diff --git a/README.md b/README.md index 99939cf..1d25acd 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,10 @@ https://www.spigotmc.org/resources/nicko.113868/ ## Known bugs: -N/A +- Players who have operator (OP) status lose access to the Operator Items tab in creative mode + after disguising **(1.20 and up)**. +- When disguising and only changing their display name, players will have the new default + skins **(1.20 and up)**. --- @@ -22,5 +25,5 @@ N/A |---------------|----------------------------------------------------------------------------| | 1.7 and lower | Unsupported | | 1.8 - 1.12.2 | Use [NickReloaded](https://www.spigotmc.org/resources/nickreloaded.46335/) | -| 1.13 to 1.19 | Use Nicko (without support) | -| 1.20 - 1.21 | Use Nicko (with support) | +| 1.13 to 1.19 | Unsupported | +| 1.20 - 1.21 | Use Nicko | diff --git a/build.gradle.kts b/build.gradle.kts index 424b927..d266835 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "xyz.ineanto" -version = "1.3.0" +version = "1.2.0" val invuiVersion: String = "1.44" diff --git a/src/main/java/xyz/ineanto/nicko/gui/items/favorites/FavoriteAppearanceEntryItem.java b/src/main/java/xyz/ineanto/nicko/gui/items/favorites/FavoriteAppearanceEntryItem.java index de10ba0..78da1da 100644 --- a/src/main/java/xyz/ineanto/nicko/gui/items/favorites/FavoriteAppearanceEntryItem.java +++ b/src/main/java/xyz/ineanto/nicko/gui/items/favorites/FavoriteAppearanceEntryItem.java @@ -2,78 +2,45 @@ package xyz.ineanto.nicko.gui.items.favorites; import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; import xyz.ineanto.nicko.Nicko; -import xyz.ineanto.nicko.appearance.ActionResult; import xyz.ineanto.nicko.appearance.Appearance; import xyz.ineanto.nicko.appearance.AppearanceManager; import xyz.ineanto.nicko.gui.items.ItemDefaults; import xyz.ineanto.nicko.language.LanguageKey; import xyz.ineanto.nicko.language.PlayerLanguage; -import xyz.ineanto.nicko.profile.NickoProfile; -import xyz.ineanto.nicko.storage.PlayerDataStore; import xyz.xenondevs.invui.item.builder.ItemBuilder; import xyz.xenondevs.invui.item.builder.SkullBuilder; import xyz.xenondevs.invui.item.impl.AsyncItem; -import xyz.xenondevs.invui.item.impl.SuppliedItem; +import xyz.xenondevs.invui.util.MojangApiUtils; + +import java.io.IOException; public class FavoriteAppearanceEntryItem { - private final PlayerDataStore dataStore = Nicko.getInstance().getDataStore(); - private final AppearanceManager appearanceManager; private final PlayerLanguage playerLanguage; private final Appearance appearance; - private final Player player; public FavoriteAppearanceEntryItem(Player player, Appearance appearance) { - this.player = player; this.appearanceManager = new AppearanceManager(player); this.playerLanguage = new PlayerLanguage(player); this.appearance = appearance; } public AsyncItem get() { - // what the f is this entanglement of suppliers - return new AsyncItem(playerLanguage.translateItem(new ItemBuilder(Material.PAINTING), LanguageKey.GUI.LOADING), - () -> new SuppliedItem(() -> { + // TODO (Ineanto, 26/06/2025): handle click + final ItemBuilder temporaryItemBuilder = new ItemBuilder(Material.PAINTING); + return new AsyncItem(playerLanguage.translateItem(temporaryItemBuilder, LanguageKey.GUI.LOADING), + () -> { try { // TODO (Ineanto, 08/06/2025): set a default skin if the entry contains only a name final String name = (appearance.name() == null ? "N/A" : appearance.name()); final String skin = (appearance.skin() == null ? "N/A" : appearance.skin()); final SkullBuilder skull = new SkullBuilder(skin); return playerLanguage.translateItem(skull, LanguageKey.GUI.Favorites.ENTRY, name, skin); - } catch (Exception e) { + } catch (MojangApiUtils.MojangApiException | IOException e) { Nicko.getInstance().getLogger().warning("Unable to get Head texture for specified UUID (" + appearance.skin() + ")! (GUI/Favorites/Entry)"); return ItemDefaults.getErrorSkullItem(playerLanguage, LanguageKey.GUI.Favorites.ENTRY, "N/A", "N/A"); } - }, (click) -> { - System.out.println("there's a click folks!"); - final ClickType clickType = click.getClickType(); - - if (clickType.isLeftClick() || clickType.isRightClick()) { - click.getEvent().getView().close(); - final NickoProfile profile = dataStore.getData(player.getUniqueId()).orElse(NickoProfile.EMPTY_PROFILE); - - profile.setName(appearance.name()); - profile.setSkin(appearance.skin()); - dataStore.updateCache(player.getUniqueId(), profile); - - final ActionResult result = appearanceManager.update(true); - if (!result.isError()) { - player.sendMessage(playerLanguage.translateWithWhoosh(LanguageKey.Event.Appearance.Set.OK)); - return true; - } else { - player.sendMessage(playerLanguage.translateWithOops( - LanguageKey.Event.Appearance.Set.ERROR, - result.getErrorKey() - ) - ); - appearanceManager.reset(); - return false; - } - } - return false; - }).getItemProvider() - ); + }); } } diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index 90d5469..afa9439 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -169,7 +169,7 @@ gui: - "Clicking on any disguise as this mode is" - "active will remove it from your favorites." entry: - name: "Favorite" + name: "Favorite" lore: - - "Name: {0}" - - "Skin: {1}" \ No newline at end of file + - "Name: {0}" + - "Skin: {1}" \ No newline at end of file diff --git a/src/main/resources/fr.yml b/src/main/resources/fr.yml index 4e077e5..02c7310 100644 --- a/src/main/resources/fr.yml +++ b/src/main/resources/fr.yml @@ -171,7 +171,7 @@ gui: - "Cliquer sur un déguisement lorsque le mode est" - "actif le supprimera de vos favoris." entry: - name: "Favori" + name: "Favori" lore: - - "Nom: {0}" - - "Skin: {1}" \ No newline at end of file + - "Nom: {0}" + - "Skin: {1}" \ No newline at end of file