Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
763ac8deb2
Commit
bba42ec3a4
63
BauSystem_19/build.gradle
Normale Datei
63
BauSystem_19/build.gradle
Normale Datei
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'base'
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group 'steamwar'
|
||||||
|
version '1.0'
|
||||||
|
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
sourceCompatibility = 1.8
|
||||||
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDirs = ['src/']
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDirs = ['src/']
|
||||||
|
exclude '**/*.java', '**/*.kt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.18.22'
|
||||||
|
testCompileOnly 'org.projectlombok:lombok:1.18.22'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
|
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
|
|
||||||
|
implementation project(":BauSystem_Main")
|
||||||
|
|
||||||
|
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
|
||||||
|
compileOnly files("${projectDir}/../lib/Spigot-1.19.jar")
|
||||||
|
compileOnly 'it.unimi.dsi:fastutil:8.5.6'
|
||||||
|
compileOnly 'com.mojang:datafixerupper:4.0.26'
|
||||||
|
compileOnly 'io.netty:netty-all:4.1.68.Final'
|
||||||
|
compileOnly 'com.mojang:authlib:1.5.25'
|
||||||
|
compileOnly 'com.mojang:brigadier:1.0.18'
|
||||||
|
|
||||||
|
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
|
||||||
|
compileOnly files("${projectDir}/../lib/SpigotCore.jar")
|
||||||
|
}
|
20
BauSystem_19/settings.gradle
Normale Datei
20
BauSystem_19/settings.gradle
Normale Datei
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rootProject.name = 'BauSystem_18'
|
121
BauSystem_19/src/de/steamwar/bausystem/entities/DetonatorEntity19.java
Normale Datei
121
BauSystem_19/src/de/steamwar/bausystem/entities/DetonatorEntity19.java
Normale Datei
@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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.entities;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.detonator.AbstractDetonatorEntity;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||||
|
import net.minecraft.server.network.PlayerConnection;
|
||||||
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
|
import net.minecraft.world.entity.item.EntityFallingBlock;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class DetonatorEntity19 extends EntityFallingBlock implements AbstractDetonatorEntity {
|
||||||
|
|
||||||
|
private static final Field ao;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
ao = EntityFallingBlock.class.getDeclaredField("ao");
|
||||||
|
ao.setAccessible(true);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
|
private final Vector position;
|
||||||
|
private int references = 0;
|
||||||
|
|
||||||
|
public DetonatorEntity19(World world, Vector position) {
|
||||||
|
super(EntityTypes.E, ((CraftWorld) world).getHandle());
|
||||||
|
try {
|
||||||
|
ao.set(this, Blocks.dG.m());
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
this.q = true;
|
||||||
|
e(position.getX(), position.getY(), position.getZ());
|
||||||
|
f(Vec3D.b);
|
||||||
|
t = position.getX();
|
||||||
|
u = position.getY();
|
||||||
|
v = position.getZ();
|
||||||
|
a(this.db());
|
||||||
|
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
this.h(true);
|
||||||
|
this.e(true);
|
||||||
|
this.S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ae();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Player player) {
|
||||||
|
if (references++ > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), cp(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.C, Block.i(Blocks.du.m()), ZERO, 0.0);
|
||||||
|
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
|
||||||
|
playerConnection.a(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), Y, true);
|
||||||
|
playerConnection.a(packetPlayOutEntityMetadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hide(Player player, boolean force) {
|
||||||
|
if (!force && --references > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
sendDestroy(player);
|
||||||
|
ag();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendDestroy(Player player) {
|
||||||
|
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
|
||||||
|
((CraftPlayer) player).getHandle().b.a(packetPlayOutEntityDestroy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEntity(Player player) {
|
||||||
|
display(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEntityDestroy(Player player) {
|
||||||
|
hide(player, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
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.entities;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
|
||||||
|
import de.steamwar.bausystem.shared.BaseEntity19;
|
||||||
|
import de.steamwar.bausystem.shared.ReferenceCounter;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class SimulatorEntity19 extends BaseEntity19 implements AbstractSimulatorEntity {
|
||||||
|
|
||||||
|
private ReferenceCounter referenceCounter = new ReferenceCounter();
|
||||||
|
|
||||||
|
public SimulatorEntity19(World world, Vector position, boolean highlight) {
|
||||||
|
super(world, position, highlight ? Material.WHITE_STAINED_GLASS : Material.TNT);
|
||||||
|
|
||||||
|
this.e(true);
|
||||||
|
this.S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ae();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Player player) {
|
||||||
|
if (referenceCounter.increment() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendEntity(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition(Vector position) {
|
||||||
|
this.position = position;
|
||||||
|
e(position.getX(), position.getY(), position.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hide(Player player, boolean force) {
|
||||||
|
if (!force && referenceCounter.decrement() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendEntityDestroy(player);
|
||||||
|
ag();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
74
BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java
Normale Datei
74
BauSystem_19/src/de/steamwar/bausystem/entities/TraceEntity19.java
Normale Datei
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
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.entities;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
|
||||||
|
import de.steamwar.bausystem.shared.BaseEntity19;
|
||||||
|
import de.steamwar.bausystem.shared.ReferenceCounter;
|
||||||
|
import net.minecraft.network.chat.IChatMutableComponent;
|
||||||
|
import net.minecraft.network.chat.contents.LiteralContents;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class TraceEntity19 extends BaseEntity19 implements AbstractTraceEntity {
|
||||||
|
|
||||||
|
private boolean exploded = false;
|
||||||
|
private ReferenceCounter referenceCounter = new ReferenceCounter();
|
||||||
|
|
||||||
|
public TraceEntity19(World world, Vector position, boolean tnt) {
|
||||||
|
super(world, position, tnt ? Material.TNT : Material.WHITE_STAINED_GLASS);
|
||||||
|
|
||||||
|
this.e(true);
|
||||||
|
this.S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Player player, boolean exploded, int ticks) {
|
||||||
|
if (ticks != -1) {
|
||||||
|
this.n(true);
|
||||||
|
this.a(IChatMutableComponent.a(new LiteralContents(ticks + "")));
|
||||||
|
}
|
||||||
|
if (!this.exploded && exploded) {
|
||||||
|
this.n(true);
|
||||||
|
this.a(IChatMutableComponent.a(new LiteralContents("Bumm")));
|
||||||
|
this.exploded = true;
|
||||||
|
if (referenceCounter.increment() > 0) {
|
||||||
|
sendEntityDestroy(player);
|
||||||
|
}
|
||||||
|
} else if (referenceCounter.increment() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendEntity(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hide(Player player, boolean force) {
|
||||||
|
if (!force && referenceCounter.decrement() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendEntityDestroy(player);
|
||||||
|
ag();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
61
BauSystem_19/src/de/steamwar/bausystem/entities/WarpEntity19.java
Normale Datei
61
BauSystem_19/src/de/steamwar/bausystem/entities/WarpEntity19.java
Normale Datei
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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.entities;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
|
||||||
|
import de.steamwar.bausystem.shared.BaseArmorStand19;
|
||||||
|
import net.minecraft.network.chat.IChatMutableComponent;
|
||||||
|
import net.minecraft.network.chat.contents.LiteralContents;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class WarpEntity19 extends BaseArmorStand19 implements AbstractWarpEntity {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public WarpEntity19(World world, Vector position, String name) {
|
||||||
|
super(world, position);
|
||||||
|
this.j(true);
|
||||||
|
this.a(true);
|
||||||
|
this.name = name;
|
||||||
|
this.e(true);
|
||||||
|
this.S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Player player) {
|
||||||
|
this.n(true);
|
||||||
|
this.a(IChatMutableComponent.a(new LiteralContents(name)));
|
||||||
|
sendEntity(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hide(Player player) {
|
||||||
|
sendEntityDestroy(player);
|
||||||
|
ag();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
62
BauSystem_19/src/de/steamwar/bausystem/shared/BaseArmorStand19.java
Normale Datei
62
BauSystem_19/src/de/steamwar/bausystem/shared/BaseArmorStand19.java
Normale Datei
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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.shared;
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||||
|
import net.minecraft.server.network.PlayerConnection;
|
||||||
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
|
import net.minecraft.world.entity.decoration.EntityArmorStand;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class BaseArmorStand19 extends EntityArmorStand implements AbstractEntity {
|
||||||
|
|
||||||
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
|
|
||||||
|
protected Vector position;
|
||||||
|
|
||||||
|
public BaseArmorStand19(World world, Vector position) {
|
||||||
|
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ());
|
||||||
|
|
||||||
|
this.position = position;
|
||||||
|
e(true);
|
||||||
|
S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEntity(Player player) {
|
||||||
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(ae(), cp(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.c, 0, ZERO, 0.0);
|
||||||
|
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
|
||||||
|
playerConnection.a(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(ae(), Y, true);
|
||||||
|
playerConnection.a(packetPlayOutEntityMetadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEntityDestroy(Player player) {
|
||||||
|
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(ae());
|
||||||
|
((CraftPlayer) player).getHandle().b.a(packetPlayOutEntityDestroy);
|
||||||
|
}
|
||||||
|
}
|
94
BauSystem_19/src/de/steamwar/bausystem/shared/BaseEntity19.java
Normale Datei
94
BauSystem_19/src/de/steamwar/bausystem/shared/BaseEntity19.java
Normale Datei
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021 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.shared;
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||||
|
import net.minecraft.server.network.PlayerConnection;
|
||||||
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
|
import net.minecraft.world.entity.item.EntityFallingBlock;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class BaseEntity19 extends EntityFallingBlock implements AbstractEntity {
|
||||||
|
|
||||||
|
private static final Field ao;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
ao = EntityFallingBlock.class.getDeclaredField("ao");
|
||||||
|
ao.setAccessible(true);
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
|
|
||||||
|
private final IBlockData iBlockData;
|
||||||
|
protected Vector position;
|
||||||
|
|
||||||
|
public BaseEntity19(World world, Vector position, Material blockType) {
|
||||||
|
super(EntityTypes.E, ((CraftWorld) world).getHandle());
|
||||||
|
try {
|
||||||
|
ao.set(this, ((CraftBlockData) blockType.createBlockData()).getState());
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
this.q = true;
|
||||||
|
e(position.getX(), position.getY(), position.getZ());
|
||||||
|
f(Vec3D.b);
|
||||||
|
t = position.getX();
|
||||||
|
u = position.getY();
|
||||||
|
v = position.getZ();
|
||||||
|
a(this.db());
|
||||||
|
|
||||||
|
this.iBlockData = ((CraftBlockData) blockType.createBlockData()).getState();
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
this.e(true);
|
||||||
|
this.S = -12000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEntity(Player player) {
|
||||||
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(ae(), cp(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.C, Block.i(iBlockData), ZERO, 0.0);
|
||||||
|
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
|
||||||
|
playerConnection.a(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(ae(), Y, true);
|
||||||
|
playerConnection.a(packetPlayOutEntityMetadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEntityDestroy(Player player) {
|
||||||
|
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(ae());
|
||||||
|
((CraftPlayer) player).getHandle().b.a(packetPlayOutEntityDestroy);
|
||||||
|
}
|
||||||
|
}
|
177
BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java
Normale Datei
177
BauSystem_19/src/de/steamwar/bausystem/utils/NMSWrapper19.java
Normale Datei
@ -0,0 +1,177 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 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.utils;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import de.steamwar.bausystem.entities.DetonatorEntity19;
|
||||||
|
import de.steamwar.bausystem.entities.SimulatorEntity19;
|
||||||
|
import de.steamwar.bausystem.entities.TraceEntity19;
|
||||||
|
import de.steamwar.bausystem.entities.WarpEntity19;
|
||||||
|
import de.steamwar.bausystem.features.detonator.AbstractDetonatorEntity;
|
||||||
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
|
import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
|
||||||
|
import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
|
||||||
|
import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
|
||||||
|
import net.minecraft.SystemUtils;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityVelocity;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange;
|
||||||
|
import net.minecraft.server.level.PlayerInteractManager;
|
||||||
|
import net.minecraft.world.level.EnumGamemode;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.LongSupplier;
|
||||||
|
|
||||||
|
public class NMSWrapper19 implements NMSWrapper.INMSWrapper {
|
||||||
|
|
||||||
|
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void setInternalGameMode(Player player, GameMode gameMode) {
|
||||||
|
playerGameMode.set(((CraftPlayer) player).getHandle().d, EnumGamemode.a(gameMode.getValue()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(LongSupplier longSupplier) {
|
||||||
|
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final List<Packet<?>> packets = new ArrayList<>();
|
||||||
|
private static final Vec3D noMotion = new Vec3D(0, 0, 0);
|
||||||
|
@Override
|
||||||
|
public void createTickCache(World world) {
|
||||||
|
packets.clear();
|
||||||
|
world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
|
||||||
|
packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
|
||||||
|
packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
|
||||||
|
|
||||||
|
if (entity instanceof TNTPrimed) {
|
||||||
|
net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
packets.add(new PacketPlayOutEntityMetadata(serverEntity.ae(), serverEntity.ai(), true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTickPackets() {
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
|
for (Packet<?> p : packets) {
|
||||||
|
TinyProtocol.instance.sendPacket(player, p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
@Override
|
||||||
|
public void setGameStateChangeReason(Object packet) {
|
||||||
|
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayerBuildAbilities(Player player) {
|
||||||
|
((CraftPlayer) player).getHandle().fC().d = true;
|
||||||
|
((CraftPlayer) player).getHandle().fC().e = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Particle tntPositionParticle() {
|
||||||
|
return Particle.BLOCK_MARKER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material pathMaterial() {
|
||||||
|
return Material.DIRT_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int threshold = 2048;
|
||||||
|
@Override
|
||||||
|
public boolean checkItemStack(ItemStack item) {
|
||||||
|
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||||
|
NBTTagCompound tag = nmsItem.v();
|
||||||
|
if (tag != null && tag.e("BlockEntityTag")) {
|
||||||
|
NBTTagCompound blockTag = tag.p("BlockEntityTag");
|
||||||
|
if (blockTag.e("Items")) {
|
||||||
|
return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int drillDown(NBTTagList items, int layer, int start) {
|
||||||
|
if (layer > 2) return start + threshold;
|
||||||
|
int invalid = start;
|
||||||
|
for (NBTBase nbtBase : items) {
|
||||||
|
if (!(nbtBase instanceof NBTTagCompound))
|
||||||
|
continue;
|
||||||
|
NBTTagCompound slot = (NBTTagCompound) nbtBase;
|
||||||
|
if (slot.e("tag")) {
|
||||||
|
invalid += slot.f("Count");
|
||||||
|
NBTTagCompound iTag = slot.p("tag");
|
||||||
|
if (iTag.e("BlockEntityTag")) {
|
||||||
|
NBTTagCompound blockTag = iTag.p("BlockEntityTag");
|
||||||
|
if (blockTag.e("Items")) {
|
||||||
|
invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (invalid > threshold)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractWarpEntity createWarp(World world, Vector position, String name) {
|
||||||
|
return new WarpEntity19(world, position, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractSimulatorEntity createSimulator(World world, Vector tntPosition, boolean highlight) {
|
||||||
|
return new SimulatorEntity19(world, tntPosition, highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractDetonatorEntity constructDetonator(World world, Vector position) {
|
||||||
|
return new DetonatorEntity19(world, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractTraceEntity createTrace(World world, Vector tntPosition, boolean tnt) {
|
||||||
|
return new TraceEntity19(world, tntPosition, tnt);
|
||||||
|
}
|
||||||
|
}
|
@ -56,8 +56,10 @@ dependencies {
|
|||||||
annotationProcessor 'org.atteo.classindex:classindex:3.11'
|
annotationProcessor 'org.atteo.classindex:classindex:3.11'
|
||||||
testAnnotationProcessor 'org.atteo.classindex:classindex:3.11'
|
testAnnotationProcessor 'org.atteo.classindex:classindex:3.11'
|
||||||
|
|
||||||
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
// compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
||||||
compileOnly files("${projectDir}/../lib/Spigot-1.18.jar")
|
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
|
||||||
|
// compileOnly files("${projectDir}/../lib/Spigot-1.18.jar")
|
||||||
|
compileOnly files("${projectDir}/../lib/Spigot-1.19.jar")
|
||||||
compileOnly 'com.mojang:authlib:1.5.25'
|
compileOnly 'com.mojang:authlib:1.5.25'
|
||||||
compileOnly 'io.netty:netty-all:4.1.68.Final'
|
compileOnly 'io.netty:netty-all:4.1.68.Final'
|
||||||
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
|
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
|
||||||
|
@ -21,4 +21,5 @@ rootProject.name = 'BauSystem2.0'
|
|||||||
|
|
||||||
include 'BauSystem_15'
|
include 'BauSystem_15'
|
||||||
include 'BauSystem_18'
|
include 'BauSystem_18'
|
||||||
|
include 'BauSystem_19'
|
||||||
include 'BauSystem_Main'
|
include 'BauSystem_Main'
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren