diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index a78ff18a..673867e7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -226,7 +226,7 @@ public class FreezeListener implements Listener, ScoreboardElement { } } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent e) { if (Core.getVersion() < 19) return; if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java index 3b3ea664..f1aed39f 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java @@ -179,7 +179,12 @@ public class SpectatorListener implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { - if (event.getMessage().startsWith("/schem save") || event.getMessage().startsWith("//schem save") || event.getMessage().startsWith("/schematic save") || event.getMessage().startsWith("//schematic save")) { + if (event.getMessage().startsWith("/schem save") || + event.getMessage().startsWith("//schem save") || + event.getMessage().startsWith("/schematic save") || + event.getMessage().startsWith("//schematic save") || + event.getMessage().startsWith("/download") || + event.getMessage().startsWith("//download")) { if (!Permission.SUPERVISOR.hasPermission(event.getPlayer())) { event.setCancelled(true); event.setMessage("/"); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index b32a41b9..bff38170 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -23,10 +23,7 @@ import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.core.Core; import de.steamwar.fightsystem.commands.*; import de.steamwar.fightsystem.countdown.*; -import de.steamwar.fightsystem.event.HellsBells; -import de.steamwar.fightsystem.event.Meteor; -import de.steamwar.fightsystem.event.PersistentDamage; -import de.steamwar.fightsystem.event.TNTDistributor; +import de.steamwar.fightsystem.event.*; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightWorld; @@ -136,6 +133,7 @@ public class FightSystem extends JavaPlugin { new PersistentDamage(); new TNTDistributor(); new WinconditionAmongUs(); + new NoGravity(); new NoPlayersOnlineCountdown(); new PreSchemCountdown(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index dde4e266..455e0444 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -76,6 +76,7 @@ KITSEARCH_TITLE=Search for kit SCHEM_NO_ENEMY=§cNo schematic selection without an opponent SCHEM_TITLE={0} selection +SCHEM_DIRT=§eDirt Block SCHEM_PUBLIC=§ePublic {0} SCHEM_UNCHECKED=§eUnchecked {0} SCHEM_PRIVATE=§ePrivate {0} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties index 470226a8..cd294425 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties @@ -70,6 +70,7 @@ KITSEARCH_TITLE=Nach Kit suchen SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner SCHEM_TITLE={0}-Auswahl +SCHEM_DIRT=§eErdblock SCHEM_PUBLIC=§eÖffentliches {0} SCHEM_UNCHECKED=§eUngeprüftes {0} SCHEM_PRIVATE=§ePrivates {0} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index 2ca6849c..237d860e 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -24,15 +24,14 @@ import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.ai.AIManager; import de.steamwar.fightsystem.fight.*; +import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.listener.PersonalKitCreator; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.utils.ColorConverter; import de.steamwar.inventory.*; import de.steamwar.message.Message; -import de.steamwar.sql.PersonalKit; -import de.steamwar.sql.SchematicNode; -import de.steamwar.sql.SchematicType; -import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.*; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -40,7 +39,10 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Consumer; import java.util.stream.Collectors; public class GUI { @@ -206,6 +208,14 @@ public class GUI { for (int i = 0; i < Config.SubTypes.size(); i++) { setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1); } + if (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) { + SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameName, (Integer) null); + if (node != null) { + inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> { + schemSelect(p, node); + })); + } + } inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.open(); } @@ -241,14 +251,18 @@ public class GUI { private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){ SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> { - FightTeam fightTeam = Fight.getPlayerTeam(p); - if(fightTeam == null) - return; - if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) - fightTeam.pasteSchem(node); - p.closeInventory(); + schemSelect(p, node); }); selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY); selector.open(); } + + private static void schemSelect(Player p, SchematicNode node) { + FightTeam fightTeam = Fight.getPlayerTeam(p); + if(fightTeam == null) + return; + if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) + fightTeam.pasteSchem(node); + p.closeInventory(); + } } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java index 4a3bf47f..3080c13e 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TechhiderbugCommand.java @@ -34,6 +34,7 @@ import org.bukkit.command.CommandSender; import java.io.StringWriter; import java.util.Arrays; +import java.util.logging.Level; public class TechhiderbugCommand implements CommandExecutor { @@ -45,25 +46,33 @@ public class TechhiderbugCommand implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) { StringWriter writer = new StringWriter(); - writer.append("ArenaMode: ").append(Config.mode.name()).append('\n'); - writer.append("FightState: ").append(FightState.getFightState().name()).append('\n'); - writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n'); + try { + writer.append("ArenaMode: ").append(Config.mode.name()).append('\n'); + writer.append("FightState: ").append(FightState.getFightState().name()).append('\n'); + writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n'); - writer.append("Arena region: ").append(Config.ArenaRegion.toString()).append('\n'); - writer.append("Team regions: "); - Fight.teams().forEach(t -> writer.append(t.getName()).append(':').append(t.getExtendRegion().toString()).append(' ')); - writer.append('\n'); + writer.append("Arena region: ").append(Config.ArenaRegion.toString()).append('\n'); + writer.append("Team regions: "); + Fight.teams().forEach(t -> writer.append(t.getName()).append(':').append(t.getExtendRegion().toString()).append(' ')); + writer.append('\n'); - writer.append("HullHider regions: "); - FightSystem.getHullHider().getHullMap().forEach((t, h) -> writer.append(t.getName()).append(':').append(h.getRegion().toString()).append(' ')); - writer.append('\n'); + writer.append("HullHider regions: "); + FightSystem.getHullHider().getHullMap().forEach((t, h) -> writer.append(t.getName()).append(':').append(h.getRegion().toString()).append(' ')); + writer.append('\n'); - writer.append("Hidden regions: "); - FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' ')); - writer.append('\n'); + writer.append("Hidden regions: "); + FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' ')); + writer.append('\n'); - writer.append('\n').append("Netty pipelines:\n"); - Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n')); + writer.append("TinyProtocol: "); + writer.append(TinyProtocol.instance.toString()).append('\n'); + + writer.append('\n').append("Netty pipelines:\n"); + Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n')); + } catch (Exception e) { + writer.append("Error while generating bug report: ").append(e.getMessage()).append('\n'); + Bukkit.getLogger().log(Level.SEVERE, "Error while generating bug report", e); + } SWException.log("Techhider-Bug reported by " + sender.getName() + ": " + Arrays.toString(args), writer.toString()); return false; diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java new file mode 100644 index 00000000..12246f8e --- /dev/null +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/NoGravity.java @@ -0,0 +1,41 @@ +/* + * 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.event; + +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentListener; +import de.steamwar.fightsystem.winconditions.Winconditions; +import org.bukkit.entity.EntityType; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntitySpawnEvent; + +public class NoGravity implements Listener { + + public NoGravity() { + new StateDependentListener(Winconditions.NO_GRAVITY, FightState.All, this); + } + + @EventHandler + public void onEntitySpawn(EntitySpawnEvent event) { + if (event.getEntityType() == EntityType.PLAYER) return; + event.getEntity().setGravity(false); + } +} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/HotbarKit.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/HotbarKit.java index ec4d5439..6b3df110 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/HotbarKit.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/HotbarKit.java @@ -37,6 +37,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; @@ -120,9 +121,6 @@ public class HotbarKit extends Kit { Player player = (Player) event.getWhoClicked(); click(player, slot, event); - Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { - player.setItemOnCursor(null); - }, 1); } private void click(Player player, int slot, Cancellable event) { diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java index 288eda76..29ccc434 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java @@ -86,7 +86,10 @@ public class PrepareSchem implements Listener { if(schemExists(schem)) return; + SchematicNode old = schem; schem = SchematicNode.createSchematicNode(schem.getOwner(), preparedName(schem), schem.getParent(), Config.SchematicType.checkType().toDB(), schem.getItem()); + schem.setReplaceColor(old.replaceColor()); + schem.setAllowReplay(old.allowReplay()); try{ WorldeditWrapper.impl.saveSchem(schem, region, minY); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionBlocks.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionBlocks.java index b9b0c9f7..72c0873a 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionBlocks.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionBlocks.java @@ -84,6 +84,9 @@ public class WinconditionBlocks extends Wincondition implements PrintableWincond } private void check() { + // Edge Case for DirtBlock + if (blocks.isEmpty()) return; + blocks.removeIf(block -> !isOfType.test(block)); if(blocks.isEmpty()) win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName()); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionPercent.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionPercent.java index 37d3fafa..f98bdecc 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionPercent.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionPercent.java @@ -78,6 +78,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon private int totalBlocks = 0; private int currentBlocks = 0; + private boolean countAnyBlock = false; private TeamPercent(FightTeam team, Winconditions wincondition) { this.team = team; @@ -98,7 +99,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon } event.blockList().forEach(block -> { - if (Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) { + if (countAnyBlock || Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) { currentBlocks--; } }); @@ -108,10 +109,16 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon private void enable() { totalBlocks = 0; + countAnyBlock = false; team.getSchemRegion().forEach((x, y, z) -> { if (Config.PercentBlocks.contains(Config.world.getBlockAt(x, y, z).getType()) == Config.PercentBlocksWhitelist) totalBlocks++; }); + // Edge Case for DirtBlock + if (totalBlocks == 0) { + totalBlocks = team.getSchemRegion().volume(); + countAnyBlock = true; + } currentBlocks = totalBlocks; postEnable.accept(team); } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java index 296cf97e..2aaecae6 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java @@ -39,5 +39,6 @@ public enum Winconditions { METEOR, AMONG_US, PERSISTENT_DAMAGE, - TNT_DISTRIBUTION + TNT_DISTRIBUTION, + NO_GRAVITY, } diff --git a/FightSystem/build.gradle.kts b/FightSystem/build.gradle.kts index 0cd412bc..87849826 100644 --- a/FightSystem/build.gradle.kts +++ b/FightSystem/build.gradle.kts @@ -39,3 +39,13 @@ dependencies { implementation(project(":FightSystem:FightSystem_20")) implementation(project(":FightSystem:FightSystem_21")) } + +tasks.register("WarGear20") { + group = "run" + description = "Run a WarGear 1.20 Fight Server" + dependsOn(":SpigotCore:shadowJar") + dependsOn(":FightSystem:shadowJar") + template = "WarGear20" + worldName = "arenas/Pentraki" + config = "WarGear20.yml" +} diff --git a/LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java b/LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java index f8ce3338..68097463 100644 --- a/LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java +++ b/LobbySystem/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java @@ -67,7 +67,7 @@ public class JumpAndRun extends BasicListener { int count = CLICKED_COUNT.getOrDefault(player, -1); if (count >= 0) { - if (count > 60) { + if (count > 20) { toReset.add(player); return; } @@ -104,12 +104,18 @@ public class JumpAndRun extends BasicListener { return; } Vector point = points.get(index); - if (location.getY() < point.getY()) { - return; - } - if (location.toVector().distanceSquared(point) >= 12.25) { + if (location.getY() < point.getY()) index = -2; + if (location.toVector().distanceSquared(point) >= 17) index = -2; + if (index > 0 && index < points.size() - 1) { + Vector nextPoint = points.get(index + 1); + if (location.getY() >= nextPoint.getY() && location.toVector().distanceSquared(nextPoint) < 17) { + index = index + 1; + } + } + if (index == -2) { return; } + CURRENT_POS.put(event.getPlayer(), index); event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.4F, 1); if (index < points.size() - 1) { diff --git a/MissileWars/src/de/steamwar/misslewars/countdowns/EndCountdown.java b/MissileWars/src/de/steamwar/misslewars/countdowns/EndCountdown.java index 292071a6..f2d3183b 100644 --- a/MissileWars/src/de/steamwar/misslewars/countdowns/EndCountdown.java +++ b/MissileWars/src/de/steamwar/misslewars/countdowns/EndCountdown.java @@ -37,7 +37,7 @@ public class EndCountdown extends StateDependent { @Override public void enable() { if (Config.isEvent()) { - task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::stop, 1200); + task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::stop, 200); } else { task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::restart, Config.EndTime); } diff --git a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java index 9dd5e456..a97cb133 100644 --- a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java +++ b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java @@ -31,57 +31,6 @@ import java.util.*; import java.util.stream.Collectors; public class AutoChecker15 implements AutoChecker.IAutoChecker { - private static final Set INVENTORY = EnumSet.of( - Material.BARREL, - Material.BLAST_FURNACE, - Material.BREWING_STAND, - Material.CAMPFIRE, - Material.CHEST, - Material.DISPENSER, - Material.DROPPER, - Material.FURNACE, - Material.HOPPER, - Material.JUKEBOX, - Material.SHULKER_BOX, - Material.WHITE_SHULKER_BOX, - Material.ORANGE_SHULKER_BOX, - Material.MAGENTA_SHULKER_BOX, - Material.LIGHT_BLUE_SHULKER_BOX, - Material.YELLOW_SHULKER_BOX, - Material.LIME_SHULKER_BOX, - Material.PINK_SHULKER_BOX, - Material.GRAY_SHULKER_BOX, - Material.LIGHT_GRAY_SHULKER_BOX, - Material.CYAN_SHULKER_BOX, - Material.PURPLE_SHULKER_BOX, - Material.BLUE_SHULKER_BOX, - Material.BROWN_SHULKER_BOX, - Material.GREEN_SHULKER_BOX, - Material.RED_SHULKER_BOX, - Material.BLACK_SHULKER_BOX, - Material.SMOKER, - Material.TRAPPED_CHEST); - - private static final Set FLOWERS = EnumSet.of( - Material.CORNFLOWER, - Material.POPPY, - Material.FERN, - Material.DANDELION, - Material.BLUE_ORCHID, - Material.ALLIUM, - Material.AZURE_BLUET, - Material.RED_TULIP, - Material.ORANGE_TULIP, - Material.WHITE_TULIP, - Material.PINK_TULIP, - Material.OXEYE_DAISY, - Material.LILY_OF_THE_VALLEY, - Material.WITHER_ROSE, - Material.SUNFLOWER, - Material.DIAMOND_HORSE_ARMOR, - Material.IRON_HORSE_ARMOR, - Material.GOLDEN_HORSE_ARMOR, - Material.HONEY_BOTTLE); public AutoChecker.BlockScanResult scan(Clipboard clipboard) { AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult(); @@ -98,7 +47,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker { result.getBlockCounts().merge(material, 1, Integer::sum); - if(INVENTORY.contains(material)) { + if(AutoCheckerItems.impl.getInventoryMaterials().contains(material)) { checkInventory(result, block, material, new BlockPos(x, y, z)); } @@ -125,7 +74,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker { )); itemsInInv.put(Material.FIRE_CHARGE, EnumSet.of(Material.DISPENSER)); itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER)); - FLOWERS.forEach(material -> itemsInInv.put(material, INVENTORY)); + AutoCheckerItems.impl.getAllowedMaterialsInInventory().forEach(material -> itemsInInv.put(material, AutoCheckerItems.impl.getInventoryMaterials())); } private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) { diff --git a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems15.java b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems15.java new file mode 100644 index 00000000..0d853c16 --- /dev/null +++ b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems15.java @@ -0,0 +1,90 @@ +/* + * 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.schematicsystem.autocheck; + +import org.bukkit.Material; + +import java.util.EnumSet; +import java.util.Set; + +public class AutoCheckerItems15 implements AutoCheckerItems { + + private static final Set INVENTORY = EnumSet.of( + Material.BARREL, + Material.BLAST_FURNACE, + Material.BREWING_STAND, + Material.CAMPFIRE, + Material.CHEST, + Material.DISPENSER, + Material.DROPPER, + Material.FURNACE, + Material.HOPPER, + Material.JUKEBOX, + Material.SHULKER_BOX, + Material.WHITE_SHULKER_BOX, + Material.ORANGE_SHULKER_BOX, + Material.MAGENTA_SHULKER_BOX, + Material.LIGHT_BLUE_SHULKER_BOX, + Material.YELLOW_SHULKER_BOX, + Material.LIME_SHULKER_BOX, + Material.PINK_SHULKER_BOX, + Material.GRAY_SHULKER_BOX, + Material.LIGHT_GRAY_SHULKER_BOX, + Material.CYAN_SHULKER_BOX, + Material.PURPLE_SHULKER_BOX, + Material.BLUE_SHULKER_BOX, + Material.BROWN_SHULKER_BOX, + Material.GREEN_SHULKER_BOX, + Material.RED_SHULKER_BOX, + Material.BLACK_SHULKER_BOX, + Material.SMOKER, + Material.TRAPPED_CHEST); + + private static final Set FLOWERS = EnumSet.of( + Material.CORNFLOWER, + Material.POPPY, + Material.FERN, + Material.DANDELION, + Material.BLUE_ORCHID, + Material.ALLIUM, + Material.AZURE_BLUET, + Material.RED_TULIP, + Material.ORANGE_TULIP, + Material.WHITE_TULIP, + Material.PINK_TULIP, + Material.OXEYE_DAISY, + Material.LILY_OF_THE_VALLEY, + Material.WITHER_ROSE, + Material.SUNFLOWER, + Material.DIAMOND_HORSE_ARMOR, + Material.IRON_HORSE_ARMOR, + Material.GOLDEN_HORSE_ARMOR, + Material.HONEY_BOTTLE); + + @Override + public Set getInventoryMaterials() { + return INVENTORY; + } + + @Override + public Set getAllowedMaterialsInInventory() { + return FLOWERS; + } +} diff --git a/SchematicSystem/SchematicSystem_19/build.gradle.kts b/SchematicSystem/SchematicSystem_19/build.gradle.kts new file mode 100644 index 00000000..38fcd471 --- /dev/null +++ b/SchematicSystem/SchematicSystem_19/build.gradle.kts @@ -0,0 +1,33 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 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 . + */ + +plugins { + steamwar.java +} + +dependencies { + compileOnly(project(":SpigotCore", "default")) + compileOnly(project(":SchematicSystem:SchematicSystem_Core", "default")) + compileOnly(project(":SchematicSystem:SchematicSystem_15", "default")) + + compileOnly(libs.spigotapi) + + compileOnly(libs.nms19) + compileOnly(libs.fawe18) +} diff --git a/SchematicSystem/SchematicSystem_19/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems19.java b/SchematicSystem/SchematicSystem_19/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems19.java new file mode 100644 index 00000000..0c004cfe --- /dev/null +++ b/SchematicSystem/SchematicSystem_19/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems19.java @@ -0,0 +1,75 @@ +/* + * 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.schematicsystem.autocheck; + +import org.bukkit.Material; + +import java.util.EnumSet; +import java.util.Set; + +public class AutoCheckerItems19 extends AutoCheckerItems15 { + + private static final Set ALLOWED_ITEMS_IN_INVENTORY = EnumSet.of( + // 64-stackable Items + Material.CORNFLOWER, + Material.POPPY, + Material.FERN, + Material.DANDELION, + Material.BLUE_ORCHID, + Material.ALLIUM, + Material.AZURE_BLUET, + Material.RED_TULIP, + Material.ORANGE_TULIP, + Material.WHITE_TULIP, + Material.PINK_TULIP, + Material.OXEYE_DAISY, + Material.LILY_OF_THE_VALLEY, + Material.WITHER_ROSE, + Material.SUNFLOWER, + // 16-stackable Items + Material.HONEY_BOTTLE, + // Non-stackable items + Material.DIAMOND_HORSE_ARMOR, + Material.IRON_HORSE_ARMOR, + Material.GOLDEN_HORSE_ARMOR, + // Disks + Material.MUSIC_DISC_11, + Material.MUSIC_DISC_13, + Material.MUSIC_DISC_CAT, + Material.MUSIC_DISC_BLOCKS, + Material.MUSIC_DISC_CHIRP, + Material.MUSIC_DISC_FAR, + Material.MUSIC_DISC_MALL, + Material.MUSIC_DISC_MELLOHI, + Material.MUSIC_DISC_STAL, + Material.MUSIC_DISC_STRAD, + Material.MUSIC_DISC_WAIT, + Material.MUSIC_DISC_WARD, + Material.MUSIC_DISC_OTHERSIDE, + Material.MUSIC_DISC_PIGSTEP, + Material.MUSIC_DISC_RELIC, + Material.MUSIC_DISC_5 + ); + + @Override + public Set getAllowedMaterialsInInventory() { + return ALLOWED_ITEMS_IN_INVENTORY; + } +} diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems.java new file mode 100644 index 00000000..fb103f67 --- /dev/null +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerItems.java @@ -0,0 +1,34 @@ +/* + * 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.schematicsystem.autocheck; + +import de.steamwar.core.VersionDependent; +import de.steamwar.schematicsystem.SchematicSystem; +import org.bukkit.Material; + +import java.util.Set; + +public interface AutoCheckerItems { + + AutoCheckerItems impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance()); + + Set getInventoryMaterials(); + Set getAllowedMaterialsInInventory(); +} diff --git a/SchematicSystem/build.gradle.kts b/SchematicSystem/build.gradle.kts index f9871adc..813550b2 100644 --- a/SchematicSystem/build.gradle.kts +++ b/SchematicSystem/build.gradle.kts @@ -30,4 +30,5 @@ dependencies { implementation(project(":SchematicSystem:SchematicSystem_Core")) implementation(project(":SchematicSystem:SchematicSystem_8")) implementation(project(":SchematicSystem:SchematicSystem_15")) + implementation(project(":SchematicSystem:SchematicSystem_19")) } diff --git a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java index af318d83..6f1dbf1a 100644 --- a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java +++ b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -71,6 +71,17 @@ public class TinyProtocol implements Listener { @Getter private final Map playerInterceptors = new HashMap<>(); + @Override + public String toString() { + return "TinyProtocol{" + + "plugin=" + plugin + + ", connections=" + connections + + ", closed=" + closed + + ", packetFilters=" + packetFilters + + ", playerInterceptors=" + playerInterceptors + + '}'; + } + private TinyProtocol(final Plugin plugin) { this.plugin = plugin; this.connections = networkManagers.get(getServerConnection(plugin)); @@ -84,6 +95,7 @@ public class TinyProtocol implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void onPlayerLogin(PlayerLoginEvent e) { + plugin.getLogger().info("Creating PacketInterceptor for: " + e.getPlayer().getName() + " (" + closed + ")"); if(closed) return; new PacketInterceptor(e.getPlayer()); @@ -118,6 +130,8 @@ public class TinyProtocol implements Listener { } public final void close() { + plugin.getLogger().log(Level.INFO, "Closing PacketInterceptor", new Exception("Stacktrace")); + if(closed) return; closed = true; @@ -146,10 +160,10 @@ public class TinyProtocol implements Listener { private PacketInterceptor(Player player) { this.player = player; - channel = getChannel.get(connections.stream().filter(connection -> player.getUniqueId().equals(getUUID.get(connection))).findAny().orElseThrow(() -> { + channel = connections.stream().filter(connection -> player.getUniqueId().equals(getUUID.get(connection))).map(getChannel::get).filter(Channel::isActive).findAny().orElseThrow(() -> { Bukkit.getScheduler().runTask(plugin, () -> player.kickPlayer("Connection failure.")); return new SecurityException("Could not find channel for player " + player.getName()); - })); + }); if(!channel.isActive()) return; @@ -157,14 +171,15 @@ public class TinyProtocol implements Listener { synchronized (playerInterceptors) { playerInterceptors.put(player, this); } + plugin.getLogger().info("Adding Techhider for: " + player.getName()); try { channel.pipeline().addBefore("packet_handler", HANDLER_NAME, this); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException | NoSuchElementException e) { Bukkit.getScheduler().runTask(plugin, () -> player.kickPlayer("Connection failure.")); throw new SecurityException(e); } - } + } private void sendPacket(Object packet) { channel.pipeline().writeAndFlush(packet); diff --git a/TowerRun/src/TowerRun.properties b/TowerRun/src/TowerRun.properties index 2a6c0e04..0935bd83 100644 --- a/TowerRun/src/TowerRun.properties +++ b/TowerRun/src/TowerRun.properties @@ -17,7 +17,7 @@ # along with this program. If not, see . # -PREFIX=§eTowerRun§8§§r +PREFIX=§eTowerRun§8»§r PLAYER_DIED=§c{0} §7died§8! PLAYER_ESCAPE=§a{0} §7escaped§8! diff --git a/TowerRun/src/de/steamwar/towerrun/TowerRun.java b/TowerRun/src/de/steamwar/towerrun/TowerRun.java index 7e6df112..4503c5da 100644 --- a/TowerRun/src/de/steamwar/towerrun/TowerRun.java +++ b/TowerRun/src/de/steamwar/towerrun/TowerRun.java @@ -80,7 +80,5 @@ public class TowerRun extends JavaPlugin { gameCountdown = new GameCountdown(); Bukkit.getScheduler().runTaskTimer(this, new FightInfoPacketSender(), 20, 20); - - TowerRunGame.reset(); } } diff --git a/TowerRun/src/de/steamwar/towerrun/countdowns/EndCountdown.java b/TowerRun/src/de/steamwar/towerrun/countdowns/EndCountdown.java index 0162ba53..6d631e02 100644 --- a/TowerRun/src/de/steamwar/towerrun/countdowns/EndCountdown.java +++ b/TowerRun/src/de/steamwar/towerrun/countdowns/EndCountdown.java @@ -20,6 +20,7 @@ package de.steamwar.towerrun.countdowns; import de.steamwar.towerrun.TowerRun; +import de.steamwar.towerrun.config.Config; import de.steamwar.towerrun.game.TowerRunGame; import de.steamwar.towerrun.state.GameStates; import org.bukkit.Bukkit; @@ -48,7 +49,11 @@ public class EndCountdown extends Countdown { void timerEnd() { Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1)); if (RESETS) { - TowerRunGame.reset(); + if (Config.event()) { + Bukkit.shutdown(); + } else { + TowerRunGame.reset(); + } lobbyCountdown.setTime(lobbyCountdown.defaultTime()); } else { Bukkit.shutdown(); diff --git a/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java b/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java index 3c846247..c1514db4 100644 --- a/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java +++ b/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java @@ -147,6 +147,7 @@ public class TowerRunGame { player.setGameMode(GameMode.SURVIVAL); } player.teleport(WorldConfig.SPAWN); + PLAYERS_ALIVE.add(TowerRunPlayer.get(player)); }); } diff --git a/TowerRun/src/de/steamwar/towerrun/generator/TowerGenerator.java b/TowerRun/src/de/steamwar/towerrun/generator/TowerGenerator.java index 4f379547..63cd94ee 100644 --- a/TowerRun/src/de/steamwar/towerrun/generator/TowerGenerator.java +++ b/TowerRun/src/de/steamwar/towerrun/generator/TowerGenerator.java @@ -140,8 +140,10 @@ public class TowerGenerator { noKeyFloors--; if (!chestBlocks.isEmpty() && noKeyFloors < 0 && random.nextDouble() < config.keyChance) { noKeyFloors = random.nextInt(config.maxNoKeyFloors - config.minNoKeyFloors) + config.minNoKeyFloors; - Container container = chestBlocks.get(random.nextInt(chestBlocks.size())); - keys.add(container.getLocation()); + for (int i = 0; i < 2; i++) { + Container container = chestBlocks.get(random.nextInt(chestBlocks.size())); + keys.add(container.getLocation()); + } for (WorldConfig.TowerGeneratorDoorBlock doorBlock : config.doorBlocks) { int x = doorBlock.getX(); diff --git a/TowerRun/src/de/steamwar/towerrun/listener/IngameListener.java b/TowerRun/src/de/steamwar/towerrun/listener/IngameListener.java index bbb332bf..bc74e57f 100644 --- a/TowerRun/src/de/steamwar/towerrun/listener/IngameListener.java +++ b/TowerRun/src/de/steamwar/towerrun/listener/IngameListener.java @@ -26,6 +26,8 @@ import de.steamwar.towerrun.config.WorldConfig; import de.steamwar.towerrun.game.TowerRunGame; import de.steamwar.towerrun.state.GameStateBukkitListener; import de.steamwar.towerrun.state.GameStates; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.entity.EntityType; @@ -42,16 +44,24 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.scheduler.BukkitRunnable; import java.util.*; -import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; public class IngameListener extends GameStateBukkitListener { private int time = 0; - private final Map> blocksToMelt = new HashMap<>(); + private final Map blocksToMelt = new HashMap<>(); private BukkitRunnable blocksToMeltRunnable; private BukkitRunnable antiCampRunnable; + @AllArgsConstructor + @EqualsAndHashCode + private class Pos { + private final int x; + private final int y; + private final int z; + } + public IngameListener() { super(EnumSet.of(GameStates.RUNNING)); } @@ -62,16 +72,21 @@ public class IngameListener extends GameStateBukkitListener { blocksToMeltRunnable = new BukkitRunnable() { @Override public void run() { - List blocks = blocksToMelt.remove(time); + List blocksToBreak = blocksToMelt.entrySet().stream() + .filter(entry -> entry.getValue() <= time) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); time++; - if (blocks == null) { + if (blocksToBreak.isEmpty()) { return; } - blocks.forEach(block -> { - if (block.getType() == Material.AIR || block.getType() == Material.LAVA) return; + for (Pos pos : blocksToBreak) { + blocksToMelt.remove(pos); + Block block = Bukkit.getWorlds().get(0).getBlockAt(pos.x, pos.y, pos.z); + if (block.getType() == Material.AIR || block.getType() == Material.LAVA) continue; block.setType(Material.AIR); block.getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.1F, 1); - }); + } } }; blocksToMeltRunnable.runTaskTimer(TowerRun.getInstance(), 0, 1); @@ -80,16 +95,16 @@ public class IngameListener extends GameStateBukkitListener { @Override public void run() { double minY = TowerRunGame.PLAYERS_ALIVE.stream() - .map(p -> p.player().getLocation().getY()) - .min(Comparator.comparing(Function.identity())) + .mapToDouble(p -> p.player().getLocation().getY()) + .average() .orElse(0.0); List toDamage = new ArrayList<>(); TowerRunGame.PLAYERS_ALIVE.forEach(towerRunPlayer -> { - if (towerRunPlayer.player().getLocation().getY() - minY > 20) { - towerRunPlayer.player().sendTitle("§a", TowerRun.getMessage().parse("CATCH_UP_WARNING", towerRunPlayer.player()), 5, 30, 5); - } if (towerRunPlayer.player().getLocation().getY() - minY > 30) { + towerRunPlayer.player().sendTitle("", TowerRun.getMessage().parse("CATCH_UP_WARNING", towerRunPlayer.player()), 5, 30, 5); + } + if (towerRunPlayer.player().getLocation().getY() - minY > 50) { toDamage.add(towerRunPlayer.player()); } }); @@ -115,12 +130,12 @@ public class IngameListener extends GameStateBukkitListener { public void onPlayerDeath(PlayerDeathEvent event) { event.setDeathMessage(null); Bukkit.getScheduler().runTaskLater(TowerRun.getInstance(), () -> { - if (TowerRun.getTowerGenerator() != null) { - event.getEntity().teleport(TowerRun.getTowerGenerator().getSpawn()); - } else { - event.getEntity().teleport(WorldConfig.SPAWN); - } - }, 5 + if (TowerRun.getTowerGenerator() != null) { + event.getEntity().teleport(TowerRun.getTowerGenerator().getSpawn()); + } else { + event.getEntity().teleport(WorldConfig.SPAWN); + } + }, 5 ); event.getEntity().setGameMode(GameMode.SPECTATOR); Bukkit.getOnlinePlayers().forEach(player -> { @@ -181,10 +196,12 @@ public class IngameListener extends GameStateBukkitListener { } event.getPlayer().getInventory().addItem(new SWItem(Material.LEVER, TowerRun.getMessage().parse("KEY_NAME", event.getPlayer())).getItemStack()); - event.getClickedBlock().setType(Material.ENDER_CHEST); - event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_ENDER_CHEST_OPEN, 1, 1); - TowerRun.getMessage().broadcast("KEY_FOUND", event.getPlayer().getName()); + + Bukkit.getOnlinePlayers().forEach(player -> { + player.playSound(event.getPlayer().getLocation(), Sound.BLOCK_ENDER_CHEST_OPEN, 1, 1); + player.sendTitle("", TowerRun.getMessage().parse("KEY_FOUND", player, event.getPlayer().getName()), 10, 70, 20); + }); } @EventHandler @@ -206,8 +223,51 @@ public class IngameListener extends GameStateBukkitListener { private void shouldMelt(Block block) { if (block.getType().isBurnable()) return; + if (block.getType().isAir()) return; + if (block.isLiquid()) return; int meltingTime = (int) (block.getType().getHardness() * 48 * 20); - blocksToMelt.computeIfAbsent(time + meltingTime, integer -> new ArrayList<>()).add(block); + switch (block.getType()) { + case TINTED_GLASS: + meltingTime = meltingTime * 2; + break; + case WHITE_STAINED_GLASS: + case ORANGE_STAINED_GLASS: + case MAGENTA_STAINED_GLASS: + case LIGHT_BLUE_STAINED_GLASS: + case YELLOW_STAINED_GLASS: + case LIME_STAINED_GLASS: + case PINK_STAINED_GLASS: + case GRAY_STAINED_GLASS: + case LIGHT_GRAY_STAINED_GLASS: + case CYAN_STAINED_GLASS: + case PURPLE_STAINED_GLASS: + case BLUE_STAINED_GLASS: + case BROWN_STAINED_GLASS: + case GREEN_STAINED_GLASS: + case RED_STAINED_GLASS: + case BLACK_STAINED_GLASS: + case WHITE_STAINED_GLASS_PANE: + case ORANGE_STAINED_GLASS_PANE: + case MAGENTA_STAINED_GLASS_PANE: + case LIGHT_BLUE_STAINED_GLASS_PANE: + case YELLOW_STAINED_GLASS_PANE: + case LIME_STAINED_GLASS_PANE: + case PINK_STAINED_GLASS_PANE: + case GRAY_STAINED_GLASS_PANE: + case LIGHT_GRAY_STAINED_GLASS_PANE: + case CYAN_STAINED_GLASS_PANE: + case PURPLE_STAINED_GLASS_PANE: + case BLUE_STAINED_GLASS_PANE: + case BROWN_STAINED_GLASS_PANE: + case GREEN_STAINED_GLASS_PANE: + case RED_STAINED_GLASS_PANE: + case BLACK_STAINED_GLASS_PANE: + meltingTime = meltingTime * 10; + default: + break; + } + Pos pos = new Pos(block.getLocation().getBlockX(), block.getLocation().getBlockY(), block.getLocation().getBlockZ()); + blocksToMelt.putIfAbsent(pos, time + meltingTime + 1); } @EventHandler diff --git a/TowerRun/src/de/steamwar/towerrun/listener/LobbyListener.java b/TowerRun/src/de/steamwar/towerrun/listener/LobbyListener.java index c93bc4bb..0a4e4358 100644 --- a/TowerRun/src/de/steamwar/towerrun/listener/LobbyListener.java +++ b/TowerRun/src/de/steamwar/towerrun/listener/LobbyListener.java @@ -68,6 +68,8 @@ public class LobbyListener extends GameStateBukkitListener { if (TowerRunGame.PLAYERS_ALIVE.stream().map(towerRunPlayer -> SteamwarUser.get(towerRunPlayer.player().getUniqueId()).getTeam()).filter(integer -> integer == team).count() < Config.EVENT_MAXIMUM_TEAM_MEMBERS) { TowerRunGame.PLAYERS_ALIVE.add(TowerRunPlayer.get(player)); + } else { + player.setGameMode(GameMode.SPECTATOR); } } else { TowerRunGame.PLAYERS_ALIVE.add(TowerRunPlayer.get(player)); diff --git a/VelocityCore/src/de/steamwar/velocitycore/Node.java b/VelocityCore/src/de/steamwar/velocitycore/Node.java index 9c717886..308d9938 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/Node.java +++ b/VelocityCore/src/de/steamwar/velocitycore/Node.java @@ -35,7 +35,7 @@ public abstract class Node { private static final List OPENJ9_ARGS = Arrays.asList( "-XX:+EnableCRIUSupport", "-XX:-CRIURestoreNonPortableMode", "-Xgc:excessiveGCratio=80", "-Xdisableexplicitgc", "-Xnoclassgc", "-Xmos128M", "-Xmns48M", "-XX:+ExitOnOutOfMemoryError", // initial heap half values of memory observed by 1.19 spectate server - "-Xsyslog:none", "-Xtrace:none", "-Xverify:none", "-Xdump:system:none", "-Xdump:jit:none", "-Xdump:snap:none", + "-Xsyslog:none", "-Xtrace:none", "-Xverify:none", "-Xdump:system:none", "-Xdump:jit:none", "-Xdump:snap:none", "-Xdump:heap:opts=hprof", "-XX:+EnableDynamicAgentLoading", "-Dlog4j.configurationFile=log4j2.xml" ); private static final Set JAVA_8 = new HashSet<>(); diff --git a/VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java b/VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java index 63d15da7..4b114a8f 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java +++ b/VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java @@ -51,7 +51,7 @@ public enum ServerVersion { static { chatMap.put("21", ServerVersion.PAPER_21); chatMap.put("1.21", ServerVersion.PAPER_21); - chatMap.put("1.21.5", ServerVersion.PAPER_21); + chatMap.put("1.21.3", ServerVersion.PAPER_21); chatMap.put("20", ServerVersion.PAPER_20); chatMap.put("1.20", ServerVersion.PAPER_20); diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/BugCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/BugCommand.java index 22c9f391..088acb09 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/BugCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/BugCommand.java @@ -19,9 +19,11 @@ package de.steamwar.velocitycore.commands; +import de.steamwar.persistent.Subserver; import de.steamwar.sql.SWException; import de.steamwar.command.SWCommand; import de.steamwar.messages.Chatter; +import de.steamwar.velocitycore.SubserverSystem; public class BugCommand extends SWCommand { public BugCommand() { @@ -35,5 +37,9 @@ public class BugCommand extends SWCommand { sender.withPlayerOrOffline(player -> player.getCurrentServer().map(connection -> connection.getServerInfo().getName()).orElse("offline"), () -> "offline") + " " + sender.user().getUserName() + " " + sender.user().getId() ); sender.system("BUG_MESSAGE", id); + + if (Subserver.isArena(Subserver.getSubserver(sender.getPlayer()))) { + sender.getPlayer().spoofChatInput("/techhiderbug"); + } } } diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java index 0dd865b1..f77207a6 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java @@ -19,9 +19,14 @@ package de.steamwar.velocitycore.commands; +import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.server.ServerInfo; +import com.viaversion.viaversion.api.Via; +import com.viaversion.viaversion.velocity.platform.VelocityViaAPI; +import com.viaversion.viaversion.velocity.platform.VelocityViaConfig; import de.steamwar.persistent.Storage; +import de.steamwar.velocitycore.ServerVersion; import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.inventory.SWItem; @@ -405,6 +410,8 @@ public class TeamCommand extends SWCommand { ServerInfo serverInfo = Storage.teamServers.computeIfAbsent(targetTeam.getTeamId(), integer -> { ServerInfo info = new ServerInfo("Team " + targetTeam.getTeamKuerzel(), address); VelocityCore.getProxy().registerServer(info); + // This is needed because otherwise ViaVersion uses the wrong version! + ((VelocityViaConfig) Via.getConfig()).getVelocityServerProtocols().put(info.getName(), ProtocolVersion.MAXIMUM_VERSION.getProtocol()); return info; }); diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java index 7ef0be27..5d84eb17 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java +++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/PluginMessage.java @@ -33,6 +33,8 @@ import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.proxy.protocol.ProtocolUtils; import de.steamwar.messages.Chatter; import de.steamwar.network.packets.NetworkPacket; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.UserPerm; import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.commands.TeamCommand; import de.steamwar.velocitycore.mods.*; @@ -360,6 +362,23 @@ public class PluginMessage extends BasicListener { )) channelRegisterHandlers.put(channel, player -> Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "minimap")); + for(String channel : Arrays.asList( + "flashback:remote_food_data", + "flashback:remote_set_slot", + "flashback:force_client_tick", + "flashback:accurate_entity_position", + "flashback:instantly_lerp", + "flashback:remote_experience", + "flashback:clear_particles", + "flashback:remote_select_hotbar_slot", // https://github.com/Moulberry/Flashback/tree/master/src/main/java/com/moulberry/flashback/packet + "flashback:clear_entities" // https://github.com/Moulberry/Flashback + )) + channelRegisterHandlers.put(channel, player -> { + if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.RESTRICTED_MODS)) { + Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "flashback"); + } + }); + for(String channel : Arrays.asList("bedrockify:cauldron_particles", "bedrockify:eat-particles")) //https://github.com/juancarloscp52/BedrockIfy (Bedrock features on Java, banned for reach-around block placement) channelRegisterHandlers.put(channel, player -> Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "bedrockify")); @@ -386,7 +405,7 @@ public class PluginMessage extends BasicListener { for(String channel : Arrays.asList( "floodgate:skin", - "watut:nbt", //https://github.com/Corosauce/WATUT + "watut:nbt", "watut:nbt_server", //https://github.com/Corosauce/WATUT "bclib:hello_server", "vivecraft:data", //https://github.com/Vivecraft/VivecraftMod https://github.com/jrbudda/Vivecraft_Spigot_Extensions https://github.com/Techjar/Vivecraft_BungeeCord_Extensions (VR support) "badpackets:channel_sync", //https://github.com/badasintended/badpackets (Forge fabric translation layer) diff --git a/WebsiteBackend/src/de/steamwar/routes/Schematic.kt b/WebsiteBackend/src/de/steamwar/routes/Schematic.kt index 1beb0f29..ec3b54fb 100644 --- a/WebsiteBackend/src/de/steamwar/routes/Schematic.kt +++ b/WebsiteBackend/src/de/steamwar/routes/Schematic.kt @@ -149,6 +149,23 @@ fun Route.configureSchematic() { return@let SchematicFormat.SPONGE_V2 } + if (version == SchematicFormat.SPONGE_V3) { + try { + val fawe = schem.getCompound("Metadata") + .getCompound("WorldEdit") + .getString("Version") + .value + + if (fawe.equals("2.12.3-SNAPSHOT")) { + SWException.log("Schematic with Bugged Version Uploaded", """ + Schematic=$schemName + User=${user.userName} + Id=${user.id} + """.trimIndent()) + } + } catch (_: Exception) {} + } + val data = NodeData(node.id, version) data.saveFromStream(content.inputStream(), version) diff --git a/buildSrc/src/steamwar.devserver.gradle b/buildSrc/src/steamwar.devserver.gradle index 1879bf87..53f8be3d 100644 --- a/buildSrc/src/steamwar.devserver.gradle +++ b/buildSrc/src/steamwar.devserver.gradle @@ -135,10 +135,10 @@ class DevServer extends DefaultTask { if (plugins != null) devPy.append(" -p $plugins") if (jar != null) devPy.append(" --jar $jar") for (Map.Entry dParam : dParams.entrySet()) { - devPy.append("-D${dParam.key}=${dParam.value}") + devPy.append(" -D${dParam.key}=${dParam.value}") } - println("Starting $template with command ${devPy.toString()}") devPy.append(" $template") + println("Starting $template with command ${devPy.toString()}") def process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start() def processOutput = new BufferedReader(new InputStreamReader(process.inputStream)) @@ -172,15 +172,15 @@ class FightServer extends DevServer { @Input @Optional - int checkSchemID = 0 + Integer checkSchemID = 0 @Input @Optional - int prepareSchemID = 0 + Integer prepareSchemID = 0 @Input @Optional - int replay = 0 + Integer replay = 0 @Input @Optional @@ -189,7 +189,7 @@ class FightServer extends DevServer { @Input @Optional // Property: fightID - int eventKampfID = 0 + Integer eventKampfID = 0 @Input @Optional diff --git a/settings.gradle.kts b/settings.gradle.kts index 51e7db6a..1fe0442b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -138,7 +138,7 @@ dependencyResolutionManagement { library("velocityapi", "com.velocitypowered:velocity-api:3.3.0-SNAPSHOT") library("viaapi", "com.viaversion:viaversion-api:4.3.1") library("viavelocity", "com.viaversion:viaversion-velocity:4.3.1") - library("jda", "net.dv8tion:JDA:5.2.0") + library("jda", "net.dv8tion:JDA:5.5.1") library("msgpack", "org.msgpack:msgpack-core:0.9.8") library("apolloprotos", "com.lunarclient:apollo-protos:1.0-SNAPSHOT") @@ -218,6 +218,7 @@ include( "SchematicSystem", "SchematicSystem:SchematicSystem_8", "SchematicSystem:SchematicSystem_15", + "SchematicSystem:SchematicSystem_19", "SchematicSystem:SchematicSystem_Core" )