Compare commits

..

2 commits

6 changed files with 20 additions and 16 deletions

View file

@ -1,10 +1,12 @@
1.2.0: Update n°13 (XX/XX/24) 1.2.0: Update n°13 (XX/XX/24)
[FEATURES] [FEATURES]
- Players are now able to save disguises as presets. - Players are now able to mark disguises as favorites.
- Modernized the messages and added various sound effects upon interacting with the plugin. - Modernized the messages and added various sound effects upon interacting with the plugin.
- Made GUIs names cleaner.
[FIXES] [FIXES]
- Fixed an oversight preventing the configuration from properly being migrated. - Fixed an oversight preventing the configuration from properly being migrated.
- Fixed the placeholder item in the skin cache invalidation not being translated.
[LANGUAGE] [LANGUAGE]
- Moved the prefix to the language file. - Moved the prefix to the language file.

View file

@ -118,14 +118,14 @@ public class AnvilManager {
final ActionResult actionResult = appearanceManager.update(skinChange, false); final ActionResult actionResult = appearanceManager.update(skinChange, false);
if (!actionResult.isError()) { if (!actionResult.isError()) {
player.sendMessage(playerLanguage.translateWithWhoosh(LanguageKey.Event.Appearance.Set.OK)); player.sendMessage(playerLanguage.translateWithWhoosh(LanguageKey.Event.Appearance.Set.OK));
player.playSound(player, Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f); player.playSound(player.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f);
} else { } else {
player.sendMessage( player.sendMessage(
playerLanguage.translateWithOops( playerLanguage.translateWithOops(
LanguageKey.Event.Appearance.Set.ERROR, LanguageKey.Event.Appearance.Set.ERROR,
playerLanguage.translate(actionResult.getErrorKey(), false) playerLanguage.translate(actionResult.getErrorKey(), false)
)); ));
player.playSound(player, Sound.BLOCK_ANVIL_PLACE, 0.5f, 1f); player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_PLACE, 1f, 1f);
} }
return Collections.singletonList(AnvilGUI.ResponseAction.close()); return Collections.singletonList(AnvilGUI.ResponseAction.close());
} }

View file

@ -1,6 +1,5 @@
package xyz.ineanto.nicko.gui.items.admin.cache; package xyz.ineanto.nicko.gui.items.admin.cache;
import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,6 +17,7 @@ import xyz.ineanto.nicko.mojang.MojangAPI;
import xyz.xenondevs.invui.item.builder.ItemBuilder; import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.builder.SkullBuilder; import xyz.xenondevs.invui.item.builder.SkullBuilder;
import xyz.xenondevs.invui.item.impl.AsyncItem; import xyz.xenondevs.invui.item.impl.AsyncItem;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
import xyz.xenondevs.invui.util.MojangApiUtils; import xyz.xenondevs.invui.util.MojangApiUtils;
import java.io.IOException; import java.io.IOException;
@ -29,10 +29,10 @@ public class CacheEntryItem extends AsyncItem {
private final MojangAPI mojangAPI = Nicko.getInstance().getMojangAPI(); private final MojangAPI mojangAPI = Nicko.getInstance().getMojangAPI();
public CacheEntryItem(PlayerLanguage playerLanguage, String uuid) { public CacheEntryItem(PlayerLanguage playerLanguage, String uuid) {
super(new ItemBuilder(Material.PAINTING) super(new SuppliedItem(() -> {
.setDisplayName( final ItemBuilder builder = new ItemBuilder(Material.PAINTING);
Component.text(playerLanguage.translate(LanguageKey.GUI.LOADING, false)).content() return playerLanguage.translateItem(builder, LanguageKey.GUI.LOADING);
), }, (click -> true)).getItemProvider(),
() -> { () -> {
final String dashedUuid = uuid.replaceAll("(.{8})(.{4})(.{4})(.{4})(.+)", "$1-$2-$3-$4-$5"); final String dashedUuid = uuid.replaceAll("(.{8})(.{4})(.{4})(.{4})(.+)", "$1-$2-$3-$4-$5");
final UUID uuidObject = UUID.fromString(dashedUuid); final UUID uuidObject = UUID.fromString(dashedUuid);
@ -57,7 +57,7 @@ public class CacheEntryItem extends AsyncItem {
public void onConfirm() { public void onConfirm() {
final PlayerLanguage playerLanguage = new PlayerLanguage(player); final PlayerLanguage playerLanguage = new PlayerLanguage(player);
player.sendMessage(playerLanguage.translate(LanguageKey.Event.Admin.Cache.INVALIDATE_ENTRY, true, name)); player.sendMessage(playerLanguage.translate(LanguageKey.Event.Admin.Cache.INVALIDATE_ENTRY, true, name));
player.playSound(player, Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f); player.playSound(player.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f);
mojangAPI.eraseFromCache(uuid); mojangAPI.eraseFromCache(uuid);
} }

View file

@ -29,7 +29,7 @@ public class InvalidateCacheItem {
final Player player = click.getPlayer(); final Player player = click.getPlayer();
final PlayerLanguage playerLanguage = new PlayerLanguage(player); final PlayerLanguage playerLanguage = new PlayerLanguage(player);
player.sendMessage(playerLanguage.translateWithWhoosh(LanguageKey.Event.Admin.Cache.INVALIDATE_CACHE)); player.sendMessage(playerLanguage.translateWithWhoosh(LanguageKey.Event.Admin.Cache.INVALIDATE_CACHE));
player.playSound(player, Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f); player.playSound(player.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1f);
Nicko.getInstance().getMojangAPI().getSkinCache().invalidateAll(); Nicko.getInstance().getMojangAPI().getSkinCache().invalidateAll();
return true; return true;
} }

View file

@ -13,8 +13,8 @@ import xyz.ineanto.nicko.gui.ChoiceGUI;
import xyz.ineanto.nicko.gui.PlayerCheckGUI; import xyz.ineanto.nicko.gui.PlayerCheckGUI;
import xyz.ineanto.nicko.gui.items.ItemDefaults; import xyz.ineanto.nicko.gui.items.ItemDefaults;
import xyz.ineanto.nicko.gui.items.common.choice.ChoiceCallback; import xyz.ineanto.nicko.gui.items.common.choice.ChoiceCallback;
import xyz.ineanto.nicko.language.PlayerLanguage;
import xyz.ineanto.nicko.language.LanguageKey; import xyz.ineanto.nicko.language.LanguageKey;
import xyz.ineanto.nicko.language.PlayerLanguage;
import xyz.ineanto.nicko.profile.NickoProfile; import xyz.ineanto.nicko.profile.NickoProfile;
import xyz.xenondevs.invui.item.builder.AbstractItemBuilder; import xyz.xenondevs.invui.item.builder.AbstractItemBuilder;
import xyz.xenondevs.invui.item.builder.ItemBuilder; import xyz.xenondevs.invui.item.builder.ItemBuilder;
@ -79,7 +79,7 @@ public class PlayerInformationItem extends AsyncItem {
public void onConfirm() { public void onConfirm() {
final AppearanceManager appearanceManager = new AppearanceManager(target); final AppearanceManager appearanceManager = new AppearanceManager(target);
appearanceManager.reset(true); appearanceManager.reset(true);
player.playSound(player, Sound.ENTITY_VILLAGER_TRADE, 1, 1f); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_TRADE, 1, 1f);
player.sendMessage(playerLanguage.translate(LanguageKey.Event.Admin.Check.REMOVE_SKIN, true, target.getName())); player.sendMessage(playerLanguage.translate(LanguageKey.Event.Admin.Check.REMOVE_SKIN, true, target.getName()));
} }

View file

@ -4,7 +4,9 @@ import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap; import com.mojang.authlib.properties.PropertyMap;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.Optionull;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.RemoteChatSession;
import net.minecraft.network.chat.contents.PlainTextContents; import net.minecraft.network.chat.contents.PlainTextContents;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*; import net.minecraft.network.protocol.game.*;
@ -141,14 +143,14 @@ public class InternalPacketSender implements PacketSender {
ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY); ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY);
final List<ClientboundPlayerInfoUpdatePacket.Entry> entries = List.of(new ClientboundPlayerInfoUpdatePacket.Entry( final List<ClientboundPlayerInfoUpdatePacket.Entry> entries = List.of(new ClientboundPlayerInfoUpdatePacket.Entry(
player.getUniqueId(), serverPlayer.getUUID(),
serverPlayer.gameProfile, serverPlayer.gameProfile,
true, true,
player.getPing(), serverPlayer.connection.latency(),
serverPlayer.gameMode.getGameModeForPlayer(), serverPlayer.gameMode.getGameModeForPlayer(),
MutableComponent.create(new PlainTextContents.LiteralContents(displayName)), MutableComponent.create(new PlainTextContents.LiteralContents(displayName)),
1, serverPlayer.getTabListOrder(),
null Optionull.map(serverPlayer.getChatSession(), RemoteChatSession::asData)
)); ));
final ClientboundPlayerInfoUpdatePacket update = new ClientboundPlayerInfoUpdatePacket(actions, entries); final ClientboundPlayerInfoUpdatePacket update = new ClientboundPlayerInfoUpdatePacket(actions, entries);