mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-22 08:29:27 +00:00
Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
627ebafb79 | ||
|
|
ef3bf3fc19 | ||
|
|
97c02883b8 | ||
|
|
ad516e80d1 | ||
|
|
317ee261db | ||
|
|
5f8fb642a4 | ||
|
|
7f4a1bc3f2 | ||
|
|
e2a727864e | ||
|
|
c0014476fd | ||
|
|
8ec6a87b94 | ||
|
|
97cf079b63 | ||
|
|
82f13c349f | ||
|
|
f91c174b20 | ||
|
|
3ae6a11626 | ||
|
|
f2fab91916 | ||
|
|
55890fa4ac | ||
|
|
fa2aa2c6dc | ||
|
|
0b5f986cfc | ||
|
|
26361b833f | ||
|
|
28a37848c8 | ||
|
|
7131a45d9c | ||
|
|
6d9325ed18 | ||
|
|
0640b33d50 | ||
|
|
8b944b8e29 | ||
|
|
4481fa1c12 | ||
|
|
de133fa288 | ||
|
|
20da7797c9 | ||
|
|
2aed727832 | ||
|
|
b6731ba21a | ||
|
|
d333527664 | ||
|
|
a82bb8183b | ||
|
|
1eaeb8ecea | ||
|
|
7a9d2f0041 | ||
|
|
6d11deb9aa | ||
|
|
f5f33f5fe7 | ||
|
|
62a1d04040 | ||
|
|
17db498e18 | ||
|
|
0c11e1b1e5 | ||
|
|
d20eb11f45 | ||
|
|
51e19d3c36 | ||
|
|
8e8d86b94c | ||
|
|
c0caea2447 | ||
|
|
33356ea81d | ||
|
|
a486b13e7e | ||
|
|
938a561d25 | ||
|
|
1c61b72624 | ||
|
|
46d82b01f0 |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.5.2"
|
version = "2.6.0"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
@@ -73,12 +73,17 @@ allprojects {
|
|||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.3")
|
compileOnly("me.clip:placeholderapi:2.11.3")
|
||||||
compileOnly("com.ticxo:modelengine:R3.0.1")
|
compileOnly("com.ticxo:modelengine:R3.0.1")
|
||||||
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
compileOnly("com.github.oraxen:oraxen:1.160.0")
|
||||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
||||||
compileOnly("com.mineinabyss:geary-papermc:0.24-SNAPSHOT")
|
compileOnly("com.mineinabyss:geary-papermc:0.24.1")
|
||||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
||||||
compileOnly("it.unimi.dsi:fastutil:8.5.11")
|
compileOnly("it.unimi.dsi:fastutil:8.5.11")
|
||||||
compileOnly("com.github.LeonMangler:SuperVanish:6.2.17")
|
compileOnly("com.github.LeonMangler:SuperVanish:6.2.17")
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.2")
|
||||||
|
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.28")
|
||||||
|
testCompileOnly("org.projectlombok:lombok:1.18.28")
|
||||||
|
testAnnotationProcessor("org.projectlombok:lombok:1.18.28")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ dependencies {
|
|||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.3")
|
compileOnly("me.clip:placeholderapi:2.11.3")
|
||||||
compileOnly("com.ticxo:modelengine:R3.0.1")
|
compileOnly("com.ticxo:modelengine:R3.0.1")
|
||||||
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
compileOnly("com.github.oraxen:oraxen:1.160.0")
|
||||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
||||||
compileOnly("com.mineinabyss:geary-papermc:0.24-SNAPSHOT")
|
compileOnly("com.mineinabyss:geary-papermc:0.24-SNAPSHOT")
|
||||||
compileOnly("com.hibiscus:hmccolor:0.3-SNAPSHOT")
|
//compileOnly("com.hibiscus:hmccolor:0.3-SNAPSHOT") USE LIB PROVIDED FILE
|
||||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
||||||
compileOnly("it.unimi.dsi:fastutil:8.5.11")
|
compileOnly("it.unimi.dsi:fastutil:8.5.11")
|
||||||
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
|||||||
new Database();
|
new Database();
|
||||||
|
|
||||||
// WorldGuard
|
// WorldGuard
|
||||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null && Settings.isWorldGuardMoveCheckEnabled()) {
|
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null && Settings.isWorldGuardMoveCheck()) {
|
||||||
getServer().getPluginManager().registerEvents(new WGListener(), this);
|
getServer().getPluginManager().registerEvents(new WGListener(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.api;
|
package com.hibiscusmc.hmccosmetics.api;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
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.Cosmetics;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
|
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@@ -94,4 +96,22 @@ public class HMCCosmeticsAPI {
|
|||||||
public static List<CosmeticUser> getAllCosmeticUsers() {
|
public static List<CosmeticUser> getAllCosmeticUsers() {
|
||||||
return List.copyOf(CosmeticUsers.values());
|
return List.copyOf(CosmeticUsers.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This returns the NMS version of the server as recognized by HMCCosmetics. This will be null until HMCC setup has been completed.
|
||||||
|
* @return The NMS version of the server in String format
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static String getNMSVersion() {
|
||||||
|
return NMSHandlers.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This returns the HMCCosmetics version.
|
||||||
|
* @return The HMCCosmetics version in String format
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public static String getHMCCVersion() {
|
||||||
|
return HMCCosmeticsPlugin.getInstance().getDescription().getVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
player.sendMessage("Passengers -> " + player.getPassengers());
|
player.sendMessage("Passengers -> " + player.getPassengers());
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
player.sendMessage("Backpack Location -> " + user.getUserBackpackManager().getArmorStand().getLocation());
|
player.sendMessage("Backpack Location -> " + user.getUserBackpackManager().getEntityManager().getLocation());
|
||||||
}
|
}
|
||||||
player.sendMessage("Cosmetics -> " + user.getCosmetics());
|
player.sendMessage("Cosmetics -> " + user.getCosmetics());
|
||||||
player.sendMessage("EntityId -> " + player.getEntityId());
|
player.sendMessage("EntityId -> " + player.getEntityId());
|
||||||
@@ -423,7 +423,7 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.getDebugMode()) {
|
if (Settings.isDebugMode()) {
|
||||||
Settings.setDebugMode(false);
|
Settings.setDebugMode(false);
|
||||||
if (!silent) MessagesUtil.sendMessage(sender, "debug-disabled");
|
if (!silent) MessagesUtil.sendMessage(sender, "debug-disabled");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.config;
|
package com.hibiscusmc.hmccosmetics.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import org.spongepowered.configurate.ConfigurationNode;
|
import org.spongepowered.configurate.ConfigurationNode;
|
||||||
|
|
||||||
public class DatabaseSettings {
|
public class DatabaseSettings {
|
||||||
|
|
||||||
//private static final String DATABASE_SETTINGS_PATH = "cosmetic-settings";
|
|
||||||
private static final String DATABASE_TYPE_PATH = "type";
|
private static final String DATABASE_TYPE_PATH = "type";
|
||||||
private static final String MYSQL_DATABASE_SETTINGS = "mysql";
|
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 ENABLE_DELAY = "enabled";
|
||||||
private static final String DELAY_LENGTH = "delay";
|
private static final String DELAY_LENGTH = "delay";
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static String databaseType;
|
private static String databaseType;
|
||||||
|
@Getter
|
||||||
private static String database;
|
private static String database;
|
||||||
|
@Getter
|
||||||
private static String password;
|
private static String password;
|
||||||
|
@Getter
|
||||||
private static String host;
|
private static String host;
|
||||||
|
@Getter
|
||||||
private static String username;
|
private static String username;
|
||||||
|
@Getter
|
||||||
private static int port;
|
private static int port;
|
||||||
|
@Getter
|
||||||
private static boolean enabledDelay;
|
private static boolean enabledDelay;
|
||||||
|
@Getter
|
||||||
private static int delayLength;
|
private static int delayLength;
|
||||||
|
|
||||||
public static void load(ConfigurationNode source) {
|
public static void load(ConfigurationNode source) {
|
||||||
//ConfigurationNode databaseSettings = source.node(DATABASE_SETTINGS_PATH);
|
|
||||||
|
|
||||||
databaseType = source.node(DATABASE_TYPE_PATH).getString();
|
databaseType = source.node(DATABASE_TYPE_PATH).getString();
|
||||||
|
|
||||||
ConfigurationNode mySql = source.node(MYSQL_DATABASE_SETTINGS);
|
ConfigurationNode mySql = source.node(MYSQL_DATABASE_SETTINGS);
|
||||||
@@ -44,36 +50,4 @@ public class DatabaseSettings {
|
|||||||
enabledDelay = delay.node(ENABLE_DELAY).getBoolean(false);
|
enabledDelay = delay.node(ENABLE_DELAY).getBoolean(false);
|
||||||
delayLength = delay.node(DELAY_LENGTH).getInt(2);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.config;
|
package com.hibiscusmc.hmccosmetics.config;
|
||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.spongepowered.configurate.ConfigurationNode;
|
import org.spongepowered.configurate.ConfigurationNode;
|
||||||
@@ -15,11 +15,6 @@ public class Settings {
|
|||||||
private static final String DEFAULT_MENU = "default-menu";
|
private static final String DEFAULT_MENU = "default-menu";
|
||||||
private static final String CONFIG_VERSION = "config-version";
|
private static final String CONFIG_VERSION = "config-version";
|
||||||
private static final String COSMETIC_SETTINGS_PATH = "cosmetic-settings";
|
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 BALLOON_OFFSET = "balloon-offset";
|
||||||
private static final String VIEW_DISTANCE_PATH = "view-distance";
|
private static final String VIEW_DISTANCE_PATH = "view-distance";
|
||||||
private static final String DYE_MENU_PATH = "dye-menu";
|
private static final String DYE_MENU_PATH = "dye-menu";
|
||||||
@@ -42,6 +37,9 @@ public class Settings {
|
|||||||
private static final String COSMETIC_EMOTE_AIR_CHECK_PATH = "emote-air-check";
|
private static final String COSMETIC_EMOTE_AIR_CHECK_PATH = "emote-air-check";
|
||||||
private static final String COSMETIC_EMOTE_DAMAGE_PATH = "emote-damage-leave";
|
private static final String COSMETIC_EMOTE_DAMAGE_PATH = "emote-damage-leave";
|
||||||
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_MOVE_CHECK_PATH = "emote-move";
|
||||||
|
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
||||||
private static final String COSMETIC_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments";
|
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_CHESTPLATE_PATH = "chest-add-enchantments";
|
||||||
private static final String COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH = "leggings-add-enchantments";
|
private static final String COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH = "leggings-add-enchantments";
|
||||||
@@ -51,38 +49,94 @@ public class Settings {
|
|||||||
private static final String COSMETIC_TYPE_SETTINGS_PATH = "cosmetic-type";
|
private static final String COSMETIC_TYPE_SETTINGS_PATH = "cosmetic-type";
|
||||||
private static final String EQUIP_CLICK_TYPE = "equip-click";
|
private static final String EQUIP_CLICK_TYPE = "equip-click";
|
||||||
private static final String UNEQUIP_CLICK_TYPE = "unequip-click";
|
private static final String UNEQUIP_CLICK_TYPE = "unequip-click";
|
||||||
|
private static final String SHADING_PATH = "shading";
|
||||||
|
private static final String FIRST_ROW_SHIFT_PATH = "first-row-shift";
|
||||||
|
private static final String SEQUENT_ROW_SHIFT_PATH = "sequent-row-shift";
|
||||||
|
private static final String INDIVIDUAL_COLUMN_SHIFT_PATH = "individual-column-shift";
|
||||||
|
private static final String BACKGROUND_PATH = "background";
|
||||||
|
private static final String CLEAR_BACKGROUND_PATH = "clear-background";
|
||||||
|
private static final String EQUIPPED_COSMETIC_COLOR_PATH = "equipped-cosmetic-color";
|
||||||
|
private static final String EQUIPABLE_COSMETIC_COLOR_PATH = "equipable-cosmetic-color";
|
||||||
|
private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color";
|
||||||
|
private static final String ENABLED_PATH = "enabled";
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static String defaultMenu;
|
private static String defaultMenu;
|
||||||
|
@Getter
|
||||||
private static String dyeMenuName;
|
private static String dyeMenuName;
|
||||||
|
@Getter
|
||||||
private static int dyeMenuInputSlot;
|
private static int dyeMenuInputSlot;
|
||||||
|
@Getter
|
||||||
private static int dyeMenuOutputSlot;
|
private static int dyeMenuOutputSlot;
|
||||||
|
@Getter
|
||||||
private static int configVersion;
|
private static int configVersion;
|
||||||
private static boolean requireEmptyHelmet;
|
@Getter
|
||||||
private static boolean requireEmptyOffHand;
|
|
||||||
private static boolean requireEmptyChestPlate;
|
|
||||||
private static boolean requireEmptyPants;
|
|
||||||
private static boolean requireEmptyBoots;
|
|
||||||
private static boolean debugMode;
|
private static boolean debugMode;
|
||||||
|
@Getter
|
||||||
private static boolean unapplyOnDeath;
|
private static boolean unapplyOnDeath;
|
||||||
|
@Getter
|
||||||
private static boolean forcePermissionJoin;
|
private static boolean forcePermissionJoin;
|
||||||
|
@Getter
|
||||||
private static boolean forceShowOnJoin;
|
private static boolean forceShowOnJoin;
|
||||||
|
@Getter
|
||||||
private static boolean itemsAdderChangeReload;
|
private static boolean itemsAdderChangeReload;
|
||||||
|
@Getter
|
||||||
private static boolean worldGuardMoveCheck;
|
private static boolean worldGuardMoveCheck;
|
||||||
|
@Getter
|
||||||
private static boolean cosmeticEmoteBlockCheck;
|
private static boolean cosmeticEmoteBlockCheck;
|
||||||
|
@Getter
|
||||||
private static boolean addHelmetEnchants;
|
private static boolean addHelmetEnchants;
|
||||||
|
@Getter
|
||||||
private static boolean addChestplateEnchants;
|
private static boolean addChestplateEnchants;
|
||||||
|
@Getter
|
||||||
private static boolean addLeggingEnchants;
|
private static boolean addLeggingEnchants;
|
||||||
|
@Getter
|
||||||
private static boolean addBootsEnchants;
|
private static boolean addBootsEnchants;
|
||||||
|
@Getter
|
||||||
private static boolean emoteAirCheck;
|
private static boolean emoteAirCheck;
|
||||||
|
@Getter
|
||||||
private static boolean emoteDamageLeave;
|
private static boolean emoteDamageLeave;
|
||||||
|
@Getter
|
||||||
private static boolean emoteInvincible;
|
private static boolean emoteInvincible;
|
||||||
|
@Getter
|
||||||
private static boolean destroyLooseCosmetics;
|
private static boolean destroyLooseCosmetics;
|
||||||
|
@Getter
|
||||||
|
private static boolean backpackForceRidingEnabled;
|
||||||
|
@Getter
|
||||||
private static int viewDistance;
|
private static int viewDistance;
|
||||||
|
@Getter
|
||||||
private static int tickPeriod;
|
private static int tickPeriod;
|
||||||
|
@Getter
|
||||||
private static double emoteDistance;
|
private static double emoteDistance;
|
||||||
|
@Getter
|
||||||
private static Vector balloonOffset;
|
private static Vector balloonOffset;
|
||||||
|
@Getter
|
||||||
private static String cosmeticEquipClickType;
|
private static String cosmeticEquipClickType;
|
||||||
|
@Getter
|
||||||
private static String cosmeticUnEquipClickType;
|
private static String cosmeticUnEquipClickType;
|
||||||
|
@Getter
|
||||||
|
private static boolean defaultShading;
|
||||||
|
@Getter
|
||||||
|
private static String firstRowShift;
|
||||||
|
@Getter
|
||||||
|
private static String sequentRowShift;
|
||||||
|
@Getter
|
||||||
|
private static String individualColumnShift;
|
||||||
|
@Getter
|
||||||
|
private static String background;
|
||||||
|
@Getter
|
||||||
|
private static String clearBackground;
|
||||||
|
@Getter
|
||||||
|
private static String equippedCosmeticColor;
|
||||||
|
@Getter
|
||||||
|
private static String equipableCosmeticColor;
|
||||||
|
@Getter
|
||||||
|
private static String lockedCosmeticColor;
|
||||||
|
@Getter
|
||||||
|
private static boolean emoteCameraEnabled;
|
||||||
|
@Getter
|
||||||
|
private static boolean emoteMoveCheck;
|
||||||
|
|
||||||
|
|
||||||
public static void load(ConfigurationNode source) {
|
public static void load(ConfigurationNode source) {
|
||||||
|
|
||||||
@@ -101,11 +155,6 @@ public class Settings {
|
|||||||
|
|
||||||
ConfigurationNode cosmeticSettings = source.node(COSMETIC_SETTINGS_PATH);
|
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);
|
unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false);
|
||||||
forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false);
|
forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false);
|
||||||
forceShowOnJoin = cosmeticSettings.node(FORCE_SHOW_COSMETICS_PATH).getBoolean(false);
|
forceShowOnJoin = cosmeticSettings.node(FORCE_SHOW_COSMETICS_PATH).getBoolean(false);
|
||||||
@@ -115,20 +164,34 @@ public class Settings {
|
|||||||
emoteDamageLeave = cosmeticSettings.node(COSMETIC_EMOTE_DAMAGE_PATH).getBoolean(false);
|
emoteDamageLeave = cosmeticSettings.node(COSMETIC_EMOTE_DAMAGE_PATH).getBoolean(false);
|
||||||
emoteInvincible = cosmeticSettings.node(COSMETIC_EMOTE_INVINCIBLE_PATH).getBoolean(false);
|
emoteInvincible = cosmeticSettings.node(COSMETIC_EMOTE_INVINCIBLE_PATH).getBoolean(false);
|
||||||
destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false);
|
destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false);
|
||||||
|
backpackForceRidingEnabled = cosmeticSettings.node(COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH).getBoolean(false);
|
||||||
addHelmetEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_HELMET_PATH).getBoolean(false);
|
addHelmetEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_HELMET_PATH).getBoolean(false);
|
||||||
addChestplateEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_CHESTPLATE_PATH).getBoolean(false);
|
addChestplateEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_CHESTPLATE_PATH).getBoolean(false);
|
||||||
addLeggingEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH).getBoolean(false);
|
addLeggingEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH).getBoolean(false);
|
||||||
addBootsEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_BOOTS_PATH).getBoolean(false);
|
addBootsEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_BOOTS_PATH).getBoolean(false);
|
||||||
tickPeriod = cosmeticSettings.node(TICK_PERIOD_PATH).getInt(-1);
|
tickPeriod = cosmeticSettings.node(TICK_PERIOD_PATH).getInt(-1);
|
||||||
viewDistance = cosmeticSettings.node(VIEW_DISTANCE_PATH).getInt();
|
viewDistance = cosmeticSettings.node(VIEW_DISTANCE_PATH).getInt(-3);
|
||||||
|
emoteCameraEnabled = cosmeticSettings.node(COSMETIC_EMOTE_CAMERA_PATH).getBoolean(true);
|
||||||
|
emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false);
|
||||||
|
|
||||||
ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH);
|
ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH);
|
||||||
|
|
||||||
|
ConfigurationNode shadingSettings = menuSettings.node(SHADING_PATH);
|
||||||
|
defaultShading = shadingSettings.node(ENABLED_PATH).getBoolean();
|
||||||
|
firstRowShift = shadingSettings.node(FIRST_ROW_SHIFT_PATH).getString();
|
||||||
|
sequentRowShift = shadingSettings.node(SEQUENT_ROW_SHIFT_PATH).getString();
|
||||||
|
individualColumnShift = shadingSettings.node(INDIVIDUAL_COLUMN_SHIFT_PATH).getString();
|
||||||
|
background = shadingSettings.node(BACKGROUND_PATH).getString();
|
||||||
|
clearBackground = shadingSettings.node(CLEAR_BACKGROUND_PATH).getString();
|
||||||
|
equippedCosmeticColor = shadingSettings.node(EQUIPPED_COSMETIC_COLOR_PATH).getString();
|
||||||
|
equipableCosmeticColor = shadingSettings.node(EQUIPABLE_COSMETIC_COLOR_PATH).getString();
|
||||||
|
lockedCosmeticColor = shadingSettings.node(LOCKED_COSMETIC_COLOR_PATH).getString();
|
||||||
|
|
||||||
ConfigurationNode cosmeticTypeSettings = menuSettings.node(COSMETIC_TYPE_SETTINGS_PATH);
|
ConfigurationNode cosmeticTypeSettings = menuSettings.node(COSMETIC_TYPE_SETTINGS_PATH);
|
||||||
cosmeticEquipClickType = cosmeticTypeSettings.node(EQUIP_CLICK_TYPE).getString("ALL");
|
cosmeticEquipClickType = cosmeticTypeSettings.node(EQUIP_CLICK_TYPE).getString("ALL");
|
||||||
cosmeticUnEquipClickType = cosmeticTypeSettings.node(UNEQUIP_CLICK_TYPE).getString("ALL");
|
cosmeticUnEquipClickType = cosmeticTypeSettings.node(UNEQUIP_CLICK_TYPE).getString("ALL");
|
||||||
|
|
||||||
final var balloonSection = cosmeticSettings.node(BALLOON_OFFSET);
|
final var balloonSection = cosmeticSettings.node(BALLOON_OFFSET);
|
||||||
|
|
||||||
balloonOffset = loadVector(balloonSection);
|
balloonOffset = loadVector(balloonSection);
|
||||||
|
|
||||||
ConfigurationNode dyeMenuSettings = source.node(DYE_MENU_PATH);
|
ConfigurationNode dyeMenuSettings = source.node(DYE_MENU_PATH);
|
||||||
@@ -150,149 +213,10 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector loadVector(final ConfigurationNode config) {
|
public static Vector loadVector(final ConfigurationNode config) {
|
||||||
return new Vector(config.node("x").getDouble(), config.node("y").getDouble(), config.node("z").getDouble());
|
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 double getEmoteDistance() {
|
|
||||||
return emoteDistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
public static boolean getShouldAddEnchants(EquipmentSlot slot) {
|
||||||
switch (slot) {
|
switch (slot) {
|
||||||
case HEAD -> {
|
case HEAD -> {
|
||||||
@@ -322,12 +246,4 @@ public class Settings {
|
|||||||
|
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCosmeticEquipClickType() {
|
|
||||||
return cosmeticEquipClickType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCosmeticUnEquipClickType() {
|
|
||||||
return cosmeticUnEquipClickType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import javax.annotation.Nullable;
|
|||||||
public class Wardrobe {
|
public class Wardrobe {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int distance = WardrobeSettings.getDefaultDistance();
|
private int distance = WardrobeSettings.getDisplayRadius();
|
||||||
private String permission;
|
private String permission;
|
||||||
private WardrobeLocation location;
|
private WardrobeLocation location;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.config;
|
package com.hibiscusmc.hmccosmetics.config;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class WardrobeLocation {
|
public class WardrobeLocation {
|
||||||
|
|
||||||
|
@Setter
|
||||||
private Location npcLocation;
|
private Location npcLocation;
|
||||||
|
@Setter
|
||||||
private Location viewerLocation;
|
private Location viewerLocation;
|
||||||
|
@Setter
|
||||||
private Location leaveLocation;
|
private Location leaveLocation;
|
||||||
|
|
||||||
public WardrobeLocation(Location npcLocation, Location viewerLocation, 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;
|
if (npcLocation == null || viewerLocation == null || leaveLocation == null) return false;
|
||||||
return true;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
|||||||
import com.hibiscusmc.hmccosmetics.config.serializer.LocationSerializer;
|
import com.hibiscusmc.hmccosmetics.config.serializer.LocationSerializer;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.Utils;
|
import com.hibiscusmc.hmccosmetics.util.misc.Utils;
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.bossbar.BossBar;
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
import org.apache.commons.lang3.EnumUtils;
|
import org.apache.commons.lang3.EnumUtils;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@@ -17,7 +18,6 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class WardrobeSettings {
|
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 DISABLE_ON_DAMAGE_PATH = "disable-on-damage";
|
||||||
private static final String DISPLAY_RADIUS_PATH = "display-radius";
|
private static final String DISPLAY_RADIUS_PATH = "display-radius";
|
||||||
private static final String PORTABLE_PATH = "portable";
|
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 final String TRANSITION_FADE_OUT_PATH = "title-fade-out";
|
||||||
|
|
||||||
private static ConfigurationNode configRoot;
|
private static ConfigurationNode configRoot;
|
||||||
|
@Getter
|
||||||
private static boolean disableOnDamage;
|
private static boolean disableOnDamage;
|
||||||
|
@Getter
|
||||||
private static int displayRadius;
|
private static int displayRadius;
|
||||||
|
@Getter
|
||||||
private static boolean portable;
|
private static boolean portable;
|
||||||
|
@Getter
|
||||||
private static boolean alwaysDisplay;
|
private static boolean alwaysDisplay;
|
||||||
|
@Getter
|
||||||
private static int staticRadius;
|
private static int staticRadius;
|
||||||
|
@Getter
|
||||||
private static int rotationSpeed;
|
private static int rotationSpeed;
|
||||||
|
@Getter
|
||||||
private static int spawnDelay;
|
private static int spawnDelay;
|
||||||
|
@Getter
|
||||||
private static int despawnDelay;
|
private static int despawnDelay;
|
||||||
|
@Getter
|
||||||
private static float bossbarProgress;
|
private static float bossbarProgress;
|
||||||
|
@Getter
|
||||||
private static boolean applyCosmeticsOnClose;
|
private static boolean applyCosmeticsOnClose;
|
||||||
|
@Getter
|
||||||
private static boolean tryCosmeticsInWardrobe;
|
private static boolean tryCosmeticsInWardrobe;
|
||||||
|
@Getter
|
||||||
private static boolean equipPumpkin;
|
private static boolean equipPumpkin;
|
||||||
|
@Getter
|
||||||
private static boolean returnLastLocation;
|
private static boolean returnLastLocation;
|
||||||
|
@Getter
|
||||||
private static boolean enabledBossbar;
|
private static boolean enabledBossbar;
|
||||||
|
@Getter
|
||||||
private static boolean enterOpenMenu;
|
private static boolean enterOpenMenu;
|
||||||
|
@Getter
|
||||||
private static boolean forceExitGamemode;
|
private static boolean forceExitGamemode;
|
||||||
|
@Getter
|
||||||
private static GameMode exitGamemode;
|
private static GameMode exitGamemode;
|
||||||
private static HashMap<String, Wardrobe> wardrobes;
|
private static HashMap<String, Wardrobe> wardrobes;
|
||||||
|
@Getter
|
||||||
private static String bossbarMessage;
|
private static String bossbarMessage;
|
||||||
|
@Getter
|
||||||
private static BossBar.Overlay bossbarOverlay;
|
private static BossBar.Overlay bossbarOverlay;
|
||||||
|
@Getter
|
||||||
private static BossBar.Color bossbarColor;
|
private static BossBar.Color bossbarColor;
|
||||||
|
@Getter
|
||||||
private static boolean enabledTransition;
|
private static boolean enabledTransition;
|
||||||
|
@Getter
|
||||||
private static String transitionText;
|
private static String transitionText;
|
||||||
|
@Getter
|
||||||
private static int transitionDelay;
|
private static int transitionDelay;
|
||||||
|
@Getter
|
||||||
private static int transitionFadeIn;
|
private static int transitionFadeIn;
|
||||||
|
@Getter
|
||||||
private static int transitionStay;
|
private static int transitionStay;
|
||||||
|
@Getter
|
||||||
private static int transitionFadeOut;
|
private static int transitionFadeOut;
|
||||||
|
|
||||||
public static void load(ConfigurationNode source) {
|
public static void load(ConfigurationNode source) {
|
||||||
@@ -158,54 +184,6 @@ public class WardrobeSettings {
|
|||||||
MessagesUtil.sendDebugMessages("Unable to create wardrobe " + id, Level.SEVERE);
|
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) {
|
public static Wardrobe getWardrobe(String key) {
|
||||||
@@ -244,68 +222,12 @@ public class WardrobeSettings {
|
|||||||
return wardrobeLocation.distanceSquared(location) <= staticRadius * staticRadius;
|
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
|
* Sets where the NPC/Mannequin will spawn in the wardrobe
|
||||||
* @param newLocation
|
* @param newLocation
|
||||||
*/
|
*/
|
||||||
public static void setNPCLocation(Wardrobe wardrobe, Location newLocation) {
|
public static void setNPCLocation(Wardrobe wardrobe, Location newLocation) {
|
||||||
wardrobe.getLocation().setNPCLocation(newLocation);
|
wardrobe.getLocation().setNpcLocation(newLocation);
|
||||||
|
|
||||||
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.hibiscusmc.hmccosmetics.cosmetic;
|
|||||||
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
|
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -14,11 +16,16 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public abstract class Cosmetic {
|
public abstract class Cosmetic {
|
||||||
|
|
||||||
|
@Getter @Setter
|
||||||
private String id;
|
private String id;
|
||||||
|
@Getter @Setter
|
||||||
private String permission;
|
private String permission;
|
||||||
private ItemStack item;
|
private ItemStack item;
|
||||||
|
@Getter @Setter
|
||||||
private String material;
|
private String material;
|
||||||
|
@Getter @Setter
|
||||||
private CosmeticSlot slot;
|
private CosmeticSlot slot;
|
||||||
|
@Getter @Setter
|
||||||
private boolean dyable;
|
private boolean dyable;
|
||||||
|
|
||||||
protected Cosmetic(String id, @NotNull ConfigurationNode config) {
|
protected Cosmetic(String id, @NotNull ConfigurationNode config) {
|
||||||
@@ -44,46 +51,10 @@ public abstract class Cosmetic {
|
|||||||
Cosmetics.addCosmetic(this);
|
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() {
|
public boolean requiresPermission() {
|
||||||
return permission != null;
|
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);
|
public abstract void update(CosmeticUser user);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class Cosmetics {
|
|||||||
default -> new CosmeticArmorType(id, cosmeticConfig);
|
default -> new CosmeticArmorType(id, cosmeticConfig);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (Settings.isDebugEnabled()) e.printStackTrace();
|
if (Settings.isDebugMode()) e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.cosmetic.types;
|
package com.hibiscusmc.hmccosmetics.cosmetic.types;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserBackpackManager;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.AreaEffectCloud;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -18,11 +19,15 @@ import org.spongepowered.configurate.ConfigurationNode;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class CosmeticBackpackType extends Cosmetic {
|
public class CosmeticBackpackType extends Cosmetic {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String modelName;
|
private final String modelName;
|
||||||
|
@Getter
|
||||||
|
private int height = -1;
|
||||||
private ItemStack firstPersonBackpack;
|
private ItemStack firstPersonBackpack;
|
||||||
|
|
||||||
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
||||||
@@ -32,8 +37,8 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
|
|
||||||
if (!config.node("firstperson-item").virtual()) {
|
if (!config.node("firstperson-item").virtual()) {
|
||||||
this.firstPersonBackpack = generateItemStack(config.node("firstperson-item"));
|
this.firstPersonBackpack = generateItemStack(config.node("firstperson-item"));
|
||||||
|
this.height = config.node("height").getInt(5);
|
||||||
}
|
}
|
||||||
//backpackType = UserBackpackManager.BackpackType.valueOf(config.node("type").getString("NORMAL").toUpperCase());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,19 +50,18 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
|
|
||||||
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
||||||
// This needs to be moved to purely packet based, there are far to many plugin doing dumb stuff that prevents spawning armorstands ignoring our spawn reason.
|
// This needs to be moved to purely packet based, there are far to many plugin doing dumb stuff that prevents spawning armorstands ignoring our spawn reason.
|
||||||
if (!user.getUserBackpackManager().IsValidBackpackEntity()) {
|
List<Player> outsideViewers = user.getUserBackpackManager().getEntityManager().refreshViewers(loc);
|
||||||
MessagesUtil.sendDebugMessages("Invalid Backpack Entity[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!");
|
|
||||||
user.respawnBackpack();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (loc.getWorld() != user.getUserBackpackManager().getArmorStand().getWorld()) {
|
|
||||||
user.getUserBackpackManager().getArmorStand().teleport(loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
user.getUserBackpackManager().getArmorStand().teleport(loc);
|
user.getUserBackpackManager().getEntityManager().teleport(loc);
|
||||||
user.getUserBackpackManager().getArmorStand().setRotation(loc.getYaw(), loc.getPitch());
|
user.getUserBackpackManager().getEntityManager().setRotation((int) loc.getYaw());
|
||||||
|
|
||||||
|
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), user.getUserBackpackManager().getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), outsideViewers);
|
||||||
|
PacketManager.sendInvisibilityPacket(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, getItem()), outsideViewers);
|
||||||
|
// If true, it will send the riding packet to all players. If false, it will send the riding packet only to new players
|
||||||
|
if (Settings.isBackpackForceRidingEnabled()) PacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), user.getUserBackpackManager().getEntityManager().getViewers());
|
||||||
|
else PacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
|
|
||||||
List<Player> outsideViewers = user.getUserBackpackManager().getCloudManager().refreshViewers(loc);
|
|
||||||
if (!user.isInWardrobe() && isFirstPersonCompadible() && user.getPlayer() != null) {
|
if (!user.isInWardrobe() && isFirstPersonCompadible() && user.getPlayer() != null) {
|
||||||
List<Player> owner = List.of(user.getPlayer());
|
List<Player> owner = List.of(user.getPlayer());
|
||||||
|
|
||||||
@@ -70,18 +74,17 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
PacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
||||||
if (!user.getHidden()) NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, firstPersonBackpack, owner);
|
if (!user.getHidden()) {
|
||||||
|
//if (loc.getPitch() < -70) NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, new ItemStack(Material.AIR), owner);
|
||||||
|
//else NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, firstPersonBackpack, owner);
|
||||||
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, firstPersonBackpack), owner);
|
||||||
|
}
|
||||||
MessagesUtil.sendDebugMessages("First Person Backpack Update[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!", Level.INFO);
|
MessagesUtil.sendDebugMessages("First Person Backpack Update[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!", Level.INFO);
|
||||||
}
|
}
|
||||||
PacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
|
||||||
|
|
||||||
user.getUserBackpackManager().showBackpack();
|
user.getUserBackpackManager().showBackpack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModelName() {
|
|
||||||
return modelName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFirstPersonCompadible() {
|
public boolean isFirstPersonCompadible() {
|
||||||
return firstPersonBackpack != null;
|
return firstPersonBackpack != null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserBalloonManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserBalloonManager;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@@ -19,17 +20,27 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CosmeticBalloonType extends Cosmetic {
|
public class CosmeticBalloonType extends Cosmetic {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String modelName;
|
private final String modelName;
|
||||||
|
@Getter
|
||||||
private List<String> dyableParts;
|
private List<String> dyableParts;
|
||||||
|
@Getter
|
||||||
private final boolean showLead;
|
private final boolean showLead;
|
||||||
|
@Getter
|
||||||
|
private Vector balloonOffset;
|
||||||
|
|
||||||
public CosmeticBalloonType(String id, ConfigurationNode config) {
|
public CosmeticBalloonType(String id, ConfigurationNode config) {
|
||||||
super(id, config);
|
super(id, config);
|
||||||
|
|
||||||
String modelId = config.node("model").getString();
|
String modelId = config.node("model").getString();
|
||||||
|
|
||||||
showLead = config.node("show-lead").getBoolean(true);
|
showLead = config.node("show-lead").getBoolean(true);
|
||||||
|
|
||||||
|
ConfigurationNode balloonOffsetNode = config.node("balloon-offset");
|
||||||
|
if (balloonOffsetNode.virtual())
|
||||||
|
balloonOffset = Settings.getBalloonOffset();
|
||||||
|
else
|
||||||
|
balloonOffset = Settings.loadVector(balloonOffsetNode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!config.node("dyable-parts").virtual()) {
|
if (!config.node("dyable-parts").virtual()) {
|
||||||
dyableParts = config.node("dyable-parts").getList(String.class);
|
dyableParts = config.node("dyable-parts").getList(String.class);
|
||||||
@@ -57,7 +68,7 @@ public class CosmeticBalloonType extends Cosmetic {
|
|||||||
|
|
||||||
Location newLocation = entity.getLocation();
|
Location newLocation = entity.getLocation();
|
||||||
Location currentLocation = user.getBalloonManager().getLocation();
|
Location currentLocation = user.getBalloonManager().getLocation();
|
||||||
newLocation = newLocation.clone().add(Settings.getBalloonOffset());
|
newLocation = newLocation.clone().add(getBalloonOffset());
|
||||||
|
|
||||||
List<Player> viewer = PacketManager.getViewers(entity.getLocation());
|
List<Player> viewer = PacketManager.getViewers(entity.getLocation());
|
||||||
|
|
||||||
@@ -85,22 +96,10 @@ public class CosmeticBalloonType extends Cosmetic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModelName() {
|
|
||||||
return this.modelName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getDyableParts() {
|
|
||||||
return dyableParts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDyablePart(String name) {
|
public boolean isDyablePart(String name) {
|
||||||
// If player does not define parts, dye whole model
|
// If player does not define parts, dye whole model
|
||||||
if (dyableParts == null) return true;
|
if (dyableParts == null) return true;
|
||||||
if (dyableParts.isEmpty()) return true;
|
if (dyableParts.isEmpty()) return true;
|
||||||
return dyableParts.contains(name);
|
return dyableParts.contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowLead() {
|
|
||||||
return showLead;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,15 @@ import com.hibiscusmc.hmccosmetics.database.types.SQLiteData;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Database {
|
public class Database {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static Data data;
|
private static Data data;
|
||||||
|
|
||||||
private static final MySQLData MYSQL_DATA = new MySQLData();
|
private static final MySQLData MYSQL_DATA = new MySQLData();
|
||||||
private static final SQLiteData SQLITE_DATA = new SQLiteData();
|
private static final SQLiteData SQLITE_DATA = new SQLiteData();
|
||||||
|
|
||||||
@@ -50,10 +51,6 @@ public class Database {
|
|||||||
return data.get(uniqueId);
|
return data.get(uniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Data getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clearData(UUID uniqueId) {
|
public static void clearData(UUID uniqueId) {
|
||||||
data.clear(uniqueId);
|
data.clear(uniqueId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,27 +31,27 @@ public abstract class Data {
|
|||||||
// BACKPACK=colorfulbackpack&RRGGBB,HELMET=niftyhat,BALLOON=colorfulballoon,CHESTPLATE=niftychestplate
|
// BACKPACK=colorfulbackpack&RRGGBB,HELMET=niftyhat,BALLOON=colorfulballoon,CHESTPLATE=niftychestplate
|
||||||
@NotNull
|
@NotNull
|
||||||
public final String serializeData(@NotNull CosmeticUser user) {
|
public final String serializeData(@NotNull CosmeticUser user) {
|
||||||
String data = "";
|
StringBuilder data = new StringBuilder();
|
||||||
if (user.getHidden()) {
|
if (user.getHidden()) {
|
||||||
if (shouldHiddenSave(user.getHiddenReason())) {
|
if (shouldHiddenSave(user.getHiddenReason())) {
|
||||||
data = "HIDDEN=" + user.getHiddenReason();
|
data.append("HIDDEN=").append(user.getHiddenReason());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Cosmetic cosmetic : user.getCosmetics()) {
|
for (Cosmetic cosmetic : user.getCosmetics()) {
|
||||||
Color color = user.getCosmeticColor(cosmetic.getSlot());
|
Color color = user.getCosmeticColor(cosmetic.getSlot());
|
||||||
String input = cosmetic.getSlot() + "=" + cosmetic.getId();
|
String input = cosmetic.getSlot() + "=" + cosmetic.getId();
|
||||||
if (color != null) input = input + "&" + color.asRGB();
|
if (color != null) input = input + "&" + color.asRGB();
|
||||||
if (data.length() == 0) {
|
if (data.isEmpty()) {
|
||||||
data = input;
|
data.append(input);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
data = data + "," + input;
|
data.append(",").append(input);
|
||||||
}
|
}
|
||||||
return data;
|
return data.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Map<CosmeticSlot, Map<Cosmetic, Color>> deserializeData(CosmeticUser user, @NotNull String raw) {
|
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
|
@NotNull
|
||||||
@@ -101,7 +101,7 @@ public abstract class Data {
|
|||||||
return cosmetics;
|
return cosmetics;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldHiddenSave(CosmeticUser.@NotNull HiddenReason reason) {
|
private boolean shouldHiddenSave(CosmeticUser.HiddenReason reason) {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case EMOTE, NONE -> {
|
case EMOTE, NONE -> {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.hibiscusmc.hmccosmetics.database.types;
|
|||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
||||||
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -126,9 +127,7 @@ public class MySQLData extends SQLData {
|
|||||||
public PreparedStatement preparedStatement(String query) {
|
public PreparedStatement preparedStatement(String query) {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
|
|
||||||
if (!isConnectionOpen()) {
|
if (!isConnectionOpen()) MessagesUtil.sendDebugMessages("Connection is not open");
|
||||||
HMCCosmeticsPlugin.getInstance().getLogger().info("Connection is not open");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (connection == null) throw new NullPointerException("Connection is null");
|
if (connection == null) throw new NullPointerException("Connection is null");
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class SQLiteData extends SQLData {
|
|||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC");
|
||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + dataFolder);
|
connection = DriverManager.getConnection("jdbc:sqlite:" + dataFolder);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println(e.getMessage());
|
e.printStackTrace();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -83,9 +83,7 @@ public class SQLiteData extends SQLData {
|
|||||||
@Override
|
@Override
|
||||||
public PreparedStatement preparedStatement(String query) {
|
public PreparedStatement preparedStatement(String query) {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
if (!isConnectionOpen()) {
|
if (!isConnectionOpen()) MessagesUtil.sendDebugMessages("Connection is not open");
|
||||||
HMCCosmeticsPlugin.getInstance().getLogger().info("Connection is not open");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ps = connection.prepareStatement(query);
|
ps = connection.prepareStatement(query);
|
||||||
|
|||||||
@@ -4,18 +4,21 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
|||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerMenuOpenEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerMenuOpenEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
|
import com.hibiscusmc.hmccosmetics.config.serializer.ItemSerializer;
|
||||||
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.type.Type;
|
import com.hibiscusmc.hmccosmetics.gui.type.Type;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.type.Types;
|
import com.hibiscusmc.hmccosmetics.gui.type.Types;
|
||||||
import com.hibiscusmc.hmccosmetics.hooks.Hooks;
|
import com.hibiscusmc.hmccosmetics.hooks.Hooks;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.Adventure;
|
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.builder.item.ItemBuilder;
|
||||||
import dev.triumphteam.gui.guis.Gui;
|
import dev.triumphteam.gui.guis.Gui;
|
||||||
import dev.triumphteam.gui.guis.GuiItem;
|
import dev.triumphteam.gui.guis.GuiItem;
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -31,13 +34,21 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class Menu {
|
public class Menu {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String id;
|
private final String id;
|
||||||
|
@Getter
|
||||||
private final String title;
|
private final String title;
|
||||||
|
@Getter
|
||||||
private final int rows;
|
private final int rows;
|
||||||
|
@Getter
|
||||||
private final ConfigurationNode config;
|
private final ConfigurationNode config;
|
||||||
|
@Getter
|
||||||
private final String permissionNode;
|
private final String permissionNode;
|
||||||
private final ArrayList<MenuItem> items;
|
private final HashMap<Integer, MenuItem> items;
|
||||||
|
@Getter
|
||||||
private final int refreshRate;
|
private final int refreshRate;
|
||||||
|
@Getter
|
||||||
|
private final boolean shading;
|
||||||
|
|
||||||
public Menu(String id, @NotNull ConfigurationNode config) {
|
public Menu(String id, @NotNull ConfigurationNode config) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -47,8 +58,9 @@ public class Menu {
|
|||||||
rows = config.node("rows").getInt(1);
|
rows = config.node("rows").getInt(1);
|
||||||
permissionNode = config.node("permission").getString("");
|
permissionNode = config.node("permission").getString("");
|
||||||
refreshRate = config.node("refresh-rate").getInt(-1);
|
refreshRate = config.node("refresh-rate").getInt(-1);
|
||||||
|
shading = config.node("shading").getBoolean(Settings.isDefaultShading());
|
||||||
|
|
||||||
items = new ArrayList<>();
|
items = new HashMap<>();
|
||||||
setupItems();
|
setupItems();
|
||||||
|
|
||||||
Menus.addMenu(this);
|
Menus.addMenu(this);
|
||||||
@@ -70,8 +82,8 @@ public class Menu {
|
|||||||
|
|
||||||
List<Integer> slots = getSlots(slotString);
|
List<Integer> slots = getSlots(slotString);
|
||||||
|
|
||||||
if (slots == null) {
|
if (slots.isEmpty()) {
|
||||||
MessagesUtil.sendDebugMessages("Slot is null for " + config.key().toString());
|
MessagesUtil.sendDebugMessages("Slot is empty for " + config.key().toString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,33 +95,23 @@ public class Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
MessagesUtil.sendDebugMessages("something went wrong! " + item);
|
MessagesUtil.sendDebugMessages("Something went wrong with the item creation for " + config.key().toString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type type = null;
|
Type type = null;
|
||||||
|
|
||||||
if (!config.node("type").virtual()) {
|
if (!config.node("type").virtual()) {
|
||||||
String typeId = config.node("type").getString();
|
String typeId = config.node("type").getString("");
|
||||||
if (Types.isType(typeId)) type = Types.getType(typeId);
|
if (Types.isType(typeId)) type = Types.getType(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
items.add(new MenuItem(slots, item, type, config));
|
for (Integer slot : slots) {
|
||||||
|
items.put(slot, new MenuItem(slots, item, type, config));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRows() {
|
|
||||||
return this.getRows();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openMenu(CosmeticUser user) {
|
public void openMenu(CosmeticUser user) {
|
||||||
openMenu(user, false);
|
openMenu(user, false);
|
||||||
}
|
}
|
||||||
@@ -124,24 +126,21 @@ public class Menu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Component component = Adventure.MINI_MESSAGE.deserialize(Hooks.processPlaceholders(player, this.title));
|
final Component component = Adventure.MINI_MESSAGE.deserialize(Hooks.processPlaceholders(player, this.title));
|
||||||
Gui gui = Gui.gui().
|
Gui gui = Gui.gui()
|
||||||
title(component).
|
.title(component)
|
||||||
rows(this.rows).
|
.rows(this.rows)
|
||||||
create();
|
.create();
|
||||||
|
|
||||||
gui.setDefaultClickAction(event -> event.setCancelled(true));
|
gui.setDefaultClickAction(event -> event.setCancelled(true));
|
||||||
|
|
||||||
AtomicInteger taskid = new AtomicInteger(-1);
|
AtomicInteger taskid = new AtomicInteger(-1);
|
||||||
gui.setOpenGuiAction(event -> {
|
gui.setOpenGuiAction(event -> {
|
||||||
Runnable run = new Runnable() {
|
Runnable run = () -> {
|
||||||
@Override
|
if (gui.getInventory().getViewers().isEmpty() && taskid.get() != -1) {
|
||||||
public void run() {
|
Bukkit.getScheduler().cancelTask(taskid.get());
|
||||||
if (gui.getInventory().getViewers().size() == 0 && taskid.get() != -1) {
|
|
||||||
Bukkit.getScheduler().cancelTask(taskid.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMenu(user, gui);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateMenu(user, gui);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (refreshRate != -1) {
|
if (refreshRate != -1) {
|
||||||
@@ -157,33 +156,85 @@ public class Menu {
|
|||||||
|
|
||||||
// API
|
// API
|
||||||
PlayerMenuOpenEvent event = new PlayerMenuOpenEvent(user, this);
|
PlayerMenuOpenEvent event = new PlayerMenuOpenEvent(user, this);
|
||||||
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> Bukkit.getPluginManager().callEvent(event));
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
});
|
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
// Internal
|
// Internal
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||||
gui.open(player);
|
gui.open(player);
|
||||||
|
updateMenu(user, gui); // fixes shading? I know I do this twice but it's easier than writing a whole new class to deal with this shit
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMenu(CosmeticUser user, Gui gui) {
|
private void updateMenu(CosmeticUser user, Gui gui) {
|
||||||
for (MenuItem item : items) {
|
StringBuilder title = new StringBuilder(this.title);
|
||||||
Type type = item.getType();
|
|
||||||
for (int slot : item.getSlots()) {
|
|
||||||
ItemStack modifiedItem = getMenuItem(user, type, item.getItemConfig(), item.getItem().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);
|
|
||||||
updateMenu(user, gui);
|
|
||||||
});
|
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("Added " + slot + " as " + guiItem + " in the menu");
|
int row = 0;
|
||||||
gui.updateItem(slot, guiItem);
|
if (shading) {
|
||||||
|
for (int i = 0; i < gui.getInventory().getSize(); i++) {
|
||||||
|
// Handles the title
|
||||||
|
if (i % 9 == 0) {
|
||||||
|
if (row == 0) {
|
||||||
|
title.append(Settings.getFirstRowShift()); // Goes back to the start of the gui
|
||||||
|
} else {
|
||||||
|
title.append(Settings.getSequentRowShift());
|
||||||
|
}
|
||||||
|
row += 1;
|
||||||
|
} else {
|
||||||
|
title.append(Settings.getIndividualColumnShift()); // Goes to the next slot
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean occupied = false;
|
||||||
|
|
||||||
|
if (items.containsKey(i)) {
|
||||||
|
// Handles the items
|
||||||
|
MenuItem item = items.get(i);
|
||||||
|
updateItem(user, gui, item);
|
||||||
|
|
||||||
|
if (item.type().getId().equalsIgnoreCase("cosmetic")) {
|
||||||
|
Cosmetic cosmetic = Cosmetics.getCosmetic(item.itemConfig().node("cosmetic").getString(""));
|
||||||
|
if (cosmetic == null) continue;
|
||||||
|
if (user.hasCosmeticInSlot(cosmetic)) {
|
||||||
|
title.append(Settings.getEquippedCosmeticColor());
|
||||||
|
} else {
|
||||||
|
if (user.canEquipCosmetic(cosmetic, true)) {
|
||||||
|
title.append(Settings.getEquipableCosmeticColor());
|
||||||
|
} else {
|
||||||
|
title.append(Settings.getLockedCosmeticColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
occupied = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (occupied) {
|
||||||
|
title.append(Settings.getBackground().replaceAll("<row>", String.valueOf(row)));
|
||||||
|
} else {
|
||||||
|
title.append(Settings.getClearBackground().replaceAll("<row>", String.valueOf(row)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
MessagesUtil.sendDebugMessages("Updated menu with title " + title);
|
||||||
|
gui.updateTitle(StringUtils.parseStringToString(Hooks.processPlaceholders(user.getPlayer(), title.toString())));
|
||||||
|
} else {
|
||||||
|
for (MenuItem item : items.values()) {
|
||||||
|
updateItem(user, gui, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateItem(CosmeticUser user, Gui gui, MenuItem item) {
|
||||||
|
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.itemConfig(), clickType);
|
||||||
|
updateMenu(user, gui);
|
||||||
|
});
|
||||||
|
|
||||||
|
MessagesUtil.sendDebugMessages("Added " + slot + " as " + guiItem + " in the menu");
|
||||||
|
gui.updateItem(slot, guiItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +245,8 @@ public class Menu {
|
|||||||
for (String a : slotString) {
|
for (String a : slotString) {
|
||||||
if (a.contains("-")) {
|
if (a.contains("-")) {
|
||||||
String[] split = a.split("-");
|
String[] split = a.split("-");
|
||||||
int min = Integer.valueOf(split[0]);
|
int min = Integer.parseInt(split[0]);
|
||||||
int max = Integer.valueOf(split[1]);
|
int max = Integer.parseInt(split[1]);
|
||||||
slots.addAll(getSlots(min, max));
|
slots.addAll(getSlots(min, max));
|
||||||
} else {
|
} else {
|
||||||
slots.add(Integer.valueOf(a));
|
slots.add(Integer.valueOf(a));
|
||||||
@@ -213,17 +264,13 @@ public class Menu {
|
|||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Contract("_, _, _, _ -> param2")
|
@Contract("_, _, _, _, _ -> param2")
|
||||||
@NotNull
|
@NotNull
|
||||||
private ItemStack getMenuItem(CosmeticUser user, Type type, ConfigurationNode config, ItemStack itemStack, int slot) {
|
private ItemStack getMenuItem(CosmeticUser user, Type type, ConfigurationNode config, ItemStack itemStack, int slot) {
|
||||||
if (!itemStack.hasItemMeta()) return itemStack;
|
if (!itemStack.hasItemMeta()) return itemStack;
|
||||||
return type.setItem(user, config, itemStack, slot);
|
return type.setItem(user, config, itemStack, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPermissionNode() {
|
|
||||||
return permissionNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canOpen(Player player) {
|
public boolean canOpen(Player player) {
|
||||||
if (permissionNode.isEmpty()) return true;
|
if (permissionNode.isEmpty()) return true;
|
||||||
return player.isOp() || player.hasPermission(permissionNode);
|
return player.isOp() || player.hasPermission(permissionNode);
|
||||||
|
|||||||
@@ -6,34 +6,6 @@ import org.spongepowered.configurate.ConfigurationNode;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MenuItem {
|
public record MenuItem(List<Integer> slots, ItemStack item, Type type, ConfigurationNode itemConfig) {
|
||||||
|
|
||||||
private List<Integer> slots;
|
|
||||||
private ItemStack item;
|
|
||||||
private Type type;
|
|
||||||
private ConfigurationNode itemConfig;
|
|
||||||
|
|
||||||
public MenuItem(List<Integer> slots, ItemStack item, Type type, ConfigurationNode itemConfig) {
|
|
||||||
this.slots = slots;
|
|
||||||
this.item = item;
|
|
||||||
this.type = type;
|
|
||||||
this.itemConfig = itemConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getSlots() {
|
|
||||||
return slots;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItem() {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConfigurationNode getItemConfig() {
|
|
||||||
return itemConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Menus {
|
|||||||
new Menu(FilenameUtils.removeExtension(child.getFileName().toString()), root);
|
new Menu(FilenameUtils.removeExtension(child.getFileName().toString()), root);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessagesUtil.sendDebugMessages("Unable to create menu in " + child.getFileName().toString(), Level.WARNING);
|
MessagesUtil.sendDebugMessages("Unable to create menu in " + child.getFileName().toString(), Level.WARNING);
|
||||||
if (Settings.isDebugEnabled()) e.printStackTrace();
|
if (Settings.isDebugMode()) e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.hibiscusmc.hmccosmetics.gui.action.actions;
|
|||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.action.Action;
|
import com.hibiscusmc.hmccosmetics.gui.action.Action;
|
||||||
|
import com.hibiscusmc.hmccosmetics.hooks.Hooks;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ActionConsoleCommand extends Action {
|
public class ActionConsoleCommand extends Action {
|
||||||
@@ -13,6 +15,6 @@ public class ActionConsoleCommand extends Action {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(@NotNull CosmeticUser user, String raw) {
|
public void run(@NotNull CosmeticUser user, String raw) {
|
||||||
HMCCosmeticsPlugin.getInstance().getServer().dispatchCommand(user.getPlayer(), raw);
|
HMCCosmeticsPlugin.getInstance().getServer().dispatchCommand(Bukkit.getConsoleSender(), Hooks.processPlaceholders(user.getPlayer(), raw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.gui.special;
|
package com.hibiscusmc.hmccosmetics.gui.special;
|
||||||
|
|
||||||
import com.hibiscusmc.hmccolor.HMCColorApi;
|
import com.hibiscusmc.hmccolor.HMCColorApi;
|
||||||
import com.hibiscusmc.hmccolor.gui.guis.Gui;
|
import com.hibiscusmc.hmccolor.shaded.gui.guis.Gui;
|
||||||
import com.hibiscusmc.hmccolor.gui.guis.GuiItem;
|
import com.hibiscusmc.hmccolor.shaded.gui.guis.GuiItem;
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ public class TypeCosmetic extends Type {
|
|||||||
if (clickType.isRightClick()) {
|
if (clickType.isRightClick()) {
|
||||||
if (!actionConfig.node("right-click").virtual()) actionStrings.addAll(actionConfig.node("right-click").getList(String.class));
|
if (!actionConfig.node("right-click").virtual()) actionStrings.addAll(actionConfig.node("right-click").getList(String.class));
|
||||||
}
|
}
|
||||||
|
if (clickType.equals(ClickType.SHIFT_LEFT)) {
|
||||||
|
if (!actionConfig.node("shift-left-click").virtual()) actionStrings.addAll(actionConfig.node("shift-left-click").getList(String.class));
|
||||||
|
}
|
||||||
|
if (clickType.equals(ClickType.SHIFT_RIGHT)) {
|
||||||
|
if (!actionConfig.node("shift-right-click").virtual()) actionStrings.addAll(actionConfig.node("shift-right-click").getList(String.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUnEquippingCosmetic) {
|
if (isUnEquippingCosmetic) {
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ public class TypeEmpty extends Type {
|
|||||||
if (clickType.isRightClick()) {
|
if (clickType.isRightClick()) {
|
||||||
if (!actionConfig.node("right-click").virtual()) actionStrings.addAll(actionConfig.node("right-click").getList(String.class));
|
if (!actionConfig.node("right-click").virtual()) actionStrings.addAll(actionConfig.node("right-click").getList(String.class));
|
||||||
}
|
}
|
||||||
|
if (clickType.equals(ClickType.SHIFT_LEFT)) {
|
||||||
|
if (!actionConfig.node("shift-left-click").virtual()) actionStrings.addAll(actionConfig.node("shift-left-click").getList(String.class));
|
||||||
|
}
|
||||||
|
if (clickType.equals(ClickType.SHIFT_RIGHT)) {
|
||||||
|
if (!actionConfig.node("shift-right-click").virtual()) actionStrings.addAll(actionConfig.node("shift-right-click").getList(String.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We run the actions once we got the raw strings from the config.
|
// We run the actions once we got the raw strings from the config.
|
||||||
|
|||||||
@@ -17,19 +17,19 @@ import java.util.HashMap;
|
|||||||
public class Hooks {
|
public class Hooks {
|
||||||
|
|
||||||
private static final HashMap<String, Hook> hooks = new HashMap<>();
|
private static final HashMap<String, Hook> hooks = new HashMap<>();
|
||||||
private static HookOraxen ORAXEN_HOOK = new HookOraxen();
|
private static final HookOraxen ORAXEN_HOOK = new HookOraxen();
|
||||||
private static HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
private static final HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
||||||
private static HookGeary GEARY_HOOK = new HookGeary();
|
private static final HookGeary GEARY_HOOK = new HookGeary();
|
||||||
private static HookMythic MYTHIC_HOOK = new HookMythic();
|
private static final HookMythic MYTHIC_HOOK = new HookMythic();
|
||||||
private static HookDenizen DENIZEN_HOOK = new HookDenizen();
|
private static final HookDenizen DENIZEN_HOOK = new HookDenizen();
|
||||||
private static HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
private static final HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
||||||
private static HookPlaceholderAPI PAPI_HOOK = new HookPlaceholderAPI();
|
private static final HookPlaceholderAPI PAPI_HOOK = new HookPlaceholderAPI();
|
||||||
private static HookPremiumVanish PREMIUM_VANISH_HOOK = new HookPremiumVanish();
|
private static final HookPremiumVanish PREMIUM_VANISH_HOOK = new HookPremiumVanish();
|
||||||
private static HookSuperVanish SUPER_VANISH_HOOK = new HookSuperVanish();
|
private static final HookSuperVanish SUPER_VANISH_HOOK = new HookSuperVanish();
|
||||||
private static HookHMCColor HMC_COLOR_HOOK = new HookHMCColor();
|
private static final HookHMCColor HMC_COLOR_HOOK = new HookHMCColor();
|
||||||
private static HookCMI CMI_HOOK = new HookCMI();
|
private static final HookCMI CMI_HOOK = new HookCMI();
|
||||||
private static HookLibsDisguises LIBS_DISGUISES_HOOK = new HookLibsDisguises();
|
private static final HookLibsDisguises LIBS_DISGUISES_HOOK = new HookLibsDisguises();
|
||||||
private static HookModelEngine MODEL_ENGINE_HOOK = new HookModelEngine();
|
private static final HookModelEngine MODEL_ENGINE_HOOK = new HookModelEngine();
|
||||||
|
|
||||||
public static Hook getHook(@NotNull String id) {
|
public static Hook getHook(@NotNull String id) {
|
||||||
return hooks.get(id.toLowerCase());
|
return hooks.get(id.toLowerCase());
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
/**
|
/**
|
||||||
* A hook that integrates the plugin {@link com.mineinabyss.geary.papermc.GearyPlugin Geary} to provide custom items
|
* A hook that integrates the plugin {@link com.mineinabyss.geary.papermc.GearyPlugin Geary} to provide custom items
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("SpellCheckingInspection")
|
|
||||||
public class HookGeary extends Hook {
|
public class HookGeary extends Hook {
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class HookGeary extends Hook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
GearyModuleKt.getGeary().getPipeline().intercept(GearyPhase.ENABLE, () -> {
|
if (!enabled) GearyModuleKt.getGeary().getPipeline().intercept(GearyPhase.INIT_ENTITIES, () -> {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
HMCCosmeticsPlugin.setup();
|
HMCCosmeticsPlugin.setup();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class HookItemAdder extends Hook {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onItemAdderDataLoad(ItemsAdderLoadDataEvent event) {
|
public void onItemAdderDataLoad(ItemsAdderLoadDataEvent event) {
|
||||||
// By default, it will only run once at startup, if hook setting is enabled
|
// 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;
|
this.enabled = true;
|
||||||
HMCCosmeticsPlugin.setup();
|
HMCCosmeticsPlugin.setup();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
|
|||||||
return "INVALID_COSMETIC";
|
return "INVALID_COSMETIC";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TranslationUtil.getTranslation("unlocked-cosmetic", String.valueOf(user.canEquipCosmetic(cosmetic)));
|
return TranslationUtil.getTranslation("unlocked-cosmetic", String.valueOf(user.canEquipCosmetic(cosmetic, true)));
|
||||||
}
|
}
|
||||||
case "equipped":
|
case "equipped":
|
||||||
if (placeholderArgs == null) {
|
if (placeholderArgs == null) {
|
||||||
@@ -152,8 +152,9 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
|
|||||||
return "INVALID_COSMETIC";
|
return "INVALID_COSMETIC";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user.getCosmetic(cosmetic.getSlot()) == null) return "false";
|
Cosmetic equippedCosmetic = user.getCosmetic(cosmetic.getSlot());
|
||||||
return TranslationUtil.getTranslation("equipped-cosmetic", String.valueOf(cosmetic.getId() == user.getCosmetic(cosmetic.getSlot()).getId()));
|
if (equippedCosmetic == null) return TranslationUtil.getTranslation("equipped-cosmetic", "false");
|
||||||
|
return TranslationUtil.getTranslation("equipped-cosmetic", String.valueOf(cosmetic.getId().equals(equippedCosmetic.getId())));
|
||||||
}
|
}
|
||||||
case "wardrobe-enabled":
|
case "wardrobe-enabled":
|
||||||
return TranslationUtil.getTranslation("in-wardrobe", String.valueOf(user.isInWardrobe()));
|
return TranslationUtil.getTranslation("in-wardrobe", String.valueOf(user.isInWardrobe()));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class WGListener implements Listener {
|
|||||||
Location location = event.getPlayer().getLocation();
|
Location location = event.getPlayer().getLocation();
|
||||||
ApplicableRegionSet set = getRegions(location);
|
ApplicableRegionSet set = getRegions(location);
|
||||||
if (user.getHidden()) {
|
if (user.getHidden()) {
|
||||||
if (user.getHiddenReason() == CosmeticUser.HiddenReason.WORLDGUARD && set.getRegions().size() == 0) {
|
if (user.getHiddenReason() == CosmeticUser.HiddenReason.WORLDGUARD && set.getRegions().isEmpty()) {
|
||||||
user.showCosmetics();
|
user.showCosmetics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ public class WGListener implements Listener {
|
|||||||
Location location = event.getTo();
|
Location location = event.getTo();
|
||||||
ApplicableRegionSet set = getRegions(location);
|
ApplicableRegionSet set = getRegions(location);
|
||||||
if (user.getHidden()) {
|
if (user.getHidden()) {
|
||||||
if (user.getHiddenReason() == CosmeticUser.HiddenReason.WORLDGUARD && set.getRegions().size() == 0) {
|
if (user.getHiddenReason() == CosmeticUser.HiddenReason.WORLDGUARD && set.getRegions().isEmpty()) {
|
||||||
user.showCosmetics();
|
user.showCosmetics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
registerPlayerEquipmentListener();
|
registerPlayerEquipmentListener();
|
||||||
registerPlayerArmListener();
|
registerPlayerArmListener();
|
||||||
registerEntityUseListener();
|
registerEntityUseListener();
|
||||||
|
registerSlotChangeListener();
|
||||||
|
|
||||||
//registerLookMovement();
|
//registerLookMovement();
|
||||||
//registerMoveListener();
|
//registerMoveListener();
|
||||||
@@ -138,7 +139,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void portalTeleport(PlayerPortalEvent event) {
|
public void onPortalTeleport(PlayerPortalEvent event) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("Player Teleport Event");
|
MessagesUtil.sendDebugMessages("Player Teleport Event");
|
||||||
@@ -157,9 +158,8 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerHit(EntityDamageByEntityEvent event) {
|
public void onPlayerHit(EntityDamageByEntityEvent event) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (event.getEntity().getEntityId() == event.getDamager().getEntityId()) event.setCancelled(true);
|
if (event.getEntity().getEntityId() == event.getDamager().getEntityId()) event.setCancelled(true);
|
||||||
if (!entity.getPersistentDataContainer().has(new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "cosmeticMob"), PersistentDataType.SHORT))
|
if (!entity.getPersistentDataContainer().has(new NamespacedKey(HMCCosmeticsPlugin.getInstance(), "cosmeticMob"), PersistentDataType.SHORT))
|
||||||
@@ -167,9 +167,8 @@ public class PlayerGameListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerDamaged(EntityDamageEvent event) {
|
public void onPlayerDamaged(EntityDamageEvent event) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
if (!(event.getEntity() instanceof Player player)) return;
|
if (!(event.getEntity() instanceof Player player)) return;
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
@@ -186,13 +185,15 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerLook(PlayerMoveEvent event) {
|
public void onPlayerLook(PlayerMoveEvent event) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
// Really need to look into optimization of this
|
if (!Settings.isEmoteMoveCheck() && user.getUserEmoteManager().isPlayingEmote()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
user.updateCosmetic(CosmeticSlot.BACKPACK);
|
user.updateCosmetic(CosmeticSlot.BACKPACK);
|
||||||
user.updateCosmetic(CosmeticSlot.BALLOON);
|
user.updateCosmetic(CosmeticSlot.BALLOON);
|
||||||
}
|
}
|
||||||
@@ -218,10 +219,9 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerArmorDamage(PlayerItemDamageEvent event) {
|
public void onPlayerArmorDamage(PlayerItemDamageEvent event) {
|
||||||
// Possibly look into cancelling the event, then handling the damage on our own.
|
// Possibly look into cancelling the event, then handling the damage on our own.
|
||||||
if (event.isCancelled()) return;
|
|
||||||
MessagesUtil.sendDebugMessages("PlayerItemDamageEvent");
|
MessagesUtil.sendDebugMessages("PlayerItemDamageEvent");
|
||||||
|
|
||||||
int slot = -1;
|
int slot = -1;
|
||||||
@@ -253,7 +253,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void playerOffhandSwap(PlayerSwapHandItemsEvent event) {
|
public void onPlayerOffhandSwap(PlayerSwapHandItemsEvent event) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
// Really need to look into optimization of this
|
// Really need to look into optimization of this
|
||||||
@@ -263,9 +263,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> user.updateCosmetic(CosmeticSlot.OFFHAND), 2);
|
||||||
user.updateCosmetic(CosmeticSlot.OFFHAND);
|
|
||||||
}, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
@@ -276,9 +274,8 @@ public class PlayerGameListener implements Listener {
|
|||||||
if (user.isInWardrobe()) event.setCancelled(true);
|
if (user.isInWardrobe()) event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void playerInvisibility(EntityPotionEffectEvent event) {
|
public void onPlayerPotionEffect(EntityPotionEffectEvent event) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
if (!event.getModifiedType().equals(PotionEffectType.INVISIBILITY)) return;
|
if (!event.getModifiedType().equals(PotionEffectType.INVISIBILITY)) return;
|
||||||
if (!event.getEntityType().equals(EntityType.PLAYER)) return;
|
if (!event.getEntityType().equals(EntityType.PLAYER)) return;
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
@@ -303,7 +300,6 @@ public class PlayerGameListener implements Listener {
|
|||||||
//NMSHandlers.getHandler().slotUpdate(event.getPlayer(), event.getPreviousSlot());
|
//NMSHandlers.getHandler().slotUpdate(event.getPlayer(), event.getPreviousSlot());
|
||||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||||
user.updateCosmetic(CosmeticSlot.MAINHAND);
|
user.updateCosmetic(CosmeticSlot.MAINHAND);
|
||||||
user.updateCosmetic(CosmeticSlot.OFFHAND);
|
|
||||||
}, 2);
|
}, 2);
|
||||||
|
|
||||||
// #84, Riptides mess with backpacks
|
// #84, Riptides mess with backpacks
|
||||||
@@ -322,7 +318,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
|
|
||||||
if (user.isInWardrobe()) user.leaveWardrobe();
|
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();
|
user.removeCosmetics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,37 +338,34 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerCosemticEquip(PlayerCosmeticPostEquipEvent event) {
|
public void onPlayerCosmeticEquip(PlayerCosmeticPostEquipEvent event) {
|
||||||
CosmeticUser user = event.getUser();
|
CosmeticUser user = event.getUser();
|
||||||
if (user.isInWardrobe() && event.getCosmetic().getSlot().equals(CosmeticSlot.BALLOON)) {
|
if (user.isInWardrobe() && event.getCosmetic().getSlot().equals(CosmeticSlot.BALLOON)) {
|
||||||
Location NPCLocation = user.getWardrobeManager().getNpcLocation();
|
Location NPCLocation = user.getWardrobeManager().getNpcLocation();
|
||||||
|
CosmeticBalloonType cosmetic = (CosmeticBalloonType) event.getCosmetic();
|
||||||
// We know that no other entity besides a regular player will be in the wardrobe
|
// We know that no other entity besides a regular player will be in the wardrobe
|
||||||
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), NPCLocation.add(Settings.getBalloonOffset()), false, List.of(user.getPlayer()));
|
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), NPCLocation.add(cosmetic.getBalloonOffset()), false, List.of(user.getPlayer()));
|
||||||
user.getBalloonManager().getModelEntity().teleport(NPCLocation.add(Settings.getBalloonOffset()));
|
user.getBalloonManager().getModelEntity().teleport(NPCLocation.add(cosmetic.getBalloonOffset()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerMounted(EntityMountEvent event) {
|
public void onPlayerMounted(EntityMountEvent event) {
|
||||||
if (!event.isCancelled() && event.getEntity() instanceof Player player) {
|
if (event.getEntity() instanceof Player player) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HMCCosmeticsPlugin.getInstance(), ()->{
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HMCCosmeticsPlugin.getInstance(), user::respawnBackpack, 1);
|
||||||
user.respawnBackpack();
|
|
||||||
}, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDismounted(EntityDismountEvent event) {
|
public void onPlayerDismounted(EntityDismountEvent event) {
|
||||||
if (!event.isCancelled() && event.getDismounted() instanceof Player player) {
|
if (event.getDismounted() instanceof Player player) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HMCCosmeticsPlugin.getInstance(), ()->{
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HMCCosmeticsPlugin.getInstance(), user::respawnBackpack, 1);
|
||||||
user.respawnBackpack();
|
|
||||||
}, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,6 +444,30 @@ public class PlayerGameListener implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerSlotChangeListener() {
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.SET_SLOT) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
MessagesUtil.sendDebugMessages("SetSlot Initial ");
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (event.getPlayer() == null) return;
|
||||||
|
|
||||||
|
int windowID = event.getPacket().getIntegers().read(0);
|
||||||
|
if (windowID != 0) return;
|
||||||
|
|
||||||
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
|
if (user == null) return;
|
||||||
|
|
||||||
|
int slot = event.getPacket().getIntegers().read(2);
|
||||||
|
MessagesUtil.sendDebugMessages("SetSlot Slot " + slot);
|
||||||
|
if (slot == 45 && user.hasCosmeticInSlot(CosmeticSlot.OFFHAND) && player.getInventory().getItemInOffHand().getType().isAir()) {
|
||||||
|
event.getPacket().getItemModifier().write(0, user.getUserCosmeticItem(CosmeticSlot.OFFHAND));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void registerPlayerEquipmentListener() {
|
private void registerPlayerEquipmentListener() {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_EQUIPMENT) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_EQUIPMENT) {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public interface NMSHandler {
|
|||||||
|
|
||||||
UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType);
|
UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType);
|
||||||
|
|
||||||
|
@Deprecated(since = "2.6.0")
|
||||||
void equipmentSlotUpdate(
|
void equipmentSlotUpdate(
|
||||||
int entityId,
|
int entityId,
|
||||||
CosmeticUser user,
|
CosmeticUser user,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.hibiscusmc.hmccosmetics.nms;
|
|||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.logging.Level;
|
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 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;
|
private static NMSHandler handler;
|
||||||
|
@Getter
|
||||||
private static String version;
|
private static String version;
|
||||||
|
|
||||||
public static NMSHandler getHandler() {
|
public static NMSHandler getHandler() {
|
||||||
@@ -21,10 +23,6 @@ public class NMSHandlers {
|
|||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
if (handler != null) return;
|
if (handler != null) return;
|
||||||
final String packageName = HMCCosmeticsPlugin.getInstance().getServer().getClass().getPackage().getName();
|
final String packageName = HMCCosmeticsPlugin.getInstance().getServer().getClass().getPackage().getName();
|
||||||
|
|||||||
@@ -23,11 +23,13 @@ import com.hibiscusmc.hmccosmetics.util.InventoryUtils;
|
|||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.*;
|
import org.bukkit.inventory.meta.*;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
@@ -39,18 +41,22 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class CosmeticUser {
|
public class CosmeticUser {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final UUID uniqueId;
|
private final UUID uniqueId;
|
||||||
private int taskId;
|
private int taskId;
|
||||||
private HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
|
private final HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
|
||||||
private UserWardrobeManager userWardrobeManager;
|
private UserWardrobeManager userWardrobeManager;
|
||||||
private UserBalloonManager userBalloonManager;
|
private UserBalloonManager userBalloonManager;
|
||||||
|
@Getter
|
||||||
private UserBackpackManager userBackpackManager;
|
private UserBackpackManager userBackpackManager;
|
||||||
private UserEmoteManager userEmoteManager;
|
@Getter
|
||||||
|
private final UserEmoteManager userEmoteManager;
|
||||||
|
|
||||||
// Cosmetic Settings/Toggles
|
// Cosmetic Settings/Toggles
|
||||||
private boolean hideCosmetics;
|
private boolean hideCosmetics;
|
||||||
|
@Getter
|
||||||
private HiddenReason hiddenReason;
|
private HiddenReason hiddenReason;
|
||||||
private HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
||||||
|
|
||||||
public CosmeticUser(UUID uuid) {
|
public CosmeticUser(UUID uuid) {
|
||||||
this.uniqueId = uuid;
|
this.uniqueId = uuid;
|
||||||
@@ -79,10 +85,6 @@ public class CosmeticUser {
|
|||||||
despawnBalloon();
|
despawnBalloon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUniqueId() {
|
|
||||||
return this.uniqueId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Cosmetic getCosmetic(CosmeticSlot slot) {
|
public Cosmetic getCosmetic(CosmeticSlot slot) {
|
||||||
return playerCosmetics.get(slot);
|
return playerCosmetics.get(slot);
|
||||||
}
|
}
|
||||||
@@ -196,6 +198,10 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getUserCosmeticItem(CosmeticSlot slot) {
|
||||||
|
return getUserCosmeticItem(getCosmetic(slot));
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getUserCosmeticItem(Cosmetic cosmetic) {
|
public ItemStack getUserCosmeticItem(Cosmetic cosmetic) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if (hideCosmetics) {
|
if (hideCosmetics) {
|
||||||
@@ -216,6 +222,11 @@ public class CosmeticUser {
|
|||||||
MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return getUserCosmeticItem(cosmetic, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public ItemStack getUserCosmeticItem(Cosmetic cosmetic, ItemStack item) {
|
||||||
if (item.hasItemMeta()) {
|
if (item.hasItemMeta()) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
|
||||||
@@ -273,10 +284,6 @@ public class CosmeticUser {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserBackpackManager getUserBackpackManager() {
|
|
||||||
return userBackpackManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserBalloonManager getBalloonManager() {
|
public UserBalloonManager getBalloonManager() {
|
||||||
return this.userBalloonManager;
|
return this.userBalloonManager;
|
||||||
}
|
}
|
||||||
@@ -285,10 +292,6 @@ public class CosmeticUser {
|
|||||||
return userWardrobeManager;
|
return userWardrobeManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserEmoteManager getUserEmoteManager() {
|
|
||||||
return userEmoteManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enterWardrobe(boolean ignoreDistance, Wardrobe wardrobe) {
|
public void enterWardrobe(boolean ignoreDistance, Wardrobe wardrobe) {
|
||||||
if (wardrobe.hasPermission() && !getPlayer().hasPermission(wardrobe.getPermission())) {
|
if (wardrobe.hasPermission() && !getPlayer().hasPermission(wardrobe.getPermission())) {
|
||||||
MessagesUtil.sendMessage(getPlayer(), "no-permission");
|
MessagesUtil.sendMessage(getPlayer(), "no-permission");
|
||||||
@@ -350,7 +353,7 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
if (this.userBackpackManager != null) return;
|
if (this.userBackpackManager != null) return;
|
||||||
this.userBackpackManager = new UserBackpackManager(this, cosmeticBackpackType.isFirstPersonCompadible());
|
this.userBackpackManager = new UserBackpackManager(this);
|
||||||
userBackpackManager.spawnBackpack(cosmeticBackpackType);
|
userBackpackManager.spawnBackpack(cosmeticBackpackType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +370,7 @@ public class CosmeticUser {
|
|||||||
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
||||||
if (this.userBalloonManager != null) return;
|
if (this.userBalloonManager != null) return;
|
||||||
this.userBalloonManager = NMSHandlers.getHandler().spawnBalloon(this, cosmeticBalloonType);
|
this.userBalloonManager = NMSHandlers.getHandler().spawnBalloon(this, cosmeticBalloonType);
|
||||||
updateCosmetic(cosmeticBalloonType);
|
//updateCosmetic(cosmeticBalloonType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void despawnBalloon() {
|
public void despawnBalloon() {
|
||||||
@@ -395,7 +398,13 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeArmor(CosmeticSlot slot) {
|
public void removeArmor(CosmeticSlot slot) {
|
||||||
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, PlayerUtils.getNearbyPlayers(getEntity().getLocation()));
|
EquipmentSlot equipmentSlot = InventoryUtils.getEquipmentSlot(slot);
|
||||||
|
if (equipmentSlot == null) return;
|
||||||
|
if (getPlayer() != null) {
|
||||||
|
NMSHandlers.getHandler().equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), PlayerUtils.getNearbyPlayers(getEntity().getLocation()));
|
||||||
|
} else {
|
||||||
|
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, PlayerUtils.getNearbyPlayers(getEntity().getLocation()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,8 +440,12 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEquipCosmetic(Cosmetic cosmetic) {
|
public boolean canEquipCosmetic(Cosmetic cosmetic) {
|
||||||
|
return canEquipCosmetic(cosmetic, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEquipCosmetic(Cosmetic cosmetic, boolean ignoreWardrobe) {
|
||||||
if (!cosmetic.requiresPermission()) return true;
|
if (!cosmetic.requiresPermission()) return true;
|
||||||
if (isInWardrobe()) {
|
if (isInWardrobe() && !ignoreWardrobe) {
|
||||||
if (WardrobeSettings.isTryCosmeticsInWardrobe() && userWardrobeManager.getWardrobeStatus().equals(UserWardrobeManager.WardrobeStatus.RUNNING)) return true;
|
if (WardrobeSettings.isTryCosmeticsInWardrobe() && userWardrobeManager.getWardrobeStatus().equals(UserWardrobeManager.WardrobeStatus.RUNNING)) return true;
|
||||||
}
|
}
|
||||||
return getPlayer().hasPermission(cosmetic.getPermission());
|
return getPlayer().hasPermission(cosmetic.getPermission());
|
||||||
@@ -491,10 +504,10 @@ public class CosmeticUser {
|
|||||||
if (hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON);
|
CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON);
|
||||||
getBalloonManager().addPlayerToModel(this, balloonType);
|
getBalloonManager().addPlayerToModel(this, balloonType);
|
||||||
List<Player> viewer = PlayerUtils.getNearbyPlayers(getPlayer());
|
List<Player> viewer = PlayerUtils.getNearbyPlayers(getEntity().getLocation());
|
||||||
PacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer);
|
PacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer);
|
||||||
}
|
}
|
||||||
if (hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (hasCosmeticInSlot(CosmeticSlot.BACKPACK) && isBackpackSpawned()) {
|
||||||
CosmeticBackpackType cosmeticBackpackType = (CosmeticBackpackType) getCosmetic(CosmeticSlot.BACKPACK);
|
CosmeticBackpackType cosmeticBackpackType = (CosmeticBackpackType) getCosmetic(CosmeticSlot.BACKPACK);
|
||||||
ItemStack item = getUserCosmeticItem(cosmeticBackpackType);
|
ItemStack item = getUserCosmeticItem(cosmeticBackpackType);
|
||||||
userBackpackManager.setItem(item);
|
userBackpackManager.setItem(item);
|
||||||
@@ -507,10 +520,6 @@ public class CosmeticUser {
|
|||||||
return this.hideCosmetics;
|
return this.hideCosmetics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HiddenReason getHiddenReason() {
|
|
||||||
return hiddenReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum HiddenReason {
|
public enum HiddenReason {
|
||||||
NONE,
|
NONE,
|
||||||
WORLDGUARD,
|
WORLDGUARD,
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
|||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
import com.ticxo.modelengine.api.ModelEngineAPI;
|
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import lombok.Getter;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -19,43 +17,34 @@ import org.bukkit.inventory.EquipmentSlot;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class UserBackpackManager {
|
public class UserBackpackManager {
|
||||||
|
|
||||||
private boolean hideBackpack;
|
@Getter
|
||||||
private ArmorStand invisibleArmorStand;
|
private boolean backpackHidden;
|
||||||
|
@Getter
|
||||||
|
private int invisibleArmorStand;
|
||||||
private ArrayList<Integer> particleCloud = new ArrayList<>();
|
private ArrayList<Integer> particleCloud = new ArrayList<>();
|
||||||
|
@Getter
|
||||||
private final CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
private boolean firstPerson;
|
@Getter
|
||||||
private UserBackpackCloudManager cloudManager;
|
private UserEntity entityManager;
|
||||||
|
|
||||||
public UserBackpackManager(CosmeticUser user, boolean firstPersonView) {
|
public UserBackpackManager(CosmeticUser user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.hideBackpack = false;
|
this.backpackHidden = false;
|
||||||
this.firstPerson = firstPersonView;
|
this.invisibleArmorStand = NMSHandlers.getHandler().getNextEntityId();
|
||||||
this.cloudManager = new UserBackpackCloudManager(user.getUniqueId());
|
this.entityManager = new UserEntity(user.getUniqueId());
|
||||||
|
this.entityManager.refreshViewers(user.getEntity().getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirstArmorStandId() {
|
public int getFirstArmorStandId() {
|
||||||
return invisibleArmorStand.getEntityId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArmorStand getArmorStand() {
|
|
||||||
return invisibleArmorStand;
|
return invisibleArmorStand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean IsValidBackpackEntity() {
|
|
||||||
if (invisibleArmorStand == null) {
|
|
||||||
MessagesUtil.sendDebugMessages("InvisibleArmorStand is Null!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return getArmorStand().isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Start");
|
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Start");
|
||||||
|
|
||||||
@@ -63,8 +52,11 @@ public class UserBackpackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawn(CosmeticBackpackType cosmeticBackpackType) {
|
private void spawn(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
if (this.invisibleArmorStand != null) return;
|
getEntityManager().setIds(List.of(invisibleArmorStand));
|
||||||
this.invisibleArmorStand = (ArmorStand) NMSHandlers.getHandler().spawnBackpack(user, cosmeticBackpackType);
|
getEntityManager().teleport(user.getEntity().getLocation());
|
||||||
|
List<Player> outsideViewers = getEntityManager().getViewers();
|
||||||
|
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), getEntityManager().getViewers());
|
||||||
|
PacketManager.sendInvisibilityPacket(getFirstArmorStandId(), outsideViewers);
|
||||||
|
|
||||||
Entity entity = user.getEntity();
|
Entity entity = user.getEntity();
|
||||||
|
|
||||||
@@ -76,14 +68,11 @@ public class UserBackpackManager {
|
|||||||
|
|
||||||
passengerIDs[passengerIDs.length - 1] = this.getFirstArmorStandId();
|
passengerIDs[passengerIDs.length - 1] = this.getFirstArmorStandId();
|
||||||
|
|
||||||
List<Player> outsideViewers = user.getUserBackpackManager().getCloudManager().refreshViewers(user.getEntity().getLocation());
|
|
||||||
PacketManager.sendRidingPacket(user.getEntity().getEntityId(), passengerIDs, outsideViewers);
|
|
||||||
|
|
||||||
ArrayList<Player> owner = new ArrayList<>();
|
ArrayList<Player> owner = new ArrayList<>();
|
||||||
if (user.getPlayer() != null) owner.add(user.getPlayer());
|
if (user.getPlayer() != null) owner.add(user.getPlayer());
|
||||||
|
|
||||||
if (cosmeticBackpackType.isFirstPersonCompadible()) {
|
if (cosmeticBackpackType.isFirstPersonCompadible()) {
|
||||||
for (int i = particleCloud.size(); i < 5; i++) {
|
for (int i = particleCloud.size(); i < cosmeticBackpackType.getHeight(); i++) {
|
||||||
int entityId = NMSHandlers.getHandler().getNextEntityId();
|
int entityId = NMSHandlers.getHandler().getNextEntityId();
|
||||||
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), entityId, EntityType.AREA_EFFECT_CLOUD, UUID.randomUUID());
|
PacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), entityId, EntityType.AREA_EFFECT_CLOUD, UUID.randomUUID());
|
||||||
PacketManager.sendCloudEffect(entityId, PacketManager.getViewers(user.getEntity().getLocation()));
|
PacketManager.sendCloudEffect(entityId, PacketManager.getViewers(user.getEntity().getLocation()));
|
||||||
@@ -95,8 +84,9 @@ public class UserBackpackManager {
|
|||||||
else PacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
else PacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
||||||
}
|
}
|
||||||
PacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
PacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
||||||
if (!user.getHidden()) NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, cosmeticBackpackType.getFirstPersonBackpack(), owner);
|
if (!user.getHidden()) NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(cosmeticBackpackType, cosmeticBackpackType.getFirstPersonBackpack()), owner);
|
||||||
}
|
}
|
||||||
|
NMSHandlers.getHandler().equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(cosmeticBackpackType), outsideViewers);
|
||||||
PacketManager.sendRidingPacket(entity.getEntityId(), passengerIDs, outsideViewers);
|
PacketManager.sendRidingPacket(entity.getEntityId(), passengerIDs, outsideViewers);
|
||||||
|
|
||||||
// No one should be using ME because it barely works but some still use it, so it's here
|
// No one should be using ME because it barely works but some still use it, so it's here
|
||||||
@@ -105,24 +95,22 @@ public class UserBackpackManager {
|
|||||||
MessagesUtil.sendDebugMessages("Invalid Model Engine Blueprint " + cosmeticBackpackType.getModelName(), Level.SEVERE);
|
MessagesUtil.sendDebugMessages("Invalid Model Engine Blueprint " + cosmeticBackpackType.getModelName(), Level.SEVERE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModeledEntity modeledEntity = ModelEngineAPI.getOrCreateModeledEntity(invisibleArmorStand);
|
/* TODO: Readd ModelEngine support
|
||||||
|
ModeledEntity modeledEntity = ModelEngineAPI.createModeledEntity(new PacketBaseEntity(getFirstArmorStandId(), UUID.randomUUID(), entity.getLocation()));
|
||||||
ActiveModel model = ModelEngineAPI.createActiveModel(ModelEngineAPI.getBlueprint(cosmeticBackpackType.getModelName()));
|
ActiveModel model = ModelEngineAPI.createActiveModel(ModelEngineAPI.getBlueprint(cosmeticBackpackType.getModelName()));
|
||||||
model.setCanHurt(false);
|
model.setCanHurt(false);
|
||||||
modeledEntity.addModel(model, false);
|
modeledEntity.addModel(model, false);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Finish");
|
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Finish");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void despawnBackpack() {
|
public void despawnBackpack() {
|
||||||
if (invisibleArmorStand != null) {
|
PacketManager.sendEntityDestroyPacket(invisibleArmorStand, getEntityManager().getViewers());
|
||||||
invisibleArmorStand.setHealth(0);
|
|
||||||
invisibleArmorStand.remove();
|
|
||||||
this.invisibleArmorStand = null;
|
|
||||||
}
|
|
||||||
if (particleCloud != null) {
|
if (particleCloud != null) {
|
||||||
for (Integer entityId : particleCloud) {
|
for (Integer entityId : particleCloud) {
|
||||||
PacketManager.sendEntityDestroyPacket(entityId, getCloudManager().getViewers());
|
PacketManager.sendEntityDestroyPacket(entityId, getEntityManager().getViewers());
|
||||||
}
|
}
|
||||||
this.particleCloud = null;
|
this.particleCloud = null;
|
||||||
}
|
}
|
||||||
@@ -130,20 +118,20 @@ public class UserBackpackManager {
|
|||||||
|
|
||||||
public void hideBackpack() {
|
public void hideBackpack() {
|
||||||
if (user.getHidden()) return;
|
if (user.getHidden()) return;
|
||||||
getArmorStand().getEquipment().clear();
|
//getArmorStand().getEquipment().clear();
|
||||||
hideBackpack = true;
|
backpackHidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showBackpack() {
|
public void showBackpack() {
|
||||||
if (!hideBackpack) return;
|
if (!backpackHidden) return;
|
||||||
CosmeticBackpackType cosmeticBackpackType = (CosmeticBackpackType) user.getCosmetic(CosmeticSlot.BACKPACK);
|
CosmeticBackpackType cosmeticBackpackType = (CosmeticBackpackType) user.getCosmetic(CosmeticSlot.BACKPACK);
|
||||||
ItemStack item = user.getUserCosmeticItem(cosmeticBackpackType);
|
ItemStack item = user.getUserCosmeticItem(cosmeticBackpackType);
|
||||||
getArmorStand().getEquipment().setHelmet(item);
|
//getArmorStand().getEquipment().setHelmet(item);
|
||||||
hideBackpack = false;
|
backpackHidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(boolean shown) {
|
public void setVisibility(boolean shown) {
|
||||||
hideBackpack = shown;
|
backpackHidden = shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getAreaEffectEntityId() {
|
public ArrayList<Integer> getAreaEffectEntityId() {
|
||||||
@@ -151,15 +139,11 @@ public class UserBackpackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(ItemStack item) {
|
public void setItem(ItemStack item) {
|
||||||
getArmorStand().getEquipment().setHelmet(item);
|
NMSHandlers.getHandler().equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, item, getEntityManager().getViewers());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearItems() {
|
public void clearItems() {
|
||||||
ItemStack item = new ItemStack(Material.AIR);
|
ItemStack item = new ItemStack(Material.AIR);
|
||||||
getArmorStand().getEquipment().setHelmet(item);
|
NMSHandlers.getHandler().equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, item, getEntityManager().getViewers());
|
||||||
}
|
|
||||||
|
|
||||||
public UserBackpackCloudManager getCloudManager() {
|
|
||||||
return cloudManager;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
|||||||
import com.ticxo.modelengine.api.ModelEngineAPI;
|
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
import com.ticxo.modelengine.api.model.ModeledEntity;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
@@ -27,11 +28,12 @@ public class UserBalloonManager {
|
|||||||
|
|
||||||
private BalloonType balloonType;
|
private BalloonType balloonType;
|
||||||
private CosmeticBalloonType cosmeticBalloonType;
|
private CosmeticBalloonType cosmeticBalloonType;
|
||||||
|
@Getter
|
||||||
private UserBalloonPufferfish pufferfish;
|
private UserBalloonPufferfish pufferfish;
|
||||||
private final ArmorStand modelEntity;
|
private final ArmorStand modelEntity;
|
||||||
|
|
||||||
public UserBalloonManager(@NotNull Location location) {
|
public UserBalloonManager(CosmeticUser user, @NotNull Location location) {
|
||||||
this.pufferfish = new UserBalloonPufferfish(NMSHandlers.getHandler().getNextEntityId(), UUID.randomUUID());
|
this.pufferfish = new UserBalloonPufferfish(user.getUniqueId(), NMSHandlers.getHandler().getNextEntityId(), UUID.randomUUID());
|
||||||
this.modelEntity = NMSHandlers.getHandler().getMEGEntity(location.add(Settings.getBalloonOffset()));
|
this.modelEntity = NMSHandlers.getHandler().getMEGEntity(location.add(Settings.getBalloonOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +177,6 @@ public class UserBalloonManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserBalloonPufferfish getPufferfish() {
|
|
||||||
return pufferfish;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum BalloonType {
|
public enum BalloonType {
|
||||||
MODELENGINE,
|
MODELENGINE,
|
||||||
ITEM,
|
ITEM,
|
||||||
|
|||||||
@@ -9,17 +9,15 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UserBalloonPufferfish {
|
public class UserBalloonPufferfish extends UserEntity {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private List<Player> viewers = new ArrayList<>();
|
|
||||||
private Long lastUpdate;
|
|
||||||
|
|
||||||
public UserBalloonPufferfish(int id, UUID uuid) {
|
public UserBalloonPufferfish(UUID owner, int id, UUID uuid) {
|
||||||
|
super(owner);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.lastUpdate = 0L;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -30,33 +28,8 @@ public class UserBalloonPufferfish {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> refreshViewers(Location location) {
|
|
||||||
if (System.currentTimeMillis() - lastUpdate <= 1000) return List.of(); //Prevents mass refreshes
|
|
||||||
ArrayList<Player> newPlayers = new ArrayList<>();
|
|
||||||
ArrayList<Player> removePlayers = new ArrayList<>();
|
|
||||||
List<Player> players = PlayerUtils.getNearbyPlayers(location);
|
|
||||||
|
|
||||||
for (Player player : players) {
|
|
||||||
if (!viewers.contains(player)) {
|
|
||||||
viewers.add(player);
|
|
||||||
newPlayers.add(player);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// bad loopdy loops
|
|
||||||
for (Player viewerPlayer : viewers) {
|
|
||||||
if (!players.contains(viewerPlayer)) {
|
|
||||||
removePlayers.add(viewerPlayer);
|
|
||||||
PacketManager.sendEntityDestroyPacket(id, List.of(viewerPlayer)); // prevents random leashes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewers.removeAll(removePlayers);
|
|
||||||
lastUpdate = System.currentTimeMillis();
|
|
||||||
return newPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hidePufferfish() {
|
public void hidePufferfish() {
|
||||||
PacketManager.sendEntityDestroyPacket(id, viewers);
|
PacketManager.sendEntityDestroyPacket(id, getViewers());
|
||||||
viewers.clear();
|
getViewers().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,39 +47,42 @@ public class UserEmoteModel extends PlayerModel {
|
|||||||
PacketManager.equipmentSlotUpdate(player, true, outsideViewers);
|
PacketManager.equipmentSlotUpdate(player, true, outsideViewers);
|
||||||
outsideViewers.remove(player);
|
outsideViewers.remove(player);
|
||||||
|
|
||||||
Location newLocation = player.getLocation().clone();
|
|
||||||
newLocation.setPitch(0);
|
|
||||||
|
|
||||||
double DISTANCE = Settings.getEmoteDistance();
|
|
||||||
|
|
||||||
Location thirdPersonLocation = newLocation.add(newLocation.getDirection().normalize().multiply(DISTANCE));
|
|
||||||
if (DISTANCE > 0) {
|
|
||||||
MessagesUtil.sendDebugMessages("Yaw " + (int) thirdPersonLocation.getYaw());
|
|
||||||
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()) {
|
|
||||||
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()) {
|
|
||||||
stopAnimation();
|
|
||||||
MessagesUtil.sendMessage(player, "emote-blocked");
|
|
||||||
}
|
|
||||||
|
|
||||||
user.getPlayer().setInvisible(true);
|
user.getPlayer().setInvisible(true);
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.EMOTE);
|
user.hideCosmetics(CosmeticUser.HiddenReason.EMOTE);
|
||||||
|
|
||||||
originalGamemode = player.getGameMode();
|
originalGamemode = player.getGameMode();
|
||||||
|
|
||||||
PacketManager.sendEntitySpawnPacket(thirdPersonLocation, armorStandId, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
if (Settings.isEmoteCameraEnabled()) {
|
||||||
PacketManager.sendInvisibilityPacket(armorStandId, viewer);
|
Location newLocation = player.getLocation().clone();
|
||||||
PacketManager.sendLookPacket(armorStandId, thirdPersonLocation, viewer);
|
newLocation.setPitch(0);
|
||||||
|
|
||||||
|
double DISTANCE = Settings.getEmoteDistance();
|
||||||
|
|
||||||
|
Location thirdPersonLocation = newLocation.add(newLocation.getDirection().normalize().multiply(DISTANCE));
|
||||||
|
if (DISTANCE > 0) {
|
||||||
|
MessagesUtil.sendDebugMessages("Yaw " + (int) thirdPersonLocation.getYaw());
|
||||||
|
MessagesUtil.sendDebugMessages("New Yaw " + ServerUtils.getNextYaw((int) thirdPersonLocation.getYaw(), 180));
|
||||||
|
thirdPersonLocation.setYaw(ServerUtils.getNextYaw((int) thirdPersonLocation.getYaw(), 180));
|
||||||
|
}
|
||||||
|
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.isEmoteAirCheck() && newLocation.clone().subtract(0, 1, 0).getBlock().getType().isAir()) {
|
||||||
|
stopAnimation();
|
||||||
|
MessagesUtil.sendMessage(player, "emote-blocked");
|
||||||
|
}
|
||||||
|
|
||||||
|
PacketManager.sendEntitySpawnPacket(thirdPersonLocation, armorStandId, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
||||||
|
PacketManager.sendInvisibilityPacket(armorStandId, viewer);
|
||||||
|
PacketManager.sendLookPacket(armorStandId, thirdPersonLocation, viewer);
|
||||||
|
|
||||||
|
PacketManager.gamemodeChangePacket(player, 3);
|
||||||
|
PacketManager.sendCameraPacket(armorStandId, viewer);
|
||||||
|
}
|
||||||
|
|
||||||
PacketManager.gamemodeChangePacket(player, 3);
|
|
||||||
PacketManager.sendCameraPacket(armorStandId, viewer);
|
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("playAnimation run");
|
MessagesUtil.sendDebugMessages("playAnimation run");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -9,25 +13,25 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UserBackpackCloudManager {
|
public class UserEntity {
|
||||||
|
|
||||||
private ArrayList<Integer> ids;
|
@Getter
|
||||||
private UUID owner;
|
private UUID owner;
|
||||||
|
@Getter
|
||||||
private List<Player> viewers = new ArrayList<>();
|
private List<Player> viewers = new ArrayList<>();
|
||||||
private Long lastUpdate;
|
@Getter @Setter
|
||||||
|
private Long lastUpdate = 0L;
|
||||||
|
@Getter @Setter
|
||||||
|
private List<Integer> ids = new ArrayList<>();
|
||||||
|
@Getter
|
||||||
|
private Location location;
|
||||||
|
|
||||||
public UserBackpackCloudManager(UUID owner) {
|
public UserEntity(UUID owner) {
|
||||||
this.ids = new ArrayList<>();
|
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.lastUpdate = 0L;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getId() {
|
public List<Player> refreshViewers() {
|
||||||
return ids;
|
return refreshViewers(location);
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getOwner() {
|
|
||||||
return owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> refreshViewers(Location location) {
|
public List<Player> refreshViewers(Location location) {
|
||||||
@@ -37,7 +41,12 @@ public class UserBackpackCloudManager {
|
|||||||
List<Player> players = PlayerUtils.getNearbyPlayers(location);
|
List<Player> players = PlayerUtils.getNearbyPlayers(location);
|
||||||
|
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
//if (player.getUniqueId().toString().equalsIgnoreCase(owner.toString())) continue;
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
|
if (user != null && owner != user.getUniqueId() && user.isInWardrobe()) { // Fixes issue where players in wardrobe would see other players cosmetics if they were not in wardrobe
|
||||||
|
removePlayers.add(player);
|
||||||
|
PacketManager.sendEntityDestroyPacket(ids, List.of(player));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!viewers.contains(player)) {
|
if (!viewers.contains(player)) {
|
||||||
viewers.add(player);
|
viewers.add(player);
|
||||||
newPlayers.add(player);
|
newPlayers.add(player);
|
||||||
@@ -47,7 +56,7 @@ public class UserBackpackCloudManager {
|
|||||||
for (Player viewerPlayer : viewers) {
|
for (Player viewerPlayer : viewers) {
|
||||||
if (!players.contains(viewerPlayer)) {
|
if (!players.contains(viewerPlayer)) {
|
||||||
removePlayers.add(viewerPlayer);
|
removePlayers.add(viewerPlayer);
|
||||||
PacketManager.sendEntityDestroyPacket(ids, List.of(viewerPlayer)); // prevents random leashes
|
PacketManager.sendEntityDestroyPacket(ids, List.of(viewerPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,13 +65,17 @@ public class UserBackpackCloudManager {
|
|||||||
return newPlayers;
|
return newPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideEffects() {
|
public void teleport(Location location) {
|
||||||
PacketManager.sendEntityDestroyPacket(ids, viewers);
|
this.location = location;
|
||||||
viewers.clear();
|
for (Integer entity : ids) {
|
||||||
|
PacketManager.sendTeleportPacket(entity, location, false, getViewers());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> getViewers() {
|
public void setRotation(int yaw) {
|
||||||
return viewers;
|
location.setYaw(yaw);
|
||||||
|
for (Integer entity : ids) {
|
||||||
|
PacketManager.sendLookPacket(entity, location, getViewers());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
|
||||||
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
import com.hibiscusmc.hmccosmetics.config.WardrobeLocation;
|
import com.hibiscusmc.hmccosmetics.config.WardrobeLocation;
|
||||||
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
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.CosmeticBalloonType;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||||
@@ -14,6 +14,7 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
|||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.ServerUtils;
|
import com.hibiscusmc.hmccosmetics.util.ServerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.PacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.bossbar.BossBar;
|
import net.kyori.adventure.bossbar.BossBar;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
@@ -36,19 +37,33 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class UserWardrobeManager {
|
public class UserWardrobeManager {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final int NPC_ID;
|
private final int NPC_ID;
|
||||||
|
@Getter
|
||||||
private final int ARMORSTAND_ID;
|
private final int ARMORSTAND_ID;
|
||||||
|
@Getter
|
||||||
private final UUID WARDROBE_UUID;
|
private final UUID WARDROBE_UUID;
|
||||||
|
@Getter
|
||||||
private String npcName;
|
private String npcName;
|
||||||
|
@Getter
|
||||||
private GameMode originalGamemode;
|
private GameMode originalGamemode;
|
||||||
|
@Getter
|
||||||
private final CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
|
@Getter
|
||||||
private final Wardrobe wardrobe;
|
private final Wardrobe wardrobe;
|
||||||
|
@Getter
|
||||||
private final WardrobeLocation wardrobeLocation;
|
private final WardrobeLocation wardrobeLocation;
|
||||||
|
@Getter
|
||||||
private final Location viewingLocation;
|
private final Location viewingLocation;
|
||||||
|
@Getter
|
||||||
private final Location npcLocation;
|
private final Location npcLocation;
|
||||||
|
@Getter
|
||||||
private Location exitLocation;
|
private Location exitLocation;
|
||||||
|
@Getter
|
||||||
private BossBar bossBar;
|
private BossBar bossBar;
|
||||||
|
@Getter
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
@Getter
|
||||||
private WardrobeStatus wardrobeStatus;
|
private WardrobeStatus wardrobeStatus;
|
||||||
|
|
||||||
public UserWardrobeManager(CosmeticUser user, Wardrobe wardrobe) {
|
public UserWardrobeManager(CosmeticUser user, Wardrobe wardrobe) {
|
||||||
@@ -116,24 +131,25 @@ public class UserWardrobeManager {
|
|||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
// Maybe null as backpack maybe despawned before entering
|
// Maybe null as backpack maybe despawned before entering
|
||||||
if (user.getUserBackpackManager() == null) user.respawnBackpack();
|
if (user.getUserBackpackManager() == null) user.respawnBackpack();
|
||||||
user.getUserBackpackManager().getArmorStand().teleport(npcLocation.clone().add(0, 2, 0));
|
user.getUserBackpackManager().getEntityManager().teleport(npcLocation.clone().add(0, 2, 0));
|
||||||
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(user.getCosmetic(CosmeticSlot.BACKPACK)), viewer);
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(user.getCosmetic(CosmeticSlot.BACKPACK)), viewer);
|
||||||
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
|
CosmeticBalloonType cosmetic = (CosmeticBalloonType) user.getCosmetic(CosmeticSlot.BALLOON);
|
||||||
user.getBalloonManager().sendRemoveLeashPacket(viewer);
|
user.getBalloonManager().sendRemoveLeashPacket(viewer);
|
||||||
user.getBalloonManager().sendLeashPacket(NPC_ID);
|
user.getBalloonManager().sendLeashPacket(NPC_ID);
|
||||||
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getModelId(), NPC_ID, viewer);
|
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getModelId(), NPC_ID, viewer);
|
||||||
|
|
||||||
Location balloonLocation = npcLocation.clone().add(Settings.getBalloonOffset());
|
Location balloonLocation = npcLocation.clone().add(cosmetic.getBalloonOffset());
|
||||||
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), balloonLocation , false, viewer);
|
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), balloonLocation , false, viewer);
|
||||||
user.getBalloonManager().getModelEntity().teleport(balloonLocation);
|
user.getBalloonManager().getModelEntity().teleport(balloonLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WardrobeSettings.getEnabledBossbar()) {
|
if (WardrobeSettings.isEnabledBossbar()) {
|
||||||
float progress = WardrobeSettings.getBossbarProgress();
|
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());
|
bossBar = BossBar.bossBar(message, progress, WardrobeSettings.getBossbarColor(), WardrobeSettings.getBossbarOverlay());
|
||||||
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
|
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
|
||||||
@@ -228,7 +244,7 @@ public class UserWardrobeManager {
|
|||||||
NMSHandlers.getHandler().equipmentSlotUpdate(user.getPlayer().getEntityId(), EquipmentSlot.HEAD, player.getInventory().getHelmet(), viewer);
|
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);
|
Audience target = BukkitAudiences.create(HMCCosmeticsPlugin.getInstance()).player(player);
|
||||||
|
|
||||||
target.hideBossBar(bossBar);
|
target.hideBossBar(bossBar);
|
||||||
@@ -275,7 +291,7 @@ public class UserWardrobeManager {
|
|||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
PacketManager.sendTeleportPacket(user.getUserBackpackManager().getFirstArmorStandId(), location, false, viewer);
|
PacketManager.sendTeleportPacket(user.getUserBackpackManager().getFirstArmorStandId(), location, false, viewer);
|
||||||
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
||||||
user.getUserBackpackManager().getArmorStand().setRotation(nextyaw, 0);
|
user.getUserBackpackManager().getEntityManager().setRotation(nextyaw);
|
||||||
PacketManager.sendEntityDestroyPacket(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
PacketManager.sendEntityDestroyPacket(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,14 +313,6 @@ public class UserWardrobeManager {
|
|||||||
runnable.runTaskTimer(HMCCosmeticsPlugin.getInstance(), 0, 2);
|
runnable.runTaskTimer(HMCCosmeticsPlugin.getInstance(), 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCameraId() {
|
|
||||||
return ARMORSTAND_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WardrobeStatus getWardrobeStatus() {
|
|
||||||
return wardrobeStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWardrobeStatus(WardrobeStatus status) {
|
public void setWardrobeStatus(WardrobeStatus status) {
|
||||||
this.wardrobeStatus = status;
|
this.wardrobeStatus = status;
|
||||||
}
|
}
|
||||||
@@ -316,7 +324,4 @@ public class UserWardrobeManager {
|
|||||||
STOPPING,
|
STOPPING,
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getNpcLocation() {
|
|
||||||
return npcLocation;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public class MessagesUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sendDebugMessages(String message, Level level) {
|
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);
|
HMCCosmeticsPlugin.getInstance().getLogger().log(level, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
|||||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
|
import com.hibiscusmc.hmccosmetics.util.InventoryUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerNamedEntitySpawn;
|
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerNamedEntitySpawn;
|
||||||
@@ -118,7 +119,7 @@ public class PacketManager extends BasePacket {
|
|||||||
) {
|
) {
|
||||||
if (cosmeticSlot == CosmeticSlot.BACKPACK || cosmeticSlot == CosmeticSlot.BALLOON || cosmeticSlot == CosmeticSlot.EMOTE) return;
|
if (cosmeticSlot == CosmeticSlot.BACKPACK || cosmeticSlot == CosmeticSlot.BALLOON || cosmeticSlot == CosmeticSlot.EMOTE) return;
|
||||||
|
|
||||||
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, user, cosmeticSlot, sendTo);
|
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, InventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void armorStandMetaPacket(
|
public static void armorStandMetaPacket(
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ cosmetic-settings:
|
|||||||
emote-air-check: true # Check if there is air under a player, if there is, don't play emote
|
emote-air-check: true # Check if there is air under a player, if there is, don't play emote
|
||||||
emote-damage-leave: true # If the player should leave the emote when they take damage
|
emote-damage-leave: true # If the player should leave the emote when they take damage
|
||||||
emote-invincible: false # If the player should not take damage while doing an emote
|
emote-invincible: false # If the player should not take damage while doing an emote
|
||||||
|
# If a player should be put into camera mode when looking at an emote. Highly recommend keeping it as true.
|
||||||
|
emote-camera: true
|
||||||
|
# If a player should be able to move in an emote. This option really only affects if "emote-camera" is false
|
||||||
|
emote-move: false
|
||||||
|
# This make it so it always sends the riding packets for the backpack. This sends more packets but is more reliable for servers which modify player passengers.
|
||||||
|
backpack-force-riding-packet: false
|
||||||
|
|
||||||
helmet-add-enchantments: false # If the plugin should keep enchants on helmets. This is useful as some enchantments are client side only.
|
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.
|
chest-add-enchantments: false # If the plugin should keep enchants on chestplate. This is useful as some enchantments are client side only.
|
||||||
@@ -49,6 +55,20 @@ cosmetic-settings:
|
|||||||
y: 3
|
y: 3
|
||||||
z: 0.5
|
z: 0.5
|
||||||
menu-settings:
|
menu-settings:
|
||||||
|
shading:
|
||||||
|
# Below is the shading mechanism behind cosmetic items. This is a bit complicated, but it allows for a lot of customization.
|
||||||
|
# The shading is done through the title and by shifting textures around. This is done by offsets.
|
||||||
|
# Only Oraxen is support by default. Vanilla can't properly handle it without a lot of unicodes and ItemsAdder adds weird offsets and decolors it. (This is why it is disabled by default)
|
||||||
|
enabled: false # Default of menus having shading. This can be toggled individually in menus with "shading: true/false"
|
||||||
|
first-row-shift: "<s:-169>" # Oraxen: "<s:-169>"
|
||||||
|
sequent-row-shift: " <s:-169>" # Oraxen: " <s:-169>" (Space is important here!)
|
||||||
|
individual-column-shift: "<s:-3>" # Oraxen: "<s:-3>"
|
||||||
|
background: "<g:shade_row_<row>:colorable> " # Oraxen: "<g:shade_row_<row>:colorable>
|
||||||
|
clear-background: "<g:clear_row_<row>:colorable> " # Oraxen: "<g:clear_row_<row>:colorable> "
|
||||||
|
#These use MiniMessage for color! https://docs.advntr.dev/minimessage/format.html#color
|
||||||
|
equipped-cosmetic-color: "<yellow>"
|
||||||
|
equipable-cosmetic-color: "<green>"
|
||||||
|
locked-cosmetic-color: "<red>"
|
||||||
cosmetic-type:
|
cosmetic-type:
|
||||||
# This allows you to specify if it should require a special click type for the interaction to work.
|
# This allows you to specify if it should require a special click type for the interaction to work.
|
||||||
equip-click: "ANY" # ANY or ClickType, https://jd.papermc.io/paper/1.20/org/bukkit/event/inventory/ClickType.html
|
equip-click: "ANY" # ANY or ClickType, https://jd.papermc.io/paper/1.20/org/bukkit/event/inventory/ClickType.html
|
||||||
|
|||||||
BIN
lib/HMCColor-0.8-all.jar
Normal file
BIN
lib/HMCColor-0.8-all.jar
Normal file
Binary file not shown.
@@ -96,8 +96,8 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
|
|||||||
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
||||||
org.bukkit.entity.Entity entity = user.getEntity();
|
org.bukkit.entity.Entity entity = user.getEntity();
|
||||||
|
|
||||||
UserBalloonManager userBalloonManager1 = new UserBalloonManager(entity.getLocation());
|
UserBalloonManager userBalloonManager1 = new UserBalloonManager(user, entity.getLocation());
|
||||||
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(Settings.getBalloonOffset()));
|
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(cosmeticBalloonType.getBalloonOffset()));
|
||||||
|
|
||||||
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
|
|||||||
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
||||||
org.bukkit.entity.Entity entity = user.getEntity();
|
org.bukkit.entity.Entity entity = user.getEntity();
|
||||||
|
|
||||||
UserBalloonManager userBalloonManager1 = new UserBalloonManager(entity.getLocation());
|
UserBalloonManager userBalloonManager1 = new UserBalloonManager(user, entity.getLocation());
|
||||||
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(Settings.getBalloonOffset()));
|
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(cosmeticBalloonType.getBalloonOffset()));
|
||||||
|
|
||||||
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
|
|||||||
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
||||||
org.bukkit.entity.Entity entity = user.getEntity();
|
org.bukkit.entity.Entity entity = user.getEntity();
|
||||||
|
|
||||||
UserBalloonManager userBalloonManager1 = new UserBalloonManager(entity.getLocation());
|
UserBalloonManager userBalloonManager1 = new UserBalloonManager(user, entity.getLocation());
|
||||||
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(Settings.getBalloonOffset()));
|
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(cosmeticBalloonType.getBalloonOffset()));
|
||||||
|
|
||||||
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
|
|||||||
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
||||||
Entity entity = user.getEntity();
|
Entity entity = user.getEntity();
|
||||||
|
|
||||||
UserBalloonManager userBalloonManager1 = new UserBalloonManager(entity.getLocation());
|
UserBalloonManager userBalloonManager1 = new UserBalloonManager(user, entity.getLocation());
|
||||||
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(Settings.getBalloonOffset()));
|
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(cosmeticBalloonType.getBalloonOffset()));
|
||||||
|
|
||||||
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ public class NMSHandler implements com.hibiscusmc.hmccosmetics.nms.NMSHandler {
|
|||||||
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
public UserBalloonManager spawnBalloon(CosmeticUser user, CosmeticBalloonType cosmeticBalloonType) {
|
||||||
org.bukkit.entity.Entity entity = user.getEntity();
|
org.bukkit.entity.Entity entity = user.getEntity();
|
||||||
|
|
||||||
UserBalloonManager userBalloonManager1 = new UserBalloonManager(entity.getLocation());
|
UserBalloonManager userBalloonManager1 = new UserBalloonManager(user, entity.getLocation());
|
||||||
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(Settings.getBalloonOffset()));
|
userBalloonManager1.getModelEntity().teleport(entity.getLocation().add(cosmeticBalloonType.getBalloonOffset()));
|
||||||
|
|
||||||
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.spawnModel(cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
userBalloonManager1.addPlayerToModel(user, cosmeticBalloonType, user.getCosmeticColor(cosmeticBalloonType.getSlot()));
|
||||||
|
|||||||
Reference in New Issue
Block a user