9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-21 16:09:27 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
HeroBrineGoat
f21749a45d Merge remote-tracking branch 'origin/master' 2022-01-06 21:22:55 -05:00
HeroBrineGoat
eeb2ef960b Added bstats 2022-01-06 21:22:47 -05:00
lucian929
6e4c4bc127 Update requirements 2022-01-06 21:00:41 -05:00
lucian929
ca73a9e5b4 Create README.md 2022-01-06 20:40:23 -05:00
5 changed files with 35 additions and 0 deletions

21
README.md Normal file
View File

@@ -0,0 +1,21 @@
# HMCCosmetics
----
<a href="https://img.shields.io/badge/License-gpl-v3"><img src="https://img.shields.io/badge/License-gpl-v3"></a>
## Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Contact Information](#contact-information)
### Description
HMCCosmetics is a free, open source cosmetics plugin which allows you to easily give players backpack and hat type cosmetics.
### Requirements
- Server running PaperMC (or a fork of PaperMC)
- ProtocolLib

View File

@@ -28,6 +28,7 @@ dependencies {
implementation 'dev.triumphteam:triumph-gui:3.0.3'
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'
}
test {
@@ -40,6 +41,7 @@ shadowJar {
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'
}
shadowJar {

View File

@@ -14,6 +14,7 @@ import io.github.fisher2911.hmccosmetics.message.MessageHandler;
import io.github.fisher2911.hmccosmetics.message.Messages;
import io.github.fisher2911.hmccosmetics.user.UserManager;
import me.mattstudios.mf.base.CommandManager;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Arrays;
@@ -30,6 +31,9 @@ public class HMCCosmetics extends JavaPlugin {
@Override
public void onEnable() {
final int pluginId = 13873;
final Metrics metrics = new Metrics(this, pluginId);
protocolManager = ProtocolLibrary.getProtocolManager();
this.messageHandler = new MessageHandler(this);
this.userManager = new UserManager(this);

View File

@@ -4,12 +4,14 @@ import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
import io.github.fisher2911.hmccosmetics.inventory.PlayerArmor;
import io.github.fisher2911.hmccosmetics.message.MessageHandler;
import io.github.fisher2911.hmccosmetics.message.Messages;
import io.github.fisher2911.hmccosmetics.util.Keys;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -161,6 +163,11 @@ public class User {
armorStand -> {
armorStand.setVisible(false);
armorStand.setMarker(true);
armorStand.getPersistentDataContainer().set(
Keys.ARMOR_STAND_KEY,
PersistentDataType.BYTE,
(byte) 1
);
player.addPassenger(armorStand);
});
}

View File

@@ -15,6 +15,7 @@ public class Keys {
}
public static final NamespacedKey ITEM_KEY = new NamespacedKey(plugin, "cosmetic");
public static final NamespacedKey ARMOR_STAND_KEY = new NamespacedKey(plugin, "armor-stand");
public static void setKey(final ItemStack itemStack) {
final ItemMeta itemMeta = itemStack.getItemMeta();