Add Tablist support #30
@ -54,6 +54,8 @@ public class Config {
|
||||
public static final UUID BlueLeader;
|
||||
public static final UUID RedLeader;
|
||||
|
||||
private static final int EventKampfID;
|
||||
|
||||
static {
|
||||
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||
if (!configfile.exists()) {
|
||||
@ -98,10 +100,16 @@ public class Config {
|
||||
RedLeader = UUID.fromString(redLeader);
|
||||
else
|
||||
RedLeader = null;
|
||||
|
||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
}
|
||||
|
||||
public static boolean isChallenge() {
|
||||
return BlueLeader != null && RedLeader != null;
|
||||
}
|
||||
|
||||
public static boolean test(){
|
||||
return EventKampfID == -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import de.steamwar.comms.packets.TablistNamePacket;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@ -122,6 +121,9 @@ public class MWTeam {
|
||||
p.setDisplayName(color + p.getName());
|
||||
if (MissileWars.getFightState() == FightState.WAITING && !enemy().players.isEmpty())
|
||||
MissileWars.startRound();
|
||||
|
||||
if (!Config.test())
|
||||
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(p.getUniqueId()).getId(), color + p.getName()).send(p), 5);
|
||||
}
|
||||
|
||||
public void leave(Player p) {
|
||||
@ -132,6 +134,9 @@ public class MWTeam {
|
||||
sbteam.removePlayer(p);
|
||||
if (players.isEmpty() && MissileWars.getFightState() == FightState.FIGHTING)
|
||||
MissileWars.end(WinReasons.NO_ENEMY, enemy());
|
||||
|
||||
if (!Config.test())
|
||||
new TablistNamePacket(SteamwarUser.get(p.getUniqueId()).getId(), "§7§o" + p.getName()).send(p);
|
||||
}
|
||||
|
||||
public void invitePlayer(Player p) {
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
package de.steamwar.misslewars.listener;
|
||||
|
||||
import de.steamwar.comms.packets.TablistNamePacket;
|
||||
import de.steamwar.misslewars.Config;
|
||||
import de.steamwar.misslewars.FightState;
|
||||
import de.steamwar.misslewars.MWTeam;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -19,9 +19,11 @@
|
||||
|
||||
package de.steamwar.misslewars.listener;
|
||||
|
||||
import de.steamwar.comms.packets.TablistNamePacket;
|
||||
import de.steamwar.misslewars.Config;
|
||||
import de.steamwar.misslewars.FightState;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -37,6 +39,8 @@ public class JoinListener extends BasicListener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onJoin(PlayerJoinEvent e){
|
||||
e.setJoinMessage("§a» " + e.getPlayer().getDisplayName());
|
||||
if (!Config.test())
|
||||
new TablistNamePacket(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), "§7" + e.getPlayer().getName()).send(e.getPlayer());
|
||||
if (Config.isChallenge()) {
|
||||
if (Config.RedLeader.equals(e.getPlayer().getUniqueId())) {
|
||||
MissileWars.getRedTeam().join(e.getPlayer());
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Wofür werden diese Imports in dieser Datei benötigt?