SteamWar/BauSystem
Archiviert
13
0

added scoreboard

Dieser Commit ist enthalten in:
Yaruma3341 2020-01-07 23:22:31 +01:00
Ursprung 14924858f0
Commit 0657ac404b
3 geänderte Dateien mit 47 neuen und 2 gelöschten Zeilen

3
.gitignore vendored
Datei anzeigen

@ -1,3 +1,4 @@
.idea .idea
target target
dependency-reduced-pom.xml dependency-reduced-pom.xml
*.iml

Datei anzeigen

@ -2,6 +2,7 @@ package de.steamwar.bausystem;
import de.steamwar.bausystem.commands.*; import de.steamwar.bausystem.commands.*;
import de.steamwar.bausystem.world.ArenaSection; import de.steamwar.bausystem.world.ArenaSection;
import de.steamwar.bausystem.world.BauScoreboard;
import de.steamwar.bausystem.world.RegionListener; import de.steamwar.bausystem.world.RegionListener;
import de.steamwar.bausystem.world.TNTListener; import de.steamwar.bausystem.world.TNTListener;
import de.steamwar.core.CommandRemover; import de.steamwar.core.CommandRemover;
@ -83,6 +84,7 @@ public class BauSystem extends JavaPlugin implements Listener {
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new RegionListener(), this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this);
Bukkit.getPluginManager().registerEvents(new TNTListener(), this); Bukkit.getPluginManager().registerEvents(new TNTListener(), this);
Bukkit.getPluginManager().registerEvents(new BauScoreboard(), this);
} }
public static BauSystem getPlugin(){ public static BauSystem getPlugin(){
@ -114,7 +116,7 @@ public class BauSystem extends JavaPlugin implements Listener {
} }
@EventHandler @EventHandler
public void onLeave(PlayerQuitEvent e){ public void onLeave(PlayerQuitEvent e) {
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(e.getPlayer()))) if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(e.getPlayer())))
Bukkit.shutdown(); Bukkit.shutdown();
} }

Datei anzeigen

@ -0,0 +1,42 @@
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.commands.CommandFreeze;
import de.steamwar.bausystem.commands.CommandTNT;
import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.scoreboard.ScoreboardCallback;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
public class BauScoreboard implements Listener {
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
SWScoreboard.createScoreboard(player, new ScoreboardCallback() {
@Override
public HashMap<String, Integer> getData() {
HashMap<String, Integer> data = new HashMap<>();
data.put("§1 ", 5);
data.put("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()), 4);
data.put("§2 ", 3);
data.put("§eTNT§8: " + (!CommandTNT.getInstance().isOn() ? "§aan" : "§caus"), 2);
data.put("§eFreeze§8: " + (!CommandFreeze.getInstance().isOn() ? "§aan" : "§caus"), 1);
return data;
}
@Override
public String getTitle() {
return "§eSteam§8War";
}
});
}
}