From 50dd4c3adf2de47a5a2f27263a609fe81ff6bd14 Mon Sep 17 00:00:00 2001 From: ineanto Date: Wed, 28 Jun 2023 13:22:48 +0200 Subject: [PATCH] feat: 1.20/1.20.1 update --- README.md | 22 ++++++-- docker-compose.yml | 8 +-- pom.xml | 13 ++--- .../xyz/atnrch/nicko/anvil/AnvilManager.java | 53 +++++++++++-------- .../nicko/disguise/AppearanceManager.java | 5 ++ 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index e723fb3..cd38263 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,25 @@ ## The feature packed, next generation disguise plugin for Minecraft. -### Download: +--- + +## Download: Coming soon! ⏳ +--- + +## Q/A + +Q: Players are getting kicked when they send a message on versions above 1.19.2! + +A: Install [NoEncryption](https://www.spigotmc.org/resources/noencryption.102902/). + +--- + #### Version compatibility table -| Version | Supported | -|-----------|----------------------------------------------------------------------------| -| < 1.12.2 | Use [NickReloaded](https://www.spigotmc.org/resources/nickreloaded.46335/) | -| \> 1.12.2 | Supported | \ No newline at end of file +| Version | Plugin | +|----------|----------------------------------------------------------------------------| +| < 1.12.2 | Use [NickReloaded](https://www.spigotmc.org/resources/nickreloaded.46335/) | +| > 1.12.2 | Use Nicko | diff --git a/docker-compose.yml b/docker-compose.yml index f06cc56..6bdf830 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: db: image: mariadb - restart: always + restart: no environment: MARIADB_ROOT_PASSWORD: 12345 ports: @@ -14,12 +14,12 @@ services: adminer: image: adminer - restart: always + restart: no ports: - "8080:8080" redis: image: redis - restart: always + restart: no ports: - - "6379:6379" \ No newline at end of file + - "6379:6379" diff --git a/pom.xml b/pom.xml index 04e30ec..f7515f3 100644 --- a/pom.xml +++ b/pom.xml @@ -17,12 +17,12 @@ - papermc - https://repo.papermc.io/repository/maven-public/ + xenondevs + https://repo.xenondevs.xyz/releases - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public/ + papermc + https://repo.papermc.io/repository/maven-public/ codemc-snapshots @@ -63,12 +63,13 @@ xyz.xenondevs.invui invui - 1.0-SNAPSHOT + 1.11 + pom net.wesjd anvilgui - 1.6.3-SNAPSHOT + 1.7.0-SNAPSHOT com.github.seeseemelk diff --git a/src/main/java/xyz/atnrch/nicko/anvil/AnvilManager.java b/src/main/java/xyz/atnrch/nicko/anvil/AnvilManager.java index b741fef..5b53c5b 100644 --- a/src/main/java/xyz/atnrch/nicko/anvil/AnvilManager.java +++ b/src/main/java/xyz/atnrch/nicko/anvil/AnvilManager.java @@ -41,14 +41,17 @@ public class AnvilManager { .plugin(NickoBukkit.getInstance()) .itemLeft(getLeftItem(false)) .interactableSlots(AnvilGUI.Slot.OUTPUT) - .onComplete((completion) -> { - if (MojangUtils.isUsernameInvalid(completion.getText())) { - return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); - } else { - appearanceManager.setName(completion.getText()); - openSkinAnvil(); - return Collections.singletonList(AnvilGUI.ResponseAction.close()); + .onClick((slot, snapshot) -> { + if (slot == AnvilGUI.Slot.OUTPUT) { + if (MojangUtils.isUsernameInvalid(snapshot.getText())) { + return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); + } else { + appearanceManager.setName(snapshot.getText()); + openSkinAnvil(); + return Collections.singletonList(AnvilGUI.ResponseAction.close()); + } } + return Collections.emptyList(); }) .text("New name..."); } @@ -58,14 +61,17 @@ public class AnvilManager { .plugin(NickoBukkit.getInstance()) .itemLeft(getLeftItem(false)) .interactableSlots(AnvilGUI.Slot.OUTPUT) - .onComplete((completion) -> { - if (MojangUtils.isUsernameInvalid(completion.getText())) { - return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); - } else { - appearanceManager.setName(completion.getText()); - final ActionResult actionResult = appearanceManager.updatePlayer(false); - return sendResultAndClose(actionResult); + .onClick((slot, snapshot) -> { + if (slot == AnvilGUI.Slot.OUTPUT) { + if (MojangUtils.isUsernameInvalid(snapshot.getText())) { + return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); + } else { + appearanceManager.setName(snapshot.getText()); + final ActionResult actionResult = appearanceManager.updatePlayer(false); + return sendResultAndClose(actionResult); + } } + return Collections.emptyList(); }) .text("New name..."); } @@ -75,14 +81,17 @@ public class AnvilManager { .plugin(NickoBukkit.getInstance()) .itemLeft(getLeftItem(true)) .interactableSlots(AnvilGUI.Slot.OUTPUT) - .onComplete((completion) -> { - if (MojangUtils.isUsernameInvalid(completion.getText())) { - return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); - } else { - appearanceManager.setSkin(completion.getText()); - final ActionResult actionResult = appearanceManager.updatePlayer(true); - return sendResultAndClose(actionResult); + .onClick((slot, snapshot) -> { + if (slot == AnvilGUI.Slot.OUTPUT) { + if (MojangUtils.isUsernameInvalid(snapshot.getText())) { + return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); + } else { + appearanceManager.setSkin(snapshot.getText()); + final ActionResult actionResult = appearanceManager.updatePlayer(true); + return sendResultAndClose(actionResult); + } } + return Collections.emptyList(); }) .text("New skin..."); } @@ -99,7 +108,7 @@ public class AnvilManager { private ItemStack getLeftItem(boolean skin) { final ItemStack item = new ItemStack(Material.PAPER); final ItemMeta meta = item.getItemMeta(); - meta.setDisplayName("§0New " + (skin ? "skin" : "name") + "..."); + if (meta != null) meta.setDisplayName("§0New " + (skin ? "skin" : "name") + "..."); item.setItemMeta(meta); return item; } diff --git a/src/main/java/xyz/atnrch/nicko/disguise/AppearanceManager.java b/src/main/java/xyz/atnrch/nicko/disguise/AppearanceManager.java index 1857003..282b3f5 100644 --- a/src/main/java/xyz/atnrch/nicko/disguise/AppearanceManager.java +++ b/src/main/java/xyz/atnrch/nicko/disguise/AppearanceManager.java @@ -144,6 +144,7 @@ public class AppearanceManager { private void respawnPlayer() { final World world = player.getWorld(); + final boolean wasFlying = player.isFlying(); final WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(); respawn.setDimension(world); respawn.setSeed(world.getSeed()); @@ -152,8 +153,12 @@ public class AppearanceManager { respawn.setDifficulty(world.getDifficulty()); respawn.setCopyMetadata(true); respawn.sendPacket(player); + player.setFlying(wasFlying); + player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + player.updateInventory(); } + @SuppressWarnings("deprecation") private void updateTabList(WrappedGameProfile gameProfile, String displayName) { final WrapperPlayerServerPlayerInfo add = new WrapperPlayerServerPlayerInfo(); if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) {