Compare commits

..
Author SHA1 Message Date
zOnlyKroks 2d172ffe6b Implement basic techhider 2025-10-08 18:32:32 +02:00
47 changed files with 378 additions and 350 deletions
@@ -980,12 +980,10 @@ SELECT_ITEM_BAUPLATTFORM=§eBuild platform
SELECT_ITEM_TESTBLOCK=§eDummy
CHESTFILLER_FILLED=§eChest filled
CHESTFILLER_COUNT=§7{0}§8: §e§l{1}
PISTON_HELP_1=§7Right click on piston to calculate the moved blocks.
PISTON_HELP_1=§7Right click on piston with a slime ball to calculate the moved blocks.
PISTON_HELP_2=§7Count is red, if one unmoveable block is present.
PISTON_HELP_3=§7Count is yellow, if too many blocks are present.
PISTON_INFO=§7Moved Blocks {0}{1}§8/§712
PISTON_ENABLED=§aCalculator enabled
PISTON_DISABLED=§cCalculator disabled
# Warp
WARP_LOC_X=§7X§8: §e{0}
WARP_LOC_Y=§7Y§8: §e{0}
@@ -912,12 +912,10 @@ SELECT_ITEM_BAURAHMEN=§eBaurahmen
SELECT_ITEM_BAUPLATTFORM=§eBauplattform
SELECT_ITEM_TESTBLOCK=§eTestblock
CHESTFILLER_FILLED=§eKiste gefüllt
PISTON_HELP_1=§7Rechts Klick auf einen Piston berechnet dir die bewegten Blöcke.
PISTON_HELP_1=§7Rechts Klick auf Piston mit einem Slime Ball berechnet dir die bewegten Blöcke.
PISTON_HELP_2=§7Die Anzahl ist Rot, wenn ein unmovable Block vorhanden ist.
PISTON_HELP_3=§7Die Anzahl ist Gelb, wenn zu viele Blöcke vorhanden sind.
PISTON_INFO=§7Bewegte Blöcke {0}{1}§8/§712
PISTON_ENABLED=§aPiston-Berechnung aktiviert
PISTON_DISABLED=§cPiston-Berechnung deaktiviert
# Warp
WARP_LOC_X=§7X§8: §e{0}
WARP_LOC_Y=§7Y§8: §e{0}
@@ -56,7 +56,6 @@ public class ResetCommand extends SWCommand {
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getArea().reset(pasteBuilder, false);
region.getFlags().clear();
region.getRegionData().clear();
RegionUtils.message(region, "REGION_RESET_RESETED");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);
@@ -25,13 +25,13 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
@@ -93,37 +93,8 @@ public class TestblockCommand extends SWCommand {
}
}
// Beta Tester enabled
switch (BauServer.getInstance().getOwnerID()) {
case 245:
case 403:
case 1898:
case 3320:
case 4603:
case 5262:
case 6032:
case 11077:
case 11888:
case 12258:
case 16009:
if (node == null) {
node = region.getRegionData().getTestblockSchematic();
} else {
region.getRegionData().setTestblockSchematic(node);
}
break;
default:
break;
}
PasteBuilder.ClipboardProvider clipboardProvider;
if (node == null) {
clipboardProvider = new PasteBuilder.FileProvider(region.getTestblockArea().getResetFile());
} else {
clipboardProvider = new PasteBuilder.SchematicProvider(node);
}
try {
PasteBuilder.ClipboardProvider clipboardProvider = node == null ? new PasteBuilder.FileProvider(region.getTestblockArea().getResetFile()) : new PasteBuilder.SchematicProvider(node);
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider)
.ignoreAir(ignoreAir)
.onlyColors(onlyColors)
@@ -40,10 +40,13 @@ import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.bausystem.utils.RayTraceUtils;
import de.steamwar.data.CMDs;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import lombok.AllArgsConstructor;
@@ -71,14 +74,14 @@ import java.util.stream.Collectors;
@MinVersion(19)
public class SimulatorCursor implements Listener {
private static final World WORLD = Bukkit.getWorlds().get(0);
private final World WORLD = Bukkit.getWorlds().get(0);
private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
private static Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
private static Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
private static final Set<Player> calculating = new HashSet<>();
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
private final Set<Player> calculating = new HashSet<>();
public static boolean isSimulatorItem(ItemStack itemStack) {
return ItemUtils.isItem(itemStack, "simulator");
@@ -118,7 +121,7 @@ public class SimulatorCursor implements Listener {
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getChanged().forEach(SimulatorCursor::calcCursor);
event.getChanged().forEach(this::calcCursor);
}
@EventHandler
@@ -147,28 +150,29 @@ public class SimulatorCursor implements Listener {
return;
}
if (LAST_SNEAKS.containsKey(player)) {
SWInventory swInventory = new SWInventory(player, 9, "Simulator Cursor");
int slot = 2;
CursorType currentType = cursorType.getOrDefault(player, CursorType.TNT);
if (currentType == CursorType.TNT) {
cursorType.put(player, CursorType.REDSTONE_BLOCK);
} else {
cursorType.put(player, CursorType.TNT);
for (CursorType type : CursorType.values()) {
boolean selected = type == currentType;
SWItem swItem = new SWItem(selected ? type.material : type.nonSelectedMaterial, "§e" + type.name)
.setCustomModelData(selected ? 0 : CMDs.Simulator.NEW_PHASE)
.setLore(Collections.singletonList("§eClick to select"))
.setCallback(click -> {
cursorType.put(player, type);
calcCursor(player);
player.closeInventory();
});
swInventory.setItem(slot, swItem);
slot += 2;
}
calcCursor(player);
swInventory.open();
} else {
LAST_SNEAKS.put(player, System.currentTimeMillis());
}
}
public static CursorType getCursorType(Player player) {
return cursorType.getOrDefault(player, CursorType.TNT);
}
public static void setCursorType(Player player, CursorType cursorType) {
SimulatorCursor.cursorType.put(player, cursorType);
calcCursor(player);
}
public static void calcCursor(Player player) {
public void calcCursor(Player player) {
synchronized (calculating) {
if (calculating.contains(player)) return;
calculating.add(player);
@@ -216,7 +220,7 @@ public class SimulatorCursor implements Listener {
}
}
private static synchronized boolean removeCursor(Player player) {
private synchronized boolean removeCursor(Player player) {
REntityServer entityServer = cursors.get(player);
boolean hadCursor = entityServer != null && !entityServer.getEntities().isEmpty();
if (entityServer != null) {
@@ -225,7 +229,7 @@ public class SimulatorCursor implements Listener {
return hadCursor;
}
private static synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
private synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
REntityServer entityServer = cursors.computeIfAbsent(player, __ -> {
REntityServer rEntityServer = new REntityServer();
rEntityServer.addPlayer(player);
@@ -350,11 +354,11 @@ public class SimulatorCursor implements Listener {
OBSERVER(Material.OBSERVER, Material.QUARTZ, SimulatorCursor::getPosBlockAligned, "Observer", vector -> new ObserverElement(vector).add(new ObserverPhase())),
;
public final Material material;
public final Material nonSelectedMaterial;
public final BiFunction<Player, RayTraceUtils.RRayTraceResult, Vector> position;
public final String name;
public final Function<Vector, SimulatorElement<?>> elementFunction;
private Material material;
private Material nonSelectedMaterial;
private BiFunction<Player, RayTraceUtils.RRayTraceResult, Vector> position;
private String name;
private Function<Vector, SimulatorElement<?>> elementFunction;
}
@EventHandler
@@ -1,67 +0,0 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.simulator.gui;
import de.steamwar.bausystem.features.simulator.SimulatorCursor;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.data.CMDs;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.Collections;
public class SimulatorCursorSwitcherGui extends SimulatorBaseGui {
private SimulatorBaseGui back;
public SimulatorCursorSwitcherGui(Player player, Simulator simulator, SimulatorBaseGui back) {
super(player, simulator, 9);
this.back = back;
}
@Override
public String title() {
return "Simulator Cursor";
}
@Override
public void populate() {
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open();
}).setCustomModelData(CMDs.BACK));
int slot = 2;
SimulatorCursor.CursorType currentType = SimulatorCursor.getCursorType(player);
for (SimulatorCursor.CursorType type : SimulatorCursor.CursorType.values()) {
boolean selected = type == currentType;
SWItem swItem = new SWItem(selected ? type.material : type.nonSelectedMaterial, "§e" + type.name)
.setCustomModelData(selected ? 0 : CMDs.Simulator.NEW_PHASE)
.setLore(Collections.singletonList("§eClick to select"))
.setCallback(click -> {
SimulatorCursor.setCursorType(player, type);
player.closeInventory();
});
inventory.setItem(slot, swItem);
slot += 2;
}
}
}
@@ -19,7 +19,6 @@
package de.steamwar.bausystem.features.simulator.gui;
import de.steamwar.bausystem.features.simulator.SimulatorCursor;
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator.data.Simulator;
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
@@ -50,11 +49,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
inventory.setItem(4, simulator.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open();
}));
SimulatorCursor.CursorType cursorType = SimulatorCursor.getCursorType(player);
inventory.setItem(48, new SWItem(cursorType.material, "§7Placing §8-§e " + cursorType.name, clickType -> {
new SimulatorCursorSwitcherGui(player, simulator, this).open();
}));
inventory.setItem(50, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorSettingsGui(player, simulator, this).open();
}).setCustomModelData(CMDs.Simulator.SETTINGS));
}
@@ -49,8 +49,7 @@ import java.util.stream.Collectors;
@MinVersion(20)
public class PistonCalculator implements Listener {
private final Map<Player, Long> debounce = new HashMap<>();
protected final Set<Player> disablePistonCalculator = new HashSet<>();
private final Map<Player, Long> DEBOUNCE = new HashMap<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
@@ -59,16 +58,15 @@ public class PistonCalculator implements Listener {
if (event.getItem() == null) {
} else if (event.getItem() != null && event.getItem().getType() == Material.SLIME_BALL) {
} else if (!event.getItem().getType().isBlock()) {
debounce.put(event.getPlayer(), System.currentTimeMillis());
DEBOUNCE.put(event.getPlayer(), System.currentTimeMillis());
return;
} else return;
if (event.getClickedBlock() == null) return;
Block clickedBlock = event.getClickedBlock();
Material blockType = clickedBlock.getType();
if (!(blockType == Material.PISTON || blockType == Material.STICKY_PISTON)) return;
if (disablePistonCalculator.contains(event.getPlayer())) return;
if (System.currentTimeMillis() - debounce.getOrDefault(event.getPlayer(), 0L) <= 200) return;
debounce.put(event.getPlayer(), System.currentTimeMillis());
if (System.currentTimeMillis() - DEBOUNCE.getOrDefault(event.getPlayer(), 0L) <= 200) return;
DEBOUNCE.put(event.getPlayer(), System.currentTimeMillis());
Location location = event.getClickedBlock().getLocation();
if (pistOrders.containsKey(location)) {
@@ -145,14 +143,11 @@ public class PistonCalculator implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
debounce.remove(event.getPlayer());
disablePistonCalculator.remove(event.getPlayer());
}
DEBOUNCE.remove(event.getPlayer());
public void clear(Player player) {
Set<Location> toRemove = new HashSet<>();
pistOrders.forEach((location, pistOrder) -> {
pistOrder.server.removePlayer(player);
pistOrder.server.removePlayer(event.getPlayer());
if (pistOrder.server.getPlayers().isEmpty()) {
toRemove.add(location);
pistOrder.server.close();
@@ -22,46 +22,21 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.MinVersion;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@Linked
@MinVersion(20)
public class PistonCalculatorCommand extends SWCommand {
@LinkedInstance
public PistonCalculator pistonCalculator;
private final Set<UUID> helpMessageShowed = new HashSet<>();
public PistonCalculatorCommand() {
super("piston", "pistoncalculator", "pistoncalc");
}
@Register
public void genericCommand(@Validator Player player) {
if (pistonCalculator.disablePistonCalculator.contains(player)) {
pistonCalculator.disablePistonCalculator.remove(player);
if (!helpMessageShowed.contains(player.getUniqueId())) {
BauSystem.MESSAGE.send("PISTON_HELP_1", player);
BauSystem.MESSAGE.send("PISTON_HELP_2", player);
BauSystem.MESSAGE.send("PISTON_HELP_3", player);
helpMessageShowed.add(player.getUniqueId());
}
BauSystem.MESSAGE.send("PISTON_ENABLED", player);
} else {
pistonCalculator.disablePistonCalculator.add(player);
BauSystem.MESSAGE.send("PISTON_DISABLED", player);
}
}
@Register("clear")
public void clearCommand(@Validator Player player) {
pistonCalculator.clear(player);
public void help(@Validator Player player) {
BauSystem.MESSAGE.send("PISTON_HELP_1", player);
BauSystem.MESSAGE.send("PISTON_HELP_2", player);
BauSystem.MESSAGE.send("PISTON_HELP_3", player);
}
}
@@ -72,9 +72,6 @@ public interface Region {
@NonNull
RegionBackups getBackups();
@NonNull
RegionData getRegionData();
interface Area {
Area EMPTY = new Area() {
@@ -1,93 +0,0 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region;
import de.steamwar.sql.SchematicNode;
import yapion.hierarchy.types.YAPIONObject;
import java.util.Objects;
public interface RegionData {
void clear();
SchematicNode getTestblockSchematic();
void setTestblockSchematic(SchematicNode schematic);
RegionData EMPTY = new RegionData() {
@Override
public void clear() {
}
@Override
public SchematicNode getTestblockSchematic() {
return null;
}
@Override
public void setTestblockSchematic(SchematicNode schematic) {
}
};
class RegionDataImpl implements RegionData {
private final YAPIONObject yapionObject;
private final Runnable onChange;
public RegionDataImpl(YAPIONObject yapionObject, Runnable onChange) {
this.yapionObject = yapionObject;
this.onChange = onChange;
if (yapionObject.containsKey("testblockSchematic")) {
testblockSchematic = SchematicNode.getSchematicNode(yapionObject.getInt("testblockSchematic"));
}
}
@Override
public void clear() {
testblockSchematic = null;
yapionObject.remove("testblockSchematic");
onChange.run();
}
private SchematicNode testblockSchematic = null;
@Override
public SchematicNode getTestblockSchematic() {
return testblockSchematic;
}
@Override
public void setTestblockSchematic(SchematicNode schematic) {
if (Objects.equals(this.testblockSchematic, schematic)) {
return;
}
this.testblockSchematic = schematic;
if (schematic == null) {
yapionObject.remove("testblockSchematic");
} else {
yapionObject.put("testblockSchematic", testblockSchematic.getId());
}
onChange.run();
}
}
}
@@ -139,9 +139,4 @@ public final class FixedGlobalRegion implements Region {
public @NonNull RegionBackups getBackups() {
return RegionBackups.EMPTY;
}
@Override
public @NonNull RegionData getRegionData() {
return RegionData.EMPTY;
}
}
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.TestblockMode;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.core.Core;
import de.steamwar.sql.SchematicType;
import lombok.NonNull;
@@ -58,7 +57,6 @@ public class FixedRegion implements Region {
private final int floorLevel;
private final int waterLevel;
private final GameModeConfig gameModeConfig;
private final RegionData regionData;
private final RegionHistory regionHistory = new RegionHistory.Impl(20);
private final RegionBackups regionBackups = new RegionBackups() {
@@ -337,7 +335,6 @@ public class FixedRegion implements Region {
}
}
this.gameModeConfig = new GameModeConfig(found);
this.regionData = new RegionData.RegionDataImpl(regionData, WorldData::write);
}
@Override
@@ -384,9 +381,4 @@ public class FixedRegion implements Region {
public @NonNull RegionBackups getBackups() {
return regionBackups;
}
@Override
public @NonNull RegionData getRegionData() {
return regionData;
}
}
@@ -83,7 +83,7 @@ public class SchematicNode {
private static final SelectStatement<SchematicNode> byIdAndUser = new SelectStatement<>(table,
"SELECT NodeId, NodeOwner, ? AS EffectiveOwner, NodeName, ParentNode, LastUpdate, NodeItem, NodeType, NodeRank, Config FROM SchematicNode WHERE NodeId = ?");
private static final SelectStatement<SchematicNode> allParentsOfNode = new SelectStatement<>(table,
"WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? AND EffectiveOwner = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.Config FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId");
"WITH RECURSIVE R AS (SELECT NodeId, ParentNode FROM EffectiveSchematicNode WHERE NodeId = ? AND EffectiveOwner = ? UNION SELECT E.NodeId, E.ParentNode FROM R, EffectiveSchematicNode E WHERE R.ParentNode = E.NodeId AND E.EffectiveOwner = ?) SELECT SN.NodeId, SN.NodeOwner, ? AS EffectiveOwner, SN.NodeName, R.ParentNode, SN.LastUpdate, SN.NodeItem, SN.NodeType, SN.NodeRank, SN.ReplaceColor, SN.AllowReplay FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId");
static {
NodeMember.init();
@@ -24,13 +24,11 @@ import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Set;
import java.util.stream.Collectors;
@AllArgsConstructor
@Getter
public class TeamTeilnahme {
private static final Table<TeamTeilnahme> table = new Table<>(TeamTeilnahme.class);
@@ -40,28 +38,16 @@ public class TeamTeilnahme {
private static final Statement insert = table.insert(Table.PRIMARY);
private static final Statement delete = table.delete(Table.PRIMARY);
private static final Statement deleteFuture = new Statement("DELETE t FROM TeamTeilnahme t INNER JOIN Event e ON t.EventID = e.EventID WHERE t.TeamID = ? AND e.Start > NOW()");
private static final Statement update = table.update(Table.PRIMARY, "Place");
@Field(keys = {Table.PRIMARY})
private final int teamId;
@Field(keys = {Table.PRIMARY})
private final int eventId;
@Field
private int place;
public void setPlace(int place) {
update.update(place, teamId, eventId);
this.place = place;
}
public static boolean nimmtTeil(int teamID, int eventID){
return select.select(teamID, eventID) != null;
}
public static TeamTeilnahme get(int teamID, int eventID) {
return select.select(teamID, eventID);
}
public static void teilnehmen(int teamID, int eventID){
insert.update(teamID, eventID);
}
@@ -60,14 +60,16 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
public TechHiderWrapper() {
super(ENABLED, FightState.Schem);
SecretKey key1;
techHider = new TechHider(this, Config.ObfuscateWith, Config.HiddenBlocks, Config.HiddenBlockEntities);
try {
key = new SecretKeySpec(Files.readAllBytes(new File(System.getProperty("user.home"), "hullhider.key").toPath()), "AES");
key1 = new SecretKeySpec(Files.readAllBytes(new File(System.getProperty("user.home"), "hullhider.key").toPath()), "AES");
} catch (IOException e) {
throw new SecurityException(e);
key1 = new SecretKeySpec(new byte[32], "AES");
}
key = key1;
new StateDependentListener(ENABLED, FightState.Schem, this);
register();
}
@@ -0,0 +1,35 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
tasks.compileJava {
options.isWarnings = false
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(libs.spigotapi)
compileOnly(libs.netty)
compileOnly(libs.fastutil)
}
@@ -0,0 +1,32 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider_8", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider_9", "default"))
compileOnly(libs.nms14)
}
@@ -0,0 +1,32 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(libs.nms18)
compileOnly(libs.netty)
compileOnly(libs.spigotapi)
}
@@ -0,0 +1,32 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider_18", "default"))
compileOnly(libs.nms19)
compileOnly(libs.spigotapi)
}
@@ -0,0 +1,32 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(libs.nms21)
compileOnly(libs.netty)
compileOnly(libs.spigotapi)
}
@@ -0,0 +1,30 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(libs.nms8)
}
@@ -0,0 +1,31 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
steamwar.java
}
dependencies {
compileOnly(project(":CommonCore", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider", "default"))
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
compileOnly(project(":HiderCore:HiderCore_TechHider_8", "default"))
compileOnly(libs.nms9)
}
+42
View File
@@ -0,0 +1,42 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
plugins {
`java-library`
alias(libs.plugins.shadow)
}
tasks.build {
finalizedBy(tasks.shadowJar)
}
dependencies {
api(project(":HiderCore:HiderCore_TechHider"))
implementation(project(":HiderCore:HiderCore_TechHider_8"))
implementation(project(":HiderCore:HiderCore_TechHider_9"))
implementation(project(":HiderCore:HiderCore_TechHider_14"))
implementation(project(":HiderCore:HiderCore_TechHider_18"))
implementation(project(":HiderCore:HiderCore_TechHider_19"))
implementation(project(":HiderCore:HiderCore_TechHider_21")) {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
}
}
}
@@ -23,7 +23,6 @@ import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.Reflection;
import de.steamwar.command.*;
import de.steamwar.core.authlib.AuthlibInjector;
import de.steamwar.core.events.AntiNocom;
import de.steamwar.core.events.ChattingEvent;
import de.steamwar.core.events.PlayerJoinedEvent;
import de.steamwar.core.events.WorldLoadEvent;
@@ -110,7 +109,16 @@ public class Core extends JavaPlugin {
TinyProtocol.init();
CheckpointUtils.signalHandler();
new AntiNocom();
// AntiNocom moved to HiderCore - will be initialized if HiderCore is present
try {
Class<?> antiNocomClass = Class.forName("de.steamwar.core.events.AntiNocom");
antiNocomClass.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException ignored) {
// HiderCore not present, skip AntiNocom
} catch (Exception e) {
getLogger().log(Level.WARNING, "Failed to initialize AntiNocom", e);
}
if(Core.getVersion() >= 19)
new ServerDataHandler();
+1
View File
@@ -30,6 +30,7 @@ dependencies {
api(project(":CommonCore"))
api(project(":CommandFramework"))
api(project(":SpigotCore:SpigotCore_Main"))
api(project(":HiderCore"))
implementation(project(":SpigotCore:SpigotCore_8"))
implementation(project(":SpigotCore:SpigotCore_9"))
@@ -402,7 +402,7 @@ public class PluginMessage extends BasicListener {
"axiom:set_world_property", "axiom:set_block", "axiom:set_hotbar_slot", "axiom:switch_active_hotbar",
"axiom:teleport", "axiom:request_chunk_data", "axiom:spawn_entity", "axiom:response_entity_data",
"axiom:manipulate_entity", "axiom:delete_entity", "axiom:marker_nbt_request", "axiom:set_buffer",
"axiom:allowed_gamemodes", "axiom:ignore_display_entities", "axiom:add_server_heightmap", "axiom:set_no_physical_trigger"
"axiom:allowed_gamemodes", "axiom:ignore_display_entities", "axiom:add_server_heightmap"
)) {
channelRegisterHandlers.put(channel, player -> {});
registerPassthroughToServer(channel);
@@ -54,7 +54,7 @@ public class PlayerSkinHandler extends PacketHandler {
VelocityCore.getProxy().getEventManager().register(VelocityCore.get(), this);
}
private final Map<UUID, SkinData> skins = new LinkedHashMap<>(maxCacheSize, 1, true) {
private Map<UUID, SkinData> skins = new LinkedHashMap<>(maxCacheSize, 1, true) {
@Override
protected boolean removeEldestEntry(Map.Entry<UUID, SkinData> eldest) {
return size() > maxCacheSize;
@@ -64,40 +64,38 @@ public class PlayerSkinHandler extends PacketHandler {
@Handler
@SneakyThrows
public void handle(PlayerSkinRequestPacket packet) {
synchronized (skins) {
if (skins.containsKey(packet.getUuid())) {
SkinData skinData = skins.get(packet.getUuid());
NetworkSender.send(((ServerMetaInfo) packet.getMetaInfos()).sender().getServer(), new PlayerSkinResponsePacket(packet.getUuid(), skinData.skin, skinData.signature));
if (skins.containsKey(packet.getUuid())) {
SkinData skinData = skins.get(packet.getUuid());
NetworkSender.send(((ServerMetaInfo) packet.getMetaInfos()).sender().getServer(), new PlayerSkinResponsePacket(packet.getUuid(), skinData.skin, skinData.signature));
return;
}
String url = "https://sessionserver.mojang.com/session/minecraft/profile/" + packet.getUuid().toString().replace("-", "") + "?unsigned=false";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestProperty("User-Agent", "SkinFetcher");
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
return;
}
InputStream is = connection.getInputStream();
String json = new BufferedReader(new InputStreamReader(is))
.lines().collect(Collectors.joining("\n"));
JsonObject obj = JsonParser.parseString(json).getAsJsonObject();
JsonArray properties = obj.getAsJsonArray("properties");
for (JsonElement propElement : properties) {
JsonObject prop = propElement.getAsJsonObject();
if (prop.get("name").getAsString().equals("textures")) {
String skin = prop.get("value").getAsString();
String signature = prop.get("signature").getAsString();
skins.put(packet.getUuid(), new SkinData(skin, signature));
NetworkSender.send(((ServerMetaInfo) packet.getMetaInfos()).sender().getServer(), new PlayerSkinResponsePacket(packet.getUuid(), skin, signature));
return;
}
String url = "https://sessionserver.mojang.com/session/minecraft/profile/" + packet.getUuid().toString().replace("-", "") + "?unsigned=false";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestProperty("User-Agent", "SkinFetcher");
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
return;
}
InputStream is = connection.getInputStream();
String json = new BufferedReader(new InputStreamReader(is))
.lines().collect(Collectors.joining("\n"));
JsonObject obj = JsonParser.parseString(json).getAsJsonObject();
JsonArray properties = obj.getAsJsonArray("properties");
for (JsonElement propElement : properties) {
JsonObject prop = propElement.getAsJsonObject();
if (prop.get("name").getAsString().equals("textures")) {
String skin = prop.get("value").getAsString();
String signature = prop.get("signature").getAsString();
skins.put(packet.getUuid(), new SkinData(skin, signature));
NetworkSender.send(((ServerMetaInfo) packet.getMetaInfos()).sender().getServer(), new PlayerSkinResponsePacket(packet.getUuid(), skin, signature));
return;
}
}
}
}
@@ -107,17 +105,14 @@ public class PlayerSkinHandler extends PacketHandler {
GameProfile gameProfile = player.getGameProfile();
GameProfile.Property property = gameProfile.getProperties().stream().filter(p -> p.getName().equals("textures")).findFirst().orElse(null);
if (property == null) return;
skins.put(player.getUniqueId(), new SkinData(property.getValue(), property.getSignature()));
synchronized (skins) {
skins.put(player.getUniqueId(), new SkinData(property.getValue(), property.getSignature()));
Set<UUID> uuidSet = skins.keySet();
VelocityCore.getProxy().getAllServers().forEach(server -> {
for (UUID uuid : uuidSet) {
NetworkSender.send(server, new PlayerSkinResponsePacket(uuid, property.getValue(), property.getSignature()));
}
});
}
Set<UUID> uuidSet = skins.keySet();
VelocityCore.getProxy().getAllServers().forEach(server -> {
for (UUID uuid : uuidSet) {
NetworkSender.send(server, new PlayerSkinResponsePacket(uuid, property.getValue(), property.getSignature()));
}
});
}
public record SkinData(String skin, String signature) {}
+11
View File
@@ -190,6 +190,17 @@ include(
"CommonCore:Network"
)
include(
"HiderCore",
"HiderCore:HiderCore_TechHider",
"HiderCore:HiderCore_TechHider_8",
"HiderCore:HiderCore_TechHider_9",
"HiderCore:HiderCore_TechHider_14",
"HiderCore:HiderCore_TechHider_18",
"HiderCore:HiderCore_TechHider_19",
"HiderCore:HiderCore_TechHider_21"
)
include(
"FightSystem",
"FightSystem:FightSystem_8",