fix: chat session no longer broken and item translated correctly
This commit is contained in:
parent
3d5ef0f020
commit
7ba8a26af6
3 changed files with 14 additions and 10 deletions
|
@ -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.
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue