Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39c6747e13 | ||
|
|
d204d8c9fe | ||
|
|
4412e8b984 | ||
|
|
1bd783aeb1 | ||
|
|
999f43f448 | ||
|
|
88ca112d35 | ||
|
|
127dae4f19 | ||
|
|
71be6693a3 | ||
|
|
c7cfec78f4 | ||
|
|
6d85991c24 | ||
|
|
58bfb886ca | ||
|
|
1f25e2f005 | ||
|
|
3cc188ae47 | ||
|
|
ce4157e318 | ||
|
|
4a430b2238 | ||
|
|
e9072bd3a6 | ||
|
|
b3f2c79d02 | ||
|
|
86a21a089b | ||
|
|
17e63ac792 | ||
|
|
3edba7dac4 | ||
|
|
402652c29d | ||
|
|
7a0b6cc24f | ||
|
|
3397936ab4 | ||
|
|
8f27eca2e3 | ||
|
|
0bbed6029c | ||
|
|
883620f828 | ||
|
|
61a11d791c | ||
|
|
f8028c508e | ||
|
|
7646770baa | ||
|
|
d3a3626a73 | ||
|
|
85a2184a1c | ||
|
|
f3b4987f33 | ||
|
|
89bda77d56 | ||
|
|
94524aebdb |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -74,4 +74,3 @@ run/
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
10
build-data/dev-imports.txt
Normal file
10
build-data/dev-imports.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
# 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
|
||||
@@ -1,4 +0,0 @@
|
||||
# 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
|
||||
@@ -3,8 +3,8 @@ import io.papermc.paperweight.util.constants.*
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.3.11"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.11"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -15,9 +15,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
|
||||
paperclip("io.papermc:paperclip:3.0.2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.10:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -48,10 +48,6 @@ subprojects {
|
||||
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 {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
group = gg.projecteden.parchment
|
||||
version = 1.19.2-R0.1-SNAPSHOT
|
||||
version = 1.20.4-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion = 1.19.2
|
||||
paperRef = 476ef25d053c523aea416487a38f72011d72a9cf
|
||||
mcVersion = 1.20.4
|
||||
paperRef = f1820dc80a02009980e6466ea5847933861b911a
|
||||
edenVersion = 2.2.8-SNAPSHOT
|
||||
|
||||
updatingMinecraft=true
|
||||
|
||||
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,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
288
gradlew
vendored
288
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,98 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# 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
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$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"'
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +118,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +137,109 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
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
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
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
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
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.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
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,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 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!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
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%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
28
patches/api/0001-Build-changes.patch
Normal file
28
patches/api/0001-Build-changes.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
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 9d817bf3f26ffd484945a00a6538970eca22ee20..fa4928487cca082a770a25f6f6490286ae397037 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,6 +14,9 @@ val bungeeCordChatVersion = "1.20-R0.1"
|
||||
val adventureVersion = "4.14.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 dependencies are listed transitively to API consumers
|
||||
api("com.google.guava:guava:32.1.2-jre")
|
||||
api("com.google.code.gson:gson:2.10.1")
|
||||
@@ -60,7 +60,7 @@ index abeb24fccda2acfdb0dfdadacb8fe688bd97cf78..890069604ca78a9a3f3b4c5f40969a45
|
||||
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 59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3..b0cc7665e6591c71b7cd4388d028a5f8abd65e64 100644
|
||||
index 59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3..738007be082287a1f1662f2f3b7772e818042647 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -20,7 +20,7 @@ import java.util.UUID;
|
||||
@@ -68,12 +68,12 @@ index 59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3..b0cc7665e6591c71b7cd4388d028a5f8
|
||||
* <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
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable, gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment {
|
||||
|
||||
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 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdcb1de2e78 100644
|
||||
index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..700fa58c70612ef18b26e8160e8ad1275ad56b5a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
|
||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -85,20 +85,16 @@ index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdc
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@NotNull private final String name;
|
||||
@@ -49,11 +49,27 @@ public class PreLookupProfileEvent extends Event {
|
||||
* {@link LookupProfileEvent}
|
||||
*
|
||||
@@ -51,10 +51,25 @@ public class PreLookupProfileEvent extends Event {
|
||||
* @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
|
||||
+ public final UUID getUUID() {
|
||||
+ return getUniqueId();
|
||||
+ }
|
||||
+
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * 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
|
||||
@@ -108,12 +104,13 @@ index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdc
|
||||
+ */
|
||||
+ @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.
|
||||
*
|
||||
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 9be64a95c2345433b6142d611077dedadcef9f5d..e3cea810881868fb5869de72f331733e6893fcee 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
@@ -128,7 +125,7 @@ index 9be64a95c2345433b6142d611077dedadcef9f5d..e3cea810881868fb5869de72f331733e
|
||||
@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 89e132525cfae0ce979e37b3e2793df781e47227..f14635ae3112862c1337398bf5f5f56a7f87d90f 100644
|
||||
index 2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a..640a01478be687b089aeddad422e4bba2bea19b6 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -8,7 +8,7 @@ import static com.google.common.base.Preconditions.*;
|
||||
@@ -263,10 +260,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..23897904c6e2d6195f3613c36d77454587afd8bc
|
||||
index 0000000000000000000000000000000000000000..305713e6095de2849a42ba1f4049b8715f1f907c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/OptionalLocation.java
|
||||
@@ -0,0 +1,18 @@
|
||||
@@ -0,0 +1,17 @@
|
||||
+package gg.projecteden.parchment;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@@ -279,8 +276,7 @@ index 0000000000000000000000000000000000000000..23897904c6e2d6195f3613c36d774545
|
||||
+@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();
|
||||
@@ -427,21 +423,21 @@ index 12163a7b0591a7d022dc7eb9ee6608a1b6c39d9b..d81c7307127b135417e06a3b244416be
|
||||
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 ef0cb00ca4cb7d2f5e4ec1c950cce036566d1ae4..df53183beb4c438ea3c821e1ffd8e2719c08f269 100644
|
||||
index 9bbd928f7d513ca317cd27beffa61e5111f5ffb0..7cc62b34800d7fe3d26e78945b1e4f24d09f7c85 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;
|
||||
* magnitude than 360 are valid, but may be normalized to any other equivalent
|
||||
* representation by the implementation.
|
||||
*/
|
||||
-public class Location implements Cloneable, ConfigurationSerializable {
|
||||
+public class Location implements Cloneable, ConfigurationSerializable, gg.projecteden.parchment.HasLocation { // Parchment
|
||||
-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
|
||||
private Reference<World> world;
|
||||
private double x;
|
||||
private double y;
|
||||
@@ -72,6 +72,13 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
@@ -38,6 +38,13 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
@@ -451,35 +447,28 @@ index ef0cb00ca4cb7d2f5e4ec1c950cce036566d1ae4..df53183beb4c438ea3c821e1ffd8e271
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Sets the world that this location resides in
|
||||
* Constructs a new Location with the given coordinates
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index a7d1f1e701f23e851f735584a30bedadb0d8b9bd..7b37b6f596b4ac6b8049c7bd195139ac03ba63bc 100644
|
||||
index bce07d84cafca677bb6fad78c21b82097f06430c..c148832d2df44faa41d239d0be5b9df284a9b7c0 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -10,7 +10,7 @@ import org.bukkit.profile.PlayerProfile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,7 +19,14 @@ 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
|
||||
|
||||
/**
|
||||
* Checks if this player is currently online
|
||||
@@ -139,6 +139,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
|
||||
+
|
||||
|
||||
/**
|
||||
* Gets the first date and time that this player was witnessed on this
|
||||
* server.
|
||||
* Checks if this player is currently online
|
||||
diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java
|
||||
index 983a8c20a06d2b509602b27f49c090598b8ecc42..46dd8496f5a2c792ee7811e33c424e88edf8b5b3 100644
|
||||
--- a/src/main/java/org/bukkit/Raid.java
|
||||
@@ -520,23 +509,23 @@ index d124768378d6f0c5573f28ee815ea3886fe74868..11a00998b1cb5ee582e225553f15b1b7
|
||||
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 9930ebe7a23d306c602840fd43652fbdaba481b3..531b8090a224c448c7316d77663d2cc2787ee621 100644
|
||||
index 49974558799830d827f9ccd65a8bafee3fb0376b..0015bb89899e52d3c8f1ca68807ad7092e690305 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* (i.e. lighting and power) may not be able to be safely accessed during world
|
||||
* generation when used in cases like BlockPhysicsEvent!!!!
|
||||
*/
|
||||
-public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
||||
+public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable, gg.projecteden.parchment.HasLocation { // Paper - translatable
|
||||
-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
|
||||
|
||||
/**
|
||||
* 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 37ca7b6b0fcee8bec12026ec3715dcc47400cc11..eaf14ce470f041360082cbb0bc16247706b2cd77 100644
|
||||
index ef35316fa66ac8d9c7836b9c8af56dcefbf6ff2e..01e2c95bf52cfcffc51d354770fbda5f76540a28 100644
|
||||
--- a/src/main/java/org/bukkit/block/BlockState.java
|
||||
+++ b/src/main/java/org/bukkit/block/BlockState.java
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -21,7 +21,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.
|
||||
*/
|
||||
@@ -572,12 +561,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 33a6b7a27dc91552799c07a7aad9b3df31ad13f7..04626febc2f141c2774de98694761f010a0b0c6a 100644
|
||||
index 1d0fd7ff8449f815a7d980af0b378181ea8bf8d8..65d2b0e87feec296b9f20a6de2d2266493cd1e7b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a base entity in the world
|
||||
@@ -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.
|
||||
*/
|
||||
-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
|
||||
@@ -585,7 +574,7 @@ index 33a6b7a27dc91552799c07a7aad9b3df31ad13f7..04626febc2f141c2774de98694761f01
|
||||
/**
|
||||
* 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 3b204144e2d245098b3dc23b8779f9ed817bb6d1..2d5a09bb8f31d6234ca8a3f343d45eee81cc1dd4 100644
|
||||
index 8b0d04d5b39ee817555a36adddc39b18fc6f0d02..1c87047de615a85ee20297295478770e669d87e6 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;
|
||||
@@ -593,28 +582,28 @@ index 3b204144e2d245098b3dc23b8779f9ed817bb6d1..2d5a09bb8f31d6234ca8a3f343d45eee
|
||||
* Represents a human entity, such as an NPC or a player
|
||||
*/
|
||||
-public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
|
||||
+// Parchment start
|
||||
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity {
|
||||
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity { // Parchment
|
||||
+
|
||||
+ // 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 1e27b9de47f111b9c000243214e22890e323f7fc..56e979e2083199cc68b0381ed51733397cb230be 100644
|
||||
index a8d3451ccfcd21a9e80adc2feab8fc9c2926c753..c445cff54095a5389c8d186a9a191beef082c118 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -42,7 +42,17 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -52,7 +52,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, 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
|
||||
-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
|
||||
+
|
||||
+ // Parchment start - fix defaults
|
||||
+ /**
|
||||
@@ -642,7 +631,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 a1350c0f74d445dca09eea6e10abac050bb06990..11bb6f8f7363f31061d5fd0f2e4515099ac40649 100644
|
||||
index 08d09c2a92d8aa6adf6610cc05905d58a76fce1f..5105d8be50d3ebc75eb776f27679ece82317fe06 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;
|
||||
@@ -655,7 +644,7 @@ index a1350c0f74d445dca09eea6e10abac050bb06990..11bb6f8f7363f31061d5fd0f2e451509
|
||||
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 cd04a0bd9d232857408b38605787016a217cb8d2..7035fe7c0f5adb981ac41804605c4fbcf57968bf 100644
|
||||
index 392cde07d578d684423e1bf369af28696eb7e484..e1dacc04c73e0cabcd04d50540f3a5716550e22f 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;
|
||||
@@ -707,7 +696,7 @@ index 6dcd9f828c6c40e48593b0bad5a44a656eb01645..0651bdd983e90e0e1e8a3565dcb5d97c
|
||||
private final IgniteCause cause;
|
||||
private final Entity ignitingEntity;
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
|
||||
index be0a2d1f234d8265d98e54e518a994957b1f3ab7..54cd6735fbcad009330927d760f8bd93ea9c51ec 100644
|
||||
index 4e3c406ba883aae553e8d69b6b719b872cd6096c..d0a92dc9eba0f61b596e9a388f3aa4076ef2bc65 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -720,10 +709,10 @@ index be0a2d1f234d8265d98e54e518a994957b1f3ab7..54cd6735fbcad009330927d760f8bd93
|
||||
protected boolean cancel;
|
||||
protected boolean canBuild;
|
||||
diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
|
||||
index 1268066e30ddb0cd3792ea4b3de894eb04196669..1e20629da438651d3987258b93cf9caf9eff9452 100644
|
||||
index d944d67f544494355f03c5bc9afd8ea7726e6412..800db8e63bdb8c05ffdc88c3a3b0f1f268a1357e 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
* If a Sign Change event is cancelled, the sign will not be changed.
|
||||
*/
|
||||
@@ -733,7 +722,7 @@ index 1268066e30ddb0cd3792ea4b3de894eb04196669..1e20629da438651d3987258b93cf9caf
|
||||
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..b42465617e83d3413ab647cd9c78212b61ca5833 100644
|
||||
index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..57f89f569725289d56f1c75db258ac19b6f94f30 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;
|
||||
@@ -745,11 +734,8 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
@@ -42,11 +42,27 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable
|
||||
*
|
||||
* @return The Human entity that caused the animal to enter love mode, or
|
||||
@@ -44,9 +44,24 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable
|
||||
* null if there wasn't one.
|
||||
+ * @deprecated alias of {@link #getPlayer()} <!-- Parchment: fix inconsistent naming -->
|
||||
*/
|
||||
@Nullable
|
||||
- public HumanEntity getHumanEntity() {
|
||||
@@ -775,12 +761,12 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b
|
||||
/**
|
||||
* 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 10d0e18dfd423b108fe381e8142867eb10399359..7f9f266057de42261fa06e4874d7bec5388c90c7 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
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Called when an entity explodes
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* event isn't called if the {@link org.bukkit.GameRule#MOB_GRIEFING}
|
||||
* is disabled as no block interaction will occur.
|
||||
*/
|
||||
-public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
+public class EntityExplodeEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
|
||||
@@ -788,7 +774,7 @@ index 10d0e18dfd423b108fe381e8142867eb10399359..7f9f266057de42261fa06e4874d7bec5
|
||||
private boolean cancel;
|
||||
private final Location location;
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
|
||||
index 327876e0ad7dcfeb71d9d22afe1c04bcd71c3bf9..466a54c4e30a7886e7383f43f9b6c389a5bdba7c 100644
|
||||
index 71d664dd89995f088c47d17b38547d530319470c..d931ece8f35c8f01748c59d01617fd59b287030e 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -866,12 +852,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 020739697a0b535cad0b15b574f77cdabbdfa3eb..ee4fd41e66852d5d2c62222c7b884473d3f3001d 100644
|
||||
index a965b6a78073c5da86ad671752eff4a270029420..84cc90c085ae5ab788bcbc83bf1a0081be3b8186 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* This event is called when a player takes items out of the furnace
|
||||
@@ -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}.
|
||||
*/
|
||||
-public class FurnaceExtractEvent extends BlockExpEvent {
|
||||
+public class FurnaceExtractEvent extends BlockExpEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
|
||||
@@ -879,12 +865,12 @@ index 020739697a0b535cad0b15b574f77cdabbdfa3eb..ee4fd41e66852d5d2c62222c7b884473
|
||||
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 21ad8888c0e403bfc63518502577d651c02dda05..1c59335a8f0a40162190f6fb73ffbfef0cd795d8 100644
|
||||
index 4db0a07db156c61867644f50c185e63b695e2462..eb6632e2e9d247bd54e02e3a134dfdbed9aeef39 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a player related inventory event
|
||||
@@ -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.
|
||||
*/
|
||||
-public class InventoryCloseEvent extends InventoryEvent {
|
||||
+public class InventoryCloseEvent extends InventoryEvent implements gg.projecteden.parchment.HasHumanEntity { // Parchment
|
||||
@@ -892,20 +878,20 @@ index 21ad8888c0e403bfc63518502577d651c02dda05..1c59335a8f0a40162190f6fb73ffbfef
|
||||
// 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 9013d043503d175004ad276799e5935b7fa59dc4..4095ca19e6ceff2432e0cbd372e9475f748278a7 100644
|
||||
index 8e2afeab4c62724148e8bb0c83fb7eec569c7a0c..2843fd117151dc75c87db06915a6732277867a0c 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;
|
||||
/**
|
||||
* Represents a player related inventory event
|
||||
* Called when a player opens an inventory
|
||||
*/
|
||||
-public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
|
||||
+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 635b8787fc235b61c0d5677def034656e4ec4cef..6f15f4adfa552e2f5960464663ee126282086bb1 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
|
||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -944,19 +930,18 @@ index 6800132c6288b4588fd02b08d26f016c38f27129..8e333a361cdee30a83e9472285dfb0b3
|
||||
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..97bb62b616f8f08ec697c14681ffe6d89934b526 100644
|
||||
index d63bd62606763d0902ea800f0c35a1cfd07fc8ec..ecca20d51f8ac6f27887c55ae2aaa428ecb1ea53 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
@@ -10,8 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,7 +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
|
||||
@@ -1010,7 +995,7 @@ index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..c28d62fc3dc359f9ebcf926094198ee3
|
||||
private boolean cancelled = false;
|
||||
private final Location location;
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
index c574bb94b21eb27974b40c839fce52c6ac4b54b4..0172bed7917ea1199c34438385be4bceac9cfaa4 100644
|
||||
index 0d519813c12d98b28d62e6d01d7ec6e8c2dba3c3..469b9cc0c4b77844ba0317af51bd9ad873915967 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -1023,7 +1008,7 @@ index c574bb94b21eb27974b40c839fce52c6ac4b54b4..0172bed7917ea1199c34438385be4bce
|
||||
/**
|
||||
* 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 2448e70d75ae7a678c6befac4506c103edb78875..65ca144618f74bc8e317a4b9c2732ad5ed13a208 100644
|
||||
index ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059..464c69fd652db3384b1a4a5f4151933c3cd7df7b 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;
|
||||
@@ -6,12 +6,13 @@ 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..e612cecc89b060a9c0fc882754e45c0409febb9d
|
||||
index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222bae9167a85
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java
|
||||
@@ -0,0 +1,382 @@
|
||||
@@ -0,0 +1,359 @@
|
||||
+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;
|
||||
@@ -34,7 +35,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ * 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, OptionalHumanEntity {
|
||||
+public final class SoundEvent extends Event implements Cancellable {
|
||||
+ private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(SoundEvent.class);
|
||||
+
|
||||
+ private static final org.bukkit.event.HandlerList handlers = new org.bukkit.event.HandlerList();
|
||||
@@ -59,16 +60,14 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ 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, long seed, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
|
||||
+ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, @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));
|
||||
+ }
|
||||
@@ -77,18 +76,6 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ * 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;
|
||||
@@ -140,24 +127,6 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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
|
||||
@@ -336,7 +305,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+
|
||||
+ private record WrappedRecipientsFunction(@NotNull Function<SoundEvent, List<Player>> wrapped) implements Function<SoundEvent, List<Player>> {
|
||||
+ @Override
|
||||
+ public List<Player> apply(SoundEvent event) {
|
||||
+ public @NotNull List<Player> apply(@NotNull SoundEvent event) {
|
||||
+ List<Player> recipients = wrapped.apply(event);
|
||||
+ HumanEntity except = event.getException();
|
||||
+ if (except != null) {
|
||||
@@ -362,14 +331,18 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ /**
|
||||
+ * The class which determines where a sound will emit from.
|
||||
+ */
|
||||
+ public sealed interface Emitter permits EntityEmitter, LocationEmitter {
|
||||
+ public sealed interface Emitter extends HasLocation permits EntityEmitter, LocationEmitter {
|
||||
+ /**
|
||||
+ * Gets the location at which the sound will be played.
|
||||
+ *
|
||||
+ * @return sound's location
|
||||
+ * @deprecated use {@link #getLocation()} instead
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Location location();
|
||||
+ @Deprecated
|
||||
+ default Location location() {
|
||||
+ return getLocation();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -379,7 +352,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ */
|
||||
+ public record EntityEmitter(@NotNull Entity entity) implements Emitter {
|
||||
+ @Override
|
||||
+ public @NotNull Location location() {
|
||||
+ public @NotNull Location getLocation() {
|
||||
+ return entity.getLocation();
|
||||
+ }
|
||||
+ }
|
||||
@@ -390,5 +363,9 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
|
||||
+ * @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;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -5,39 +5,47 @@ 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
|
||||
index ab18f35b686ec79551c307dde9e43c7dfad1b182..47c522e31d704d6c36fbfe128c97cba234932bc7 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;
|
||||
*/
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
private final Block damager;
|
||||
private final org.bukkit.block.BlockState damagerBlockState; // Paper
|
||||
+ private final org.bukkit.Location location; // Parchment
|
||||
|
||||
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
// Paper start
|
||||
@@ -28,21 +29,41 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
|
||||
super(damagee, cause, damage);
|
||||
this.damager = damager;
|
||||
this.damagerBlockState = damagerBlockState; // Paper
|
||||
+ 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
|
||||
// Paper start
|
||||
- this(damager, damagee, cause, modifiers, modifierFunctions, null);
|
||||
+ this(damager, damagee, cause, modifiers, modifierFunctions, null, null);
|
||||
}
|
||||
|
||||
+ // 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;
|
||||
@org.jetbrains.annotations.ApiStatus.Internal
|
||||
- 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, final @Nullable org.bukkit.block.BlockState damagerBlockState) {
|
||||
+ 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, final @Nullable org.bukkit.block.BlockState damagerBlockState, @Nullable final org.bukkit.Location damageLocation) { // Parchment
|
||||
// Paper end
|
||||
super(damagee, cause, modifiers, modifierFunctions);
|
||||
this.damager = damager;
|
||||
this.damagerBlockState = damagerBlockState; // Paper
|
||||
+ // 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.
|
||||
+ *
|
||||
@@ -6,19 +6,19 @@ 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 f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489642245c2 100644
|
||||
index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76719d2d04 100644
|
||||
--- a/src/main/java/org/bukkit/ChatColor.java
|
||||
+++ b/src/main/java/org/bukkit/ChatColor.java
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* All supported color values for chat
|
||||
@@ -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
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
-public enum ChatColor {
|
||||
+public enum ChatColor implements net.kyori.adventure.text.format.StyleBuilderApplicable, net.kyori.adventure.text.format.TextFormat { // Parchment
|
||||
/**
|
||||
* Represents black
|
||||
*/
|
||||
@@ -181,6 +181,13 @@ public enum ChatColor {
|
||||
@@ -183,6 +183,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.MAGIC;
|
||||
}
|
||||
@@ -26,41 +26,13 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
|
||||
+ style.apply(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text bold.
|
||||
@@ -191,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.
|
||||
@@ -201,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.
|
||||
@@ -211,6 +232,13 @@ public enum ChatColor {
|
||||
@@ -213,6 +220,13 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.UNDERLINE;
|
||||
}
|
||||
@@ -68,27 +40,13 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
|
||||
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
|
||||
+ style.apply(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
},
|
||||
/**
|
||||
* Makes the text italic.
|
||||
@@ -221,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.
|
||||
@@ -231,6 +266,16 @@ public enum ChatColor {
|
||||
@@ -233,6 +247,16 @@ public enum ChatColor {
|
||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||
return net.md_5.bungee.api.ChatColor.RESET;
|
||||
}
|
||||
@@ -105,14 +63,17 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -263,6 +308,13 @@ public enum ChatColor {
|
||||
@@ -265,6 +289,16 @@ 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) {
|
||||
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB()));
|
||||
+ 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()));
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
@@ -120,20 +81,20 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
|
||||
* Gets the char value associated with this color
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Color.java b/src/main/java/org/bukkit/Color.java
|
||||
index d2f8f5a8e49f60422b6a41e51248a6710251d61b..40b09a861ba365b126c2b28bb7f18c8fb8b3e5b5 100644
|
||||
index e088390ec3fb87eeabc73dfe90e3544980c02e5b..5d4fbb08832fd0490a9375580f909beaf941e8fa 100644
|
||||
--- a/src/main/java/org/bukkit/Color.java
|
||||
+++ b/src/main/java/org/bukkit/Color.java
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* but subject to change.
|
||||
*/
|
||||
@SerializableAs("Color")
|
||||
-public final class Color implements ConfigurationSerializable {
|
||||
+public final class Color implements ConfigurationSerializable, net.kyori.adventure.text.format.TextColor { // Parchment
|
||||
private static final int BIT_MASK = 0xff;
|
||||
private static final int DEFAULT_ALPHA = 255;
|
||||
|
||||
/**
|
||||
@@ -244,6 +244,13 @@ public final class Color implements ConfigurationSerializable {
|
||||
return getRed() << 16 | getGreen() << 8 | getBlue() << 0;
|
||||
@@ -309,6 +309,13 @@ public final class Color implements ConfigurationSerializable {
|
||||
return getAlpha() << 24 | getRed() << 16 | getGreen() << 8 | getBlue();
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Add UnsafeValues#canPlaceItemOn
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 854be548e5a645e7312e6e9390d5255f8b1d61e6..9fdcb933788cb78306dc066b3bf6ed01a6316cd3 100644
|
||||
index a4b38f284d4fea7df7f9df9bf44e4f68fefaf20f..df153e397f69a6a2f2487998efd444f26d1ff701 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -271,4 +271,17 @@ public interface UnsafeValues {
|
||||
*/
|
||||
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||
@@ -260,4 +260,17 @@ public interface UnsafeValues {
|
||||
|
||||
String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic);
|
||||
// Paper end
|
||||
+
|
||||
+ // Parchment start
|
||||
@@ -5,14 +5,13 @@ Subject: [PATCH] Expose MCUtil Executors
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index e43fef0152468944d8a33036344a43e95fe58476..3e46e1c329eb19851ae78025237e70083d815879 100644
|
||||
index d0c634629aa0b6bac0da93655dd86ad3aea0ce30..b3162d58938ea5cb38f735a5977ce5e60d81c2b0 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2137,4 +2137,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
|
||||
// Paper end
|
||||
+
|
||||
@@ -2162,6 +2162,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
UnsafeValues getUnsafe();
|
||||
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
+ * Gets the executor which runs tasks on an asynchronous thread pool.
|
||||
@@ -28,4 +27,7 @@ index e43fef0152468944d8a33036344a43e95fe58476..3e46e1c329eb19851ae78025237e7008
|
||||
+ @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..28c01caa9d6379046f6af6612719b40459a89d17
|
||||
index 0000000000000000000000000000000000000000..ea17d99c7a1d70d88e2c439399cdb376b9dedf47
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
|
||||
@@ -0,0 +1,50 @@
|
||||
@@ -24,15 +24,15 @@ index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b404
|
||||
+ */
|
||||
+ CRAFTING(false),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a furnace.
|
||||
+ * Recipes for smelting an item inside a furnace.
|
||||
+ */
|
||||
+ SMELTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a blasting furnace.
|
||||
+ * Recipes for smelting an item inside a blasting furnace.
|
||||
+ */
|
||||
+ BLASTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a smoker.
|
||||
+ * Recipes for smelting an item inside a smoker.
|
||||
+ */
|
||||
+ SMOKING(true),
|
||||
+ /**
|
||||
@@ -64,12 +64,12 @@ index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b404
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index e8c0c853eb52d1473c20231660355f77b1f7e016..60172dd594e51351c8253446f6d8c1347920b2a0 100644
|
||||
index 5eb3521f5f91b0684b4beebf4f7ba2c795b41c42..c8a3e139fd462a184fac9ff472048451372229de 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -3985,6 +3985,36 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@Nullable
|
||||
public DragonBattle getEnderDragonBattle();
|
||||
@@ -50,6 +50,36 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
@@ -101,6 +101,6 @@ index e8c0c853eb52d1473c20231660355f77b1f7e016..60172dd594e51351c8253446f6d8c134
|
||||
+ ItemStack smeltItem(@NotNull ItemStack toSmelt, gg.projecteden.parchment.inventory.@NotNull RecipeType recipeType);
|
||||
+ // Parchment end
|
||||
+
|
||||
// Paper start
|
||||
/**
|
||||
* Represents various map environment types that a world may be
|
||||
*/
|
||||
* @return The amount of Entities in this world
|
||||
|
||||
@@ -5,11 +5,11 @@ 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 cea29fd3c3ea6b3f2e6d2f89022cc4f4fdab93b2..7f4827819fc241866edb571f05e9b14d0955c0c4 100644
|
||||
index c445cff54095a5389c8d186a9a191beef082c118..e59cac883dc83186e0977a73b03636993696b37e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1476,6 +1476,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@org.jetbrains.annotations.ApiStatus.Experimental // Paper
|
||||
@@ -1912,6 +1912,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@ApiStatus.Experimental
|
||||
public boolean canSee(@NotNull Entity entity);
|
||||
|
||||
+ // Parchment start
|
||||
@@ -19,10 +19,10 @@ index cea29fd3c3ea6b3f2e6d2f89022cc4f4fdab93b2..7f4827819fc241866edb571f05e9b14d
|
||||
+ * @param plugin Plugin that has hidden entities
|
||||
+ * @return a view of hidden entity UUIDs
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ public java.util.@NotNull Set<UUID> getHiddenEntities(@NotNull Plugin plugin);
|
||||
+ @ApiStatus.Experimental
|
||||
+ public java.util.@NotNull Set<java.util.UUID> getHiddenEntities(@NotNull Plugin plugin);
|
||||
+ // Parchment end
|
||||
+
|
||||
// Paper start
|
||||
/**
|
||||
* Checks to see if this player is currently flying or not.
|
||||
*
|
||||
* Returns whether the {@code other} player is listed for {@code this}.
|
||||
|
||||
@@ -5,128 +5,100 @@ 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 dd72a34eaa4bedd9ea0b92eaa79091b00eb4dd09..90f8f7a0996cf1a6f6b3e9eef0243b2d629a1214 100644
|
||||
index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..16198861748b29c537527151216e79c7c32e7204 100644
|
||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||
@@ -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;
|
||||
@@ -135,7 +137,24 @@ public final class Timings {
|
||||
@@ -145,8 +145,27 @@ 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 TimingsModifyEvent}, if cancelled the timings will not be reset
|
||||
+ * Calls a {@link co.aikar.timings.event.TimingsModifyEvent}, if cancelled the timings will not be reset
|
||||
+ *
|
||||
+ * @param enabled Should timings be reported
|
||||
+ * @param sender The sender asking to reset
|
||||
+ */
|
||||
+ public static void setTimingsEnabled(boolean enabled, CommandSender sender) {
|
||||
timingsEnabled = enabled;
|
||||
warnAboutDeprecationOnEnable();
|
||||
+ if (sender != null) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, Action.RESET).callEvent()) {
|
||||
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.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 3132dc98d26c54c5e46162e53aaed195d7335c8d..f44ec5789bc98d5558eee6cff39770b4192c3e3c 100644
|
||||
index e801e79fa57c44b2e5d359647c920f88064826f1..012d2281c386d2e5f5a655079c0cbfa4545d6476 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
@@ -59,12 +59,14 @@ public class TimingsCommand extends BukkitCommand {
|
||||
@@ -63,10 +63,12 @@ public class TimingsCommand extends BukkitCommand {
|
||||
}
|
||||
final String arg = args[0];
|
||||
if ("on".equalsIgnoreCase(arg)) {
|
||||
- Timings.setTimingsEnabled(true);
|
||||
- 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);
|
||||
+ }
|
||||
+ 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"));
|
||||
return true;
|
||||
} else if ("off".equalsIgnoreCase(arg)) {
|
||||
- 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);
|
||||
+ }
|
||||
+ 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"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,20 +77,22 @@ public class TimingsCommand extends BukkitCommand {
|
||||
@@ -79,15 +81,18 @@ public class TimingsCommand extends BukkitCommand {
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if ("verbon".equalsIgnoreCase(arg)) {
|
||||
- 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);
|
||||
+ }
|
||||
+ 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"));
|
||||
return true;
|
||||
} else if ("verboff".equalsIgnoreCase(arg)) {
|
||||
- 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);
|
||||
+ }
|
||||
+ 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"));
|
||||
return true;
|
||||
} else if ("reset".equalsIgnoreCase(arg)) {
|
||||
if (now - lastResetAttempt < 30000) {
|
||||
- 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();
|
||||
+ }
|
||||
+ 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));
|
||||
} 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 34f4c02c3bdbe571a7efb1f8c61d8924b0c81268..093c1bc755061dc6f54e5dce1ef68fd027fc43a6 100644
|
||||
index 3af5b8ea795311582044c712de50d29412024b77..806a1e528aae9a26413b483855130bef78ca72fb 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
@@ -58,7 +58,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
@@ -59,6 +59,7 @@ 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) {
|
||||
- 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);
|
||||
+ }
|
||||
+ if (!new co.aikar.timings.event.TimingsMessageEvent(this.senders, message).callEvent()) return; // Parchment
|
||||
net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -69,7 +71,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
@@ -70,6 +71,7 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String 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));
|
||||
+ }
|
||||
+ 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));
|
||||
}
|
||||
|
||||
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..df78c90859999ec18c7b8758e0f1c71281e1abe4
|
||||
index 0000000000000000000000000000000000000000..9ad67d72e6173d1629f862ca9fd13475950709f0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsEvent.java
|
||||
@@ -0,0 +1,34 @@
|
||||
@@ -0,0 +1,36 @@
|
||||
+package co.aikar.timings.event;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -135,19 +107,21 @@ index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c712
|
||||
+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 Set<CommandSender> audience;
|
||||
+ private final @NotNull Set<CommandSender> audience;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ public TimingsEvent(Set<CommandSender> audience) {
|
||||
+ public TimingsEvent(@NotNull Collection<CommandSender> audience) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.audience = audience;
|
||||
+ this.audience = new HashSet<>(audience);
|
||||
+ }
|
||||
+
|
||||
+ public Set<CommandSender> getAudience() {
|
||||
+ public @NotNull Set<CommandSender> getAudience() {
|
||||
+ return this.audience;
|
||||
+ }
|
||||
+
|
||||
@@ -156,62 +130,65 @@ index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c712
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ public static @NotNull 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..5ed7d1d4972842e93e2a9c2ffa799e6fc9136e63
|
||||
index 0000000000000000000000000000000000000000..33152129508c526031eee68f2ae797563d97be0c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java
|
||||
@@ -0,0 +1,19 @@
|
||||
@@ -0,0 +1,20 @@
|
||||
+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 String paste;
|
||||
+ private final @NotNull String paste;
|
||||
+
|
||||
+ public TimingsGenerateReportEvent(CommandSender sender, String paste) {
|
||||
+ public TimingsGenerateReportEvent(@NotNull CommandSender sender, @NotNull String paste) {
|
||||
+ super(Collections.singleton(sender));
|
||||
+ this.paste = paste;
|
||||
+ }
|
||||
+
|
||||
+ public String getPaste() {
|
||||
+ public @NotNull 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..04ec925cfa9e385e8ad4763b18570b7bf07c4007
|
||||
index 0000000000000000000000000000000000000000..626f25e164c6b23481c5a976a6e184e739104305
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java
|
||||
@@ -0,0 +1,33 @@
|
||||
@@ -0,0 +1,35 @@
|
||||
+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 Component message;
|
||||
+ public @NotNull Component message;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public TimingsMessageEvent(List<CommandSender> senders, Component message) {
|
||||
+ public TimingsMessageEvent(@NotNull Collection<CommandSender> senders, @NotNull Component message) {
|
||||
+ super(new HashSet<>(senders));
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ public Component getMessage() {
|
||||
+ public @NotNull Component getMessage() {
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
@@ -227,28 +204,29 @@ index 0000000000000000000000000000000000000000..04ec925cfa9e385e8ad4763b18570b7b
|
||||
+}
|
||||
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..1fe9bbedf23fdf7b02de02f5d184d8d956c7056b
|
||||
index 0000000000000000000000000000000000000000..3faf845716d5d3adf360949f28a5e12aa7e20aa6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,41 @@
|
||||
+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 Action action;
|
||||
+ private final @NotNull Action action;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public TimingsModifyEvent(CommandSender sender, Action action) {
|
||||
+ public TimingsModifyEvent(@NotNull CommandSender sender, @NotNull Action action) {
|
||||
+ super(Collections.singleton(sender));
|
||||
+ this.action = action;
|
||||
+ }
|
||||
+
|
||||
+ public Action getAction() {
|
||||
+ public @NotNull 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 7f4827819fc241866edb571f05e9b14d0955c0c4..1e7c5b991939e984d3448a5f9e0859857d04ce63 100644
|
||||
index e59cac883dc83186e0977a73b03636993696b37e..e4df334e6ceba43144114c1ad84cb5710b71030e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -52,6 +52,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -62,6 +62,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Override
|
||||
@NotNull Player getPlayer();
|
||||
|
||||
@@ -5,10 +5,10 @@ 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 4aa2d483b706fbf6ba0dc5126de74ee532e12382..8b17088739b126a1ecb86370d23cf49e499d30ea 100644
|
||||
index 4aaf268f58038cd5d4101ec3fbfdc20b544d6678..29aa9227a57b4ea458379402ccfce3334d9325d8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EntityType.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
@@ -287,6 +287,7 @@ public enum EntityType implements Keyed, net.kyori.adventure.translation.Transla
|
||||
@@ -303,6 +303,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
|
||||
*/
|
||||
LIGHTNING("lightning_bolt", LightningStrike.class, -1, false),
|
||||
PLAYER("player", Player.class, -1, false),
|
||||
|
||||
28
patches/api/0016-Revert-BungeeChat-Deprecation.patch
Normal file
28
patches/api/0016-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 fa4928487cca082a770a25f6f6490286ae397037..9901114fba1469c138bba1821cafd057fbafd4b1 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -35,7 +35,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.14") {
|
||||
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") { // Parchment - revert
|
||||
exclude("com.google.guava", "guava")
|
||||
}
|
||||
// Paper - adventure
|
||||
@@ -133,7 +133,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 // Parchment - revert
|
||||
// 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",
|
||||
73
patches/api/0017-Add-PreEntityShootBowEvent.patch
Normal file
73
patches/api/0017-Add-PreEntityShootBowEvent.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Thu, 16 Mar 2023 23:10:47 -0400
|
||||
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
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package gg.projecteden.parchment.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class PreEntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final @NotNull ItemStack bow;
|
||||
+ private final @NotNull ItemStack arrow;
|
||||
+ boolean relative = true;
|
||||
+ boolean cancelled = false;
|
||||
+
|
||||
+ public PreEntityShootBowEvent(@NotNull Entity entity, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
|
||||
+ super(entity);
|
||||
+ this.bow = bow;
|
||||
+ this.arrow = arrow;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ItemStack getBow() {
|
||||
+ return this.bow;
|
||||
+ }
|
||||
+
|
||||
+ public @NotNull ItemStack getArrow() {
|
||||
+ return this.arrow;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isRelative() {
|
||||
+ return this.relative;
|
||||
+ }
|
||||
+
|
||||
+ public void setRelative(boolean relative) {
|
||||
+ this.relative = relative;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
31
patches/api/0018-Add-Block-BreakNaturally-Overload.patch
Normal file
31
patches/api/0018-Add-Block-BreakNaturally-Overload.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
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
|
||||
18
patches/api/0019-Temporarily-remove-Javadoc-jar.patch
Normal file
18
patches/api/0019-Temporarily-remove-Javadoc-jar.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Fri, 15 Dec 2023 23:46:17 -0500
|
||||
Subject: [PATCH] Temporarily remove Javadoc jar
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 9901114fba1469c138bba1821cafd057fbafd4b1..7b2266d0033a43a195e344f816c2a65bd2877db4 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -6,7 +6,6 @@ plugins {
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
- withJavadocJar()
|
||||
}
|
||||
|
||||
val annotationsVersion = "24.0.1"
|
||||
70
patches/api/0020-Add-CustomBlockUpdateEvent.patch
Normal file
70
patches/api/0020-Add-CustomBlockUpdateEvent.patch
Normal file
@@ -0,0 +1,70 @@
|
||||
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..620e091669dca44001f834ee66cf3b9681e998ce
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+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.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;
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum UpdateType {
|
||||
+ POWERED,
|
||||
+ SHAPE,
|
||||
+ INSTRUMENT,
|
||||
+ PITCH
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
273
patches/api/0021-Entity-Data-Storage.patch
Normal file
273
patches/api/0021-Entity-Data-Storage.patch
Normal file
@@ -0,0 +1,273 @@
|
||||
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/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 65d2b0e87feec296b9f20a6de2d2266493cd1e7b..283fa192456de9e643ed6b87ace05135e9cb7713 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1107,4 +1107,7 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ gg.projecteden.parchment.entity.EntityData getStoredEntityData();
|
||||
+
|
||||
}
|
||||
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;
|
||||
+ }
|
||||
+}
|
||||
361
patches/api/0022-Add-Sidebar-Utility.patch
Normal file
361
patches/api/0022-Add-Sidebar-Utility.patch
Normal file
@@ -0,0 +1,361 @@
|
||||
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..f3f7a138d8d0a0e5f863f50fa39ffd861a8a1db9
|
||||
--- /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..c4a58a2b4e8bf5d3130b7da71616f06b6ed98e8f
|
||||
--- /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,10 +5,10 @@ Subject: [PATCH] Expose NMS ordinals
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 9fdcb933788cb78306dc066b3bf6ed01a6316cd3..606ae769ea443853c0d236f5bac5429467190778 100644
|
||||
index 3ed52d016314c01293530fa760fa5faaf59586ed..f93672ebb76664c5a71030b72966c6b13e107246 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -283,5 +283,12 @@ public interface UnsafeValues {
|
||||
@@ -257,5 +257,12 @@ public interface UnsafeValues {
|
||||
* @return if the item can be placed
|
||||
*/
|
||||
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);
|
||||
@@ -5,28 +5,29 @@ Subject: [PATCH] Expose EntityType Ordinals
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 72516335570d7137a62ec8667a6e8f06f024692f..30c79796359c8f2fd4f04afdb863047ba95112a9 100644
|
||||
index ceacc0d383e2ee674783d3c0a7df0a951595faca..72b5ce4c93c021ca2f3f1d65b45fdd8cd50d71f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -154,6 +154,8 @@ import org.slf4j.Logger;
|
||||
@@ -162,6 +162,8 @@ import org.slf4j.Logger;
|
||||
|
||||
public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
public class EntityType<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
|
||||
|
||||
+ private static int ordinal = 0; // Parchment
|
||||
+ private static final java.util.Map<EntityType, Integer> ordinals = new java.util.HashMap<>(); // Parchment
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ENTITY_TAG = "EntityTag";
|
||||
private final Holder.Reference<EntityType<?>> builtInRegistryHolder;
|
||||
@@ -294,9 +296,31 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
private final EntityDimensions dimensions;
|
||||
@@ -310,9 +312,32 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
|
||||
private static <T extends Entity> EntityType<T> register(String id, EntityType.Builder type) { // CraftBukkit - decompile error
|
||||
- return (EntityType) Registry.register(Registry.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
|
||||
- return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
|
||||
+ // return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
|
||||
+ // Parchment start
|
||||
+ EntityType build = type.build(id);
|
||||
+ ordinals.put(build, ordinal);
|
||||
+ ordinal += 1;
|
||||
+ return (EntityType) Registry.register(Registry.ENTITY_TYPE, id, (EntityType<T>) build);
|
||||
+ return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) build);
|
||||
}
|
||||
|
||||
+ public int ordinal() {
|
||||
@@ -38,23 +39,23 @@ index 72516335570d7137a62ec8667a6e8f06f024692f..30c79796359c8f2fd4f04afdb863047b
|
||||
+ if (this == o) return true;
|
||||
+ if (o == null || getClass() != o.getClass()) return false;
|
||||
+ EntityType<?> that = (EntityType<?>) o;
|
||||
+ return id.equals(that.id);
|
||||
+ return this.builtInRegistryHolder.key().toString().equals(that.builtInRegistryHolder.key().toString());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return java.util.Objects.hash(id);
|
||||
+ return java.util.Objects.hash(this.builtInRegistryHolder.key().toString());
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
public static ResourceLocation getKey(EntityType<?> type) {
|
||||
return Registry.ENTITY_TYPE.getKey(type);
|
||||
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 4743d462ce712e312decdb40fdfdfe6b71468b94..776911b43156bf297b96fb3cc334383197559ae2 100644
|
||||
index be2739875ba1ba1a973c4a45c7e6a6996f0daf31..a6eab579c0f4cc6039bdd9914dd770c796b75d3c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -671,6 +671,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -665,6 +665,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
final net.minecraft.world.item.context.BlockPlaceContext ctx = context;
|
||||
return future.completeAsync(() -> blockItem.canPlace(ctx, blockState), io.papermc.paper.util.MCUtil.MAIN_EXECUTOR);
|
||||
}
|
||||
@@ -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 92b56f16b4d8107ccf206be6b81a98dc58986c10..0882d7271c51d79c4d089ec643d633bb0a81ef07 100644
|
||||
index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..fe48cb0fbf3b510b365bed06d84c0c62edd1ad19 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -96,6 +96,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -133,6 +133,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
|
||||
private void setProfile(GameProfile profile) {
|
||||
this.profile = profile;
|
||||
@@ -21,7 +21,7 @@ index 92b56f16b4d8107ccf206be6b81a98dc58986c10..0882d7271c51d79c4d089ec643d633bb
|
||||
this.serializedProfile = (profile == null) ? null : NbtUtils.writeGameProfile(new CompoundTag(), profile);
|
||||
}
|
||||
|
||||
@@ -104,6 +109,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -141,6 +146,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
super.applyToItem(tag);
|
||||
|
||||
if (this.profile != null) {
|
||||
@@ -29,12 +29,12 @@ index 92b56f16b4d8107ccf206be6b81a98dc58986c10..0882d7271c51d79c4d089ec643d633bb
|
||||
// SPIGOT-6558: Set initial textures
|
||||
tag.put(SKULL_OWNER.NBT, serializedProfile);
|
||||
// Fill in textures
|
||||
@@ -243,6 +249,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
@@ -303,6 +309,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
if (meta instanceof CraftMetaSkull) {
|
||||
CraftMetaSkull that = (CraftMetaSkull) meta;
|
||||
|
||||
+ refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
|
||||
+ that.refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
|
||||
// SPIGOT-5403: equals does not check properties
|
||||
return (this.profile != null ? that.profile != null && this.serializedProfile.equals(that.serializedProfile) : that.profile == null);
|
||||
return (this.profile != null ? that.profile != null && this.serializedProfile.equals(that.serializedProfile) : that.profile == null) && Objects.equals(this.noteBlockSound, that.noteBlockSound);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Sun, 19 Mar 2023 17:32:26 -0400
|
||||
Subject: [PATCH] Lookup plugin dependencies during runtime
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
|
||||
index bfa258faf17ca6118aeddfa4e95bbd082bcd1390..c106c26ccd673e46c5ae9415096923b66efd8af2 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
|
||||
@@ -2,6 +2,7 @@ package io.papermc.paper.plugin.entrypoint.dependency;
|
||||
|
||||
import com.google.common.graph.MutableGraph;
|
||||
import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import io.papermc.paper.plugin.manager.PaperPluginManagerImpl;
|
||||
import io.papermc.paper.plugin.provider.PluginProvider;
|
||||
import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
@@ -65,7 +66,7 @@ public class DependencyUtil {
|
||||
public static List<String> validateSimple(PluginMeta meta, Map<String, PluginProvider<?>> toLoad) {
|
||||
List<String> missingDependencies = new ArrayList<>();
|
||||
for (String hardDependency : meta.getPluginDependencies()) {
|
||||
- if (!toLoad.containsKey(hardDependency)) {
|
||||
+ if (!toLoad.containsKey(hardDependency) && !PaperPluginManagerImpl.getInstance().isPluginEnabled(hardDependency)) {
|
||||
missingDependencies.add(hardDependency);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,11 +4,28 @@ 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 245f09b771fb1e8fab3bc4c03b1afe34ef505f1b..8dbef407de5c48543ca7f97d8c22301aa54da7d8 100644
|
||||
--- a/src/main/java/net/minecraft/core/Holder.java
|
||||
+++ b/src/main/java/net/minecraft/core/Holder.java
|
||||
@@ -126,6 +126,12 @@ public interface Holder<T> {
|
||||
return new Holder.Reference<>(Holder.Reference.Type.INTRUSIVE, owner, (ResourceKey<T>)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 8f3b9b8784f0d7b137a1ad87655ee8bad801b59d..5153ae98bd80697a0e8bc71e5484c1f4f2817fe2 100644
|
||||
index efdf56044396b4ce486948d2c993971f99174a5e..4238b65cc86b0c49a34b50c4dac00cd89e3900e1 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -205,7 +205,7 @@ public class BlockItem extends Item {
|
||||
@@ -206,7 +206,7 @@ public class BlockItem extends Item {
|
||||
}).orElse(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ Date: Sat, 19 Jun 2021 16:30:39 -0400
|
||||
Subject: [PATCH] Add SoundEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/event/sound/ParchmentSoundEvent.java b/src/main/java/gg/projecteden/parchment/event/sound/ParchmentSoundEvent.java
|
||||
diff --git a/src/main/java/gg/projecteden/gg/parchment/event/sound/ParchmentSoundEvent.java b/src/main/java/gg/projecteden/gg/parchment/event/sound/ParchmentSoundEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..44245b61f64e4e2eb21ac4f5e540aa9a583bfcfe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/event/sound/ParchmentSoundEvent.java
|
||||
+++ b/src/main/java/gg/projecteden/gg/parchment/event/sound/ParchmentSoundEvent.java
|
||||
@@ -0,0 +1,28 @@
|
||||
+package gg.projecteden.parchment.event.sound;
|
||||
+
|
||||
@@ -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 01e424792f68bac73ec41726031ebbb53df13da7..7fa767185dcc73daa4500b6c66761ea4a19c34b5 100644
|
||||
index 99871023c54e387c6ef72a4307d945047aee87fe..4ce043faf03caf8858a86876b9125e274eb75c43 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -325,6 +325,32 @@ public final class PaperAdventure {
|
||||
@@ -344,6 +344,41 @@ public final class PaperAdventure {
|
||||
return asVanilla(source);
|
||||
}
|
||||
|
||||
@@ -62,8 +62,16 @@ index 01e424792f68bac73ec41726031ebbb53df13da7..7fa767185dcc73daa4500b6c66761ea4
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static java.util.Optional<net.minecraft.sounds.SoundEvent> asVanillaSound(final Key key) {
|
||||
+ return net.minecraft.core.Registry.SOUND_EVENT.getOptional(asVanilla(key));
|
||||
+ 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)));
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("PatternValidation")
|
||||
@@ -72,29 +80,33 @@ index 01e424792f68bac73ec41726031ebbb53df13da7..7fa767185dcc73daa4500b6c66761ea4
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
// NBT
|
||||
|
||||
public static @Nullable BinaryTagHolder asBinaryTagHolder(final @Nullable CompoundTag tag) {
|
||||
+
|
||||
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 79aa3374fd47cd57d2e0810bb5afebbdb38a1892..f4c9ff697bc86e1410e916df19c4eccf05c8af71 100644
|
||||
index b78a9628a88f2a495ef6de74446a02a14d41a1f6..abd5300282563a804290eb2e9333e59a0e8ac708 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1575,12 +1575,40 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1811,12 +1811,46 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@Override
|
||||
public void playSeededSound(@Nullable Player except, double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
- this.server.getPlayerList().broadcast(except, x, y, z, (double) sound.getRange(volume), this.dimension(), new ClientboundSoundPacket(sound, category, x, y, z, volume, pitch, seed));
|
||||
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));
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ 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
|
||||
+ ),
|
||||
+ 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(),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(this, x, y, z),
|
||||
+ seed,
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
|
||||
+ null
|
||||
+ ));
|
||||
@@ -102,19 +114,22 @@ index 79aa3374fd47cd57d2e0810bb5afebbdb38a1892..f4c9ff697bc86e1410e916df19c4eccf
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSeededSound(@Nullable Player except, Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) {
|
||||
- this.server.getPlayerList().broadcast(except, entity.getX(), entity.getY(), entity.getZ(), (double) sound.getRange(volume), this.dimension(), new ClientboundSoundEntityPacket(sound, category, entity, volume, pitch, seed));
|
||||
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));
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ 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
|
||||
+ ),
|
||||
+ 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(),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(entity),
|
||||
+ seed,
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
|
||||
+ null
|
||||
+ ));
|
||||
@@ -123,63 +138,64 @@ index 79aa3374fd47cd57d2e0810bb5afebbdb38a1892..f4c9ff697bc86e1410e916df19c4eccf
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 9c9b4d7e0637348a94befce9377fdb69c1239694..69b3524ebb197430e90a3519b8165e472e1cf823 100644
|
||||
index 8efbbd379244e3ed54d4aba199037cc20ccd096a..823bc659f7421c3752e4cf1333e1568e1308464d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2250,7 +2250,19 @@ public class ServerPlayer extends Player {
|
||||
@@ -2435,7 +2435,20 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void playNotifySound(SoundEvent event, SoundSource category, float volume, float pitch) {
|
||||
- this.connection.send(new ClientboundSoundPacket(event, category, this.getX(), this.getY(), this.getZ(), volume, pitch, this.random.nextLong()));
|
||||
- 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(
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(event.getLocation()),
|
||||
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category),
|
||||
+ volume,
|
||||
+ pitch
|
||||
+ ),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(level, getX(), getY(), getZ()),
|
||||
+ this.random.nextLong(), sound -> 0d, soundEvent -> java.util.Collections.singletonList(getBukkitEntity())
|
||||
+ net.kyori.adventure.sound.Sound.sound()
|
||||
+ .type(io.papermc.paper.adventure.PaperAdventure.asAdventure(event.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())
|
||||
+ ));
|
||||
+ // 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 3be9352ae9b0b84acf07064b45562ceffd30391b..b0dd96bb3af3ec7157c62c515ac09d8364eef9f5 100644
|
||||
index a35638a92479b90afa89cf201fc45b49c9e767f3..70aa55d04875338b92d29faba18aee08a926e518 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -984,7 +984,7 @@ public abstract class PlayerList {
|
||||
if (flag2 && !isLocAltered) {
|
||||
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);
|
||||
@@ -968,7 +968,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, SoundSource.BLOCKS, 1.0F, 1.0F); // Parchment - use existing play sound method
|
||||
+ entityplayer1.playNotifySound(SoundEvents.RESPAWN_ANCHOR_DEPLETE.value(), SoundSource.BLOCKS, 1.0F, 1.0F); // Parchment - use existing play sound method
|
||||
// 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 0ea101f155936f7c340d9e1d1077c58b72551027..baa4aa10f40de237d44aa1e692657d2a36eb7a66 100644
|
||||
index 7f3466340891b4409d1399ebeb2ca865d77841cd..f459202c3a79128df936be4a1a2cd51bbc9143b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1917,7 +1917,21 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1839,7 +1839,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
|
||||
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) {
|
||||
- ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
- ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
+ // Parchment start - sound event
|
||||
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
|
||||
+ null,
|
||||
+ 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(),
|
||||
+ 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(),
|
||||
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(fromEntity.level(), x, y, z),
|
||||
+ sound -> 0d,
|
||||
+ soundEvent -> java.util.Collections.singletonList(((ServerPlayer) fromEntity).getBukkitEntity())
|
||||
+ ));
|
||||
@@ -188,73 +204,46 @@ index 0ea101f155936f7c340d9e1d1077c58b72551027..baa4aa10f40de237d44aa1e692657d2a
|
||||
}
|
||||
// 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 6a0a1731fd6804eb69d3641213712d31bce085b2..81819d12e0becde85b6d66f3b3ffedde847a72f6 100644
|
||||
index eaa2943b667967f93f28d9d794d702fdaeb670ec..df03f4867742cd194db260dfb81398b14286397e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -526,7 +526,7 @@ public class Raid {
|
||||
float f = 13.0F;
|
||||
boolean flag = true;
|
||||
Collection<ServerPlayer> collection = this.raidEvent.getPlayers();
|
||||
- long i = this.random.nextLong();
|
||||
+ //long i = this.random.nextLong(); // Parchment - remove redundant variable
|
||||
Iterator iterator = this.level.players().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -538,7 +538,7 @@ public class Raid {
|
||||
@@ -542,7 +542,7 @@ public class Raid {
|
||||
double d2 = vec3d.z + 13.0D / d0 * (vec3d1.z - vec3d.z);
|
||||
|
||||
if (d0 <= 64.0D || collection.contains(entityplayer)) {
|
||||
- entityplayer.connection.send(new ClientboundSoundPacket(SoundEvents.RAID_HORN, SoundSource.NEUTRAL, d1, entityplayer.getY(), d2, 64.0F, 1.0F, i));
|
||||
+ entityplayer.playNotifySound(SoundEvents.RAID_HORN, SoundSource.NEUTRAL, 64.0F, 1.0F); // Parchment - use existing play sound method
|
||||
+ entityplayer.playNotifySound(SoundEvents.RAID_HORN.value(), SoundSource.NEUTRAL, 64.0F, 1.0F); // Parchment - use existing play sound method
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 03b3f29bde2bf6cb4e7b08a775bcc380a9404543..a37bc950d24acee9889aded042ed2bc3a0d76929 100644
|
||||
index f5a5ae30dfba21d5cf3990c046cfe41547e8a87a..dfd54e3f9016635c986afdb613c94be9bec91237 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.event;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
-import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
@@ -1921,4 +1920,52 @@ public class CraftEventFactory {
|
||||
return event.callEvent();
|
||||
@@ -2177,4 +2177,42 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
// Paper end
|
||||
// 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 = 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(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(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 {
|
||||
+ // 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);
|
||||
+ 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);
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Unknown emitter type: " + emitter.getClass().getName());
|
||||
+ }
|
||||
+
|
||||
+ public static void playSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event) {
|
||||
|
||||
@@ -5,22 +5,21 @@ 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 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c22e3f515 100644
|
||||
index 797ece59c10bdb60a86f71ca3b7bb95dbe0f1078..e560312bacc25ef3c2f26122fa68228bdf9e42a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -51,23 +51,48 @@ public class RespawnAnchorBlock extends Block {
|
||||
@Override
|
||||
@@ -65,23 +65,45 @@ public class RespawnAnchorBlock extends Block {
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getItemInHand(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 (hand == InteractionHand.MAIN_HAND && !isRespawnFuel(itemStack) && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) {
|
||||
if (hand == InteractionHand.MAIN_HAND && !RespawnAnchorBlock.isRespawnFuel(itemstack) && RespawnAnchorBlock.isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) {
|
||||
return InteractionResult.PASS;
|
||||
} else if (isRespawnFuel(itemStack) && canBeCharged(state)) {
|
||||
} else if (RespawnAnchorBlock.isRespawnFuel(itemstack) && RespawnAnchorBlock.canBeCharged(state)) {
|
||||
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
||||
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE;
|
||||
+ } else if (state.getValue(CHARGE) == 0) {
|
||||
@@ -32,26 +31,24 @@ index 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c
|
||||
+ } else {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ if (bukkitPlayer != null) {
|
||||
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent event = new gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent(bukkitPlayer, block, result);
|
||||
+ event.callEvent();
|
||||
+ result = event.getResult();
|
||||
+ }
|
||||
+
|
||||
+ if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE) {
|
||||
+ // Parchment end
|
||||
charge(world, pos, state);
|
||||
RespawnAnchorBlock.charge(player, world, pos, state);
|
||||
if (!player.getAbilities().instabuild) {
|
||||
itemStack.shrink(1);
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
- } else if (state.getValue(CHARGE) == 0) {
|
||||
- } else if ((Integer) state.getValue(RespawnAnchorBlock.CHARGE) == 0) {
|
||||
- return InteractionResult.PASS;
|
||||
- } else if (!canSetSpawn(world)) {
|
||||
- } else if (!RespawnAnchorBlock.canSetSpawn(world)) {
|
||||
- if (!world.isClientSide) {
|
||||
- this.explode(state, world, pos);
|
||||
- }
|
||||
@@ -64,12 +61,4 @@ index 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c
|
||||
+ // Parchment end
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
ServerPlayer serverPlayer = (ServerPlayer)player;
|
||||
@@ -82,7 +107,6 @@ public class RespawnAnchorBlock extends Block {
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
-
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) player;
|
||||
|
||||
@@ -4,180 +4,34 @@ Date: Fri, 18 Jun 2021 14:04:39 -0400
|
||||
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java b/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
|
||||
index 968c915cc494bb3c57169b7b3640002c3a4a8810..0c2b2cb4be57b11d748d13a0ec24b7470619267f 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
|
||||
@@ -7,12 +7,20 @@ import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
public class BadRespawnPointDamage extends DamageSource {
|
||||
+ @Deprecated // Parchment
|
||||
protected BadRespawnPointDamage() {
|
||||
super("badRespawnPoint");
|
||||
this.setScalesWithDifficulty();
|
||||
this.setExplosion();
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ protected BadRespawnPointDamage(org.bukkit.Location location) {
|
||||
+ this();
|
||||
+ location(location);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
@Override
|
||||
public Component getLocalizedDeathMessage(LivingEntity entity) {
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable("death.attack.badRespawnPoint.link")).withStyle((style) -> {
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
index 67bce77093dcc126098731047447da2031e3388d..051cf78fe9f7700e1f639c804f35903c8079eae9 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -77,6 +77,18 @@ public class DamageSource {
|
||||
return this;
|
||||
}
|
||||
// Paper end
|
||||
+ // Parchment start
|
||||
+ private @Nullable org.bukkit.Location location;
|
||||
+
|
||||
+ public @Nullable org.bukkit.Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+
|
||||
+ public DamageSource location(@Nullable org.bukkit.Location location) {
|
||||
+ this.location = location;
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
|
||||
public static DamageSource sting(LivingEntity attacker) {
|
||||
return new EntityDamageSource("sting", attacker);
|
||||
@@ -127,7 +139,7 @@ public class DamageSource {
|
||||
}
|
||||
|
||||
public static DamageSource explosion(@Nullable Explosion explosion) {
|
||||
- return DamageSource.explosion(explosion != null ? explosion.getSourceMob() : null);
|
||||
+ return DamageSource.explosion(explosion != null ? explosion.getSourceMob() : null).location(explosion != null ? explosion.getBukkitLocation() : null); // Parchment
|
||||
}
|
||||
|
||||
public static DamageSource explosion(@Nullable LivingEntity attacker) {
|
||||
@@ -138,10 +150,17 @@ public class DamageSource {
|
||||
return (new EntityDamageSource("sonic_boom", attacker)).bypassArmor().bypassEnchantments().setMagic();
|
||||
}
|
||||
|
||||
+ @Deprecated // Parchment
|
||||
public static DamageSource badRespawnPointExplosion() {
|
||||
return new BadRespawnPointDamage();
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ public static DamageSource badRespawnPointExplosion(org.bukkit.Location location) {
|
||||
+ return new BadRespawnPointDamage(location);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
public String toString() {
|
||||
return "DamageSource (" + this.msgId + ")";
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index b786bd5178a605a5dfb7682b7cb809646895aea3..d986103d2d20be4514ce91fe27e42d0f7f1ca72b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -98,7 +98,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
private final Node[] nodes = new Node[24];
|
||||
private final int[] nodeAdjacency = new int[24];
|
||||
private final BinaryHeap openSet = new BinaryHeap();
|
||||
- private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
+ private Explosion explosionSource;// = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() // Parchment - moved into constructor to fix null world
|
||||
// Paper start - add var for save custom podium
|
||||
@Nullable
|
||||
private BlockPos podium;
|
||||
@@ -106,6 +106,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
|
||||
public EnderDragon(EntityType<? extends EnderDragon> entitytypes, Level world) {
|
||||
super(EntityType.ENDER_DRAGON, world);
|
||||
+ explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // Parchment - fix null world
|
||||
this.subEntities = new EnderDragonPart[]{this.head, this.neck, this.body, this.tail1, this.tail2, this.tail3, this.wing1, this.wing2};
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.noPhysics = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 31708d1e94b557896d42199aa0bc6ed26a4c6d8a..786d43a991b94a355d8f52e81f5aa41cc11cfcb1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -477,6 +477,13 @@ public class Explosion {
|
||||
return this.toBlow;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ public @Nullable Location getBukkitLocation() {
|
||||
+ if (this.level == null) return null;
|
||||
+ return new Location(level.getWorld(), x, y, z);
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
public static enum BlockInteraction {
|
||||
|
||||
NONE, BREAK, DESTROY;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
index 654a859a37bf991c7a7fa8a44a3d20f8feb223db..52e6c9ea22273759ea9a827125bf561a62272ad9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -145,7 +145,10 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
world.removeBlock(blockposition1, false);
|
||||
}
|
||||
|
||||
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ // Parchment start
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D);
|
||||
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(location), (ExplosionDamageCalculator) null, location.getX(), location.getY(), location.getZ(), 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ // Parchment end
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
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 6be6adf73dc48ebbac22fe2a9be635f675f18cb1..e814c791137da2a10f4d4dd65f201fc220399975 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -148,7 +148,10 @@ public class RespawnAnchorBlock extends Block {
|
||||
return pos.equals(explodedPos) && bl2 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
|
||||
}
|
||||
};
|
||||
- world.explode((Entity)null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double)explodedPos.getX() + 0.5D, (double)explodedPos.getY() + 0.5D, (double)explodedPos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ // Parchment start
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), explodedPos.getX() + 0.5D, explodedPos.getY() + 0.5D, explodedPos.getZ() + 0.5D);
|
||||
+ world.explode((Entity)null, DamageSource.badRespawnPointExplosion(location), explosionDamageCalculator, location.getX(), location.getY(), location.getZ(), 5.0F, true, Explosion.BlockInteraction.DESTROY);
|
||||
+ // Parchment end
|
||||
}
|
||||
|
||||
public static boolean canSetSpawn(Level world) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index a37bc950d24acee9889aded042ed2bc3a0d76929..e9847ba8dde5b9efb5214973f1399460ddcf930f 100644
|
||||
index dfd54e3f9016635c986afdb613c94be9bec91237..c7056a714cecb4c2190bc5e85bf4ac3812640f6c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -970,7 +970,7 @@ public class CraftEventFactory {
|
||||
@@ -1063,7 +1063,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.getLocation(), modifiers, modifierFunctions); // Parchment - add location
|
||||
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState); // Paper - handle block state in damage
|
||||
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState, source.getEntity().getBukkitEntity().getLocation()); // Paper - handle block state in damage
|
||||
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
||||
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
||||
} else {
|
||||
@@ -1010,7 +1010,7 @@ public class CraftEventFactory {
|
||||
@@ -1111,7 +1111,7 @@ public class CraftEventFactory {
|
||||
|
||||
return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
|
||||
} else if (source == DamageSource.OUT_OF_WORLD) {
|
||||
} 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); // Parchment - add location
|
||||
+ EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions, null, entity.getBukkitEntity().getLocation());
|
||||
event.setCancelled(cancelled);
|
||||
CraftEventFactory.callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
@@ -1020,7 +1020,7 @@ public class CraftEventFactory {
|
||||
@@ -1121,7 +1121,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
return event;
|
||||
} else if (source == DamageSource.LAVA) {
|
||||
} 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, entity.getBukkitEntity().getLocation().toBlockLocation(), modifiers, modifierFunctions)); // Parchment - add location
|
||||
+ EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions, null, blockDamage.getLocation()));
|
||||
event.setCancelled(cancelled);
|
||||
|
||||
Block damager = CraftEventFactory.blockDamage;
|
||||
|
||||
@@ -5,10 +5,10 @@ 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 103ab25119bfcdd21eac7e1deeac025108e3c138..4743d462ce712e312decdb40fdfdfe6b71468b94 100644
|
||||
index ec2396f0e5d62b10450eaa7239a8c5479638b3c3..ad1cc677ed7f04c9b6629050e1900e85299bac67 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -624,6 +624,55 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -642,6 +642,55 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -5,19 +5,19 @@ 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 baa4aa10f40de237d44aa1e692657d2a36eb7a66..ce0b0a1fd49afcb3c88b26bd6b361c735cab0b09 100644
|
||||
index f459202c3a79128df936be4a1a2cd51bbc9143b8..31f533ae280f147cbc183430a6209beedf4e96b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1521,6 +1521,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1511,6 +1511,12 @@ public abstract class Player extends LivingEntity {
|
||||
return this.gameProfile;
|
||||
}
|
||||
|
||||
+ // Parchment start | TODO: rename to match getter
|
||||
+ // Parchment start
|
||||
+ public void setProfile(GameProfile gameProfile) {
|
||||
+ this.gameProfile = gameProfile;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
@Nullable
|
||||
public ProfilePublicKey getProfilePublicKey() {
|
||||
return this.profilePublicKey;
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
@@ -5,10 +5,10 @@ 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 53e4a8db9ff5619982dfb059de9e431dbe2edc57..e8da5c60be1aabfb4047177db0a15952af59325e 100644
|
||||
index f8925b5f581fac113de89b9fca24d35e39a6fa3d..7aa1ee8ec0ddcbac85102c67394c757a438f95e9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2911,4 +2911,16 @@ public final class CraftServer implements Server {
|
||||
@@ -3228,4 +3228,16 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
// Paper end
|
||||
@@ -8,19 +8,10 @@ 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 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..cdeecf0032db60385db19d6a6607da792f532a79 100644
|
||||
index 4d50dd92a7f3187ee1d8edb926e7c273c8156549..c4c27fb5b92833eca243e1ba718c8dcaa676a310 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -308,7 +308,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
ServerLevel worldserver = lootContext.getLevel();
|
||||
BlockPos blockposition = new BlockPos((Vec3) lootContext.getParameter(LootContextParams.ORIGIN));
|
||||
|
||||
- state.getDrops(lootContext).forEach((itemstack) -> {
|
||||
+ 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);
|
||||
@@ -316,7 +316,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -309,7 +309,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos) {
|
||||
if (world instanceof ServerLevel) {
|
||||
@@ -29,7 +20,7 @@ index 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..cdeecf0032db60385db19d6a6607da79
|
||||
Block.popResource(world, pos, itemstack);
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
@@ -326,7 +326,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -319,7 +319,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) {
|
||||
@@ -38,20 +29,20 @@ index 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..cdeecf0032db60385db19d6a6607da79
|
||||
Block.popResource((ServerLevel) world, pos, itemstack);
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
@@ -353,7 +353,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -346,7 +346,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
|
||||
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, stack).forEach((itemstack1) -> {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack)).forEach((itemstack1) -> { // Parchment
|
||||
- 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, stack, true);
|
||||
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 e9847ba8dde5b9efb5214973f1399460ddcf930f..13e30a3ad79df17c180ba95ab9f41eb39f93e726 100644
|
||||
index c7056a714cecb4c2190bc5e85bf4ac3812640f6c..6c1f74e3dbbf421e6ff496aee58297e6a9d36308 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1967,5 +1967,19 @@ public class CraftEventFactory {
|
||||
@@ -2214,5 +2214,19 @@ public class CraftEventFactory {
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -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 72ed25022d5ea1074304be3c72b23882b8f0f88a..22457dfb3c4a2489f79e2f977f415d2938db0d27 100644
|
||||
index e1fad381b861471a17529c246bb8a4a9c7646420..3a0fa7f7085607f44a52095c29647f6fbe641764 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2376,4 +2376,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2505,4 +2505,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return this.adventure$pointers;
|
||||
}
|
||||
// Paper end
|
||||
@@ -226,7 +226,7 @@ index 72ed25022d5ea1074304be3c72b23882b8f0f88a..22457dfb3c4a2489f79e2f977f415d29
|
||||
+ // 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.getResultItem().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.value().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 f4c9ff697bc86e1410e916df19c4eccf05c8af71..4102e9345df8e1413a4efb13ac022dc4a092a715 100644
|
||||
index abd5300282563a804290eb2e9333e59a0e8ac708..bb6fcfe8c4fd42db3018b79853c11d598fac4b7b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -957,7 +957,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1173,7 +1173,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 5982dda61e07f1661b0a68d0ba1fcc1122e8d428..0008c021d17b3333a5d4cc6fa954b24ede487e3e 100644
|
||||
index 071d3877e386a0c7c4d2f2e8ddd06e0765c49d0d..aa47cd0274db73cefb5feb062be53f1cd66d48cf 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -255,6 +255,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -287,6 +287,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
}
|
||||
|
||||
public boolean disablePlayerCrits = false;
|
||||
@@ -17,15 +17,15 @@ index 5982dda61e07f1661b0a68d0ba1fcc1122e8d428..0008c021d17b3333a5d4cc6fa954b24e
|
||||
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 ce0b0a1fd49afcb3c88b26bd6b361c735cab0b09..cf41ff3be41b576123457bcb1e613378b6cce4de 100644
|
||||
index 31f533ae280f147cbc183430a6209beedf4e96b3..1016f8a15756756fa7e85878aa22dbab5ae74a55 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -294,7 +294,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -288,7 +288,7 @@ public abstract class Player extends LivingEntity {
|
||||
this.awardStat(Stats.CROUCH_TIME);
|
||||
}
|
||||
|
||||
- if (!this.isSleeping()) {
|
||||
+ if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment
|
||||
+ if (!this.isSleeping() && this.level().paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment
|
||||
this.awardStat(Stats.TIME_SINCE_REST);
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ 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 334a47b5e0d205c57dfcbb17168cbd3f21d15606..1ffc318c12cde935aea58d6d1efff53818893bf9 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
|
||||
@@ -41,6 +41,7 @@ public abstract class HangingEntity extends Entity {
|
||||
private int checkInterval; { this.checkInterval = this.getId() % this.level.spigotConfig.hangingTickFrequency; } // Paper
|
||||
private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper
|
||||
public BlockPos pos;
|
||||
protected Direction direction;
|
||||
+ public boolean tick = true; // Parchment
|
||||
@@ -20,18 +20,18 @@ index 334a47b5e0d205c57dfcbb17168cbd3f21d15606..1ffc318c12cde935aea58d6d1efff538
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
- if (!this.level.isClientSide) {
|
||||
+ if (tick && !this.level.isClientSide) { // Parchment
|
||||
this.checkOutOfWorld();
|
||||
if (this.checkInterval++ == this.level.spigotConfig.hangingTickFrequency) { // Spigot
|
||||
- if (!this.level().isClientSide) {
|
||||
+ if (tick && !this.level().isClientSide) { // Parchment
|
||||
this.checkBelowWorld();
|
||||
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 62e11bf104b8d39ac73883e2a5d207e5f7393253..639bd33ae91ed818bda29fed776adb8c169458d7 100644
|
||||
index cbdcf767c01e2c173913f56747d2dacbda2f0094..a74f783df0225223a2b2ae3dc632541ccf078893 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
|
||||
@@ -72,4 +72,16 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public EntityType getType() {
|
||||
return EntityType.UNKNOWN;
|
||||
@@ -66,4 +66,16 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public String toString() {
|
||||
return "CraftHanging";
|
||||
}
|
||||
+
|
||||
+ // Parchment start
|
||||
@@ -5,24 +5,24 @@ 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 a5220a4e514865c70700527bcd2f941d852564c0..0950b5f97b3382d1e41da9837e1e0b7cce6ba1b4 100644
|
||||
index fd84786f3e72875e79df46416f47f3403876cef3..c3d6e20a29ab392ce9c1be027fbf6c6e06720efe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1838,6 +1838,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
registerEntity(player);
|
||||
}
|
||||
@@ -2009,6 +2009,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
|
||||
}
|
||||
// Paper start
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public Set<UUID> getHiddenEntities(Plugin plugin) {
|
||||
+ return hiddenEntities.entrySet().stream()
|
||||
+ return invertedVisibilityEntities.entrySet().stream()
|
||||
+ .filter(entry -> entry.getValue().contains(CraftPlayer.getPluginWeakReference(plugin)))
|
||||
+ .map(Map.Entry::getKey)
|
||||
+ .collect(java.util.stream.Collectors.toSet());
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+ // Parchment end
|
||||
+
|
||||
@Override
|
||||
public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) {
|
||||
ServerPlayer self = getHandle();
|
||||
self.gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
||||
ServerPlayer self = this.getHandle();
|
||||
@@ -5,7 +5,7 @@ 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 f52487e1cfcfab1bf22ab2cb52f998283a86e340..9f8394d0348b068623b3acafe18b40a3ed0503d0 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
|
||||
@@ -67,7 +67,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -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 06bff37e4c1fddd3be6343049a66787c63fb420c..b6567f558cd25698208a06513c241646e0b28341 100644
|
||||
index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..88244a89ccf7ed33073e3795ef26a5ee4645e323 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -349,6 +349,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))));
|
||||
|
||||
53
patches/server/0017-Expanded-Insomnia-API.patch
Normal file
53
patches/server/0017-Expanded-Insomnia-API.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Sun, 24 Jul 2022 19:37:33 -0400
|
||||
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 c3d6e20a29ab392ce9c1be027fbf6c6e06720efe..0070b39c9b4e6414c83d1863095af7ed93b55fc7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -197,6 +197,8 @@ 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 boolean bypassesInsomnia = false; // Parchment - Insomnia api
|
||||
+
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
|
||||
@@ -3304,4 +3306,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.spigot;
|
||||
}
|
||||
// Spigot end
|
||||
+
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public boolean isInsomniac() {
|
||||
+ return net.minecraft.world.entity.EntitySelector.IS_INSOMNIAC.test(this.getHandle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBypassInsomnia(boolean val) {
|
||||
+ this.bypassesInsomnia = val;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesBypassInsomnia() {
|
||||
+ return this.bypassesInsomnia;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTimeSinceLastRest(int ticks) {
|
||||
+ this.getHandle().getStats().setValue(this.getHandle(), net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST), net.minecraft.util.Mth.clamp(ticks, 1, Integer.MAX_VALUE));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getTimeSinceLastRest() {
|
||||
+ 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
|
||||
+
|
||||
+
|
||||
}
|
||||
@@ -5,31 +5,26 @@ 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 d31a345edfffe39f127073fc3aec8b3489bae79c..65e3378860a20ebbbd7765ce7b83c97d01437d4b 100644
|
||||
index 30ccbab1586a656e0ae41d7406525fb02d9e025b..4a5c5a0f4e4bf1f256bcf518955403995e2368a7 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -875,16 +875,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -773,6 +773,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
|
||||
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
|
||||
// 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 - kick event cause
|
||||
@@ -783,6 +784,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper
|
||||
return;
|
||||
}
|
||||
+ } // Parchment - spam bypass
|
||||
// Paper end
|
||||
// CraftBukkit end
|
||||
// Paper start - Don't suggest if tab-complete is disabled
|
||||
@@ -2617,6 +2620,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2450,6 +2452,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
// Spigot start - spam exclusions
|
||||
private void detectRateSpam(String s) {
|
||||
@@ -37,16 +32,16 @@ index d31a345edfffe39f127073fc3aec8b3489bae79c..65e3378860a20ebbbd7765ce7b83c97d
|
||||
// CraftBukkit start - replaced with thread safe throttle
|
||||
boolean counted = true;
|
||||
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
|
||||
@@ -3396,10 +3400,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3199,10 +3202,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
||||
// Paper start
|
||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
|
||||
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
|
||||
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
|
||||
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.getLevel());
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@@ -5,21 +5,18 @@ 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 69b3524ebb197430e90a3519b8165e472e1cf823..1f6e7d43885c65d2b083190a2c088d71f2b78617 100644
|
||||
index 823bc659f7421c3752e4cf1333e1568e1308464d..b7cdefdbbdba46fdd9f39275474be356c2af8b40 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2200,10 +2200,10 @@ public class ServerPlayer extends Player {
|
||||
angle = (float) event.getLocation().getYaw();
|
||||
@@ -2399,9 +2399,11 @@ public class ServerPlayer extends Player {
|
||||
forced = event.isForced();
|
||||
// Paper end
|
||||
-
|
||||
- if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
|
||||
- this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
|
||||
- }
|
||||
+ // Parchment
|
||||
+// 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 */
|
||||
|
||||
this.respawnPosition = pos;
|
||||
this.respawnDimension = dimension;
|
||||
@@ -1,90 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Sun, 24 Jul 2022 19:37:33 -0400
|
||||
Subject: [PATCH] Expanded Insomnia API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
index 72abebff2018cde2922e97ad6478f93da9aed3ec..c541e80f7ab6772bdd4074f5df7075502b144a31 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
@@ -36,6 +36,12 @@ public final class EntitySelector {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ if (((org.bukkit.entity.Player) player.getBukkitEntity()).doesBypassInsomnia()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Parchment end
|
||||
+
|
||||
return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks;
|
||||
};
|
||||
// Paper end
|
||||
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 cf41ff3be41b576123457bcb1e613378b6cce4de..853deb219785787f78c6eecad6237893eba9f03f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -294,7 +294,7 @@ public abstract class Player extends LivingEntity {
|
||||
this.awardStat(Stats.CROUCH_TIME);
|
||||
}
|
||||
|
||||
- if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment
|
||||
+ if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep && !((org.bukkit.entity.Player) this.getBukkitEntity()).doesBypassInsomnia()) { // Parchment
|
||||
this.awardStat(Stats.TIME_SINCE_REST);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0950b5f97b3382d1e41da9837e1e0b7cce6ba1b4..b209c1b2e9a877af830c022756fd60c8c65ea8dd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -73,6 +73,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.UserWhiteListEntry;
|
||||
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;
|
||||
@@ -176,6 +177,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 end
|
||||
+ private boolean bypassesInsomnia = false;
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -1915,6 +1917,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // Parchment start
|
||||
+ @Override
|
||||
+ public boolean isInsomniac() {
|
||||
+ return EntitySelector.isInsomniac.test(this.getHandle());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBypassInsomnia(boolean val) {
|
||||
+ this.bypassesInsomnia = val;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesBypassInsomnia() {
|
||||
+ return this.bypassesInsomnia;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTimeSinceLastRest(int ticks) {
|
||||
+ this.getHandle().getStats().setValue(this.getHandle(), net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST), net.minecraft.util.Mth.clamp(ticks, 1, Integer.MAX_VALUE));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getTimeSinceLastRest() {
|
||||
+ 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;
|
||||
@@ -5,7 +5,7 @@ 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 450bd95218852174cfbc88d4517e17daee5ffd5f..794842cb3dfa0732ccecf625b97dbc6c311a8a18 100644
|
||||
index 463c6d8d5b114816ed9065558285945817c30385..d77fb29ea767fce5b8e00b76625188f19ecdbd24 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
@@ -24,6 +24,7 @@ import static net.kyori.adventure.text.format.NamedTextColor.BLUE;
|
||||
19
patches/server/0021-Remove-Hanging-Entity-Debug.patch
Normal file
19
patches/server/0021-Remove-Hanging-Entity-Debug.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Wed, 1 Mar 2023 22:02:23 -0500
|
||||
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
|
||||
--- 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 {
|
||||
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||
|
||||
if (!blockposition.closerThan(this.blockPosition(), 16.0D)) {
|
||||
- HangingEntity.LOGGER.error("Hanging entity at invalid position: {}", blockposition);
|
||||
+ //HangingEntity.LOGGER.error("Hanging entity at invalid position: {}", blockposition);
|
||||
} else {
|
||||
this.pos = blockposition;
|
||||
}
|
||||
149
patches/server/0022-Add-PreEntityShootBowEvent.patch
Normal file
149
patches/server/0022-Add-PreEntityShootBowEvent.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
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 b319021b22c5dceba6199ed27814b2dcf47b8d50..d12a49f9eb0110d4d889f15863ecb88c07a848b9 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 63fce7e3d9f59f36e29bc827a46396d73143bb8b..9762a79c928d7235a7868b37858474e1b1e0cf56 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,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
|
||||
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 42ebd91196ae420eee57f4380abc558555457163..593c9e840956efe0fcd723744eef389b01a140c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -136,8 +136,10 @@ 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);
|
||||
+ // 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 2f058cec80c6ef7a5a5ca065dc6c9fe353c521de..48f246351d75af18b72fe235b013de1c7290c8db 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -172,9 +172,17 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void shoot(double x, double y, double z, float speed, float divergence) {
|
||||
+ // Parchment start
|
||||
+ shoot(x, y, z, speed, divergence, true);
|
||||
+ }
|
||||
+
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
|
||||
+ // Parchment end
|
||||
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);
|
||||
|
||||
+ if (relative) { // Parchment
|
||||
this.setDeltaMovement(vec3d);
|
||||
+ } // Parchment
|
||||
double d3 = vec3d.horizontalDistance();
|
||||
|
||||
this.setYRot((float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D));
|
||||
@@ -184,6 +192,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);
|
||||
@@ -191,7 +205,9 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
|
||||
Vec3 vec3d = shooter.getDeltaMovement();
|
||||
|
||||
+ 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
|
||||
+ } // Parchment
|
||||
}
|
||||
|
||||
// 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..b923ea037a69628309167d16cc2a0ae780444523 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
|
||||
@@ -42,9 +42,13 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
|
||||
if (!world.isClientSide) {
|
||||
ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW);
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(entityhuman.getBukkitEntity(), stack.asBukkitCopy(), itemstack1.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // Parchment end
|
||||
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()); // Parchment
|
||||
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 eede02c3f125d230af537bb67bebed9b88f7d1b4..343c634b97f3ff5e8eda008121a661423a1810aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -225,6 +225,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) {
|
||||
+ // Parchment start
|
||||
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(shooter.getBukkitEntity(), crossbow.asBukkitCopy(), projectile.asBukkitCopy());
|
||||
+ if (!preEvent.callEvent()) return;
|
||||
+ // TODO: handle relative flag in CrossbowAttackMob#shootCrossbowProjectile
|
||||
+ // Parchment end
|
||||
boolean flag1 = projectile.is(Items.FIREWORK_ROCKET);
|
||||
Object object;
|
||||
|
||||
19
patches/server/0023-Return-Displays-in-getTargetEntity.patch
Normal file
19
patches/server/0023-Return-Displays-in-getTargetEntity.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Sun, 19 Mar 2023 20:02:00 -0400
|
||||
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 45b1a182acf6b2aef40b714d31ca125d8f74619a..90da5817fd0e5dc332193944b68fc343915d5b39 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4107,7 +4107,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
|
||||
|
||||
double distance = 0.0D;
|
||||
EntityHitResult result = null;
|
||||
@@ -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 a043c382c37058032548a5192e17f5f816abe5a6..24fb2e60bcf3722cbc95684ce81952ad4a4f840d 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -289,7 +289,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;
|
||||
}
|
||||
131
patches/server/0025-Add-Block-BreakNaturally-Overload.patch
Normal file
131
patches/server/0025-Add-Block-BreakNaturally-Overload.patch
Normal file
@@ -0,0 +1,131 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Blast-MC <cjblanton2@gmail.com>
|
||||
Date: Fri, 15 Dec 2023 21:59:19 -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 c4c27fb5b92833eca243e1ba718c8dcaa676a310..74be1111c4ac7fc43ed92c83544b0e7d77764e9a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -7,6 +7,8 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
@@ -307,24 +309,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 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.popResource(world, pos, itemstack));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new 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 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.popResource((ServerLevel) world, pos, itemstack));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new ArrayList<>();
|
||||
}
|
||||
// Paper start
|
||||
public static boolean dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity, BlockPos source) {
|
||||
@@ -344,25 +350,29 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
|
||||
+ public static List<ItemEntity> dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
|
||||
if (world instanceof ServerLevel) {
|
||||
+ List<ItemEntity> itemEntities = new 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.popResource(world, pos, itemstack1));
|
||||
});
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, tool, true);
|
||||
+ return itemEntities;
|
||||
}
|
||||
-
|
||||
+ return new ArrayList<>();
|
||||
}
|
||||
|
||||
- public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
||||
+ public static ItemEntity popResource(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, () -> {
|
||||
- return new ItemEntity(world, d1, d2, d3, stack);
|
||||
+ return itemEntity;
|
||||
}, stack);
|
||||
+ return itemEntity;
|
||||
}
|
||||
|
||||
public static void popResourceFromFace(Level world, BlockPos pos, Direction direction, ItemStack stack) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index e5506a7d074a9f89d41f4d5d7549a458779bef20..102b4238ca81b59248c83e9fa0529eb2340485d3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -43,6 +43,7 @@ import org.bukkit.craftbukkit.CraftFluidCollisionMode;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.craftbukkit.entity.CraftItem;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
@@ -494,16 +495,26 @@ 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 tool, 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();
|
||||
net.minecraft.world.level.block.Block block = iblockdata.getBlock();
|
||||
- net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
|
||||
+ net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(tool);
|
||||
boolean result = false;
|
||||
|
||||
// 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);
|
||||
+ if (block != Blocks.AIR && (tool == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
|
||||
+ 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);
|
||||
+
|
||||
+ if (player != null) {
|
||||
+ new org.bukkit.event.block.BlockDropItemEvent(this, this.getState(), player, itemEntities.stream().map(item -> (org.bukkit.entity.Item) CraftEntity.getEntity((org.bukkit.craftbukkit.CraftServer) Bukkit.getServer(), item)).toList()).callEvent();
|
||||
+ }
|
||||
+
|
||||
// Paper start - improve Block#breanNaturally
|
||||
if (triggerEffect) {
|
||||
if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.BaseFireBlock) {
|
||||
124
patches/server/0026-Add-CustomBlockUpdateEvent.patch
Normal file
124
patches/server/0026-Add-CustomBlockUpdateEvent.patch
Normal file
@@ -0,0 +1,124 @@
|
||||
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 ff16075fbfe664c73a46bc4b002450867974114e..32b56119850282ba8da5741e22dc21ffd6f6fb08 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
||||
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import gg.projecteden.parchment.event.block.CustomBlockUpdateEvent;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -65,12 +67,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()), 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
|
||||
public 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), CustomBlockUpdateEvent.UpdateType.INSTRUMENT).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;
|
||||
|
||||
@@ -79,6 +83,7 @@ public class NoteBlock extends Block {
|
||||
|
||||
@Override
|
||||
public 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()), CustomBlockUpdateEvent.UpdateType.POWERED).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return; // Paper - prevent noteblock powered-state from updating
|
||||
boolean flag1 = world.hasNeighborSignal(pos);
|
||||
|
||||
@@ -117,7 +122,9 @@ public class NoteBlock extends Block {
|
||||
} else 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()), CustomBlockUpdateEvent.UpdateType.PITCH).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 2f947997ca746d18544940ef67ff550a95946edd..b1ecefd22a64bf7a134490cf7ac88d4d04e1f4e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||
@@ -66,21 +66,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
|
||||
public 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).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
|
||||
public 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).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);
|
||||
@@ -89,6 +93,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public 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).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), true); // Paper - fix state inconsistency
|
||||
@@ -97,6 +102,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).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);
|
||||
@@ -107,6 +113,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).callEvent()) return;
|
||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
||||
// Paper start - fix state inconsistency
|
||||
this.updateSource(world, pos, state, false);
|
||||
@@ -146,6 +153,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public 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).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
|
||||
if (!world.isClientSide) {
|
||||
@@ -157,6 +165,7 @@ public class TripWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public 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).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);
|
||||
92
patches/server/0027-Entity-Data-Storage.patch
Normal file
92
patches/server/0027-Entity-Data-Storage.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
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 58536aabf607015939a1326f80207c0a06eed8ff..b27e958e8da8abbf0e36b432bf3a29da270ecb8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -268,6 +268,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 9abe817ae202edaa2d88cd59ae5c7db0b1c634be..861dff20a09d94cb90e1ff95ea51f50efa7b501d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -158,6 +158,31 @@ import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public abstract class Entity implements 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 - 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 aa4dbf91cf6da329fdcacbde98bb870eb48e8f5c..392d5b896254e5dd57de33e16fa196950e6f7c61 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -222,6 +222,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;
|
||||
275
patches/server/0028-Add-Sidebar-Utility.patch
Normal file
275
patches/server/0028-Add-Sidebar-Utility.patch
Normal file
@@ -0,0 +1,275 @@
|
||||
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..5a1e28da1f3dcae1abeb016708dc6fdf883cd213
|
||||
--- /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);
|
||||
+ }
|
||||
+
|
||||
+ NumberFormat numberFormat = (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);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
Reference in New Issue
Block a user