SteamWar/FightSystem
Archiviert
13
1

replace #66

Manuell gemergt
Lixfel hat 4 Commits von replace nach 1_14-support 2019-12-09 20:41:41 +01:00 zusammengeführt
3 geänderte Dateien mit 19 neuen und 8 gelöschten Zeilen
Nur Änderungen aus Commit 0fc5730cf5 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -107,8 +107,7 @@ public class FightSystem extends JavaPlugin {
new PreRunningCountdown(); new PreRunningCountdown();
Fight.getRedTeam().replaceSync(); Fight.replaceSync();
Fight.getBlueTeam().replaceSync();
Veraltet
Review

Bitte verschiebe das Aufsplitten in Red und Blue Team in die Klasse Fight

Bitte verschiebe das Aufsplitten in Red und Blue Team in die Klasse Fight
new WinconditionAllDead(); new WinconditionAllDead();
new WinconditionCaptainDead(); new WinconditionCaptainDead();

Datei anzeigen

@ -2,6 +2,7 @@ package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -66,4 +67,15 @@ public class Fight {
public static void setLevel(int level) { public static void setLevel(int level) {
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(level)); Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(level));
} }
public static void replaceSync() {
if(Config.ReplaceObsidian) {
Fight.getRedTeam().replaceSync(true, Material.OBSIDIAN, Material.TNT);
Fight.getBlueTeam().replaceSync(true, Material.OBSIDIAN, Material.TNT);
}
if(Config.ReplaceBedrock) {
Fight.getRedTeam().replaceSync(true, Material.BEDROCK, Material.SLIME_BLOCK);
Fight.getBlueTeam().replaceSync(true, Material.BEDROCK, Material.SLIME_BLOCK);
}
}
} }

Datei anzeigen

@ -300,7 +300,10 @@ public class FightTeam implements IFightTeam{
} }
} }
public void replaceSync() { public void replaceSync(boolean replace, Material target, Material replacement) {
if(!replace)
return;
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
Location minPoint = new Location(world, cornerX, cornerY, cornerZ); Location minPoint = new Location(world, cornerX, cornerY, cornerZ);
Location maxPoint = new Location(world, (cornerX + Config.SchemsizeX), (cornerY + Config.SchemsizeY), (cornerZ + Config.SchemsizeZ)); Location maxPoint = new Location(world, (cornerX + Config.SchemsizeX), (cornerY + Config.SchemsizeY), (cornerZ + Config.SchemsizeZ));
@ -310,11 +313,8 @@ public class FightTeam implements IFightTeam{
for(int y = minPoint.getBlockY(); y <= maxPoint.getBlockY(); y++) { for(int y = minPoint.getBlockY(); y <= maxPoint.getBlockY(); y++) {
Block block = world.getBlockAt(x, y, z); Block block = world.getBlockAt(x, y, z);
if(block.getType() == target)
if(Config.ReplaceObsidian && block.getType() == Material.OBSIDIAN) block.setType(replacement);
block.setType(Material.TNT);
else if(Config.ReplaceBedrock && block.getType() == Material.BEDROCK)
block.setType(Material.SLIME_BLOCK);
} }
} }
} }