|
|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: AlphaKR93 <dev@alpha93.kr>
|
|
|
|
|
Date: Fri, 31 Mar 2023 07:20:33 +0000
|
|
|
|
|
Date: Tue, 4 Apr 2023 22:23:38 +0000
|
|
|
|
|
Subject: [PATCH] Purpur Server Changes
|
|
|
|
|
|
|
|
|
|
Original: PurpurMC
|
|
|
|
|
@@ -2135,7 +2135,7 @@ index d5cb594f0b17ec9dc1a19cdb99bba553e70171be..6afee2a744a3498d4a0eee35f77cde44
|
|
|
|
|
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
|
|
|
|
this.trackedPlayers = trackedPlayers;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
index ff2862bf1f511196d1e911e2584262ed728e9a81..43bf3285729ec5cedb3de84f2b60673928b079db 100644
|
|
|
|
|
index 17b1a891073521be51e7c6bf8f53cb4ed79983ce..06b0b78d16804b4bf8f6b5bb29b21b0eda57f0fc 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
@@ -212,6 +212,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
@@ -3026,7 +3026,7 @@ index 877498729c66de9aa6a27c9148f7494d7895615c..acd7468ee3c86d3456e96e4ec3d7e6a4
|
|
|
|
|
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
|
|
|
|
|
hasSetFarWarned = true;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
|
index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e90078684f 100644
|
|
|
|
|
index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700f33421cc 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
|
@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3037,7 +3037,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
// CraftBukkit start - multithreaded fields
|
|
|
|
|
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
|
|
|
|
|
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
|
|
|
|
|
@@ -337,6 +338,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -338,6 +339,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
private boolean justTeleported = false;
|
|
|
|
|
private boolean hasMoved; // Spigot
|
|
|
|
|
|
|
|
|
|
@@ -3058,7 +3058,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
public CraftPlayer getCraftPlayer() {
|
|
|
|
|
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
|
|
|
|
|
}
|
|
|
|
|
@@ -392,12 +407,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -393,12 +408,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.aboveGroundVehicleTickCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3087,7 +3087,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
if (this.keepAlivePending) {
|
|
|
|
|
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
|
|
|
|
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
|
|
|
|
|
@@ -413,7 +443,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -414,7 +444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
@@ -3096,7 +3096,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
// CraftBukkit start
|
|
|
|
|
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
|
|
|
|
|
if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
|
|
|
|
|
@@ -430,6 +460,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -431,6 +461,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60) && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
|
|
|
|
|
@@ -3109,7 +3109,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
|
|
|
|
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
|
|
|
|
|
}
|
|
|
|
|
@@ -734,6 +770,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -742,6 +778,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.lastYaw = to.getYaw();
|
|
|
|
|
this.lastPitch = to.getPitch();
|
|
|
|
|
|
|
|
|
|
@@ -3118,7 +3118,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
// Skip the first time we do this
|
|
|
|
|
if (true) { // Spigot - don't skip any move events
|
|
|
|
|
Location oldTo = to.clone();
|
|
|
|
|
@@ -810,6 +848,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -818,6 +856,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
if (packet.getId() == this.awaitingTeleport) {
|
|
|
|
|
if (this.awaitingPositionFromClient == null) {
|
|
|
|
|
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
|
|
|
|
|
@@ -3126,7 +3126,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1214,10 +1253,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1222,10 +1261,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax;
|
|
|
|
|
double multiplier = Math.max(0.3D, Math.min(1D, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier));
|
|
|
|
|
long byteAllowed = maxBookPageSize;
|
|
|
|
|
@@ -3139,7 +3139,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -1241,6 +1282,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1249,6 +1290,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
if (byteTotal > byteAllowed) {
|
|
|
|
|
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
|
|
|
|
@@ -3147,7 +3147,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -1294,13 +1336,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1302,13 +1344,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
itemstack1.setTag(nbttagcompound.copy());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3167,7 +3167,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
|
|
|
|
|
this.updateBookPages(pages, (s) -> {
|
|
|
|
|
return Component.Serializer.toJson(Component.literal(s));
|
|
|
|
|
@@ -1312,10 +1357,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1320,10 +1365,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
private void updateBookPages(List<FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit
|
|
|
|
|
ListTag nbttaglist = new ListTag();
|
|
|
|
|
|
|
|
|
|
@@ -3183,7 +3183,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
|
|
|
|
|
Objects.requireNonNull(nbttaglist);
|
|
|
|
|
stream.forEach(nbttaglist::add);
|
|
|
|
|
@@ -1325,11 +1373,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1333,11 +1381,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
for (int j = list.size(); i < j; ++i) {
|
|
|
|
|
FilteredText filteredtext = (FilteredText) list.get(i);
|
|
|
|
|
@@ -3197,7 +3197,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1342,6 +1390,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1350,6 +1398,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3214,7 +3214,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
@Override
|
|
|
|
|
public void handleEntityTagQuery(ServerboundEntityTagQuery packet) {
|
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
|
|
|
@@ -1371,8 +1429,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1379,8 +1437,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@Override
|
|
|
|
|
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
|
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
|
|
|
@@ -3232,7 +3232,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
} else {
|
|
|
|
|
ServerLevel worldserver = this.player.getLevel();
|
|
|
|
|
|
|
|
|
|
@@ -1538,7 +1604,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1546,7 +1612,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
|
|
|
|
|
flag2 = true; // Paper - diff on change, this should be moved wrongly
|
|
|
|
|
@@ -3241,7 +3241,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.player.absMoveTo(d0, d1, d2, f, f1);
|
|
|
|
|
@@ -1589,6 +1655,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1597,6 +1663,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.lastYaw = to.getYaw();
|
|
|
|
|
this.lastPitch = to.getPitch();
|
|
|
|
|
|
|
|
|
|
@@ -3250,7 +3250,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
// Skip the first time we do this
|
|
|
|
|
if (from.getX() != Double.MAX_VALUE) {
|
|
|
|
|
Location oldTo = to.clone();
|
|
|
|
|
@@ -1628,6 +1696,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1636,6 +1704,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.player.resetFallDistance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3264,7 +3264,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
|
|
|
|
|
this.lastGoodX = this.player.getX();
|
|
|
|
|
this.lastGoodY = this.player.getY();
|
|
|
|
|
@@ -1661,6 +1736,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -1669,6 +1744,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
}
|
|
|
|
|
// Paper end - optimise out extra getCubes
|
|
|
|
|
|
|
|
|
|
@@ -3277,7 +3277,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
private boolean isPlayerCollidingWithAnythingNew(LevelReader world, AABB box) {
|
|
|
|
|
Iterable<VoxelShape> iterable = world.getCollisions(this.player, this.player.getBoundingBox().deflate(9.999999747378752E-6D));
|
|
|
|
|
VoxelShape voxelshape = Shapes.create(box.deflate(9.999999747378752E-6D));
|
|
|
|
|
@@ -2005,6 +2086,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2013,6 +2094,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
boolean cancelled;
|
|
|
|
|
if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) {
|
|
|
|
|
@@ -3285,7 +3285,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
|
|
|
|
|
cancelled = event.useItemInHand() == Event.Result.DENY;
|
|
|
|
|
} else {
|
|
|
|
|
@@ -2058,12 +2140,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2066,12 +2148,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@Override
|
|
|
|
|
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
|
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
|
|
|
@@ -3307,7 +3307,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
player.getBukkitEntity().setResourcePackStatus(packStatus);
|
|
|
|
|
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit
|
|
|
|
|
// Paper end
|
|
|
|
|
@@ -2354,7 +2445,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2362,7 +2453,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
do {
|
|
|
|
|
instant1 = (Instant) this.lastChatTimeStamp.get();
|
|
|
|
|
if (timestamp.isBefore(instant1)) {
|
|
|
|
|
@@ -3316,7 +3316,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
}
|
|
|
|
|
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
|
|
|
|
|
|
|
|
|
|
@@ -2491,7 +2582,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2499,7 +2590,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Paper End
|
|
|
|
|
@@ -3325,7 +3325,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
|
|
|
|
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
|
|
|
|
|
|
|
|
|
|
@@ -2501,7 +2592,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2509,7 +2600,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
this.cserver.getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
|
@@ -3334,7 +3334,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2514,7 +2605,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2522,7 +2613,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
|
return;
|
|
|
|
|
} finally {
|
|
|
|
|
@@ -3343,7 +3343,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
@@ -2780,6 +2871,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2788,6 +2879,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
AABB axisalignedbb = entity.getBoundingBox();
|
|
|
|
|
|
|
|
|
|
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
|
|
|
|
|
@@ -3351,7 +3351,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
packet.dispatch(new ServerboundInteractPacket.Handler() {
|
|
|
|
|
private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
|
|
|
|
ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand);
|
|
|
|
|
@@ -2793,6 +2885,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -2801,6 +2893,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
|
|
@@ -3360,7 +3360,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
|
|
|
|
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
|
|
|
|
|
entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it.
|
|
|
|
|
@@ -3344,6 +3438,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3352,6 +3446,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -3373,7 +3373,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
|
|
|
|
|
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
|
|
|
|
|
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
|
|
|
|
@@ -3450,11 +3550,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3458,11 +3558,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
for (int i = 0; i < signText.size(); ++i) {
|
|
|
|
|
FilteredText filteredtext = (FilteredText) signText.get(i);
|
|
|
|
|
|
|
|
|
|
@@ -3394,7 +3394,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
}
|
|
|
|
|
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
|
|
|
|
|
this.cserver.getPluginManager().callEvent(event);
|
|
|
|
|
@@ -3476,6 +3582,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3484,6 +3590,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
|
|
|
|
@@ -3411,7 +3411,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
|
|
|
|
|
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
|
|
|
|
int i = (int) (Util.getMillis() - this.keepAliveTime);
|
|
|
|
|
@@ -3526,6 +3642,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3534,6 +3650,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
|
|
|
|
|
|
|
|
|
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
|
|
|
|
|
@@ -3419,7 +3419,7 @@ index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e9
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
|
|
|
|
@@ -3550,6 +3667,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
@@ -3558,6 +3675,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
|
|
|
|
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
|
|
|
|
}
|
|
|
|
|
@@ -3488,10 +3488,10 @@ index 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..7383c7d3820dce06108eaafd236a7c6c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8eee7a4269 100644
|
|
|
|
|
index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04edd19fc5 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
|
@@ -462,6 +462,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -466,6 +466,7 @@ public abstract class PlayerList {
|
|
|
|
|
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
@@ -3499,7 +3499,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
// CraftBukkit - Moved from above, added world
|
|
|
|
|
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
|
|
|
|
|
}
|
|
|
|
|
@@ -571,6 +572,8 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -575,6 +576,8 @@ public abstract class PlayerList {
|
|
|
|
|
}
|
|
|
|
|
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
|
|
|
|
// Paper end
|
|
|
|
|
@@ -3508,7 +3508,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
ServerLevel worldserver = entityplayer.getLevel();
|
|
|
|
|
|
|
|
|
|
entityplayer.awardStat(Stats.LEAVE_GAME);
|
|
|
|
|
@@ -724,7 +727,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -728,7 +731,7 @@ public abstract class PlayerList {
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
|
|
|
|
} else {
|
|
|
|
|
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
|
|
|
|
|
@@ -3517,7 +3517,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -962,6 +965,8 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -966,6 +969,8 @@ public abstract class PlayerList {
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
@@ -3526,7 +3526,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
return entityplayer1;
|
|
|
|
|
}
|
|
|
|
|
@@ -1022,6 +1027,20 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1026,6 +1031,20 @@ public abstract class PlayerList {
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
|
@@ -3547,7 +3547,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
|
|
|
|
|
Iterator iterator = this.players.iterator();
|
|
|
|
|
|
|
|
|
|
@@ -1125,6 +1144,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1129,6 +1148,7 @@ public abstract class PlayerList {
|
|
|
|
|
} else {
|
|
|
|
|
b0 = (byte) (24 + permissionLevel);
|
|
|
|
|
}
|
|
|
|
|
@@ -3555,7 +3555,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
|
|
|
|
|
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
|
|
|
|
}
|
|
|
|
|
@@ -1133,6 +1153,27 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1137,6 +1157,27 @@ public abstract class PlayerList {
|
|
|
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
|
|
|
this.server.getCommands().sendCommands(player);
|
|
|
|
|
} // Paper
|
|
|
|
|
@@ -3583,7 +3583,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isWhiteListed(GameProfile profile) {
|
|
|
|
|
@@ -1194,7 +1235,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1198,7 +1239,7 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
|
|
public void saveAll(int interval) {
|
|
|
|
|
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
|
|
|
|
|
@@ -3592,7 +3592,7 @@ index c0c14766adaac855112f85a203a6163b8adfdded..1a288ebcaade0cc44c7d09478f4f2f8e
|
|
|
|
|
int numSaved = 0;
|
|
|
|
|
long now = MinecraftServer.currentTick;
|
|
|
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
|
|
|
@@ -1205,7 +1246,7 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -1209,7 +1250,7 @@ public abstract class PlayerList {
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
}
|
|
|
|
|
@@ -10164,7 +10164,7 @@ index e2935115c8d41af1d623da4f0d4f73de80386129..ae663a9b32c281f745592afa614f55c0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
|
|
|
index 89f761871a84f8ab95f2a16aba8340bb8726da30..6e7c0e95b27c41bf12da1beb3458830ce27c6029 100644
|
|
|
|
|
index f6e2348b280eaefc0eb05bf5d962593caa654357..adae992ade60e0fce7ca0cc10192720025a574fe 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
|
|
|
@@ -81,6 +81,33 @@ public class Sniffer extends Animal {
|
|
|
|
|
@@ -10210,7 +10210,7 @@ index 89f761871a84f8ab95f2a16aba8340bb8726da30..6e7c0e95b27c41bf12da1beb3458830c
|
|
|
|
|
super.jumpFromGround();
|
|
|
|
|
double d0 = this.moveControl.getSpeedModifier();
|
|
|
|
|
|
|
|
|
|
@@ -442,11 +469,11 @@ public class Sniffer extends Animal {
|
|
|
|
|
@@ -443,11 +470,11 @@ public class Sniffer extends Animal {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void customServerAiStep() {
|
|
|
|
|
@@ -20682,10 +20682,10 @@ index 4d7a2c4c1001aefe9fcd4be8dbcb414f721bfff9..2c7716a9d65ebda209a144b82c2126b6
|
|
|
|
|
+ // Purpur end
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c991ce9636b 100644
|
|
|
|
|
index 589783e93785196eb9f7ff6890c03e84f3102d93..b7f1382d48a66f78c4492b0f8b90c16116a90220 100644
|
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
|
@@ -525,10 +525,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
@@ -528,10 +528,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setPlayerListName(String name) {
|
|
|
|
|
@@ -20702,7 +20702,7 @@ index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c99
|
|
|
|
|
for (ServerPlayer player : (List<ServerPlayer>) server.getHandle().players) {
|
|
|
|
|
if (player.getBukkitEntity().canSee(this)) {
|
|
|
|
|
player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle()));
|
|
|
|
|
@@ -1336,6 +1341,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
@@ -1339,6 +1344,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (entity.isVehicle() && !ignorePassengers) { // Paper - Teleport API
|
|
|
|
|
@@ -20713,7 +20713,7 @@ index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c99
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2366,6 +2375,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
@@ -2369,6 +2378,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
return this.getHandle().getAbilities().walkingSpeed * 2f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -20742,7 +20742,7 @@ index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c99
|
|
|
|
|
private void validateSpeed(float value) {
|
|
|
|
|
if (value < 0) {
|
|
|
|
|
if (value < -1f) {
|
|
|
|
|
@@ -3158,4 +3189,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
@@ -3161,4 +3192,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
return this.spigot;
|
|
|
|
|
}
|
|
|
|
|
// Spigot end
|
|
|
|
|
@@ -27157,7 +27157,7 @@ index 0000000000000000000000000000000000000000..b7586f494528f30eb0da82420d3bcf5b
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
|
index 63d3fcc45be732a4cd2dc8b5347d860fd6577bdd..665625c69b93a2568b1f2218a0db39da435d8c99 100644
|
|
|
|
|
index 07050c78a2eb6ce0c699101b38961b111d631a41..ee64ddb0da23ea1e54d0295324aca5b46a438111 100644
|
|
|
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
|
@@ -15,6 +15,7 @@ import net.minecraft.world.entity.ambient.AmbientCreature;
|
|
|
|
|
@@ -27185,7 +27185,7 @@ index 63d3fcc45be732a4cd2dc8b5347d860fd6577bdd..665625c69b93a2568b1f2218a0db39da
|
|
|
|
|
// Paper start
|
|
|
|
|
int worldHeight = world.getHeight();
|
|
|
|
|
ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange );
|
|
|
|
|
@@ -242,7 +244,7 @@ public class ActivationRange
|
|
|
|
|
@@ -243,7 +245,7 @@ public class ActivationRange
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
}
|
|
|
|
|
@@ -27194,7 +27194,7 @@ index 63d3fcc45be732a4cd2dc8b5347d860fd6577bdd..665625c69b93a2568b1f2218a0db39da
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -395,6 +397,7 @@ public class ActivationRange
|
|
|
|
|
@@ -396,6 +398,7 @@ public class ActivationRange
|
|
|
|
|
*/
|
|
|
|
|
public static boolean checkIfActive(Entity entity)
|
|
|
|
|
{
|
|
|
|
|
@@ -27203,18 +27203,18 @@ index 63d3fcc45be732a4cd2dc8b5347d860fd6577bdd..665625c69b93a2568b1f2218a0db39da
|
|
|
|
|
if ( entity instanceof FireworkRocketEntity ) {
|
|
|
|
|
return true;
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
|
|
|
index 9bede6a26c08ede063c7a38f1149c811df14b258..088239d17aa8178cf8af09ec23cfd4deaaf2bbb6 100644
|
|
|
|
|
index b1a72aa3634405f3fce64c66677a75d8f77cb6f6..df158d5339000cbc3206e4e1e0603acb1d39c528 100644
|
|
|
|
|
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
|
|
|
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
|
|
|
@@ -31,7 +31,7 @@ public class TicksPerSecondCommand extends Command
|
|
|
|
|
@@ -37,7 +37,7 @@ public class TicksPerSecondCommand extends Command
|
|
|
|
|
for ( int i = 0; i < tps.length; i++) {
|
|
|
|
|
tpsAvg[i] = TicksPerSecondCommand.format( tps[i] );
|
|
|
|
|
}
|
|
|
|
|
- sender.sendMessage(ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "));
|
|
|
|
|
+ sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
|
|
|
|
|
- sender.sendMessage(net.kyori.adventure.text.Component.text("TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "), net.kyori.adventure.text.format.NamedTextColor.GOLD));
|
|
|
|
|
+ sender.sendMessage(net.kyori.adventure.text.Component.text("TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "), net.kyori.adventure.text.format.NamedTextColor.GOLD));
|
|
|
|
|
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
|
|
|
|
|
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
|
|
|
|
|
if (!hasShownMemoryWarning) {
|
|
|
|
|
sender.sendMessage(net.kyori.adventure.text.Component.text()
|
|
|
|
|
.append(net.kyori.adventure.text.Component.text("Current Memory Usage: ", net.kyori.adventure.text.format.NamedTextColor.GOLD))
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
|
|
|
|
index e9fa7faaa4451e36b3908cbcbbe0baf213abde96..a810bfd3b8d6bd4d8f2ef8797e4281ae4fe8a67f 100644
|
|
|
|
|
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
|
|
|
|
|