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