diff --git a/libs/public/BedwarsAPI-5.3.3.jar b/libs/public/BedwarsAPI-5.3.3.jar
deleted file mode 100644
index 222b69c..0000000
Binary files a/libs/public/BedwarsAPI-5.3.3.jar and /dev/null differ
diff --git a/libs/public/BedwarsAPI-5.4.5.jar b/libs/public/BedwarsAPI-5.4.5.jar
new file mode 100644
index 0000000..6cbd504
Binary files /dev/null and b/libs/public/BedwarsAPI-5.4.5.jar differ
diff --git a/pom.xml b/pom.xml
index c2b9e68..7991e06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.metallicgoat
MBedwarsTweaks
- 4.1.0
+ 4.1.2
@@ -36,11 +36,18 @@
2.11.3
provided
+
+
+
+
+
+
de.marcely.bedwars
API
- 5.4.4
- provided
+ 5.4.5
+ system
+ ${basedir}/libs/public/BedwarsAPI-5.4.5.jar
me.metallicgoat.hotbarmanageraddon
@@ -56,13 +63,6 @@
system
${basedir}/libs/public/PrestigeAddonAPI-1.2.0.jar
-
-
-
-
-
-
-
org.projectlombok
lombok
diff --git a/src/main/java/me/metallicgoat/tweaksaddon/MBedwarsTweaksPlugin.java b/src/main/java/me/metallicgoat/tweaksaddon/MBedwarsTweaksPlugin.java
index e2adcfd..cc426bf 100644
--- a/src/main/java/me/metallicgoat/tweaksaddon/MBedwarsTweaksPlugin.java
+++ b/src/main/java/me/metallicgoat/tweaksaddon/MBedwarsTweaksPlugin.java
@@ -17,8 +17,8 @@
public class MBedwarsTweaksPlugin extends JavaPlugin {
- public static final int MIN_MBEDWARS_API_VER = 100;
- public static final String MIN_MBEDWARS_VER_NAME = "5.4";
+ public static final int MIN_MBEDWARS_API_VER = 104;
+ public static final String MIN_MBEDWARS_VER_NAME = "5.4.5";
@Getter
private static MBedwarsTweaksPlugin instance;
diff --git a/src/main/java/me/metallicgoat/tweaksaddon/tweaks/misc/LockTeamChest.java b/src/main/java/me/metallicgoat/tweaksaddon/tweaks/misc/LockTeamChest.java
index cb85f2d..771b31c 100644
--- a/src/main/java/me/metallicgoat/tweaksaddon/tweaks/misc/LockTeamChest.java
+++ b/src/main/java/me/metallicgoat/tweaksaddon/tweaks/misc/LockTeamChest.java
@@ -1,24 +1,42 @@
package me.metallicgoat.tweaksaddon.tweaks.misc;
-import de.marcely.bedwars.api.BedwarsAPI;
import de.marcely.bedwars.api.arena.Arena;
-import de.marcely.bedwars.api.arena.ArenaStatus;
import de.marcely.bedwars.api.arena.Team;
+import de.marcely.bedwars.api.event.player.PlayerOpenArenaChestEvent;
import de.marcely.bedwars.api.message.Message;
import de.marcely.bedwars.tools.location.XYZYP;
import me.metallicgoat.tweaksaddon.config.MainConfig;
import org.bukkit.Location;
-import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
public class LockTeamChest implements Listener {
- private static Team getChestTeam(Arena arena, Block chest) {
+ @EventHandler
+ public void playerOpenArenaChest(PlayerOpenArenaChestEvent event) {
+ // Dont mess with TeamChests, handled by MBedwars
+ if (!MainConfig.lock_team_chest_enabled || event.isTeamChest())
+ return;
+
+ final Arena arena = event.getArena();
+ final Player player = event.getPlayer();
+ final Team playerTeam = event.getTeam();
+ final Team chestTeam = getChestTeam(arena, event.getChestBlock());
+
+ if (chestTeam != null && !arena.getPlayersInTeam(chestTeam).isEmpty() && chestTeam != playerTeam) {
+ final String failOpen = Message.build(MainConfig.lock_team_chest_fail_open)
+ .placeholder("team-name", chestTeam.getDisplayName())
+ .placeholder("team", chestTeam.getDisplayName())
+ .done();
+
+ player.sendMessage(failOpen);
+ event.setCancelled(true);
+ }
+ }
+
+ private Team getChestTeam(Arena arena, Block chest) {
if (arena.getGameWorld() == chest.getWorld()) {
for (Team team : arena.getEnabledTeams()) {
final XYZYP spawn = arena.getTeamSpawn(team);
@@ -32,39 +50,7 @@ private static Team getChestTeam(Arena arena, Block chest) {
}
}
}
- return null;
- }
-
- @EventHandler
- public void onChestOpen(PlayerInteractEvent e) {
- if (!MainConfig.lock_team_chest_enabled)
- return;
-
- final Player player = e.getPlayer();
- final Arena arena = BedwarsAPI.getGameAPI().getArenaByPlayer(player);
- final Block block = e.getClickedBlock();
-
- // Check if player is opening chest in an arena
- if (arena == null ||
- arena.getStatus() != ArenaStatus.RUNNING ||
- block == null ||
- e.getAction() != Action.RIGHT_CLICK_BLOCK)
- return;
-
- if (block.getType() == Material.CHEST) {
- final Team playerTeam = arena.getPlayerTeam(player);
- final Team chestTeam = getChestTeam(arena, block);
- if (chestTeam != null && !arena.getPlayersInTeam(chestTeam).isEmpty() && chestTeam != playerTeam) {
-
- final String failOpen = Message.build(MainConfig.lock_team_chest_fail_open)
- .placeholder("team-name", chestTeam.getDisplayName())
- .placeholder("team", chestTeam.getDisplayName())
- .done();
-
- player.sendMessage(failOpen);
- e.setCancelled(true);
- }
- }
+ return null;
}
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index a296d68..1b5475b 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: MBedwarsTweaks
-version: 4.1.0
+version: 4.1.2
author: MetallicGoat
main: me.metallicgoat.tweaksaddon.MBedwarsTweaksPlugin
description: Adds some extra customizability to MBedwars