3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-11-08 17:40:04 +01:00

Add two more config options

Dieser Commit ist enthalten in:
Moulberry 2023-10-14 12:15:30 +08:00
Ursprung fa3f904f22
Commit 5c8e845b62
4 geänderte Dateien mit 39 neuen und 31 gelöschten Zeilen

Datei anzeigen

@ -8,7 +8,7 @@ plugins {
}
group = "com.moulberry.axiom"
version = "1.5.1"
version = "1.5.2"
description = "Serverside component for Axiom on Paper"
java {

Datei anzeigen

@ -93,6 +93,9 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
int playerSectionZ = player.getBlockZ() >> 4;
Long2ObjectMap<PalettedContainer<BlockState>> sections = new Long2ObjectOpenHashMap<>();
int maxChunkLoadDistance = this.plugin.configuration.getInt("max-chunk-load-distance");
if (maxChunkLoadDistance > 0) {
count = friendlyByteBuf.readVarInt();
for (int i = 0; i < count; i++) {
long pos = friendlyByteBuf.readLong();
@ -102,7 +105,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
int sz = BlockPos.getZ(pos);
int distance = Math.abs(playerSectionX - sx) + Math.abs(playerSectionZ - sz);
if (distance > 128) continue;
if (distance > maxChunkLoadDistance) continue;
LevelChunk chunk = level.getChunk(sx, sz);
int sectionIndex = chunk.getSectionIndexFromSectionY(sy);
@ -134,7 +137,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
}
}
}
}
// Send response packet

Datei anzeigen

@ -38,7 +38,6 @@ import java.lang.reflect.Method;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.logging.Level;
public class SetBlockPacketListener implements PluginMessageListener {

Datei anzeigen

@ -38,6 +38,12 @@ public class TeleportPacketListener implements PluginMessageListener {
World world = Bukkit.getWorld(namespacedKey);
if (world == null) return;
// Prevent teleport based on config value
boolean allowTeleportBetweenWorlds = this.plugin.configuration.getBoolean("allow-teleport-between-worlds");
if (!allowTeleportBetweenWorlds && world != player.getWorld()) {
return;
}
// Call event
AxiomTeleportEvent teleportEvent = new AxiomTeleportEvent(player, new Location(world, x, y, z, yRot, xRot));
Bukkit.getPluginManager().callEvent(teleportEvent);