mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-26 18:39:07 +00:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ef2c6b631 | ||
|
|
c7667b2dc2 | ||
|
|
e4c4933d46 | ||
|
|
1f94192772 | ||
|
|
8ebcea5465 | ||
|
|
4c7ccc06ca | ||
|
|
667f58ff4b | ||
|
|
69d318c4b0 | ||
|
|
0414f3be90 | ||
|
|
402203b4c2 | ||
|
|
6dcaf06ebe | ||
|
|
1b6adca00e | ||
|
|
0dce5822e3 | ||
|
|
0f1b75f09e | ||
|
|
19192c46a5 | ||
|
|
62a9e7d1ac | ||
|
|
06077201f9 | ||
|
|
b2795a705e | ||
|
|
1e6734bf6f | ||
|
|
ad382e5d9e | ||
|
|
6458a1e316 | ||
|
|
279d6edc34 | ||
|
|
439dc85aa3 | ||
|
|
60e23411dc | ||
|
|
33fb680c22 | ||
|
|
536b7ebdec | ||
|
|
5da95f2f5b | ||
|
|
30f4a84241 | ||
|
|
f34e126c85 | ||
|
|
d7d0f27e49 | ||
|
|
f42937a6d0 |
@@ -2,13 +2,13 @@ import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.gradleup.shadow") version "8.3.2"
|
||||||
id("xyz.jpenilla.run-paper") version "2.0.0"
|
id("xyz.jpenilla.run-paper") version "2.3.1"
|
||||||
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
|
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.7.3"
|
version = "2.7.4${getGitCommitHash()}"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
@@ -49,9 +49,6 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateChecker
|
|
||||||
maven("https://hub.jeff-media.com/nexus/repository/jeff-media-public/")
|
|
||||||
|
|
||||||
// ParticleHelper
|
// ParticleHelper
|
||||||
maven("https://repo.bytecode.space/repository/maven-public/")
|
maven("https://repo.bytecode.space/repository/maven-public/")
|
||||||
|
|
||||||
@@ -75,15 +72,15 @@ allprojects {
|
|||||||
compileOnly(fileTree("${project.rootDir}/lib") { include("*.jar") })
|
compileOnly(fileTree("${project.rootDir}/lib") { include("*.jar") })
|
||||||
compileOnly("com.mojang:authlib:1.5.25")
|
compileOnly("com.mojang:authlib:1.5.25")
|
||||||
//compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
//compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
||||||
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
|
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.jetbrains:annotations:24.1.0")
|
compileOnly("org.jetbrains:annotations:24.1.0")
|
||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.3.0-SNAPSHOT")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.3.0")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.2")
|
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.6")
|
||||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.12")
|
||||||
compileOnly("it.unimi.dsi:fastutil:8.5.13")
|
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
||||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||||
compileOnly("me.lojosho:HibiscusCommons:0.4.1")
|
compileOnly("me.lojosho:HibiscusCommons:0.5.1")
|
||||||
|
|
||||||
// Handled by Spigot Library Loader
|
// Handled by Spigot Library Loader
|
||||||
compileOnly("net.kyori:adventure-api:4.17.0")
|
compileOnly("net.kyori:adventure-api:4.17.0")
|
||||||
@@ -123,15 +120,21 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runServer {
|
runServer {
|
||||||
minecraftVersion("1.20.6")
|
minecraftVersion("1.21.1")
|
||||||
|
|
||||||
|
downloadPlugins {
|
||||||
|
hangar("PlaceholderAPI", "2.11.6")
|
||||||
|
url("https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/build/libs/ProtocolLib.jar")
|
||||||
|
url("https://download.luckperms.net/1567/bukkit/loader/LuckPerms-Bukkit-5.4.150.jar")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
mergeServiceFiles()
|
mergeServiceFiles()
|
||||||
|
|
||||||
relocate("dev.triumphteam.gui", "com.hisbiscusmc.hmccosmetics.gui")
|
relocate("dev.triumphteam.gui", "com.hibiscusmc.hmccosmetics.shaded.gui")
|
||||||
relocate("com.owen1212055.particlehelper", "com.hisbiscusmc.hmccosmetics.particlehelper")
|
relocate("com.owen1212055.particlehelper", "com.hibiscusmc.hmccosmetics.shaded.particlehelper")
|
||||||
relocate("com.ticxo.playeranimator", "com.hisbiscusmc.hmccosmetics.playeranimator")
|
relocate("com.ticxo.playeranimator", "com.hibiscusmc.hmccosmetics.shaded.playeranimator")
|
||||||
archiveFileName.set("HMCCosmeticsRemapped-${project.version}.jar")
|
archiveFileName.set("HMCCosmeticsRemapped-${project.version}.jar")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -156,7 +159,7 @@ tasks {
|
|||||||
bukkit {
|
bukkit {
|
||||||
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
|
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
|
||||||
main = "com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin"
|
main = "com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin"
|
||||||
apiVersion = "1.19"
|
apiVersion = "1.20"
|
||||||
authors = listOf("LoJoSho")
|
authors = listOf("LoJoSho")
|
||||||
depend = listOf("HibiscusCommons", "ProtocolLib")
|
depend = listOf("HibiscusCommons", "ProtocolLib")
|
||||||
softDepend = listOf("ModelEngine", "Oraxen", "ItemsAdder", "Geary", "HMCColor", "WorldGuard", "MythicMobs", "PlaceholderAPI", "SuperVanish", "PremiumVanish", "LibsDisguises", "Denizen", "MMOItems", "Eco")
|
softDepend = listOf("ModelEngine", "Oraxen", "ItemsAdder", "Geary", "HMCColor", "WorldGuard", "MythicMobs", "PlaceholderAPI", "SuperVanish", "PremiumVanish", "LibsDisguises", "Denizen", "MMOItems", "Eco")
|
||||||
@@ -260,3 +263,23 @@ java {
|
|||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getGitCommitHash(): String {
|
||||||
|
var includeHash = true
|
||||||
|
val includeHashVariable = System.getenv("HMCC_INCLUDE_HASH")
|
||||||
|
|
||||||
|
if (!includeHashVariable.isNullOrEmpty()) includeHash = includeHashVariable.toBoolean()
|
||||||
|
|
||||||
|
if (includeHash) {
|
||||||
|
return try {
|
||||||
|
val process = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
|
||||||
|
.redirectErrorStream(true)
|
||||||
|
.start()
|
||||||
|
|
||||||
|
process.inputStream.bufferedReader().use { "-" + it.readLine().trim() }
|
||||||
|
} catch (e: Exception) {
|
||||||
|
"-unknown" // Fallback if Git is not available or an error occurs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGListener;
|
|||||||
import com.hibiscusmc.hmccosmetics.listener.PaperPlayerGameListener;
|
import com.hibiscusmc.hmccosmetics.listener.PaperPlayerGameListener;
|
||||||
import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener;
|
import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener;
|
||||||
import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener;
|
import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener;
|
||||||
|
import com.hibiscusmc.hmccosmetics.listener.ServerListener;
|
||||||
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;
|
||||||
@@ -94,6 +95,7 @@ public final class HMCCosmeticsPlugin extends HibiscusPlugin {
|
|||||||
// Listener
|
// Listener
|
||||||
getServer().getPluginManager().registerEvents(new PlayerConnectionListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerConnectionListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(new PlayerGameListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerGameListener(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new ServerListener(), this);
|
||||||
// Taken from PaperLib
|
// Taken from PaperLib
|
||||||
if (HibiscusCommonsPlugin.isOnPaper()) {
|
if (HibiscusCommonsPlugin.isOnPaper()) {
|
||||||
getServer().getPluginManager().registerEvents(new PaperPlayerGameListener(), this);
|
getServer().getPluginManager().registerEvents(new PaperPlayerGameListener(), this);
|
||||||
|
|||||||
@@ -43,10 +43,14 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
|
||||||
boolean silent = false;
|
boolean silent = false;
|
||||||
|
boolean console = false;
|
||||||
|
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
console = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if (!(sender instanceof Player)) {
|
if (console) {
|
||||||
// Console
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!sender.hasPermission("hmccosmetics.cmd.default")) {
|
if (!sender.hasPermission("hmccosmetics.cmd.default")) {
|
||||||
@@ -140,7 +144,7 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
|
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
|
|
||||||
if (!user.canEquipCosmetic(cosmetic)) {
|
if (!user.canEquipCosmetic(cosmetic) && !console) {
|
||||||
if (!silent) MessagesUtil.sendMessage(player, "no-cosmetic-permission");
|
if (!silent) MessagesUtil.sendMessage(player, "no-cosmetic-permission");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -247,12 +251,16 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
// cosmetic menu exampleMenu playerName
|
// cosmetic menu exampleMenu playerName
|
||||||
case ("menu") -> {
|
case ("menu") -> {
|
||||||
if (args.length == 1) return true;
|
|
||||||
if (!sender.hasPermission("hmccosmetics.cmd.menu")) {
|
if (!sender.hasPermission("hmccosmetics.cmd.menu")) {
|
||||||
if (!silent) MessagesUtil.sendMessage(sender, "no-permission");
|
if (!silent) MessagesUtil.sendMessage(sender, "no-permission");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Menu menu = Menus.getMenu(args[1]);
|
Menu menu;
|
||||||
|
if (args.length == 1) {
|
||||||
|
menu = Menus.getDefaultMenu();
|
||||||
|
} else {
|
||||||
|
menu = Menus.getMenu(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
if (sender instanceof Player) player = ((Player) sender).getPlayer();
|
if (sender instanceof Player) player = ((Player) sender).getPlayer();
|
||||||
if (sender.hasPermission("hmccosmetics.cmd.menu.other")) {
|
if (sender.hasPermission("hmccosmetics.cmd.menu.other")) {
|
||||||
@@ -334,7 +342,7 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
Wardrobe wardrobe = WardrobeSettings.getWardrobe(args[1]);
|
Wardrobe wardrobe = WardrobeSettings.getWardrobe(args[1]);
|
||||||
if (wardrobe == null) {
|
if (wardrobe == null) {
|
||||||
wardrobe = new Wardrobe(args[1], new WardrobeLocation(null, null, null), null, -1);
|
wardrobe = new Wardrobe(args[1], new WardrobeLocation(null, null, null), null, -1, null);
|
||||||
WardrobeSettings.addWardrobe(wardrobe);
|
WardrobeSettings.addWardrobe(wardrobe);
|
||||||
//MessagesUtil.sendMessage(player, "no-wardrobes");
|
//MessagesUtil.sendMessage(player, "no-wardrobes");
|
||||||
//return true;
|
//return true;
|
||||||
|
|||||||
@@ -30,11 +30,15 @@ public class Settings {
|
|||||||
private static final String UNAPPLY_DEATH_PATH = "unapply-on-death";
|
private static final String UNAPPLY_DEATH_PATH = "unapply-on-death";
|
||||||
private static final String FORCE_PERMISSION_JOIN_PATH = "force-permission-join";
|
private static final String FORCE_PERMISSION_JOIN_PATH = "force-permission-join";
|
||||||
private static final String FORCE_SHOW_COSMETICS_PATH = "force-show-join";
|
private static final String FORCE_SHOW_COSMETICS_PATH = "force-show-join";
|
||||||
|
private static final String ITEM_PROCESSING_PATH = "item-processing";
|
||||||
|
private static final String ITEM_PROCESS_DISPLAY_NAME_PATH = "display-name";
|
||||||
|
private static final String ITEM_PROCESS_LORE_PATH = "lore";
|
||||||
private static final String DISABLED_GAMEMODE_PATH = "disabled-gamemode";
|
private static final String DISABLED_GAMEMODE_PATH = "disabled-gamemode";
|
||||||
private static final String DISABLED_GAMEMODE_GAMEMODES_PATH = "gamemodes";
|
private static final String DISABLED_GAMEMODE_GAMEMODES_PATH = "gamemodes";
|
||||||
private static final String EMOTE_DISTANCE_PATH = "emote-distance";
|
private static final String EMOTE_DISTANCE_PATH = "emote-distance";
|
||||||
private static final String HOOK_SETTING_PATH = "hook-settings";
|
private static final String HOOK_SETTING_PATH = "hook-settings";
|
||||||
private static final String HOOK_ITEMADDER_PATH = "itemsadder";
|
private static final String HOOK_ITEMADDER_PATH = "itemsadder";
|
||||||
|
private static final String HOOK_NEXO_PATH = "nexo";
|
||||||
private static final String HOOK_RELOAD_CHANGE_PATH = "reload-on-change";
|
private static final String HOOK_RELOAD_CHANGE_PATH = "reload-on-change";
|
||||||
private static final String HOOK_WORLDGUARD_PATH = "worldguard";
|
private static final String HOOK_WORLDGUARD_PATH = "worldguard";
|
||||||
private static final String HOOK_WG_MOVE_CHECK_PATH = "player-move-check";
|
private static final String HOOK_WG_MOVE_CHECK_PATH = "player-move-check";
|
||||||
@@ -88,8 +92,14 @@ public class Settings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static boolean forceShowOnJoin;
|
private static boolean forceShowOnJoin;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static boolean itemProcessingDisplayName;
|
||||||
|
@Getter
|
||||||
|
private static boolean itemProcessingLore;
|
||||||
|
@Getter
|
||||||
private static boolean itemsAdderChangeReload;
|
private static boolean itemsAdderChangeReload;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static boolean nexoChangeReload;
|
||||||
|
@Getter
|
||||||
private static boolean worldGuardMoveCheck;
|
private static boolean worldGuardMoveCheck;
|
||||||
@Getter
|
@Getter
|
||||||
private static boolean cosmeticEmoteBlockCheck;
|
private static boolean cosmeticEmoteBlockCheck;
|
||||||
@@ -185,6 +195,10 @@ public class Settings {
|
|||||||
disabledWorlds = new ArrayList<>();
|
disabledWorlds = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigurationNode itemProcessingSettings = cosmeticSettings.node(ITEM_PROCESSING_PATH);
|
||||||
|
itemProcessingDisplayName = itemProcessingSettings.node(ITEM_PROCESS_DISPLAY_NAME_PATH).getBoolean(true);
|
||||||
|
itemProcessingLore = itemProcessingSettings.node(ITEM_PROCESS_LORE_PATH).getBoolean(true);
|
||||||
|
|
||||||
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);
|
||||||
@@ -246,9 +260,13 @@ public class Settings {
|
|||||||
dyeMenuOutputSlot = dyeMenuSettings.node(DYE_MENU_OUTPUT_SLOT).getInt(25);
|
dyeMenuOutputSlot = dyeMenuSettings.node(DYE_MENU_OUTPUT_SLOT).getInt(25);
|
||||||
|
|
||||||
ConfigurationNode hookSettings = source.node(HOOK_SETTING_PATH);
|
ConfigurationNode hookSettings = source.node(HOOK_SETTING_PATH);
|
||||||
|
|
||||||
ConfigurationNode itemsAdderSettings = hookSettings.node(HOOK_ITEMADDER_PATH);
|
ConfigurationNode itemsAdderSettings = hookSettings.node(HOOK_ITEMADDER_PATH);
|
||||||
itemsAdderChangeReload = itemsAdderSettings.node(HOOK_RELOAD_CHANGE_PATH).getBoolean(false);
|
itemsAdderChangeReload = itemsAdderSettings.node(HOOK_RELOAD_CHANGE_PATH).getBoolean(false);
|
||||||
|
|
||||||
|
ConfigurationNode nexoSettings = hookSettings.node(HOOK_NEXO_PATH);
|
||||||
|
nexoChangeReload = nexoSettings.node(HOOK_RELOAD_CHANGE_PATH).getBoolean(true);
|
||||||
|
|
||||||
ConfigurationNode worldGuardSettings = hookSettings.node(HOOK_WORLDGUARD_PATH);
|
ConfigurationNode worldGuardSettings = hookSettings.node(HOOK_WORLDGUARD_PATH);
|
||||||
worldGuardMoveCheck = worldGuardSettings.node(HOOK_WG_MOVE_CHECK_PATH).getBoolean(true);
|
worldGuardMoveCheck = worldGuardSettings.node(HOOK_WG_MOVE_CHECK_PATH).getBoolean(true);
|
||||||
// I messed up in release 2.2.6 and forgot to change player_move_check to player-move-check.
|
// I messed up in release 2.2.6 and forgot to change player_move_check to player-move-check.
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ public class Wardrobe {
|
|||||||
private final String id;
|
private final String id;
|
||||||
@Getter @Setter
|
@Getter @Setter
|
||||||
private int distance;
|
private int distance;
|
||||||
@Getter @Setter
|
@Getter @Setter @Nullable
|
||||||
private String permission;
|
private String permission;
|
||||||
@Getter @Setter
|
@Getter @Setter
|
||||||
private WardrobeLocation location;
|
private WardrobeLocation location;
|
||||||
|
@Getter @Setter @Nullable
|
||||||
|
private String defaultMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This creates a Wardrobe object with all the information that a user will need when entering.
|
* This creates a Wardrobe object with all the information that a user will need when entering.
|
||||||
@@ -25,12 +27,14 @@ public class Wardrobe {
|
|||||||
* @param location The 3 locations of the Wardrobe, if any of these 3 locations are null, the wardrobe will not work
|
* @param location The 3 locations of the Wardrobe, if any of these 3 locations are null, the wardrobe will not work
|
||||||
* @param permission The permission required to enter the wardrobe, if null, no permission is required
|
* @param permission The permission required to enter the wardrobe, if null, no permission is required
|
||||||
* @param distance The distance from the wardrobe that the player can be to enter, if -1, the player can enter from any distance
|
* @param distance The distance from the wardrobe that the player can be to enter, if -1, the player can enter from any distance
|
||||||
|
* @param defaultMenu The default menu that the player will open when entering the wardrobe.
|
||||||
*/
|
*/
|
||||||
public Wardrobe(@NotNull String id, @NotNull WardrobeLocation location, @Nullable String permission, int distance) {
|
public Wardrobe(@NotNull String id, @NotNull WardrobeLocation location, @Nullable String permission, int distance, @Nullable String defaultMenu) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
if (permission != null) this.permission = permission;
|
if (permission != null) this.permission = permission;
|
||||||
|
if (defaultMenu != null) this.defaultMenu = defaultMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class WardrobeSettings {
|
|||||||
private static final String WARDROBES_PATH = "wardrobes";
|
private static final String WARDROBES_PATH = "wardrobes";
|
||||||
private static final String PERMISSION_PATH = "permission";
|
private static final String PERMISSION_PATH = "permission";
|
||||||
private static final String DISTANCE_PATH = "distance";
|
private static final String DISTANCE_PATH = "distance";
|
||||||
|
private static final String WARDROBE_DEFAULT_MENU = "default-menu";
|
||||||
private static final String BOSSBAR_PATH = "bossbar";
|
private static final String BOSSBAR_PATH = "bossbar";
|
||||||
private static final String BOSSBAR_ENABLE_PATH = "enabled";
|
private static final String BOSSBAR_ENABLE_PATH = "enabled";
|
||||||
private static final String BOSSBAR_TEXT_PATH = "text";
|
private static final String BOSSBAR_TEXT_PATH = "text";
|
||||||
@@ -174,9 +175,10 @@ public class WardrobeSettings {
|
|||||||
WardrobeLocation wardrobeLocation = new WardrobeLocation(npcLocation, viewerLocation, leaveLocation);
|
WardrobeLocation wardrobeLocation = new WardrobeLocation(npcLocation, viewerLocation, leaveLocation);
|
||||||
|
|
||||||
String permission = wardrobesNode.node(PERMISSION_PATH).getString();
|
String permission = wardrobesNode.node(PERMISSION_PATH).getString();
|
||||||
|
String defaultMenu = wardrobesNode.node(WARDROBE_DEFAULT_MENU).getString();
|
||||||
int distance = wardrobesNode.node(DISTANCE_PATH).getInt(-1);
|
int distance = wardrobesNode.node(DISTANCE_PATH).getInt(-1);
|
||||||
|
|
||||||
Wardrobe wardrobe = new Wardrobe(id, wardrobeLocation, permission, distance);
|
Wardrobe wardrobe = new Wardrobe(id, wardrobeLocation, permission, distance, defaultMenu);
|
||||||
addWardrobe(wardrobe);
|
addWardrobe(wardrobe);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessagesUtil.sendDebugMessages("Unable to create wardrobe " + id, Level.SEVERE);
|
MessagesUtil.sendDebugMessages("Unable to create wardrobe " + id, Level.SEVERE);
|
||||||
|
|||||||
@@ -22,7 +22,12 @@ public class CosmeticArmorType extends Cosmetic {
|
|||||||
public CosmeticArmorType(String id, ConfigurationNode config) {
|
public CosmeticArmorType(String id, ConfigurationNode config) {
|
||||||
super(id, config);
|
super(id, config);
|
||||||
|
|
||||||
this.equipSlot = HMCCInventoryUtils.getEquipmentSlot(getSlot());
|
EquipmentSlot slot = HMCCInventoryUtils.getEquipmentSlot(getSlot());
|
||||||
|
if (slot == null) {
|
||||||
|
// Hypothetically it shouldn't be null, but it was happening on some random servers? Adding this just in case
|
||||||
|
throw new IllegalArgumentException("Invalid slot for cosmetic armor type: " + getSlot() + " in " + id + " cosmetic config.");
|
||||||
|
}
|
||||||
|
this.equipSlot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,6 +57,7 @@ public class CosmeticArmorType extends Cosmetic {
|
|||||||
return cosmeticItem;
|
return cosmeticItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public EquipmentSlot getEquipSlot() {
|
public EquipmentSlot getEquipSlot() {
|
||||||
return this.equipSlot;
|
return this.equipSlot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
//else NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, firstPersonBackpack, owner);
|
//else NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, firstPersonBackpack, owner);
|
||||||
PacketManager.equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, firstPersonBackpack), owner);
|
PacketManager.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getUserBackpackManager().showBackpack();
|
user.getUserBackpackManager().showBackpack();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import lombok.Getter;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Database {
|
public class Database {
|
||||||
@@ -56,7 +57,7 @@ public class Database {
|
|||||||
data.save(CosmeticUsers.getUser(player));
|
data.save(CosmeticUsers.getUser(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CosmeticUser get(UUID uniqueId) {
|
public static CompletableFuture<UserData> get(UUID uniqueId) {
|
||||||
return data.get(uniqueId);
|
return data.get(uniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.hibiscusmc.hmccosmetics.database;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
|
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||||
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class UserData {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private UUID owner;
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
private HashMap<CosmeticSlot, Map.Entry<Cosmetic, Integer>> cosmetics;
|
||||||
|
@Getter
|
||||||
|
private ArrayList<CosmeticUser.HiddenReason> hiddenReasons;
|
||||||
|
|
||||||
|
public UserData(UUID owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
this.cosmetics = new HashMap<>();
|
||||||
|
this.hiddenReasons = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCosmetic(CosmeticSlot slot, Cosmetic cosmetic, Integer color) {
|
||||||
|
cosmetics.put(slot, Map.entry(cosmetic, color));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addHiddenReason(CosmeticUser.HiddenReason reason) {
|
||||||
|
hiddenReasons.add(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.hibiscusmc.hmccosmetics.config.Settings;
|
|||||||
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.database.UserData;
|
||||||
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 org.apache.commons.lang3.EnumUtils;
|
import org.apache.commons.lang3.EnumUtils;
|
||||||
@@ -14,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public abstract class Data {
|
public abstract class Data {
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ public abstract class Data {
|
|||||||
public abstract void save(CosmeticUser user);
|
public abstract void save(CosmeticUser user);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public abstract CosmeticUser get(UUID uniqueId);
|
public abstract CompletableFuture<UserData> get(UUID uniqueId);
|
||||||
|
|
||||||
public abstract void clear(UUID uniqueId);
|
public abstract void clear(UUID uniqueId);
|
||||||
|
|
||||||
@@ -48,13 +50,9 @@ public abstract class Data {
|
|||||||
return data.toString();
|
return data.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Map<CosmeticSlot, Map<Cosmetic, Color>> deserializeData(CosmeticUser user, @NotNull String raw) {
|
|
||||||
return deserializeData(user, raw, Settings.isForcePermissionJoin());
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public final Map<CosmeticSlot, Map<Cosmetic, Color>> deserializeData(CosmeticUser user, @NotNull String raw, boolean permissionCheck) {
|
public final HashMap<CosmeticSlot, Map.Entry<Cosmetic, Integer>> deserializeData(@NotNull String raw) {
|
||||||
Map<CosmeticSlot, Map<Cosmetic, Color>> cosmetics = new HashMap<>();
|
HashMap<CosmeticSlot, Map.Entry<Cosmetic, Integer>> cosmetics = new HashMap<>();
|
||||||
|
|
||||||
String[] rawData = raw.split(",");
|
String[] rawData = raw.split(",");
|
||||||
ArrayList<CosmeticUser.HiddenReason> hiddenReason = new ArrayList<>();
|
ArrayList<CosmeticUser.HiddenReason> hiddenReason = new ArrayList<>();
|
||||||
@@ -76,59 +74,14 @@ public abstract class Data {
|
|||||||
String[] colorSplitData = splitData[1].split("&");
|
String[] colorSplitData = splitData[1].split("&");
|
||||||
if (Cosmetics.hasCosmetic(colorSplitData[0])) cosmetic = Cosmetics.getCosmetic(colorSplitData[0]);
|
if (Cosmetics.hasCosmetic(colorSplitData[0])) cosmetic = Cosmetics.getCosmetic(colorSplitData[0]);
|
||||||
if (slot == null || cosmetic == null) continue;
|
if (slot == null || cosmetic == null) continue;
|
||||||
if (permissionCheck && cosmetic.requiresPermission()) {
|
cosmetics.put(slot, Map.entry(cosmetic, Integer.parseInt(colorSplitData[1])));
|
||||||
if (user.getPlayer() != null && !user.getPlayer().hasPermission(cosmetic.getPermission())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cosmetics.put(slot, Map.of(cosmetic, Color.fromRGB(Integer.parseInt(colorSplitData[1]))));
|
|
||||||
} else {
|
} else {
|
||||||
if (Cosmetics.hasCosmetic(splitData[1])) cosmetic = Cosmetics.getCosmetic(splitData[1]);
|
if (Cosmetics.hasCosmetic(splitData[1])) cosmetic = Cosmetics.getCosmetic(splitData[1]);
|
||||||
if (slot == null || cosmetic == null) continue;
|
if (slot == null || cosmetic == null) continue;
|
||||||
if (permissionCheck && cosmetic.requiresPermission()) {
|
cosmetics.put(slot, Map.entry(cosmetic, -1));
|
||||||
if (user.getPlayer() != null && !user.getPlayer().hasPermission(cosmetic.getPermission())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<Cosmetic, Color> cosmeticColorHashMap = new HashMap<>();
|
|
||||||
cosmeticColorHashMap.put(cosmetic, null);
|
|
||||||
cosmetics.put(slot, cosmeticColorHashMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("Hidden Reason: " + hiddenReason);
|
|
||||||
// if else this, if else that, if else I got to deal with this anymore i'll lose my mind
|
|
||||||
if (!hiddenReason.isEmpty()) {
|
|
||||||
for (CosmeticUser.HiddenReason reason : hiddenReason) user.silentlyAddHideFlag(reason);
|
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
|
||||||
// Handle gamemode check
|
|
||||||
if (user.getPlayer() != null && Settings.isDisabledGamemodesEnabled() && Settings.getDisabledGamemodes().contains(user.getPlayer().getGameMode().toString())) {
|
|
||||||
MessagesUtil.sendDebugMessages("Hiding Cosmetics due to gamemode");
|
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.GAMEMODE);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (user.isHidden(CosmeticUser.HiddenReason.GAMEMODE)) {
|
|
||||||
MessagesUtil.sendDebugMessages("Join Gamemode Check: Showing Cosmetics");
|
|
||||||
user.showCosmetics(CosmeticUser.HiddenReason.GAMEMODE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle world check
|
|
||||||
if (user.getPlayer() != null && Settings.getDisabledWorlds().contains(user.getPlayer().getWorld().getName())) {
|
|
||||||
MessagesUtil.sendDebugMessages("Hiding Cosmetics due to world");
|
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.WORLD);
|
|
||||||
} else {
|
|
||||||
if (user.isHidden(CosmeticUser.HiddenReason.WORLD)) {
|
|
||||||
MessagesUtil.sendDebugMessages("Join World Check: Showing Cosmetics");
|
|
||||||
user.showCosmetics(CosmeticUser.HiddenReason.WORLD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Settings.isAllPlayersHidden()) {
|
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.DISABLED);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return cosmetics;
|
return cosmetics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.database.types;
|
package com.hibiscusmc.hmccosmetics.database.types;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.database.UserData;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class NoneData extends Data {
|
public class NoneData extends Data {
|
||||||
@Override
|
@Override
|
||||||
@@ -17,8 +19,8 @@ public class NoneData extends Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable CosmeticUser get(UUID uniqueId) {
|
public @Nullable CompletableFuture<UserData> get(UUID uniqueId) {
|
||||||
return new CosmeticUser(uniqueId);
|
return CompletableFuture.completedFuture(new UserData(uniqueId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.database.types;
|
|||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
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.database.UserData;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@@ -13,14 +14,15 @@ import java.sql.SQLException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public abstract class SQLData extends Data {
|
public abstract class SQLData extends Data {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"resource"}) // Duplicate is from deprecated InternalData
|
@SuppressWarnings({"resource"}) // Duplicate is from deprecated InternalData
|
||||||
public CosmeticUser get(UUID uniqueId) {
|
public CompletableFuture<UserData> get(UUID uniqueId) {
|
||||||
CosmeticUser user = new CosmeticUser(uniqueId);
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
UserData data = new UserData(uniqueId);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(HMCCosmeticsPlugin.getInstance(), () -> {
|
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
try {
|
try {
|
||||||
preparedStatement = preparedStatement("SELECT * FROM COSMETICDATABASE WHERE UUID = ?;");
|
preparedStatement = preparedStatement("SELECT * FROM COSMETICDATABASE WHERE UUID = ?;");
|
||||||
@@ -28,21 +30,8 @@ public abstract class SQLData extends Data {
|
|||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
String rawData = rs.getString("COSMETICS");
|
String rawData = rs.getString("COSMETICS");
|
||||||
Map<CosmeticSlot, Map<Cosmetic, Color>> cosmetics = deserializeData(user, rawData);
|
HashMap<CosmeticSlot, Map.Entry<Cosmetic, Integer>> cosmetics = deserializeData(rawData);
|
||||||
// Load cosmetics, put them into the addedCosmetic hashmap
|
data.setCosmetics(cosmetics);
|
||||||
HashMap<Cosmetic, Color> addedCosmetics = new HashMap<>();
|
|
||||||
for (Map<Cosmetic, Color> cosmeticColors : cosmetics.values()) {
|
|
||||||
for (Cosmetic cosmetic : cosmeticColors.keySet()) {
|
|
||||||
addedCosmetics.put(cosmetic, cosmeticColors.get(cosmetic));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Run a task on the main thread, adding the cosmetics to the player
|
|
||||||
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
|
||||||
// This can not be async.
|
|
||||||
for (Cosmetic cosmetic : addedCosmetics.keySet()) {
|
|
||||||
user.addPlayerCosmetic(cosmetic, addedCosmetics.get(cosmetic));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -51,9 +40,8 @@ public abstract class SQLData extends Data {
|
|||||||
if (preparedStatement != null) preparedStatement.close();
|
if (preparedStatement != null) preparedStatement.close();
|
||||||
} catch (SQLException e) {}
|
} catch (SQLException e) {}
|
||||||
}
|
}
|
||||||
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -128,8 +128,9 @@ public class TypeCosmetic extends Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack setItem(CosmeticUser user, @NotNull ConfigurationNode config, ItemStack itemStack, int slot) {
|
public ItemStack setItem(@NotNull CosmeticUser user, @NotNull ConfigurationNode config, @NotNull ItemStack itemStack, int slot) {
|
||||||
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
if (itemStack.hasItemMeta()) itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||||
|
else MessagesUtil.sendDebugMessages("ItemStack has no ItemMeta?");
|
||||||
|
|
||||||
if (config.node("cosmetic").virtual()) {
|
if (config.node("cosmetic").virtual()) {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
@@ -153,7 +154,8 @@ public class TypeCosmetic extends Type {
|
|||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
if (itemStack.hasItemMeta()) itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||||
|
else MessagesUtil.sendDebugMessages("ItemStack has no ItemMeta in equipped item?");
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +172,8 @@ public class TypeCosmetic extends Type {
|
|||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
if (itemStack.hasItemMeta()) itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||||
|
else MessagesUtil.sendDebugMessages("ItemStack has no ItemMeta in locked item?");
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
return itemStack;
|
return itemStack;
|
||||||
@@ -193,7 +196,7 @@ public class TypeCosmetic extends Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (itemMeta instanceof SkullMeta skullMeta) {
|
if (itemMeta instanceof SkullMeta skullMeta) {
|
||||||
if (skullMeta.hasOwner()) {
|
if (skullMeta.hasOwner() && skullMeta.getOwner() != null) {
|
||||||
skullMeta.setOwner(Hooks.processPlaceholders(user.getPlayer(), skullMeta.getOwner()));
|
skullMeta.setOwner(Hooks.processPlaceholders(user.getPlayer(), skullMeta.getOwner()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class TypeEmpty extends Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (itemMeta instanceof SkullMeta skullMeta) {
|
if (itemMeta instanceof SkullMeta skullMeta) {
|
||||||
if (skullMeta.hasOwner()) {
|
if (skullMeta.hasOwner() && skullMeta.getOwner() != null) {
|
||||||
skullMeta.setOwner(Hooks.processPlaceholders(user.getPlayer(), skullMeta.getOwner()));
|
skullMeta.setOwner(Hooks.processPlaceholders(user.getPlayer(), skullMeta.getOwner()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
|||||||
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import com.hibiscusmc.hmccosmetics.database.Database;
|
import com.hibiscusmc.hmccosmetics.database.Database;
|
||||||
|
import com.hibiscusmc.hmccosmetics.database.UserData;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
@@ -17,6 +18,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerConnectionListener implements Listener {
|
public class PlayerConnectionListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@@ -33,17 +36,24 @@ public class PlayerConnectionListener implements Listener {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This literally makes me want to end it all but I can't do that so I'll just cry instead
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
if (!event.getPlayer().isOnline()) return; // If a player is no longer online, don't run this.
|
if (!event.getPlayer().isOnline()) return; // If a player is no longer online, don't run this.
|
||||||
CosmeticUser user = Database.get(event.getPlayer().getUniqueId());
|
UUID uuid = event.getPlayer().getUniqueId();
|
||||||
CosmeticUsers.addUser(user);
|
Database.get(uuid).thenAccept(data -> {
|
||||||
MessagesUtil.sendDebugMessages("Run User Join");
|
if (data == null) return;
|
||||||
|
Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||||
|
CosmeticUser cosmeticUser = new CosmeticUser(uuid, data);
|
||||||
|
CosmeticUsers.addUser(cosmeticUser);
|
||||||
|
MessagesUtil.sendDebugMessages("Run User Join for " + uuid);
|
||||||
|
|
||||||
// And finally, launch an update for the cosmetics they have.
|
// And finally, launch an update for the cosmetics they have.
|
||||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||||
if (user.getPlayer() == null) return;
|
if (cosmeticUser.getPlayer() == null) return;
|
||||||
user.updateCosmetic();
|
cosmeticUser.updateCosmetic();
|
||||||
}, 4);
|
}, 4);
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (DatabaseSettings.isEnabledDelay()) {
|
if (DatabaseSettings.isEnabledDelay()) {
|
||||||
|
|||||||
@@ -25,10 +25,13 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserWardrobeManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserWardrobeManager;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
||||||
|
import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import me.lojosho.hibiscuscommons.api.events.*;
|
import me.lojosho.hibiscuscommons.api.events.*;
|
||||||
|
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||||
import me.lojosho.hibiscuscommons.hooks.items.HookItemAdder;
|
import me.lojosho.hibiscuscommons.hooks.items.HookItemAdder;
|
||||||
|
import me.lojosho.hibiscuscommons.hooks.items.HookNexo;
|
||||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -66,6 +69,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
registerPlayerArmListener();
|
registerPlayerArmListener();
|
||||||
registerEntityUseListener();
|
registerEntityUseListener();
|
||||||
registerSlotChangeListener();
|
registerSlotChangeListener();
|
||||||
|
registerPassengerSetListener();
|
||||||
|
|
||||||
//registerLookMovement();
|
//registerLookMovement();
|
||||||
//registerMoveListener();
|
//registerMoveListener();
|
||||||
@@ -379,6 +383,10 @@ public class PlayerGameListener implements Listener {
|
|||||||
public void onPlayerCosmeticEquip(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)) {
|
||||||
|
if (user.getBalloonManager() == null) {
|
||||||
|
MessagesUtil.sendDebugMessages("Balloon Manager is null? " + user.getEntity().getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
CosmeticBalloonType cosmetic = (CosmeticBalloonType) event.getCosmetic();
|
CosmeticBalloonType cosmetic = (CosmeticBalloonType) event.getCosmetic();
|
||||||
Location npclocation = user.getWardrobeManager().getNpcLocation().clone().add(cosmetic.getBalloonOffset());
|
Location npclocation = user.getWardrobeManager().getNpcLocation().clone().add(cosmetic.getBalloonOffset());
|
||||||
// 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
|
||||||
@@ -425,21 +433,6 @@ public class PlayerGameListener implements Listener {
|
|||||||
user.showCosmetics(CosmeticUser.HiddenReason.PLUGIN);
|
user.showCosmetics(CosmeticUser.HiddenReason.PLUGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
||||||
public void onHookReload(HibiscusHookReload event) {
|
|
||||||
if (event.getHook() instanceof HookItemAdder hook) {
|
|
||||||
switch (event.getReloadType()) {
|
|
||||||
case INITIAL -> {
|
|
||||||
HMCCosmeticsPlugin.setup();
|
|
||||||
}
|
|
||||||
case RELOAD -> {
|
|
||||||
if (!Settings.isItemsAdderChangeReload()) return;
|
|
||||||
HMCCosmeticsPlugin.setup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// These emote mostly handles emotes from other plugins, such as ItemsAdder
|
// These emote mostly handles emotes from other plugins, such as ItemsAdder
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerPlayEmote(HibiscusPlayerEmotePlayEvent event) {
|
public void onPlayerPlayEmote(HibiscusPlayerEmotePlayEvent event) {
|
||||||
@@ -455,6 +448,22 @@ public class PlayerGameListener implements Listener {
|
|||||||
user.showCosmetics(CosmeticUser.HiddenReason.EMOTE);
|
user.showCosmetics(CosmeticUser.HiddenReason.EMOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
public void onPlayerHibiscusPose(HibiscusPlayerPoseEvent event) {
|
||||||
|
if (event.isGettingUp()) return;
|
||||||
|
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer());
|
||||||
|
if (user == null) return;
|
||||||
|
user.hideCosmetics(CosmeticUser.HiddenReason.PLUGIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
public void onPlayerHibiscusGetUpPose(HibiscusPlayerPoseEvent event) {
|
||||||
|
if (!event.isGettingUp()) return;
|
||||||
|
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer());
|
||||||
|
if (user == null) return;
|
||||||
|
user.showCosmetics(CosmeticUser.HiddenReason.PLUGIN);
|
||||||
|
}
|
||||||
|
|
||||||
private void registerInventoryClickListener() {
|
private void registerInventoryClickListener() {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.WINDOW_CLICK) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.WINDOW_CLICK) {
|
||||||
@Override
|
@Override
|
||||||
@@ -585,6 +594,7 @@ public class PlayerGameListener implements Listener {
|
|||||||
switch (pair.getFirst()) {
|
switch (pair.getFirst()) {
|
||||||
case MAINHAND -> {
|
case MAINHAND -> {
|
||||||
if (user.getPlayer() == event.getPlayer()) continue; // When a player scrolls real fast, it messes up the mainhand. This fixes it
|
if (user.getPlayer() == event.getPlayer()) continue; // When a player scrolls real fast, it messes up the mainhand. This fixes it
|
||||||
|
if (user.getPlayer() != null && user.getPlayer().isInvisible()) continue; // Fixes integration with GSit still showing mainhand even when hidden
|
||||||
armor.set(i, new Pair<>(pair.getFirst(), user.getPlayer().getInventory().getItemInMainHand()));
|
armor.set(i, new Pair<>(pair.getFirst(), user.getPlayer().getInventory().getItemInMainHand()));
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
@@ -630,6 +640,37 @@ public class PlayerGameListener implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerPassengerSetListener() {
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.MOUNT) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
CosmeticUser viewerUser = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
||||||
|
if (viewerUser == null) return;
|
||||||
|
if (viewerUser.isInWardrobe()) return;
|
||||||
|
|
||||||
|
int ownerId = event.getPacket().getIntegers().read(0);
|
||||||
|
MessagesUtil.sendDebugMessages("Mount Packet Sent - Read - EntityID: " + ownerId);
|
||||||
|
Entity entity = HMCCServerUtils.getEntity(ownerId);
|
||||||
|
if (entity == null) return;
|
||||||
|
|
||||||
|
CosmeticUser user = CosmeticUsers.getUser(entity.getUniqueId());
|
||||||
|
if (user == null) return;
|
||||||
|
MessagesUtil.sendDebugMessages("Mount Packet Sent - " + user.getUniqueId());
|
||||||
|
|
||||||
|
if (!user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) return;
|
||||||
|
if (user.getUserBackpackManager() == null) return;
|
||||||
|
|
||||||
|
// Basically, take the original passengers and "bump" them to the end of the list
|
||||||
|
int[] originalPassengers = event.getPacket().getIntegerArrays().read(0);
|
||||||
|
List<Integer> passengers = new ArrayList<>(user.getUserBackpackManager().getEntityManager().getIds());
|
||||||
|
|
||||||
|
passengers.addAll(Arrays.stream(originalPassengers).boxed().toList());
|
||||||
|
|
||||||
|
event.getPacket().getIntegerArrays().write(0, passengers.stream().mapToInt(Integer::intValue).toArray());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void registerPlayerArmListener() {
|
private void registerPlayerArmListener() {
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.ARM_ANIMATION) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.ARM_ANIMATION) {
|
||||||
@Override
|
@Override
|
||||||
@@ -719,10 +760,6 @@ public class PlayerGameListener implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private EquipmentSlot getArmorSlot(final Material material) {
|
private EquipmentSlot getArmorSlot(final Material material) {
|
||||||
for (final EquipmentSlot slot : EquipmentSlot.values()) {
|
for (final EquipmentSlot slot : EquipmentSlot.values()) {
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.hibiscusmc.hmccosmetics.listener;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
|
import me.lojosho.hibiscuscommons.api.events.HibiscusHookReload;
|
||||||
|
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||||
|
import me.lojosho.hibiscuscommons.hooks.items.HookItemAdder;
|
||||||
|
import me.lojosho.hibiscuscommons.hooks.items.HookNexo;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class ServerListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onHookReload(HibiscusHookReload event) {
|
||||||
|
Hook hook = event.getHook();
|
||||||
|
if (hook instanceof HookItemAdder) {
|
||||||
|
switch (event.getReloadType()) {
|
||||||
|
case INITIAL -> {
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
}
|
||||||
|
case RELOAD -> {
|
||||||
|
if (!Settings.isItemsAdderChangeReload()) return;
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hook instanceof HookNexo) {
|
||||||
|
switch (event.getReloadType()) {
|
||||||
|
case INITIAL -> {
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
}
|
||||||
|
case RELOAD -> {
|
||||||
|
if (!Settings.isNexoChangeReload()) return;
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
|||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticMainhandType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticMainhandType;
|
||||||
|
import com.hibiscusmc.hmccosmetics.database.UserData;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserBackpackManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserBackpackManager;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserBalloonManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserBalloonManager;
|
||||||
@@ -38,6 +39,7 @@ 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;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -59,6 +61,8 @@ public class CosmeticUser {
|
|||||||
// Cosmetic Settings/Toggles
|
// Cosmetic Settings/Toggles
|
||||||
private final ArrayList<HiddenReason> hiddenReason = new ArrayList<>();
|
private final ArrayList<HiddenReason> hiddenReason = new ArrayList<>();
|
||||||
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
||||||
|
// Cosmetic caches
|
||||||
|
private final HashMap<String, ItemStack> cosmeticItems = new HashMap<>();
|
||||||
|
|
||||||
public CosmeticUser(UUID uuid) {
|
public CosmeticUser(UUID uuid) {
|
||||||
this.uniqueId = uuid;
|
this.uniqueId = uuid;
|
||||||
@@ -66,6 +70,13 @@ public class CosmeticUser {
|
|||||||
tick();
|
tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CosmeticUser(UUID uuid, UserData data) {
|
||||||
|
this.uniqueId = uuid;
|
||||||
|
userEmoteManager = new UserEmoteManager(this);
|
||||||
|
loadData(data);
|
||||||
|
tick();
|
||||||
|
}
|
||||||
|
|
||||||
private void tick() {
|
private void tick() {
|
||||||
// Occasionally updates the entity cosmetics
|
// Occasionally updates the entity cosmetics
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
@@ -87,6 +98,54 @@ public class CosmeticUser {
|
|||||||
despawnBalloon();
|
despawnBalloon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadData(@NotNull UserData data) {
|
||||||
|
boolean permissionCheck = Settings.isForcePermissionJoin();
|
||||||
|
|
||||||
|
for (Map.Entry<CosmeticSlot, Map.Entry<Cosmetic, Integer>> entry : data.getCosmetics().entrySet()) {
|
||||||
|
Cosmetic cosmetic = entry.getValue().getKey();
|
||||||
|
Color color = entry.getValue().getValue() == -1 ? null : Color.fromRGB(entry.getValue().getValue());
|
||||||
|
|
||||||
|
if (permissionCheck && cosmetic.requiresPermission()) {
|
||||||
|
if (getPlayer() != null && !getPlayer().hasPermission(cosmetic.getPermission())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addPlayerCosmetic(cosmetic, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hiddenReason.isEmpty()) {
|
||||||
|
for (CosmeticUser.HiddenReason reason : hiddenReason) silentlyAddHideFlag(reason);
|
||||||
|
} else {
|
||||||
|
for (HiddenReason reason : data.getHiddenReasons()) {
|
||||||
|
if (getPlayer() != null && Settings.isDisabledGamemodesEnabled() && Settings.getDisabledGamemodes().contains(getPlayer().getGameMode().toString())) {
|
||||||
|
MessagesUtil.sendDebugMessages("Hiding Cosmetics due to gamemode");
|
||||||
|
hideCosmetics(CosmeticUser.HiddenReason.GAMEMODE);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (isHidden(CosmeticUser.HiddenReason.GAMEMODE)) {
|
||||||
|
MessagesUtil.sendDebugMessages("Join Gamemode Check: Showing Cosmetics");
|
||||||
|
showCosmetics(CosmeticUser.HiddenReason.GAMEMODE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Handle world check
|
||||||
|
if (getPlayer() != null && Settings.getDisabledWorlds().contains(getPlayer().getWorld().getName())) {
|
||||||
|
MessagesUtil.sendDebugMessages("Hiding Cosmetics due to world");
|
||||||
|
hideCosmetics(CosmeticUser.HiddenReason.WORLD);
|
||||||
|
} else {
|
||||||
|
if (isHidden(CosmeticUser.HiddenReason.WORLD)) {
|
||||||
|
MessagesUtil.sendDebugMessages("Join World Check: Showing Cosmetics");
|
||||||
|
showCosmetics(CosmeticUser.HiddenReason.WORLD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Settings.isAllPlayersHidden()) {
|
||||||
|
hideCosmetics(CosmeticUser.HiddenReason.DISABLED);
|
||||||
|
}
|
||||||
|
silentlyAddHideFlag(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Cosmetic getCosmetic(CosmeticSlot slot) {
|
public Cosmetic getCosmetic(CosmeticSlot slot) {
|
||||||
return playerCosmetics.get(slot);
|
return playerCosmetics.get(slot);
|
||||||
}
|
}
|
||||||
@@ -95,11 +154,11 @@ public class CosmeticUser {
|
|||||||
return ImmutableList.copyOf(playerCosmetics.values());
|
return ImmutableList.copyOf(playerCosmetics.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayerCosmetic(Cosmetic cosmetic) {
|
public void addPlayerCosmetic(@NotNull Cosmetic cosmetic) {
|
||||||
addPlayerCosmetic(cosmetic, null);
|
addPlayerCosmetic(cosmetic, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayerCosmetic(Cosmetic cosmetic, Color color) {
|
public void addPlayerCosmetic(@NotNull Cosmetic cosmetic, @Nullable Color color) {
|
||||||
// API
|
// API
|
||||||
PlayerCosmeticEquipEvent event = new PlayerCosmeticEquipEvent(this, cosmetic);
|
PlayerCosmeticEquipEvent event = new PlayerCosmeticEquipEvent(this, cosmetic);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
@@ -221,7 +280,7 @@ public class CosmeticUser {
|
|||||||
return getUserCosmeticItem(cosmetic);
|
return getUserCosmeticItem(cosmetic);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getUserCosmeticItem(Cosmetic cosmetic) {
|
public ItemStack getUserCosmeticItem(@NotNull Cosmetic cosmetic) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if (!hiddenReason.isEmpty()) {
|
if (!hiddenReason.isEmpty()) {
|
||||||
if (cosmetic instanceof CosmeticBackpackType || cosmetic instanceof CosmeticBalloonType) return new ItemStack(Material.AIR);
|
if (cosmetic instanceof CosmeticBackpackType || cosmetic instanceof CosmeticBalloonType) return new ItemStack(Material.AIR);
|
||||||
@@ -244,7 +303,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public ItemStack getUserCosmeticItem(Cosmetic cosmetic, ItemStack item) {
|
public ItemStack getUserCosmeticItem(@NotNull Cosmetic cosmetic, @Nullable ItemStack item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
//MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
//MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
||||||
return new ItemStack(Material.AIR);
|
return new ItemStack(Material.AIR);
|
||||||
@@ -275,18 +334,22 @@ public class CosmeticUser {
|
|||||||
itemMeta = skullMeta;
|
itemMeta = skullMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> processedLore = new ArrayList<>();
|
if (Settings.isItemProcessingDisplayName()) {
|
||||||
|
if (itemMeta.hasDisplayName()) {
|
||||||
if (itemMeta.hasLore()) {
|
String displayName = itemMeta.getDisplayName();
|
||||||
for (String loreLine : itemMeta.getLore()) {
|
itemMeta.setDisplayName(Hooks.processPlaceholders(getPlayer(), displayName));
|
||||||
processedLore.add(Hooks.processPlaceholders(getPlayer(), loreLine));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itemMeta.hasDisplayName()) {
|
if (Settings.isItemProcessingLore()) {
|
||||||
String displayName = itemMeta.getDisplayName();
|
List<String> processedLore = new ArrayList<>();
|
||||||
itemMeta.setDisplayName(Hooks.processPlaceholders(getPlayer(), displayName));
|
if (itemMeta.hasLore()) {
|
||||||
|
for (String loreLine : itemMeta.getLore()) {
|
||||||
|
processedLore.add(Hooks.processPlaceholders(getPlayer(), loreLine));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemMeta.setLore(processedLore);
|
||||||
}
|
}
|
||||||
itemMeta.setLore(processedLore);
|
|
||||||
|
|
||||||
if (colors.containsKey(cosmetic.getSlot())) {
|
if (colors.containsKey(cosmetic.getSlot())) {
|
||||||
Color color = colors.get(cosmetic.getSlot());
|
Color color = colors.get(cosmetic.getSlot());
|
||||||
@@ -323,7 +386,7 @@ public class CosmeticUser {
|
|||||||
return userWardrobeManager;
|
return userWardrobeManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterWardrobe(boolean ignoreDistance, Wardrobe wardrobe) {
|
public void enterWardrobe(boolean ignoreDistance, @NotNull 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");
|
||||||
return;
|
return;
|
||||||
@@ -424,10 +487,6 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
public void despawnBalloon() {
|
public void despawnBalloon() {
|
||||||
if (this.userBalloonManager == null) return;
|
if (this.userBalloonManager == null) return;
|
||||||
List<Player> sentTo = HMCCPlayerUtils.getNearbyPlayers(getEntity().getLocation());
|
|
||||||
|
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(userBalloonManager.getPufferfishBalloonId(), sentTo);
|
|
||||||
|
|
||||||
this.userBalloonManager.remove();
|
this.userBalloonManager.remove();
|
||||||
this.userBalloonManager = null;
|
this.userBalloonManager = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.ticxo.modelengine.api.ModelEngineAPI;
|
|||||||
import com.ticxo.modelengine.api.entity.data.BukkitEntityData;
|
import com.ticxo.modelengine.api.entity.data.BukkitEntityData;
|
||||||
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 com.ticxo.modelengine.api.nms.RenderParsers;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.lojosho.hibiscuscommons.hooks.Hooks;
|
import me.lojosho.hibiscuscommons.hooks.Hooks;
|
||||||
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||||
@@ -30,16 +31,17 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class UserBalloonManager {
|
public class UserBalloonManager {
|
||||||
|
|
||||||
private CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
@Getter
|
@Getter
|
||||||
private BalloonType balloonType;
|
private BalloonType balloonType;
|
||||||
private CosmeticBalloonType cosmeticBalloonType;
|
private CosmeticBalloonType cosmeticBalloonType;
|
||||||
@Getter
|
@Getter
|
||||||
private UserBalloonPufferfish pufferfish;
|
private UserBalloonPufferfish pufferfish;
|
||||||
private final ArmorStand modelEntity;
|
private final ArmorStand modelEntity;
|
||||||
|
|
||||||
public UserBalloonManager(CosmeticUser user, @NotNull Location location) {
|
public UserBalloonManager(CosmeticUser user, @NotNull Location location) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.pufferfish = new UserBalloonPufferfish(user.getUniqueId(), NMSHandlers.getHandler().getNextEntityId(), UUID.randomUUID());
|
this.pufferfish = new UserBalloonPufferfish(user.getUniqueId(), NMSHandlers.getHandler().getUtilHandler().getNextEntityId(), UUID.randomUUID());
|
||||||
this.modelEntity = location.getWorld().spawn(location, ArmorStand.class, (e) -> {
|
this.modelEntity = location.getWorld().spawn(location, ArmorStand.class, (e) -> {
|
||||||
e.setInvisible(true);
|
e.setInvisible(true);
|
||||||
e.setGravity(false);
|
e.setGravity(false);
|
||||||
@@ -82,7 +84,7 @@ public class UserBalloonManager {
|
|||||||
modeledEntity.getModels().forEach((d, singleModel) -> {
|
modeledEntity.getModels().forEach((d, singleModel) -> {
|
||||||
if (cosmeticBalloonType.isDyablePart(d)) {
|
if (cosmeticBalloonType.isDyablePart(d)) {
|
||||||
singleModel.setDefaultTint(color);
|
singleModel.setDefaultTint(color);
|
||||||
singleModel.getModelRenderer().sendToClient();
|
singleModel.getModelRenderer().sendToClient(ModelEngineAPI.getNMSHandler().createParsers());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -98,6 +100,7 @@ public class UserBalloonManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
public void remove() {
|
||||||
|
pufferfish.destroyPufferfish();
|
||||||
if (balloonType == BalloonType.MODELENGINE) {
|
if (balloonType == BalloonType.MODELENGINE) {
|
||||||
final ModeledEntity entity = ModelEngineAPI.getModeledEntity(modelEntity);
|
final ModeledEntity entity = ModelEngineAPI.getModeledEntity(modelEntity);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
@@ -156,6 +159,7 @@ public class UserBalloonManager {
|
|||||||
public int getPufferfishBalloonId() {
|
public int getPufferfishBalloonId() {
|
||||||
return pufferfish.getPufferFishEntityId();
|
return pufferfish.getPufferFishEntityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getPufferfishBalloonUniqueId() {
|
public UUID getPufferfishBalloonUniqueId() {
|
||||||
return pufferfish.getUuid();
|
return pufferfish.getUuid();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ package com.hibiscusmc.hmccosmetics.user.manager;
|
|||||||
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.HMCCPlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
||||||
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -14,8 +17,11 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class UserBalloonPufferfish extends UserEntity {
|
public class UserBalloonPufferfish extends UserEntity {
|
||||||
|
|
||||||
private int pufferFishEntityId;
|
@Getter
|
||||||
private UUID uuid;
|
private final int pufferFishEntityId;
|
||||||
|
@Getter
|
||||||
|
private final UUID uuid;
|
||||||
|
private boolean destroyed = false;
|
||||||
|
|
||||||
public UserBalloonPufferfish(UUID owner, int pufferFishEntityId, UUID uuid) {
|
public UserBalloonPufferfish(UUID owner, int pufferFishEntityId, UUID uuid) {
|
||||||
super(owner);
|
super(owner);
|
||||||
@@ -23,14 +29,6 @@ public class UserBalloonPufferfish extends UserEntity {
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPufferFishEntityId() {
|
|
||||||
return pufferFishEntityId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hidePufferfish() {
|
public void hidePufferfish() {
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, getViewers());
|
HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, getViewers());
|
||||||
getViewers().clear();
|
getViewers().clear();
|
||||||
@@ -41,35 +39,15 @@ public class UserBalloonPufferfish extends UserEntity {
|
|||||||
HMCCPacketManager.sendInvisibilityPacket(pufferFishEntityId, sendTo);
|
HMCCPacketManager.sendInvisibilityPacket(pufferFishEntityId, sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void destroyPufferfish() {
|
||||||
|
HMCCPacketManager.sendEntityDestroyPacket(pufferFishEntityId, getViewers());
|
||||||
|
getViewers().clear();
|
||||||
|
destroyed = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Player> refreshViewers(Location location) {
|
public List<Player> refreshViewers(Location location) {
|
||||||
if (System.currentTimeMillis() - getViewerLastUpdate() <= 1000) return List.of(); //Prevents mass refreshes
|
if (destroyed) return List.of(); //Prevents refreshing a destroyed entity
|
||||||
ArrayList<Player> newPlayers = new ArrayList<>();
|
return super.refreshViewers(location);
|
||||||
ArrayList<Player> removePlayers = new ArrayList<>();
|
|
||||||
List<Player> players = HMCCPlayerUtils.getNearbyPlayers(location);
|
|
||||||
|
|
||||||
for (Player player : players) {
|
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
|
||||||
if (user != null && getOwner() != user.getUniqueId() && user.isInWardrobe()) { // Fixes issue where players in wardrobe would see other players cosmetics if they were not in wardrobe
|
|
||||||
removePlayers.add(player);
|
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(getPufferFishEntityId(), List.of(player));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!getViewers().contains(player)) {
|
|
||||||
getViewers().add(player);
|
|
||||||
newPlayers.add(player);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// bad loopdy loops
|
|
||||||
for (Player viewerPlayer : getViewers()) {
|
|
||||||
if (!players.contains(viewerPlayer)) {
|
|
||||||
removePlayers.add(viewerPlayer);
|
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(getPufferFishEntityId(), List.of(viewerPlayer));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getViewers().removeAll(removePlayers);
|
|
||||||
setViewerLastUpdate(System.currentTimeMillis());
|
|
||||||
return newPlayers;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import com.hibiscusmc.hmccosmetics.config.Settings;
|
|||||||
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.HMCCPlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
||||||
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -42,10 +44,15 @@ public class UserEntity {
|
|||||||
ArrayList<Player> newPlayers = new ArrayList<>();
|
ArrayList<Player> newPlayers = new ArrayList<>();
|
||||||
ArrayList<Player> removePlayers = new ArrayList<>();
|
ArrayList<Player> removePlayers = new ArrayList<>();
|
||||||
List<Player> players = HMCCPlayerUtils.getNearbyPlayers(location);
|
List<Player> players = HMCCPlayerUtils.getNearbyPlayers(location);
|
||||||
|
Player ownerPlayer = Bukkit.getPlayer(owner);
|
||||||
|
if (ownerPlayer == null) {
|
||||||
|
MessagesUtil.sendDebugMessages("Owner is null (refreshViewers), returning empty list");
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
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
|
if (user != null && owner != user.getUniqueId() && user.isInWardrobe() && !player.canSee(ownerPlayer)) { // Fixes issue where players in wardrobe would see other players cosmetics if they were not in wardrobe
|
||||||
removePlayers.add(player);
|
removePlayers.add(player);
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(ids, List.of(player));
|
HMCCPacketManager.sendEntityDestroyPacket(ids, List.of(player));
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -83,8 +83,11 @@ public class UserWardrobeManager {
|
|||||||
this.viewingLocation = wardrobeLocation.getViewerLocation();
|
this.viewingLocation = wardrobeLocation.getViewerLocation();
|
||||||
this.npcLocation = wardrobeLocation.getNpcLocation();
|
this.npcLocation = wardrobeLocation.getNpcLocation();
|
||||||
|
|
||||||
|
String defaultMenu = wardrobe.getDefaultMenu();
|
||||||
|
if (defaultMenu != null && Menus.hasMenu(defaultMenu)) this.lastOpenMenu = Menus.getMenu(defaultMenu);
|
||||||
|
else this.lastOpenMenu = Menus.getDefaultMenu();
|
||||||
|
|
||||||
wardrobeStatus = WardrobeStatus.SETUP;
|
wardrobeStatus = WardrobeStatus.SETUP;
|
||||||
this.lastOpenMenu = Menus.getDefaultMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
@@ -129,7 +132,7 @@ public class UserWardrobeManager {
|
|||||||
HMCCPacketManager.sendFakePlayerSpawnPacket(npcLocation, WARDROBE_UUID, NPC_ID, viewer);
|
HMCCPacketManager.sendFakePlayerSpawnPacket(npcLocation, WARDROBE_UUID, NPC_ID, viewer);
|
||||||
HMCCPacketManager.sendPlayerOverlayPacket(NPC_ID, viewer);
|
HMCCPacketManager.sendPlayerOverlayPacket(NPC_ID, viewer);
|
||||||
MessagesUtil.sendDebugMessages("Spawned Fake Player on " + npcLocation);
|
MessagesUtil.sendDebugMessages("Spawned Fake Player on " + npcLocation);
|
||||||
NMSHandlers.getHandler().hideNPCName(player, npcName);
|
NMSHandlers.getHandler().getPacketHandler().sendScoreboardHideNamePacket(player, npcName);
|
||||||
}, 4);
|
}, 4);
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class HMCCServerUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static org.bukkit.entity.Entity getEntity(int entityId) {
|
public static org.bukkit.entity.Entity getEntity(int entityId) {
|
||||||
return NMSHandlers.getHandler().getEntity(entityId);
|
return NMSHandlers.getHandler().getUtilHandler().getEntity(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ cosmetic-settings:
|
|||||||
force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server.
|
force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server.
|
||||||
force-show-join: false # If the plugin should force show a player's cosmetics when they join the server.
|
force-show-join: false # If the plugin should force show a player's cosmetics when they join the server.
|
||||||
|
|
||||||
|
# This determines what to process what areas to process placeholders when displaying the item to the user.
|
||||||
|
# This can be heavy on servers with a lot of players, so if experiencing lag issues relating to setting display/lores of items, disable this.
|
||||||
|
item-processing:
|
||||||
|
display-name: true
|
||||||
|
lore: true
|
||||||
|
|
||||||
# This is a list of worlds that cosmetics are hidden in. When a player enters one of these worlds, their cosmetics will be hidden.
|
# This is a list of worlds that cosmetics are hidden in. When a player enters one of these worlds, their cosmetics will be hidden.
|
||||||
disabled-worlds:
|
disabled-worlds:
|
||||||
- "disabledworld"
|
- "disabledworld"
|
||||||
@@ -123,6 +129,9 @@ hook-settings:
|
|||||||
# This causes the plugin to reload itself after any ItemsAdder change. This keeps the plugin fully up to date with IA, but
|
# This causes the plugin to reload itself after any ItemsAdder change. This keeps the plugin fully up to date with IA, but
|
||||||
# could cause console spam as HMCCosmetics has to reload itself as well.
|
# could cause console spam as HMCCosmetics has to reload itself as well.
|
||||||
reload-on-change: false
|
reload-on-change: false
|
||||||
|
nexo:
|
||||||
|
# This causes the plugin to reload itself after any Nexo change. This keeps the plugin fully up to date with Nexo
|
||||||
|
reload-on-change: true
|
||||||
worldguard:
|
worldguard:
|
||||||
# Checks worldguard regions for HMCC flags. If set to false, flags will not work properly.
|
# Checks worldguard regions for HMCC flags. If set to false, flags will not work properly.
|
||||||
# Requires restart to apply changes.
|
# Requires restart to apply changes.
|
||||||
@@ -168,6 +177,7 @@ wardrobe:
|
|||||||
default:
|
default:
|
||||||
distance: -1 # Distance in blocks that a player can interact with the wardrobe. -1 to ignore.
|
distance: -1 # Distance in blocks that a player can interact with the wardrobe. -1 to ignore.
|
||||||
permission: "hmccosmetics.wardrobe.default" # Permission required to use the wardrobe.
|
permission: "hmccosmetics.wardrobe.default" # Permission required to use the wardrobe.
|
||||||
|
default-menu: defaultmenu
|
||||||
npc-location:
|
npc-location:
|
||||||
world: "world"
|
world: "world"
|
||||||
x: 0
|
x: 0
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
Reference in New Issue
Block a user