Compare commits

...

16 Commits

Author SHA1 Message Date
github-actions[bot]
f0db903bb5 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@bf92f3e Updated Upstream (Bukkit/CraftBukkit)
2023-03-30 13:57:03 +00:00
github-actions[bot]
8a333120da Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@1924a57 Updated Upstream (Paper)
2023-03-30 07:08:13 +00:00
AlphaKR93
424e876c7c Updated Upstream (Paper) 2023-03-30 12:56:38 +09:00
github-actions[bot]
e5e84f55ab Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@32875b4 8948: Nag when timings is enabled or a plugin creates a new Timing
2023-03-29 19:54:35 +00:00
github-actions[bot]
2bfa77be48 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@f5a789d Updated Upstream (Paper)
2023-03-28 04:52:02 +00:00
IPECTER 이팩터
8578903621 Port MemoryLeakFix (#39) 2023-03-28 12:53:31 +09:00
github-actions[bot]
6a3b842b90 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@5c78e77 Fix api checking banned ips (#9026)
2023-03-28 03:36:17 +00:00
github-actions[bot]
6c345e6680 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@ce2a36d Fix PluginMeta#getDisplayName (#9038)
PaperMC/Paper@9940019 Deprecate public Timings classes for removal (#8949)
2023-03-28 03:24:49 +00:00
github-actions[bot]
60b13b6213 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@bd62f2c Fix chat messages being logged without formatting to console (#9058)
2023-03-27 17:37:40 +00:00
github-actions[bot]
b602b8e073 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@7e014a8 Updated Upstream (Paper)
2023-03-27 07:08:26 +00:00
AlphaKR93
02a7f7c066 [CI-Skip] [CheckSkip] Update Upstream data 2023-03-27 12:36:46 +09:00
AlphaKR93
b46915c9b2 Updated Upstream (Paper & Purpur) 2023-03-27 12:35:18 +09:00
AlphaKR93
187067c505 [CI-Skip] [CheckSkip] Cleanup workflows 2023-03-27 00:35:47 +09:00
IPECTER 이팩터
8bb0b20868 Port FixMySpawnR (#37)
* Port FixMySpawnR

* Update

* Use DO_OPTIMIZE instead Boolean.getBoolean()

---------

Co-authored-by: AlphaKR93 <dev@alpha93.kr>
2023-03-26 23:30:02 +09:00
Alpha
a97ffba61f [CI-Skip] [CheckSkip] Push with token 2023-03-26 15:45:12 +09:00
Alpha
a5026805b7 [CI-Skip] [CheckSkip] Check release number before release 2023-03-26 15:43:38 +09:00
39 changed files with 500 additions and 1170 deletions

View File

@@ -30,11 +30,12 @@ jobs:
with: with:
path: javadoc path: javadoc
ref: gh-pages ref: gh-pages
token: ${{ secrets.GH_PAT }}
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Set up GraalVM ${{ matrix.jdk }} - name: Set up GraalVM ${{ matrix.base_jdk }}
uses: graalvm/setup-graalvm@v1 uses: graalvm/setup-graalvm@v1
with: with:
github-token: ${{ secrets.GH_PAT }} github-token: ${{ secrets.GH_PAT }}
@@ -43,9 +44,7 @@ jobs:
cache: 'gradle' cache: 'gradle'
- name: Configure Git - name: Configure Git
run: | run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
echo "release_num=$(git ls-remote --tags origin | grep "release" | wc -l)" >> $GITHUB_ENV
- name: Apply Patches - name: Apply Patches
run: ./gradlew applyPatches --stacktrace run: ./gradlew applyPatches --stacktrace
@@ -66,7 +65,7 @@ jobs:
(cd Plazma-API/build/docs/javadoc && tar c .) | (cd javadoc && tar xf -) (cd Plazma-API/build/docs/javadoc && tar c .) | (cd javadoc && tar xf -)
cd javadoc cd javadoc
git add . && git commit -m "Update Javadocs" git add . && git commit -m "Update Javadocs"
git push -f git push
- name: Publish Packages - name: Publish Packages
if: github.ref_name == env.MAIN_BRANCH if: github.ref_name == env.MAIN_BRANCH
@@ -83,13 +82,16 @@ jobs:
path: | path: |
build/libs build/libs
Plazma-API/build/docs/javadoc Plazma-API/build/docs/javadoc
- name: Get Release Number
run: echo "RELEASE=$(git ls-remote --tags origin | grep "release" | wc -l)" >> $GITHUB_ENV
- name: Release Artifacts - name: Release Artifacts
if: startsWith(github.ref_name, 'ver/') if: startsWith(github.ref_name, 'ver/')
uses: marvinpinto/action-automatic-releases@latest uses: marvinpinto/action-automatic-releases@latest
with: with:
title: "Release #${{ env.release_num }}" title: "Release #${{ env.RELEASE }}"
automatic_release_tag: release-${{ env.release_num }} automatic_release_tag: release-${{ env.RELEASE }}
repo_token: "${{ secrets.GH_PAT }}" repo_token: "${{ secrets.GH_PAT }}"
files: build/libs/*.jar files: build/libs/*.jar
prerelease: false prerelease: false
@@ -98,7 +100,7 @@ jobs:
if: startsWith(github.ref_name, 'ver/') if: startsWith(github.ref_name, 'ver/')
uses: marvinpinto/action-automatic-releases@latest uses: marvinpinto/action-automatic-releases@latest
with: with:
title: "Release #${{ env.release_num }}" title: "Release #${{ env.RELEASE }}"
automatic_release_tag: latest-${{ env.MC_VERSION }} automatic_release_tag: latest-${{ env.MC_VERSION }}
repo_token: "${{ secrets.GH_PAT }}" repo_token: "${{ secrets.GH_PAT }}"
files: build/libs/*.jar files: build/libs/*.jar

14
.github/workflows/close-invalid-prs.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Close invalid PRs
on:
pull_request_target:
types: [ opened ]
jobs:
run:
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && !startsWith(github.head_ref, 'ver/') }}
runs-on: ubuntu-22.04
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Please do not open pull requests from the `master` branch, create a new branch instead."

View File

@@ -9,8 +9,8 @@ jobs:
release: release:
strategy: strategy:
matrix: matrix:
base_jdk: [19] jdk: [19.0.2+7]
graal: [latest] java: ['temurin']
os: [ubuntu-22.04] os: [ubuntu-22.04]
if: "!contains(github.event.commits[0].message, '[CheckSkip]')" if: "!contains(github.event.commits[0].message, '[CheckSkip]')"
@@ -22,12 +22,11 @@ jobs:
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Set up GraalVM ${{ matrix.jdk }} - name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }}
uses: graalvm/setup-graalvm@v1 uses: actions/setup-java@v3
with: with:
github-token: ${{ secrets.GH_PAT }} distribution: ${{ matrix.java }}
java-version: ${{ matrix.base_jdk }} java-version: ${{ matrix.jdk }}
version: ${{ matrix.graal }}
cache: 'gradle' cache: 'gradle'
- name: Configure Git - name: Configure Git

View File

@@ -1,2 +1,2 @@
purpurCommit = 893ce2a77ae2c2c31638a4c1e73cde595c4c21ec purpurCommit = 1924a57cc7a547de392686dc18fd0b1e137e95b1
pufferfishCommit = d032415ca6fd0736d7cb0da28e3134b957fb83a0 pufferfishCommit = 751dfb0338e2c09519313ffaca04084dc3140b80

View File

@@ -85,8 +85,6 @@ paperweight {
} }
val upstreamTask = tasks.register("updateUpstream") { val upstreamTask = tasks.register("updateUpstream") {
finalizedBy("applyPatches")
val tempDir = layout.cacheDir("updateUpstream"); val tempDir = layout.cacheDir("updateUpstream");
val file = "gradle.properties"; val file = "gradle.properties";

View File

@@ -1,7 +1,7 @@
group = org.plazmamc.plazma group = org.plazmamc.plazma
version = 1.19.4-R0.1-SNAPSHOT version = 1.19.4-R0.1-SNAPSHOT
paperCommit = d5abb94e69ceed6e73116c13e7634b57b5ad84cf paperCommit = bf92f3e4db44d17dab7411b0a5474a6b2fabc3b5
org.gradle.caching = true org.gradle.caching = true
org.gradle.parallel = true org.gradle.parallel = true

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr> From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:28:40 +0900 Date: Thu, 30 Mar 2023 06:56:29 +0000
Subject: [PATCH] Pufferfish API Changes Subject: [PATCH] Pufferfish API Changes
Original: Kevin Raneri <kevin.raneri@gmail.com> Original: Kevin Raneri <kevin.raneri@gmail.com>
@@ -47,7 +47,7 @@ index cad12a2632b9ebb569280441c42869685db1f31a..b83e2c5a0a094002d12aee55ec0cf8d1
into("META-INF/maven/${project.group}/${project.name}") into("META-INF/maven/${project.group}/${project.name}")
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc90cefc4ee
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java +++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
@@ -0,0 +1,161 @@ @@ -0,0 +1,161 @@
@@ -69,21 +69,21 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.Nullable;
+ +
+public class SentryContext { +public class SentryContext {
+ +
+ private static final Gson GSON = new Gson(); + private static final Gson GSON = new Gson();
+ +
+ public static void setPluginContext(@Nullable Plugin plugin) { + public static void setPluginContext(@Nullable Plugin plugin) {
+ if (plugin != null) { + if (plugin != null) {
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName()); + ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion()); + ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion());
+ } + }
+ } + }
+ +
+ public static void removePluginContext() { + public static void removePluginContext() {
+ ThreadContext.remove("pufferfishsentry_pluginname"); + ThreadContext.remove("pufferfishsentry_pluginname");
+ ThreadContext.remove("pufferfishsentry_pluginversion"); + ThreadContext.remove("pufferfishsentry_pluginversion");
+ } + }
+ +
+ public static void setSenderContext(@Nullable CommandSender sender) { + public static void setSenderContext(@Nullable CommandSender sender) {
+ if (sender != null) { + if (sender != null) {
+ ThreadContext.put("pufferfishsentry_playername", sender.getName()); + ThreadContext.put("pufferfishsentry_playername", sender.getName());
@@ -92,15 +92,15 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+ } + }
+ } + }
+ } + }
+ +
+ public static void removeSenderContext() { + public static void removeSenderContext() {
+ ThreadContext.remove("pufferfishsentry_playername"); + ThreadContext.remove("pufferfishsentry_playername");
+ ThreadContext.remove("pufferfishsentry_playerid"); + ThreadContext.remove("pufferfishsentry_playerid");
+ } + }
+ +
+ public static void setEventContext(Event event, RegisteredListener registration) { + public static void setEventContext(Event event, RegisteredListener registration) {
+ setPluginContext(registration.getPlugin()); + setPluginContext(registration.getPlugin());
+ +
+ try { + try {
+ // Find the player that was involved with this event + // Find the player that was involved with this event
+ Player player = null; + Player player = null;
@@ -108,36 +108,36 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+ player = ((PlayerEvent) event).getPlayer(); + player = ((PlayerEvent) event).getPlayer();
+ } else { + } else {
+ Class<? extends Event> eventClass = event.getClass(); + Class<? extends Event> eventClass = event.getClass();
+ +
+ Field playerField = null; + Field playerField = null;
+ +
+ for (Field field : eventClass.getDeclaredFields()) { + for (Field field : eventClass.getDeclaredFields()) {
+ if (field.getType().equals(Player.class)) { + if (field.getType().equals(Player.class)) {
+ playerField = field; + playerField = field;
+ break; + break;
+ } + }
+ } + }
+ +
+ if (playerField != null) { + if (playerField != null) {
+ playerField.setAccessible(true); + playerField.setAccessible(true);
+ player = (Player) playerField.get(event); + player = (Player) playerField.get(event);
+ } + }
+ } + }
+ +
+ if (player != null) { + if (player != null) {
+ setSenderContext(player); + setSenderContext(player);
+ } + }
+ } catch (Exception e) {} // We can't really safely log exceptions. + } catch (Exception e) {} // We can't really safely log exceptions.
+ +
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event))); + ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
+ } + }
+ +
+ public static void removeEventContext() { + public static void removeEventContext() {
+ removePluginContext(); + removePluginContext();
+ removeSenderContext(); + removeSenderContext();
+ ThreadContext.remove("pufferfishsentry_eventdata"); + ThreadContext.remove("pufferfishsentry_eventdata");
+ } + }
+ +
+ private static Map<String, String> serializeFields(Object object) { + private static Map<String, String> serializeFields(Object object) {
+ Map<String, String> fields = new TreeMap<>(); + Map<String, String> fields = new TreeMap<>();
+ fields.put("_class", object.getClass().getName()); + fields.put("_class", object.getClass().getName());
@@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+ if (Modifier.isStatic(declaredField.getModifiers())) { + if (Modifier.isStatic(declaredField.getModifiers())) {
+ continue; + continue;
+ } + }
+ +
+ String fieldName = declaredField.getName(); + String fieldName = declaredField.getName();
+ if (fieldName.equals("handlers")) { + if (fieldName.equals("handlers")) {
+ continue; + continue;
@@ -162,51 +162,51 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+ } + }
+ return fields; + return fields;
+ } + }
+ +
+ public static class State { + public static class State {
+ +
+ private Plugin plugin; + private Plugin plugin;
+ private Command command; + private Command command;
+ private String commandLine; + private String commandLine;
+ private Event event; + private Event event;
+ private RegisteredListener registeredListener; + private RegisteredListener registeredListener;
+ +
+ public Plugin getPlugin() { + public Plugin getPlugin() {
+ return plugin; + return plugin;
+ } + }
+ +
+ public void setPlugin(Plugin plugin) { + public void setPlugin(Plugin plugin) {
+ this.plugin = plugin; + this.plugin = plugin;
+ } + }
+ +
+ public Command getCommand() { + public Command getCommand() {
+ return command; + return command;
+ } + }
+ +
+ public void setCommand(Command command) { + public void setCommand(Command command) {
+ this.command = command; + this.command = command;
+ } + }
+ +
+ public String getCommandLine() { + public String getCommandLine() {
+ return commandLine; + return commandLine;
+ } + }
+ +
+ public void setCommandLine(String commandLine) { + public void setCommandLine(String commandLine) {
+ this.commandLine = commandLine; + this.commandLine = commandLine;
+ } + }
+ +
+ public Event getEvent() { + public Event getEvent() {
+ return event; + return event;
+ } + }
+ +
+ public void setEvent(Event event) { + public void setEvent(Event event) {
+ this.event = event; + this.event = event;
+ } + }
+ +
+ public RegisteredListener getRegisteredListener() { + public RegisteredListener getRegisteredListener() {
+ return registeredListener; + return registeredListener;
+ } + }
+ +
+ public void setRegisteredListener(RegisteredListener registeredListener) { + public void setRegisteredListener(RegisteredListener registeredListener) {
+ this.registeredListener = registeredListener; + this.registeredListener = registeredListener;
+ } + }
@@ -214,7 +214,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+} +}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704ff713345 index 0000000000000000000000000000000000000000..6d266ebf5e52745ad13e90e5754b524383fa9b29
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java +++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
@@ -231,7 +231,7 @@ index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704
+ */ + */
+@Deprecated +@Deprecated
+public class SIMDChecker { +public class SIMDChecker {
+ +
+ @Deprecated + @Deprecated
+ public static boolean canEnable(Logger logger) { + public static boolean canEnable(Logger logger) {
+ try { + try {
@@ -239,13 +239,13 @@ index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704
+ return false; + return false;
+ } else { + } else {
+ SIMDDetection.testRun = true; + SIMDDetection.testRun = true;
+ +
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED; + VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED; + VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
+ +
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)"); + logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)");
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)"); + logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)");
+ +
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) { + if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
+ logger.log(Level.WARNING, "SIMD is not properly supported on this system!"); + logger.log(Level.WARNING, "SIMD is not properly supported on this system!");
+ return false; + return false;
@@ -256,11 +256,11 @@ index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704
+ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it. + } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
+ return false; + return false;
+ } + }
+ +
+} +}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b index 0000000000000000000000000000000000000000..fd708554d6dab2ddcd24c3024330b8ebf9462111
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java +++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
@@ -270,11 +270,11 @@ index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c
+ +
+@Deprecated +@Deprecated
+public class SIMDDetection { +public class SIMDDetection {
+ +
+ public static boolean isEnabled = false; + public static boolean isEnabled = false;
+ public static boolean versionLimited = false; + public static boolean versionLimited = false;
+ public static boolean testRun = false; + public static boolean testRun = false;
+ +
+ @Deprecated + @Deprecated
+ public static boolean canEnable(Logger logger) { + public static boolean canEnable(Logger logger) {
+ try { + try {
@@ -283,7 +283,7 @@ index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c
+ return false; + return false;
+ } + }
+ } + }
+ +
+ @Deprecated + @Deprecated
+ public static int getJavaVersion() { + public static int getJavaVersion() {
+ // https://stackoverflow.com/a/2591122 + // https://stackoverflow.com/a/2591122
@@ -297,11 +297,11 @@ index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c
+ version = version.split("-")[0]; // Azul is stupid + version = version.split("-")[0]; // Azul is stupid
+ return Integer.parseInt(version); + return Integer.parseInt(version);
+ } + }
+ +
+} +}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f index 0000000000000000000000000000000000000000..20ec3b29b0cb4061cc89d635b3929ffe71008e22
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java +++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
@@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
@@ -316,10 +316,10 @@ index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be
+ +
+@Deprecated +@Deprecated
+public class VectorMapPalette { +public class VectorMapPalette {
+ +
+ private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED; + private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
+ private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED; + private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
+ +
+ @Deprecated + @Deprecated
+ public static void matchColorVectorized(int[] in, byte[] out) { + public static void matchColorVectorized(int[] in, byte[] out) {
+ int speciesLength = I_SPEC.length(); + int speciesLength = I_SPEC.length();
@@ -329,64 +329,64 @@ index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be
+ float[] bluesArr = new float[speciesLength]; + float[] bluesArr = new float[speciesLength];
+ float[] greensArr = new float[speciesLength]; + float[] greensArr = new float[speciesLength];
+ int[] alphasArr = new int[speciesLength]; + int[] alphasArr = new int[speciesLength];
+ +
+ for (int j = 0; j < speciesLength; j++) { + for (int j = 0; j < speciesLength; j++) {
+ alphasArr[j] = (in[i + j] >> 24) & 0xFF; + alphasArr[j] = (in[i + j] >> 24) & 0xFF;
+ redsArr[j] = (in[i + j] >> 16) & 0xFF; + redsArr[j] = (in[i + j] >> 16) & 0xFF;
+ greensArr[j] = (in[i + j] >> 8) & 0xFF; + greensArr[j] = (in[i + j] >> 8) & 0xFF;
+ bluesArr[j] = (in[i + j] >> 0) & 0xFF; + bluesArr[j] = (in[i + j] >> 0) & 0xFF;
+ } + }
+ +
+ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0); + IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
+ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0); + FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
+ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0); + FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
+ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0); + FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
+ IntVector resultIndex = IntVector.zero(I_SPEC); + IntVector resultIndex = IntVector.zero(I_SPEC);
+ VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff); + VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
+ +
+ modificationMask = modificationMask.and(alphas.lt(128).not()); + modificationMask = modificationMask.and(alphas.lt(128).not());
+ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE); + FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
+ +
+ for (int c = 4; c < MapPalette.colors.length; c++) { + for (int c = 4; c < MapPalette.colors.length; c++) {
+ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference. + // We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
+ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary. + // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
+ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed()); + FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
+ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen()); + FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
+ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue()); + FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
+ +
+ FloatVector rMean = reds.add(compReds).div(2.0f); + FloatVector rMean = reds.add(compReds).div(2.0f);
+ FloatVector rDiff = reds.sub(compReds); + FloatVector rDiff = reds.sub(compReds);
+ FloatVector gDiff = greens.sub(compGreens); + FloatVector gDiff = greens.sub(compGreens);
+ FloatVector bDiff = blues.sub(compBlues); + FloatVector bDiff = blues.sub(compBlues);
+ +
+ FloatVector weightR = rMean.div(256.0f).add(2); + FloatVector weightR = rMean.div(256.0f).add(2);
+ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f); + FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
+ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f); + FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
+ +
+ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff)); + FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
+ +
+ // Now we compare to the best distance we've found. + // Now we compare to the best distance we've found.
+ // This mask contains a "1" if better, and a "0" otherwise. + // This mask contains a "1" if better, and a "0" otherwise.
+ VectorMask<Float> bestDistanceMask = distance.lt(bestDistances); + VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
+ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances + bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
+ +
+ // Update the result array + // Update the result array
+ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough. + // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
+ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results + resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
+ } + }
+ +
+ for (int j = 0; j < speciesLength; j++) { + for (int j = 0; j < speciesLength; j++) {
+ int index = resultIndex.lane(j); + int index = resultIndex.lane(j);
+ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127)); + out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
+ } + }
+ } + }
+ +
+ // For the final ones, fall back to the regular method + // For the final ones, fall back to the regular method
+ for (; i < in.length; i++) { + for (; i < in.length; i++) {
+ out[i] = MapPalette.matchColor(new Color(in[i], true)); + out[i] = MapPalette.matchColor(new Color(in[i], true));
+ } + }
+ } + }
+ +
+} +}
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..9584e245144b561b4f6745b2f26a4f69a6f92891 100644 index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..9584e245144b561b4f6745b2f26a4f69a6f92891 100644

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr> From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:35:54 +0900 Date: Thu, 30 Mar 2023 06:58:47 +0000
Subject: [PATCH] Purpur API Changes Subject: [PATCH] Purpur API Changes
Original: PurpurMC Original: PurpurMC
@@ -38,10 +38,10 @@ index b83e2c5a0a094002d12aee55ec0cf8d12bf33f3e..b5835fa536f90b7f88a5ee4df78733cf
options.overview = "src/main/javadoc/overview.html" options.overview = "src/main/javadoc/overview.html"
options.use() options.use()
diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java
index 34e43e56ccc663e05b9cae36643e8df5eee5cb17..2c15b67149d014fdce2dd74a550013d83b6e44c8 100644 index 8f29c1561ba5916cb5634392edd8bd2a5a294a51..6fbc64e0f214d0c8e5afcbe385e414a4e1fe1c72 100644
--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java --- a/src/main/java/co/aikar/timings/TimedEventExecutor.java
+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java +++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java
@@ -76,9 +76,9 @@ public class TimedEventExecutor implements EventExecutor { @@ -77,9 +77,9 @@ public class TimedEventExecutor implements EventExecutor {
executor.execute(listener, event); executor.execute(listener, event);
return; return;
} }
@@ -54,10 +54,10 @@ index 34e43e56ccc663e05b9cae36643e8df5eee5cb17..2c15b67149d014fdce2dd74a550013d8
@Override @Override
diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java
index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb662bf81b 100644 index 7514fad26f955329f8bf17ff17db75f0c8301ee5..1d866e980abc542bdfee1ce082cd9cdd7761e9f7 100644
--- a/src/main/java/co/aikar/timings/Timing.java --- a/src/main/java/co/aikar/timings/Timing.java
+++ b/src/main/java/co/aikar/timings/Timing.java +++ b/src/main/java/co/aikar/timings/Timing.java
@@ -36,6 +36,7 @@ public interface Timing extends AutoCloseable { @@ -39,6 +39,7 @@ public interface Timing extends AutoCloseable {
* @return Timing * @return Timing
*/ */
@NotNull @NotNull
@@ -65,7 +65,7 @@ index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb
Timing startTiming(); Timing startTiming();
/** /**
@@ -43,6 +44,7 @@ public interface Timing extends AutoCloseable { @@ -46,6 +47,7 @@ public interface Timing extends AutoCloseable {
* *
* Will automatically be called when this Timing is used with try-with-resources * Will automatically be called when this Timing is used with try-with-resources
*/ */
@@ -73,7 +73,7 @@ index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb
void stopTiming(); void stopTiming();
/** /**
@@ -53,6 +55,7 @@ public interface Timing extends AutoCloseable { @@ -56,6 +58,7 @@ public interface Timing extends AutoCloseable {
* @return Timing * @return Timing
*/ */
@NotNull @NotNull
@@ -81,7 +81,7 @@ index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb
Timing startTimingIfSync(); Timing startTimingIfSync();
/** /**
@@ -62,12 +65,14 @@ public interface Timing extends AutoCloseable { @@ -65,12 +68,14 @@ public interface Timing extends AutoCloseable {
* *
* But only if we are on the primary thread. * But only if we are on the primary thread.
*/ */
@@ -96,7 +96,7 @@ index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb
void abort(); void abort();
/** /**
@@ -79,5 +84,6 @@ public interface Timing extends AutoCloseable { @@ -82,5 +87,6 @@ public interface Timing extends AutoCloseable {
TimingHandler getTimingHandler(); TimingHandler getTimingHandler();
@Override @Override
@@ -104,10 +104,10 @@ index a21e5ead5024fd0058c5e3302d8201dd249d32bc..505908e987a032a801ae03d7fb020dfb
void close(); void close();
} }
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
index dd72a34eaa4bedd9ea0b92eaa79091b00eb4dd09..759e9cbcedb50894821dcb6dcc602af4f0c3453e 100644 index 9812d668ad945aba486fbf6d5bf83c4292cb5d03..187672fdcb77081653335d20537fbd795c026245 100644
--- a/src/main/java/co/aikar/timings/Timings.java --- a/src/main/java/co/aikar/timings/Timings.java
+++ b/src/main/java/co/aikar/timings/Timings.java +++ b/src/main/java/co/aikar/timings/Timings.java
@@ -114,7 +114,7 @@ public final class Timings { @@ -124,7 +124,7 @@ public final class Timings {
@NotNull @NotNull
public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) {
Timing timing = of(plugin, name, groupHandler); Timing timing = of(plugin, name, groupHandler);
@@ -117,10 +117,10 @@ index dd72a34eaa4bedd9ea0b92eaa79091b00eb4dd09..759e9cbcedb50894821dcb6dcc602af4
} }
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
index 3132dc98d26c54c5e46162e53aaed195d7335c8d..b461b5c50f97f11cb9ef68abc520271bb72440fa 100644 index e801e79fa57c44b2e5d359647c920f88064826f1..1abfcee0f6d632f4cd8d74b4994a90c9ea9d254c 100644
--- a/src/main/java/co/aikar/timings/TimingsCommand.java --- a/src/main/java/co/aikar/timings/TimingsCommand.java
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java +++ b/src/main/java/co/aikar/timings/TimingsCommand.java
@@ -44,7 +44,7 @@ public class TimingsCommand extends BukkitCommand { @@ -45,7 +45,7 @@ public class TimingsCommand extends BukkitCommand {
public TimingsCommand(@NotNull String name) { public TimingsCommand(@NotNull String name) {
super(name); super(name);
this.description = "Manages Spigot Timings data to see performance of the server."; this.description = "Manages Spigot Timings data to see performance of the server.";
@@ -129,21 +129,22 @@ index 3132dc98d26c54c5e46162e53aaed195d7335c8d..b461b5c50f97f11cb9ef68abc520271b
this.setPermission("bukkit.command.timings"); this.setPermission("bukkit.command.timings");
} }
@@ -53,6 +53,13 @@ public class TimingsCommand extends BukkitCommand { @@ -54,8 +54,12 @@ public class TimingsCommand extends BukkitCommand {
if (!testPermission(sender)) { if (!testPermission(sender)) {
return true; return true;
} }
- if (false) {
- sender.sendMessage(Timings.deprecationMessage());
+ if (true) { + if (true) {
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); + net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
+ sender.sendMessage(mm.deserialize("<gold>Purpur has removed timings to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead")); + sender.sendMessage(mm.deserialize("<gold>Purpur has removed timings to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
+ sender.sendMessage(mm.deserialize("<gold>For more information, view its documentation at")); + sender.sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
+ sender.sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>")); + sender.sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
+ return true; + return true;
+ } }
if (args.length < 1) { if (args.length < 1) {
sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
return true; @@ -115,7 +119,7 @@ public class TimingsCommand extends BukkitCommand {
@@ -111,7 +118,7 @@ public class TimingsCommand extends BukkitCommand {
Preconditions.checkNotNull(args, "Arguments cannot be null"); Preconditions.checkNotNull(args, "Arguments cannot be null");
Preconditions.checkNotNull(alias, "Alias cannot be null"); Preconditions.checkNotNull(alias, "Alias cannot be null");
@@ -4062,7 +4063,7 @@ index 0000000000000000000000000000000000000000..38483d908ed830e97883733bee2370f8
+ } + }
+} +}
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
index 123647bb10fc89508437d7a0bd3fd31d58ee7c82..ce209668dd7f11b284bd7f5688191a0b3ae86a09 100644 index 12946bd55fcf7c40d39081779a7fa30049ee6165..9c2d605c50cbf9aefa56ec209df9f6cea1392e89 100644
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java --- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java +++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
@@ -61,7 +61,7 @@ public final class CustomTimingsHandler { @@ -61,7 +61,7 @@ public final class CustomTimingsHandler {

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr> From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:35:36 +0900 Date: Thu, 30 Mar 2023 06:58:47 +0000
Subject: [PATCH] Purpur Server Changes Subject: [PATCH] Purpur Server Changes
Original: PurpurMC Original: PurpurMC
@@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f 100644 index b41b186397d013c19436c345be98b785d4bd0295..22470f0ab8354a9f31a0f195f3fe80f2f5ee2f0e 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -7,12 +7,8 @@ plugins { @@ -7,12 +7,8 @@ plugins {
@@ -54,7 +54,7 @@ index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4b
runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5") runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
@@ -82,7 +82,7 @@ tasks.jar { @@ -81,7 +81,7 @@ tasks.jar {
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit", "Implementation-Title" to "CraftBukkit",
@@ -63,7 +63,7 @@ index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4b
"Implementation-Vendor" to date, // Paper "Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit", "Specification-Title" to "Bukkit",
"Specification-Version" to project.version, "Specification-Version" to project.version,
@@ -154,7 +154,7 @@ fun TaskContainer.registerRunTask( @@ -153,7 +153,7 @@ fun TaskContainer.registerRunTask(
name: String, name: String,
block: JavaExec.() -> Unit block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) { ): TaskProvider<JavaExec> = register<JavaExec>(name) {
@@ -261,27 +261,27 @@ index 39844531b03eb8a6c70700b4ecbf0ff1a557424d..632ae75cb3bbc7a3955872d14ad0fbc2
public void removeCommand(String name) { public void removeCommand(String name) {
this.children.remove(name); this.children.remove(name);
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772f454732e 100644 index a8cead500186142115d4dc029c942fdfc68f7fe5..62b2a3a44929b80b813bc24a33cd1f5049fecbb2 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -36,6 +36,7 @@ public class PufferfishConfig { @@ -28,6 +28,7 @@ public class PufferfishConfig {
private static final YamlFile config = new YamlFile(); private static final YamlFile config = new YamlFile();
private static int updates = 0; private static int updates = 0;
+ public static File pufferfishFile; // Purpur + public static File pufferfishFile; // Purpur
private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) {
ConfigurationSection newSection = new MemoryConfiguration(); ConfigurationSection newSection = new MemoryConfiguration();
@@ -58,7 +59,7 @@ public class PufferfishConfig { @@ -50,7 +51,7 @@ public class PufferfishConfig {
} }
public static void load() throws IOException { public static void load() throws IOException {
- File configFile = new File("pufferfish.yml"); - File configFile = new File("pufferfish.yml");
+ File configFile = pufferfishFile; // Purpur + File configFile = pufferfishFile; // Purpur
if (configFile.exists()) { if (configFile.exists()) {
try { try {
@@ -232,7 +233,7 @@ public class PufferfishConfig { @@ -224,7 +225,7 @@ public class PufferfishConfig {
public static int activationDistanceMod; public static int activationDistanceMod;
private static void dynamicActivationOfBrains() throws IOException { private static void dynamicActivationOfBrains() throws IOException {
@@ -290,8 +290,8 @@ index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
"This value determines how far away an entity has to be", "This value determines how far away an entity has to be",
"from the player to start being effected by DEAR."); "from the player to start being effected by DEAR.");
@@ -276,7 +277,7 @@ public class PufferfishConfig { @@ -268,7 +269,7 @@ public class PufferfishConfig {
public static boolean throttleInactiveGoalSelectorTick; public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() { private static void inactiveGoalSelectorThrottle() {
- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true, - getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
@@ -1049,10 +1049,10 @@ index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..358d610ad020cada1bb83e393deeeaae
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) { public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
this.gameTime = time; this.gameTime = time;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf5ef33db7 100644 index 644a7f020afd26017543056fd9378868b1874fe8..46b9aed8ab46bd4bfdcf44a392ffc34e26da0f5f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -249,7 +249,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -250,7 +250,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean allowFlight; private boolean allowFlight;
@Nullable @Nullable
private String motd; private String motd;
@@ -1061,7 +1061,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
private int playerIdleTimeout; private int playerIdleTimeout;
public final long[] tickTimes; public final long[] tickTimes;
// Paper start // Paper start
@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -296,6 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
//public ConsoleReader reader; // Paper //public ConsoleReader reader; // Paper
public static int currentTick = 0; // Paper - Further improve tick loop public static int currentTick = 0; // Paper - Further improve tick loop
@@ -1069,7 +1069,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
public Commands vanillaCommandDispatcher; public Commands vanillaCommandDispatcher;
@@ -304,10 +305,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -305,10 +306,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static final int TPS = 20; public static final int TPS = 20;
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS; public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
private static final int SAMPLE_INTERVAL = 20; // Paper private static final int SAMPLE_INTERVAL = 20; // Paper
@@ -1083,7 +1083,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
public volatile Thread shutdownThread; // Paper public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper public volatile boolean abnormalExit = false; // Paper
@@ -339,13 +342,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -340,13 +343,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) { public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server"); super("Server");
SERVER = this; // Paper - better singleton SERVER = this; // Paper - better singleton
@@ -1103,7 +1103,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
this.random = RandomSource.create(); this.random = RandomSource.create();
this.port = -1; this.port = -1;
this.levels = Maps.newLinkedHashMap(); this.levels = Maps.newLinkedHashMap();
@@ -926,7 +929,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -927,7 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread(); shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) { if (!isSameThread()) {
@@ -1112,7 +1112,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
while (this.getRunningThread().isAlive()) { while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop(); this.getRunningThread().stop();
try { try {
@@ -936,13 +939,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -937,13 +940,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Paper end // Paper end
// CraftBukkit end // CraftBukkit end
@@ -1136,7 +1136,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();
@@ -1024,6 +1035,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1025,6 +1036,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.safeShutdown(waitForShutdown, false); this.safeShutdown(waitForShutdown, false);
} }
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) { public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
@@ -1145,7 +1145,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
this.isRestarting = isRestarting; this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper this.hasLoggedStop = true; // Paper
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
@@ -1050,6 +1063,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1051,6 +1064,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
private long lastTick = 0; private long lastTick = 0;
private long catchupTime = 0; private long catchupTime = 0;
@@ -1153,7 +1153,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
public final RollingAverage tps1 = new RollingAverage(60); public final RollingAverage tps1 = new RollingAverage(60);
public final RollingAverage tps5 = new RollingAverage(60 * 5); public final RollingAverage tps5 = new RollingAverage(60 * 5);
public final RollingAverage tps15 = new RollingAverage(60 * 15); public final RollingAverage tps15 = new RollingAverage(60 * 15);
@@ -1150,35 +1164,46 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1151,35 +1165,46 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
{ {
final long diff = curTime - tickSection; final long diff = curTime - tickSection;
java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
@@ -1211,7 +1211,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
this.isReady = true; this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime); JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
} }
@@ -1339,7 +1364,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1340,7 +1365,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
@@ -1220,7 +1220,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
super.doRunTask(ticktask); super.doRunTask(ticktask);
} }
@@ -1382,15 +1407,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1383,15 +1408,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {} public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) { public void tickServer(BooleanSupplier shouldKeepTicking) {
@@ -1239,7 +1239,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
// Paper end // Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1406,7 +1431,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1407,7 +1432,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) { if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod; playerSaveInterval = autosavePeriod;
} }
@@ -1248,7 +1248,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0; final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try { try {
this.isSaving = true; this.isSaving = true;
@@ -1421,20 +1446,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1422,20 +1447,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.isSaving = false; this.isSaving = false;
} }
@@ -1273,7 +1273,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
this.averageTickTime = this.averageTickTime * 0.8F + (float) j / 1000000.0F * 0.19999999F; this.averageTickTime = this.averageTickTime * 0.8F + (float) j / 1000000.0F * 0.19999999F;
@@ -1446,9 +1471,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1447,9 +1472,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
tickTimes60s.add(this.tickCount, j); tickTimes60s.add(this.tickCount, j);
// Paper end // Paper end
this.frameTimer.logFrameDuration(k - i); this.frameTimer.logFrameDuration(k - i);
@@ -1285,7 +1285,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
private ServerStatus buildServerStatus() { private ServerStatus buildServerStatus() {
@@ -1480,26 +1505,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1481,26 +1506,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void tickChildren(BooleanSupplier shouldKeepTicking) { public void tickChildren(BooleanSupplier shouldKeepTicking) {
@@ -1321,7 +1321,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates // Paper start - optimize time updates
for (final ServerLevel world : this.getAllLevels()) { for (final ServerLevel world : this.getAllLevels()) {
@@ -1508,7 +1533,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1509,7 +1534,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long worldTime = world.getGameTime(); long worldTime = world.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight); final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : world.players()) { for (Player entityhuman : world.players()) {
@@ -1330,7 +1330,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
continue; continue;
} }
ServerPlayer entityplayer = (ServerPlayer) entityhuman; ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1519,38 +1544,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1520,38 +1545,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
// Paper end // Paper end
@@ -1379,7 +1379,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} catch (Throwable throwable) { } catch (Throwable throwable) {
// Spigot Start // Spigot Start
CrashReport crashreport; CrashReport crashreport;
@@ -1566,33 +1593,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1567,33 +1594,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@@ -1425,7 +1425,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
private void synchronizeTime(ServerLevel world) { private void synchronizeTime(ServerLevel world) {
@@ -1600,7 +1627,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1601,7 +1628,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void forceTimeSynchronization() { public void forceTimeSynchronization() {
@@ -1434,7 +1434,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
Iterator iterator = this.getAllLevels().iterator(); Iterator iterator = this.getAllLevels().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1609,7 +1636,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1610,7 +1637,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.synchronizeTime(worldserver); this.synchronizeTime(worldserver);
} }
@@ -1443,7 +1443,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
public boolean isNetherEnabled() { public boolean isNetherEnabled() {
@@ -1683,7 +1710,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1684,7 +1711,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@@ -1452,7 +1452,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
public SystemReport fillSystemReport(SystemReport details) { public SystemReport fillSystemReport(SystemReport details) {
@@ -1876,17 +1903,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1877,17 +1904,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public net.kyori.adventure.text.Component getComponentMotd() { public net.kyori.adventure.text.Component getComponentMotd() {
@@ -1472,7 +1472,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
public boolean isStopped() { public boolean isStopped() {
@@ -2268,7 +2290,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2269,7 +2291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public ProfilerFiller getProfiler() { public ProfilerFiller getProfiler() {
@@ -1481,7 +1481,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
return this.profiler; return this.profiler;
} }
@@ -2508,7 +2530,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2509,7 +2531,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end // CraftBukkit end
private void startMetricsRecordingTick() { private void startMetricsRecordingTick() {
@@ -1490,7 +1490,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
this.executeBlocking(() -> { this.executeBlocking(() -> {
this.saveDebugReport(path.resolve("server")); this.saveDebugReport(path.resolve("server"));
@@ -2518,40 +2540,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2519,40 +2541,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.willStartRecordingMetrics = false; this.willStartRecordingMetrics = false;
} }
@@ -1543,7 +1543,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
} }
public Path getWorldPath(LevelResource worldSavePath) { public Path getWorldPath(LevelResource worldSavePath) {
@@ -2600,15 +2622,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2601,15 +2623,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public boolean isTimeProfilerRunning() { public boolean isTimeProfilerRunning() {
@@ -1562,7 +1562,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
return EmptyProfileResults.EMPTY; return EmptyProfileResults.EMPTY;
} else { } else {
ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount); ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
@@ -2638,6 +2660,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2641,6 +2663,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
public ChatDecorator getChatDecorator() { public ChatDecorator getChatDecorator() {
@@ -1578,7 +1578,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
// Paper start - moved to ChatPreviewProcessor // Paper start - moved to ChatPreviewProcessor
return ChatDecorator.create((sender, commandSourceStack, message) -> { return ChatDecorator.create((sender, commandSourceStack, message) -> {
final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message); final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message);
@@ -2772,7 +2803,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2775,7 +2806,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return; return;
} }
@@ -1587,7 +1587,7 @@ index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf
try { try {
for (;;) { for (;;) {
boolean moreTasks = this.tickMidTickTasks(); boolean moreTasks = this.tickMidTickTasks();
@@ -2799,7 +2830,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2802,7 +2833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
} finally { } finally {
@@ -1927,7 +1927,7 @@ index 3ce4dbf4eed442d89d6bbc8e4c6a000172041da5..57fdef8b16e1ed9a4693356144b4685b
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c6f5d6756fa0e068a462d9c0ded12e0771abba37..0ae45cf5a084fd412305e8b2f5dabe608b4eb1c1 100644 index 8438354e482b6f892c3344eceff1abd23cfa128a..30d364b385da21544a810a76f436f06879d39b14 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -431,16 +431,16 @@ public class ServerChunkCache extends ChunkSource { @@ -431,16 +431,16 @@ public class ServerChunkCache extends ChunkSource {
@@ -2627,10 +2627,10 @@ index ff2862bf1f511196d1e911e2584262ed728e9a81..43bf3285729ec5cedb3de84f2b606739
} }
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361b48ef1b4 100644 index 1d4d02f26391ac55c7631817f09d05e2769b0d29..8a4be66f967dfd6b57ab542ae9b06c840647486d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -274,6 +274,11 @@ public class ServerPlayer extends Player { @@ -275,6 +275,11 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -2642,7 +2642,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -373,6 +378,7 @@ public class ServerPlayer extends Player { @@ -374,6 +379,7 @@ public class ServerPlayer extends Player {
this.bukkitPickUpLoot = true; this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth(); this.maxHealthCache = this.getMaxHealth();
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -2650,7 +2650,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
} }
// Yes, this doesn't match Vanilla, but it's the best we can do for now. // Yes, this doesn't match Vanilla, but it's the best we can do for now.
@@ -512,6 +518,9 @@ public class ServerPlayer extends Player { @@ -513,6 +519,9 @@ public class ServerPlayer extends Player {
} }
} }
@@ -2660,7 +2660,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
} }
@Override @Override
@@ -578,6 +587,9 @@ public class ServerPlayer extends Player { @@ -579,6 +588,9 @@ public class ServerPlayer extends Player {
} }
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -2670,7 +2670,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
} }
// CraftBukkit start - World fallback code, either respawn location or global spawn // CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -706,6 +718,15 @@ public class ServerPlayer extends Player { @@ -707,6 +719,15 @@ public class ServerPlayer extends Player {
this.trackStartFallingPosition(); this.trackStartFallingPosition();
this.trackEnteredOrExitedLavaOnVehicle(); this.trackEnteredOrExitedLavaOnVehicle();
this.advancements.flushDirty(this); this.advancements.flushDirty(this);
@@ -2686,7 +2686,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
} }
public void doTick() { public void doTick() {
@@ -944,6 +965,7 @@ public class ServerPlayer extends Player { @@ -945,6 +966,7 @@ public class ServerPlayer extends Player {
})); }));
Team scoreboardteambase = this.getTeam(); Team scoreboardteambase = this.getTeam();
@@ -2694,7 +2694,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) { if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) {
if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) { if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent); this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent);
@@ -1045,14 +1067,30 @@ public class ServerPlayer extends Player { @@ -1046,14 +1068,30 @@ public class ServerPlayer extends Player {
} }
@@ -2726,7 +2726,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return false; return false;
} else { } else {
Entity entity = source.getEntity(); Entity entity = source.getEntity();
@@ -1161,7 +1199,7 @@ public class ServerPlayer extends Player { @@ -1162,7 +1200,7 @@ public class ServerPlayer extends Player {
PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver); PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver);
if (shapedetectorshape != null) { if (shapedetectorshape != null) {
@@ -2735,7 +2735,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
worldserver = shapedetectorshape.world; // CraftBukkit worldserver = shapedetectorshape.world; // CraftBukkit
if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit
@@ -1184,8 +1222,8 @@ public class ServerPlayer extends Player { @@ -1185,8 +1223,8 @@ public class ServerPlayer extends Player {
worldserver = ((CraftWorld) exit.getWorld()).getHandle(); worldserver = ((CraftWorld) exit.getWorld()).getHandle();
// CraftBukkit end // CraftBukkit end
@@ -2746,7 +2746,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
if (true) { // CraftBukkit if (true) { // CraftBukkit
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
@@ -1196,6 +1234,7 @@ public class ServerPlayer extends Player { @@ -1197,6 +1235,7 @@ public class ServerPlayer extends Player {
playerlist.sendPlayerPermissionLevel(this); playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved(); this.unsetRemoved();
@@ -2754,7 +2754,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
// CraftBukkit end // CraftBukkit end
this.setLevel(worldserver); this.setLevel(worldserver);
@@ -1203,7 +1242,7 @@ public class ServerPlayer extends Player { @@ -1204,7 +1243,7 @@ public class ServerPlayer extends Player {
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
this.connection.resetPosition(); this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this); worldserver.addDuringPortalTeleport(this);
@@ -2763,7 +2763,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
this.triggerDimensionChangeTriggers(worldserver1); this.triggerDimensionChangeTriggers(worldserver1);
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
playerlist.sendLevelInfo(this, worldserver); playerlist.sendLevelInfo(this, worldserver);
@@ -1232,6 +1271,7 @@ public class ServerPlayer extends Player { @@ -1233,6 +1272,7 @@ public class ServerPlayer extends Player {
} }
// Paper end // Paper end
@@ -2771,7 +2771,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return this; return this;
} }
} }
@@ -1353,7 +1393,7 @@ public class ServerPlayer extends Player { @@ -1354,7 +1394,7 @@ public class ServerPlayer extends Player {
return entitymonster.isPreventingPlayerRest(this); return entitymonster.isPreventingPlayerRest(this);
}); });
@@ -2780,7 +2780,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return Either.left(Player.BedSleepingProblem.NOT_SAFE); return Either.left(Player.BedSleepingProblem.NOT_SAFE);
} }
} }
@@ -1489,6 +1529,7 @@ public class ServerPlayer extends Player { @@ -1490,6 +1530,7 @@ public class ServerPlayer extends Player {
@Override @Override
public void openTextEdit(SignBlockEntity sign) { public void openTextEdit(SignBlockEntity sign) {
@@ -2788,7 +2788,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
sign.setAllowedPlayerEditor(this.getUUID()); sign.setAllowedPlayerEditor(this.getUUID());
this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos())); this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos())); this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
@@ -1715,6 +1756,26 @@ public class ServerPlayer extends Player { @@ -1726,6 +1767,26 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; // CraftBukkit - Added to reset this.lastSentExp = -1; // CraftBukkit - Added to reset
} }
@@ -2815,7 +2815,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
@Override @Override
public void displayClientMessage(Component message, boolean overlay) { public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay); this.sendSystemMessage(message, overlay);
@@ -2014,6 +2075,7 @@ public class ServerPlayer extends Player { @@ -2025,6 +2086,7 @@ public class ServerPlayer extends Player {
} }
public void sendTexturePack(String url, String hash, boolean required, @Nullable Component resourcePackPrompt) { public void sendTexturePack(String url, String hash, boolean required, @Nullable Component resourcePackPrompt) {
@@ -2823,7 +2823,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
this.connection.send(new ClientboundResourcePackPacket(url, hash, required, resourcePackPrompt)); this.connection.send(new ClientboundResourcePackPacket(url, hash, required, resourcePackPrompt));
} }
@@ -2028,8 +2090,63 @@ public class ServerPlayer extends Player { @@ -2039,8 +2101,63 @@ public class ServerPlayer extends Player {
public void resetLastActionTime() { public void resetLastActionTime() {
this.lastActionTime = Util.getMillis(); this.lastActionTime = Util.getMillis();
@@ -2887,7 +2887,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
public ServerStatsCounter getStats() { public ServerStatsCounter getStats() {
return this.stats; return this.stats;
} }
@@ -2490,8 +2607,16 @@ public class ServerPlayer extends Player { @@ -2501,8 +2618,16 @@ public class ServerPlayer extends Player {
@Override @Override
public boolean isImmobile() { public boolean isImmobile() {
@@ -2905,7 +2905,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
@Override @Override
public Scoreboard getScoreboard() { public Scoreboard getScoreboard() {
@@ -2540,4 +2665,50 @@ public class ServerPlayer extends Player { @@ -2551,4 +2676,50 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity(); return (CraftPlayer) super.getBukkitEntity();
} }
// CraftBukkit end // CraftBukkit end
@@ -3026,7 +3026,7 @@ index 877498729c66de9aa6a27c9148f7494d7895615c..acd7468ee3c86d3456e96e4ec3d7e6a4
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get())); Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
hasSetFarWarned = true; hasSetFarWarned = true;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b431b6fc5 100644 index e6e1c46a01961d47a774e34e430c8eacda22d558..dd53bc05595c6ea7afff23f11e0f54e90078684f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3307,7 +3307,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
player.getBukkitEntity().setResourcePackStatus(packStatus); player.getBukkitEntity().setResourcePackStatus(packStatus);
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit
// Paper end // Paper end
@@ -2353,7 +2444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2354,7 +2445,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
do { do {
instant1 = (Instant) this.lastChatTimeStamp.get(); instant1 = (Instant) this.lastChatTimeStamp.get();
if (timestamp.isBefore(instant1)) { if (timestamp.isBefore(instant1)) {
@@ -3316,7 +3316,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
} }
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp)); } while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
@@ -2490,7 +2581,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2491,7 +2582,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} }
// Paper End // Paper End
@@ -3325,7 +3325,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2500,7 +2591,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2501,7 +2592,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@@ -3334,7 +3334,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
return; return;
} }
@@ -2513,7 +2604,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2514,7 +2605,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return; return;
} finally { } finally {
@@ -3343,7 +3343,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
} }
} }
// CraftBukkit end // CraftBukkit end
@@ -2779,6 +2870,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2780,6 +2871,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
AABB axisalignedbb = entity.getBoundingBox(); AABB axisalignedbb = entity.getBoundingBox();
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
@@ -3351,7 +3351,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
packet.dispatch(new ServerboundInteractPacket.Handler() { packet.dispatch(new ServerboundInteractPacket.Handler() {
private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand);
@@ -2792,6 +2884,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2793,6 +2885,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event); ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
@@ -3360,7 +3360,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
// Entity in bucket - SPIGOT-4048 and SPIGOT-6859a // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it. entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it.
@@ -3343,6 +3437,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3344,6 +3438,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} }
} }
@@ -3373,7 +3373,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45; boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -3449,11 +3549,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3450,11 +3550,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
for (int i = 0; i < signText.size(); ++i) { for (int i = 0; i < signText.size(); ++i) {
FilteredText filteredtext = (FilteredText) signText.get(i); FilteredText filteredtext = (FilteredText) signText.get(i);
@@ -3394,7 +3394,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
} }
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -3475,6 +3581,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3476,6 +3582,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) { public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@@ -3411,7 +3411,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime); int i = (int) (Util.getMillis() - this.keepAliveTime);
@@ -3525,6 +3641,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3526,6 +3642,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
@@ -3419,7 +3419,7 @@ index 24d48fb4a63c2db19c7f957ad2260415fe1db9fe..ae3c1bd67c144fe971d4df6df2ca171b
@Override @Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@@ -3549,6 +3666,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3550,6 +3667,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
} }
@@ -4049,7 +4049,7 @@ index 14fab63346d56c72cd7534a04760efd10eef4295..745e792482f61c571e2efbd4200dd1bd
@Override @Override
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e25be74ef0a88541884ad62a4b84219400d5a142..b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe 100644 index 548133e399b5abc4aa83045af87c135a3455b722..3c10c719f6172161a2dcc6592a0a1492e9b3d7c1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager; @@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager;
@@ -5071,7 +5071,7 @@ index 791f672b30f2a4d3b329e2ce0f4fb9c2ca627b01..8d7c33e16f9eaec2120c5aad75172ff6
}); });
} }
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 636e601b004a412d02e5be86e97d489b52c28e1b..141b25060905f598208cb1a39f4c2b2e9f3ef766 100644 index 636e601b004a412d02e5be86e97d489b52c28e1b..8e2274f7dce34e0997356205cf96e46f8d41cca1 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -65,6 +65,7 @@ import net.minecraft.world.item.ProjectileWeaponItem; @@ -65,6 +65,7 @@ import net.minecraft.world.item.ProjectileWeaponItem;
@@ -5212,7 +5212,8 @@ index 636e601b004a412d02e5be86e97d489b52c28e1b..141b25060905f598208cb1a39f4c2b2e
- this.level.getProfiler().pop(); - this.level.getProfiler().pop();
+ //this.level.getProfiler().pop(); // Purpur + //this.level.getProfiler().pop(); // Purpur
} else { } else {
this.level.getProfiler().push("targetSelector"); - this.level.getProfiler().push("targetSelector");
+ //this.level.getProfiler().push("targetSelector"); // Purpur
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
this.targetSelector.tick(); this.targetSelector.tick();
- this.level.getProfiler().pop(); - this.level.getProfiler().pop();
@@ -15118,7 +15119,7 @@ index 5d199fe497bd852827d3d18fb7566a09e70331a3..6cd8a50289a6404441e9e5e08d82d2eb
if (NaturalSpawner.isSpawnPositionOk(SpawnPlacements.Type.ON_GROUND, world, blockposition2, EntityType.WANDERING_TRADER)) { if (NaturalSpawner.isSpawnPositionOk(SpawnPlacements.Type.ON_GROUND, world, blockposition2, EntityType.WANDERING_TRADER)) {
blockposition1 = blockposition2; blockposition1 = blockposition2;
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad5d8bfaac 100644 index 0629c471d38a77c44fc1c86ccdfcb0690f61ca17..d055cfc257cc7282170ba67c848af3e6c5f2ec1f 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -186,6 +186,8 @@ public abstract class Player extends LivingEntity { @@ -186,6 +186,8 @@ public abstract class Player extends LivingEntity {
@@ -15198,7 +15199,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
} }
@Override @Override
@@ -584,7 +624,7 @@ public abstract class Player extends LivingEntity { @@ -590,7 +630,7 @@ public abstract class Player extends LivingEntity {
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
@@ -15207,7 +15208,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
list1.add(entity); list1.add(entity);
} else if (!entity.isRemoved()) { } else if (!entity.isRemoved()) {
this.touch(entity); this.touch(entity);
@@ -1275,7 +1315,7 @@ public abstract class Player extends LivingEntity { @@ -1281,7 +1321,7 @@ public abstract class Player extends LivingEntity {
flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting(); flag2 = flag2 && !this.isSprinting();
if (flag2) { if (flag2) {
@@ -15216,7 +15217,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
} }
f += f1; f += f1;
@@ -1944,9 +1984,19 @@ public abstract class Player extends LivingEntity { @@ -1950,9 +1990,19 @@ public abstract class Player extends LivingEntity {
@Override @Override
public int getExperienceReward() { public int getExperienceReward() {
if (!this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) { if (!this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) {
@@ -15239,7 +15240,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
} else { } else {
return 0; return 0;
} }
@@ -2022,6 +2072,11 @@ public abstract class Player extends LivingEntity { @@ -2028,6 +2078,11 @@ public abstract class Player extends LivingEntity {
return this.inventory.armor; return this.inventory.armor;
} }
@@ -15251,7 +15252,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
public boolean setEntityOnShoulder(CompoundTag entityNbt) { public boolean setEntityOnShoulder(CompoundTag entityNbt) {
if (!this.isPassenger() && this.onGround && !this.isInWater() && !this.isInPowderSnow) { if (!this.isPassenger() && this.onGround && !this.isInWater() && !this.isInPowderSnow) {
if (this.getShoulderEntityLeft().isEmpty()) { if (this.getShoulderEntityLeft().isEmpty()) {
@@ -2305,7 +2360,7 @@ public abstract class Player extends LivingEntity { @@ -2311,7 +2366,7 @@ public abstract class Player extends LivingEntity {
public ItemStack eat(Level world, ItemStack stack) { public ItemStack eat(Level world, ItemStack stack) {
this.getFoodData().eat(stack.getItem(), stack); this.getFoodData().eat(stack.getItem(), stack);
this.awardStat(Stats.ITEM_USED.get(stack.getItem())); this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
@@ -16659,7 +16660,7 @@ index 180aec596110309aade13d2080f8824d152b07cb..c4aec1e5135a79837918b692e75a7b55
return InteractionResult.PASS; return InteractionResult.PASS;
} }
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e526254e35f 100644 index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e3143510f3c7448 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -109,6 +109,7 @@ import org.bukkit.event.world.StructureGrowEvent; @@ -109,6 +109,7 @@ import org.bukkit.event.world.StructureGrowEvent;
@@ -16670,7 +16671,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> { public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
return instance.group(BuiltInRegistries.ITEM.byNameCodec().fieldOf("id").forGetter((itemstack) -> { return instance.group(BuiltInRegistries.ITEM.byNameCodec().fieldOf("id").forGetter((itemstack) -> {
return itemstack.item; return itemstack.item;
@@ -414,6 +415,7 @@ public final class ItemStack { @@ -415,6 +416,7 @@ public final class ItemStack {
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710 world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) { for (BlockState blockstate : blocks) {
blockstate.update(true, false); blockstate.update(true, false);
@@ -16678,7 +16679,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
} }
world.preventPoiUpdated = false; world.preventPoiUpdated = false;
@@ -443,6 +445,7 @@ public final class ItemStack { @@ -444,6 +446,7 @@ public final class ItemStack {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
} }
@@ -16686,7 +16687,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
} }
@@ -558,6 +561,16 @@ public final class ItemStack { @@ -559,6 +562,16 @@ public final class ItemStack {
return this.isDamageableItem() && this.getDamageValue() > 0; return this.isDamageableItem() && this.getDamageValue() > 0;
} }
@@ -16703,7 +16704,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
public int getDamageValue() { public int getDamageValue() {
return this.tag == null ? 0 : this.tag.getInt("Damage"); return this.tag == null ? 0 : this.tag.getInt("Damage");
} }
@@ -577,7 +590,7 @@ public final class ItemStack { @@ -578,7 +591,7 @@ public final class ItemStack {
int j; int j;
if (amount > 0) { if (amount > 0) {
@@ -16712,7 +16713,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
int k = 0; int k = 0;
for (int l = 0; j > 0 && l < amount; ++l) { for (int l = 0; j > 0 && l < amount; ++l) {
@@ -632,6 +645,12 @@ public final class ItemStack { @@ -633,6 +646,12 @@ public final class ItemStack {
if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent
breakCallback.accept(entity); breakCallback.accept(entity);
Item item = this.getItem(); Item item = this.getItem();
@@ -16725,7 +16726,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
// CraftBukkit start - Check for item breaking // CraftBukkit start - Check for item breaking
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) { if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this); org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this);
@@ -1164,7 +1183,7 @@ public final class ItemStack { @@ -1165,7 +1184,7 @@ public final class ItemStack {
ListTag nbttaglist = this.tag.getList("Enchantments", 10); ListTag nbttaglist = this.tag.getList("Enchantments", 10);
@@ -16734,7 +16735,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
processEnchantOrder(this.tag); // Paper processEnchantOrder(this.tag); // Paper
} }
@@ -1172,6 +1191,12 @@ public final class ItemStack { @@ -1173,6 +1192,12 @@ public final class ItemStack {
return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
} }
@@ -17513,7 +17514,7 @@ index 3d2b34c5a7c9b00c1164b4f89c2cbff81fc460eb..b5505e926e5cdb447de68e8eb8e46c97
return true; return true;
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java 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 96434f14525a2159f335b94aad95081f488fadf3..d56bbd43b127a1d663a398b1da7090ff64ab6a6c 100644 index 3aa79a441ac4bd6b4d87d19bdb3011455210fd41..4de8e77ef7574a0febf9c89258e4aeb26f4af6fc 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java --- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -19071,7 +19072,7 @@ index b91effe91dad2e1aeea0ea31140f7432833b343f..bb628bd3fe8b185f356968697b17e1c4
if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) { if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
return; return;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 2a786c9fd29dc2139cf487fa645cd43345d60167..507b3756238ec3054232b805a9b689be6ea12e25 100644 index a3f073066f6e2eea8964461ad2b0409ade202f35..5cd7b4e7065070bf9fcc34b621dba2ccba99a573 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -44,6 +44,7 @@ import net.minecraft.world.level.Level; @@ -44,6 +44,7 @@ import net.minecraft.world.level.Level;
@@ -20681,7 +20682,7 @@ index 4d7a2c4c1001aefe9fcd4be8dbcb414f721bfff9..2c7716a9d65ebda209a144b82c2126b6
+ // Purpur end + // Purpur end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a745cfae8 100644 index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c991ce9636b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -525,10 +525,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -525,10 +525,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -20712,7 +20713,7 @@ index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a
return false; return false;
} }
@@ -2356,6 +2365,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2366,6 +2375,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().getAbilities().walkingSpeed * 2f; return this.getHandle().getAbilities().walkingSpeed * 2f;
} }
@@ -20741,7 +20742,7 @@ index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a
private void validateSpeed(float value) { private void validateSpeed(float value) {
if (value < 0) { if (value < 0) {
if (value < -1f) { if (value < -1f) {
@@ -3148,4 +3179,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3158,4 +3189,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot; return this.spigot;
} }
// Spigot end // Spigot end
@@ -21921,7 +21922,7 @@ index 0000000000000000000000000000000000000000..0bcbe1f07ff8e552d2abd6e432af5710
+} +}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..fe903b1e1bd211651e3808becd34a2d28dc57f34 index 0000000000000000000000000000000000000000..d3f2002759ac4788feca1e62c90c2e64596eb2f2
--- /dev/null --- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -0,0 +1,3189 @@ @@ -0,0 +1,3189 @@
@@ -22050,7 +22051,7 @@ index 0000000000000000000000000000000000000000..fe903b1e1bd211651e3808becd34a2d2
+ public boolean useBetterMending = false; + public boolean useBetterMending = false;
+ public boolean alwaysTameInCreative = false; + public boolean alwaysTameInCreative = false;
+ public boolean boatEjectPlayersOnLand = false; + public boolean boatEjectPlayersOnLand = false;
+ public boolean boatsDoFallDamage = true; + public boolean boatsDoFallDamage = false;
+ public boolean disableDropsOnCrammingDeath = false; + public boolean disableDropsOnCrammingDeath = false;
+ public boolean entitiesCanUsePortals = true; + public boolean entitiesCanUsePortals = true;
+ public boolean entitiesPickUpLootBypassMobGriefing = false; + public boolean entitiesPickUpLootBypassMobGriefing = false;

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 12:08:57 +0900
Subject: [PATCH] Build Fix
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 141b25060905f598208cb1a39f4c2b2e9f3ef766..d67bc2abe9590b1b0b86e450c9fabe5e2237be6c 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -946,7 +946,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.goalSelector.tickRunningGoals(false);
//this.level.getProfiler().pop(); // Purpur
} else {
- this.level.getProfiler().push("targetSelector");
+ //this.level.getProfiler().push("targetSelector"); // Plazma - build fix
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
this.targetSelector.tick();
//this.level.getProfiler().pop(); // Purpur

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f..e4de94641d33b3deadc44bbb5f23f666d79737ea 100644 index 22470f0ab8354a9f31a0f195f3fe80f2f5ee2f0e..dc89b3a8956af69fa71a2bfa17c22aee6c5e9edf 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins { @@ -7,7 +7,7 @@ plugins {
@@ -17,7 +17,7 @@ index 6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f..e4de94641d33b3deadc44bbb5f23f666
implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") // Purpur implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") // Purpur
// Paper start // Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("org.jline:jline-terminal-jansi:3.21.0")
@@ -82,7 +82,7 @@ tasks.jar { @@ -81,7 +81,7 @@ tasks.jar {
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit", "Implementation-Title" to "CraftBukkit",
@@ -175,10 +175,10 @@ index c6fa6bcd66d61359124a8426b919493c6ec43f06..e0eaa847526431ac58d00f18f0fca6b1
/* CraftBukkit start - Replace everything /* CraftBukkit start - Replace everything
OptionParser optionparser = new OptionParser(); OptionParser optionparser = new OptionParser();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5416b64c3000c9b17a78991218e068bf5ef33db7..180ea5edb002856f975c074e319998b68b67a7af 100644 index 46b9aed8ab46bd4bfdcf44a392ffc34e26da0f5f..62ccafc3df9e2d25dbe7e2ad9322f306f8df8061 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -929,7 +929,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -930,7 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread(); shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) { if (!isSameThread()) {

View File

@@ -169,10 +169,10 @@ index f6b9d216c24d8858802f85209fe1a869e5a9be31..746fdd880862e7dd8b53dec99b07ae62
+ // Plazma end + // Plazma end
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 180ea5edb002856f975c074e319998b68b67a7af..6d2d1d99977d33fdd8c9a34b65bbca189852d1c0 100644 index 62ccafc3df9e2d25dbe7e2ad9322f306f8df8061..abf904a1d0dc7a5943cdba540c2b76eb0577954d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -308,6 +308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -309,6 +309,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 4 ]; // Purpur public final double[] recentTps = new double[ 4 ]; // Purpur
// Spigot end // Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
@@ -180,7 +180,7 @@ index 180ea5edb002856f975c074e319998b68b67a7af..6d2d1d99977d33fdd8c9a34b65bbca18
public static long currentTickLong = 0L; // Paper public static long currentTickLong = 0L; // Paper
public boolean lagging = false; // Purpur public boolean lagging = false; // Purpur
protected boolean upnp = false; // Purpur protected boolean upnp = false; // Purpur
@@ -414,6 +415,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -415,6 +416,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end // Paper end
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
this.paperConfigurations = services.paperConfigurations(); // Paper this.paperConfigurations = services.paperConfigurations(); // Paper

View File

@@ -7,56 +7,45 @@ Original: YouHaveTrouble/minecraft-optimization, AkiraDevelopment/SimplyMC
Copyright (C) 2023 YouHaveTrouble, AkiraDevelopment Copyright (C) 2023 YouHaveTrouble, AkiraDevelopment
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index c0f44f0593aab16d5ceab493f4075772f454732e..7aa260293a12c0b9b9efcd2d8bc470fb06a32cf1 100644 index 62b2a3a44929b80b813bc24a33cd1f5049fecbb2..cea33db916f9fd828f3cb131a4b2ebdd16866649 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -72,7 +72,7 @@ public class PufferfishConfig { @@ -211,7 +211,7 @@ public class PufferfishConfig {
getString("info.version", "1.0"); public static int maxProjectileLoadsPerTick;
setComment("info",
"Pufferfish Configuration",
- "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host",
+ //"Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", // Plazma
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
@@ -220,7 +220,7 @@ public class PufferfishConfig {
public static int maxProjectileLoadsPerProjectile; public static int maxProjectileLoadsPerProjectile;
private static void projectileLoading() { private static void projectileLoading() {
maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); - maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
- maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); + maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10 : 8, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma
+ maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10 : 8, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); // Plazma - Optimize Default Configurations maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
setComment("projectile", "Optimizes projectile settings"); setComment("projectile", "Optimizes projectile settings");
} @@ -225,7 +225,7 @@ public class PufferfishConfig {
@@ -233,7 +233,7 @@ public class PufferfishConfig {
public static int activationDistanceMod; public static int activationDistanceMod;
private static void dynamicActivationOfBrains() throws IOException { private static void dynamicActivationOfBrains() throws IOException {
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur - dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", !Boolean.getBoolean("Plazma.disableConfigOptimization")); // Purpur // Plazma - Optimize Default Configurations + dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", !Boolean.getBoolean("Plazma.disableConfigOptimization")); // Purpur // Plazma
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
"This value determines how far away an entity has to be", "This value determines how far away an entity has to be",
"from the player to start being effected by DEAR."); "from the player to start being effected by DEAR.");
@@ -241,7 +241,7 @@ public class PufferfishConfig { @@ -233,7 +233,7 @@ public class PufferfishConfig {
maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
"This value defines how often in ticks, the furthest entity", "This value defines how often in ticks, the furthest entity",
"will get their pathfinders and behaviors ticked. 20 = 1s"); "will get their pathfinders and behaviors ticked. 20 = 1s");
- activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, - activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
+ activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 7, // Plazma - Optimize Default Configurations + activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 7, // Plazma
"This value defines how much distance modifies an entity's", "This value defines how much distance modifies an entity's",
"tick frequency. freq = (distanceToPlayer^2) / (2^value)", "tick frequency. freq = (distanceToPlayer^2) / (2^value)",
"If you want further away entities to tick less often, use 7.", "If you want further away entities to tick less often, use 7.",
@@ -277,7 +277,7 @@ public class PufferfishConfig { @@ -269,16 +269,16 @@ public class PufferfishConfig {
public static boolean throttleInactiveGoalSelectorTick; public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() { private static void inactiveGoalSelectorThrottle() {
- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur - getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", !Boolean.getBoolean("Plazma.disableConfigOptimization"), // Purpur // Plazma - Optimize Default Configurations + getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", !Boolean.getBoolean("Plazma.disableConfigOptimization"), // Purpur // Plazma
"Throttles the AI goal selector in entity inactive ticks.", "Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications."); "This can improve performance by a few percent, but has minor gameplay implications.");
} }
@@ -307,10 +307,10 @@ public class PufferfishConfig {
}
- public static boolean disableMethodProfiler; - public static boolean disableMethodProfiler;
@@ -339,7 +328,7 @@ index ac238eeea791180b66677870401c0b756f0db07b..ce960bc620d84e56c4e7fc9b721fd45c
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
} }
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index fe903b1e1bd211651e3808becd34a2d28dc57f34..bd87af1ebde124ba405d3e1d1698b78724e112c4 100644 index d3f2002759ac4788feca1e62c90c2e64596eb2f2..47f2c8f23e318b89324bfcb1342dadc325f53afc 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -425,7 +425,7 @@ public class PurpurWorldConfig { @@ -425,7 +425,7 @@ public class PurpurWorldConfig {

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com> From: IPECTER <ipectert@gmail.com>
Date: Thu, 23 Mar 2023 14:25:09 +0900 Date: Thu, 23 Mar 2023 14:25:09 +0900
Subject: [PATCH] Implement ChunkSending - Configuration Subject: [PATCH] ChunkSending Configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java

View File

@@ -33,10 +33,10 @@ index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..7f749579fe056a8436e6625204ae31f1
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 74238a87d1ff3391aac5812b24b84af228baeaa4..3d900e323e1e11b56ad2a7d8f8ebcb71c069cfe0 100644 index 8a4be66f967dfd6b57ab542ae9b06c840647486d..29c46144de1aad31b997ee5000114e6f33f1a1f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -727,8 +727,36 @@ public class ServerPlayer extends Player { @@ -728,8 +728,36 @@ public class ServerPlayer extends Player {
} }
} }
// Purpur end // Purpur end
@@ -73,7 +73,7 @@ index 74238a87d1ff3391aac5812b24b84af228baeaa4..3d900e323e1e11b56ad2a7d8f8ebcb71
public void doTick() { public void doTick() {
try { try {
if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn) if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
@@ -2345,7 +2373,14 @@ public class ServerPlayer extends Player { @@ -2356,7 +2384,14 @@ public class ServerPlayer extends Player {
return true; // Paper return true; // Paper
} }

View File

@@ -117,7 +117,7 @@ index aadc6743deb195ac3368548a75be641ffd3da404..90314f86e17ac7756f8211519fc5cde5
protected PathNavigation createNavigation(Level world) { protected PathNavigation createNavigation(Level world) {
return new WaterBoundPathNavigation(this, world); return new WaterBoundPathNavigation(this, world);
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 0c5efd0b364e4c1f510d30094757ddb7dc979a68..304de4844e822431e41ce685ed94e5307612482b 100644 index 6e7c0e95b27c41bf12da1beb3458830ce27c6029..24de1e98661541f36715c59de1487959fb53b4db 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -108,6 +108,18 @@ public class Sniffer extends Animal { @@ -108,6 +108,18 @@ public class Sniffer extends Animal {
@@ -210,7 +210,7 @@ index ce960bc620d84e56c4e7fc9b721fd45c4cfc4dac..57534bdf23b8373078a5f39c930cdb1d
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27); org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows); enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index bd87af1ebde124ba405d3e1d1698b78724e112c4..26db2140458405eb93997c784b3a47b161804007 100644 index 47f2c8f23e318b89324bfcb1342dadc325f53afc..eae616d7b0a318253725ef5bd3891f34b9d9b493 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1084,7 +1084,15 @@ public class PurpurWorldConfig { @@ -1084,7 +1084,15 @@ public class PurpurWorldConfig {

View File

@@ -18,10 +18,10 @@ index 591163d8f8300b084ac734800efee902c4def958..d74401ca3182145d136ad668704f5c04
double d1 = (double) (center.y - maxRange); double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange); double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c79e2b5160c41ce77ebd5355aebcefb3cb9151ca..735655847f75584a985c896637f47c2481b0cae6 100644 index 29c46144de1aad31b997ee5000114e6f33f1a1f7..c6d860687f6a1c286c286bb64ac4eed75a88f0c4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -402,7 +402,7 @@ public class ServerPlayer extends Player { @@ -403,7 +403,7 @@ public class ServerPlayer extends Player {
long l = k * k; long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1); int j1 = this.getCoprime(i1);
@@ -30,7 +30,7 @@ index c79e2b5160c41ce77ebd5355aebcefb3cb9151ca..735655847f75584a985c896637f47c24
for (int l1 = 0; l1 < i1; ++l1) { for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1; int i2 = (k1 + j1 * l1) % i1;
@@ -439,7 +439,7 @@ public class ServerPlayer extends Player { @@ -440,7 +440,7 @@ public class ServerPlayer extends Player {
long l = k * k; long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1); int j1 = this.getCoprime(i1);

View File

@@ -10,7 +10,7 @@ Subject: [PATCH] Various Optimizations
0011 - Swaps the predicate order of collision (Akarin) 0011 - Swaps the predicate order of collision (Akarin)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe..d6e20ebb1e07da767f6571bbaf0dc882cdf4503f 100644 index 3c10c719f6172161a2dcc6592a0a1492e9b3d7c1..d64f188257c135e2a4af07e28ff8f912c80eac03 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1991,8 +1991,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1991,8 +1991,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@@ -18,10 +18,10 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..7e7a4d872983cd2efdc575bc33353f94
private long lastFill = -1; private long lastFill = -1;
private long nextRefill = -1; private long nextRefill = -1;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6d2d1d99977d33fdd8c9a34b65bbca189852d1c0..6e2713a2f3c30a09f54bab4d0746d84dad66be2e 100644 index abf904a1d0dc7a5943cdba540c2b76eb0577954d..62507bb72288a01f15068aaaee5ae40f0655112c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -693,7 +693,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -694,7 +694,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ChunkPos chunkcoordintpair = new ChunkPos(chunkproviderserver.randomState().sampler().findSpawnPosition()); ChunkPos chunkcoordintpair = new ChunkPos(chunkproviderserver.randomState().sampler().findSpawnPosition());
// CraftBukkit start // CraftBukkit start
if (world.generator != null) { if (world.generator != null) {

View File

@@ -71,10 +71,10 @@ index efcee39cd7154493de04ca903edbd32b5901b191..a398b71c52817bd68a05613ec037ed6d
protected boolean convertOldUsers() { protected boolean convertOldUsers() {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index dee076d1e6e30f108a79565546182b4751737baa..c18f953950fd2c00a3880fa20c9904a940191666 100644 index d40ef5f2961a13572705a0fff8a5e0e9ab6a67bd..b2043528c3cfe1078b5d732cbbea8fbe2f4b5a2c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2224,10 +2224,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2225,10 +2225,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void send(Packet<?> packet) { public void send(Packet<?> packet) {

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Sun, 26 Mar 2023 16:20:13 +0900
Subject: [PATCH] FixMySpawnR Configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 7a585540c72c1c18ddcb45ec1caa350f1f9ce544..088670ec016514b4a7fae402d7119a6aaa491c5d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -62,4 +62,12 @@ public class GlobalConfiguration extends ConfigurationPart {
}
}
+
+ public FixMySpawnR fixMySpawnR;
+ public class FixMySpawnR extends ConfigurationPart {
+
+ public boolean enabled = DO_OPTIMIZE;
+ public int timerTimeOut = 0;
+
+ }
}

View File

@@ -0,0 +1,67 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Sun, 26 Mar 2023 13:17:24 +0900
Subject: [PATCH] Implement FixMySpawnR
Original: AbsolemJackdaw/FixMySpawnR
Copyright (C) 2023 AbsolemJackdaw
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index feb65fc9ee04141fe6f77400660442ed207547a1..9c759e71ef1d119d7807886f9e56b7230a334475 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -46,6 +46,8 @@ public abstract class BaseSpawner {
public int requiredPlayerRange = 16;
public int spawnRange = 4;
private int tickDelay = 0; // Paper
+ private int blockExistsTick = 0; // Plazma
+ private boolean blockLockedByTime = false; // Plazma
public BaseSpawner() {}
@@ -81,6 +83,18 @@ public abstract class BaseSpawner {
}
public void serverTick(ServerLevel world, BlockPos pos) {
+ // Plazma start - FixMySpawnR
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().fixMySpawnR.enabled) {
+ if (!blockLockedByTime) {
+ if (blockExistsTick > org.plazmamc.plazma.configurations.GlobalConfiguration.get().fixMySpawnR.timerTimeOut) {
+ blockLockedByTime = true;
+ } else {
+ blockExistsTick++;
+ }
+ }
+ }
+ if (blockLockedByTime && world.getBestNeighborSignal(pos) > 0) return;
+ // Plazma end
if (spawnCount <= 0 || maxNearbyEntities <= 0) return; // Paper - Ignore impossible spawn tick
// Paper start - Configurable mob spawner tick rate
if (spawnDelay > 0 && --tickDelay > 0) return;
@@ -292,6 +306,13 @@ public abstract class BaseSpawner {
this.spawnRange = nbt.getShort("SpawnRange");
}
+ // Plazma start - FixMySpawnR
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().fixMySpawnR.enabled && nbt.contains("SpawnRange", 99)) {
+ this.blockExistsTick = nbt.getInt("fixmyspawnrTicks");
+ this.blockLockedByTime = nbt.getBoolean("fixMySpawnerLocked");
+ }
+ // Plazma end
+
this.displayEntity = null;
}
@@ -321,6 +342,12 @@ public abstract class BaseSpawner {
}
nbt.put("SpawnPotentials", (Tag) SpawnData.LIST_CODEC.encodeStart(NbtOps.INSTANCE, this.spawnPotentials).result().orElseThrow());
+ // Plazma start - FixMySpawnR
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().fixMySpawnR.enabled) {
+ nbt.putInt("fixmyspawnrTicks", blockExistsTick);
+ nbt.putBoolean("fixMySpawnerLocked", blockLockedByTime);
+ }
+ // Plazma end
return nbt;
}

View File

@@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Tue, 28 Mar 2023 12:42:17 +0900
Subject: [PATCH] Implement MemoryLeakFix
Original: fxmorin/MemoryLeakFix
Copyright (C) 2023 fxmorin
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..2bddcaf8762ee7834c32622402a976bfad12d127 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -67,7 +67,7 @@ public final class Biome {
private final MobSpawnSettings mobSettings;
private final BiomeSpecialEffects specialEffects;
// Pufferfish start - use our cache
- private final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> {
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> { // Plazma - MemoryLeakFix
return Util.make(() -> {
/*
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
@@ -125,7 +125,7 @@ public final class Biome {
public float getTemperature(BlockPos blockPos) {
long l = blockPos.asLong();
// Pufferfish start
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - MemoryLeakFix
float f = cache.getValue(l);
if (!Float.isNaN(f)) {
return f;