From c00dd470f1ccfcf17040f92f334275329da04b9d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 3 Oct 2021 20:35:37 +0200 Subject: [PATCH 1/5] Move to FightInfoPacket Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/FightSystem.java | 6 +- .../steamwar/fightsystem/fight/FightTeam.java | 6 -- .../fightsystem/listener/Permanent.java | 6 -- .../fightsystem/utils/BungeeFightInfo.java | 63 +++++++++++++++++++ 4 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/utils/BungeeFightInfo.java diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 0e18eca..5f77e09 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -31,10 +31,7 @@ import de.steamwar.fightsystem.listener.*; import de.steamwar.fightsystem.record.*; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.OneShotStateDependent; -import de.steamwar.fightsystem.utils.EnterHandler; -import de.steamwar.fightsystem.utils.FightStatistics; -import de.steamwar.fightsystem.utils.FightUI; -import de.steamwar.fightsystem.utils.TechHider; +import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.winconditions.*; import de.steamwar.sql.EventFight; import de.steamwar.sql.Schematic; @@ -88,6 +85,7 @@ public class FightSystem extends JavaPlugin { new TechHider(); new FightWorld(); new FightUI(); + new BungeeFightInfo(); new WinconditionAllDead(); new WinconditionCaptainDead(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index 7696963..2d12cb9 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -20,7 +20,6 @@ package de.steamwar.fightsystem.fight; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import de.steamwar.comms.packets.TablistNamePacket; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; @@ -33,7 +32,6 @@ import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.utils.*; import de.steamwar.inventory.SWItem; import de.steamwar.sql.Schematic; -import de.steamwar.sql.SteamwarUser; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.*; @@ -213,8 +211,6 @@ public class FightTeam { if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits) player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build()); player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").build()); - if(ArenaMode.NotOnBau.contains(Config.mode)) - Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5); GlobalRecorder.getInstance().playerJoins(player); TechHider.reloadChunks(player, chunksToReload, false); @@ -243,8 +239,6 @@ public class FightTeam { player.getInventory().clear(); if(player.isOnline()){ - if(ArenaMode.NotOnBau.contains(Config.mode)) - new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player); TechHider.reloadChunks(player, chunksToReload, true); } } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java index 4463317..29ef016 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java @@ -19,18 +19,14 @@ package de.steamwar.fightsystem.listener; -import de.steamwar.comms.packets.TablistNamePacket; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.Config; -import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.record.REntity; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentListener; -import de.steamwar.sql.SteamwarUser; import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -79,8 +75,6 @@ public class Permanent implements Listener { if (fightTeam == null) { Fight.setPlayerGamemode(player, GameMode.SPECTATOR); player.teleport(Config.SpecSpawn); - if(ArenaMode.NotOnBau.contains(Config.mode)) - Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player), 5); } REntity.playerJoins(player); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/BungeeFightInfo.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/BungeeFightInfo.java new file mode 100644 index 0000000..f9ebb3c --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/BungeeFightInfo.java @@ -0,0 +1,63 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2021 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.utils; + +import de.steamwar.comms.packets.FightInfoPacket; +import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.Config; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentCountdown; +import de.steamwar.fightsystem.states.StateDependentTask; +import de.steamwar.sql.SteamwarUser; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.stream.Collectors; + +public class BungeeFightInfo { + + public BungeeFightInfo() { + new StateDependentTask(ArenaMode.NotOnBau, FightState.All, this::send, 20, 20); + } + + private void send() { + Player player = Bukkit.getOnlinePlayers().stream().findAny().orElse(null); + if(player == null) + return; + + new FightInfoPacket( + Bukkit.getWorlds().get(0).getName(), + Config.SchematicType.toDB(), + "", + Fight.getBlueTeam().getColoredName(), + Fight.getRedTeam().getColoredName(), + FightState.getFightState().name(), + StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0, + Fight.getBlueTeam().getLeader() != null ? SteamwarUser.get(Fight.getBlueTeam().getLeader().getPlayer().getUniqueId()).getId() : 0, + Fight.getRedTeam().getLeader() != null ? SteamwarUser.get(Fight.getRedTeam().getLeader().getPlayer().getUniqueId()).getId() : 0, + Fight.getBlueTeam().getSchematic(), + Fight.getRedTeam().getSchematic(), + Fight.getBlueTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()), + Fight.getRedTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()), + Bukkit.getOnlinePlayers().stream().filter(p -> Fight.getPlayerTeam(p) == null).map(p -> SteamwarUser.get(p.getUniqueId()).getId()).collect(Collectors.toList()) + ).send(player); + } +} From a9766d02658ccea901b18d35fe4b52be76cd9374 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 7 Oct 2021 09:56:34 +0200 Subject: [PATCH 2/5] Fix start listening on Spectateserver Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/record/FileSource.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/FileSource.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/FileSource.java index c283504..86c52ad 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/FileSource.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/FileSource.java @@ -29,8 +29,14 @@ import java.util.zip.GZIPInputStream; public class FileSource extends PacketSource { public static void startReplay() { - if(Config.replayserver()) + if(Config.replayserver()) { + try { + new LiveServer(); + } catch (IOException e) { + throw new SecurityException("Could not start replayserver", e); + } return; + } InputStream input = de.steamwar.sql.Fight.getReplay(Config.ReplayID); try { From d064cb8f8f537678471ee32276d267c24d2adb85 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 8 Oct 2021 07:48:56 +0200 Subject: [PATCH 3/5] Waterremover adjustment for Underwater Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/listener/WaterRemover.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java index ae8059e..f6fba6b 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java @@ -54,6 +54,10 @@ public class WaterRemover implements Listener { } private void checkBlock(Block b) { + //do not remove outside teamareas + if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b)) + return; + //checks for water and removes it, if present if(!FlatteningWrapper.impl.removeWater(b)) return; From 34f75bfeb7feb3642aa218554370733c13efba38 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 10 Oct 2021 08:26:31 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Fix=20345=C2=B0=20Bossbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lixfel --- FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java index 79e68d1..bf909db 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java @@ -164,7 +164,7 @@ public class FightUI { angle = ((angle % 360) + 360) % 360; for(BossBarType type : values()) { - if(type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle < angle || angle <= type.maxAngle) + if(type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle <= angle || angle < type.maxAngle) return type; } From 681df203da555f46afd45cb62ef2553bfb004ef1 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 10 Oct 2021 14:31:43 +0200 Subject: [PATCH 5/5] Fix prepared schematics one too big Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/utils/WorldeditWrapper14.java | 2 +- .../src/de/steamwar/fightsystem/utils/WorldeditWrapper8.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/WorldeditWrapper14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/WorldeditWrapper14.java index a91d4eb..fe5bc06 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/utils/WorldeditWrapper14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/WorldeditWrapper14.java @@ -125,7 +125,7 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper { public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException { World w = new BukkitWorld(Bukkit.getWorlds().get(0)); BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ()); - CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ())); + CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(BlockVector3.ONE)); BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion); ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy( diff --git a/FightSystem_8/src/de/steamwar/fightsystem/utils/WorldeditWrapper8.java b/FightSystem_8/src/de/steamwar/fightsystem/utils/WorldeditWrapper8.java index 2264f2b..a4856bb 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/utils/WorldeditWrapper8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/utils/WorldeditWrapper8.java @@ -124,7 +124,7 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper { public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException { World w = new BukkitWorld(Bukkit.getWorlds().get(0)); Vector min = new Vector(region.getMinX(), minY, region.getMinZ()); - CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ())); + CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(Vector.ONE)); BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion); ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(