feat: WE MAKING PROGRESS CHAT
This commit is contained in:
parent
144245fc5a
commit
18afb84caa
16 changed files with 133 additions and 91 deletions
|
@ -1,11 +1,11 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("io.github.goooler.shadow") version "8.1.7"
|
id("com.gradleup.shadow") version "8.3.2"
|
||||||
id("xyz.jpenilla.run-paper") version "2.3.0"
|
id("xyz.jpenilla.run-paper") version "2.3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "xyz.ineanto"
|
group = "xyz.ineanto"
|
||||||
version = "1.1.8"
|
version = "1.2.0"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
@ -38,14 +38,13 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Nicko
|
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||||
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
|
compileOnly("com.github.dmulloy2:ProtocolLib:-SNAPSHOT")
|
||||||
compileOnly("com.github.dmulloy2:ProtocolLib:master-SNAPSHOT")
|
|
||||||
compileOnly("me.clip:placeholderapi:2.11.5")
|
compileOnly("me.clip:placeholderapi:2.11.5")
|
||||||
compileOnly("net.kyori:adventure-api:4.17.0")
|
compileOnly("net.kyori:adventure-api:4.17.0")
|
||||||
|
|
||||||
implementation("xyz.xenondevs.invui:invui:1.35")
|
implementation("xyz.xenondevs.invui:invui:1.36")
|
||||||
implementation("net.wesjd:anvilgui:1.10.1-SNAPSHOT")
|
implementation("net.wesjd:anvilgui:1.10.2-SNAPSHOT")
|
||||||
implementation("com.github.jsixface:yamlconfig:1.2")
|
implementation("com.github.jsixface:yamlconfig:1.2")
|
||||||
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2")
|
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2")
|
||||||
implementation("com.fasterxml.jackson.core:jackson-core:2.15.2")
|
implementation("com.fasterxml.jackson.core:jackson-core:2.15.2")
|
||||||
|
@ -115,14 +114,6 @@ tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
runServer {
|
runServer {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Mon Dec 11 00:36:17 CET 2023
|
#Mon Dec 11 00:36:17 CET 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package xyz.ineanto.nicko;
|
package xyz.ineanto.nicko;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -10,6 +11,7 @@ import xyz.ineanto.nicko.appearance.random.RandomNameFetcher;
|
||||||
import xyz.ineanto.nicko.command.NickoCommand;
|
import xyz.ineanto.nicko.command.NickoCommand;
|
||||||
import xyz.ineanto.nicko.config.Configuration;
|
import xyz.ineanto.nicko.config.Configuration;
|
||||||
import xyz.ineanto.nicko.config.ConfigurationManager;
|
import xyz.ineanto.nicko.config.ConfigurationManager;
|
||||||
|
import xyz.ineanto.nicko.debug.RespawnPacketListener;
|
||||||
import xyz.ineanto.nicko.event.PlayerJoinListener;
|
import xyz.ineanto.nicko.event.PlayerJoinListener;
|
||||||
import xyz.ineanto.nicko.event.PlayerQuitListener;
|
import xyz.ineanto.nicko.event.PlayerQuitListener;
|
||||||
import xyz.ineanto.nicko.language.CustomLanguage;
|
import xyz.ineanto.nicko.language.CustomLanguage;
|
||||||
|
@ -132,6 +134,8 @@ public class Nicko extends JavaPlugin {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
|
||||||
metrics = new Metrics(this, 20483);
|
metrics = new Metrics(this, 20483);
|
||||||
|
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new RespawnPacketListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("Nicko has been enabled.");
|
getLogger().info("Nicko has been enabled.");
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package xyz.ineanto.nicko.appearance;
|
package xyz.ineanto.nicko.appearance;
|
||||||
|
|
||||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
|
||||||
import com.comphenix.protocol.wrappers.*;
|
import com.comphenix.protocol.wrappers.*;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
@ -160,27 +159,19 @@ public class AppearanceManager {
|
||||||
player.setFoodLevel(foodLevel);
|
player.setFoodLevel(foodLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void updateTabList(WrappedGameProfile gameProfile, String displayName) {
|
private void updateTabList(WrappedGameProfile gameProfile, String displayName) {
|
||||||
final WrapperPlayerServerPlayerInfo add = new WrapperPlayerServerPlayerInfo();
|
final WrapperPlayerServerPlayerInfo add = new WrapperPlayerServerPlayerInfo();
|
||||||
if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) {
|
final WrapperPlayerServerPlayerInfoRemove remove = new WrapperPlayerServerPlayerInfoRemove();
|
||||||
final WrapperPlayerServerPlayerInfoRemove remove = new WrapperPlayerServerPlayerInfoRemove();
|
final EnumSet<EnumWrappers.PlayerInfoAction> actions = EnumSet.of(
|
||||||
final EnumSet<EnumWrappers.PlayerInfoAction> actions = EnumSet.of(
|
EnumWrappers.PlayerInfoAction.ADD_PLAYER,
|
||||||
EnumWrappers.PlayerInfoAction.ADD_PLAYER,
|
EnumWrappers.PlayerInfoAction.INITIALIZE_CHAT,
|
||||||
EnumWrappers.PlayerInfoAction.INITIALIZE_CHAT,
|
EnumWrappers.PlayerInfoAction.UPDATE_LISTED,
|
||||||
EnumWrappers.PlayerInfoAction.UPDATE_LISTED,
|
EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME,
|
||||||
EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME,
|
EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE,
|
||||||
EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE,
|
EnumWrappers.PlayerInfoAction.UPDATE_LATENCY);
|
||||||
EnumWrappers.PlayerInfoAction.UPDATE_LATENCY);
|
remove.setUUIDs(List.of(player.getUniqueId()));
|
||||||
remove.setUUIDs(List.of(player.getUniqueId()));
|
remove.broadcastPacket();
|
||||||
remove.broadcastPacket();
|
add.setActions(actions);
|
||||||
add.setActions(actions);
|
|
||||||
} else {
|
|
||||||
final WrapperPlayerServerPlayerInfo remove = new WrapperPlayerServerPlayerInfo();
|
|
||||||
remove.setActions(EnumSet.of(EnumWrappers.PlayerInfoAction.REMOVE_PLAYER));
|
|
||||||
add.setActions(EnumSet.of(EnumWrappers.PlayerInfoAction.ADD_PLAYER));
|
|
||||||
remove.broadcastPacket();
|
|
||||||
}
|
|
||||||
|
|
||||||
add.setData(List.of(new PlayerInfoData(
|
add.setData(List.of(new PlayerInfoData(
|
||||||
player.getUniqueId(),
|
player.getUniqueId(),
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import xyz.ineanto.nicko.version.Version;
|
import xyz.ineanto.nicko.version.Version;
|
||||||
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
public static final Version VERSION = new Version(1, 0, 9);
|
public static final Version VERSION = new Version(1, 2, 0);
|
||||||
public static final Configuration DEFAULT = new Configuration(VERSION.toString(),
|
public static final Configuration DEFAULT = new Configuration(VERSION.toString(),
|
||||||
DefaultDataSources.SQL_EMPTY,
|
DefaultDataSources.SQL_EMPTY,
|
||||||
DefaultDataSources.REDIS_EMPTY,
|
DefaultDataSources.REDIS_EMPTY,
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
package xyz.ineanto.nicko.debug;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.events.ListeningWhitelist;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.comphenix.protocol.events.PacketListener;
|
||||||
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
|
import com.comphenix.protocol.wrappers.MinecraftKey;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import xyz.ineanto.nicko.Nicko;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class RespawnPacketListener implements PacketListener {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
try {
|
||||||
|
final Optional<World> world = getWorld(event);
|
||||||
|
if (world.isEmpty()) {
|
||||||
|
Bukkit.broadcast(Component.text("did not find the world the player was in"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.broadcast(Component.text("found " + world.get().getName() + "!"));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ListeningWhitelist getSendingWhitelist() {
|
||||||
|
return ListeningWhitelist.newBuilder().types(PacketType.Play.Server.RESPAWN).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ListeningWhitelist getReceivingWhitelist() {
|
||||||
|
return ListeningWhitelist.EMPTY_WHITELIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Plugin getPlugin() {
|
||||||
|
return Nicko.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean keysEquals(MinecraftKey wrappedKey, NamespacedKey bukkitKey) {
|
||||||
|
// compare bukkit minecraft key and NMS wrapped minecraft key
|
||||||
|
return wrappedKey.getPrefix().equals(bukkitKey.getNamespace()) && wrappedKey.getKey().equals(bukkitKey.getKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<World> getWorld(PacketEvent event) throws Throwable {
|
||||||
|
final Class<?> commonPlayerInfoClazz = MinecraftReflection.getMinecraftClass("network.protocol.game.CommonPlayerSpawnInfo");
|
||||||
|
// access CommonPlayerSpawnInfo, first field of that type in the Respawn / Login packets
|
||||||
|
final Object packetHandle = event.getPacket().getHandle();
|
||||||
|
final Object commonSpawnData = packetHandle.getClass().getRecordComponents()[0].getAccessor().invoke(packetHandle);
|
||||||
|
|
||||||
|
Arrays.stream(commonSpawnData.getClass().getRecordComponents()).forEach(component -> {
|
||||||
|
component.getAccessor().setAccessible(true);
|
||||||
|
System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
||||||
|
System.out.println(component.getName());
|
||||||
|
System.out.println(component.getType().getSimpleName());
|
||||||
|
System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
||||||
|
component.getAccessor().setAccessible(false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// get the key of the level the player is joining. Second field in the object. First of type ResourceKey
|
||||||
|
/**MinecraftKey key = MinecraftKey.fromHandle(Accessors.getFieldAccessor(commonSpawnData.getClass(), MinecraftReflection.getResourceKey(), true)
|
||||||
|
.get(commonSpawnData)); // wrap to ProtocolLib handle
|
||||||
|
for (World world : Bukkit.getWorlds()) {
|
||||||
|
if (keysEquals(key, world.getKey())) {
|
||||||
|
return Optional.of(world);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,18 +5,12 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.ineanto.nicko.Nicko;
|
|
||||||
import xyz.ineanto.nicko.gui.CacheManagementGUI;
|
import xyz.ineanto.nicko.gui.CacheManagementGUI;
|
||||||
import xyz.ineanto.nicko.gui.items.ItemDefaults;
|
|
||||||
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.xenondevs.invui.item.builder.ItemBuilder;
|
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.AsyncItem;
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
import xyz.xenondevs.invui.util.MojangApiUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ManageCacheItem extends AsyncItem {
|
public class ManageCacheItem extends AsyncItem {
|
||||||
public ManageCacheItem(PlayerLanguage playerLanguage) {
|
public ManageCacheItem(PlayerLanguage playerLanguage) {
|
||||||
|
@ -25,13 +19,8 @@ public class ManageCacheItem extends AsyncItem {
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.LOADING);
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.LOADING);
|
||||||
}, (click -> true)).getItemProvider(),
|
}, (click -> true)).getItemProvider(),
|
||||||
() -> {
|
() -> {
|
||||||
try {
|
final ItemBuilder builder = new ItemBuilder(Material.PLAYER_HEAD);
|
||||||
final SkullBuilder builder = new SkullBuilder("Notch");
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.Admin.MANAGE_CACHE);
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.Admin.MANAGE_CACHE);
|
|
||||||
} catch (MojangApiUtils.MojangApiException | IOException e) {
|
|
||||||
Nicko.getInstance().getLogger().warning("Unable to get Head texture for Notch! (GUI/ManageCache)");
|
|
||||||
return ItemDefaults.getErrorSkullItem(playerLanguage, LanguageKey.GUI.Admin.MANAGE_CACHE);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class ChangeBothItem {
|
||||||
|
|
||||||
public SuppliedItem get() {
|
public SuppliedItem get() {
|
||||||
return new SuppliedItem(() -> {
|
return new SuppliedItem(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.TOTEM_OF_UNDYING);
|
final ItemBuilder builder = new ItemBuilder(Material.ARMOR_STAND);
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.CHANGE_BOTH);
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.CHANGE_BOTH);
|
||||||
}, click -> {
|
}, click -> {
|
||||||
final ClickType clickType = click.getClickType();
|
final ClickType clickType = click.getClickType();
|
||||||
|
|
|
@ -1,36 +1,25 @@
|
||||||
package xyz.ineanto.nicko.gui.items.appearance;
|
package xyz.ineanto.nicko.gui.items.appearance;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import xyz.ineanto.nicko.Nicko;
|
|
||||||
import xyz.ineanto.nicko.anvil.AnvilManager;
|
import xyz.ineanto.nicko.anvil.AnvilManager;
|
||||||
import xyz.ineanto.nicko.gui.items.ItemDefaults;
|
|
||||||
import xyz.ineanto.nicko.language.PlayerLanguage;
|
|
||||||
import xyz.ineanto.nicko.language.LanguageKey;
|
import xyz.ineanto.nicko.language.LanguageKey;
|
||||||
import xyz.xenondevs.invui.item.builder.SkullBuilder;
|
import xyz.ineanto.nicko.language.PlayerLanguage;
|
||||||
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
import xyz.xenondevs.invui.util.MojangApiUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ChangeSkinItem {
|
public class ChangeSkinItem {
|
||||||
private final PlayerLanguage playerLanguage;
|
private final PlayerLanguage playerLanguage;
|
||||||
private final Player player;
|
|
||||||
|
|
||||||
public ChangeSkinItem(Player player) {
|
public ChangeSkinItem(Player player) {
|
||||||
this.playerLanguage = new PlayerLanguage(player);
|
this.playerLanguage = new PlayerLanguage(player);
|
||||||
this.player = player;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuppliedItem get() {
|
public SuppliedItem get() {
|
||||||
return new SuppliedItem(() -> {
|
return new SuppliedItem(() -> {
|
||||||
try {
|
final ItemBuilder builder = new ItemBuilder(Material.PLAYER_HEAD);
|
||||||
final SkullBuilder builder = new SkullBuilder(player.getName());
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.CHANGE_SKIN);
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.CHANGE_SKIN);
|
|
||||||
} catch (MojangApiUtils.MojangApiException | IOException e) {
|
|
||||||
Nicko.getInstance().getLogger().warning("Unable to get Head texture for specified player (" + player.getName() + ")! (GUI/Home)");
|
|
||||||
return ItemDefaults.getErrorSkullItem(playerLanguage, LanguageKey.GUI.Home.CHANGE_SKIN);
|
|
||||||
}
|
|
||||||
}, click -> {
|
}, click -> {
|
||||||
final ClickType clickType = click.getClickType();
|
final ClickType clickType = click.getClickType();
|
||||||
if (clickType.isLeftClick() || clickType.isRightClick()) {
|
if (clickType.isLeftClick() || clickType.isRightClick()) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class AdminAccessItem {
|
||||||
|
|
||||||
public SuppliedItem get() {
|
public SuppliedItem get() {
|
||||||
return new SuppliedItem(() -> {
|
return new SuppliedItem(() -> {
|
||||||
final ItemBuilder builder = new ItemBuilder(Material.COMMAND_BLOCK_MINECART);
|
final ItemBuilder builder = new ItemBuilder(Material.SCAFFOLDING);
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.ADMIN);
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.ADMIN);
|
||||||
}, click -> {
|
}, click -> {
|
||||||
final ClickType clickType = click.getClickType();
|
final ClickType clickType = click.getClickType();
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package xyz.ineanto.nicko.gui.items.home;
|
package xyz.ineanto.nicko.gui.items.home;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import xyz.ineanto.nicko.Nicko;
|
import xyz.ineanto.nicko.Nicko;
|
||||||
import xyz.ineanto.nicko.appearance.ActionResult;
|
import xyz.ineanto.nicko.appearance.ActionResult;
|
||||||
import xyz.ineanto.nicko.appearance.AppearanceManager;
|
import xyz.ineanto.nicko.appearance.AppearanceManager;
|
||||||
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.SkullBuilder;
|
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||||
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
import xyz.xenondevs.invui.item.impl.SuppliedItem;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -24,8 +25,7 @@ public class RandomSkinItem {
|
||||||
|
|
||||||
public SuppliedItem get() {
|
public SuppliedItem get() {
|
||||||
return new SuppliedItem(() -> {
|
return new SuppliedItem(() -> {
|
||||||
final SkullBuilder.HeadTexture texture = new SkullBuilder.HeadTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzgzMTEzOGMyMDYxMWQzMDJjNDIzZmEzMjM3MWE3NDNkMTc0MzdhMTg5NzNjMzUxOTczNDQ3MGE3YWJiNCJ9fX0=");
|
final ItemBuilder builder = new ItemBuilder(Material.SPAWNER);
|
||||||
final SkullBuilder builder = new SkullBuilder(texture);
|
|
||||||
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.RANDOM_SKIN);
|
return playerLanguage.translateItem(builder, LanguageKey.GUI.Home.RANDOM_SKIN);
|
||||||
}, (event) -> {
|
}, (event) -> {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
|
@ -9,7 +9,7 @@ public enum Language implements Serializable {
|
||||||
FRENCH("fr", "Français"),
|
FRENCH("fr", "Français"),
|
||||||
CUSTOM("cm", "Server Custom");
|
CUSTOM("cm", "Server Custom");
|
||||||
|
|
||||||
public static final Version VERSION = new Version(1, 1, 4);
|
public static final Version VERSION = new Version(1, 2, 0);
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private transient final String name;
|
private transient final String name;
|
||||||
|
|
|
@ -13,6 +13,8 @@ import com.google.common.hash.Hashing;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PacketPlayServerRespawn Wrapper class (1.20.X to 1.21.X)
|
* PacketPlayServerRespawn Wrapper class (1.20.X to 1.21.X)
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -53,11 +55,11 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
} else {
|
} else {
|
||||||
// 1.20.5 to 1.21.1
|
// 1.20.5 to 1.21.1
|
||||||
|
|
||||||
// why is life so hard?
|
|
||||||
final Class<?> commonPlayerInfoClazz = MinecraftReflection.getMinecraftClass("network.protocol.game.CommonPlayerSpawnInfo");
|
final Class<?> commonPlayerInfoClazz = MinecraftReflection.getMinecraftClass("network.protocol.game.CommonPlayerSpawnInfo");
|
||||||
try {
|
try {
|
||||||
final Object commonSpawnData = Accessors.getFieldAccessor(TYPE.getPacketClass(), commonPlayerInfoClazz, true).getField()
|
final Field commonSpawnDataField = Accessors.getFieldAccessor(TYPE.getPacketClass(), commonPlayerInfoClazz, true).getField();
|
||||||
.get(this);
|
commonSpawnDataField.setAccessible(true);
|
||||||
|
|
||||||
final MinecraftKey key = MinecraftKey.fromHandle(
|
final MinecraftKey key = MinecraftKey.fromHandle(
|
||||||
Accessors.getFieldAccessor(
|
Accessors.getFieldAccessor(
|
||||||
commonPlayerInfoClazz,
|
commonPlayerInfoClazz,
|
||||||
|
@ -71,7 +73,7 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
MinecraftReflection.getResourceKey(),
|
MinecraftReflection.getResourceKey(),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.set(commonSpawnData, key);
|
.set(commonSpawnDataField.get(this), key);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# Nicko ${version} - Config:
|
# Nicko ${version} - Config:
|
||||||
|
|
||||||
# Specifies the configuration version, don't change.
|
# Specifies the configuration version, don't change.
|
||||||
version: "1.0.9"
|
version: "1.2.0"
|
||||||
|
|
||||||
#
|
|
||||||
# Language
|
|
||||||
#
|
|
||||||
|
|
||||||
# Nicko will copy the English locale as "lang.yml"
|
# Nicko will copy the English locale as "lang.yml"
|
||||||
# and will use the translations in that file when "Server Custom"
|
# and will use the translations in that file when "Server Custom"
|
||||||
|
@ -13,10 +9,6 @@ version: "1.0.9"
|
||||||
# Accepted values: false (Disabled), true (Enabled)
|
# Accepted values: false (Disabled), true (Enabled)
|
||||||
customLocale: false
|
customLocale: false
|
||||||
|
|
||||||
#
|
|
||||||
# Storage
|
|
||||||
#
|
|
||||||
|
|
||||||
sql:
|
sql:
|
||||||
# Indicates wherever the data will be stored locally
|
# Indicates wherever the data will be stored locally
|
||||||
# inside a .json file or in an SQL database.
|
# inside a .json file or in an SQL database.
|
||||||
|
@ -39,8 +31,6 @@ sql:
|
||||||
# Accepted values: any string
|
# Accepted values: any string
|
||||||
password: "password"
|
password: "password"
|
||||||
|
|
||||||
# This configuration section manages Redis (enabled BungeeCord support).
|
|
||||||
# It is used to transfer data between multiple servers.
|
|
||||||
redis:
|
redis:
|
||||||
# Indicates wherever the data will be stored through
|
# Indicates wherever the data will be stored through
|
||||||
# Redis to transfer whenever a player switches server.
|
# Redis to transfer whenever a player switches server.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Nicko ${version} - Language File:
|
# Nicko ${version} - Language File:
|
||||||
|
|
||||||
# Specifies the configuration version, don't change.
|
# Specifies the configuration version, don't change.
|
||||||
version: "1.1.4"
|
version: "1.2.0"
|
||||||
|
|
||||||
prefix: "<b><gradient:#01a97c:#8ffd54>NICKO</gradient></b>"
|
prefix: "<b><gradient:#01a97c:#8ffd54>NICKO</gradient></b>"
|
||||||
whoosh: "<b><gradient:#01a97c:#8ffd54>WHOOSH!</gradient></b>"
|
whoosh: "<b><gradient:#01a97c:#8ffd54>WHOOSH!</gradient></b>"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Nicko ${version} - Fichier de langue:
|
# Nicko ${version} - Fichier de langue:
|
||||||
|
|
||||||
# Précise la version de la configuration, ne pas changer.
|
# Précise la version de la configuration, ne pas changer.
|
||||||
version: "1.1.4"
|
version: "1.2.0"
|
||||||
|
|
||||||
prefix: "<b><gradient:#01a97c:#8ffd54>NICKO</gradient></b>"
|
prefix: "<b><gradient:#01a97c:#8ffd54>NICKO</gradient></b>"
|
||||||
whoosh: "<b><gradient:#01a97c:#8ffd54>WHOOSH!</gradient></b>"
|
whoosh: "<b><gradient:#01a97c:#8ffd54>WHOOSH!</gradient></b>"
|
||||||
|
|
Loading…
Add table
Reference in a new issue