mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-26 10:29:10 +00:00
Fix possible compatibility breaks
This commit is contained in:
@@ -202,4 +202,9 @@ public class CustomCropsPluginImpl extends CustomCropsPlugin {
|
||||
public boolean isHookedPluginEnabled(String plugin) {
|
||||
return Bukkit.getPluginManager().isPluginEnabled(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesHookedPluginExist(String plugin) {
|
||||
return Bukkit.getPluginManager().getPlugin(plugin) != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
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;
|
||||
@@ -49,43 +50,47 @@ public class IntegrationManagerImpl implements IntegrationManager {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (plugin.isHookedPluginEnabled("MMOItems")) {
|
||||
if (plugin.doesHookedPluginExist("MMOItems")) {
|
||||
plugin.getItemManager().registerItemLibrary(new MMOItemsItemImpl());
|
||||
hookMessage("MMOItems");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("Zaphkiel")) {
|
||||
if (plugin.doesHookedPluginExist("Zaphkiel")) {
|
||||
plugin.getItemManager().registerItemLibrary(new ZaphkielItemImpl());
|
||||
hookMessage("Zaphkiel");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("NeigeItems")) {
|
||||
if (plugin.doesHookedPluginExist("NeigeItems")) {
|
||||
plugin.getItemManager().registerItemLibrary(new NeigeItemsItemImpl());
|
||||
hookMessage("NeigeItems");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("MythicMobs")) {
|
||||
if (plugin.doesHookedPluginExist("MythicMobs")) {
|
||||
plugin.getItemManager().registerItemLibrary(new MythicMobsItemImpl());
|
||||
hookMessage("MythicMobs");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("EcoJobs")) {
|
||||
if (plugin.doesHookedPluginExist("EcoJobs")) {
|
||||
registerLevelPlugin("EcoJobs", new EcoJobsImpl());
|
||||
hookMessage("EcoJobs");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("AureliumSkills")) {
|
||||
if (plugin.doesHookedPluginExist("Jobs")) {
|
||||
registerLevelPlugin("JobsReborn", new JobsRebornImpl());
|
||||
hookMessage("JobsReborn");
|
||||
}
|
||||
if (plugin.doesHookedPluginExist("AureliumSkills")) {
|
||||
registerLevelPlugin("AureliumSkills", new AureliumSkillsImpl());
|
||||
hookMessage("AureliumSkills");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("EcoSkills")) {
|
||||
if (plugin.doesHookedPluginExist("EcoSkills")) {
|
||||
registerLevelPlugin("EcoSkills", new EcoSkillsImpl());
|
||||
hookMessage("EcoSkills");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("mcMMO")) {
|
||||
if (plugin.doesHookedPluginExist("mcMMO")) {
|
||||
registerLevelPlugin("mcMMO", new McMMOImpl());
|
||||
hookMessage("mcMMO");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("MMOCore")) {
|
||||
if (plugin.doesHookedPluginExist("MMOCore")) {
|
||||
registerLevelPlugin("MMOCore", new MMOCoreImpl());
|
||||
hookMessage("MMOCore");
|
||||
}
|
||||
if (plugin.isHookedPluginEnabled("AuraSkills")) {
|
||||
if (plugin.doesHookedPluginExist("AuraSkills")) {
|
||||
registerLevelPlugin("AuraSkills", new AuraSkillsImpl());
|
||||
hookMessage("AuraSkills");
|
||||
}
|
||||
|
||||
@@ -24,15 +24,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class AureliumSkillsImpl implements LevelInterface {
|
||||
|
||||
private final Leveler leveler;
|
||||
|
||||
public AureliumSkillsImpl() {
|
||||
leveler = AureliumAPI.getPlugin().getLeveler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addXp(Player player, String target, double amount) {
|
||||
leveler.addXp(player, AureliumAPI.getPlugin().getSkillRegistry().getSkill(target), amount);
|
||||
AureliumAPI.getPlugin().getLeveler().addXp(player, AureliumAPI.getPlugin().getSkillRegistry().getSkill(target), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -236,7 +236,14 @@ public class ItemManagerImpl implements ItemManager {
|
||||
return itemStack;
|
||||
if (id.contains(":")) {
|
||||
String[] split = id.split(":", 2);
|
||||
return itemLibraryMap.get(split[0]).buildItem(player, split[1]);
|
||||
ItemLibrary library = itemLibraryMap.get(split[0]);
|
||||
if (library == null) {
|
||||
LogUtils.warn("Error occurred when building item: " + id + ". Possible causes:");
|
||||
LogUtils.warn("① Item library: " + split[0] + " doesn't exist.");
|
||||
LogUtils.warn("② If you are using ItemsAdder, " + id + " doesn't exist in your ItemsAdder config");
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
return library.buildItem(player, split[1]);
|
||||
} else {
|
||||
try {
|
||||
return new ItemStack(Material.valueOf(id.toUpperCase(Locale.ENGLISH)));
|
||||
|
||||
@@ -12,16 +12,9 @@ softdepend:
|
||||
- ItemsAdder
|
||||
- Oraxen
|
||||
- PlaceholderAPI
|
||||
- EcoJobs
|
||||
- BattlePass
|
||||
- BetonQuest
|
||||
- ClueScrolls
|
||||
- mcMMO
|
||||
- AureliumSkills
|
||||
- AuraSkills
|
||||
- MMOCore
|
||||
- EcoSkills
|
||||
- Jobs
|
||||
- RealisticSeasons
|
||||
- AdvancedSeasons
|
||||
- SlimeWorldManager
|
||||
|
||||
Reference in New Issue
Block a user