diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 8b5f02cb..a9466915 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,3 +1,13 @@ +### 1.4.3 Release (10.07.2025) +* Added 1.21.6-7 support! +* Updated XSeries to 13.3.3 +* Updated FastBoard to 2.1.5 +* Updated FastInv to 3.1.2 +* Fixed NPE on ServerListPing if plugin isn't fully started / arenaregistry not ready +* Fixed NSM on CRAFTING TABLE usage at mc 1.8.8 +* Internal Code Cleanup such as prefixes and MiscUtils +* Changed Hex code support to only support 6 digit long hex code! + ### 1.4.2 Release (09.06.2025) * Added BLOCK_IN_GAME_INTERACTIONS option to block interactions whileas ingame * Added onArrowHitRemoveProjectile event to remove projectiles which got shoot from InGame Players diff --git a/.github/building/classic/pom.xml b/.github/building/classic/pom.xml index 486888bb..cec21596 100644 --- a/.github/building/classic/pom.xml +++ b/.github/building/classic/pom.xml @@ -68,7 +68,7 @@ fr.mrmicky fastboard - 2.1.3 + 2.1.5 true diff --git a/MiniGamesBox API/pom.xml b/MiniGamesBox API/pom.xml index baf0be1d..0d129a20 100644 --- a/MiniGamesBox API/pom.xml +++ b/MiniGamesBox API/pom.xml @@ -23,7 +23,7 @@ minigamesbox plugily.projects - 1.4.2 + 1.4.2-SNAPSHOT9 4.0.0 @@ -53,7 +53,7 @@ com.github.cryptomorin XSeries - 13.3.1 + 13.3.3 provided true diff --git a/MiniGamesBox Classic/pom.xml b/MiniGamesBox Classic/pom.xml index 00e7bc6c..7024cd48 100644 --- a/MiniGamesBox Classic/pom.xml +++ b/MiniGamesBox Classic/pom.xml @@ -23,7 +23,7 @@ minigamesbox plugily.projects - 1.4.2 + 1.4.2-SNAPSHOT9 4.0.0 @@ -68,7 +68,7 @@ fr.mrmicky fastboard - 2.1.4 + 2.1.5 compile true @@ -87,7 +87,7 @@ com.github.cryptomorin XSeries - 13.3.1 + 13.3.3 compile true diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/arena/managers/BungeeManager.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/arena/managers/BungeeManager.java index d5e20e1f..fef651ce 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/arena/managers/BungeeManager.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/arena/managers/BungeeManager.java @@ -76,6 +76,10 @@ public void connectToHub(Player player) { @EventHandler(priority = EventPriority.HIGHEST) public void onServerListPing(ServerListPingEvent event) { + if(plugin.getArenaRegistry() == null) { + //can be null on early request after server startup + return; + } if(plugin.getArenaRegistry().getArenas().isEmpty() || !config.getBoolean("MOTD.Manager")) { return; } diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/events/Events.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/events/Events.java index 7a781180..d2efa4fc 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/events/Events.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/events/Events.java @@ -44,6 +44,7 @@ import plugily.projects.minigamesbox.classic.PluginMain; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; import plugily.projects.minigamesbox.classic.utils.version.ServerVersion; +import plugily.projects.minigamesbox.classic.utils.version.VersionUtils; import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerInteractEvent; import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerSwapHandItemsEvent; @@ -189,13 +190,10 @@ public void onCraft(PlugilyPlayerInteractEvent event) { return; } if(event.getPlayer().getTargetBlock(null, 7).getType() == XMaterial.CRAFTING_TABLE.parseMaterial()) { - if(event.getAction().isRightClick()) { + if(VersionUtils.isRightClick(event.getAction())) { event.setCancelled(true); } } - if(event.getClickedBlock() == null) { - return; - } if(event.getClickedBlock().getType() == XMaterial.PAINTING.parseMaterial() || event.getClickedBlock().getType() == XMaterial.FLOWER_POT.parseMaterial()) { event.setCancelled(true); } diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/BooleanItem.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/BooleanItem.java index 81b424b7..6dea1d2a 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/BooleanItem.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/BooleanItem.java @@ -103,7 +103,7 @@ public Prompt acceptInput(ConversationContext context, String input) { context.getForWhom().sendRawMessage(new MessageBuilder("&e✖ Only a value of the list is allowed, try again by clicking the item again").build()); return Prompt.END_OF_CONVERSATION; } - context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).build()); + context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).prefix().build()); setupInventory.setConfig(keyName, Boolean.valueOf(input)); return Prompt.END_OF_CONVERSATION; } @@ -113,7 +113,7 @@ public Prompt acceptInput(ConversationContext context, String input) { boolean option = setupInventory.getConfig().getBoolean("instances." + setupInventory.getArenaKey() + "." + keyName, false); int position = 2; boolean newOption = !option; - event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).build()); + event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).prefix().build()); setupInventory.setConfig(keyName, newOption); InventoryHolder holder = event.getInventory().getHolder(); if(holder instanceof RefreshableFastInv) { diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/CountItem.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/CountItem.java index 9d82d3f3..dfb78c63 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/CountItem.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/CountItem.java @@ -132,7 +132,7 @@ public void onClick(InventoryClickEvent event) { countInput = 1; } updateArenaFile(countInput); - conversationContext.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aCount for " + name.toUpperCase() + " on " + setupInventory.getArenaKey() + " set to " + countInput).build()); + conversationContext.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aCount for " + name.toUpperCase() + " on " + setupInventory.getArenaKey() + " set to " + countInput).prefix().build()); //considerable to open setup inventory again? return Prompt.END_OF_CONVERSATION; } diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/SwitchItem.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/SwitchItem.java index aae2b950..1ecf4347 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/SwitchItem.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/SwitchItem.java @@ -104,7 +104,7 @@ public Prompt acceptInput(ConversationContext context, String input) { context.getForWhom().sendRawMessage(new MessageBuilder("&e✖ Only a value of the list is allowed, try again by clicking the item again").build()); return Prompt.END_OF_CONVERSATION; } - context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).build()); + context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).prefix().build()); setupInventory.setConfig(keyName, input); return Prompt.END_OF_CONVERSATION; } @@ -114,7 +114,7 @@ public Prompt acceptInput(ConversationContext context, String input) { String option = setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + "." + keyName, switches.get(0)); int position = switches.indexOf(option); String newOption = switches.get(switches.size() - 1 <= position ? 0 : position + 1); - event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).build()); + event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).prefix().build()); setupInventory.setConfig(keyName, newOption); InventoryHolder holder = event.getInventory().getHolder(); if(holder instanceof RefreshableFastInv) { diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/ValueItem.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/ValueItem.java index 5580e819..03cb1cb0 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/ValueItem.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/handlers/setup/items/category/ValueItem.java @@ -95,7 +95,7 @@ public void onClick(InventoryClickEvent event) { @Override public Prompt acceptInput(ConversationContext context, String input) { String name = new MessageBuilder(input, false).build(); - context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aName of &7" + setupInventory.getArenaKey() + " &aset to &r" + name).build()); + context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aName of &7" + setupInventory.getArenaKey() + " &aset to &r" + name).prefix().build()); setupInventory.setConfig(keyName, name); return Prompt.END_OF_CONVERSATION; } diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/misc/MiscUtils.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/misc/MiscUtils.java index 68112db7..0a648a34 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/misc/MiscUtils.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/misc/MiscUtils.java @@ -50,26 +50,26 @@ public class MiscUtils { private static final Random RANDOM = new Random(); - private static final Pattern PATTERN = Pattern.compile("&?#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})"); + private static final Pattern PATTERN = Pattern.compile("&?#([A-Fa-f0-9]{6})"); private MiscUtils() { } - public static String matchColorRegex(String s) { + public static String matchColorRegex(String message) { if(Version.isCurrentLower(Version.v1_16)) { - return s; + return message; } - Matcher matcher = PATTERN.matcher(s); + Matcher matcher = PATTERN.matcher(message); while(matcher.find()) { try { - s = s.replace(matcher.group(0), net.md_5.bungee.api.ChatColor.of("#" + matcher.group(1)).toString()); - } catch(Exception e) { - System.err.println("Invalid hex color: " + e.getLocalizedMessage()); + message = message.replace(matcher.group(0), net.md_5.bungee.api.ChatColor.of("#" + matcher.group(1)).toString()); + } catch(Exception exception) { + System.err.println("Invalidh hex color: " + exception.getLocalizedMessage() + " && " + message); } } - return s; + return message; } @Deprecated @@ -87,8 +87,8 @@ public static Optional getEntityAttribute(LivingEntity entity * @param location location to spawn firework there */ public static void spawnRandomFirework(Location location) { - Firework fw = (Firework) location.getWorld().spawnEntity(location, XEntityType.FIREWORK_ROCKET.get()); - FireworkMeta fwm = fw.getFireworkMeta(); + Firework firework = (Firework) location.getWorld().spawnEntity(location, XEntityType.FIREWORK_ROCKET.get()); + FireworkMeta fireworkMeta = firework.getFireworkMeta(); //Get the type FireworkEffect.Type type; @@ -124,11 +124,11 @@ public static void spawnRandomFirework(Location location) { .with(type).trail(RANDOM.nextBoolean()).build(); //Then apply the effect to the meta - fwm.addEffect(effect); + fireworkMeta.addEffect(effect); //Generate some random power and set it - fwm.setPower(RANDOM.nextInt(2) + 1); - fw.setFireworkMeta(fwm); + fireworkMeta.setPower(RANDOM.nextInt(2) + 1); + firework.setFireworkMeta(fireworkMeta); } /** diff --git a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/version/VersionUtils.java b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/version/VersionUtils.java index 547eb0f9..ec3883fc 100644 --- a/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/version/VersionUtils.java +++ b/MiniGamesBox Classic/src/main/java/plugily/projects/minigamesbox/classic/utils/version/VersionUtils.java @@ -36,6 +36,7 @@ import org.bukkit.entity.HumanEntity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; @@ -445,7 +446,6 @@ public static double getMaxHealth(LivingEntity entity) { } - java.util.Optional at = MiscUtils.getEntityAttribute(entity, XAttribute.MAX_HEALTH.get()); return at.map(AttributeInstance::getValue).orElse(20D); } @@ -643,16 +643,22 @@ public static Entity spawnEntity(Location location, EntityType entityType) { } public static BannerMeta setBaseColor(BannerMeta meta, DyeColor color) { - BlockStateMeta bsm = (BlockStateMeta) meta; - BlockState state = ((BlockStateMeta) meta).getBlockState(); - if (state instanceof Banner) { - ((Banner) state).setBaseColor(color); - state.update(true); - } - bsm.setBlockState(state); + BlockStateMeta bsm = (BlockStateMeta) meta; + BlockState state = ((BlockStateMeta) meta).getBlockState(); + if(state instanceof Banner) { + ((Banner) state).setBaseColor(color); + state.update(true); + } + bsm.setBlockState(state); return meta; + } + public static boolean isLeftClick(Action action) { + return action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK; + } -} + public static boolean isRightClick(Action action) { + return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK; + } } diff --git a/MiniGamesBox Database/pom.xml b/MiniGamesBox Database/pom.xml index 7a655623..00f3ba44 100644 --- a/MiniGamesBox Database/pom.xml +++ b/MiniGamesBox Database/pom.xml @@ -23,7 +23,7 @@ minigamesbox plugily.projects - 1.4.2 + 1.4.2-SNAPSHOT9 4.0.0 diff --git a/MiniGamesBox Inventory/pom.xml b/MiniGamesBox Inventory/pom.xml index 2d38566a..b44fefd9 100644 --- a/MiniGamesBox Inventory/pom.xml +++ b/MiniGamesBox Inventory/pom.xml @@ -23,7 +23,7 @@ minigamesbox plugily.projects - 1.4.2 + 1.4.2-SNAPSHOT9 4.0.0 @@ -45,7 +45,7 @@ fr.mrmicky FastInv - 3.1.1 + v3.1.2 diff --git a/MiniGamesBox Utils/pom.xml b/MiniGamesBox Utils/pom.xml index 449fee1d..0a2d260b 100644 --- a/MiniGamesBox Utils/pom.xml +++ b/MiniGamesBox Utils/pom.xml @@ -23,7 +23,7 @@ minigamesbox plugily.projects - 1.4.2 + 1.4.2-SNAPSHOT9 4.0.0 diff --git a/pom.xml b/pom.xml index 32e28d3e..2d527e9e 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ plugily.projects minigamesbox - 1.4.2 + 1.4.2-SNAPSHOT9 pom