9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2026-01-06 15:51:52 +00:00

[Fix] Tripwire for sprinkler

This commit is contained in:
XiaoMoMi
2024-04-20 20:05:01 +08:00
parent 8d3443f989
commit c602ba7c0e
44 changed files with 503 additions and 108 deletions

View File

@@ -17,12 +17,10 @@
package net.momirealms.customcrops.compatibility;
import com.gamingmesh.jobs.Jobs;
import net.momirealms.customcrops.api.CustomCropsPlugin;
import net.momirealms.customcrops.api.integration.LevelInterface;
import net.momirealms.customcrops.api.integration.SeasonInterface;
import net.momirealms.customcrops.api.manager.IntegrationManager;
import net.momirealms.customcrops.api.mechanic.world.season.Season;
import net.momirealms.customcrops.api.util.LogUtils;
import net.momirealms.customcrops.compatibility.item.MMOItemsItemImpl;
import net.momirealms.customcrops.compatibility.item.MythicMobsItemImpl;
@@ -32,7 +30,6 @@ import net.momirealms.customcrops.compatibility.level.*;
import net.momirealms.customcrops.compatibility.season.AdvancedSeasonsImpl;
import net.momirealms.customcrops.compatibility.season.InBuiltSeason;
import net.momirealms.customcrops.compatibility.season.RealisticSeasonsImpl;
import org.bukkit.World;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
@@ -110,13 +107,6 @@ public class IntegrationManagerImpl implements IntegrationManager {
}
/**
* Registers a level plugin with the specified name.
*
* @param plugin The name of the level plugin.
* @param level The implementation of the LevelInterface.
* @return true if the registration was successful, false if the plugin name is already registered.
*/
@Override
public boolean registerLevelPlugin(String plugin, LevelInterface level) {
if (levelPluginMap.containsKey(plugin)) return false;
@@ -124,12 +114,6 @@ public class IntegrationManagerImpl implements IntegrationManager {
return true;
}
/**
* Unregisters a level plugin with the specified name.
*
* @param plugin The name of the level plugin to unregister.
* @return true if the unregistration was successful, false if the plugin name is not found.
*/
@Override
public boolean unregisterLevelPlugin(String plugin) {
return levelPluginMap.remove(plugin) != null;
@@ -139,12 +123,6 @@ public class IntegrationManagerImpl implements IntegrationManager {
LogUtils.info( plugin + " hooked!");
}
/**
* Get the LevelInterface provided by a plugin.
*
* @param plugin The name of the plugin providing the LevelInterface.
* @return The LevelInterface provided by the specified plugin, or null if the plugin is not registered.
*/
@Override
@Nullable
public LevelInterface getLevelPlugin(String plugin) {
@@ -155,14 +133,4 @@ public class IntegrationManagerImpl implements IntegrationManager {
public SeasonInterface getSeasonInterface() {
return seasonInterface;
}
@Override
public Season getSeason(World world) {
return seasonInterface.getSeason(world);
}
@Override
public int getDate(World world) {
return seasonInterface.getDate(world);
}
}

View File

@@ -18,7 +18,6 @@
package net.momirealms.customcrops.compatibility.level;
import com.archyx.aureliumskills.api.AureliumAPI;
import com.archyx.aureliumskills.leveler.Leveler;
import net.momirealms.customcrops.api.integration.LevelInterface;
import org.bukkit.entity.Player;

View File

@@ -74,10 +74,10 @@ public class CCPapi extends PlaceholderExpansion {
switch (split[0]) {
case "season" -> {
if (split.length == 1) {
return MessageManager.seasonTranslation(plugin.getIntegrationManager().getSeason(player.getWorld()));
return MessageManager.seasonTranslation(plugin.getIntegrationManager().getSeasonInterface().getSeason(player.getWorld()));
} else {
try {
return MessageManager.seasonTranslation(plugin.getIntegrationManager().getSeason(Bukkit.getWorld(split[1])));
return MessageManager.seasonTranslation(plugin.getIntegrationManager().getSeasonInterface().getSeason(Bukkit.getWorld(split[1])));
} catch (NullPointerException e) {
LogUtils.severe("World " + split[1] + " does not exist");
e.printStackTrace();
@@ -86,10 +86,10 @@ public class CCPapi extends PlaceholderExpansion {
}
case "date" -> {
if (split.length == 1) {
return String.valueOf(plugin.getIntegrationManager().getDate(player.getWorld()));
return String.valueOf(plugin.getIntegrationManager().getSeasonInterface().getDate(player.getWorld()));
} else {
try {
return String.valueOf(plugin.getIntegrationManager().getDate(Bukkit.getWorld(split[1])));
return String.valueOf(plugin.getIntegrationManager().getSeasonInterface().getDate(Bukkit.getWorld(split[1])));
} catch (NullPointerException e) {
LogUtils.severe("World " + split[1] + " does not exist");
e.printStackTrace();