feat: optimize changelog

This commit is contained in:
Simon Giesel 2020-05-04 10:42:24 +02:00
parent 72cf4a2b44
commit 6f2557f897

View file

@ -1,5 +1,7 @@
package de.cliffbreak.varo.listeners; package de.cliffbreak.varo.listeners;
import java.util.Stack;
import com.destroystokyo.paper.event.server.PaperServerListPingEvent; import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -15,6 +17,7 @@ import de.cliffbreak.varo.uitls.MessageUtils;
public class PlayerJoinQuitListener implements Listener { public class PlayerJoinQuitListener implements Listener {
private final Varo plugin; private final Varo plugin;
private int task;
public PlayerJoinQuitListener(final Varo plugin) { public PlayerJoinQuitListener(final Varo plugin) {
this.plugin = plugin; this.plugin = plugin;
@ -33,14 +36,33 @@ public class PlayerJoinQuitListener implements Listener {
Bukkit.broadcast( Bukkit.broadcast(
MessageUtils.getRichTextComponent(e.getPlayer().getName(), "§f hat den Server betreten.", true)); MessageUtils.getRichTextComponent(e.getPlayer().getName(), "§f hat den Server betreten.", true));
e.getPlayer().sendMessage("\n§7§l#### §9Cliffbreak.de - §lVaro §r§9Changelog §7§l####\n \n" e.getPlayer().sendMessage("\n§7§l#### §9Cliffbreak.de - §lVaro §r§9Changelog §7§l####\n \n"
+ " §cWarning: §r§c Plugin is running in DEBUG mode!\n " + " §cWarning: §r§c Plugin is running in DEBUG mode!\n ");
+ "\n §7• §r§lADD: §rRedesigned Chat with Timestamp"
+ "\n §7• §r§lADD: §rHover over Playername for Details (Team)" final Stack<String> changes = new Stack<String>();
+ "\n §7• §r§lADD: §rControl Difficulty and Gamerules by the Plugin"
+ "\n §7• §r§lADD: §rCustom Dynamic ServerListEntry" + "\n §7• §r§lADD: §r1.8 Health Regeneration" changes.push(" §7• §r§lFIX: §rCheck for Ban in AsyncPreLoginEvent");
+ "\n §7• §r§lADD: §rBan Player on Death" + "\n §7• §r§lADD: §r/varo Command for Admins" changes.push(" §7• §r§lFIX: §rOnly kick player after Entity isn't ticking anymore");
+ "\n §7• §r§lFIX: §rOnly kick player after Entity isn't ticking anymore" changes.push(" §7• §r§lADD: §r/varo Command for Admins");
+ "\n §7• §r§lFIX: §rCheck for Ban in AsyncPreLoginEvent"); changes.push(" §7• §r§lADD: §rBan Player on Death");
changes.push(" §7• §r§lADD: §r1.8 Health Regeneration");
changes.push(" §7• §r§lADD: §rCustom Dynamic ServerListEntry");
changes.push(" §7• §r§lADD: §rControl Difficulty and Gamerules by the Plugin");
changes.push(" §7• §r§lADD: §rHover over Playername for Details (Team)");
changes.push(" §7• §r§lADD: §rRedesigned Chat with Timestamp");
this.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
e.getPlayer().sendMessage(changes.pop());
if (changes.empty())
stopScheduler();
}
}, 20, 20);
}
private void stopScheduler() {
Bukkit.getScheduler().cancelTask(this.task);
} }
@EventHandler() @EventHandler()