@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/NetworkManager.java
|
||||
+++ b/net/minecraft/server/NetworkManager.java
|
||||
@@ -127,7 +127,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void a(Packet<T> packet, PacketListener packetlistener) {
|
||||
- packet.a(packetlistener);
|
||||
+ packet.a((T) packetlistener); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void setPacketListener(PacketListener packetlistener) {
|
||||
@@ -237,7 +237,7 @@
|
||||
|
||||
public void close(IChatBaseComponent ichatbasecomponent) {
|
||||
if (this.channel.isOpen()) {
|
||||
- this.channel.close().awaitUninterruptibly();
|
||||
+ this.channel.close(); // We can't wait as this may be called from an event loop.
|
||||
this.m = ichatbasecomponent;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
--- a/net/minecraft/server/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/server/PacketDataSerializer.java
|
||||
@@ -26,6 +26,8 @@
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
+
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
private final ByteBuf a;
|
||||
@@ -154,7 +156,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T a(Class<T> oclass) {
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.i()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.i()]; // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(Enum<?> oenum) {
|
||||
@@ -231,7 +233,7 @@
|
||||
} else {
|
||||
try {
|
||||
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
- } catch (IOException ioexception) {
|
||||
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -268,7 +270,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(ItemStack itemstack) {
|
||||
- if (itemstack.isEmpty()) {
|
||||
+ if (itemstack.isEmpty() || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -297,6 +299,11 @@
|
||||
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
|
||||
|
||||
itemstack.setTag(this.l());
|
||||
+ // CraftBukkit start
|
||||
+ if (itemstack.getTag() != null) {
|
||||
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
--- a/net/minecraft/server/ChatHexColor.java
|
||||
+++ b/net/minecraft/server/ChatHexColor.java
|
||||
@@ -10,7 +10,7 @@
|
||||
public final class ChatHexColor {
|
||||
|
||||
private static final Map<EnumChatFormat, ChatHexColor> a = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
- return new ChatHexColor(enumchatformat.e(), enumchatformat.f());
|
||||
+ return new ChatHexColor(enumchatformat.e(), enumchatformat.f(), enumchatformat); // CraftBukkit
|
||||
}));
|
||||
private static final Map<String, ChatHexColor> b = (Map) ChatHexColor.a.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
return chathexcolor.name;
|
||||
@@ -18,16 +18,22 @@
|
||||
private final int rgb;
|
||||
@Nullable
|
||||
public final String name;
|
||||
+ // CraftBukkit start
|
||||
+ @Nullable
|
||||
+ public final EnumChatFormat format;
|
||||
|
||||
- private ChatHexColor(int i, String s) {
|
||||
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
|
||||
this.rgb = i;
|
||||
this.name = s;
|
||||
+ this.format = format;
|
||||
}
|
||||
|
||||
private ChatHexColor(int i) {
|
||||
this.rgb = i;
|
||||
this.name = null;
|
||||
+ this.format = null;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public String b() {
|
||||
return this.name != null ? this.name : this.c();
|
||||
@@ -0,0 +1,23 @@
|
||||
--- a/net/minecraft/server/ChatModifier.java
|
||||
+++ b/net/minecraft/server/ChatModifier.java
|
||||
@@ -114,6 +114,20 @@
|
||||
return new ChatModifier(this.color, this.bold, obool, this.underlined, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public ChatModifier setStrikethrough(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, obool, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setUnderline(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, obool, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setRandom(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, obool, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ChatModifier setChatClickable(@Nullable ChatClickable chatclickable) {
|
||||
return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, this.obfuscated, chatclickable, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
--- a/net/minecraft/server/IChatBaseComponent.java
|
||||
+++ b/net/minecraft/server/IChatBaseComponent.java
|
||||
@@ -23,7 +23,23 @@
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
-public interface IChatBaseComponent extends Message, IChatFormatted {
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.collect.Streams;
|
||||
+import java.util.stream.Stream;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IChatBaseComponent> { // CraftBukkit
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ default Stream<IChatBaseComponent> stream() {
|
||||
+ return Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default Iterator<IChatBaseComponent> iterator() {
|
||||
+ return this.stream().iterator();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
ChatModifier getChatModifier();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/net/minecraft/server/PlayerConnectionUtils.java
|
||||
+++ b/net/minecraft/server/PlayerConnectionUtils.java
|
||||
@@ -14,6 +14,7 @@
|
||||
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isMainThread()) {
|
||||
iasynctaskhandler.execute(() -> {
|
||||
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (t0.a().isConnected()) {
|
||||
packet.a(t0);
|
||||
} else {
|
||||
@@ -22,6 +23,10 @@
|
||||
|
||||
});
|
||||
throw CancelledPacketHandleException.INSTANCE;
|
||||
+ // CraftBukkit start - SPIGOT-5477, MC-142590
|
||||
+ } else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) {
|
||||
+ throw CancelledPacketHandleException.INSTANCE;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/server/PacketPlayInCloseWindow.java
|
||||
+++ b/net/minecraft/server/PacketPlayInCloseWindow.java
|
||||
@@ -8,6 +8,12 @@
|
||||
|
||||
public PacketPlayInCloseWindow() {}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public PacketPlayInCloseWindow(int id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(PacketListenerPlayIn packetlistenerplayin) {
|
||||
packetlistenerplayin.a(this);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
||||
+++ b/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
||||
@@ -24,7 +24,7 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.b[i] = short0;
|
||||
- this.c[i] = chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0));
|
||||
+ this.c[i] = (chunksection != null) ? chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0)) : Blocks.AIR.getBlockData(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/server/PacketPlayOutWorldBorder.java
|
||||
+++ b/net/minecraft/server/PacketPlayOutWorldBorder.java
|
||||
@@ -18,8 +18,10 @@
|
||||
|
||||
public PacketPlayOutWorldBorder(WorldBorder worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction packetplayoutworldborder_enumworldborderaction) {
|
||||
this.a = packetplayoutworldborder_enumworldborderaction;
|
||||
- this.c = worldborder.getCenterX();
|
||||
- this.d = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.c = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.d = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ // CraftBukkit end
|
||||
this.f = worldborder.getSize();
|
||||
this.e = worldborder.k();
|
||||
this.g = worldborder.j();
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/server/DataWatcher.java
|
||||
+++ b/net/minecraft/server/DataWatcher.java
|
||||
@@ -129,6 +129,13 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - add method from above
|
||||
+ public <T> void markDirty(DataWatcherObject<T> datawatcherobject) {
|
||||
+ this.b(datawatcherobject).a(true);
|
||||
+ this.g = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean a() {
|
||||
return this.g;
|
||||
}
|
||||
Reference in New Issue
Block a user