mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-06 15:51:50 +00:00
feat: add offhand-always-show option
This commit is contained in:
@@ -41,6 +41,7 @@ public class Settings {
|
||||
private static final String COSMETIC_EMOTE_MOVE_CHECK_PATH = "emote-move";
|
||||
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_FORCE_OFFHAND_COSMETIC_SHOW_PATH = "offhand-always-show";
|
||||
private static final String COSMETIC_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments";
|
||||
private static final String COSMETIC_ADD_ENCHANTS_CHESTPLATE_PATH = "chest-add-enchantments";
|
||||
private static final String COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH = "leggings-add-enchantments";
|
||||
@@ -104,6 +105,8 @@ public class Settings {
|
||||
@Getter
|
||||
private static boolean backpackForceRidingEnabled;
|
||||
@Getter
|
||||
private static boolean cosmeticForceOffhandCosmeticShow;
|
||||
@Getter
|
||||
private static int viewDistance;
|
||||
@Getter
|
||||
private static int tickPeriod;
|
||||
@@ -177,6 +180,7 @@ public class Settings {
|
||||
emoteCameraEnabled = cosmeticSettings.node(COSMETIC_EMOTE_CAMERA_PATH).getBoolean(true);
|
||||
emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false);
|
||||
packetEntityTeleportCooldown = cosmeticSettings.node(COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH).getInt(-1);
|
||||
cosmeticForceOffhandCosmeticShow = cosmeticSettings.node(COSMETIC_FORCE_OFFHAND_COSMETIC_SHOW_PATH).getBoolean(false);
|
||||
|
||||
ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH);
|
||||
|
||||
|
||||
@@ -480,7 +480,6 @@ public class PlayerGameListener implements Listener {
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<com.comphenix.protocol.wrappers.Pair<EnumWrappers.ItemSlot, ItemStack>> armor = event.getPacket().getSlotStackPairLists().read(0);
|
||||
|
||||
for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) {
|
||||
@@ -490,14 +489,11 @@ public class PlayerGameListener implements Listener {
|
||||
continue;
|
||||
}
|
||||
if (equipmentSlot.equals(EquipmentSlot.OFF_HAND)) {
|
||||
ItemStack item = null;
|
||||
if (user.getPlayer().getInventory().getItemInOffHand().getType().isAir()) {
|
||||
if (user.hasCosmeticInSlot(CosmeticSlot.OFFHAND)) item = user.getUserCosmeticItem(CosmeticSlot.OFFHAND);
|
||||
} else {
|
||||
item = user.getPlayer().getInventory().getItemInOffHand();
|
||||
if (Settings.isCosmeticForceOffhandCosmeticShow() && user.hasCosmeticInSlot(CosmeticSlot.OFFHAND)) {
|
||||
ItemStack item = user.getUserCosmeticItem(CosmeticSlot.OFFHAND);
|
||||
Pair<EnumWrappers.ItemSlot, ItemStack> pair = new Pair<>(EnumWrappers.ItemSlot.OFFHAND, item);
|
||||
armor.add(pair);
|
||||
}
|
||||
Pair<EnumWrappers.ItemSlot, ItemStack> pair = new Pair<>(EnumWrappers.ItemSlot.OFFHAND, item);
|
||||
armor.add(pair);
|
||||
continue;
|
||||
}
|
||||
CosmeticArmorType cosmeticArmor = (CosmeticArmorType) user.getCosmetic(InventoryUtils.BukkitCosmeticSlot(equipmentSlot));
|
||||
|
||||
@@ -38,6 +38,9 @@ cosmetic-settings:
|
||||
# This helps reduce the amount of packets sent for packet entities, but reduces accuracy of the entity. This is in milliseconds. -1 to disable.
|
||||
# This is useful for servers with a lot of backpacks, as they are passengers, which means the client will update their position automatically within an area where the entity is located.
|
||||
entity-cooldown-teleport-packet: 500
|
||||
# This forces the offhand to always show the cosmetic. False means it will only show when the slot is empty.
|
||||
# There is a small visual blip for a tick when you put a new item in the offhand slot, hence why its disabled by default.
|
||||
offhand-always-show: false
|
||||
|
||||
helmet-add-enchantments: false # If the plugin should keep enchants on helmets. This is useful as some enchantments are client side only.
|
||||
chest-add-enchantments: false # If the plugin should keep enchants on chestplate. This is useful as some enchantments are client side only.
|
||||
|
||||
Reference in New Issue
Block a user