Skip to content

Commit

Permalink
Merge pull request #40 from IamTheDefender/development
Browse files Browse the repository at this point in the history
Some changes I forgot to push
  • Loading branch information
IamTheDefender authored Feb 4, 2024
2 parents 8b13cf8 + 3d9f620 commit 1e1185d
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>me.defender</groupId>
<artifactId>BW1058-Cosmetics</artifactId>
<artifactId>BedWars-Cosmetics</artifactId>
<version>1.4.6</version>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package me.defender.cosmetics.api.handler;

public enum HandlerType {
BUNGEE, SHARED, MULTIARENA;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ public interface IHandler {
IArenaUtil getArenaUtil();
ILanguage getLanguageUtil();
String getAddonPath();
HandlerType getHandlerType();

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public void register() {

}

@Override
public HandlerType getHandlerType() {
return HandlerType.BUNGEE;
}

@Override
public ISetupSession getSetupSession(UUID playerUUID) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1e1185d

Please sign in to comment.