Skip to content

Commit

Permalink
upped version to 16.5.23
Browse files Browse the repository at this point in the history
  • Loading branch information
PMFRTT committed Mar 21, 2021
1 parent 2362c40 commit f098250
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 50 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>Bingo</groupId>
<artifactId>Bingo</artifactId>
<version>16.5.21</version>
<version>16.5.23</version>
<packaging>jar</packaging>

<name>Bingo</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bingo/BingoInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static ItemStack createItemStack() {
ItemStack itemStack = new ItemStack(Material.TURTLE_HELMET, 1);
ItemMeta itemMeta = itemStack.getItemMeta();
assert itemMeta != null;
itemMeta.setDisplayName(ChatColor.GOLD + "Abgeschlossen!" + BingoPlugin.seconds);
//itemMeta.setDisplayName(ChatColor.GOLD + "Abgeschlossen!" + BingoPlugin.seconds);
itemMeta.hasEnchants();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
Expand Down
56 changes: 10 additions & 46 deletions src/main/java/bingo/BingoPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import bingo.eventhandler.CheckInventory;
import core.core.CoreMain;
import core.Utils;
import core.timer.Timer;
import core.core.CoreSendStringPacket;
import core.settings.SettingCycle;
import core.settings.SettingSwitch;
import core.timer.TimerType;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
Expand All @@ -23,19 +25,18 @@ public final class BingoPlugin extends JavaPlugin {
private final BingoEventhandler bingoEventhandler = new BingoEventhandler(this);
public BingoSettings bingoSettings;

public static int seconds = 0;

public int difficulty = 0;
public static boolean paused = true;
public static boolean singleplayer = false;
public boolean announce = true;
public static SideList sideList;

public static Timer timer;

@Override
public void onEnable() {

CoreMain.setPlugin(this);
timer = new Timer(this, TimerType.Increasing);
bingoEventhandler.initialize();
bingoSettings = new BingoSettings(this);
BingoCommandExecutor bingoCommandExecutor = new BingoCommandExecutor(this);
Expand All @@ -48,47 +49,6 @@ public void onEnable() {
Objects.requireNonNull(getCommand("reset")).setExecutor(resetCommandExecutor);

BukkitScheduler scheduler1 = getServer().getScheduler();
scheduler1.scheduleSyncRepeatingTask(this, new Runnable() {

@Override
public void run() {
if (singleplayer) {
if (!paused) {
seconds--;
}
if (seconds <= 0) {
paused = true;
}
for (Player player : Bukkit.getOnlinePlayers()) {
String msg;
if (!paused) {
msg = Utils.colorize("Du hast noch &b" + Utils.formatTimerTime(seconds) + "&f Zeit");
} else {
msg = Utils.colorize("&cDas Bingo ist pausiert!");
}
CoreSendStringPacket.sendPacketToHotbar(player, msg);

}
} else {

if (!paused) {
seconds++;
}

for (Player player : Bukkit.getOnlinePlayers()) {
String msg;
if (!paused) {
msg = Utils.colorize("Das Bingo läuft seit &b" + Utils.formatTimerTime(seconds));
} else {
msg = Utils.colorize("&cDas Bingo ist pausiert!");
}
CoreSendStringPacket.sendPacketToHotbar(player, msg);

}

}
}
}, 0L, 20);

scheduler1.scheduleSyncRepeatingTask(this, new Runnable() {

Expand All @@ -100,7 +60,8 @@ public void run() {
CheckInventory.checkInventory(player, announce, singleplayer, getDifficulty());
BingoInventory.updateInventory(player);
} else {
Utils.sendMessageToEveryone(Utils.getPrefix("Bingo") + Utils.colorize("&e" + Utils.getDisplayName(player) + " &fhat das Bingo in &a" + Utils.formatTimerTime(seconds) + "&f beendet!"));
timer.pause();
Utils.sendMessageToEveryone(Utils.getPrefix("Bingo") + Utils.colorize("&e" + Utils.getDisplayName(player) + " &fhat das Bingo in &a" + Utils.formatTimerTimeTicksThreeDecimal(timer.getTicks()) + "&f beendet!"));
Utils.playSoundForAll(Sound.UI_TOAST_CHALLENGE_COMPLETE, 1f, 1f);
paused = true;
}
Expand Down Expand Up @@ -132,13 +93,16 @@ public void startBingo() {
Utils.changeGamerule(GameRule.KEEP_INVENTORY, true);
}
if (singleplayer) {
seconds = singlePlayerStartTime.getValue();
timer.setTimerType(TimerType.Decreasing);
timer.setSeconds(singlePlayerStartTime.getValue());
timer.setSingle(true);
}

BingoList.populatePlayerBingoList(difficulty.getValue(), items.getValue());
bingo.Utils.preparePlayers();
sideList.init();
paused = false;
timer.resume();
}

public void onDisable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
} else if (args[0].equalsIgnoreCase("start")) {
main.startBingo();
}else if(args[0].equalsIgnoreCase("clear")){
BingoPlugin.seconds = 0;
BingoPlugin.timer.pause();
BingoPlugin.paused = true;
BingoList.getBingoList().clear();
BingoList.playerBingoLists.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bingo/eventhandler/CheckInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void checkInventory(Player player, boolean announcement, boolean s
if (player.getInventory().contains(material)) {
if(singleplayer){
double random = min + Math.random() * (max - min) * multiplier;
BingoPlugin.seconds += random;
BingoPlugin.timer.addSeconds((int)random);
player.sendMessage(Utils.colorize("&f+&a" + Utils.formatTimerTime((int) random)));
}
BingoPlugin.sideList.removeScore(player, material);
Expand Down

0 comments on commit f098250

Please sign in to comment.