mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
feat: Add config for papi hook
This commit is contained in:
parent
2edf955332
commit
d126b3d31a
@ -258,8 +258,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
}
|
||||
|
||||
private void setupPlaceholderAPI() {
|
||||
if(getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
if(config.isRegisterPapiHook() && getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
new MultiverseCorePlaceholders(this).register();
|
||||
Logging.config("Registered PlaceholderAPI hook.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.onarandombox.MultiverseCore.api;
|
||||
|
||||
import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders;
|
||||
|
||||
public interface MVConfig {
|
||||
|
||||
/**
|
||||
@ -156,6 +158,18 @@ public interface MVConfig {
|
||||
*/
|
||||
String getPrefixChatFormat();
|
||||
|
||||
/**
|
||||
* Sets whether to register the {@link MultiverseCorePlaceholders} class with PlaceholderAPI plugin.
|
||||
* @param registerPapiHook The new value.
|
||||
*/
|
||||
void setRegisterPapiHook(boolean registerPapiHook);
|
||||
|
||||
/**
|
||||
* Gets whether to register the {@link MultiverseCorePlaceholders} class with PlaceholderAPI plugin.
|
||||
* @return registerPapiHook.
|
||||
*/
|
||||
boolean isRegisterPapiHook();
|
||||
|
||||
/**
|
||||
* Sets globalDebug.
|
||||
* @param globalDebug The new value.
|
||||
|
@ -201,6 +201,16 @@ public class DefaultMVConfig implements MVConfig {
|
||||
return settings.get(MVConfigNodes.CHAT_PREFIX_FORMAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRegisterPapiHook(boolean registerPapiHook) {
|
||||
settings.set(MVConfigNodes.REGISTER_PAPI_HOOK, registerPapiHook);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegisterPapiHook() {
|
||||
return settings.get(MVConfigNodes.REGISTER_PAPI_HOOK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlobalDebug(int globalDebug) {
|
||||
settings.set(MVConfigNodes.GLOBAL_DEBUG, globalDebug);
|
||||
|
@ -140,6 +140,14 @@ public class MVConfigNodes {
|
||||
.name("chat-prefix-format")
|
||||
.build());
|
||||
|
||||
public static final MVValueNode<Boolean> REGISTER_PAPI_HOOK = node(MVValueNode.builder("messaging.register-papi-hook", Boolean.class)
|
||||
.comment("")
|
||||
.comment("This config option defines whether or not Multiverse should register the PlaceholderAPI hook.")
|
||||
.comment("This only applies if PlaceholderAPI is installed.")
|
||||
.defaultValue(true)
|
||||
.name("register-papi-hook")
|
||||
.build());
|
||||
|
||||
private static final MVCommentedNode MISC_HEADER = node(MVCommentedNode.builder("misc")
|
||||
.comment("")
|
||||
.comment("")
|
||||
|
Loading…
Reference in New Issue
Block a user