mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-20 15:39:16 +00:00
feat: add disabled worlds option
This commit is contained in:
@@ -44,6 +44,7 @@ public class Settings {
|
|||||||
private static final String COSMETIC_EMOTE_INVINCIBLE_PATH = "emote-invincible";
|
private static final String COSMETIC_EMOTE_INVINCIBLE_PATH = "emote-invincible";
|
||||||
private static final String COSMETIC_EMOTE_CAMERA_PATH = "emote-camera";
|
private static final String COSMETIC_EMOTE_CAMERA_PATH = "emote-camera";
|
||||||
private static final String COSMETIC_EMOTE_MOVE_CHECK_PATH = "emote-move";
|
private static final String COSMETIC_EMOTE_MOVE_CHECK_PATH = "emote-move";
|
||||||
|
private static final String COSMETIC_DISABLED_WORLDS_PATH = "disabled-worlds";
|
||||||
private static final String COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH = "entity-cooldown-teleport-packet";
|
private static final String COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH = "entity-cooldown-teleport-packet";
|
||||||
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
||||||
private static final String COSMETIC_FORCE_OFFHAND_COSMETIC_SHOW_PATH = "offhand-always-show";
|
private static final String COSMETIC_FORCE_OFFHAND_COSMETIC_SHOW_PATH = "offhand-always-show";
|
||||||
@@ -118,6 +119,8 @@ public class Settings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static List<String> disabledGamemodes;
|
private static List<String> disabledGamemodes;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static List<String> disabledWorlds;
|
||||||
|
@Getter
|
||||||
private static int viewDistance;
|
private static int viewDistance;
|
||||||
@Getter
|
@Getter
|
||||||
private static int tickPeriod;
|
private static int tickPeriod;
|
||||||
@@ -176,8 +179,10 @@ public class Settings {
|
|||||||
disabledGamemodesEnabled = disabledGamemodeSettings.node(ENABLED_PATH).getBoolean(true);
|
disabledGamemodesEnabled = disabledGamemodeSettings.node(ENABLED_PATH).getBoolean(true);
|
||||||
try {
|
try {
|
||||||
disabledGamemodes = disabledGamemodeSettings.node(DISABLED_GAMEMODE_GAMEMODES_PATH).getList(String.class);
|
disabledGamemodes = disabledGamemodeSettings.node(DISABLED_GAMEMODE_GAMEMODES_PATH).getList(String.class);
|
||||||
|
disabledWorlds = cosmeticSettings.node(COSMETIC_DISABLED_WORLDS_PATH).getList(String.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
disabledGamemodes = new ArrayList<>();
|
disabledGamemodes = new ArrayList<>();
|
||||||
|
disabledWorlds = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false);
|
unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false);
|
||||||
|
|||||||
@@ -131,6 +131,13 @@ public class PlayerGameListener implements Listener {
|
|||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||||
if (user.getEntity() == null || user.isInWardrobe()) return; // fixes disconnecting when in wardrobe (the entity stuff)
|
if (user.getEntity() == null || user.isInWardrobe()) return; // fixes disconnecting when in wardrobe (the entity stuff)
|
||||||
|
if (Settings.getDisabledWorlds().contains(user.getEntity().getLocation().getWorld().getName())) {
|
||||||
|
user.hideCosmetics(CosmeticUser.HiddenReason.WORLD);
|
||||||
|
} else {
|
||||||
|
if (user.getHiddenReason() != null && user.getHiddenReason().equals(CosmeticUser.HiddenReason.WORLD)) {
|
||||||
|
user.showCosmetics();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK) && user.getUserBackpackManager() != null) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK) && user.getUserBackpackManager() != null) {
|
||||||
user.respawnBackpack();
|
user.respawnBackpack();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ public class CosmeticUser {
|
|||||||
ACTION,
|
ACTION,
|
||||||
COMMAND,
|
COMMAND,
|
||||||
EMOTE,
|
EMOTE,
|
||||||
GAMEMODE
|
GAMEMODE,
|
||||||
|
WORLD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ cosmetic-settings:
|
|||||||
force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server.
|
force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server.
|
||||||
force-show-join: false # If the plugin should force show a player's cosmetics when they join the server.
|
force-show-join: false # If the plugin should force show a player's cosmetics when they join the server.
|
||||||
|
|
||||||
|
# This is a list of worlds that cosmetics are hidden in. When a player enters one of these worlds, their cosmetics will be hidden.
|
||||||
|
disabled-worlds:
|
||||||
|
- "disabledworld"
|
||||||
|
|
||||||
disabled-gamemode:
|
disabled-gamemode:
|
||||||
enabled: true
|
enabled: true
|
||||||
# Which gamemodes should cosmetics be disabled for. This is useful for servers that have a creative world. All options are here, https://hub.spigotmc.org/javadocs/spigot/org/bukkit/GameMode.html
|
# Which gamemodes should cosmetics be disabled for. This is useful for servers that have a creative world. All options are here, https://hub.spigotmc.org/javadocs/spigot/org/bukkit/GameMode.html
|
||||||
|
|||||||
Reference in New Issue
Block a user