mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
feat: make prevent offhand swapping configurable and is now disabled by default, resolves #192
This commit is contained in:
@@ -47,6 +47,7 @@ public class Settings {
|
||||
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
||||
private static final String COSMETIC_DESTROY_LOOSE_COSMETIC_PATH = "destroy-loose-cosmetics";
|
||||
private static final String COSMETIC_BALLOON_HEAD_FORWARD_PATH = "balloon-head-forward";
|
||||
private static final String COSMETIC_OFFHAND_PREVENT_SWAPPING = "offhand-prevent-swapping";
|
||||
private static final String MENU_SETTINGS_PATH = "menu-settings";
|
||||
private static final String MENU_CLICK_COOLDOWN_PATH = "click-cooldown";
|
||||
private static final String MENU_CLICK_COOLDOWN_TIME_PATH = "time";
|
||||
@@ -101,6 +102,8 @@ public class Settings {
|
||||
@Getter
|
||||
private static boolean destroyLooseCosmetics;
|
||||
@Getter
|
||||
private static boolean preventOffhandSwapping;
|
||||
@Getter
|
||||
private static boolean backpackForceRidingEnabled;
|
||||
@Getter
|
||||
private static boolean disabledGamemodesEnabled;
|
||||
@@ -192,6 +195,7 @@ public class Settings {
|
||||
forceShowOnJoin = cosmeticSettings.node(FORCE_SHOW_COSMETICS_PATH).getBoolean(false);
|
||||
destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false);
|
||||
backpackForceRidingEnabled = cosmeticSettings.node(COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH).getBoolean(false);
|
||||
preventOffhandSwapping = cosmeticSettings.node(COSMETIC_OFFHAND_PREVENT_SWAPPING).getBoolean(false);
|
||||
|
||||
cosmeticSettings.node(SLOT_OPTIONS_PATH).childrenMap().forEach((key, value) -> {
|
||||
EquipmentSlot slot = convertConfigToEquipment(key.toString().toLowerCase());
|
||||
|
||||
@@ -191,6 +191,7 @@ public class CosmeticPacketInterface implements PacketInterface {
|
||||
|
||||
@Override
|
||||
public @NotNull PacketAction readPlayerAction(@NotNull Player player, @NotNull PlayerActionWrapper wrapper) {
|
||||
if (!Settings.isPreventOffhandSwapping()) return PacketAction.NOTHING;
|
||||
String actionType = wrapper.getActionType();
|
||||
MessagesUtil.sendDebugMessages("EntityStatus Initial " + player.getEntityId() + " - " + actionType);
|
||||
// If it's not SWAP_ITEM_WITH_OFFHAND, ignore
|
||||
|
||||
@@ -30,6 +30,9 @@ cosmetic-settings:
|
||||
display-name: false
|
||||
lore: false
|
||||
|
||||
# This prevents the offhand from being swapped with the mainhand. Only affects if a user has a cosmetic in their offhand
|
||||
offhand-prevent-swapping: false
|
||||
|
||||
# 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"
|
||||
|
||||
Reference in New Issue
Block a user