mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-01 15:13:24 +01:00
4da7b3aefc
Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 3e77330 Updated Upstream (Paper) EMC Changes: e45a78e4 Update the API as well - setTargetRange to Double where null is default FOLLOW_RANGE 9fc6891d Default target range to the follow range a1e2e2a3 Fix an issue with players in vehicles in vehicles desyncing b6e2f202 Add a Dead vehicle reason to VehicleExitEvent 72b0da43 Use the correct entity local variable ad32d0d6 Fix bug with entity passengers not executing entity tasks 194aaafb Updated Paper cb3a7bb7 Always convert Lore/Name of an item to ensure consistency 6c63538d Revert "Updated Paper" 8837d5a9 Limit fortress spawns to the nether 005cdda9 Updated Paper 1476d693 Fix Lore comparisons to use legacy format 588f30f9 Quick fix the rcon log issue for now 475e626a Fix World Meta loading 3ad5f8a7 Remove RCON Thread Logs 7f3c4a25 Fix dismounting from vehicle when teleporting cross dimension 595bd307 Prevent NPE for PathfinderGoalMeleeAttack 0a64d9e9 Fix EntityDismountEvent reason c25ef322 Updated Paper Origami Changes: 36c0e05 Fix wrong circular dependency error if plugin depends on own provides 655fa5f Add option to disable legacy plugin support Purpur Changes: 79d304f Updated Upstream (Paper) bef678f [ci-skip] Simpler method of merging metadata files 3b18ff8 Updated Upstream (Paper) 25c7772 Apply the AppendingTransformer for `META-INF/services/java.sql.Driver` faf0db9 Bump config version to 10 3d1926e More base attribute stuff 43d6dab Updated Upstream (Paper) 2fd92fe [ci-skip] Setup repo for api publishing 26b0736 Updated Upstream (Paper) e704540 [ci-skip] Fix the remaining javadoc warnings a541703 [ci-skip] Fix import mc-dev task 64f5f9d Fix dependency relocations d7f1884 [ci-skip] Skip compiling tests as well as running them when using the `-Pfast` flag 3e08321 [ci-skip] Fix javadoc warnings (missing @param and @return) 1bfe697 [ci-skip] Remove paper's unsafe util 63b647c [ci-skip] Make it easier to fork Purpur using our scripts c453170 Fix relocations 7e331c2 Fix #118 Phantom fire time not working 844337c Fix lag from villager lobotomize check 2ec0dba Updated Upstream (Paper) 69c6484 Build using Toothpick scripts (#122) AirplaneLite Changes: ff087b7 Changes from Purpur 7263c2f Fix maven subproject URL 819c731 Switch to Purpur's Toothpick
106 lines
5.1 KiB
Diff
106 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Mon, 17 Aug 2020 19:16:39 +0300
|
|
Subject: [PATCH] Use offline uuids if we need to
|
|
|
|
By default, the user cache falls back to requests to mojang if it wasn't able to find a player.
|
|
This is completely fine if we're running an online mode server, however proxies require the
|
|
server to run in offline mode, which makes mojang's default commands to not work properly
|
|
( say if we want to ban a player which has never joined the server, he wouldn't get banned )
|
|
|
|
What our change does is make use of already existing options in paper.yml and spigot.yml to check
|
|
if the server is running behind a proxy and if the proxy is running online mode. If admins fail to
|
|
configure it properly, their mistake!
|
|
|
|
Furthermore, my research on the issue shows that this behavior also can be seen if we're not running
|
|
behind a proxy at all! I try to whitelist any of my staff, and they get whitelisted with online mode
|
|
UUIDs, while they should get whitelisted with offline mode ones.
|
|
|
|
Thanks to Gabriele C <sgdc3.mail@gmail.com> for pointing this issue to us, as he said paper doesn't
|
|
have any interest fixing this.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index 3ef463e1313b9729c86437f499930ab4cd332a6d..50ba26eafcfd5024e2795f13a0b04877b2cd6688 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -1921,7 +1921,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
public static UUID a(GameProfile gameprofile) {
|
|
UUID uuid = gameprofile.getId();
|
|
|
|
- if (uuid == null) {
|
|
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.shouldUseOfflineUUID() || uuid == null) { // Yatopia
|
|
uuid = getOfflineUUID(gameprofile.getName());
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
|
index 1496c43fc9487caf6ddb3782a9d1c79ef6ca1e94..d3ffbd5247b3a9b2a046d6696c959e834dff7ef4 100644
|
|
--- a/src/main/java/net/minecraft/server/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
|
@@ -82,6 +82,11 @@ public class UserCache {
|
|
|
|
@Nullable
|
|
private static GameProfile a(GameProfileRepository gameprofilerepository, String s) {
|
|
+ // Yatopia start
|
|
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.shouldUseOfflineUUID() && org.yatopiamc.yatopia.server.YatopiaConfig.isProxy()) {
|
|
+ return new GameProfile(EntityHuman.getOfflineUUID(s), s);
|
|
+ }
|
|
+ // Yatopia end
|
|
final AtomicReference<GameProfile> atomicreference = new AtomicReference();
|
|
ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
|
|
public void onProfileLookupSucceeded(GameProfile gameprofile) {
|
|
@@ -102,6 +107,15 @@ public class UserCache {
|
|
gameprofile = new GameProfile(uuid, s);
|
|
}
|
|
|
|
+ // Yatopia start
|
|
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.shouldUseOfflineUUID() && !org.yatopiamc.yatopia.server.YatopiaConfig.isProxy()) {
|
|
+ GameProfile newProfile = new GameProfile(EntityHuman.getOfflineUUID(s), s);
|
|
+ if (gameprofile == null || gameprofile.getProperties().isEmpty()) return newProfile;
|
|
+ newProfile.getProperties().putAll(gameprofile.getProperties());
|
|
+ return newProfile;
|
|
+ }
|
|
+ // Yatopia end
|
|
+
|
|
return gameprofile;
|
|
}
|
|
|
|
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
index 003a024da8ab877895244ff9e4e4ff62288622ff..eb5f7172829037862c20bb7527badaa589f50cc7 100644
|
|
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
|
|
@@ -10,6 +10,7 @@ import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.logging.Level;
|
|
import java.util.regex.Pattern;
|
|
+import net.minecraft.server.MinecraftServer;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.configuration.InvalidConfigurationException;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
@@ -211,4 +212,26 @@ public class YatopiaConfig {
|
|
private static void fixFallDistance() {
|
|
fixFallDistance = getBoolean("settings.fixFallDistance", false);
|
|
}
|
|
+
|
|
+ public static boolean shouldUseOfflineUUID() {
|
|
+ if (org.spigotmc.SpigotConfig.bungee && com.destroystokyo.paper.PaperConfig.bungeeOnlineMode) {
|
|
+ return false;
|
|
+ }
|
|
+ if (org.spigotmc.SpigotConfig.bungee) {
|
|
+ return true;
|
|
+ }
|
|
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport &&
|
|
+ com.destroystokyo.paper.PaperConfig.velocityOnlineMode) {
|
|
+ return false;
|
|
+ }
|
|
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ return !MinecraftServer.getServer().getOnlineMode();
|
|
+ }
|
|
+
|
|
+ public static boolean isProxy() {
|
|
+ return org.spigotmc.SpigotConfig.bungee || com.destroystokyo.paper.PaperConfig.velocitySupport;
|
|
+ }
|
|
}
|