Unregister permissions on unload

Should allow the plugin to be reloaded
This commit is contained in:
Goh Wei Wen 2020-06-14 21:24:05 +08:00
parent 3a810bda54
commit 3198855544
2 changed files with 10 additions and 0 deletions

View File

@ -234,6 +234,7 @@ public class DungeonsXL extends DREPlugin implements DungeonsAPI {
deleteAllInstances(); deleteAllInstances();
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
getServer().getScheduler().cancelTasks(this); getServer().getScheduler().cancelTasks(this);
DPermission.unregister();
loaded = false; loaded = false;
} }

View File

@ -213,4 +213,13 @@ public enum DPermission {
} }
} }
/**
* Unregisters the permissions.
*/
public static void unregister() {
for (DPermission permission : values()) {
Bukkit.getPluginManager().removePermission(permission.getNode());
}
}
} }