Added two new configuration options, "BuildPyramidOnChunkPercentage" and "BuildTempleOnChunkPercentage" that will allow server administrators to control the chance of a pyramid or temple spawning when a chunk is loaded

This commit is contained in:
David Berdik 2016-01-14 23:34:01 -05:00
parent f3e65a286e
commit e638588df3
2 changed files with 14 additions and 2 deletions

View File

@ -47,6 +47,7 @@ public class ConfigDB
public List<String> useSignMessages = new ArrayList<String>(); public List<String> useSignMessages = new ArrayList<String>();
public List<String> useBookMessages = new ArrayList<String>(); public List<String> useBookMessages = new ArrayList<String>();
public boolean BuildPyramids = true; public boolean BuildPyramids = true;
public int BuildPyramidOnChunkPercentage = 5;
public boolean UseGraveyardWorld = true; public boolean UseGraveyardWorld = true;
public boolean BuryPlayers = true; public boolean BuryPlayers = true;
public boolean SpawnWolves = true; public boolean SpawnWolves = true;
@ -54,6 +55,7 @@ public class ConfigDB
public int WalkingModeXRadius = 1000; public int WalkingModeXRadius = 1000;
public int WalkingModeZRadius = 1000; public int WalkingModeZRadius = 1000;
public boolean BuildTemples = true; public boolean BuildTemples = true;
public int BuildTempleOnChunkPercentage = 5;
public boolean UseArtifactBow = true; public boolean UseArtifactBow = true;
public boolean UseArtifactSword = true; public boolean UseArtifactSword = true;
public boolean UseArtifactApple = true; public boolean UseArtifactApple = true;
@ -87,6 +89,7 @@ public class ConfigDB
public boolean UseSound = true; public boolean UseSound = true;
public boolean ShowInTabList = false; public boolean ShowInTabList = false;
public boolean CheckForUpdates = true; public boolean CheckForUpdates = true;
private boolean isStartupDone = false; private boolean isStartupDone = false;
private String pluginVersionNumber = Bukkit.getServer().getPluginManager().getPlugin("Herobrine"). private String pluginVersionNumber = Bukkit.getServer().getPluginManager().getPlugin("Herobrine").
getDescription().getVersion(); getDescription().getVersion();
@ -223,6 +226,7 @@ public class ConfigDB
this.config.set("config.Drops.264.count", Integer.valueOf(1)); this.config.set("config.Drops.264.count", Integer.valueOf(1));
this.config.set("config.Drops.264.chance", Integer.valueOf(20)); this.config.set("config.Drops.264.chance", Integer.valueOf(20));
this.config.set("config.BuildPyramids", Boolean.valueOf(true)); this.config.set("config.BuildPyramids", Boolean.valueOf(true));
this.config.set("config.BuildPyramidOnChunkPercentage", Integer.valueOf(5));
this.config.set("config.UseGraveyardWorld", Boolean.valueOf(true)); this.config.set("config.UseGraveyardWorld", Boolean.valueOf(true));
this.config.set("config.BuryPlayers", Boolean.valueOf(true)); this.config.set("config.BuryPlayers", Boolean.valueOf(true));
this.config.set("config.SpawnWolves", Boolean.valueOf(true)); this.config.set("config.SpawnWolves", Boolean.valueOf(true));
@ -231,6 +235,7 @@ public class ConfigDB
this.config.set("config.WalkingModeRadius.Z", Integer.valueOf(1000)); this.config.set("config.WalkingModeRadius.Z", Integer.valueOf(1000));
this.config.set("config.BuildInterval", Integer.valueOf(72000)); this.config.set("config.BuildInterval", Integer.valueOf(72000));
this.config.set("config.BuildTemples", Boolean.valueOf(true)); this.config.set("config.BuildTemples", Boolean.valueOf(true));
this.config.set("config.BuildTempleOnChunkPercentage", Integer.valueOf(5));
this.config.set("config.UseArtifacts.Bow", Boolean.valueOf(true)); this.config.set("config.UseArtifacts.Bow", Boolean.valueOf(true));
this.config.set("config.UseArtifacts.Sword", Boolean.valueOf(true)); this.config.set("config.UseArtifacts.Sword", Boolean.valueOf(true));
this.config.set("config.UseArtifacts.Apple", Boolean.valueOf(true)); this.config.set("config.UseArtifacts.Apple", Boolean.valueOf(true));
@ -548,6 +553,8 @@ public class ConfigDB
this.config.set("config.UseWalkingMode", null); this.config.set("config.UseWalkingMode", null);
this.config.set("config.WalkingModeRadius.FromX", null); this.config.set("config.WalkingModeRadius.FromX", null);
this.config.set("config.WalkingModeRadius.FromZ", null); this.config.set("config.WalkingModeRadius.FromZ", null);
this.config.set("config.BuildPyramidOnChunkPercentage", Integer.valueOf(5));
this.config.set("config.BuildTempleOnChunkPercentage", Integer.valueOf(5));
} }
if (hasUpdated) if (hasUpdated)
{ {
@ -612,6 +619,7 @@ public class ConfigDB
this.useSignMessages = this.config.getStringList("config.SignMessages"); this.useSignMessages = this.config.getStringList("config.SignMessages");
this.useBookMessages = this.config.getStringList("config.BookMessages"); this.useBookMessages = this.config.getStringList("config.BookMessages");
this.BuildPyramids = this.config.getBoolean("config.BuildPyramids"); this.BuildPyramids = this.config.getBoolean("config.BuildPyramids");
this.BuildPyramidOnChunkPercentage = this.config.getInt("config.BuildPyramidOnChunkPercentage");
this.UseGraveyardWorld = this.config.getBoolean("config.UseGraveyardWorld"); this.UseGraveyardWorld = this.config.getBoolean("config.UseGraveyardWorld");
this.BuryPlayers = this.config.getBoolean("config.BuryPlayers"); this.BuryPlayers = this.config.getBoolean("config.BuryPlayers");
this.SpawnWolves = this.config.getBoolean("config.SpawnWolves"); this.SpawnWolves = this.config.getBoolean("config.SpawnWolves");
@ -620,6 +628,7 @@ public class ConfigDB
this.WalkingModeZRadius = this.config.getInt("config.WalkingModeRadius.Z"); this.WalkingModeZRadius = this.config.getInt("config.WalkingModeRadius.Z");
this.BuildInterval = this.config.getInt("config.BuildInterval"); this.BuildInterval = this.config.getInt("config.BuildInterval");
this.BuildTemples = this.config.getBoolean("config.BuildTemples"); this.BuildTemples = this.config.getBoolean("config.BuildTemples");
this.BuildTempleOnChunkPercentage = this.config.getInt("config.BuildTempleOnChunkPercentage");
this.UseArtifactBow = this.config.getBoolean("config.UseArtifacts.Bow"); this.UseArtifactBow = this.config.getBoolean("config.UseArtifacts.Bow");
this.UseArtifactSword = this.config.getBoolean("config.UseArtifacts.Sword"); this.UseArtifactSword = this.config.getBoolean("config.UseArtifacts.Sword");
this.UseArtifactApple = this.config.getBoolean("config.UseArtifacts.Apple"); this.UseArtifactApple = this.config.getBoolean("config.UseArtifacts.Apple");

View File

@ -18,11 +18,14 @@ public class WorldListener implements Listener {
final World world = event.getWorld(); final World world = event.getWorld();
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(world.getName())) { if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(world.getName())) {
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids && (new Random().nextInt(15) == 1)) { int pyramidChance = Herobrine.getPluginCore().getConfigDB().BuildPyramidOnChunkPercentage;
int templeChance = Herobrine.getPluginCore().getConfigDB().BuildTempleOnChunkPercentage;
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids && (new Random().nextInt(100) + 1 <= pyramidChance)) {
final Object[] data = { event.getChunk() }; final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.PYRAMID).runCore(data); Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.PYRAMID).runCore(data);
} }
if (Herobrine.getPluginCore().getConfigDB().BuildTemples && (new Random().nextInt(20) == 1)) { if (Herobrine.getPluginCore().getConfigDB().BuildTemples && (new Random().nextInt(100) + 1 <= templeChance)) {
final Object[] data = { event.getChunk() }; final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.TEMPLE).runCore(data); Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.TEMPLE).runCore(data);
} }