Compare commits

1 Commits

Author SHA1 Message Date
dependabot[bot]
8a0951bd4c Bump mysql-connector-java from 5.1.45 to 8.0.28 in /sources
Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.45 to 8.0.28.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/5.1.45...8.0.28)

---
updated-dependencies:
- dependency-name: mysql:mysql-connector-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-28 06:20:18 +00:00
10 changed files with 32 additions and 133 deletions

View File

@@ -66,7 +66,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
<version>8.0.28</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -144,7 +144,7 @@
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>mixin</artifactId>
<version>0.8.3-SNAPSHOT</version>
<version>0.7.11-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.concurrent-locks</groupId>

View File

@@ -1,16 +1,11 @@
package net.minecraft.server;
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.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import java.util.concurrent.ConcurrentLinkedQueue; // Paper
import org.apache.logging.log4j.LogManager;
@@ -94,22 +89,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
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
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)) {
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j));
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;
}
@Nullable Entity getVehicleDirect() { return this.bJ(); } // Paper - OBFHELPER
@Nullable
public Entity bJ() {
return this.au;
}

View File

@@ -1096,13 +1096,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void s() {
this.cu = true;
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) {
this.a(true, false, false);
}

View File

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

View File

@@ -355,13 +355,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
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
// CraftBukkit end
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
@@ -393,13 +386,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
entity.setLocation(d3, d4, d5, f, f1);
Location curPos = getPlayer().getLocation(); // Paper
player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper
Location curPos = getPlayer().getLocation(); // Paper
player.setLocation(d3, d4, d5, f, f1); // Paper
boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D)).isEmpty();
if (flag && (flag1 || !flag2)) {
entity.setLocation(d0, d1, d2, f, f1);
player.setLocation(d3, d4, d5, player.yaw, player.pitch); // CraftBukkit // Paper
player.setLocation(d0, d1, d2, f, f1); // Paper
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
}
@@ -559,9 +552,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
double d1 = this.player.locY;
double d2 = this.player.locZ;
double d3 = this.player.locY;
double d4 = packetplayinflying.a(this.player.locX); double toX = d4; // Paper - OBFHELPER
double d4 = packetplayinflying.a(this.player.locX);
double d5 = packetplayinflying.b(this.player.locY);
double d6 = packetplayinflying.c(this.player.locZ); double toZ = d6; // Paper - OBFHELPER
double d6 = packetplayinflying.c(this.player.locZ);
float f = packetplayinflying.a(this.player.yaw);
float f1 = packetplayinflying.b(this.player.pitch);
double d7 = d4 - this.l;
@@ -601,13 +594,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
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())) {
float f2 = this.player.cP() ? 300.0F : 100.0F;
@@ -1709,7 +1695,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
// Refresh the current entity metadata
entity.tracker.broadcast(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); // Paper - update entity for all players
this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
}
if (event.isCancelled()) {
@@ -2246,7 +2232,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.a() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) { // Paper
if (!tileentitysign.a() || tileentitysign.e() != this.player) {
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
return;
@@ -2262,14 +2248,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
String[] lines = new String[4];
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.
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
@@ -2372,45 +2350,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
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) {
PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x());
String s = packetplayincustompayload.a();
@@ -2444,7 +2383,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
if (!validateBook(itemstack)) return; // Paper
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
}
@@ -2480,7 +2418,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
if (!validateBook(itemstack)) return; // Paper
ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK);
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;
// CraftBukkit end
public IPlayerFileData playerFileData;
//private boolean hasWhitelist; // Paper - moved to whitelist object so not duplicated
private boolean hasWhitelist;
protected int maxPlayers;
private int s;
private EnumGamemode t;
@@ -1241,9 +1241,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);
boolean isWhitelisted = !this.getHasWhitelist() || isOp || this.whitelist.d(gameprofile);
boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile);
final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.getHasWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
event.callEvent();
if (!event.isWhitelisted()) {
if (loginEvent != null) {
@@ -1392,11 +1392,11 @@ public abstract class PlayerList {
}
public boolean getHasWhitelist() {
return this.whitelist.isEnabled(); // Paper
return this.hasWhitelist;
}
public void setHasWhitelist(boolean flag) {
this.whitelist.setEnabled(flag); // Paper
this.hasWhitelist = flag;
}
public List<EntityPlayer> b(String s) {

View File

@@ -936,8 +936,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(vec3d.y);
int j1 = MathHelper.floor(vec3d.z);
BlockPosition blockposition = new BlockPosition(l, i1, j1);
IBlockData iblockdata = this.getTypeIfLoaded(blockposition); // Paper
if (iblockdata == null) return null; // Paper
IBlockData iblockdata = this.getType(blockposition);
Block block = iblockdata.getBlock();
if ((!flag1 || iblockdata.d(this, blockposition) != Block.k) && block.a(iblockdata, flag)) {
@@ -1039,8 +1038,7 @@ public abstract class World implements IBlockAccess {
i1 = MathHelper.floor(vec3d.y) - (enumdirection == EnumDirection.UP ? 1 : 0);
j1 = MathHelper.floor(vec3d.z) - (enumdirection == EnumDirection.SOUTH ? 1 : 0);
blockposition = new BlockPosition(l, i1, j1);
IBlockData iblockdata1 = this.getTypeIfLoaded(blockposition); // Paper
if (iblockdata1 == null) return null; // Paper
IBlockData iblockdata1 = this.getType(blockposition);
Block block1 = iblockdata1.getBlock();
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");
timings.doVillages.startTiming(); // Spigot
this.villages.tick();
if (paperConfig.villageSiegesEnabled) { this.siegeManager.a(); } // Paper - Allow disabling village sieges
this.siegeManager.a();
timings.doVillages.stopTiming(); // Spigot
this.methodProfiler.c("portalForcer");
timings.doPortalForcer.startTiming(); // Spigot

View File

@@ -1781,7 +1781,7 @@ public final class CraftServer implements Server {
ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
ByteBuf bytebuf1 = Base64.encode(bytebuf);
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
return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}
@Override