mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
Merge remote-tracking branch 'origin/remapped' into remapped
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.7.0-DEV"
|
version = "2.7.2-DEV"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -113,9 +113,7 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
if (!textColor.contains("#") && Hooks.isActiveHook("HMCColor")) {
|
if (!textColor.contains("#") && Hooks.isActiveHook("HMCColor")) {
|
||||||
HMCColorConfig.Colors colors = HMCColorContextKt.getHmcColor().getConfig().getColors().get(textColor);
|
HMCColorConfig.Colors colors = HMCColorContextKt.getHmcColor().getConfig().getColors().get(textColor);
|
||||||
if (colors != null) {
|
if (colors != null) {
|
||||||
String hmccolor = colors.getBaseColor().getColor();
|
color = colors.getBaseColor().getColor();
|
||||||
if (hmccolor.contains("#")) color = HMCCServerUtils.hex2Rgb(hmccolor);
|
|
||||||
else color = HMCCServerUtils.rgbToRgb(hmccolor);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
color = HMCCServerUtils.hex2Rgb(textColor);
|
color = HMCCServerUtils.hex2Rgb(textColor);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class WardrobeSettings {
|
|||||||
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
||||||
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
|
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
|
||||||
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
||||||
|
private static final String DAMAGE_KICK_PATH = "damage-kicked";
|
||||||
|
private static final String PREVENT_DAMAGE_PATH = "prevent-damage";
|
||||||
|
|
||||||
private static final String WARDROBE_MENU_OPTIONS = "menu-options";
|
private static final String WARDROBE_MENU_OPTIONS = "menu-options";
|
||||||
private static final String WARDROBE_ENTER_OPEN_MENU_PATH = "enter-open-menu";
|
private static final String WARDROBE_ENTER_OPEN_MENU_PATH = "enter-open-menu";
|
||||||
@@ -87,6 +89,10 @@ public class WardrobeSettings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static boolean forceExitGamemode;
|
private static boolean forceExitGamemode;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static boolean damagedKicked;
|
||||||
|
@Getter
|
||||||
|
private static boolean preventDamage;
|
||||||
|
@Getter
|
||||||
private static GameMode exitGamemode;
|
private static GameMode exitGamemode;
|
||||||
private static HashMap<String, Wardrobe> wardrobes;
|
private static HashMap<String, Wardrobe> wardrobes;
|
||||||
@Getter
|
@Getter
|
||||||
@@ -121,6 +127,8 @@ public class WardrobeSettings {
|
|||||||
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
||||||
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
||||||
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
||||||
|
damagedKicked = source.node(DAMAGE_KICK_PATH).getBoolean(false);
|
||||||
|
preventDamage = source.node(PREVENT_DAMAGE_PATH).getBoolean(true);
|
||||||
|
|
||||||
ConfigurationNode menuOptionsNode = source.node(WARDROBE_MENU_OPTIONS);
|
ConfigurationNode menuOptionsNode = source.node(WARDROBE_MENU_OPTIONS);
|
||||||
enterOpenMenu = menuOptionsNode.node(WARDROBE_ENTER_OPEN_MENU_PATH).getBoolean(false);
|
enterOpenMenu = menuOptionsNode.node(WARDROBE_ENTER_OPEN_MENU_PATH).getBoolean(false);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class DyeMenu {
|
|||||||
ItemStack originalItem = user.getUserCosmeticItem(cosmetic);
|
ItemStack originalItem = user.getUserCosmeticItem(cosmetic);
|
||||||
if (originalItem == null || !cosmetic.isDyable()) return;
|
if (originalItem == null || !cosmetic.isDyable()) return;
|
||||||
|
|
||||||
Gui gui = HMCColorApi.INSTANCE.colorMenu();
|
Gui gui = HMCColorApi.createColorMenu(player);
|
||||||
gui.updateTitle(Hooks.processPlaceholders(player, Settings.getDyeMenuName()));
|
gui.updateTitle(Hooks.processPlaceholders(player, Settings.getDyeMenuName()));
|
||||||
gui.setItem(Settings.getDyeMenuInputSlot(), new GuiItem(originalItem));
|
gui.setItem(Settings.getDyeMenuInputSlot(), new GuiItem(originalItem));
|
||||||
gui.setDefaultTopClickAction(event -> {
|
gui.setDefaultTopClickAction(event -> {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.comphenix.protocol.wrappers.Pair;
|
|||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerCosmeticPostEquipEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerCosmeticPostEquipEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
||||||
@@ -195,7 +196,11 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user.isInWardrobe()) {
|
if (user.isInWardrobe()) {
|
||||||
user.leaveWardrobe();
|
if (WardrobeSettings.isPreventDamage()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (WardrobeSettings.isDamagedKicked()) user.leaveWardrobe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import org.bukkit.inventory.EquipmentSlot;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class UserWardrobeManager {
|
public class UserWardrobeManager {
|
||||||
@@ -202,7 +199,8 @@ public class UserWardrobeManager {
|
|||||||
List<Player> outsideViewers = HMCCPacketManager.getViewers(viewingLocation);
|
List<Player> outsideViewers = HMCCPacketManager.getViewers(viewingLocation);
|
||||||
outsideViewers.remove(player);
|
outsideViewers.remove(player);
|
||||||
|
|
||||||
if (player != null) MessagesUtil.sendMessage(player, "closed-wardrobe");
|
if (player == null) return;
|
||||||
|
MessagesUtil.sendMessage(player, "closed-wardrobe");
|
||||||
|
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
@@ -252,9 +250,17 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
player.teleport(Objects.requireNonNullElseGet(exitLocation, () -> player.getWorld().getSpawnLocation()), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
player.teleport(Objects.requireNonNullElseGet(exitLocation, () -> player.getWorld().getSpawnLocation()), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
|
|
||||||
if (WardrobeSettings.isEquipPumpkin()) {
|
HashMap<EquipmentSlot, ItemStack> items = new HashMap<>();
|
||||||
PacketManager.equipmentSlotUpdate(user.getPlayer().getEntityId(), EquipmentSlot.HEAD, player.getInventory().getHelmet(), viewer);
|
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||||
|
ItemStack item = player.getInventory().getItem(slot);
|
||||||
|
items.put(slot, item);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
if (WardrobeSettings.isEquipPumpkin()) {
|
||||||
|
items.put(EquipmentSlot.HEAD, player.getInventory().getHelmet());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
HMCCPacketManager.equipmentSlotUpdate(player.getEntityId(), items, viewer);
|
||||||
|
|
||||||
if (WardrobeSettings.isEnabledBossbar()) {
|
if (WardrobeSettings.isEnabledBossbar()) {
|
||||||
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
|
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ wardrobe:
|
|||||||
return-last-location: false
|
return-last-location: false
|
||||||
# If players in wardrobes should be able to equip any cosmetic, regardless of permission (Cosmetics they do not have access to will be removed when they leave the wardrobe)
|
# If players in wardrobes should be able to equip any cosmetic, regardless of permission (Cosmetics they do not have access to will be removed when they leave the wardrobe)
|
||||||
unchecked-wardrobe-cosmetics: false
|
unchecked-wardrobe-cosmetics: false
|
||||||
|
# If HMCC should prevent a player from being damaged while being in the wardrobe
|
||||||
|
prevent-damage: true
|
||||||
|
# If a player is damaged in a wardrobe, and if it's set to true, it'll kick them from the wardrobe (prevent-damage must be false)
|
||||||
|
damage-kicked: false
|
||||||
|
|
||||||
menu-options:
|
menu-options:
|
||||||
enter-open-menu: false # If the menu should open when a player enters a wardrobe
|
enter-open-menu: false # If the menu should open when a player enters a wardrobe
|
||||||
|
|||||||
Binary file not shown.
BIN
lib/HMCColor-0.8.6.jar
Normal file
BIN
lib/HMCColor-0.8.6.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user