diff --git a/pom.xml b/pom.xml
index 05c4c78a..79586cab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
me.defender
- BW1058-Cosmetics
+ BedWars-Cosmetics
1.4.6
jar
diff --git a/src/main/java/me/defender/cosmetics/api/handler/HandlerType.java b/src/main/java/me/defender/cosmetics/api/handler/HandlerType.java
new file mode 100644
index 00000000..5841a414
--- /dev/null
+++ b/src/main/java/me/defender/cosmetics/api/handler/HandlerType.java
@@ -0,0 +1,5 @@
+package me.defender.cosmetics.api.handler;
+
+public enum HandlerType {
+ BUNGEE, SHARED, MULTIARENA;
+}
diff --git a/src/main/java/me/defender/cosmetics/api/handler/IHandler.java b/src/main/java/me/defender/cosmetics/api/handler/IHandler.java
index f4211b18..35ec12b6 100644
--- a/src/main/java/me/defender/cosmetics/api/handler/IHandler.java
+++ b/src/main/java/me/defender/cosmetics/api/handler/IHandler.java
@@ -11,5 +11,6 @@ public interface IHandler {
IArenaUtil getArenaUtil();
ILanguage getLanguageUtil();
String getAddonPath();
+ HandlerType getHandlerType();
}
diff --git a/src/main/java/me/defender/cosmetics/category/projectiletrails/ProjectileHandler.java b/src/main/java/me/defender/cosmetics/category/projectiletrails/ProjectileHandler.java
index 7c7a4013..0b4498f3 100644
--- a/src/main/java/me/defender/cosmetics/category/projectiletrails/ProjectileHandler.java
+++ b/src/main/java/me/defender/cosmetics/category/projectiletrails/ProjectileHandler.java
@@ -10,7 +10,6 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
-import static me.defender.cosmetics.util.Utility.plugin;
public class ProjectileHandler implements Listener {
diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java
index b8c65fd3..a5b161ea 100644
--- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java
+++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java
@@ -11,6 +11,7 @@
import me.defender.cosmetics.Cosmetics;
import me.defender.cosmetics.api.cosmetics.CosmeticsType;
import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin;
+import me.defender.cosmetics.api.handler.HandlerType;
import me.defender.cosmetics.api.handler.IHandler;
import me.defender.cosmetics.util.DebugUtil;
import me.defender.cosmetics.util.MathUtil;
@@ -78,11 +79,12 @@ public void run() {
}
}
}
-
- for (Player p : team.getMembers()) {
- IHandler handler = plugin.getHandler();
- handler.getScoreboardUtil().removePlayerScoreboard(p);
- handler.getScoreboardUtil().giveScoreboard(p, true);
+ if(plugin.getHandler().getHandlerType() != HandlerType.BUNGEE){
+ for (Player p : team.getMembers()) {
+ IHandler handler = plugin.getHandler();
+ handler.getScoreboardUtil().removePlayerScoreboard(p);
+ handler.getScoreboardUtil().giveScoreboard(p, true);
+ }
}
}
}
diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java
index c26a56f5..ad76ba28 100644
--- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java
+++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java
@@ -1,13 +1,13 @@
package me.defender.cosmetics.category.shopkeeperskins;
import com.hakan.core.HCore;
-import com.tomkeuper.bedwars.api.BedWars;
import com.tomkeuper.bedwars.api.arena.GameState;
import com.tomkeuper.bedwars.api.arena.team.ITeam;
import com.tomkeuper.bedwars.api.events.gameplay.GameStateChangeEvent;
import me.defender.cosmetics.Cosmetics;
import me.defender.cosmetics.api.cosmetics.CosmeticsType;
import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin;
+import me.defender.cosmetics.api.handler.HandlerType;
import me.defender.cosmetics.api.handler.IHandler;
import me.defender.cosmetics.util.DebugUtil;
import me.defender.cosmetics.util.MathUtil;
@@ -68,10 +68,13 @@ public void run() {
}
}
- for (Player p : team.getMembers()) {
- IHandler api = Cosmetics.getInstance().getHandler();
- api.getScoreboardUtil().removePlayerScoreboard(p);
- api.getScoreboardUtil().giveScoreboard(p, true);
+
+ if(Cosmetics.getInstance().getHandler().getHandlerType() != HandlerType.BUNGEE){
+ for (Player p : team.getMembers()) {
+ IHandler handler = Cosmetics.getInstance().getHandler();
+ handler.getScoreboardUtil().removePlayerScoreboard(p);
+ handler.getScoreboardUtil().giveScoreboard(p, true);
+ }
}
}
}
diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java
index aab2327e..81197ee7 100644
--- a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java
+++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java
@@ -2,6 +2,7 @@
import com.andrei1058.bedwars.api.BedWars;
import com.andrei1058.bedwars.api.language.Language;
+import com.andrei1058.bedwars.api.server.ServerType;
import com.hakan.core.HCore;
import me.defender.cosmetics.Cosmetics;
import me.defender.cosmetics.api.handler.*;
@@ -43,6 +44,13 @@ public void register() {
HCore.registerListeners(new SpraysHandler1058());
}
+ @Override
+ public HandlerType getHandlerType() {
+ if(api.getServerType() == ServerType.SHARED) return HandlerType.SHARED;
+ if(api.getServerType() == ServerType.BUNGEE) return HandlerType.BUNGEE;
+ return HandlerType.MULTIARENA;
+ }
+
@Override
public IArenaUtil getArenaUtil() {
return player -> {
diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java
index 751a7a10..857f016f 100644
--- a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java
+++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java
@@ -16,6 +16,11 @@ public void register() {
}
+ @Override
+ public HandlerType getHandlerType() {
+ return HandlerType.BUNGEE;
+ }
+
@Override
public ISetupSession getSetupSession(UUID playerUUID) {
return null;
diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java
index 961589f7..9ea4856a 100644
--- a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java
+++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java
@@ -4,6 +4,8 @@
import com.tomkeuper.bedwars.api.BedWars;
import com.tomkeuper.bedwars.api.language.Language;
import java.io.File;
+
+import com.tomkeuper.bedwars.api.server.ServerType;
import me.defender.cosmetics.Cosmetics;
import me.defender.cosmetics.api.handler.*;
import me.defender.cosmetics.category.bedbreakeffects.BedDestroyHandler2023;
@@ -45,6 +47,13 @@ public void register() {
HCore.registerListeners(new DeathCryHandler2023());
}
+ @Override
+ public HandlerType getHandlerType() {
+ if(api.getServerType() == ServerType.SHARED) return HandlerType.SHARED;
+ if(api.getServerType() == ServerType.BUNGEE) return HandlerType.BUNGEE;
+ return HandlerType.MULTIARENA;
+ }
+
@Override
public IArenaUtil getArenaUtil() {
diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java
index f75665c2..13672f89 100644
--- a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java
+++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java
@@ -16,6 +16,11 @@ public void register() {
// What should be here?
}
+ @Override
+ public HandlerType getHandlerType() {
+ return HandlerType.BUNGEE;
+ }
+
@Override
public String getAddonPath() {
return BedWarsProxy.getPlugin().getDataFolder().getPath() + File.separator + "Addons" + File.separator + Cosmetics.getInstance().getDescription().getName();