Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58e39bc650 | ||
|
|
d456e7a116 | ||
|
|
d547242824 |
2
.github/workflows/pr-build.yml
vendored
2
.github/workflows/pr-build.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java: [21]
|
||||
java: [17]
|
||||
fail-fast: true
|
||||
|
||||
steps:
|
||||
|
||||
4
.github/workflows/push-build.yml
vendored
4
.github/workflows/push-build.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java: [21]
|
||||
java: [17]
|
||||
fail-fast: true
|
||||
|
||||
steps:
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
./gradlew applyPatches
|
||||
./gradlew createMojmapBundlerJar
|
||||
./gradlew createReobfPaperclipJar
|
||||
./gradlew :parchment-api:publishMavenPublicationToEdenSnapshotsRepository
|
||||
./gradlew publishDevBundlePublicationToEdenSnapshotsRepository -PpublishDevBundle
|
||||
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -49,7 +49,6 @@ run/
|
||||
/parchment-server/
|
||||
/Parchment-API/
|
||||
/parchment-api/
|
||||
/paper-api-generator/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
@@ -75,3 +74,4 @@ run/
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# You can use this file to import files from minecraft libraries into the project
|
||||
# format:
|
||||
# <artifactId> <fileName>
|
||||
# both fully qualified and a file based syntax are accepted for <fileName>:
|
||||
# authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||
# datafixerupper com.mojang.datafixers.DataFixerBuilder
|
||||
# datafixerupper com/mojang/datafixers/util/Either.java
|
||||
# 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/LevelEntityGetter.java
|
||||
4
build-data/mcdev-imports.txt
Normal file
4
build-data/mcdev-imports.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
# You can use this file to import files from vanilla into the project
|
||||
# both fully qualified and a file based syntax are accepted here:
|
||||
# net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
@@ -4,19 +4,19 @@ plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.7.1"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.3"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/") {
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
content { onlyForConfigurations(PAPERCLIP_CONFIG) }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ allprojects {
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ allprojects {
|
||||
subprojects {
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(21)
|
||||
options.release.set(17)
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
@@ -45,9 +45,13 @@ subprojects {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://sonatype.projecteden.gg/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("gg.projecteden:eden-interfaces:2.1.0-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
|
||||
paperweight {
|
||||
@@ -64,15 +68,6 @@ paperweight {
|
||||
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("parchment-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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +77,12 @@ paperweight {
|
||||
|
||||
tasks.generateDevelopmentBundle {
|
||||
apiCoordinates.set("gg.projecteden.parchment:parchment-api")
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
libraryRepositories.set(
|
||||
listOf(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
"https://libraries.minecraft.net/",
|
||||
"https://repo.papermc.io/repository/maven-public/",
|
||||
"https://papermc.io/repo/repository/maven-public/",
|
||||
"https://maven.quiltmc.org/repository/release/",
|
||||
"https://sonatype.projecteden.gg/repository/maven-public/"
|
||||
)
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
group = gg.projecteden.parchment
|
||||
version = 1.20.6-R0.1-SNAPSHOT
|
||||
version = 1.20-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion = 1.20.6
|
||||
paperRef = 0ad09de75bfb1db2a84bb760cdee09b06d609bb3
|
||||
edenVersion = 2.2.8-SNAPSHOT
|
||||
|
||||
updatingMinecraft=true
|
||||
mcVersion = 1.20
|
||||
paperRef = de19eb8c4a490ff4f427e9ad8b8bbe181c368cc1
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.vfs.watch=false
|
||||
org.gradle.warning.mode=none
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
25
gradlew
vendored
25
gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,11 +80,14 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# 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"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -140,16 +143,12 @@ fi
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -194,10 +193,6 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# 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"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
@@ -210,12 +205,6 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,8 +25,7 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -76,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -8,94 +8,97 @@ Creates new interfaces for objects that have a reference to a player, offlinepla
|
||||
Also creates interfaces for objects that are like players in that they use all other interfaces and can receive Adventure messages.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
index 7270c1feece2dc15a4a0503c4bca93a1288f8f13..a941a1e1a9e0c5047ad9f7976e65338ac3f87f68 100644
|
||||
index 978813b94a5eae0afccbd3b38b463091a46b56ac..617a4b17982e3dac47480cb16046233232f288b7 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Called when a beacon effect is being applied to a player.
|
||||
*/
|
||||
-public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private PotionEffect effect;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
|
||||
index ae34e679723a2ef436da04c116038272743a8f35..420842d6882c37c64e0f2e9fd41ba9b289fe7690 100644
|
||||
index f530a3d9314e17d1da896cac633f6a422258d9a9..08897d13a8af33ed1cd40c46b0f168e0c4ebfd4a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
|
||||
@@ -37,7 +37,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Starts off cancelled if the player is wearing a pumpkin head or is not looking
|
||||
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* at the Enderman, according to Vanilla rules.
|
||||
*
|
||||
*/
|
||||
-public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable {
|
||||
+public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
@NotNull private final Player player;
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) {
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
index 3029e406cd684efb5645e38711dff9c0bb7b01e4..7ce5cdb02c2b8dc46d01892f495bf06e59d11641 100644
|
||||
index bcc8dba50e3a3df0206c4827bb468bf884837b8b..83b23884d67e7600a3a3cc33050606e397106020 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Fired when a Turtle lays eggs
|
||||
*/
|
||||
-public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
|
||||
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
@NotNull
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
index 7a2fa4a11b47e4982d1644830d7e28f12b4378ec..0cb8e6b174ab62899068ab2a0fcc9e63834e6efd 100644
|
||||
index abeb24fccda2acfdb0dfdadacb8fe688bd97cf78..890069604ca78a9a3f3b4c5f40969a451a1b2067 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Fired when a Turtle starts digging to lay eggs
|
||||
*/
|
||||
-public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
|
||||
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
@NotNull private final Location location;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
index 7c049bad187b94331f42f96833d1cf4ce03ef477..72c36b9ebd668750598a5bf1146fea8043126e05 100644
|
||||
index 59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3..b0cc7665e6591c71b7cd4388d028a5f8abd65e64 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -21,7 +21,7 @@ import java.util.UUID;
|
||||
@@ -20,7 +20,7 @@ import java.util.UUID;
|
||||
*
|
||||
* <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
*/
|
||||
-public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable, gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
@NotNull private final String originalHandshake;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
index 3f73ec52f9b581001bef3a19a5f1533dfa474356..92a38938ab76d5ae873a1d82b8d53250912ced06 100644
|
||||
index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdcb1de2e78 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* No guarantees are made about thread execution context for this event. If you need to know, check
|
||||
* {@link Event#isAsynchronous()}
|
||||
* event.isAsync()
|
||||
*/
|
||||
-public class PreLookupProfileEvent extends Event {
|
||||
+public class PreLookupProfileEvent extends Event implements gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
@@ -52,11 +52,26 @@ public class PreLookupProfileEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@NotNull private final String name;
|
||||
@@ -49,11 +49,27 @@ public class PreLookupProfileEvent extends Event {
|
||||
* {@link LookupProfileEvent}
|
||||
*
|
||||
* @return The UUID of the profile if it has already been provided by a plugin
|
||||
+ * @deprecated alias of {@link #getUniqueId()} <!-- Parchment: fix inconsistent naming -->
|
||||
*/
|
||||
@Nullable
|
||||
- public UUID getUUID() {
|
||||
+ // Parchment start
|
||||
+ @Deprecated
|
||||
@Nullable
|
||||
public UUID getUUID() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
+ public final UUID getUUID() {
|
||||
+ return getUniqueId();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * If this value is left null by the completion of the event call, then the server will
|
||||
+ * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a
|
||||
@@ -105,26 +108,25 @@ index 3f73ec52f9b581001bef3a19a5f1533dfa474356..92a38938ab76d5ae873a1d82b8d53250
|
||||
+ */
|
||||
+ @Override
|
||||
+ public @Nullable UUID getUniqueId() {
|
||||
+ return uuid;
|
||||
+ }
|
||||
return uuid;
|
||||
}
|
||||
+ // Parchment end
|
||||
+
|
||||
|
||||
/**
|
||||
* Sets the UUID for this player name. This will skip the initial API call to find the players UUID.
|
||||
* <p>
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
index 8965974988ad20fbe1d45885f20a3a98d2e9595f..a19e23e55737bdb7ee9909e02ca6414aaf66830f 100644
|
||||
index 9be64a95c2345433b6142d611077dedadcef9f5d..e3cea810881868fb5869de72f331733e6893fcee 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
@@ -53,7 +53,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
@@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*
|
||||
* Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
|
||||
*/
|
||||
-public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
+public class AsyncTabCompleteEvent extends Event implements Cancellable, gg.projecteden.parchment.OptionalLocation { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
@NotNull private final CommandSender sender;
|
||||
@NotNull private final String buffer;
|
||||
private final boolean isCommand;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
index 2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a..640a01478be687b089aeddad422e4bba2bea19b6 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -261,10 +263,10 @@ index 0000000000000000000000000000000000000000..45410a77714ad28201520c188e280e4f
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/OptionalLocation.java b/src/main/java/gg/projecteden/parchment/OptionalLocation.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..305713e6095de2849a42ba1f4049b8715f1f907c
|
||||
index 0000000000000000000000000000000000000000..23897904c6e2d6195f3613c36d77454587afd8bc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/OptionalLocation.java
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,18 @@
|
||||
+package gg.projecteden.parchment;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@@ -277,7 +279,8 @@ index 0000000000000000000000000000000000000000..305713e6095de2849a42ba1f4049b871
|
||||
+@FunctionalInterface
|
||||
+public interface OptionalLocation {
|
||||
+ /**
|
||||
+ * Gets a {@link Location} attached to this object if present *
|
||||
+ * Gets a {@link Location} attached to this object if present
|
||||
+ *
|
||||
+ * @return attached location
|
||||
+ */
|
||||
+ @Nullable Location getLocation();
|
||||
@@ -398,33 +401,33 @@ index 0000000000000000000000000000000000000000..c70ddc6f92d62d2d5baa001c9009ddd3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
|
||||
index 3ddbc099a13df939b3912f30b54e7635840ba5a4..cf34f788b732037713d9a0ab29636de1820afd0a 100644
|
||||
index 2c1cda1126e577a88f19071e958eddb5a38785af..39e746f0c8536642346abbb6909fd2053031d695 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Should only be used for packet/clientside related stuff.
|
||||
* Not intended for modifying server side state.
|
||||
*/
|
||||
-public class PlayerChunkLoadEvent extends ChunkEvent {
|
||||
+public class PlayerChunkLoadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
|
||||
index 2cac7e27991c04a9ced261f2dd8ad8657ccddf6b..2dc9666fac98e3ff8b569f9510fa0db3ba0eb681 100644
|
||||
index 12163a7b0591a7d022dc7eb9ee6608a1b6c39d9b..d81c7307127b135417e06a3b244416bee34b0abe 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Should only be used for packet/clientside related stuff.
|
||||
* Not intended for modifying server side.
|
||||
*/
|
||||
-public class PlayerChunkUnloadEvent extends ChunkEvent {
|
||||
+public class PlayerChunkUnloadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index c6049747fc286acb4e8053901fcc517e5170afa2..5ab9b3e73c9cc6ee9cc4471a1f40c9c60a75b99c 100644
|
||||
index 1a60a18e15780128a1914826daa952ffacb92e9e..b7b881a66536b9f31cad5d00baebea83dcb834bc 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
|
||||
@@ -432,13 +435,13 @@ index c6049747fc286acb4e8053901fcc517e5170afa2..5ab9b3e73c9cc6ee9cc4471a1f40c9c6
|
||||
* representation by the implementation.
|
||||
*/
|
||||
-public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
|
||||
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition, gg.projecteden.parchment.HasLocation { // Paper // Parchment
|
||||
+public class Location implements Cloneable, ConfigurationSerializable , io.papermc.paper.math.FinePosition, gg.projecteden.parchment.HasLocation { // Parchment
|
||||
private Reference<World> world;
|
||||
private double x;
|
||||
private double y;
|
||||
@@ -38,6 +38,13 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
@@ -72,6 +72,13 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
@@ -448,38 +451,46 @@ index c6049747fc286acb4e8053901fcc517e5170afa2..5ab9b3e73c9cc6ee9cc4471a1f40c9c6
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Constructs a new Location with the given coordinates
|
||||
* Sets the world that this location resides in
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index 30298a629b39bd43ce14b414fc697b2dfcbea89c..5f50d10c79990a96ae3f954fbff41b5b39a4d7b8 100644
|
||||
index 72175dcae49f75b494ab70958053ed994a8828f4..4b7ff7a624e94f9bd3a251976b33e289de084f04 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -19,7 +19,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -15,7 +15,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
* player that is stored on the disk and can, thus, be retrieved without the
|
||||
* player needing to be online.
|
||||
*/
|
||||
-public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable {
|
||||
+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, gg.projecteden.parchment.HasOfflinePlayer, gg.projecteden.parchment.OptionalPlayer { // Parchment
|
||||
+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, gg.projecteden.parchment.HasOfflinePlayer, gg.projecteden.parchment.OptionalPlayer, gg.projecteden.api.interfaces.HasUniqueId { // Parchment
|
||||
+
|
||||
|
||||
/**
|
||||
* Checks if this player is currently online
|
||||
@@ -144,6 +145,13 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
@Nullable
|
||||
public Player getPlayer();
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ default @org.jetbrains.annotations.NotNull OfflinePlayer getOfflinePlayer() {
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
|
||||
+
|
||||
/**
|
||||
* Checks if this player is currently online
|
||||
* Gets the first date and time that this player was witnessed on this
|
||||
* server.
|
||||
diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java
|
||||
index fa98599e3eee37bf68f0e9813497c718f457485c..7af5afbef7b1559221ab6c28131ae698aa8cec76 100644
|
||||
index 983a8c20a06d2b509602b27f49c090598b8ecc42..46dd8496f5a2c792ee7811e33c424e88edf8b5b3 100644
|
||||
--- a/src/main/java/org/bukkit/Raid.java
|
||||
+++ b/src/main/java/org/bukkit/Raid.java
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a raid event.
|
||||
*/
|
||||
-public interface Raid extends org.bukkit.persistence.PersistentDataHolder { // Paper
|
||||
+public interface Raid extends org.bukkit.persistence.PersistentDataHolder, gg.projecteden.parchment.HasLocation { // Paper // Parchment
|
||||
-public interface Raid {
|
||||
+public interface Raid extends gg.projecteden.parchment.HasLocation { // Parchment
|
||||
|
||||
/**
|
||||
* Get whether this raid started.
|
||||
@@ -497,10 +508,10 @@ index bbc01e7c192ae6689c301670047ff114306c57cb..2a83ba61686caffb247f17a67af47429
|
||||
private final Location block;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
index 8ba00f743b61cd33dd41ae7f1c272ee2b0c8546d..6e2d3f7e8e2f96016d28bb941f16706d228b542d 100644
|
||||
index d124768378d6f0c5573f28ee815ea3886fe74868..11a00998b1cb5ee582e225553f15b1b7c1a65b2a 100644
|
||||
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Concrete implementation of an attribute modifier.
|
||||
*/
|
||||
@@ -510,7 +521,7 @@ index 8ba00f743b61cd33dd41ae7f1c272ee2b0c8546d..6e2d3f7e8e2f96016d28bb941f16706d
|
||||
private final UUID uuid;
|
||||
private final String name;
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 8a842840e1a2652a6356d4a56e4749a5ba36e902..c5b6ec1c6dfa8789afcde1bf22b2507d20c0545f 100644
|
||||
index 1c3f54382d66549dc881d4577c7104be6673a274..dbc7e9c460cc23b08778934cbe400eb1e1ed88b8 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -518,15 +529,15 @@ index 8a842840e1a2652a6356d4a56e4749a5ba36e902..c5b6ec1c6dfa8789afcde1bf22b2507d
|
||||
* generation when used in cases like BlockPhysicsEvent!!!!
|
||||
*/
|
||||
-public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
||||
+public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable, gg.projecteden.parchment.HasLocation { // Paper - translatable // Parchment
|
||||
+public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable, gg.projecteden.parchment.HasLocation { // Paper - translatable
|
||||
|
||||
/**
|
||||
* Gets the metadata for this block
|
||||
diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java
|
||||
index 80e5d39afe8a6cf882b29c0da78450b958812137..e747f89e5129e360f9827886fcbfb238cf7e19c1 100644
|
||||
index 37ca7b6b0fcee8bec12026ec3715dcc47400cc11..eaf14ce470f041360082cbb0bc16247706b2cd77 100644
|
||||
--- a/src/main/java/org/bukkit/block/BlockState.java
|
||||
+++ b/src/main/java/org/bukkit/block/BlockState.java
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* change the state of the block and you will not know, or they may change the
|
||||
* block to another type entirely, causing your BlockState to become invalid.
|
||||
*/
|
||||
@@ -562,12 +573,12 @@ index 2e17b2d4f759531fbe9ee8e9b00c839186af09ca..8f4a293c131cb8b63c31b410ffa211bd
|
||||
/**
|
||||
* This is the name of the specified AnimalTamer.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 62e3793903905b94eb1a120345015149abb33713..8f35e0c9e778d98ca191d45eec76a7a74d51959a 100644
|
||||
index a2a423d4e4c2702ba5967223cab0432dd7d04732..88704047f596440bd9c68fb4f61417b2bde09757 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* Not all methods are guaranteed to work/may have side effects when
|
||||
* {@link #isInWorld()} is false.
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a base entity in the world
|
||||
*/
|
||||
-public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter { // Paper
|
||||
+public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter, gg.projecteden.api.interfaces.HasUniqueId, gg.projecteden.parchment.HasLocation { // Paper // Parchment
|
||||
@@ -575,7 +586,7 @@ index 62e3793903905b94eb1a120345015149abb33713..8f35e0c9e778d98ca191d45eec76a7a7
|
||||
/**
|
||||
* Gets the entity's current position
|
||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index ee866f3497ed56708d4062685f5585ca06a03955..4c8f373cb946f4db769be566c163f27a9f4af61e 100644
|
||||
index 8b0d04d5b39ee817555a36adddc39b18fc6f0d02..28935c1ff3de9fc2e15e2bca0d254c0e805ed3ce 100644
|
||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
@@ -20,7 +20,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -583,28 +594,28 @@ index ee866f3497ed56708d4062685f5585ca06a03955..4c8f373cb946f4db769be566c163f27a
|
||||
* Represents a human entity, such as an NPC or a player
|
||||
*/
|
||||
-public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
|
||||
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity { // Parchment
|
||||
+// Parchment start
|
||||
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity {
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ default HumanEntity getPlayer() {
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+// Parchment end
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 6c327a07bf8a6aa11a2d7dad12b2830acc539484..42e186ffdb421ccea61c4325f4b9800d55f624a8 100644
|
||||
index 1e5e757b1e3bd02e595020704d14244330555bf0..d4235e9633eeacc35f45530a63b43a4c0e07c5ea 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -56,7 +56,17 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -42,7 +42,17 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a player, connected or not
|
||||
*/
|
||||
-public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient { // Paper
|
||||
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient, gg.projecteden.parchment.HasPlayer { // Paper // Parchment
|
||||
-public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, com.destroystokyo.paper.network.NetworkClient { // Paper
|
||||
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, com.destroystokyo.paper.network.NetworkClient, gg.projecteden.parchment.HasPlayer { // Paper // Parchment
|
||||
+
|
||||
+ // Parchment start - fix defaults
|
||||
+ /**
|
||||
@@ -632,7 +643,7 @@ index 691733a642b3295bbe6d484be728c77cd32803bd..a2eae7a9bad13d1ba2bd954888a03738
|
||||
private boolean dropItems;
|
||||
private boolean cancel;
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
|
||||
index c74ac0cb004aa219ce2f761969a4bb46cb7c9160..0ef554454608f0129b764dc3d6e3d7780ddf2a11 100644
|
||||
index a1350c0f74d445dca09eea6e10abac050bb06990..11bb6f8f7363f31061d5fd0f2e4515099ac40649 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
|
||||
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -645,7 +656,7 @@ index c74ac0cb004aa219ce2f761969a4bb46cb7c9160..0ef554454608f0129b764dc3d6e3d778
|
||||
protected boolean buildable;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
|
||||
index 392cde07d578d684423e1bf369af28696eb7e484..e1dacc04c73e0cabcd04d50540f3a5716550e22f 100644
|
||||
index cd04a0bd9d232857408b38605787016a217cb8d2..7035fe7c0f5adb981ac41804605c4fbcf57968bf 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -658,10 +669,10 @@ index 392cde07d578d684423e1bf369af28696eb7e484..e1dacc04c73e0cabcd04d50540f3a571
|
||||
private final Player player;
|
||||
private boolean instaBreak;
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
index 4c5ee91de162b202c2db8bf68259ad41a430125d..0d7087301c05bd801b32621e279ff69335b92660 100644
|
||||
index 3dd4bd38e72c04e74e5787fb38ca9abd10bad06b..3783fb96cc7086bc78dc06c573a1343c3a18c3cb 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* AIR in most cases. Use #getBlockState() for more Information about the broken
|
||||
* block.
|
||||
*/
|
||||
@@ -723,7 +734,7 @@ index d944d67f544494355f03c5bc9afd8ea7726e6412..800db8e63bdb8c05ffdc88c3a3b0f1f2
|
||||
private boolean cancel = false;
|
||||
private final Player player;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
|
||||
index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..57f89f569725289d56f1c75db258ac19b6f94f30 100644
|
||||
index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b61ca5833 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -735,8 +746,11 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..57f89f569725289d56f1c75db258ac19
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
@@ -44,9 +44,24 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable
|
||||
@@ -42,11 +42,27 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable
|
||||
*
|
||||
* @return The Human entity that caused the animal to enter love mode, or
|
||||
* null if there wasn't one.
|
||||
+ * @deprecated alias of {@link #getPlayer()} <!-- Parchment: fix inconsistent naming -->
|
||||
*/
|
||||
@Nullable
|
||||
- public HumanEntity getHumanEntity() {
|
||||
@@ -762,7 +776,7 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..57f89f569725289d56f1c75db258ac19
|
||||
/**
|
||||
* Gets the amount of ticks that the animal will fall in love for.
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
|
||||
index 8506fa03293c575c35b55b052224807470fdbd98..2b5e481929c956bdfff5522b2c7ec3e71aa750f5 100644
|
||||
index 099efafa14c10910e4ed04abb1823f0c1a96b6a6..382602ca4a9a33cf238f982f77865053d38bd285 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -788,7 +802,7 @@ index 71d664dd89995f088c47d17b38547d530319470c..d931ece8f35c8f01748c59d01617fd59
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
|
||||
index e4e3d2e22c28ef251d76c48ade267b4eb3749e7d..5128c4b618b4e369a8f9700169b187926ddde09e 100644
|
||||
index 6818e9f0ba32ca1a1e612703f7526b29f5a6438f..c9c4a6673fd3995bb9638b0d25fa212412cda807 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -814,7 +828,7 @@ index 961ee511342cd3a12ff2ff74d7b4683c6753123d..892732ab5ae58ec980c4fd05a5a3dfdc
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
|
||||
index 2bb29fa449cd6c90b52d2786ed15b6154d591607..ce4caa5d3b0801bc7e2fd2c917a4ae6e3f054052 100644
|
||||
index 6fc66197eb2c5d59c70d8d028b7963748371edbe..dc45ec5b6ae8e2958d83a113d23ab0b1a911de3f 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -853,12 +867,12 @@ index cc5781f276ec0a503b1bfef19d630c85db897c2a..89b38f2ce9a355f39abc657eff49c3a5
|
||||
private boolean cancelled;
|
||||
private final Player player;
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
|
||||
index a965b6a78073c5da86ad671752eff4a270029420..84cc90c085ae5ab788bcbc83bf1a0081be3b8186 100644
|
||||
index 020739697a0b535cad0b15b574f77cdabbdfa3eb..ee4fd41e66852d5d2c62222c7b884473d3f3001d 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* {@link org.bukkit.block.Furnace}, {@link org.bukkit.block.Smoker}, or
|
||||
* {@link org.bukkit.block.BlastFurnace}.
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* This event is called when a player takes items out of the furnace
|
||||
*/
|
||||
-public class FurnaceExtractEvent extends BlockExpEvent {
|
||||
+public class FurnaceExtractEvent extends BlockExpEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
@@ -866,12 +880,12 @@ index a965b6a78073c5da86ad671752eff4a270029420..84cc90c085ae5ab788bcbc83bf1a0081
|
||||
private final Material itemType;
|
||||
private final int itemAmount;
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
|
||||
index 4db0a07db156c61867644f50c185e63b695e2462..eb6632e2e9d247bd54e02e3a134dfdbed9aeef39 100644
|
||||
index 21ad8888c0e403bfc63518502577d651c02dda05..1c59335a8f0a40162190f6fb73ffbfef0cd795d8 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* on the next tick. Also be aware that this is not an exhaustive list, and
|
||||
* other methods could potentially create issues as well.
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a player related inventory event
|
||||
*/
|
||||
-public class InventoryCloseEvent extends InventoryEvent {
|
||||
+public class InventoryCloseEvent extends InventoryEvent implements gg.projecteden.parchment.HasHumanEntity { // Parchment
|
||||
@@ -879,7 +893,7 @@ index 4db0a07db156c61867644f50c185e63b695e2462..eb6632e2e9d247bd54e02e3a134dfdbe
|
||||
// Paper start
|
||||
private final Reason reason;
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
|
||||
index 8e2afeab4c62724148e8bb0c83fb7eec569c7a0c..2843fd117151dc75c87db06915a6732277867a0c 100644
|
||||
index ceae092eb782698803c6c3df41267dde20ba62b2..23e35e7e65bdf2e758dc8dc980b9427b7e4163a9 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -890,14 +904,14 @@ index 8e2afeab4c62724148e8bb0c83fb7eec569c7a0c..2843fd117151dc75c87db06915a67322
|
||||
+public class InventoryOpenEvent extends InventoryEvent implements Cancellable, gg.projecteden.parchment.HasHumanEntity { // Parchment
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private net.kyori.adventure.text.Component titleOverride; // Paper
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
index ae02788536d0c6736aba4ccf812844df4f9789f1..327558fcf2aacf0df5a62399fc510c25fcf7cb38 100644
|
||||
index fc2d9e85b65347b90bde3b0b13ccae759e33d466..6b2e64fa9c0f3c0af88797d63557c333edf69a5d 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Consider rendering any translatable yourself with {@link net.kyori.adventure.translation.GlobalTranslator#render}
|
||||
* if the client's language is known.
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <p>
|
||||
* This event is asynchronous, and not run using main thread.
|
||||
*/
|
||||
-public class AsyncPlayerPreLoginEvent extends Event {
|
||||
+public class AsyncPlayerPreLoginEvent extends Event implements gg.projecteden.api.interfaces.HasUniqueId { // Parchment
|
||||
@@ -918,10 +932,10 @@ index f6d3b817de3001f04ea4554c7c39a1290af3fd6d..44efb5cc62149b34b994eadac488a902
|
||||
|
||||
public PlayerEvent(@NotNull final Player who) {
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
|
||||
index 175ed12dd1698f4d153c9acdac8340c15a427ea5..5e14dc6968de1b146b31abef19fbba1af8c68b6f 100644
|
||||
index 6800132c6288b4588fd02b08d26f016c38f27129..8e333a361cdee30a83e9472285dfb0b30b2e72ca 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason = "This event causes a login thread to synchronize with the main thread")
|
||||
@@ -931,18 +945,19 @@ index 175ed12dd1698f4d153c9acdac8340c15a427ea5..5e14dc6968de1b146b31abef19fbba1a
|
||||
private Result result;
|
||||
private net.kyori.adventure.text.Component message; // Paper
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
index d63bd62606763d0902ea800f0c35a1cfd07fc8ec..ecca20d51f8ac6f27887c55ae2aaa428ecb1ea53 100644
|
||||
index d63bd62606763d0902ea800f0c35a1cfd07fc8ec..97bb62b616f8f08ec697c14681ffe6d89934b526 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,8 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Called prior to an entity being unleashed due to a player's action.
|
||||
*/
|
||||
-public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable {
|
||||
-
|
||||
+public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
|
||||
private boolean cancelled = false;
|
||||
|
||||
private final Player player;
|
||||
diff --git a/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java b/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java
|
||||
index 128e43cf12205f82f2b119a773208502cdccfdd4..ca1fed3081e2b0a3271a2dfa0f49cce78bdb8e23 100644
|
||||
--- a/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java
|
||||
@@ -957,7 +972,7 @@ index 128e43cf12205f82f2b119a773208502cdccfdd4..ca1fed3081e2b0a3271a2dfa0f49cce7
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
//
|
||||
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
|
||||
index b43c3cb5c88eada186d6f81712c244aaa18fb53e..a37055d864038a0090fa0c71f7d8e22aea69b3fe 100644
|
||||
index 4a3451af454295ac3e1b688e6665cad9fc594c82..b88cebb219577d59cc338be89c6f391d10702095 100644
|
||||
--- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
|
||||
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -970,7 +985,7 @@ index b43c3cb5c88eada186d6f81712c244aaa18fb53e..a37055d864038a0090fa0c71f7d8e22a
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
//
|
||||
diff --git a/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/src/main/java/org/bukkit/event/world/GenericGameEvent.java
|
||||
index fb975fefc74d8c9746cab4c02860f55654cf92f7..172699ba31d1ee0697607125d75549930288dd5b 100644
|
||||
index 2a2a329877d8da45c2d6afecf78ce88d52635cad..22cdf3662b02fb5751ac6d913d781084cd7eee5b 100644
|
||||
--- a/src/main/java/org/bukkit/event/world/GenericGameEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/world/GenericGameEvent.java
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -983,7 +998,7 @@ index fb975fefc74d8c9746cab4c02860f55654cf92f7..172699ba31d1ee0697607125d7554993
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final GameEvent event;
|
||||
diff --git a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
|
||||
index 783e74bc382f0f6d24203fde7b811f588a674731..c0f863b35cc7f508a33ddcb1af9ed6c52115efdc 100644
|
||||
index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..c28d62fc3dc359f9ebcf926094198ee3c92467aa 100644
|
||||
--- a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -1009,7 +1024,7 @@ index 0d519813c12d98b28d62e6d01d7ec6e8c2dba3c3..469b9cc0c4b77844ba0317af51bd9ad8
|
||||
/**
|
||||
* Returns the size of the inventory
|
||||
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
index ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059..464c69fd652db3384b1a4a5f4151933c3cd7df7b 100644
|
||||
index 77a0cd901038405ed0e267f0432f13deccae3ab5..abe9b0d97d24e9e2ef1a61e34249895eb35b800f 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -1022,7 +1037,7 @@ index ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059..464c69fd652db3384b1a4a5f4151933c
|
||||
/**
|
||||
* Represents various extra properties of certain inventory windows.
|
||||
diff --git a/src/main/java/org/bukkit/loot/LootContext.java b/src/main/java/org/bukkit/loot/LootContext.java
|
||||
index b35dba42069f771db8727bf98f9d17aff9d6094e..0b4a90259952185c0897d4c6b68124dd3d42db26 100644
|
||||
index 71b7aa9d675e1714e286e6fd4015ead036d912e0..95e120068a7c5c96b1b8553df9cf8654ba63a325 100644
|
||||
--- a/src/main/java/org/bukkit/loot/LootContext.java
|
||||
+++ b/src/main/java/org/bukkit/loot/LootContext.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lexi Larkin <lexi@qixils.dev>
|
||||
Date: Sun, 6 Aug 2023 22:01:19 -0400
|
||||
Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index fd39ed209b20c927054b8482c400beeeeab460a3..f7786d4034afae1926bb249e282f3f204e09ba1a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,6 +14,9 @@ val bungeeCordChatVersion = "1.20-R0.2"
|
||||
val adventureVersion = "4.17.0"
|
||||
val slf4jVersion = "2.0.9"
|
||||
val log4jVersion = "2.17.1"
|
||||
+
|
||||
+val edenVersion: String by project // Parchment
|
||||
+
|
||||
val apiAndDocs: Configuration by configurations.creating {
|
||||
attributes {
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||
@@ -27,6 +30,7 @@ configurations.api {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
+ api("gg.projecteden:eden-interfaces:$edenVersion") // Parchment
|
||||
api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api
|
||||
// api dependencies are listed transitively to API consumers
|
||||
api("com.google.guava:guava:32.1.2-jre")
|
||||
@@ -6,13 +6,12 @@ Subject: [PATCH] Add SoundEvent
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222bae9167a85
|
||||
index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c0409febb9d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java
|
||||
@@ -0,0 +1,359 @@
|
||||
@@ -0,0 +1,382 @@
|
||||
+package gg.projecteden.parchment.event.sound;
|
||||
+
|
||||
+import gg.projecteden.parchment.HasLocation;
|
||||
+import gg.projecteden.parchment.OptionalHumanEntity;
|
||||
+import net.kyori.adventure.sound.Sound;
|
||||
+import org.bukkit.Location;
|
||||
@@ -35,7 +34,7 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ * Called when a sound is sent to a player.
|
||||
+ * Cancelling this event will prevent the packet from sending.
|
||||
+ */
|
||||
+public final class SoundEvent extends Event implements Cancellable {
|
||||
+public final class SoundEvent extends Event implements Cancellable, OptionalHumanEntity {
|
||||
+ private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(SoundEvent.class);
|
||||
+
|
||||
+ private static final org.bukkit.event.HandlerList handlers = new org.bukkit.event.HandlerList();
|
||||
@@ -60,14 +59,16 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ private @NotNull Sound sound;
|
||||
+ private @NotNull Emitter emitter;
|
||||
+ private boolean cancelled;
|
||||
+ private long seed;
|
||||
+ private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Sound> soundOverrideFunction;
|
||||
+ private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Emitter> emitterOverrideFunction;
|
||||
+
|
||||
+ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
|
||||
+ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, long seed, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
|
||||
+ super(true);
|
||||
+ this.except = except;
|
||||
+ this.sound = Objects.requireNonNull(sound, "sound cannot be null");
|
||||
+ this.emitter = Objects.requireNonNull(emitter, "emitter cannot be null");
|
||||
+ this.seed = seed;
|
||||
+ this.distanceFunction = Objects.requireNonNullElse(distanceFunction, DEFAULT_DISTANCE_FUNCTION);
|
||||
+ this.recipientsFunction = wrapRecipientsFunction(Objects.requireNonNullElse(recipientsFunction, DEFAULT_RECIPIENTS_FUNCTION));
|
||||
+ }
|
||||
@@ -76,6 +77,18 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ * Gets the player that <b>won't</b> be receiving this sound.
|
||||
+ *
|
||||
+ * @return player excluded from receiving this sound
|
||||
+ * @deprecated use {@link #getException()} for more clarity
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public @Nullable HumanEntity getPlayer() {
|
||||
+ return getException();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player that <b>won't</b> be receiving this sound.
|
||||
+ *
|
||||
+ * @return player excluded from receiving this sound
|
||||
+ */
|
||||
+ public @Nullable HumanEntity getException() {
|
||||
+ return except;
|
||||
@@ -127,6 +140,24 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the seed used to generate the sound.
|
||||
+ *
|
||||
+ * @return seed used to generate the sound
|
||||
+ */
|
||||
+ public long getSeed() {
|
||||
+ return seed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the seed used to generate the sound.
|
||||
+ *
|
||||
+ * @param seed seed used to generate the sound
|
||||
+ */
|
||||
+ public void setSeed(long seed) {
|
||||
+ this.seed = seed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Calculates the distance of the sound.
|
||||
+ * <p>
|
||||
+ * The distance value is dynamically calculated using a
|
||||
@@ -305,7 +336,7 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+
|
||||
+ private record WrappedRecipientsFunction(@NotNull Function<SoundEvent, List<Player>> wrapped) implements Function<SoundEvent, List<Player>> {
|
||||
+ @Override
|
||||
+ public @NotNull List<Player> apply(@NotNull SoundEvent event) {
|
||||
+ public List<Player> apply(SoundEvent event) {
|
||||
+ List<Player> recipients = wrapped.apply(event);
|
||||
+ HumanEntity except = event.getException();
|
||||
+ if (except != null) {
|
||||
@@ -331,18 +362,14 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ /**
|
||||
+ * The class which determines where a sound will emit from.
|
||||
+ */
|
||||
+ public sealed interface Emitter extends HasLocation permits EntityEmitter, LocationEmitter {
|
||||
+ public sealed interface Emitter permits EntityEmitter, LocationEmitter {
|
||||
+ /**
|
||||
+ * Gets the location at which the sound will be played.
|
||||
+ *
|
||||
+ * @return sound's location
|
||||
+ * @deprecated use {@link #getLocation()} instead
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ default Location location() {
|
||||
+ return getLocation();
|
||||
+ }
|
||||
+ Location location();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -352,7 +379,7 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ */
|
||||
+ public record EntityEmitter(@NotNull Entity entity) implements Emitter {
|
||||
+ @Override
|
||||
+ public @NotNull Location getLocation() {
|
||||
+ public @NotNull Location location() {
|
||||
+ return entity.getLocation();
|
||||
+ }
|
||||
+ }
|
||||
@@ -363,9 +390,5 @@ index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222ba
|
||||
+ * @param location the location from which the sound will be played
|
||||
+ */
|
||||
+ public record LocationEmitter(@NotNull Location location) implements Emitter {
|
||||
+ @Override
|
||||
+ public @NotNull Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Fri, 18 Jun 2021 14:06:43 -0400
|
||||
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
index 461727dc7f06efb3550fc370e0db5bd04ba89711..f20ac2ba1921616f346c11ef60c53aba0080728b 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
@@ -12,17 +12,43 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
private final Block damager;
|
||||
+ private final org.bukkit.Location location; // Parchment
|
||||
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
super(damagee, cause, damage);
|
||||
this.damager = damager;
|
||||
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
|
||||
}
|
||||
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
super(damagee, cause, modifiers, modifierFunctions);
|
||||
this.damager = damager;
|
||||
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @Nullable final org.bukkit.Location damageLocation, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
+ super(damagee, cause, modifiers, modifierFunctions);
|
||||
+ this.damager = damager;
|
||||
+ if (damageLocation != null)
|
||||
+ this.location = damageLocation;
|
||||
+ else if (damager != null)
|
||||
+ this.location = damager.getLocation();
|
||||
+ else
|
||||
+ this.location = null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location of the damage source.
|
||||
+ *
|
||||
+ * @return Originating location of the damage source
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public org.bukkit.Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Returns the block that damaged the player.
|
||||
*
|
||||
@@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Fri, 18 Jun 2021 14:06:43 -0400
|
||||
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
index 148c4aad384ae8e3b8b22d264a84bddfbcafdf1e..61fcdd178fa5a8f13c889a78f431d2a5529c8c43 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
private final Block damager;
|
||||
private final BlockState damagerState;
|
||||
+ private final org.bukkit.Location location; // Parchment
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
@@ -30,19 +31,40 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
super(damagee, cause, damageSource, damage);
|
||||
this.damager = damager;
|
||||
this.damagerState = damagerState;
|
||||
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
- this(damager, (damager != null) ? damager.getState() : null, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions);
|
||||
+ this(damager, (damager != null) ? damager.getState() : null, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions, null);
|
||||
}
|
||||
|
||||
- public EntityDamageByBlockEvent(@Nullable final Block damager, @Nullable final BlockState damagerState, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
+ public EntityDamageByBlockEvent(@Nullable final Block damager, @Nullable final BlockState damagerState, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions, @Nullable final org.bukkit.Location damageLocation) { // Parchment
|
||||
super(damagee, cause, damageSource, modifiers, modifierFunctions);
|
||||
this.damager = damager;
|
||||
this.damagerState = damagerState;
|
||||
+ // Parchment start
|
||||
+ if (damageLocation != null)
|
||||
+ this.location = damageLocation;
|
||||
+ else if (damager != null)
|
||||
+ this.location = damager.getLocation();
|
||||
+ else
|
||||
+ this.location = null;
|
||||
+ // Parchment end
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Gets the location of the damage source.
|
||||
+ *
|
||||
+ * @return Originating location of the damage source
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public org.bukkit.Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
+
|
||||
/**
|
||||
* Returns the block that damaged the player.
|
||||
*
|
||||
@@ -6,19 +6,20 @@ Subject: [PATCH] Expanded Adventure support
|
||||
Adds support for Adventure in a few places where it was previously missing.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
|
||||
index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76719d2d04 100644
|
||||
index ea4ceb643239c26851bacbf45fc3f2efef3bb4be..eea8e60c363b6dc14383fb7758cbf41469f76425 100644
|
||||
--- a/src/main/java/org/bukkit/ChatColor.java
|
||||
+++ b/src/main/java/org/bukkit/ChatColor.java
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @deprecated ChatColor has been deprecated in favor of <a href="https://docs.advntr.dev/text.html">Adventure</a> API. See {@link net.kyori.adventure.text.format.NamedTextColor} for the adventure equivalent of pre-defined text colors
|
||||
@@ -11,8 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* All supported color values for chat
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
-@Deprecated // Paper
|
||||
-public enum ChatColor {
|
||||
+public enum ChatColor implements net.kyori.adventure.text.format.StyleBuilderApplicable, net.kyori.adventure.text.format.TextFormat { // Parchment
|
||||
/**
|
||||
* Represents black
|
||||
*/
|
||||
@@ -183,6 +183,13 @@ public enum ChatColor {
|
||||
@@ -182,6 +181,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.MAGIC;
|
||||
}
|
||||
@@ -26,13 +27,41 @@ index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.apply(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text bold.
|
||||
@@ -213,6 +220,13 @@ public enum ChatColor {
|
||||
@@ -192,6 +198,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.BOLD;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.BOLD);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes a line appear through the text.
|
||||
@@ -202,6 +215,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.STRIKETHROUGH;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.STRIKETHROUGH);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text appear underlined.
|
||||
@@ -212,6 +232,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.UNDERLINE;
|
||||
}
|
||||
@@ -40,13 +69,27 @@ index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.apply(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text italic.
|
||||
@@ -233,6 +247,16 @@ public enum ChatColor {
|
||||
@@ -222,6 +249,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.ITALIC;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Resets all previous chat colors or formats.
|
||||
@@ -232,6 +266,16 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
@@ -63,17 +106,14 @@ index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -265,6 +289,16 @@ public enum ChatColor {
|
||||
@@ -264,6 +308,13 @@ public enum ChatColor {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
};
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ if (isColor())
|
||||
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB()));
|
||||
+ else
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.valueOf(name()));
|
||||
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB()));
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
@@ -5,13 +5,13 @@ Subject: [PATCH] Add UnsafeValues#canPlaceItemOn
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 0857a65ecbc36e0e4b8a7d0cda52be35f238f660..1a3151814ef669db1c8530c7afaa810be99ca267 100644
|
||||
index c661eab343ae76488de701630424e2d589f44fc0..b0ba8331fa43f4584eac1b1d9f4c3cad9d47b872 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -282,4 +282,19 @@ public interface UnsafeValues {
|
||||
// Paper end - lifecycle event API
|
||||
|
||||
@NotNull java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines
|
||||
@@ -250,4 +250,17 @@ public interface UnsafeValues {
|
||||
*/
|
||||
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||
// Paper end
|
||||
+
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
@@ -25,6 +25,4 @@ index 0857a65ecbc36e0e4b8a7d0cda52be35f238f660..1a3151814ef669db1c8530c7afaa810b
|
||||
+ */
|
||||
+ java.util.concurrent.CompletableFuture<Boolean> canPlaceItemOn(@org.jetbrains.annotations.NotNull ItemStack item, @org.jetbrains.annotations.Nullable gg.projecteden.parchment.OptionalHumanEntity player, @org.jetbrains.annotations.NotNull org.bukkit.block.Block block, @org.jetbrains.annotations.NotNull org.bukkit.block.BlockFace face);
|
||||
+ // Parchment end
|
||||
+
|
||||
+
|
||||
}
|
||||
@@ -5,13 +5,14 @@ Subject: [PATCH] Expose MCUtil Executors
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index c8595ffcfcbdd79794d464415287d46acef72b72..e018920520c8d747fb10e8365d4dd0326b04c50c 100644
|
||||
index 1d1a1d087dabc9794e0062a064da2cced4062309..bf0ceb5b59a5ab63e618984ec82e9830c228fa75 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2229,6 +2229,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
UnsafeValues getUnsafe();
|
||||
|
||||
@@ -2162,4 +2162,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
|
||||
// Paper end
|
||||
+
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
+ * Gets the executor which runs tasks on an asynchronous thread pool.
|
||||
@@ -27,7 +28,4 @@ index c8595ffcfcbdd79794d464415287d46acef72b72..e018920520c8d747fb10e8365d4dd032
|
||||
+ @NotNull
|
||||
+ java.util.concurrent.Executor getMainExecutor();
|
||||
+ // Parchment end
|
||||
+
|
||||
// Spigot start
|
||||
public class Spigot {
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ Will eventually (hopefully) be replaced by a more extensive Paper PR with suppor
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ea17d99c7a1d70d88e2c439399cdb376b9dedf47
|
||||
index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b40459a89d17
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
|
||||
@@ -0,0 +1,50 @@
|
||||
@@ -24,15 +24,15 @@ index 0000000000000000000000000000000000000000..ea17d99c7a1d70d88e2c439399cdb376
|
||||
+ */
|
||||
+ CRAFTING(false),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside a furnace.
|
||||
+ * Recipes for smelting an item inside of a furnace.
|
||||
+ */
|
||||
+ SMELTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside a blasting furnace.
|
||||
+ * Recipes for smelting an item inside of a blasting furnace.
|
||||
+ */
|
||||
+ BLASTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside a smoker.
|
||||
+ * Recipes for smelting an item inside of a smoker.
|
||||
+ */
|
||||
+ SMOKING(true),
|
||||
+ /**
|
||||
@@ -64,12 +64,12 @@ index 0000000000000000000000000000000000000000..ea17d99c7a1d70d88e2c439399cdb376
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e..64c1287b7a668680e19f8c4c1a678abb0eb5d88e 100644
|
||||
index 72f1576b8ce5b55b50f053f346ce42c52db4b568..edc65af5cc0593a04c2f7fede69de0781a31ee97 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -52,6 +52,36 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
@@ -3974,6 +3974,36 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@Nullable
|
||||
public DragonBattle getEnderDragonBattle();
|
||||
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
@@ -101,6 +101,6 @@ index 97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e..64c1287b7a668680e19f8c4c1a678abb
|
||||
+ ItemStack smeltItem(@NotNull ItemStack toSmelt, gg.projecteden.parchment.inventory.@NotNull RecipeType recipeType);
|
||||
+ // Parchment end
|
||||
+
|
||||
// Paper start
|
||||
/**
|
||||
* @return The amount of Entities in this world
|
||||
* Get all {@link FeatureFlag} enabled in this world.
|
||||
*
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Add Player#getHiddenEntities API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 42e186ffdb421ccea61c4325f4b9800d55f624a8..8b2380241dbf40bd03941250a66e0a7b4a2282ec 100644
|
||||
index d4235e9633eeacc35f45530a63b43a4c0e07c5ea..aba730b762d6a0df8a5f115186f2faaf7a2cb75d 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2092,6 +2092,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1649,6 +1649,18 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public boolean canSee(@NotNull Entity entity);
|
||||
public boolean canSee(@NotNull Player player);
|
||||
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
@@ -19,10 +19,11 @@ index 42e186ffdb421ccea61c4325f4b9800d55f624a8..8b2380241dbf40bd03941250a66e0a7b
|
||||
+ * @param plugin Plugin that has hidden entities
|
||||
+ * @return a view of hidden entity UUIDs
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ public java.util.@NotNull Set<java.util.UUID> getHiddenEntities(@NotNull Plugin plugin);
|
||||
+ // Parchment end
|
||||
+
|
||||
+
|
||||
// Paper start
|
||||
/**
|
||||
* Returns whether the {@code other} player is listed for {@code this}.
|
||||
* Visually hides an entity from this player.
|
||||
*
|
||||
@@ -5,21 +5,29 @@ Subject: [PATCH] Add Timings Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||
index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..16198861748b29c537527151216e79c7c32e7204 100644
|
||||
index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..91429282ed8f30abbb969b426b34826c6e28b75d 100644
|
||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||
@@ -145,8 +145,27 @@ public final class Timings {
|
||||
@@ -23,6 +23,8 @@
|
||||
*/
|
||||
package co.aikar.timings;
|
||||
|
||||
+import co.aikar.timings.event.TimingsModifyEvent;
|
||||
+import co.aikar.timings.event.TimingsModifyEvent.Action;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.EvictingQueue;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -145,8 +147,25 @@ public final class Timings {
|
||||
* @param enabled Should timings be reported
|
||||
*/
|
||||
public static void setTimingsEnabled(boolean enabled) {
|
||||
+ // Parchment start
|
||||
+ setTimingsEnabled(enabled, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * <p>Sets whether or not the Spigot Timings system should be enabled</p>
|
||||
+ *
|
||||
+ * Calls a {@link co.aikar.timings.event.TimingsModifyEvent}, if cancelled the timings will not be reset
|
||||
+ * Calls a {@link TimingsModifyEvent}, if cancelled the timings will not be reset
|
||||
+ *
|
||||
+ * @param enabled Should timings be reported
|
||||
+ * @param sender The sender asking to reset
|
||||
@@ -28,77 +36,98 @@ index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..16198861748b29c537527151216e79c7
|
||||
timingsEnabled = enabled;
|
||||
warnAboutDeprecationOnEnable();
|
||||
+ if (sender != null) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, Action.RESET).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Parchment end
|
||||
reset();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
index e801e79fa57c44b2e5d359647c920f88064826f1..012d2281c386d2e5f5a655079c0cbfa4545d6476 100644
|
||||
index e801e79fa57c44b2e5d359647c920f88064826f1..0cbb970c42c3a71602ccd311a13e1f874067e2ae 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
@@ -63,10 +63,12 @@ public class TimingsCommand extends BukkitCommand {
|
||||
@@ -63,12 +63,14 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
final String arg = args[0];
|
||||
if ("on".equalsIgnoreCase(arg)) {
|
||||
- Timings.setTimingsEnabled(true);
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.ENABLE).callEvent()) return true; // Parchment
|
||||
+ Timings.setTimingsEnabled(true, sender);
|
||||
sender.sendMessage(text("Enabled Timings & Reset"));
|
||||
- sender.sendMessage(text("Enabled Timings & Reset"));
|
||||
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.ENABLE).callEvent()) {
|
||||
+ Timings.setTimingsEnabled(true, sender);
|
||||
+ }
|
||||
return true;
|
||||
} else if ("off".equalsIgnoreCase(arg)) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.DISABLE).callEvent()) return true; // Parchment
|
||||
Timings.setTimingsEnabled(false);
|
||||
sender.sendMessage(text("Disabled Timings"));
|
||||
- Timings.setTimingsEnabled(false);
|
||||
- sender.sendMessage(text("Disabled Timings"));
|
||||
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.DISABLE).callEvent()) {
|
||||
+ Timings.setTimingsEnabled(false, sender);
|
||||
+ }
|
||||
return true;
|
||||
@@ -79,15 +81,18 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
@@ -79,20 +81,22 @@ public class TimingsCommand extends BukkitCommand {
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if ("verbon".equalsIgnoreCase(arg)) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_ON).callEvent()) return true; // Parchment
|
||||
Timings.setVerboseTimingsEnabled(true);
|
||||
sender.sendMessage(text("Enabled Verbose Timings"));
|
||||
- Timings.setVerboseTimingsEnabled(true);
|
||||
- sender.sendMessage(text("Enabled Verbose Timings"));
|
||||
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_ON).callEvent()) {
|
||||
+ Timings.setVerboseTimingsEnabled(true);
|
||||
+ }
|
||||
return true;
|
||||
} else if ("verboff".equalsIgnoreCase(arg)) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_OFF).callEvent()) return true; // Parchment
|
||||
Timings.setVerboseTimingsEnabled(false);
|
||||
sender.sendMessage(text("Disabled Verbose Timings"));
|
||||
- Timings.setVerboseTimingsEnabled(false);
|
||||
- sender.sendMessage(text("Disabled Verbose Timings"));
|
||||
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_OFF).callEvent()) {
|
||||
+ Timings.setVerboseTimingsEnabled(false);
|
||||
+ }
|
||||
return true;
|
||||
} else if ("reset".equalsIgnoreCase(arg)) {
|
||||
if (now - lastResetAttempt < 30000) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) return true; // Parchment
|
||||
TimingsManager.reset();
|
||||
sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED));
|
||||
- TimingsManager.reset();
|
||||
- sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED));
|
||||
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) {
|
||||
+ TimingsManager.reset();
|
||||
+ }
|
||||
} else {
|
||||
lastResetAttempt = now;
|
||||
- sender.sendMessage(text("WARNING: Timings v2 should not be reset. If you are experiencing lag, please wait 3 minutes and then issue a report. The best timings will include 10+ minutes, with data before and after your lag period. If you really want to reset, run this command again within 30 seconds.", NamedTextColor.RED));
|
||||
}
|
||||
} else if (
|
||||
"paste".equalsIgnoreCase(arg) ||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
index 3af5b8ea795311582044c712de50d29412024b77..806a1e528aae9a26413b483855130bef78ca72fb 100644
|
||||
index 3af5b8ea795311582044c712de50d29412024b77..b509aa8d2b05e913277713308e2eea46e631a5df 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
@@ -59,6 +59,7 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
@@ -59,7 +59,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
|
||||
@Override
|
||||
public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
|
||||
+ if (!new co.aikar.timings.event.TimingsMessageEvent(this.senders, message).callEvent()) return; // Parchment
|
||||
net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
|
||||
- net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
|
||||
+ if (new co.aikar.timings.event.TimingsMessageEvent(this.senders, message).callEvent()) {
|
||||
+ net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
|
||||
+ }
|
||||
}
|
||||
|
||||
@@ -70,6 +71,7 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
@NotNull
|
||||
@@ -70,7 +72,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String message) {
|
||||
+ if (!new co.aikar.timings.event.TimingsMessageEvent(this.senders, net.kyori.adventure.text.Component.text(message)).callEvent()) return; // Parchment
|
||||
senders.forEach((sender) -> sender.sendMessage(message));
|
||||
- senders.forEach((sender) -> sender.sendMessage(message));
|
||||
+ if (new co.aikar.timings.event.TimingsMessageEvent(this.senders, net.kyori.adventure.text.Component.text(message)).callEvent()) {
|
||||
+ senders.forEach((sender) -> sender.sendMessage(message));
|
||||
+ }
|
||||
}
|
||||
|
||||
public void addConsoleIfNeeded() {
|
||||
diff --git a/src/main/java/co/aikar/timings/event/TimingsEvent.java b/src/main/java/co/aikar/timings/event/TimingsEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9ad67d72e6173d1629f862ca9fd13475950709f0
|
||||
index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c71281e1abe4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsEvent.java
|
||||
@@ -0,0 +1,36 @@
|
||||
@@ -0,0 +1,34 @@
|
||||
+package co.aikar.timings.event;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -107,21 +136,19 @@ index 0000000000000000000000000000000000000000..9ad67d72e6173d1629f862ca9fd13475
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+public abstract class TimingsEvent extends Event {
|
||||
+
|
||||
+ private final @NotNull Set<CommandSender> audience;
|
||||
+ private final Set<CommandSender> audience;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ public TimingsEvent(@NotNull Collection<CommandSender> audience) {
|
||||
+ public TimingsEvent(Set<CommandSender> audience) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.audience = new HashSet<>(audience);
|
||||
+ this.audience = audience;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull Set<CommandSender> getAudience() {
|
||||
+ public Set<CommandSender> getAudience() {
|
||||
+ return this.audience;
|
||||
+ }
|
||||
+
|
||||
@@ -130,65 +157,62 @@ index 0000000000000000000000000000000000000000..9ad67d72e6173d1629f862ca9fd13475
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..33152129508c526031eee68f2ae797563d97be0c
|
||||
index 0000000000000000000000000000000000000000..5ed7d1d4972842e93e2a9c2ffa799e6fc9136e63
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,19 @@
|
||||
+package co.aikar.timings.event;
|
||||
+
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+
|
||||
+public class TimingsGenerateReportEvent extends TimingsEvent {
|
||||
+
|
||||
+ private final @NotNull String paste;
|
||||
+ private final String paste;
|
||||
+
|
||||
+ public TimingsGenerateReportEvent(@NotNull CommandSender sender, @NotNull String paste) {
|
||||
+ public TimingsGenerateReportEvent(CommandSender sender, String paste) {
|
||||
+ super(Collections.singleton(sender));
|
||||
+ this.paste = paste;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull String getPaste() {
|
||||
+ public String getPaste() {
|
||||
+ return this.paste;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..626f25e164c6b23481c5a976a6e184e739104305
|
||||
index 0000000000000000000000000000000000000000..04ec925cfa9e385e8ad4763b18570b7bf07c4007
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java
|
||||
@@ -0,0 +1,35 @@
|
||||
@@ -0,0 +1,33 @@
|
||||
+package co.aikar.timings.event;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class TimingsMessageEvent extends TimingsEvent implements Cancellable {
|
||||
+
|
||||
+ public @NotNull Component message;
|
||||
+ public Component message;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public TimingsMessageEvent(@NotNull Collection<CommandSender> senders, @NotNull Component message) {
|
||||
+ public TimingsMessageEvent(List<CommandSender> senders, Component message) {
|
||||
+ super(new HashSet<>(senders));
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull Component getMessage() {
|
||||
+ public Component getMessage() {
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
@@ -204,29 +228,28 @@ index 0000000000000000000000000000000000000000..626f25e164c6b23481c5a976a6e184e7
|
||||
+}
|
||||
diff --git a/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3faf845716d5d3adf360949f28a5e12aa7e20aa6
|
||||
index 0000000000000000000000000000000000000000..1fe9bbedf23fdf7b02de02f5d184d8d956c7056b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java
|
||||
@@ -0,0 +1,41 @@
|
||||
@@ -0,0 +1,40 @@
|
||||
+package co.aikar.timings.event;
|
||||
+
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+
|
||||
+public class TimingsModifyEvent extends TimingsEvent implements Cancellable {
|
||||
+
|
||||
+ private final @NotNull Action action;
|
||||
+ private final Action action;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public TimingsModifyEvent(@NotNull CommandSender sender, @NotNull Action action) {
|
||||
+ public TimingsModifyEvent(CommandSender sender, Action action) {
|
||||
+ super(Collections.singleton(sender));
|
||||
+ this.action = action;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull Action getAction() {
|
||||
+ public Action getAction() {
|
||||
+ return this.action;
|
||||
+ }
|
||||
+
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Expanded Insomnia API methods
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 8b2380241dbf40bd03941250a66e0a7b4a2282ec..d86f8f80e0873dccd24b186d4860d1e5dbe2f450 100644
|
||||
index aba730b762d6a0df8a5f115186f2faaf7a2cb75d..77db3f6bc082cc92c27775bd804fb678b377107e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -66,6 +66,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -52,6 +52,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Override
|
||||
@NotNull Player getPlayer();
|
||||
@@ -5,14 +5,14 @@ Subject: [PATCH] Add NPC to EntityType
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
index 1d1315262737d99bf9f5aabc0ae66eee4645cc65..825ad446bcee169c4735955d226dae18b512d7e3 100644
|
||||
index 6cf14afd2c1b8018c67c6cac302ae28bb12ab5a5..9ab641d268cd10a2c9bd888732d4754d520c56c7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EntityType.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
@@ -317,6 +317,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
|
||||
@@ -295,6 +295,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
|
||||
*/
|
||||
LIGHTNING("lightning_bolt", LightningStrike.class, -1, false),
|
||||
PLAYER("player", Player.class, -1, false),
|
||||
+ NPC("npc", NPC.class, -1, true),
|
||||
/**
|
||||
* An unknown entity without an Entity Class
|
||||
*/
|
||||
+ NPC("npc", NPC.class, -1, true),
|
||||
UNKNOWN(null, null, -1, false);
|
||||
|
||||
private final String name;
|
||||
28
patches/api/0015-Revert-BungeeChat-Deprecation.patch
Normal file
28
patches/api/0015-Revert-BungeeChat-Deprecation.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Wed, 15 Mar 2023 01:05:09 -0400
|
||||
Subject: [PATCH] Revert BungeeChat Deprecation
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 4b2330bac734cd07f8798ceeb6d9c67bd3f3521d..3c4eaa792da395db739f554bea69faba46a7bd12 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -27,7 +27,7 @@ dependencies {
|
||||
// api dependencies are listed transitively to API consumers
|
||||
api("com.google.guava:guava:31.1-jre")
|
||||
api("com.google.code.gson:gson:2.10")
|
||||
- api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.9") // Paper
|
||||
+ api("net.md-5:bungeecord-chat:1.16-R0.4") // Paper // Parchment - revert
|
||||
api("org.yaml:snakeyaml:2.0")
|
||||
api("org.joml:joml:1.10.5")
|
||||
// Paper start
|
||||
@@ -108,7 +108,7 @@ tasks.withType<Javadoc> {
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.0/",
|
||||
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
|
||||
// Paper start
|
||||
- //"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", // don't link to bungee chat
|
||||
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/", // don't link to bungee chat // Parchment - revert
|
||||
"https://jd.advntr.dev/api/$adventureVersion/",
|
||||
"https://jd.advntr.dev/text-minimessage/$adventureVersion/",
|
||||
"https://jd.advntr.dev/text-serializer-gson/$adventureVersion/",
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Add PreEntityShootBowEvent
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java b/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cd156e2d71728f8d30a12df87398875b1ec8915e
|
||||
index 0000000000000000000000000000000000000000..7368e7b039882dd629d187502c5c90d74471590e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
@@ -23,22 +23,22 @@ index 0000000000000000000000000000000000000000..cd156e2d71728f8d30a12df87398875b
|
||||
+public class PreEntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final @NotNull ItemStack bow;
|
||||
+ private final @NotNull ItemStack arrow;
|
||||
+ private final ItemStack bow;
|
||||
+ private final ItemStack arrow;
|
||||
+ boolean relative = true;
|
||||
+ boolean cancelled = false;
|
||||
+
|
||||
+ public PreEntityShootBowEvent(@NotNull Entity entity, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
|
||||
+ public PreEntityShootBowEvent(Entity entity, ItemStack bow, ItemStack arrow) {
|
||||
+ super(entity);
|
||||
+ this.bow = bow;
|
||||
+ this.arrow = arrow;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ItemStack getBow() {
|
||||
+ public ItemStack getBow() {
|
||||
+ return this.bow;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ItemStack getArrow() {
|
||||
+ public ItemStack getArrow() {
|
||||
+ return this.arrow;
|
||||
+ }
|
||||
+
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Wed, 15 Mar 2023 01:05:09 -0400
|
||||
Subject: [PATCH] Revert BungeeChat Deprecation
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f7786d4034afae1926bb249e282f3f204e09ba1a..f689a22e535bb007089b981fe803f1a6af4911c2 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -36,7 +36,7 @@ dependencies {
|
||||
api("com.google.guava:guava:32.1.2-jre")
|
||||
api("com.google.code.gson:gson:2.10.1")
|
||||
// Paper start - adventure
|
||||
- api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.18") {
|
||||
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") { // Parchment - revert
|
||||
exclude("com.google.guava", "guava")
|
||||
}
|
||||
// Paper - adventure
|
||||
@@ -154,7 +154,7 @@ tasks.withType<Javadoc> {
|
||||
"https://guava.dev/releases/32.1.2-jre/api/docs/",
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
|
||||
- // "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat
|
||||
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat
|
||||
// Paper start - add missing javadoc links
|
||||
"https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
||||
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
||||
@@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Fri, 15 Dec 2023 20:29:34 -0500
|
||||
Subject: [PATCH] Add Block BreakNaturally Overload
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0015bb89899e52d3c8f1ca68807ad7092e690305..2c384d6c1719a3b2b1335a3f2b7e826c1892bd69 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -590,6 +590,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
*/
|
||||
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
||||
|
||||
+ // Parchment Start
|
||||
+ /**
|
||||
+ * Breaks the block and spawns item drops as if a player had broken it
|
||||
+ * with a specific tool
|
||||
+ *
|
||||
+ * @param player The player to break the block as
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @param dropExperience drop exp if the block normally does so
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(Player player, @NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Causes the block to be ticked, this is different from {@link Block#randomTick()},
|
||||
* in that it is usually scheduled to occur, for example
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 21 Dec 2023 20:26:53 -0500
|
||||
Subject: [PATCH] Add CustomBlockUpdateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java b/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ae798a18bb07d83bfd3acefc222a48e29f9a3ec3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java
|
||||
@@ -0,0 +1,70 @@
|
||||
+package gg.projecteden.parchment.event.block;
|
||||
+
|
||||
+import org.bukkit.block.data.BlockData;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class CustomBlockUpdateEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ private BlockData block;
|
||||
+ private UpdateType updateType;
|
||||
+ private Location location;
|
||||
+
|
||||
+ public CustomBlockUpdateEvent(BlockData block, UpdateType updateType, Location location) {
|
||||
+ this.block = block;
|
||||
+ this.updateType = updateType;
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ public CustomBlockUpdateEvent(BlockData block, UpdateType updateType) {
|
||||
+ this.block = block;
|
||||
+ this.updateType = updateType;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ public BlockData getBlock() {
|
||||
+ return block;
|
||||
+ }
|
||||
+
|
||||
+ public UpdateType getUpdateType() {
|
||||
+ return updateType;
|
||||
+ }
|
||||
+
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum UpdateType {
|
||||
+ POWERED,
|
||||
+ SHAPE,
|
||||
+ INSTRUMENT,
|
||||
+ PITCH
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -1,273 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 15 Jan 2024 16:38:52 -0500
|
||||
Subject: [PATCH] Entity Data Storage
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityData.java b/src/main/java/gg/projecteden/parchment/entity/EntityData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c4b2cd54c6c0d595e67b0fa0f05a32afa40328b3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityData.java
|
||||
@@ -0,0 +1,140 @@
|
||||
+package gg.projecteden.parchment.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+
|
||||
+import java.util.*;
|
||||
+import java.util.function.Supplier;
|
||||
+
|
||||
+public final class EntityData {
|
||||
+ private static final Map<UUID, List<DataSlot>> PARKED = new HashMap<>();
|
||||
+ private static int DATA_IDX;
|
||||
+
|
||||
+ private final List<EntityDataFragment<?>> data = new ArrayList<>();
|
||||
+ private final Class<?> ownerType;
|
||||
+ private Entity owner;
|
||||
+
|
||||
+ EntityData(Class<?> ownerType) {
|
||||
+ this.ownerType = ownerType;
|
||||
+ }
|
||||
+
|
||||
+ public static <T extends EntityDataFragment<E>, E extends Entity> EntityDataKey<T, E> createKey(
|
||||
+ Supplier<T> generator,
|
||||
+ Class<E> ownerType
|
||||
+ ) {
|
||||
+ return new EntityDataKey<>(ownerType, generator, EntityData.DATA_IDX++);
|
||||
+ }
|
||||
+
|
||||
+ public static EntityData create(Entity entity) {
|
||||
+ EntityData data = new EntityData(entity.getClass());
|
||||
+
|
||||
+ List<DataSlot> slots = EntityData.PARKED.get(entity.getUniqueId());
|
||||
+ if (slots != null) {
|
||||
+ for (DataSlot slot : slots) {
|
||||
+ data.set(slot.idx, slot.data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ data.setOwner(entity);
|
||||
+
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ public <T extends EntityDataFragment<E>, E extends Entity> T get(EntityDataKey<T, E> key) {
|
||||
+ while (this.data.size() <= key.getIdx()) {
|
||||
+ this.data.add(null);
|
||||
+ }
|
||||
+
|
||||
+ T out = cast(this.data.get(key.getIdx()));
|
||||
+ if (out == null) {
|
||||
+ this.checkEntityType(key.ownerType);
|
||||
+
|
||||
+ out = key.getGenerator().get();
|
||||
+ out.setOwner(cast(this.owner));
|
||||
+
|
||||
+ this.data.set(key.getIdx(), out);
|
||||
+ }
|
||||
+
|
||||
+ return out;
|
||||
+ }
|
||||
+
|
||||
+ public <T extends EntityDataFragment<E>, E extends Entity> boolean clear(EntityDataKey<T, E> key) {
|
||||
+ if (this.data.size() <= key.getIdx()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ this.checkEntityType(key.ownerType);
|
||||
+ return this.data.set(key.getIdx(), null) != null;
|
||||
+ }
|
||||
+
|
||||
+ public void orphan() {
|
||||
+ for (EntityDataFragment<?> frag : this.data) {
|
||||
+ if (frag != null) {
|
||||
+ frag.onOrphan();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ List<DataSlot> persist = new ArrayList<>();
|
||||
+
|
||||
+ for (int i = this.data.size() - 1; i >= 0; i--) {
|
||||
+ EntityDataFragment<?> frag = this.data.get(i);
|
||||
+ if (frag != null && frag.isPersistent()) {
|
||||
+ persist.add(new DataSlot(frag, i));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!persist.isEmpty()) {
|
||||
+ EntityData.PARKED.put(this.owner.getUniqueId(), persist);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ void set(int slot, EntityDataFragment<?> data) {
|
||||
+ while (this.data.size() <= slot) {
|
||||
+ this.data.add(null);
|
||||
+ }
|
||||
+
|
||||
+ this.data.set(slot, data);
|
||||
+ }
|
||||
+
|
||||
+ void setOwner(Entity entity) {
|
||||
+ Class<?> ownerType = entity.getClass();
|
||||
+ if (!ownerType.equals(this.ownerType)) {
|
||||
+ throw new IllegalArgumentException(String.format(
|
||||
+ "Wrong entity type. (entity=%s@%s, expect=%s@%s)",
|
||||
+ ownerType, ownerType.getClassLoader(),
|
||||
+ this.ownerType, this.ownerType.getClassLoader()
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ this.owner = entity;
|
||||
+
|
||||
+ for (EntityDataFragment<?> frag : this.data) {
|
||||
+ if (frag != null) {
|
||||
+ frag.setOwner(cast(entity));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void checkEntityType(Class<?> ownerType) {
|
||||
+ if (!ownerType.isAssignableFrom(this.ownerType)) {
|
||||
+ throw new IllegalArgumentException(String.format(
|
||||
+ "Incompatible entity types. (key=%s@%s, expect=%s@%s)",
|
||||
+ ownerType, ownerType.getClassLoader(),
|
||||
+ this.ownerType, this.ownerType.getClassLoader()
|
||||
+ ));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private <S, T> T cast(S src) {
|
||||
+ return (T) src;
|
||||
+ }
|
||||
+
|
||||
+ private static final class DataSlot {
|
||||
+ private final EntityDataFragment<?> data;
|
||||
+ private final int idx;
|
||||
+
|
||||
+ private DataSlot(EntityDataFragment<?> data, int idx) {
|
||||
+ this.data = data;
|
||||
+ this.idx = idx;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c3d43c27a61155036e3f74e781da14ab0bc58d5f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java
|
||||
@@ -0,0 +1,34 @@
|
||||
+package gg.projecteden.parchment.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+
|
||||
+public abstract class EntityDataFragment<E extends Entity> {
|
||||
+ private E owner;
|
||||
+ private boolean persistent = true;
|
||||
+
|
||||
+ protected EntityDataFragment() {
|
||||
+ }
|
||||
+
|
||||
+ protected void onOwnerChange() {
|
||||
+ }
|
||||
+
|
||||
+ protected void onOrphan() {
|
||||
+ }
|
||||
+
|
||||
+ protected final E getOwner() {
|
||||
+ return this.owner;
|
||||
+ }
|
||||
+
|
||||
+ protected final void setPersistent(boolean persistent) {
|
||||
+ this.persistent = persistent;
|
||||
+ }
|
||||
+
|
||||
+ final boolean isPersistent() {
|
||||
+ return this.persistent;
|
||||
+ }
|
||||
+
|
||||
+ final void setOwner(E entity) {
|
||||
+ this.owner = entity;
|
||||
+ this.onOwnerChange();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c52c8371b2edf4f62533ffcbc7f8d7b1dbc90777
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package gg.projecteden.parchment.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+
|
||||
+import java.util.function.Supplier;
|
||||
+
|
||||
+public final class EntityDataKey<T extends EntityDataFragment<E>, E extends Entity> {
|
||||
+ private final Supplier<T> generator;
|
||||
+ private final int idx;
|
||||
+
|
||||
+ final Class<E> ownerType;
|
||||
+
|
||||
+ EntityDataKey(Class<E> ownerType, Supplier<T> generator, int idx) {
|
||||
+ this.generator = generator;
|
||||
+ this.idx = idx;
|
||||
+
|
||||
+ this.ownerType = ownerType;
|
||||
+ }
|
||||
+
|
||||
+ Supplier<T> getGenerator() {
|
||||
+ return this.generator;
|
||||
+ }
|
||||
+
|
||||
+ int getIdx() {
|
||||
+ return this.idx;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c9f9c0d235f33925ee247ba4af56bf9f31bf7056
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package gg.projecteden.parchment.entity;
|
||||
+
|
||||
+public final class EntityDataServiceKey<S> {
|
||||
+ private final Class<S> serviceType;
|
||||
+ private S service;
|
||||
+
|
||||
+ public EntityDataServiceKey(Class<S> serviceType) {
|
||||
+ this.serviceType = serviceType;
|
||||
+ }
|
||||
+
|
||||
+ public S get() {
|
||||
+ if (this.service == null) {
|
||||
+ throw new IllegalStateException("Service is not initialized.");
|
||||
+ }
|
||||
+
|
||||
+ return this.service;
|
||||
+ }
|
||||
+
|
||||
+ public void set(S service) {
|
||||
+ if (this.service != null) {
|
||||
+ throw new IllegalStateException("Service is already initialized.");
|
||||
+ }
|
||||
+
|
||||
+ if (!this.serviceType.isInstance(service)) {
|
||||
+ throw new IllegalArgumentException("Value does not implement service contract.");
|
||||
+ }
|
||||
+
|
||||
+ this.service = service;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 8f35e0c9e778d98ca191d45eec76a7a74d51959a..f865c4dbdf29e3cd718de7a325d478252895d940 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1155,4 +1155,7 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ gg.projecteden.parchment.entity.EntityData getStoredEntityData();
|
||||
+
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 15 Jan 2024 20:53:14 -0500
|
||||
Subject: [PATCH] Add Sidebar Utility
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java b/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b0c704387e566d76d097595c35d06d8e5cbe204f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java
|
||||
@@ -0,0 +1,123 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import gg.projecteden.parchment.entity.EntityData;
|
||||
+import gg.projecteden.parchment.entity.EntityDataFragment;
|
||||
+import gg.projecteden.parchment.entity.EntityDataKey;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+import java.util.Objects;
|
||||
+
|
||||
+public final class Sidebar extends EntityDataFragment<Player> {
|
||||
+ private static final EntityDataKey<Sidebar, Player> DATA_KEY = EntityData.createKey(Sidebar::new, Player.class);
|
||||
+
|
||||
+ private final SidebarBuffer[] buffer = new SidebarBuffer[2];
|
||||
+
|
||||
+ private final StageImpl stage = new StageImpl();
|
||||
+ private final Runnable layoutListener;
|
||||
+
|
||||
+ private SidebarLayout layout;
|
||||
+
|
||||
+ private boolean visible;
|
||||
+ private int back;
|
||||
+
|
||||
+ public static Sidebar get(Player player) {
|
||||
+ Objects.requireNonNull(player);
|
||||
+
|
||||
+ return player.getStoredEntityData().get(Sidebar.DATA_KEY);
|
||||
+ }
|
||||
+
|
||||
+ private Sidebar() {
|
||||
+ this.buffer[0] = SidebarBufferUtilSpec.IMPL_KEY.get().create("_sidebar_l");
|
||||
+ this.buffer[1] = SidebarBufferUtilSpec.IMPL_KEY.get().create("_sidebar_r");
|
||||
+
|
||||
+ this.layoutListener = () -> {
|
||||
+ this.layout.update(this.stage);
|
||||
+ this.flush();
|
||||
+ };
|
||||
+
|
||||
+ this.setPersistent(false);
|
||||
+ }
|
||||
+
|
||||
+ public void applyLayout(SidebarLayout layout) {
|
||||
+ if (this.layout != null) {
|
||||
+ this.layout.unsubscribe(this.layoutListener);
|
||||
+ this.buffer[this.back].clear();
|
||||
+ }
|
||||
+
|
||||
+ this.layout = layout;
|
||||
+
|
||||
+ if (layout == null) {
|
||||
+ this.hide();
|
||||
+ } else {
|
||||
+ layout.setup(this.stage);
|
||||
+ this.flush();
|
||||
+
|
||||
+ layout.subscribe(this.layoutListener);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void setTitle(String title) {
|
||||
+ this.buffer[this.back].setTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ private void setLine(int idx, String value, String display) {
|
||||
+ if (value == null) {
|
||||
+ this.buffer[this.back].clearLine(idx);
|
||||
+ } else {
|
||||
+ this.buffer[this.back].setLine(idx, value, display);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void flush() {
|
||||
+ SidebarBuffer front = this.buffer[this.back];
|
||||
+ SidebarBuffer back = this.buffer[this.back ^ 1];
|
||||
+ boolean shouldShow = !this.visible;
|
||||
+
|
||||
+ if (front.hasDiverged(back)) {
|
||||
+ front.pushChanges();
|
||||
+
|
||||
+ back.sync(front);
|
||||
+ this.back ^= 1;
|
||||
+
|
||||
+ shouldShow = true;
|
||||
+ }
|
||||
+
|
||||
+ if (shouldShow) {
|
||||
+ front.setActive();
|
||||
+ this.visible = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void hide() {
|
||||
+ SidebarBufferUtilSpec.IMPL_KEY.get().hideSidebar(this.getOwner());
|
||||
+ this.visible = false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void onOwnerChange() {
|
||||
+ this.buffer[0].setOwner(this.getOwner());
|
||||
+ this.buffer[1].setOwner(this.getOwner());
|
||||
+
|
||||
+ if (this.visible) {
|
||||
+ this.buffer[this.back ^ 1].setActive();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private final class StageImpl implements SidebarStage {
|
||||
+ @Override
|
||||
+ public void setTitle(String title) {
|
||||
+ Sidebar.this.setTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setLine(int line, String value) {
|
||||
+ this.setLine(line, value, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setLine(int line, String value, String display) {
|
||||
+ Sidebar.this.setLine(line, value, display);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ec13738dc625464d7fa41484ee44583ef82248fd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Objects;
|
||||
+
|
||||
+public abstract class SidebarBuffer {
|
||||
+
|
||||
+ @SuppressWarnings("StringOperationCanBeSimplified")
|
||||
+ private static final String AUTO_SPACE = new String();
|
||||
+ protected final String name;
|
||||
+ protected final int size;
|
||||
+ protected final String[] liveLines;
|
||||
+ protected final String[] stagedLines;
|
||||
+ protected final String[] liveDisplays;
|
||||
+ protected final String[] stagedDisplays;
|
||||
+
|
||||
+ protected String liveTitle = "";
|
||||
+ protected String stagedTitle = "";
|
||||
+
|
||||
+ protected SidebarBuffer(String name, int size) {
|
||||
+ this.name = name;
|
||||
+ this.size = size;
|
||||
+ this.liveLines = new String[size];
|
||||
+ this.stagedLines = new String[size];
|
||||
+ this.liveDisplays = new String[size];
|
||||
+ this.stagedDisplays = new String[size];
|
||||
+ }
|
||||
+
|
||||
+ protected abstract void setActive();
|
||||
+
|
||||
+ protected abstract void pushChanges();
|
||||
+
|
||||
+ protected abstract void setOwner(Player player);
|
||||
+
|
||||
+ protected abstract boolean checkTitle(String title);
|
||||
+
|
||||
+ protected abstract boolean checkLine(String line);
|
||||
+
|
||||
+ void setTitle(String title) {
|
||||
+ this.stagedTitle = Objects.requireNonNullElse(title, "");
|
||||
+ }
|
||||
+
|
||||
+ void setLine(int line, String value, String display) {
|
||||
+ Objects.requireNonNull(value);
|
||||
+ if (line < 0 || line > this.size - 1) {
|
||||
+ throw new IndexOutOfBoundsException();
|
||||
+ }
|
||||
+
|
||||
+ this.stagedLines[line] = value;
|
||||
+ this.stagedDisplays[line] = display;
|
||||
+
|
||||
+ for (int i = line - 1; i >= 0; i--) {
|
||||
+ if (this.stagedLines[i] == null) {
|
||||
+ this.stagedLines[i] = SidebarBuffer.AUTO_SPACE;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ void clearLine(int line) {
|
||||
+ if (line < 0 || line > this.size - 1) {
|
||||
+ throw new IndexOutOfBoundsException();
|
||||
+ }
|
||||
+
|
||||
+ this.stagedLines[line] = SidebarBuffer.AUTO_SPACE;
|
||||
+
|
||||
+ if (line + 1 == this.size || this.stagedLines[line + 1] == null) {
|
||||
+ for (int i = line; i >= 0; i--) {
|
||||
+ if (this.stagedLines[i] == SidebarBuffer.AUTO_SPACE) {
|
||||
+ this.stagedLines[i] = null;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ void sync(SidebarBuffer live) {
|
||||
+ this.stagedTitle = live.liveTitle;
|
||||
+ System.arraycopy(live.liveLines, 0, this.stagedLines, 0, this.size);
|
||||
+ System.arraycopy(live.liveDisplays, 0, this.stagedDisplays, 0, this.size);
|
||||
+ }
|
||||
+
|
||||
+ void clear() {
|
||||
+ this.stagedTitle = "";
|
||||
+ Arrays.fill(this.stagedLines, null);
|
||||
+ Arrays.fill(this.stagedDisplays, null);
|
||||
+ }
|
||||
+
|
||||
+ boolean hasDiverged(SidebarBuffer live) {
|
||||
+ boolean out = !Objects.equals(this.stagedTitle, live.liveTitle);
|
||||
+ out = out || !Arrays.equals(this.stagedLines, live.liveLines);
|
||||
+ out = out || !Arrays.equals(this.stagedDisplays, live.liveDisplays);
|
||||
+
|
||||
+ return out;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..22239d7ea5d632f306caba0d139fe1576e85a7dc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import gg.projecteden.parchment.entity.EntityDataServiceKey;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+public interface SidebarBufferUtilSpec {
|
||||
+ EntityDataServiceKey<SidebarBufferUtilSpec> IMPL_KEY = new EntityDataServiceKey<>(SidebarBufferUtilSpec.class);
|
||||
+
|
||||
+ SidebarBuffer create(String bufferName);
|
||||
+
|
||||
+ void hideSidebar(Player player);
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..238d2c1338aee95b24fd31c9643e0f966fe0b79f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+/**
|
||||
+ * A sidebar layout. Subclasses can describe custom layouts by using the
|
||||
+ * {@link #setup(SidebarStage)} and {@link #update(SidebarStage)} hooks.
|
||||
+ */
|
||||
+public abstract class SidebarLayout {
|
||||
+ private final Set<Runnable> subscribers = new HashSet<>();
|
||||
+
|
||||
+ /**
|
||||
+ * Pushes an update to all subscribers.
|
||||
+ */
|
||||
+ public final void refresh() {
|
||||
+ synchronized (this.subscribers) {
|
||||
+ for (Runnable s : this.subscribers) {
|
||||
+ s.run();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Runs when the layout is first applied.
|
||||
+ *
|
||||
+ * <p> The provided sidebar stage may be used to create the first
|
||||
+ * frame of sidebar data, which will be pushed to the client upon
|
||||
+ * exit of this method.
|
||||
+ *
|
||||
+ * @param stage The sidebar stage. Using it outside this method will
|
||||
+ * result in undefined behavior.
|
||||
+ */
|
||||
+ protected void setup(SidebarStage stage) {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Runs when a refresh is requested.
|
||||
+ *
|
||||
+ * <p> The provided sidebar stage may be used to update the existing
|
||||
+ * sidebar data, which will be pushed to the client upon exit of
|
||||
+ * this method. Sidebar data from previous hook calls will stay the
|
||||
+ * same unless explicitly changed here.
|
||||
+ *
|
||||
+ * @param stage The sidebar stage. Using it outside this method will
|
||||
+ * result in undefined behavior.
|
||||
+ */
|
||||
+ protected void update(SidebarStage stage) {
|
||||
+ }
|
||||
+
|
||||
+ final void subscribe(Runnable listener) {
|
||||
+ this.subscribers.add(listener);
|
||||
+ }
|
||||
+
|
||||
+ final void unsubscribe(Runnable listener) {
|
||||
+ this.subscribers.remove(listener);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9e604d3b8183abe342ef5c055069f1c4b16df55c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+/**
|
||||
+ * An abstracted sidebar stage.
|
||||
+ */
|
||||
+public interface SidebarStage {
|
||||
+ /**
|
||||
+ * Stages a new title.
|
||||
+ *
|
||||
+ * @param title The new title.
|
||||
+ */
|
||||
+ void setTitle(String title);
|
||||
+
|
||||
+ /**
|
||||
+ * Stages a new line at the provided index.
|
||||
+ *
|
||||
+ * @param line The line index.
|
||||
+ * @param value The new line.
|
||||
+ */
|
||||
+ void setLine(int line, String value);
|
||||
+
|
||||
+ /**
|
||||
+ * Stages a new line at the provided index
|
||||
+ * Uses the display as the right aligned text
|
||||
+ *
|
||||
+ * @param line The line index
|
||||
+ * @param value The new line
|
||||
+ * @param display The right aligned text
|
||||
+ */
|
||||
+ void setLine(int line, String value, String display);
|
||||
+
|
||||
+}
|
||||
@@ -5,55 +5,35 @@ Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..34f1acc44c17b53d93b750a35817131145db454f 100644
|
||||
index e7a03ea1dab56e7725f718da0b44c736018ac995..61677ea29c30ce02c9d7a19db18582d1f3024cb8 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -1,6 +1,8 @@
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.time.Instant
|
||||
|
||||
+val edenVersion: String by project // Parchment
|
||||
+
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
@@ -13,7 +15,9 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
@@ -7,8 +7,8 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":paper-api"))
|
||||
+ // Parchment start
|
||||
+ implementation(project(":parchment-api"))
|
||||
+ // Parchment end
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ implementation(project(":parchment-api")) // Parchment
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:${project.version}") // Parchment
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -80,14 +84,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
@@ -62,7 +62,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
- "Implementation-Title" to "Paper",
|
||||
+ "Implementation-Title" to "Parchment",
|
||||
"Implementation-Version" to implementationVersion,
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Parchment-$implementationVersion", // Parchment
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
- "Specification-Title" to "Paper",
|
||||
+ "Specification-Title" to "Parchment",
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
- "Specification-Vendor" to "Paper Team",
|
||||
- "Brand-Id" to "papermc:paper",
|
||||
- "Brand-Name" to "Paper",
|
||||
+ "Specification-Vendor" to "Project Eden",
|
||||
+ "Brand-Id" to "projectedengg:parchment",
|
||||
+ "Brand-Name" to "Parchment",
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
@@ -108,6 +112,27 @@ tasks.compileTestJava {
|
||||
|
||||
@@ -80,6 +80,27 @@ tasks.jar {
|
||||
publishing {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifact(tasks.shadowJar)
|
||||
+ // Parchment start
|
||||
+ artifact(tasks.jar)
|
||||
+ artifact(tasks.reobfJar)
|
||||
+ groupId = project.group as String?
|
||||
+ artifactId = "parchment"
|
||||
+ version = project.version as String?
|
||||
@@ -76,7 +56,7 @@ index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..34f1acc44c17b53d93b750a358171311
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +169,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -134,7 +155,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
@@ -86,7 +66,7 @@ index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..34f1acc44c17b53d93b750a358171311
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..4dca3956a76a9d57b3167f73696cf5d55d84606c 100644
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..bf6d9879810359216a60d1efe1d1bd9e23e55b1e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -73,7 +73,7 @@ public class Metrics {
|
||||
@@ -94,36 +74,73 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..4dca3956a76a9d57b3167f73696cf5d5
|
||||
|
||||
// Start submitting the data
|
||||
- startSubmitting();
|
||||
+ // startSubmitting(); // Parchment
|
||||
+ // startSubmitting();
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..87db580c74d20714e2ebe01df23811c79d1f8331 100644
|
||||
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..325561b00d1ed2d5cceb399b023dc59e2d1c7807 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -49,7 +49,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
|
||||
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
|
||||
} else {
|
||||
- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build);
|
||||
+ updateMessage = getUpdateStatusMessage("ProjectEdenGG/Parchment", build);
|
||||
}
|
||||
final @Nullable Component history = this.getHistory();
|
||||
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
|
||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
||||
+ String[] parts = serverVersion.substring("git-Parchment-".length()).split("[-\\s]");
|
||||
+ final Component updateMessage = getUpdateStatusMessage("ProjectEdenGG/Parchment", GITHUB_BRANCH_NAME, parts[0]); // Parchment
|
||||
final Component history = getHistory();
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
@@ -45,7 +45,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
String result = matcher.group();
|
||||
mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
|
||||
} else {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
|
||||
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to ProjectEdenGG!");
|
||||
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
||||
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index fb82bb52f219e7683fe1d3c0fb3acbe2251de8d4..476aa9a9921b9b6026def89c64d730ba08495dd8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1681,7 +1681,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Parchment"; // Parchment - Parchment > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ffa27c9c02dc4d12411fc089de3af8e8e12ba06e..46831bd86a010c7f0116473876fd90af5abdce4b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Parchment"; // Parchment // Paper
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index e02102280ed1dc300191d19bbca8f00e17701753..9b5d9729288ac11d21365c900a3b2af454c765dc 100644
|
||||
index 717e292040ed7779eb4b6c5fa26665d3df9024e7..9f0a8daf4d9488d348de9ce880a0cdae6b19d738 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -303,7 +303,7 @@ public class Main {
|
||||
@@ -292,7 +292,7 @@ public class Main {
|
||||
if (buildDate.before(deadline.getTime())) {
|
||||
// Paper start - This is some stupid bullshit
|
||||
System.err.println("*** Warning, you've not updated in a while! ***");
|
||||
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
|
||||
+ System.err.println("*** Please download a new build as per instructions from https://github.com/ProjectEdenGG/Parchment ***"); // Paper
|
||||
+ System.err.println("*** Please download a new build as per instructions from https://github.com/ProjectEdenGG/Parchment ***"); // Parchment
|
||||
//System.err.println("*** Server will start in 20 seconds ***");
|
||||
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
||||
// Paper end
|
||||
// Paper End
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..6f1b3fa6ebeabc7596034663ed06686fd3892267 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -138,7 +155,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..6f1b3fa6ebeabc7596034663ed06686f
|
||||
|
||||
if (stream != null) {
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 6db566e3111ec08a99aa429624979cb83a85e272..d3a5867e9202d1f34e66c4e6d3842211c40a6255 100644
|
||||
index 98fba0288be9ed2cb18ffba5cf81148157dd4fcf..69a07076e8876a4db8f068189bf67c70f2a74e27 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -162,7 +162,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
|
||||
@@ -4,33 +4,16 @@ Date: Sat, 19 Jun 2021 18:03:59 -0400
|
||||
Subject: [PATCH] Temporary Access Transformers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Holder.java b/src/main/java/net/minecraft/core/Holder.java
|
||||
index d7bbf60ba94ecd85f991a0c5c70c34fdb00ec9d5..724adc4c35aece988af815e7886fcbd727f0e27e 100644
|
||||
--- a/src/main/java/net/minecraft/core/Holder.java
|
||||
+++ b/src/main/java/net/minecraft/core/Holder.java
|
||||
@@ -137,6 +137,12 @@ public interface Holder<T> {
|
||||
return new Holder.Reference<>(Holder.Reference.Type.INTRUSIVE, owner, null, value);
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ public static <T> Holder.Reference<T> create(HolderOwner<T> owner, @Nullable ResourceKey<T> registryKey, @Nullable T value) {
|
||||
+ return new Holder.Reference<>(Holder.Reference.Type.STAND_ALONE, owner, registryKey, value);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
public ResourceKey<T> key() {
|
||||
if (this.key == null) {
|
||||
throw new IllegalStateException("Trying to access unbound value '" + this.value + "' from registry " + this.owner);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..45a5f63268ebd67d6601e86e33f9fa5fd458ad0c 100644
|
||||
index b0204af850ee182773ad458208cccd946ad148d5..92980f04bc1bac9924907007eb63fd04eba3875c 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -183,7 +183,7 @@ public class BlockItem extends Item {
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public class BlockItem extends Item {
|
||||
}).orElse(state);
|
||||
}
|
||||
|
||||
- protected boolean canPlace(BlockPlaceContext context, BlockState state) {
|
||||
+ public boolean canPlace(BlockPlaceContext context, BlockState state) { // Parchment: protected -> public
|
||||
+ public boolean canPlace(BlockPlaceContext context, BlockState state) { // Parchment
|
||||
Player entityhuman = context.getPlayer();
|
||||
CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman);
|
||||
// CraftBukkit start - store default return
|
||||
|
||||
@@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..44245b61f64e4e2eb21ac4f5e540aa9a
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
index badd85a92f38caae257181f67a322fc79599d1ce..4fc829f26512159f430ea26af462bbad0d602149 100644
|
||||
index 3dc613116c086444ece88bcb0a569eeea953074f..c454ed979e4a2ef36bf0a8c7bd1bb64a62f59a5f 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -363,6 +363,40 @@ public final class PaperAdventure {
|
||||
@@ -335,6 +335,33 @@ public final class PaperAdventure {
|
||||
return asVanilla(source);
|
||||
}
|
||||
|
||||
@@ -62,16 +62,8 @@ index badd85a92f38caae257181f67a322fc79599d1ce..4fc829f26512159f430ea26af462bbad
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static Optional<SoundEvent> asVanillaSound(final Key key) {
|
||||
+ return BuiltInRegistries.SOUND_EVENT.getOptional(asVanilla(key));
|
||||
+ }
|
||||
+
|
||||
+ public static Optional<Holder.Reference<SoundEvent>> asSoundHolder(final net.minecraft.resources.ResourceKey<SoundEvent> key) {
|
||||
+ return BuiltInRegistries.SOUND_EVENT.getHolder(key);
|
||||
+ }
|
||||
+
|
||||
+ public static Optional<Holder.Reference<net.minecraft.sounds.SoundEvent>> asVanillaSoundHolder(final Key key) {
|
||||
+ return asSoundHolder(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.SOUND_EVENT, asVanilla(key)));
|
||||
+ public static java.util.Optional<net.minecraft.sounds.SoundEvent> asVanillaSound(final Key key) {
|
||||
+ return net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.getOptional(asVanilla(key));
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("PatternValidation")
|
||||
@@ -79,107 +71,100 @@ index badd85a92f38caae257181f67a322fc79599d1ce..4fc829f26512159f430ea26af462bbad
|
||||
+ return Key.key(key.getNamespace(), key.getPath());
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
+
|
||||
public static Packet<?> asSoundPacket(final Sound sound, final double x, final double y, final double z, final long seed, @Nullable BiConsumer<Packet<?>, Float> packetConsumer) {
|
||||
final ResourceLocation name = asVanilla(sound.name());
|
||||
final Optional<SoundEvent> soundEvent = BuiltInRegistries.SOUND_EVENT.getOptional(name);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..c3891adadf9b49c8b17ec387bb63713285621b76 100644
|
||||
index 18aac3da3c88f33b1a71a5920a8daa27e9723913..f8da87074468b34b18c774fba6868373ecb8a8a7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1813,12 +1813,46 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public void playSeededSound(@Nullable Player source, double x, double y, double z, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
- this.server.getPlayerList().broadcast(source, x, y, z, (double) ((SoundEvent) sound.value()).getRange(volume), this.dimension(), new ClientboundSoundPacket(sound, category, x, y, z, volume, pitch, seed));
|
||||
@@ -2818,4 +2818,41 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return this.server.getPlayerList().getPlayer(uuid);
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ public void playSeededSound(@org.jetbrains.annotations.Nullable Player except, double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ source == null ? null : source.getBukkitEntity(),
|
||||
+ net.kyori.adventure.sound.Sound.sound()
|
||||
+ .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
|
||||
+ key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
|
||||
+ soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.getLocation())
|
||||
+ ))
|
||||
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
|
||||
+ .volume(volume)
|
||||
+ .pitch(pitch)
|
||||
+ .seed(seed)
|
||||
+ .build(),
|
||||
+ except == null ? null : except.getBukkitEntity(),
|
||||
+ net.kyori.adventure.sound.Sound.sound(
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category),
|
||||
+ volume,
|
||||
+ pitch
|
||||
+ ),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(this, x, y, z),
|
||||
+ seed,
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
|
||||
+ null
|
||||
+ ));
|
||||
+ // Parchment end
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(@Nullable Player source, Entity entity, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
- this.server.getPlayerList().broadcast(source, entity.getX(), entity.getY(), entity.getZ(), (double) ((SoundEvent) sound.value()).getRange(volume), this.dimension(), new ClientboundSoundEntityPacket(sound, category, entity, volume, pitch, seed));
|
||||
+ }
|
||||
+
|
||||
+ public void playSeededSound(@org.jetbrains.annotations.Nullable Player except, Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ source == null ? null : source.getBukkitEntity(),
|
||||
+ net.kyori.adventure.sound.Sound.sound()
|
||||
+ .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
|
||||
+ key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
|
||||
+ soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.getLocation())
|
||||
+ ))
|
||||
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
|
||||
+ .volume(volume)
|
||||
+ .pitch(pitch)
|
||||
+ .seed(seed)
|
||||
+ .build(),
|
||||
+ except == null ? null : except.getBukkitEntity(),
|
||||
+ net.kyori.adventure.sound.Sound.sound(
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category),
|
||||
+ volume,
|
||||
+ pitch
|
||||
+ ),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(entity),
|
||||
+ seed,
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
|
||||
+ null
|
||||
+ ));
|
||||
+ // Parchment end
|
||||
}
|
||||
|
||||
@Override
|
||||
+ }
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index a645ad66af061966c5e47cae677026b35a55c486..b1e1717b3b63b9c554c7925ed63ed217bff7e792 100644
|
||||
index 5fad40fa88f697108e42461c41012d5964ed7d75..26857b67e403d650387cf789f3778bbced7ea0a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2528,7 +2528,20 @@ public class ServerPlayer extends Player {
|
||||
@@ -2328,7 +2328,19 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void playNotifySound(SoundEvent sound, SoundSource category, float volume, float pitch) {
|
||||
- this.connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound), category, this.getX(), this.getY(), this.getZ(), volume, pitch, this.random.nextLong()));
|
||||
public void playNotifySound(SoundEvent event, SoundSource category, float volume, float pitch) {
|
||||
- this.connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event), category, this.getX(), this.getY(), this.getZ(), volume, pitch, this.random.nextLong()));
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ null,
|
||||
+ net.kyori.adventure.sound.Sound.sound()
|
||||
+ .type(io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()))
|
||||
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
|
||||
+ .volume(volume)
|
||||
+ .pitch(pitch)
|
||||
+ .seed(this.random.nextLong())
|
||||
+ .build(),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(level(), getX(), getY(), getZ()),
|
||||
+ _sound -> 0d, soundEvent -> java.util.Collections.singletonList(getBukkitEntity())
|
||||
+ net.kyori.adventure.sound.Sound.sound(
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(event.getLocation()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category),
|
||||
+ volume,
|
||||
+ pitch
|
||||
+ ),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(this.level(), getX(), getY(), getZ()),
|
||||
+ this.random.nextLong(), sound -> 0d, soundEvent -> java.util.Collections.singletonList(getBukkitEntity())
|
||||
+ ));
|
||||
+ // Parchment end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index a2142930b4d4b05987c90496fb9d733d99040aa0..ca96202a50f36dfc870e418c7816bc871f098eab 100644
|
||||
index 683b5d78f9e3dc34e40c54683f64be32317797ac..96b79fbd763fe981862d5e1d73a3dd71f5da445f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -967,7 +967,7 @@ public abstract class PlayerList {
|
||||
@@ -946,7 +946,7 @@ public abstract class PlayerList {
|
||||
BlockState data = worldserver1.getBlockState(blockposition);
|
||||
worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3);
|
||||
}
|
||||
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
|
||||
+ entityplayer1.playNotifySound(SoundEvents.RESPAWN_ANCHOR_DEPLETE.value(), SoundSource.BLOCKS, 1.0F, 1.0F); // Parchment - use existing play sound method
|
||||
// Paper end - Fix SPIGOT-5989
|
||||
// Paper end
|
||||
}
|
||||
// Added from changeDimension
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 686374e89e41b0917791264f3281f7384835bca8..75995354090771370ba6b4aa8f4ded28186583e8 100644
|
||||
index 58152160d609d0e9d105153aeb166a56a7955603..66866e1dabe79a78df255fc17842bdb36988d86f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1882,7 +1882,21 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1918,7 +1918,21 @@ public abstract class Player extends LivingEntity {
|
||||
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
|
||||
if (fromEntity instanceof ServerPlayer) {
|
||||
@@ -187,26 +172,26 @@ index 686374e89e41b0917791264f3281f7384835bca8..75995354090771370ba6b4aa8f4ded28
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ null,
|
||||
+ net.kyori.adventure.sound.Sound.sound()
|
||||
+ .type(io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEffect.getLocation()))
|
||||
+ .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(soundCategory))
|
||||
+ .volume(volume)
|
||||
+ .pitch(pitch)
|
||||
+ .seed(fromEntity.random.nextLong())
|
||||
+ .build(),
|
||||
+ net.kyori.adventure.sound.Sound.sound(
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEffect.getLocation()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(soundCategory),
|
||||
+ volume,
|
||||
+ pitch
|
||||
+ ),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(fromEntity.level(), x, y, z),
|
||||
+ fromEntity.random.nextLong(),
|
||||
+ sound -> 0d,
|
||||
+ soundEvent -> java.util.Collections.singletonList(((ServerPlayer) fromEntity).getBukkitEntity())
|
||||
+ ));
|
||||
+ // Parchment end
|
||||
}
|
||||
}
|
||||
// Paper end - send while respecting visibility
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
index fdff9788eaf663be79214b2ca491f0f0444f6136..4b26f4a4620bacd40efe22b685f48fdda1012e8a 100644
|
||||
index f7399737548483905f3b5c08a03876b0da54b714..e668de87a5b58febf451fe4be79e47143f4eab01 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -564,7 +564,7 @@ public class Raid {
|
||||
@@ -538,7 +538,7 @@ public class Raid {
|
||||
double d2 = vec3d.z + 13.0D / d0 * (vec3d1.z - vec3d.z);
|
||||
|
||||
if (d0 <= 64.0D || collection.contains(entityplayer)) {
|
||||
@@ -216,33 +201,44 @@ index fdff9788eaf663be79214b2ca491f0f0444f6136..4b26f4a4620bacd40efe22b685f48fdd
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 34b91eff3190848bae38b20e1d956ece497b1473..75a3d42d0ac458e1f7161e88cf27ec6087828926 100644
|
||||
index a9a58f0bb19e034cffdafcc38fdc9003744a5d6c..f238fda2543d3dae4d66c83a2230f858aff822df 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2182,4 +2182,42 @@ public class CraftEventFactory {
|
||||
@@ -2011,4 +2011,53 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
// Paper end - add EntityFertilizeEggEvent
|
||||
+
|
||||
+ // Parchment start
|
||||
+ private static net.minecraft.network.protocol.@org.jetbrains.annotations.NotNull Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> handleSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event, CraftPlayer recipient) {
|
||||
+ // init variables
|
||||
+ net.kyori.adventure.sound.Sound sound = event.calculateSound(recipient);
|
||||
+ ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name());
|
||||
+ gg.projecteden.parchment.event.sound.SoundEvent.Emitter emitter = event.calculateEmitter(recipient);
|
||||
+ net.minecraft.sounds.SoundSource source = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source());
|
||||
+ float volume = sound.volume();
|
||||
+ float pitch = sound.pitch();
|
||||
+ long seed = sound.seed().orElse(0L); // TODO: random source?
|
||||
+ net.minecraft.resources.ResourceKey<net.minecraft.sounds.SoundEvent> soundKey = net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.SOUND_EVENT, name);
|
||||
+ net.minecraft.core.Holder.Reference<net.minecraft.sounds.SoundEvent> soundEvent = io.papermc.paper.adventure.PaperAdventure.asVanillaSoundHolder(sound.name()) // TODO: calculate event distance?
|
||||
+ .orElseGet(() -> net.minecraft.core.Holder.Reference.create(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.holderOwner(), soundKey, net.minecraft.sounds.SoundEvent.createFixedRangeEvent(name, (float) event.calculateDistance())));
|
||||
+ if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter entityEmitter)
|
||||
+ return new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(soundEvent, source, ((CraftEntity) entityEmitter.entity()).getHandle(), volume, pitch, seed);
|
||||
+ else if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.LocationEmitter locationEmitter) {
|
||||
+ org.bukkit.Location loc = locationEmitter.getLocation();
|
||||
+ return new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEvent, source, loc.getX(), loc.getY(), loc.getZ(), volume, pitch, seed);
|
||||
+ long seed = event.getSeed();
|
||||
+ java.util.Optional<net.minecraft.sounds.SoundEvent> soundEvent = io.papermc.paper.adventure.PaperAdventure.asVanillaSound(sound.name());
|
||||
+ // handle vanilla sounds
|
||||
+ if (soundEvent.isPresent()) {
|
||||
+ if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter entityEmitter)
|
||||
+ return new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(net.minecraft.core.Holder.direct(soundEvent.get()), source, ((CraftEntity) entityEmitter.entity()).getHandle(), volume, pitch, seed);
|
||||
+ else if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.LocationEmitter locationEmitter) {
|
||||
+ Location loc = locationEmitter.location();
|
||||
+ return new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.Holder.direct(soundEvent.get()), source, loc.getX(), loc.getY(), loc.getZ(), volume, pitch, seed);
|
||||
+ }
|
||||
+ else
|
||||
+ throw new IllegalArgumentException("Unknown emitter type: " + emitter.getClass().getName());
|
||||
+ }
|
||||
+ // handle custom sounds
|
||||
+ else {
|
||||
+ return null; // ClientboundCustomSoundPacket was removed and the standard packet now supports custom sounds
|
||||
+// // warn if trying to use EntityEmitter with custom sound
|
||||
+// if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter)
|
||||
+// org.slf4j.LoggerFactory.getLogger("SoundEvent").warn("Sound event is using a custom sound ({}) which cannot be used with EntityEmitter. Falling back to playing at the entity's location.", sound.name().asString());
|
||||
+// Vec3 pos = org.bukkit.craftbukkit.util.CraftVector.toNMS(emitter.location().toVector());
|
||||
+// return new net.minecraft.network.protocol.game.ClientboundCustomSoundPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name()), source, pos, volume, pitch, seed);
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Unknown emitter type: " + emitter.getClass().getName());
|
||||
+ }
|
||||
+
|
||||
+ public static void playSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event) {
|
||||
|
||||
@@ -5,20 +5,26 @@ Subject: [PATCH] Add PlayerUseRespawnAnchorEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
index 94d067e9eeee73183de25165d8c97043fe256103..3d6e33abbebe526796359fab76768601c227fbe8 100644
|
||||
index 2ed78cf83c0ae66a6ddba1ff307da89a24b0d0a8..15d4d703762d54ebab57814a28ad8d0e6500df6d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -65,7 +65,33 @@ public class RespawnAnchorBlock extends Block {
|
||||
@@ -56,25 +56,47 @@ public class RespawnAnchorBlock extends Block {
|
||||
|
||||
@Override
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
- ItemStack itemstack = player.getItemInHand(hand);
|
||||
-
|
||||
- if (hand == InteractionHand.MAIN_HAND && !RespawnAnchorBlock.isRespawnFuel(itemstack) && RespawnAnchorBlock.isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) {
|
||||
+ ItemStack itemstack = player.getItemInHand(hand);
|
||||
+
|
||||
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
||||
+ org.bukkit.entity.Player bukkitPlayer = player.getBukkitEntity() instanceof org.bukkit.entity.Player ? (org.bukkit.entity.Player) player.getBukkitEntity() : null;
|
||||
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
|
||||
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult result;
|
||||
+ // Parchment end
|
||||
+
|
||||
if (RespawnAnchorBlock.isRespawnFuel(stack) && RespawnAnchorBlock.canBeCharged(state)) {
|
||||
+ if (hand == InteractionHand.MAIN_HAND && !isRespawnFuel(itemstack) && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ } else if (isRespawnFuel(itemstack) && canBeCharged(state)) {
|
||||
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
||||
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE;
|
||||
+ } else if (state.getValue(CHARGE) == 0) {
|
||||
@@ -28,7 +34,7 @@ index 94d067e9eeee73183de25165d8c97043fe256103..3d6e33abbebe526796359fab76768601
|
||||
+ } else if (!world.isClientSide) {
|
||||
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.SET_SPAWN;
|
||||
+ } else {
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ if (bukkitPlayer != null) {
|
||||
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent event = new gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent(bukkitPlayer, block, result);
|
||||
@@ -36,9 +42,30 @@ index 94d067e9eeee73183de25165d8c97043fe256103..3d6e33abbebe526796359fab76768601
|
||||
+ result = event.getResult();
|
||||
+ }
|
||||
+ if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING) {
|
||||
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.PASS;
|
||||
- } else if (RespawnAnchorBlock.isRespawnFuel(itemstack) && RespawnAnchorBlock.canBeCharged(state)) {
|
||||
- RespawnAnchorBlock.charge(player, world, pos, state);
|
||||
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE) {
|
||||
+ // Parchment end
|
||||
RespawnAnchorBlock.charge(player, world, pos, state);
|
||||
stack.consume(1, player);
|
||||
return ItemInteractionResult.sidedSuccess(world.isClientSide);
|
||||
+ charge(player, world, pos, state);
|
||||
if (!player.getAbilities().instabuild) {
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
- } else if ((Integer) state.getValue(RespawnAnchorBlock.CHARGE) == 0) {
|
||||
- return InteractionResult.PASS;
|
||||
- } else if (!RespawnAnchorBlock.canSetSpawn(world)) {
|
||||
- if (!world.isClientSide) {
|
||||
- this.explode(state, world, pos);
|
||||
- }
|
||||
-
|
||||
- return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
||||
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.EXPLODE) {
|
||||
+ this.explode(state, world, pos);
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ // Parchment end
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) player;
|
||||
|
||||
@@ -5,15 +5,33 @@ Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 75a3d42d0ac458e1f7161e88cf27ec6087828926..ca52d30944a067bb156cae6290663ab20cb160e9 100644
|
||||
index f238fda2543d3dae4d66c83a2230f858aff822df..34849bcfcc18d547efa3141ce1ec30311988da40 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1188,7 +1188,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
@@ -990,7 +990,7 @@ public class CraftEventFactory {
|
||||
CraftEventFactory.entityDamage = null;
|
||||
EntityDamageEvent event;
|
||||
if (damager == null) {
|
||||
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions);
|
||||
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, source.getEntity().getBukkitEntity().getLocation(), modifiers, modifierFunctions);
|
||||
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
||||
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
||||
} else {
|
||||
@@ -1038,7 +1038,7 @@ public class CraftEventFactory {
|
||||
|
||||
private static EntityDamageEvent callEntityDamageEvent(Block damager, BlockState damagerState, Entity damagee, DamageCause cause, org.bukkit.damage.DamageSource bukkitDamageSource, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
|
||||
- EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagerState, damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions);
|
||||
+ EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagerState, damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions, bukkitDamageSource.getDamageLocation());
|
||||
return CraftEventFactory.callEntityDamageEvent(event, damagee, cancelled);
|
||||
}
|
||||
return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
|
||||
} else if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) {
|
||||
- EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions);
|
||||
+ EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, entity.getBukkitEntity().getLocation(), modifiers, modifierFunctions);
|
||||
event.setCancelled(cancelled);
|
||||
CraftEventFactory.callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
@@ -1048,7 +1048,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
return event;
|
||||
} else if (source.is(DamageTypes.LAVA)) {
|
||||
- EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
|
||||
+ EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, blockDamage.getLocation(), modifiers, modifierFunctions));
|
||||
event.setCancelled(cancelled);
|
||||
|
||||
Block damager = CraftEventFactory.blockDamage;
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Add UnsafeValues#canPlaceItemOn
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 5a382907285a288f2a223189e690d3dbdf45594c..fab345b24eebeac1935bff9f0ece4334748d1b17 100644
|
||||
index b059bb46b649cbf82debdb8d58fe4ba77d040276..407d39e3c9eb8cd68f5c82ca7f4d1ff5f2c380fb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -693,6 +693,55 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -626,6 +626,55 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
// Paper end - lifecycle event API
|
||||
// Paper end
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#setGameProfile
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 75995354090771370ba6b4aa8f4ded28186583e8..38388feb2a578d71568fbe17799c4f9a0d5f2c2c 100644
|
||||
index 66866e1dabe79a78df255fc17842bdb36988d86f..fd0c584d459f912a714e464e40803d4e3dca8bd8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1541,6 +1541,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1510,6 +1510,12 @@ public abstract class Player extends LivingEntity {
|
||||
return this.gameProfile;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Expose MCUtil Executors
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 2fa5507aa2153a05208077f9547c165a1099b5bb..50f91ac8303dd33f3b493c85cb713dba1b89d294 100644
|
||||
index 46831bd86a010c7f0116473876fd90af5abdce4b..bdbd310a227afc59a3a5142a9408016d3bdc0582 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3264,4 +3264,16 @@ public final class CraftServer implements Server {
|
||||
return this.potionBrewer;
|
||||
@@ -2972,4 +2972,16 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
// Paper end
|
||||
+
|
||||
+ // Parchment start
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix missing CraftMetaSkull serializedProfile
|
||||
Plugins (ab)using NMS may change the "profile" field using reflections instead of the "setProfile" method, especially if they are targeted towards old Minecraft versions. This fixes the potential discrepancies and NPEs.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..fe48cb0fbf3b510b365bed06d84c0c62edd1ad19 100644
|
||||
index deed77a3d44bc55681483d7f47f148b5220135f2..5b4100f0fcd29660b4738d908d2bda677f206cc4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -133,6 +133,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -131,6 +131,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
|
||||
private void setProfile(GameProfile profile) {
|
||||
this.profile = profile;
|
||||
@@ -21,7 +21,7 @@ index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..fe48cb0fbf3b510b365bed06d84c0c62
|
||||
this.serializedProfile = (profile == null) ? null : NbtUtils.writeGameProfile(new CompoundTag(), profile);
|
||||
}
|
||||
|
||||
@@ -141,6 +146,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -139,6 +144,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
super.applyToItem(tag);
|
||||
|
||||
if (this.profile != null) {
|
||||
@@ -29,7 +29,7 @@ index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..fe48cb0fbf3b510b365bed06d84c0c62
|
||||
// SPIGOT-6558: Set initial textures
|
||||
tag.put(SKULL_OWNER.NBT, serializedProfile);
|
||||
// Fill in textures
|
||||
@@ -303,6 +309,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -301,6 +307,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
if (meta instanceof CraftMetaSkull) {
|
||||
CraftMetaSkull that = (CraftMetaSkull) meta;
|
||||
|
||||
@@ -8,11 +8,23 @@ to easily get the items being dropped by any
|
||||
block instead of only blocks broken by players.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..46330f02d04f9e8a921ddf14bb34e94392c17431 100644
|
||||
index 9522e646529f3d849471931b4b3c0d133e7fcfc5..622632157b0815d91a8fb807aa9122bbebb213b1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -301,7 +301,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -300,9 +300,19 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
return state.getDrops(lootparams_a);
|
||||
}
|
||||
|
||||
+ public static void dropResources(BlockState state, net.minecraft.world.level.storage.loot.LootParams.Builder lootContext) {
|
||||
+ ServerLevel worldserver = lootContext.getLevel();
|
||||
+ BlockPos blockposition = BlockPos.containing((net.minecraft.core.Position) lootContext.getParameter(LootContextParams.ORIGIN));
|
||||
+
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(worldserver, blockposition, state.getDrops(lootContext)).forEach((itemstack) -> { // Parchment
|
||||
+ Block.popResource(worldserver, blockposition, itemstack);
|
||||
+ });
|
||||
+ state.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, true);
|
||||
+ }
|
||||
+
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos) {
|
||||
if (world instanceof ServerLevel) {
|
||||
- Block.getDrops(state, (ServerLevel) world, pos, (BlockEntity) null).forEach((itemstack) -> {
|
||||
@@ -20,7 +32,7 @@ index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..46330f02d04f9e8a921ddf14bb34e943
|
||||
Block.popResource(world, pos, itemstack);
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
@@ -311,7 +311,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -312,7 +322,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel) {
|
||||
@@ -29,20 +41,21 @@ index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..46330f02d04f9e8a921ddf14bb34e943
|
||||
Block.popResource((ServerLevel) world, pos, itemstack);
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
@@ -347,7 +347,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
|
||||
// Paper end - Properly handle xp dropping
|
||||
@@ -339,7 +349,8 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
|
||||
if (world instanceof ServerLevel) {
|
||||
- Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool).forEach((itemstack1) -> {
|
||||
+
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool)).forEach((itemstack1) -> { // Parchment
|
||||
Block.popResource(world, pos, itemstack1);
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, tool, dropExperience); // Paper - Properly handle xp dropping
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, tool, true);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index ca52d30944a067bb156cae6290663ab20cb160e9..bbd231e085b3d14693a56c4b2abf393f86ff0683 100644
|
||||
index 34849bcfcc18d547efa3141ce1ec30311988da40..902cf45b1da660f1901bf334396bac50353d04e5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2219,5 +2219,19 @@ public class CraftEventFactory {
|
||||
@@ -2059,5 +2059,20 @@ public class CraftEventFactory {
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -61,4 +74,5 @@ index ca52d30944a067bb156cae6290663ab20cb160e9..bbd231e085b3d14693a56c4b2abf393f
|
||||
+ return items;
|
||||
+ }
|
||||
// Parchment end
|
||||
+
|
||||
}
|
||||
@@ -215,10 +215,10 @@ index 0000000000000000000000000000000000000000..e7114e456f818d7bdd4081620f4b9b93
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index f2b20ed5063a293f0b464548f590d652170cd1d8..b6c14eaeb9e1c0f186e0ec15b76e6ba8814287d3 100644
|
||||
index 89514af7f3771db496e7e2a40fa4e7fdf527f095..5e6a5b7bf9ecea3445ae3f8de1e8b826afc3ccab 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2561,4 +2561,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2430,4 +2430,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return this.adventure$pointers;
|
||||
}
|
||||
// Paper end
|
||||
@@ -226,7 +226,7 @@ index f2b20ed5063a293f0b464548f590d652170cd1d8..b6c14eaeb9e1c0f186e0ec15b76e6ba8
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public ItemStack smeltItem(ItemStack toSmelt, gg.projecteden.parchment.inventory.RecipeType recipeType) {
|
||||
+ return world.getRecipeManager().getRecipeFor(gg.projecteden.parchment.inventory.CraftRecipeType.asCookingRecipe(recipeType), new gg.projecteden.parchment.inventory.SingletonContainer(toSmelt), world).map(recipe -> recipe.value().getResultItem(world.registryAccess()).getBukkitStack()).orElse(null);
|
||||
+ return world.getRecipeManager().getRecipeFor(gg.projecteden.parchment.inventory.CraftRecipeType.asCookingRecipe(recipeType), new gg.projecteden.parchment.inventory.SingletonContainer(toSmelt), world).map(recipe -> recipe.getResultItem(world.registryAccess()).getBukkitStack()).orElse(null);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable sleep status announcements
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c3891adadf9b49c8b17ec387bb63713285621b76..05ffad3a3bf6eeb720db239238b2d3189585cce9 100644
|
||||
index f8da87074468b34b18c774fba6868373ecb8a8a7..bbe67e33aee5dae86eda9eefe74db4ffd781cc80 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1178,7 +1178,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1116,7 +1116,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
|
||||
private void announceSleepStatus() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add config for ticking TIME_SINCE_REST
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index efc91ff91827872c62b8bd060282549ccdcf67dd..2555be33b41c7011c9acceb5ac777e7ab6752c10 100644
|
||||
index a33de97340f14219291c4175e9194914cdf441db..a6341580f9c1a163ddb9c380a2c5c1658cb5bf0d 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -288,6 +288,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -265,6 +265,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
}
|
||||
|
||||
public boolean disablePlayerCrits = false;
|
||||
@@ -17,10 +17,10 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..2555be33b41c7011c9acceb5ac777e7a
|
||||
public PillagerPatrols pillagerPatrols;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 38388feb2a578d71568fbe17799c4f9a0d5f2c2c..a11c18605c0fbaead1163466a38089265a5ac5a8 100644
|
||||
index fd0c584d459f912a714e464e40803d4e3dca8bd8..870fefca60162ca75bcdd04abf721f321ec1b745 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -302,7 +302,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -292,7 +292,7 @@ public abstract class Player extends LivingEntity {
|
||||
this.awardStat(Stats.CROUCH_TIME);
|
||||
}
|
||||
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Add HangingFrame Tick API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
index bf2d91bbb4bf401696f5f5d14a67e3920a179084..47a38704eba3ce3da1bf0d5dc18856f2c02c3ea8 100644
|
||||
index 66cf0a6cd1525ecf2615809210a26d55f445d07d..360ca6458083fa4018f11fcdade3ce930835db72 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
@@ -43,6 +43,7 @@ public abstract class HangingEntity extends Entity {
|
||||
private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper - Perf: offset item frame ticking
|
||||
@@ -41,6 +41,7 @@ public abstract class HangingEntity extends Entity {
|
||||
private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper
|
||||
public BlockPos pos;
|
||||
protected Direction direction;
|
||||
+ public boolean tick = true; // Parchment
|
||||
|
||||
protected HangingEntity(EntityType<? extends HangingEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -118,7 +119,7 @@ public abstract class HangingEntity extends Entity {
|
||||
@@ -116,7 +117,7 @@ public abstract class HangingEntity extends Entity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -26,12 +26,12 @@ index bf2d91bbb4bf401696f5f5d14a67e3920a179084..47a38704eba3ce3da1bf0d5dc18856f2
|
||||
if (this.checkInterval++ == this.level().spigotConfig.hangingTickFrequency) { // Spigot
|
||||
this.checkInterval = 0;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
|
||||
index cbdcf767c01e2c173913f56747d2dacbda2f0094..a74f783df0225223a2b2ae3dc632541ccf078893 100644
|
||||
index 62e11bf104b8d39ac73883e2a5d207e5f7393253..639bd33ae91ed818bda29fed776adb8c169458d7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
|
||||
@@ -66,4 +66,16 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public String toString() {
|
||||
return "CraftHanging";
|
||||
@@ -72,4 +72,16 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public EntityType getType() {
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Add Player#getHiddenEntities API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7e6116963d835d4606ef3d93b69d3e44b61288e1..1da9415f141aabe8df5b82392c142c1f3fd960fb 100644
|
||||
index e41f5417304f5b05fa7e2f6b6e1c0095e820f1cc..50a1a50e13f54d3db843d5f378432409e159caef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2145,6 +2145,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
|
||||
@@ -1913,6 +1913,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity)); // Paper
|
||||
}
|
||||
// Paper start
|
||||
+
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Big Barrels
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
index 6186e55014bbb9d5bedaa0e9d196879c55339d42..4f02184ec9aa7067f0ee20f041799d25494cb358 100644
|
||||
index 416aa989ebb18a8741cc9d605a1180ab830f6643..c48466a4d2115f4fa6121b6bcba87b838743af34 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
@@ -68,7 +68,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -67,7 +67,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
public BarrelBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.BARREL, pos, state);
|
||||
@@ -17,7 +17,7 @@ index 6186e55014bbb9d5bedaa0e9d196879c55339d42..4f02184ec9aa7067f0ee20f041799d25
|
||||
this.openersCounter = new ContainerOpenersCounter() {
|
||||
@Override
|
||||
protected void onOpen(Level world, BlockPos pos, BlockState state) {
|
||||
@@ -119,7 +119,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -118,7 +118,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
@@ -26,7 +26,7 @@ index 6186e55014bbb9d5bedaa0e9d196879c55339d42..4f02184ec9aa7067f0ee20f041799d25
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,7 +139,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -138,7 +138,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add Timings Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
index 7620c72a4c243cbeea245203ce03a97cbfa7d922..37da50840a55e9df555aaf3aceb21661e472bcff 100644
|
||||
index c07eb451a576811a39021f6f97103c77488fd001..58fd2d024a9de3a9a31cde948bb9fc8b68f461bc 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -348,6 +348,8 @@ public class TimingsExport extends Thread {
|
||||
@@ -350,6 +350,8 @@ public class TimingsExport extends Thread {
|
||||
timingsURL = con.getHeaderField("Location");
|
||||
listeners.sendMessage(text("View Timings Report: ", NamedTextColor.GREEN).append(text(timingsURL).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, timingsURL))));
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 25 Jul 2022 09:11:13 -0400
|
||||
Subject: [PATCH] Add spam bypass permission
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b9b3277c8ed94e0cd30b20b9c00a33eaad48e5ac..c68329a2668220b0884eafd88440f3aaffd9e0fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -787,9 +787,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
|
||||
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
|
||||
// CraftBukkit start
|
||||
- if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
|
||||
- this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause
|
||||
- return;
|
||||
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
|
||||
+ if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - AsyncTabCompleteEvent & kick event cause
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
// CraftBukkit end
|
||||
// Paper start - Don't suggest if tab-complete is disabled
|
||||
@@ -2512,6 +2514,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
// Spigot start - spam exclusions
|
||||
private void detectRateSpam(String s) {
|
||||
+ if (this.getCraftPlayer().hasPermission("spam.bypass")) return; // Parchment - spam bypass
|
||||
// CraftBukkit start - replaced with thread safe throttle
|
||||
boolean counted = true;
|
||||
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
|
||||
@@ -3273,10 +3276,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
||||
// Paper start - auto recipe limit
|
||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
- if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
- return;
|
||||
- }
|
||||
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
|
||||
+ if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
+ return;
|
||||
+ }
|
||||
+ } // Parchment - spam bypass
|
||||
}
|
||||
// Paper end - auto recipe limit
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@@ -5,27 +5,33 @@ Subject: [PATCH] Expanded Insomnia API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 1da9415f141aabe8df5b82392c142c1f3fd960fb..f8aaccfebf81debf807eb74fb7accaa86d5f1a9e 100644
|
||||
index 50a1a50e13f54d3db843d5f378432409e159caef..11e4bd75b10c2f4b292d2ce3c683eb2373609a20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -211,6 +211,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -76,6 +76,7 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.UserWhiteListEntry;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EntitySelector;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeMap;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
@@ -185,6 +186,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
|
||||
private long lastSaveTime; // Paper - getLastPlayed replacement API
|
||||
|
||||
private long lastSaveTime;
|
||||
// Paper end
|
||||
+ private boolean bypassesInsomnia = false; // Parchment - Insomnia api
|
||||
+
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
|
||||
@@ -3530,4 +3532,31 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setSendViewDistance(final int viewDistance) {
|
||||
this.getHandle().setSendViewDistance(viewDistance);
|
||||
@@ -2033,6 +2035,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this;
|
||||
}
|
||||
+
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public boolean isInsomniac() {
|
||||
+ return net.minecraft.world.entity.EntitySelector.IS_INSOMNIAC.test(this.getHandle());
|
||||
+ return EntitySelector.IS_INSOMNIAC.test(this.getHandle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -48,4 +54,7 @@ index 1da9415f141aabe8df5b82392c142c1f3fd960fb..f8aaccfebf81debf807eb74fb7accaa8
|
||||
+ return net.minecraft.util.Mth.clamp(this.getHandle().getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
}
|
||||
+
|
||||
@Override
|
||||
public ServerPlayer getHandle() {
|
||||
return (ServerPlayer) entity;
|
||||
52
patches/server/0019-Add-spam-bypass-permission.patch
Normal file
52
patches/server/0019-Add-spam-bypass-permission.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 25 Jul 2022 09:11:13 -0400
|
||||
Subject: [PATCH] Add spam bypass permission
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 4dd04aa5f4affd42afbce718ec3dfaf7f1fafe2f..ed35299215a8f01d7a4c53fe2a63d07bdd6d53a0 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -882,16 +882,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
|
||||
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async
|
||||
// CraftBukkit start
|
||||
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
|
||||
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
|
||||
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
// Paper start
|
||||
- String str = packet.getCommand(); int index = -1;
|
||||
+ String str = packet.getCommand();
|
||||
+ int index = -1;
|
||||
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
|
||||
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper
|
||||
return;
|
||||
}
|
||||
+ } // Parchment - spam bypass
|
||||
// Paper end
|
||||
// CraftBukkit end
|
||||
// Paper start - Don't suggest if tab-complete is disabled
|
||||
@@ -2562,6 +2565,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
// Spigot start - spam exclusions
|
||||
private void detectRateSpam(String s) {
|
||||
+ if (this.getCraftPlayer().hasPermission("spam.bypass")) return; // Parchment - spam bypass
|
||||
// CraftBukkit start - replaced with thread safe throttle
|
||||
boolean counted = true;
|
||||
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
|
||||
@@ -3284,10 +3288,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
// Paper start
|
||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
|
||||
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
+ } // Parchment - spam bypass
|
||||
}
|
||||
// Paper end
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@@ -5,20 +5,21 @@ Subject: [PATCH] Disable set respawn message
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b1e1717b3b63b9c554c7925ed63ed217bff7e792..606384fa11d6aab9384278e89481cd7e07cdb945 100644
|
||||
index 26857b67e403d650387cf789f3778bbced7ea0a4..e07d651cbf8730f8427114438307ce216f2fef07 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2492,9 +2492,10 @@ public class ServerPlayer extends Player {
|
||||
@@ -2278,10 +2278,10 @@ public class ServerPlayer extends Player {
|
||||
angle = event.getLocation().getYaw();
|
||||
forced = event.isForced();
|
||||
// Paper end - Add PlayerSetSpawnEvent
|
||||
|
||||
- if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper - Add PlayerSetSpawnEvent
|
||||
- this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper - Add PlayerSetSpawnEvent
|
||||
// Paper end
|
||||
-
|
||||
- if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
|
||||
- this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
|
||||
- }
|
||||
+ /* Parchment start
|
||||
+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
|
||||
+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
|
||||
+ } Parchment end */
|
||||
+ // Parchment
|
||||
+// if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
|
||||
+// this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
|
||||
+// }
|
||||
|
||||
this.respawnPosition = pos;
|
||||
this.respawnDimension = dimension;
|
||||
@@ -5,10 +5,18 @@ Subject: [PATCH] Make FixLight use action bar
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
index 56524cbe4303901007e1e7fb3703a19efbf79ae7..e13e1da7fc814e83bed1f0f32cd5d115c1c3b710 100644
|
||||
index 7784d72ddd6db00c674e22759c00c430222c4b85..b336789b74d6d6819b38e78cb2014f61de3f004b 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
@@ -87,17 +87,20 @@ public final class FixLightCommand implements PaperSubcommand {
|
||||
@@ -24,6 +24,7 @@ import static net.kyori.adventure.text.format.NamedTextColor.BLUE;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.DARK_AQUA;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class FixLightCommand implements PaperSubcommand {
|
||||
@@ -93,17 +94,20 @@ public final class FixLightCommand implements PaperSubcommand {
|
||||
lightengine.relight(chunks,
|
||||
(final ChunkPos chunkPos) -> {
|
||||
++relitChunks[0];
|
||||
@@ -17,10 +25,10 @@ index 56524cbe4303901007e1e7fb3703a19efbf79ae7..e13e1da7fc814e83bed1f0f32cd5d115
|
||||
- text(", progress: ", BLUE), text((int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%")
|
||||
+ sender.getBukkitEntity().sendActionBar(text().color(DARK_AQUA).append(
|
||||
+ text("Relighting Chunks: ", DARK_AQUA), text(chunkPos.toString()),
|
||||
+ text(" " + relitChunks[0], net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text(" " + relitChunks[0], YELLOW),
|
||||
+ text("/", DARK_AQUA),
|
||||
+ text(pending[0] + " ", net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text("(" + (int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%)", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
|
||||
+ text(pending[0] + " ", YELLOW),
|
||||
+ text("(" + (int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%)", YELLOW)
|
||||
));
|
||||
},
|
||||
(final int totalRelit) -> {
|
||||
@@ -29,8 +37,8 @@ index 56524cbe4303901007e1e7fb3703a19efbf79ae7..e13e1da7fc814e83bed1f0f32cd5d115
|
||||
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
- text("Relit ", BLUE), text(totalRelit),
|
||||
- text(" chunks. Took ", BLUE), text(diff + "ms")
|
||||
+ text("Relit ", DARK_AQUA), text(totalRelit, net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text(" chunks. Took ", DARK_AQUA), text(diff + "ms", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
|
||||
+ text("Relit ", DARK_AQUA), text(totalRelit, YELLOW),
|
||||
+ text(" chunks. Took ", DARK_AQUA), text(diff + "ms", YELLOW)
|
||||
));
|
||||
if (done != null) {
|
||||
done.run();
|
||||
@@ -1,206 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 16 Mar 2023 23:11:05 -0400
|
||||
Subject: [PATCH] Add PreEntityShootBowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 0c5fe46d2da113beff3e220843593d616e37d4ca..7a57f18eeb052a451c54f232f012a8cffa4803f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -199,13 +199,17 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@Override
|
||||
public void performRangedAttack(LivingEntity target, float pullProgress) {
|
||||
ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)));
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // Parchment end
|
||||
AbstractArrow entityarrow = this.getArrow(itemstack, pullProgress);
|
||||
double d0 = target.getX() - this.getX();
|
||||
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
|
||||
double d2 = target.getZ() - this.getZ();
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative()); // Parchment
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
index a7964208c952cb4e34916ae6523850fc3921b07e..776bfaf8bc5f3d7afe8c2e2cdafe734eb32aac82 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
@@ -176,13 +176,17 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
|
||||
@Override
|
||||
public void performRangedAttack(LivingEntity target, float pullProgress) {
|
||||
ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)));
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // Parchment end
|
||||
AbstractArrow entityarrow = ProjectileUtil.getMobArrow(this, itemstack, pullProgress);
|
||||
double d0 = target.getX() - this.getX();
|
||||
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
|
||||
double d2 = target.getZ() - this.getZ();
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative()); // Parchment
|
||||
// Paper start - EntityShootBowEvent
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 31b8a8bf78d52b5f11b68e780ec09bf78e7bda84..d296e1ce4798bd223a98bbc5693f29713a1fde7e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -143,8 +143,10 @@ public abstract class AbstractArrow extends Projectile {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void shoot(double x, double y, double z, float power, float uncertainty) {
|
||||
- super.shoot(x, y, z, power, uncertainty);
|
||||
+ // Parchment start
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
|
||||
+ super.shoot(x, y, z, speed, divergence, relative);
|
||||
+ // Parchment end
|
||||
this.life = 0;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 74c596264d4da551437bd2a23e1c70022cfc73fc..968bfd2004ec8bd2243f886ffee660f235e80241 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -175,9 +175,17 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void shoot(double x, double y, double z, float power, float uncertainty) {
|
||||
- Vec3 vec3d = this.getMovementToShoot(x, y, z, power, uncertainty);
|
||||
+ // Parchment start
|
||||
+ shoot(x, y, z, power, uncertainty, true);
|
||||
+ }
|
||||
+
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
|
||||
+ // Parchment end
|
||||
+ Vec3 vec3d = this.getMovementToShoot(x, y, z, speed, divergence);
|
||||
|
||||
- this.setDeltaMovement(vec3d);
|
||||
+ if (relative) { // Parchment
|
||||
+ this.setDeltaMovement(vec3d);
|
||||
+ } // Parchment
|
||||
double d3 = vec3d.horizontalDistance();
|
||||
|
||||
this.setYRot((float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D));
|
||||
@@ -187,6 +195,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) {
|
||||
+ // Parchment start
|
||||
+ shootFromRotation(shooter, pitch, yaw, roll, speed, divergence, true);
|
||||
+ }
|
||||
+
|
||||
+ public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence, boolean relative) {
|
||||
+ // Parchment end
|
||||
float f5 = -Mth.sin(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
|
||||
float f6 = -Mth.sin((pitch + roll) * 0.017453292F);
|
||||
float f7 = Mth.cos(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
|
||||
@@ -194,7 +208,9 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
|
||||
Vec3 vec3d = shooter.getDeltaMovement();
|
||||
|
||||
- if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
|
||||
+ if (relative) { // Parchment
|
||||
+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
|
||||
+ }
|
||||
}
|
||||
|
||||
// CraftBukkit start - call projectile hit event
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
index 5ca843df5b4caa668953e5e36a9b20fabeb35046..68012cc58dc794afae8b74b7d81eab0080929707 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
@@ -31,7 +31,11 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
if (!((double)f < 0.1)) {
|
||||
List<ItemStack> list = draw(stack, itemStack, player);
|
||||
if (!world.isClientSide() && !list.isEmpty()) {
|
||||
- this.shoot(world, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null);
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(user.getBukkitEntity(), stack.asBukkitCopy(), itemStack.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // Parchment end
|
||||
+ this.shoot(world, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null, preEvent.isRelative());
|
||||
}
|
||||
|
||||
world.playSound(
|
||||
@@ -52,9 +56,9 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
|
||||
@Override
|
||||
protected void shootProjectile(
|
||||
- LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target
|
||||
+ LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative
|
||||
) {
|
||||
- projectile.shootFromRotation(shooter, shooter.getXRot(), shooter.getYRot() + yaw, 0.0F, speed, divergence);
|
||||
+ projectile.shootFromRotation(shooter, shooter.getXRot(), shooter.getYRot() + yaw, 0.0F, speed, divergence, relative);
|
||||
}
|
||||
|
||||
public static float getPowerForTime(int useTicks) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index 1f52feb5684ee1bab710e1557cf69b43b4d4dfd4..b4633be6d59f5b05d0b59e2aff2d8452ffd29736 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -124,7 +124,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
|
||||
@Override
|
||||
protected void shootProjectile(
|
||||
- LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target
|
||||
+ LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative
|
||||
) {
|
||||
Vector3f vector3f;
|
||||
if (target != null) {
|
||||
@@ -186,8 +186,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
) {
|
||||
if (!world.isClientSide()) {
|
||||
ChargedProjectiles chargedProjectiles = stack.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY);
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(shooter.getBukkitEntity(), stack.asBukkitCopy(), chargedProjectiles.getItems().get(0).asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // TODO: handle relative flag in CrossbowAttackMob#shootCrossbowProjectile
|
||||
+ // Parchment end
|
||||
+
|
||||
if (chargedProjectiles != null && !chargedProjectiles.isEmpty()) {
|
||||
- this.shoot(world, shooter, hand, stack, chargedProjectiles.getItems(), speed, divergence, shooter instanceof Player, livingEntity);
|
||||
+ this.shoot(world, shooter, hand, stack, chargedProjectiles.getItems(), speed, divergence, shooter instanceof Player, livingEntity, preEvent.isRelative());
|
||||
if (shooter instanceof ServerPlayer serverPlayer) {
|
||||
CriteriaTriggers.SHOT_CROSSBOW.trigger(serverPlayer, stack);
|
||||
serverPlayer.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
|
||||
index d27e83c08c45b8514207f26e48ceb1a91ded94be..9d4460201093fa34a37c118c9a38dcd596448265 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
|
||||
@@ -46,7 +46,7 @@ public abstract class ProjectileWeaponItem extends Item {
|
||||
|
||||
public abstract int getDefaultProjectileRange();
|
||||
|
||||
- protected void shoot(Level world, LivingEntity shooter, InteractionHand hand, ItemStack stack, List<ItemStack> projectiles, float speed, float divergence, boolean critical, @Nullable LivingEntity target) {
|
||||
+ protected void shoot(Level world, LivingEntity shooter, InteractionHand hand, ItemStack stack, List<ItemStack> projectiles, float speed, float divergence, boolean critical, @Nullable LivingEntity target, boolean relative) {
|
||||
float f2 = 10.0F;
|
||||
float f3 = projectiles.size() == 1 ? 0.0F : 20.0F / (float) (projectiles.size() - 1);
|
||||
float f4 = (float) ((projectiles.size() - 1) % 2) * f3 / 2.0F;
|
||||
@@ -62,7 +62,7 @@ public abstract class ProjectileWeaponItem extends Item {
|
||||
// itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand)); // CraftBukkit - moved down
|
||||
Projectile iprojectile = this.createProjectile(world, shooter, stack, itemstack1, critical);
|
||||
|
||||
- this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target);
|
||||
+ this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target, relative);
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, stack, itemstack1, iprojectile, hand, speed, true);
|
||||
if (event.isCancelled()) {
|
||||
@@ -90,7 +90,7 @@ public abstract class ProjectileWeaponItem extends Item {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- protected abstract void shootProjectile(LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target);
|
||||
+ protected abstract void shootProjectile(LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative);
|
||||
|
||||
protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) {
|
||||
Item item = projectileStack.getItem();
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove Hanging Entity Debug
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
index 374f73ac1dbfa27daef132373f7af4b9bb12daa0..015badafe28adc6ab121b24b7cb585a84bce12ff 100644
|
||||
index 360ca6458083fa4018f11fcdade3ce930835db72..94f105c829d196c1526c8251527fe519a5e0180e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
@@ -281,7 +281,7 @@ public abstract class HangingEntity extends Entity {
|
||||
@@ -272,7 +272,7 @@ public abstract class HangingEntity extends Entity {
|
||||
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||
|
||||
if (!blockposition.closerThan(this.blockPosition(), 16.0D)) {
|
||||
151
patches/server/0023-Add-PreEntityShootBowEvent.patch
Normal file
151
patches/server/0023-Add-PreEntityShootBowEvent.patch
Normal file
@@ -0,0 +1,151 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 16 Mar 2023 23:11:05 -0400
|
||||
Subject: [PATCH] Add PreEntityShootBowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 9ca1e9d95e62929c0015d5ca2c2f9c70e421842e..b3150821875b4dd1c3fd0f10b56b51fac40f68ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -199,13 +199,20 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@Override
|
||||
public void performRangedAttack(LivingEntity target, float pullProgress) {
|
||||
ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)));
|
||||
+
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
AbstractArrow entityarrow = this.getArrow(itemstack, pullProgress);
|
||||
double d0 = target.getX() - this.getX();
|
||||
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
|
||||
double d2 = target.getZ() - this.getZ();
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative());
|
||||
+
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
index 63fce7e3d9f59f36e29bc827a46396d73143bb8b..54dfb3cbaeb37c41187185068ab5573ffb9fd793 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
@@ -189,13 +189,20 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
|
||||
@Override
|
||||
public void performRangedAttack(LivingEntity target, float pullProgress) {
|
||||
ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)));
|
||||
+
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
AbstractArrow entityarrow = ProjectileUtil.getMobArrow(this, itemstack, pullProgress);
|
||||
double d0 = target.getX() - this.getX();
|
||||
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
|
||||
double d2 = target.getZ() - this.getZ();
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative());
|
||||
+
|
||||
// Paper start
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 7226be19248a1ffb8ff2c89b55882529d33a6c0c..990d85daaafae8938c99ad9f389a76b1c6b7937f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -129,8 +129,8 @@ public abstract class AbstractArrow extends Projectile {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void shoot(double x, double y, double z, float speed, float divergence) {
|
||||
- super.shoot(x, y, z, speed, divergence);
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
|
||||
+ super.shoot(x, y, z, speed, divergence, relative);
|
||||
this.life = 0;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 1b7cf6d06bdf36f146656727511a461f2520762e..38bb93521820a2cebdbd72b6b76373e986a0f15f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -157,9 +157,15 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void shoot(double x, double y, double z, float speed, float divergence) {
|
||||
+ shoot(x, y, z, speed, divergence, true);
|
||||
+ }
|
||||
+
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
|
||||
Vec3 vec3d = (new Vec3(x, y, z)).normalize().add(this.random.triangle(0.0D, 0.0172275D * (double) divergence), this.random.triangle(0.0D, 0.0172275D * (double) divergence), this.random.triangle(0.0D, 0.0172275D * (double) divergence)).scale((double) speed);
|
||||
|
||||
- this.setDeltaMovement(vec3d);
|
||||
+ if (relative) {
|
||||
+ this.setDeltaMovement(vec3d);
|
||||
+ }
|
||||
double d3 = vec3d.horizontalDistance();
|
||||
|
||||
this.setYRot((float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D));
|
||||
@@ -169,6 +175,10 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) {
|
||||
+ this.shootFromRotation(shooter, pitch, yaw, roll, speed, divergence, true);
|
||||
+ }
|
||||
+
|
||||
+ public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence, boolean relative) {
|
||||
float f5 = -Mth.sin(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
|
||||
float f6 = -Mth.sin((pitch + roll) * 0.017453292F);
|
||||
float f7 = Mth.cos(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
|
||||
@@ -176,7 +186,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
|
||||
Vec3 vec3d = shooter.getDeltaMovement();
|
||||
|
||||
- if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
|
||||
+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity && relative) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
|
||||
}
|
||||
|
||||
// CraftBukkit start - call projectile hit event
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
index 08d597db1a5345a343777a01427655e6bf2c926b..789c7fa48fcf4bf6f462f0ca188518ca97c6b342 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
@@ -42,9 +42,15 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
|
||||
if (!world.isClientSide) {
|
||||
ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW);
|
||||
+
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(entityhuman.getBukkitEntity(), stack.asBukkitCopy(), itemstack1.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
AbstractArrow entityarrow = itemarrow.createArrow(world, itemstack1, entityhuman);
|
||||
|
||||
- entityarrow.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, f * 3.0F, 1.0F);
|
||||
+ entityarrow.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, f * 3.0F, 1.0F, preEvent.isRelative());
|
||||
if (f == 1.0F) {
|
||||
entityarrow.setCritArrow(true);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index a433910fb4d0bd8d7b6b0d66c8fc88d62a0e4879..880aa7780f577bbafc6720400768b0e055927b72 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -229,6 +229,11 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
|
||||
private static void shootProjectile(Level world, LivingEntity shooter, InteractionHand hand, ItemStack crossbow, ItemStack projectile, float soundPitch, boolean creative, float speed, float divergence, float simulated) {
|
||||
if (!world.isClientSide) {
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(shooter.getBukkitEntity(), crossbow.asBukkitCopy(), projectile.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
boolean flag1 = projectile.is(Items.FIREWORK_ROCKET);
|
||||
Object object;
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 21 Dec 2023 20:58:03 -0500
|
||||
Subject: [PATCH] Add CustomBlockUpdateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
index 1d82cfe7af0dc42f88901fb0c44896771fdf8a93..60bb2fe8bb5773d7d0d4279af2216f4c175eca74 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
@@ -66,12 +66,14 @@ public class NoteBlock extends Block {
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.INSTRUMENT).callEvent()) return this.defaultBlockState();
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return this.defaultBlockState(); // Paper - place without considering instrument
|
||||
return this.setInstrument(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.INSTRUMENT, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world.getMinecraftWorld())).callEvent()) return state;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return state; // Paper - prevent noteblock instrument from updating
|
||||
boolean flag = direction.getAxis() == Direction.Axis.Y;
|
||||
|
||||
@@ -80,6 +82,7 @@ public class NoteBlock extends Block {
|
||||
|
||||
@Override
|
||||
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return; // Paper - prevent noteblock powered-state from updating
|
||||
boolean flag1 = world.hasNeighborSignal(pos);
|
||||
|
||||
@@ -119,7 +122,8 @@ public class NoteBlock extends Block {
|
||||
if (world.isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating
|
||||
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates ||
|
||||
+ !new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.PITCH, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating
|
||||
world.setBlock(pos, state, 3);
|
||||
this.playNote(player, state, world, pos);
|
||||
player.awardStat(Stats.TUNE_NOTEBLOCK);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
index 6fe5be785423a35b6ff4e6206ca281b66845b979..227c969c0c52709ccc85663d3b7dce282bba75b0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
@@ -67,21 +67,25 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
- if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return this.defaultBlockState(); // Paper - place tripwire without updating
|
||||
Level world = ctx.getLevel();
|
||||
BlockPos blockposition = ctx.getClickedPos();
|
||||
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE).callEvent()) return this.defaultBlockState();
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return this.defaultBlockState(); // Paper - place tripwire without updating
|
||||
+
|
||||
return (BlockState) ((BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(TripWireBlock.NORTH, this.shouldConnectTo(world.getBlockState(blockposition.north()), Direction.NORTH))).setValue(TripWireBlock.EAST, this.shouldConnectTo(world.getBlockState(blockposition.east()), Direction.EAST))).setValue(TripWireBlock.SOUTH, this.shouldConnectTo(world.getBlockState(blockposition.south()), Direction.SOUTH))).setValue(TripWireBlock.WEST, this.shouldConnectTo(world.getBlockState(blockposition.west()), Direction.WEST));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world.getMinecraftWorld())).callEvent()) return state;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent tripwire from updating
|
||||
return direction.getAxis().isHorizontal() ? (BlockState) state.setValue((Property) TripWireBlock.PROPERTY_BY_DIRECTION.get(direction), this.shouldConnectTo(neighborState, direction)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
||||
if (!oldState.is(state.getBlock())) {
|
||||
this.updateSource(world, pos, state);
|
||||
@@ -90,6 +94,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
||||
if (!moved && !state.is(newState.getBlock())) {
|
||||
this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
|
||||
@@ -98,6 +103,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return state;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent disarming tripwires
|
||||
if (!world.isClientSide && !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) {
|
||||
world.setBlock(pos, (BlockState) state.setValue(TripWireBlock.DISARMED, true), 4);
|
||||
@@ -108,6 +114,7 @@ public class TripWireBlock extends Block {
|
||||
}
|
||||
|
||||
private void updateSource(Level world, BlockPos pos, BlockState state) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
||||
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
|
||||
int i = aenumdirection.length;
|
||||
@@ -141,6 +148,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwires from detecting collision
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
if (!world.isClientSide) {
|
||||
@@ -152,6 +160,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwire pressed check
|
||||
if ((Boolean) world.getBlockState(pos).getValue(TripWireBlock.POWERED)) {
|
||||
this.checkPressed(world, pos);
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Return Displays in getTargetEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index ef0f118aecf0893e45cb9423a677d7e42496324b..ac75ec5d0d0e9ec36030859d78082e0fa48a9b70 100644
|
||||
index a189461330a4d427a7450d504ef13de3605497e3..edbb3b71fb526d75eac65bb4356335c46f79b1b6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4117,7 +4117,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4040,7 +4040,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Vec3 direction = this.getLookAngle();
|
||||
Vec3 end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
|
||||
|
||||
- List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable));
|
||||
+ List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(entity -> entity.isPickable() || entity instanceof Display)); // Parchment - add displays
|
||||
+ List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(entity -> entity.isPickable() || entity instanceof Display));
|
||||
|
||||
double distance = 0.0D;
|
||||
EntityHitResult result = null;
|
||||
@@ -1,92 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 15 Jan 2024 16:39:10 -0500
|
||||
Subject: [PATCH] Entity Data Storage
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..30f8fd154136d05267e8737ff04a0be45b23a35d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
|
||||
@@ -0,0 +1,16 @@
|
||||
+package gg.projecteden.parchment.entity;
|
||||
+
|
||||
+public class EntityDataServices {
|
||||
+
|
||||
+ private static boolean initialized;
|
||||
+
|
||||
+ public static void init() {
|
||||
+ if (initialized) {
|
||||
+ throw new RuntimeException("EntityData Services already initialized");
|
||||
+ }
|
||||
+ initialized = true;
|
||||
+
|
||||
+ // Initialize Services Here
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 2eb9c584cc77237f1c82d880a51a3f8b51008d73..dd0fa065e97f0ae0bc6a2f66392d6393e4c04b06 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -281,6 +281,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
+ gg.projecteden.parchment.entity.EntityDataServices.init();
|
||||
+
|
||||
// CraftBukkit start
|
||||
// this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up
|
||||
this.server.loadPlugins();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 25ea45a528612d1a2a2d77293b3802f473a52f38..169fdd2e21a192bfc834785a2e9eae2adde442c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -164,6 +164,31 @@ import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder {
|
||||
|
||||
+ @javax.annotation.Nullable
|
||||
+ private gg.projecteden.parchment.entity.EntityData storedEntityData;
|
||||
+
|
||||
+ /**
|
||||
+ * Retrieves the stored EntityData for this entity
|
||||
+ * @return The currently stored EntityData
|
||||
+ */
|
||||
+ public gg.projecteden.parchment.entity.EntityData getStoredEntityData() {
|
||||
+ if (this.storedEntityData == null) {
|
||||
+ this.storedEntityData = gg.projecteden.parchment.entity.EntityData.create(this.getBukkitEntity());
|
||||
+ }
|
||||
+ return this.storedEntityData;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clears the currently stored EntityData for this entity
|
||||
+ * @return the previously stored EntityData
|
||||
+ */
|
||||
+ public @javax.annotation.Nullable gg.projecteden.parchment.entity.EntityData clearStoredEntityData() {
|
||||
+ gg.projecteden.parchment.entity.EntityData data = this.storedEntityData;
|
||||
+ this.storedEntityData = null;
|
||||
+
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
// CraftBukkit start
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index a2d336ceb52b63db5c03432ee7bc94dc6a742b82..a7a95547fc3f1614c7e6efdd0dcd24ba6af27fd8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -78,6 +78,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
};
|
||||
// Paper end - Folia schedulers
|
||||
|
||||
+ public gg.projecteden.parchment.entity.EntityData getStoredEntityData() {
|
||||
+ return this.entity.getStoredEntityData();
|
||||
+ }
|
||||
+
|
||||
public CraftEntity(final CraftServer server, final Entity entity) {
|
||||
this.server = server;
|
||||
this.entity = entity;
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 23 Mar 2023 18:18:43 -0400
|
||||
Subject: [PATCH] Make SynchedEntityData#packAll Public
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index bf6a70a69bb695ec1a202cd1e863c468329f80fc..c3f46cba9160b5f1b1d3c882d18f7761a3ee2fdf 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -267,7 +267,7 @@ public class SynchedEntityData {
|
||||
// We need to pack all as we cannot rely on "non default values" or "dirty" ones.
|
||||
// Because these values can possibly be desynced on the client.
|
||||
@Nullable
|
||||
- private List<SynchedEntityData.DataValue<?>> packAll() {
|
||||
+ public List<SynchedEntityData.DataValue<?>> packAll() {
|
||||
if (this.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Mon, 15 Jan 2024 20:53:54 -0500
|
||||
Subject: [PATCH] Add Sidebar Utility
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
|
||||
index 30f8fd154136d05267e8737ff04a0be45b23a35d..7091340870607605521239893b8ab763f49d7999 100644
|
||||
--- a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
|
||||
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
|
||||
@@ -1,5 +1,8 @@
|
||||
package gg.projecteden.parchment.entity;
|
||||
|
||||
+import gg.projecteden.parchment.sidebar.SidebarBufferUtil;
|
||||
+import gg.projecteden.parchment.sidebar.SidebarBufferUtilSpec;
|
||||
+
|
||||
public class EntityDataServices {
|
||||
|
||||
private static boolean initialized;
|
||||
@@ -11,6 +14,7 @@ public class EntityDataServices {
|
||||
initialized = true;
|
||||
|
||||
// Initialize Services Here
|
||||
+ SidebarBufferUtilSpec.IMPL_KEY.set(new SidebarBufferUtil());
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..79900376e8d91792a23dde07fd9f516c3694318f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java
|
||||
@@ -0,0 +1,181 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import gg.projecteden.parchment.util.StringUtils;
|
||||
+import net.minecraft.network.Connection;
|
||||
+import net.minecraft.network.chat.Component;
|
||||
+import net.minecraft.network.chat.numbers.BlankFormat;
|
||||
+import net.minecraft.network.chat.numbers.FixedFormat;
|
||||
+import net.minecraft.network.chat.numbers.NumberFormat;
|
||||
+import net.minecraft.network.protocol.game.*;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.world.scores.DisplaySlot;
|
||||
+import net.minecraft.world.scores.Objective;
|
||||
+import net.minecraft.world.scores.PlayerTeam;
|
||||
+import net.minecraft.world.scores.Team;
|
||||
+import net.minecraft.world.scores.criteria.ObjectiveCriteria;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+import java.util.Objects;
|
||||
+
|
||||
+public class SidebarBufferImpl extends SidebarBuffer {
|
||||
+
|
||||
+ private static final int NAME_LIMIT = 38;
|
||||
+ private static final int AFFIX_LIMIT = 16;
|
||||
+ private static final int SIZE = 15;
|
||||
+
|
||||
+ static final int SIDEBAR_SLOT = 1;
|
||||
+ private final Objective objective = new Objective(DedicatedServer.getServer().getScoreboard(), this.name,
|
||||
+ ObjectiveCriteria.DUMMY, Component.literal(this.stagedTitle), ObjectiveCriteria.RenderType.INTEGER,
|
||||
+ false, null);
|
||||
+
|
||||
+ private Connection connection;
|
||||
+
|
||||
+ SidebarBufferImpl(String name) {
|
||||
+ super(name, SidebarBufferImpl.SIZE);
|
||||
+ }
|
||||
+
|
||||
+ protected void setActive() {
|
||||
+ objective.setDisplayName(Component.literal(StringUtils.colorize(this.stagedTitle)));
|
||||
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_CHANGE);
|
||||
+ ClientboundSetDisplayObjectivePacket packet2 = new ClientboundSetDisplayObjectivePacket(DisplaySlot.SIDEBAR, this.objective);
|
||||
+
|
||||
+ this.connection.send(packet);
|
||||
+ this.connection.send(packet2);
|
||||
+ }
|
||||
+
|
||||
+ protected void pushChanges() {
|
||||
+ if (!Objects.equals(this.liveTitle, this.stagedTitle)) {
|
||||
+ this.liveTitle = this.stagedTitle;
|
||||
+
|
||||
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_CHANGE);
|
||||
+
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ int liveEnd = this.size;
|
||||
+ for (int i = 0; i < this.size; i++) {
|
||||
+ if (this.liveLines[i] == null) {
|
||||
+ liveEnd = i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int stagedEnd = this.size;
|
||||
+ for (int i = 0; i < this.size; i++) {
|
||||
+ if (this.stagedLines[i] == null) {
|
||||
+ stagedEnd = i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int maxEnd = Math.max(liveEnd, stagedEnd);
|
||||
+ int liveIdx = liveEnd - maxEnd;
|
||||
+ int stagedIdx = stagedEnd - maxEnd;
|
||||
+
|
||||
+ for (int i = 0; i < this.size; i++) {
|
||||
+ String live = liveIdx >= 0 ? this.liveLines[liveIdx] : null;
|
||||
+ String staged = stagedIdx >= 0 ? this.stagedLines[stagedIdx] : null;
|
||||
+
|
||||
+ String liveDisplay = liveIdx >= 0 ? this.liveDisplays[liveIdx] : null;
|
||||
+ String stagedDisplay = stagedIdx >= 0 ? this.stagedDisplays[stagedIdx] : null;
|
||||
+
|
||||
+ if (!Objects.equals(live, staged) || !Objects.equals(liveDisplay, stagedDisplay)) {
|
||||
+ if (live != null) {
|
||||
+ this.sendDelete(live, liveEnd - liveIdx);
|
||||
+ }
|
||||
+
|
||||
+ if (staged != null) {
|
||||
+ this.sendCreate(staged, stagedEnd - stagedIdx, this.stagedDisplays[stagedIdx]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ liveIdx++;
|
||||
+ stagedIdx++;
|
||||
+ }
|
||||
+
|
||||
+ System.arraycopy(this.stagedLines, 0, this.liveLines, 0, this.size);
|
||||
+ System.arraycopy(this.stagedDisplays, 0, this.liveDisplays, 0, this.size);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void setOwner(Player player) {
|
||||
+ this.connection = ((CraftPlayer) player).getHandle().connection.connection;
|
||||
+
|
||||
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_ADD);
|
||||
+ this.connection.send(packet);
|
||||
+
|
||||
+ for (int i = 0; i < this.size; i++) {
|
||||
+ String live = this.liveLines[i];
|
||||
+
|
||||
+ if (live != null) {
|
||||
+ this.sendCreate(live, i, stagedDisplays[i]);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected boolean checkTitle(String line) {
|
||||
+ return line.length() <= 32;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected boolean checkLine(String line) {
|
||||
+ return line.length() <= SidebarBufferImpl.NAME_LIMIT + SidebarBufferImpl.AFFIX_LIMIT * 2;
|
||||
+ }
|
||||
+
|
||||
+ private void sendCreate(String value, int line, String display) {
|
||||
+ String id = "\u00a7" + (char) ('\u0080' + line);
|
||||
+ value = StringUtils.colorize(value);
|
||||
+
|
||||
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
|
||||
+ String prefix = value.substring(0, SidebarBufferImpl.AFFIX_LIMIT);
|
||||
+ String suffix = "";
|
||||
+
|
||||
+ value = value.substring(SidebarBufferImpl.AFFIX_LIMIT);
|
||||
+
|
||||
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
|
||||
+ suffix = value.substring(SidebarBufferImpl.NAME_LIMIT);
|
||||
+ value = value.substring(0, SidebarBufferImpl.NAME_LIMIT);
|
||||
+ }
|
||||
+
|
||||
+ PlayerTeam team = new PlayerTeam(DedicatedServer.getServer().getScoreboard(), this.getTeamName(line));
|
||||
+ team.setPlayerPrefix(Component.literal(prefix));
|
||||
+ team.setPlayerSuffix(Component.literal(suffix));
|
||||
+ team.setNameTagVisibility(Team.Visibility.NEVER);
|
||||
+ team.setCollisionRule(Team.CollisionRule.NEVER);
|
||||
+ team.getPlayers().add(id + value);
|
||||
+ ClientboundSetPlayerTeamPacket packet = ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(team, true);
|
||||
+
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ java.util.Optional<NumberFormat> numberFormat = java.util.Optional.of((display == null || display.isEmpty() || display.isBlank()) ? BlankFormat.INSTANCE : new FixedFormat(Component.literal(StringUtils.colorize(display))));
|
||||
+ ClientboundSetScorePacket packet = new ClientboundSetScorePacket(id + value, this.name, line, null, numberFormat);
|
||||
+
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ private void sendDelete(String value, int line) {
|
||||
+ String id = "\u00a7" + (char) ('\u0080' + line);
|
||||
+
|
||||
+ value = StringUtils.colorize(value);
|
||||
+
|
||||
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
|
||||
+ value = value.substring(
|
||||
+ SidebarBufferImpl.AFFIX_LIMIT,
|
||||
+ Math.min(value.length(), SidebarBufferImpl.AFFIX_LIMIT + SidebarBufferImpl.NAME_LIMIT)
|
||||
+ );
|
||||
+
|
||||
+ ClientboundSetPlayerTeamPacket packet = ClientboundSetPlayerTeamPacket.createRemovePacket(DedicatedServer.getServer().getScoreboard().getPlayerTeam(this.getTeamName(line)));
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ ClientboundResetScorePacket packet = new ClientboundResetScorePacket(id + value, this.name);
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ private String getTeamName(int line) {
|
||||
+ return this.name + "/" + Integer.toUnsignedString(line, 32);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..599e84adf8e480508b9c2ce87baca07e163d345e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java
|
||||
@@ -0,0 +1,19 @@
|
||||
+package gg.projecteden.parchment.sidebar;
|
||||
+
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetDisplayObjectivePacket;
|
||||
+import net.minecraft.world.scores.DisplaySlot;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.entity.Player;
|
||||
+
|
||||
+public class SidebarBufferUtil implements SidebarBufferUtilSpec {
|
||||
+ @Override
|
||||
+ public SidebarBuffer create(String name) {
|
||||
+ return new SidebarBufferImpl(name);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void hideSidebar(Player player) {
|
||||
+ ClientboundSetDisplayObjectivePacket packet = new ClientboundSetDisplayObjectivePacket(DisplaySlot.SIDEBAR, null);
|
||||
+ ((CraftPlayer) player).getHandle().connection.send(packet);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/util/StringUtils.java b/src/main/java/gg/projecteden/parchment/util/StringUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0f8700f43e5503d5b002368fa36d8e6a7577658f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/util/StringUtils.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package gg.projecteden.parchment.util;
|
||||
+
|
||||
+import net.md_5.bungee.api.ChatColor;
|
||||
+
|
||||
+import java.util.regex.Matcher;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+public class StringUtils {
|
||||
+
|
||||
+ private static final String colorChar = "§";
|
||||
+ private static final String altColorChar = "&";
|
||||
+ private static final String colorCharsRegex = "[" + colorChar + altColorChar + "]";
|
||||
+ private static final Pattern hexPattern = Pattern.compile(colorCharsRegex + "#[a-fA-F\\d]{6}");
|
||||
+
|
||||
+ public static String colorize(String input) {
|
||||
+ if (input == null)
|
||||
+ return null;
|
||||
+
|
||||
+ while (true) {
|
||||
+ Matcher matcher = hexPattern.matcher(input);
|
||||
+ if (!matcher.find()) break;
|
||||
+
|
||||
+ String color = matcher.group();
|
||||
+ input = input.replace(color, ChatColor.of(color.replaceFirst(colorCharsRegex, "")).toString());
|
||||
+ }
|
||||
+
|
||||
+ return ChatColor.translateAlternateColorCodes(altColorChar.charAt(0), input);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -1,114 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 25 Jan 2024 19:59:13 -0500
|
||||
Subject: [PATCH] Add Block BreakNaturally Overload
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 46330f02d04f9e8a921ddf14bb34e94392c17431..e7695d630e17260708951090da89db7dbb3db09e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -299,24 +299,28 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
return state.getDrops(lootparams_a);
|
||||
}
|
||||
|
||||
- public static void dropResources(BlockState state, Level world, BlockPos pos) {
|
||||
+ public static List<ItemEntity> dropResources(BlockState state, Level world, BlockPos pos) {
|
||||
if (world instanceof ServerLevel) {
|
||||
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, (BlockEntity) null)).forEach((itemstack) -> { // Parchment
|
||||
- Block.popResource(world, pos, itemstack);
|
||||
+ itemEntities.add(Block.popResourceWithReturn(world, pos, itemstack));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new java.util.ArrayList<>();
|
||||
}
|
||||
|
||||
- public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
+ public static List<ItemEntity> dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel) {
|
||||
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity)).forEach((itemstack) -> { // Parchment
|
||||
- Block.popResource((ServerLevel) world, pos, itemstack);
|
||||
+ itemEntities.add(Block.popResourceWithReturn((ServerLevel) world, pos, itemstack));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new java.util.ArrayList<>();
|
||||
}
|
||||
|
||||
// Paper start - Add BlockBreakBlockEvent
|
||||
@@ -344,15 +348,17 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
// Paper start - Properly handle xp dropping
|
||||
dropResources(state, world, pos, blockEntity, entity, tool, true);
|
||||
}
|
||||
- public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
|
||||
+ public static List<ItemEntity> dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
|
||||
// Paper end - Properly handle xp dropping
|
||||
if (world instanceof ServerLevel) {
|
||||
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool)).forEach((itemstack1) -> { // Parchment
|
||||
- Block.popResource(world, pos, itemstack1);
|
||||
+ itemEntities.add(Block.popResourceWithReturn(world, pos, itemstack1));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, tool, dropExperience); // Paper - Properly handle xp dropping
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new java.util.ArrayList<>();
|
||||
}
|
||||
|
||||
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
||||
@@ -366,6 +372,17 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}, stack);
|
||||
}
|
||||
|
||||
+ public static ItemEntity popResourceWithReturn(Level world, BlockPos pos, ItemStack stack) {
|
||||
+ double d0 = (double) EntityType.ITEM.getHeight() / 2.0D;
|
||||
+ double d1 = (double) pos.getX() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
||||
+ double d2 = (double) pos.getY() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D) - d0;
|
||||
+ double d3 = (double) pos.getZ() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
||||
+
|
||||
+ ItemEntity itemEntity = new ItemEntity(world, d1, d2, d3, stack);
|
||||
+ Block.popResource(world, () -> itemEntity, stack);
|
||||
+ return itemEntity;
|
||||
+ }
|
||||
+
|
||||
public static void popResourceFromFace(Level world, BlockPos pos, Direction direction, ItemStack stack) {
|
||||
int i = direction.getStepX();
|
||||
int j = direction.getStepY();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index ac11f18690434922179b61ffcc3036dea025b0cb..f9aae49eed516bce00cb968de36ca8b3de038311 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -500,6 +500,11 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public boolean breakNaturally(ItemStack item, boolean triggerEffect, boolean dropExperience) {
|
||||
+ return this.breakNaturally(null, item, triggerEffect, dropExperience);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean breakNaturally(Player player, ItemStack item, boolean triggerEffect, boolean dropExperience) {
|
||||
// Paper end
|
||||
// Order matters here, need to drop before setting to air so skulls can get their data
|
||||
net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
|
||||
@@ -509,7 +514,12 @@ public class CraftBlock implements Block {
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
|
||||
- net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), this.position, this.world.getBlockEntity(this.position), null, nmsItem, false); // Paper - Properly handle xp dropping
|
||||
+ List<net.minecraft.world.entity.item.ItemEntity> itemEntities = net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), this.position, this.world.getBlockEntity(this.position), null, nmsItem, false);
|
||||
+
|
||||
+ if (player != null) {
|
||||
+ new org.bukkit.event.block.BlockDropItemEvent(this, this.getState(), player, itemEntities.stream().map(i -> (org.bukkit.entity.Item) CraftEntity.getEntity((org.bukkit.craftbukkit.CraftServer) Bukkit.getServer(), i)).toList()).callEvent();
|
||||
+ }
|
||||
+
|
||||
// Paper start - improve Block#breanNaturally
|
||||
if (triggerEffect) {
|
||||
if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.BaseFireBlock) {
|
||||
Reference in New Issue
Block a user