9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-31 04:46:42 +00:00

feat: add option to disable World Guard listener #87

This commit is contained in:
LoJoSho
2023-04-02 12:30:41 -05:00
parent ca01a94502
commit 744fc87491
3 changed files with 15 additions and 1 deletions

View File

@@ -123,7 +123,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
}
// WorldGuard
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null && Settings.isWorldGuardMoveCheckEnabled()) {
getServer().getPluginManager().registerEvents(new WGListener(), this);
}
}

View File

@@ -35,6 +35,8 @@ public class Settings {
private static final String HOOK_SETTING_PATH = "hook-settings";
private static final String HOOK_ITEMADDER_PATH = "itemsadder";
private static final String HOOK_RELOAD_CHANGE_PATH = "reload-on-change";
private static final String HOOK_WORLDGUARD_PATH = "worldguard";
private static final String HOOK_WG_MOVE_CHECK_PATH = "player_move_check";
private static final String COSMETIC_EMOTE_CHECK_PATH = "emote-block-check";
private static final String COSMETIC_EMOTE_DAMAGE_PATH = "emote-damage-leave";
private static final String COSMETIC_EMOTE_INVINCIBLE_PATH = "emote-invincible";
@@ -57,6 +59,7 @@ public class Settings {
private static boolean unapplyOnDeath;
private static boolean forcePermissionJoin;
private static boolean itemsAdderChangeReload;
private static boolean worldGuardMoveCheck;
private static boolean cosmeticEmoteBlockCheck;
private static boolean addHelmetEnchants;
private static boolean addChestplateEnchants;
@@ -120,6 +123,9 @@ public class Settings {
ConfigurationNode hookSettings = source.node(HOOK_SETTING_PATH);
ConfigurationNode itemsAdderSettings = hookSettings.node(HOOK_ITEMADDER_PATH);
itemsAdderChangeReload = itemsAdderSettings.node(HOOK_RELOAD_CHANGE_PATH).getBoolean(false);
ConfigurationNode worldGuardSettings = hookSettings.node(HOOK_WORLDGUARD_PATH);
worldGuardMoveCheck = worldGuardSettings.node(HOOK_WG_MOVE_CHECK_PATH).getBoolean(true);
}
private static Vector loadVector(final ConfigurationNode config) {
@@ -253,6 +259,10 @@ public class Settings {
return emoteInvincible;
}
public static boolean isWorldGuardMoveCheckEnabled() {
return worldGuardMoveCheck;
}
public static boolean getShouldAddEnchants(EquipmentSlot slot) {
switch (slot) {
case HEAD -> {

View File

@@ -53,6 +53,10 @@ hook-settings:
# This causes the plugin to reload itself after any ItemsAdder change. This keeps the plugin fully up to date with IA, but
# could cause console spam as HMCCosmetics has to reload itself as well.
reload-on-change: false
worldguard:
# Checks worldguard regions for HMCC flags. If set to false, flags will not work properly.
# Requires restart to apply changes.
player_move_check: true
wardrobe:
# spawn static wardrobe if in this radius of wardrobe-location
static-radius: 10