9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 04:19:28 +00:00

clean: move to Lombok for getters (wip)

This commit is contained in:
LoJoSho
2023-08-05 22:01:11 -05:00
parent a486b13e7e
commit 33356ea81d
19 changed files with 105 additions and 395 deletions

View File

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

View File

@@ -423,7 +423,7 @@ public class CosmeticCommand implements CommandExecutor {
return true;
}
if (Settings.getDebugMode()) {
if (Settings.isDebugMode()) {
Settings.setDebugMode(false);
if (!silent) MessagesUtil.sendMessage(sender, "debug-disabled");
} else {

View File

@@ -1,10 +1,10 @@
package com.hibiscusmc.hmccosmetics.config;
import lombok.Getter;
import org.spongepowered.configurate.ConfigurationNode;
public class DatabaseSettings {
//private static final String DATABASE_SETTINGS_PATH = "cosmetic-settings";
private static final String DATABASE_TYPE_PATH = "type";
private static final String MYSQL_DATABASE_SETTINGS = "mysql";
@@ -17,18 +17,24 @@ public class DatabaseSettings {
private static final String ENABLE_DELAY = "enabled";
private static final String DELAY_LENGTH = "delay";
@Getter
private static String databaseType;
@Getter
private static String database;
@Getter
private static String password;
@Getter
private static String host;
@Getter
private static String username;
@Getter
private static int port;
@Getter
private static boolean enabledDelay;
@Getter
private static int delayLength;
public static void load(ConfigurationNode source) {
//ConfigurationNode databaseSettings = source.node(DATABASE_SETTINGS_PATH);
databaseType = source.node(DATABASE_TYPE_PATH).getString();
ConfigurationNode mySql = source.node(MYSQL_DATABASE_SETTINGS);
@@ -44,36 +50,4 @@ public class DatabaseSettings {
enabledDelay = delay.node(ENABLE_DELAY).getBoolean(false);
delayLength = delay.node(DELAY_LENGTH).getInt(2);
}
public static String getDatabaseType() {
return databaseType;
}
public static String getDatabase() {
return database;
}
public static String getPassword() {
return password;
}
public static String getHost() {
return host;
}
public static String getUsername() {
return username;
}
public static int getPort() {
return port;
}
public static boolean isEnabledDelay() {
return enabledDelay;
}
public static int getDelayLength() {
return delayLength;
}
}

View File

@@ -1,7 +1,6 @@
package com.hibiscusmc.hmccosmetics.config;
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import lombok.Getter;
import org.bukkit.inventory.EquipmentSlot;
@@ -16,11 +15,6 @@ public class Settings {
private static final String DEFAULT_MENU = "default-menu";
private static final String CONFIG_VERSION = "config-version";
private static final String COSMETIC_SETTINGS_PATH = "cosmetic-settings";
private static final String REQUIRE_EMPTY_HELMET_PATH = "require-empty-helmet";
private static final String REQUIRE_EMPTY_OFF_HAND_PATH = "require-empty-off-hand";
private static final String REQUIRE_EMPTY_CHEST_PLATE_PATH = "require-empty-chest-plate";
private static final String REQUIRE_EMPTY_PANTS_PATH = "require-empty-pants";
private static final String REQUIRE_EMPTY_BOOTS_PATH = "require-empty-boots";
private static final String BALLOON_OFFSET = "balloon-offset";
private static final String VIEW_DISTANCE_PATH = "view-distance";
private static final String DYE_MENU_PATH = "dye-menu";
@@ -62,37 +56,57 @@ public class Settings {
private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color";
private static final String ENABLED_PATH = "enabled";
@Getter
private static String defaultMenu;
@Getter
private static String dyeMenuName;
@Getter
private static int dyeMenuInputSlot;
@Getter
private static int dyeMenuOutputSlot;
@Getter
private static int configVersion;
private static boolean requireEmptyHelmet;
private static boolean requireEmptyOffHand;
private static boolean requireEmptyChestPlate;
private static boolean requireEmptyPants;
private static boolean requireEmptyBoots;
@Getter
private static boolean debugMode;
@Getter
private static boolean unapplyOnDeath;
@Getter
private static boolean forcePermissionJoin;
@Getter
private static boolean forceShowOnJoin;
@Getter
private static boolean itemsAdderChangeReload;
@Getter
private static boolean worldGuardMoveCheck;
@Getter
private static boolean cosmeticEmoteBlockCheck;
@Getter
private static boolean addHelmetEnchants;
@Getter
private static boolean addChestplateEnchants;
@Getter
private static boolean addLeggingEnchants;
@Getter
private static boolean addBootsEnchants;
@Getter
private static boolean emoteAirCheck;
@Getter
private static boolean emoteDamageLeave;
@Getter
private static boolean emoteInvincible;
@Getter
private static boolean destroyLooseCosmetics;
@Getter
private static int viewDistance;
@Getter
private static int tickPeriod;
@Getter
private static double emoteDistance;
@Getter
private static Vector balloonOffset;
@Getter
private static String cosmeticEquipClickType;
@Getter
private static String cosmeticUnEquipClickType;
@Getter
private static boolean defaultShading;
@@ -129,11 +143,6 @@ public class Settings {
ConfigurationNode cosmeticSettings = source.node(COSMETIC_SETTINGS_PATH);
requireEmptyHelmet = cosmeticSettings.node(REQUIRE_EMPTY_HELMET_PATH).getBoolean();
requireEmptyOffHand = cosmeticSettings.node(REQUIRE_EMPTY_OFF_HAND_PATH).getBoolean();
requireEmptyChestPlate = cosmeticSettings.node(REQUIRE_EMPTY_CHEST_PLATE_PATH).getBoolean();
requireEmptyPants = cosmeticSettings.node(REQUIRE_EMPTY_PANTS_PATH).getBoolean();
requireEmptyBoots = cosmeticSettings.node(REQUIRE_EMPTY_BOOTS_PATH).getBoolean();
unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false);
forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false);
forceShowOnJoin = cosmeticSettings.node(FORCE_SHOW_COSMETICS_PATH).getBoolean(false);
@@ -193,141 +202,6 @@ public class Settings {
return new Vector(config.node("x").getDouble(), config.node("y").getDouble(), config.node("z").getDouble());
}
public static boolean isRequireEmptyHelmet() {
return requireEmptyHelmet;
}
public static boolean isRequireEmptyOffHand() {
return requireEmptyOffHand;
}
public static boolean isRequireEmptyChestPlate() {
return requireEmptyChestPlate;
}
public static boolean isRequireEmptyPants() {
return requireEmptyPants;
}
public static boolean isRequireEmptyBoots() {
return requireEmptyBoots;
}
public static boolean getRequireEmpty(CosmeticSlot slot) {
switch (slot) {
case HELMET -> {
return requireEmptyHelmet;
}
case CHESTPLATE -> {
return requireEmptyChestPlate;
}
case LEGGINGS -> {
return requireEmptyPants;
}
case BOOTS -> {
return requireEmptyBoots;
}
case OFFHAND -> {
return requireEmptyOffHand;
}
}
return false;
}
public static boolean getRequireEmpty(EquipmentSlot slot) {
switch (slot) {
case HEAD -> {
return requireEmptyHelmet;
}
case CHEST -> {
return requireEmptyChestPlate;
}
case LEGS -> {
return requireEmptyPants;
}
case FEET -> {
return requireEmptyBoots;
}
case OFF_HAND -> {
return requireEmptyOffHand;
}
}
return false;
}
public static Vector getBalloonOffset() {
if (balloonOffset == null) HMCCosmeticsPlugin.getInstance().getLogger().info("Shits null");
return balloonOffset;
}
public static int getViewDistance() {
return viewDistance;
}
public static String getDefaultMenu() {
return defaultMenu;
}
public static int getConfigVersion() {
return configVersion;
}
public static String getDyeMenuName() {
return dyeMenuName;
}
public static int getDyeMenuInputSlot() { return dyeMenuInputSlot; }
public static int getDyeMenuOutputSlot() { return dyeMenuOutputSlot; }
public static boolean isDebugEnabled() {
return debugMode;
}
public static boolean getItemsAdderReloadChange() {
return itemsAdderChangeReload;
}
public static int getTickPeriod() {
return tickPeriod;
}
public static boolean getUnapplyOnDeath() {
return unapplyOnDeath;
}
public static boolean getForcePermissionJoin() {
return forcePermissionJoin;
}
public static boolean isForceShowOnJoin() {
return forceShowOnJoin;
}
public static boolean getDebugMode() {
return debugMode;
}
public static boolean getCosmeticEmoteBlockCheck() {
return cosmeticEmoteBlockCheck;
}
public static boolean getEmoteAirCheck() {
return emoteAirCheck;
}
public static boolean isEmoteDamageLeave() {
return emoteDamageLeave;
}
public static boolean isEmoteInvincible() {
return emoteInvincible;
}
public static boolean isWorldGuardMoveCheckEnabled() {
return worldGuardMoveCheck;
}
public static boolean isDestroyLooseCosmetics() {
return destroyLooseCosmetics;
}
public static boolean getShouldAddEnchants(EquipmentSlot slot) {
switch (slot) {
case HEAD -> {
@@ -357,12 +231,4 @@ public class Settings {
plugin.saveConfig();
}
public static String getCosmeticEquipClickType() {
return cosmeticEquipClickType;
}
public static String getCosmeticUnEquipClickType() {
return cosmeticUnEquipClickType;
}
}

View File

@@ -8,7 +8,7 @@ import javax.annotation.Nullable;
public class Wardrobe {
private String id;
private int distance = WardrobeSettings.getDefaultDistance();
private int distance = WardrobeSettings.getDisplayRadius();
private String permission;
private WardrobeLocation location;

View File

@@ -1,11 +1,15 @@
package com.hibiscusmc.hmccosmetics.config;
import lombok.Setter;
import org.bukkit.Location;
public class WardrobeLocation {
@Setter
private Location npcLocation;
@Setter
private Location viewerLocation;
@Setter
private Location leaveLocation;
public WardrobeLocation(Location npcLocation, Location viewerLocation, Location leaveLocation) {
@@ -30,16 +34,4 @@ public class WardrobeLocation {
if (npcLocation == null || viewerLocation == null || leaveLocation == null) return false;
return true;
}
public void setNPCLocation(Location wardrobeLocation) {
this.npcLocation = wardrobeLocation;
}
public void setViewerLocation(Location viewerLocation) {
this.viewerLocation = viewerLocation;
}
public void setLeaveLocation(Location leaveLocation) {
this.leaveLocation = leaveLocation;
}
}

View File

@@ -4,6 +4,7 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
import com.hibiscusmc.hmccosmetics.config.serializer.LocationSerializer;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import com.hibiscusmc.hmccosmetics.util.misc.Utils;
import lombok.Getter;
import net.kyori.adventure.bossbar.BossBar;
import org.apache.commons.lang3.EnumUtils;
import org.bukkit.GameMode;
@@ -17,7 +18,6 @@ import java.util.logging.Level;
public class WardrobeSettings {
private static final String WARDROBE_PATH = "wardrobe";
private static final String DISABLE_ON_DAMAGE_PATH = "disable-on-damage";
private static final String DISPLAY_RADIUS_PATH = "display-radius";
private static final String PORTABLE_PATH = "portable";
@@ -60,32 +60,58 @@ public class WardrobeSettings {
private static final String TRANSITION_FADE_OUT_PATH = "title-fade-out";
private static ConfigurationNode configRoot;
@Getter
private static boolean disableOnDamage;
@Getter
private static int displayRadius;
@Getter
private static boolean portable;
@Getter
private static boolean alwaysDisplay;
@Getter
private static int staticRadius;
@Getter
private static int rotationSpeed;
@Getter
private static int spawnDelay;
@Getter
private static int despawnDelay;
@Getter
private static float bossbarProgress;
@Getter
private static boolean applyCosmeticsOnClose;
@Getter
private static boolean tryCosmeticsInWardrobe;
@Getter
private static boolean equipPumpkin;
@Getter
private static boolean returnLastLocation;
@Getter
private static boolean enabledBossbar;
@Getter
private static boolean enterOpenMenu;
@Getter
private static boolean forceExitGamemode;
@Getter
private static GameMode exitGamemode;
private static HashMap<String, Wardrobe> wardrobes;
@Getter
private static String bossbarMessage;
@Getter
private static BossBar.Overlay bossbarOverlay;
@Getter
private static BossBar.Color bossbarColor;
@Getter
private static boolean enabledTransition;
@Getter
private static String transitionText;
@Getter
private static int transitionDelay;
@Getter
private static int transitionFadeIn;
@Getter
private static int transitionStay;
@Getter
private static int transitionFadeOut;
public static void load(ConfigurationNode source) {
@@ -158,54 +184,6 @@ public class WardrobeSettings {
MessagesUtil.sendDebugMessages("Unable to create wardrobe " + id, Level.SEVERE);
}
}
//throw new RuntimeException(e);
}
public static int getDefaultDistance() {
return staticRadius;
}
public static boolean getDisableOnDamage() {
return disableOnDamage;
}
public static int getDisplayRadius() {
return displayRadius;
}
public static boolean isPortable() {
return portable;
}
public static boolean isAlwaysDisplay() {
return alwaysDisplay;
}
public static int getStaticRadius() {
return staticRadius;
}
public static int getRotationSpeed() {
return rotationSpeed;
}
public static int getSpawnDelay() {
return spawnDelay;
}
public static int getDespawnDelay() {
return despawnDelay;
}
public static boolean isApplyCosmeticsOnClose() {
return applyCosmeticsOnClose;
}
public static boolean isEquipPumpkin() {
return equipPumpkin;
}
public static boolean isReturnLastLocation() {
return returnLastLocation;
}
public static Wardrobe getWardrobe(String key) {
@@ -244,68 +222,12 @@ public class WardrobeSettings {
return wardrobeLocation.distanceSquared(location) <= staticRadius * staticRadius;
}
public static boolean getEnabledBossbar() {
return enabledBossbar;
}
public static float getBossbarProgress() {
return bossbarProgress;
}
public static String getBossbarText() {
return bossbarMessage;
}
public static BossBar.Overlay getBossbarOverlay() {
return bossbarOverlay;
}
public static BossBar.Color getBossbarColor() {
return bossbarColor;
}
public static boolean isEnabledTransition() {
return enabledTransition;
}
public static String getTransitionText() {
return transitionText;
}
public static int getTransitionDelay() {
return transitionDelay;
}
public static int getTransitionFadeIn() {
return transitionFadeIn;
}
public static int getTransitionStay() {
return transitionStay;
}
public static int getTransitionFadeOut() {
return transitionFadeOut;
}
public static boolean isEnterOpenMenu() {
return enterOpenMenu;
}
public static boolean isForceExitGamemode() {
return forceExitGamemode;
}
public static GameMode getExitGamemode() {
return exitGamemode;
}
public static boolean isTryCosmeticsInWardrobe() {
return tryCosmeticsInWardrobe;
}
/**
* Sets where the NPC/Mannequin will spawn in the wardrobe
* @param newLocation
*/
public static void setNPCLocation(Wardrobe wardrobe, Location newLocation) {
wardrobe.getLocation().setNPCLocation(newLocation);
wardrobe.getLocation().setNpcLocation(newLocation);
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();

View File

@@ -3,6 +3,8 @@ package com.hibiscusmc.hmccosmetics.cosmetic;
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@@ -14,11 +16,16 @@ import java.util.logging.Level;
public abstract class Cosmetic {
@Getter @Setter
private String id;
@Getter @Setter
private String permission;
private ItemStack item;
@Getter @Setter
private String material;
@Getter @Setter
private CosmeticSlot slot;
@Getter @Setter
private boolean dyable;
protected Cosmetic(String id, @NotNull ConfigurationNode config) {
@@ -44,46 +51,10 @@ public abstract class Cosmetic {
Cosmetics.addCosmetic(this);
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public CosmeticSlot getSlot() {
return this.slot;
}
public void setSlot(CosmeticSlot slot) {
this.slot = slot;
}
public String getPermission() {
return this.permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public boolean requiresPermission() {
return permission != null;
}
public void setDyable(boolean dyable) {
this.dyable = dyable;
}
public boolean isDyable() {
return this.dyable;
}
public String getMaterial() {
return material;
}
public abstract void update(CosmeticUser user);
@Nullable

View File

@@ -113,7 +113,7 @@ public class Cosmetics {
default -> new CosmeticArmorType(id, cosmeticConfig);
}
} catch (Exception e) {
if (Settings.isDebugEnabled()) e.printStackTrace();
if (Settings.isDebugMode()) e.printStackTrace();
}
}
}

View File

@@ -51,7 +51,7 @@ public abstract class Data {
}
public final Map<CosmeticSlot, Map<Cosmetic, Color>> deserializeData(CosmeticUser user, @NotNull String raw) {
return deserializeData(user, raw, Settings.getForcePermissionJoin());
return deserializeData(user, raw, Settings.isForcePermissionJoin());
}
@NotNull
@@ -101,7 +101,7 @@ public abstract class Data {
return cosmetics;
}
private boolean shouldHiddenSave(CosmeticUser.@NotNull HiddenReason reason) {
private boolean shouldHiddenSave(CosmeticUser.HiddenReason reason) {
switch (reason) {
case EMOTE, NONE -> {
return false;

View File

@@ -14,12 +14,10 @@ import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import com.hibiscusmc.hmccosmetics.util.misc.Adventure;
import com.hibiscusmc.hmccosmetics.util.misc.StringUtils;
import dev.triumphteam.gui.builder.item.ItemBuilder;
import dev.triumphteam.gui.guis.BaseGui;
import dev.triumphteam.gui.guis.Gui;
import dev.triumphteam.gui.guis.GuiItem;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
@@ -200,8 +198,8 @@ public class Menu {
title += Settings.getIndividualColumnShift(); // Goes to the next slot
}
if (item.getType().getId().equalsIgnoreCase("cosmetic")) {
Cosmetic cosmetic = Cosmetics.getCosmetic(item.getItemConfig().node("cosmetic").getString(""));
if (item.type().getId().equalsIgnoreCase("cosmetic")) {
Cosmetic cosmetic = Cosmetics.getCosmetic(item.itemConfig().node("cosmetic").getString(""));
if (cosmetic == null) continue;
if (user.hasCosmeticInSlot(cosmetic)) {
title += Settings.getEquippedCosmeticColor();
@@ -226,14 +224,14 @@ public class Menu {
}
private void updateItem(CosmeticUser user, Gui gui, MenuItem item) {
Type type = item.getType();
for (int slot : item.getSlots()) {
ItemStack modifiedItem = getMenuItem(user, type, item.getItemConfig(), item.getItem().clone(), slot);
Type type = item.type();
for (int slot : item.slots()) {
ItemStack modifiedItem = getMenuItem(user, type, item.itemConfig(), item.item().clone(), slot);
GuiItem guiItem = ItemBuilder.from(modifiedItem).asGuiItem();
guiItem.setAction(event -> {
MessagesUtil.sendDebugMessages("Selected slot " + slot);
final ClickType clickType = event.getClick();
if (type != null) type.run(user, item.getItemConfig(), clickType);
if (type != null) type.run(user, item.itemConfig(), clickType);
updateMenu(user, gui);
});

View File

@@ -86,7 +86,7 @@ public class Menus {
new Menu(FilenameUtils.removeExtension(child.getFileName().toString()), root);
} catch (Exception e) {
MessagesUtil.sendDebugMessages("Unable to create menu in " + child.getFileName().toString(), Level.WARNING);
if (Settings.isDebugEnabled()) e.printStackTrace();
if (Settings.isDebugMode()) e.printStackTrace();
}
}
});

View File

@@ -40,7 +40,7 @@ public class HookItemAdder extends Hook {
@EventHandler(priority = EventPriority.MONITOR)
public void onItemAdderDataLoad(ItemsAdderLoadDataEvent event) {
// By default, it will only run once at startup, if hook setting is enabled
if (enabled && !Settings.getItemsAdderReloadChange()) return;
if (enabled && !Settings.isItemsAdderChangeReload()) return;
this.enabled = true;
HMCCosmeticsPlugin.setup();
}

View File

@@ -322,7 +322,7 @@ public class PlayerGameListener implements Listener {
if (user.isInWardrobe()) user.leaveWardrobe();
if (Settings.getUnapplyOnDeath() && !event.getEntity().hasPermission("hmccosmetics.unapplydeath.bypass")) {
if (Settings.isUnapplyOnDeath() && !event.getEntity().hasPermission("hmccosmetics.unapplydeath.bypass")) {
user.removeCosmetics();
}
}

View File

@@ -2,6 +2,7 @@ package com.hibiscusmc.hmccosmetics.nms;
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import lombok.Getter;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
@@ -10,6 +11,7 @@ public class NMSHandlers {
private static final String[] SUPPORTED_VERSION = new String[]{"v1_18_R2", "v1_19_R1", "v1_19_R2", "v1_19_R3", "v1_20_R1"};
private static NMSHandler handler;
@Getter
private static String version;
public static NMSHandler getHandler() {
@@ -21,10 +23,6 @@ public class NMSHandlers {
return handler;
}
public static String getVersion() {
return version;
}
public static void setup() {
if (handler != null) return;
final String packageName = HMCCosmeticsPlugin.getInstance().getServer().getClass().getPackage().getName();

View File

@@ -23,6 +23,7 @@ import com.hibiscusmc.hmccosmetics.util.InventoryUtils;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Material;
@@ -39,18 +40,22 @@ import java.util.logging.Level;
public class CosmeticUser {
@Getter
private final UUID uniqueId;
private int taskId;
private HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
private final HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
private UserWardrobeManager userWardrobeManager;
private UserBalloonManager userBalloonManager;
@Getter
private UserBackpackManager userBackpackManager;
private UserEmoteManager userEmoteManager;
@Getter
private final UserEmoteManager userEmoteManager;
// Cosmetic Settings/Toggles
private boolean hideCosmetics;
@Getter
private HiddenReason hiddenReason;
private HashMap<CosmeticSlot, Color> colors = new HashMap<>();
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
public CosmeticUser(UUID uuid) {
this.uniqueId = uuid;
@@ -79,10 +84,6 @@ public class CosmeticUser {
despawnBalloon();
}
public UUID getUniqueId() {
return this.uniqueId;
}
public Cosmetic getCosmetic(CosmeticSlot slot) {
return playerCosmetics.get(slot);
}
@@ -273,10 +274,6 @@ public class CosmeticUser {
return item;
}
public UserBackpackManager getUserBackpackManager() {
return userBackpackManager;
}
public UserBalloonManager getBalloonManager() {
return this.userBalloonManager;
}
@@ -285,10 +282,6 @@ public class CosmeticUser {
return userWardrobeManager;
}
public UserEmoteManager getUserEmoteManager() {
return userEmoteManager;
}
public void enterWardrobe(boolean ignoreDistance, Wardrobe wardrobe) {
if (wardrobe.hasPermission() && !getPlayer().hasPermission(wardrobe.getPermission())) {
MessagesUtil.sendMessage(getPlayer(), "no-permission");
@@ -491,7 +484,7 @@ public class CosmeticUser {
if (hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON);
getBalloonManager().addPlayerToModel(this, balloonType);
List<Player> viewer = PlayerUtils.getNearbyPlayers(getPlayer());
List<Player> viewer = PlayerUtils.getNearbyPlayers(getEntity().getLocation());
PacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer);
}
if (hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
@@ -507,10 +500,6 @@ public class CosmeticUser {
return this.hideCosmetics;
}
public HiddenReason getHiddenReason() {
return hiddenReason;
}
public enum HiddenReason {
NONE,
WORLDGUARD,

View File

@@ -58,13 +58,13 @@ public class UserEmoteModel extends PlayerModel {
MessagesUtil.sendDebugMessages("New Yaw " + ServerUtils.getNextYaw((int) thirdPersonLocation.getYaw(), 180));
thirdPersonLocation.setYaw(ServerUtils.getNextYaw((int) thirdPersonLocation.getYaw(), 180));
}
if (Settings.getCosmeticEmoteBlockCheck() && thirdPersonLocation.getBlock().getType().isOccluding()) {
if (Settings.isCosmeticEmoteBlockCheck() && thirdPersonLocation.getBlock().getType().isOccluding()) {
stopAnimation();
MessagesUtil.sendMessage(player, "emote-blocked");
return;
}
// Check if block below player is an air block
if (Settings.getEmoteAirCheck() && newLocation.clone().subtract(0, 1, 0).getBlock().getType().isAir()) {
if (Settings.isEmoteAirCheck() && newLocation.clone().subtract(0, 1, 0).getBlock().getType().isAir()) {
stopAnimation();
MessagesUtil.sendMessage(player, "emote-blocked");
}

View File

@@ -131,9 +131,9 @@ public class UserWardrobeManager {
user.getBalloonManager().getModelEntity().teleport(balloonLocation);
}
if (WardrobeSettings.getEnabledBossbar()) {
if (WardrobeSettings.isEnabledBossbar()) {
float progress = WardrobeSettings.getBossbarProgress();
Component message = MessagesUtil.processStringNoKey(WardrobeSettings.getBossbarText());
Component message = MessagesUtil.processStringNoKey(WardrobeSettings.getBossbarMessage());
bossBar = BossBar.bossBar(message, progress, WardrobeSettings.getBossbarColor(), WardrobeSettings.getBossbarOverlay());
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
@@ -228,7 +228,7 @@ public class UserWardrobeManager {
NMSHandlers.getHandler().equipmentSlotUpdate(user.getPlayer().getEntityId(), EquipmentSlot.HEAD, player.getInventory().getHelmet(), viewer);
}
if (WardrobeSettings.getEnabledBossbar()) {
if (WardrobeSettings.isEnabledBossbar()) {
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
target.hideBossBar(bossBar);

View File

@@ -142,7 +142,7 @@ public class MessagesUtil {
}
public static void sendDebugMessages(String message, Level level) {
if (!Settings.isDebugEnabled() && level == Level.INFO) return;
if (!Settings.isDebugMode() && level == Level.INFO) return;
HMCCosmeticsPlugin.getInstance().getLogger().log(level, message);
}
}