forked from SteamWar/SteamWar
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50c24e68d0 | ||
|
|
d0414c71f3 | ||
|
|
3530aec5e2 | ||
|
|
3ae9a41b31 | ||
|
|
b8b38cf777 | ||
|
|
c1eca74dd0 | ||
|
|
8c23bf5bd4 | ||
|
|
556c8f7db1 |
@@ -94,7 +94,7 @@ public class NMSWrapper21 implements NMSWrapper {
|
|||||||
return false;
|
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) {
|
private int drillDown(List<ItemStack> items, int layer, int start) {
|
||||||
|
|||||||
-16
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
||||||
import de.steamwar.bausystem.features.simulator.preview.SimulatorPreviewCalculator;
|
|
||||||
import de.steamwar.command.PreviousArguments;
|
import de.steamwar.command.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
@@ -31,7 +30,6 @@ import de.steamwar.command.TypeValidator;
|
|||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.linkage.MinVersion;
|
import de.steamwar.linkage.MinVersion;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -92,20 +90,6 @@ public class SimulatorCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "test")
|
|
||||||
public void test(Player player) {
|
|
||||||
for (int i = 0; i < 1; i++) {
|
|
||||||
SimulatorPreviewCalculator data = new SimulatorPreviewCalculator(null);
|
|
||||||
data.spawnTNT(0, 166, 0);
|
|
||||||
data.calculate(simulatorPreviewResult -> {
|
|
||||||
simulatorPreviewResult.show(player);
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
simulatorPreviewResult.hide(player);
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ClassMapper(value = Simulator.class, local = true)
|
@ClassMapper(value = Simulator.class, local = true)
|
||||||
public TypeMapper<Simulator> allSimulators() {
|
public TypeMapper<Simulator> allSimulators() {
|
||||||
return new TypeMapper<>() {
|
return new TypeMapper<>() {
|
||||||
|
|||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
public class SimulatorPreview {
|
|
||||||
}
|
|
||||||
-76
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
|
||||||
public class SimulatorPreviewAABB {
|
|
||||||
public double minX;
|
|
||||||
public double minY;
|
|
||||||
public double minZ;
|
|
||||||
public double maxX;
|
|
||||||
public double maxY;
|
|
||||||
public double maxZ;
|
|
||||||
|
|
||||||
public SimulatorPreviewAABB copy() {
|
|
||||||
return new SimulatorPreviewAABB(minX, minY, minZ, maxX, maxY, maxZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expandTowards(double vx, double vy, double vz) {
|
|
||||||
if (vx < 0) {
|
|
||||||
minX += vx;
|
|
||||||
} else {
|
|
||||||
maxX += vx;
|
|
||||||
}
|
|
||||||
if (vy < 0) {
|
|
||||||
minY += vy;
|
|
||||||
} else {
|
|
||||||
maxY += vy;
|
|
||||||
}
|
|
||||||
if (vz < 0) {
|
|
||||||
minZ += vz;
|
|
||||||
} else {
|
|
||||||
maxZ += vz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(double vx, double vy, double vz) {
|
|
||||||
minX += vx;
|
|
||||||
minY += vy;
|
|
||||||
minZ += vz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean intersects(double x, double y, double z, BoundingBox boundingBox) {
|
|
||||||
return minX - (x + boundingBox.getMaxX()) < -1.0E-7 &&
|
|
||||||
maxX - (x + boundingBox.getMinX()) > 1.0E-7 &&
|
|
||||||
minY - (y + boundingBox.getMaxY()) < -1.0E-7 &&
|
|
||||||
maxY - (y + boundingBox.getMinY()) > 1.0E-7 &&
|
|
||||||
minZ - (z + boundingBox.getMaxZ()) < -1.0E-7 &&
|
|
||||||
maxZ - (z + boundingBox.getMinZ()) > 1.0E-7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-114
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.util.Consumer;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SimulatorPreviewCalculator {
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
|
||||||
|
|
||||||
public final Simulator simulator;
|
|
||||||
public final List<SimulatorPreviewTNT> tnts = new ArrayList<>();
|
|
||||||
|
|
||||||
private int ticks = 0;
|
|
||||||
private final Set<SimulatorPreviewPos> air = new HashSet<>();
|
|
||||||
private final Map<SimulatorPreviewPos, BlockData> datas = new HashMap<>();
|
|
||||||
private final Map<SimulatorPreviewPos, VoxelShape> shapes = new HashMap<>();
|
|
||||||
|
|
||||||
public BlockData getBlockData(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
if (air.contains(pos)) return null;
|
|
||||||
return datas.computeIfAbsent(pos, __ -> {
|
|
||||||
BlockData blockData = WORLD.getBlockData(x, y, z);
|
|
||||||
if (blockData.getMaterial().isAir()) {
|
|
||||||
air.add(pos);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return blockData;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoxelShape getBlockShape(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
if (air.contains(pos)) return null;
|
|
||||||
return shapes.computeIfAbsent(pos, __ -> {
|
|
||||||
Block block = WORLD.getBlockAt(x, y, z);
|
|
||||||
if (block.getType().isAir()) {
|
|
||||||
air.add(pos);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return block.getCollisionShape();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAir(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
air.add(pos);
|
|
||||||
datas.remove(pos);
|
|
||||||
shapes.remove(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void spawnTNT(double x, double y, double z) {
|
|
||||||
tnts.add(new SimulatorPreviewTNT(this, x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void calculate(Consumer<SimulatorPreviewResult> result) {
|
|
||||||
List<TNTPoint> tntPoints = new ArrayList<>();
|
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
while (!tnts.isEmpty()) {
|
|
||||||
if (System.currentTimeMillis() - time > 40) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tick(tntPoints);
|
|
||||||
}
|
|
||||||
bukkitTask.cancel();
|
|
||||||
System.out.println(tntPoints);
|
|
||||||
result.accept(new SimulatorPreviewResult(new Trace(null, tntPoints), air));
|
|
||||||
}, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tick(List<TNTPoint> tntPoints) {
|
|
||||||
System.out.println("TICK");
|
|
||||||
tnts.removeIf(simulatorPreviewTNT -> {
|
|
||||||
tntPoints.add(new TNTPoint(0, false, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
|
|
||||||
simulatorPreviewTNT.tick();
|
|
||||||
if (!simulatorPreviewTNT.removed) return false;
|
|
||||||
tntPoints.add(new TNTPoint(0, true, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
final class SimulatorPreviewPos {
|
|
||||||
public final int x;
|
|
||||||
public final int y;
|
|
||||||
public final int z;
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.rendering.BundleFilter;
|
|
||||||
import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public class SimulatorPreviewResult {
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
|
||||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
|
||||||
|
|
||||||
private final Trace trace;
|
|
||||||
private final Set<SimulatorPreviewPos> air;
|
|
||||||
|
|
||||||
public SimulatorPreviewResult(Trace trace, Set<SimulatorPreviewPos> air) {
|
|
||||||
this.trace = trace;
|
|
||||||
this.air = air;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(Player player) {
|
|
||||||
trace.render(player, new PlayerTraceShowData(BundleFilter.DEFAULT));
|
|
||||||
air.forEach(simulatorPreviewPos -> {
|
|
||||||
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), AIR);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hide(Player player) {
|
|
||||||
trace.hide(player);
|
|
||||||
air.forEach(simulatorPreviewPos -> {
|
|
||||||
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), WORLD.getBlockData(simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-228
@@ -1,228 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import org.bukkit.Axis;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SimulatorPreviewTNT {
|
|
||||||
|
|
||||||
private static final double size = 0.98;
|
|
||||||
private static final Random random = new Random();
|
|
||||||
|
|
||||||
private final SimulatorPreviewCalculator data;
|
|
||||||
private boolean gravity = true;
|
|
||||||
int fuse = 80;
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
double z;
|
|
||||||
double vx;
|
|
||||||
double vy;
|
|
||||||
double vz;
|
|
||||||
|
|
||||||
private SimulatorPreviewVec collide = new SimulatorPreviewVec();
|
|
||||||
private boolean onGround;
|
|
||||||
boolean removed = false;
|
|
||||||
|
|
||||||
public SimulatorPreviewTNT(SimulatorPreviewCalculator data, double x, double y, double z) {
|
|
||||||
this.data = data;
|
|
||||||
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
|
|
||||||
double d = random.nextDouble() * Math.PI * 2;
|
|
||||||
this.vx = -Math.sin(d) * 0.02;
|
|
||||||
this.vy = 0.2;
|
|
||||||
this.vz = -Math.cos(d) * 0.02;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tick() {
|
|
||||||
System.out.println(x + " " + y + " " + z);
|
|
||||||
// TODO: Issue in movement still!
|
|
||||||
// System.out.println(x + " " + y + " " + z);
|
|
||||||
// Gravity
|
|
||||||
if (gravity) {
|
|
||||||
vy -= 0.04;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Movement
|
|
||||||
move();
|
|
||||||
|
|
||||||
// TODO: EffectsFromOtherBlocks
|
|
||||||
|
|
||||||
// Velocity * 0.98
|
|
||||||
vx *= 0.98;
|
|
||||||
vy *= 0.98;
|
|
||||||
vz *= 0.98;
|
|
||||||
|
|
||||||
// OnGround Velocity * 0.7 -0.5 0.7
|
|
||||||
if (onGround) {
|
|
||||||
vx *= 0.7;
|
|
||||||
vy *= -0.5;
|
|
||||||
vz *= 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decrease Fuse
|
|
||||||
fuse--;
|
|
||||||
if (fuse <= 0) {
|
|
||||||
// Explode on zero Fuse
|
|
||||||
explode();
|
|
||||||
} else {
|
|
||||||
// TODO: or do water Movement!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void move() {
|
|
||||||
collide();
|
|
||||||
double collisionLengthSquared = collide.lengthSquared();
|
|
||||||
if (collisionLengthSquared > 1.0E-7 || new Vector(vx, vy, vz).lengthSquared() - collisionLengthSquared < 1.0E-7) {
|
|
||||||
x += collide.x;
|
|
||||||
y += collide.y;
|
|
||||||
z += collide.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean xCollision = !equal(vx, collide.x);
|
|
||||||
boolean zCollision = !equal(vz, collide.z);
|
|
||||||
boolean horizontalCollision = xCollision || zCollision;
|
|
||||||
if (Math.abs(vy) > 0.0F) {
|
|
||||||
boolean verticalCollision = vy != collide.y;
|
|
||||||
onGround = verticalCollision && vy < (double) 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (horizontalCollision) {
|
|
||||||
if (xCollision) vx = 0;
|
|
||||||
if (zCollision) vz = 0;
|
|
||||||
}
|
|
||||||
vx = collide.x;
|
|
||||||
vy = collide.y;
|
|
||||||
vz = collide.z;
|
|
||||||
// TODO: Get Block -> updateEntityMovementAfterFallOn!
|
|
||||||
// TODO: Get BlockSpeedFactor multiply
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean equal(double first, double second) {
|
|
||||||
return Math.abs(second - first) < (double) 1.0E-5F;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void collide() {
|
|
||||||
boolean xZero = vx == 0;
|
|
||||||
boolean zZero = vz == 0;
|
|
||||||
if (xZero && vy == 0 && zZero) {
|
|
||||||
collide.x = 0;
|
|
||||||
collide.y = 0;
|
|
||||||
collide.z = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SimulatorPreviewAABB box = new SimulatorPreviewAABB(x, y, z, x + size, y + size, z + size);
|
|
||||||
|
|
||||||
double vx = this.vx;
|
|
||||||
double vy = this.vy;
|
|
||||||
double vz = this.vz;
|
|
||||||
|
|
||||||
if (vy != 0) {
|
|
||||||
vy = iterateBlocks(box.copy(), Axis.Y, vy);
|
|
||||||
if (vy != 0) box.add(0, vy, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean xSmaller = Math.abs(vx) < Math.abs(vz);
|
|
||||||
if (xSmaller && vz != 0) {
|
|
||||||
vz = iterateBlocks(box.copy(), Axis.Z, vz);
|
|
||||||
if (vz != 0) box.add(0, 0, vz);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vx != 0) {
|
|
||||||
vx = iterateBlocks(box.copy(), Axis.X, vx);
|
|
||||||
if (vx != 0) box.add(vx, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xSmaller && vz != 0) {
|
|
||||||
vz = iterateBlocks(box.copy(), Axis.Z, vz);
|
|
||||||
if (vz != 0) box.add(0, 0, vz);
|
|
||||||
}
|
|
||||||
|
|
||||||
collide.x = vx;
|
|
||||||
collide.y = vy;
|
|
||||||
collide.z = vz;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double iterateBlocks(SimulatorPreviewAABB box, Axis axis, double v) {
|
|
||||||
switch (axis) {
|
|
||||||
case X -> box.expandTowards(v, 0, 0);
|
|
||||||
case Y -> box.expandTowards(0, v, 0);
|
|
||||||
case Z -> box.expandTowards(0, 0, v);
|
|
||||||
}
|
|
||||||
boolean negative = v < 0;
|
|
||||||
for (int x = floor(box.minX - 1.0E-7) - 1; x < floor(box.maxX + 1.0E-7) + 1; x++) {
|
|
||||||
for (int y = floor(box.minY - 1.0E-7) - 1; y < floor(box.maxY + 1.0E-7) + 1; y++) {
|
|
||||||
for (int z = floor(box.minZ - 1.0E-7) - 1; z < floor(box.maxZ + 1.0E-7) + 1; z++) {
|
|
||||||
VoxelShape shape = data.getBlockShape(x, y, z);
|
|
||||||
if (shape == null) continue;
|
|
||||||
for (BoundingBox other : shape.getBoundingBoxes()) {
|
|
||||||
switch (axis) {
|
|
||||||
case X -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, x + other.getMaxX() - this.x);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, x + other.getMinX() - this.x - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Y -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, y + other.getMaxY() - this.y);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, y + other.getMinY() - this.y - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Z -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, z + other.getMaxZ() - this.z);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, z + other.getMinZ() - this.z - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int floor(double value) {
|
|
||||||
int i = (int) value;
|
|
||||||
return value < (double) i ? i - 1 : i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void explode() {
|
|
||||||
removed = true;
|
|
||||||
// TODO: Implement
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
public class SimulatorPreviewVec {
|
|
||||||
public double x;
|
|
||||||
public double y;
|
|
||||||
public double z;
|
|
||||||
|
|
||||||
public double lengthSquared() {
|
|
||||||
return x * x + y * y + z * z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,18 +25,23 @@ import de.steamwar.bausystem.region.utils.RegionType;
|
|||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.io.Externalizable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInput;
|
||||||
|
import java.io.ObjectOutput;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recording of a tnt at a specific tick
|
* Recording of a tnt at a specific tick
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor(access = AccessLevel.PACKAGE)
|
||||||
@Getter
|
@Getter
|
||||||
public class TNTPoint{
|
public class TNTPoint{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class Config {
|
|||||||
EventKampf = null;
|
EventKampf = null;
|
||||||
TeamBlueName = "Blau";
|
TeamBlueName = "Blau";
|
||||||
TeamRedName = "Rot";
|
TeamRedName = "Rot";
|
||||||
TeamBlueColor = "§3";
|
TeamBlueColor = "§9";
|
||||||
TeamRedColor = "§c";
|
TeamRedColor = "§c";
|
||||||
EventTeamBlueID = 0;
|
EventTeamBlueID = 0;
|
||||||
EventTeamRedID = 0;
|
EventTeamRedID = 0;
|
||||||
|
|||||||
+10
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.schematicsystem.autocheck;
|
package de.steamwar.schematicsystem.autocheck;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@@ -96,6 +97,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for(CompoundTag item : items){
|
for(CompoundTag item : items){
|
||||||
|
System.out.println(item.getValue());
|
||||||
if(!item.containsKey("id")){
|
if(!item.containsKey("id")){
|
||||||
result.getDefunctNbt().add(pos);
|
result.getDefunctNbt().add(pos);
|
||||||
continue;
|
continue;
|
||||||
@@ -112,6 +114,14 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
|||||||
}
|
}
|
||||||
if (item.containsKey("tag")) {
|
if (item.containsKey("tag")) {
|
||||||
result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
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);
|
result.getDispenserItems().put(pos, counter);
|
||||||
|
|||||||
+7
-1
@@ -76,7 +76,13 @@ public class AutoCheckerItems15 implements AutoCheckerItems {
|
|||||||
Material.DIAMOND_HORSE_ARMOR,
|
Material.DIAMOND_HORSE_ARMOR,
|
||||||
Material.IRON_HORSE_ARMOR,
|
Material.IRON_HORSE_ARMOR,
|
||||||
Material.GOLDEN_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
|
@Override
|
||||||
public Set<Material> getInventoryMaterials() {
|
public Set<Material> getInventoryMaterials() {
|
||||||
|
|||||||
+7
@@ -43,12 +43,19 @@ public class AutoCheckerItems19 extends AutoCheckerItems15 {
|
|||||||
Material.LILY_OF_THE_VALLEY,
|
Material.LILY_OF_THE_VALLEY,
|
||||||
Material.WITHER_ROSE,
|
Material.WITHER_ROSE,
|
||||||
Material.SUNFLOWER,
|
Material.SUNFLOWER,
|
||||||
|
Material.LILAC,
|
||||||
|
Material.ROSE_BUSH,
|
||||||
|
Material.PEONY,
|
||||||
|
Material.TALL_GRASS,
|
||||||
|
Material.LARGE_FERN,
|
||||||
|
Material.TORCHFLOWER,
|
||||||
// 16-stackable Items
|
// 16-stackable Items
|
||||||
Material.HONEY_BOTTLE,
|
Material.HONEY_BOTTLE,
|
||||||
// Non-stackable items
|
// Non-stackable items
|
||||||
Material.DIAMOND_HORSE_ARMOR,
|
Material.DIAMOND_HORSE_ARMOR,
|
||||||
Material.IRON_HORSE_ARMOR,
|
Material.IRON_HORSE_ARMOR,
|
||||||
Material.GOLDEN_HORSE_ARMOR,
|
Material.GOLDEN_HORSE_ARMOR,
|
||||||
|
Material.LEATHER_HORSE_ARMOR,
|
||||||
// Disks
|
// Disks
|
||||||
Material.MUSIC_DISC_11,
|
Material.MUSIC_DISC_11,
|
||||||
Material.MUSIC_DISC_13,
|
Material.MUSIC_DISC_13,
|
||||||
|
|||||||
@@ -507,6 +507,15 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
|
BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ);
|
||||||
origin = min.subtract(offset);
|
origin = min.subtract(offset);
|
||||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
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 {
|
} else {
|
||||||
origin = min;
|
origin = min;
|
||||||
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
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) {
|
for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||||
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||||
final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]);
|
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){
|
if(faweSchem){
|
||||||
values.put("x", new IntTag(pt.getBlockX() - offsetX));
|
values.put("x", new IntTag(pt.getBlockX() - offsetX));
|
||||||
values.put("y", new IntTag(pt.getBlockY() - offsetY));
|
values.put("y", new IntTag(pt.getBlockY() - offsetY));
|
||||||
values.put("z", new IntTag(pt.getBlockZ() - offsetZ));
|
values.put("z", new IntTag(pt.getBlockZ() - offsetZ));
|
||||||
}else{
|
}else{
|
||||||
values.put("x", new IntTag(pt.getBlockX()));
|
values.putIfAbsent("x", new IntTag(pt.getBlockX()));
|
||||||
values.put("y", new IntTag(pt.getBlockY()));
|
values.putIfAbsent("y", new IntTag(pt.getBlockY()));
|
||||||
values.put("z", new IntTag(pt.getBlockZ()));
|
values.putIfAbsent("z", new IntTag(pt.getBlockZ()));
|
||||||
}
|
}
|
||||||
values.put("id", values.get("Id"));
|
values.putIfAbsent("id", values.get("Id"));
|
||||||
values.remove("Id");
|
values.remove("Id");
|
||||||
values.remove("Pos");
|
values.remove("Pos");
|
||||||
if (fixer != null) {
|
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.Reflection;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
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 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 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) {
|
private void getBlock(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || !block.getAsString(true).equals(DEFAULT_BLOCK.getAsString(true))) {
|
if (ignoreDefault || !block.getAsString(true).equals(DEFAULT_BLOCK.getAsString(true))) {
|
||||||
packetSink.accept(blockWatcher, getState.invoke(block));
|
packetSink.accept(blockWatcher, getState.invoke(block));
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.entity;
|
package de.steamwar.entity;
|
||||||
|
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@@ -110,10 +111,10 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getTransformData);
|
sendPacket(updatePacketSink, this::getTransformData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Object translationWatcher = BountifulWrapper.impl.getDataWatcherObject(10, Vector3f.class);
|
private static final Object translationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 11 : 10, Vector3f.class);
|
||||||
private static final Object leftRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(12, Quaternionf.class);
|
private static final Object leftRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 13 : 12, Quaternionf.class);
|
||||||
private static final Object scaleWatcher = BountifulWrapper.impl.getDataWatcherObject(11, Vector3f.class);
|
private static final Object scaleWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() >= 21 ? 12 : 11, Vector3f.class);
|
||||||
private static final Object rightRotationWatcher = BountifulWrapper.impl.getDataWatcherObject(13, Quaternionf.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) {
|
private void getTransformData(boolean ignoreDefault, BiConsumer<Object, Object> dataSink) {
|
||||||
if (ignoreDefault || !transform.equals(DEFAULT_TRANSFORM)) {
|
if (ignoreDefault || !transform.equals(DEFAULT_TRANSFORM)) {
|
||||||
@@ -129,8 +130,8 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getInterpolationDuration);
|
sendPacket(updatePacketSink, this::getInterpolationDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Object transformationInterpolationDurationWatcher = BountifulWrapper.impl.getDataWatcherObject(8, 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(9, 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) {
|
private void getInterpolationDuration(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || interpolationDelay != 0) {
|
if (ignoreDefault || interpolationDelay != 0) {
|
||||||
@@ -144,7 +145,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getViewRange);
|
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) {
|
private void getViewRange(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || viewRange != 1.0F) {
|
if (ignoreDefault || viewRange != 1.0F) {
|
||||||
@@ -157,7 +158,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getShadowRadius);
|
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) {
|
private void getShadowRadius(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || shadowRadius != 0.0F) {
|
if (ignoreDefault || shadowRadius != 0.0F) {
|
||||||
@@ -170,7 +171,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getShadowStrength);
|
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) {
|
private void getShadowStrength(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || shadowStrength != 1.0F) {
|
if (ignoreDefault || shadowStrength != 1.0F) {
|
||||||
@@ -183,7 +184,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getDisplayWidth);
|
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) {
|
private void getDisplayWidth(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || displayWidth != 0.0F) {
|
if (ignoreDefault || displayWidth != 0.0F) {
|
||||||
@@ -196,7 +197,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getDisplayHeight);
|
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) {
|
private void getDisplayHeight(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || displayHeight != 0.0F) {
|
if (ignoreDefault || displayHeight != 0.0F) {
|
||||||
@@ -209,7 +210,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getInterpolationDelay);
|
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) {
|
private void getInterpolationDelay(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || interpolationDelay != 0) {
|
if (ignoreDefault || interpolationDelay != 0) {
|
||||||
@@ -222,7 +223,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getBillboard);
|
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) {
|
private void getBillboard(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || billboard != Display.Billboard.FIXED) {
|
if (ignoreDefault || billboard != Display.Billboard.FIXED) {
|
||||||
@@ -235,7 +236,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getGlowColorOverride);
|
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) {
|
private void getGlowColorOverride(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || glowColorOverride != null) {
|
if (ignoreDefault || glowColorOverride != null) {
|
||||||
@@ -248,7 +249,7 @@ public abstract class RDisplay extends REntity {
|
|||||||
sendPacket(updatePacketSink, this::getBrightness);
|
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) {
|
private void getBrightness(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || brightness != null) {
|
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 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);
|
public static final BountifulWrapper.PositionSetter teleportPosition = BountifulWrapper.impl.getPositionSetter(teleportPacket, Core.getVersion() == 8 ? 1 : 0);
|
||||||
private Object getTeleportPacket(){
|
private Object getTeleportPacket(){
|
||||||
|
if (Core.getVersion() >= 21) {
|
||||||
|
return PacketConstructor.impl.teleportPacket(entityId, x, y, z, pitch, yaw);
|
||||||
|
}
|
||||||
|
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
Object packet = Reflection.newInstance(teleportPacket);
|
||||||
teleportEntity.set(packet, entityId);
|
teleportEntity.set(packet, entityId);
|
||||||
teleportPosition.set(packet, x, y, z, pitch, yaw);
|
teleportPosition.set(packet, x, y, z, pitch, yaw);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.entity;
|
package de.steamwar.entity;
|
||||||
|
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.ProtocolWrapper;
|
import de.steamwar.core.ProtocolWrapper;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -60,14 +61,14 @@ public class RItemDisplay extends RDisplay {
|
|||||||
sendPacket(updatePacketSink, this::getItemStack);
|
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) {
|
private void getItemStack(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || !itemStack.equals(DEFAULT_ITEM_STACK)) {
|
if (ignoreDefault || !itemStack.equals(DEFAULT_ITEM_STACK)) {
|
||||||
packetSink.accept(itemStackWatcher, asNMSCopy.invoke(null, itemStack));
|
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) {
|
public void setItemDisplayTransform(ItemDisplay.ItemDisplayTransform itemDisplayTransform) {
|
||||||
this.itemDisplayTransform = itemDisplayTransform;
|
this.itemDisplayTransform = itemDisplayTransform;
|
||||||
sendPacket(updatePacketSink, this::getItemDisplayTransform);
|
sendPacket(updatePacketSink, this::getItemDisplayTransform);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package de.steamwar.entity;
|
|||||||
import de.steamwar.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
import de.steamwar.core.ChatWrapper;
|
import de.steamwar.core.ChatWrapper;
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.EntityType;
|
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 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) {
|
private void getText(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || !text.isEmpty()) {
|
if (ignoreDefault || !text.isEmpty()) {
|
||||||
packetSink.accept(textWatcher, ChatWrapper.impl.stringToChatComponent(text));
|
packetSink.accept(textWatcher, ChatWrapper.impl.stringToChatComponent(text));
|
||||||
@@ -86,7 +87,7 @@ public class RTextDisplay extends RDisplay {
|
|||||||
sendPacket(updatePacketSink, this::getLineWidth);
|
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) {
|
private void getLineWidth(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || lineWidth != 200) {
|
if (ignoreDefault || lineWidth != 200) {
|
||||||
packetSink.accept(lineWidthWatcher, lineWidth);
|
packetSink.accept(lineWidthWatcher, lineWidth);
|
||||||
@@ -98,7 +99,7 @@ public class RTextDisplay extends RDisplay {
|
|||||||
sendPacket(updatePacketSink, this::getTextOpacity);
|
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) {
|
private void getTextOpacity(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
if (ignoreDefault || textOpacity != (byte) -1) {
|
if (ignoreDefault || textOpacity != (byte) -1) {
|
||||||
packetSink.accept(textOpacityWatcher, textOpacity);
|
packetSink.accept(textOpacityWatcher, textOpacity);
|
||||||
@@ -125,7 +126,7 @@ public class RTextDisplay extends RDisplay {
|
|||||||
sendPacket(updatePacketSink, this::getTextStatus);
|
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) {
|
private void getTextStatus(boolean ignoreDefault, BiConsumer<Object, Object> packetSink) {
|
||||||
byte status = 0;
|
byte status = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ data class TNTLeagueConfig(
|
|||||||
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("PLAIN_STRING", "§${eventTeamBlue.teamColor}${eventTeamBlue.teamName}"), eventTeamBlue.teamColor[0])
|
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])
|
redTeam = TeamConfig(TNTLeagueWorldConfig.redTeam, SubMessage("PLAIN_STRING", "§${eventTeamRed.teamColor}${eventTeamRed.teamName}"), eventTeamRed.teamColor[0])
|
||||||
} else {
|
} else {
|
||||||
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("BLUE"), '3')
|
blueTeam = TeamConfig(TNTLeagueWorldConfig.blueTeam, SubMessage("BLUE"), '9')
|
||||||
redTeam = TeamConfig(TNTLeagueWorldConfig.redTeam, SubMessage("RED"), 'c')
|
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.DisconnectEvent;
|
||||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||||
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
import com.velocitypowered.api.event.permission.PermissionsSetupEvent;
|
||||||
|
import com.velocitypowered.api.event.player.KickedFromServerEvent;
|
||||||
import com.velocitypowered.api.network.ProtocolVersion;
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
import com.velocitypowered.api.permission.Tristate;
|
import com.velocitypowered.api.permission.Tristate;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
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.DiscordBot;
|
||||||
import de.steamwar.velocitycore.discord.util.DiscordRanks;
|
import de.steamwar.velocitycore.discord.util.DiscordRanks;
|
||||||
import de.steamwar.velocitycore.mods.ModUtils;
|
import de.steamwar.velocitycore.mods.ModUtils;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
|
||||||
import java.util.HashSet;
|
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
|
@Subscribe
|
||||||
public void onDisconnect(DisconnectEvent e){
|
public void onDisconnect(DisconnectEvent e){
|
||||||
ChallengeCommand.remove(e.getPlayer());
|
ChallengeCommand.remove(e.getPlayer());
|
||||||
|
|||||||
Reference in New Issue
Block a user