SteamWar/FightSystem
Archiviert
13
1

added TechKO wincondition; reworked player quit and join; send team leader schematic list;

Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-04-13 17:39:07 +02:00
Ursprung 0c28aee3d9
Commit 59418b8001
10 geänderte Dateien mit 188 neuen und 77 gelöschten Zeilen

Datei anzeigen

@ -39,6 +39,7 @@ WinConditions:
CaptainDead: boolean CaptainDead: boolean
PercentSystem: boolean PercentSystem: boolean
Entern: boolean Entern: boolean
TechKO: boolean
WinConditionParams: WinConditionParams:
TimeoutTime: 0 TimeoutTime: 0
EnterPhaseBegin: 0 EnterPhaseBegin: 0

Datei anzeigen

@ -6,11 +6,17 @@ import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import de.warking.hunjy.MySQL.Schematic; import de.warking.hunjy.MySQL.Schematic;
import de.warking.hunjy.MySQL.SchematicType;
import de.warking.hunjy.MySQL.WarkingUser; import de.warking.hunjy.MySQL.WarkingUser;
import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.kit.KitManager; import me.yaruma.fightsystem.kit.KitManager;
import me.yaruma.fightsystem.utils.Config; import me.yaruma.fightsystem.utils.Config;
import me.yaruma.fightsystem.utils.ItemBuilder; import me.yaruma.fightsystem.utils.ItemBuilder;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -20,6 +26,7 @@ import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class FightTeam { public class FightTeam {
@ -94,6 +101,8 @@ public class FightTeam {
public void removePlayer(Player player) { public void removePlayer(Player player) {
FightPlayer fightPlayer = Fight.getPlayerTeam(player).getFightPlayer(player); FightPlayer fightPlayer = Fight.getPlayerTeam(player).getFightPlayer(player);
players.remove(fightPlayer); players.remove(fightPlayer);
if(fightPlayer.isLeader())
this.leader = null;
} }
public boolean hasTeamLeader() { public boolean hasTeamLeader() {
@ -194,4 +203,80 @@ public class FightTeam {
public String getPrefix() { public String getPrefix() {
return prefix; return prefix;
} }
public void sendPlayerSchematicList(int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
List<Schematic> preSchematicList = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
List<Schematic> schematicList = new ArrayList<>();
for(Schematic s : preSchematicList) {
if(s.getSchemType() == schematicType)
schematicList.add(s);
}
if(schematicList.isEmpty()) {
player.sendMessage(FightSystem.PREFIX + "§cDu hast noch keine Schematic(s)!");
return;
}
int pages;
double doublePages = (Double.valueOf(schematicList.size()) / Double.valueOf(filesPerPage));
int intPages = schematicList.size() / filesPerPage;
if(schematicList.size() <= filesPerPage) {
pages = 1;
} else if(doublePages > intPages) {
pages = (intPages + 1);
} else
pages = intPages;
int currPage = currentPage;
if(currPage >= pages) return;
player.sendMessage("§5======§8[§dSeite " + (currentPage + 1) + " §7/ §d" + pages + " §7| §d" + schematicList.size() + " Schematic(s)§8]§5======");
for(int i = currPage * filesPerPage; i < (currPage * filesPerPage) + filesPerPage; i++) {
if(schematicList.size() <= i) break;
Schematic schematic = schematicList.get(i);
TextComponent schematics = new TextComponent("§b" + schematic.getSchemName());
schematics.setBold(true);
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Schematic benutzen...").create()));
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName()));
player.spigot().sendMessage(schematics);
}
if(pages <= 1) return;
if(currPage == 0) {
TextComponent nextPage = new TextComponent("Nächste Seite >>");
nextPage.setColor(ChatColor.RED);
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list 1"));
player.spigot().sendMessage(nextPage);
} else if((currPage + 1) == pages) {
TextComponent beforePage = new TextComponent("<< Vorherige Seite");
beforePage.setColor(ChatColor.RED);
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage - 1)));
player.spigot().sendMessage(beforePage);
} else {
TextComponent beforePage = new TextComponent("<< Seite ");
beforePage.setColor(ChatColor.RED);
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage - 1)));
TextComponent nextPage = new TextComponent(">>");
nextPage.setColor(ChatColor.RED);
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage + 1)));
beforePage.addExtra(nextPage);
player.spigot().sendMessage(beforePage);
}
}
} }

Datei anzeigen

@ -1,6 +1,7 @@
package me.yaruma.fightsystem.fight; package me.yaruma.fightsystem.fight;
import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.winconditions.WinconditionTechKO;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -69,6 +70,7 @@ public class WaterRemover {
Bukkit.getScheduler().runTask((Plugin)FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTask((Plugin)FightSystem.getPlugin(), () -> {
for (Block block : blocksToRemove) { for (Block block : blocksToRemove) {
block.setType(Material.AIR); block.setType(Material.AIR);
WinconditionTechKO.removeWater(block.getLocation());
} }
}); });
} }

Datei anzeigen

@ -34,9 +34,11 @@ public class PlayerJoinListener implements Listener {
if (Fight.getPlayerTeam(player) == null) { if (Fight.getPlayerTeam(player) == null) {
if(!Fight.getRedTeam().hasTeamLeader()) { if(!Fight.getRedTeam().hasTeamLeader()) {
Fight.getRedTeam().setLeader(new FightPlayer(player, false)); Fight.getRedTeam().setLeader(new FightPlayer(player, false));
Fight.getRedTeam().sendPlayerSchematicList(0, 15, player, Config.SchematicType);
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
} else if(!Fight.getBlueTeam().hasTeamLeader()) { } else if(!Fight.getBlueTeam().hasTeamLeader()) {
Fight.getBlueTeam().setLeader(new FightPlayer(player, false)); Fight.getBlueTeam().setLeader(new FightPlayer(player, false));
Fight.getBlueTeam().sendPlayerSchematicList(0, 15, player, Config.SchematicType);
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
} else { } else {
player.setGameMode(GameMode.SPECTATOR); player.setGameMode(GameMode.SPECTATOR);

Datei anzeigen

@ -2,8 +2,10 @@ package me.yaruma.fightsystem.listener;
import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight; import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightPlayer;
import me.yaruma.fightsystem.fight.FightState; import me.yaruma.fightsystem.fight.FightState;
import me.yaruma.fightsystem.fight.FightTeam; import me.yaruma.fightsystem.fight.FightTeam;
import me.yaruma.fightsystem.utils.Config;
import me.yaruma.fightsystem.utils.countdown.Countdown; import me.yaruma.fightsystem.utils.countdown.Countdown;
import me.yaruma.fightsystem.utils.countdown.FinishNoPlayersOnline; import me.yaruma.fightsystem.utils.countdown.FinishNoPlayersOnline;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -21,8 +23,38 @@ public class PlayerQuitListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) == null) return; if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!"); FightState fightState = FightSystem.getPlugin().getFightState();
if(!fightTeam.getFightPlayer(player).isLeader()) {
if(fightState == FightState.PRE_RUNNING
|| fightState == FightState.RUNNING) {
fightTeam.getFightPlayer(player).setOut(true);
} else if(fightState == FightState.SETUP) {
fightTeam.removePlayer(player);
}
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!");
} else {
if(fightState == FightState.SETUP) {
fightTeam.removePlayer(player);
if(!fightTeam.getPlayers().isEmpty()) {
fightTeam.setLeader(fightTeam.getPlayers().get(0));
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightTeam.getPlayers().get(0).getPlayer().getDisplayName() + " §aist nun Leader von Team " + fightTeam.getName() == Fight.getRedTeam().getName() ?
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!");
} else {
for(Player players : Bukkit.getServer().getOnlinePlayers()) {
if(Fight.getPlayerTeam(players) != null) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Es gibt keine Spieler mehr die den Leader ersetzen können! \n Server stoppt...");
Bukkit.shutdown();
} else {
FightPlayer fightPlayer = new FightPlayer(players, false);
fightTeam.setLeader(fightPlayer);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + players.getDisplayName() + " §aist nun Leader von Team " + fightTeam.getName() == Fight.getRedTeam().getName() ?
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!");
}
}
}
}
}
if(fightTeam.allPlayersOut() && FightSystem.getPlugin().getFightState() == FightState.SETUP) { if(fightTeam.allPlayersOut() && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team " + fightTeam.getName() + " §chaben den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team " + fightTeam.getName() + " §chaben den Kampf verlassen!");

Datei anzeigen

@ -49,6 +49,7 @@ public class Config {
public static boolean CaptainDead; public static boolean CaptainDead;
public static boolean PercentSystem; public static boolean PercentSystem;
public static boolean Entern; public static boolean Entern;
public static boolean TechKO;
public static int TimeoutTime; public static int TimeoutTime;
public static int EnterPhaseBegin; public static int EnterPhaseBegin;
@ -127,6 +128,7 @@ public class Config {
CaptainDead = config.getBoolean("WinConditions.CaptainDead"); CaptainDead = config.getBoolean("WinConditions.CaptainDead");
PercentSystem = config.getBoolean("WinConditions.PercentSystem"); PercentSystem = config.getBoolean("WinConditions.PercentSystem");
Entern = config.getBoolean("WinConditions.Entern"); Entern = config.getBoolean("WinConditions.Entern");
TechKO = config.getBoolean("WinConditions.TechKO");
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime"); TimeoutTime = config.getInt("WinConditionParams.TimeoutTime");
EnterPhaseBegin = config.getInt("WinConditionParams.EnterPhaseBegin"); EnterPhaseBegin = config.getInt("WinConditionParams.EnterPhaseBegin");

Datei anzeigen

@ -106,80 +106,5 @@ public class WorldEdit {
} }
} }
public static void sendPlayerSchematicList(int currentPage, int filesPerPage, Player player, SchematicType schematicType) {
List<Schematic> preSchematicList = Schematic.getSchemsAccessibleByUser(player.getUniqueId());
List<Schematic> schematicList = new ArrayList<>();
for(Schematic s : preSchematicList) {
if(s.getSchemType() == schematicType)
schematicList.add(s);
}
if(schematicList.isEmpty()) {
player.sendMessage(FightSystem.PREFIX + "§cDu hast noch keine Schematic(s)!");
return;
}
int pages;
double doublePages = (Double.valueOf(schematicList.size()) / Double.valueOf(filesPerPage));
int intPages = schematicList.size() / filesPerPage;
if(schematicList.size() <= filesPerPage) {
pages = 1;
} else if(doublePages > intPages) {
pages = (intPages + 1);
} else
pages = intPages;
int currPage = currentPage;
if(currPage >= pages) return;
player.sendMessage("§5======§8[§dSeite " + (currentPage + 1) + " §7/ §d" + pages + " §7| §d" + schematicList.size() + " Schematic(s)§8]§5======");
for(int i = currPage * filesPerPage; i < (currPage * filesPerPage) + filesPerPage; i++) {
if(schematicList.size() <= i) break;
Schematic schematic = schematicList.get(i);
TextComponent schematics = new TextComponent("§b" + schematic.getSchemName());
schematics.setBold(true);
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Schematic benutzen...").create()));
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName()));
player.spigot().sendMessage(schematics);
}
if(pages <= 1) return;
if(currPage == 0) {
TextComponent nextPage = new TextComponent("Nächste Seite >>");
nextPage.setColor(ChatColor.RED);
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list 1"));
player.spigot().sendMessage(nextPage);
} else if((currPage + 1) == pages) {
TextComponent beforePage = new TextComponent("<< Vorherige Seite");
beforePage.setColor(ChatColor.RED);
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage - 1)));
player.spigot().sendMessage(beforePage);
} else {
TextComponent beforePage = new TextComponent("<< Seite ");
beforePage.setColor(ChatColor.RED);
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Vorherige Seite...").create()));
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage - 1)));
TextComponent nextPage = new TextComponent(">>");
nextPage.setColor(ChatColor.RED);
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§6Nächste Seite...").create()));
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (currPage + 1)));
beforePage.addExtra(nextPage);
player.spigot().sendMessage(beforePage);
}
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package me.yaruma.fightsystem.winconditions;
import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight; import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightState;
import me.yaruma.fightsystem.fight.FightTeam; import me.yaruma.fightsystem.fight.FightTeam;
import me.yaruma.fightsystem.utils.Config; import me.yaruma.fightsystem.utils.Config;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -18,9 +19,11 @@ public class WinconditionAllDead implements Listener {
@EventHandler @EventHandler
public void handlePlayerDeath(PlayerDeathEvent event) { public void handlePlayerDeath(PlayerDeathEvent event) {
if(!Config.AllDead) return; if(!Config.AllDead) return;
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
Player player = event.getEntity().getPlayer(); Player player = event.getEntity().getPlayer();
if(Fight.getPlayerTeam(player) == null) return; if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
if(fightTeam.allPlayersOut()) { if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!");
@ -31,9 +34,11 @@ public class WinconditionAllDead implements Listener {
@EventHandler @EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) { public void handlePlayerQuit(PlayerQuitEvent event) {
if(!Config.AllDead) return; if(!Config.AllDead) return;
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) == null) return; if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
if(fightTeam.allPlayersOut()) { if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");

Datei anzeigen

@ -2,6 +2,7 @@ package me.yaruma.fightsystem.winconditions;
import me.yaruma.fightsystem.FightSystem; import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight; import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightState;
import me.yaruma.fightsystem.fight.FightTeam; import me.yaruma.fightsystem.fight.FightTeam;
import me.yaruma.fightsystem.utils.Config; import me.yaruma.fightsystem.utils.Config;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -18,9 +19,11 @@ public class WinconditionCaptainDead implements Listener {
@EventHandler @EventHandler
public void handlePlayerDeath(PlayerDeathEvent event) { public void handlePlayerDeath(PlayerDeathEvent event) {
if(!Config.CaptainDead) return; if(!Config.CaptainDead) return;
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
Player player = event.getEntity().getPlayer(); Player player = event.getEntity().getPlayer();
if(Fight.getPlayerTeam(player) == null) return; if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
if(fightTeam.isPlayerLeader(player)) { if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!");
@ -32,9 +35,11 @@ public class WinconditionCaptainDead implements Listener {
@EventHandler @EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) { public void handlePlayerQuit(PlayerQuitEvent event) {
if(!Config.CaptainDead) return; if(!Config.CaptainDead) return;
if(instance.getFightState() != FightState.PRE_RUNNING && instance.getFightState() != FightState.RUNNING) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if(Fight.getPlayerTeam(player) == null) return; if(Fight.getPlayerTeam(player) == null) return;
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
if(fightTeam.isPlayerLeader(player)) { if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");

Datei anzeigen

@ -0,0 +1,52 @@
package me.yaruma.fightsystem.winconditions;
import me.yaruma.fightsystem.utils.Config;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import java.util.HashSet;
public class WinconditionTechKO {
public static HashSet<Location> teamRedWater = new HashSet<>();
public static HashSet<Location> teamBlueWater = new HashSet<>();
public static void addWater() {
//Team Red
for(int x = Config.TeamRedCornerX; x <= (x + Config.SchemsizeX); x++) {
for(int y = Config.TeamRedCornerY; y <= (y + Config.SchemsizeY); y++) {
for(int z = Config.TeamRedCornerZ; z <= (y + Config.SchemsizeZ); z++) {
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
if(location.getBlock().getType() == Material.WATER
|| location.getBlock().getType() == Material.STATIONARY_WATER)
teamRedWater.add(location);
}
}
}
//Team Blue
for(int x = Config.TeamBlueCornerX; x <= (x + Config.SchemsizeX); x++) {
for(int y = Config.TeamBlueCornerY; y <= (y + Config.SchemsizeY); y++) {
for(int z = Config.TeamBlueCornerZ; z <= (y + Config.SchemsizeZ); z++) {
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
if(location.getBlock().getType() == Material.WATER
|| location.getBlock().getType() == Material.STATIONARY_WATER)
teamBlueWater.add(location);
}
}
}
}
public static void removeWater(Location location) {
if(!Config.TechKO)
return;
if(teamRedWater.contains(location))
teamRedWater.remove(location);
if(teamBlueWater.contains(location))
teamBlueWater.remove(location);
}
}