diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 659bf431..d4ff5c91 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..3f2c0380
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 1fff01b8..3711232a 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,7 +12,10 @@
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index d5467869..80bd9982 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -1,60 +1,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -67,9 +52,39 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -77,19 +92,19 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinScripting.xml b/.idea/kotlinScripting.xml
new file mode 100644
index 00000000..bc444dea
--- /dev/null
+++ b/.idea/kotlinScripting.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/1.17/HMCCosmetics.1.17.main.iml b/.idea/modules/1.17/HMCCosmetics.1.17.main.iml
new file mode 100644
index 00000000..d35a0362
--- /dev/null
+++ b/.idea/modules/1.17/HMCCosmetics.1.17.main.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ SPIGOT
+ MCP
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/1.17/HMCCosmetics.1.17.test.iml b/.idea/modules/1.17/HMCCosmetics.1.17.test.iml
new file mode 100644
index 00000000..c4622759
--- /dev/null
+++ b/.idea/modules/1.17/HMCCosmetics.1.17.test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ ADVENTURE
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/1.18/HMCCosmetics.1.18.main.iml b/.idea/modules/1.18/HMCCosmetics.1.18.main.iml
new file mode 100644
index 00000000..d35a0362
--- /dev/null
+++ b/.idea/modules/1.18/HMCCosmetics.1.18.main.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ SPIGOT
+ MCP
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/1.18/HMCCosmetics.1.18.test.iml b/.idea/modules/1.18/HMCCosmetics.1.18.test.iml
new file mode 100644
index 00000000..c4622759
--- /dev/null
+++ b/.idea/modules/1.18/HMCCosmetics.1.18.test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ ADVENTURE
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/HMCCosmetics.test.iml b/.idea/modules/HMCCosmetics.test.iml
index c4622759..cc08c59f 100644
--- a/.idea/modules/HMCCosmetics.test.iml
+++ b/.idea/modules/HMCCosmetics.test.iml
@@ -1,12 +1,4 @@
-
-
-
-
- ADVENTURE
-
-
-
-
+
\ No newline at end of file
diff --git a/.idea/modules/HMCCosmetics.main.iml b/.idea/modules/common/HMCCosmetics.common.main.iml
similarity index 100%
rename from .idea/modules/HMCCosmetics.main.iml
rename to .idea/modules/common/HMCCosmetics.common.main.iml
diff --git a/.idea/modules/common/HMCCosmetics.common.test.iml b/.idea/modules/common/HMCCosmetics.common.test.iml
index c163761f..c4622759 100644
--- a/.idea/modules/common/HMCCosmetics.common.test.iml
+++ b/.idea/modules/common/HMCCosmetics.common.test.iml
@@ -1,4 +1,12 @@
-
+
+
+
+
+ ADVENTURE
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/nms/HMCCosmetics.nms.main.iml b/.idea/modules/nms/HMCCosmetics.nms.main.iml
new file mode 100644
index 00000000..d35a0362
--- /dev/null
+++ b/.idea/modules/nms/HMCCosmetics.nms.main.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ SPIGOT
+ MCP
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_17_R1.java b/1.17/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_17_R1.java
similarity index 89%
rename from src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_17_R1.java
rename to 1.17/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_17_R1.java
index 9151beb1..8f5a1d92 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_17_R1.java
+++ b/1.17/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_17_R1.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.playerpackets;
+package io.github.fisher2911.nms;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
@@ -8,6 +8,7 @@ import com.comphenix.protocol.wrappers.PlayerInfoData;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.mojang.authlib.GameProfile;
+import io.github.fisher2911.nms.playerpackets.PlayerPackets;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
@@ -15,20 +16,32 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import java.util.UUID;
public class PlayerPackets_1_17_R1 implements PlayerPackets {
- public PacketContainer[] getSpawnPacket(final Location location, final Player player, final UUID uuid, final int entityId) {
+ @Override
+ public PacketContainer getSpawnPacket(final Location location, UUID uuid, final int entityId) {
+ final PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
+ spawnPacket.getUUIDs().write(0, uuid);
+ spawnPacket.getIntegers().write(0, entityId);
+ spawnPacket.getDoubles().
+ write(0, location.getX()).
+ write(1, location.getY()).
+ write(2, location.getZ());
+
+ return spawnPacket;
+ }
+
+ @Override
+ public PacketContainer getPlayerInfoPacket(final Player player, final UUID uuid) {
+ final GameProfile profile = this.getCopyProfile(player, uuid);
final PacketContainer playerInfoPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
final StructureModifier action = playerInfoPacket.getPlayerInfoAction();
final StructureModifier> infoData = playerInfoPacket.getPlayerInfoDataLists();
final List playerInfoData = new ArrayList<>();
- final GameProfile profile = this.getCopyProfile(player, uuid);
-
playerInfoData.add(new PlayerInfoData(WrappedGameProfile
.fromHandle(profile),
0,
@@ -38,20 +51,12 @@ public class PlayerPackets_1_17_R1 implements PlayerPackets {
action.write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
infoData.write(0, playerInfoData);
- final PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
- spawnPacket.getUUIDs().write(0, uuid);
- spawnPacket.getIntegers().write(0, entityId);
- spawnPacket.getDoubles().
- write(0, location.getX()).
- write(1, location.getY()).
- write(2, location.getZ());
-
- return new PacketContainer[]{playerInfoPacket, spawnPacket};
+ return playerInfoPacket;
}
+ @Override
public PacketContainer getRemovePacket(final Player player, final UUID uuid, final int entityId) {
final PacketContainer playerPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
- playerPacket.getIntegers().write(0, entityId);
final StructureModifier action = playerPacket.getPlayerInfoAction();
final StructureModifier> infoData = playerPacket.getPlayerInfoDataLists();
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_18_R1.java b/1.18/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_18_R1.java
similarity index 85%
rename from src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_18_R1.java
rename to 1.18/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_18_R1.java
index 4851670a..dcfbbcf8 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets_1_18_R1.java
+++ b/1.18/src/main/java/io/github/fisher2911/nms/PlayerPackets_1_18_R1.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.playerpackets;
+package io.github.fisher2911.nms;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
@@ -8,10 +8,10 @@ import com.comphenix.protocol.wrappers.PlayerInfoData;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.mojang.authlib.GameProfile;
+import io.github.fisher2911.nms.playerpackets.PlayerPackets;
import org.bukkit.GameMode;
import org.bukkit.Location;
-//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@@ -20,15 +20,28 @@ import java.util.UUID;
public class PlayerPackets_1_18_R1 implements PlayerPackets {
- public PacketContainer[] getSpawnPacket(final Location location, final Player player, final UUID uuid, final int entityId) {
+ @Override
+ public PacketContainer getSpawnPacket(final Location location, UUID uuid, final int entityId) {
+ final PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
+ spawnPacket.getUUIDs().write(0, uuid);
+ spawnPacket.getIntegers().write(0, entityId);
+ spawnPacket.getDoubles().
+ write(0, location.getX()).
+ write(1, location.getY()).
+ write(2, location.getZ());
+
+ return spawnPacket;
+ }
+
+ @Override
+ public PacketContainer getPlayerInfoPacket(final Player player, final UUID uuid) {
+ final GameProfile profile = this.getCopyProfile(player, uuid);
final PacketContainer playerInfoPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
final StructureModifier action = playerInfoPacket.getPlayerInfoAction();
final StructureModifier> infoData = playerInfoPacket.getPlayerInfoDataLists();
final List playerInfoData = new ArrayList<>();
- final GameProfile profile = this.getCopyProfile(player, uuid);
-
playerInfoData.add(new PlayerInfoData(WrappedGameProfile
.fromHandle(profile),
0,
@@ -38,20 +51,12 @@ public class PlayerPackets_1_18_R1 implements PlayerPackets {
action.write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
infoData.write(0, playerInfoData);
- final PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
- spawnPacket.getUUIDs().write(0, uuid);
- spawnPacket.getIntegers().write(0, entityId);
- spawnPacket.getDoubles().
- write(0, location.getX()).
- write(1, location.getY()).
- write(2, location.getZ());
-
- return new PacketContainer[]{playerInfoPacket, spawnPacket};
+ return playerInfoPacket;
}
+ @Override
public PacketContainer getRemovePacket(final Player player, final UUID uuid, final int entityId) {
final PacketContainer playerPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
- playerPacket.getIntegers().write(0, entityId);
final StructureModifier action = playerPacket.getPlayerInfoAction();
final StructureModifier> infoData = playerPacket.getPlayerInfoDataLists();
@@ -77,8 +82,10 @@ public class PlayerPackets_1_18_R1 implements PlayerPackets {
uuid,
player.getDisplayName());
+ System.out.println("Printing Profile Data");
for (final var entry : playerProfile.getProperties().entries()) {
profile.getProperties().put(entry.getKey(), entry.getValue());
+ System.out.println(entry.getKey() + " : " + entry.getValue());
}
return profile;
diff --git a/build.gradle.kts b/build.gradle.kts
index f1c64be4..facee0dd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,110 +1,112 @@
-import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
+//import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
+//
plugins {
id("java")
- id("com.github.johnrengelman.shadow") version "7.1.1"
- id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
}
-
-group = "io.github.fisher2911"
-version = "1.7.1"
-description = "Intuitive, easy-to-use cosmetics plugin, designed for servers using resource packs.\n"
-
-repositories {
- mavenCentral()
- maven("https://papermc.io/repo/repository/maven-public/")
- maven("https://repo.mattstudios.me/artifactory/public/")
- maven("https://jitpack.io")
- maven("https://repo.dmulloy2.net/repository/public/")
- 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://oss.sonatype.org/content/repositories/snapshots")
-}
-
-dependencies {
- compileOnly("com.mojang:authlib:1.5.25")
- compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT")
- compileOnly("org.jetbrains:annotations:22.0.0")
- compileOnly("com.comphenix.protocol:ProtocolLib:4.7.0")
- compileOnly("me.clip:placeholderapi:2.11.1")
- compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
- compileOnly("com.github.LoneDev6:API-ItemsAdder:2.5.4")
- 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")
- implementation("dev.triumphteam:triumph-gui:3.1.1")
- implementation("me.mattstudios.utils:matt-framework:1.4.6")
- implementation("org.spongepowered:configurate-yaml:4.1.2")
- implementation("org.bstats:bstats-bukkit:2.2.1")
- implementation("com.zaxxer:HikariCP:5.0.0")
- implementation("com.j256.ormlite:ormlite-jdbc:6.1")
- implementation("com.j256.ormlite:ormlite-core:6.1")
-}
-
-tasks {
- build {
- dependsOn(shadowJar)
- }
-
- compileJava {
- options.encoding = Charsets.UTF_8.name()
- options.release.set(16)
- }
-
- shadowJar {
- relocate("dev.triumphteam.gui", "io.github.fisher2911.hmccosmetics.gui")
- relocate("me.mattstudios.mf", "io.github.fisher2911.hmccosmetics.mf")
- relocate("net.kyori.adventure.text.minimessage", "io.github.fisher2911.hmccosmetics.adventure.minimessage")
- relocate("net.kyori.adventure.platform", "io.github.fisher2911.hmccosmetics.adventure.platform")
- relocate("org.spongepowered.configurate", "io.github.fisher2911.hmccosmetics.configurate")
- relocate("org.bstats", "io.github.fisher2911.hmccosmetics.bstats")
- relocate("com.zaxxer.hikaricp", "io.github.fisher2911.hmccosmetics.hikaricp")
- relocate("com.j256.ormlite", "io.github.fisher2911.hmccosmetics.ormlite")
- archiveFileName.set("HMCCosmetics.jar")
- }
-
- javadoc {
- options.encoding = Charsets.UTF_8.name()
- }
-
- processResources {
- filteringCharset = Charsets.UTF_8.name()
- }
-}
-
-java {
- toolchain.languageVersion.set(JavaLanguageVersion.of(16))
-}
-
-bukkit {
- load = BukkitPluginDescription.PluginLoadOrder.STARTUP
- main = "io.github.fisher2911.hmccosmetics.HMCCosmetics"
- apiVersion = "1.17"
- name = "HMCCosmetics"
- authors = listOf("MasterOfTheFish")
- softDepend = listOf("Multiverse", "PlaceholderAPI", "Oraxen", "ItemsAdder")
- depend = listOf("ProtocolLib")
- permissions {
- register("hmccosmetics.cmd.default") {
- default = BukkitPluginDescription.Permission.Default.OP
- description = "Permission to execute the default command."
- }
- register("hmccosmetics.cmd.dye") {
- default = BukkitPluginDescription.Permission.Default.OP
- description = "Permission to dye armor."
- }
- register("hmccosmetics.cmd.reload") {
- default = BukkitPluginDescription.Permission.Default.OP
- description = "Permission to use the reload command."
- }
- register("hmccosmetics.cmd.set") {
- default = BukkitPluginDescription.Permission.Default.OP
- description = "Permission to set other users' cosmetics."
- }
- register("hmccosmetics.cmd.wardrobe") {
- default = BukkitPluginDescription.Permission.Default.OP
- description = "Permission to view the wardrobe"
- }
- }
-}
\ No newline at end of file
+// id("com.github.johnrengelman.shadow") version "7.1.1"
+// id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
+//}
+//
+//group = "io.github.fisher2911"
+//version = "1.7.1"
+//description = "Intuitive, easy-to-use cosmetics plugin, designed for servers using resource packs.\n"
+//
+//repositories {
+// mavenCentral()
+// maven("https://papermc.io/repo/repository/maven-public/")
+// maven("https://repo.mattstudios.me/artifactory/public/")
+// maven("https://jitpack.io")
+// maven("https://repo.dmulloy2.net/repository/public/")
+// 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://oss.sonatype.org/content/repositories/snapshots")
+//}
+//
+//dependencies {
+// compileOnly("com.mojang:authlib:1.5.25")
+// compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT")
+// compileOnly("org.jetbrains:annotations:22.0.0")
+// compileOnly("com.comphenix.protocol:ProtocolLib:4.7.0")
+// compileOnly("me.clip:placeholderapi:2.11.1")
+// compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
+// compileOnly("com.github.LoneDev6:API-ItemsAdder:2.5.4")
+// 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")
+// implementation("dev.triumphteam:triumph-gui:3.1.1")
+// implementation("me.mattstudios.utils:matt-framework:1.4.6")
+// implementation("org.spongepowered:configurate-yaml:4.1.2")
+// implementation("org.bstats:bstats-bukkit:2.2.1")
+// implementation("com.zaxxer:HikariCP:5.0.0")
+// implementation("com.j256.ormlite:ormlite-jdbc:6.1")
+// implementation("com.j256.ormlite:ormlite-core:6.1")
+//}
+//
+//tasks {
+// build {
+// dependsOn(shadowJar)
+// }
+//
+// compileJava {
+// options.encoding = Charsets.UTF_8.name()
+// options.release.set(16)
+// }
+//
+// shadowJar {
+// relocate("dev.triumphteam.gui", "io.github.fisher2911.hmccosmetics.gui")
+// relocate("me.mattstudios.mf", "io.github.fisher2911.hmccosmetics.mf")
+// relocate("net.kyori.adventure.text.minimessage", "io.github.fisher2911.hmccosmetics.adventure.minimessage")
+// relocate("net.kyori.adventure.platform", "io.github.fisher2911.hmccosmetics.adventure.platform")
+// relocate("org.spongepowered.configurate", "io.github.fisher2911.hmccosmetics.configurate")
+// relocate("org.bstats", "io.github.fisher2911.hmccosmetics.bstats")
+// relocate("com.zaxxer.hikaricp", "io.github.fisher2911.hmccosmetics.hikaricp")
+// relocate("com.j256.ormlite", "io.github.fisher2911.hmccosmetics.ormlite")
+// archiveFileName.set("HMCCosmetics.jar")
+// }
+//
+// javadoc {
+// options.encoding = Charsets.UTF_8.name()
+// }
+//
+// processResources {
+// filteringCharset = Charsets.UTF_8.name()
+// }
+//}
+//
+//java {
+// toolchain.languageVersion.set(JavaLanguageVersion.of(16))
+//}
+//
+//bukkit {
+// load = BukkitPluginDescription.PluginLoadOrder.STARTUP
+// main = "io.github.fisher2911.hmccosmetics.HMCCosmetics"
+// apiVersion = "1.17"
+// name = "HMCCosmetics"
+// authors = listOf("MasterOfTheFish")
+// softDepend = listOf("Multiverse", "PlaceholderAPI", "Oraxen", "ItemsAdder")
+// depend = listOf("ProtocolLib")
+// permissions {
+// register("hmccosmetics.cmd.default") {
+// default = BukkitPluginDescription.Permission.Default.OP
+// description = "Permission to execute the default command."
+// }
+// register("hmccosmetics.cmd.dye") {
+// default = BukkitPluginDescription.Permission.Default.OP
+// description = "Permission to dye armor."
+// }
+// register("hmccosmetics.cmd.reload") {
+// default = BukkitPluginDescription.Permission.Default.OP
+// description = "Permission to use the reload command."
+// }
+// register("hmccosmetics.cmd.set") {
+// default = BukkitPluginDescription.Permission.Default.OP
+// description = "Permission to set other users' cosmetics."
+// }
+// register("hmccosmetics.cmd.wardrobe") {
+// default = BukkitPluginDescription.Permission.Default.OP
+// description = "Permission to view the wardrobe"
+// }
+// }
+//}
\ No newline at end of file
diff --git a/common/build.gradle.kts b/common/build.gradle.kts
new file mode 100644
index 00000000..b20c34b6
--- /dev/null
+++ b/common/build.gradle.kts
@@ -0,0 +1,114 @@
+import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
+
+plugins {
+ id("java")
+ id("com.github.johnrengelman.shadow") version "7.1.1"
+ id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
+}
+
+group = "io.github.fisher2911"
+version = "1.7.1"
+description = "Intuitive, easy-to-use cosmetics plugin, designed for servers using resource packs.\n"
+
+repositories {
+ mavenCentral()
+ maven("https://papermc.io/repo/repository/maven-public/")
+ maven("https://oss.sonatype.org/content/repositories/snapshots")
+ maven("https://repo.mattstudios.me/artifactory/public/")
+ maven("https://jitpack.io")
+ maven("https://repo.dmulloy2.net/repository/public/")
+ maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
+ maven("https://mvnrepository.com/artifact/com.zaxxer/HikariCP")
+ maven("https://repo.jeff-media.de/maven2/")
+}
+
+dependencies {
+ implementation(project(":1.17"))
+ implementation(project(":1.18"))
+ implementation(project(":nms"))
+ compileOnly("com.mojang:authlib:1.5.25")
+ compileOnly("org.spigotmc:spigot:1.17-R0.1-SNAPSHOT")
+ compileOnly("org.jetbrains:annotations:22.0.0")
+ compileOnly("com.comphenix.protocol:ProtocolLib:4.7.0")
+ compileOnly("me.clip:placeholderapi:2.11.1")
+ compileOnly("com.github.oraxen:oraxen:-SNAPSHOT")
+ compileOnly("com.github.LoneDev6:API-ItemsAdder:2.5.4")
+ 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")
+ implementation("dev.triumphteam:triumph-gui:3.1.1")
+ implementation("me.mattstudios.utils:matt-framework:1.4.6")
+ implementation("org.spongepowered:configurate-yaml:4.1.2")
+ implementation("org.bstats:bstats-bukkit:2.2.1")
+ implementation("com.zaxxer:HikariCP:5.0.0")
+ implementation("com.j256.ormlite:ormlite-jdbc:6.1")
+ implementation("com.j256.ormlite:ormlite-core:6.1")
+}
+
+tasks {
+ build {
+ dependsOn(shadowJar)
+ }
+
+ compileJava {
+ options.encoding = Charsets.UTF_8.name()
+ options.release.set(16)
+ }
+
+ shadowJar {
+ relocate("dev.triumphteam.gui", "io.github.fisher2911.hmccosmetics.gui")
+ relocate("me.mattstudios.mf", "io.github.fisher2911.hmccosmetics.mf")
+ relocate("net.kyori.adventure.text.minimessage", "io.github.fisher2911.hmccosmetics.adventure.minimessage")
+ relocate("net.kyori.adventure.platform", "io.github.fisher2911.hmccosmetics.adventure.platform")
+ relocate("org.spongepowered.configurate", "io.github.fisher2911.hmccosmetics.configurate")
+ relocate("org.bstats", "io.github.fisher2911.hmccosmetics.bstats")
+ relocate("com.zaxxer.hikaricp", "io.github.fisher2911.hmccosmetics.hikaricp")
+ relocate("com.j256.ormlite", "io.github.fisher2911.hmccosmetics.ormlite")
+ archiveFileName.set("HMCCosmetics.jar")
+ }
+
+ javadoc {
+ options.encoding = Charsets.UTF_8.name()
+ }
+
+ processResources {
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
+ filteringCharset = Charsets.UTF_8.name()
+ }
+}
+
+java {
+ toolchain.languageVersion.set(JavaLanguageVersion.of(16))
+}
+
+bukkit {
+ load = BukkitPluginDescription.PluginLoadOrder.STARTUP
+ main = "io.github.fisher2911.hmccosmetics.HMCCosmetics"
+ apiVersion = "1.17"
+ name = "HMCCosmetics"
+ authors = listOf("MasterOfTheFish")
+ softDepend = listOf("Multiverse", "PlaceholderAPI", "Oraxen", "ItemsAdder")
+ depend = listOf("ProtocolLib")
+ permissions {
+ register("hmccosmetics.cmd.default") {
+ default = BukkitPluginDescription.Permission.Default.OP
+ description = "Permission to execute the default command."
+ }
+ register("hmccosmetics.cmd.dye") {
+ default = BukkitPluginDescription.Permission.Default.OP
+ description = "Permission to dye armor."
+ }
+ register("hmccosmetics.cmd.reload") {
+ default = BukkitPluginDescription.Permission.Default.OP
+ description = "Permission to use the reload command."
+ }
+ register("hmccosmetics.cmd.set") {
+ default = BukkitPluginDescription.Permission.Default.OP
+ description = "Permission to set other users' cosmetics."
+ }
+ register("hmccosmetics.cmd.wardrobe") {
+ default = BukkitPluginDescription.Permission.Default.OP
+ description = "Permission to view the wardrobe"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/HMCCosmetics.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/api/CosmeticItem.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/CosmeticItem.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/api/CosmeticItem.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/api/CosmeticItem.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticItemEvent.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticItemEvent.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticItemEvent.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/api/event/CosmeticItemEvent.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
similarity index 99%
rename from src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
index 53ba7623..0d1748fa 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java
@@ -212,7 +212,7 @@ public class CosmeticsCommand extends CommandBase {
wardrobe.setActive(true);
Bukkit.getScheduler().runTaskAsynchronously(
this.plugin,
- () -> wardrobe.spawnFakePlayer(player)
+ () -> wardrobe.spawnFakePlayer(player, this.plugin.getSettings())
);
this.cosmeticsMenu.openDefault(player);
}
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/concurrent/Threads.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/concurrent/Threads.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/concurrent/Threads.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/concurrent/Threads.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java
similarity index 98%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java
index b77755d9..d9a2aba0 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ActionSerializer.java
@@ -4,7 +4,6 @@ import com.comphenix.protocol.wrappers.EnumWrappers;
import dev.triumphteam.gui.components.GuiAction;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.message.Message;
-import io.github.fisher2911.hmccosmetics.message.MessageHandler;
import io.github.fisher2911.hmccosmetics.util.Utils;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
similarity index 94%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
index 95c3d403..81a2aa5c 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/CosmeticSettings.java
@@ -1,10 +1,8 @@
package io.github.fisher2911.hmccosmetics.config;
-import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.EquipmentSlot;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
-import org.spongepowered.configurate.objectmapping.meta.Setting;
@ConfigSerializable
public class CosmeticSettings {
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/DyeGuiSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/DyeGuiSerializer.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/DyeGuiSerializer.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/DyeGuiSerializer.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/GuiSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/GuiSerializer.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/GuiSerializer.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/GuiSerializer.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/Settings.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/Settings.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/Settings.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/Settings.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/config/SoundData.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/SoundData.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/config/SoundData.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/config/SoundData.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/cosmetic/CosmeticManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/cosmetic/CosmeticManager.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/cosmetic/CosmeticManager.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/cosmetic/CosmeticManager.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
similarity index 97%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
index 5dc8fd8e..d1fd3835 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/Database.java
@@ -71,7 +71,7 @@ public class Database {
public void loadUser(final UUID uuid, final Consumer onComplete) {
final int armorStandId = FAKE_ENTITY_ID.getAndDecrement();
- final Wardrobe wardrobe = this.newWardrobe();
+ final Wardrobe wardrobe = this.createNewWardrobe(uuid);
Threads.getInstance().execute(
() -> {
try {
@@ -156,9 +156,10 @@ public class Database {
return armorItemDao;
}
- public Wardrobe newWardrobe() {
+ public Wardrobe createNewWardrobe(final UUID ownerUUID) {
return new Wardrobe(
UUID.randomUUID(),
+ ownerUUID,
PlayerArmor.empty(),
FAKE_ENTITY_ID.getAndDecrement(),
FAKE_ENTITY_ID.getAndDecrement(),
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
similarity index 96%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
index e2036b31..87cbf39d 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseConverter.java
@@ -87,10 +87,11 @@ public class DatabaseConverter {
while (results.next()) {
final PlayerArmor playerArmor = PlayerArmor.empty();
+ final UUID uuid = UUID.fromString(results.getString(1));
final User user = new User(
- UUID.fromString(results.getString(1)),
+ uuid,
playerArmor,
- this.database.newWardrobe(),
+ this.database.createNewWardrobe(uuid),
this.database.FAKE_ENTITY_ID.getAndDecrement()
);
final String backpackId = results.getString(2);
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseFactory.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseFactory.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseFactory.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseFactory.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseType.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseType.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseType.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/DatabaseType.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/ArmorItemDAO.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ArmorItem.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/ColorItem.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ColorItem.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/gui/ColorItem.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/gui/ColorItem.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java
similarity index 95%
rename from src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java
index e4d4a6cb..82eee1f1 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java
@@ -107,16 +107,9 @@ public class CosmeticGui {
this.gui.updateItem(slot, guiItem);
}
- public void open(final HumanEntity humanEntity) {
- final Optional optionalUser = this.plugin.getUserManager()
- .get(humanEntity.getUniqueId());
-
- if (optionalUser.isEmpty()) {
- return;
- }
-
- final User user = optionalUser.get();
-
+ public void open(final User user) {
+ final Player player = user.getPlayer();
+ if (player == null) return;
this.gui = Gui.gui().
title(Adventure.MINI_MESSAGE.deserialize(
Placeholder.applyPapiPlaceholders(user.getPlayer(), this.title))).
@@ -127,7 +120,7 @@ public class CosmeticGui {
this.setItems(user);
- this.gui.open(humanEntity);
+ this.gui.open(player);
}
@Nullable
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
similarity index 91%
rename from src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
index 1e381653..acc67d77 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java
@@ -1,14 +1,13 @@
package io.github.fisher2911.hmccosmetics.gui;
-import dev.triumphteam.gui.components.GuiAction;
import dev.triumphteam.gui.guis.GuiItem;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
-import io.github.fisher2911.hmccosmetics.config.ActionSerializer;
import io.github.fisher2911.hmccosmetics.config.DyeGuiSerializer;
import io.github.fisher2911.hmccosmetics.config.GuiSerializer;
import io.github.fisher2911.hmccosmetics.config.ItemSerializer;
import io.github.fisher2911.hmccosmetics.cosmetic.CosmeticManager;
import io.github.fisher2911.hmccosmetics.user.User;
+import io.github.fisher2911.hmccosmetics.user.Wardrobe;
import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
@@ -23,7 +22,6 @@ import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import java.util.function.Supplier;
public class CosmeticsMenu {
@@ -43,14 +41,22 @@ public class CosmeticsMenu {
public void openMenu(final String id, final HumanEntity humanEntity) {
final CosmeticGui cosmeticGui = this.getGui(id);
+ final Optional optionalUser = this.plugin.getUserManager().get(humanEntity.getUniqueId());
+
+ if (optionalUser.isEmpty()) return;
+
+ User user = optionalUser.get();
+
+ final Wardrobe wardrobe = user.getWardrobe();
+ if (wardrobe.isActive()) user = wardrobe;
+
if (cosmeticGui instanceof final DyeSelectorGui dyeSelectorGui) {
- final Optional optionalUser = this.plugin.getUserManager().get(humanEntity.getUniqueId());
- optionalUser.ifPresent(user -> dyeSelectorGui.getGui(user, user.getLastSetItem().getType()).open(humanEntity));
+ dyeSelectorGui.getGui(user, user.getLastSetItem().getType()).open(humanEntity);
return;
}
if (cosmeticGui != null) {
- cosmeticGui.open(humanEntity);
+ cosmeticGui.open(user);
}
}
@@ -66,7 +72,7 @@ public class CosmeticsMenu {
}
public void openDyeSelectorGui(
- final User user,
+ User user,
final ArmorItem.Type type) {
final Player player = user.getPlayer();
@@ -75,6 +81,9 @@ public class CosmeticsMenu {
return;
}
+ final Wardrobe wardrobe = user.getWardrobe();
+ if (wardrobe.isActive()) user = wardrobe;
+
final CosmeticGui gui = this.getGui(DEFAULT_DYE_MENU);
if (gui instanceof final DyeSelectorGui dyeSelectorGui) {
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java
similarity index 95%
rename from src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java
index 5acb0413..84b79d1f 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java
@@ -176,10 +176,10 @@ public class DyeSelectorGui extends CosmeticGui {
}
@Override
- public void open(final HumanEntity player) {
- final Optional optionalUser = this.plugin.getUserManager().get(player.getUniqueId());
- optionalUser.ifPresent(
- user -> this.getGui(user, user.getLastSetItem().getType()).open(player));
+ public void open(final User user) {
+ final Player player = user.getPlayer();
+ if (player == null) return;
+ this.getGui(user, user.getLastSetItem().getType()).open(player);
}
@Override
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/Hook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/Hook.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/Hook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/Hook.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/HookManager.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIHook.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIHook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/PAPIHook.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHook.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHook.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHooks.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHooks.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHooks.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemHooks.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemsAdderHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemsAdderHook.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemsAdderHook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/ItemsAdderHook.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/OraxenHook.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/OraxenHook.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/hook/item/OraxenHook.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/hook/item/OraxenHook.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/inventory/PlayerArmor.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java
similarity index 98%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java
index 519f1a7b..15094904 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/ClickListener.java
@@ -3,7 +3,7 @@ package io.github.fisher2911.hmccosmetics.listener;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.user.User;
import io.github.fisher2911.hmccosmetics.user.UserManager;
-import java.util.List;
+
import java.util.Optional;
import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/CosmeticFixListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/CosmeticFixListener.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/CosmeticFixListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/CosmeticFixListener.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/JoinListener.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java
similarity index 96%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java
index f9228307..bd9c6e5f 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/PlayerShiftListener.java
@@ -34,7 +34,7 @@ public class PlayerShiftListener implements Listener {
if (!wardrobe.isActive()) return;
- wardrobe.setActive(false);
+ wardrobe.despawnFakePlayer(player);
this.plugin.getMessageHandler().sendMessage(
player,
Messages.CLOSED_WARDROBE
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/RespawnListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/RespawnListener.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/RespawnListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/RespawnListener.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/listener/TeleportListener.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/listener/TeleportListener.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/listener/TeleportListener.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/listener/TeleportListener.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Adventure.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Adventure.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Adventure.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Adventure.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/ErrorMessages.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/ErrorMessages.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/ErrorMessages.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/ErrorMessages.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Message.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Message.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Message.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Message.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Placeholder.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Placeholder.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Placeholder.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Placeholder.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Translation.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Translation.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/message/Translation.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/message/Translation.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
similarity index 86%
rename from src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
index d2d90c87..7a391160 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/packet/PacketManager.java
@@ -4,19 +4,13 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.MinecraftKey;
import com.comphenix.protocol.wrappers.Pair;
-import com.comphenix.protocol.wrappers.PlayerInfoData;
-import com.comphenix.protocol.wrappers.WrappedChatComponent;
-import com.comphenix.protocol.wrappers.WrappedGameProfile;
-import com.mojang.authlib.GameProfile;
-import io.github.fisher2911.hmccosmetics.playerpackets.PlayerPackets;
-import io.github.fisher2911.hmccosmetics.playerpackets.PlayerPackets_1_17_R1;
-import io.github.fisher2911.hmccosmetics.playerpackets.PlayerPackets_1_18_R1;
+import io.github.fisher2911.nms.playerpackets.PlayerPackets;
+import io.github.fisher2911.nms.PlayerPackets_1_17_R1;
+import io.github.fisher2911.nms.PlayerPackets_1_18_R1;
import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.IntArrayList;
import org.bukkit.entity.EntityType;
@@ -24,7 +18,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -34,11 +27,12 @@ public class PacketManager {
static {
final String version = Bukkit.getVersion();
+ System.out.println("Version: " + Bukkit.getVersion());
if (version.contains("1.17")) {
playerPackets = new PlayerPackets_1_17_R1();
- } /*else if (version.contains("1.18")) {
+ } else if (version.contains("1.18")) {
playerPackets = new PlayerPackets_1_18_R1();
- }*/ else {
+ } else {
playerPackets = null;
}
}
@@ -141,9 +135,14 @@ public class PacketManager {
return packet;
}
- public static PacketContainer[] getFakePlayerPacket(final Location location, Player player, final UUID uuid, final int entityId) throws IllegalStateException {
+ public static PacketContainer getFakePlayerSpawnPacket(final Location location, final UUID uuid, final int entityId) throws IllegalStateException {
if (playerPackets == null) throw new IllegalStateException("This cannot be used in version: " + Bukkit.getVersion());
- return playerPackets.getSpawnPacket(location, player, uuid, entityId);
+ return playerPackets.getSpawnPacket(location, uuid, entityId);
+ }
+
+ public static PacketContainer getFakePlayerInfoPacket(final Player player, final UUID uuid) throws IllegalStateException {
+ if (playerPackets == null) throw new IllegalStateException("This cannot be used in version: " + Bukkit.getVersion());
+ return playerPackets.getPlayerInfoPacket(player, uuid);
}
public static PacketContainer getRemovePlayerPacket(final Player player, final UUID uuid, final int entityId) {
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/user/Equipment.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Equipment.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/user/Equipment.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/user/Equipment.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
similarity index 89%
rename from src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
index 2f38f60c..291f5a26 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java
@@ -27,7 +27,7 @@ public class User {
private final UUID uuid;
private final PlayerArmor playerArmor;
- private Wardrobe wardrobe;
+ protected Wardrobe wardrobe;
private ArmorItem lastSetItem = ArmorItem.empty(ArmorItem.Type.HAT);
@@ -52,7 +52,7 @@ public class User {
}
public UUID getUuid() {
- return uuid;
+ return this.uuid;
}
public PlayerArmor getPlayerArmor() {
@@ -117,21 +117,28 @@ public class User {
if (!this.hasArmorStand) {
this.spawnArmorStand(settings);
}
+ for (final Player player : Bukkit.getOnlinePlayers()) {
+ this.updateArmorStand(player, settings);
+ }
+ }
+ public void updateArmorStand(final Player other, final Settings settings) {
final Player player = this.getPlayer();
if (player == null) return;
+ this.updateArmorStand(other, settings, player.getLocation());
+ }
+
+ public void updateArmorStand(final Player other, final Settings settings, final Location location) {
final List> equipmentList = new ArrayList<>();
equipmentList.add(new Pair<>(EnumWrappers.ItemSlot.HEAD,
this.playerArmor.getBackpack().getColored()
));
- final Location location = player.getLocation();
-
final PacketContainer armorPacket = PacketManager.getEquipmentPacket(equipmentList, this.armorStandId);
final PacketContainer rotationPacket = PacketManager.getRotationPacket(this.armorStandId, location);
- final PacketContainer ridingPacket = PacketManager.getRidingPacket(player.getEntityId(), this.armorStandId);
+ final PacketContainer ridingPacket = PacketManager.getRidingPacket(this.getEntityId(), this.armorStandId);
final PacketContainer metaContainer = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
@@ -145,7 +152,7 @@ public class User {
metaContainer.getIntegers().write(0, this.armorStandId);
metaContainer.getWatchableCollectionModifier().write(0, metaData.getWatchableObjects());
- PacketManager.sendPacketToOnline(armorPacket, metaContainer, rotationPacket, ridingPacket);
+ PacketManager.sendPacket(other, armorPacket, metaContainer, rotationPacket, ridingPacket);
final int lookDownPitch = settings.getCosmeticSettings().getLookDownPitch();
@@ -155,7 +162,7 @@ public class User {
new ItemStack(Material.AIR)
));
- PacketManager.sendPacket(player, PacketManager.getEquipmentPacket(equipmentList, this.armorStandId));
+ PacketManager.sendPacket(other, PacketManager.getEquipmentPacket(equipmentList, this.armorStandId));
}
}
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
similarity index 98%
rename from src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
index c6dab9cc..d4e08f35 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/UserManager.java
@@ -19,7 +19,6 @@ import io.github.fisher2911.hmccosmetics.util.builder.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
-import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
@@ -200,6 +199,9 @@ public class UserManager {
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
switch (armorItem.getType()) {
case HAT, OFF_HAND -> this.updateCosmetics(setUser);
+ case BACKPACK -> {
+ if (wardrobe.isActive()) setUser.updateArmorStand(settings);
+ }
}
});
}
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
new file mode 100644
index 00000000..5f5416ea
--- /dev/null
+++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
@@ -0,0 +1,84 @@
+package io.github.fisher2911.hmccosmetics.user;
+
+import com.comphenix.protocol.events.PacketContainer;
+import io.github.fisher2911.hmccosmetics.config.Settings;
+import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
+import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
+import io.github.fisher2911.hmccosmetics.packet.PacketManager;
+import net.minecraft.network.protocol.Packet;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
+
+public class Wardrobe extends User {
+
+ private final UUID ownerUUID;
+ private final int entityId;
+ private boolean active;
+
+ private Location currentLocation;
+
+ public Wardrobe(
+ final UUID uuid,
+ final UUID ownerUUID,
+ final PlayerArmor playerArmor,
+ final int armorStandId,
+ final int entityId,
+ final boolean active) {
+ super(uuid, playerArmor, armorStandId);
+ this.ownerUUID = ownerUUID;
+ this.entityId = entityId;
+ this.active = active;
+ this.wardrobe = this;
+ }
+
+ public void spawnFakePlayer(final Player viewer, final Settings settings) {
+ this.currentLocation = viewer.getLocation().clone();
+ this.currentLocation.setPitch(0);
+ this.currentLocation.setYaw(0);
+ final PacketContainer playerSpawnPacket = PacketManager.getFakePlayerSpawnPacket(
+ this.currentLocation,
+ this.getUuid(),
+ this.entityId
+ );
+ final PacketContainer playerInfoPacket = PacketManager.getFakePlayerInfoPacket(
+ viewer,
+ this.getUuid()
+ );
+ PacketManager.sendPacket(viewer, playerInfoPacket, playerSpawnPacket);
+ this.spawnArmorStand(viewer);
+ this.updateArmorStand(viewer, settings, this.currentLocation);
+ }
+
+ public void despawnFakePlayer(final Player viewer) {
+ PacketManager.sendPacket(viewer, PacketManager.getRemovePlayerPacket(viewer, this.getUuid(), this.getEntityId()));
+ this.despawnAttached();
+ this.active = false;
+ }
+
+ @Override
+ public int getEntityId() {
+ return this.entityId;
+ }
+
+ @Override
+ public boolean hasPermissionToUse(final ArmorItem armorItem) {
+ return true;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(final boolean active) {
+ this.active = active;
+ }
+
+ @Override
+ public Player getPlayer() {
+ return Bukkit.getPlayer(this.ownerUUID);
+ }
+
+}
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/Keys.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/Keys.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/Keys.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/Keys.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/StringUtils.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/StringUtils.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/StringUtils.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/StringUtils.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/Utils.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/Utils.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/Utils.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/Utils.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ColorBuilder.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ColorBuilder.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ColorBuilder.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ColorBuilder.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ItemBuilder.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ItemBuilder.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ItemBuilder.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/ItemBuilder.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/SkullBuilder.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/SkullBuilder.java
similarity index 100%
rename from src/main/java/io/github/fisher2911/hmccosmetics/util/builder/SkullBuilder.java
rename to common/src/main/java/io/github/fisher2911/hmccosmetics/util/builder/SkullBuilder.java
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets.java b/nms/src/main/java/io/github/fisher2911/nms/playerpackets/PlayerPackets.java
similarity index 55%
rename from src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets.java
rename to nms/src/main/java/io/github/fisher2911/nms/playerpackets/PlayerPackets.java
index 890b7bcc..15f85522 100644
--- a/src/main/java/io/github/fisher2911/hmccosmetics/playerpackets/PlayerPackets.java
+++ b/nms/src/main/java/io/github/fisher2911/nms/playerpackets/PlayerPackets.java
@@ -1,4 +1,4 @@
-package io.github.fisher2911.hmccosmetics.playerpackets;
+package io.github.fisher2911.nms.playerpackets;
import com.comphenix.protocol.events.PacketContainer;
import org.bukkit.Location;
@@ -8,7 +8,8 @@ import java.util.UUID;
public interface PlayerPackets {
- PacketContainer[] getSpawnPacket(final Location location, final Player player, final UUID uuid, final int entityId);
+ PacketContainer getSpawnPacket(final Location location, UUID uuid, final int entityId);
+ PacketContainer getPlayerInfoPacket(final Player player, final UUID uuid);
PacketContainer getRemovePacket(final Player player, final UUID uuid, final int entityId);
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 99d0a73a..39fdaed3 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,2 +1,7 @@
rootProject.name = "HMCCosmetics"
-include("common")
+include(
+ "common",
+ "nms",
+ "1.17",
+ "1.18"
+)
diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java b/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
deleted file mode 100644
index 1b97fcdc..00000000
--- a/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.github.fisher2911.hmccosmetics.user;
-
-import com.mojang.authlib.GameProfile;
-import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
-import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
-import io.github.fisher2911.hmccosmetics.packet.PacketManager;
-import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-import java.util.UUID;
-
-public class Wardrobe extends User {
-
- private final int entityId;
- private boolean active;
-
- public Wardrobe(
- final UUID uuid,
- final PlayerArmor playerArmor,
- final int armorStandId,
- final int entityId,
- final boolean active) {
- super(uuid, playerArmor, armorStandId);
- this.entityId = entityId;
- this.active = active;
- }
-
- public void spawnFakePlayer(final Player viewer) {
- PacketManager.sendPacket(viewer, PacketManager.getFakePlayerPacket(viewer.getLocation(), viewer, this.getUuid(), this.entityId));
- }
-
- public void despawnFakePlayer(final Player viewer) {
- PacketManager.sendPacket(viewer, PacketManager.getRemovePlayerPacket(viewer, this.getUuid(), this.entityId));
- }
-
- @Override
- public boolean hasPermissionToUse(final ArmorItem armorItem) {
- return true;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public void setActive(final boolean active) {
- this.active = active;
- }
-}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
deleted file mode 100644
index dfedb3fd..00000000
--- a/src/main/resources/config.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-cosmetic-settings:
- require-empty-helmet: false
- require-empty-off-hand: true
- # The pitch the player must look down for the backpack to be removed
- # Set to -1 for no removal
- look-down-backpack-remove: 70
\ No newline at end of file
diff --git a/src/main/resources/database.yml b/src/main/resources/database.yml
deleted file mode 100644
index 363d95aa..00000000
--- a/src/main/resources/database.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-# SQLite or MySQL (case-insensitive)
-type: "sqlite"
-# The rest of these are only required for MySQL
-name: "name"
-username: "username"
-password: "password"
-ip: "ip"
-port: 3306
\ No newline at end of file
diff --git a/src/main/resources/database/info.yml b/src/main/resources/database/info.yml
deleted file mode 100644
index ea428f79..00000000
--- a/src/main/resources/database/info.yml
+++ /dev/null
@@ -1 +0,0 @@
-version: 2
\ No newline at end of file
diff --git a/src/main/resources/menus/dye-menu.yml b/src/main/resources/menus/dye-menu.yml
deleted file mode 100644
index d6a664c3..00000000
--- a/src/main/resources/menus/dye-menu.yml
+++ /dev/null
@@ -1,100 +0,0 @@
-title: ""
-rows: 4
-gui-type: dye
-cosmetics-slots:
- 27: HAT
- 28: BACKPACK
- 29: OFF_HAND
-items:
- 10:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 255
- green: 255
- blue: 255
- name: "Set to <#FFFFFF>white"
- set-color:
- red: 255
- green: 255
- blue: 255
- 11:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 190
- green: 20
- blue: 20
- name: "Set to <#BE1414>red"
- set-color:
- red: 190
- green: 20
- blue: 20
- 12:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 234
- green: 92
- blue: 43
- name: "Set to <#EA5C2B>orange"
- set-color:
- red: 234
- green: 92
- blue: 43
- 13:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 255
- green: 201
- blue: 0
- name: "Set to <#FFC900>yellow"
- set-color:
- red: 255
- green: 201
- blue: 0
- 14:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 163
- green: 218
- blue: 141
- name: "Set to <#A3DA8D>green"
- set-color:
- red: 163
- green: 218
- blue: 141
- 15:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 55
- green: 49
- blue: 181
- name: "Set to <#3731B5>blue"
- set-color:
- red: 55
- green: 49
- blue: 181
- 16:
- material: LEATHER_HORSE_ARMOR
- model-data: 1
- color:
- red: 137
- green: 70
- blue: 166
- name: "Set to <#8946A6>purple"
- set-color:
- red: 137
- green: 70
- blue: 166
- 31:
- material: PAPER
- name: "<#F7DCFA>Previous Page"
- amount: 1
- model-data: 1
- action: # See how the action system works on the wiki
- any:
- open-menu: main
\ No newline at end of file
diff --git a/src/main/resources/menus/main.yml b/src/main/resources/menus/main.yml
deleted file mode 100644
index c22801c8..00000000
--- a/src/main/resources/menus/main.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-title: "" # GUI Title
-rows: 5 # Rows in the GUI
-items:
- 1: # GUI Slot number
- material: LEATHER_HORSE_ARMOR # Also supports Oraxen items! Format: "oraxen:item_name"
- name: "Colorful Hat"
- lore: # Lore displayed when the player owns the item
- - ""
- - "Enabled: <#6D9DC5>%enabled%"
- - "Allowed: <#6D9DC5>%allowed%"
- locked-lore: # Lore displayed when the player does not have the correct permission.
- - "You do not own this item!"
- amount: 1
- model-data: 2 # CustomModelData Number
- type: HAT
- dyeable: true # Enables dyeable item feature
- color: # Sets default color for item. Uses RGB format.
- red: 5
- green: 230
- blue: 100
- action: # See how the action system works on the wiki
- any:
- open-menu: dye-menu
- permission: "cosmetics.colorful_hat" # Can be anything you want.
- id: colorful_hat # Internal identifier. Can be anything you want.
- 2:
- material: PAPER
- name: "Backpack"
- lore:
- - ""
- - "Enabled: <#6D9DC5>%enabled%"
- - "Allowed: <#6D9DC5>%allowed%"
- locked-lore:
- - "You do not own this item!"
- amount: 1
- model-data: 4
- type: BACKPACK
- permission: ""
- id: backpack
- 3:
- material: PAPER
- name: "Lantern Cosmetic"
- lore:
- - ""
- - "Enabled: <#6D9DC5>%enabled%"
- - "Allowed: <#6D9DC5>%allowed%"
- locked-lore:
- - "You do not own this item!"
- amount: 1
- model-data: 5
- type: OFF_HAND
- permission: ""
- id: lantern_cosmetic
- 4:
- material: PAPER
- name: "Baseball Hat"
- lore:
- - ""
- - "Enabled: <#6D9DC5>%enabled%"
- - "Allowed: <#6D9DC5>%allowed%"
- locked-lore:
- - "You do not own this item!"
- amount: 1
- model-data: 6
- type: HAT
- permission: ""
- id: baseball_hat
- 37:
- material: PAPER
- name: "<#40B7D6>Previous Page"
- amount: 1
- model-data: 1
- action:
- any:
- open-menu: menu-2
- 40:
- material: PAPER
- name: "Customization Menu"
- amount: 1
- model-data: 3
- action:
- any:
- open-menu: dye-menu
- 43:
- material: PAPER
- name: "<#40B7D6>Next Page"
- amount: 1
- model-data: 2
- action:
- any:
- open-menu: menu-2
\ No newline at end of file
diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml
deleted file mode 100644
index 458018b4..00000000
--- a/src/main/resources/messages.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-no-permission: " No Permission!"
-no-cosmetic-permission: " You do not have permission for this cosmetic!"
-set-hat: " Applied hat!"
-removed-hat: " Removed hat!"
-set-backpack: " Applied backpack!"
-removed-backpack: " Removed backpack!"
-set-off-hand: " Applied offhand!"
-removed-off-hand: " Removed offhand!"
-set-dye-color: " Set color of %item%!"
-must-be-player: "You must be a player to do this!"
-reloaded: " Config files reloaded!"
-invalid-type: " Invalid cosmetic type, please use hat, backpack or off_hand!"
-set-other-backpack: "You have set the backpack of %player% to %type%"
-set-other-hat: "You have set the hat of %player% to %type%"
-set-other-off-hand: "You have set the off hand of %player% to %type%"
-help-command: "<#6D9DC5> HMCCosmetics - Help <#6D9DC5>
-
-
-<#5AE4B5>- <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI.
-
-<#5AE4B5>- <#40B7D6>/cosmetics add (#HEX) - <#6D9DC5>Adds cosmetic to player.
-
-<#5AE4B5>- <#40B7D6>/cosmetics remove - <#6D9DC5>Removes cosmetic from a player.
-
-<#5AE4B5>- <#40B7D6>/cosmetics dye - <#6D9DC5>Opens dye menu for the specified cosmetic type.
-
-<#5AE4B5>- <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu.
-
-
-"
\ No newline at end of file
diff --git a/src/main/resources/translations.yml b/src/main/resources/translations.yml
deleted file mode 100644
index 3e6acef5..00000000
--- a/src/main/resources/translations.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-translations:
- true: "true"
- false: "false"
\ No newline at end of file