diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 5c7d44a6..7fc660a2 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,3 +1,9 @@ +### 2.1.5 Release (09.06.2025) +* Fixed startup issues on lower mc versions +* Added a onserverjoin message about wrong base arena setup if base cuboid is outside arena cuboid +* Added Death.Blindness in config.yml to change length of blindness effect after death +* Updated to minigamesbox 1.4.2 + ### 2.1.4 Release (03.05.2025) * Fixed arena forcestop the game after a player leave the Fullgame and not enough players to continue are online * Updated language.yml so by default base selection got prefix diff --git a/pom.xml b/pom.xml index 96134d17..bbd5d148 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ plugily.projects thebridge - 2.1.4 + 2.1.4-SNAPSHOT4 TheBridge @@ -58,7 +58,7 @@ plugily.projects MiniGamesBox-Classic - 1.4.1 + 1.4.2 compile true diff --git a/src/main/java/plugily/projects/thebridge/arena/Arena.java b/src/main/java/plugily/projects/thebridge/arena/Arena.java index ddbc44a5..5cfe8c96 100644 --- a/src/main/java/plugily/projects/thebridge/arena/Arena.java +++ b/src/main/java/plugily/projects/thebridge/arena/Arena.java @@ -290,7 +290,7 @@ public void resetPlayer(Player player) { player.setExp(0); player.setFireTicks(0); player.setGameMode(GameMode.SURVIVAL); - XPotion.BLINDNESS.buildPotionEffect(30, 10).apply(player); + XPotion.BLINDNESS.buildPotionEffect(plugin.getConfig().getInt("Death.Blindness", 30), 10).apply(player); VersionUtils.setMaxHealth(player, VersionUtils.getMaxHealth(player)); player.setHealth(VersionUtils.getMaxHealth(player)); player.setAllowFlight(false); diff --git a/src/main/java/plugily/projects/thebridge/events/PluginEvents.java b/src/main/java/plugily/projects/thebridge/events/PluginEvents.java index 0c0d8cd2..08cfae6d 100644 --- a/src/main/java/plugily/projects/thebridge/events/PluginEvents.java +++ b/src/main/java/plugily/projects/thebridge/events/PluginEvents.java @@ -19,6 +19,8 @@ package plugily.projects.thebridge.events; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -27,18 +29,22 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.potion.PotionEffectType; import plugily.projects.minigamesbox.api.arena.IArenaState; +import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; +import plugily.projects.minigamesbox.classic.utils.services.UpdateChecker; import plugily.projects.minigamesbox.classic.utils.version.VersionUtils; import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial; import plugily.projects.minigamesbox.classic.utils.version.xseries.XPotion; import plugily.projects.thebridge.Main; import plugily.projects.thebridge.arena.Arena; +import plugily.projects.thebridge.arena.base.Base; /** * @author Tigerpanzer_02 - *

Created at 23.11.2020 + *

Created at 23.11.2020 */ public class PluginEvents implements Listener { @@ -49,9 +55,28 @@ public PluginEvents(Main plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } + @EventHandler + public void onJoinCheckBases(PlayerJoinEvent event) { + if(!event.getPlayer().hasPermission(plugin.getPluginNamePrefixLong() + ".admin") || !event.getPlayer().isOp()) { + return; + } + Bukkit.getScheduler().runTaskLater(plugin, () -> { + for(Arena arena : plugin.getArenaRegistry().getPluginArenas()) { + for(Base base : arena.getBases()) { + if(!(arena.getArenaBorder().isIn(base.getBaseCuboid().getMinPoint()) && (arena.getArenaBorder().isIn(base.getBaseCuboid().getMaxPoint())))) { + event.getPlayer().sendMessage(""); + event.getPlayer().sendMessage(ChatColor.BOLD + plugin.getPluginMessagePrefix() + "Your arena setup is broken. Please adjust your arena cuboid."); + event.getPlayer().sendMessage(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().arena(arena).value("YOUR BASE CUBOIDS ARE NOT INSIDE ARENA CUBOID").build()); + event.getPlayer().sendMessage(ChatColor.YELLOW + plugin.getPluginMessagePrefix() + "[CHECK BASE INSIDE ARENA] " + arena.getId() + base.getColor() + " Locations amin" + arena.getArenaBorder().getMinPoint() + "amax" + arena.getArenaBorder().getMaxPoint() + "bmin" + base.getBaseCuboid().getMinPoint() + "bma" + base.getBaseCuboid().getMaxPoint()); + } + } + } + }, 25); + } + @EventHandler public void onDrop(PlayerDropItemEvent event) { - if (plugin.getArenaRegistry().isInArena(event.getPlayer())) { + if(plugin.getArenaRegistry().isInArena(event.getPlayer())) { event.setCancelled(true); } } @@ -60,10 +85,10 @@ public void onDrop(PlayerDropItemEvent event) { public void onAppleConsume(PlayerItemConsumeEvent event) { Player player = event.getPlayer(); Arena arena = plugin.getArenaRegistry().getArena(player); - if (arena == null) { + if(arena == null) { return; } - if (event.getItem().getType() == XMaterial.GOLDEN_APPLE.parseMaterial()) { + if(event.getItem().getType() == XMaterial.GOLDEN_APPLE.parseMaterial()) { player.setFoodLevel(20); player.setHealth(VersionUtils.getMaxHealth(player)); player.removePotionEffect(XPotion.REGENERATION.getPotionEffectType()); @@ -73,9 +98,9 @@ public void onAppleConsume(PlayerItemConsumeEvent event) { @EventHandler(priority = EventPriority.HIGH) // highest priority to fully protect our game public void onBlockBreakEvent(BlockBreakEvent event) { - if (plugin.getArenaRegistry().isInArena(event.getPlayer()) - && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() - != IArenaState.IN_GAME) { + if(plugin.getArenaRegistry().isInArena(event.getPlayer()) + && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() + != IArenaState.IN_GAME) { event.setCancelled(true); } } @@ -83,22 +108,22 @@ public void onBlockBreakEvent(BlockBreakEvent event) { @EventHandler(priority = EventPriority.HIGH) // highest priority to fully protect our game public void onBuild(BlockPlaceEvent event) { - if (plugin.getArenaRegistry().isInArena(event.getPlayer()) - && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() - != IArenaState.IN_GAME) { + if(plugin.getArenaRegistry().isInArena(event.getPlayer()) + && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() + != IArenaState.IN_GAME) { event.setCancelled(true); } } @EventHandler public void onPlayerTeleport(PlayerTeleportEvent event) { - if (!plugin.getArenaRegistry().isInArena(event.getPlayer())) { + if(!plugin.getArenaRegistry().isInArena(event.getPlayer())) { return; } - if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) { + if(event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) { event.setCancelled(true); } - if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)) { + if(event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)) { event.setCancelled(true); } } diff --git a/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java b/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java index 832ca08b..a6950404 100644 --- a/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java +++ b/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java @@ -42,7 +42,7 @@ public void addItems(NormalFastInv gui) { gui.setItem((getInventoryLine() * 9) + 4, midLocation); getItemList().add(midLocation); - LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena", "Location where all bases and lines are in \n (players will be able to build inside)", "arenalocation"); + LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena", "Location where all bases and lines are in \n (players will be able to build inside) \n MAKE SURE TO SET IT OUTSIDE \n OF THE BASES WHICH YOU SET BEFORE!", "arenalocation"); gui.setItem((getInventoryLine() * 9) + 5, arenaBorder); getItemList().add(arenaBorder); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d50f71cc..1b86c940 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -98,6 +98,9 @@ Block: # Setting it to false means on all stages of the game the event will be cancelled. # Setting it to true means only while IN_GAME the event will be cancelled. Check: true + # Should all interactions with interactive materials such as doors / buttons / fences / redstone be blocked during ingame + # Full list see https://github.com/CryptoMorin/XSeries/blob/e84000a2bead7367d893cf8661f8d5432116adaa/core/src/main/java/com/cryptomorin/xseries/XTag.java#L2793 + Interact: false # Enable this option when you're using MySQL, otherwise it won't work. @@ -210,6 +213,9 @@ Natural-Regeneration: false # Should blocks when broken drop items during a game Block-Break-Drop: true +# How long should be the blindness effect after death? +Death: + Blindness: 30 # Settings about cages on all bases Cage: @@ -230,5 +236,5 @@ Update-Notifier: # Really, don't edit ;p # You edited it, huh? Next time hurt yourself! Do-Not-Edit: - File-Version: 2 - Core-Version: 5 + File-Version: 3 + Core-Version: 6