SteamWar/FightSystem
Archiviert
13
1

1_14-support #67

Manuell gemergt
Lixfel hat 6 Commits von 1_14-support nach master 2019-12-09 20:53:13 +01:00 zusammengeführt
5 geänderte Dateien mit 38 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -63,6 +63,8 @@ public class Config {
public static final de.steamwar.sql.SchematicType SchematicType;
public static final boolean TeamRedRotate;
public static final boolean TeamBlueRotate;
public static final boolean ReplaceObsidian;
public static final boolean ReplaceBedrock;
//team parameter
public static final String TeamRedName;
@ -143,6 +145,8 @@ public class Config {
SchematicDirectory = config.getString("Schematic.Directory");
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
boolean rotate = config.getBoolean("Schematic.Rotate");
ReplaceObsidian = config.getBoolean("Schematic.ReplaceObsidian");
ReplaceBedrock = config.getBoolean("Schematic.ReplaceBedrock");
TeamRedPrefix = config.getString("Output.TeamRedPrefix");
TeamBluePrefix = config.getString("Output.TeamBluePrefix");

Datei anzeigen

@ -26,6 +26,8 @@ Schematic:
Directory: /home/netuser/schematics/
SchematicType: airship
Rotate: boolean
ReplaceObsidian: boolean
ReplaceBedrock: boolean
Output:
TeamRedName: Team1
TeamRedPrefix: §c

Datei anzeigen

@ -107,6 +107,8 @@ public class FightSystem extends JavaPlugin {
new PreRunningCountdown();
Fight.replaceSync();
new WinconditionAllDead();
new WinconditionCaptainDead();
new WinconditionWaterTechKO();

Datei anzeigen

@ -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,12 @@ public class Fight {
public static void setLevel(int level) {
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(level));
}
public static void replaceSync() {
Fight.getRedTeam().replaceSync(Config.ReplaceObsidian, Material.OBSIDIAN, Material.TNT);
Fight.getBlueTeam().replaceSync(Config.ReplaceObsidian, Material.OBSIDIAN, Material.TNT);
Fight.getRedTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
Fight.getBlueTeam().replaceSync(Config.ReplaceBedrock, Material.BEDROCK, Material.SLIME_BLOCK);
}
}

Datei anzeigen

@ -14,6 +14,7 @@ import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import javafx.util.Pair;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
@ -306,6 +307,26 @@ public class FightTeam implements IFightTeam{
}
}
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));
for(int x = minPoint.getBlockX(); x <= maxPoint.getBlockX(); x++) {
for(int z = minPoint.getBlockZ(); z <= maxPoint.getBlockZ(); z++) {
for(int y = minPoint.getBlockY(); y <= maxPoint.getBlockY(); y++) {
Block block = world.getBlockAt(x, y, z);
if(block.getType() == target)
block.setType(replacement);
}
}
}
}
public Set<Player> getInvited() {
return invited;
}