Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into ver/1.20.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle.kts
  • Loading branch information
acrylic-style committed Jul 30, 2024
2 parents ee809bd + dbefe03 commit 6438e2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}

group = "net.azisaba"
version = "1.20.2+6.16.6a"
version = "1.20.2+6.16.7"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ class TownServerCommand(private val plugin: LifeCore) : TransferCommand(plugin,
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
val player = sender as? Player ?: return false
if (plugin.config.getBoolean("enable-backup-item-tag", true)) {
val size = player.inventory.size
for (i in 0..<size) {
val inventorySize = player.inventory.size
for (i in 0..<inventorySize) {
player.inventory.setItem(i, ItemUtil.restoreTag(player.inventory.getItem(i)))
player.inventory.setItem(i, ItemUtil.backupTag(player.inventory.getItem(i)))
}
val enderSize = player.enderChest.size
for (i in 0..<enderSize) {
player.enderChest.setItem(i, ItemUtil.restoreTag(player.enderChest.getItem(i)))
player.enderChest.setItem(i, ItemUtil.backupTag(player.enderChest.getItem(i)))
}
}
JoinFilterUtil.addPlayerWithExpire(player.uniqueId, "lifetown", 1)
super.onCommand(sender, command, label, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ public void onPlayerJoin(PlayerJoinEvent e) {

// restore item tags
if (plugin.getConfig().getBoolean("enable-backup-item-tag", true)) {
int size = player.getInventory().getSize();
for (int i = 0; i < size; i++) {
int inventorySize = player.getInventory().getSize();
for (int i = 0; i < inventorySize; i++) {
player.getInventory().setItem(i, ItemUtil.restoreTag(player.getInventory().getItem(i)));
}
int enderSize = player.getEnderChest().getSize();
for (int i = 0; i < enderSize; i++) {
player.getEnderChest().setItem(i, ItemUtil.restoreTag(player.getEnderChest().getItem(i)));
}
}
}, 20 * 2); // 2 seconds
Bukkit.getScheduler().runTaskLater(plugin, () -> {
Expand All @@ -61,10 +65,14 @@ public void onPlayerJoin(PlayerJoinEvent e) {

// restore item tags
if (plugin.getConfig().getBoolean("enable-backup-item-tag", true)) {
int size = player.getInventory().getSize();
for (int i = 0; i < size; i++) {
int inventorySize = player.getInventory().getSize();
for (int i = 0; i < inventorySize; i++) {
player.getInventory().setItem(i, ItemUtil.restoreTag(player.getInventory().getItem(i)));
}
int enderSize = player.getEnderChest().getSize();
for (int i = 0; i < enderSize; i++) {
player.getEnderChest().setItem(i, ItemUtil.restoreTag(player.getEnderChest().getItem(i)));
}
}
}, 20 * 10); // 10 seconds
}
Expand Down

0 comments on commit 6438e2e

Please sign in to comment.