13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Jason Penilla 2021-06-14 20:50:26 -07:00
Ursprung b23eec8be4
Commit d15e006a8c
12 geänderte Dateien mit 154 neuen und 202 gelöschten Zeilen

Datei anzeigen

@ -114,6 +114,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ DUPLICATE_LOGIN, + DUPLICATE_LOGIN,
+ +
+ RESOURCE_PACK_REJECTION,
+
+ /** + /**
+ * Spigot's restart command + * Spigot's restart command
+ */ + */

Datei anzeigen

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 26 May 2021 17:09:07 -0400
Subject: [PATCH] Add BellRevealRaiderEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Position;
import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.EntityTypeTags;
@@ -0,0 +0,0 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity
}
private void glow(LivingEntity entity) {
+ if (!new io.papermc.paper.event.block.BellRevealRaiderEvent(level.getWorld().getBlockAt(MCUtil.toLocation(level, worldPosition)), entity.getBukkitEntity()).callEvent()) return; // Paper - BellRevealRaiderEvent
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
}
}

Datei anzeigen

@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 26 May 2021 17:09:07 -0400
Subject: [PATCH] Add BellRevealRaiderEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -0,0 +0,0 @@ public class BellBlockEntity extends BlockEntity {
private static void makeRaidersGlow(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
hearingEntities.stream().filter((livingEntity) -> {
return isRaiderWithinRange(pos, livingEntity);
- }).forEach(BellBlockEntity::glow);
+ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
}
private static void showBellParticles(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
@@ -0,0 +0,0 @@ public class BellBlockEntity extends BlockEntity {
return entity.isAlive() && !entity.isRemoved() && pos.closerThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS);
}
- private static void glow(LivingEntity entity) {
+ // Paper start
+ private static void glow(LivingEntity entity) { glow(entity, null); }
+ private static void glow(LivingEntity entity, BlockPos pos) {
+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(net.minecraft.server.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return;
+ // Paper end
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
}

Datei anzeigen

@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), entityplayer.getBukkitEntity()).callEvent()) { // Paper - Add Guardian Appearance Event + if (new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), entityplayer.getBukkitEntity()).callEvent()) { // Paper - Add Guardian Appearance Event
if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) { if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) {
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F)); entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
entityplayer.addEffect(new MobEffectInstance(mobeffectlist, 6000, 2), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit entityplayer.addEffect(new MobEffectInstance(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
} }
+ } // Paper - Add Guardian Appearance Event + } // Paper - Add Guardian Appearance Event
} }
} }

Datei anzeigen

@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java --- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java +++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
@@ -0,0 +0,0 @@ public class BanIpCommands { @@ -0,0 +0,0 @@ public class BanIpCommands {
while (iterator.hasNext()) { }
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned")); for(ServerPlayer serverPlayer : list) {
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause - serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned"));
+ serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause
} }
return list.size(); return list.size();
@ -35,11 +35,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java --- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
+++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java +++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
@@ -0,0 +0,0 @@ public class BanPlayerCommands { @@ -0,0 +0,0 @@ public class BanPlayerCommands {
ServerPlayer entityplayer = source.getServer().getPlayerList().getPlayer(gameprofile.getId()); source.sendSuccess(new TranslatableComponent("commands.ban.success", ComponentUtils.getDisplayName(gameProfile), userBanListEntry.getReason()), true);
ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
if (entityplayer != null) { if (serverPlayer != null) {
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned")); - serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned"));
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause + serverPlayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
} }
} }
} }
@ -48,19 +48,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/commands/KickCommand.java --- a/src/main/java/net/minecraft/server/commands/KickCommand.java
+++ b/src/main/java/net/minecraft/server/commands/KickCommand.java +++ b/src/main/java/net/minecraft/server/commands/KickCommand.java
@@ -0,0 +0,0 @@ public class KickCommand { @@ -0,0 +0,0 @@ public class KickCommand {
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
- entityplayer.connection.disconnect(reason); private static int kickPlayers(CommandSourceStack source, Collection<ServerPlayer> targets, Component reason) {
+ entityplayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause for(ServerPlayer serverPlayer : targets) {
source.sendSuccess(new TranslatableComponent("commands.kick.success", new Object[]{entityplayer.getDisplayName(), reason}), true); - serverPlayer.connection.disconnect(reason);
+ serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause
source.sendSuccess(new TranslatableComponent("commands.kick.success", serverPlayer.getDisplayName(), reason), true);
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping()) { if (this.clientIsFloating && !this.player.isSleeping()) {
if (++this.aboveGroundTickCount > 80) { if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
} else { } else {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) { if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
@ -78,8 +78,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
} else { } else {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.isPendingPing()) { if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected 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 ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
- this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0])); - this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]));
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} else { } else {
if (elapsedTime >= 15000L) { // 15 seconds if (elapsedTime >= 15000L) { // 15 seconds
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) { if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
@ -96,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void disconnect(String s) { public void disconnect(String s) {
// Paper start // Paper start
@ -122,28 +122,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper end // Paper end
// CraftBukkit start - fire PlayerKickEvent // CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) { if (this.processedDisconnect) {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.craftServer.getPlayer(this.player), reason, leaveMessage); // Paper - Adventure - PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure
+ PlayerKickEvent event = new PlayerKickEvent(this.craftServer.getPlayer(this.player), reason, leaveMessage, cause); // Paper - Adventure & kick event reason + PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - Adventure & kick event reason
if (this.craftServer.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.craftServer.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (containsInvalidValues(packet)) { if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement")); - this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause + this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
} else { } else {
Entity entity = this.player.getRootVehicle(); Entity entity = this.player.getRootVehicle();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start // CraftBukkit start
if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper - server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause + server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return; return;
@ -156,16 +156,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
// Paper end // Paper end
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start - validate pick item position // Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.inventory.items.size())) { if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
- this.disconnect("Invalid hotbar selection (Hacking?)"); - this.disconnect("Invalid hotbar selection (Hacking?)");
+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause + this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
return; return;
} }
this.player.inventory.pickSlot(packet.getSlot()); // Paper - Diff above if changed this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ListTag pageList = testStack.getTag().getList("pages", 8); ListTag pageList = testStack.getTag().getList("pages", 8);
if (pageList.size() > 100) { if (pageList.size() > 100) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages");
@ -174,7 +174,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
long byteTotal = 0; long byteTotal = 0;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) { if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -183,7 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
byteTotal += byteLength; byteTotal += byteLength;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (byteTotal > byteAllowed) { 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()); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -200,25 +200,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
this.lastBookTick = MinecraftServer.currentTick; this.lastBookTick = MinecraftServer.currentTick;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMovePlayer(ServerboundMovePlayerPacket packet) { public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (containsInvalidValues(packet)) { if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement")); - this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause + this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
} else { } else {
ServerLevel worldserver = this.player.getLevel(); ServerLevel worldserver = this.player.getLevel();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.dropCount++; this.dropCount++;
if (this.dropCount >= 20) { if (this.dropCount >= 20) {
LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
- this.disconnect("You dropped your items too quickly (Hacking?)"); - this.disconnect("You dropped your items too quickly (Hacking?)");
+ this.disconnect("You dropped your items too quickly (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause + this.disconnect("You dropped your items too quickly (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
return; return;
} }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
- this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect"));
+ this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime(); this.player.resetLastActionTime();
} else { } else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -227,25 +236,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() {
@Override for (int i = 0; i < s.length(); ++i) {
protected Object evaluate() { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters")); - this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"));
+ ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event cause + this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
return null; return;
} }
}; }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e);
}
} else {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event cause
}
// CraftBukkit end
return;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
@ -254,7 +254,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return null; return null;
} }
}; };
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} else { } else {
@ -263,43 +263,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// CraftBukkit end // CraftBukkit end
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start // Spigot Start
if ( entity == player && !player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
- disconnect( "Cannot interact with self!" ); - this.disconnect( "Cannot interact with self!" );
+ disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause + this.disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - add cause
return; return;
} }
// Spigot End // Spigot End
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// CraftBukkit end }
} else if (packet.getAction() == ServerboundInteractPacket.Action.ATTACK) { // CraftBukkit end
if (entity instanceof ItemEntity || entity instanceof ExperienceOrb || entity instanceof AbstractArrow || (entity == this.player && !player.isSpectator())) { // CraftBukkit } else {
- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked")); - ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"));
+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - kick event cause + ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
return; }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start // Paper start
if (!Bukkit.isPrimaryThread()) { if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(PaperConfig.autoRecipeIncrement) > PaperConfig.autoRecipeLimit) { if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper - server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause + server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return; return;
} }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) { } else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins // Paper start - This needs to be handled on the main thread for plugins
server.scheduleOnMain(() -> { server.submit(() -> {
- this.disconnect(new TranslatableComponent("disconnect.timeout")); - this.disconnect(new TranslatableComponent("disconnect.timeout"));
+ this.disconnect(new TranslatableComponent("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause + this.disconnect(new TranslatableComponent("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
}); });
// Paper end // Paper end
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -308,7 +308,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try { try {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -317,8 +317,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} else { } else {
try { try {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
craftServer.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.identifier.toString(), data); this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
- this.disconnect("Invalid custom payload!"); - this.disconnect("Invalid custom payload!");
@ -333,14 +333,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
while (iterator.hasNext()) { while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next(); entityplayer = (ServerPlayer) iterator.next();
save(entityplayer); // CraftBukkit - Force the player's inventory to be saved this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0])); - entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]));
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause + entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
} }
// Instead of kicking then returning, we need to store the kick reason // Instead of kicking then returning, we need to store the kick reason
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
public void shutdown(boolean isRestarting) { // Paper end
// CraftBukkit start - disconnect safely // CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) { for (ServerPlayer player : this.players) {
- if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper - if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper
@ -356,10 +356,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (getHandle().connection == null) return; if (this.getHandle().connection == null) return;
- getHandle().connection.disconnect(message == null ? "" : message); - this.getHandle().connection.disconnect(message == null ? "" : message);
+ getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause + this.getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause
} }
// Paper start // Paper start
@ -377,7 +377,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); + connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
} }
} }
// Paper end
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java --- a/src/main/java/org/spigotmc/RestartCommand.java

Datei anzeigen

@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); + fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@ -35,5 +36,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper End + // Paper End
this.tryToMerge(entityitem); this.tryToMerge(entityitem);
if (this.removed) { if (this.isRemoved()) {
break; break;

Datei anzeigen

@ -9,29 +9,30 @@ diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java --- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java +++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -0,0 +0,0 @@ public class BucketItem extends Item { @@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
+ private static ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
+
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -0,0 +0,0 @@ public class BucketItem extends Item implements DispensibleContainerItem {
} }
protected ItemStack getEmptySuccessItem(ItemStack stack, Player player) { public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
+ // Paper + // Paper start
+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) { + if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent; + ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
+ itemLeftInHandAfterPlayerBucketEmptyEvent = null; + itemLeftInHandAfterPlayerBucketEmptyEvent = null;
+ return itemInHand; + return itemInHand;
+ } + }
+ // Paper + // Paper end
return !player.abilities.instabuild ? new ItemStack(Items.BUCKET) : stack; return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
} }
@@ -0,0 +0,0 @@ public class BucketItem extends Item { @@ -0,0 +0,0 @@ public class BucketItem extends Item implements DispensibleContainerItem {
return a(player, world, pos, movingobjectpositionblock, null, null, null, null);
}
+ private ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) {
// Paper end
// CraftBukkit end
@@ -0,0 +0,0 @@ public class BucketItem extends Item {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false; return false;
} }

Datei anzeigen

@ -10,23 +10,11 @@ and will result in all kinds of dupes.
Move the tick logic into the post tick, where portaling was Move the tick logic into the post tick, where portaling was
designed to happen in the first place. designed to happen in the first place.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
return b(destination, TeleportCause.UNKNOWN);
}
+ @Nullable public final Entity changeDimension(ServerLevel worldserver, PlayerTeleportEvent.TeleportCause cause) { return this.b(worldserver, cause); } // Paper - OBFHELPER
@Nullable
public Entity b(ServerLevel worldserver, PlayerTeleportEvent.TeleportCause cause) {
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
} }
// Paper end - optimise entity tracking // Paper end - optimise entity tracking
@ -63,8 +51,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
public Entity(EntityType<?> type, Level world) { public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
this.passengers = Lists.newArrayList(); this.passengers = ImmutableList.of();
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
} }
this.processPortalCooldown(); this.processPortalCooldown();
@ -76,14 +64,6 @@ diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
-import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
@@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock { @@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock {
// return; // CraftBukkit - always fire event in case plugins wish to change it // return; // CraftBukkit - always fire event in case plugins wish to change it
} }
@ -93,7 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- world.getCraftServer().getPluginManager().callEvent(event); - world.getCraftServer().getPluginManager().callEvent(event);
- -
- if (entity instanceof ServerPlayer) { - if (entity instanceof ServerPlayer) {
- ((ServerPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); - ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
- return; - return;
- } - }
- // CraftBukkit end - // CraftBukkit end

Datei anzeigen

@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); + fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit);
+ } + }
} }
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@ -48,18 +49,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
}
@@ -0,0 +0,0 @@ public class EndCrystal extends Entity {
}
tag.putBoolean("ShowBottom", this.showsBottom());
+ if (this.generatedByDragonFight) tag.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals + if (this.generatedByDragonFight) tag.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
} }
@Override @Override
@@ -0,0 +0,0 @@ public class EndCrystal extends Entity { @@ -0,0 +0,0 @@ public class EndCrystal extends Entity {
if (tag.contains("ShowBottom", 1)) { if (nbt.contains("ShowBottom", 1)) {
this.setShowBottom(tag.getBoolean("ShowBottom")); this.setShowBottom(nbt.getBoolean("ShowBottom"));
} }
+ if (tag.contains("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = tag.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals + if (tag.contains("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = tag.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals
@ -70,36 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java --- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
@@ -0,0 +0,0 @@ public class SpikeFeature extends Feature<SpikeConfiguration> { @@ -0,0 +0,0 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
return (List) SpikeFeature.SPIKE_CACHE.getUnchecked(i); endCrystal.setBeamTarget(config.getCrystalBeamTarget());
} endCrystal.setInvulnerable(config.isCrystalInvulnerable());
endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F);
- public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, SpikeConfiguration config) { + endCrystal.generatedByDragonFight = true; // Paper
- List<SpikeFeature.EndSpike> list = config.getSpikes(); world.addFreshEntity(endCrystal);
+ public boolean generate(WorldGenLevel generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPos blockposition, SpikeConfiguration worldgenfeatureendspikeconfiguration) { // Paper - decompile fix
+ List<SpikeFeature.EndSpike> list = worldgenfeatureendspikeconfiguration.getSpikes();
if (list.isEmpty()) {
- list = getSpikesForLevel(world);
+ list = getSpikesForLevel(generatoraccessseed);
}
Iterator iterator = list.iterator();
@@ -0,0 +0,0 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
while (iterator.hasNext()) {
SpikeFeature.EndSpike worldgenender_spike = (SpikeFeature.EndSpike) iterator.next();
- if (worldgenender_spike.isCenterWithinChunk(pos)) {
- this.placeSpike(world, random, config, worldgenender_spike);
+ if (worldgenender_spike.isCenterWithinChunk(blockposition)) {
+ this.placeSpike(generatoraccessseed, random, worldgenfeatureendspikeconfiguration, worldgenender_spike);
}
}
@@ -0,0 +0,0 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
entityendercrystal.setBeamTarget(config.getCrystalBeamTarget());
entityendercrystal.setInvulnerable(config.isCrystalInvulnerable());
entityendercrystal.moveTo((double) spike.getCenterX() + 0.5D, (double) (spike.getHeight() + 1), (double) spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F);
+ entityendercrystal.generatedByDragonFight = true;
world.addFreshEntity(entityendercrystal);
this.setBlock(world, new BlockPos(spike.getCenterX(), spike.getHeight(), spike.getCenterZ()), Blocks.BEDROCK.defaultBlockState()); this.setBlock(world, new BlockPos(spike.getCenterX(), spike.getHeight(), spike.getCenterZ()), Blocks.BEDROCK.defaultBlockState());
} }

Datei anzeigen

@ -23,16 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
public void onOpen(CraftHumanEntity who) { public void onOpen(CraftHumanEntity who) {
transaction.add(who); this.transaction.add(who);
} }
@@ -0,0 +0,0 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
return itemstack;
}
+ public ItemStack addItem(ItemStack itemstack) { return addItem(itemstack); } // Paper - OBFHELPER
public ItemStack addItem(ItemStack stack) {
ItemStack itemstack1 = stack.copy();
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
@ -59,4 +51,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // ItemStack itemstack1 = inventorysubcontainer.a(itemstack); // Paper - moved up + // ItemStack itemstack1 = inventorysubcontainer.a(itemstack); // Paper - moved up
if (itemstack1.isEmpty()) { if (itemstack1.isEmpty()) {
item.remove(); item.discard();