code cleanup; performance update
Dieser Commit ist enthalten in:
Ursprung
efc7af3e55
Commit
0fc5730cf5
@ -107,8 +107,7 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
new PreRunningCountdown();
|
||||
|
||||
Fight.getRedTeam().replaceSync();
|
||||
Fight.getBlueTeam().replaceSync();
|
||||
Fight.replaceSync();
|
||||
|
||||
new WinconditionAllDead();
|
||||
new WinconditionCaptainDead();
|
||||
|
@ -2,6 +2,7 @@ package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -66,4 +67,15 @@ public class Fight {
|
||||
public static void setLevel(int 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
Location minPoint = new Location(world, cornerX, cornerY, cornerZ);
|
||||
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++) {
|
||||
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
|
||||
if(Config.ReplaceObsidian && block.getType() == Material.OBSIDIAN)
|
||||
block.setType(Material.TNT);
|
||||
else if(Config.ReplaceBedrock && block.getType() == Material.BEDROCK)
|
||||
block.setType(Material.SLIME_BLOCK);
|
||||
if(block.getType() == target)
|
||||
block.setType(replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren