forked from SteamWar/SteamWar
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
733588d75e | ||
|
|
eeb2eae7eb | ||
|
|
ed672ec07a | ||
|
|
67960bfc2a | ||
|
|
c831d994be | ||
|
|
08706d705d | ||
|
|
6ccb056065 | ||
|
|
2b32cf38c7 | ||
|
|
bcdda35b44 | ||
|
|
d154fe90a9 | ||
|
|
a12c620744 | ||
|
|
f9c320cb33 | ||
|
|
4e050106f5 | ||
|
|
089503e0a0 | ||
|
|
7179daedae | ||
|
|
e69d203b99 | ||
|
|
e1fa8aaefa |
@@ -980,10 +980,12 @@ 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 with a slime ball to calculate the moved blocks.
|
||||
PISTON_HELP_1=§7Right click on piston 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,10 +912,12 @@ SELECT_ITEM_BAURAHMEN=§eBaurahmen
|
||||
SELECT_ITEM_BAUPLATTFORM=§eBauplattform
|
||||
SELECT_ITEM_TESTBLOCK=§eTestblock
|
||||
CHESTFILLER_FILLED=§eKiste gefüllt
|
||||
PISTON_HELP_1=§7Rechts Klick auf Piston mit einem Slime Ball berechnet dir die bewegten Blöcke.
|
||||
PISTON_HELP_1=§7Rechts Klick auf einen Piston 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,6 +56,7 @@ 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);
|
||||
|
||||
+31
-2
@@ -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,8 +93,37 @@ 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)
|
||||
|
||||
+27
-31
@@ -40,13 +40,10 @@ 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;
|
||||
@@ -74,14 +71,14 @@ import java.util.stream.Collectors;
|
||||
@MinVersion(19)
|
||||
public class SimulatorCursor implements Listener {
|
||||
|
||||
private final World WORLD = Bukkit.getWorlds().get(0);
|
||||
private static 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 Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
||||
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
||||
private final Set<Player> calculating = new HashSet<>();
|
||||
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<>();
|
||||
|
||||
public static boolean isSimulatorItem(ItemStack itemStack) {
|
||||
return ItemUtils.isItem(itemStack, "simulator");
|
||||
@@ -121,7 +118,7 @@ public class SimulatorCursor implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getChanged().forEach(this::calcCursor);
|
||||
event.getChanged().forEach(SimulatorCursor::calcCursor);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -150,29 +147,28 @@ 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);
|
||||
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;
|
||||
if (currentType == CursorType.TNT) {
|
||||
cursorType.put(player, CursorType.REDSTONE_BLOCK);
|
||||
} else {
|
||||
cursorType.put(player, CursorType.TNT);
|
||||
}
|
||||
swInventory.open();
|
||||
calcCursor(player);
|
||||
} else {
|
||||
LAST_SNEAKS.put(player, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
public void calcCursor(Player player) {
|
||||
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) {
|
||||
synchronized (calculating) {
|
||||
if (calculating.contains(player)) return;
|
||||
calculating.add(player);
|
||||
@@ -220,7 +216,7 @@ public class SimulatorCursor implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized boolean removeCursor(Player player) {
|
||||
private static synchronized boolean removeCursor(Player player) {
|
||||
REntityServer entityServer = cursors.get(player);
|
||||
boolean hadCursor = entityServer != null && !entityServer.getEntities().isEmpty();
|
||||
if (entityServer != null) {
|
||||
@@ -229,7 +225,7 @@ public class SimulatorCursor implements Listener {
|
||||
return hadCursor;
|
||||
}
|
||||
|
||||
private synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
|
||||
private static synchronized void showCursor(Player player, RayTraceUtils.RRayTraceResult rayTraceResult, boolean hasSimulatorSelected) {
|
||||
REntityServer entityServer = cursors.computeIfAbsent(player, __ -> {
|
||||
REntityServer rEntityServer = new REntityServer();
|
||||
rEntityServer.addPlayer(player);
|
||||
@@ -354,11 +350,11 @@ public class SimulatorCursor implements Listener {
|
||||
OBSERVER(Material.OBSERVER, Material.QUARTZ, SimulatorCursor::getPosBlockAligned, "Observer", vector -> new ObserverElement(vector).add(new ObserverPhase())),
|
||||
;
|
||||
|
||||
private Material material;
|
||||
private Material nonSelectedMaterial;
|
||||
private BiFunction<Player, RayTraceUtils.RRayTraceResult, Vector> position;
|
||||
private String name;
|
||||
private Function<Vector, SimulatorElement<?>> elementFunction;
|
||||
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;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
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;
|
||||
@@ -49,7 +50,11 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
|
||||
inventory.setItem(4, simulator.toItem(player, clickType -> {
|
||||
new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open();
|
||||
}));
|
||||
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||
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 -> {
|
||||
new SimulatorSettingsGui(player, simulator, this).open();
|
||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
||||
}
|
||||
|
||||
+11
-6
@@ -49,7 +49,8 @@ import java.util.stream.Collectors;
|
||||
@MinVersion(20)
|
||||
public class PistonCalculator implements Listener {
|
||||
|
||||
private final Map<Player, Long> DEBOUNCE = new HashMap<>();
|
||||
private final Map<Player, Long> debounce = new HashMap<>();
|
||||
protected final Set<Player> disablePistonCalculator = new HashSet<>();
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
@@ -58,15 +59,16 @@ 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 (System.currentTimeMillis() - DEBOUNCE.getOrDefault(event.getPlayer(), 0L) <= 200) return;
|
||||
DEBOUNCE.put(event.getPlayer(), System.currentTimeMillis());
|
||||
if (disablePistonCalculator.contains(event.getPlayer())) return;
|
||||
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)) {
|
||||
@@ -143,11 +145,14 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
DEBOUNCE.remove(event.getPlayer());
|
||||
debounce.remove(event.getPlayer());
|
||||
disablePistonCalculator.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public void clear(Player player) {
|
||||
Set<Location> toRemove = new HashSet<>();
|
||||
pistOrders.forEach((location, pistOrder) -> {
|
||||
pistOrder.server.removePlayer(event.getPlayer());
|
||||
pistOrder.server.removePlayer(player);
|
||||
if (pistOrder.server.getPlayers().isEmpty()) {
|
||||
toRemove.add(location);
|
||||
pistOrder.server.close();
|
||||
|
||||
+29
-4
@@ -22,21 +22,46 @@ 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 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,9 @@ public interface Region {
|
||||
@NonNull
|
||||
RegionBackups getBackups();
|
||||
|
||||
@NonNull
|
||||
RegionData getRegionData();
|
||||
|
||||
interface Area {
|
||||
|
||||
Area EMPTY = new Area() {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -139,4 +139,9 @@ public final class FixedGlobalRegion implements Region {
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionData getRegionData() {
|
||||
return RegionData.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -26,6 +26,7 @@ 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;
|
||||
@@ -57,6 +58,7 @@ 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() {
|
||||
@@ -335,6 +337,7 @@ public class FixedRegion implements Region {
|
||||
}
|
||||
}
|
||||
this.gameModeConfig = new GameModeConfig(found);
|
||||
this.regionData = new RegionData.RegionDataImpl(regionData, WorldData::write);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -381,4 +384,9 @@ 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.ReplaceColor, SN.AllowReplay 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.Config FROM R INNER JOIN SchematicNode SN ON SN.NodeId = R.NodeId");
|
||||
|
||||
static {
|
||||
NodeMember.init();
|
||||
|
||||
@@ -24,11 +24,13 @@ 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);
|
||||
@@ -38,16 +40,28 @@ 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);
|
||||
}
|
||||
|
||||
+2
-4
@@ -60,16 +60,14 @@ 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 {
|
||||
key1 = new SecretKeySpec(Files.readAllBytes(new File(System.getProperty("user.home"), "hullhider.key").toPath()), "AES");
|
||||
key = new SecretKeySpec(Files.readAllBytes(new File(System.getProperty("user.home"), "hullhider.key").toPath()), "AES");
|
||||
} catch (IOException e) {
|
||||
key1 = new SecretKeySpec(new byte[32], "AES");
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
||||
key = key1;
|
||||
new StateDependentListener(ENABLED, FightState.Schem, this);
|
||||
register();
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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,6 +23,7 @@ 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;
|
||||
@@ -109,16 +110,7 @@ public class Core extends JavaPlugin {
|
||||
|
||||
TinyProtocol.init();
|
||||
CheckpointUtils.signalHandler();
|
||||
|
||||
// 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);
|
||||
}
|
||||
new AntiNocom();
|
||||
|
||||
if(Core.getVersion() >= 19)
|
||||
new ServerDataHandler();
|
||||
|
||||
@@ -30,7 +30,6 @@ 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:allowed_gamemodes", "axiom:ignore_display_entities", "axiom:add_server_heightmap", "axiom:set_no_physical_trigger"
|
||||
)) {
|
||||
channelRegisterHandlers.put(channel, player -> {});
|
||||
registerPassthroughToServer(channel);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PlayerSkinHandler extends PacketHandler {
|
||||
VelocityCore.getProxy().getEventManager().register(VelocityCore.get(), this);
|
||||
}
|
||||
|
||||
private Map<UUID, SkinData> skins = new LinkedHashMap<>(maxCacheSize, 1, true) {
|
||||
private final Map<UUID, SkinData> skins = new LinkedHashMap<>(maxCacheSize, 1, true) {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<UUID, SkinData> eldest) {
|
||||
return size() > maxCacheSize;
|
||||
@@ -64,38 +64,40 @@ public class PlayerSkinHandler extends PacketHandler {
|
||||
@Handler
|
||||
@SneakyThrows
|
||||
public void handle(PlayerSkinRequestPacket packet) {
|
||||
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));
|
||||
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));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,14 +107,17 @@ 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()));
|
||||
|
||||
Set<UUID> uuidSet = skins.keySet();
|
||||
VelocityCore.getProxy().getAllServers().forEach(server -> {
|
||||
for (UUID uuid : uuidSet) {
|
||||
NetworkSender.send(server, new PlayerSkinResponsePacket(uuid, 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()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public record SkinData(String skin, String signature) {}
|
||||
|
||||
@@ -190,17 +190,6 @@ 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",
|
||||
|
||||
Reference in New Issue
Block a user