aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0398-Add-WorldUnloadResult.patch
blob: 1ada5657c1741830b9268aedad4665cd131ea684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 28 Sep 2022 05:09:05 +0100
Subject: [PATCH] Add WorldUnloadResult


diff --git a/src/main/java/io/papermc/paper/world/WorldUnloadResult.java b/src/main/java/io/papermc/paper/world/WorldUnloadResult.java
new file mode 100644
index 0000000000000000000000000000000000000000..5fb077e0ab5ad238763adb2a1d2a6cc95cf0f1e4
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/WorldUnloadResult.java
@@ -0,0 +1,30 @@
+package io.papermc.paper.world;
+
+import net.kyori.adventure.text.Component;
+
+public class WorldUnloadResult {
+
+    public static final WorldUnloadResult SUCCESS = new WorldUnloadResult(true, Component.text("Success"));
+    public static final WorldUnloadResult NOT_LOADED = new WorldUnloadResult(false, Component.text("Cannot unload unloaded world"));
+    public static final WorldUnloadResult UNSUPPORTED = new WorldUnloadResult(false, Component.text("Unloading this world is not supported"));
+    public static final WorldUnloadResult NOT_EMPTY = new WorldUnloadResult(false, Component.text("Unable to load world with players!"));
+    public static final WorldUnloadResult PENDING_LOGIN = new WorldUnloadResult(false, Component.text("Unable to load world with pending login!"));
+    public static final WorldUnloadResult PLUGIN = new WorldUnloadResult(false, Component.text("World unload cancelled by plugin"));
+    public static final WorldUnloadResult NULL = new WorldUnloadResult(false, Component.text("Cannot unload null world"));
+
+    private final boolean success;
+    private final Component message;
+
+    public WorldUnloadResult(boolean success, Component message) {
+        this.success = success;
+        this.message = message;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public Component message() {
+        return message;
+    }
+}