Replacing old inventory protecting with safe packet modifications using ProtocolLib.
Instead of clearing the inventory of players and storing it's contents in a file, we now prevent the server from sending the inventory packet if the player is not logged in. The player will see a empty inventory, but has still his items stored on the server. Therefore we don't need to modify the player's inventory and we won't make any inventory corrupted. Fixes Xephi/AuthMeReloaded#203, Fixes Xephi/AuthMeReloaded#193, Fixes Xephi/AuthMeReloaded#191, Fixes Xephi/AuthMeReloaded#148 Remove dead code + Fix empty inventory on the unregister command Fix NPE if ProtocolLib isn't enabled or installed
This commit is contained in:
@@ -18,7 +18,6 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
@@ -34,7 +33,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
|
||||
public UnregisterCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.playerCache = new JsonCache(plugin);
|
||||
this.playerCache = new JsonCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,8 +78,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
player.teleport(tpEvent.getTo());
|
||||
}
|
||||
}
|
||||
player.getInventory().setContents(new ItemStack[36]);
|
||||
player.getInventory().setArmorContents(new ItemStack[4]);
|
||||
|
||||
player.saveData();
|
||||
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
|
||||
if (!Settings.getRegisteredGroup.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user