Dieser Commit ist enthalten in:
Ursprung
d1968e0c43
Commit
b5eb7fb4af
@ -19,6 +19,9 @@
|
||||
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.Team;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -30,92 +33,148 @@ import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Config {
|
||||
private Config(){}
|
||||
private Config() {
|
||||
}
|
||||
|
||||
public static final int ArenaMinX;
|
||||
public static final int ArenaMaxX;
|
||||
public static final int ArenaMinY;
|
||||
public static final int ArenaMinZ;
|
||||
public static final int ArenaMaxZ;
|
||||
public static final int ArenaMinX;
|
||||
public static final int ArenaMaxX;
|
||||
public static final int ArenaMinY;
|
||||
public static final int ArenaMinZ;
|
||||
public static final int ArenaMaxZ;
|
||||
|
||||
public static final Location RedSpawn;
|
||||
public static final int RedPortalZ;
|
||||
public static final Location BlueSpawn;
|
||||
public static final int BluePortalZ;
|
||||
public static final Location RedSpawn;
|
||||
public static final int RedPortalZ;
|
||||
public static final Location BlueSpawn;
|
||||
public static final int BluePortalZ;
|
||||
|
||||
public static final int WaitingTime;
|
||||
public static final int PlatformTime;
|
||||
public static final int ItemTime;
|
||||
public static final int ShieldFlyTime;
|
||||
public static final int EndTime;
|
||||
public static final int WaitingTime;
|
||||
public static final int PlatformTime;
|
||||
public static final int ItemTime;
|
||||
public static final int ShieldFlyTime;
|
||||
public static final int EndTime;
|
||||
|
||||
public static final double MissileChance;
|
||||
public static final double MissileChance;
|
||||
|
||||
public static UUID BlueLeader;
|
||||
public static UUID RedLeader;
|
||||
public static final boolean Barrier;
|
||||
public static final boolean Space;
|
||||
|
||||
private static final int EventKampfID;
|
||||
// Challenge
|
||||
public static UUID BlueLeader;
|
||||
public static UUID RedLeader;
|
||||
|
||||
public static final boolean Barrier;
|
||||
public static final boolean Space;
|
||||
private static final int EventKampfID;
|
||||
|
||||
static {
|
||||
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||
if (!configfile.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Config fehlt!");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
// Event
|
||||
public static final EventFight EventKampf;
|
||||
public static final String TeamBlueName;
|
||||
public static final String TeamRedName;
|
||||
public static final String TeamBlueColor;
|
||||
public static final String TeamRedColor;
|
||||
public static final int EventTeamBlueID;
|
||||
public static final int EventTeamRedID;
|
||||
public static final int MaximumTeamMembers;
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(configfile);
|
||||
WaitingTime = config.getInt("WaitingTime");
|
||||
PlatformTime = config.getInt("PlatformTime");
|
||||
ItemTime = config.getInt("ItemTime");
|
||||
ShieldFlyTime = config.getInt("ShieldFlyTime");
|
||||
EndTime = config.getInt("EndTime");
|
||||
static {
|
||||
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||
if (!configfile.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Config fehlt!");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
|
||||
MissileChance = config.getDouble("MissileChance");
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(configfile);
|
||||
WaitingTime = config.getInt("WaitingTime");
|
||||
PlatformTime = config.getInt("PlatformTime");
|
||||
ItemTime = config.getInt("ItemTime");
|
||||
ShieldFlyTime = config.getInt("ShieldFlyTime");
|
||||
EndTime = config.getInt("EndTime");
|
||||
|
||||
ConfigurationSection arena = config.getConfigurationSection("Arena");
|
||||
assert arena != null;
|
||||
ArenaMinX = arena.getInt("MinX");
|
||||
ArenaMaxX = arena.getInt("MaxX");
|
||||
ArenaMinY = arena.getInt("MinY");
|
||||
ArenaMinZ = arena.getInt("MinZ");
|
||||
ArenaMaxZ = arena.getInt("MaxZ");
|
||||
MissileChance = config.getDouble("MissileChance");
|
||||
|
||||
ConfigurationSection red = config.getConfigurationSection("Red");
|
||||
assert red != null;
|
||||
RedPortalZ = red.getInt("PortalZ");
|
||||
RedSpawn = new Location(Bukkit.getWorlds().get(0), red.getDouble("SpawnX"), red.getDouble("SpawnY"), red.getDouble("SpawnZ"), (float)red.getDouble("SpawnYaw"), (float)red.getDouble("SpawnPitch"));
|
||||
ConfigurationSection arena = config.getConfigurationSection("Arena");
|
||||
assert arena != null;
|
||||
ArenaMinX = arena.getInt("MinX");
|
||||
ArenaMaxX = arena.getInt("MaxX");
|
||||
ArenaMinY = arena.getInt("MinY");
|
||||
ArenaMinZ = arena.getInt("MinZ");
|
||||
ArenaMaxZ = arena.getInt("MaxZ");
|
||||
|
||||
ConfigurationSection blue = config.getConfigurationSection("Blue");
|
||||
assert blue != null;
|
||||
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"));
|
||||
ConfigurationSection red = config.getConfigurationSection("Red");
|
||||
assert red != null;
|
||||
RedPortalZ = red.getInt("PortalZ");
|
||||
RedSpawn = new Location(Bukkit.getWorlds().get(0), red.getDouble("SpawnX"), red.getDouble("SpawnY"), red.getDouble("SpawnZ"), (float) red.getDouble("SpawnYaw"), (float) red.getDouble("SpawnPitch"));
|
||||
|
||||
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;
|
||||
ConfigurationSection blue = config.getConfigurationSection("Blue");
|
||||
assert blue != null;
|
||||
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;
|
||||
|
||||
Barrier = config.getBoolean("Barrier", false);
|
||||
Space = config.getBoolean("Space", false);
|
||||
}
|
||||
Barrier = config.getBoolean("Barrier", false);
|
||||
Space = config.getBoolean("Space", false);
|
||||
|
||||
public static boolean isChallenge() {
|
||||
return BlueLeader != null && RedLeader != null;
|
||||
}
|
||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
if (EventKampfID >= 1) {
|
||||
EventKampf = EventFight.get(EventKampfID);
|
||||
if (EventKampf == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
assert EventKampf != null;
|
||||
|
||||
public static boolean test(){
|
||||
return EventKampfID == -1;
|
||||
}
|
||||
Team team1 = Team.get(EventKampf.getTeamBlue());
|
||||
Team team2 = Team.get(EventKampf.getTeamRed());
|
||||
|
||||
if (team1 == null || team2 == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
assert team1 != null;
|
||||
assert team2 != null;
|
||||
|
||||
TeamBlueName = team1.getTeamKuerzel();
|
||||
TeamRedName = team2.getTeamKuerzel();
|
||||
TeamBlueColor = "§" + team1.getTeamColor();
|
||||
TeamRedColor = "§" + team2.getTeamColor();
|
||||
EventTeamBlueID = team1.getTeamId();
|
||||
EventTeamRedID = team2.getTeamId();
|
||||
|
||||
Event event = Event.get(EventKampf.getEventID());
|
||||
if (EventTeamBlueID == 0 && EventTeamRedID == 0) {
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
} else {
|
||||
MaximumTeamMembers = event.getMaximumTeamMembers();
|
||||
}
|
||||
} else {
|
||||
EventKampf = null;
|
||||
TeamBlueName = "Blau";
|
||||
TeamRedName = "Red";
|
||||
TeamBlueColor = "§3";
|
||||
TeamRedColor = "§c";
|
||||
EventTeamBlueID = 0;
|
||||
EventTeamRedID = 0;
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEvent() {
|
||||
return EventKampfID >= 1;
|
||||
}
|
||||
|
||||
public static boolean isChallenge() {
|
||||
return BlueLeader != null && RedLeader != null;
|
||||
}
|
||||
|
||||
public static boolean test() {
|
||||
return EventKampfID == -1;
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ public class FightInfoPacketSender implements Runnable {
|
||||
private final String serverName = Bukkit.getServer().getName();
|
||||
private final String gameMode = "missilewars";
|
||||
private final String worldName = world.getName();
|
||||
private final String blueName = "§3blue";
|
||||
private final String redName = "§cred";
|
||||
private final String blueName = Config.TeamBlueColor + Config.TeamBlueName;
|
||||
private final String redName = Config.TeamRedColor + Config.TeamRedName;
|
||||
private final int blueLeader = Config.BlueLeader != null ? SteamwarUser.get(Config.BlueLeader).getId() : 0;
|
||||
private final int redLeader = Config.RedLeader != null ? SteamwarUser.get(Config.RedLeader).getId() : 0;
|
||||
|
||||
|
@ -36,11 +36,6 @@ import java.util.function.ObjIntConsumer;
|
||||
public class FightWorld {
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
private static final boolean paper = Bukkit.getVersion().contains("git-Paper");
|
||||
|
||||
private static boolean isPaper(){
|
||||
return paper;
|
||||
}
|
||||
|
||||
private static double posToChunk(int pos){
|
||||
return pos / 16.0;
|
||||
|
@ -19,18 +19,17 @@
|
||||
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.*;
|
||||
@ -48,16 +47,19 @@ public class MWTeam {
|
||||
bow.setItemMeta(bowMeta);
|
||||
}
|
||||
|
||||
private final ChatColor color;
|
||||
private final String color;
|
||||
private final String teamName;
|
||||
private final Team sbteam; //scoreboard-Team
|
||||
@Getter
|
||||
private final Location spawn;
|
||||
@Getter
|
||||
private final int portalZ;
|
||||
|
||||
@Getter
|
||||
private final LinkedList<Player> players = new LinkedList<>();
|
||||
private final Set<Player> openInvitations = new HashSet<>();
|
||||
|
||||
MWTeam(ChatColor color, Location spawn, String teamName, int portalZ) {
|
||||
MWTeam(String color, Location spawn, String teamName, int portalZ) {
|
||||
this.teamName = teamName;
|
||||
this.color = color;
|
||||
this.spawn = spawn;
|
||||
@ -68,7 +70,7 @@ public class MWTeam {
|
||||
sbteam = FightScoreboard.getScoreboard().getTeam(teamName);
|
||||
assert sbteam != null;
|
||||
sbteam.setAllowFriendlyFire(false);
|
||||
sbteam.setColor(color);
|
||||
sbteam.setColor(ChatColor.getByChar(color.charAt(1)));
|
||||
}
|
||||
|
||||
public void countdown(int timeDelay, int offset) {
|
||||
@ -169,14 +171,6 @@ public class MWTeam {
|
||||
return players.size();
|
||||
}
|
||||
|
||||
public int getPortalZ() {
|
||||
return portalZ;
|
||||
}
|
||||
|
||||
public Location getSpawn() {
|
||||
return spawn;
|
||||
}
|
||||
|
||||
public void join(Player p) {
|
||||
players.add(p);
|
||||
p.teleport(spawn);
|
||||
@ -235,7 +229,7 @@ public class MWTeam {
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return "§" + color.getChar();
|
||||
return color;
|
||||
}
|
||||
|
||||
public boolean hasPlayer(Player p) {
|
||||
@ -247,16 +241,11 @@ public class MWTeam {
|
||||
}
|
||||
|
||||
public String getColoredName() {
|
||||
return color.toString() + teamName;
|
||||
}
|
||||
|
||||
public LinkedList<Player> getPlayers() {
|
||||
return players;
|
||||
return color + teamName;
|
||||
}
|
||||
|
||||
public static void removeInvitations(Player p) {
|
||||
MissileWars.getRedTeam().openInvitations.remove(p);
|
||||
MissileWars.getBlueTeam().openInvitations.remove(p);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import de.steamwar.misslewars.listener.*;
|
||||
import de.steamwar.misslewars.listener.special.BarrierListener;
|
||||
import de.steamwar.misslewars.listener.special.SpaceListener;
|
||||
import de.steamwar.misslewars.slowmo.SlowMoRunner;
|
||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -58,8 +59,8 @@ public class MissileWars extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
redTeam = new MWTeam(ChatColor.RED, Config.RedSpawn, "Rot", Config.RedPortalZ);
|
||||
blueTeam = new MWTeam(ChatColor.DARK_AQUA, Config.BlueSpawn, "Blau", Config.BluePortalZ);
|
||||
redTeam = new MWTeam(Config.TeamRedColor, Config.RedSpawn, Config.TeamRedName, Config.RedPortalZ);
|
||||
blueTeam = new MWTeam(Config.TeamBlueColor, Config.BlueSpawn, Config.TeamBlueName, Config.BluePortalZ);
|
||||
new BreakListener();
|
||||
new DeathListener();
|
||||
new ItemListener();
|
||||
@ -82,8 +83,7 @@ public class MissileWars extends JavaPlugin {
|
||||
new ItemCountdown();
|
||||
new EndCountdown();
|
||||
|
||||
FightScoreboard.init();
|
||||
|
||||
new FightScoreboard();
|
||||
Missile.init();
|
||||
CustomItem.init();
|
||||
|
||||
@ -147,6 +147,11 @@ public class MissileWars extends JavaPlugin {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
// TODO: FightsEndPacket for ELO...
|
||||
if (Config.isEvent()) {
|
||||
Config.EventKampf.setErgebnis(winner == blueTeam ? 1 : 2);
|
||||
}
|
||||
|
||||
switch (reason) {
|
||||
case PORTAL_DESTROYED:
|
||||
Bukkit.getServer().broadcastMessage(winner.getColoredName() + ChatColor.RESET + " §7hat das gegnerische Portal zerstört");
|
||||
@ -190,14 +195,6 @@ public class MissileWars extends JavaPlugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void join(Player p) {
|
||||
if (MissileWars.getRedTeam().size() < MissileWars.getBlueTeam().size()) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
}
|
||||
}
|
||||
|
||||
public static void leave(Player p) {
|
||||
MissileWars.getBlueTeam().leave(p);
|
||||
MissileWars.getRedTeam().leave(p);
|
||||
|
@ -50,7 +50,7 @@ public class AcceptCommand extends SWCommand {
|
||||
return new TypeValidator<Player>() {
|
||||
@Override
|
||||
public boolean validate(CommandSender commandSender, Player player, MessageSender messageSender) {
|
||||
if (!Config.isChallenge()) {
|
||||
if (!Config.isChallenge() || Config.isEvent()) {
|
||||
messageSender.send("§cDieser Command ist deaktiviert.");
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class DeclineCommand extends SWCommand {
|
||||
return new TypeValidator<Player>() {
|
||||
@Override
|
||||
public boolean validate(CommandSender commandSender, Player player, MessageSender messageSender) {
|
||||
if (!Config.isChallenge()) {
|
||||
if (!Config.isChallenge() || Config.isEvent()) {
|
||||
messageSender.send("§cDieser Command ist deaktiviert.");
|
||||
return false;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class InviteCommand extends SWCommand {
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Config.isChallenge()) {
|
||||
if (!Config.isChallenge() || !Config.isEvent()) {
|
||||
messageSender.send("§cDieser Command ist deaktiviert.");
|
||||
return false;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class SpectateCommand extends SWCommand {
|
||||
return new TypeValidator<Player>() {
|
||||
@Override
|
||||
public boolean validate(CommandSender commandSender, Player player, MessageSender messageSender) {
|
||||
if (Config.isChallenge()) {
|
||||
if (Config.isChallenge() && !Config.isEvent()) {
|
||||
messageSender.send("§cDieser Command ist deaktiviert.");
|
||||
return false;
|
||||
}
|
||||
|
@ -36,7 +36,11 @@ public class EndCountdown extends StateDependent {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::restart, Config.EndTime);
|
||||
if (Config.isEvent()) {
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::stop, 1200);
|
||||
} else {
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::restart, Config.EndTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
@ -44,6 +48,17 @@ public class EndCountdown extends StateDependent {
|
||||
MissileWars.waiting();
|
||||
}
|
||||
|
||||
private void stop() {
|
||||
//Staggered kick to prevent lobby overloading
|
||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||
Bukkit.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
|
||||
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::stop, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (task != null && !task.isCancelled())
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.misslewars.listener;
|
||||
import de.steamwar.misslewars.Config;
|
||||
import de.steamwar.misslewars.FightState;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -42,16 +43,55 @@ public class JoinListener extends BasicListener {
|
||||
}
|
||||
|
||||
public static void join(Player p) {
|
||||
if (Config.isChallenge()) {
|
||||
if (Config.RedLeader.equals(p.getUniqueId())) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else if (Config.BlueLeader.equals(p.getUniqueId())) {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
} else {
|
||||
p.teleport(MissileWars.getRedTeam().getSpawn().toVector().midpoint(MissileWars.getBlueTeam().getSpawn().toVector()).toLocation(p.getWorld()));
|
||||
}
|
||||
if (Config.isEvent()) {
|
||||
joinEvent(p);
|
||||
return;
|
||||
}
|
||||
MissileWars.join(p);
|
||||
|
||||
if (Config.isChallenge()) {
|
||||
joinChallenge(p);
|
||||
return;
|
||||
}
|
||||
|
||||
joinNormal(p);
|
||||
}
|
||||
|
||||
private static void joinEvent(Player p) {
|
||||
if (Config.EventTeamRedID == Config.EventTeamBlueID) {
|
||||
joinNormal(p);
|
||||
return;
|
||||
}
|
||||
int teamId = SteamwarUser.get(p.getUniqueId()).getTeam();
|
||||
if (teamId == Config.EventTeamRedID && MissileWars.getRedTeam().size() < Config.MaximumTeamMembers) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else if (teamId == Config.EventTeamBlueID && MissileWars.getBlueTeam().size() < Config.MaximumTeamMembers) {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
} else {
|
||||
p.teleport(MissileWars.getRedTeam().getSpawn().toVector().midpoint(MissileWars.getBlueTeam().getSpawn().toVector()).toLocation(p.getWorld()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void joinChallenge(Player p) {
|
||||
if (Config.RedLeader.equals(p.getUniqueId())) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else if (Config.BlueLeader.equals(p.getUniqueId())) {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
} else {
|
||||
p.teleport(MissileWars.getRedTeam().getSpawn().toVector().midpoint(MissileWars.getBlueTeam().getSpawn().toVector()).toLocation(p.getWorld()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void joinNormal(Player p) {
|
||||
if (MissileWars.getRedTeam().size() == MissileWars.getBlueTeam().size()) {
|
||||
if (Math.random() > 0.5) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
}
|
||||
} else if (MissileWars.getRedTeam().size() < MissileWars.getBlueTeam().size()) {
|
||||
MissileWars.getRedTeam().join(p);
|
||||
} else {
|
||||
MissileWars.getBlueTeam().join(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren