feat: 1.20/1.20.1 update

This commit is contained in:
ineanto 2023-06-28 13:22:48 +02:00
parent c66979133d
commit 50dd4c3adf
5 changed files with 64 additions and 37 deletions

View file

@ -2,13 +2,25 @@
## The feature packed, next generation disguise plugin for Minecraft. ## The feature packed, next generation disguise plugin for Minecraft.
### Download: ---
## Download:
Coming soon! ⏳ 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 compatibility table
| Version | Supported | | Version | Plugin |
|-----------|----------------------------------------------------------------------------| |----------|----------------------------------------------------------------------------|
| < 1.12.2 | Use [NickReloaded](https://www.spigotmc.org/resources/nickreloaded.46335/) | | < 1.12.2 | Use [NickReloaded](https://www.spigotmc.org/resources/nickreloaded.46335/) |
| \> 1.12.2 | Supported | | > 1.12.2 | Use Nicko |

View file

@ -6,7 +6,7 @@ services:
db: db:
image: mariadb image: mariadb
restart: always restart: no
environment: environment:
MARIADB_ROOT_PASSWORD: 12345 MARIADB_ROOT_PASSWORD: 12345
ports: ports:
@ -14,12 +14,12 @@ services:
adminer: adminer:
image: adminer image: adminer
restart: always restart: no
ports: ports:
- "8080:8080" - "8080:8080"
redis: redis:
image: redis image: redis
restart: always restart: no
ports: ports:
- "6379:6379" - "6379:6379"

13
pom.xml
View file

@ -17,12 +17,12 @@
<repositories> <repositories>
<repository> <repository>
<id>papermc</id> <id>xenondevs</id>
<url>https://repo.papermc.io/repository/maven-public/</url> <url>https://repo.xenondevs.xyz/releases</url>
</repository> </repository>
<repository> <repository>
<id>spigot-repo</id> <id>papermc</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> <url>https://repo.papermc.io/repository/maven-public/</url>
</repository> </repository>
<repository> <repository>
<id>codemc-snapshots</id> <id>codemc-snapshots</id>
@ -63,12 +63,13 @@
<dependency> <dependency>
<groupId>xyz.xenondevs.invui</groupId> <groupId>xyz.xenondevs.invui</groupId>
<artifactId>invui</artifactId> <artifactId>invui</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.11</version>
<type>pom</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.wesjd</groupId> <groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId> <artifactId>anvilgui</artifactId>
<version>1.6.3-SNAPSHOT</version> <version>1.7.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.seeseemelk</groupId> <groupId>com.github.seeseemelk</groupId>

View file

@ -41,14 +41,17 @@ public class AnvilManager {
.plugin(NickoBukkit.getInstance()) .plugin(NickoBukkit.getInstance())
.itemLeft(getLeftItem(false)) .itemLeft(getLeftItem(false))
.interactableSlots(AnvilGUI.Slot.OUTPUT) .interactableSlots(AnvilGUI.Slot.OUTPUT)
.onComplete((completion) -> { .onClick((slot, snapshot) -> {
if (MojangUtils.isUsernameInvalid(completion.getText())) { if (slot == AnvilGUI.Slot.OUTPUT) {
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); if (MojangUtils.isUsernameInvalid(snapshot.getText())) {
} else { return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!"));
appearanceManager.setName(completion.getText()); } else {
openSkinAnvil(); appearanceManager.setName(snapshot.getText());
return Collections.singletonList(AnvilGUI.ResponseAction.close()); openSkinAnvil();
return Collections.singletonList(AnvilGUI.ResponseAction.close());
}
} }
return Collections.emptyList();
}) })
.text("New name..."); .text("New name...");
} }
@ -58,14 +61,17 @@ public class AnvilManager {
.plugin(NickoBukkit.getInstance()) .plugin(NickoBukkit.getInstance())
.itemLeft(getLeftItem(false)) .itemLeft(getLeftItem(false))
.interactableSlots(AnvilGUI.Slot.OUTPUT) .interactableSlots(AnvilGUI.Slot.OUTPUT)
.onComplete((completion) -> { .onClick((slot, snapshot) -> {
if (MojangUtils.isUsernameInvalid(completion.getText())) { if (slot == AnvilGUI.Slot.OUTPUT) {
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); if (MojangUtils.isUsernameInvalid(snapshot.getText())) {
} else { return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!"));
appearanceManager.setName(completion.getText()); } else {
final ActionResult<Void> actionResult = appearanceManager.updatePlayer(false); appearanceManager.setName(snapshot.getText());
return sendResultAndClose(actionResult); final ActionResult<Void> actionResult = appearanceManager.updatePlayer(false);
return sendResultAndClose(actionResult);
}
} }
return Collections.emptyList();
}) })
.text("New name..."); .text("New name...");
} }
@ -75,14 +81,17 @@ public class AnvilManager {
.plugin(NickoBukkit.getInstance()) .plugin(NickoBukkit.getInstance())
.itemLeft(getLeftItem(true)) .itemLeft(getLeftItem(true))
.interactableSlots(AnvilGUI.Slot.OUTPUT) .interactableSlots(AnvilGUI.Slot.OUTPUT)
.onComplete((completion) -> { .onClick((slot, snapshot) -> {
if (MojangUtils.isUsernameInvalid(completion.getText())) { if (slot == AnvilGUI.Slot.OUTPUT) {
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); if (MojangUtils.isUsernameInvalid(snapshot.getText())) {
} else { return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!"));
appearanceManager.setSkin(completion.getText()); } else {
final ActionResult<Void> actionResult = appearanceManager.updatePlayer(true); appearanceManager.setSkin(snapshot.getText());
return sendResultAndClose(actionResult); final ActionResult<Void> actionResult = appearanceManager.updatePlayer(true);
return sendResultAndClose(actionResult);
}
} }
return Collections.emptyList();
}) })
.text("New skin..."); .text("New skin...");
} }
@ -99,7 +108,7 @@ public class AnvilManager {
private ItemStack getLeftItem(boolean skin) { private ItemStack getLeftItem(boolean skin) {
final ItemStack item = new ItemStack(Material.PAPER); final ItemStack item = new ItemStack(Material.PAPER);
final ItemMeta meta = item.getItemMeta(); final ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§0New " + (skin ? "skin" : "name") + "..."); if (meta != null) meta.setDisplayName("§0New " + (skin ? "skin" : "name") + "...");
item.setItemMeta(meta); item.setItemMeta(meta);
return item; return item;
} }

View file

@ -144,6 +144,7 @@ public class AppearanceManager {
private void respawnPlayer() { private void respawnPlayer() {
final World world = player.getWorld(); final World world = player.getWorld();
final boolean wasFlying = player.isFlying();
final WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(); final WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn();
respawn.setDimension(world); respawn.setDimension(world);
respawn.setSeed(world.getSeed()); respawn.setSeed(world.getSeed());
@ -152,8 +153,12 @@ public class AppearanceManager {
respawn.setDifficulty(world.getDifficulty()); respawn.setDifficulty(world.getDifficulty());
respawn.setCopyMetadata(true); respawn.setCopyMetadata(true);
respawn.sendPacket(player); respawn.sendPacket(player);
player.setFlying(wasFlying);
player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
player.updateInventory();
} }
@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()) { if (MinecraftVersion.FEATURE_PREVIEW_UPDATE.atOrAbove()) {