Dieser Commit ist enthalten in:
Ursprung
fe317bec1e
Commit
305664e9ea
@ -32,6 +32,7 @@ import de.steamwar.bausystem.entities.WarpEntity15;
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
@ -91,6 +92,17 @@ public class NMSWrapper15 implements NMSWrapper.INMSWrapper {
|
||||
gameStateChangeReason.set(packet, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerBuildAbilities(Player player) {
|
||||
((CraftPlayer) player).getHandle().abilities.mayBuild = true;
|
||||
((CraftPlayer) player).getHandle().abilities.canInstantlyBuild = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle tntPositionParticle() {
|
||||
return Particle.BARRIER;
|
||||
}
|
||||
|
||||
private static final int threshold = 2048;
|
||||
@Override
|
||||
public boolean checkItemStack(ItemStack item) {
|
||||
|
@ -44,6 +44,7 @@ import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
|
||||
@ -103,6 +104,17 @@ public class NMSWrapper18 implements NMSWrapper.INMSWrapper {
|
||||
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerBuildAbilities(Player player) {
|
||||
((CraftPlayer) player).getHandle().fr().d = true;
|
||||
((CraftPlayer) player).getHandle().fr().e = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle tntPositionParticle() {
|
||||
return Particle.BLOCK_MARKER;
|
||||
}
|
||||
|
||||
private static final int threshold = 2048;
|
||||
@Override
|
||||
public boolean checkItemStack(ItemStack item) {
|
||||
|
@ -56,7 +56,10 @@ dependencies {
|
||||
annotationProcessor 'org.atteo.classindex:classindex:3.11'
|
||||
testAnnotationProcessor 'org.atteo.classindex:classindex:3.11'
|
||||
|
||||
compileOnly files("${projectDir}/../lib/Spigot-1.15.jar")
|
||||
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
||||
compileOnly files("${projectDir}/../lib/Spigot-1.18.jar")
|
||||
compileOnly 'com.mojang:authlib:1.5.25'
|
||||
compileOnly 'io.netty:netty-all:4.1.68.Final'
|
||||
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
|
||||
compileOnly files("${projectDir}/../lib/SpigotCore.jar")
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -29,7 +30,6 @@ import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Observer;
|
||||
import org.bukkit.block.data.type.*;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.impl.CraftPoweredRail;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
@ -170,6 +170,7 @@ public class ObserverTracer {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Class<?> craftPoweredRail = Reflection.getClass("{obc}.block.impl.CraftPoweredRail");
|
||||
private boolean checkAllowed(Block block, BlockData blockData) {
|
||||
if (checkMaterial(block)) return true;
|
||||
if (block.getType() == Material.BELL) {
|
||||
@ -178,7 +179,7 @@ public class ObserverTracer {
|
||||
|
||||
return blockData instanceof Door
|
||||
|| blockData instanceof Gate
|
||||
|| blockData instanceof CraftPoweredRail
|
||||
|| craftPoweredRail.isInstance(blockData)
|
||||
|| blockData instanceof TrapDoor
|
||||
|| blockData instanceof GlassPane;
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.core.Core;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -106,8 +105,7 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
} else {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
((CraftPlayer) player).getHandle().abilities.mayBuild = true;
|
||||
((CraftPlayer) player).getHandle().abilities.canInstantlyBuild = true;
|
||||
NMSWrapper.impl.setPlayerBuildAbilities(player);
|
||||
|
||||
Object gameStateChangeObject = Reflection.newInstance(gameStateChange);
|
||||
NMSWrapper.impl.setGameStateChangeReason(gameStateChangeObject);
|
||||
|
@ -86,7 +86,7 @@ public class BlockBoundingBox {
|
||||
addPixel(Material.AIR.createBlockData(), 0, 0, 0, 0, 0, 0, null);
|
||||
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
|
||||
|
||||
addPixel(Material.GRASS_PATH.createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", Material.GRASS_PATH));
|
||||
addPixel(SWItem.getMaterial("GRASS_PATH").createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", SWItem.getMaterial("GRASS_PATH")));
|
||||
addPixel(Material.SOUL_SAND.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
|
||||
|
||||
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
||||
|
@ -24,9 +24,11 @@ import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||
import de.steamwar.bausystem.linkage.Enable;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.core.Core;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.type.Fence;
|
||||
import org.bukkit.block.data.type.Wall;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -39,6 +41,50 @@ public class WallBoundingBox implements Enable {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
if (Core.getVersion() > 15) {
|
||||
v18();
|
||||
} else {
|
||||
v15();
|
||||
}
|
||||
}
|
||||
|
||||
private void v18() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
for (int pz = 0; pz < 2; pz++) {
|
||||
Wall fence = (Wall) Material.END_STONE_BRICK_WALL.createBlockData();
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<Cuboid> cuboidList = new ArrayList<>();
|
||||
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
||||
if (nz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_NORTH");
|
||||
fence.setHeight(BlockFace.NORTH, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
||||
}
|
||||
if (pz == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_SOUTH");
|
||||
fence.setHeight(BlockFace.SOUTH, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
||||
}
|
||||
if (nx == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_WEST");
|
||||
fence.setHeight(BlockFace.WEST, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
||||
}
|
||||
if (px == 1) {
|
||||
lore.add("LAUFBAU_CONNECTION_EAST");
|
||||
fence.setHeight(BlockFace.EAST, Wall.Height.LOW);
|
||||
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
||||
}
|
||||
new BlockBoundingBox(fence, cuboidList, createItem("LAUFBAU_BLOCK_END_STONE_BRICK_WALL", Material.END_STONE_BRICK_WALL, lore.toArray(new String[0])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void v15() {
|
||||
for (int nx = 0; nx < 2; nx++) {
|
||||
for (int nz = 0; nz < 2; nz++) {
|
||||
for (int px = 0; px < 2; px++) {
|
||||
|
@ -19,12 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.tpslimit;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import yapion.utils.ReflectionsUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -35,13 +34,16 @@ public class FreezeUtils {
|
||||
private static final Field field;
|
||||
public static final boolean freezeEnabled;
|
||||
|
||||
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", null);
|
||||
|
||||
@Getter
|
||||
private static boolean frozen = false;
|
||||
|
||||
private static final World world;
|
||||
|
||||
static {
|
||||
field = ReflectionsUtils.getField(WorldServer.class, "freezed");
|
||||
|
||||
field = ReflectionsUtils.getField(Reflection.getClass("{nms.server.level}.WorldServer"), "freezed");
|
||||
if (field != null) field.setAccessible(true);
|
||||
freezeEnabled = field != null;
|
||||
world = Bukkit.getWorlds().get(0);
|
||||
@ -62,7 +64,7 @@ public class FreezeUtils {
|
||||
private void setFreeze(World world, boolean state) {
|
||||
if (freezeEnabled) {
|
||||
try {
|
||||
field.set(((CraftWorld) world).getHandle(), state);
|
||||
field.set(getWorldHandle.invoke(world), state);
|
||||
frozen = state;
|
||||
} catch (IllegalAccessException e) {
|
||||
// Ignored;
|
||||
|
@ -23,8 +23,8 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tracer.TNTPosition;
|
||||
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
|
||||
import de.steamwar.bausystem.shared.ShowMode;
|
||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -57,7 +57,7 @@ public class ParticleShowMode implements ShowMode<TNTPosition> {
|
||||
positionSet.add(position.getLocation());
|
||||
if (bukkitTask == null) {
|
||||
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
positionSet.forEach(p -> player.spawnParticle(Particle.BARRIER, p.toLocation(player.getWorld()), 1, 0, 0, 0, 0));
|
||||
positionSet.forEach(p -> player.spawnParticle(NMSWrapper.impl.tntPositionParticle(), p.toLocation(player.getWorld()), 1, 0, 0, 0, 0));
|
||||
}, 40L, 40L);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
public class SignEdit implements Listener {
|
||||
|
||||
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
|
||||
private static final Class<?> craftBlock = Reflection.getClass("{obc}.CraftBlock");
|
||||
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlock");
|
||||
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld");
|
||||
private static final Class<?> generatorAccess = Reflection.getClass("{nms.world.level}.GeneratorAccess");
|
||||
private static final Reflection.MethodInvoker getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
|
||||
|
@ -26,6 +26,7 @@ import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
|
||||
import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -46,6 +47,9 @@ public class NMSWrapper {
|
||||
void sendTickPackets();
|
||||
|
||||
void setGameStateChangeReason(Object packet);
|
||||
void setPlayerBuildAbilities(Player player);
|
||||
|
||||
Particle tntPositionParticle();
|
||||
|
||||
boolean checkItemStack(ItemStack item);
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren