mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-30 04:19:30 +00:00
2.2.35
This commit is contained in:
@@ -60,6 +60,7 @@ dependencies {
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
from(project(":compatibility:j21").tasks.jar.get().archiveFile)
|
||||
archiveFileName = "CustomFishing-${rootProject.properties["project_version"]}.jar"
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
relocate("net.kyori", "net.momirealms.customfishing.libraries")
|
||||
|
||||
@@ -236,7 +236,11 @@ public class BukkitCustomFishingPluginImpl extends BukkitCustomFishingPlugin {
|
||||
if (this.integrationManager != null) this.integrationManager.disable();
|
||||
if (this.storageManager != null) this.storageManager.disable();
|
||||
if (this.hologramManager != null) this.hologramManager.disable();
|
||||
if (this.commandManager != null) this.commandManager.unregisterFeatures();
|
||||
if (this.commandManager != null) {
|
||||
if (!Bukkit.getServer().isStopping()) {
|
||||
this.commandManager.unregisterFeatures();
|
||||
}
|
||||
}
|
||||
this.scheduler.shutdownScheduler();
|
||||
this.scheduler.shutdownExecutor();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.kyori.adventure.text.ScoreComponent;
|
||||
import net.momirealms.customfishing.api.BukkitCustomFishingPlugin;
|
||||
import net.momirealms.customfishing.api.mechanic.MechanicType;
|
||||
import net.momirealms.customfishing.api.mechanic.context.Context;
|
||||
import net.momirealms.customfishing.api.mechanic.context.ContextKeys;
|
||||
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
||||
import net.momirealms.customfishing.api.mechanic.hook.HookConfig;
|
||||
import net.momirealms.customfishing.api.mechanic.hook.HookManager;
|
||||
@@ -129,7 +130,7 @@ public class BukkitHookManager implements HookManager, Listener {
|
||||
if (hookItemBase64 != null) {
|
||||
itemStack = bytesToHook(hookItemBase64);
|
||||
} else {
|
||||
itemStack = plugin.getItemManager().buildInternal(Context.player(player), id);
|
||||
itemStack = plugin.getItemManager().buildInternal(Context.player(player).arg(ContextKeys.ID, id), id);
|
||||
}
|
||||
plugin.getItemManager().setDamage(player, itemStack, damage);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -84,6 +85,22 @@ public class BukkitIntegrationManager implements IntegrationManager {
|
||||
if (isHooked("CraftEngine")) {
|
||||
registerItemProvider(new CraftEngineProvider());
|
||||
}
|
||||
if (isHooked("Nexo")) {
|
||||
try {
|
||||
Class<?> nexoItemProviderClass = Class.forName("net.momirealms.customfishing.bukkit.integration.item.NexoItemProvider");
|
||||
Constructor<?> itemProviderConstructor = nexoItemProviderClass.getDeclaredConstructor();
|
||||
itemProviderConstructor.setAccessible(true);
|
||||
ItemProvider itemProvider = (ItemProvider) itemProviderConstructor.newInstance();
|
||||
registerItemProvider(itemProvider);
|
||||
Class<?> nexoBlockProviderClass = Class.forName("net.momirealms.customfishing.bukkit.integration.block.NexoBlockProvider");
|
||||
Constructor<?> nexoBlockProviderConstructor = nexoBlockProviderClass.getDeclaredConstructor();
|
||||
nexoBlockProviderConstructor.setAccessible(true);
|
||||
BlockProvider blockProvider = (BlockProvider) nexoBlockProviderConstructor.newInstance();
|
||||
registerBlockProvider(blockProvider);
|
||||
} catch (ReflectiveOperationException exception) {
|
||||
plugin.getPluginLogger().warn("Failed to hook Nexo", exception);
|
||||
}
|
||||
}
|
||||
if (isHooked("MMOItems")) {
|
||||
registerItemProvider(new MMOItemsItemProvider());
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ public class BukkitItemManager implements ItemManager, Listener {
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemStack build(@NotNull Context<Player> context, @NotNull CustomFishingItem item) {
|
||||
if (context.arg(ContextKeys.ID) == null) {
|
||||
context.arg(ContextKeys.ID, item.id());
|
||||
}
|
||||
ItemStack itemStack = getOriginalStack(context.holder(), item.material());
|
||||
if (itemStack.getType() == Material.AIR) return itemStack;
|
||||
plugin.getLootManager().getLoot(item.id()).ifPresent(loot -> {
|
||||
|
||||
Reference in New Issue
Block a user