Perms are still ignoring me

This commit is contained in:
Norbi Peti 2016-11-29 22:05:00 +01:00
parent 6808c18d5b
commit 4e2a60e625
2 changed files with 29 additions and 0 deletions

10
pom.xml
View file

@ -108,6 +108,10 @@
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
</repository> </repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@ -142,5 +146,11 @@
<version>master-SNAPSHOT</version> <version>master-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View file

@ -6,6 +6,7 @@ import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.io.Files; import com.google.common.io.Files;
@ -21,6 +22,7 @@ import buttondevteam.discordplugin.listeners.MCListener;
import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase; import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCChatAPI;
import net.milkbowl.vault.permission.Permission;
import sx.blah.discord.api.*; import sx.blah.discord.api.*;
import sx.blah.discord.api.events.IListener; import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.ReadyEvent; import sx.blah.discord.handle.impl.events.ReadyEvent;
@ -126,6 +128,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
for (int i = msgs.size() - 1; i >= 10; i--) { for (int i = msgs.size() - 1; i >= 10; i--) {
genchannel.unpin(msgs.get(i)); genchannel.unpin(msgs.get(i));
} }
setupProviders();
TBMCCoreAPI.SendUnsentExceptions(); TBMCCoreAPI.SendUnsentExceptions();
TBMCCoreAPI.SendUnsentDebugMessages(); TBMCCoreAPI.SendUnsentDebugMessages();
} catch (Exception e) { } catch (Exception e) {
@ -223,4 +226,20 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
} }
return null; return null;
} }
public static Permission perms;
public boolean setupProviders() {
try {
Class.forName("net.milkbowl.vault.permission.Permission");
Class.forName("net.milkbowl.vault.chat.Chat");
} catch (ClassNotFoundException e) {
return false;
}
RegisteredServiceProvider<Permission> permsProvider = Bukkit.getServer().getServicesManager()
.getRegistration(Permission.class);
perms = permsProvider.getProvider();
return perms != null;
}
} }