Merge pull request #246 from speedxx/development

fix beds exploding in new nether biomes
This commit is contained in:
Seth 2020-07-28 14:38:12 -07:00 committed by GitHub
commit 2353c728c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 29 deletions

View File

@ -5,9 +5,11 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.Groups; import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; 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) private void handleRightClick(PlayerInteractEvent event)
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
@ -74,15 +96,6 @@ public class InteractBlocker extends FreedomService
return; 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()) switch (event.getMaterial())
{ {
case WATER_BUCKET: case WATER_BUCKET:

View File

@ -64,7 +64,14 @@ public class Command_entitywipe extends FreedomCommand
{ {
count = plugin.ew.wipeEntities(bypassBlacklist); 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; return true;
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.EntityType;
public class Groups public class Groups
{ {
public static final List<Material> WOOL_COLORS = Arrays.asList( public static final List<Material> WOOL_COLORS = Arrays.asList(
Material.WHITE_WOOL, Material.WHITE_WOOL,
Material.RED_WOOL, Material.RED_WOOL,
@ -24,6 +25,7 @@ public class Groups
Material.GRAY_WOOL, Material.GRAY_WOOL,
Material.LIGHT_GRAY_WOOL, Material.LIGHT_GRAY_WOOL,
Material.BLACK_WOOL); Material.BLACK_WOOL);
public static final List<Material> SHULKER_BOXES = Arrays.asList( public static final List<Material> SHULKER_BOXES = Arrays.asList(
Material.SHULKER_BOX, Material.SHULKER_BOX,
Material.WHITE_SHULKER_BOX, Material.WHITE_SHULKER_BOX,
@ -101,6 +103,7 @@ public class Groups
EntityType.WITCH, EntityType.WITCH,
EntityType.WITHER_SKELETON, EntityType.WITHER_SKELETON,
EntityType.WOLF, EntityType.WOLF,
EntityType.ZOGLIN,
EntityType.ZOMBIE, EntityType.ZOMBIE,
EntityType.ZOMBIE_HORSE, EntityType.ZOMBIE_HORSE,
EntityType.ZOMBIFIED_PIGLIN, EntityType.ZOMBIFIED_PIGLIN,
@ -204,22 +207,4 @@ public class Groups
Material.WHITE_WALL_BANNER, Material.WHITE_WALL_BANNER,
Material.YELLOW_BANNER, Material.YELLOW_BANNER,
Material.YELLOW_WALL_BANNER); Material.YELLOW_WALL_BANNER);
}
public static final List<Material> 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);
}