-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrote clearTeamInventory #848
base: master
Are you sure you want to change the base?
Conversation
- should now correctly ignore visitors (since visitors are technically members?) - should now remove data for offline players
|
||
for(User user : island.getMembers()) { | ||
|
||
if (user.getUserRank() == -1) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is needed, island.getMembers()
only returns a list of the island members which doesnt include visitors
try{ | ||
user.getPlayer(); | ||
onlinePlayers.add(user); | ||
} catch (Exception e) { | ||
offlinePlayers.add(user); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try{ | |
user.getPlayer(); | |
onlinePlayers.add(user); | |
} catch (Exception e) { | |
offlinePlayers.add(user); | |
} | |
Player player = user.getPlayer(); | |
if (player == null){ | |
offlinePlayers.add(player); | |
} else { | |
onlinePlayers.add(player); | |
} |
for(User user : offlinePlayers) { | ||
|
||
try { | ||
File file = new File(Bukkit.getWorlds().get(0).getWorldFolder().getPath() + File.pathSeparator + "playerdata" + File.pathSeparator + user.getUuid() + ".dat"); | ||
NBTFile playerFile = new NBTFile(file); | ||
|
||
if (IridiumSkyblock.getInstance().getConfiguration().clearInventoryOnRegen) { | ||
NBTCompound compound = playerFile.getCompound("").getCompound("Inventory"); | ||
compound.clearNBT(); | ||
playerFile.save(); | ||
} | ||
|
||
if (IridiumSkyblock.getInstance().getConfiguration().clearEnderChestOnRegen) { | ||
NBTCompound compound = playerFile.getCompound("").getCompound("EnderItems"); | ||
compound.clearNBT(); | ||
playerFile.save(); | ||
} | ||
|
||
} catch (IOException e) { | ||
IridiumSkyblock.getInstance().getLogger().warning("Cannot mutate user: " + user.getName() + ". See stacktrace for details."); | ||
IridiumSkyblock.getInstance().getLogger().warning(e.getMessage()); | ||
} catch (NullPointerException e) { | ||
IridiumSkyblock.getInstance().getLogger().warning("Cannot mutate user: " + user.getName() + ". Either player or compound doesn't exist (See stacktrace for details)."); | ||
IridiumSkyblock.getInstance().getLogger().warning(e.getMessage()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate this... why cant you access an offline player's inventory (Talking to the physical embodiment of the Spigot API here, not you)
hopefully fixes #847