mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-24 01:19:14 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69de2fa178 | ||
|
|
cdcf904ac8 | ||
|
|
80f9100bf0 | ||
|
|
751509ece4 | ||
|
|
f36d558e13 |
@@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.hibiscusmc"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "java")
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
||||
// File setup
|
||||
if (!getDataFolder().exists()) {
|
||||
saveDefaultConfig();
|
||||
saveResource("translations.yml", false);
|
||||
//saveResource("translations.yml", false);
|
||||
saveResource("messages.yml", false);
|
||||
saveResource("cosmetics/defaultcosmetics.yml", false);
|
||||
saveResource("menus/defaultmenu.yml", false);
|
||||
|
||||
@@ -152,10 +152,12 @@ public class Menu {
|
||||
MessagesUtil.sendDebugMessages("Selected slot " + slot);
|
||||
final ClickType clickType = event.getClick();
|
||||
if (finalType != null) finalType.run(user, config, clickType);
|
||||
|
||||
for (int guiSlot : slots) {
|
||||
gui.updateItem(guiSlot, updateItem(user, originalItem.clone(), finalType, config, guiSlot));
|
||||
}
|
||||
// Need to delay the update by a tick so it will actually update with new values
|
||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
|
||||
for (int guiSlot : slots) {
|
||||
gui.updateItem(guiSlot, updateItem(user, originalItem, finalType, config, guiSlot));
|
||||
}
|
||||
}, 1);
|
||||
MessagesUtil.sendDebugMessages("Updated slot " + slot);
|
||||
});
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ public class TypeCosmetic extends Type {
|
||||
if (cosmetic instanceof CosmeticArmorType) {
|
||||
if (((CosmeticArmorType) cosmetic).getEquipSlot().equals(EquipmentSlot.OFF_HAND)) {
|
||||
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), run, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
run.run();
|
||||
@@ -101,19 +100,19 @@ public class TypeCosmetic extends Type {
|
||||
@Override
|
||||
public ItemStack setItem(CosmeticUser user, @NotNull ConfigurationNode config, ItemStack itemStack, int slot) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemStack.setItemMeta(processLoreLines(user, itemMeta));
|
||||
|
||||
if (config.node("cosmetic").virtual()) {
|
||||
itemStack.setItemMeta(processLoreLines(user, itemMeta));
|
||||
return itemStack;
|
||||
};
|
||||
String cosmeticName = config.node("cosmetic").getString();
|
||||
Cosmetic cosmetic = Cosmetics.getCosmetic(cosmeticName);
|
||||
if (cosmetic == null) {
|
||||
itemStack.setItemMeta(processLoreLines(user, itemMeta));
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
if (user.hasCosmeticInSlot(cosmetic) && !config.node("equipped-item").virtual()) {
|
||||
MessagesUtil.sendDebugMessages("GUI Equipped Item");
|
||||
ConfigurationNode equippedItem = config.node("equipped-item");
|
||||
try {
|
||||
if (equippedItem.node("material").virtual()) equippedItem.node("material").set(config.node("item", "material").getString());
|
||||
@@ -125,10 +124,12 @@ public class TypeCosmetic extends Type {
|
||||
} catch (SerializationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
if (!user.canEquipCosmetic(cosmetic) && !config.node("locked-item").virtual()) {
|
||||
MessagesUtil.sendDebugMessages("GUI Locked Item");
|
||||
ConfigurationNode lockedItem = config.node("locked-item");
|
||||
try {
|
||||
if (lockedItem.node("material").virtual()) lockedItem.node("material").set(config.node("item", "material").getString());
|
||||
@@ -137,10 +138,10 @@ public class TypeCosmetic extends Type {
|
||||
}
|
||||
try {
|
||||
itemStack = ItemSerializer.INSTANCE.deserialize(ItemStack.class, lockedItem);
|
||||
//item = config.node("item").get(ItemStack.class);
|
||||
} catch (SerializationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
itemStack.setItemMeta(processLoreLines(user, itemStack.getItemMeta()));
|
||||
return itemStack;
|
||||
}
|
||||
return itemStack;
|
||||
|
||||
@@ -181,7 +181,7 @@ public class CosmeticUser {
|
||||
}
|
||||
|
||||
public void updateCosmetic() {
|
||||
for (Cosmetic cosmetic : playerCosmetics.values()) {
|
||||
for (Cosmetic cosmetic : getCosmetics()) {
|
||||
updateCosmetic(cosmetic.getSlot());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user