Skip to content
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

Merged
merged 4 commits into from
Dec 28, 2024
Merged

Rewrote clearTeamInventory #848

merged 4 commits into from
Dec 28, 2024

Conversation

sh0inx
Copy link
Contributor

@sh0inx sh0inx commented May 13, 2024

  • should now correctly ignore visitors (since visitors are technically members?)
  • should now remove data for offline players

hopefully fixes #847

sh0inx added 2 commits May 13, 2024 02:05
- 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;
Copy link
Member

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

Comment on lines +774 to +798
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());
}
Copy link
Member

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)

@dlsf dlsf added the bug Something isn't working label Sep 4, 2024
@PeachesMLG PeachesMLG merged commit c5791dd into master Dec 28, 2024
1 check passed
@PeachesMLG PeachesMLG deleted the 847-visitor-inventory-fix branch December 28, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting island can remove itens from visiting players
3 participants