diff --git a/src/main/java/de/fanta/challenges/challenges/BingoChallengeEvent.java b/src/main/java/de/fanta/challenges/challenges/BingoChallengeEvent.java index 4b88053..3d8b09f 100644 --- a/src/main/java/de/fanta/challenges/challenges/BingoChallengeEvent.java +++ b/src/main/java/de/fanta/challenges/challenges/BingoChallengeEvent.java @@ -38,12 +38,14 @@ public class BingoChallengeEvent implements Listener { private static final Map> playerMaterials = new HashMap<>(); + + private static final Map> teamMaterials = new HashMap<>(); private static boolean running; private static boolean eventend = false; private static List materials = new ArrayList<>(); - private static BossBar bossBar = Bukkit.createBossBar(ChatUtil.GREEN + "Nutze " + ChatUtil.BLUE + "/bingo" + ChatUtil.GREEN + " um die Items zu sehen", BarColor.GREEN, BarStyle.SOLID); + private static final BossBar bossBar = Bukkit.createBossBar(ChatUtil.GREEN + "Nutze " + ChatUtil.BLUE + "/bingo" + ChatUtil.GREEN + " um die Items zu sehen", BarColor.GREEN, BarStyle.SOLID); private final Challenges plugin = Challenges.getPlugin(); public static List getMaterials() { @@ -58,6 +60,11 @@ return playerMaterials; } + public static Map> getTeamMaterials() { + return playerMaterials; + } + + public static boolean isRunning() { return running; } @@ -145,6 +152,14 @@ if (isRunning()) { bossBar.setVisible(true); bossBar.addPlayer(e.getPlayer()); + + if (plugin.getConfig().getBoolean("event.teams")) { + ChallengeTeam team = TeamUtils.getPlayerTeam(e.getPlayer()); + if (team != null) { + playerMaterials.remove(e.getPlayer().getUniqueId()); + playerMaterials.put(e.getPlayer().getUniqueId(), teamMaterials.get(team)); + } + } } } @@ -187,6 +202,7 @@ if (!items.contains(material)) { items.add(material); playerMaterials.put(onlinePlayer.getUniqueId(), items); + teamMaterials.put(team, items); if (!scoreset) { plugin.getScoreManager().updateTeamScore(onlinePlayer, 1); scoreset = true; diff --git a/src/main/java/de/fanta/challenges/commands/LeaveCommand.java b/src/main/java/de/fanta/challenges/commands/LeaveCommand.java index 6780fdb..526f80e 100644 --- a/src/main/java/de/fanta/challenges/commands/LeaveCommand.java +++ b/src/main/java/de/fanta/challenges/commands/LeaveCommand.java @@ -26,7 +26,7 @@ ChatUtil.sendErrorMessage(sender, "You are not a Player :>"); return true; } else { - if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { + if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_LOAD || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { GlobalApi.portOnlinePlayerToLocation(p.getName(), "challenge"); } else if (plugin.getServerType() == ServerType.ADVENTURE) { GlobalApi.portOnlinePlayerToLocation(p.getName(), "adventure"); diff --git a/src/main/java/de/fanta/challenges/commands/reset/ResetConfirmCommand.java b/src/main/java/de/fanta/challenges/commands/reset/ResetConfirmCommand.java index 7cb521a..4f9ee5c 100644 --- a/src/main/java/de/fanta/challenges/commands/reset/ResetConfirmCommand.java +++ b/src/main/java/de/fanta/challenges/commands/reset/ResetConfirmCommand.java @@ -45,7 +45,7 @@ plugin.getTimer().setTime(0); Bukkit.getPluginManager().callEvent(new EventStatusChangedEvent(false)); for (Player p : Bukkit.getOnlinePlayers()) { - if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { + if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_LOAD || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { p.sendTitle(ChatUtil.BLUE + "Server wird zurückgesetzt!", ChatUtil.RED + "Bitte warte einen Moment" + ChatUtil.BLUE + "." + ChatUtil.GREEN + "." + ChatUtil.YELLOW + ".", 10, 220, 10); GlobalApi.portOnlinePlayerToLocation(p.getName(), "challenge"); } else if (plugin.getServerType() == ServerType.ADVENTURE) { diff --git a/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java b/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java index 639e9a7..5054d4d 100644 --- a/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java +++ b/src/main/java/de/fanta/challenges/utils/SaveWorldUtils.java @@ -48,7 +48,7 @@ File savenether = new File(uuid + "/world_nether"); File saveworld = new File(uuid + "/world"); File saveconfigs = new File(uuid + "/Challenges"); - if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { + if (plugin.getServerType() == ServerType.CHALLENGE || plugin.getServerType() == ServerType.CHALLENGE_LOAD || plugin.getServerType() == ServerType.CHALLENGE_EVENT) { File loaddir; if (autosafe) { loaddir = new File("/home/minecraft/saves/" + uuid + "/autosave/");