diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md
index 4d759bf7..179c9aab 100644
--- a/.github/CHANGELOG.md
+++ b/.github/CHANGELOG.md
@@ -1,3 +1,9 @@
+### 2.1.8 Release (13.05.2026)
+* Fixed block replacement (on bridge) and in inventory for legacy versions
+* Fixed InventoryView Error
+* Added a Base Validation check on Arena Border if already present
+* Updated to MinigamesBox 1.4.6
+
### 2.1.7 Release (17.01.2026)
* Updated to MinigamesBox 1.4.5
diff --git a/pom.xml b/pom.xml
index 9e669362..76148664 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
plugily.projects
thebridge
- 2.1.7
+ 2.1.7-SNAPSHOT2
TheBridge
@@ -58,7 +58,7 @@
plugily.projects
MiniGamesBox-Classic
- 1.4.5
+ 1.4.6
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 5cfe8c96..d46336b8 100644
--- a/src/main/java/plugily/projects/thebridge/arena/Arena.java
+++ b/src/main/java/plugily/projects/thebridge/arena/Arena.java
@@ -25,7 +25,6 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.Nullable;
import plugily.projects.minigamesbox.api.arena.IArenaState;
import plugily.projects.minigamesbox.classic.arena.PluginArena;
@@ -63,7 +62,7 @@ public class Arena extends PluginArena {
private final ArrayList placedBlocks = new ArrayList<>();
private List bridgeCuboid;
- private final HashMap brokenBlocks = new HashMap<>();
+ private final HashMap brokenBlocks = new HashMap<>();
private final HashMap hits = new HashMap<>();
private int resetRound = 0;
@@ -350,10 +349,10 @@ public void addBridgeCuboid(Cuboid cuboid) {
this.bridgeCuboid.add(cuboid);
}
- public HashMap getBrokenBlocks() {
+ public HashMap getBrokenBlocks() {
return brokenBlocks;
}
- public void addBrokenBlock(Location location, Material material) {
+ public void addBrokenBlock(Location location, XMaterial material) {
this.brokenBlocks.put(location, material);
}
@@ -365,7 +364,7 @@ public void resetPlacedBlocks() {
}
public void resetBrokenBlocks() {
- brokenBlocks.forEach((location, material) -> XBlock.setType(location.getBlock(), XMaterial.matchXMaterial(material)));
+ brokenBlocks.forEach((location, material) -> XBlock.setType(location.getBlock(), material));
brokenBlocks.clear();
}
diff --git a/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java b/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java
index 667f03ca..3add4f50 100644
--- a/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java
+++ b/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java
@@ -44,8 +44,10 @@
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyEntityPickupItemEvent;
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerPickupArrow;
+import plugily.projects.minigamesbox.classic.utils.version.xseries.XBlock;
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
import plugily.projects.minigamesbox.classic.utils.version.xseries.XSound;
+import plugily.projects.minigamesbox.classic.utils.version.xseries.inventory.XInventoryView;
import plugily.projects.thebridge.Main;
import plugily.projects.thebridge.arena.base.Base;
import plugily.projects.thebridge.arena.managers.ScoreboardManager;
@@ -114,7 +116,7 @@ public void onBlockBreakEvent(BlockBreakEvent event) {
// Only add blocks to the list if the block is not found to be in the broken blocks list
// Making it so that resetting placed blocks and resetting broken blocks will not tamper with each other
if(!arena.getBrokenBlocks().containsKey(event.getBlock().getLocation())) {
- arena.addBrokenBlock(event.getBlock().getLocation(), event.getBlock().getType());
+ arena.addBrokenBlock(event.getBlock().getLocation(), XBlock.getType(event.getBlock()));
}
} else {
new MessageBuilder("IN_GAME_MESSAGES_ARENA_BUILD_BREAK")
@@ -613,8 +615,8 @@ public void onItemMove(InventoryClickEvent event) {
if(plugin.getArenaRegistry().getArena(((Player) event.getWhoClicked())).getArenaState()
!= IArenaState.IN_GAME) {
if(event.getClickedInventory() == event.getWhoClicked().getInventory()) {
- if(event.getView().getType() == InventoryType.CRAFTING
- || event.getView().getType() == InventoryType.PLAYER) {
+ if(XInventoryView.of(event.getView()).getType() == InventoryType.CRAFTING
+ || XInventoryView.of(event.getView()).getType() == InventoryType.PLAYER) {
event.setResult(Event.Result.DENY);
}
}
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 a6950404..e003f5f6 100644
--- a/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java
+++ b/src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java
@@ -20,10 +20,13 @@
package plugily.projects.thebridge.handlers.setup;
+import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginLocationCategory;
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.LocationItem;
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.LocationSelectorItem;
+import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid;
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
+import plugily.projects.minigamesbox.classic.utils.serialization.LocationSerializer;
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
@@ -42,7 +45,19 @@ 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) \n MAKE SURE TO SET IT OUTSIDE \n OF THE BASES WHICH YOU SET BEFORE!", "arenalocation");
+ LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena Cuboid/Border", "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 (Baselocations) WHICH YOU SET BEFORE!", "arenalocation", inventoryClickEvent -> {
+ String path = "instances." + getSetupInventory().getArenaKey();
+ if(getSetupInventory().getConfig().getString(path + ".arenalocation.1") != null && getSetupInventory().getConfig().getString(path + ".arenalocation.2") != null) {
+ Cuboid arenaCuboid = new Cuboid(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + ".arenalocation.1", "world,364.0,63.0,-72.0,0.0,0.0")), LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + ".arenalocation.2", "world,364.0,63.0,-72.0,0.0,0.0")));
+ for(String bases : getSetupInventory().getConfig().getConfigurationSection("instances." + getSetupInventory().getArenaKey() + ".bases").getKeys(false)) {
+ if(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.1") != null && getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.2") != null) {
+ if(!(arenaCuboid.isIn(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.1"))) && arenaCuboid.isIn(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.2"))))) {
+ new MessageBuilder("&c&l✘ &cArena validation failed! Please set your arena cuboids outside your base cuboids! The arena needs to be bigger than your bases locations! The following base is not inside the arena cuboid: " + bases).prefix().player(getSetupInventory().getPlayer()).sendPlayer();
+ }
+ }
+ }
+ }
+ });
gui.setItem((getInventoryLine() * 9) + 5, arenaBorder);
getItemList().add(arenaBorder);
}
diff --git a/src/main/java/plugily/projects/thebridge/handlers/setup/components/BasePage.java b/src/main/java/plugily/projects/thebridge/handlers/setup/components/BasePage.java
index fc7bca8c..e1962f3b 100644
--- a/src/main/java/plugily/projects/thebridge/handlers/setup/components/BasePage.java
+++ b/src/main/java/plugily/projects/thebridge/handlers/setup/components/BasePage.java
@@ -69,7 +69,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
NormalFastInv pagedGui = new BasePage(9, setupInventory.getPlugin().getPluginMessagePrefix() + "Base Editor Menu", setupInventory);
pagedGui.open(setupInventory.getPlayer());
return Prompt.END_OF_CONVERSATION;
- } catch (IllegalArgumentException ignored) {
+ } catch(IllegalArgumentException ignored) {
context.getForWhom().sendRawMessage(new MessageBuilder("&cTry again. This is not an color!").prefix().build());
return Prompt.END_OF_CONVERSATION;
}
@@ -77,7 +77,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
}).buildFor((Player) event.getWhoClicked());
}));
- LocationSelectorItem baseCorners = new LocationSelectorItem(setupInventory, new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Base", "Set the corners of one base", "bases." + getId(setupInventory.getPlayer()) + ".baselocation");
+ LocationSelectorItem baseCorners = new LocationSelectorItem(setupInventory, new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Base", "Set the corners of one base", "bases." + getId(setupInventory.getPlayer()) + ".baselocation");
setItem(1, baseCorners);
//portal in mid function? LocationSerializer.saveLoc(setupInventory.getPlugin(), setupInventory.getConfig(), "arenas", "instances." + setupInventory.getArenaKey() + ".bases." + getId(setupInventory.getPlayer()) + ".portalhologram", new Cuboid(selection.getFirstPos(), selection.getSecondPos()).getCenter().add(0, 2, 0));
@@ -103,30 +103,41 @@ public Prompt acceptInput(ConversationContext context, String input) {
.lore(ChatColor.GREEN + "Click to finish & save the setup of this base")
.build(), event -> {
String path = "instances." + setupInventory.getArenaKey() + ".bases." + getId(setupInventory.getPlayer());
- if (setupInventory.getConfig().get(path + ".baselocation.1") == null) {
+ if(setupInventory.getConfig().get(path + ".baselocation.1") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure base location properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
- if (setupInventory.getConfig().get(path + ".portallocation.1") == null) {
+ if(setupInventory.getConfig().get(path + ".portallocation.1") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure portal location properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
- if (setupInventory.getConfig().get(path + ".spawnpoint") == null) {
+ if(setupInventory.getConfig().get(path + ".spawnpoint") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure spawnpoint properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
- if (setupInventory.getConfig().get(path + ".respawnpoint") == null) {
+ if(setupInventory.getConfig().get(path + ".respawnpoint") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure respawnpoint properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
- if (setupInventory.getConfig().get(path + ".color") == null) {
+ if(setupInventory.getConfig().get(path + ".color") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure color properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
- if (setupInventory.getConfig().get(path + ".portalhologram") == null) {
+ if(setupInventory.getConfig().get(path + ".portalhologram") == null) {
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure portalhologram properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
return;
}
+ if(setupInventory.getConfig().get(path + ".portalhologram") == null) {
+ new MessageBuilder("&c&l✘ &cBase validation failed! Please configure portalhologram properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
+ return;
+ }
+ if(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.1") != null && setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.2") != null) {
+ Cuboid arenaBorder = new Cuboid(LocationSerializer.getLocation(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.1", "world,364.0,63.0,-72.0,0.0,0.0")), LocationSerializer.getLocation(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.2", "world,364.0,63.0,-72.0,0.0,0.0")));
+ if(!(arenaBorder.isIn(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".baselocation.1"))) && arenaBorder.isIn(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".baselocation.2"))))) {
+ new MessageBuilder("&c&l✘ &cBase validation failed! Please set your base cuboids (baselocation.1 and baselocation.2) inside your arena cuboid (Main Setup Menu of Arena -> Arena)!").prefix().player(setupInventory.getPlayer()).sendPlayer();
+ return;
+ }
+ }
new MessageBuilder("&a&l✔ &aValidation succeeded! Registering new base: " + getId(setupInventory.getPlayer())).prefix().player(setupInventory.getPlayer()).sendPlayer();
setupInventory.setConfig("bases." + getId(setupInventory.getPlayer()) + ".isdone", true);
Base base = new Base(
@@ -139,13 +150,13 @@ public Prompt acceptInput(ConversationContext context, String input) {
LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".portallocation.2")),
setupInventory.getConfig().getInt(path + ".maximumsize")
);
- if (setupInventory.getConfig().get(path + ".cagelocation.1") != null && setupInventory.getConfig().get(path + ".cagelocation.2") != null) {
+ if(setupInventory.getConfig().get(path + ".cagelocation.1") != null && setupInventory.getConfig().get(path + ".cagelocation.2") != null) {
base.setCageCuboid(new Cuboid(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".cagelocation.1")), LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".cagelocation.2"))));
}
Arena arena = (Arena) setupInventory.getPlugin().getArenaRegistry().getArena(setupInventory.getArenaKey());
arena.addBase(base);
ArmorStandHologram portal = new ArmorStandHologram(setupInventory.getPlugin().getBukkitHelper().getBlockCenter(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".portalhologram"))));
- for (String str : setupInventory.getPlugin().getLanguageManager().getLanguageMessage(setupInventory.getPlugin().getMessageManager().getPath("IN_GAME_MESSAGES_ARENA_PORTAL_HOLOGRAM")).split(";")) {
+ for(String str : setupInventory.getPlugin().getLanguageManager().getLanguageMessage(setupInventory.getPlugin().getMessageManager().getPath("IN_GAME_MESSAGES_ARENA_PORTAL_HOLOGRAM")).split(";")) {
portal.appendLine(str.replace("%arena_base_color_formatted%", base.getFormattedColor()));
}
base.setArmorStandHologram(portal);
@@ -167,14 +178,14 @@ String getPromptText(ConversationContext context) {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
- if (!NumberUtils.isInteger(input)) {
+ if(!NumberUtils.isInteger(input)) {
context.getForWhom().sendRawMessage(new MessageBuilder("&cTry again. Its not a number!").prefix().build());
return Prompt.END_OF_CONVERSATION;
}
int number = Integer.parseInt(input);
- if (setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases") != null) {
- if (number >= setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases").getKeys(false).size()) {
+ if(setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases") != null) {
+ if(number >= setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases").getKeys(false).size()) {
context.getForWhom().sendRawMessage(new MessageBuilder("&cTry again. The number is higher than bases that you have!").prefix().build());
return Prompt.END_OF_CONVERSATION;
}
@@ -195,9 +206,9 @@ public Prompt acceptInput(ConversationContext context, String input) {
public int getId(Player player) {
- if (!BaseUtilities.check(player)) {
+ if(!BaseUtilities.check(player)) {
int id = 0;
- if (setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases") != null) {
+ if(setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases") != null) {
id = setupInventory.getConfig().getConfigurationSection("instances." + setupInventory.getArenaKey() + ".bases").getKeys(false).size();
}
BaseUtilities.getBaseId().put(player, id);
diff --git a/src/main/java/plugily/projects/thebridge/kits/KitUtils.java b/src/main/java/plugily/projects/thebridge/kits/KitUtils.java
index f65b5833..d9e46aec 100644
--- a/src/main/java/plugily/projects/thebridge/kits/KitUtils.java
+++ b/src/main/java/plugily/projects/thebridge/kits/KitUtils.java
@@ -27,15 +27,17 @@ public static ItemStack handleItem(PluginMain plugin, Player player, ItemStack i
plugin.getDebugger().performance("Kit", "Arena {0} Handle item method called for player {1} item stack {2}.", arena.getId(), player, itemStack);
// Replaces white terracotta with coloured terracotta if the player is in a team
- if(itemStack.getType().equals(XMaterial.matchXMaterial(plugin.getConfig().getString("Kit.Colored-Block-Replace-Material", "WHITE_WOOL")).orElse(XMaterial.WHITE_WOOL).parseMaterial())) {
+ if(XMaterial.matchXMaterial(plugin.getConfig().getString("Kit.Colored-Block-Replace-Material", "WHITE_WOOL")).orElse(XMaterial.WHITE_WOOL).isSimilar(itemStack)) {
Optional material = XMaterial.matchXMaterial(arena.getBase(player).getMaterialColor().toUpperCase() + "_" + plugin.getConfig().getString("Kit.Colored-Block-Material", "WOOL"));
- material.ifPresent(xMaterial -> itemStack.setType(Objects.requireNonNull(xMaterial.parseMaterial())));
+ material.ifPresent(xMaterial -> {
+ xMaterial.setType(itemStack);
+ });
plugin.getDebugger().performance("Kit", "Arena {0} Changing coloured block to {1}.", arena.getId(), arena.getBase(player).getMaterialColor().toUpperCase() + "_" + plugin.getConfig().getString("Kit.Colored-Block-Material", "WOOL"));
return itemStack;
}
// Replaces leather armour with the coloured leather armour if the player is in a team
- if(itemStack.getType().equals(XMaterial.LEATHER_HELMET.parseMaterial()) || itemStack.getType().equals(XMaterial.LEATHER_CHESTPLATE.parseMaterial()) || itemStack.getType().equals(XMaterial.LEATHER_LEGGINGS.parseMaterial()) || itemStack.getType().equals(XMaterial.LEATHER_BOOTS.parseMaterial())) {
+ if(XMaterial.LEATHER_HELMET.isSimilar(itemStack) || XMaterial.LEATHER_CHESTPLATE.isSimilar(itemStack) || XMaterial.LEATHER_LEGGINGS.isSimilar(itemStack) || XMaterial.LEATHER_BOOTS.isSimilar(itemStack)) {
LeatherArmorMeta itemMeta = (LeatherArmorMeta) itemStack.getItemMeta();
assert itemMeta != null;
itemMeta.setColor(ColorUtil.fromChatColor(ChatColor.valueOf(arena.getBase(player).getColor().toUpperCase())));