Compare commits

15 Commits

Author SHA1 Message Date
LegacyGamerHD
d3bcde9e35 Update pom.xml 2023-02-25 18:30:48 +01:00
josephworks
104045e04d Merge pull request #238 from FatSaw/ver/1.12.2
Fix plates
2023-02-18 01:47:57 -07:00
FatSaw
c398827cba Update NetworkManager.java 2023-02-18 06:15:42 +02:00
FatSaw
1746d7b012 Update NetworkManager.java 2023-02-18 06:10:37 +02:00
FatSaw
8a5d8fdaea Update NetworkManager.java 2023-02-18 05:55:40 +02:00
FatSaw
09136ba60d Update NetworkManager.java 2023-02-18 05:45:41 +02:00
FatSaw
7bec837bdb Update Entity.java 2023-02-18 05:44:06 +02:00
FatSaw
cfb02cf611 Update EntityPlayer.java 2023-02-18 05:44:01 +02:00
FatSaw
4d9c01aa87 Update PlayerConnection.java 2023-02-18 05:43:17 +02:00
FatSaw
39670d24e1 Update PlayerList.java 2023-02-18 05:43:12 +02:00
FatSaw
dd01cae8fe Update World.java 2023-02-18 05:43:06 +02:00
FatSaw
0098d0c20d Update WorldServer.java 2023-02-18 05:42:57 +02:00
FatSaw
d8ea0f157a Update CraftServer.java 2023-02-18 05:42:50 +02:00
FatSaw
13d3cb28e4 Update ChunkRegionLoader.java 2023-02-18 03:58:59 +02:00
FatSaw
a15099f9e8 Update PlayerConnection.java 2023-02-18 02:43:14 +02:00
10 changed files with 131 additions and 30 deletions

View File

@@ -144,7 +144,7 @@
<dependency> <dependency>
<groupId>org.spongepowered</groupId> <groupId>org.spongepowered</groupId>
<artifactId>mixin</artifactId> <artifactId>mixin</artifactId>
<version>0.7.11-SNAPSHOT</version> <version>0.8.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.googlecode.concurrent-locks</groupId> <groupId>com.googlecode.concurrent-locks</groupId>

View File

@@ -1,11 +1,16 @@
package net.minecraft.server; package net.minecraft.server;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.concurrent.ConcurrentLinkedQueue; // Paper import java.util.concurrent.ConcurrentLinkedQueue; // Paper
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@@ -89,8 +94,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.d, i, j); return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.d, i, j);
} }
// Paper start
private static final int CURRENT_DATA_VERSION = 1343; // Paper
private static final boolean JUST_CORRUPT_IT = Boolean.valueOf("Paper.ignoreWorldDataVersion");
// Paper end
@Nullable @Nullable
protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[] protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
// Paper start - Do NOT attempt to load chunks saved with newer versions
if (nbttagcompound.hasKeyOfType("DataVersion", 3)) {
int dataVersion = nbttagcompound.getInt("DataVersion");
if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
System.exit(1);
}
}
// Paper end
if (!nbttagcompound.hasKeyOfType("Level", 10)) { if (!nbttagcompound.hasKeyOfType("Level", 10)) {
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j)); ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j));
return null; return null;

View File

@@ -2965,7 +2965,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return entity instanceof EntityHuman ? ((EntityHuman) entity).cZ() : !this.world.isClientSide; return entity instanceof EntityHuman ? ((EntityHuman) entity).cZ() : !this.world.isClientSide;
} }
@Nullable @Nullable Entity getVehicleDirect() { return this.bJ(); } // Paper - OBFHELPER
public Entity bJ() { public Entity bJ() {
return this.au; return this.au;
} }

View File

@@ -1096,6 +1096,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void s() { public void s() {
this.cu = true; this.cu = true;
this.ejectPassengers(); this.ejectPassengers();
// Paper start - "Fixes" an issue where the vehicle doesn't track the passenger disconnection dismount.
if (this.isPassenger() && this.getVehicleDirect() instanceof EntityLiving) {
this.stopRiding();
}
// Paper end
if (this.sleeping) { if (this.sleeping) {
this.a(true, false, false); this.a(true, false, false);
} }

View File

@@ -1,9 +1,10 @@
package net.minecraft.server; package net.minecraft.server;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.googlecode.concurentlocks.ReentrantReadWriteUpdateLock; import com.googlecode.concurentlocks.ReentrantReadWriteUpdateLock;
import io.akarin.api.internal.utils.CheckedConcurrentLinkedQueue; import io.akarin.api.internal.utils.CheckedConcurrentLinkedQueue;
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
@@ -18,9 +19,9 @@ import io.netty.handler.timeout.TimeoutException;
import io.netty.util.AttributeKey; import io.netty.util.AttributeKey;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener; import io.netty.util.concurrent.GenericFutureListener;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@@ -29,7 +30,6 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager; import org.apache.logging.log4j.MarkerManager;
/** /**
* Akarin Changes Note * Akarin Changes Note
* 2) Expose private members (nsc) * 2) Expose private members (nsc)
@@ -47,7 +47,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build()); return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build());
} }
@Override
protected Object init() { protected Object init() {
return this.a(); return this.a();
} }
@@ -57,7 +56,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Client IO #%d").setDaemon(true).build()); return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Client IO #%d").setDaemon(true).build());
} }
@Override
protected Object init() { protected Object init() {
return this.a(); return this.a();
} }
@@ -67,7 +65,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build()); return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build());
} }
@Override
protected Object init() { protected Object init() {
return this.a(); return this.a();
} }
@@ -96,7 +93,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
this.h = enumprotocoldirection; this.h = enumprotocoldirection;
} }
@Override
public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception { public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception {
super.channelActive(channelhandlercontext); super.channelActive(channelhandlercontext);
this.channel = channelhandlercontext.channel(); this.channel = channelhandlercontext.channel();
@@ -119,13 +115,20 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
NetworkManager.g.debug("Enabled auto read"); NetworkManager.g.debug("Enabled auto read");
} }
@Override
public void channelInactive(ChannelHandlerContext channelhandlercontext) throws Exception { public void channelInactive(ChannelHandlerContext channelhandlercontext) throws Exception {
this.close(new ChatMessage("disconnect.endOfStream", new Object[0])); this.close(new ChatMessage("disconnect.endOfStream", new Object[0]));
} }
@Override
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) throws Exception { public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) throws Exception {
// Paper start
if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) {
if (((PacketEncoder.PacketTooLargeException) throwable.getCause()).getPacket().packetTooLarge(this)) {
return;
} else {
throwable = throwable.getCause();
}
}
// Paper end
ChatMessage chatmessage; ChatMessage chatmessage;
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
@@ -212,7 +215,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
channelfuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); channelfuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
} else { } else {
this.channel.eventLoop().execute(new Runnable() { this.channel.eventLoop().execute(new Runnable() {
@Override
public void run() { public void run() {
if (enumprotocol != enumprotocol1) { if (enumprotocol != enumprotocol1) {
NetworkManager.this.setProtocol(enumprotocol); NetworkManager.this.setProtocol(enumprotocol);
@@ -229,6 +231,15 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}); });
} }
// Paper start
java.util.List<Packet> extraPackets = packet.getExtraPackets();
if (extraPackets != null && !extraPackets.isEmpty()) {
for (Packet extraPacket : extraPackets) {
this.dispatchPacket(extraPacket, agenericfuturelistener);
}
}
// Paper end
} }
// Paper start - Async-Anti-Xray - Stop dispatching further packets and return false if the peeked packet is a chunk packet which is not ready // Paper start - Async-Anti-Xray - Stop dispatching further packets and return false if the peeked packet is a chunk packet which is not ready
@@ -363,7 +374,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} }
} }
@Override
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet object) throws Exception { // CraftBukkit - fix decompile error protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet object) throws Exception { // CraftBukkit - fix decompile error
// FlamePaper - Check if channel is opened before reading packet // FlamePaper - Check if channel is opened before reading packet
if (isConnected()) { if (isConnected()) {

View File

@@ -355,6 +355,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
// Paper start - Prevent moving into unloaded chunks
if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4, false)) {
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
}
// Paper end
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))) { // Spigot if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))) { // Spigot
// CraftBukkit end // CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
@@ -386,13 +393,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
entity.setLocation(d3, d4, d5, f, f1); entity.setLocation(d3, d4, d5, f, f1);
Location curPos = getPlayer().getLocation(); // Paper Location curPos = getPlayer().getLocation(); // Paper
player.setLocation(d3, d4, d5, f, f1); // Paper player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper
boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty(); boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty();
if (flag && (flag1 || !flag2)) { if (flag && (flag1 || !flag2)) {
entity.setLocation(d0, d1, d2, f, f1); entity.setLocation(d0, d1, d2, f, f1);
player.setLocation(d0, d1, d2, f, f1); // Paper player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return; return;
} }
@@ -552,9 +559,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
double d1 = this.player.locY; double d1 = this.player.locY;
double d2 = this.player.locZ; double d2 = this.player.locZ;
double d3 = this.player.locY; double d3 = this.player.locY;
double d4 = packetplayinflying.a(this.player.locX); double d4 = packetplayinflying.a(this.player.locX); double toX = d4; // Paper - OBFHELPER
double d5 = packetplayinflying.b(this.player.locY); double d5 = packetplayinflying.b(this.player.locY);
double d6 = packetplayinflying.c(this.player.locZ); double d6 = packetplayinflying.c(this.player.locZ); double toZ = d6; // Paper - OBFHELPER
float f = packetplayinflying.a(this.player.yaw); float f = packetplayinflying.a(this.player.yaw);
float f1 = packetplayinflying.b(this.player.pitch); float f1 = packetplayinflying.b(this.player.pitch);
double d7 = d4 - this.l; double d7 = d4 - this.l;
@@ -594,6 +601,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
speed = player.abilities.walkSpeed * 10f; speed = player.abilities.walkSpeed * 10f;
} }
// Paper start - Prevent moving into unloaded chunks
if (player.world.paperConfig.preventMovingIntoUnloadedChunks && (this.player.locX != toX || this.player.locZ != toZ) && !worldserver.isChunkLoaded((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4, false)) {
this.internalTeleport(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch, Collections.emptySet());
return;
}
// Paper end
if (!this.player.L() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cP())) { if (!this.player.L() && (!this.player.x().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.cP())) {
float f2 = this.player.cP() ? 300.0F : 100.0F; float f2 = this.player.cP() ? 300.0F : 100.0F;
@@ -1695,7 +1709,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
// Refresh the current entity metadata // Refresh the current entity metadata
this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); entity.tracker.broadcast(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); // Paper - update entity for all players
} }
if (event.isCancelled()) { if (event.isCancelled()) {
@@ -2232,7 +2246,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
TileEntitySign tileentitysign = (TileEntitySign) tileentity; TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.a() || tileentitysign.e() != this.player) { if (!tileentitysign.a() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) { // Paper
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
return; return;
@@ -2248,6 +2262,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
String[] lines = new String[4]; String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) { for (int i = 0; i < astring.length; ++i) {
// Paper start - cap line length - modified clients can send longer data than normal
if (astring[i].length() > TileEntitySign.MAX_SIGN_LINE_LENGTH && TileEntitySign.MAX_SIGN_LINE_LENGTH > 0) {
int offset = astring[i].codePoints().limit(TileEntitySign.MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
if (offset > astring.length) {
astring[i] = astring[i].substring(0, offset);
}
}
// Paper end
lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
} }
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
@@ -2350,6 +2372,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.a(packetplayinsettings); this.player.a(packetplayinsettings);
} }
// Paper start
private boolean validateBook(ItemStack testStack) {
NBTTagList pageList = testStack.getTag().getList("pages", 8);
long byteTotal = 0;
int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
long byteAllowed = maxBookPageSize;
for (int i = 0; i < pageList.size(); ++i) {
String testString = pageList.getString(i);
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
byteTotal += byteLength;
int length = testString.length();
int multibytes = 0;
if (length != byteLength) {
for (char c : testString.toCharArray()) {
if (c > 127) {
multibytes++;
}
}
}
byteAllowed += (maxBookPageSize * Math.min(1, Math.max(0.1D, (double) length / 255D))) * multiplier;
if (multibytes > 1) {
// penalize MB
byteAllowed -= multibytes;
}
}
if (byteTotal > byteAllowed) {
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
minecraftServer.postToMainThread(() -> this.disconnect("Book too large!"));
return false;
}
return true;
}
// Paper end
public void a(PacketPlayInCustomPayload packetplayincustompayload) { public void a(PacketPlayInCustomPayload packetplayincustompayload) {
PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x()); PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x());
String s = packetplayincustompayload.a(); String s = packetplayincustompayload.a();
@@ -2383,6 +2444,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
if (!validateBook(itemstack)) return; // Paper
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
} }
@@ -2418,6 +2480,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
} }
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
if (!validateBook(itemstack)) return; // Paper
ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK); ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK);
itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName()))); itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName())));

View File

@@ -71,7 +71,7 @@ public abstract class PlayerList {
// private final Map<UUID, AdvancementDataPlayer> p; // private final Map<UUID, AdvancementDataPlayer> p;
// CraftBukkit end // CraftBukkit end
public IPlayerFileData playerFileData; public IPlayerFileData playerFileData;
private boolean hasWhitelist; //private boolean hasWhitelist; // Paper - moved to whitelist object so not duplicated
protected int maxPlayers; protected int maxPlayers;
private int s; private int s;
private EnumGamemode t; private EnumGamemode t;
@@ -1241,9 +1241,9 @@ public abstract class PlayerList {
} }
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile); boolean isOp = this.operators.d(gameprofile);
boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile); boolean isWhitelisted = !this.getHasWhitelist() || isOp || this.whitelist.d(gameprofile);
final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event; final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.getHasWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
event.callEvent(); event.callEvent();
if (!event.isWhitelisted()) { if (!event.isWhitelisted()) {
if (loginEvent != null) { if (loginEvent != null) {
@@ -1392,11 +1392,11 @@ public abstract class PlayerList {
} }
public boolean getHasWhitelist() { public boolean getHasWhitelist() {
return this.hasWhitelist; return this.whitelist.isEnabled(); // Paper
} }
public void setHasWhitelist(boolean flag) { public void setHasWhitelist(boolean flag) {
this.hasWhitelist = flag; this.whitelist.setEnabled(flag); // Paper
} }
public List<EntityPlayer> b(String s) { public List<EntityPlayer> b(String s) {

View File

@@ -936,7 +936,8 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(vec3d.y); int i1 = MathHelper.floor(vec3d.y);
int j1 = MathHelper.floor(vec3d.z); int j1 = MathHelper.floor(vec3d.z);
BlockPosition blockposition = new BlockPosition(l, i1, j1); BlockPosition blockposition = new BlockPosition(l, i1, j1);
IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata = this.getTypeIfLoaded(blockposition); // Paper
if (iblockdata == null) return null; // Paper
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
if ((!flag1 || iblockdata.d(this, blockposition) != Block.k) && block.a(iblockdata, flag)) { if ((!flag1 || iblockdata.d(this, blockposition) != Block.k) && block.a(iblockdata, flag)) {
@@ -1038,7 +1039,8 @@ public abstract class World implements IBlockAccess {
i1 = MathHelper.floor(vec3d.y) - (enumdirection == EnumDirection.UP ? 1 : 0); i1 = MathHelper.floor(vec3d.y) - (enumdirection == EnumDirection.UP ? 1 : 0);
j1 = MathHelper.floor(vec3d.z) - (enumdirection == EnumDirection.SOUTH ? 1 : 0); j1 = MathHelper.floor(vec3d.z) - (enumdirection == EnumDirection.SOUTH ? 1 : 0);
blockposition = new BlockPosition(l, i1, j1); blockposition = new BlockPosition(l, i1, j1);
IBlockData iblockdata1 = this.getType(blockposition); IBlockData iblockdata1 = this.getTypeIfLoaded(blockposition); // Paper
if (iblockdata1 == null) return null; // Paper
Block block1 = iblockdata1.getBlock(); Block block1 = iblockdata1.getBlock();
if (!flag1 || iblockdata1.getMaterial() == Material.PORTAL || iblockdata1.d(this, blockposition) != Block.k) { if (!flag1 || iblockdata1.getMaterial() == Material.PORTAL || iblockdata1.d(this, blockposition) != Block.k) {

View File

@@ -337,7 +337,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.methodProfiler.c("village"); this.methodProfiler.c("village");
timings.doVillages.startTiming(); // Spigot timings.doVillages.startTiming(); // Spigot
this.villages.tick(); this.villages.tick();
this.siegeManager.a(); if (paperConfig.villageSiegesEnabled) { this.siegeManager.a(); } // Paper - Allow disabling village sieges
timings.doVillages.stopTiming(); // Spigot timings.doVillages.stopTiming(); // Spigot
this.methodProfiler.c("portalForcer"); this.methodProfiler.c("portalForcer");
timings.doPortalForcer.startTiming(); // Spigot timings.doPortalForcer.startTiming(); // Spigot

View File

@@ -1781,7 +1781,7 @@ public final class CraftServer implements Server {
ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf)); ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
ByteBuf bytebuf1 = Base64.encode(bytebuf); ByteBuf bytebuf1 = Base64.encode(bytebuf);
return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8)); return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients
} }
@Override @Override