Remove attachments BEFORE we clear them.

This commit is contained in:
ElgarL 2013-01-09 04:27:10 +00:00
parent 5056210a38
commit b9af4fb35c

View File

@ -104,14 +104,6 @@ public class BukkitPermissions {
public void reset() { public void reset() {
/*
* Remove all attachments.
*/
for (String key : attachments.keySet()) {
attachments.get(key).remove();
attachments.remove(key);
}
/* /*
* collect new permissions * collect new permissions
* and register all attachments. * and register all attachments.
@ -395,15 +387,23 @@ public class BukkitPermissions {
*/ */
private void removeAttachment(String playerName) { private void removeAttachment(String playerName) {
if (attachments.containsKey(playerName)) if (attachments.containsKey(playerName)) {
attachments.get(playerName).remove();
attachments.remove(playerName); attachments.remove(playerName);
} }
}
/** /**
* Remove all attachments in case of a restart or reload. * Remove all attachments in case of a restart or reload.
*/ */
public void removeAllAttachments() { public void removeAllAttachments() {
/*
* Remove all attachments.
*/
for (String key : attachments.keySet()) {
attachments.get(key).remove();
}
attachments.clear(); attachments.clear();
} }