added scoreboard
Dieser Commit ist enthalten in:
Ursprung
14924858f0
Commit
0657ac404b
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
.idea
|
.idea
|
||||||
target
|
target
|
||||||
dependency-reduced-pom.xml
|
dependency-reduced-pom.xml
|
||||||
|
*.iml
|
@ -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();
|
||||||
}
|
}
|
||||||
|
42
BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java
Normale Datei
42
BauSystem_Main/src/de/steamwar/bausystem/world/BauScoreboard.java
Normale Datei
@ -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";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren