Skip to content

Commit fa317c1

Browse files
committed
Working on live server
1 parent cc17b9e commit fa317c1

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.comphenix.protocol</groupId>
55
<artifactId>ProtocolLib</artifactId>
66
<name>ProtocolLib</name>
7-
<version>4.6.1-SNAPSHOT</version>
7+
<version>4.7.0-SNAPSHOT</version>
88

99
<description>Provides read/write access to the Minecraft protocol.</description>
1010
<url>https://github.com/dmulloy2/ProtocolLib</url>

src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -222,30 +222,34 @@ public static String getMinecraftPackage() {
222222
Class<?> craftEntity = getCraftEntityClass();
223223
Method getHandle = craftEntity.getMethod("getHandle");
224224

225-
MINECRAFT_FULL_PACKAGE = getPackage(getHandle.getReturnType().getCanonicalName());
226-
227-
// Pretty important invariantt
228-
if (!MINECRAFT_FULL_PACKAGE.startsWith(MINECRAFT_PREFIX_PACKAGE)) {
229-
// See if we got the Forge entity package
230-
if (MINECRAFT_FULL_PACKAGE.equals(FORGE_ENTITY_PACKAGE)) {
231-
// USe the standard NMS versioned package
232-
MINECRAFT_FULL_PACKAGE = CachedPackage.combine(MINECRAFT_PREFIX_PACKAGE, packageVersion);
225+
if (MinecraftVersion.CAVES_CLIFFS_1.atOrAbove()) {
226+
// total rework of the NMS structure in 1.17 (at least there's no versioning)
227+
MINECRAFT_FULL_PACKAGE = MINECRAFT_PREFIX_PACKAGE = "net.minecraft";
228+
} else {
229+
MINECRAFT_FULL_PACKAGE = getPackage(getHandle.getReturnType().getCanonicalName());
230+
231+
// Pretty important invariantt
232+
if (!MINECRAFT_FULL_PACKAGE.startsWith(MINECRAFT_PREFIX_PACKAGE)) {
233+
// See if we got the Forge entity package
234+
if (MINECRAFT_FULL_PACKAGE.equals(FORGE_ENTITY_PACKAGE)) {
235+
// USe the standard NMS versioned package
236+
MINECRAFT_FULL_PACKAGE = CachedPackage.combine(MINECRAFT_PREFIX_PACKAGE, packageVersion);
237+
} else {
238+
// Assume they're the same instead
239+
MINECRAFT_PREFIX_PACKAGE = MINECRAFT_FULL_PACKAGE;
240+
}
241+
242+
// The package is usualy flat, so go with that assumption
243+
String matcher =
244+
(MINECRAFT_PREFIX_PACKAGE.length() > 0 ? Pattern.quote(MINECRAFT_PREFIX_PACKAGE + ".") : "") + CANONICAL_REGEX;
245+
246+
// We'll still accept the default location, however
247+
setDynamicPackageMatcher("(" + matcher + ")|(" + MINECRAFT_OBJECT + ")");
248+
233249
} else {
234-
// Assume they're the same instead
235-
MINECRAFT_PREFIX_PACKAGE = MINECRAFT_FULL_PACKAGE;
250+
// Use the standard matcher
251+
setDynamicPackageMatcher(MINECRAFT_OBJECT);
236252
}
237-
238-
// The package is usualy flat, so go with that assumption
239-
String matcher =
240-
(MINECRAFT_PREFIX_PACKAGE.length() > 0 ?
241-
Pattern.quote(MINECRAFT_PREFIX_PACKAGE + ".") : "") + CANONICAL_REGEX;
242-
243-
// We'll still accept the default location, however
244-
setDynamicPackageMatcher("(" + matcher + ")|(" + MINECRAFT_OBJECT + ")");
245-
246-
} else {
247-
// Use the standard matcher
248-
setDynamicPackageMatcher(MINECRAFT_OBJECT);
249253
}
250254

251255
return MINECRAFT_FULL_PACKAGE;
@@ -752,7 +756,9 @@ public static Class<?> getByteBufClass() {
752756
* @return The Enum protocol class.
753757
*/
754758
public static Class<?> getEnumProtocolClass() {
755-
try {
759+
return getMinecraftClass("network.EnumProtocol", "EnumProtocol");
760+
761+
/* try {
756762
return getMinecraftClass("network.EnumProtocol", "EnumProtocol");
757763
} catch (RuntimeException e) {
758764
Method protocolMethod = FuzzyReflection.fromClass(getNetworkManagerClass()).getMethod(
@@ -762,7 +768,7 @@ public static Class<?> getEnumProtocolClass() {
762768
build()
763769
);
764770
return setMinecraftClass("EnumProtocol", protocolMethod.getParameterTypes()[0]);
765-
}
771+
} */
766772
}
767773

768774
/**

0 commit comments

Comments
 (0)