diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index bf224e9a..a3b412c7 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -116,5 +116,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/1.16/build/libs/1.16.jar b/1.16/build/libs/1.16.jar
index 2cd4a89d..23ab0d98 100644
Binary files a/1.16/build/libs/1.16.jar and b/1.16/build/libs/1.16.jar differ
diff --git a/1.16/build/tmp/compileJava/previous-compilation-data.bin b/1.16/build/tmp/compileJava/previous-compilation-data.bin
index eae32342..17fb457d 100644
Binary files a/1.16/build/tmp/compileJava/previous-compilation-data.bin and b/1.16/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/1.17/build/libs/1.17.jar b/1.17/build/libs/1.17.jar
index 234465f9..4504dc70 100644
Binary files a/1.17/build/libs/1.17.jar and b/1.17/build/libs/1.17.jar differ
diff --git a/1.17/build/tmp/compileJava/previous-compilation-data.bin b/1.17/build/tmp/compileJava/previous-compilation-data.bin
index 380d6dd3..3de18d53 100644
Binary files a/1.17/build/tmp/compileJava/previous-compilation-data.bin and b/1.17/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/1.18/build/libs/1.18.jar b/1.18/build/libs/1.18.jar
index 226448a8..8d6b3d9c 100644
Binary files a/1.18/build/libs/1.18.jar and b/1.18/build/libs/1.18.jar differ
diff --git a/1.18/build/tmp/compileJava/previous-compilation-data.bin b/1.18/build/tmp/compileJava/previous-compilation-data.bin
index acd0272a..7c279fd9 100644
Binary files a/1.18/build/tmp/compileJava/previous-compilation-data.bin and b/1.18/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/common/build.gradle.kts b/common/build.gradle.kts
index 7b728679..11d8c057 100644
--- a/common/build.gradle.kts
+++ b/common/build.gradle.kts
@@ -20,7 +20,8 @@ repositories {
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://mvnrepository.com/artifact/com.zaxxer/HikariCP")
maven("https://repo.jeff-media.de/maven2/")
- maven("https://repo.citizensnpcs.co");
+ maven("https://repo.citizensnpcs.co")
+ maven("https://mvn.lumine.io/repository/maven-public")
}
dependencies {
@@ -36,6 +37,7 @@ dependencies {
compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
compileOnly("com.github.LoneDev6:API-ItemsAdder:2.5.4")
compileOnly("net.citizensnpcs:citizens-main:2.0.29-SNAPSHOT")
+ compileOnly("com.ticxo.modelengine:api:R2.4.1:")
implementation("net.kyori:adventure-api:4.9.3")
implementation ("net.kyori:adventure-text-minimessage:4.10.0-SNAPSHOT")
implementation("net.kyori:adventure-platform-bukkit:4.0.1")
@@ -93,7 +95,7 @@ bukkit {
apiVersion = "1.16"
name = "HMCCosmetics"
authors = listOf("MasterOfTheFish")
- softDepend = listOf("Multiverse", "PlaceholderAPI", "Oraxen", "ItemsAdder", "Citizens")
+ softDepend = listOf("Multiverse", "PlaceholderAPI", "Oraxen", "ItemsAdder", "Citizens", "ModelEngine")
depend = listOf("ProtocolLib")
permissions {
register("hmccosmetics.cmd.default") {
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class
index b19e0e44..c68a1a88 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class
index b2fd391c..19953fe4 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class
index 0a36d689..6549888b 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings$1.class
index 6ddef897..37acca85 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings$1.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.class
index 31d5cd07..3c8ba85a 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class
index 30bbf14d..c1a766b4 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class
index 16d454bf..06030ae4 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.class
index b1996cd4..dbd441a0 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.class
index ed41d847..ebba4363 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class
index 37fcb864..eeedbae9 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class
index e3a7b37c..fa1fd9be 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class
index 29e49c88..2cd5f31f 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class
index c0c4cf98..7c0a04cb 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.class
index 53345e8b..f249630c 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class
index 77ba2649..748c5137 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.class
deleted file mode 100644
index e4cc46dc..00000000
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.class and /dev/null differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.class
index b5796d4e..7ab44321 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class
index 1520afb8..570376c3 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class
index 375db034..483b904b 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class
index e98d4bbe..d8ad0244 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/packet/PacketManager.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/packet/PacketManager.class
index cc057615..3bff95bb 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/packet/PacketManager.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/packet/PacketManager.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class
index 01b92a7f..c274515f 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class
index f51a5042..21db65e8 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class
index 658bffc7..82851050 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class differ
diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class
index 084ebbed..2a398e6e 100644
Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class differ
diff --git a/common/build/generated/plugin-yml/Bukkit/plugin.yml b/common/build/generated/plugin-yml/Bukkit/plugin.yml
index 1cad557f..7397355e 100644
--- a/common/build/generated/plugin-yml/Bukkit/plugin.yml
+++ b/common/build/generated/plugin-yml/Bukkit/plugin.yml
@@ -1,5 +1,5 @@
name: HMCCosmetics
-version: 1.9.3
+version: 1.9.4
main: io.github.fisher2911.hmccosmetics.HMCCosmetics
description: |
Intuitive, easy-to-use cosmetics plugin, designed for servers using resource packs.
@@ -37,3 +37,4 @@ softdepend:
- Oraxen
- ItemsAdder
- Citizens
+ - ModelEngine
diff --git a/common/build/libs/HMCCosmetics.jar b/common/build/libs/HMCCosmetics.jar
index f0b2c9d2..cb0656d3 100644
Binary files a/common/build/libs/HMCCosmetics.jar and b/common/build/libs/HMCCosmetics.jar differ
diff --git a/common/build/resources/main/config.yml b/common/build/resources/main/config.yml
index 84b4ba64..39ca6a7d 100644
--- a/common/build/resources/main/config.yml
+++ b/common/build/resources/main/config.yml
@@ -13,6 +13,11 @@ cosmetic-settings:
# setting this to lower than the server player view distance should fix the
# bug where players see random backpacks
view-distance: 32
+ # how the balloon should be positioned relative to the player
+ balloon-offset:
+ x: 0.5
+ y: 3
+ z: 0.5
wardrobe:
# if true, the wardrobe will be removed when the player is damaged
disable-on-damage: true
diff --git a/common/build/resources/main/menus/main.yml b/common/build/resources/main/menus/main.yml
index f3be4f22..8c31c114 100644
--- a/common/build/resources/main/menus/main.yml
+++ b/common/build/resources/main/menus/main.yml
@@ -104,6 +104,20 @@ items:
type: BOOTS
permission: ""
id: boots
+ 8:
+ material: BARRIER
+ name: "Balloon"
+ lore:
+ - ""
+ - "Enabled: <#6D9DC5>%enabled%"
+ - "Allowed: <#6D9DC5>%allowed%"
+ locked-lore:
+ - "You do not own this item!"
+ amount: 1
+ type: BALLOON
+ permission: ""
+ id: barrier
+ balloon: "kindletronjr"
37:
material: PAPER
name: "<#40B7D6>Previous Page"
diff --git a/common/build/resources/main/plugin.yml b/common/build/resources/main/plugin.yml
index 1cad557f..7397355e 100644
--- a/common/build/resources/main/plugin.yml
+++ b/common/build/resources/main/plugin.yml
@@ -1,5 +1,5 @@
name: HMCCosmetics
-version: 1.9.3
+version: 1.9.4
main: io.github.fisher2911.hmccosmetics.HMCCosmetics
description: |
Intuitive, easy-to-use cosmetics plugin, designed for servers using resource packs.
@@ -37,3 +37,4 @@ softdepend:
- Oraxen
- ItemsAdder
- Citizens
+ - ModelEngine
diff --git a/common/build/tmp/compileJava/previous-compilation-data.bin b/common/build/tmp/compileJava/previous-compilation-data.bin
index 9c91554e..06cad71c 100644
Binary files a/common/build/tmp/compileJava/previous-compilation-data.bin and b/common/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
index 38c8c2f7..f268cc34 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
@@ -11,7 +11,7 @@ import io.github.fisher2911.hmccosmetics.database.DatabaseFactory;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.gui.CosmeticsMenu;
import io.github.fisher2911.hmccosmetics.hook.HookManager;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
+import io.github.fisher2911.hmccosmetics.hook.CitizensHook;
import io.github.fisher2911.hmccosmetics.hook.item.ItemsAdderHook;
import io.github.fisher2911.hmccosmetics.listener.ClickListener;
import io.github.fisher2911.hmccosmetics.listener.CosmeticFixListener;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
index 9f8cb0ba..e39c0faa 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
@@ -60,7 +60,7 @@ public class HMCCosmeticsAPI {
if (armorItem == null) {
return null;
}
- return new CosmeticItem(new ArmorItem(armorItem));
+ return new CosmeticItem(armorItem.copy());
}
/**
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
index 2e2f0a7b..d92c8311 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
@@ -6,7 +6,7 @@ import io.github.fisher2911.hmccosmetics.config.WardrobeSettings;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.gui.CosmeticsMenu;
import io.github.fisher2911.hmccosmetics.hook.HookManager;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
+import io.github.fisher2911.hmccosmetics.hook.CitizensHook;
import io.github.fisher2911.hmccosmetics.message.Message;
import io.github.fisher2911.hmccosmetics.message.MessageHandler;
import io.github.fisher2911.hmccosmetics.message.Messages;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
index e44a84e5..ae421459 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
@@ -1,8 +1,11 @@
package io.github.fisher2911.hmccosmetics.config;
import org.bukkit.Bukkit;
+import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.util.Vector;
+import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
@ConfigSerializable
@@ -14,6 +17,7 @@ public class CosmeticSettings {
private static final transient String REQUIRE_EMPTY_CHEST_PLATE_PATH = "require-empty-chest-plate";
private static final transient String REQUIRE_EMPTY_PANTS_PATH = "require-empty-pants";
private static final transient String REQUIRE_EMPTY_BOOTS_PATH = "require-empty-boots";
+ private static final transient String BALLOON_OFFSET = "balloon-offset";
private static final transient String LOOK_DOWN_PITCH_PATH = "look-down-backpack-remove";
private static final String VIEW_DISTANCE_PATH = "view-distance";
@@ -25,6 +29,7 @@ public class CosmeticSettings {
private boolean requireEmptyBoots;
private int lookDownPitch;
private int viewDistance;
+ private Vector balloonOffset;
public void load(final FileConfiguration config) {
this.requireEmptyHelmet = config.getBoolean(COSMETIC_SETTINGS_PATH + "." + REQUIRE_EMPTY_HELMET_PATH);
@@ -35,6 +40,16 @@ public class CosmeticSettings {
this.lookDownPitch = config.getInt(COSMETIC_SETTINGS_PATH + "." + LOOK_DOWN_PITCH_PATH);
this.viewDistance = config.getInt(COSMETIC_SETTINGS_PATH + "." + VIEW_DISTANCE_PATH);
+
+ final var balloonSection = config.getConfigurationSection(COSMETIC_SETTINGS_PATH + "." + BALLOON_OFFSET);
+
+ if (balloonSection != null) {
+ this.balloonOffset = loadVector(balloonSection);
+ }
+ }
+
+ private Vector loadVector(final ConfigurationSection section) {
+ return new Vector(section.getDouble("x"), section.getDouble("y"), section.getDouble("z"));
}
public boolean isRequireEmptyHelmet() {
@@ -77,6 +92,10 @@ public class CosmeticSettings {
this.requireEmptyBoots = requireEmptyBoots;
}
+ public Vector getBalloonOffset() {
+ return balloonOffset;
+ }
+
public int getLookDownPitch() {
return lookDownPitch;
}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
index e60daac6..c9f7bfe4 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
@@ -4,6 +4,7 @@ import dev.triumphteam.gui.components.GuiAction;
import dev.triumphteam.gui.guis.GuiItem;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
+import io.github.fisher2911.hmccosmetics.gui.BalloonItem;
import io.github.fisher2911.hmccosmetics.hook.HookManager;
import io.github.fisher2911.hmccosmetics.util.Keys;
import io.github.fisher2911.hmccosmetics.util.StringUtils;
@@ -58,6 +59,7 @@ public class ItemSerializer implements TypeSerializer {
private static final String ACTION = "action";
private static final String ID = "id";
private static final String DYEABLE = "dyeable";
+ private static final String BALLOON_MODEL_ID = "balloon";
static {
plugin = HMCCosmetics.getPlugin(HMCCosmetics.class);
@@ -100,6 +102,7 @@ public class ItemSerializer implements TypeSerializer {
final ConfigurationNode actionNode = source.node(ACTION);
final ConfigurationNode idNode = source.node(ID);
final ConfigurationNode dyeableNode = source.node(DYEABLE);
+ final ConfigurationNode balloonModelIdNode = source.node(BALLOON_MODEL_ID);
final String materialString = Utils.replaceIfNull(materialNode.getString(), "");
final int amount = amountNode.getInt();
@@ -227,6 +230,20 @@ public class ItemSerializer implements TypeSerializer {
final String permission = permissionNode.getString();
+ if (cosmeticType == ArmorItem.Type.BALLOON) {
+ return new BalloonItem(
+ itemStack,
+ actions,
+ Utils.replaceIfNull(idNode.getString(), ""),
+ lockedLore,
+ permission,
+ cosmeticType,
+ dyeable,
+ -1,
+ balloonModelIdNode.getString()
+ );
+ }
+
return new ArmorItem(
itemStack,
actions,
@@ -238,6 +255,8 @@ public class ItemSerializer implements TypeSerializer {
-1
);
+
+
} catch (final IllegalArgumentException exception) {
final GuiItem guiItem = dev.triumphteam.gui.builder.item.ItemBuilder.from(itemStack).asGuiItem();
guiItem.setAction(event -> {
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
index 26212f2f..eee1b6ba 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
@@ -10,13 +10,13 @@ import io.github.fisher2911.hmccosmetics.database.dao.ArmorItemDAO;
import io.github.fisher2911.hmccosmetics.database.dao.CitizenDAO;
import io.github.fisher2911.hmccosmetics.database.dao.UserDAO;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
-import io.github.fisher2911.hmccosmetics.hook.HookManager;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
-import io.github.fisher2911.hmccosmetics.user.BaseUser;
+import io.github.fisher2911.hmccosmetics.user.EntityIds;
import io.github.fisher2911.hmccosmetics.user.NPCUser;
import io.github.fisher2911.hmccosmetics.user.User;
+import io.github.fisher2911.hmccosmetics.user.Wardrobe;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Entity;
import java.sql.SQLException;
import java.util.List;
@@ -24,35 +24,15 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
-import io.github.fisher2911.hmccosmetics.user.UserFactory;
-import io.github.fisher2911.hmccosmetics.user.Wardrobe;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-
public class Database {
protected final HMCCosmetics plugin;
- final Dao userDao;
- final Dao citizenDao;
- final Dao armorItemDao;
+ private final Dao userDao;
+ private final Dao citizenDao;
+ private final Dao armorItemDao;
private final ConnectionSource dataSource;
private final DatabaseType databaseType;
AtomicInteger FAKE_ENTITY_ID = new AtomicInteger(Integer.MAX_VALUE);
- String TABLE_NAME = "user";
- String PLAYER_UUID_COLUMN = "uuid";
- String BACKPACK_COLUMN = "backpack";
- String HAT_COLUMN = "hat";
- String DYE_COLOR_COLUMN = "dye";
- String CREATE_TABLE_STATEMENT =
- "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
- PLAYER_UUID_COLUMN + " CHAR(36), " +
- BACKPACK_COLUMN + " CHAR(50), " +
- HAT_COLUMN + " CHAR(50), " +
- DYE_COLOR_COLUMN + " INT, " +
- "UNIQUE (" +
- PLAYER_UUID_COLUMN +
- "))";
public Database(
final HMCCosmetics plugin,
@@ -64,7 +44,6 @@ public class Database {
this.citizenDao = DaoManager.createDao(this.dataSource, CitizenDAO.class);
this.armorItemDao = DaoManager.createDao(this.dataSource, ArmorItemDAO.class);
this.databaseType = databaseType;
-
}
public void load() {
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
index 1bbb39a3..44eeeada 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
@@ -3,7 +3,7 @@ package io.github.fisher2911.hmccosmetics.database;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
+import io.github.fisher2911.hmccosmetics.user.EntityIds;
import io.github.fisher2911.hmccosmetics.user.User;
import java.io.File;
@@ -12,9 +12,6 @@ import java.nio.file.Path;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -24,8 +21,6 @@ import java.util.function.Consumer;
import org.bukkit.configuration.file.YamlConfiguration;
-import javax.swing.text.DateFormatter;
-
public class DatabaseConverter {
private static final int CURRENT_VERSION = 2;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
index c5c0e98d..33252910 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
@@ -46,7 +46,7 @@ public class ArmorItemDAO {
if (armorItem == null) {
return null;
}
- final ArmorItem copy = new ArmorItem(armorItem);
+ final ArmorItem copy = armorItem.copy();
copy.setDye(this.rgbDye);
return copy;
}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/CitizenDAO.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/CitizenDAO.java
index 1a46cc63..0fa09ec3 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/CitizenDAO.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/CitizenDAO.java
@@ -5,11 +5,8 @@ import com.j256.ormlite.table.DatabaseTable;
import io.github.fisher2911.hmccosmetics.cosmetic.CosmeticManager;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
-import io.github.fisher2911.hmccosmetics.user.BaseUser;
+import io.github.fisher2911.hmccosmetics.user.EntityIds;
import io.github.fisher2911.hmccosmetics.user.NPCUser;
-import io.github.fisher2911.hmccosmetics.user.User;
-import io.github.fisher2911.hmccosmetics.user.Wardrobe;
import org.jetbrains.annotations.Nullable;
import java.util.List;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
index 2b78b5ea..07ad6ce5 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
@@ -5,9 +5,7 @@ import com.j256.ormlite.table.DatabaseTable;
import io.github.fisher2911.hmccosmetics.cosmetic.CosmeticManager;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
-import io.github.fisher2911.hmccosmetics.user.BaseUser;
-import io.github.fisher2911.hmccosmetics.user.NPCUser;
+import io.github.fisher2911.hmccosmetics.user.EntityIds;
import io.github.fisher2911.hmccosmetics.user.User;
import io.github.fisher2911.hmccosmetics.user.Wardrobe;
import org.jetbrains.annotations.Nullable;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
index 25fce1a8..5e2c5b1d 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
@@ -171,7 +171,7 @@ public class ArmorItem extends GuiItem {
this.dye = dye;
}
- public ArmorItem(final ArmorItem armorItem) {
+ protected ArmorItem(final ArmorItem armorItem) {
super(armorItem.getItemStack(), null);
this.id = armorItem.getId();
this.lockedLore = new ArrayList<>();
@@ -188,6 +188,17 @@ public class ArmorItem extends GuiItem {
}
public static ArmorItem empty(final Type type, final String id) {
+ if (type == Type.BALLOON) {
+ return new BalloonItem(
+ new ItemStack(Material.AIR),
+ id,
+ new ArrayList<>(),
+ "",
+ type,
+ -1,
+ ""
+ );
+ }
return new ArmorItem(
new ItemStack(Material.AIR),
id,
@@ -268,6 +279,9 @@ public class ArmorItem extends GuiItem {
}
public ArmorItem copy() {
+ if (this instanceof final BalloonItem item) {
+ return new BalloonItem(item);
+ }
return new ArmorItem(this);
}
@@ -281,6 +295,7 @@ public class ArmorItem extends GuiItem {
HAT(EquipmentSlot.HEAD),
BACKPACK(null),
+ BALLOON(null),
OFF_HAND(EquipmentSlot.OFF_HAND),
CHEST_PLATE(EquipmentSlot.CHEST),
PANTS(EquipmentSlot.LEGS),
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/BalloonItem.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/BalloonItem.java
new file mode 100644
index 00000000..e6e47905
--- /dev/null
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/BalloonItem.java
@@ -0,0 +1,82 @@
+package io.github.fisher2911.hmccosmetics.gui;
+
+import dev.triumphteam.gui.components.GuiAction;
+import io.github.fisher2911.hmccosmetics.config.CosmeticGuiAction;
+import org.apache.logging.log4j.util.Strings;
+import org.bukkit.Material;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+public class BalloonItem extends ArmorItem {
+
+ private final String modelId;
+
+ public BalloonItem(final BalloonItem item) {
+ this(
+ item.getItemStack(),
+ item.getActions(),
+ item.getId(),
+ item.getLockedLore(),
+ item.getPermission(),
+ item.getType(),
+ item.getDye(),
+ item.getModelId()
+ );
+ }
+
+ public BalloonItem(final @NotNull ItemStack itemStack, final List actions, final String id, final List lockedLore, final String permission, final Type type, final int dye, final String modelId) {
+ super(itemStack, actions, id, lockedLore, permission, type, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull ItemStack itemStack, final String id, final List lockedLore, final String permission, final Type type, final int dye, final String modelId) {
+ super(itemStack, id, lockedLore, permission, type, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull Material material, final String id, final List lockedLore, final String permission, final Type type, final int dye, final String modelId) {
+ super(material, id, lockedLore, permission, type, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull Material material, final List actions, final String id, final List lockedLore, final String permission, final Type type, final int dye, final String modelId) {
+ super(material, actions, id, lockedLore, permission, type, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull ItemStack itemStack, final List actions, final String id, final List lockedLore, final String permission, final Type type, final boolean dyeable, final int dye, final String modelId) {
+ super(itemStack, actions, id, lockedLore, permission, type, dyeable, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull ItemStack itemStack, final String id, final List lockedLore, final String permission, final Type type, final boolean dyeable, final int dye, final String modelId) {
+ super(itemStack, id, lockedLore, permission, type, dyeable, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull Material material, final String id, final List lockedLore, final String permission, final Type type, final boolean dyeable, final int dye, final String modelId) {
+ super(material, id, lockedLore, permission, type, dyeable, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final @NotNull Material material, final @Nullable GuiAction action, final String id, final List lockedLore, final String permission, final Type type, final boolean dyeable, final int dye, final String modelId) {
+ super(material, action, id, lockedLore, permission, type, dyeable, dye);
+ this.modelId = modelId;
+ }
+
+ public BalloonItem(final ArmorItem armorItem, final String modelId) {
+ super(armorItem);
+ this.modelId = modelId;
+ }
+
+ public String getModelId() {
+ if (this.modelId == null) {
+ return Strings.EMPTY;
+ }
+ return this.modelId;
+ }
+}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
index 2b01c0be..7df3aa89 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
@@ -182,7 +182,7 @@ public class CosmeticsMenu {
for (final GuiItem guiItem : gui.guiItemMap.values()) {
if (guiItem instanceof final ArmorItem item) {
- final ArmorItem copy = new ArmorItem(item);
+ final ArmorItem copy = item.copy();
copy.setAction(null);
this.cosmeticManager.addArmorItem(copy);
final String perm = copy.getPermission();
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/CitizensHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/CitizensHook.java
similarity index 99%
rename from common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/CitizensHook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/CitizensHook.java
index 9a7be5e6..cec25a7b 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/CitizensHook.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/CitizensHook.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.hook.item;
+package io.github.fisher2911.hmccosmetics.hook;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.concurrent.Threads;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
index 68821068..d5cc8a28 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
@@ -1,7 +1,6 @@
package io.github.fisher2911.hmccosmetics.hook;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
import io.github.fisher2911.hmccosmetics.hook.item.ItemHook;
import io.github.fisher2911.hmccosmetics.hook.item.ItemHooks;
import io.github.fisher2911.hmccosmetics.hook.item.ItemsAdderHook;
@@ -11,7 +10,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import io.github.fisher2911.hmccosmetics.hook.item.PAPIExpansion;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.PluginManager;
@@ -29,6 +27,7 @@ public class HookManager {
private final ItemHooks itemHooks;
private final PAPIHook papiHook;
private final CitizensHook citizensHook;
+ private final ModelEngineHook modelEngineHook;
private final Set> registeredHooks;
private final Set listeners;
@@ -48,6 +47,7 @@ public class HookManager {
final OraxenHook oraxenHook = new OraxenHook();
final ItemsAdderHook itemsAdderHook = new ItemsAdderHook();
final CitizensHook citizensHook = new CitizensHook(this.plugin);
+ final ModelEngineHook modelEngineHook = new ModelEngineHook();
if (pluginManager.getPlugin("Oraxen") != null) {
itemHookMap.put(oraxenHook.getIdentifier(), oraxenHook);
}
@@ -62,6 +62,12 @@ public class HookManager {
} else {
this.citizensHook = null;
}
+ if (pluginManager.getPlugin("ModelEngine") != null) {
+ this.registerHook(modelEngineHook.getClass());
+ this.modelEngineHook = modelEngineHook;
+ } else {
+ this.modelEngineHook = null;
+ }
this.itemHooks = new ItemHooks(itemHookMap);
itemHookMap.values().forEach(hook -> this.registerHook(hook.getClass()));
@@ -102,6 +108,11 @@ public class HookManager {
return this.citizensHook;
}
+ @Nullable
+ public ModelEngineHook getModelEngineHook() {
+ return modelEngineHook;
+ }
+
public ItemHooks getItemHooks() {
return itemHooks;
}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/ModelEngineHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/ModelEngineHook.java
new file mode 100644
index 00000000..894d7ec2
--- /dev/null
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/ModelEngineHook.java
@@ -0,0 +1,62 @@
+package io.github.fisher2911.hmccosmetics.hook;
+
+import com.ticxo.modelengine.api.ModelEngineAPI;
+import com.ticxo.modelengine.api.model.ActiveModel;
+import com.ticxo.modelengine.api.model.ModeledEntity;
+import com.ticxo.modelengine.api.model.base.BaseEntity;
+import io.github.fisher2911.hmccosmetics.HMCCosmetics;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
+
+public class ModelEngineHook implements Hook {
+
+ private static final String ID = "model-engine";
+
+ public void spawnModel(final String id, final BaseEntity> entity) {
+ if (ModelEngineAPI.getModeledEntity(entity.getUniqueId()) != null) return;
+ final ActiveModel model = ModelEngineAPI.createActiveModel(id);
+ ModeledEntity modeledEntity = ModelEngineAPI.api.getModelManager().createModeledEntity(entity);
+ modeledEntity.addActiveModel(model);
+ }
+
+ public void addPlayerToModel(final Player player, final String id, final BaseEntity> entity) {
+ final ModeledEntity model = ModelEngineAPI.getModeledEntity(entity.getUniqueId());
+
+ if (model == null) {
+ this.spawnModel(id, entity);
+ return;
+ }
+
+ if (model.getPlayerInRange().contains(player)) return;
+ model.addPlayerAsync(player);
+ }
+
+ public void removePlayerFromModel(final Player player, final UUID uuid) {
+ final ModeledEntity model = ModelEngineAPI.getModeledEntity(uuid);
+
+ if (model == null) return;
+
+ model.removePlayerAsync(player);
+ }
+
+ public void remove(final UUID uuid) {
+ final ModeledEntity entity = ModelEngineAPI.getModeledEntity(uuid);
+
+ if (entity == null) return;
+
+ for (final Player player : entity.getPlayerInRange()) {
+ entity.removePlayer(player);
+ }
+
+ entity.getEntity().remove();
+
+ ModelEngineAPI.api.getModelManager().removeModeledEntity(uuid);
+ }
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIExpansion.java
similarity index 98%
rename from common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIExpansion.java
index 6be230de..a44bd258 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/PAPIExpansion.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIExpansion.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.hook.item;
+package io.github.fisher2911.hmccosmetics.hook;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.api.CosmeticItem;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/entity/BalloonEntity.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/entity/BalloonEntity.java
new file mode 100644
index 00000000..660da36f
--- /dev/null
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/entity/BalloonEntity.java
@@ -0,0 +1,258 @@
+package io.github.fisher2911.hmccosmetics.hook.entity;
+
+import com.ticxo.modelengine.api.model.ActiveModel;
+import com.ticxo.modelengine.api.model.ModeledEntity;
+import com.ticxo.modelengine.api.model.base.BaseEntity;
+import com.ticxo.modelengine.api.model.base.EntityData;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.util.Vector;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class BalloonEntity implements BaseEntity {
+
+ private final UUID uuid;
+ private final int entityId;
+ private Vector velocity = new Vector(0, 0, 0);
+ private Location location;
+ private boolean alive;
+
+ public BalloonEntity(final UUID uuid, final int entityId, final Vector velocity, final Location location, final boolean alive) {
+ this.uuid = uuid;
+ this.entityId = entityId;
+ this.velocity = velocity;
+ this.location = location;
+ this.alive = alive;
+ }
+
+ public BalloonEntity(final UUID uuid, final int entityId) {
+ this.uuid = uuid;
+ this.entityId = entityId;
+ this.alive = true;
+ }
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setVelocity(final Vector velocity) {
+ this.velocity = velocity;
+ }
+
+ public void setLocation(final Location location) {
+ this.location = location;
+ }
+
+ public void setAlive(final boolean alive) {
+ this.alive = alive;
+ }
+
+ public boolean isAlive() {
+ return alive;
+ }
+
+ public EntityData getEntityData() {
+ return entityData;
+ }
+
+ @Override
+ public BalloonEntity getBase() {
+ return this;
+ }
+
+ @Override
+ public Location getLocation() {
+ return this.location;
+ }
+
+ @Override
+ public Vector getVelocity() {
+ return velocity;
+ }
+
+ @Override
+ public boolean isOnGround() {
+ return false;
+ }
+
+ @Override
+ public World getWorld() {
+ return this.location.getWorld();
+ }
+
+ @Override
+ public List getNearbyEntities(final double v, final double v1, final double v2) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public int getEntityId() {
+ return -1;
+ }
+
+ @Override
+ public void remove() {
+ this.alive = false;
+ }
+
+ @Override
+ public boolean isCustomNameVisible() {
+ return false;
+ }
+
+ @Override
+ public boolean isDead() {
+ return !this.alive;
+ }
+
+ @Override
+ public UUID getUniqueId() {
+ return this.uuid;
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.PIG;
+ }
+
+ @Override
+ public boolean isInvulnerable() {
+ return true;
+ }
+
+ @Override
+ public boolean hasGravity() {
+ return false;
+ }
+
+ @Override
+ public void setGravity(final boolean flag) {
+
+ }
+
+ @Override
+ public double getHealth() {
+ return 1;
+ }
+
+ @Override
+ public double getMaxHealth() {
+ return 1;
+ }
+
+ @Override
+ public String getCustomName() {
+ return null;
+ }
+
+ @Override
+ public void setCustomName(final String s) {
+
+ }
+
+ @Override
+ public double getMovementSpeed() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getItemInMainHand() {
+ return null;
+ }
+
+ @Override
+ public ItemStack getItemInOffHand() {
+ return null;
+ }
+
+ @Override
+ public boolean isLivingEntity() {
+ return false;
+ }
+
+ @Override
+ public void addPotionEffect(final PotionEffect potion) {
+
+ }
+
+ @Override
+ public void removePotionEffect(final PotionEffectType potion) {
+
+ }
+
+ @Override
+ public void setEntitySize(final float width, final float height, final float eye) {
+
+ }
+
+ @Override
+ public void sendDespawnPacket(final ModeledEntity modeledEntity) {
+
+ }
+
+ @Override
+ public void sendSpawnPacket(final ModeledEntity modeledEntity) {
+
+ }
+
+ @Override
+ public double getLastX() {
+ return this.location.getX();
+ }
+
+ @Override
+ public double getLastY() {
+ return this.location.getY();
+ }
+
+ @Override
+ public double getLastZ() {
+ return this.location.getZ();
+ }
+
+ @Override
+ public double getWantedX() {
+ return this.location.getX();
+ }
+
+ @Override
+ public double getWantedY() {
+ return this.location.getY();
+ }
+
+ @Override
+ public double getWantedZ() {
+ return this.location.getZ();
+ }
+
+ @Override
+ public void saveModelList(final Map models) {
+
+ }
+
+ @Override
+ public void saveModelInfo(final ModeledEntity model) {
+
+ }
+
+ @Override
+ public List getModelList() {
+ return Collections.emptyList();
+ }
+
+ final EntityData entityData = new EntityData();
+
+ @Override
+ public EntityData loadModelInfo() {
+ return this.entityData;
+ }
+}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
index ba760352..2d2c516a 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
@@ -1,6 +1,8 @@
package io.github.fisher2911.hmccosmetics.inventory;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
+import org.bukkit.Bukkit;
+
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
index b1ba22ad..e0313d92 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
@@ -54,6 +54,8 @@ public class JoinListener implements Listener {
optionalUser.ifPresent(user -> {
final Wardrobe wardrobe = user.getWardrobe();
+ user.despawnAttached();
+
if (wardrobe.isActive()) {
Bukkit.getScheduler().runTaskAsynchronously(
this.plugin,
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
index 30603499..4ce99b43 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
@@ -35,6 +35,10 @@ public class Messages {
new Message("set-boots", "Set boots");
public static final Message REMOVED_BOOTS =
new Message("removed-boots", "Removed boots");
+ public static final Message SET_BALLOON =
+ new Message("set-balloon", "Set balloon");
+ public static final Message REMOVED_BALLOON =
+ new Message("removed-balloon", "Removed balloon");
public static final Message SET_DYE_COLOR =
new Message("set-dye-color", "Set dye color of " + Placeholder.ITEM);
public static final Message MUST_BE_PLAYER =
@@ -110,6 +114,10 @@ public class Messages {
"set-other-boots", ChatColor.GREEN + "You have set the boots of " +
Placeholder.PLAYER + " to " + Placeholder.TYPE + "."
);
+ public static final Message SET_OTHER_BALLOON = new Message(
+ "set-other-balloon", ChatColor.GREEN + "You have set the balloon of " +
+ Placeholder.PLAYER + " to " + Placeholder.TYPE + "."
+ );
public static Message getSetMessage(final ArmorItem.Type type) {
return switch (type) {
@@ -119,6 +127,7 @@ public class Messages {
case CHEST_PLATE -> Messages.SET_CHEST_PLATE;
case PANTS -> Messages.SET_PANTS;
case BOOTS -> Messages.SET_BOOTS;
+ case BALLOON -> Messages.SET_BALLOON;
};
}
@@ -130,6 +139,7 @@ public class Messages {
case CHEST_PLATE -> Messages.REMOVED_CHEST_PLATE;
case PANTS -> Messages.REMOVED_PANTS;
case BOOTS -> Messages.REMOVED_BOOTS;
+ case BALLOON -> Messages.REMOVED_BALLOON;
};
}
@@ -141,6 +151,7 @@ public class Messages {
case CHEST_PLATE -> Messages.SET_OTHER_CHEST_PLATE;
case PANTS -> Messages.SET_OTHER_PANTS;
case BOOTS -> Messages.SET_OTHER_BOOTS;
+ case BALLOON -> Messages.REMOVED_BALLOON;
};
}
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
index ace6654a..bc32beff 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
@@ -7,6 +7,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.MinecraftKey;
import com.comphenix.protocol.wrappers.Pair;
+import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import io.github.fisher2911.nms.ArmorStandPackets;
import io.github.fisher2911.nms.ArmorStandPackets_1_16_R3;
import io.github.fisher2911.nms.ArmorStandPackets_1_17_R1;
@@ -96,7 +97,28 @@ public class PacketManager {
return packet;
}
- public static PacketContainer getLeashPacket(final int entityId, final int balloonId) {
+ public static PacketContainer getInvisibilityPacket(final int entityId) {
+ final PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
+ packet.getIntegers().write(0, entityId);
+
+ WrappedDataWatcher metaData = new WrappedDataWatcher();
+
+ final WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
+
+ metaData.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, byteSerializer), (byte) (0x20));
+
+ packet.getWatchableCollectionModifier().write(0, metaData.getWatchableObjects());
+ return packet;
+ }
+
+ public static PacketContainer getTeleportPacket(final int entityId, final Location location) {
+ final PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
+ packet.getIntegers().write(0, entityId);
+ packet.getDoubles().write(0, location.getX()).write(1, location.getY()).write(2, location.getZ());
+ return packet;
+ }
+
+ public static PacketContainer getLeashPacket(final int balloonId, final int entityId) {
final PacketContainer packet = new PacketContainer(PacketType.Play.Server.ATTACH_ENTITY);
packet.getIntegers().write(0, balloonId).write(1, entityId);
return packet;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/BaseUser.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/BaseUser.java
index 81773c44..ba8e7a5c 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/BaseUser.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/BaseUser.java
@@ -3,15 +3,20 @@ package io.github.fisher2911.hmccosmetics.user;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.Pair;
+import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.config.CosmeticSettings;
import io.github.fisher2911.hmccosmetics.config.Settings;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
+import io.github.fisher2911.hmccosmetics.gui.BalloonItem;
+import io.github.fisher2911.hmccosmetics.hook.HookManager;
+import io.github.fisher2911.hmccosmetics.hook.ModelEngineHook;
+import io.github.fisher2911.hmccosmetics.hook.entity.BalloonEntity;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
import io.github.fisher2911.hmccosmetics.packet.PacketManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -26,22 +31,24 @@ import java.util.UUID;
public abstract class BaseUser {
+ private final HMCCosmetics plugin;
protected final T id;
protected final EntityIds entityIds;
+ protected final BalloonEntity balloon;
protected final PlayerArmor playerArmor;
protected ArmorItem lastSetItem = ArmorItem.empty(ArmorItem.Type.HAT);
- protected boolean hasArmorStand;
- protected boolean hasBallon;
-
// List of players that are currently viewing the armor stand
- protected final Set viewing = new HashSet<>();
+ protected final Set viewingArmorStand = new HashSet<>();
+ protected final Set viewingBalloon = new HashSet<>();
public BaseUser(final T id, final PlayerArmor playerArmor, final EntityIds entityIds) {
this.id = id;
this.entityIds = entityIds;
this.playerArmor = playerArmor;
+ this.plugin = HMCCosmetics.getPlugin(HMCCosmetics.class);
+ this.balloon = new BalloonEntity(UUID.randomUUID(), -1);
}
@Nullable
@@ -89,76 +96,111 @@ public abstract class BaseUser {
this.updateOutsideCosmetics(other, location, settings);
}
- private void despawnBalloon(final Player other) {
- final PacketContainer removePacket = PacketManager.getEntityDestroyPacket(this.getBalloonId());
- PacketManager.sendPacket(other, removePacket);
+ protected void despawnBalloon() {
+ final HookManager hookManager = HookManager.getInstance();
+ if (!hookManager.isEnabled(ModelEngineHook.class)) return;
+ hookManager.getModelEngineHook().remove(this.balloon.getUniqueId());
+ PacketManager.sendPacketToOnline(PacketManager.getEntityDestroyPacket(this.getBalloonId()));
+ this.viewingBalloon.clear();
+ }
+
+ protected void despawnBalloon(final Player other) {
+ final HookManager hookManager = HookManager.getInstance();
+ if (!hookManager.isEnabled(ModelEngineHook.class)) return;
+ hookManager.getModelEngineHook().removePlayerFromModel(other, this.balloon.getUniqueId());
+ PacketManager.sendPacket(other, PacketManager.getEntityDestroyPacket(this.getBalloonId()));
+ this.viewingBalloon.remove(other.getUniqueId());
+ if (this.viewingBalloon.isEmpty()) {
+ this.despawnBalloon();
+ }
}
private void spawnBalloon(final Player other, final Location location, final CosmeticSettings settings) {
- final Location actual = location.add(0, 5, 0);
- final PacketContainer spawnPacket = PacketManager.getEntitySpawnPacket(actual, this.getBalloonId(), EntityType.PIG);
- final PacketContainer leashPacket = PacketManager.getLeashPacket(this.getBalloonId(), this.getEntityId());
- PacketManager.sendPacket(other, spawnPacket, leashPacket);
+ final Location actual = location.clone().add(settings.getBalloonOffset());
+ final World world = location.getWorld();
+ if (world == null) return;
+
+ final BalloonItem balloonItem = (BalloonItem) this.playerArmor.getItem(ArmorItem.Type.BALLOON);
+ final String id = balloonItem.getModelId();
+ final HookManager hookManager = HookManager.getInstance();
+ if (id.isBlank() || !hookManager.isEnabled(ModelEngineHook.class)) return;
+ other.sendMessage("Spawned balloon");
+ this.balloon.setAlive(true);
+ this.viewingBalloon.add(other.getUniqueId());
+ this.balloon.setLocation(actual);
+
+ final ModelEngineHook hook = hookManager.getModelEngineHook();
+ hook.spawnModel(id, this.balloon);
+ hook.addPlayerToModel(other, id, this.balloon);
+ this.updateBalloon(other, location, settings);
+ PacketManager.sendPacket(
+ other,
+ PacketManager.getEntitySpawnPacket(
+ actual,
+ this.getBalloonId(),
+ EntityType.PIG
+ ),
+ PacketManager.getInvisibilityPacket(this.getBalloonId()),
+ PacketManager.getLeashPacket(
+ this.getBalloonId(),
+ this.getEntityId()
+ )
+ );
}
- private void updateBalloon(final CosmeticSettings settings) {
- final Location location = this.getLocation();
- for (final Player player : Bukkit.getOnlinePlayers()) {
- if (!this.hasBallon) {
- this.spawnBalloon(player, location, settings);
- } else {
- this.updateBalloon(player, location, settings);
- }
+ protected void updateBalloon(final Player other, final Location location, final CosmeticSettings settings) {
+ if (!this.viewingBalloon.contains(other.getUniqueId())) {
+ this.spawnBalloon(other, location, settings);
+ return;
}
- this.hasBallon = true;
+ final Location actual = location.clone().add(settings.getBalloonOffset());
+ this.balloon.setLocation(actual);
+ PacketManager.sendPacket(
+ other,
+ PacketManager.getTeleportPacket(this.getBalloonId(), actual)
+ );
}
- private void updateBalloon(final Player other, final Location location, final CosmeticSettings settings) {
-// final PacketContainer spawnPacket = PacketManager.getEntitySpawnPacket(location, this.getBalloonId(), EntityType.PARROT);
-// PacketManager.sendPacket(other, spawnPacket, spawnPacket);
- }
-
- private void spawnArmorStand(final Player other, final Location location, final CosmeticSettings settings) {
-// if (!this.isInViewDistance(this.getLocation(), other.getLocation(), settings) || !shouldShow(other)) return;
+ private void spawnArmorStand(final Player other, final Location location) {
final PacketContainer packet = PacketManager.getEntitySpawnPacket(location, this.getArmorStandId(), EntityType.ARMOR_STAND);
PacketManager.sendPacket(other, packet);
}
-// private void spawnArmorStand(final Settings settings) {
-// if (this.hasArmorStand) {
-// this.updateArmorStand(settings);
-// return;
-// }
-//
-// for (final Player p : Bukkit.getOnlinePlayers()) {
-// this.spawnArmorStand(p, this.getLocation(), settings.getCosmeticSettings());
-// }
-//
-// this.hasArmorStand = true;
-// }
-
- public void updateOutsideCosmetics(final Player player, final Settings settings) {
- this.updateOutsideCosmetics(player, this.getLocation(), settings);
- }
-
public void updateOutsideCosmetics(final Settings settings) {
+ final Location location = this.getLocation();
+ if (location == null) return;
for (final Player player : Bukkit.getOnlinePlayers()) {
- this.spawnOutsideCosmetics(player, this.getLocation(), settings);
+ this.spawnOutsideCosmetics(player, location, settings);
}
}
public void updateOutsideCosmetics(final Player other, final Location location, final Settings settings) {
- final boolean inViewDistance = this.isInViewDistance(this.getLocation(), other.getLocation(), settings.getCosmeticSettings());
- if (!this.viewing.contains(other.getUniqueId())) {
- if (!inViewDistance || !shouldShow(other)) return;
- this.spawnArmorStand(other, location, settings.getCosmeticSettings());
- this.spawnBalloon(other, location, settings.getCosmeticSettings());
- } else if (!inViewDistance || !shouldShow(other)) {
+ final boolean inViewDistance = this.isInViewDistance(location, other.getLocation(), settings.getCosmeticSettings());
+ final boolean shouldShow = shouldShow(other);
+ final UUID otherUUID = other.getUniqueId();
+ if (!this.viewingArmorStand.contains(otherUUID)) {
+ if (!inViewDistance || !shouldShow) {
+ if (this.viewingBalloon.contains(otherUUID)) {
+ this.despawnAttached(other);
+ }
+ return;
+ }
+ this.spawnArmorStand(other, location);
+ this.viewingArmorStand.add(otherUUID);
+ } else if (!inViewDistance || !shouldShow) {
this.despawnAttached(other);
- this.despawnBalloon(other);
- this.viewing.remove(other.getUniqueId());
+ if (this.viewingBalloon.contains(otherUUID)) {
+ this.despawnBalloon(other);
+ }
return;
}
+
+ if (!this.viewingBalloon.contains(otherUUID)) {
+ this.spawnBalloon(other, location, settings.getCosmeticSettings());
+ } else if (!this.hasBalloon()) {
+ this.despawnBalloon(other);
+ }
+
final List> equipmentList = new ArrayList<>();
final boolean hidden = !this.shouldShow(other);
if (hidden) {
@@ -180,7 +222,6 @@ public abstract class BaseUser {
PacketManager.sendPacket(other, armorPacket, armorStandMetaContainer, rotationPacket, ridingPacket);
if (hidden) return;
-
this.updateBalloon(other, location, settings.getCosmeticSettings());
final int lookDownPitch = settings.getCosmeticSettings().getLookDownPitch();
@@ -196,6 +237,11 @@ public abstract class BaseUser {
}
}
+ private boolean hasBalloon() {
+ return (this.playerArmor.getItem(ArmorItem.Type.BALLOON) instanceof final BalloonItem balloonItem &&
+ !balloonItem.getModelId().isBlank());
+ }
+
public abstract boolean shouldShow(final Player other);
protected boolean isInViewDistance(final Location location, final Location other, final CosmeticSettings settings) {
@@ -209,17 +255,12 @@ public abstract class BaseUser {
public void despawnAttached(final Player other) {
PacketManager.sendPacket(other, PacketManager.getEntityDestroyPacket(this.getArmorStandId()));
- this.viewing.remove(other.getUniqueId());
- this.hasArmorStand = false;
+ this.viewingArmorStand.remove(other.getUniqueId());
}
public void despawnAttached() {
PacketManager.sendPacketToOnline(PacketManager.getEntityDestroyPacket(this.getArmorStandId()));
- this.hasArmorStand = false;
- }
-
- public boolean hasArmorStand() {
- return hasArmorStand;
+ this.viewingArmorStand.clear();
}
public ArmorItem getLastSetItem() {
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/EntityIds.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/EntityIds.java
similarity index 94%
rename from common/src/main/java/io/github/fisher2911/hmccosmetics/packet/EntityIds.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/user/EntityIds.java
index 8447776c..a030f408 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/EntityIds.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/EntityIds.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.packet;
+package io.github.fisher2911.hmccosmetics.user;
import java.util.EnumMap;
import java.util.Map;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/NPCUser.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/NPCUser.java
index c9e0a18d..07381765 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/NPCUser.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/NPCUser.java
@@ -1,9 +1,8 @@
package io.github.fisher2911.hmccosmetics.user;
import io.github.fisher2911.hmccosmetics.hook.HookManager;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
+import io.github.fisher2911.hmccosmetics.hook.CitizensHook;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
index 18890a40..c1c469df 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
@@ -3,7 +3,6 @@ package io.github.fisher2911.hmccosmetics.user;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.gui.CosmeticGui;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserFactory.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserFactory.java
index d8e66864..ff8729f5 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserFactory.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserFactory.java
@@ -2,9 +2,8 @@ package io.github.fisher2911.hmccosmetics.user;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.hook.HookManager;
-import io.github.fisher2911.hmccosmetics.hook.item.CitizensHook;
+import io.github.fisher2911.hmccosmetics.hook.CitizensHook;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.Nullable;
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
index f1339d44..80edb3d8 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
@@ -1,11 +1,5 @@
package io.github.fisher2911.hmccosmetics.user;
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.ProtocolLibrary;
-import com.comphenix.protocol.events.ListenerPriority;
-import com.comphenix.protocol.events.PacketAdapter;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.Pair;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
@@ -29,7 +23,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -39,6 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
public class UserManager {
@@ -46,7 +40,7 @@ public class UserManager {
private final Settings settings;
private final MessageHandler messageHandler;
- private final Map userMap = new HashMap<>();
+ private final Map userMap = new ConcurrentHashMap<>();
public UserManager(final HMCCosmetics plugin) {
this.plugin = plugin;
@@ -106,7 +100,6 @@ public class UserManager {
public void updateCosmetics(final UUID uuid) {
this.get(uuid).ifPresent(this::updateCosmetics);
-
}
public void updateCosmetics(final BaseUser user) {
diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
index 5e02d5f3..d42b4169 100644
--- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
@@ -2,11 +2,9 @@ package io.github.fisher2911.hmccosmetics.user;
import com.comphenix.protocol.events.PacketContainer;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
-import io.github.fisher2911.hmccosmetics.config.Settings;
import io.github.fisher2911.hmccosmetics.config.WardrobeSettings;
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.EntityIds;
import io.github.fisher2911.hmccosmetics.packet.PacketManager;
import io.github.fisher2911.hmccosmetics.task.SupplierTask;
import io.github.fisher2911.hmccosmetics.task.Task;
@@ -103,7 +101,6 @@ public class Wardrobe extends User {
this.plugin,
() -> {
PacketManager.sendPacket(viewer, playerInfoPacket, playerSpawnPacket);
- this.spawnOutsideCosmetics(viewer, this.currentLocation, this.plugin.getSettings());
this.updateOutsideCosmetics(viewer, this.currentLocation, plugin.getSettings());
PacketManager.sendPacket(
viewer,
@@ -119,11 +116,6 @@ public class Wardrobe extends User {
this.startSpinTask(viewer);
}
- @Override
- public void updateOutsideCosmetics(final Player player, final Settings settings) {
- this.updateOutsideCosmetics(player, this.currentLocation, settings);
- }
-
public void despawnFakePlayer(final Player viewer) {
this.active = false;
final WardrobeSettings settings = this.plugin.getSettings().getWardrobeSettings();
@@ -138,6 +130,7 @@ public class Wardrobe extends User {
// PacketManager.getEntityDestroyPacket(this.viewerId)
);
this.despawnAttached();
+ this.despawnBalloon();
this.showPlayer(this.plugin.getUserManager());
this.spawned = false;
this.cameraLocked = false;
@@ -167,7 +160,10 @@ public class Wardrobe extends User {
PacketManager.sendPacket(player, PacketManager.getLookPacket(this.getEntityId(), location));
this.updateOutsideCosmetics(player, location, this.plugin.getSettings());
location.setYaw(this.getNextYaw(yaw - 30, rotationSpeed));
- PacketManager.sendPacket(player, PacketManager.getRotationPacket(this.getEntityId(), location));
+ PacketManager.sendPacket(
+ player,
+ PacketManager.getRotationPacket(this.getEntityId(), location)
+ );
data.set(this.getNextYaw(yaw, rotationSpeed));
},
() -> !this.spawned || this.currentLocation == null
diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml
index 84b4ba64..39ca6a7d 100644
--- a/common/src/main/resources/config.yml
+++ b/common/src/main/resources/config.yml
@@ -13,6 +13,11 @@ cosmetic-settings:
# setting this to lower than the server player view distance should fix the
# bug where players see random backpacks
view-distance: 32
+ # how the balloon should be positioned relative to the player
+ balloon-offset:
+ x: 0.5
+ y: 3
+ z: 0.5
wardrobe:
# if true, the wardrobe will be removed when the player is damaged
disable-on-damage: true
diff --git a/common/src/main/resources/menus/main.yml b/common/src/main/resources/menus/main.yml
index f3be4f22..8c31c114 100644
--- a/common/src/main/resources/menus/main.yml
+++ b/common/src/main/resources/menus/main.yml
@@ -104,6 +104,20 @@ items:
type: BOOTS
permission: ""
id: boots
+ 8:
+ material: BARRIER
+ name: "Balloon"
+ lore:
+ - ""
+ - "Enabled: <#6D9DC5>%enabled%"
+ - "Allowed: <#6D9DC5>%allowed%"
+ locked-lore:
+ - "You do not own this item!"
+ amount: 1
+ type: BALLOON
+ permission: ""
+ id: barrier
+ balloon: "kindletronjr"
37:
material: PAPER
name: "<#40B7D6>Previous Page"
diff --git a/nms/build/libs/nms.jar b/nms/build/libs/nms.jar
index a10169de..b88d39dc 100644
Binary files a/nms/build/libs/nms.jar and b/nms/build/libs/nms.jar differ
diff --git a/nms/build/tmp/compileJava/previous-compilation-data.bin b/nms/build/tmp/compileJava/previous-compilation-data.bin
index ce47f889..0ebf9e27 100644
Binary files a/nms/build/tmp/compileJava/previous-compilation-data.bin and b/nms/build/tmp/compileJava/previous-compilation-data.bin differ