From 106e457fa7e9c56e11767e322ef7d4fba05b524a Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Tue, 28 Jul 2020 16:24:41 -0400 Subject: [PATCH] fix beds exploding in new nether biomes add end biomes too since beds explode there aswell & fix the stupid "(amount) entitiess removed." shit too --- .../blocking/InteractBlocker.java | 31 +++++++++++++------ .../command/Command_entitywipe.java | 9 +++++- .../totalfreedommod/util/Groups.java | 23 +++----------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index 2d3c6685..b5f5a410 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -5,9 +5,11 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.Groups; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.block.Biome; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -53,6 +55,26 @@ public class InteractBlocker extends FreedomService } } + @EventHandler + public void onBedEnter(PlayerBedEnterEvent event) + { + Player player = event.getPlayer(); + if (event.getBed().getBiome().equals(Biome.NETHER_WASTES) + || event.getBed().getBiome().equals(Biome.CRIMSON_FOREST) + || event.getBed().getBiome().equals(Biome.SOUL_SAND_VALLEY) + || event.getBed().getBiome().equals(Biome.WARPED_FOREST) + || event.getBed().getBiome().equals(Biome.BASALT_DELTAS) + || event.getBed().getBiome().equals(Biome.END_BARRENS) + || event.getBed().getBiome().equals(Biome.END_HIGHLANDS) + || event.getBed().getBiome().equals(Biome.END_MIDLANDS) + || event.getBed().getBiome().equals(Biome.THE_END) + || event.getBed().getBiome().equals(Biome.SMALL_END_ISLANDS)) + { + player.sendMessage(ChatColor.RED + "You may not sleep here."); + event.setCancelled(true); + } + } + private void handleRightClick(PlayerInteractEvent event) { final Player player = event.getPlayer(); @@ -74,15 +96,6 @@ public class InteractBlocker extends FreedomService return; } - // TODO: lookup new biomes that have bed explosions in 1.16 - - /*if (Groups.BED_COLORS.contains(event.getMaterial()) && event.getClickedBlock().getBiome().equals(Biome.NETHER)) - { - player.sendMessage(ChatColor.RED + "You can't sleep in hell."); - event.setCancelled(true); - return; - }*/ - switch (event.getMaterial()) { case WATER_BUCKET: diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java index 46bf9297..e82b27c1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java @@ -64,7 +64,14 @@ public class Command_entitywipe extends FreedomCommand { count = plugin.ew.wipeEntities(bypassBlacklist); } - msg(count + " " + (type != null ? entityName : "entities") + FUtil.showS(count) + " removed."); + if (count == 1) + { + msg(count + " " + (type != null ? entityName : "entity") + " removed."); + } + else + { + msg(count + " " + (type != null ? entityName : "entitie") + FUtil.showS(count) + " removed."); + } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java index cadcca04..2dc04c9f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/Groups.java @@ -7,6 +7,7 @@ import org.bukkit.entity.EntityType; public class Groups { + public static final List WOOL_COLORS = Arrays.asList( Material.WHITE_WOOL, Material.RED_WOOL, @@ -24,6 +25,7 @@ public class Groups Material.GRAY_WOOL, Material.LIGHT_GRAY_WOOL, Material.BLACK_WOOL); + public static final List SHULKER_BOXES = Arrays.asList( Material.SHULKER_BOX, Material.WHITE_SHULKER_BOX, @@ -101,6 +103,7 @@ public class Groups EntityType.WITCH, EntityType.WITHER_SKELETON, EntityType.WOLF, + EntityType.ZOGLIN, EntityType.ZOMBIE, EntityType.ZOMBIE_HORSE, EntityType.ZOMBIFIED_PIGLIN, @@ -204,22 +207,4 @@ public class Groups Material.WHITE_WALL_BANNER, Material.YELLOW_BANNER, Material.YELLOW_WALL_BANNER); - - public static final List BED_COLORS = Arrays.asList( - Material.WHITE_BED, - Material.RED_BED, - Material.ORANGE_BED, - Material.YELLOW_BED, - Material.GREEN_BED, - Material.LIME_BED, - Material.LIGHT_BLUE_BED, - Material.CYAN_BED, - Material.BLUE_BED, - Material.PURPLE_BED, - Material.MAGENTA_BED, - Material.PINK_BED, - Material.BROWN_BED, - Material.GRAY_BED, - Material.LIGHT_GRAY_BED, - Material.BLACK_BED); -} +} \ No newline at end of file