From 7dd543dab58e881716906680179da98571e9154c Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 18 Dec 2020 23:19:10 +0100 Subject: [PATCH] Add Basic challenge functions --- src/de/steamwar/misslewars/Config.java | 19 +++++++++++++++---- src/de/steamwar/misslewars/MWTeam.java | 2 -- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/misslewars/Config.java b/src/de/steamwar/misslewars/Config.java index 27073cc..da66400 100644 --- a/src/de/steamwar/misslewars/Config.java +++ b/src/de/steamwar/misslewars/Config.java @@ -26,6 +26,7 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; +import java.util.UUID; import java.util.logging.Level; public class Config { @@ -50,7 +51,8 @@ public class Config { public static final double MissileChance; - private static final int EventKampfID; + public static final UUID BlueLeader; + public static final UUID RedLeader; static { File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml"); @@ -86,11 +88,20 @@ public class Config { BluePortalZ = blue.getInt("PortalZ"); BlueSpawn = new Location(Bukkit.getWorlds().get(0), blue.getDouble("SpawnX"), blue.getDouble("SpawnY"), blue.getDouble("SpawnZ"), (float)blue.getDouble("SpawnYaw"), (float)blue.getDouble("SpawnPitch")); - EventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); + String blueLeader = System.getProperty("blueLeader", null); + String redLeader = System.getProperty("redLeader", null); + if(blueLeader != null) + BlueLeader = UUID.fromString(blueLeader); + else + BlueLeader = null; + if(redLeader != null) + RedLeader = UUID.fromString(redLeader); + else + RedLeader = null; } - public static boolean test() { - return EventKampfID == -1; + public boolean isChallenge() { + return BlueLeader != null && RedLeader != null; } } diff --git a/src/de/steamwar/misslewars/MWTeam.java b/src/de/steamwar/misslewars/MWTeam.java index 906adc4..82be00a 100644 --- a/src/de/steamwar/misslewars/MWTeam.java +++ b/src/de/steamwar/misslewars/MWTeam.java @@ -118,8 +118,6 @@ 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) {