001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.core.generator; 020 021import com.plotsquared.core.configuration.ConfigurationSection; 022import com.plotsquared.core.configuration.Settings; 023import com.plotsquared.core.configuration.file.YamlConfiguration; 024import com.plotsquared.core.inject.annotations.WorldConfig; 025import com.plotsquared.core.plot.PlotId; 026import com.plotsquared.core.queue.GlobalBlockQueue; 027import org.apache.logging.log4j.LogManager; 028import org.apache.logging.log4j.Logger; 029import org.checkerframework.checker.nullness.qual.NonNull; 030import org.checkerframework.checker.nullness.qual.Nullable; 031 032public abstract class SquarePlotWorld extends GridPlotWorld { 033 034 private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SquarePlotWorld.class.getSimpleName()); 035 036 public int PLOT_WIDTH = 42; 037 public int ROAD_WIDTH = 7; 038 public int ROAD_OFFSET_X = 0; 039 public int ROAD_OFFSET_Z = 0; 040 041 public SquarePlotWorld( 042 final String worldName, 043 final @Nullable String id, 044 final @NonNull IndependentPlotGenerator generator, 045 final @Nullable PlotId min, 046 final @Nullable PlotId max, 047 @WorldConfig final @NonNull YamlConfiguration worldConfiguration, 048 final @NonNull GlobalBlockQueue blockQueue 049 ) { 050 super(worldName, id, generator, min, max, worldConfiguration, blockQueue); 051 } 052 053 @Override 054 public void loadConfiguration(ConfigurationSection config) { 055 if (!config.contains("plot.height")) { 056 if (Settings.DEBUG) { 057 LOGGER.info("- Configuration is null? ({})", config.getCurrentPath()); 058 } 059 060 } 061 this.PLOT_WIDTH = config.getInt("plot.size"); 062 this.ROAD_WIDTH = config.getInt("road.width"); 063 this.ROAD_OFFSET_X = config.getInt("road.offset.x"); 064 this.ROAD_OFFSET_Z = config.getInt("road.offset.z"); 065 this.SIZE = (short) (this.PLOT_WIDTH + this.ROAD_WIDTH); 066 } 067 068}