SteamWar/FightSystem
Archiviert
13
1
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-04-14 12:16:28 +02:00
Ursprung 086076ab58
Commit 42ee422149
4 geänderte Dateien mit 75 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -191,6 +191,12 @@ public class FightSystem extends JavaPlugin {
Bukkit.getScheduler().cancelTask(WinconditionTechKO.taskID);
setAllPlayersGM(GameMode.SPECTATOR);
for(FightPlayer team1 : winFightTeam.getPlayers()) {
team1.getPlayer().getInventory().clear();
}
for(FightPlayer team2 : Fight.getOpposite(winFightTeam).getPlayers()) {
team2.getPlayer().getInventory().clear();
}
Bukkit.broadcastMessage(" ");
if(winFightTeam != null) {

Datei anzeigen

@ -155,6 +155,7 @@ public class FightTeam {
Bukkit.getScheduler().scheduleSyncDelayedTask(FightSystem.getPlugin(), new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage("ADD WATER");
WinconditionTechKO.addWater();
}
}, 20*10L);

Datei anzeigen

@ -71,6 +71,7 @@ public class WaterRemover {
for (Block block : blocksToRemove) {
block.setType(Material.AIR);
}
WinconditionTechKO.removeWater();
});
}

Datei anzeigen

@ -19,10 +19,37 @@ public class WinconditionTechKO {
public static void addWater() {
if(!Config.TechKO) return;
int redMinX = Config.TeamRedCornerX;
int redMinY = Config.TeamRedCornerY;
int redMinZ = Config.TeamRedCornerZ;
int redMaxX = (redMinX + Config.SchemsizeX);
int redMaxY = (redMinY+ Config.SchemsizeY);
int redMaxZ = (redMinZ + Config.SchemsizeZ);
int blueMinX = Config.TeamBlueCornerX;
int blueMinY = Config.TeamBlueCornerY;
int blueMinZ = Config.TeamBlueCornerZ;
int blueMaxX = (blueMinX + Config.SchemsizeX);
int blueMaxY = (blueMinY + Config.SchemsizeY);
int blueMaxZ = (blueMinZ + Config.SchemsizeZ);
Bukkit.broadcastMessage(" " + redMinX);
Bukkit.broadcastMessage(" " + redMinY);
Bukkit.broadcastMessage(" " + redMinZ);
Bukkit.broadcastMessage(" " + redMaxX);
Bukkit.broadcastMessage(" " + redMaxY);
Bukkit.broadcastMessage(" " + redMaxZ);
Bukkit.broadcastMessage(" " + blueMinX);
Bukkit.broadcastMessage(" " + blueMinY);
Bukkit.broadcastMessage(" " + blueMinZ);
Bukkit.broadcastMessage(" " + blueMaxX);
Bukkit.broadcastMessage(" " + blueMaxY);
Bukkit.broadcastMessage(" " + blueMaxZ);
//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++) {
for(int x = redMinX; x <= redMaxX; x++) {
for(int y = redMinY; y <= redMaxY; y++) {
for(int z = redMinZ; z <= redMaxZ; z++) {
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
if(location.getBlock().getType() == Material.WATER
|| location.getBlock().getType() == Material.STATIONARY_WATER)
@ -32,9 +59,9 @@ public class WinconditionTechKO {
}
//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++) {
for(int x = blueMinX; x <= blueMaxX; x++) {
for(int y = blueMinY; y <= blueMaxY; y++) {
for(int z = blueMinZ; z <= blueMaxZ; z++) {
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
if(location.getBlock().getType() == Material.WATER
|| location.getBlock().getType() == Material.STATIONARY_WATER)
@ -42,20 +69,20 @@ public class WinconditionTechKO {
}
}
}
Bukkit.broadcastMessage("Red: " + teamRedWater.size());
Bukkit.broadcastMessage("Blue: " + teamBlueWater.size());
}
public static void startAutoChecker() {
if(!Config.TechKO) return;
taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), new Runnable() {
@Override
public void run() {
public static void removeWater() {
//Team Red
Iterator itrRed = teamRedWater.iterator();
while (itrRed.hasNext()) {
Location location = (Location) itrRed.next();
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER)
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) {
itrRed.remove();
Bukkit.broadcastMessage("red remove" + teamRedWater.size());
}
}
if(teamRedWater.isEmpty()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "6Das Team " + Config.TeamRedPrefix + Config.TeamRedName + " §6ist Tech K.O. !");
@ -66,14 +93,24 @@ public class WinconditionTechKO {
Iterator itrBlue = teamRedWater.iterator();
while (itrRed.hasNext()) {
Location location = (Location) itrRed.next();
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER)
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) {
itrRed.remove();
Bukkit.broadcastMessage("blue remove" + teamBlueWater.size());
}
}
if(teamBlueWater.isEmpty()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "6Das Team " + Config.TeamBluePrefix + Config.TeamBlueName + " §6ist Tech K.O. !");
FightSystem.getPlugin().setSpectateState(Fight.getRedTeam());
}
}
public static void startAutoChecker() {
if(!Config.TechKO) return;
taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), new Runnable() {
@Override
public void run() {
removeWater();
}
}, 0, 20*20);
}