diff --git a/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java b/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java index 3e20fe9..722eba4 100644 --- a/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java +++ b/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_10_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrap } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java b/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java index 1c03c20..37b70a5 100644 --- a/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java +++ b/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_12_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrap } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java index 14c5989..5c74382 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_14_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -51,9 +49,6 @@ public class CraftbukkitWrapper14 implements CraftbukkitWrapper.ICraftbukkitWrap chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.heightMap.clear(); chunk.heightMap.putAll(backupChunk.heightMap); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java b/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java index 8d55c47..03f40d6 100644 --- a/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java +++ b/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_15_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -51,9 +49,6 @@ public class CraftbukkitWrapper15 implements CraftbukkitWrapper.ICraftbukkitWrap chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.heightMap.clear(); chunk.heightMap.putAll(backupChunk.heightMap); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java b/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java index 3eb750e..f79dc0e 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java @@ -19,9 +19,7 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import net.minecraft.server.v1_8_R3.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; @@ -47,9 +45,6 @@ public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapp w.tileEntityList.removeAll(chunk.tileEntities.values()); chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java b/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java index bb13e18..4a2cc0b 100644 --- a/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java +++ b/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_9_R2.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapp } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java b/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java index b48cc55..a25ca27 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java @@ -48,7 +48,7 @@ public enum ArenaMode { public static final Set AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE))); public static final Set VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RANKED, EVENT, REPLAY))); public static final Set RankedEvent = Collections.unmodifiableSet(EnumSet.of(RANKED, EVENT, REPLAY)); - public static final Set Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, REPLAY)); + public static final Set Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED)); public static final Set NotRestartable = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY)); public static final Set SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE)); public static final Set NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE, REPLAY))); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 4d5e3ea..9431174 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -123,6 +123,8 @@ public class FightSystem extends JavaPlugin { new KitCommand(); new RemoveCommand(); new AcceptCommand(); + new WGCommand(); + new TBCommand(); new DeclineCommand(); new GamemodeCommand(); new InviteCommand(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/TBCommand.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/TBCommand.java new file mode 100644 index 0000000..fa18262 --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/TBCommand.java @@ -0,0 +1,45 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.commands; + +import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentCommand; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class TBCommand implements CommandExecutor { + + public TBCommand() { + new StateDependentCommand(ArenaMode.Check, FightState.All, "resettb", this); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) { + return false; + } + Fight.getRedTeam().pasteSchem(); + return false; + } +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/WGCommand.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/WGCommand.java new file mode 100644 index 0000000..edb891f --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/WGCommand.java @@ -0,0 +1,45 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.commands; + +import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentCommand; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class WGCommand implements CommandExecutor { + + public WGCommand() { + new StateDependentCommand(ArenaMode.Check, FightState.All, "resetwg", this); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) { + return false; + } + Fight.getBlueTeam().pasteSchem(); + return false; + } +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/SpectateOverCountdown.java b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/SpectateOverCountdown.java index 67bcfb3..0290647 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/SpectateOverCountdown.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/SpectateOverCountdown.java @@ -31,7 +31,7 @@ public class SpectateOverCountdown extends Countdown { public SpectateOverCountdown() { super(Config.SpectatorDuration, new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); - new StateDependentCountdown(ArenaMode.Restartable, FightState.Spectate, this); + new StateDependentCountdown(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Spectate, this); } @Override diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index f88a616..d1e888f 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -321,6 +321,10 @@ public class FightTeam { return ready; } + public void pasteSchem() { + testPasteAction(); + } + public void pasteSchem(SchematicNode schematic){ setSchem(schematic); testPasteAction(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java index b3cacb5..82187fa 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java @@ -30,6 +30,7 @@ import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; public class FightWorld extends StateDependent { @@ -41,7 +42,7 @@ public class FightWorld extends StateDependent { } public FightWorld() { - super(ArenaMode.Restartable, FightState.Schem); + super(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Schem); register(); } @@ -72,7 +73,12 @@ public class FightWorld extends StateDependent { World backup = new WorldCreator(world.getName() + "/backup").createWorld(); assert backup != null; - Config.ArenaRegion.forEachChunk((x, z) -> CraftbukkitWrapper.impl.resetChunk(world, backup, x, z)); + Config.ArenaRegion.forEachChunk((x, z) -> { + CraftbukkitWrapper.impl.resetChunk(world, backup, x, z); + for(Player p : Bukkit.getOnlinePlayers()) { + de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z); + } + }); Bukkit.unloadWorld(backup, false); } } \ No newline at end of file diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 84e07fb..a4aad6b 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -21,11 +21,9 @@ package de.steamwar.fightsystem.record; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.core.Core; -import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.countdown.Countdown; -import de.steamwar.fightsystem.countdown.EventSpectateCountdown; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FreezeWorld; @@ -463,17 +461,13 @@ public class PacketProcessor { p.resetTitle(); WorldOfColorWrapper.impl.sendTitle(p, title, subtitle, 5, 40, 5); }); - if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) { - FightState.setFightState(FightState.SPECTATE); - }else{ - new EventSpectateCountdown().enable(); - } } private void endReplay() { REntity.dieAll(); freezer.disable(); FightSystem.getMessage().broadcast("REPLAY_ENDS"); + FightState.setFightState(FightState.SPECTATE); replaying = false; } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java index 8466333..2523cf0 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java @@ -23,6 +23,7 @@ import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; import com.mojang.authlib.GameProfile; import de.steamwar.core.Core; +import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.listener.FightScoreboard; import de.steamwar.fightsystem.utils.BlockIdWrapper; @@ -39,6 +40,7 @@ import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Team; import java.util.*; +import java.util.logging.Level; public class REntity { @@ -133,7 +135,14 @@ public class REntity { this.entityType = EntityType.PLAYER; this.entityId = entityCount--; - SteamwarUser user = SteamwarUser.get(userId); + SteamwarUser user; + try { + user = SteamwarUser.get(userId); + } catch (SecurityException e) { + FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Could not load user " + userId); + throw e; + } + this.uuid = user.getUUID(); this.name = user.getUserName(); entities.put(internalId, this); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java index 61d9085..5427fc5 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java @@ -22,8 +22,8 @@ package de.steamwar.fightsystem.utils; import com.comphenix.tinyprotocol.Reflection; import com.google.common.primitives.Bytes; import de.steamwar.core.Core; +import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.VersionDependent; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; @@ -234,7 +234,7 @@ public class TechHider extends StateDependent { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { for(ChunkPos chunk : chunksToReload){ if(bypass(p, chunk.x(), chunk.z()) != hide) - ChunkListener.sendChunk(p, chunk.x(), chunk.z()); + CraftbukkitWrapper.impl.sendChunk(p, chunk.x(), chunk.z()); } }, 40); } diff --git a/FightSystem_Core/src/plugin.yml b/FightSystem_Core/src/plugin.yml index 0013293..74e8510 100644 --- a/FightSystem_Core/src/plugin.yml +++ b/FightSystem_Core/src/plugin.yml @@ -21,4 +21,6 @@ commands: lockreplay: state: skip: - win: \ No newline at end of file + win: + resetwg: + resettb: \ No newline at end of file