mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-03 01:00:20 +01:00
Use soft dependencies to request loading of Permissions and CraftIRC
before NoCheat
This commit is contained in:
parent
30622e9235
commit
a039edcfaf
@ -5,6 +5,8 @@ author: Evenprime
|
||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||
version: 1.02
|
||||
|
||||
softdepend: [ Permissions, CraftIRC ]
|
||||
|
||||
commands:
|
||||
nocheat:
|
||||
description: Provides information about the current status of the NoCheat plugin
|
||||
|
@ -168,6 +168,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
||||
|
||||
if(cleanUpTaskId != -1) return;
|
||||
|
||||
try {
|
||||
cleanUpTaskId = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -176,6 +177,10 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
||||
}
|
||||
}, 5000, 5000);
|
||||
}
|
||||
catch(Exception e) {
|
||||
// It's not THAT important, so if it fails for whatever reason, just let it be.
|
||||
}
|
||||
}
|
||||
|
||||
private void teardownCleanupTask() {
|
||||
if(cleanUpTaskId != -1)
|
||||
@ -207,24 +212,17 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
||||
* Get, if available, a reference to the Permissions-plugin
|
||||
*/
|
||||
private void setupPermissions() {
|
||||
PermissionHandler p = null;
|
||||
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
|
||||
if(test != null && test instanceof Permissions) {
|
||||
p = ((Permissions)test).getHandler();
|
||||
if(p == null) {
|
||||
this.getServer().getPluginManager().enablePlugin(test);
|
||||
}
|
||||
p = ((Permissions)test).getHandler();
|
||||
}
|
||||
|
||||
if(p == null) {
|
||||
if (this.permissions == null) {
|
||||
if (permissionsPlugin != null) {
|
||||
this.permissions = ((Permissions) permissionsPlugin).getHandler();
|
||||
} else {
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
Logger.getLogger("Minecraft").warning("[NoCheat] version [" + pdfFile.getVersion() + "] couldn't find Permissions plugin. Fallback to 'isOp()' equals 'nocheat.*'");
|
||||
}
|
||||
|
||||
permissions = p;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user