mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 13:45:20 +01:00
Fix Vault hook - thanks @Yann151924
This commit is contained in:
parent
b36a33f015
commit
de09ae94b8
@ -35,6 +35,7 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -143,4 +144,11 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
e.getPlayer().sendMessage(Message.OP_DISABLED.toString());
|
e.getPlayer().sendMessage(Message.OP_DISABLED.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPluginEnable(PluginEnableEvent e) {
|
||||||
|
if (e.getPlugin().getName().equalsIgnoreCase("Vault")) {
|
||||||
|
plugin.tryVaultHook(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,19 +198,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Provide vault support
|
// Provide vault support
|
||||||
getLog().info("Attempting to hook into Vault...");
|
tryVaultHook(false);
|
||||||
try {
|
|
||||||
if (getServer().getPluginManager().isPluginEnabled("Vault")) {
|
|
||||||
vaultHook = new VaultHook();
|
|
||||||
vaultHook.hook(this);
|
|
||||||
getLog().info("Registered Vault permission & chat hook.");
|
|
||||||
} else {
|
|
||||||
getLog().info("Vault not found.");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
getLog().severe("Error occurred whilst hooking into Vault.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
// register with the LP API
|
// register with the LP API
|
||||||
getLog().info("Registering API...");
|
getLog().info("Registering API...");
|
||||||
@ -268,6 +256,27 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tryVaultHook(boolean force) {
|
||||||
|
if (vaultHook != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLog().info("Attempting to hook with Vault...");
|
||||||
|
try {
|
||||||
|
if (force || getServer().getPluginManager().isPluginEnabled("Vault")) {
|
||||||
|
vaultHook = new VaultHook();
|
||||||
|
vaultHook.hook(this);
|
||||||
|
getLog().info("Registered Vault permission & chat hook.");
|
||||||
|
} else {
|
||||||
|
getLog().info("Vault not found.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
vaultHook = null;
|
||||||
|
getLog().severe("Error occurred whilst hooking into Vault.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAsync(Runnable r) {
|
public void doAsync(Runnable r) {
|
||||||
asyncExecutor.execute(r);
|
asyncExecutor.execute(r);
|
||||||
|
@ -5,7 +5,8 @@ author: Luck
|
|||||||
website: https://github.com/lucko/LuckPerms
|
website: https://github.com/lucko/LuckPerms
|
||||||
|
|
||||||
main: me.lucko.luckperms.bukkit.LPBukkitPlugin
|
main: me.lucko.luckperms.bukkit.LPBukkitPlugin
|
||||||
softdepend: [Vault, PermissionsEx, GroupManager, PowerfulPerms, zPermissions, bPermissions] # For migration
|
load: STARTUP
|
||||||
|
softdepend: [PermissionsEx, GroupManager, PowerfulPerms, zPermissions, bPermissions] # For migration
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
luckperms:
|
luckperms:
|
||||||
|
Loading…
Reference in New Issue
Block a user