mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 20:09:23 +00:00
Be prepared for minecraft server patches
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
|
||||
Date: Thu, 6 Feb 2025 00:14:23 +0800
|
||||
Subject: [PATCH] Bytebuf API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b6c8536c143b9ff64e7a7cb7016d113e7f766fb1..eb49cf958cbbd1d53f0bb4556ade8bc407ae7a20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -318,6 +318,7 @@ public final class CraftServer implements Server {
|
||||
private final ServerConfiguration serverConfig = new PaperServerConfiguration();
|
||||
private final org.leavesmc.leaves.entity.CraftBotManager botManager; // Leaves
|
||||
private final org.leavesmc.leaves.entity.CraftPhotographerManager photographerManager = new org.leavesmc.leaves.entity.CraftPhotographerManager(); // Leaves
|
||||
+ private final org.leavesmc.leaves.bytebuf.internal.InternalBytebufHandler internalBytebufHandler = new org.leavesmc.leaves.bytebuf.internal.InternalBytebufHandler(); // Leaves
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
|
||||
@@ -3226,4 +3227,15 @@ public final class CraftServer implements Server {
|
||||
return photographerManager;
|
||||
}
|
||||
// Leaves end - replay mod api
|
||||
+
|
||||
+ // Leaves start - Bytebuf API
|
||||
+ @Override
|
||||
+ public org.leavesmc.leaves.bytebuf.BytebufManager getBytebufManager() {
|
||||
+ return internalBytebufHandler.getManager();
|
||||
+ }
|
||||
+
|
||||
+ public org.leavesmc.leaves.bytebuf.internal.InternalBytebufHandler getBytebufHandler() {
|
||||
+ return internalBytebufHandler;
|
||||
+ }
|
||||
+ // Leaves end - Bytebuf API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index e09e9daadb9f8d8230d72f50ab34bffd1c5c3ecd..32b866b5327634af3c5fdf80d80839e219789b21 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3576,4 +3576,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setDeathScreenScore(final int score) {
|
||||
getHandle().setScore(score);
|
||||
}
|
||||
+
|
||||
+ // Leaves start - Bytebuf API
|
||||
+ @Override
|
||||
+ public void sendPacket(org.leavesmc.leaves.bytebuf.packet.Packet packet) {
|
||||
+ this.server.getBytebufHandler().applyPacketToPlayer(this.getHandle(), packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendPacket(org.leavesmc.leaves.bytebuf.Bytebuf bytebuf, org.leavesmc.leaves.bytebuf.packet.PacketType type) {
|
||||
+ this.server.getBytebufHandler().applyPacketToPlayer(this.getHandle(), new org.leavesmc.leaves.bytebuf.packet.Packet(type, bytebuf));
|
||||
+ }
|
||||
+ // Leaves end - Bytebuf API
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MC_XiaoHei <xiaohei.xor7@outlook.com>
|
||||
Date: Mon, 22 Jul 2024 09:05:56 +0000
|
||||
Subject: [PATCH] Leaves plugin
|
||||
|
||||
This patch is licensed under the MIT license.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
|
||||
index 41c95f00b4b2bea6d31f85e268c33d7f6184823e..a9154645554379d80b43171562f6f64a01ed3792 100644
|
||||
--- a/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
|
||||
+++ b/src/main/java/io/papermc/paper/command/PaperPluginsCommand.java
|
||||
@@ -172,28 +172,41 @@ public class PaperPluginsCommand extends BukkitCommand {
|
||||
|
||||
final TreeMap<String, PluginProvider<JavaPlugin>> paperPlugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final TreeMap<String, PluginProvider<JavaPlugin>> spigotPlugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
+ // Leaves start - leaves plugin
|
||||
+ final TreeMap<String, PluginProvider<JavaPlugin>> leavesPlugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (final PluginProvider<JavaPlugin> provider : LaunchEntryPointHandler.INSTANCE.get(Entrypoint.PLUGIN).getRegisteredProviders()) {
|
||||
final PluginMeta configuration = provider.getMeta();
|
||||
|
||||
if (provider instanceof SpigotPluginProvider) {
|
||||
spigotPlugins.put(configuration.getDisplayName(), provider);
|
||||
+ } else if (provider instanceof PaperPluginParent.LeavesServerPluginProvider) {
|
||||
+ leavesPlugins.put(configuration.getDisplayName(), provider);
|
||||
} else if (provider instanceof PaperPluginParent.PaperServerPluginProvider) {
|
||||
paperPlugins.put(configuration.getDisplayName(), provider);
|
||||
}
|
||||
}
|
||||
|
||||
+ final int sizeLeavesPlugins = leavesPlugins.size();
|
||||
final int sizePaperPlugins = paperPlugins.size();
|
||||
final int sizeSpigotPlugins = spigotPlugins.size();
|
||||
- final int sizePlugins = sizePaperPlugins + sizeSpigotPlugins;
|
||||
- final boolean hasAllPluginTypes = (sizePaperPlugins > 0 && sizeSpigotPlugins > 0);
|
||||
+ final int sizePlugins = sizePaperPlugins + sizeSpigotPlugins + sizeLeavesPlugins;
|
||||
+ final boolean showSize = (sizePaperPlugins > 0 && sizeSpigotPlugins > 0) || (sizePaperPlugins > 0 && sizeLeavesPlugins > 0) || (sizeSpigotPlugins > 0 && sizeLeavesPlugins > 0);
|
||||
|
||||
final Component infoMessage = Component.text().append(INFO_ICON_SERVER_PLUGIN).append(Component.text("Server Plugins (%s):".formatted(sizePlugins), NamedTextColor.WHITE)).build();
|
||||
|
||||
sender.sendMessage(infoMessage);
|
||||
|
||||
+ if (!leavesPlugins.isEmpty()) {
|
||||
+ sender.sendMessage(header("Leaves Plugins", 0x37D1AB, sizeLeavesPlugins, showSize));
|
||||
+ }
|
||||
+
|
||||
+ for (final Component component : formatProviders(leavesPlugins)) {
|
||||
+ sender.sendMessage(component);
|
||||
+ }
|
||||
+
|
||||
if (!paperPlugins.isEmpty()) {
|
||||
- sender.sendMessage(header("Paper Plugins", 0x0288D1, sizePaperPlugins, hasAllPluginTypes));
|
||||
+ sender.sendMessage(header("Paper Plugins", 0x0288D1, sizePaperPlugins, showSize));
|
||||
}
|
||||
|
||||
for (final Component component : formatProviders(paperPlugins)) {
|
||||
@@ -201,8 +214,9 @@ public class PaperPluginsCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
if (!spigotPlugins.isEmpty()) {
|
||||
- sender.sendMessage(header("Bukkit Plugins", 0xED8106, sizeSpigotPlugins, hasAllPluginTypes));
|
||||
+ sender.sendMessage(header("Bukkit Plugins", 0xED8106, sizeSpigotPlugins, showSize));
|
||||
}
|
||||
+ // Leaves end - leaves plugin
|
||||
|
||||
for (final Component component : formatProviders(spigotPlugins)) {
|
||||
sender.sendMessage(component);
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
index 70413fddd23ca1165cb5090cce4fddcb1bbca93f..2cdf32d5f08b575cf0fe755634242ddb05b59774 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
@@ -117,19 +117,30 @@ public class PluginInitializerManager {
|
||||
java.util.List<Path> files = ((java.util.List<File>) optionSet.valuesOf("add-plugin")).stream().map(File::toPath).toList();
|
||||
io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.PluginFlagProviderSource.INSTANCE, files);
|
||||
|
||||
+ // Leaves start - leaves plugin
|
||||
+ final Set<String> leavesPluginNames = new TreeSet<>();
|
||||
final Set<String> paperPluginNames = new TreeSet<>();
|
||||
final Set<String> legacyPluginNames = new TreeSet<>();
|
||||
LaunchEntryPointHandler.INSTANCE.getStorage().forEach((entrypoint, providerStorage) -> {
|
||||
providerStorage.getRegisteredProviders().forEach(provider -> {
|
||||
if (provider instanceof final SpigotPluginProvider legacy) {
|
||||
legacyPluginNames.add(String.format("%s (%s)", legacy.getMeta().getName(), legacy.getMeta().getVersion()));
|
||||
+ } else if (provider instanceof final PaperPluginParent.LeavesServerPluginProvider leaves) {
|
||||
+ leavesPluginNames.add(String.format("%s (%s)", provider.getMeta().getName(), provider.getMeta().getVersion()));
|
||||
} else if (provider instanceof final PaperPluginParent.PaperServerPluginProvider paper) {
|
||||
paperPluginNames.add(String.format("%s (%s)", provider.getMeta().getName(), provider.getMeta().getVersion()));
|
||||
}
|
||||
});
|
||||
});
|
||||
- final int total = paperPluginNames.size() + legacyPluginNames.size();
|
||||
+ final int total = leavesPluginNames.size() + paperPluginNames.size() + legacyPluginNames.size();
|
||||
LOGGER.info("Initialized {} plugin{}", total, total == 1 ? "" : "s");
|
||||
+ if (!leavesPluginNames.isEmpty()) {
|
||||
+ if (LOGGER.isDebugEnabled()) {
|
||||
+ LOGGER.info("Leaves plugins ({}):\n - {}", leavesPluginNames.size(), String.join("\n - ", leavesPluginNames));
|
||||
+ } else {
|
||||
+ LOGGER.info("Leaves plugins ({}):\n - {}", leavesPluginNames.size(), String.join(", ", leavesPluginNames));
|
||||
+ }
|
||||
+ } // Leaves end - leaves plugin
|
||||
if (!paperPluginNames.isEmpty()) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.info("Paper plugins ({}):\n - {}", paperPluginNames.size(), String.join("\n - ", paperPluginNames));
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/LegacyPaperMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/LegacyPaperMeta.java
|
||||
index 8cd649c977172f6b757d68565fcbb9eb8ae100a3..c18a94af99c827d73c31279e324e15ec8217a31d 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/LegacyPaperMeta.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/LegacyPaperMeta.java
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
-class LegacyPaperMeta {
|
||||
+public class LegacyPaperMeta {
|
||||
|
||||
|
||||
private static final TypeToken<Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>>> TYPE_TOKEN = new TypeToken<>() {
|
||||
@@ -28,6 +28,12 @@ class LegacyPaperMeta {
|
||||
ConfigurationTransformation.chain(notVersioned()).apply(node);
|
||||
}
|
||||
|
||||
+ // Leaves start - leaves plugin
|
||||
+ public static void migrate(org.spongepowered.configurate.ConfigurationNode node) throws ConfigurateException {
|
||||
+ ConfigurationTransformation.chain(notVersioned()).apply(node);
|
||||
+ }
|
||||
+ // Leaves end - leaves plugin
|
||||
+
|
||||
private static ConfigurationTransformation notVersioned() {
|
||||
return ConfigurationTransformation.builder()
|
||||
.addAction(NodePath.path(), (path, value) -> {
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
||||
index d3b3a8baca013909fa9c6204d964d7d7efeb2719..753fdb9782ee6b4cb8e232ebfdd52dea5d9e2a66 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
||||
@@ -55,7 +55,7 @@ public class PaperPluginMeta implements PluginMeta {
|
||||
@Required
|
||||
private String version;
|
||||
private String description;
|
||||
- private List<String> authors = List.of();
|
||||
+ protected List<String> authors = List.of(); // Leaves - leaves plugin
|
||||
private List<String> contributors = List.of();
|
||||
private String website;
|
||||
private String prefix;
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java b/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java
|
||||
index 8d0da6e46d4eb5eb05c3144510c4ef083559d0ec..331a4e98699f65adfad275bde923c0f57ef4dd18 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/PluginFileType.java
|
||||
@@ -23,6 +23,7 @@ import java.util.jar.JarFile;
|
||||
public abstract class PluginFileType<T, C extends PluginMeta> {
|
||||
|
||||
public static final String PAPER_PLUGIN_YML = "paper-plugin.yml";
|
||||
+ public static final String LEAVES_PLUGIN_JSON = "leaves-plugin.json"; // Leaves - leaves plugin
|
||||
private static final List<String> CONFIG_TYPES = new ArrayList<>();
|
||||
|
||||
public static final PluginFileType<PaperPluginParent, PaperPluginMeta> PAPER = new PluginFileType<>(PAPER_PLUGIN_YML, PaperPluginParent.FACTORY) {
|
||||
@@ -43,8 +44,21 @@ public abstract class PluginFileType<T, C extends PluginMeta> {
|
||||
entrypointHandler.register(Entrypoint.PLUGIN, provider);
|
||||
}
|
||||
};
|
||||
+ // Leaves start - leaves plugin
|
||||
+ public static final PluginFileType<PaperPluginParent, org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta> LEAVES = new PluginFileType<>(LEAVES_PLUGIN_JSON, PaperPluginParent.LEAVES_FACTORY) {
|
||||
+ @Override
|
||||
+ protected void register(EntrypointHandler entrypointHandler, PaperPluginParent parent) {
|
||||
+ PaperPluginParent.LeavesBootstrapProvider bootstrapPluginProvider = null;
|
||||
+ if (parent.shouldCreateBootstrap()) {
|
||||
+ bootstrapPluginProvider = parent.createLeavesBootstrapProvider();
|
||||
+ entrypointHandler.register(Entrypoint.BOOTSTRAPPER, bootstrapPluginProvider);
|
||||
+ }
|
||||
+ entrypointHandler.register(Entrypoint.PLUGIN, parent.createLeavesPluginProvider(bootstrapPluginProvider));
|
||||
+ }
|
||||
+ };
|
||||
|
||||
- private static final List<PluginFileType<?, ?>> VALUES = List.of(PAPER, SPIGOT);
|
||||
+ private static final List<PluginFileType<?, ?>> VALUES = List.of(LEAVES, PAPER, SPIGOT);
|
||||
+ // Leaves end - leaves plugin
|
||||
|
||||
private final String config;
|
||||
private final PluginTypeFactory<T, C> factory;
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java
|
||||
index 55a6898e95704cddafda1ca5dc0951c7102fe10b..283f046c6f34c83f01e1ca1d80cbd7cc35a2b7d2 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginParent.java
|
||||
@@ -27,6 +27,7 @@ import java.util.jar.JarFile;
|
||||
public class PaperPluginParent {
|
||||
|
||||
public static final PluginTypeFactory<PaperPluginParent, PaperPluginMeta> FACTORY = new PaperPluginProviderFactory();
|
||||
+ public static final PluginTypeFactory<PaperPluginParent, org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta> LEAVES_FACTORY = new org.leavesmc.leaves.plugin.provider.LeavesPluginProviderFactory(); // Leaves - leaves plugin
|
||||
private final Path path;
|
||||
private final JarFile jarFile;
|
||||
private final PaperPluginMeta description;
|
||||
@@ -51,6 +52,32 @@ public class PaperPluginParent {
|
||||
return new PaperBootstrapProvider();
|
||||
}
|
||||
|
||||
+ // Leaves start - leaves plugin
|
||||
+ public LeavesBootstrapProvider createLeavesBootstrapProvider() {
|
||||
+ return new io.papermc.paper.plugin.provider.type.paper.PaperPluginParent.LeavesBootstrapProvider();
|
||||
+ }
|
||||
+ public LeavesServerPluginProvider createLeavesPluginProvider(LeavesBootstrapProvider provider) {
|
||||
+ return new LeavesServerPluginProvider(provider);
|
||||
+ }
|
||||
+
|
||||
+ public class LeavesBootstrapProvider extends PaperBootstrapProvider {
|
||||
+ @Override
|
||||
+ public org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta getMeta() {
|
||||
+ return (org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta) super.getMeta();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public class LeavesServerPluginProvider extends PaperServerPluginProvider {
|
||||
+ LeavesServerPluginProvider(PaperPluginParent.LeavesBootstrapProvider bootstrapProvider) {
|
||||
+ super(bootstrapProvider);
|
||||
+ }
|
||||
+ @Override
|
||||
+ public org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta getMeta() {
|
||||
+ return (org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta) super.getMeta();
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - leaves plugin
|
||||
+
|
||||
public PaperServerPluginProvider createPluginProvider(PaperBootstrapProvider provider) {
|
||||
return new PaperServerPluginProvider(provider);
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java
|
||||
index 26422904751647a061397ce978bba752149003cd..884ed63dab16acca83fe8f421762f2561400b1fb 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/storage/SimpleProviderStorage.java
|
||||
@@ -26,6 +26,16 @@ public abstract class SimpleProviderStorage<T> implements ProviderStorage<T> {
|
||||
|
||||
@Override
|
||||
public void register(PluginProvider<T> provider) {
|
||||
+ // Leaves start - leaves plugin
|
||||
+ if (provider instanceof final io.papermc.paper.plugin.provider.type.paper.PaperPluginParent.LeavesServerPluginProvider leaves) {
|
||||
+ org.leavesmc.leaves.plugin.provider.configuration.LeavesPluginMeta meta = leaves.getMeta();
|
||||
+ java.util.List<String> unavailableFeatures = meta.getFeatures().getRequired().stream().filter(feature -> !org.leavesmc.leaves.plugin.ServerFeatureManager.INSTANCE.isFeatureAvailable(feature)).toList();
|
||||
+ if (!unavailableFeatures.isEmpty()) {
|
||||
+ LOGGER.warn("The plugin {} ({}) requires some unavailable feature(s) {}. The plugin has been skipped.", meta.getName(), meta.getVersion(), unavailableFeatures);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - leaves plugin
|
||||
this.providers.add(provider);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
|
||||
index fbad4a2242aa1ab910b2e2ae4cce973ff63fda84..89d4fa952d072dd6e071dc9eef51f4050f7e750e 100644
|
||||
--- a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
|
||||
+++ b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
|
||||
@@ -337,7 +337,13 @@ public final class PluginRemapper {
|
||||
}
|
||||
index.skip(inputFile);
|
||||
return CompletableFuture.completedFuture(inputFile);
|
||||
- }
|
||||
+ } else if (ns == null && Files.exists(fs.getPath(PluginFileType.LEAVES_PLUGIN_JSON))) { // Leaves start - leaves plugin
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is a Leaves plugin with no namespace specified.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ } // Leaves end - leaves plugin
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
return CompletableFuture.failedFuture(new RuntimeException("Failed to open plugin jar " + inputFile, ex));
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 6 Apr 2025 10:42:46 +0800
|
||||
Subject: [PATCH] Fix SculkCatalyst exp skip
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 03778c286144d8f04147f37aa59fb73fcc584833..daea37a117101a9f3b463e87bfc8f0f9db394aca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -851,7 +851,7 @@ public class CraftEventFactory {
|
||||
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
|
||||
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
|
||||
CraftWorld world = (CraftWorld) entity.getWorld();
|
||||
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior
|
||||
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity()), victim.getExperienceReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior // Leaves - exp fix
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -862,6 +862,7 @@ public class CraftEventFactory {
|
||||
playDeathSound(victim, event, damageSource);
|
||||
// Paper end
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
|
||||
lootCheck.run(); // Paper - advancement triggers before destroying items
|
||||
|
||||
// Paper start - Restore vanilla drops behavior
|
||||
@@ -901,6 +902,7 @@ public class CraftEventFactory {
|
||||
victim.newLevel = event.getNewLevel();
|
||||
victim.newTotalExp = event.getNewTotalExp();
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
|
||||
victim.newExp = event.getNewExp();
|
||||
|
||||
// Paper start - Restore vanilla drops behavior
|
||||
@@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
|
||||
Date: Sun, 18 May 2025 19:58:42 +0800
|
||||
Subject: [PATCH] Leaves Config API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index eb49cf958cbbd1d53f0bb4556ade8bc407ae7a20..6fbcde3248ec35d0188eea0e99922759d5f1d5cf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3238,4 +3238,11 @@ public final class CraftServer implements Server {
|
||||
return internalBytebufHandler;
|
||||
}
|
||||
// Leaves end - Bytebuf API
|
||||
+
|
||||
+ // Leaves start - Config API
|
||||
+ @Override
|
||||
+ public org.leavesmc.leaves.config.LeavesConfigProvider getLeavesConfig() {
|
||||
+ return org.leavesmc.leaves.config.InternalConfigProvider.INSTANCE;
|
||||
+ }
|
||||
+ // Leaves end - Config API
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user