Merge pull request #27 from Badbird-5907/world

Don't check if the world is the nether by name
This commit is contained in:
Chris
2021-08-31 11:12:30 -05:00
committed by GitHub

View File

@@ -297,7 +297,7 @@ public class LegacyAgent extends Agent {
Material itemType; Material itemType;
if (bot.getBukkitEntity().getWorld().getName().equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() == World.Environment.NETHER) {
itemType = Material.TWISTING_VINES; itemType = Material.TWISTING_VINES;
} else { } else {
itemType = Material.WATER_BUCKET; itemType = Material.WATER_BUCKET;
@@ -339,7 +339,7 @@ public class LegacyAgent extends Agent {
Material placeType; Material placeType;
Sound sound; Sound sound;
if (world.getName().equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() == World.Environment.NETHER) {
itemType = Material.TWISTING_VINES; itemType = Material.TWISTING_VINES;
sound = Sound.BLOCK_WEEPING_VINES_PLACE; sound = Sound.BLOCK_WEEPING_VINES_PLACE;
placeType = itemType; placeType = itemType;
@@ -934,7 +934,7 @@ public class LegacyAgent extends Agent {
Location loc = bot.getLocation(); Location loc = bot.getLocation();
if (bot.isOnFire()) { if (bot.isOnFire()) {
if (!worldName.equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() != World.Environment.NETHER) {
placeWaterDown(bot, world, loc); placeWaterDown(bot, world, loc);
} }
} }
@@ -942,7 +942,7 @@ public class LegacyAgent extends Agent {
Material atType = loc.getBlock().getType(); Material atType = loc.getBlock().getType();
if (atType == Material.FIRE || atType == Material.SOUL_FIRE) { if (atType == Material.FIRE || atType == Material.SOUL_FIRE) {
if (!worldName.equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() != World.Environment.NETHER) {
placeWaterDown(bot, world, loc); placeWaterDown(bot, world, loc);
world.playSound(loc, Sound.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); world.playSound(loc, Sound.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1);
} else { } else {
@@ -954,7 +954,7 @@ public class LegacyAgent extends Agent {
} }
if (atType == Material.LAVA) { if (atType == Material.LAVA) {
if (worldName.equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() == World.Environment.NETHER) {
bot.attemptBlockPlace(loc, Material.COBBLESTONE, false); bot.attemptBlockPlace(loc, Material.COBBLESTONE, false);
} else { } else {
placeWaterDown(bot, world, loc); placeWaterDown(bot, world, loc);
@@ -965,7 +965,7 @@ public class LegacyAgent extends Agent {
Material headType = head.getBlock().getType(); Material headType = head.getBlock().getType();
if (headType == Material.LAVA) { if (headType == Material.LAVA) {
if (worldName.equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() == World.Environment.NETHER) {
bot.attemptBlockPlace(head, Material.COBBLESTONE, false); bot.attemptBlockPlace(head, Material.COBBLESTONE, false);
} else { } else {
placeWaterDown(bot, world, head); placeWaterDown(bot, world, head);
@@ -973,7 +973,7 @@ public class LegacyAgent extends Agent {
} }
if (headType == Material.FIRE || headType == Material.SOUL_FIRE) { if (headType == Material.FIRE || headType == Material.SOUL_FIRE) {
if (worldName.equals("world_nether")) { if (bot.getBukkitEntity().getWorld().getEnvironment() == World.Environment.NETHER) {
bot.look(BlockFace.DOWN); bot.look(BlockFace.DOWN);
bot.punch(); bot.punch();
world.playSound(head, Sound.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); world.playSound(head, Sound.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1);