Compare commits

...
15 changed files with 143 additions and 31 deletions
@@ -94,7 +94,7 @@ public class NMSWrapper21 implements NMSWrapper {
return false;
}
return drillDown(data.contents(), 0, 0) <= threshold;
return drillDown(data.contents(), 0, 0) > threshold;
}
private int drillDown(List<ItemStack> items, int layer, int start) {
@@ -158,7 +158,7 @@ public class Config {
EventKampf = null;
TeamBlueName = "Blau";
TeamRedName = "Rot";
TeamBlueColor = "§3";
TeamBlueColor = "§9";
TeamRedColor = "§c";
EventTeamBlueID = 0;
EventTeamRedID = 0;
@@ -20,6 +20,7 @@
package de.steamwar.schematicsystem.autocheck;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
@@ -96,6 +97,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
int counter = 0;
for(CompoundTag item : items){
System.out.println(item.getValue());
if(!item.containsKey("id")){
result.getDefunctNbt().add(pos);
continue;
@@ -112,6 +114,14 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
}
if (item.containsKey("tag")) {
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
} else if (item.containsKey("components")) {
if (item.getValue().get("components") instanceof CompoundTag) {
CompoundTag components = (CompoundTag) item.getValue().get("components");
if (components.getValue().size() > 1) {
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
} else if (components.getValue().size() == 1){
}
}
}
}
result.getDispenserItems().put(pos, counter);
@@ -76,7 +76,13 @@ public class AutoCheckerItems15 implements AutoCheckerItems {
Material.DIAMOND_HORSE_ARMOR,
Material.IRON_HORSE_ARMOR,
Material.GOLDEN_HORSE_ARMOR,
Material.HONEY_BOTTLE);
Material.LEATHER_HORSE_ARMOR,
Material.HONEY_BOTTLE,
Material.LILAC,
Material.ROSE_BUSH,
Material.PEONY,
Material.TALL_GRASS,
Material.LARGE_FERN);
@Override
public Set<Material> getInventoryMaterials() {
@@ -43,12 +43,19 @@ public class AutoCheckerItems19 extends AutoCheckerItems15 {
Material.LILY_OF_THE_VALLEY,
Material.WITHER_ROSE,
Material.SUNFLOWER,
Material.LILAC,
Material.ROSE_BUSH,
Material.PEONY,
Material.TALL_GRASS,
Material.LARGE_FERN,
Material.TORCHFLOWER,
// 16-stackable Items
Material.HONEY_BOTTLE,
// Non-stackable items
Material.DIAMOND_HORSE_ARMOR,
Material.IRON_HORSE_ARMOR,
Material.GOLDEN_HORSE_ARMOR,
Material.LEATHER_HORSE_ARMOR,
// Disks
Material.MUSIC_DISC_11,
Material.MUSIC_DISC_13,
@@ -507,6 +507,15 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
origin = min.subtract(offset);
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
} else if (metadataTag != null && metadataTag.containsKey("WorldEdit")){
CompoundTag weMeta = requireTag(metadataTag.getValue(), "WorldEdit", CompoundTag.class);
int[] off = requireTag(weMeta.getValue(), "Origin", IntArrayTag.class).getValue();
if (off.length != 3) {
throw new IOException("Invalid offset specified in schematic.");
}
origin = BlockVector3.at(off[0], off[1], off[2]);
region = new CuboidRegion(min.add(origin), min.add(origin).add(width, height, length).subtract(BlockVector3.ONE));
} else {
origin = min;
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
@@ -565,17 +574,17 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
for (Map<String, Tag> tileEntity : tileEntityTags) {
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]);
Map<String, Tag> values = Maps.newHashMap(tileEntity);
Map<String, Tag> values = Maps.newHashMap(v3Mode ? requireTag(tileEntity, "Data", CompoundTag.class).getValue() : tileEntity);
if(faweSchem){
values.put("x", new IntTag(pt.getBlockX() - offsetX));
values.put("y", new IntTag(pt.getBlockY() - offsetY));
values.put("z", new IntTag(pt.getBlockZ() - offsetZ));
}else{
values.put("x", new IntTag(pt.getBlockX()));
values.put("y", new IntTag(pt.getBlockY()));
values.put("z", new IntTag(pt.getBlockZ()));
values.putIfAbsent("x", new IntTag(pt.getBlockX()));
values.putIfAbsent("y", new IntTag(pt.getBlockY()));
values.putIfAbsent("z", new IntTag(pt.getBlockZ()));
}
values.put("id", values.get("Id"));
values.putIfAbsent("id", values.get("Id"));
values.remove("Id");
values.remove("Pos");
if (fixer != null) {
@@ -0,0 +1,34 @@
/*
* 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/>.
*/
package de.steamwar.entity;
import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket;
import net.minecraft.world.entity.PositionMoveRotation;
import net.minecraft.world.phys.Vec3;
import java.util.Collections;
public class PacketConstructor21 implements PacketConstructor{
@Override
public Object teleportPacket(int entityId, double x, double y, double z, float yaw, float pitch) {
PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, pitch, yaw);
return new ClientboundTeleportEntityPacket(entityId, rot, Collections.emptySet(), false);
}
}
@@ -0,0 +1,29 @@
/*
* 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/>.
*/
package de.steamwar.entity;
import de.steamwar.core.Core;
import de.steamwar.core.VersionDependent;
public interface PacketConstructor {
public static final PacketConstructor impl = VersionDependent.getVersionImpl(Core.getInstance());
Object teleportPacket(int entityId, double x, double y, double z, float yaw, float pitch);
}
@@ -21,6 +21,7 @@ package de.steamwar.entity;
import de.steamwar.Reflection;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.Core;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -59,7 +60,7 @@ public class RBlockDisplay extends RDisplay {
private static final Class<?> iBlockDataClass = Reflection.getClass("net.minecraft.world.level.block.state.BlockState");
private static final Reflection.Method getState = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.data.CraftBlockData"), "getState", iBlockDataClass);
private static final Object blockWatcher = BountifulWrapper.impl.getDataWatcherObject(22, iBlockDataClass);
private static final Object blockWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 23 : 22, iBlockDataClass);
private void getBlock(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || !block.getAsString(true).equals(DEFAULT_BLOCK.getAsString(true))) {
packetSink.accept(blockWatcher, getState.invoke(block));
@@ -20,6 +20,7 @@
package de.steamwar.entity;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.Core;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Color;
@@ -110,10 +111,10 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getTransformData);
}
private static final Object translationWatcher = BountifulWrapper.impl.getDataWatcherObject(10, Vector3f.class);
private static final Object leftRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(12, Quaternionf.class);
private static final Object scaleWatcher = BountifulWrapper.impl.getDataWatcherObject(11, Vector3f.class);
private static final Object rightRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(13, Quaternionf.class);
private static final Object translationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 11 : 10, Vector3f.class);
private static final Object leftRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 13 : 12, Quaternionf.class);
private static final Object scaleWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 12 : 11, Vector3f.class);
private static final Object rightRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 14 : 13, Quaternionf.class);
private void getTransformData(boolean ignoreDefault, BiConsumer<Object, Object> dataSink) {
if (ignoreDefault || !transform.equals(DEFAULT_TRANSFORM)) {
@@ -129,8 +130,8 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getInterpolationDuration);
}
private static final Object transformationInterpolationDurationWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
private static final Object positionOrRotationInterpolationDurationWatcher = BountifulWrapper.impl.getDataWatcherObject(9, Integer.class);
private static final Object transformationInterpolationDurationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 9 : 8, Integer.class);
private static final Object positionOrRotationInterpolationDurationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 10 : 9, Integer.class);
private void getInterpolationDuration(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || interpolationDelay != 0) {
@@ -144,7 +145,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getViewRange);
}
private static final Object viewRangeWatcher = BountifulWrapper.impl.getDataWatcherObject(16, Float.class);
private static final Object viewRangeWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 17 : 16, Float.class);
private void getViewRange(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || viewRange != 1.0F) {
@@ -157,7 +158,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getShadowRadius);
}
private static final Object shadowRadiusWatcher = BountifulWrapper.impl.getDataWatcherObject(17, Float.class);
private static final Object shadowRadiusWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 18 : 17, Float.class);
private void getShadowRadius(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || shadowRadius != 0.0F) {
@@ -170,7 +171,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getShadowStrength);
}
private static final Object shadowStrengthWatcher = BountifulWrapper.impl.getDataWatcherObject(18, Float.class);
private static final Object shadowStrengthWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 19 : 18, Float.class);
private void getShadowStrength(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || shadowStrength != 1.0F) {
@@ -183,7 +184,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getDisplayWidth);
}
private static final Object displayWidthWatcher = BountifulWrapper.impl.getDataWatcherObject(19, Float.class);
private static final Object displayWidthWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 20 : 19, Float.class);
private void getDisplayWidth(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || displayWidth != 0.0F) {
@@ -196,7 +197,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getDisplayHeight);
}
private static final Object displayHeightWatcher = BountifulWrapper.impl.getDataWatcherObject(20, Float.class);
private static final Object displayHeightWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 21 : 20, Float.class);
private void getDisplayHeight(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || displayHeight != 0.0F) {
@@ -209,7 +210,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getInterpolationDelay);
}
private static final Object interpolationDelayWatcher = BountifulWrapper.impl.getDataWatcherObject(7, Integer.class);
private static final Object interpolationDelayWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 8 : 7, Integer.class);
private void getInterpolationDelay(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || interpolationDelay != 0) {
@@ -222,7 +223,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getBillboard);
}
private static final Object billboardWatcher = BountifulWrapper.impl.getDataWatcherObject(14, Byte.class);
private static final Object billboardWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 15 : 14, Byte.class);
private void getBillboard(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || billboard != Display.Billboard.FIXED) {
@@ -235,7 +236,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getGlowColorOverride);
}
private static final Object glowColorOverrideWatcher = BountifulWrapper.impl.getDataWatcherObject(21, Integer.class);
private static final Object glowColorOverrideWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 22 : 21, Integer.class);
private void getGlowColorOverride(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || glowColorOverride != null) {
@@ -248,7 +249,7 @@ public abstract class RDisplay extends REntity {
sendPacket(updatePacketSink, this::getBrightness);
}
private static final Object brightnessWatcher = BountifulWrapper.impl.getDataWatcherObject(15, Integer.class);
private static final Object brightnessWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 16 : 15, Integer.class);
private void getBrightness(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || brightness != null) {
@@ -397,6 +397,10 @@ public class REntity {
public static final Reflection.Field<Integer> teleportEntity = Reflection.getField(teleportPacket, int.class, 0);
public static final BountifulWrapper.PositionSetter teleportPosition = BountifulWrapper.impl.getPositionSetter(teleportPacket, Core.getVersion() == 8 ? 1 : 0);
private Object getTeleportPacket(){
if (Core.getVersion() >= 21) {
return PacketConstructor.impl.teleportPacket(entityId, x, y, z, pitch, yaw);
}
Object packet = Reflection.newInstance(teleportPacket);
teleportEntity.set(packet, entityId);
teleportPosition.set(packet, x, y, z, pitch, yaw);
@@ -20,6 +20,7 @@
package de.steamwar.entity;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.Core;
import de.steamwar.core.ProtocolWrapper;
import lombok.Getter;
import org.bukkit.Location;
@@ -60,14 +61,14 @@ public class RItemDisplay extends RDisplay {
sendPacket(updatePacketSink, this::getItemStack);
}
private static final Object itemStackWatcher = BountifulWrapper.impl.getDataWatcherObject(22, ProtocolWrapper.itemStack);
private static final Object itemStackWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 23 : 22, ProtocolWrapper.itemStack);
private void getItemStack(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || !itemStack.equals(DEFAULT_ITEM_STACK)) {
packetSink.accept(itemStackWatcher, asNMSCopy.invoke(null, itemStack));
}
}
private static final Object itemDisplayTransformWatcher = BountifulWrapper.impl.getDataWatcherObject(23, Byte.class);
private static final Object itemDisplayTransformWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 24 : 23, Byte.class);
public void setItemDisplayTransform(ItemDisplay.ItemDisplayTransform itemDisplayTransform) {
this.itemDisplayTransform = itemDisplayTransform;
sendPacket(updatePacketSink, this::getItemDisplayTransform);
@@ -22,6 +22,7 @@ package de.steamwar.entity;
import de.steamwar.Reflection;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.ChatWrapper;
import de.steamwar.core.Core;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
@@ -74,7 +75,7 @@ public class RTextDisplay extends RDisplay {
}
private static final Class<?> iChatBaseComponent = Reflection.getClass("net.minecraft.network.chat.Component");
private static final Object textWatcher = BountifulWrapper.impl.getDataWatcherObject(22, iChatBaseComponent);
private static final Object textWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 23 : 22, iChatBaseComponent);
private void getText(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || !text.isEmpty()) {
packetSink.accept(textWatcher, ChatWrapper.impl.stringToChatComponent(text));
@@ -86,7 +87,7 @@ public class RTextDisplay extends RDisplay {
sendPacket(updatePacketSink, this::getLineWidth);
}
private static final Object lineWidthWatcher = BountifulWrapper.impl.getDataWatcherObject(23, Integer.class);
private static final Object lineWidthWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 24 : 23, Integer.class);
private void getLineWidth(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || lineWidth != 200) {
packetSink.accept(lineWidthWatcher, lineWidth);
@@ -98,7 +99,7 @@ public class RTextDisplay extends RDisplay {
sendPacket(updatePacketSink, this::getTextOpacity);
}
private static final Object textOpacityWatcher = BountifulWrapper.impl.getDataWatcherObject(25, Byte.class);
private static final Object textOpacityWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 26 : 25, Byte.class);
private void getTextOpacity(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
if (ignoreDefault || textOpacity != (byte) -1) {
packetSink.accept(textOpacityWatcher, textOpacity);
@@ -125,7 +126,7 @@ public class RTextDisplay extends RDisplay {
sendPacket(updatePacketSink, this::getTextStatus);
}
private static final Object textStatusWatcher = BountifulWrapper.impl.getDataWatcherObject(26, Byte.class);
private static final Object textStatusWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 27 : 26, Byte.class);
private void getTextStatus(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
byte status = 0;
@@ -63,7 +63,7 @@ data class TNTLeagueConfig(
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("PLAIN_STRING", "§${eventTeamBlue.teamColor}${eventTeamBlue.teamName}"), eventTeamBlue.teamColor[0])
redTeam = TeamConfig(TNTLeagueWorldConfig.redTeam, SubMessage("PLAIN_STRING", "§${eventTeamRed.teamColor}${eventTeamRed.teamName}"), eventTeamRed.teamColor[0])
} else {
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("BLUE"), '3')
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("BLUE"), '9')
redTeam = TeamConfig(TNTLeagueWorldConfig.redTeam, SubMessage("RED"), 'c')
}
}
@@ -23,6 +23,7 @@ import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.connection.PostLoginEvent;
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
import com.velocitypowered.api.event.player.KickedFromServerEvent;
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.permission.Tristate;
import com.velocitypowered.api.proxy.Player;
@@ -38,6 +39,7 @@ import de.steamwar.velocitycore.commands.*;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.util.DiscordRanks;
import de.steamwar.velocitycore.mods.ModUtils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import java.util.HashSet;
@@ -110,6 +112,13 @@ public class ConnectionListener extends BasicListener {
}
}
@Subscribe
public void kickEvent(KickedFromServerEvent event) {
if (event.getResult() instanceof KickedFromServerEvent.RedirectPlayer red) {
event.setResult(KickedFromServerEvent.RedirectPlayer.create(red.getServer(), Component.empty()));
}
}
@Subscribe
public void onDisconnect(DisconnectEvent e){
ChallengeCommand.remove(e.getPlayer());