mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-22 10:36:08 +01:00
Add config option to disable plugin hooks (#291)
* Update UltimateStacker dependency * Add config option to disable plugin hooks
This commit is contained in:
parent
2b0a6d82ef
commit
913eed9c77
2
pom.xml
2
pom.xml
@ -237,7 +237,7 @@
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateStacker</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<version>2.4.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -126,32 +126,42 @@ public class Level extends Addon {
|
||||
// Check if WildStackers is enabled on the server
|
||||
// I only added support for counting blocks into the island level
|
||||
// Someone else can PR if they want spawners added to the Leveling system :)
|
||||
stackersEnabled = Bukkit.getPluginManager().isPluginEnabled("WildStacker");
|
||||
if (stackersEnabled) {
|
||||
log("Hooked into WildStackers.");
|
||||
}
|
||||
// Check if AdvancedChests is enabled on the server
|
||||
Plugin advChest = Bukkit.getPluginManager().getPlugin("AdvancedChests");
|
||||
advChestEnabled = advChest != null;
|
||||
if (advChestEnabled) {
|
||||
// Check version
|
||||
if (compareVersions(advChest.getDescription().getVersion(), "23.0") > 0) {
|
||||
log("Hooked into AdvancedChests.");
|
||||
} else {
|
||||
logError("Could not hook into AdvancedChests " + advChest.getDescription().getVersion() + " - requires version 23.0 or later");
|
||||
advChestEnabled = false;
|
||||
if ( !settings.getDisabledPluginHooks().contains("WildStacker") ) {
|
||||
stackersEnabled = Bukkit.getPluginManager().isPluginEnabled("WildStacker");
|
||||
if (stackersEnabled) {
|
||||
log("Hooked into WildStackers.");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if AdvancedChests is enabled on the server
|
||||
if ( !settings.getDisabledPluginHooks().contains("AdvancedChests") ) {
|
||||
Plugin advChest = Bukkit.getPluginManager().getPlugin("AdvancedChests");
|
||||
advChestEnabled = advChest != null;
|
||||
if (advChestEnabled) {
|
||||
// Check version
|
||||
if (compareVersions(advChest.getDescription().getVersion(), "23.0") > 0) {
|
||||
log("Hooked into AdvancedChests.");
|
||||
} else {
|
||||
logError("Could not hook into AdvancedChests " + advChest.getDescription().getVersion() + " - requires version 23.0 or later");
|
||||
advChestEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if RoseStackers is enabled
|
||||
roseStackersEnabled = Bukkit.getPluginManager().isPluginEnabled("RoseStacker");
|
||||
if (roseStackersEnabled) {
|
||||
log("Hooked into RoseStackers.");
|
||||
if ( !settings.getDisabledPluginHooks().contains("RoseStacker") ) {
|
||||
roseStackersEnabled = Bukkit.getPluginManager().isPluginEnabled("RoseStacker");
|
||||
if (roseStackersEnabled) {
|
||||
log("Hooked into RoseStackers.");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if UltimateStacker is enabled
|
||||
ultimateStackerEnabled = Bukkit.getPluginManager().isPluginEnabled("UltimateStacker");
|
||||
if (ultimateStackerEnabled) {
|
||||
log("Hooked into UltimateStacker.");
|
||||
if ( !settings.getDisabledPluginHooks().contains("UltimateStacker") ) {
|
||||
ultimateStackerEnabled = Bukkit.getPluginManager().isPluginEnabled("UltimateStacker");
|
||||
if (ultimateStackerEnabled) {
|
||||
log("Hooked into UltimateStacker.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package world.bentobox.level.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -126,6 +127,12 @@ public class ConfigSettings implements ConfigObject {
|
||||
@ConfigEntry(path = "include-shulkers-in-chest")
|
||||
private boolean includeShulkersInChest = false;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Disables hooking with other plugins.")
|
||||
@ConfigComment("Example: disabled-plugin-hooks: [UltimateStacker, RoseStacker]")
|
||||
@ConfigEntry(path = "disabled-plugin-hooks")
|
||||
private List<String> disabledPluginHooks = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
* @return the gameModes
|
||||
@ -404,4 +411,12 @@ public class ConfigSettings implements ConfigObject {
|
||||
public void setIncludeShulkersInChest(boolean includeShulkersInChest) {
|
||||
this.includeShulkersInChest = includeShulkersInChest;
|
||||
}
|
||||
|
||||
public List<String> getDisabledPluginHooks() {
|
||||
return disabledPluginHooks;
|
||||
}
|
||||
|
||||
public void setDisabledPluginHooks(List<String> disabledPluginHooks) {
|
||||
this.disabledPluginHooks = disabledPluginHooks;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user