mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-22 16:39:21 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b00c79f67b | ||
|
|
0528ebfa84 | ||
|
|
1e0ffdc08b | ||
|
|
cc08cc6537 | ||
|
|
455b8cd1a1 | ||
|
|
5c6bb93e6c | ||
|
|
e9c7946319 | ||
|
|
fcde8e7f25 | ||
|
|
7fcbbd6b5a | ||
|
|
a92b4c15f5 | ||
|
|
7439aabfd1 | ||
|
|
50bda8343c | ||
|
|
c189424aa8 | ||
|
|
70b97667c3 | ||
|
|
128a33a21f | ||
|
|
538edb67dd | ||
|
|
9b607a099e | ||
|
|
f084d9e782 | ||
|
|
8ee1400f85 | ||
|
|
8e33b2022b | ||
|
|
a661ea09e1 | ||
|
|
9c2120d13d | ||
|
|
7ea4ccccef | ||
|
|
0b1ed0fbeb | ||
|
|
0aac0a2377 | ||
|
|
04810b91ef | ||
|
|
f072f0e044 | ||
|
|
6e2278f4f0 | ||
|
|
7c95d9614d | ||
|
|
54e8e5102a | ||
|
|
b270d022d4 | ||
|
|
f087933d48 | ||
|
|
ed1d1515bc | ||
|
|
aa364f5e77 | ||
|
|
5ae6d17ef3 | ||
|
|
4590bdcde1 | ||
|
|
f9465e8206 | ||
|
|
cd3a9f1af4 | ||
|
|
853668ff1b | ||
|
|
e2ee55bab4 | ||
|
|
7a13715897 | ||
|
|
d92e3e4616 | ||
|
|
49023ff701 | ||
|
|
1bd405d13e |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.3.1"
|
version = "2.4.0"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
@@ -27,6 +27,7 @@ allprojects {
|
|||||||
// ProtocolLib repo
|
// ProtocolLib repo
|
||||||
maven("https://repo.dmulloy2.net/repository/public/") //ProtocolLib Repo, constantly down
|
maven("https://repo.dmulloy2.net/repository/public/") //ProtocolLib Repo, constantly down
|
||||||
maven("https://repo.mineinabyss.com/releases/")
|
maven("https://repo.mineinabyss.com/releases/")
|
||||||
|
maven("https://repo.mineinabyss.com/snapshots/")
|
||||||
|
|
||||||
// PlaceholderAPI
|
// PlaceholderAPI
|
||||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
@@ -69,14 +70,12 @@ allprojects {
|
|||||||
compileOnly("com.mojang:authlib:1.5.25")
|
compileOnly("com.mojang:authlib:1.5.25")
|
||||||
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.1")
|
compileOnly("me.clip:placeholderapi:2.11.1")
|
||||||
compileOnly("com.ticxo.modelengine:api:R3.0.1")
|
compileOnly("com.ticxo:modelengine:R3.0.1")
|
||||||
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
||||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
||||||
compileOnly("com.mineinabyss:idofront:0.12.111")
|
compileOnly("com.mineinabyss:geary-papermc:0.24-SNAPSHOT")
|
||||||
compileOnly("com.mineinabyss:geary-papermc-core:0.19.113")
|
|
||||||
compileOnly("com.mineinabyss:looty:0.8.67")
|
|
||||||
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.6-4")
|
compileOnly("com.github.LeonMangler:SuperVanish:6.2.6-4")
|
||||||
@@ -101,6 +100,7 @@ dependencies {
|
|||||||
implementation("com.jeff_media:SpigotUpdateChecker:3.0.0")
|
implementation("com.jeff_media:SpigotUpdateChecker:3.0.0")
|
||||||
implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT")
|
implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT")
|
||||||
implementation("com.ticxo:PlayerAnimator:R1.2.6")
|
implementation("com.ticxo:PlayerAnimator:R1.2.6")
|
||||||
|
implementation("com.github.BG-Software-LLC:CommentedConfiguration:-SNAPSHOT")
|
||||||
//implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5")
|
//implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +142,7 @@ tasks {
|
|||||||
relocate("com.jeff_media.updatechecker", "com.hisbiscusmc.hmccosmetics.updatechecker")
|
relocate("com.jeff_media.updatechecker", "com.hisbiscusmc.hmccosmetics.updatechecker")
|
||||||
relocate("com.owen1212055.particlehelper", "com.hisbiscusmc.hmccosmetics.particlehelper")
|
relocate("com.owen1212055.particlehelper", "com.hisbiscusmc.hmccosmetics.particlehelper")
|
||||||
relocate("com.ticxo.playeranimator", "com.hisbiscusmc.hmccosmetics.playeranimator")
|
relocate("com.ticxo.playeranimator", "com.hisbiscusmc.hmccosmetics.playeranimator")
|
||||||
|
relocate("com.bgsoftware", "com.hisbiscusmc.hmccosmetics.configupdater")
|
||||||
archiveFileName.set("HMCCosmeticsRemapped-${project.version}.jar")
|
archiveFileName.set("HMCCosmeticsRemapped-${project.version}.jar")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -169,7 +170,7 @@ bukkit {
|
|||||||
apiVersion = "1.17"
|
apiVersion = "1.17"
|
||||||
authors = listOf("LoJoSho")
|
authors = listOf("LoJoSho")
|
||||||
depend = listOf("ProtocolLib")
|
depend = listOf("ProtocolLib")
|
||||||
softDepend = listOf("ModelEngine", "Oraxen", "ItemsAdder", "Looty", "HMCColor", "WorldGuard", "MythicMobs", "PlaceholderAPI", "SuperVanish", "PremiumVanish", "LibsDisguises", "Denizen")
|
softDepend = listOf("ModelEngine", "Oraxen", "ItemsAdder", "Geary", "HMCColor", "WorldGuard", "MythicMobs", "PlaceholderAPI", "SuperVanish", "PremiumVanish", "LibsDisguises", "Denizen")
|
||||||
version = "${project.version}"
|
version = "${project.version}"
|
||||||
|
|
||||||
commands {
|
commands {
|
||||||
@@ -211,7 +212,7 @@ bukkit {
|
|||||||
register("hmccosmetics.cmd.emote.other") {
|
register("hmccosmetics.cmd.emote.other") {
|
||||||
default = BukkitPluginDescription.Permission.Default.OP
|
default = BukkitPluginDescription.Permission.Default.OP
|
||||||
}
|
}
|
||||||
register("hmccosmetics.cmd.setlocation") {
|
register("hmccosmetics.cmd.setwardrobesetting") {
|
||||||
default = BukkitPluginDescription.Permission.Default.OP
|
default = BukkitPluginDescription.Permission.Default.OP
|
||||||
}
|
}
|
||||||
register("hmccosmetics.cmd.dataclear") {
|
register("hmccosmetics.cmd.dataclear") {
|
||||||
@@ -256,4 +257,4 @@ bukkit {
|
|||||||
java {
|
java {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17
|
toolchain.languageVersion.set(JavaLanguageVersion.of(17
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ dependencies {
|
|||||||
compileOnly("com.mojang:authlib:1.5.25")
|
compileOnly("com.mojang:authlib:1.5.25")
|
||||||
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.1")
|
compileOnly("me.clip:placeholderapi:2.11.1")
|
||||||
compileOnly("com.ticxo.modelengine:api:R3.0.1")
|
compileOnly("com.ticxo:modelengine:R3.0.1")
|
||||||
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
|
||||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.2.5")
|
||||||
compileOnly("com.mineinabyss:geary-papermc-core:0.19.113")
|
compileOnly("com.mineinabyss:geary-papermc:0.24-SNAPSHOT")
|
||||||
compileOnly("com.mineinabyss:looty:0.8.67")
|
|
||||||
compileOnly("com.hibiscus:hmccolor:0.3-SNAPSHOT")
|
compileOnly("com.hibiscus:hmccolor:0.3-SNAPSHOT")
|
||||||
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")
|
||||||
@@ -34,6 +33,7 @@ dependencies {
|
|||||||
implementation("com.jeff_media:SpigotUpdateChecker:3.0.0")
|
implementation("com.jeff_media:SpigotUpdateChecker:3.0.0")
|
||||||
implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT")
|
implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT")
|
||||||
implementation("com.ticxo:PlayerAnimator:R1.2.6")
|
implementation("com.ticxo:PlayerAnimator:R1.2.6")
|
||||||
|
implementation("com.github.BG-Software-LLC:CommentedConfiguration:-SNAPSHOT")
|
||||||
//implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5")
|
//implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.hibiscusmc.hmccosmetics;
|
package com.hibiscusmc.hmccosmetics;
|
||||||
|
|
||||||
|
import com.bgsoftware.common.config.CommentedConfiguration;
|
||||||
import com.hibiscusmc.hmccosmetics.api.HMCCosmeticSetupEvent;
|
import com.hibiscusmc.hmccosmetics.api.HMCCosmeticSetupEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.command.CosmeticCommand;
|
import com.hibiscusmc.hmccosmetics.command.CosmeticCommand;
|
||||||
import com.hibiscusmc.hmccosmetics.command.CosmeticCommandTabComplete;
|
import com.hibiscusmc.hmccosmetics.command.CosmeticCommandTabComplete;
|
||||||
@@ -12,6 +13,7 @@ import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
|||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||||
import com.hibiscusmc.hmccosmetics.database.Database;
|
import com.hibiscusmc.hmccosmetics.database.Database;
|
||||||
import com.hibiscusmc.hmccosmetics.emotes.EmoteManager;
|
import com.hibiscusmc.hmccosmetics.emotes.EmoteManager;
|
||||||
|
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
import com.hibiscusmc.hmccosmetics.hooks.Hooks;
|
import com.hibiscusmc.hmccosmetics.hooks.Hooks;
|
||||||
import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGHook;
|
import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGHook;
|
||||||
@@ -86,13 +88,12 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
|||||||
.checkNow();
|
.checkNow();
|
||||||
onLatestVersion = checker.isUsingLatestVersion();
|
onLatestVersion = checker.isUsingLatestVersion();
|
||||||
// File setup
|
// File setup
|
||||||
if (!getDataFolder().exists()) {
|
saveDefaultConfig();
|
||||||
saveDefaultConfig();
|
//saveResource("translations.yml", false);
|
||||||
//saveResource("translations.yml", false);
|
if (!Path.of(getDataFolder().getPath(), "messages.yml").toFile().exists()) saveResource("messages.yml", false);
|
||||||
saveResource("messages.yml", false);
|
if (!Path.of(getDataFolder().getPath() + "/cosmetics/").toFile().exists()) saveResource("cosmetics/defaultcosmetics.yml", false);
|
||||||
saveResource("cosmetics/defaultcosmetics.yml", false);
|
if (!Path.of(getDataFolder().getPath() + "/menus/").toFile().exists()) saveResource("menus/defaultmenu.yml", false);
|
||||||
saveResource("menus/defaultmenu.yml", false);
|
|
||||||
}
|
|
||||||
// Emote folder setup
|
// Emote folder setup
|
||||||
File emoteFile = new File(getDataFolder().getPath() + "/emotes");
|
File emoteFile = new File(getDataFolder().getPath() + "/emotes");
|
||||||
if (!emoteFile.exists()) emoteFile.mkdir();
|
if (!emoteFile.exists()) emoteFile.mkdir();
|
||||||
@@ -100,6 +101,16 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
|||||||
// Player Animator
|
// Player Animator
|
||||||
PlayerAnimatorImpl.initialize(this);
|
PlayerAnimatorImpl.initialize(this);
|
||||||
|
|
||||||
|
// Configuration Sync
|
||||||
|
final File configFile = Path.of(getInstance().getDataFolder().getPath(), "config.yml").toFile();
|
||||||
|
final File messageFile = Path.of(getInstance().getDataFolder().getPath(), "messages.yml").toFile();
|
||||||
|
try {
|
||||||
|
CommentedConfiguration.loadConfiguration(configFile).syncWithConfig(configFile, getInstance().getResource("config.yml"),
|
||||||
|
"database-settings", "debug-mode", "wardrobe.viewer-location", "wardrobe.npc-location", "wardrobe.wardrobe-location", "wardrobe.leave-location");
|
||||||
|
CommentedConfiguration.loadConfiguration(messageFile).syncWithConfig(messageFile, getInstance().getResource("messages.yml"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
|
// Setup
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
@@ -170,7 +181,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
|||||||
WardrobeSettings.load(loader.load().node("wardrobe"));
|
WardrobeSettings.load(loader.load().node("wardrobe"));
|
||||||
DatabaseSettings.load(loader.load().node("database-settings"));
|
DatabaseSettings.load(loader.load().node("database-settings"));
|
||||||
configLoader = loader;
|
configLoader = loader;
|
||||||
} catch (ConfigurateException e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,12 +247,19 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
|||||||
getInstance().getServer().getPluginManager().addPermission(new Permission(cosmetic.getPermission()));
|
getInstance().getServer().getPluginManager().addPermission(new Permission(cosmetic.getPermission()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Menu menu : Menus.values()) {
|
||||||
|
if (menu.getPermissionNode() != null) {
|
||||||
|
if (getInstance().getServer().getPluginManager().getPermission(menu.getPermissionNode()) != null) continue;
|
||||||
|
getInstance().getServer().getPluginManager().addPermission(new Permission(menu.getPermissionNode()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmoteManager.loadEmotes();
|
EmoteManager.loadEmotes();
|
||||||
|
|
||||||
getInstance().getLogger().info("Successfully Enabled HMCCosmetics");
|
getInstance().getLogger().info("Successfully Enabled HMCCosmetics");
|
||||||
getInstance().getLogger().info(Cosmetics.values().size() + " Cosmetics Successfully Setup");
|
getInstance().getLogger().info(Cosmetics.values().size() + " Cosmetics Successfully Setup");
|
||||||
getInstance().getLogger().info(Menus.getMenuNames().size() + " Menus Successfully Setup");
|
getInstance().getLogger().info(Menus.getMenuNames().size() + " Menus Successfully Setup");
|
||||||
|
getInstance().getLogger().info(WardrobeSettings.getWardrobes().size() + " Wardrobes Successfully Setup");
|
||||||
getInstance().getLogger().info("Data storage is set to " + DatabaseSettings.getDatabaseType());
|
getInstance().getLogger().info("Data storage is set to " + DatabaseSettings.getDatabaseType());
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new HMCCosmeticSetupEvent());
|
Bukkit.getPluginManager().callEvent(new HMCCosmeticSetupEvent());
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.api;
|
package com.hibiscusmc.hmccosmetics.api;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.WardrobeLocation;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -11,9 +13,11 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Cancellable {
|
public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
|
private Wardrobe wardrobe;
|
||||||
|
|
||||||
public PlayerWardrobeEnterEvent(@NotNull CosmeticUser who) {
|
public PlayerWardrobeEnterEvent(@NotNull CosmeticUser who, @NotNull Wardrobe wardrobe) {
|
||||||
super(who);
|
super(who);
|
||||||
|
this.wardrobe = wardrobe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,4 +49,12 @@ public class PlayerWardrobeEnterEvent extends PlayerCosmeticEvent implements Can
|
|||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWardrobe(Wardrobe wardrobe) {
|
||||||
|
this.wardrobe = wardrobe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wardrobe getWardrobe() {
|
||||||
|
return wardrobe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.hibiscusmc.hmccosmetics.command;
|
|||||||
|
|
||||||
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.config.Wardrobe;
|
||||||
|
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;
|
||||||
@@ -194,8 +196,14 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
case ("wardrobe") -> {
|
case ("wardrobe") -> {
|
||||||
if (sender instanceof Player) player = ((Player) sender).getPlayer();
|
if (sender instanceof Player) player = ((Player) sender).getPlayer();
|
||||||
|
|
||||||
|
if (args.length == 1) {
|
||||||
|
if (!silent) MessagesUtil.sendMessage(player, "not-enough-args");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (sender.hasPermission("hmccosmetics.cmd.wardrobe.other")) {
|
if (sender.hasPermission("hmccosmetics.cmd.wardrobe.other")) {
|
||||||
if (args.length >= 2) player = Bukkit.getPlayer(args[1]);
|
if (args.length >= 3) player = Bukkit.getPlayer(args[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sender.hasPermission("hmccosmetics.cmd.wardrobe")) {
|
if (!sender.hasPermission("hmccosmetics.cmd.wardrobe")) {
|
||||||
@@ -208,9 +216,19 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WardrobeSettings.getWardrobeNames().contains(args[1])) {
|
||||||
|
if (!silent) MessagesUtil.sendMessage(sender, "no-wardrobes");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Wardrobe wardrobe = WardrobeSettings.getWardrobe(args[1]);
|
||||||
|
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
|
|
||||||
user.toggleWardrobe();
|
if (user.isInWardrobe()) {
|
||||||
|
user.leaveWardrobe();
|
||||||
|
} else {
|
||||||
|
user.enterWardrobe(false, wardrobe);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// cosmetic menu exampleMenu playerName
|
// cosmetic menu exampleMenu playerName
|
||||||
@@ -289,36 +307,56 @@ public class CosmeticCommand implements CommandExecutor {
|
|||||||
DyeMenu.openMenu(user, cosmetic);
|
DyeMenu.openMenu(user, cosmetic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ("setlocation") -> {
|
case ("setwardrobesetting") -> {
|
||||||
if (!sender.hasPermission("hmccosmetics.cmd.setlocation")) {
|
if (!sender.hasPermission("hmccosmetics.cmd.setwardrobesetting")) {
|
||||||
if (!silent) MessagesUtil.sendMessage(sender, "no-permission");
|
if (!silent) MessagesUtil.sendMessage(sender, "no-permission");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player == null) return true;
|
if (player == null) return true;
|
||||||
|
|
||||||
if (args.length < 2) {
|
if (args.length < 3) {
|
||||||
if (!silent) MessagesUtil.sendMessage(player, "not-enough-args");
|
if (!silent) MessagesUtil.sendMessage(player, "not-enough-args");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Wardrobe wardrobe = WardrobeSettings.getWardrobe(args[1]);
|
||||||
|
if (wardrobe == null) {
|
||||||
|
wardrobe = new Wardrobe(args[1], new WardrobeLocation(null, null, null), null, -1);
|
||||||
|
WardrobeSettings.addWardrobe(wardrobe);
|
||||||
|
//MessagesUtil.sendMessage(player, "no-wardrobes");
|
||||||
|
//return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("wardrobelocation")) {
|
if (args[2].equalsIgnoreCase("npclocation")) {
|
||||||
WardrobeSettings.setWardrobeLocation(player.getLocation());
|
WardrobeSettings.setNPCLocation(wardrobe, player.getLocation());
|
||||||
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-location");
|
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-location");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("viewerlocation")) {
|
if (args[2].equalsIgnoreCase("viewerlocation")) {
|
||||||
WardrobeSettings.setViewerLocation(player.getLocation());
|
WardrobeSettings.setViewerLocation(wardrobe, player.getLocation());
|
||||||
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-viewing");
|
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-viewing");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].equalsIgnoreCase("leavelocation")) {
|
if (args[2].equalsIgnoreCase("leavelocation")) {
|
||||||
WardrobeSettings.setLeaveLocation(player.getLocation());
|
WardrobeSettings.setLeaveLocation(wardrobe, player.getLocation());
|
||||||
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-leaving");
|
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-leaving");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.length >= 4) {
|
||||||
|
if (args[2].equalsIgnoreCase("permission")) {
|
||||||
|
WardrobeSettings.setWardrobePermission(wardrobe, args[3]);
|
||||||
|
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-permission");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args[2].equalsIgnoreCase("distance")) {
|
||||||
|
WardrobeSettings.setWardrobeDistance(wardrobe, Integer.valueOf(args[3]));
|
||||||
|
if (!silent) MessagesUtil.sendMessage(player, "set-wardrobe-distance");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case ("dump") -> {
|
case ("dump") -> {
|
||||||
if (player == null) return true;
|
if (player == null) return true;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.command;
|
package com.hibiscusmc.hmccosmetics.command;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
|
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.Cosmetics;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
|
||||||
@@ -36,7 +38,7 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
|||||||
if (hasPermission(sender, "hmccosmetics.cmd.wardrobe")) completions.add("wardrobe");
|
if (hasPermission(sender, "hmccosmetics.cmd.wardrobe")) completions.add("wardrobe");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.dataclear")) completions.add("dataclear");
|
if (hasPermission(sender, "hmccosmetics.cmd.dataclear")) completions.add("dataclear");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.dye")) completions.add("dye");
|
if (hasPermission(sender, "hmccosmetics.cmd.dye")) completions.add("dye");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.setlocation")) completions.add("setlocation");
|
if (hasPermission(sender, "hmccosmetics.cmd.setwardrobesetting")) completions.add("setwardrobesetting");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.hide")) completions.add("hide");
|
if (hasPermission(sender, "hmccosmetics.cmd.hide")) completions.add("hide");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.show")) completions.add("show");
|
if (hasPermission(sender, "hmccosmetics.cmd.show")) completions.add("show");
|
||||||
if (hasPermission(sender, "hmccosmetics.cmd.debug")) completions.add("debug");
|
if (hasPermission(sender, "hmccosmetics.cmd.debug")) completions.add("debug");
|
||||||
@@ -66,20 +68,29 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
|||||||
if (menu.canOpen(user.getPlayer())) completions.add(menu.getId());
|
if (menu.canOpen(user.getPlayer())) completions.add(menu.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "dataclear", "wardrobe", "hide", "show", "emote" -> {
|
case "dataclear", "hide", "show", "emote" -> {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
completions.add(player.getName());
|
completions.add(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "wardrobe" -> {
|
||||||
|
for (Wardrobe wardrobe : WardrobeSettings.getWardrobes()) {
|
||||||
|
if (wardrobe.hasPermission()) {
|
||||||
|
if (user.getPlayer().hasPermission(wardrobe.getPermission())) completions.add(wardrobe.getId());
|
||||||
|
} else {
|
||||||
|
completions.add(wardrobe.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
case "dye" -> {
|
case "dye" -> {
|
||||||
for (CosmeticSlot slot : user.getDyeableSlots()) {
|
for (CosmeticSlot slot : user.getDyeableSlots()) {
|
||||||
completions.add(slot.name());
|
completions.add(slot.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "setlocation" -> {
|
case "setwardrobesetting" -> {
|
||||||
completions.add("wardrobelocation");
|
for (Wardrobe wardrobe : WardrobeSettings.getWardrobes()) {
|
||||||
completions.add("viewerlocation");
|
completions.add(wardrobe.getId());
|
||||||
completions.add("leavelocation");
|
}
|
||||||
}
|
}
|
||||||
case "playemote" -> completions.addAll(EmoteManager.getAllNames());
|
case "playemote" -> completions.addAll(EmoteManager.getAllNames());
|
||||||
}
|
}
|
||||||
@@ -91,11 +102,18 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
|||||||
case "dye" -> {
|
case "dye" -> {
|
||||||
completions.add("#FFFFFF");
|
completions.add("#FFFFFF");
|
||||||
}
|
}
|
||||||
case "menu", "apply", "unapply", "playemote" -> {
|
case "menu", "wardrobe", "apply", "unapply", "playemote" -> {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
completions.add(player.getName());
|
completions.add(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "setwardrobesetting" -> {
|
||||||
|
completions.add("npclocation");
|
||||||
|
completions.add("viewerlocation");
|
||||||
|
completions.add("leavelocation");
|
||||||
|
completions.add("permission");
|
||||||
|
completions.add("distance");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
StringUtil.copyPartialMatches(args[2], completions, finalCompletions);
|
StringUtil.copyPartialMatches(args[2], completions, finalCompletions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class Settings {
|
|||||||
private static final String HOOK_WG_MOVE_CHECK_PATH = "player-move-check";
|
private static final String HOOK_WG_MOVE_CHECK_PATH = "player-move-check";
|
||||||
private static final String HOOK_WG_MOVE_CHECK_PATH_LEGACY = "player_move_check";
|
private static final String HOOK_WG_MOVE_CHECK_PATH_LEGACY = "player_move_check";
|
||||||
private static final String COSMETIC_EMOTE_CHECK_PATH = "emote-block-check";
|
private static final String COSMETIC_EMOTE_CHECK_PATH = "emote-block-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_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments";
|
private static final String COSMETIC_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments";
|
||||||
@@ -70,6 +71,7 @@ public class Settings {
|
|||||||
private static boolean addChestplateEnchants;
|
private static boolean addChestplateEnchants;
|
||||||
private static boolean addLeggingEnchants;
|
private static boolean addLeggingEnchants;
|
||||||
private static boolean addBootsEnchants;
|
private static boolean addBootsEnchants;
|
||||||
|
private static boolean emoteAirCheck;
|
||||||
private static boolean emoteDamageLeave;
|
private static boolean emoteDamageLeave;
|
||||||
private static boolean emoteInvincible;
|
private static boolean emoteInvincible;
|
||||||
private static boolean destroyLooseCosmetics;
|
private static boolean destroyLooseCosmetics;
|
||||||
@@ -105,6 +107,7 @@ public class Settings {
|
|||||||
forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false);
|
forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false);
|
||||||
emoteDistance = cosmeticSettings.node(EMOTE_DISTANCE_PATH).getDouble(-3);
|
emoteDistance = cosmeticSettings.node(EMOTE_DISTANCE_PATH).getDouble(-3);
|
||||||
cosmeticEmoteBlockCheck = cosmeticSettings.node(COSMETIC_EMOTE_CHECK_PATH).getBoolean(true);
|
cosmeticEmoteBlockCheck = cosmeticSettings.node(COSMETIC_EMOTE_CHECK_PATH).getBoolean(true);
|
||||||
|
emoteAirCheck = cosmeticSettings.node(COSMETIC_EMOTE_AIR_CHECK_PATH).getBoolean(true);
|
||||||
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);
|
||||||
@@ -263,6 +266,10 @@ public class Settings {
|
|||||||
return cosmeticEmoteBlockCheck;
|
return cosmeticEmoteBlockCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean getEmoteAirCheck() {
|
||||||
|
return emoteAirCheck;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isEmoteDamageLeave() {
|
public static boolean isEmoteDamageLeave() {
|
||||||
return emoteDamageLeave;
|
return emoteDamageLeave;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.hibiscusmc.hmccosmetics.config;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class Wardrobe {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private int distance = WardrobeSettings.getDefaultDistance();
|
||||||
|
private String permission;
|
||||||
|
private WardrobeLocation location;
|
||||||
|
|
||||||
|
public Wardrobe(String id, WardrobeLocation location, @Nullable String permission, int distance) {
|
||||||
|
this.id = id;
|
||||||
|
this.location = location;
|
||||||
|
if (permission != null) this.permission = permission;
|
||||||
|
if (distance != -1) this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WardrobeLocation getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistance(int distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermission(String permission) {
|
||||||
|
this.permission = permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPermission() {
|
||||||
|
return permission != null;
|
||||||
|
}
|
||||||
|
public int getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPermission() {
|
||||||
|
return permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(WardrobeLocation location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEnter(CosmeticUser user) {
|
||||||
|
Location wardrobeLocation = location.getNpcLocation();
|
||||||
|
Location location = user.getPlayer().getLocation();
|
||||||
|
if (wardrobeLocation == null) return false;
|
||||||
|
if (distance == -1) return true;
|
||||||
|
if (!wardrobeLocation.getWorld().equals(location.getWorld())) return false;
|
||||||
|
return wardrobeLocation.distanceSquared(location) <= distance * distance;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.hibiscusmc.hmccosmetics.config;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class WardrobeLocation {
|
||||||
|
|
||||||
|
private Location npcLocation;
|
||||||
|
private Location viewerLocation;
|
||||||
|
private Location leaveLocation;
|
||||||
|
|
||||||
|
public WardrobeLocation(Location npcLocation, Location viewerLocation, Location leaveLocation) {
|
||||||
|
this.npcLocation = npcLocation;
|
||||||
|
this.viewerLocation = viewerLocation;
|
||||||
|
this.leaveLocation = leaveLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getNpcLocation() {
|
||||||
|
return npcLocation.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getViewerLocation() {
|
||||||
|
return viewerLocation.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLeaveLocation() {
|
||||||
|
return leaveLocation.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAllLocations() {
|
||||||
|
if (npcLocation == null || viewerLocation == null || leaveLocation == null) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNPCLocation(Location wardrobeLocation) {
|
||||||
|
this.npcLocation = wardrobeLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewerLocation(Location viewerLocation) {
|
||||||
|
this.viewerLocation = viewerLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeaveLocation(Location leaveLocation) {
|
||||||
|
this.leaveLocation = leaveLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,9 @@ import org.apache.commons.lang3.EnumUtils;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.spongepowered.configurate.ConfigurationNode;
|
import org.spongepowered.configurate.ConfigurationNode;
|
||||||
import org.spongepowered.configurate.serialize.SerializationException;
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class WardrobeSettings {
|
public class WardrobeSettings {
|
||||||
|
|
||||||
@@ -25,14 +27,18 @@ public class WardrobeSettings {
|
|||||||
private static final String APPLY_COSMETICS_ON_CLOSE = "apply-cosmetics-on-close";
|
private static final String APPLY_COSMETICS_ON_CLOSE = "apply-cosmetics-on-close";
|
||||||
private static final String OPEN_SOUND = "open-sound";
|
private static final String OPEN_SOUND = "open-sound";
|
||||||
private static final String CLOSE_SOUND = "close-sound";
|
private static final String CLOSE_SOUND = "close-sound";
|
||||||
private static final String STATIC_LOCATION_PATH = "wardrobe-location";
|
private static final String NPC_LOCATION_PATH = "npc-location";
|
||||||
private static final String VIEWER_LOCATION_PATH = "viewer-location";
|
private static final String VIEWER_LOCATION_PATH = "viewer-location";
|
||||||
private static final String LEAVE_LOCATION_PATH = "leave-location";
|
private static final String LEAVE_LOCATION_PATH = "leave-location";
|
||||||
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
||||||
|
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
|
||||||
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
||||||
private static final String GAMEMODE_OPTIONS_PATH = "gamemode-options";
|
private static final String GAMEMODE_OPTIONS_PATH = "gamemode-options";
|
||||||
private static final String FORCE_EXIT_GAMEMODE_PATH = "exit-gamemode-enabled";
|
private static final String FORCE_EXIT_GAMEMODE_PATH = "exit-gamemode-enabled";
|
||||||
private static final String EXIT_GAMEMODE_PATH = "exit-gamemode";
|
private static final String EXIT_GAMEMODE_PATH = "exit-gamemode";
|
||||||
|
private static final String WARDROBES_PATH = "wardrobes";
|
||||||
|
private static final String PERMISSION_PATH = "permission";
|
||||||
|
private static final String DISTANCE_PATH = "distance";
|
||||||
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";
|
||||||
@@ -58,14 +64,13 @@ public class WardrobeSettings {
|
|||||||
private static int despawnDelay;
|
private static int despawnDelay;
|
||||||
private static float bossbarProgress;
|
private static float bossbarProgress;
|
||||||
private static boolean applyCosmeticsOnClose;
|
private static boolean applyCosmeticsOnClose;
|
||||||
|
private static boolean tryCosmeticsInWardrobe;
|
||||||
private static boolean equipPumpkin;
|
private static boolean equipPumpkin;
|
||||||
private static boolean returnLastLocation;
|
private static boolean returnLastLocation;
|
||||||
private static boolean enabledBossbar;
|
private static boolean enabledBossbar;
|
||||||
private static boolean forceExitGamemode;
|
private static boolean forceExitGamemode;
|
||||||
private static GameMode exitGamemode;
|
private static GameMode exitGamemode;
|
||||||
private static Location wardrobeLocation;
|
private static HashMap<String, Wardrobe> wardrobes;
|
||||||
private static Location viewerLocation;
|
|
||||||
private static Location leaveLocation;
|
|
||||||
private static String bossbarMessage;
|
private static String bossbarMessage;
|
||||||
private static BossBar.Overlay bossbarOverlay;
|
private static BossBar.Overlay bossbarOverlay;
|
||||||
private static BossBar.Color bossbarColor;
|
private static BossBar.Color bossbarColor;
|
||||||
@@ -90,6 +95,7 @@ public class WardrobeSettings {
|
|||||||
applyCosmeticsOnClose = source.node(APPLY_COSMETICS_ON_CLOSE).getBoolean();
|
applyCosmeticsOnClose = source.node(APPLY_COSMETICS_ON_CLOSE).getBoolean();
|
||||||
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
||||||
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
||||||
|
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
||||||
|
|
||||||
ConfigurationNode gamemodeNode = source.node(GAMEMODE_OPTIONS_PATH);
|
ConfigurationNode gamemodeNode = source.node(GAMEMODE_OPTIONS_PATH);
|
||||||
forceExitGamemode = gamemodeNode.node(FORCE_EXIT_GAMEMODE_PATH).getBoolean(false);
|
forceExitGamemode = gamemodeNode.node(FORCE_EXIT_GAMEMODE_PATH).getBoolean(false);
|
||||||
@@ -119,15 +125,35 @@ public class WardrobeSettings {
|
|||||||
transitionStay = transitionNode.node(TRANSITION_STAY_PATH).getInt(2000);
|
transitionStay = transitionNode.node(TRANSITION_STAY_PATH).getInt(2000);
|
||||||
transitionFadeOut = transitionNode.node(TRANSITION_FADE_OUT_PATH).getInt(2000);
|
transitionFadeOut = transitionNode.node(TRANSITION_FADE_OUT_PATH).getInt(2000);
|
||||||
|
|
||||||
try {
|
wardrobes = new HashMap<>();
|
||||||
wardrobeLocation = LocationSerializer.INSTANCE.deserialize(Location.class, source.node(STATIC_LOCATION_PATH));
|
for (ConfigurationNode wardrobesNode : source.node(WARDROBES_PATH).childrenMap().values()) {
|
||||||
MessagesUtil.sendDebugMessages("Wardrobe Location: " + wardrobeLocation);
|
String id = wardrobesNode.key().toString();
|
||||||
viewerLocation = LocationSerializer.INSTANCE.deserialize(Location.class, source.node(VIEWER_LOCATION_PATH));
|
try {
|
||||||
MessagesUtil.sendDebugMessages("Viewer Location: " + viewerLocation);
|
Location npcLocation = LocationSerializer.INSTANCE.deserialize(Location.class, wardrobesNode.node(NPC_LOCATION_PATH));
|
||||||
leaveLocation = Utils.replaceIfNull(LocationSerializer.INSTANCE.deserialize(Location.class, source.node(LEAVE_LOCATION_PATH)), viewerLocation);
|
MessagesUtil.sendDebugMessages("Wardrobe Location: " + npcLocation);
|
||||||
} catch (SerializationException e) {
|
Location viewerLocation = LocationSerializer.INSTANCE.deserialize(Location.class, wardrobesNode.node(VIEWER_LOCATION_PATH));
|
||||||
throw new RuntimeException(e);
|
MessagesUtil.sendDebugMessages("Viewer Location: " + viewerLocation);
|
||||||
|
Location leaveLocation = Utils.replaceIfNull(LocationSerializer.INSTANCE.deserialize(Location.class, wardrobesNode.node(LEAVE_LOCATION_PATH)), viewerLocation);
|
||||||
|
MessagesUtil.sendDebugMessages("Leave Location: " + leaveLocation);
|
||||||
|
WardrobeLocation wardrobeLocation = new WardrobeLocation(npcLocation, viewerLocation, leaveLocation);
|
||||||
|
|
||||||
|
String permission = null;
|
||||||
|
int distance = -1;
|
||||||
|
if (!wardrobesNode.node(PERMISSION_PATH).virtual()) permission = wardrobesNode.node(PERMISSION_PATH).getString();
|
||||||
|
if (!wardrobesNode.node(DISTANCE_PATH).virtual()) distance = wardrobesNode.node(DISTANCE_PATH).getInt();
|
||||||
|
|
||||||
|
Wardrobe wardrobe = new Wardrobe(id, wardrobeLocation, permission, distance);
|
||||||
|
addWardrobe(wardrobe);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MessagesUtil.sendDebugMessages("Unable to create wardrobe " + id, Level.SEVERE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDefaultDistance() {
|
||||||
|
return staticRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getDisableOnDamage() {
|
public static boolean getDisableOnDamage() {
|
||||||
@@ -172,25 +198,36 @@ public class WardrobeSettings {
|
|||||||
return returnLastLocation;
|
return returnLastLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getWardrobeLocation() {
|
public static Wardrobe getWardrobe(String key) {
|
||||||
return wardrobeLocation.clone();
|
return wardrobes.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getViewerLocation() {
|
public static Set<String> getWardrobeNames() {
|
||||||
return viewerLocation;
|
return wardrobes.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getLeaveLocation() {
|
public static Collection<Wardrobe> getWardrobes() {
|
||||||
return leaveLocation;
|
return wardrobes.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addWardrobe(Wardrobe wardrobe) {
|
||||||
|
wardrobes.put(wardrobe.getId(), wardrobe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeWardrobe(String id) {
|
||||||
|
wardrobes.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static boolean inDistanceOfWardrobe(final Location wardrobeLocation, final Location playerLocation) {
|
public static boolean inDistanceOfWardrobe(final Location wardrobeLocation, final Location playerLocation) {
|
||||||
if (displayRadius == -1) return true;
|
if (displayRadius == -1) return true;
|
||||||
if (!wardrobeLocation.getWorld().equals(playerLocation.getWorld())) return false;
|
if (!wardrobeLocation.getWorld().equals(playerLocation.getWorld())) return false;
|
||||||
return playerLocation.distanceSquared(wardrobeLocation) <= displayRadius * displayRadius;
|
return playerLocation.distanceSquared(wardrobeLocation) <= displayRadius * displayRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inDistanceOfStatic(final Location location) {
|
@Deprecated
|
||||||
|
public static boolean inDistanceOfStatic(Wardrobe wardrobe, final Location location) {
|
||||||
|
Location wardrobeLocation = wardrobe.getLocation().getNpcLocation();
|
||||||
if (wardrobeLocation == null) return false;
|
if (wardrobeLocation == null) return false;
|
||||||
if (staticRadius == -1) return true;
|
if (staticRadius == -1) return true;
|
||||||
if (!wardrobeLocation.getWorld().equals(location.getWorld())) return false;
|
if (!wardrobeLocation.getWorld().equals(location.getWorld())) return false;
|
||||||
@@ -245,57 +282,84 @@ public class WardrobeSettings {
|
|||||||
return exitGamemode;
|
return exitGamemode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setWardrobeLocation(Location newLocation) {
|
public static boolean isTryCosmeticsInWardrobe() {
|
||||||
wardrobeLocation = newLocation;
|
return tryCosmeticsInWardrobe;
|
||||||
|
|
||||||
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
|
||||||
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "world", newLocation.getWorld().getName());
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "x", newLocation.getX());
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "y", newLocation.getY());
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "z", newLocation.getZ());
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "yaw", newLocation.getYaw());
|
|
||||||
plugin.getConfig().set("wardrobe.wardrobe-location." + "pitch", newLocation.getPitch());
|
|
||||||
|
|
||||||
/* Configuration sets suck
|
|
||||||
source.node(WORLD).set(loc.getWorld().getName());
|
|
||||||
source.node(X).set(loc.getX());
|
|
||||||
source.node(Y).set(loc.getY());
|
|
||||||
source.node(Z).set(loc.getZ());
|
|
||||||
source.node(YAW).set(loc.getYaw());
|
|
||||||
source.node(PITCH).set(loc.getPitch());
|
|
||||||
*/
|
|
||||||
|
|
||||||
HMCCosmeticsPlugin.getInstance().saveConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setViewerLocation(Location newLocation) {
|
/**
|
||||||
viewerLocation = newLocation;
|
* Sets where the NPC/Mannequin will spawn in the wardrobe
|
||||||
|
* @param newLocation
|
||||||
|
*/
|
||||||
|
public static void setNPCLocation(Wardrobe wardrobe, Location newLocation) {
|
||||||
|
wardrobe.getLocation().setNPCLocation(newLocation);
|
||||||
|
|
||||||
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "world", newLocation.getWorld().getName());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "world", newLocation.getWorld().getName());
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "x", newLocation.getX());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "x", newLocation.getX());
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "y", newLocation.getY());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "y", newLocation.getY());
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "z", newLocation.getZ());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "z", newLocation.getZ());
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "yaw", newLocation.getYaw());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "yaw", newLocation.getYaw());
|
||||||
plugin.getConfig().set("wardrobe.viewer-location." + "pitch", newLocation.getPitch());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".npc-location." + "pitch", newLocation.getPitch());
|
||||||
|
|
||||||
HMCCosmeticsPlugin.getInstance().saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLeaveLocation(Location newLocation) {
|
/**
|
||||||
leaveLocation = newLocation;
|
* Sets where the player will view the wardrobe
|
||||||
|
* @param newLocation
|
||||||
|
*/
|
||||||
|
public static void setViewerLocation(Wardrobe wardrobe, Location newLocation) {
|
||||||
|
wardrobe.getLocation().setViewerLocation(newLocation);
|
||||||
|
|
||||||
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "world", newLocation.getWorld().getName());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.world", newLocation.getWorld().getName());
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "x", newLocation.getX());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.x", newLocation.getX());
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "y", newLocation.getY());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.y", newLocation.getY());
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "z", newLocation.getZ());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.z", newLocation.getZ());
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "yaw", newLocation.getYaw());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.yaw", newLocation.getYaw());
|
||||||
plugin.getConfig().set("wardrobe.leave-location." + "pitch", newLocation.getPitch());
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".viewer-location.pitch", newLocation.getPitch());
|
||||||
|
|
||||||
HMCCosmeticsPlugin.getInstance().saveConfig();
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets where a player will leave the wardrobe from
|
||||||
|
* @param newLocation
|
||||||
|
*/
|
||||||
|
public static void setLeaveLocation(Wardrobe wardrobe, Location newLocation) {
|
||||||
|
wardrobe.getLocation().setLeaveLocation(newLocation);
|
||||||
|
|
||||||
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.world", newLocation.getWorld().getName());
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.x", newLocation.getX());
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.y", newLocation.getY());
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.z", newLocation.getZ());
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.yaw", newLocation.getYaw());
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".leave-location.pitch", newLocation.getPitch());
|
||||||
|
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWardrobePermission(Wardrobe wardrobe, String permission) {
|
||||||
|
wardrobe.setPermission(permission);
|
||||||
|
|
||||||
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".permission", permission);
|
||||||
|
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWardrobeDistance(Wardrobe wardrobe, int distance) {
|
||||||
|
wardrobe.setDistance(distance);
|
||||||
|
|
||||||
|
HMCCosmeticsPlugin plugin = HMCCosmeticsPlugin.getInstance();
|
||||||
|
|
||||||
|
plugin.getConfig().set("wardrobe.wardrobes." + wardrobe.getId() + ".distance", distance);
|
||||||
|
|
||||||
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class CosmeticArmorType extends Cosmetic {
|
|||||||
public void update(@NotNull CosmeticUser user) {
|
public void update(@NotNull CosmeticUser user) {
|
||||||
Player player = Bukkit.getPlayer(user.getUniqueId());
|
Player player = Bukkit.getPlayer(user.getUniqueId());
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
if (user.getUserEmoteManager().isPlayingEmote()) return; // There has to be a better way of doing this...
|
||||||
ItemStack cosmeticItem = user.getUserCosmeticItem(this);
|
ItemStack cosmeticItem = user.getUserCosmeticItem(this);
|
||||||
if (equipSlot.equals(EquipmentSlot.OFF_HAND)) {
|
if (equipSlot.equals(EquipmentSlot.OFF_HAND)) {
|
||||||
if (!player.getInventory().getItemInOffHand().getType().isAir()) return;
|
if (!player.getInventory().getItemInOffHand().getType().isAir()) return;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
|
|
||||||
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
||||||
if (!user.getUserBackpackManager().getArmorStand().isValid()) {
|
if (!user.getUserBackpackManager().getArmorStand().isValid()) {
|
||||||
MessagesUtil.sendDebugMessages("Invalid Backpack detected! Respawning backpack, report this on the discord if this happens often!", Level.WARNING);
|
MessagesUtil.sendDebugMessages("Invalid Backpack Entity[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!", Level.WARNING);
|
||||||
user.respawnBackpack();
|
user.respawnBackpack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class Menu {
|
|||||||
|
|
||||||
for (ConfigurationNode config : config.node("items").childrenMap().values()) {
|
for (ConfigurationNode config : config.node("items").childrenMap().values()) {
|
||||||
|
|
||||||
List<String> slotString = null;
|
List<String> slotString;
|
||||||
try {
|
try {
|
||||||
slotString = config.node("slots").getList(String.class);
|
slotString = config.node("slots").getList(String.class);
|
||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
@@ -126,7 +126,6 @@ public class Menu {
|
|||||||
ItemStack item;
|
ItemStack item;
|
||||||
try {
|
try {
|
||||||
item = ItemSerializer.INSTANCE.deserialize(ItemStack.class, config.node("item"));
|
item = ItemSerializer.INSTANCE.deserialize(ItemStack.class, config.node("item"));
|
||||||
//item = config.node("item").get(ItemStack.class);
|
|
||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -144,8 +143,8 @@ public class Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int slot : slots) {
|
for (int slot : slots) {
|
||||||
ItemStack originalItem = updateItem(user, item, type, config, slot).clone();
|
ItemStack modifiedItem = getMenuItem(user, type, config, item.clone(), slot).clone();
|
||||||
GuiItem guiItem = ItemBuilder.from(originalItem).asGuiItem();
|
GuiItem guiItem = ItemBuilder.from(modifiedItem).asGuiItem();
|
||||||
|
|
||||||
Type finalType = type;
|
Type finalType = type;
|
||||||
guiItem.setAction(event -> {
|
guiItem.setAction(event -> {
|
||||||
@@ -153,11 +152,9 @@ public class Menu {
|
|||||||
final ClickType clickType = event.getClick();
|
final ClickType clickType = event.getClick();
|
||||||
if (finalType != null) finalType.run(user, config, clickType);
|
if (finalType != null) finalType.run(user, config, clickType);
|
||||||
// Need to delay the update by a tick so it will actually update with new values
|
// Need to delay the update by a tick so it will actually update with new values
|
||||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
for (int guiSlot : slots) {
|
||||||
for (int guiSlot : slots) {
|
gui.updateItem(guiSlot, getMenuItem(user, finalType, config, item.clone(), guiSlot));
|
||||||
gui.updateItem(guiSlot, updateItem(user, originalItem, finalType, config, guiSlot));
|
}
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
MessagesUtil.sendDebugMessages("Updated slot " + slot);
|
MessagesUtil.sendDebugMessages("Updated slot " + slot);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -196,11 +193,9 @@ public class Menu {
|
|||||||
|
|
||||||
@Contract("_, _, _, _ -> param2")
|
@Contract("_, _, _, _ -> param2")
|
||||||
@NotNull
|
@NotNull
|
||||||
private ItemStack updateItem(CosmeticUser user, @NotNull ItemStack itemStack, Type type, ConfigurationNode config, int slot) {
|
private ItemStack getMenuItem(CosmeticUser user, Type type, ConfigurationNode config, ItemStack itemStack, int slot) {
|
||||||
if (itemStack.hasItemMeta()) {
|
if (!itemStack.hasItemMeta()) return itemStack;
|
||||||
itemStack = type.setItem(user, config, itemStack, slot);
|
return type.setItem(user, config, itemStack, slot);
|
||||||
}
|
|
||||||
return itemStack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPermissionNode() {
|
public String getPermissionNode() {
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ public class Menus {
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Collection<Menu> values() {
|
||||||
|
return MENUS.values();
|
||||||
|
}
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
MENUS.clear();
|
MENUS.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class TypeCosmetic extends Type {
|
|||||||
if (!actionConfig.node("on-equip").virtual()) actionStrings.addAll(actionConfig.node("on-equip").getList(String.class));
|
if (!actionConfig.node("on-equip").virtual()) actionStrings.addAll(actionConfig.node("on-equip").getList(String.class));
|
||||||
MessagesUtil.sendDebugMessages("on-equip");
|
MessagesUtil.sendDebugMessages("on-equip");
|
||||||
// TODO: Redo this
|
// TODO: Redo this
|
||||||
if (cosmetic.isDyable()) {
|
if (cosmetic.isDyable() && Hooks.isActiveHook("HMCColor")) {
|
||||||
DyeMenu.openMenu(user, cosmetic);
|
DyeMenu.openMenu(user, cosmetic);
|
||||||
} else {
|
} else {
|
||||||
user.addPlayerCosmetic(cosmetic);
|
user.addPlayerCosmetic(cosmetic);
|
||||||
@@ -99,12 +99,11 @@ public class TypeCosmetic extends Type {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack setItem(CosmeticUser user, @NotNull ConfigurationNode config, ItemStack itemStack, int slot) {
|
public ItemStack setItem(CosmeticUser user, @NotNull ConfigurationNode config, ItemStack itemStack, int slot) {
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||||
itemStack.setItemMeta(processLoreLines(user, itemMeta));
|
|
||||||
|
|
||||||
if (config.node("cosmetic").virtual()) {
|
if (config.node("cosmetic").virtual()) {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
};
|
}
|
||||||
String cosmeticName = config.node("cosmetic").getString();
|
String cosmeticName = config.node("cosmetic").getString();
|
||||||
Cosmetic cosmetic = Cosmetics.getCosmetic(cosmeticName);
|
Cosmetic cosmetic = Cosmetics.getCosmetic(cosmeticName);
|
||||||
if (cosmetic == null) {
|
if (cosmetic == null) {
|
||||||
@@ -155,12 +154,10 @@ public class TypeCosmetic extends Type {
|
|||||||
|
|
||||||
if (itemMeta.hasLore()) {
|
if (itemMeta.hasLore()) {
|
||||||
for (String loreLine : itemMeta.getLore()) {
|
for (String loreLine : itemMeta.getLore()) {
|
||||||
if (Hooks.isActiveHook("PlaceholderAPI"))
|
if (Hooks.isActiveHook("PlaceholderAPI")) loreLine = PlaceholderAPI.setPlaceholders(user.getPlayer(), loreLine);
|
||||||
loreLine = PlaceholderAPI.setPlaceholders(user.getPlayer(), loreLine);
|
|
||||||
processedLore.add(loreLine);
|
processedLore.add(loreLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
itemMeta.setLore(processedLore);
|
itemMeta.setLore(processedLore);
|
||||||
return itemMeta;
|
return itemMeta;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ 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 HookOraxen ORAXEN_HOOK = new HookOraxen();
|
||||||
private static HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
private static HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
||||||
private static HookLooty LOOTY_HOOK = new HookLooty();
|
private static HookGeary GEARY_HOOK = new HookGeary();
|
||||||
private static HookMythic MYTHIC_HOOK = new HookMythic();
|
private static HookMythic MYTHIC_HOOK = new HookMythic();
|
||||||
private static HookDenizen DENIZEN_HOOK = new HookDenizen();
|
private static HookDenizen DENIZEN_HOOK = new HookDenizen();
|
||||||
private static HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
private static HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.hibiscusmc.hmccosmetics.hooks.items;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
|
import com.hibiscusmc.hmccosmetics.hooks.Hook;
|
||||||
|
import com.mineinabyss.geary.addons.GearyPhase;
|
||||||
|
import com.mineinabyss.geary.modules.GearyModuleKt;
|
||||||
|
import com.mineinabyss.geary.papermc.tracking.items.ItemTrackingKt;
|
||||||
|
import com.mineinabyss.geary.prefabs.PrefabKey;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A hook that integrates the plugin {@link com.mineinabyss.geary.papermc.GearyPlugin Geary} to provide custom items
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("SpellCheckingInspection")
|
||||||
|
public class HookGeary extends Hook {
|
||||||
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
public HookGeary() {
|
||||||
|
super("geary");
|
||||||
|
setEnabledItemHook(true);
|
||||||
|
GearyModuleKt.getGeary().getPipeline().intercept(GearyPhase.ENABLE, () -> {
|
||||||
|
enabled = true;
|
||||||
|
HMCCosmeticsPlugin.setup();
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a cosmetic {@link ItemStack} that is associated with the provided id from the plugin {@link com.mineinabyss.geary.papermc.GearyPlugin Geary}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack getItem(@NotNull String itemId) {
|
||||||
|
if (enabled) {
|
||||||
|
PrefabKey prefabKey = PrefabKey.Companion.ofOrNull(itemId);
|
||||||
|
if (prefabKey == null) return null;
|
||||||
|
return ItemTrackingKt.getItemTracking().getProvider().serializePrefabToItemStack(prefabKey, null);
|
||||||
|
} else return new ItemStack(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.hooks.items;
|
|
||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.hooks.Hook;
|
|
||||||
import com.mineinabyss.geary.prefabs.PrefabKey;
|
|
||||||
import com.mineinabyss.looty.LootyFactory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A hook that integrates the plugin {@link com.mineinabyss.looty.LootyPlugin Looty} to provide custom items
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("SpellCheckingInspection")
|
|
||||||
public class HookLooty extends Hook {
|
|
||||||
public HookLooty() {
|
|
||||||
super("looty");
|
|
||||||
setEnabledItemHook(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a cosmetic {@link ItemStack} that is associated with the provided id from the plugin {@link com.mineinabyss.looty.LootyPlugin Looty}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ItemStack getItem(@NotNull String itemId) {
|
|
||||||
PrefabKey prefabKey = PrefabKey.Companion.ofOrNull(itemId);
|
|
||||||
if (prefabKey == null) return null;
|
|
||||||
return LootyFactory.INSTANCE.createFromPrefab(prefabKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -110,11 +110,15 @@ public class HMCPlaceholderExpansion extends PlaceholderExpansion {
|
|||||||
if (placeholderArgs.get(1) != null) {
|
if (placeholderArgs.get(1) != null) {
|
||||||
Cosmetic cosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1));
|
Cosmetic cosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1));
|
||||||
if (cosmetic == null) {
|
if (cosmetic == null) {
|
||||||
Cosmetic secondAttemptCosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1) + "_" + placeholderArgs.get(2));
|
if (placeholderArgs.size() >= 3) {
|
||||||
if (secondAttemptCosmetic == null) {
|
Cosmetic secondAttemptCosmetic = Cosmetics.getCosmetic(placeholderArgs.get(1) + "_" + placeholderArgs.get(2));
|
||||||
return "INVALID_COSMETIC";
|
if (secondAttemptCosmetic == null) {
|
||||||
|
return "INVALID_COSMETIC";
|
||||||
|
} else {
|
||||||
|
cosmetic = secondAttemptCosmetic;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cosmetic = secondAttemptCosmetic;
|
return "INVALID_COSMETIC";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TranslationUtil.getTranslation("unlockedCosmetic", String.valueOf(user.canEquipCosmetic(cosmetic)));
|
return TranslationUtil.getTranslation("unlockedCosmetic", String.valueOf(user.canEquipCosmetic(cosmetic)));
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
|||||||
import com.sk89q.worldguard.WorldGuard;
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
|
import com.sk89q.worldguard.protection.flags.StringFlag;
|
||||||
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
|
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
|
||||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||||
|
|
||||||
@@ -21,13 +22,13 @@ public class WGHook {
|
|||||||
/**
|
/**
|
||||||
* @implNote Please use {@link #getCosmeticWardrobeFlag()} instead
|
* @implNote Please use {@link #getCosmeticWardrobeFlag()} instead
|
||||||
*/
|
*/
|
||||||
public static StateFlag COSMETIC_WARDROBE_FLAG;
|
public static StringFlag COSMETIC_WARDROBE_FLAG;
|
||||||
|
|
||||||
public WGHook() {
|
public WGHook() {
|
||||||
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
||||||
try {
|
try {
|
||||||
StateFlag cosmeticFlag = new StateFlag("cosmetic-enable", false);
|
StateFlag cosmeticFlag = new StateFlag("cosmetic-enable", false);
|
||||||
StateFlag wardrobeFlag = new StateFlag("cosmetic-wardrobe", false);
|
StringFlag wardrobeFlag = new StringFlag("cosmetic-wardrobe");
|
||||||
registry.register(cosmeticFlag);
|
registry.register(cosmeticFlag);
|
||||||
registry.register(wardrobeFlag);
|
registry.register(wardrobeFlag);
|
||||||
COSMETIC_ENABLE_FLAG = cosmeticFlag;
|
COSMETIC_ENABLE_FLAG = cosmeticFlag;
|
||||||
@@ -56,7 +57,7 @@ public class WGHook {
|
|||||||
* Gets the cosmetic wardrobe {@link StateFlag}
|
* Gets the cosmetic wardrobe {@link StateFlag}
|
||||||
* @return The cosmetic wardrobe {@link StateFlag}
|
* @return The cosmetic wardrobe {@link StateFlag}
|
||||||
*/
|
*/
|
||||||
public static StateFlag getCosmeticWardrobeFlag() {
|
public static StringFlag getCosmeticWardrobeFlag() {
|
||||||
return COSMETIC_WARDROBE_FLAG;
|
return COSMETIC_WARDROBE_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.hooks.worldguard;
|
package com.hibiscusmc.hmccosmetics.hooks.worldguard;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||||
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.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldguard.WorldGuard;
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
@@ -34,13 +37,17 @@ public class WGListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (ProtectedRegion protectedRegion : set.getRegions()) {
|
for (ProtectedRegion protectedRegion : set.getRegions()) {
|
||||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticEnableFlag())) {
|
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticEnableFlag())) {
|
||||||
if (protectedRegion.getFlags().get(WGHook.getCosmeticEnableFlag()).toString().equalsIgnoreCase("ALLOW")) return;
|
if (protectedRegion.getFlags().get(WGHook.getCosmeticEnableFlag()).toString().equalsIgnoreCase("ALLOW")) {
|
||||||
|
if (user.getHiddenReason() == CosmeticUser.HiddenReason.WORLDGUARD) user.showCosmetics();
|
||||||
|
return;
|
||||||
|
}
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
user.hideCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticWardrobeFlag())) {
|
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticWardrobeFlag())) {
|
||||||
if (!protectedRegion.getFlags().get(WGHook.getCosmeticWardrobeFlag()).toString().equalsIgnoreCase("ALLOW")) return;
|
if (!WardrobeSettings.getWardrobeNames().contains(protectedRegion.getFlags().get(WGHook.getCosmeticWardrobeFlag()).toString())) return;
|
||||||
user.enterWardrobe();
|
Wardrobe wardrobe = WardrobeSettings.getWardrobe(protectedRegion.getFlags().get(WGHook.getCosmeticWardrobeFlag()).toString());
|
||||||
|
user.enterWardrobe(true, wardrobe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.api.*;
|
import com.hibiscusmc.hmccosmetics.api.*;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
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;
|
||||||
@@ -30,7 +31,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class CosmeticUser {
|
public class CosmeticUser {
|
||||||
|
|
||||||
private UUID uniqueId;
|
private final UUID uniqueId;
|
||||||
private int taskId;
|
private int taskId;
|
||||||
private HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
|
private HashMap<CosmeticSlot, Cosmetic> playerCosmetics = new HashMap<>();
|
||||||
private UserWardrobeManager userWardrobeManager;
|
private UserWardrobeManager userWardrobeManager;
|
||||||
@@ -158,10 +159,7 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
public boolean hasCosmeticInSlot(Cosmetic cosmetic) {
|
public boolean hasCosmeticInSlot(Cosmetic cosmetic) {
|
||||||
if (getCosmetic(cosmetic.getSlot()) == null) return false;
|
if (getCosmetic(cosmetic.getSlot()) == null) return false;
|
||||||
if (cosmetic.getId() == getCosmetic(cosmetic.getSlot()).getId()) {
|
return Objects.equals(cosmetic.getId(), getCosmetic(cosmetic.getSlot()).getId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<CosmeticSlot> getSlotsWithCosmetics() {
|
public Set<CosmeticSlot> getSlotsWithCosmetics() {
|
||||||
@@ -242,27 +240,28 @@ public class CosmeticUser {
|
|||||||
return userEmoteManager;
|
return userEmoteManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterWardrobe() {
|
public void enterWardrobe(boolean ignoreDistance, Wardrobe wardrobe) {
|
||||||
enterWardrobe(false);
|
if (wardrobe.hasPermission() && !getPlayer().hasPermission(wardrobe.getPermission())) {
|
||||||
}
|
MessagesUtil.sendMessage(getPlayer(), "no-permission");
|
||||||
|
return;
|
||||||
public void enterWardrobe(boolean ignoreDistance) {
|
}
|
||||||
enterWardrobe(ignoreDistance, WardrobeSettings.getLeaveLocation(), WardrobeSettings.getViewerLocation(), WardrobeSettings.getWardrobeLocation());
|
if (!wardrobe.canEnter(this) && !ignoreDistance) {
|
||||||
}
|
|
||||||
|
|
||||||
public void enterWardrobe(boolean ignoreDistance, Location exitLocation, Location viewingLocation, Location npcLocation) {
|
|
||||||
if (!WardrobeSettings.inDistanceOfStatic(getPlayer().getLocation()) && !ignoreDistance) {
|
|
||||||
MessagesUtil.sendMessage(getPlayer(), "not-near-wardrobe");
|
MessagesUtil.sendMessage(getPlayer(), "not-near-wardrobe");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerWardrobeEnterEvent event = new PlayerWardrobeEnterEvent(this);
|
if (!wardrobe.getLocation().hasAllLocations()) {
|
||||||
|
MessagesUtil.sendMessage(getPlayer(), "wardrobe-not-setup");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlayerWardrobeEnterEvent event = new PlayerWardrobeEnterEvent(this, wardrobe);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
wardrobe = event.getWardrobe();
|
||||||
|
|
||||||
if (userWardrobeManager == null) {
|
if (userWardrobeManager == null) {
|
||||||
userWardrobeManager = new UserWardrobeManager(this, exitLocation, viewingLocation, npcLocation);
|
userWardrobeManager = new UserWardrobeManager(this, wardrobe);
|
||||||
userWardrobeManager.start();
|
userWardrobeManager.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,16 +296,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInWardrobe() {
|
public boolean isInWardrobe() {
|
||||||
if (userWardrobeManager == null) return false;
|
return userWardrobeManager != null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleWardrobe() {
|
|
||||||
if (isInWardrobe()) {
|
|
||||||
leaveWardrobe();
|
|
||||||
} else {
|
|
||||||
enterWardrobe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
@@ -322,8 +312,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBackpackSpawned() {
|
public boolean isBackpackSpawned() {
|
||||||
if (this.userBackpackManager == null) return false;
|
return this.userBackpackManager != null;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
||||||
@@ -374,7 +363,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<CosmeticSlot> getDyeableSlots() {
|
public List<CosmeticSlot> getDyeableSlots() {
|
||||||
ArrayList<CosmeticSlot> dyableSlots = new ArrayList();
|
ArrayList<CosmeticSlot> dyableSlots = new ArrayList<>();
|
||||||
|
|
||||||
for (Cosmetic cosmetic : getCosmetics()) {
|
for (Cosmetic cosmetic : getCosmetics()) {
|
||||||
if (cosmetic.isDyable()) dyableSlots.add(cosmetic.getSlot());
|
if (cosmetic.isDyable()) dyableSlots.add(cosmetic.getSlot());
|
||||||
@@ -385,8 +374,8 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
public boolean canEquipCosmetic(Cosmetic cosmetic) {
|
public boolean canEquipCosmetic(Cosmetic cosmetic) {
|
||||||
if (!cosmetic.requiresPermission()) return true;
|
if (!cosmetic.requiresPermission()) return true;
|
||||||
if (getPlayer().hasPermission(cosmetic.getPermission())) return true;
|
if (isInWardrobe() && WardrobeSettings.isTryCosmeticsInWardrobe()) return true;
|
||||||
return false;
|
return getPlayer().hasPermission(cosmetic.getPermission());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hidePlayer() {
|
public void hidePlayer() {
|
||||||
@@ -408,7 +397,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void hideCosmetics(HiddenReason reason) {
|
public void hideCosmetics(HiddenReason reason) {
|
||||||
if (hideCosmetics == true) return;
|
if (hideCosmetics) return;
|
||||||
PlayerCosmeticHideEvent event = new PlayerCosmeticHideEvent(this, reason);
|
PlayerCosmeticHideEvent event = new PlayerCosmeticHideEvent(this, reason);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.user.manager;
|
|||||||
import com.hibiscusmc.hmccosmetics.api.PlayerEmoteStartEvent;
|
import com.hibiscusmc.hmccosmetics.api.PlayerEmoteStartEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.api.PlayerEmoteStopEvent;
|
import com.hibiscusmc.hmccosmetics.api.PlayerEmoteStopEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticEmoteType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticEmoteType;
|
||||||
|
import com.hibiscusmc.hmccosmetics.emotes.EmoteManager;
|
||||||
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.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -19,7 +20,7 @@ public class UserEmoteManager {
|
|||||||
|
|
||||||
public void playEmote(@NotNull CosmeticEmoteType cosmeticEmoteType) {
|
public void playEmote(@NotNull CosmeticEmoteType cosmeticEmoteType) {
|
||||||
MessagesUtil.sendDebugMessages("playEmote " + cosmeticEmoteType.getAnimationId());
|
MessagesUtil.sendDebugMessages("playEmote " + cosmeticEmoteType.getAnimationId());
|
||||||
playEmote(cosmeticEmoteType.getAnimationId());
|
playEmote(EmoteManager.get(cosmeticEmoteType.getAnimationId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playEmote(String animationId) {
|
public void playEmote(String animationId) {
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ public class UserEmoteModel extends PlayerModel {
|
|||||||
MessagesUtil.sendMessage(player, "emote-blocked");
|
MessagesUtil.sendMessage(player, "emote-blocked");
|
||||||
return;
|
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);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ 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.Settings;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.Wardrobe;
|
||||||
|
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;
|
||||||
@@ -38,6 +40,8 @@ public class UserWardrobeManager {
|
|||||||
private String npcName;
|
private String npcName;
|
||||||
private GameMode originalGamemode;
|
private GameMode originalGamemode;
|
||||||
private final CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
|
private final Wardrobe wardrobe;
|
||||||
|
private final WardrobeLocation wardrobeLocation;
|
||||||
private final Location viewingLocation;
|
private final Location viewingLocation;
|
||||||
private final Location npcLocation;
|
private final Location npcLocation;
|
||||||
private Location exitLocation;
|
private Location exitLocation;
|
||||||
@@ -45,15 +49,18 @@ public class UserWardrobeManager {
|
|||||||
private boolean active;
|
private boolean active;
|
||||||
private WardrobeStatus wardrobeStatus;
|
private WardrobeStatus wardrobeStatus;
|
||||||
|
|
||||||
public UserWardrobeManager(CosmeticUser user, Location exitLocation, Location viewingLocation, Location npcLocation) {
|
public UserWardrobeManager(CosmeticUser user, Wardrobe wardrobe) {
|
||||||
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
WARDROBE_UUID = UUID.randomUUID();
|
WARDROBE_UUID = UUID.randomUUID();
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
this.exitLocation = exitLocation;
|
this.wardrobe = wardrobe;
|
||||||
this.viewingLocation = viewingLocation;
|
this.wardrobeLocation = wardrobe.getLocation();
|
||||||
this.npcLocation = npcLocation;
|
|
||||||
|
this.exitLocation = wardrobeLocation.getLeaveLocation();
|
||||||
|
this.viewingLocation = wardrobeLocation.getViewerLocation();
|
||||||
|
this.npcLocation = wardrobeLocation.getNpcLocation();
|
||||||
|
|
||||||
wardrobeStatus = WardrobeStatus.SETUP;
|
wardrobeStatus = WardrobeStatus.SETUP;
|
||||||
}
|
}
|
||||||
@@ -208,9 +215,7 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
// For Wardrobe Temp Cosmetics
|
// For Wardrobe Temp Cosmetics
|
||||||
for (Cosmetic cosmetic : user.getCosmetics()) {
|
for (Cosmetic cosmetic : user.getCosmetics()) {
|
||||||
if (cosmetic.requiresPermission()) {
|
if (!user.canEquipCosmetic(cosmetic)) user.removeCosmeticSlot(cosmetic.getSlot());
|
||||||
if (!player.hasPermission(cosmetic.getPermission())) user.removeCosmeticSlot(cosmetic.getSlot());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user.updateCosmetic();
|
user.updateCosmetic();
|
||||||
@@ -230,12 +235,12 @@ public class UserWardrobeManager {
|
|||||||
this.cancel();
|
this.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessagesUtil.sendDebugMessages("WardrobeUpdate[user= " + user.getUniqueId() + ",status=" + getWardrobeStatus() + "]");
|
MessagesUtil.sendDebugMessages("WardrobeUpdate[user=" + user.getUniqueId() + ",status=" + getWardrobeStatus() + "]");
|
||||||
List<Player> viewer = Collections.singletonList(player);
|
List<Player> viewer = Collections.singletonList(player);
|
||||||
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
||||||
outsideViewers.remove(player);
|
outsideViewers.remove(player);
|
||||||
|
|
||||||
Location location = WardrobeSettings.getWardrobeLocation().clone();
|
Location location = npcLocation;
|
||||||
int yaw = data.get();
|
int yaw = data.get();
|
||||||
location.setYaw(yaw);
|
location.setYaw(yaw);
|
||||||
|
|
||||||
@@ -259,8 +264,8 @@ public class UserWardrobeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()), false, viewer);
|
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), npcLocation.add(Settings.getBalloonOffset()), false, viewer);
|
||||||
user.getBalloonManager().getModelEntity().teleport(WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()));
|
user.getBalloonManager().getModelEntity().teleport(npcLocation.add(Settings.getBalloonOffset()));
|
||||||
user.getBalloonManager().sendRemoveLeashPacket(outsideViewers);
|
user.getBalloonManager().sendRemoveLeashPacket(outsideViewers);
|
||||||
PacketManager.sendEntityDestroyPacket(user.getBalloonManager().getModelId(), outsideViewers);
|
PacketManager.sendEntityDestroyPacket(user.getBalloonManager().getModelId(), outsideViewers);
|
||||||
user.getBalloonManager().sendLeashPacket(NPC_ID);
|
user.getBalloonManager().sendLeashPacket(NPC_ID);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ cosmetic-settings:
|
|||||||
|
|
||||||
emote-distance: -3 # This shows how far away the camera should be while a player is doing an emote. Negative is behind player.
|
emote-distance: -3 # This shows how far away the camera should be while a player is doing an emote. Negative is behind player.
|
||||||
emote-block-check: true # If the server should check if the block is open where the camera is placed (prevents players viewing through blocks)
|
emote-block-check: true # If the server should check if the block is open where the camera is placed (prevents players viewing through blocks)
|
||||||
|
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
|
||||||
|
|
||||||
@@ -70,6 +71,8 @@ wardrobe:
|
|||||||
equip-pumpkin: false
|
equip-pumpkin: false
|
||||||
# Rather than having a set exit location, this will send the player back to where they entered the wardrobe. Not recommended for WG regions
|
# Rather than having a set exit location, this will send the player back to where they entered the wardrobe. Not recommended for WG regions
|
||||||
return-last-location: false
|
return-last-location: false
|
||||||
|
# If players in wardrobes should be able to equip any cosmetic, regardless of permission (Cosmetics they do not have access to will be removed when they leave the wardrobe)
|
||||||
|
unchecked-wardrobe-cosmetics: false
|
||||||
|
|
||||||
gamemode-options:
|
gamemode-options:
|
||||||
exit-gamemode-enabled: false # Setting this to false will set the gamemode the player came in as. True sets to exit-gamemode gamemode
|
exit-gamemode-enabled: false # Setting this to false will set the gamemode the player came in as. True sets to exit-gamemode gamemode
|
||||||
@@ -91,24 +94,26 @@ wardrobe:
|
|||||||
title-fade-in: 1000 # milliseconds
|
title-fade-in: 1000 # milliseconds
|
||||||
title-stay: 500 # milliseconds
|
title-stay: 500 # milliseconds
|
||||||
title-fade-out: 1000 # milliseconds
|
title-fade-out: 1000 # milliseconds
|
||||||
wardrobe-location:
|
wardrobes:
|
||||||
world: "World"
|
default:
|
||||||
x: 0
|
npc-location:
|
||||||
y: 0
|
world: "world"
|
||||||
z: 0
|
x: 0
|
||||||
yaw: 0
|
y: 0
|
||||||
pitch: 0
|
z: 0
|
||||||
viewer-location:
|
yaw: 0
|
||||||
world: "World"
|
pitch: 0
|
||||||
x: 5
|
viewer-location:
|
||||||
y: 0
|
world: "world"
|
||||||
z: 5
|
x: 5
|
||||||
yaw: 0
|
y: 0
|
||||||
pitch: 0
|
z: 5
|
||||||
leave-location:
|
yaw: 0
|
||||||
world: "World"
|
pitch: 0
|
||||||
x: 5
|
leave-location:
|
||||||
y: 5
|
world: "world"
|
||||||
z: 5
|
x: 5
|
||||||
yaw: 0
|
y: 5
|
||||||
pitch: 0
|
z: 5
|
||||||
|
yaw: 0
|
||||||
|
pitch: 0
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ not-near-wardrobe: "%prefix% <red>You are not near the wardrobe!"
|
|||||||
set-wardrobe-location: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe location!"
|
set-wardrobe-location: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe location!"
|
||||||
set-wardrobe-viewing: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe viewing location!"
|
set-wardrobe-viewing: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe viewing location!"
|
||||||
set-wardrobe-leaving: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe leaving location!"
|
set-wardrobe-leaving: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe leaving location!"
|
||||||
|
set-wardrobe-permission: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe permission!"
|
||||||
|
set-wardrobe-distance: "%prefix% <gradient:#6D9DC5:#45CDE9>Set new wardrobe distance!"
|
||||||
|
no-wardrobes: "%prefix% <red>There are no wardrobes with that name!"
|
||||||
|
wardrobe-not-setup: "%prefix% <red>This wardrobe does not have all required locations set!"
|
||||||
|
|
||||||
equip-cosmetic: "%prefix% <gradient:#6D9DC5:#45CDE9>You have equipped <cosmetic>!"
|
equip-cosmetic: "%prefix% <gradient:#6D9DC5:#45CDE9>You have equipped <cosmetic>!"
|
||||||
unequip-cosmetic: "%prefix% <gradient:#6D9DC5:#45CDE9>You have unequipped <cosmetic>!"
|
unequip-cosmetic: "%prefix% <gradient:#6D9DC5:#45CDE9>You have unequipped <cosmetic>!"
|
||||||
|
|||||||
Reference in New Issue
Block a user