paper is fighting me

This commit is contained in:
Telesphoreo 2023-12-10 13:12:22 -06:00
parent 569338c315
commit 747552d1a2
6 changed files with 35 additions and 30 deletions

2
.gitignore vendored
View File

@ -50,3 +50,5 @@ Scissors-Server
Scissors-API Scissors-API
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
paper-api-generator

View File

@ -8,3 +8,5 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net/minecraft/network/chat/HoverEvent

View File

@ -65,6 +65,15 @@ paperweight {
serverPatchDir.set(layout.projectDirectory.dir("patches/server")) serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Scissors-Server")) serverOutputDir.set(layout.projectDirectory.dir("Scissors-Server"))
patchTasks {
register("generatedApi") {
isBareDirectory.set(true)
upstreamDirPath.set("paper-api-generator/generated")
patchDir.set(layout.projectDirectory.dir("patches/generatedApi"))
outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated"))
}
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

14
gradlew vendored
View File

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com> From: Telesphoreo <me@telesphoreo.me>
Date: Sat, 12 Mar 2022 19:34:59 -0700 Date: Sun, 10 Dec 2023 13:11:22 -0600
Subject: [PATCH] UUID validation Subject: [PATCH] UUID validation
@ -22,26 +22,18 @@ index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b
// Paper end // Paper end
String string = nbt.getString("Name"); String string = nbt.getString("Name");
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644 index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java --- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java +++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -174,7 +174,14 @@ public class HoverEvent { @@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
} else { import net.minecraft.nbt.TagParser;
JsonObject jsonObject = json.getAsJsonObject(); import net.minecraft.resources.ResourceLocation;
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type"))); import net.minecraft.util.ExtraCodecs;
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id")); +import net.minecraft.util.GsonHelper;
+ // Scissors start import net.minecraft.util.StringRepresentable;
+ UUID uUID; import net.minecraft.world.entity.EntityType;
+ try { import net.minecraft.world.item.Item;
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id")); @@ -161,7 +162,14 @@ public class HoverEvent {
+ } catch (Exception ex) {
+ return null;
+ }
+ // Scissors end
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
}
@@ -186,7 +193,14 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString()); CompoundTag compoundTag = TagParser.parseTag(text.getString());
Component component = Component.Serializer.fromJson(compoundTag.getString("name")); Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type"))); EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
@ -54,6 +46,6 @@ index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d
+ return null; + return null;
+ } + }
+ // Scissors end + // Scissors end
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component); return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
} catch (Exception var5) { } catch (Exception var5) {
return null; return DataResult.error(() -> {