made world configurable
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="C:/Users/Tom/Desktop/MC Servers/plugins/Metropolis-0.3.jar"/>
|
||||
<jar path="C:/Users/Tom/Desktop/MC Servers/plugins/Metropolis-0.4.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/Metropolis/Plugin.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class MetropolisPlugin extends JavaPlugin {
|
||||
public static final Logger log=Logger.getLogger("Minecraft");
|
||||
public static final String DEFAULT_WORLD_NAME = "world";
|
||||
|
||||
public PluginDescriptionFile pdf = null;
|
||||
public WorldGuardPlugin worldGuard = null;
|
||||
@@ -45,6 +44,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
int roadLevel = 62;
|
||||
int spaceAboveRoad = 2;
|
||||
int roadMaterial = 4;
|
||||
String worldName = "world";
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
@@ -56,6 +56,20 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
pdf = getDescription();
|
||||
|
||||
Configuration config = getConfig();
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
plotSizeX = config.getInt("plot.sizeX");
|
||||
plotSizeZ = config.getInt("plot.sizeZ");
|
||||
roadWidth = config.getInt("road.width");
|
||||
spaceAboveRoad = config.getInt("road.clearSpaceAbove");
|
||||
roadLevel = config.getInt("road.level");
|
||||
roadMaterial = config.getInt("road.material");
|
||||
worldName =config.getString("worldname");
|
||||
|
||||
saveConfig();
|
||||
|
||||
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if(plugin == null || !(plugin instanceof WorldGuardPlugin)){
|
||||
throw new RuntimeException("WorldGuard must be loaded first");
|
||||
@@ -69,7 +83,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
}
|
||||
worldEdit = (WorldEditPlugin) plugin;
|
||||
|
||||
world = getServer().getWorld(DEFAULT_WORLD_NAME);
|
||||
world = getServer().getWorld(worldName);
|
||||
|
||||
regionManager = worldGuard.getRegionManager(world);
|
||||
|
||||
@@ -101,17 +115,6 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
log.info(String.format("%s enabled", pdf.getFullName()));
|
||||
|
||||
Configuration config = getConfig();
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
plotSizeX = config.getInt("plot.sizeX");
|
||||
plotSizeZ = config.getInt("plot.sizeZ");
|
||||
roadWidth = config.getInt("road.width");
|
||||
spaceAboveRoad = config.getInt("road.clearSpaceAbove");
|
||||
roadLevel = config.getInt("road.level");
|
||||
roadMaterial = config.getInt("road.material");
|
||||
|
||||
saveConfig();
|
||||
|
||||
getCommand("metropolis-home-generate").setExecutor(new MetropolisHomeGenerateCommand(this));
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@ road:
|
||||
clearSpaceAbove: 66
|
||||
level: 62
|
||||
material: 4
|
||||
worldname: world
|
||||
|
||||
Reference in New Issue
Block a user