Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Fix PS compatibility on Java 16
Dieser Commit ist enthalten in:
Ursprung
1538ff5201
Commit
4f9f3254be
@ -21,6 +21,8 @@ import com.viaversion.viaversion.ViaVersionPlugin;
|
||||
import com.viaversion.viaversion.bukkit.handlers.BukkitDecodeHandler;
|
||||
import com.viaversion.viaversion.bukkit.handlers.BukkitEncodeHandler;
|
||||
import com.viaversion.viaversion.bukkit.util.NMSUtil;
|
||||
import com.viaversion.viaversion.classgenerator.generated.BasicHandlerConstructor;
|
||||
import com.viaversion.viaversion.classgenerator.generated.HandlerConstructor;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
@ -144,7 +146,7 @@ public class ClassGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
return generated.toClass(HandlerConstructor.class.getClassLoader());
|
||||
return generated.toClass(HandlerConstructor.class);
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CannotCompileException e) {
|
||||
@ -153,7 +155,7 @@ public class ClassGenerator {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Class addPSCompatibility(ClassPool pool, Class input, Class superclass) {
|
||||
private static void addPSCompatibility(ClassPool pool, Class input, Class superclass) {
|
||||
boolean newPS = getOldPSPackage().equals("unknown");
|
||||
String newName = "com.viaversion.viaversion.classgenerator.generated." + input.getSimpleName();
|
||||
|
||||
@ -193,13 +195,12 @@ public class ClassGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
return generated.toClass(HandlerConstructor.class.getClassLoader());
|
||||
generated.toClass(HandlerConstructor.class);
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CannotCompileException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Class makePSConnectListener(ClassPool pool, boolean newVersionMethod) {
|
||||
@ -247,7 +248,7 @@ public class ClassGenerator {
|
||||
// In any case, remove the packet listener and wrap up.
|
||||
+ " connection.removePacketListener(this);\n"
|
||||
+ "}", connectListenerClazz));
|
||||
return connectListenerClazz.toClass(HandlerConstructor.class.getClassLoader());
|
||||
return connectListenerClazz.toClass(HandlerConstructor.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package com.viaversion.viaversion.bukkit.handlers;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.bukkit.classgenerator.ClassGenerator;
|
||||
import com.viaversion.viaversion.bukkit.classgenerator.HandlerConstructor;
|
||||
import com.viaversion.viaversion.classgenerator.generated.HandlerConstructor;
|
||||
import com.viaversion.viaversion.connection.UserConnectionImpl;
|
||||
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||
import io.netty.channel.Channel;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.bukkit.classgenerator;
|
||||
package com.viaversion.viaversion.classgenerator.generated;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.bukkit.handlers.BukkitDecodeHandler;
|
@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.bukkit.classgenerator;
|
||||
package com.viaversion.viaversion.classgenerator.generated;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -79,17 +77,7 @@ public class ConcurrentList<E> extends ArrayList<E> {
|
||||
@Override
|
||||
public Object clone() {
|
||||
synchronized (lock) {
|
||||
try {
|
||||
ConcurrentList<E> clist = (ConcurrentList<E>) super.clone();
|
||||
clist.modCount = 0;
|
||||
Field f = ArrayList.class.getDeclaredField("elementData");
|
||||
f.setAccessible(true);
|
||||
f.set(clist, Arrays.copyOf((Object[]) f.get(this), this.size()));
|
||||
|
||||
return clist;
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return super.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ adventure = "4.7.0"
|
||||
gson = "2.8.6"
|
||||
fastutil = "8.3.1"
|
||||
openNBT = "2.0-SNAPSHOT"
|
||||
javassist = "3.27.0-GA"
|
||||
javassist = "3.28.0-GA"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren