Rebuild patches

This commit is contained in:
Toffikk 2021-06-16 19:58:18 +02:00
parent b41035f835
commit 9f5d2f38e8
71 changed files with 140 additions and 139 deletions

View File

@ -3,6 +3,7 @@ From: tr7zw <tr7zw@live.de>
Date: Sat, 1 Aug 2020 15:52:50 -0500
Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/build.gradle.kts b/build.gradle.kts
index 6d04816e22f44a33c001d2b7e080402fba6af86c..dffd42fa0862a04fbb63dbc2c378d41eac2aafb5 100644
--- a/build.gradle.kts
@ -17,7 +18,7 @@ index 6d04816e22f44a33c001d2b7e080402fba6af86c..dffd42fa0862a04fbb63dbc2c378d41e
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
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
index 0000000000000000000000000000000000000000..f96afc8f1b04f4bf46a2acbca95ebcfebfa01182
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java
@@ -0,0 +1,51 @@

View File

@ -1,138 +1,138 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YatopiaMC <yatopiamc@gmail.com>
Date: Fri, 23 Oct 2020 09:20:01 -0700
Subject: [PATCH] Utilities
This patch includes all utilities required by the Yatopia project and its patches.
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 494297e5bed54f7cf41711032391fce991d5efa8..80a2ba2fe63ad6fd6e83f46cd29b4cabe64023b0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,6 +37,7 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.14.1") // Paper
implementation("org.ow2.asm:asm:9.1")
+ implementation("org.apache.commons:commons-rng-core:1.3")
implementation("com.googlecode.json-simple:json-simple:1.1.1") {
// This includes junit transitively for whatever reason
isTransitive = false
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java b/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java
new file mode 100644
index 0000000000000000000000000000000000000000..ac5235155eb1b5515165fc9648b7c9d7a0713b44
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java
@@ -0,0 +1,7 @@
+package org.yatopiamc.yatopia.server.util;
+
+public class Constants {
+
+ public static final int[] EMPTY_ARRAY = new int[0];
+ public static final int[] ZERO_ARRAY = new int[]{0};
+}
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java b/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..e41c1e3fa656d8f595733897ab05089c3b0976a7
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java
@@ -0,0 +1,64 @@
+package org.yatopiamc.yatopia.server.util;
+
+import org.apache.commons.rng.core.source64.XoRoShiRo128PlusPlus;
+
+import java.util.Random;
+import java.util.SplittableRandom;
+
+public class FastRandom extends Random {
+
+ private XoRoShiRo128PlusPlus random;
+
+ public FastRandom() {
+ super();
+ SplittableRandom randomseed = new SplittableRandom();
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ public FastRandom(long seed) {
+ super(seed);
+ SplittableRandom randomseed = new SplittableRandom(seed);
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ @Override
+ public boolean nextBoolean() {
+ return random.nextBoolean();
+ }
+
+ @Override
+ public int nextInt() {
+ return random.nextInt();
+ }
+
+ @Override
+ public float nextFloat() {
+ return (float) random.nextDouble();
+ }
+
+ @Override
+ public double nextDouble() {
+ return random.nextDouble();
+ }
+
+ @Override
+ public synchronized void setSeed(long seed) {
+ SplittableRandom randomseed = new SplittableRandom(seed);
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ @Override
+ public void nextBytes(byte[] bytes) {
+ random.nextBytes(bytes);
+ }
+
+ @Override
+ public int nextInt(int bound) {
+ return random.nextInt(bound);
+ }
+
+ @Override
+ public long nextLong() {
+ return random.nextLong();
+ }
+}
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..acdf3d60738791b767a3bafa2c9511342a8c18df
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java
@@ -0,0 +1,27 @@
+package org.yatopiamc.yatopia.server.util;
+
+import java.util.concurrent.TimeUnit;
+
+public class TimeUtils {
+
+ public static String getFriendlyName(TimeUnit unit) {
+ switch (unit) {
+ case NANOSECONDS:
+ return "ns";
+ case MILLISECONDS:
+ return "ms";
+ case MICROSECONDS:
+ return "micros";
+ case SECONDS:
+ return "s";
+ case MINUTES:
+ return "m";
+ case DAYS:
+ return "d";
+ case HOURS:
+ return "h";
+ default:
+ throw new AssertionError();
+ }
+ }
+}
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YatopiaMC <yatopiamc@gmail.com>
Date: Fri, 23 Oct 2020 09:20:01 -0700
Subject: [PATCH] Utilities
This patch includes all utilities required by the Yatopia project and its patches.
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 494297e5bed54f7cf41711032391fce991d5efa8..80a2ba2fe63ad6fd6e83f46cd29b4cabe64023b0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,6 +37,7 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.14.1") // Paper
implementation("org.ow2.asm:asm:9.1")
+ implementation("org.apache.commons:commons-rng-core:1.3")
implementation("com.googlecode.json-simple:json-simple:1.1.1") {
// This includes junit transitively for whatever reason
isTransitive = false
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java b/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java
new file mode 100644
index 0000000000000000000000000000000000000000..ac5235155eb1b5515165fc9648b7c9d7a0713b44
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java
@@ -0,0 +1,7 @@
+package org.yatopiamc.yatopia.server.util;
+
+public class Constants {
+
+ public static final int[] EMPTY_ARRAY = new int[0];
+ public static final int[] ZERO_ARRAY = new int[]{0};
+}
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java b/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..e41c1e3fa656d8f595733897ab05089c3b0976a7
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/FastRandom.java
@@ -0,0 +1,64 @@
+package org.yatopiamc.yatopia.server.util;
+
+import org.apache.commons.rng.core.source64.XoRoShiRo128PlusPlus;
+
+import java.util.Random;
+import java.util.SplittableRandom;
+
+public class FastRandom extends Random {
+
+ private XoRoShiRo128PlusPlus random;
+
+ public FastRandom() {
+ super();
+ SplittableRandom randomseed = new SplittableRandom();
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ public FastRandom(long seed) {
+ super(seed);
+ SplittableRandom randomseed = new SplittableRandom(seed);
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ @Override
+ public boolean nextBoolean() {
+ return random.nextBoolean();
+ }
+
+ @Override
+ public int nextInt() {
+ return random.nextInt();
+ }
+
+ @Override
+ public float nextFloat() {
+ return (float) random.nextDouble();
+ }
+
+ @Override
+ public double nextDouble() {
+ return random.nextDouble();
+ }
+
+ @Override
+ public synchronized void setSeed(long seed) {
+ SplittableRandom randomseed = new SplittableRandom(seed);
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
+ }
+
+ @Override
+ public void nextBytes(byte[] bytes) {
+ random.nextBytes(bytes);
+ }
+
+ @Override
+ public int nextInt(int bound) {
+ return random.nextInt(bound);
+ }
+
+ @Override
+ public long nextLong() {
+ return random.nextLong();
+ }
+}
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..acdf3d60738791b767a3bafa2c9511342a8c18df
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/util/TimeUtils.java
@@ -0,0 +1,27 @@
+package org.yatopiamc.yatopia.server.util;
+
+import java.util.concurrent.TimeUnit;
+
+public class TimeUtils {
+
+ public static String getFriendlyName(TimeUnit unit) {
+ switch (unit) {
+ case NANOSECONDS:
+ return "ns";
+ case MILLISECONDS:
+ return "ms";
+ case MICROSECONDS:
+ return "micros";
+ case SECONDS:
+ return "s";
+ case MINUTES:
+ return "m";
+ case DAYS:
+ return "d";
+ case HOURS:
+ return "h";
+ default:
+ throw new AssertionError();
+ }
+ }
+}