9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-30 20:39:15 +00:00
---------

Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
This commit is contained in:
Lumine1909
2025-06-05 18:41:51 +08:00
committed by GitHub
parent f553c53e42
commit f09fbb247d
379 changed files with 6930 additions and 6288 deletions

View File

@@ -1,21 +1,21 @@
--- a/paper-api/build.gradle.kts
+++ b/paper-api/build.gradle.kts
@@ -93,19 +_,33 @@
@@ -90,19 +_,33 @@
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Leaves - build change
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Leaves - build change
idea {
module {
generatedSourceDirs.add(generatedApiPath.toFile())
generatedSourceDirs.add(generatedDir.toFile())
}
}
+// Leaves start - build change
sourceSets {
main {
java {
srcDir(generatedApiPath)
srcDir(generatedDir)
+ srcDir(file("../paper-api/src/main/java"))
+ }
+ resources {
@@ -35,7 +35,7 @@
val outgoingVariants = arrayOf("runtimeElements", "apiElements", "sourcesElements", "javadocElements")
val mainCapability = "${project.group}:${project.name}:${project.version}"
@@ -150,6 +_,16 @@
@@ -147,6 +_,16 @@
}
}
@@ -52,7 +52,7 @@
tasks.jar {
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
into("META-INF/maven/${project.group}/${project.name}")
@@ -169,7 +_,7 @@
@@ -166,7 +_,7 @@
tasks.withType<Javadoc> {
val options = options as StandardJavadocDocletOptions
@@ -61,7 +61,7 @@
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -202,16 +_,18 @@
@@ -199,16 +_,18 @@
}
// workaround for https://github.com/gradle/gradle/issues/4046

View File

@@ -730,7 +730,7 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..00000000000000000000000000000000
-}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
deleted file mode 100644
index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000
index c8287776ad585d04fb4fa3290cd73d7097035ea0..0000000000000000000000000000000000000000
--- a/src/main/java/co/aikar/timings/TimingHistory.java
+++ /dev/null
@@ -1,357 +0,0 @@
@@ -1025,7 +1025,7 @@ index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..00000000000000000000000000000000
- final TicksRecord ticksRecord = new TicksRecord();
- final PingRecord pingRecord = new PingRecord();
- final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone();
- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed;
- final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed;
- final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory;
- final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory;
- final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
@@ -1743,7 +1743,7 @@ index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..00000000000000000000000000000000
-}
diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java
deleted file mode 100644
index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000
index 83a70358e9b7d3d9ae76cf130915b3c33d09a793..0000000000000000000000000000000000000000
--- a/src/main/java/co/aikar/timings/TimingsManager.java
+++ /dev/null
@@ -1,192 +0,0 @@
@@ -1902,9 +1902,9 @@ index e72ad05abada04426e32a73d02b21cb69079d268..00000000000000000000000000000000
- public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) {
- Plugin plugin = null;
- final Server server = Bukkit.getServer();
- if (!( server == null || pluginName == null ||
- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) ||
- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName)
- if (!(server == null || pluginName == null ||
- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) ||
- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName)
- )) {
- plugin = server.getPluginManager().getPlugin(pluginName);
- }
@@ -2141,10 +2141,10 @@ index dae84243804b4b076cafb3e1b29bdcf614efc93f..00000000000000000000000000000000
-}
diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java
deleted file mode 100644
index c105a1429ca58b37be265708ec345e00f0d43ed8..0000000000000000000000000000000000000000
index 232bf09e1a7bc176bfd34b1acb5326a06a92fe79..0000000000000000000000000000000000000000
--- a/src/main/java/co/aikar/util/JSONUtil.java
+++ /dev/null
@@ -1,141 +0,0 @@
@@ -1,138 +0,0 @@
-package co.aikar.util;
-
-import com.google.common.base.Function;
@@ -2152,10 +2152,7 @@ index c105a1429ca58b37be265708ec345e00f0d43ed8..00000000000000000000000000000000
-import com.google.common.collect.Maps;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
@@ -2863,10 +2860,10 @@ index 3e61a926620a67daec3af54b72a1b911eaef2ed4..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..a43419c23aa0f6fd809caf5a841cb138f350b7ba 100644
index 27a7c69f23084e821d945d5e97e51a94ddd94e58..d645ee8470a2dd9f7b8eff2b7ff2211aba9c342f 100644
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
@@ -33,16 +33,6 @@ public abstract class Command {
@@ -32,16 +32,6 @@ public abstract class Command {
protected String usageMessage;
private String permission;
private net.kyori.adventure.text.Component permissionMessage; // Paper
@@ -2884,10 +2881,10 @@ index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..a43419c23aa0f6fd809caf5a841cb138
protected Command(@NotNull String name) {
this(name, "", "/" + name, new ArrayList<String>());
diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
index abe256e1e45ce28036da4aa1586715bc8a1a3414..9eab8024e0675865f17669847759a26d28f74f3a 100644
index 59fada9b1eb78238d280c6bbb711f52facba52c6..eb4d78c6111a530d015a0b91d14c40ad0eec9ca7 100644
--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java
+++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java
@@ -12,7 +12,6 @@ public class FormattedCommandAlias extends Command {
@@ -14,7 +14,6 @@ public class FormattedCommandAlias extends Command {
public FormattedCommandAlias(@NotNull String alias, @NotNull String[] formatStrings) {
super(alias);
@@ -2895,7 +2892,7 @@ index abe256e1e45ce28036da4aa1586715bc8a1a3414..9eab8024e0675865f17669847759a26d
this.formatStrings = formatStrings;
}
@@ -120,10 +119,6 @@ public class FormattedCommandAlias extends Command {
@@ -122,10 +121,6 @@ public class FormattedCommandAlias extends Command {
return formatString.trim(); // Paper - Causes an extra space at the end, breaks with brig commands
}
@@ -2907,18 +2904,18 @@ index abe256e1e45ce28036da4aa1586715bc8a1a3414..9eab8024e0675865f17669847759a26d
return i >= j && i <= k;
}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..940565704d0e8914a76cf25daf7d1f5ecd99bad4 100644
index 4acda947b7d69ab4133b4cc94e76d945e4d148d5..d356f1895e8f3fae14bbbe1f60e589af3856b9ec 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -39,7 +39,6 @@ public class SimpleCommandMap implements CommandMap {
register("bukkit", new VersionCommand("version"));
@@ -32,7 +32,6 @@ public class SimpleCommandMap implements CommandMap {
private void setDefaultCommands() {
register("bukkit", new ReloadCommand("reload"));
//register("bukkit", new PluginsCommand("plugins")); // Paper
- register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper
- register("bukkit", new co.aikar.timings.TimingsCommand("timings"));
}
public void setFallbackCommands() {
@@ -71,7 +70,6 @@ public class SimpleCommandMap implements CommandMap {
@@ -64,7 +63,6 @@ public class SimpleCommandMap implements CommandMap {
*/
@Override
public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) {
@@ -2926,7 +2923,7 @@ index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..940565704d0e8914a76cf25daf7d1f5e
label = label.toLowerCase(Locale.ROOT).trim();
fallbackPrefix = fallbackPrefix.toLowerCase(Locale.ROOT).trim();
boolean registered = register(label, command, false, fallbackPrefix);
@@ -153,17 +151,9 @@ public class SimpleCommandMap implements CommandMap {
@@ -146,17 +144,9 @@ public class SimpleCommandMap implements CommandMap {
return false;
}
@@ -2977,35 +2974,45 @@ index 001465eedafa51ac027a4db51cba6223edfe1171..dd98b4886d21ac92d9f9139450258754
// Paper start
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index b412aaf08901d169ac9fc89b36f9d6ccb95c53d3..b2257f3e51a754b7d3d946b434745f22e3305b0a 100644
index 163e9a0e179dc88be93614ff66ee2be3eccc694f..f4f1a51a3b0c34b87270ba81b705a8ee5d615f8a 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -43,7 +43,6 @@ import org.bukkit.plugin.TimedRegisteredListener;
import org.bukkit.plugin.UnknownDependencyException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.spigotmc.CustomTimingsHandler; // Spigot
import org.yaml.snakeyaml.error.YAMLException;
/**
@@ -293,7 +292,7 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -290,22 +290,22 @@ public final class JavaPluginLoader implements PluginLoader {
}
}
- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper
+ EventExecutor executor = new EventExecutor() { // Paper
@Override
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper
try {
@@ -307,7 +306,7 @@ public final class JavaPluginLoader implements PluginLoader {
throw new EventException(t);
- @Override
- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper
- try {
- if (!eventClass.isAssignableFrom(event.getClass())) {
- return;
- }
- method.invoke(listener, event);
- } catch (InvocationTargetException ex) {
- throw new EventException(ex.getCause());
- } catch (Throwable t) {
- throw new EventException(t);
+ // Leaves start - Delete timings
+ // Paper
+ EventExecutor executor = (listener1, event) -> { // Paper
+ try {
+ if (!eventClass.isAssignableFrom(event.getClass())) {
+ return;
}
+ method.invoke(listener1, event);
+ } catch (java.lang.reflect.InvocationTargetException ex) {
+ throw new org.bukkit.event.EventException(ex.getCause());
+ } catch (Throwable t) {
+ throw new org.bukkit.event.EventException(t);
}
- }, plugin, method, eventClass); // Paper
+ }; // Paper
if (false) { // Spigot - RL handles useTimings check now
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
+ // Leaves end - Delete timings
}
return ret;
}
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
deleted file mode 100644
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..0000000000000000000000000000000000000000

View File

@@ -5,38 +5,38 @@ Subject: [PATCH] Add isShrink to EntityResurrectEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java b/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java
index 2a7426c157f6a06f2491d95d67df95a0fb809926..8fe7d559ad6cbb8f15584c202067250dd55a8ede 100644
index fa60c0ce5c79757952ad39932e1c5fac8b068811..71fd070aaebfd9fa0fbfd6eb7cd26c8b34120203 100644
--- a/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityResurrectEvent.java
@@ -16,20 +16,44 @@ import org.jetbrains.annotations.Nullable;
public class EntityResurrectEvent extends EntityEvent implements Cancellable {
@@ -17,22 +17,46 @@ public class EntityResurrectEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
- //
+
private static final HandlerList HANDLER_LIST = new HandlerList();
- private final EquipmentSlot hand;
-
private boolean cancelled;
+ private boolean shrink;
private final EquipmentSlot hand;
+
+ private final EquipmentSlot hand;
@ApiStatus.Internal
- public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand) {
+ public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand, boolean shrink) {
super(what);
- public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand) {
+ public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand, boolean shrink) {
super(livingEntity);
+ this.shrink = shrink;
this.hand = hand;
}
+ public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand) {
+ this(what, hand, true);
+ public EntityResurrectEvent(@NotNull LivingEntity livingEntity, @Nullable EquipmentSlot hand) {
+ this(livingEntity, hand, true);
+ }
+
@ApiStatus.Internal
@Deprecated(since = "1.19.2", forRemoval = true)
public EntityResurrectEvent(@NotNull LivingEntity what) {
- this(what, null);
+ this(what, null, true);
+ }
+
public EntityResurrectEvent(@NotNull LivingEntity livingEntity) {
this(livingEntity, null);
}
+ /**
+ * Get is shrink item
+ *
@@ -53,6 +53,8 @@ index 2a7426c157f6a06f2491d95d67df95a0fb809926..8fe7d559ad6cbb8f15584c202067250d
+ */
+ public void setShrink(boolean shrink) {
+ this.shrink = shrink;
}
+ }
+
@NotNull
@Override
public LivingEntity getEntity() {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add fakeplayer api
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 4eb723afaca049a816d16370b383fa37441eafd4..e1c6974cfd96b406314901862c2d92ad0a4ba8f2 100644
index c9ea6559f809a6732588b8908001807be3d91196..fe30de1f0a7fc7112466b6eb2e5813f39259c3b6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2996,4 +2996,15 @@ public final class Bukkit {
@@ -3007,4 +3007,15 @@ public final class Bukkit {
public static void restart() {
server.restart();
}
@@ -25,18 +25,10 @@ index 4eb723afaca049a816d16370b383fa37441eafd4..e1c6974cfd96b406314901862c2d92ad
+ // Leaves end - Bot API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0c1f3053ecb415a6dfbbe283bae8c1f6d8477e9c..e42fa3dc7f70a5e4426564f26d471c5bfc3d57f2 100644
index ed899c4cb4b5261ceff56bbc9ca806e20904508e..a5370832380e93cf029588caeb8e29e03cc52db8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -66,6 +66,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.leavesmc.leaves.entity.BotManager;
/**
* Represents a server implementation.
@@ -2698,4 +2699,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2716,4 +2716,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
// Paper end - API to check if the server is sleeping
@@ -47,6 +39,6 @@ index 0c1f3053ecb415a6dfbbe283bae8c1f6d8477e9c..e42fa3dc7f70a5e4426564f26d471c5b
+ *
+ * @return Bot Manager
+ */
+ @NotNull BotManager getBotManager();
+ @NotNull org.leavesmc.leaves.entity.BotManager getBotManager();
+ // Leaves end - Bot API
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Force peaceful mode switch
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index bff01411f4b2d3ecd9e6d807c3f450d72c108323..aae996e55cfda36adcca50065e05b5ecc4129614 100644
index a8b64f78bf3c453094074b4b4d3c8fd07b9eb273..ed2bcc30cec91d3266c3d184b89b96bac6fb1f67 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4351,6 +4351,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4358,6 +4358,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
void setSendViewDistance(int viewDistance);
// Paper end - view distance api

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Sun, 26 Jan 2025 01:39:16 -0500
Date: Sat, 17 May 2025 17:36:22 +0800
Subject: [PATCH] Replay Mod API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index e1c6974cfd96b406314901862c2d92ad0a4ba8f2..27bd3867836744a6e10507d165215ebf8dd7da53 100644
index fe30de1f0a7fc7112466b6eb2e5813f39259c3b6..23f3ab31bbc9d197f9a82f4ed5003e6de814fad7 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3007,4 +3007,10 @@ public final class Bukkit {
@@ -3018,4 +3018,10 @@ public final class Bukkit {
return server.getBotManager();
}
// Leaves end - Bot API
@@ -20,23 +20,15 @@ index e1c6974cfd96b406314901862c2d92ad0a4ba8f2..27bd3867836744a6e10507d165215ebf
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e42fa3dc7f70a5e4426564f26d471c5bfc3d57f2..f4f83b1534a90127a77420a1768cd4b255a04868 100644
index a5370832380e93cf029588caeb8e29e03cc52db8..2531e82464e54e0c1b707e7c5a62ff0fd5ed8637 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -67,6 +67,7 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.entity.BotManager;
+import org.leavesmc.leaves.entity.PhotographerManager;
/**
* Represents a server implementation.
@@ -2708,4 +2709,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2725,4 +2725,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull BotManager getBotManager();
@NotNull org.leavesmc.leaves.entity.BotManager getBotManager();
// Leaves end - Bot API
+
+ // Leaves start - Photographer API
+ @NotNull PhotographerManager getPhotographerManager();
+ @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
+ // Leaves end - Photographer API
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Bytebuf API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 27bd3867836744a6e10507d165215ebf8dd7da53..190e532fd3ddaf78eae3ea0ba2b4b986ab5f9540 100644
index 23f3ab31bbc9d197f9a82f4ed5003e6de814fad7..30488f80b98d1dba485e53601edb5cb0e23b7591 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3013,4 +3013,10 @@ public final class Bukkit {
@@ -3024,4 +3024,10 @@ public final class Bukkit {
return server.getPhotographerManager();
}
// Leaves end - Photographer API
@@ -20,12 +20,12 @@ index 27bd3867836744a6e10507d165215ebf8dd7da53..190e532fd3ddaf78eae3ea0ba2b4b986
+ // Leaves end - Bytebuf API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f4f83b1534a90127a77420a1768cd4b255a04868..8d4c10d7d8b3982a960ca2cee52ce069b1916c24 100644
index 2531e82464e54e0c1b707e7c5a62ff0fd5ed8637..a1742e64232c949dc88deb5d6083c4bf62e6aae9 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2713,4 +2713,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2729,4 +2729,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Leaves start - Photographer API
@NotNull PhotographerManager getPhotographerManager();
@NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
// Leaves end - Photographer API
+
+ // Leaves start - Bytebuf API
@@ -33,10 +33,10 @@ index f4f83b1534a90127a77420a1768cd4b255a04868..8d4c10d7d8b3982a960ca2cee52ce069
+ // Leaves end - Bytebuf API
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 494dca2ee48a03953d47050b178496df12bc48c5..b429eb9a0326460a8841a1cfdfd6cd13c02ec2b7 100644
index d34419693fc78b3f7e8f6bbf115f17f29e5e3377..ab45edbc10398d92ddfcfd16d12d49f5b4e87c4c 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3853,6 +3853,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3860,6 +3860,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
boolean isChunkSent(long chunkKey);
// Paper end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Revert raid changes
diff --git a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
index f6218d317af4f4d83292a10abdf583fb01824232..3eb836575307116ce0668eadd6a6ee0a9aafc7cd 100644
index 22e14ba522510d659c191d72536cde895458d9ed..253f937dbd130fac064963b4af7572e1302fee8f 100644
--- a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
@@ -219,9 +219,7 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
@@ -221,9 +221,7 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
/**
* When a player gets bad omen after killing a patrol captain.
*

View File

@@ -5,36 +5,40 @@ Subject: [PATCH] Fix SculkCatalyst exp skip
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c10408e6e 100644
index 76c08499b704a6cb0cb95ce69b9a9248d69cc127..316bbf8c95e4803190897d66a0c7d8b4316f4164 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -25,17 +25,25 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
@@ -28,6 +28,8 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
private float deathSoundVolume;
private float deathSoundPitch;
// Paper end
+ private int rewardExp; // Leaves - exp fix
+
private boolean cancelled;
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops) {
this(entity, damageSource, drops, 0);
}
@ApiStatus.Internal
@@ -37,12 +39,19 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
+ // Leaves start - exp fix
+ this(what, damageSource, drops, droppedExp, droppedExp);
@ApiStatus.Internal
public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
+ // Leaves start - exp fix
+ this(livingEntity, damageSource, drops, droppedExp, droppedExp);
+ }
+
+ public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
super(what);
+ @ApiStatus.Internal
+ public EntityDeathEvent(@NotNull final LivingEntity livingEntity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
super(livingEntity);
this.damageSource = damageSource;
this.drops = drops;
this.dropExp = droppedExp;
+ this.rewardExp = rewardExp;
}
-
+ // Leaves end - exp fix
@NotNull
@Override
@@ -75,6 +83,7 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
public LivingEntity getEntity() {
@@ -81,6 +90,7 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
*/
public void setDroppedExp(int exp) {
this.dropExp = exp;
@@ -42,11 +46,10 @@ index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c
}
/**
@@ -226,4 +235,14 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
@@ -210,6 +220,16 @@ public class EntityDeathEvent extends EntityEvent implements Cancellable {
this.deathSoundPitch = pitch;
}
// Paper end
+
+ // Leaves start - exp fix
+ public int getRewardExp() {
+ return rewardExp;
@@ -56,26 +59,28 @@ index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c
+ this.rewardExp = rewardExp;
+ }
+ // Leaves end - exp fix
}
+
@Override
public boolean isCancelled() {
return this.cancelled;
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index ab7584873e46020148bceecbd42a43055684e6a0..7c99b1c6f5fc8e4ce442d111e7598ddb89d6ee05 100644
index 6316a2f1d2dc0314397e33e6dbd354fb8bc50541..16d4e3d42710be5eb87372d31c0ea9935d441de0 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -18,6 +18,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@@ -23,6 +23,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private Component deathMessage;
private Component deathScreenMessageOverride = null;
private boolean doExpDrop;
+ private boolean useApiExpDropStatus = false; // Leaves - exp fix
private boolean keepLevel = false;
private boolean keepInventory = false;
private boolean doExpDrop; // Paper - shouldDropExperience API
+ private boolean useApiExpDropStatus = false; // Leaves - exp fix
// Paper start - adventure
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
@@ -122,9 +123,16 @@ public class PlayerDeathEvent extends EntityDeathEvent {
*/
public void setShouldDropExperience(boolean doExpDrop) {
@Deprecated
@@ -82,8 +83,15 @@ public class PlayerDeathEvent extends EntityDeathEvent {
this.showDeathMessages = true;
this.deathMessage = LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage);
this.doExpDrop = doExpDrop;
+ this.useApiExpDropStatus = true; // Leaves - exp fix
}
// Paper end - shouldDropExperience API
+ // Leaves start - exp fix
+ public boolean forceUseEventDropStatus() {

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Sun, 18 May 2025 19:59:11 +0800
Subject: [PATCH] Leaves Config API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 30488f80b98d1dba485e53601edb5cb0e23b7591..91fa30c1713795007faef73280713a33d2518487 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3030,4 +3030,10 @@ public final class Bukkit {
return server.getBytebufManager();
}
// Leaves end - Bytebuf API
+
+ // Leaves start - Config API
+ public static org.leavesmc.leaves.config.LeavesConfigProvider getLeavesConfig() {
+ return server.getLeavesConfig();
+ }
+ // Leaves end - Config API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a1742e64232c949dc88deb5d6083c4bf62e6aae9..75a1917d998bf8aa0b86a67ca0f0836804fad012 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2733,4 +2733,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Leaves start - Bytebuf API
org.leavesmc.leaves.bytebuf.BytebufManager getBytebufManager();
// Leaves end - Bytebuf API
+
+ // Leaves start - Config API
+ org.leavesmc.leaves.config.LeavesConfigProvider getLeavesConfig();
+ // Leaves End - Config API
}

View File

@@ -4,8 +4,8 @@ import com.google.gson.JsonElement;
import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
import java.util.List;
import java.util.UUID;
public interface Bytebuf {
@@ -103,5 +103,7 @@ public interface Bytebuf {
Bytebuf copy();
void retain();
boolean release();
}

View File

@@ -5,8 +5,10 @@ import org.leavesmc.leaves.bytebuf.packet.PacketListener;
public interface BytebufManager {
@Deprecated
void registerListener(Plugin plugin, PacketListener listener);
@Deprecated
void unregisterListener(Plugin plugin, PacketListener listener);
Bytebuf newBytebuf(int size);

View File

@@ -2,5 +2,6 @@ package org.leavesmc.leaves.bytebuf.packet;
import org.leavesmc.leaves.bytebuf.Bytebuf;
@Deprecated
public record Packet(PacketType type, Bytebuf bytebuf) {
}

View File

@@ -2,6 +2,7 @@ package org.leavesmc.leaves.bytebuf.packet;
import org.bukkit.entity.Player;
@Deprecated
public interface PacketListener {
Packet onPacketIn(Player player, Packet packet);

View File

@@ -1,5 +1,6 @@
package org.leavesmc.leaves.bytebuf.packet;
@Deprecated
public enum PacketType {
// ClientboundBundle,
// ClientboundBundleDelimiter,

View File

@@ -0,0 +1,8 @@
package org.leavesmc.leaves.config;
public interface LeavesConfigProvider {
LeavesConfigValue getConfig(String configNode);
void setConfig(String configNode, LeavesConfigValue value);
}

View File

@@ -0,0 +1,36 @@
package org.leavesmc.leaves.config;
public record LeavesConfigValue(Object value) {
public int getInt() {
if (value instanceof Integer) {
return (Integer) value;
}
throw new ClassCastException("Value is not an integer");
}
public double getDouble() {
if (value instanceof Double) {
return (Double) value;
}
throw new ClassCastException("Value is not a double");
}
public boolean getBoolean() {
if (value instanceof Boolean) {
return (Boolean) value;
}
throw new ClassCastException("Value is not a boolean");
}
public String getString() {
if (value instanceof String) {
return (String) value;
}
throw new ClassCastException("Value is not a string");
}
public String toString() {
return value.toString();
}
}

View File

@@ -17,31 +17,29 @@ public interface Bot extends Player {
*
* @return fakeplayer skin name
*/
@Nullable
public String getSkinName();
@Nullable String getSkinName();
/**
* Gets the fakeplayer name without prefix and suffix
*
* @return fakeplayer real name
*/
@NotNull
public String getRealName();
@NotNull String getRealName();
/**
* Gets the creator's UUID of the fakeplayer
*
* @return creator's UUID
*/
@Nullable
public UUID getCreatePlayerUUID();
@Nullable UUID getCreatePlayerUUID();
/**
* Add an action to the fakeplayer
*
* @param action bot action
*/
public void addAction(@NotNull LeavesBotAction action);
@org.jetbrains.annotations.ApiStatus.Experimental
void addAction(@NotNull LeavesBotAction action);
/**
* Get the copy action in giving index
@@ -49,26 +47,27 @@ public interface Bot extends Player {
* @param index index of actions
* @return Action of that index
*/
public LeavesBotAction getAction(int index);
@org.jetbrains.annotations.ApiStatus.Experimental
LeavesBotAction getAction(int index);
/**
* Get action size
*
* @return size
*/
public int getActionSize();
int getActionSize();
/**
* Stop the action in giving index
*
* @param index index of actions
*/
public void stopAction(int index);
void stopAction(int index);
/**
* Stop all the actions of the fakeplayer
*/
public void stopAllActions();
void stopAllActions();
/**
* Remove the fakeplayer
@@ -76,5 +75,5 @@ public interface Bot extends Player {
* @param save should save
* @return success
*/
public boolean remove(boolean save);
boolean remove(boolean save);
}

View File

@@ -14,11 +14,11 @@ public interface BotCreator {
return Bukkit.getBotManager().botCreator(realName, location);
}
public BotCreator name(String name);
BotCreator name(String name);
public BotCreator skinName(String skinName);
BotCreator skinName(String skinName);
public BotCreator skin(String[] skin);
BotCreator skin(String[] skin);
/**
* Sets the skin of the bot using the Mojang API based on the provided skin name.
@@ -27,19 +27,18 @@ public interface BotCreator {
*
* @return BotCreator
*/
public BotCreator mojangAPISkin();
BotCreator mojangAPISkin();
public BotCreator location(@NotNull Location location);
BotCreator location(@NotNull Location location);
public BotCreator creator(@Nullable CommandSender creator);
BotCreator creator(@Nullable CommandSender creator);
/**
* Create a bot directly
*
* @return a bot, null spawn fail
*/
@Nullable
public Bot spawn();
@Nullable Bot spawn();
/**
* Create a bot and apply skin of player names `skinName` from MojangAPI
@@ -49,5 +48,5 @@ public interface BotCreator {
*
* @param consumer Consumer
*/
public void spawnWithSkin(Consumer<Bot> consumer);
void spawnWithSkin(Consumer<Bot> consumer);
}

View File

@@ -19,8 +19,7 @@ public interface BotManager {
* @param uuid the uuid to look up
* @return a fakeplayer if one was found, null otherwise
*/
@Nullable
public Bot getBot(@NotNull UUID uuid);
@Nullable Bot getBot(@NotNull UUID uuid);
/**
* Gets a fakeplayer object by the given name.
@@ -28,15 +27,14 @@ public interface BotManager {
* @param name the name to look up
* @return a fakeplayer if one was found, null otherwise
*/
@Nullable
public Bot getBot(@NotNull String name);
@Nullable Bot getBot(@NotNull String name);
/**
* Gets a view of all currently logged in fakeplayers. This view is a reused object, making some operations like Collection.size() zero-allocation.
*
* @return a view of fakeplayers.
*/
public Collection<Bot> getBots();
Collection<Bot> getBots();
/**
* Register a custom bot action.
@@ -45,7 +43,8 @@ public interface BotManager {
* @param action action executor
* @return true if success, or false
*/
public boolean registerCustomBotAction(String name, CustomBotAction action);
@org.jetbrains.annotations.ApiStatus.Experimental
boolean registerCustomBotAction(String name, CustomBotAction action);
/**
* Unregister a custom bot action.
@@ -53,7 +52,8 @@ public interface BotManager {
* @param name action name
* @return true if success, or false
*/
public boolean unregisterCustomBotAction(String name);
@org.jetbrains.annotations.ApiStatus.Experimental
boolean unregisterCustomBotAction(String name);
public BotCreator botCreator(@NotNull String realName, @NotNull Location location);
BotCreator botCreator(@NotNull String realName, @NotNull Location location);
}

View File

@@ -8,20 +8,19 @@ import java.io.File;
public interface Photographer extends Player {
@NotNull
public String getId();
@NotNull String getId();
public void setRecordFile(@NotNull File file);
void setRecordFile(@NotNull File file);
public void stopRecording();
void stopRecording();
public void stopRecording(boolean async);
void stopRecording(boolean async);
public void stopRecording(boolean async, boolean save);
void stopRecording(boolean async, boolean save);
public void pauseRecording();
void pauseRecording();
public void resumeRecording();
void resumeRecording();
public void setFollowPlayer(@Nullable Player player);
void setFollowPlayer(@Nullable Player player);
}

View File

@@ -1,33 +1,27 @@
package org.leavesmc.leaves.entity;
import org.bukkit.Location;
import org.bukkit.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.entity.botaction.CustomBotAction;
import org.leavesmc.leaves.replay.BukkitRecorderOption;
import java.util.Collection;
import java.util.UUID;
public interface PhotographerManager {
@Nullable
public Photographer getPhotographer(@NotNull UUID uuid);
@Nullable Photographer getPhotographer(@NotNull UUID uuid);
@Nullable
public Photographer getPhotographer(@NotNull String id);
@Nullable Photographer getPhotographer(@NotNull String id);
@Nullable
public Photographer createPhotographer(@NotNull String id, @NotNull Location location);
@Nullable Photographer createPhotographer(@NotNull String id, @NotNull Location location);
@Nullable
public Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
@Nullable Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
public void removePhotographer(@NotNull String id);
void removePhotographer(@NotNull String id);
public void removePhotographer(@NotNull UUID uuid);
void removePhotographer(@NotNull UUID uuid);
public void removeAllPhotographers();
void removeAllPhotographers();
public Collection<Photographer> getPhotographers();
Collection<Photographer> getPhotographers();
}

View File

@@ -3,6 +3,8 @@ package org.leavesmc.leaves.entity.botaction;
/**
* A Leaves bot action enum
*/
@org.jetbrains.annotations.ApiStatus.Experimental
public enum BotActionType {
ATTACK("attack"),
BREAK("break"),
@@ -23,7 +25,7 @@ public enum BotActionType {
private final String name;
private BotActionType(String name) {
BotActionType(String name) {
this.name = name;
}

View File

@@ -10,6 +10,7 @@ import java.util.List;
/**
* Represents a class which contains methods for a custom bot action
*/
@org.jetbrains.annotations.ApiStatus.Experimental
public interface CustomBotAction {
/**
@@ -18,37 +19,42 @@ public interface CustomBotAction {
* @param bot bot of the action
* @return true if once action finish, otherwise false
*/
public boolean doTick(Bot bot);
boolean doTick(Bot bot);
/**
* Created a new action instance.
* Created a new action instance.
*
* @param player player who create this action
* @param args passed action arguments
* @param args passed action arguments
* @return a new action instance with given args
*/
@Nullable
public CustomBotAction getNew(@Nullable Player player, String[] args);
@Nullable CustomBotAction getNew(@Nullable Player player, String[] args);
/**
* Requests a list of possible completions for a action argument.
*
* @return A List of a List of possible completions for the argument.
*/
@NotNull
public List<List<String>> getTabComplete();
@NotNull List<List<String>> getTabComplete();
/**
* Return a ticks to wait between {@link CustomBotAction#doTick(Bot)}
* Return the interval between {@link CustomBotAction#doTick(Bot)}
*
* @return the ticks to wait between runs
* @return the tick interval
*/
public int getTickDelay();
int getInitialTickInterval();
/**
* Return the tick delay to the first {@link CustomBotAction#doTick(Bot)}
*
* @return the tick delay
*/
int getInitialTickDelay();
/**
* Return a number of times {@link CustomBotAction#doTick(Bot)} can return true
*
* @return the number of times an action can be executed
*/
public int getNumber();
int getInitialNumber();
}

View File

@@ -5,61 +5,54 @@ import org.jetbrains.annotations.Nullable;
import java.util.UUID;
@org.jetbrains.annotations.ApiStatus.Experimental
public class LeavesBotAction {
private final String actionName;
private int tickToExecute;
private int executeInterval;
private int remainingExecuteTime;
private final UUID uuid;
private final int initialTickDelay;
private final int initialTickInterval;
private final int initialNumber;
private Player actionPlayer;
private int tickToNext;
private int numberRemaining;
private boolean cancel;
public LeavesBotAction(BotActionType type, int executeInterval, int remainingExecuteTime) {
this(type.getName(), executeInterval, remainingExecuteTime, UUID.randomUUID());
public LeavesBotAction(BotActionType type, int initialTickInterval, int initialNumber) {
this(type.getName(), UUID.randomUUID(), 0, initialTickInterval, initialNumber);
}
public LeavesBotAction(String name, int executeInterval, int remainingExecuteTime) {
this(name, executeInterval, remainingExecuteTime, UUID.randomUUID());
public LeavesBotAction(BotActionType type, int initialTickDelay, int initialTickInterval, int initialNumber) {
this(type.getName(), UUID.randomUUID(), initialTickDelay, initialTickInterval, initialNumber);
}
protected LeavesBotAction(String name, int executeInterval, int remainingExecuteTime, UUID actionUUID) {
protected LeavesBotAction(String name, UUID actionUUID, int initialTickDelay, int initialTickInterval, int initialNumber) {
this.actionName = name;
this.remainingExecuteTime = remainingExecuteTime;
this.executeInterval = executeInterval;
this.uuid = actionUUID;
this.tickToExecute = executeInterval;
}
public void setTickToExecute(int tickToExecute) {
this.tickToExecute = tickToExecute;
}
public int getTickToExecute() {
return tickToExecute;
}
public void setExecuteInterval(int executeInterval) {
this.executeInterval = executeInterval;
}
public int getExecuteInterval() {
return executeInterval;
}
public void setRemainingExecuteTime(int remainingExecuteTime) {
this.remainingExecuteTime = remainingExecuteTime;
}
public int getRemainingExecuteTime() {
return remainingExecuteTime;
this.initialTickDelay = initialTickDelay;
this.initialTickInterval = initialTickInterval;
this.initialNumber = initialNumber;
}
public String getActionName() {
return actionName;
}
public void setActionPlayer(@Nullable Player actionPlayer) {
this.actionPlayer = actionPlayer;
public UUID getUuid() {
return uuid;
}
public int getInitialTickDelay() {
return initialTickDelay;
}
public int getInitialTickInterval() {
return initialTickInterval;
}
public int getInitialNumber() {
return initialNumber;
}
@Nullable
@@ -67,7 +60,31 @@ public class LeavesBotAction {
return actionPlayer;
}
public UUID getUuid() {
return uuid;
public void setActionPlayer(@Nullable Player actionPlayer) {
this.actionPlayer = actionPlayer;
}
public boolean isCancel() {
return cancel;
}
public void setCancel(boolean cancel) {
this.cancel = cancel;
}
public int getNumberRemaining() {
return numberRemaining;
}
public void setNumberRemaining(int numberRemaining) {
this.numberRemaining = numberRemaining;
}
public int getTickToNext() {
return tickToNext;
}
public void setTickToNext(int tickToNext) {
this.tickToNext = tickToNext;
}
}

View File

@@ -10,18 +10,16 @@ import java.util.UUID;
public class BotActionExecuteEvent extends BotActionEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
public enum Result {
PASS, SOFT_CANCEL, HARD_CANCEL;
}
private Result result = Result.PASS;
public BotActionExecuteEvent(@NotNull Bot who, String actionName, UUID actionUUID) {
super(who, actionName, actionUUID);
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return result != Result.PASS;
@@ -45,8 +43,9 @@ public class BotActionExecuteEvent extends BotActionEvent implements Cancellable
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
public enum Result {
PASS, SOFT_CANCEL, HARD_CANCEL
}
}

View File

@@ -12,15 +12,18 @@ import java.util.UUID;
public class BotActionScheduleEvent extends BotActionEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false;
private final CommandSender sender;
private boolean cancel = false;
public BotActionScheduleEvent(@NotNull Bot who, String actionName, UUID actionUUID, CommandSender sender) {
super(who, actionName, actionUUID);
this.sender = sender;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return cancel;
@@ -41,8 +44,4 @@ public class BotActionScheduleEvent extends BotActionEvent implements Cancellabl
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -9,16 +9,11 @@ import org.leavesmc.leaves.entity.Bot;
import java.util.UUID;
public class BotActionStopEvent extends BotActionEvent implements Cancellable{
public class BotActionStopEvent extends BotActionEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false;
private final CommandSender sender;
public enum Reason {
DONE, COMMAND, PLUGIN, INTERNAL
}
private final Reason reason;
private boolean cancel = false;
public BotActionStopEvent(@NotNull Bot who, String actionName, UUID actionUUID, Reason stopReason, CommandSender sender) {
super(who, actionName, actionUUID);
@@ -26,6 +21,10 @@ public class BotActionStopEvent extends BotActionEvent implements Cancellable{
this.sender = sender;
}
public static HandlerList getHandlerList() {
return handlers;
}
public Reason getReason() {
return reason;
}
@@ -35,10 +34,6 @@ public class BotActionStopEvent extends BotActionEvent implements Cancellable{
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return cancel;
@@ -53,4 +48,8 @@ public class BotActionStopEvent extends BotActionEvent implements Cancellable{
public CommandSender getSender() {
return sender;
}
public enum Reason {
DONE, COMMAND, PLUGIN, INTERNAL
}
}

View File

@@ -12,8 +12,8 @@ public class BotConfigModifyEvent extends BotEvent implements Cancellable {
private final String configName;
private final String[] configValue;
private boolean cancel;
private final CommandSender sender;
private boolean cancel;
public BotConfigModifyEvent(@NotNull Bot who, String configName, String[] configValue, CommandSender sender) {
super(who);
@@ -22,6 +22,10 @@ public class BotConfigModifyEvent extends BotEvent implements Cancellable {
this.sender = sender;
}
public static HandlerList getHandlerList() {
return handlers;
}
@NotNull
public String getConfigName() {
return configName;
@@ -46,8 +50,4 @@ public class BotConfigModifyEvent extends BotEvent implements Cancellable {
public @NotNull HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -14,21 +14,12 @@ import org.jetbrains.annotations.Nullable;
public class BotCreateEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
public enum CreateReason {
COMMAND,
PLUGIN,
INTERNAL,
UNKNOWN,
}
private final String bot;
private final String skin;
private final CreateReason reason;
private final CommandSender creator;
private Location createLocation;
private boolean cancel = false;
public BotCreateEvent(@NotNull final String who, @NotNull final String skin, @NotNull final Location createLocation, @NotNull CreateReason reason, @Nullable CommandSender creator) {
this.bot = who;
this.skin = skin;
@@ -37,6 +28,11 @@ public class BotCreateEvent extends Event implements Cancellable {
this.creator = creator;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the fakeplayer name
*
@@ -112,8 +108,10 @@ public class BotCreateEvent extends Event implements Cancellable {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
public enum CreateReason {
COMMAND,
PLUGIN,
INTERNAL,
UNKNOWN,
}
}

View File

@@ -22,13 +22,13 @@ public class BotDeathEvent extends BotEvent implements Cancellable {
this.sendDeathMessage = sendDeathMessage;
}
@Override
public @NotNull HandlerList getHandlers() {
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}

View File

@@ -19,6 +19,11 @@ public class BotInventoryOpenEvent extends BotEvent implements Cancellable {
this.player = player;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return cancel;
@@ -38,9 +43,4 @@ public class BotInventoryOpenEvent extends BotEvent implements Cancellable {
public @NotNull HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -26,6 +26,11 @@ public class BotJoinEvent extends BotEvent {
this.joinMessage = joinMessage != null ? LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
public void joinMessage(@Nullable final Component joinMessage) {
this.joinMessage = joinMessage;
}
@@ -59,9 +64,4 @@ public class BotJoinEvent extends BotEvent {
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -23,6 +23,11 @@ public class BotLoadEvent extends Event implements Cancellable {
this.botUUID = uuid;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the fakeplayer name
*
@@ -51,9 +56,4 @@ public class BotLoadEvent extends Event implements Cancellable {
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -15,20 +15,11 @@ import org.leavesmc.leaves.entity.Bot;
public class BotRemoveEvent extends BotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
public enum RemoveReason {
COMMAND,
PLUGIN,
DEATH,
INTERNAL
}
private final RemoveReason reason;
private final CommandSender remover;
private Component removeMessage;
private boolean save;
private boolean cancel = false;
public BotRemoveEvent(@NotNull final Bot who, @NotNull RemoveReason reason, @Nullable CommandSender remover, @Nullable Component removeMessage, boolean save) {
super(who);
this.reason = reason;
@@ -37,6 +28,11 @@ public class BotRemoveEvent extends BotEvent implements Cancellable {
this.save = save;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the remove reason of the bot
*
@@ -99,8 +95,10 @@ public class BotRemoveEvent extends BotEvent implements Cancellable {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
public enum RemoveReason {
COMMAND,
PLUGIN,
DEATH,
INTERNAL
}
}

View File

@@ -16,6 +16,11 @@ public class BotSpawnLocationEvent extends BotEvent {
this.spawnLocation = spawnLocation;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
@NotNull
public Location getSpawnLocation() {
return spawnLocation;
@@ -30,9 +35,4 @@ public class BotSpawnLocationEvent extends BotEvent {
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -21,6 +21,11 @@ public class PlayerOperationLimitEvent extends PlayerEvent {
this.operation = operation;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Gets the operated block
*
@@ -45,11 +50,6 @@ public class PlayerOperationLimitEvent extends PlayerEvent {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
public enum Operation {
MINE, PLACE
}

View File

@@ -0,0 +1,10 @@
// This file is licensed under the MIT license.
package org.leavesmc.leaves.plugin;
import java.util.Set;
public interface FeatureManager {
Set<String> getAvailableFeatures();
boolean isFeatureAvailable(String feature);
}

View File

@@ -0,0 +1,9 @@
// This file is licensed under the MIT license.
package org.leavesmc.leaves.plugin;
public class Features {
public static final String MIXIN = "mixin";
public static final String FAKEPLAYER = "fakeplayer";
public static final String PHOTOGRAPHER = "photographer";
public static final String RECORDER = "recorder";
}