ported two api patches

This commit is contained in:
Toffikk 2021-06-16 19:24:55 +02:00
parent 0b1fe8e29b
commit 7eaa58bca3
8 changed files with 56 additions and 196 deletions

View File

@ -1,16 +0,0 @@
# Patches
<!---
This file is autogenerated! Modify the .template.md to make changes!
--->
This is an overview of all the patches that are currently used.
| Side | Patch | Author | CoAuthors |
| ----- | ------------- |:-------------:| -----:|
{{#patches}}
| {{parent}} | {{subject}} | {{from}} | {{#getCoAuthorString}}{{/getCoAuthorString}} |
{{/patches}}
implementation(project(":Yatopia-API"))
implementation("com.destroystokyo.paper:paper-mojangapi:1.16.5-R0.1-SNAPSHOT") // Yatopia

View File

@ -4,4 +4,5 @@
# both fully qualified and a file based syntax are accepted for <fileName>:
# authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
# datafixerupper com.mojang.datafixers.DataFixerBuilder
# datafixerupper com/mojang/datafixers/util/Either.java
# datafixerupper com/mojang/datafixers/util/Either.java
authlib com.mojang.authlib.GameProfile

View File

@ -3,7 +3,7 @@
group=org.yatopiamc.yatopia
version=1.17-R0.1-SNAPSHOT
packageVersion=1_17_R1
paperCommit=2b8d06aed3a19559785c8956d672a9f8a50ca267
paperCommit=05623c47ec541cdc17bd9ba390608a1c9ea07bea
# Gradle
@ -12,4 +12,5 @@ org.gradle.jvmargs=-Xms1G -Xmx3G
org.gradle.parallel=true
kotlin.parallel.tasks.in.project=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configureondemand=true
org.gradle.vfs.watch=false # causes too much issues

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Yatopia Config & Redirect Config
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0f66655541dbb0dbb05a13a3612bb46cfb2b538a..a69bf7aae1e9d6b658b079431d23ca0f28c871d1 100644
index e88b47a838dc472ad64271a518ee1789f7be19fa..a69bf7aae1e9d6b658b079431d23ca0f28c871d1 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1618,6 +1618,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1606,6 +1606,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Purpur end
// Paper end
+ // Origami start - add config to timings report
+ @NotNull

View File

@ -4,42 +4,13 @@ Date: Sat, 1 Aug 2020 15:52:50 -0500
Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/pom.xml b/pom.xml
index 57f8d001e6a83ea6ada0fb820a4e5b25866c0edb..f0ef93cb0c1d369265b2a6fc56c80f79d61d4ebc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
+ <repository>
+ <id>mojang</id>
+ <url>https://libraries.minecraft.net/</url>
+ </repository>
</repositories>
<!-- Paper start -->
@@ -60,6 +64,13 @@
<!-- Paper end -->
<dependencies>
+ <!-- Authlib for Gameprofiles -->
+ <dependency>
+ <groupId>com.mojang</groupId>
+ <artifactId>authlib</artifactId>
+ <version>1.5.25</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Paper start -->
<dependency>
<groupId>net.kyori</groupId>
diff --git a/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java
diff --git a/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java b/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..313fe42442a93db76f91eaab50a345340f314fa8
--- /dev/null
+++ b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java
@@ -0,0 +1,51 @@
+package dev.tr7zw.yatopia.events;
+package org.yatopiamc.yatopia.server.events;
+
+import com.mojang.authlib.GameProfile;
+import java.util.UUID;

View File

@ -1,96 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YatopiaMC <yatopiamc@gmail.com>
Date: Sat, 1 Aug 2020 15:51:49 -0500
Subject: [PATCH] Modify POM
diff --git a/pom.xml b/pom.xml
index 6fd6066b16d4dbf8695be16ec8b2d135d4d04901..57f8d001e6a83ea6ada0fb820a4e5b25866c0edb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,18 +3,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>com.tuinity</groupId>
- <artifactId>tuinity-parent</artifactId>
+ <groupId>org.yatopiamc</groupId>
+ <artifactId>yatopia-parent</artifactId>
<version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>tuinity-api</artifactId>
+ <artifactId>yatopia-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Tuinity-API</name>
- <url>https://github.com/Spottedleaf/Tuinity</url>
+ <name>Yatopia-API</name>
+ <url>https://github.com/YatopiaMC/Yatopia</url>
<description>An enhanced plugin API for Minecraft servers.</description>
<properties>
@@ -25,6 +25,19 @@
<adventure.version>4.7.0</adventure.version> <!-- Paper - When updating this make sure to update the linked JavaDocs on the homepage as well! -->
</properties>
+ <!-- Yatopia start -->
+ <distributionManagement>
+ <repository>
+ <id>codemc-releases</id>
+ <url>https://repo.codemc.io/repository/maven-releases/</url>
+ </repository>
+ <snapshotRepository>
+ <id>codemc-snapshots</id>
+ <url>https://repo.codemc.io/repository/maven-snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <!-- Yatopia end -->
+
<repositories>
<repository>
<id>sonatype</id>
@@ -68,7 +81,7 @@
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
- <version>8.2.2</version>
+ <version>8.5.4</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -115,7 +128,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.27</version>
+ <version>1.28</version>
<scope>compile</scope>
</dependency>
<!-- not part of the API proper -->
@@ -148,7 +161,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
+ <version>1.7.30</version>
<scope>compile</scope>
</dependency>
<!-- testing -->
@@ -174,12 +187,12 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>9.0</version>
+ <version>9.1</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
- <version>9.0</version>
+ <version>9.1</version>
</dependency>
</dependencies>

View File

@ -5,60 +5,59 @@ Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
index 3d9452892a4077e64f37424052a9e52d76dd7a6d..7e88d332b3f31e49935ce7d9f99d447c9427769e 100644
index ef6aab69daa7ab952408b573bff6c6996cbc349a..7e88d332b3f31e49935ce7d9f99d447c9427769e 100644
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -187,13 +187,24 @@ public class CraftPlayerProfile implements PlayerProfile {
@@ -189,13 +189,24 @@ public class CraftPlayerProfile implements PlayerProfile {
boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
- GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true);
- GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
- if (result != null) {
- copyProfileProperties(result, this.profile, true);
- }
- if (this.profile.isComplete()) {
- server.getUserCache().saveProfile(this.profile);
- server.getProfileCache().add(this.profile);
+ // Yatopia start
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent event = new
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent(
+ org.yatopiamc.yatopia.server.events.GameProfileLookupEvent event = new
+ org.yatopiamc.yatopia.server.events.GameProfileLookupEvent(
+ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ GameProfile eventProfile = event.getGameProfile();
+ if (eventProfile != null) {
+ this.profile = eventProfile;
+ } else {
+ GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true);
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
+ if (result != null) {
+ copyProfileProperties(result, this.profile, true);
+ }
+ if (this.profile.isComplete()) {
+ server.getUserCache().saveProfile(this.profile);
+ server.getProfileCache().add(this.profile);
+ }
}
+ // Yatopia end
}
return profile.isComplete() && (!onlineMode || !textures || hasTextures());
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
index 4f7c014fa609a39cac651ccc6d3397d7edb77d8d..fe9238ecc0f3a4948f5867fcae4fe64c9142a98e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
@@ -87,7 +87,18 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index f0192a009f6a21d1781ce709624a9187048d9a08..fe9238ecc0f3a4948f5867fcae4fe64c9142a98e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -150,7 +150,19 @@ public class SkullBlockEntity extends BlockEntity {
if ( property == null )
{
+ // Yatopia start
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent event =
+ new dev.tr7zw.yatopia.events.GameProfileLookupEvent(
if (property == null) {
- gameprofile1 = SkullBlockEntity.sessionService.fillProfileProperties(gameprofile1, true);
- }
+ // Yatopia start - add GameProfileLookupEvent
+ org.yatopiamc.yatopia.server.events.GameProfileLookupEvent event =
+ new org.yatopiamc.yatopia.server.events.GameProfileLookupEvent(
+ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ GameProfile eventProfile = event.getGameProfile();
+ if (eventProfile != null) {
+ if (eventProfile != null) {
+ profile = eventProfile;
+ } else {
profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
+ }
+ // Yatopia end
}
}
+ gameprofile1 = SkullBlockEntity.sessionService.fillProfileProperties(gameprofile1, true);
+ }
+ // Yatopia end - add GameProfileLookupEvent

View File

@ -7,57 +7,56 @@ Original patch by:
Co-authored-by: tr7zw <tr7zw@live.de>
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3f33301c3349c1c04b869a001120d03697afae8d..08d4a2ef671ff750305df9d4c0cac0f2e9c89006 100644
index 893a992156efb7b01b13efe9637704ac99c19baa..08d4a2ef671ff750305df9d4c0cac0f2e9c89006 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1068,6 +1068,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1112,6 +1112,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End
// Spigot End
+ public static java.time.Duration lastTickTime = java.time.Duration.ZERO; // Yatopia
+
protected void w() {
protected void runServer() {
try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
long serverStartTime = Util.getNanos(); // Paper
@@ -1139,7 +1141,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick);
this.methodProfiler.a();
this.methodProfiler.enter("tick");
this.nextTickTime += 50L;
this.startMetricsRecordingTick();
this.profiler.push("tick");
+ long tickStart = System.nanoTime(); // Yatopia
this.a(this::canSleepForTick);
this.tickServer(this::haveTime);
+ lastTickTime = java.time.Duration.ofNanos(System.nanoTime() - tickStart); // Yatopia
this.methodProfiler.exitEnter("nextTickWait");
this.X = true;
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
// Purpur start - tps catchup
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3bf0e295f7e9a3593789f513863dabaf35f17281..1f7a592aa8e76d0ff4cb6391f1c0b8a8e85c427d 100644
index 5c85cdb4ef4ffeebdadf01a4ad4a23801bd3fdca..1f7a592aa8e76d0ff4cb6391f1c0b8a8e85c427d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2569,4 +2569,6 @@ public final class CraftServer implements Server {
return getServer().lagging;
}
// Purpur end
@@ -2523,4 +2523,6 @@ public final class CraftServer implements Server {
// Paper end
+
+ @Override public java.time.Duration getLastTickTime() { return net.minecraft.server.MinecraftServer.lastTickTime; } // Yatopia
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 312248b5c6febc6a3c10940714fac7fbc3c53b7f..abc9b7aa53e554ef2196dceafe8db8ba65f34e84 100644
index 9bede6a26c08ede063c7a38f1149c811df14b258..abc9b7aa53e554ef2196dceafe8db8ba65f34e84 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -32,6 +32,10 @@ public class TicksPerSecondCommand extends Command
tpsAvg[i] = format( tps[i] );
tpsAvg[i] = TicksPerSecondCommand.format( tps[i] );
}
sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
sender.sendMessage(ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Yatopia
+ // Yatopia start
+ java.time.Duration lastTickTime = org.bukkit.Bukkit.getLastTickTime();
+ sender.sendMessage(ChatColor.GOLD + "Last tick: " + formatTo( lastTickTime, java.util.concurrent.TimeUnit.MILLISECONDS ) + " (" + formatTo( lastTickTime, java.util.concurrent.TimeUnit.NANOSECONDS ) + ")");
+ sender.sendMessage(ChatColor.GOLD + "Last tick: " + TicksPerSecondCommand.formatTo( lastTickTime, java.util.concurrent.TimeUnit.MILLISECONDS ) + " (" + formatTo( lastTickTime, java.util.concurrent.TimeUnit.NANOSECONDS ) + ")");
+ // Yatopia end
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
if (!hasShownMemoryWarning) {
@@ -50,4 +54,16 @@ public class TicksPerSecondCommand extends Command
@@ -50,4 +50,16 @@ public class TicksPerSecondCommand extends Command
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
+
+ // Yatopia start
@ -72,3 +71,4 @@ index 312248b5c6febc6a3c10940714fac7fbc3c53b7f..abc9b7aa53e554ef2196dceafe8db8ba
+ }
+ // Yatopia end
}