9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-24 01:19:14 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
LoJoSho
69de2fa178 version bump (2.3.1) 2023-05-09 14:20:23 -05:00
LoJoSho
cdcf904ac8 fix: cosmetic tpe gui items not processing placeholders 2023-05-08 12:23:20 -05:00
LoJoSho
80f9100bf0 fix: translation file generating 2023-05-08 12:22:57 -05:00
LoJoSho
751509ece4 version bump (2.3.1-DEV) 2023-05-08 12:22:46 -05:00
LoJoSho
f36d558e13 clean: updateCosmetic use proper method 2023-05-06 10:40:15 -05:00
5 changed files with 14 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ plugins {
}
group = "com.hibiscusmc"
version = "2.3.0"
version = "2.3.1"
allprojects {
apply(plugin = "java")

View File

@@ -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);

View File

@@ -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);
});

View File

@@ -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;

View File

@@ -181,7 +181,7 @@ public class CosmeticUser {
}
public void updateCosmetic() {
for (Cosmetic cosmetic : playerCosmetics.values()) {
for (Cosmetic cosmetic : getCosmetics()) {
updateCosmetic(cosmetic.getSlot());
}
}