mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Revert "hey some patches", its too much work to keep around
This reverts commit 4bfdbfd164.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Tue, 23 Nov 2021 08:38:18 -0500
|
||||
Subject: [PATCH] Decompile Fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
index c5b9c0c650df5f4b7e3d2a431dc900e210104dea..212e2c5b4b917c0c327d4b0612fecaea81c0ad87 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
@@ -123,7 +123,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
||||
|
||||
@Override
|
||||
public Brain<Hoglin> getBrain() {
|
||||
- return super.getBrain();
|
||||
+ return (Brain<Hoglin>) super.getBrain(); // Purpur - decompile fix
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,172 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 May 2019 01:02:11 -0500
|
||||
Subject: [PATCH] Rebrand
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 80849d9b582916be238ba8c8e79de5832eff3c9a..5a8a5aa6baf8fadfb7bd8ef33044f9d7ce554407 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -15,7 +15,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":Paper-API"))
|
||||
+ implementation(project(":Purpur-API")) // Purpur
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // Purpur
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -38,6 +39,9 @@ dependencies {
|
||||
runtimeOnly("mysql:mysql-connector-java:8.0.27")
|
||||
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
|
||||
|
||||
+ implementation("cat.inspiracio:rhino-js-engine:1.7.7.1") // Purpur
|
||||
+ implementation("dev.omega24:upnp4j:1.0") // Purpur
|
||||
+
|
||||
runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.1")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
|
||||
@@ -57,7 +61,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Purpur-$implementationVersion", // Purpur
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -117,7 +121,7 @@ tasks.test {
|
||||
fun TaskContainer.registerRunTask(
|
||||
name: String, block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight" // Purpur
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory.dir(
|
||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..aadd6550a5892e403f7b0bbef008461c1566a1bb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -19,8 +19,8 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
public class PaperVersionFetcher implements VersionFetcher {
|
||||
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
|
||||
- private static final String GITHUB_BRANCH_NAME = "master";
|
||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||
+ private static final String DOWNLOAD_PAGE = "https://purpur.pl3x.net/downloads/";
|
||||
+ private static final String JENKINS_URL = "https://ci.pl3x.net/job/Purpur/lastSuccessfulBuild/buildNumber"; // Purpur
|
||||
private static @Nullable String mcVer;
|
||||
|
||||
@Override
|
||||
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
|
||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
||||
+ String[] parts = serverVersion.substring("git-Purpur-".length()).split("[-\\s]"); // Airplane // Purpur
|
||||
+ final Component updateMessage = getUpdateStatusMessage("pl3xgaming/Purpur", "ver/" + getMinecraftVersion(), parts[0]); // Airplane // Purpur
|
||||
final Component history = getHistory();
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
@@ -45,7 +45,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
String result = matcher.group();
|
||||
mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
|
||||
} else {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
|
||||
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to Purpur!"); // Purpur
|
||||
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
||||
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
|
||||
}
|
||||
@@ -85,15 +85,11 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
if (siteApiVersion == null) { return -1; }
|
||||
try {
|
||||
try (BufferedReader reader = Resources.asCharSource(
|
||||
- new URL("https://papermc.io/api/v2/projects/paper/versions/" + siteApiVersion),
|
||||
+ new URL("https://api.pl3x.net/v2/purpur/" + siteApiVersion), // Purpur
|
||||
Charsets.UTF_8
|
||||
).openBufferedStream()) {
|
||||
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
|
||||
- JsonArray builds = json.getAsJsonArray("builds");
|
||||
- int latest = StreamSupport.stream(builds.spliterator(), false)
|
||||
- .mapToInt(e -> e.getAsInt())
|
||||
- .max()
|
||||
- .getAsInt();
|
||||
+ int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur
|
||||
return latest - jenkinsBuild;
|
||||
} catch (JsonSyntaxException ex) {
|
||||
ex.printStackTrace();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
index a4070b59e261f0f1ac4beec47b11492f4724bf27..c0186a95cb4759f0660bf4df03e4819723cfaae1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@Override
|
||||
protected LineReader buildReader(LineReaderBuilder builder) {
|
||||
return super.buildReader(builder
|
||||
- .appName("Paper")
|
||||
+ .appName("Purpur") // Purpur
|
||||
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index a9f54a691af0cd15cbc38af8b8df3831de244aa7..4b64d23616cfb9d7c7f3b376d487ce94ecdf9e20 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1520,7 +1520,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Purpur"; // Purpur - Purpur > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 9a2c040c3a513fe51c5fa9c5deaba13a01639f38..1b5daec7298aeaa130b16b3e52b15f00845ca2c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -254,11 +254,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
// Spigot start
|
||||
- if (org.spigotmc.SpigotConfig.bungee) {
|
||||
- DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) { // Purpur
|
||||
+ DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord or Velocity, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); // Purpur
|
||||
DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
|
||||
} else {
|
||||
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
+ DedicatedServer.LOGGER.warn("You will not be offered any support as long as the server allows offline-mode players to join."); // Purpur
|
||||
}
|
||||
// Spigot end
|
||||
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 26c7c5c51c60086957db57e9fdc256e3940e9c39..6fc91833ae6ff6b3813fe4e18ae539643e986db5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -254,7 +254,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Purpur"; // Paper // Purpur
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..e9aee2d8a929bded46c79c3ea0f1fcfd172af438 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/net.pl3x.purpur/purpur-api/pom.properties"); // Purpur
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
@@ -1,511 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 9 May 2019 18:09:43 -0500
|
||||
Subject: [PATCH] Purpur config files
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index e3b74dbdf8e14219a56fab939f3174e0c2f66de6..c856fb3147b82ddf82ffdad06ab8eaa0efacb665 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -588,8 +588,7 @@ public class Metrics {
|
||||
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||
// Only start Metrics, if it's enabled in the config
|
||||
if (config.getBoolean("enabled", true)) {
|
||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||
-
|
||||
+ Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
String minecraftVersion = Bukkit.getVersion();
|
||||
minecraftVersion = minecraftVersion.substring(minecraftVersion.indexOf("MC: ") + 4, minecraftVersion.length() - 1);
|
||||
@@ -597,8 +596,8 @@ public class Metrics {
|
||||
}));
|
||||
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (PaperConfig.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Purpur
|
||||
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index 9f79c949d18c1ff3bdb49780fcecfc75366a8ff6..22524fa6b448cb5895bba6759213bbe70fd56b73 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -215,6 +215,30 @@ public class CommandSourceStack implements SharedSuggestionProvider {
|
||||
return this.anchor;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public void sendSuccess(@Nullable String message) {
|
||||
+ sendSuccess(message, false);
|
||||
+ }
|
||||
+
|
||||
+ public void sendSuccess(@Nullable String message, boolean broadcastToOps) {
|
||||
+ if (message == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ sendSuccess(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message), broadcastToOps);
|
||||
+ }
|
||||
+
|
||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ sendSuccess(message, false);
|
||||
+ }
|
||||
+
|
||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message, boolean broadcastToOps) {
|
||||
+ if (message == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), broadcastToOps);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public void sendSuccess(Component message, boolean broadcastToOps) {
|
||||
if (this.source.acceptsSuccess() && !this.silent) {
|
||||
this.source.sendMessage(message, Util.NIL_UUID);
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 1b5daec7298aeaa130b16b3e52b15f00845ca2c4..a623dcd96b8bfbb6261b0304795e03025367e77f 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -211,6 +211,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
return false;
|
||||
}
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands();
|
||||
+ // Purpur start
|
||||
+ try {
|
||||
+ net.pl3x.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ net.pl3x.purpur.PurpurConfig.registerCommands();
|
||||
+ // Purpur end
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0663aa74688104c551e8ef52b01947dacf95bb22..ff93b1352701647929bd5b71d4a3e9c1c20433a9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -161,6 +161,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
|
||||
|
||||
+ public final net.pl3x.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
||||
+
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -182,6 +184,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
|
||||
+ this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((ServerLevel) this, ((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
|
||||
this.generator = gen;
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f589e4376f88c7774a7fe999cad4d11a59379cd9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -0,0 +1,159 @@
|
||||
+package net.pl3x.purpur;
|
||||
+
|
||||
+import co.aikar.timings.TimingsManager;
|
||||
+import com.google.common.base.Throwables;
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
+import net.kyori.adventure.bossbar.BossBar;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.entity.EntityDimensions;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+import net.pl3x.purpur.command.PurpurCommand;
|
||||
+import net.pl3x.purpur.task.TPSBarTask;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class PurpurConfig {
|
||||
+ private static final String HEADER = "This is the main configuration file for Purpur.\n"
|
||||
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
|
||||
+ + "with caution, and make sure you know what each option does before configuring.\n"
|
||||
+ + "\n"
|
||||
+ + "If you need help with the configuration or have any questions related to Purpur,\n"
|
||||
+ + "join us in our Discord guild.\n"
|
||||
+ + "\n"
|
||||
+ + "Website: https://github.com/pl3xgaming/Purpur \n"
|
||||
+ + "Wiki: https://github.com/pl3xgaming/Purpur/wiki \n";
|
||||
+ private static File CONFIG_FILE;
|
||||
+ public static YamlConfiguration config;
|
||||
+
|
||||
+ private static Map<String, Command> commands;
|
||||
+
|
||||
+ static int version;
|
||||
+ static boolean verbose;
|
||||
+
|
||||
+ public static void init(File configFile) {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ config = new YamlConfiguration();
|
||||
+ try {
|
||||
+ config.load(CONFIG_FILE);
|
||||
+ } catch (IOException ignore) {
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load purpur.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ }
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ verbose = getBoolean("verbose", false);
|
||||
+
|
||||
+ commands = new HashMap<>();
|
||||
+ commands.put("purpur", new PurpurCommand("purpur"));
|
||||
+
|
||||
+ version = getInt("config-version", 22);
|
||||
+ set("config-version", 22);
|
||||
+
|
||||
+ readConfig(PurpurConfig.class, null);
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(String s) {
|
||||
+ if (verbose) {
|
||||
+ log(Level.INFO, s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(Level level, String s) {
|
||||
+ Bukkit.getLogger().log(level, s);
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands() {
|
||||
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Purpur", entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ try {
|
||||
+ method.setAccessible(true);
|
||||
+ method.invoke(instance);
|
||||
+ } catch (InvocationTargetException ex) {
|
||||
+ throw Throwables.propagate(ex.getCause());
|
||||
+ } catch (Exception ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ config.save(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void set(String path, Object val) {
|
||||
+ config.addDefault(path, val);
|
||||
+ config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ private static String getString(String path, String def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ private static double getDouble(String path, double def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ private static int getInt(String path, int def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ private static <T> List getList(String path, T def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getList(path, config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ static Map<String, Object> getMap(String path, Map<String, Object> def) {
|
||||
+ if (def != null && config.getConfigurationSection(path) == null) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return def;
|
||||
+ }
|
||||
+ return toMap(config.getConfigurationSection(path));
|
||||
+ }
|
||||
+
|
||||
+ private static Map<String, Object> toMap(ConfigurationSection section) {
|
||||
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
|
||||
+ if (section != null) {
|
||||
+ for (String key : section.getKeys(false)) {
|
||||
+ Object obj = section.get(key);
|
||||
+ if (obj != null) {
|
||||
+ builder.put(key, obj instanceof ConfigurationSection val ? toMap(val) : obj);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return builder.build();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8bc89d48695c816a1db77f9cdffd05f35afea92a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -0,0 +1,96 @@
|
||||
+package net.pl3x.purpur;
|
||||
+
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.item.DyeColor;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.item.Items;
|
||||
+import net.minecraft.world.level.Explosion;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import net.minecraft.world.level.block.state.properties.Tilt;
|
||||
+import net.pl3x.purpur.tool.Strippable;
|
||||
+import net.pl3x.purpur.tool.Tillable;
|
||||
+import net.pl3x.purpur.tool.Waxable;
|
||||
+import net.pl3x.purpur.tool.Weatherable;
|
||||
+import org.apache.commons.lang.BooleanUtils;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import java.util.function.Predicate;
|
||||
+import java.util.logging.Level;
|
||||
+import static net.pl3x.purpur.PurpurConfig.log;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class PurpurWorldConfig {
|
||||
+
|
||||
+ private final ServerLevel level;
|
||||
+ private final String worldName;
|
||||
+ private final World.Environment environment;
|
||||
+
|
||||
+ public PurpurWorldConfig(ServerLevel level, String worldName, World.Environment environment) {
|
||||
+ this.level = level;
|
||||
+ this.worldName = worldName;
|
||||
+ this.environment = environment;
|
||||
+ init();
|
||||
+ }
|
||||
+
|
||||
+ public void init() {
|
||||
+ log("-------- World Settings For [" + worldName + "] --------");
|
||||
+ PurpurConfig.readConfig(PurpurWorldConfig.class, this);
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, val);
|
||||
+ PurpurConfig.config.set("world-settings.default." + path, val);
|
||||
+ if (PurpurConfig.config.get("world-settings." + worldName + "." + path) != null) {
|
||||
+ PurpurConfig.config.addDefault("world-settings." + worldName + "." + path, val);
|
||||
+ PurpurConfig.config.set("world-settings." + worldName + "." + path, val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private ConfigurationSection getConfigurationSection(String path) {
|
||||
+ ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path);
|
||||
+ return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path);
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getBoolean("world-settings." + worldName + "." + path, PurpurConfig.config.getBoolean("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private double getDouble(String path, double def) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getDouble("world-settings." + worldName + "." + path, PurpurConfig.config.getDouble("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getInt("world-settings." + worldName + "." + path, PurpurConfig.config.getInt("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private <T> List<?> getList(String path, T def) {
|
||||
+ PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
+ return PurpurConfig.config.getList("world-settings." + worldName + "." + path, PurpurConfig.config.getList("world-settings.default." + path));
|
||||
+ }
|
||||
+
|
||||
+ private Map<String, Object> getMap(String path, Map<String, Object> def) {
|
||||
+ final Map<String, Object> fallback = PurpurConfig.getMap("world-settings.default." + path, def);
|
||||
+ final Map<String, Object> value = PurpurConfig.getMap("world-settings." + worldName + "." + path, null);
|
||||
+ return value.isEmpty() ? fallback : value;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/command/PurpurCommand.java b/src/main/java/net/pl3x/purpur/command/PurpurCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6e7f56fe2b78d7a09d5d130f2c88338fb8ae628e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/command/PurpurCommand.java
|
||||
@@ -0,0 +1,65 @@
|
||||
+package net.pl3x.purpur.command;
|
||||
+
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+import java.util.stream.Collectors;
|
||||
+import java.util.stream.Stream;
|
||||
+
|
||||
+public class PurpurCommand extends Command {
|
||||
+ public PurpurCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "Purpur related commands";
|
||||
+ this.usageMessage = "/purpur [reload | version]";
|
||||
+ this.setPermission("bukkit.command.purpur");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
|
||||
+ if (args.length == 1) {
|
||||
+ return Stream.of("reload", "version")
|
||||
+ .filter(arg -> arg.startsWith(args[0].toLowerCase()))
|
||||
+ .collect(Collectors.toList());
|
||||
+ }
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender)) return true;
|
||||
+
|
||||
+ if (args.length != 1) {
|
||||
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (args[0].equalsIgnoreCase("reload")) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
+
|
||||
+ MinecraftServer console = MinecraftServer.getServer();
|
||||
+ PurpurConfig.init((File) console.options.valueOf("purpur-settings"));
|
||||
+ for (ServerLevel level : console.getAllLevels()) {
|
||||
+ level.purpurConfig.init();
|
||||
+ }
|
||||
+ console.server.reloadCount++;
|
||||
+
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Purpur config reload complete.");
|
||||
+ } else if (args[0].equalsIgnoreCase("version")) {
|
||||
+ Command verCmd = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version");
|
||||
+ if (verCmd != null) {
|
||||
+ return verCmd.execute(sender, commandLabel, new String[0]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 6fc91833ae6ff6b3813fe4e18ae539643e986db5..05d95d6aa4982a08705d5c9b9b138b60c41c9154 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -881,6 +881,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
+ net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
world.serverLevelData.setDifficulty(config.difficulty);
|
||||
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
|
||||
@@ -921,6 +922,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.paperConfig.init(); // Paper
|
||||
+ world.purpurConfig.init(); // Purpur
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -936,6 +938,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
|
||||
+ net.pl3x.purpur.PurpurConfig.registerCommands(); // Purpur
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2423,6 +2426,18 @@ public final class CraftServer implements Server {
|
||||
return com.destroystokyo.paper.PaperConfig.config;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getPurpurConfig() {
|
||||
+ return net.pl3x.purpur.PurpurConfig.config;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.Properties getServerProperties() {
|
||||
+ return getProperties().properties;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index cd75c62770f872a5c270f63adfe3016156e2efc9..1943b9d7b24c75817316522f92b2068068348e6a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -144,6 +144,14 @@ public class Main {
|
||||
.describedAs("Yml file");
|
||||
// Paper end
|
||||
|
||||
+ // Purpur Start
|
||||
+ acceptsAll(asList("purpur", "purpur-settings"), "File for purpur settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("purpur.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ // Purpur end
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
@@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 30 Jul 2021 14:31:25 -0500
|
||||
Subject: [PATCH] Purpur client support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index fd1937f49312204d38510996a5be43b731f38bde..d905a7a2cf7a820bca8bddbc555c49764e8b7779 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -238,6 +238,7 @@ public class ServerPlayer extends Player {
|
||||
public Integer clientViewDistance;
|
||||
// CraftBukkit end
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
+ public boolean purpurClient = false; // Purpur
|
||||
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 7ed73ea4a5f7383c953ee3e28ce8f234d8ff941e..210435ecd44a7f111d2ad78b368f929dbba0fe10 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2865,6 +2865,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
|
||||
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
||||
|
||||
+ private static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur
|
||||
+
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
@@ -2888,6 +2890,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
||||
this.disconnect("Invalid payload UNREGISTER!");
|
||||
}
|
||||
+ // Purpur start
|
||||
+ } else if (packet.identifier.equals(PURPUR_CLIENT)) {
|
||||
+ try {
|
||||
+ player.purpurClient = true;
|
||||
+ } catch (Exception ignore) {
|
||||
+ }
|
||||
+ // Purpur end
|
||||
} else {
|
||||
try {
|
||||
byte[] data = new byte[packet.data.readableBytes()];
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index b415f0760bd1027dcc9cd987d06421cbc50fbfaa..ef1a08a0ce7a58797e9f9c8f9cdb32f7c157087d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2413,4 +2413,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.spigot;
|
||||
}
|
||||
// Spigot end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean usesPurpurClient() {
|
||||
+ return getHandle().purpurClient;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 29 Jun 2021 21:37:40 -0500
|
||||
Subject: [PATCH] Component related conveniences
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d905a7a2cf7a820bca8bddbc555c49764e8b7779..f2585706d3b23a67c13130e2e38d5bedd1f7cf71 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1564,6 +1564,26 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start
|
||||
+ public void sendActionBarMessage(@Nullable String message) {
|
||||
+ if (message != null) {
|
||||
+ sendActionBarMessage(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendActionBarMessage(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ if (message != null) {
|
||||
+ sendActionBarMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendActionBarMessage(@Nullable Component message) {
|
||||
+ if (message != null) {
|
||||
+ displayClientMessage(message, true);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public void displayClientMessage(Component message, boolean actionBar) {
|
||||
this.sendMessage(message, actionBar ? ChatType.GAME_INFO : ChatType.CHAT, Util.NIL_UUID);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index fb16158ed403abaac740729cb351cd94a36653ac..a9c6895d577cac491448057a4d7347d99d300710 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1192,6 +1192,62 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start
|
||||
+ public void broadcast(@Nullable String message) {
|
||||
+ broadcast(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable String message, ChatType type) {
|
||||
+ broadcast(message, type, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable String message, UUID sender) {
|
||||
+ broadcast(message, ChatType.SYSTEM, sender);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable String message, ChatType type, UUID sender) {
|
||||
+ if (message != null) {
|
||||
+ broadcast(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message), type, sender);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ broadcast(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable net.kyori.adventure.text.Component message, ChatType type) {
|
||||
+ broadcast(message, type, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable net.kyori.adventure.text.Component message, UUID sender) {
|
||||
+ broadcast(message, ChatType.SYSTEM, sender);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable net.kyori.adventure.text.Component message, ChatType type, UUID sender) {
|
||||
+ if (message != null) {
|
||||
+ broadcast(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), type, sender);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable Component message) {
|
||||
+ broadcast(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable Component message, ChatType type) {
|
||||
+ broadcast(message, type, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable Component message, UUID sender) {
|
||||
+ broadcast(message, ChatType.SYSTEM, sender);
|
||||
+ }
|
||||
+
|
||||
+ public void broadcast(@Nullable Component message, ChatType type, UUID sender) {
|
||||
+ if (message != null) {
|
||||
+ broadcastMessage(message, type, sender);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public void broadcastMessage(Component message, ChatType type, UUID sender) {
|
||||
this.server.sendMessage(message, sender);
|
||||
Iterator iterator = this.players.iterator();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 752e4593bed746e663f018f85ae1ac43cd7b0795..2a5f730f9ca7f56f361e2f598b83245b129d1930 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3292,6 +3292,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
return SlotAccess.NULL;
|
||||
}
|
||||
|
||||
+ // Purpur Start
|
||||
+ public void sendMessage(@Nullable String message) {
|
||||
+ sendMessage(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(@Nullable String message, UUID sender) {
|
||||
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(message)) {
|
||||
+ sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message), sender);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ sendMessage(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(@Nullable net.kyori.adventure.text.Component message, UUID sender) {
|
||||
+ if (message != null) {
|
||||
+ sendMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), sender);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(@Nullable Component message) {
|
||||
+ if (message != null) {
|
||||
+ sendMessage(message, Util.NIL_UUID);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public void sendMessage(Component message, UUID sender) {}
|
||||
|
||||
Reference in New Issue
Block a user