diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_5_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_5_R0_1_SNAPSHOT.xml
index b9b492d..10424ef 100644
--- a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_5_R0_1_SNAPSHOT.xml
+++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_5_R0_1_SNAPSHOT.xml
@@ -1,13 +1,13 @@
-
+
-
+
-
+
\ No newline at end of file
diff --git a/Bingo.iml b/Bingo.iml
index edd4529..d2853b6 100644
--- a/Bingo.iml
+++ b/Bingo.iml
@@ -29,9 +29,9 @@
-
+
-
+
diff --git a/pom.xml b/pom.xml
index bed8b59..f5052e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,9 +78,9 @@
com.github.PMFRTT
Core
- 16.5.32-dev
+ 16.5.40-dev
system
- C:\Code\Java\Bukkit\Core\target\Core-16.5.32-dev.jar
+ C:\Code\Java\Bukkit\Core\target\Core-16.5.40-dev.jar
diff --git a/src/main/java/bingo/Banner.java b/src/main/java/bingo/Banner.java
index 06a0204..3699f8c 100644
--- a/src/main/java/bingo/Banner.java
+++ b/src/main/java/bingo/Banner.java
@@ -22,7 +22,8 @@
public class Banner {
private static HashMap playerTimers = new HashMap();
- private static HashMap playerIndexTimers = new HashMap();
+ private static final HashMap playerIndexTimers = new HashMap();
+ private static boolean isRunning = false;
private static Plugin plugin;
@@ -48,17 +49,20 @@ public void run() {
Timer timer = playerTimers.get(player.getDisplayName());
Random random = new Random();
if (timer.getSeconds() == ((Integer) BingoPlugin.getBingoSettings().banningSettings.getSettingbyName("Erster Timeout").getValue() + playerIndexTimers.get(player.getDisplayName()) * (Integer) BingoPlugin.getBingoSettings().banningSettings.getSettingbyName("Bann Abstand").getValue()) && BingoInventory.bannedItem.get(player.getDisplayName()).size() < core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().banningSettings, "Anzahl der Items")) {
- while (!banItem(player, BingoList.getBingoList().get(random.nextInt(BingoList.getBingoList().size()))));
+ while (!banItem(player, BingoList.getBingoList().get(random.nextInt(BingoList.getBingoList().size()))))
+ ;
}
}
}
+ isRunning = !done;
if (done) {
for (Player player : Bukkit.getOnlinePlayers()) {
player.closeInventory();
if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Scatter Players")) {
- scatterPlayer(player, scatterSize, true);
+ scatterPlayer(player, scatterSize, true, false);
}
}
+ isRunning = false;
cancel();
}
}
@@ -67,17 +71,18 @@ public void run() {
public static boolean banItem(Player player, Material material) {
if (BingoInventory.bannedItem.get(player.getDisplayName()).size() < core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().banningSettings, "Anzahl der Items")) {
- if (!BingoList.playerCollectedList.get(player.getDisplayName()).contains(material)) {
- assert BingoList.getBingoList() != null;
- CheckInventory.playerBans.get(player.getDisplayName()).add(BingoList.getBingoList().indexOf(material));
- BingoInventory.bannedItem.get(player.getDisplayName()).add(material);
- BingoList.addMaterialToCollected(player, material);
- SideList.updateScoreboard();
- playerIndexTimers.put(player.getDisplayName(), playerIndexTimers.get(player.getDisplayName()) + 1);
- return true;
- }
+ assert BingoList.getBingoList() != null;
+ CheckInventory.playerBans.get(player.getDisplayName()).add(BingoList.getBingoList().indexOf(material));
+ BingoInventory.bannedItem.get(player.getDisplayName()).add(material);
+ BingoList.addMaterialToCollected(player, material);
+ playerIndexTimers.put(player.getDisplayName(), playerIndexTimers.get(player.getDisplayName()) + 1);
+ return true;
}
return false;
}
+ public static boolean getRunning(){
+ return isRunning;
+ }
+
}
diff --git a/src/main/java/bingo/SideList.java b/src/main/java/bingo/SideList.java
index d959111..d7c58b7 100644
--- a/src/main/java/bingo/SideList.java
+++ b/src/main/java/bingo/SideList.java
@@ -1,5 +1,6 @@
package bingo;
+import bingo.eventhandler.CheckInventory;
import bingo.main.BingoInventory;
import bingo.main.BingoList;
import bingo.main.BingoPlugin;
@@ -23,7 +24,7 @@
public class SideList {
- Plugin plugin;
+ private static Plugin plugin;
private static final HashMap playerScoreboards = new HashMap();
private static final HashMap playerScoreboardsDisplay = new HashMap();
@@ -41,10 +42,14 @@ public void init() {
public void createPlayerScoreBoards() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!playerScoreboards.containsKey(player.getDisplayName())) {
- Scoreboard scoreboard = new Scoreboard(ScoreboardType.STATIC_TITLE, new ArrayList() {{
- add("Bingo");
+ Scoreboard scoreboard = new Scoreboard(ScoreboardType.MULTI_TITLE, new ArrayList() {{
+ add(core.Utils.colorize(core.Utils.getRainbowString("Bingo") + "&f - by PMFRTT"));
+ add(core.Utils.colorize("Gefundene Items: &6" + BingoList.playerCollectedList.get(player.getDisplayName()).size() + "&7/&a" + BingoList.bingoList.size()));
}}, 0);
- ScoreboardDisplay scoreboardDisplay = new ScoreboardDisplay(this.plugin, player);
+ scoreboard.addScore(new Score("", 2));
+ ScoreboardDisplay scoreboardDisplay = new ScoreboardDisplay(plugin, player);
+ scoreboardDisplay.setScoreboard(scoreboard);
+ scoreboardDisplay.enableTitlesList(300);
playerScoreboards.put(core.Utils.getDisplayName(player), scoreboard);
playerScoreboardsDisplay.put(core.Utils.getDisplayName(player), scoreboardDisplay);
} else {
@@ -56,50 +61,82 @@ public void createPlayerScoreBoards() {
}
public static void updateScoreboard() {
- for (String name : playerScoreboards.keySet()) {
- Player player = Bukkit.getPlayer(name);
- Scoreboard scoreboard = playerScoreboards.get(name);
- List scores = new ArrayList();
- for (Score score : scoreboard.getScores()) {
- scores.add(score.getContent());
- }
- for (Material material : BingoList.getBingoList(Objects.requireNonNull(player))) {
- if (BingoList.playerCollectedList.get(name).contains(material)) {
- removeScore(player, material);
- Objects.requireNonNull(SummarizerCore.getSummarization(player)).lockedItem(material);
- scoreboard.addScore(new Score(core.Utils.colorize("&a" + Utils.formatMaterialName(material)), -1));
- } else if (player.getInventory().contains(material)) {
- removeScore(player, material);
- Objects.requireNonNull(SummarizerCore.getSummarization(player)).collectedItem(material);
- scoreboard.addScore(new Score(core.Utils.colorize("&b" + Utils.formatMaterialName(material)), 0));
- } else {
- removeScore(player, material);
- scoreboard.addScore(new Score(core.Utils.colorize("&c" + Utils.formatMaterialName(material)), 1));
+ if (!BingoPlugin.getTimer().isPaused()) {
+ CheckInventory.checkInventory(BingoList.bingoList.size());
+ for (String name : playerScoreboards.keySet()) {
+ Player player = Bukkit.getPlayer(name);
+ Scoreboard scoreboard = playerScoreboards.get(name);
+ List scores = new ArrayList();
+ for (Score score : scoreboard.getScores()) {
+ scores.add(score.getContent());
}
- BingoInventory.updateInventory(player);
- }
- int i = 0;
- for (Score score : scoreboard.getScores()) {
- if (scores.contains(score.getContent())) {
- i++;
+ for (Material material : BingoList.getBingoList(Objects.requireNonNull(player))) {
+ if (BingoList.playerCollectedList.get(name).contains(material)) {
+ removeScore(player, material);
+ Objects.requireNonNull(SummarizerCore.getSummarization(player)).lockedItem(material);
+ Score score = new Score(core.Utils.colorize("&a" + Utils.formatMaterialName(material)), -3);
+ score.setSuffix("&7 gefunden!");
+ scoreboard.addScore(score);
+ } else if (player.getInventory().contains(material)) {
+ removeScore(player, material);
+ Objects.requireNonNull(SummarizerCore.getSummarization(player)).collectedItem(material);
+ Score score = new Score(core.Utils.colorize("&b" + Utils.formatMaterialName(material)), 1);
+ score.setPrefix("&7Sperre ");
+ score.setSuffix("&7!");
+ scoreboard.addScore(score);
+ } else {
+ removeScore(player, material);
+ Score score = new Score(core.Utils.colorize("&c" + Utils.formatMaterialName(material)), 0);
+ if (BingoList.contains(material) == 0) {
+ score.setValue(0);
+ score.setPrefix("(&aX&f) &7Finde ");
+ } else if (BingoList.contains(material) == 1) {
+ score.setValue(-1);
+ score.setPrefix("(&6X&f) &7Finde ");
+ } else if (BingoList.contains(material) == 2) {
+ score.setValue(-2);
+ score.setPrefix("(&cX&f) &7Finde ");
+ }
+ score.setSuffix("&7!");
+ scoreboard.addScore(score);
+ }
+
+ scoreboard.getTitles().set(1, core.Utils.colorize("Gefundene Items: &6" + BingoList.playerCollectedList.get(player.getDisplayName()).size() + "&7/&a" + BingoList.bingoList.size()));
+ BingoInventory.updateInventory(player);
+ }
+ int i = 0;
+ for (Score score : scoreboard.getScores()) {
+ if (scores.contains(score.getContent())) {
+ i++;
+ }
+ }
+ if (i != BingoList.bingoList.size()) {
+ startRender(player);
}
- }
- if (i != core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Items")) {
- startRender(player);
}
}
}
private static void removeScore(Player player, Material material) {
- Scoreboard scoreboard = playerScoreboards.get(player.getDisplayName());
+
+ Scoreboard scoreboard = getScoreboard(player);
+
scoreboard.removeScoreByName(core.Utils.colorize("&a" + Utils.formatMaterialName(material)));
scoreboard.removeScoreByName(core.Utils.colorize("&b" + Utils.formatMaterialName(material)));
scoreboard.removeScoreByName(core.Utils.colorize("&c" + Utils.formatMaterialName(material)));
}
private static void startRender(Player player) {
- playerScoreboardsDisplay.get(player.getDisplayName()).renderScoreboard(playerScoreboards.get(player.getDisplayName()));
- DebugSender.sendDebug(DebugType.GUI, "rendered sidelist", "Sidelist");
+
+ Scoreboard scoreboard = getScoreboard(player);
+ ScoreboardDisplay display = getScoreboardDisplay(player);
+
+ if (scoreboard.getType().equals(ScoreboardType.STATIC_TITLE) || scoreboard.getType().equals(ScoreboardType.MULTI_TITLE)) {
+ display.renderScoreboard();
+ DebugSender.sendDebug(DebugType.GUI, "rendered sidelist", "Sidelist");
+ } else {
+ System.err.println("could not start render of scoreboard because the ScoreBoardType is not STATIC_TITLE (bingo.SideList:126)");
+ }
}
public static void removePlayer(Player player) {
@@ -107,4 +144,11 @@ public static void removePlayer(Player player) {
playerScoreboardsDisplay.remove(player.getDisplayName());
}
-}
+ private static Scoreboard getScoreboard(Player player) {
+ return playerScoreboards.get(player.getDisplayName());
+ }
+
+ private static ScoreboardDisplay getScoreboardDisplay(Player player) {
+ return playerScoreboardsDisplay.get(player.getDisplayName());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/bingo/Utils.java b/src/main/java/bingo/Utils.java
index 6d023f4..7db66e8 100644
--- a/src/main/java/bingo/Utils.java
+++ b/src/main/java/bingo/Utils.java
@@ -9,6 +9,7 @@
import core.core.CoreMain;
import core.debug.DebugSender;
import core.debug.DebugType;
+import core.hotbar.HotbarScheduler;
import core.timer.Timer;
import core.timer.TimerType;
import org.apache.commons.lang.WordUtils;
@@ -16,8 +17,10 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
+import org.graalvm.compiler.core.common.util.Util;
import java.util.Random;
+import java.util.Vector;
public class Utils {
@@ -28,15 +31,20 @@ public Utils(BingoPlugin main) {
}
public void init() {
+ core.Utils.changeGamerule(GameRule.DO_DAYLIGHT_CYCLE, false);
Banner banner = new Banner(main);
BingoPlugin.setTimer(new Timer(main, TimerType.INCREASING, "Das Bingo läuft seit: &b", "&cDas Bingo ist pausiert", false));
for (Player player : Bukkit.getOnlinePlayers()) {
- CoreMain.hotbarManager.getHotbarScheduler(player).setTimer(BingoPlugin.getTimer());
- CoreMain.hotbarManager.getHotbarScheduler(player).startScheduler(false);
+
+ HotbarScheduler hotbarScheduler = CoreMain.hotbarManager.getHotbarScheduler(player);
+
+ hotbarScheduler.setTimer(BingoPlugin.getTimer());
+ hotbarScheduler.startScheduler(false);
}
}
- private static void startCompletedChecker(){
+
+ private static void startCompletedChecker() {
BukkitScheduler scheduler = main.getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(main, new Runnable() {
@@ -45,12 +53,30 @@ private static void startCompletedChecker(){
public void run() {
if (!BingoPlugin.getTimer().isPaused()) {
for (Player player : Bukkit.getOnlinePlayers()) {
+ getFacing(player.getLocation());
if (!BingoList.completed(player)) {
BingoInventory.updateInventory(player);
- CheckInventory.checkInventory(player,core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Items"));
+ CheckInventory.checkInventory(BingoList.bingoList.size());
+ SideList.updateScoreboard();
+ if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+ if (BingoPlugin.getTimer().getTicks() <= 0) {
+ core.Utils.sendMessageToEveryone(core.Utils.getPrefix("Bingo") + core.Utils.colorize("Du hast das Bingo nach &c" + core.Utils.formatTimerTimeTicksTwoDecimal(SummarizerCore.getTimer().getTicks()) + "&f leider nicht geschafft!"));
+ core.Utils.playSoundForAll(Sound.ENTITY_ENDER_DRAGON_DEATH, 1f, .75f);
+ SummarizerCore.getTimer().pause();
+ for (Player player1 : Bukkit.getOnlinePlayers()) {
+ player1.openInventory(BingoInventory.getPlayerInventory(player));
+ }
+ }
+ }
} else {
BingoPlugin.getTimer().pause();
- core.Utils.sendMessageToEveryone(core.Utils.getPrefix("Bingo") + core.Utils.colorize("&e" + core.Utils.getDisplayName(player) + " &fhat das Bingo in &a" + core.Utils.formatTimerTimeTicksThreeDecimal(BingoPlugin.getTimer().getTicks()) + "&f beendet!"));
+ SummarizerCore.getTimer().pause();
+ if (!core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+ core.Utils.sendMessageToEveryone(core.Utils.getPrefix("Bingo") + core.Utils.colorize("&e" + core.Utils.getDisplayName(player) + " &fhat das Bingo in &a" + core.Utils.formatTimerTimeTicksThreeDecimal(BingoPlugin.getTimer().getTicks()) + "&f beendet!"));
+ } else {
+ core.Utils.sendMessageToEveryone(core.Utils.getPrefix("Bingo") + core.Utils.colorize("&e" + core.Utils.getDisplayName(player) + " &fhat das Bingo in &a" + core.Utils.formatTimerTimeTicksThreeDecimal(SummarizerCore.getTimer().getTicks()) + "&f beendet!"));
+ core.Utils.sendMessageToEveryone(core.Utils.getPrefix("Bingo") + core.Utils.colorize("&e" + core.Utils.getDisplayName(player) + " &fhatte noch &a" + core.Utils.formatTimerTimeTicksThreeDecimal(BingoPlugin.getTimer().getTicks()) + "&f Zeit!"));
+ }
core.Utils.playSoundForAll(Sound.UI_TOAST_CHALLENGE_COMPLETE, 1f, 1f);
for (Player player1 : Bukkit.getOnlinePlayers()) {
player1.openInventory(BingoInventory.getPlayerInventory(player));
@@ -60,15 +86,44 @@ public void run() {
}
}
}, 0L, 1);
+
}
- public static void scatterPlayer(Player player, int scatterSize, boolean fromSpawn) {
+ public static void scatterPlayer(Player player, int scatterSize, boolean fromSpawn, boolean facing) {
Random random = new Random();
World world = Bukkit.getWorld("world");
Location location = player.getLocation();
+
+ float factorX = 0;
+ float factorZ = 0;
+
do {
- double x = (random.nextFloat() - 0.5f) * scatterSize;
- double z = (random.nextFloat() - 0.5f) * scatterSize;
+ if (facing) {
+ switch (getFacing(player.getLocation())) {
+ case "ws":
+ factorX = (random.nextFloat() - 1);
+ factorZ = (random.nextFloat());
+ break;
+ case "es":
+ factorX = (random.nextFloat());
+ factorZ = (random.nextFloat());
+ break;
+ case "en":
+ factorX = (random.nextFloat());
+ factorZ = (random.nextFloat() - 1);
+ break;
+ case "wn":
+ factorX = (random.nextFloat() - 1);
+ factorZ = (random.nextFloat() - 1);
+ break;
+
+ }
+ } else {
+ factorX = (random.nextFloat() - 0.5f);
+ factorZ = (random.nextFloat() - 0.5f);
+ }
+ double x = factorX * scatterSize;
+ double z = factorZ * scatterSize;
location.setX(x);
location.setZ(z);
assert world != null;
@@ -98,7 +153,7 @@ public static void preparePlayers(int scatterSize) {
} else {
if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Scatter Players")) {
for (Player player : Bukkit.getOnlinePlayers())
- scatterPlayer(player, scatterSize, true);
+ scatterPlayer(player, scatterSize, true, false);
}
}
DebugSender.sendDebug(DebugType.PLUGIN, "players have been prepared", "Bingo");
@@ -120,9 +175,13 @@ public static String formatMaterialName(Material material) {
return WordUtils.capitalize(tmp2);
}
+ public static Boolean hasStarted = false;
+
public static void startBingo() {
core.Utils.changeGamerule(GameRule.ANNOUNCE_ADVANCEMENTS, false);
+ core.Utils.changeGamerule(GameRule.DO_DAYLIGHT_CYCLE, true);
+
if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Keep Inventory")) {
core.Utils.changeGamerule(GameRule.KEEP_INVENTORY, true);
@@ -134,7 +193,7 @@ public static void startBingo() {
BingoPlugin.getTimer().setSingle(true);
}
- BingoList.populatePlayerBingoList(core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Schwierigkeit"), core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Items"));
+ BingoList.populatePlayerBingoList(core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().itemSubSettings, "Einfache Items"), core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().itemSubSettings, "Mittlere Items"), core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().itemSubSettings, "Schwere Items"));
bingo.Utils.preparePlayers(core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Scatter-Größe"));
BingoPlugin.sideList.init();
if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Teleporter")) {
@@ -142,7 +201,43 @@ public static void startBingo() {
teleporter.init();
}
startCompletedChecker();
+ for (Player player : Bukkit.getOnlinePlayers()) {
+
+ HotbarScheduler hotbarScheduler = CoreMain.hotbarManager.getHotbarScheduler(player);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Verwende &c/bingo respawn&f um an dem Ort deines Todes zu spawnen!"), 24000, 250, 4000);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Mit &6/top&f kannst du aus einer Höhle an die Oberfläche kommen!"), 24000, 250, 8000);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Du brauchst eine Pause? Verwende &a/bingo pause&f um das Bingo zu pausieren!"), 24000, 250, 12000);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Du möchtest verreisen? Mit &5/rtp&f kannst du dich alle " + (core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().teleporterSubSettings, "Countdown-Zeit")) / 60) + " Minuten teleportieren!", 24000, 250, 16000);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Verlierst du den Überblick? Verwende &e/bingo&f um eine Übersicht über dein Bingo zu erhalten!"), 24000, 250, 20000);
+ hotbarScheduler.scheduleRepeatingMessage(core.Utils.colorize("Hast du einen Bug entdeckt? Mit &4/bug &fkannst du diesen melden!"), 24000, 250, 24000);
+
+ }
+ SummarizerCore summarizerCore = new SummarizerCore(main);
+
BingoPlugin.getTimer().resume();
+ SummarizerCore.getTimer().resume();
+ hasStarted = true;
+ }
+
+ public static Integer nextNine(Integer i) {
+ return (9 - i % 9) + i;
+ }
+
+ private static String getFacing(Location location) {
+
+ StringBuilder direction = new StringBuilder();
+
+ if (location.getDirection().getX() > 0) {
+ direction.append("e");
+ } else {
+ direction.append("w");
+ }
+ if (location.getDirection().getZ() > 0) {
+ direction.append("s");
+ } else {
+ direction.append("n");
+ }
+ return direction.toString();
}
}
diff --git a/src/main/java/bingo/commandExecutor/BingoCommandExecutor.java b/src/main/java/bingo/commandExecutor/BingoCommandExecutor.java
index 6aeac35..554c720 100644
--- a/src/main/java/bingo/commandExecutor/BingoCommandExecutor.java
+++ b/src/main/java/bingo/commandExecutor/BingoCommandExecutor.java
@@ -36,12 +36,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if (command.getLabel().equalsIgnoreCase("Bingo")) {
if (args.length == 0) {
- if (!BingoPlugin.getTimer().isPaused()) {
- assert player != null;
+ assert player != null;
+ if (bingo.Utils.hasStarted) {
BingoInventory.updateInventory(player);
player.openInventory(BingoInventory.getPlayerInventory(player));
} else {
- assert player != null;
player.sendMessage(Utils.getPrefix("Bingo") + Utils.colorize("Das Bingo hat noch &cnicht begonnen&f!"));
}
}
@@ -64,6 +63,25 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
} else if (args[0].equalsIgnoreCase("respawn")) {
assert player != null;
Respawner.respawn(player);
+ } else if (args[0].equalsIgnoreCase("pause")) {
+ if (!BingoPlugin.getTimer().isPaused()) {
+ core.Utils.changeGamerule(GameRule.DO_DAYLIGHT_CYCLE, false);
+ BingoPlugin.getTimer().pause();
+ for (Player player1 : Bukkit.getOnlinePlayers()) {
+ core.core.CoreSendStringPacket.sendPacketToTitle(player1, Utils.colorize("&cPause!"), Utils.colorize("Das Bingo wurde &cpausiert&f!"));
+ }
+ }
+ } else if (args[0].equalsIgnoreCase("resume")) {
+ if (BingoPlugin.getTimer().isPaused()) {
+ if (!core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+
+ core.Utils.changeGamerule(GameRule.DO_DAYLIGHT_CYCLE, true);
+ BingoPlugin.getTimer().resume();
+ for (Player player1 : Bukkit.getOnlinePlayers()) {
+ core.core.CoreSendStringPacket.sendPacketToTitle(player1, Utils.colorize("&aWeiter!"), Utils.colorize("Das Bingo wurde &afortgesetzt&f!"));
+ }
+ }
+ }
}
}
} else if (command.getLabel().equalsIgnoreCase("rtp")) {
diff --git a/src/main/java/bingo/commandExecutor/BingoTabCompleter.java b/src/main/java/bingo/commandExecutor/BingoTabCompleter.java
new file mode 100644
index 0000000..072b4b9
--- /dev/null
+++ b/src/main/java/bingo/commandExecutor/BingoTabCompleter.java
@@ -0,0 +1,29 @@
+package bingo.commandExecutor;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabCompleter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BingoTabCompleter implements TabCompleter {
+ @Nullable
+ @Override
+ public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
+
+ if(args.length == 1){
+ return new ArrayList(){{
+ add("settings");
+ add("start");
+ add("pause");
+ add("resume");
+ add("respawn");
+ }};
+ }
+
+ return null;
+ }
+}
diff --git a/src/main/java/bingo/eventhandler/BingoEventhandler.java b/src/main/java/bingo/eventhandler/BingoEventhandler.java
index e3c6ac5..eb70c93 100644
--- a/src/main/java/bingo/eventhandler/BingoEventhandler.java
+++ b/src/main/java/bingo/eventhandler/BingoEventhandler.java
@@ -4,11 +4,15 @@
import bingo.main.BingoInventory;
import bingo.main.BingoList;
import bingo.main.BingoPlugin;
+import core.core.CoreMain;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.PlayerDropItemEvent;
@@ -17,6 +21,8 @@
import org.bukkit.inventory.ItemStack;
import core.Utils;
+import java.util.Objects;
+
public class BingoEventhandler implements Listener {
BingoPlugin main;
@@ -29,56 +35,92 @@ public void initialize() {
Bukkit.getPluginManager().registerEvents(this, main);
}
+
@EventHandler
- public void onPlayerPickUp(EntityPickupItemEvent e) {
- if (e.getEntity() instanceof Player) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(main, SideList::updateScoreboard, 1L);
+ public void onBlockBroken(BlockBreakEvent e1) {
+ if (BingoPlugin.getTimer().isPaused()) {
+ if (!e1.getPlayer().isOp()) {
+ CoreMain.hotbarManager.getHotbarScheduler(e1.getPlayer()).scheduleMessage(Utils.colorize("&cDu kannst die Welt nicht verändern solange das Bingo pausiert ist!"), 40);
+ e1.setCancelled(true);
+ }
}
}
@EventHandler
- public void onPlayerDrop(PlayerDropItemEvent e) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(main, SideList::updateScoreboard, 1L);
+ public void onEntityDamage(EntityDamageByEntityEvent e2) {
+ if (BingoPlugin.getTimer().isPaused()) {
+ if (!e2.getDamager().isOp()) {
+ if (e2.getDamager() instanceof Player) {
+ CoreMain.hotbarManager.getHotbarScheduler((Player) e2.getDamager()).scheduleMessage(Utils.colorize("&cDu kannst die Welt nicht verändern solange das Bingo pausiert ist!"), 40);
+ }
+ e2.setCancelled(true);
+ }
+ }
}
- @EventHandler
- public void onInventoryClick(InventoryClickEvent e) {
-
- Player player = (Player) e.getWhoClicked();
- if (BingoInventory.getAllInventories().containsValue(e.getInventory())) {
- if (e.getClick().isShiftClick()) {
- if (e.getClickedInventory() == player.getInventory()) {
- SideList.updateScoreboard();
- e.setCancelled(true);
+ @EventHandler
+ public void handleBingoLock(InventoryClickEvent e) {
+ if (BingoInventory.getPlayerInventory((Player) e.getWhoClicked()) != null) {
+ if (!Banner.getRunning()) {
+ if (BingoInventory.getInventories().contains(e.getClickedInventory())) {
+ if (Objects.requireNonNull(CheckInventory.createLockedList(BingoList.getSize())).contains(e.getSlot())) {
+ e.setCancelled(true);
+ }
}
}
+ }
+ }
+
+ @EventHandler
+ public void onPlayerDamage(EntityDamageEvent e) {
+ if (e.getEntity() instanceof Player) {
+ if (BingoPlugin.getTimer().isPaused()) {
+ e.setCancelled(true);
+ }
+ }
+ }
+
+ @EventHandler
+ public void handleBingoUnlock(InventoryClickEvent e) {
+ if (BingoInventory.getPlayerInventory((Player) e.getWhoClicked()) != null) {
if (CheckInventory.getLockedSlots((Player) e.getWhoClicked()).contains(e.getSlot())) {
if (e.getClickedInventory() != e.getWhoClicked().getInventory()) {
if (e.getClick().isShiftClick()) {
- e.getWhoClicked().getInventory().addItem(new ItemStack(e.getCurrentItem().getType(), 1));
- BingoList.removeMaterialFromCollected((Player) e.getWhoClicked(), e.getCurrentItem().getType());
- e.getInventory().setItem(e.getRawSlot(), new ItemStack(Material.AIR));
- CheckInventory.unlockSlot((Player) e.getWhoClicked(), e.getSlot());
+ if (!core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+ e.getWhoClicked().getInventory().addItem(new ItemStack(Objects.requireNonNull(e.getCurrentItem()).getType(), 1));
+ BingoList.removeMaterialFromCollected((Player) e.getWhoClicked(), e.getCurrentItem().getType());
+ e.getInventory().setItem(e.getRawSlot(), new ItemStack(Material.AIR));
+ CheckInventory.unlockSlot((Player) e.getWhoClicked(), e.getSlot());
+ }
}
- SideList.updateScoreboard();
+ Bukkit.getScheduler().scheduleSyncDelayedTask(main, SideList::updateScoreboard, 2L);
e.setCancelled(true);
}
- } else {
- if (CheckInventory.getLockedSize(Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Items")).contains(e.getSlot()) || !CheckInventory.playerBans.get(player.getDisplayName()).contains(e.getSlot())) {
- if (e.getClickedInventory() != e.getWhoClicked().getInventory()) {
- if (CheckInventory.getLockedSize(Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Items")).contains(e.getSlot())) {
- e.setCancelled(true);
- }
- if (BingoInventory.bannedItem.get(player.getDisplayName()).size() < Utils.getSettingValueInt(BingoPlugin.getBingoSettings(),"Anzahl der Items")) {
- if (!e.getCurrentItem().getType().equals(Material.BARRIER)) {
- Banner.banItem((Player) e.getWhoClicked(), e.getCurrentItem().getType());
- player.sendMessage(Utils.getPrefix("Bingo") + Utils.colorize("Du hast &c" + bingo.Utils.formatMaterialName(e.getCurrentItem().getType()) + " &ferfolgreich &cgebannt&f!"));
- } else {
- player.sendMessage(Utils.getPrefix("Bingo") + Utils.colorize("Dieses Item hast du bereits &cgebannt&f!"));
+ }
+ }
+ }
+
+ @EventHandler
+ public void handleBingoBans(InventoryClickEvent e) {
+ if (BingoInventory.getPlayerInventory((Player) e.getWhoClicked()) != null) {
+ if (Banner.getRunning()) {
+ Player player = (Player) e.getWhoClicked();
+ if (CheckInventory.createLockedList(BingoList.bingoList.size()).contains(e.getSlot()) || !CheckInventory.playerBans.get(player.getDisplayName()).contains(e.getSlot())) {
+ if (BingoInventory.getInventories().contains(e.getClickedInventory())) {
+ if (BingoInventory.bannedItem.get(player.getDisplayName()).size() < Utils.getSettingValueInt(BingoPlugin.getBingoSettings(), "Anzahl der Items")) {
+ if (e.getCurrentItem() != null) {
+ Bukkit.getScheduler().scheduleSyncDelayedTask(main, SideList::updateScoreboard, 1L);
+ if (!e.getCurrentItem().getType().equals(Material.BARRIER) && !e.getCurrentItem().getType().equals(Material.AIR)) {
+ player.sendMessage(Utils.getPrefix("Bingo") + Utils.colorize("Du hast &c" + bingo.Utils.formatMaterialName(e.getCurrentItem().getType()) + " &ferfolgreich &cgebannt&f!"));
+ if (e.getCurrentItem().getType() != Material.BARRIER) {
+ Banner.banItem((Player) e.getWhoClicked(), e.getCurrentItem().getType());
+ }
+ } else {
+ player.sendMessage(Utils.getPrefix("Bingo") + Utils.colorize("Dieses Item hast du bereits &cgebannt&f!"));
+ }
+ e.setCancelled(true);
}
- SideList.updateScoreboard();
- e.setCancelled(true);
}
}
}
@@ -86,18 +128,11 @@ public void onInventoryClick(InventoryClickEvent e) {
}
}
- @EventHandler
- public void onInvClick(InventoryClickEvent e) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
- @Override
- public void run() {
- SideList.updateScoreboard();
- }
- }, 5L);
- }
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
+ CoreMain.hotbarManager.getHotbarScheduler(e.getPlayer()).setTimer(BingoPlugin.getTimer());
+ CoreMain.hotbarManager.getHotbarScheduler(e.getPlayer()).startScheduler(true);
if (!BingoPlugin.getTimer().isPaused()) {
BingoPlugin.sideList.createPlayerScoreBoards();
SideList.updateScoreboard();
diff --git a/src/main/java/bingo/eventhandler/CheckInventory.java b/src/main/java/bingo/eventhandler/CheckInventory.java
index ae4251a..b9866f7 100644
--- a/src/main/java/bingo/eventhandler/CheckInventory.java
+++ b/src/main/java/bingo/eventhandler/CheckInventory.java
@@ -2,8 +2,12 @@
import bingo.main.BingoInventory;
import bingo.main.BingoList;
-import bingo.SideList;
+import bingo.main.BingoPlugin;
+import bingo.summarizer.SummarizerCore;
+import core.Utils;
+import core.core.CoreMain;
import org.bukkit.Bukkit;
+import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
@@ -11,42 +15,46 @@
public class CheckInventory {
- private static final int min = 60;
- private static final int max = 180;
- private static int multiplier;
+ private static final Integer EASY_MIN = 45;
+ private static final Integer EASY_MAX = 120;
- public static List alwaysLocked9 = new ArrayList() {{
- addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
- }};
- public static List alwaysLocked18 = new ArrayList() {{
- addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26));
- }};
- public static List alwaysLocked27 = new ArrayList() {{
- addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 36, 37, 38, 39, 40, 41, 42, 43, 44));
- }};
+ private static final Integer MEDIUM_MIN = 150;
+ private static final Integer MEDIUM_MAX = 200;
+
+ private static final Integer HARD_MIN = 250;
+ private static final Integer HARD_MAX = 360;
public static HashMap> playerBans = new HashMap>();
private static final HashMap> lockedSlots = new HashMap>();
- public static void checkInventory(Player player, int size) {
- for (Integer i : getLockedSize(size)) {
- Inventory inventory = BingoInventory.getPlayerInventory(player);
- if (inventory.getItem(i + 9) != null) {
- if (Objects.requireNonNull(inventory.getItem(i)).getType() == Objects.requireNonNull(inventory.getItem(i + 9)).getType()) {
- if (!BingoList.playerCollectedList.get(player.getDisplayName()).contains(Objects.requireNonNull(inventory.getItem(i)).getType())) {
- lockSlot(player, i + 9);
- BingoList.addMaterialToCollected(player, Objects.requireNonNull(inventory.getItem(i)).getType());
- inventory.setItem(i + 9, BingoInventory.convertToLocked(inventory.getItem(i).getType(), player));
- BingoInventory.updateInventory(player);
- SideList.updateScoreboard();
- }
- } else {
- if (BingoList.playerCollectedList.get(player.getDisplayName()).contains(Objects.requireNonNull(inventory.getItem(i)).getType())) {
- BingoList.removeMaterialFromCollected(player, Objects.requireNonNull(inventory.getItem(i).getType()));
- BingoInventory.updateInventory(player);
- unlockSlot(player, i + 9);
- SideList.updateScoreboard();
+ public static void checkInventory(int size) {
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ for (Integer i : createLockedList(size)) {
+ Inventory inventory = BingoInventory.getPlayerInventory(player);
+ if (inventory.getItem(i + 9) != null) {
+ if (Objects.requireNonNull(inventory.getItem(i)).getType() == Objects.requireNonNull(inventory.getItem(i + 9)).getType()) {
+ if (core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+ if (!BingoList.playerCollectedList.get(player.getDisplayName()).contains(Objects.requireNonNull(inventory.getItem(i)).getType())) {
+ int j = getRandomTimerAddition(BingoList.contains(inventory.getItem(i).getType()));
+ BingoPlugin.getTimer().addSeconds(j);
+ CoreMain.hotbarManager.getHotbarScheduler(player).scheduleMessage(Utils.colorize("Du hast &a" + Utils.formatTimerTimeTicks(j * 20) + " &ferhalten"), 100);
+ SummarizerCore.getSummarization(player).addSinglePlayerTime(inventory.getItem(i).getType(), j * 20);
+ }
+ }
+ if (!BingoList.playerCollectedList.get(player.getDisplayName()).contains(Objects.requireNonNull(inventory.getItem(i)).getType())) {
+ lockSlot(player, i + 9);
+ BingoList.addMaterialToCollected(player, Objects.requireNonNull(inventory.getItem(i)).getType());
+ inventory.setItem(i + 9, BingoInventory.convertToLocked(inventory.getItem(i).getType(), player));
+ BingoInventory.updateInventory(player);
+ player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
+ }
+ } else {
+ if (BingoList.playerCollectedList.get(player.getDisplayName()).contains(Objects.requireNonNull(inventory.getItem(i)).getType())) {
+ BingoList.removeMaterialFromCollected(player, Objects.requireNonNull(inventory.getItem(i).getType()));
+ BingoInventory.updateInventory(player);
+ unlockSlot(player, i + 9);
+ }
}
}
}
@@ -66,18 +74,6 @@ public static void lockSlot(Player player, int slot) {
}
}
- public static List getLockedSize(int size) {
- switch (size) {
- case 9:
- return alwaysLocked9;
- case 18:
- return alwaysLocked18;
- case 27:
- return alwaysLocked27;
- }
- return null;
- }
-
public static void unlockSlot(Player player, int slot) {
if (lockedSlots.get(player.getDisplayName()).contains((Integer) slot)) {
lockedSlots.get(player.getDisplayName()).remove((Integer) slot);
@@ -88,19 +84,39 @@ public static ArrayList getLockedSlots(Player player) {
return lockedSlots.get(player.getDisplayName());
}
- private static void getMultiplier(int difficulty) {
+
+ private static int getRandomTimerAddition(Integer difficulty) {
+ Random random = new Random();
+ float multiplier = 0.5f * core.Utils.getSettingValueInt(BingoPlugin.getBingoSettings().singlePlayerSubSettings, "Zeit-Multiplikator");
switch (difficulty) {
case 0:
- multiplier = 1;
- break;
+ double i = (random.nextInt(EASY_MAX - EASY_MIN) + EASY_MIN);
+ return (int) ( i * multiplier);
case 1:
- multiplier = 2;
- break;
+ double j = (random.nextInt(MEDIUM_MAX - MEDIUM_MIN) + MEDIUM_MIN);
+ return (int) ( j * multiplier);
case 2:
- multiplier = 4;
- break;
+ double k = (random.nextInt(HARD_MAX - HARD_MIN) + HARD_MIN);
+ return (int) ( k * multiplier);
}
+ return 0;
}
+ public static ArrayList createLockedList(Integer size) {
+ if (0 < size && size <= 9) {
+ return new ArrayList() {{
+ addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
+ }};
+ } else if (9 < size && size <= 18) {
+ return new ArrayList() {{
+ addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26));
+ }};
+ } else if (18 < size && size <= 27) {
+ return new ArrayList() {{
+ addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 36, 37, 38, 39, 40, 41, 42, 43, 44));
+ }};
+ }
+ return null;
+ }
}
diff --git a/src/main/java/bingo/main/BingoInventory.java b/src/main/java/bingo/main/BingoInventory.java
index 796c1bf..ab5e229 100644
--- a/src/main/java/bingo/main/BingoInventory.java
+++ b/src/main/java/bingo/main/BingoInventory.java
@@ -79,13 +79,21 @@ public static ItemStack convertToLocked(Material material, Player player) {
add(Utils.colorize("&fDas Item bleibt in"));
add(Utils.colorize("&fdiesem Slot &cgesperrt!"));
add(Utils.colorize("&fDu hast das Item nach &b" + Utils.formatTimerTimeTicksTwoDecimal(SummarizerCore.getSummarization(player).getFirstFoundTicks(material)) + "&f gefunden!"));
- add(Utils.colorize("&8Shiftclick um das Item zu erhalten!"));
+ if (!core.Utils.getSettingValueBool(BingoPlugin.getBingoSettings(), "Singleplayer")) {
+ add(Utils.colorize("&8Shiftclick um das Item zu erhalten!"));
+ }else{
+ add(Utils.colorize("&fDieses Item hat dir &a" + Utils.formatTimerTimeTicksTwoDecimal(SummarizerCore.getSummarization(player).getSingleplayerTimeTicks(material)) + "&f gebracht!"));
+ }
}};
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
return itemStack;
}
+ public static ArrayList getInventories() {
+ return new ArrayList(getAllInventories().values());
+ }
+
public static ItemStack getBanned(Material material) {
ItemStack itemStack = new ItemStack(Material.BARRIER, 1);
ItemMeta itemMeta = itemStack.getItemMeta();
diff --git a/src/main/java/bingo/main/BingoList.java b/src/main/java/bingo/main/BingoList.java
index 51a8440..3e24020 100644
--- a/src/main/java/bingo/main/BingoList.java
+++ b/src/main/java/bingo/main/BingoList.java
@@ -4,13 +4,14 @@
import java.util.HashMap;
import java.util.Random;
+import bingo.SideList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class BingoList {
- public static ArrayList bingoList;
+ public static ArrayList bingoList = new ArrayList();
public static HashMap> playerBingoLists = new HashMap>();
public static HashMap> playerCollectedList = new HashMap>();
@@ -26,33 +27,82 @@ public class BingoList {
};
public static Material[] mediumMaterials = {Material.LAPIS_BLOCK, Material.GOLD_BLOCK, Material.DIAMOND,
- Material.IRON_CHESTPLATE, Material.GOLDEN_APPLE, Material.BOOKSHELF, Material.EMERALD, Material.ITEM_FRAME,
+ Material.IRON_CHESTPLATE, Material.GOLDEN_APPLE, Material.BOOKSHELF, Material.EMERALD,
Material.SHEARS, Material.DIAMOND_PICKAXE, Material.OBSIDIAN, Material.REDSTONE_BLOCK, Material.IRON_SWORD,
Material.REPEATER, Material.LIGHT_BLUE_BED, Material.OAK_SIGN, Material.CARVED_PUMPKIN, Material.FLOWER_POT,
- Material.DISPENSER, Material.IRON_BLOCK, Material.IRON_BARS, Material.CAKE, Material.ANVIL, Material.CAMPFIRE,
+ Material.DISPENSER, Material.IRON_BLOCK, Material.IRON_BARS, Material.ANVIL, Material.CAMPFIRE,
Material.NETHERRACK, Material.COMPASS, Material.CLOCK, Material.BAKED_POTATO, Material.CAULDRON, Material.WARPED_DOOR,
Material.WARPED_PLANKS, Material.CRIMSON_DOOR, Material.CRIMSON_STEM, Material.TNT, Material.REDSTONE_LAMP, Material.PISTON,
Material.LECTERN, Material.POWERED_RAIL, Material.SOUL_TORCH, Material.VINE, Material.PURPLE_WOOL, Material.GLOWSTONE,
Material.NETHER_BRICKS, Material.RED_CONCRETE, Material.COBWEB, Material.MILK_BUCKET, Material.ENDER_PEARL,
Material.FIREWORK_ROCKET, Material.QUARTZ_PILLAR, Material.SWEET_BERRIES, Material.DRIED_KELP_BLOCK, Material.GOLDEN_CHESTPLATE,
- Material.SHIELD, Material.GOLDEN_CARROT, Material.GLISTERING_MELON_SLICE, Material.FERMENTED_SPIDER_EYE, Material.HOPPER_MINECART,
+ Material.GOLDEN_CARROT, Material.FERMENTED_SPIDER_EYE, Material.HOPPER_MINECART,
Material.PISTON, Material.NOTE_BLOCK, Material.DAYLIGHT_DETECTOR, Material.TARGET, Material.LILY_PAD, Material.ORANGE_CARPET
};
public static Material[] hardMaterials = {Material.ENCHANTING_TABLE, Material.BLAZE_ROD, Material.CAKE,
- Material.DIAMOND_BLOCK, Material.REDSTONE_LAMP, Material.HOPPER, Material.OBSERVER, Material.PUFFERFISH,
- Material.GOLDEN_APPLE, Material.DIAMOND_BLOCK, Material.DIAMOND_CHESTPLATE, Material.ENDER_PEARL,
+ Material.DIAMOND_BLOCK, Material.HOPPER, Material.OBSERVER, Material.PUFFERFISH,
+ Material.DIAMOND_BLOCK, Material.DIAMOND_CHESTPLATE,
Material.EMERALD_BLOCK, Material.LIME_BED, Material.MAGMA_BLOCK, Material.SEA_LANTERN, Material.JACK_O_LANTERN,
- Material.GLOWSTONE, Material.QUARTZ_BLOCK, Material.ACACIA_LOG, Material.NETHERITE_INGOT, Material.RABBIT_STEW,
+ Material.QUARTZ_BLOCK, Material.ACACIA_LOG, Material.NETHERITE_INGOT, Material.RABBIT_STEW,
Material.LEAD, Material.GLISTERING_MELON_SLICE, Material.COAL_ORE, Material.BROWN_STAINED_GLASS, Material.ENDER_CHEST,
- Material.STICKY_PISTON, Material.ACTIVATOR_RAIL, Material.SLIME_BLOCK
+ Material.STICKY_PISTON, Material.ACTIVATOR_RAIL, Material.SLIME_BLOCK, Material.JUKEBOX, Material.BAMBOO,
+ Material.WEEPING_VINES, Material.TWISTING_VINES, Material.WARPED_ROOTS, Material.CRIMSON_ROOTS, Material.SADDLE,
+ Material.DIAMOND_HORSE_ARMOR, Material.HONEY_BOTTLE, Material.POISONOUS_POTATO, Material.NETHERITE_HELMET,
+ Material.NAME_TAG, Material.LEAD, Material.CROSSBOW
};
+ private static void checkMultiples(){
+ for(Material material : easyMaterials){
+ for(Material material1 : mediumMaterials){
+ if(material == material1){
+ System.err.println(material + "is in easy and medium");
+ }
+ }
+ }
+ for(Material material : mediumMaterials){
+ for(Material material1 : hardMaterials){
+ if(material == material1){
+ System.err.println(material + "is in hard and medium");
+ }
+ }
+ }
+ for(Material material : easyMaterials){
+ for(Material material1 : hardMaterials){
+ if(material == material1){
+ System.err.println(material + "is in easy and hard");
+ }
+ }
+ }
+ }
+
+ public static int contains(Material material){
+ for(Material material1 : easyMaterials){
+ if(material1 == material){
+ return 0;
+ }
+ }
+ for(Material material1 : mediumMaterials){
+ if(material1 == material){
+ return 1;
+ }
+ }
+ for(Material material1 : hardMaterials){
+ if(material1 == material){
+ return 2;
+ }
+ }
+ return -1;
+ }
+
+ public static int getSize(){
+ return bingoList.size();
+ }
+
private static ArrayList scrambleList(Material[] listMat, int size) {
ArrayList bingoList = new ArrayList();
Random random = new Random();
- itemCount = size;
while (bingoList.size() < size) {
int randomInt = random.nextInt(listMat.length);
if (!bingoList.contains(listMat[randomInt])) {
@@ -62,40 +112,49 @@ private static ArrayList scrambleList(Material[] listMat, int size) {
return bingoList;
}
- private static void generateBingoList(int difficulty, int size) {
+ private static ArrayList generateBingoList(int difficulty, int size) {
switch (difficulty) {
case 0:
- bingoList = scrambleList(easyMaterials, size);
- break;
+ return scrambleList(easyMaterials, size);
case 1:
- bingoList = scrambleList(mediumMaterials, size);
- break;
+ return scrambleList(mediumMaterials, size);
case 2:
- bingoList = scrambleList(hardMaterials, size);
- break;
+ return scrambleList(hardMaterials, size);
}
+ return null;
}
- public static void populatePlayerBingoList(int difficulty, int size) {
- BingoList.generateBingoList(difficulty, size);
+ public static void populatePlayerBingoList(int easyItems, int mediumItems, int hardItems) {
+ checkMultiples();
+ ArrayList finalBingoList = new ArrayList();
+ finalBingoList.addAll(generateBingoList(0, easyItems));
+ finalBingoList.addAll(generateBingoList(1, mediumItems));
+ finalBingoList.addAll(generateBingoList(2, hardItems));
+ bingoList = finalBingoList;
+ itemCount = finalBingoList.size();
for (Player player : Bukkit.getOnlinePlayers()) {
assert getBingoList() != null;
- ArrayList bingoList = getBingoList();
playerBingoLists.put(player.getDisplayName(), bingoList);
createCollectionLists(player);
- BingoInventory.createInventory(player, size);
+ if(finalBingoList.size() % 9 != 0){
+ BingoInventory.createInventory(player, finalBingoList.size() + (9 - finalBingoList.size() % 9));
+ }else{
+ BingoInventory.createInventory(player, finalBingoList.size());
+ }
}
}
private static void createCollectionLists(Player player) {
- if (!bingoList.isEmpty()) {
- playerCollectedList.put(player.getDisplayName(), new ArrayList());
- }
+ playerCollectedList.put(player.getDisplayName(), new ArrayList());
}
public static void addMaterialToCollected(Player player, Material material) {
- if (!playerCollectedList.get(player.getDisplayName()).contains(material)) {
- playerCollectedList.get(player.getDisplayName()).add(material);
+ if (material != Material.BARRIER) {
+ if (!playerCollectedList.get(player.getDisplayName()).contains(material)) {
+ playerCollectedList.get(player.getDisplayName()).add(material);
+ System.out.println("Locking " + material.name());
+ SideList.updateScoreboard();
+ }
}
}
diff --git a/src/main/java/bingo/main/BingoPlugin.java b/src/main/java/bingo/main/BingoPlugin.java
index 4a85d1d..b241d72 100644
--- a/src/main/java/bingo/main/BingoPlugin.java
+++ b/src/main/java/bingo/main/BingoPlugin.java
@@ -2,6 +2,7 @@
import bingo.SideList;
import bingo.commandExecutor.BingoCommandExecutor;
+import bingo.commandExecutor.BingoTabCompleter;
import bingo.commandExecutor.ResetCommandExecutor;
import bingo.commandExecutor.TopCommandExecutor;
import bingo.eventhandler.BingoEventhandler;
@@ -23,6 +24,9 @@ public final class BingoPlugin extends JavaPlugin {
@Override
public void onEnable() {
+
+ bingoSettings = new BingoSettings(this);
+
bingo.Utils utils = new bingo.Utils(this);
utils.init();
@@ -31,8 +35,6 @@ public void onEnable() {
BingoEventhandler bingoEventhandler = new BingoEventhandler(this);
bingoEventhandler.initialize();
- bingoSettings = new BingoSettings(this);
-
sideList = new SideList(this);
respawner = new Respawner(this);
@@ -41,6 +43,7 @@ public void onEnable() {
ResetCommandExecutor resetCommandExecutor = new ResetCommandExecutor(this);
Objects.requireNonNull(getCommand("Bingo")).setExecutor(bingoCommandExecutor);
+ Objects.requireNonNull(getCommand("bingo")).setTabCompleter(new BingoTabCompleter());
Objects.requireNonNull(getCommand("Top")).setExecutor(topCommandExecutor);
Objects.requireNonNull(getCommand("reset")).setExecutor(resetCommandExecutor);
Objects.requireNonNull(getCommand("rtp")).setExecutor(bingoCommandExecutor);
diff --git a/src/main/java/bingo/main/BingoSettings.java b/src/main/java/bingo/main/BingoSettings.java
index d41c384..4ad029d 100644
--- a/src/main/java/bingo/main/BingoSettings.java
+++ b/src/main/java/bingo/main/BingoSettings.java
@@ -1,7 +1,12 @@
package bingo.main;
+import com.google.common.util.concurrent.SettableFuture;
import core.settings.PluginSettings;
+import core.settings.Setting.Setting;
+import core.settings.Setting.SettingCycle;
+import core.settings.Setting.SettingsType;
import core.settings.SubSettings;
+import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.plugin.Plugin;
import core.Utils;
@@ -16,6 +21,7 @@ public class BingoSettings extends PluginSettings {
public SubSettings scatterPlayerSubSettings;
public SubSettings teleporterSubSettings;
public SubSettings banningSettings;
+ public SubSettings itemSubSettings;
public BingoSettings(Plugin plugin) {
super(plugin.getName() + "-Einstellungen", plugin);
@@ -26,40 +32,126 @@ public BingoSettings(Plugin plugin) {
public void update() {
this.getSettingsList().clear();
addSettings();
+ blockChecker();
}
private void addSettings() {
singlePlayerSubSettings = new SubSettings("Singleplayer-Einstellungen", plugin, this);
scatterPlayerSubSettings = new SubSettings("Scatter-Einstellungen", plugin, this);
teleporterSubSettings = new SubSettings("Teleporter-Einstellungen", plugin, this);
- banningSettings = new SubSettings("Items Bannen Einstellungen", plugin, this);
+ banningSettings = new SubSettings("Items-Bannen-Einstellungen", plugin, this);
+ itemSubSettings = new SubSettings("Item-Anzahl-Einstellungen", plugin, this);
this.addSetting("Items", new ArrayList() {{
add(Utils.colorize("&7Mit dieser Einstellung kannst du wählen"));
add(Utils.colorize("&7wie viele &6Items &7jeder Spieler"));
+ add(Utils.colorize("&7insgesamt sammeln muss!"));
+ add(Utils.colorize("&8Shift + Rechtsclick -> Einstellungen"));
+ }}, Material.COMPARATOR, itemSubSettings);
+
+ itemSubSettings.addSetting("Einfache Items", new ArrayList() {{
+ add(Utils.colorize("&7Mit dieser Einstellung kannst du wählen"));
+ add(Utils.colorize("&7wie viele &aeinfache Items &7jeder Spieler"));
add(Utils.colorize("&7sammeln muss!"));
- }}, Material.COMPARATOR, new ArrayList() {{
+ }}, Material.LIME_WOOL, new ArrayList() {{
+ add(0);
+ add(1);
+ add(2);
+ add(3);
+ add(4);
+ add(5);
+ add(6);
+ add(7);
+ add(8);
add(9);
+ add(10);
+ add(11);
+ add(12);
+ add(13);
+ add(14);
+ add(15);
+ add(16);
+ add(17);
add(18);
+ add(19);
+ add(20);
+ add(21);
+ add(22);
+ add(23);
+ add(24);
+ add(25);
+ add(26);
add(27);
}});
- this.addSetting("Schwierigkeit", new ArrayList() {{
- add(core.Utils.colorize("&7Mit dieser Einstellung kannst du"));
- add(core.Utils.colorize("&6Schwierigkeit &7der zu sammelnden"));
- add(core.Utils.colorize("&7Items wählen!"));
- }}, Material.HAY_BLOCK, new ArrayList() {{
+ itemSubSettings.addSetting("Mittlere Items", new ArrayList() {{
+ add(Utils.colorize("&7Mit dieser Einstellung kannst du wählen"));
+ add(Utils.colorize("&7wie viele &6mittlere Items &7jeder Spieler"));
+ add(Utils.colorize("&7sammeln muss!"));
+ }}, Material.ORANGE_WOOL, new ArrayList() {{
add(0);
add(1);
add(2);
- }}, new ArrayList() {{
- add(Utils.colorize("&aLeicht"));
- add(Utils.colorize("&eMittel"));
- add(Utils.colorize("&cSchwer"));
- }}, new ArrayList() {{
- add(Material.LIME_DYE);
- add(Material.ORANGE_DYE);
- add(Material.RED_DYE);
+ add(3);
+ add(4);
+ add(5);
+ add(6);
+ add(7);
+ add(8);
+ add(9);
+ add(10);
+ add(11);
+ add(12);
+ add(13);
+ add(14);
+ add(15);
+ add(16);
+ add(17);
+ add(18);
+ add(19);
+ add(20);
+ add(21);
+ add(22);
+ add(23);
+ add(24);
+ add(25);
+ add(26);
+ add(27);
+ }});
+
+ itemSubSettings.addSetting("Schwere Items", new ArrayList() {{
+ add(Utils.colorize("&7Mit dieser Einstellung kannst du wählen"));
+ add(Utils.colorize("&7wie viele &cschwere Items &7jeder Spieler"));
+ add(Utils.colorize("&7sammeln muss!"));
+ }}, Material.RED_WOOL, new ArrayList() {{
+ add(0);
+ add(1);
+ add(2);
+ add(3);
+ add(4);
+ add(5);
+ add(6);
+ add(7);
+ add(8);
+ add(9);
+ add(10);
+ add(11);
+ add(12);
+ add(13);
+ add(14);
+ add(15);
+ add(16);
+ add(17);
+ add(18);
+ add(19);
+ add(20);
+ add(21);
+ add(22);
+ add(23);
+ add(24);
+ add(25);
+ add(26);
+ add(27);
}});
this.addSetting("Keep Inventory", new ArrayList() {{
@@ -137,6 +229,22 @@ private void addSettings() {
add(Utils.colorize("&a10 Minuten"));
}});
+ singlePlayerSubSettings.addSetting("Zeit-Multiplikator", new ArrayList() {{
+ add(core.Utils.colorize("&7Hier kannst du einstellen, wie"));
+ add(core.Utils.colorize("&7viel &6Zeit &7man pro Item"));
+ add(core.Utils.colorize("&7erhält!"));
+ }}, Material.CLOCK, new ArrayList() {{
+ add(1);
+ add(2);
+ add(3);
+ add(4);
+ }}, new ArrayList() {{
+ add(Utils.colorize("&c0.5x"));
+ add(Utils.colorize("&e1.0x"));
+ add(Utils.colorize("&e1.5x"));
+ add(Utils.colorize("&a2.0x"));
+ }});
+
this.addSetting("Teleporter", new ArrayList() {{
add(Utils.colorize("&7Ermöglicht dem Spieler sich"));
add(Utils.colorize("&7entweder einmalig oder mit einem"));
@@ -144,21 +252,21 @@ private void addSettings() {
add(Utils.colorize("&8Shift + Rechtsclick -> Einstellungen"));
}}, Material.ENDERMAN_SPAWN_EGG, false, teleporterSubSettings);
- teleporterSubSettings.addSetting("Countdown", new ArrayList(){{
+ teleporterSubSettings.addSetting("Countdown", new ArrayList() {{
add(Utils.colorize("&7Wenn diese Einstellung aktiv ist,"));
add(Utils.colorize("&7kann der Teleporter &6wiederholt nach"));
add(Utils.colorize("&6einer bestimmten Zeit &7genutzt werden!"));
}}, Material.CLOCK, true);
- teleporterSubSettings.addSetting("Countdown-Zeit", new ArrayList(){{
+ teleporterSubSettings.addSetting("Countdown-Zeit", new ArrayList() {{
add(Utils.colorize("&7Hier legst du fest, &6wie lange&7 ein"));
add(Utils.colorize("&7Spieler &6warten &7muss, bis er sich"));
add(Utils.colorize("&7wieder teleportieren kann!"));
- }}, Material.NAUTILUS_SHELL, new ArrayList(){{
+ }}, Material.NAUTILUS_SHELL, new ArrayList() {{
add(120);
add(300);
add(600);
- }}, new ArrayList(){{
+ }}, new ArrayList() {{
add(Utils.colorize("&b2 Minuten"));
add(Utils.colorize("&b5 Minuten"));
add(Utils.colorize("&b10 Minuten"));
@@ -188,17 +296,17 @@ private void addSettings() {
add(Utils.colorize("&b5000 Blöcke"));
}});
- this.addSetting("Items Bannen", new ArrayList(){{
+ this.addSetting("Items Bannen", new ArrayList() {{
add(Utils.colorize("&7Hier kannst du einstellen,"));
add(Utils.colorize("&7ob Spieler vor Beginn des"));
add(Utils.colorize("&7Spiels Items bannen können"));
add(Utils.colorize("&8Shift + Rechtsclick -> Einstellungen"));
}}, Material.STRUCTURE_VOID, false, banningSettings);
- banningSettings.addSetting("Anzahl der Items", new ArrayList(){{
+ banningSettings.addSetting("Anzahl der Items", new ArrayList() {{
add(Utils.colorize("&7Hier kannst du einstellen,"));
add(Utils.colorize("&7wieviele Items ein Spieler &6bannen&7 kann"));
- }}, Material.CACTUS, new ArrayList(){{
+ }}, Material.CACTUS, new ArrayList() {{
add(1);
add(2);
add(3);
@@ -208,7 +316,7 @@ private void addSettings() {
add(7);
add(8);
add(9);
- }}, new ArrayList(){{
+ }}, new ArrayList() {{
add(Utils.colorize("&b1 &fItem"));
add(Utils.colorize("&b2 &fItems"));
add(Utils.colorize("&b3 &fItems"));
@@ -220,25 +328,25 @@ private void addSettings() {
add(Utils.colorize("&b9 &fItems"));
}});
- banningSettings.addSetting("Automatisches Bannen", new ArrayList(){{
+ banningSettings.addSetting("Automatisches Bannen", new ArrayList() {{
add(Utils.colorize("&7Hier kannst du einstellen,"));
add(Utils.colorize("&7Ob Items &6automatisch gebannt"));
add(Utils.colorize("&7werden sollen, wenn der Spieler"));
add(Utils.colorize("&7zu lange braucht!"));
}}, Material.CLOCK, true);
- banningSettings.addSetting("Erster Timeout", new ArrayList(){{
+ banningSettings.addSetting("Erster Timeout", new ArrayList() {{
add(Utils.colorize("&7Hier kannst du einstellen, wie lange"));
add(Utils.colorize("&7ein Spieler &6Zeit&7 hat, bis das erste"));
add(Utils.colorize("&7Item &6automatisch gebannt &7wird!"));
- }}, Material.NAUTILUS_SHELL, new ArrayList(){{
+ }}, Material.NAUTILUS_SHELL, new ArrayList() {{
add(15);
add(20);
add(25);
add(30);
add(45);
add(60);
- }}, new ArrayList(){{
+ }}, new ArrayList() {{
add(Utils.colorize("&b15&f Sekunden"));
add(Utils.colorize("&b20&f Sekunden"));
add(Utils.colorize("&b25&f Sekunden"));
@@ -247,19 +355,67 @@ private void addSettings() {
add(Utils.colorize("&b60&f Sekunden"));
}});
- banningSettings.addSetting("Bann Abstand", new ArrayList(){{
+ banningSettings.addSetting("Bann Abstand", new ArrayList() {{
add(Utils.colorize("&7Hier kannst du einstellen, wie lange"));
add(Utils.colorize("&7ein Spieler zwischen dem Item bannen &6Zeit"));
add(Utils.colorize("&7hat, bevor das nächste &6automatisch gebannt&7 wird"));
- }}, Material.NAUTILUS_SHELL, new ArrayList(){{
+ }}, Material.NAUTILUS_SHELL, new ArrayList() {{
add(5);
add(10);
add(15);
- }}, new ArrayList(){{
+ }}, new ArrayList() {{
add(Utils.colorize("&b5&f Sekunden"));
add(Utils.colorize("&b10&f Sekunden"));
add(Utils.colorize("&b15&f Sekunden"));
}});
}
+
+ private void blockChecker() {
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
+ @Override
+ public void run() {
+ int i = 0;
+
+ i += core.Utils.getSettingValueInt(itemSubSettings, "Einfache Items");
+ i += core.Utils.getSettingValueInt(itemSubSettings, "Mittlere Items");
+ i += core.Utils.getSettingValueInt(itemSubSettings, "Schwere Items");
+
+
+ if (i <= 27) {
+ for (Setting setting : itemSubSettings.getSettingsList()) {
+ if (setting.getType() == SettingsType.CYCLE) {
+ SettingCycle settingCycle = (SettingCycle) setting;
+ settingCycle.blockCycleUP(false, "BlockedUp");
+ settingCycle.blockCycleDO(false, "blockedDown");
+ }
+ }
+ }
+ if (i > 0 && i <= 26) {
+ for (Setting setting : itemSubSettings.getSettingsList()) {
+ if (setting.getType() == SettingsType.CYCLE) {
+ SettingCycle settingCycle = (SettingCycle) setting;
+ if (setting.value == 0) {
+ settingCycle.blockCycleDO(true, "blockedDown");
+ } else {
+ settingCycle.blockCycleDO(false, "blockedDown");
+ }
+ }
+ }
+ }
+ if (i > 26) {
+ for (Setting setting : itemSubSettings.getSettingsList()) {
+ if (setting.getType() == SettingsType.CYCLE) {
+ SettingCycle settingCycle = (SettingCycle) setting;
+ settingCycle.blockCycleUP(true, "BlockedUp");
+ if (setting.value == 0) {
+ settingCycle.blockCycleDO(true, "blockedDown");
+ }
+ }
+ }
+ }
+ getSettingbyName("Items").value = i;
+ }
+ }, 0, 1);
+ }
}
diff --git a/src/main/java/bingo/summarizer/Summarization.java b/src/main/java/bingo/summarizer/Summarization.java
index de2aba9..eed064d 100644
--- a/src/main/java/bingo/summarizer/Summarization.java
+++ b/src/main/java/bingo/summarizer/Summarization.java
@@ -21,11 +21,23 @@ public Summarization(Player player) {
public void collectedItem(Material material) {
if (this.itemTimeStamps.containsKey(material)) {
if (!this.itemTimeStamps.get(material).containsKey("first_found")) {
- this.itemTimeStamps.get(material).put("first_found", BingoPlugin.getTimer().getTicks());
+ this.itemTimeStamps.get(material).put("first_found", SummarizerCore.getTimer().getTicks());
DebugSender.sendDebug(DebugType.PLUGIN, "first_found: " + Utils.formatMaterialName(material) + " " + itemTimeStamps.get(material).get("first_found"));
} else {
DebugSender.sendDebug(DebugType.PLUGIN, "last_found: " + Utils.formatMaterialName(material) + " " + itemTimeStamps.get(material).get("last_found"));
- this.itemTimeStamps.get(material).put("last_found", BingoPlugin.getTimer().getTicks());
+ this.itemTimeStamps.get(material).put("last_found", SummarizerCore.getTimer().getTicks());
+ }
+ } else {
+ this.itemTimeStamps.put(material, new HashMap());
+ collectedItem(material);
+ }
+ }
+
+ public void addSinglePlayerTime(Material material, Integer ticks) {
+ if (this.itemTimeStamps.containsKey(material)) {
+ if (!this.itemTimeStamps.get(material).containsKey("singleplayer_time")) {
+ this.itemTimeStamps.get(material).put("singleplayer_time", ticks);
+ DebugSender.sendDebug(DebugType.PLUGIN, "singleplayer_time: " + Utils.formatMaterialName(material) + " " + itemTimeStamps.get(material).get("singleplayer_time"));
}
} else {
this.itemTimeStamps.put(material, new HashMap());
@@ -36,11 +48,11 @@ public void collectedItem(Material material) {
public void lockedItem(Material material) {
if (this.itemTimeStamps.containsKey(material)) {
if (!this.itemTimeStamps.get(material).containsKey("first_locked")) {
- this.itemTimeStamps.get(material).put("first_locked", BingoPlugin.getTimer().getTicks());
+ this.itemTimeStamps.get(material).put("first_locked", SummarizerCore.getTimer().getTicks());
DebugSender.sendDebug(DebugType.PLUGIN, "first_locked: " + Utils.formatMaterialName(material) + " " + itemTimeStamps.get(material).get("first_locked"));
} else {
- this.itemTimeStamps.get(material).put("last_locked", BingoPlugin.getTimer().getTicks());
+ this.itemTimeStamps.get(material).put("last_locked", SummarizerCore.getTimer().getTicks());
DebugSender.sendDebug(DebugType.PLUGIN, "last_locked: " + Utils.formatMaterialName(material) + " " + itemTimeStamps.get(material).get("last_locked"));
}
@@ -78,6 +90,13 @@ public Integer getLastLockedTicks(Material material) {
return 0;
}
+ public Integer getSingleplayerTimeTicks(Material material) {
+ if (this.itemTimeStamps.containsKey(material)) {
+ return this.itemTimeStamps.get(material).get("singleplayer_time");
+ }
+ return 0;
+ }
+
public Player getOwner() {
return this.player;
}
diff --git a/src/main/java/bingo/summarizer/SummarizerCore.java b/src/main/java/bingo/summarizer/SummarizerCore.java
index 1bf53fe..c58f155 100644
--- a/src/main/java/bingo/summarizer/SummarizerCore.java
+++ b/src/main/java/bingo/summarizer/SummarizerCore.java
@@ -1,28 +1,38 @@
package bingo.summarizer;
+import bingo.main.BingoPlugin;
+import core.timer.Timer;
+import core.timer.TimerType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
public class SummarizerCore {
- private static List summarizations = new ArrayList();
+ private static Plugin plugin;
+
+ private static HashMap summarizationOffline = new HashMap();
+ private static Timer timer;
+
+ public SummarizerCore(Plugin plugin){
+ SummarizerCore.plugin = plugin;
+ timer = new Timer(plugin, TimerType.INCREASING, "", "", true);
+ }
public static void init() {
for (Player player : Bukkit.getOnlinePlayers()) {
- summarizations.add(new Summarization(player));
+ summarizationOffline.put(player.getDisplayName(), new Summarization(player));
}
}
public static Summarization getSummarization(Player player) {
- for (Summarization summarization : summarizations) {
- if (summarization.getOwner() == player) {
- return summarization;
- }
- }
- return null;
+ return summarizationOffline.get(player.getDisplayName());
+ }
+
+ public static Timer getTimer(){
+ return SummarizerCore.timer;
}
}
diff --git a/src/main/java/bingo/teleporter/Teleporter.java b/src/main/java/bingo/teleporter/Teleporter.java
index d47e8fe..1e15d78 100644
--- a/src/main/java/bingo/teleporter/Teleporter.java
+++ b/src/main/java/bingo/teleporter/Teleporter.java
@@ -47,7 +47,8 @@ public void disable() {
}
public static boolean canTP(Player player){
- return playerCountdown.get(player.getDisplayName()).getTicks() == 0;
+ return true;
+ //return playerCountdown.get(player.getDisplayName()).getTicks() == 0;
}
public static void teleport(Player player){
@@ -56,7 +57,7 @@ public static void teleport(Player player){
teleporterTimer.resume();
DebugSender.sendDebug(DebugType.PLUGIN, "player has been teleported", "Bingo");
playerCountdown.put(player.getDisplayName(), teleporterTimer);
- bingo.Utils.scatterPlayer(player, radius, false);
+ bingo.Utils.scatterPlayer(player, radius, false, true);
}
public static TeleporterTimer getTimer(Player player){