WaterTechKO improver & bugfixer
Dieser Commit ist enthalten in:
Ursprung
43276797fe
Commit
8a1aa18ace
@ -181,6 +181,8 @@ public class FightSystem extends JavaPlugin {
|
|||||||
if(allFightPlayers.getPlayer() == null)
|
if(allFightPlayers.getPlayer() == null)
|
||||||
continue;
|
continue;
|
||||||
allFightPlayers.getPlayer().getInventory().clear();
|
allFightPlayers.getPlayer().getInventory().clear();
|
||||||
|
if(allFightPlayers.getKit() == null)
|
||||||
|
continue;
|
||||||
allFightPlayers.getKit().loadToPlayer(allFightPlayers.getPlayer());
|
allFightPlayers.getKit().loadToPlayer(allFightPlayers.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package de.steamwar.fightsystem.listener;
|
|||||||
|
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
|
||||||
import de.steamwar.fightsystem.utils.Config;
|
|
||||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||||
import de.steamwar.fightsystem.fight.FightState;
|
import de.steamwar.fightsystem.fight.FightState;
|
||||||
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
|
import de.steamwar.fightsystem.utils.Config;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
@ -57,8 +57,8 @@ public class PlayerConnectionListener extends BasicListener{
|
|||||||
}else if(fightState == FightState.PRE_RUNNING || fightState == FightState.RUNNING){
|
}else if(fightState == FightState.PRE_RUNNING || fightState == FightState.RUNNING){
|
||||||
FightPlayer fightPlayer = fightTeam.getFightPlayer(player);
|
FightPlayer fightPlayer = fightTeam.getFightPlayer(player);
|
||||||
if(fightPlayer.isLiving()) {
|
if(fightPlayer.isLiving()) {
|
||||||
fightTeam.getFightPlayer(player).setOut();
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §chat den Kampf verlassen!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §chat den Kampf verlassen!");
|
||||||
|
fightTeam.getFightPlayer(player).setOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class WaterRemover {
|
|||||||
|
|
||||||
private WaterRemover(){}
|
private WaterRemover(){}
|
||||||
|
|
||||||
private static Map<Location, Integer> explodedBlocks = new HashMap<>();
|
private static final Map<Location, Integer> explodedBlocks = new HashMap<>();
|
||||||
private static Set<Block> waterList = new HashSet<>();
|
private static Set<Block> waterList = new HashSet<>();
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@ -25,25 +25,27 @@ public class WaterRemover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void add(List<Block> l) {
|
public static void add(List<Block> l) {
|
||||||
|
synchronized (explodedBlocks){
|
||||||
l.forEach((Block b) -> explodedBlocks.put(b.getLocation(), 0));
|
l.forEach((Block b) -> explodedBlocks.put(b.getLocation(), 0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void wateredCheck() {
|
private static void wateredCheck() {
|
||||||
|
synchronized (explodedBlocks){
|
||||||
Iterator<Map.Entry<Location, Integer>> it = explodedBlocks.entrySet().iterator();
|
Iterator<Map.Entry<Location, Integer>> it = explodedBlocks.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Location, Integer> e = it.next();
|
Map.Entry<Location, Integer> e = it.next();
|
||||||
Block b = e.getKey().getBlock();
|
Block b = e.getKey().getBlock();
|
||||||
if (b.getType() == Material.WATER || b.getType() == Material.STATIONARY_WATER) {
|
if (b.getType() == Material.STATIONARY_WATER || b.getType() == Material.WATER)
|
||||||
waterList.add(b);
|
waterList.add(b);
|
||||||
}
|
|
||||||
|
|
||||||
if(b.getType() != Material.AIR){
|
if(b.getType() != Material.AIR){
|
||||||
it.remove();
|
it.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
explodedBlocks.replace(e.getKey(), e.getValue() + 1);
|
e.setValue(e.getValue() + 1);
|
||||||
|
|
||||||
if(explodedBlocks.get(e.getKey()) > 15){
|
if(e.getValue() > 15)
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,10 +57,9 @@ public class WaterRemover {
|
|||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
Block b = it.next();
|
Block b = it.next();
|
||||||
blocksToRemove.addAll(getSourceBlocksOfWater(b));
|
blocksToRemove.addAll(getSourceBlocksOfWater(b));
|
||||||
if (b.getType() != Material.WATER && b.getType() != Material.STATIONARY_WATER) {
|
if (b.getType() != Material.STATIONARY_WATER)
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> {
|
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> {
|
||||||
blocksToRemove.forEach((Block b) -> b.setType(Material.AIR));
|
blocksToRemove.forEach((Block b) -> b.setType(Material.AIR));
|
||||||
|
@ -21,7 +21,21 @@ public class WinconditionWaterTechKO {
|
|||||||
if(!Config.WaterTechKO)
|
if(!Config.WaterTechKO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::addWater, 0, 200);
|
Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::addWater, 200, 200);
|
||||||
|
checkForWater(teamRedWater,
|
||||||
|
Config.TeamRedCornerX,
|
||||||
|
Config.TeamRedCornerY,
|
||||||
|
Config.TeamRedCornerZ,
|
||||||
|
Config.TeamRedCornerX + Config.SchemsizeX,
|
||||||
|
Config.TeamRedCornerY + Config.SchemsizeY,
|
||||||
|
Config.TeamRedCornerZ + Config.SchemsizeZ);
|
||||||
|
checkForWater(teamBlueWater,
|
||||||
|
Config.TeamBlueCornerX,
|
||||||
|
Config.TeamBlueCornerY,
|
||||||
|
Config.TeamBlueCornerZ,
|
||||||
|
Config.TeamBlueCornerX + Config.SchemsizeX,
|
||||||
|
Config.TeamBlueCornerY + Config.SchemsizeY,
|
||||||
|
Config.TeamBlueCornerZ + Config.SchemsizeZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWater() {
|
private void addWater() {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren