From 84b01a55d3ec7c134b950798e6995e33f4dc9136 Mon Sep 17 00:00:00 2001 From: FabioZumbi12 Date: Thu, 5 Mar 2015 21:57:08 -0300 Subject: [PATCH] Adapted settings to new configDB. --- src/org/jakub1221/herobrineai/AI/AICore.java | 26 +++++++++---------- src/org/jakub1221/herobrineai/AI/Message.java | 7 +++-- .../herobrineai/AI/cores/Attack.java | 8 +++--- .../jakub1221/herobrineai/AI/cores/Book.java | 4 +-- .../herobrineai/AI/cores/BuildStuff.java | 4 +-- .../herobrineai/AI/cores/DestroyTorches.java | 14 +++++----- .../herobrineai/AI/cores/Graveyard.java | 2 +- .../jakub1221/herobrineai/AI/cores/Haunt.java | 6 ++--- .../jakub1221/herobrineai/AI/cores/Heads.java | 2 +- .../herobrineai/AI/cores/Pyramid.java | 4 +-- .../herobrineai/AI/cores/RandomExplosion.java | 2 +- .../jakub1221/herobrineai/AI/cores/Signs.java | 2 +- .../herobrineai/AI/cores/SoundF.java | 2 +- .../jakub1221/herobrineai/AI/cores/Totem.java | 4 +-- src/org/jakub1221/herobrineai/Support.java | 10 +++---- .../herobrineai/commands/CmdExecutor.java | 4 +-- .../herobrineai/listeners/BlockListener.java | 2 +- .../herobrineai/listeners/EntityListener.java | 10 +++---- .../listeners/InventoryListener.java | 4 +-- .../herobrineai/listeners/WorldListener.java | 2 +- .../herobrineai/nms/NPC/entity/HumanNPC.java | 10 ++++--- 21 files changed, 67 insertions(+), 62 deletions(-) diff --git a/src/org/jakub1221/herobrineai/AI/AICore.java b/src/org/jakub1221/herobrineai/AI/AICore.java index f2e3083..ae147b2 100644 --- a/src/org/jakub1221/herobrineai/AI/AICore.java +++ b/src/org/jakub1221/herobrineai/AI/AICore.java @@ -102,7 +102,7 @@ public class AICore { public void findPlayer() { if (!AICore.isTarget) { final int att_chance = new Random().nextInt(100); - if (((att_chance - (HerobrineAI.getPluginCore().getConfigDB().showRate * 4)) < 55) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) { + if (((att_chance - (HerobrineAI.getPluginCore().getConfigDB().ShowRate * 4)) < 55) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) { final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]); final int playerRolled = Util.getRandomPlayerNum(allOnPlayers); if (allOnPlayers[playerRolled].getEntityId() != HerobrineAI.herobrineEntityID) { @@ -143,7 +143,7 @@ public class AICore { public void run() { AICore.this.findPlayer(); } - }, (6 / HerobrineAI.getPluginCore().getConfigDB().showRate) * (HerobrineAI.getPluginCore().getConfigDB().showInterval * 1L)); + }, (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate) * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L)); } } } @@ -153,7 +153,7 @@ public class AICore { final Object[] data = { AICore.PlayerTarget }; final int chance = new Random().nextInt(100); if (chance <= 5) { - if (HerobrineAI.getPluginCore().getConfigDB().useGraveyardWorld) { + if (HerobrineAI.getPluginCore().getConfigDB().UseGraveyardWorld) { AICore.log.info("[Herobrine] Teleporting " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard."); getCore(Core.CoreType.GRAVEYARD).runCore(data); } @@ -213,16 +213,16 @@ public class AICore { if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) { final int chance2 = new Random().nextInt(100); if (chance2 < 30) { - if (HerobrineAI.getPluginCore().getConfigDB().buildPyramids) { + if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids) { final Object[] data = { allOnPlayers[playerRolled] }; getCore(Core.CoreType.PYRAMID).runCore(data); } } else if (chance2 < 70) { - if (HerobrineAI.getPluginCore().getConfigDB().buryPlayers) { + if (HerobrineAI.getPluginCore().getConfigDB().BuryPlayers) { final Object[] data = { allOnPlayers[playerRolled] }; getCore(Core.CoreType.BURY_PLAYER).runCore(data); } - } else if (HerobrineAI.getPluginCore().getConfigDB().useHeads) { + } else if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) { final Object[] data = { allOnPlayers[playerRolled].getName() }; getCore(Core.CoreType.HEADS).runCore(data); } @@ -231,7 +231,7 @@ public class AICore { } private void buildCave() { - if (HerobrineAI.getPluginCore().getConfigDB().buildStuff && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) { + if (HerobrineAI.getPluginCore().getConfigDB().BuildStuff && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) { final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]); final int playerRolled = Util.getRandomPlayerNum(allOnPlayers); if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName()) && new Random().nextBoolean()) { @@ -260,11 +260,11 @@ public class AICore { if (new Random().nextInt(100) < 30) { getCore(Core.CoreType.RANDOM_SOUND).runCore(data); } else if (new Random().nextInt(100) < 60) { - if (HerobrineAI.getPluginCore().getConfigDB().burn) { + if (HerobrineAI.getPluginCore().getConfigDB().Burn) { getCore(Core.CoreType.BURN).runCore(data); } } else if (new Random().nextInt(100) < 80) { - if (HerobrineAI.getPluginCore().getConfigDB().curse) { + if (HerobrineAI.getPluginCore().getConfigDB().Curse) { getCore(Core.CoreType.CURSE).runCore(data); } } else { @@ -345,7 +345,7 @@ public class AICore { public void run() { AICore.this.buildInterval(); } - }, 1L * HerobrineAI.getPluginCore().getConfigDB().buildInterval, 1L * HerobrineAI.getPluginCore().getConfigDB().buildInterval); + }, 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval, 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval); } public void startMAIN() { @@ -358,8 +358,8 @@ public class AICore { public void run() { AICore.this.findPlayer(); } - }, (6 / HerobrineAI.getPluginCore().getConfigDB().showRate) * (HerobrineAI.getPluginCore().getConfigDB().showInterval * 1L), - (6 / HerobrineAI.getPluginCore().getConfigDB().showRate) * (HerobrineAI.getPluginCore().getConfigDB().showInterval * 1L)); + }, (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate) * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L), + (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate) * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L)); } @@ -370,7 +370,7 @@ public class AICore { public void run() { AICore.this.randomCoreINT(); } - }, HerobrineAI.getPluginCore().getConfigDB().showInterval / 2L, HerobrineAI.getPluginCore().getConfigDB().showInterval / 2L); + }, HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 2L, HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 2L); } public void stopBD() { diff --git a/src/org/jakub1221/herobrineai/AI/Message.java b/src/org/jakub1221/herobrineai/AI/Message.java index 935c709..8591df7 100644 --- a/src/org/jakub1221/herobrineai/AI/Message.java +++ b/src/org/jakub1221/herobrineai/AI/Message.java @@ -8,9 +8,12 @@ import org.jakub1221.herobrineai.HerobrineAI; public class Message { public static void sendMessage(final Player player) { - if (HerobrineAI.getPluginCore().getConfigDB().sendMessages) { - final int count = HerobrineAI.getPluginCore().getConfigDB().useMessages.size(); + if (HerobrineAI.getPluginCore().getConfigDB().SendMessages) { + int count = HerobrineAI.getPluginCore().getConfigDB().useMessages.size(); final Random randgen = new Random(); + if (count == 0 || count < 0){ + count = 0; + } final int randmsg = randgen.nextInt(count); player.sendMessage(" " + HerobrineAI.getPluginCore().getConfigDB().useMessages.get(randmsg)); } diff --git a/src/org/jakub1221/herobrineai/AI/cores/Attack.java b/src/org/jakub1221/herobrineai/AI/cores/Attack.java index e7142a9..f400e4f 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Attack.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Attack.java @@ -44,7 +44,7 @@ public class Attack extends Core { final Location ploc = AICore.PlayerTarget.getLocation(); final Object[] data = { ploc }; HerobrineAI.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).runCore(data); - if (HerobrineAI.getPluginCore().getConfigDB().usePotionEffects) { + if (HerobrineAI.getPluginCore().getConfigDB().UsePotionEffects) { AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1)); AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1)); AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1)); @@ -95,7 +95,7 @@ public class Attack extends Core { final Location ploc = AICore.PlayerTarget.getLocation(); ploc.setY(ploc.getY() + 1.5); HerobrineAI.herobrineNPC.lookAtPoint(ploc); - if (HerobrineAI.getPluginCore().getConfigDB().lighting) { + if (HerobrineAI.getPluginCore().getConfigDB().Lighting) { final int lchance = new Random().nextInt(100); if (lchance > 75) { final Location newloc = ploc; @@ -134,7 +134,7 @@ public class Attack extends Core { ploc.setY(ploc.getY() + 1.5); HerobrineAI.herobrineNPC.lookAtPoint(ploc); AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.WITHER_HURT, 0.75f, 0.75f); - if (HerobrineAI.getPluginCore().getConfigDB().hitPlayer) { + if (HerobrineAI.getPluginCore().getConfigDB().HitPlayer) { final int hitchance = new Random().nextInt(100); if (hitchance < 55) { AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.HURT_FLESH, 0.75f, 0.75f); @@ -193,7 +193,7 @@ public class Attack extends Core { ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80); ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80); ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80); - if (HerobrineAI.getPluginCore().getConfigDB().spawnBats) { + if (HerobrineAI.getPluginCore().getConfigDB().SpawnBats) { final int cc = new Random().nextInt(3); if (cc == 0) { ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT); diff --git a/src/org/jakub1221/herobrineai/AI/cores/Book.java b/src/org/jakub1221/herobrineai/AI/cores/Book.java index 7d9be67..7573b4c 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Book.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Book.java @@ -22,11 +22,11 @@ public class Book extends Core { public CoreResult callCore(final Object[] data) { final Player player = (Player) data[0]; if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) { - if (!HerobrineAI.getPluginCore().getConfigDB().writeBooks || !HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())) { + if (!HerobrineAI.getPluginCore().getConfigDB().WriteBooks || !HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())) { return new CoreResult(false, player.getDisplayName() + " is in a world that Herobrine cannot haunt."); } final int chance = new Random().nextInt(100); - if (chance <= (100 - HerobrineAI.getPluginCore().getConfigDB().bookChance)) { + if (chance <= (100 - HerobrineAI.getPluginCore().getConfigDB().BookChance)) { return new CoreResult(false, "Herobrine books are prohibited."); } final Inventory chest = (Inventory) data[1]; diff --git a/src/org/jakub1221/herobrineai/AI/cores/BuildStuff.java b/src/org/jakub1221/herobrineai/AI/cores/BuildStuff.java index 96cf2cd..7b923ff 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/BuildStuff.java +++ b/src/org/jakub1221/herobrineai/AI/cores/BuildStuff.java @@ -27,7 +27,7 @@ public class BuildStuff extends Core { } public CoreResult BuildCave(final Location loc) { - if (!HerobrineAI.getPluginCore().getConfigDB().buildStuff) { + if (!HerobrineAI.getPluginCore().getConfigDB().BuildStuff) { return new CoreResult(false, "A cave cannot be created here because it is a protected area."); } if (!HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) { @@ -37,7 +37,7 @@ public class BuildStuff extends Core { return new CoreResult(false, "Caves can only be generated in locations where the Y coordinate is less than or equal to 60."); } final int chance = new Random().nextInt(100); - if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().caveChance)) { + if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().CaveChance)) { AICore.log.info("Creating cave..."); GenerateCave(loc); return new CoreResult(false, "Cave created."); diff --git a/src/org/jakub1221/herobrineai/AI/cores/DestroyTorches.java b/src/org/jakub1221/herobrineai/AI/cores/DestroyTorches.java index a74d4ff..3251480 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/DestroyTorches.java +++ b/src/org/jakub1221/herobrineai/AI/cores/DestroyTorches.java @@ -19,17 +19,17 @@ public class DestroyTorches extends Core { } public CoreResult destroyTorches(final Location loc) { - if (HerobrineAI.getPluginCore().getConfigDB().destroyTorches) { + if (HerobrineAI.getPluginCore().getConfigDB().DestroyTorches) { final int x = loc.getBlockX(); final int y = loc.getBlockY(); final int z = loc.getBlockZ(); final World world = loc.getWorld(); - int i = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; - int ii = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; - int iii = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; - for (i = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; i <= HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; ++i) { - for (ii = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; ii <= HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; ++ii) { - for (iii = -HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; iii <= HerobrineAI.getPluginCore().getConfigDB().destroyTorchesRadius; ++iii) { + int i = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; + int ii = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; + int iii = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; + for (i = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; i <= HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; ++i) { + for (ii = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; ii <= HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; ++ii) { + for (iii = -HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; iii <= HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius; ++iii) { if (world.getBlockAt(x + ii, y + i, z + iii).getType() == Material.TORCH) { world.getBlockAt(x + ii, y + i, z + iii).breakNaturally(); return new CoreResult(true, "Torches successfully destroyed by Herobrine."); diff --git a/src/org/jakub1221/herobrineai/AI/cores/Graveyard.java b/src/org/jakub1221/herobrineai/AI/cores/Graveyard.java index 8601098..1c5f550 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Graveyard.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Graveyard.java @@ -39,7 +39,7 @@ public class Graveyard extends Core { } public CoreResult Teleport(final Player player) { - if (!HerobrineAI.getPluginCore().getConfigDB().useGraveyardWorld) { + if (!HerobrineAI.getPluginCore().getConfigDB().UseGraveyardWorld) { return new CoreResult(false, "Herobrine's Graveyard is disabled on this server."); } LivingEntities = Bukkit.getServer().getWorld("world_herobrine_graveyard").getLivingEntities(); diff --git a/src/org/jakub1221/herobrineai/AI/cores/Haunt.java b/src/org/jakub1221/herobrineai/AI/cores/Haunt.java index bdf7c79..1f500f8 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Haunt.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Haunt.java @@ -73,18 +73,18 @@ public class Haunt extends Core { final int randx = randxgen.nextInt(100); if (randx >= 70) { if ((randx < 80) && (spawnedBats < 2)) { - if (HerobrineAI.getPluginCore().getConfigDB().spawnBats) { + if (HerobrineAI.getPluginCore().getConfigDB().SpawnBats) { ploc.getWorld().spawnEntity(ploc, EntityType.BAT); ++spawnedBats; } - } else if ((randx < 90) && (spawnedWolves < 1) && HerobrineAI.getPluginCore().getConfigDB().spawnWolves) { + } else if ((randx < 90) && (spawnedWolves < 1) && HerobrineAI.getPluginCore().getConfigDB().SpawnWolves) { final Wolf wolf = (Wolf) ploc.getWorld().spawnEntity(ploc, EntityType.WOLF); wolf.setAdult(); wolf.setAngry(true); ++spawnedWolves; } } - if (HerobrineAI.getPluginCore().getConfigDB().lighting) { + if (HerobrineAI.getPluginCore().getConfigDB().Lighting) { final int lchance = new Random().nextInt(100); if (lchance > 75) { final Location newloc = ploc; diff --git a/src/org/jakub1221/herobrineai/AI/cores/Heads.java b/src/org/jakub1221/herobrineai/AI/cores/Heads.java index 4bf206a..d7ac601 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Heads.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Heads.java @@ -38,7 +38,7 @@ public class Heads extends Core { if (!HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())) { return new CoreResult(false, player.getDisplayName() + " cannot be haunted by heads because they are in a protected area."); } - if (HerobrineAI.getPluginCore().getConfigDB().useHeads) { + if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) { final Location loc = player.getLocation(); final int px = loc.getBlockX(); final int pz = loc.getBlockZ(); diff --git a/src/org/jakub1221/herobrineai/AI/cores/Pyramid.java b/src/org/jakub1221/herobrineai/AI/cores/Pyramid.java index dafc2b7..37c7bc6 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Pyramid.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Pyramid.java @@ -27,7 +27,7 @@ public class Pyramid extends Core { } public CoreResult FindPlace(final Chunk chunk) { - if (HerobrineAI.getPluginCore().getConfigDB().buildPyramids) { + if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids) { Location loc = chunk.getBlock(2, 0, 2).getLocation(); loc = loc.getWorld().getHighestBlockAt(loc).getLocation(); boolean canBuild = true; @@ -65,7 +65,7 @@ public class Pyramid extends Core { } public CoreResult FindPlace(final Player player) { - if (HerobrineAI.getPluginCore().getConfigDB().buildPyramids) { + if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids) { final Location loc = player.getLocation(); boolean canBuild = true; int i1 = 0; diff --git a/src/org/jakub1221/herobrineai/AI/cores/RandomExplosion.java b/src/org/jakub1221/herobrineai/AI/cores/RandomExplosion.java index 3686311..96c36d3 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/RandomExplosion.java +++ b/src/org/jakub1221/herobrineai/AI/cores/RandomExplosion.java @@ -17,7 +17,7 @@ public class RandomExplosion extends Core { @Override public CoreResult callCore(final Object[] data) { final Player player = (Player) data[0]; - if (!HerobrineAI.getPluginCore().getConfigDB().explosions) { + if (!HerobrineAI.getPluginCore().getConfigDB().Explosions) { return new CoreResult(true, "Herobrine-caused explosions are disabled on this server."); } if (HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())) { diff --git a/src/org/jakub1221/herobrineai/AI/cores/Signs.java b/src/org/jakub1221/herobrineai/AI/cores/Signs.java index fee81bf..5e2bf97 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Signs.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Signs.java @@ -57,7 +57,7 @@ public class Signs extends Core { public void createSign(final Location loc, final Location ploc) { final Random randcgen = new Random(); final int chance = randcgen.nextInt(100); - if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().signChance)) { + if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().SignChance)) { final Random randgen = new Random(); final int count = HerobrineAI.getPluginCore().getConfigDB().useSignMessages.size(); final int randmsg = randgen.nextInt(count); diff --git a/src/org/jakub1221/herobrineai/AI/cores/SoundF.java b/src/org/jakub1221/herobrineai/AI/cores/SoundF.java index d8d288f..85f17d7 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/SoundF.java +++ b/src/org/jakub1221/herobrineai/AI/cores/SoundF.java @@ -20,7 +20,7 @@ public class SoundF extends Core { } public CoreResult playRandom(final Player player) { - if (!HerobrineAI.getPluginCore().getConfigDB().useSound) { + if (!HerobrineAI.getPluginCore().getConfigDB().UseSound) { return new CoreResult(false, "Herobrine-caused sound is disabled on this server."); } final Sound[] sounds = { Sound.STEP_STONE, Sound.STEP_WOOD, Sound.STEP_GRASS, Sound.STEP_SAND, Sound.STEP_GRAVEL, Sound.WITHER_HURT, Sound.WITHER_HURT, Sound.WITHER_HURT, Sound.WITHER_HURT, diff --git a/src/org/jakub1221/herobrineai/AI/cores/Totem.java b/src/org/jakub1221/herobrineai/AI/cores/Totem.java index 4af2a15..3ec16c6 100644 --- a/src/org/jakub1221/herobrineai/AI/cores/Totem.java +++ b/src/org/jakub1221/herobrineai/AI/cores/Totem.java @@ -26,7 +26,7 @@ public class Totem extends Core { public CoreResult TotemCall(final Location loc, final String caller) { AICore.isTotemCalled = false; loc.getWorld().strikeLightning(loc); - if (HerobrineAI.getPluginCore().getConfigDB().totemExplodes) { + if (HerobrineAI.getPluginCore().getConfigDB().TotemExplodes) { loc.getWorld().createExplosion(loc, 5.0f); } if (Bukkit.getServer().getPlayer(caller) != null) { @@ -44,7 +44,7 @@ public class Totem extends Core { ((ploc.getZ() - 10.0) < loc.getZ()) ) { Message.sendMessage(oplayer); - if (HerobrineAI.getPluginCore().getConfigDB().usePotionEffects) { + if (HerobrineAI.getPluginCore().getConfigDB().UsePotionEffects) { oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1)); oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1)); oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1)); diff --git a/src/org/jakub1221/herobrineai/Support.java b/src/org/jakub1221/herobrineai/Support.java index 87855f1..3c22571 100644 --- a/src/org/jakub1221/herobrineai/Support.java +++ b/src/org/jakub1221/herobrineai/Support.java @@ -109,23 +109,23 @@ public class Support { } public boolean checkBuild(final Location loc) { - return HerobrineAI.getPluginCore().getConfigDB().securedAreaBuild || !isSecuredArea(loc); + return HerobrineAI.getPluginCore().getConfigDB().SecuredArea_Build || !isSecuredArea(loc); } public boolean checkAttack(final Location loc) { - return HerobrineAI.getPluginCore().getConfigDB().securedAreaAttack || !isSecuredArea(loc); + return HerobrineAI.getPluginCore().getConfigDB().SecuredArea_Attack || !isSecuredArea(loc); } public boolean checkHaunt(final Location loc) { - return HerobrineAI.getPluginCore().getConfigDB().securedAreaHaunt || !isSecuredArea(loc); + return HerobrineAI.getPluginCore().getConfigDB().SecuredArea_Haunt || !isSecuredArea(loc); } public boolean checkSigns(final Location loc) { - return HerobrineAI.getPluginCore().getConfigDB().securedAreaSigns || !isSecuredArea(loc); + return HerobrineAI.getPluginCore().getConfigDB().SecuredArea_Signs || !isSecuredArea(loc); } public boolean checkBooks(final Location loc) { - return HerobrineAI.getPluginCore().getConfigDB().securedAreaBooks || !isSecuredArea(loc); + return HerobrineAI.getPluginCore().getConfigDB().SecuredArea_Books || !isSecuredArea(loc); } } \ No newline at end of file diff --git a/src/org/jakub1221/herobrineai/commands/CmdExecutor.java b/src/org/jakub1221/herobrineai/commands/CmdExecutor.java index c292d1d..81e430c 100644 --- a/src/org/jakub1221/herobrineai/commands/CmdExecutor.java +++ b/src/org/jakub1221/herobrineai/commands/CmdExecutor.java @@ -271,7 +271,7 @@ public class CmdExecutor implements CommandExecutor { } } else if (args[0].equalsIgnoreCase("reload")) { if (player.hasPermission("herobrine.reload")) { - P_Core.getConfigDB().reload(); + P_Core.getConfigDB().Reload(); player.sendMessage(ChatColor.RED + "[Herobrine] Herobrine configuration file reloaded."); } else { player.sendMessage(ChatColor.RED + "You do not have the necessary permissions to reload Herobrine's " + @@ -487,7 +487,7 @@ public class CmdExecutor implements CommandExecutor { P_Core.getAICore().cancelTarget(Core.CoreType.ANY); log.info(ChatColor.RED + "[Herobrine] The current Herobrine victim has been saved."); } else if (args[0].equalsIgnoreCase("reload")) { - P_Core.getConfigDB().reload(); + P_Core.getConfigDB().Reload(); log.info("[Herobrine] Herobrine configuration file reloaded."); } else if (args[0].equalsIgnoreCase("help")) { log.info("[Herobrine] Command List"); diff --git a/src/org/jakub1221/herobrineai/listeners/BlockListener.java b/src/org/jakub1221/herobrineai/listeners/BlockListener.java index 30f8821..91b68ff 100644 --- a/src/org/jakub1221/herobrineai/listeners/BlockListener.java +++ b/src/org/jakub1221/herobrineai/listeners/BlockListener.java @@ -39,7 +39,7 @@ public class BlockListener implements Listener { && (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() - 1).getType() == Material.REDSTONE_TORCH_ON) && (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON) && (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON) - && HerobrineAI.getPluginCore().getConfigDB().useTotem && !AICore.isTotemCalled) { + && HerobrineAI.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) { HerobrineAI.getPluginCore().getAICore().playerCallTotem(event.getPlayer()); } } diff --git a/src/org/jakub1221/herobrineai/listeners/EntityListener.java b/src/org/jakub1221/herobrineai/listeners/EntityListener.java index 9f92656..742273e 100644 --- a/src/org/jakub1221/herobrineai/listeners/EntityListener.java +++ b/src/org/jakub1221/herobrineai/listeners/EntityListener.java @@ -34,13 +34,13 @@ public class EntityListener implements Listener { return; } if (creatureType == EntityType.ZOMBIE) { - if (HerobrineAI.getPluginCore().getConfigDB().useNPCWarrior && (new Random().nextInt(100) < HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance")) + if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Warrior && (new Random().nextInt(100) < HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance")) && !HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) { final LivingEntity ent = (LivingEntity) entity; ent.setHealth(0); HerobrineAI.getPluginCore().getEntityManager().spawnCustomZombie(event.getLocation(), MobType.HEROBRINE_WARRIOR); } - } else if ((creatureType == EntityType.SKELETON) && HerobrineAI.getPluginCore().getConfigDB().useNPCDemon + } else if ((creatureType == EntityType.SKELETON) && HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon && (new Random().nextInt(100) < HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.SpawnChance")) && !HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) { final LivingEntity ent = (LivingEntity) entity; @@ -81,7 +81,7 @@ public class EntityListener implements Listener { if (event.getEntity().getEntityId() == HerobrineAI.herobrineEntityID) { if (event instanceof EntityDamageByEntityEvent) { final EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent) event; - if (HerobrineAI.getPluginCore().getConfigDB().killable && (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() != Core.CoreType.GRAVEYARD)) { + if (HerobrineAI.getPluginCore().getConfigDB().Killable && (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() != Core.CoreType.GRAVEYARD)) { if (dEvent.getDamager() instanceof Player) { if (event.getDamage() >= HerobrineAI.HerobrineHP) { int i; @@ -102,7 +102,7 @@ public class EntityListener implements Listener { HerobrineAI.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY); HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP; final Player player = (Player) dEvent.getDamager(); - player.sendMessage(" " + HerobrineAI.getPluginCore().getConfigDB().deathMessage); + player.sendMessage(" " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage); } else { HerobrineAI.HerobrineHP -= (int) event.getDamage(); HerobrineAI.herobrineNPC.hurtAnimation(); @@ -134,7 +134,7 @@ public class EntityListener implements Listener { HerobrineAI.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY); HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP; final Player player2 = (Player) arrow.getShooter(); - player2.sendMessage(" " + HerobrineAI.getPluginCore().getConfigDB().deathMessage); + player2.sendMessage(" " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage); } else { HerobrineAI.HerobrineHP -= (int) event.getDamage(); HerobrineAI.herobrineNPC.hurtAnimation(); diff --git a/src/org/jakub1221/herobrineai/listeners/InventoryListener.java b/src/org/jakub1221/herobrineai/listeners/InventoryListener.java index 680c7ce..400ddc5 100644 --- a/src/org/jakub1221/herobrineai/listeners/InventoryListener.java +++ b/src/org/jakub1221/herobrineai/listeners/InventoryListener.java @@ -25,7 +25,7 @@ public class InventoryListener implements Listener { if (event.getInventory().getType() == InventoryType.CHEST) { final Object[] data = { event.getPlayer(), event.getInventory() }; HerobrineAI.getPluginCore().getAICore().getCore(Core.CoreType.BOOK).runCore(data); - if ((new Random().nextInt(100) > 97) && HerobrineAI.getPluginCore().getConfigDB().useHeads && (event.getInventory().firstEmpty() != -1) + if ((new Random().nextInt(100) > 97) && HerobrineAI.getPluginCore().getConfigDB().UseHeads && (event.getInventory().firstEmpty() != -1) && HerobrineAI.getPluginCore().getAICore().getResetLimits().isHead()) { event.getInventory().setItem(event.getInventory().firstEmpty(), ItemName.CreateSkull(event.getPlayer().getName())); } @@ -35,7 +35,7 @@ public class InventoryListener implements Listener { @EventHandler public void onInventoryOpen(final InventoryOpenEvent event) { if (((event.getInventory().getType() == InventoryType.CHEST) || (event.getInventory().getType() == InventoryType.FURNACE) || (event.getInventory().getType() == InventoryType.WORKBENCH)) - && HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) && HerobrineAI.getPluginCore().getConfigDB().placeSigns + && HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) && HerobrineAI.getPluginCore().getConfigDB().PlaceSigns && HerobrineAI.getPluginCore().getSupport().checkSigns(event.getPlayer().getLocation()) && HerobrineAI.getPluginCore().getAICore().getResetLimits().isSign()) { final Object[] data = { event.getPlayer().getLocation(), event.getPlayer().getLocation() }; HerobrineAI.getPluginCore().getAICore().getCore(Core.CoreType.SIGNS).runCore(data); diff --git a/src/org/jakub1221/herobrineai/listeners/WorldListener.java b/src/org/jakub1221/herobrineai/listeners/WorldListener.java index d6a9552..10cffb7 100644 --- a/src/org/jakub1221/herobrineai/listeners/WorldListener.java +++ b/src/org/jakub1221/herobrineai/listeners/WorldListener.java @@ -16,7 +16,7 @@ public class WorldListener implements Listener { if (event.isNewChunk()) { final World world = event.getWorld(); if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(world.getName())) { - if (HerobrineAI.getPluginCore().getConfigDB().buildPyramids && (new Random().nextInt(15) == 1)) { + if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids && (new Random().nextInt(15) == 1)) { final Object[] data = { event.getChunk() }; HerobrineAI.getPluginCore().getAICore().getCore(Core.CoreType.PYRAMID).runCore(data); } diff --git a/src/org/jakub1221/herobrineai/nms/NPC/entity/HumanNPC.java b/src/org/jakub1221/herobrineai/nms/NPC/entity/HumanNPC.java index 9e6c50e..9d51a36 100644 --- a/src/org/jakub1221/herobrineai/nms/NPC/entity/HumanNPC.java +++ b/src/org/jakub1221/herobrineai/nms/NPC/entity/HumanNPC.java @@ -89,10 +89,12 @@ public class HumanNPC { if (zDiff < 0.0) { newYaw += Math.abs(180.0 - newYaw) * 2.0; } - ((EntityPlayer) getNMSEntity()).yaw = (float) (newYaw - 90.0); - ((EntityPlayer) getNMSEntity()).pitch = (float) newPitch; - ((EntityPlayer) getNMSEntity()).aJ = (float) (newYaw - 90.0); - ((EntityPlayer) getNMSEntity()).aI = (float) (newYaw - 90.0); + if (newYaw > 0.0D || newYaw < 180.0D){ + ((EntityPlayer) getNMSEntity()).yaw = (float) (newYaw - 90.0); + ((EntityPlayer) getNMSEntity()).pitch = (float) newPitch; + ((EntityPlayer) getNMSEntity()).aJ = (float) (newYaw - 90.0); + ((EntityPlayer) getNMSEntity()).aI = (float) (newYaw - 90.0); + } } public org.bukkit.entity.Entity getBukkitEntity() {