mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-15 23:06:01 +01:00
Report correct unknown type ID, also point people to entity metadata rewrite config
Bungee works around mojang adding a metatype to the middle of the list of ids by decrementing the type ID, which results in the incorrect value being shown in server logs. Also, if we see this exception, we'll point people to the configuration option to disable this system.
This commit is contained in:
parent
872b8619cb
commit
a218f5750f
@ -1,4 +1,4 @@
|
||||
From 1fa3aa755a785e79dfdd5da526658f4f1ff6dc1e Mon Sep 17 00:00:00 2001
|
||||
From 30dfafedb513a62703ceb09ee107372b7e38437b Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 03:35:21 +0000
|
||||
Subject: [PATCH] Provide an option to disable entity metadata rewriting
|
||||
@ -26,7 +26,7 @@ index a8705438..ab289e72 100644
|
||||
+ boolean isDisableEntityMetadataRewrite();
|
||||
}
|
||||
diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
||||
index f28f0111..76967fb6 100644
|
||||
index f28f0111..41a71f65 100644
|
||||
--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
||||
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
||||
@@ -53,6 +53,8 @@ public class WaterfallConfiguration extends Configuration {
|
||||
@ -38,20 +38,15 @@ index f28f0111..76967fb6 100644
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
@@ -65,6 +67,12 @@ public class WaterfallConfiguration extends Configuration {
|
||||
@@ -65,6 +67,7 @@ public class WaterfallConfiguration extends Configuration {
|
||||
tabThrottle = config.getInt("throttling.tab_complete", tabThrottle);
|
||||
disableModernTabLimiter = config.getBoolean("disable_modern_tab_limiter", disableModernTabLimiter);
|
||||
allowEmptyPackets = config.getBoolean("allow_empty_packets", allowEmptyPackets);
|
||||
+ disableEntityMetadataRewrite = config.getBoolean("disable_entity_metadata_rewrite", disableEntityMetadataRewrite);
|
||||
+ // We're exposing this as a property to bypass the fact that we can't pass this to UserConnection, might as well...
|
||||
+ if (disableEntityMetadataRewrite || System.getProperty("waterfall.disable_entity_metadata") != null) {
|
||||
+ disableEntityMetadataRewrite = true;
|
||||
+ System.setProperty("waterfall.disable_entity_metadata", "true");
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,4 +104,9 @@ public class WaterfallConfiguration extends Configuration {
|
||||
@@ -96,4 +99,9 @@ public class WaterfallConfiguration extends Configuration {
|
||||
public boolean isAllowEmptyPackets() {
|
||||
return allowEmptyPackets;
|
||||
}
|
||||
@ -120,17 +115,39 @@ index c7f081d4..110ac496 100644
|
||||
user.setDimension( login.getDimension() );
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
index 9c872a1c..a12fec7f 100644
|
||||
index 9c872a1c..8a524a64 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
@@ -730,4 +730,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@@ -145,6 +145,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Setter
|
||||
private ForgeServerHandler forgeServerHandler;
|
||||
/*========================================================================*/
|
||||
+ private boolean disableEntityMetadaRewrite;
|
||||
private final Unsafe unsafe = new Unsafe()
|
||||
{
|
||||
@Override
|
||||
@@ -156,6 +157,13 @@ public final class UserConnection implements ProxiedPlayer
|
||||
|
||||
public void init()
|
||||
{
|
||||
+ // Waterfall start
|
||||
+ disableEntityMetadaRewrite = bungee.getConfig().isDisableEntityMetadataRewrite();
|
||||
+ if ( disableEntityMetadaRewrite )
|
||||
+ {
|
||||
+ entityRewrite = net.md_5.bungee.entitymap.EntityMap_Dummy.INSTANCE;
|
||||
+ } else
|
||||
+ // Waterfall end
|
||||
this.entityRewrite = EntityMap.getEntityMap( getPendingConnection().getVersion() );
|
||||
|
||||
this.displayName = name;
|
||||
@@ -730,4 +738,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
{
|
||||
return serverSentScoreboard;
|
||||
}
|
||||
+
|
||||
+ // Waterfall start
|
||||
+ public boolean isDisableEntityMetadataRewrite() {
|
||||
+ return entityRewrite == net.md_5.bungee.entitymap.EntityMap_Dummy.INSTANCE;
|
||||
+ return disableEntityMetadaRewrite;
|
||||
+ }
|
||||
+ // Waterfall end
|
||||
}
|
||||
@ -155,21 +172,24 @@ index f635a7e4..c1dc6489 100644
|
||||
}
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
index 994670cd..4d8c665d 100644
|
||||
index 994670cd..e14b72db 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
|
||||
@@ -27,6 +27,11 @@ public abstract class EntityMap
|
||||
// Returns the correct entity map for the protocol version
|
||||
public static EntityMap getEntityMap(int version)
|
||||
{
|
||||
+ // Waterfall start
|
||||
+ if (System.getProperty("waterfall.disable_entity_metadata") != null) {
|
||||
+ return EntityMap_Dummy.INSTANCE;
|
||||
@@ -233,7 +233,13 @@ public abstract class EntityMap
|
||||
}
|
||||
break;
|
||||
default:
|
||||
- throw new IllegalArgumentException( "Unknown meta type " + type );
|
||||
+ // Waterfall start - Don't lie
|
||||
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
|
||||
+ {
|
||||
+ type++;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException( "Unknown meta type " + type + ": Using mods? refer to disable_entity_metadata_rewrite in waterfall.yml" );
|
||||
+ // Waterfall end
|
||||
switch ( version )
|
||||
{
|
||||
case ProtocolConstants.MINECRAFT_1_8:
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_Dummy.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_Dummy.java
|
||||
new file mode 100644
|
||||
index 00000000..cb81d1dd
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 3f3c2f958efa77486d3163fbf7b5b7f058d8f08c Mon Sep 17 00:00:00 2001
|
||||
From 7960a4c2a4959570f74e1c931b1d0332a4cd8259 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Tue, 26 Feb 2019 20:15:54 +0000
|
||||
Subject: [PATCH] Handle empty minecraft packets
|
||||
@ -46,10 +46,10 @@ index 9e9ea49c..a46bbc78 100644
|
||||
packetTypeInfo = packetId;
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
index a12fec7f..ade817e9 100644
|
||||
index 8a524a64..e649678e 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
@@ -343,7 +343,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@@ -351,7 +351,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
protected void initChannel(Channel ch) throws Exception
|
||||
{
|
||||
PipelineUtils.BASE.initChannel( ch );
|
||||
|
Loading…
Reference in New Issue
Block a user