mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-30 06:23:29 +01:00
commit
b13f7b4379
BIN
lib/Xperms.jar
Normal file
BIN
lib/Xperms.jar
Normal file
Binary file not shown.
9
pom.xml
9
pom.xml
@ -11,7 +11,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.7-R0.1</version>
|
||||
<version>1.4.7-R1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.hydrox.bukkit.DroxPerms</groupId>
|
||||
@ -73,6 +73,13 @@
|
||||
<version>2.0.9a</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/bpermissions.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.sebc722</groupId>
|
||||
<artifactId>xPerms</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Xperms.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.agnate.EconXP.EconXP</groupId>
|
||||
|
@ -68,6 +68,7 @@ import net.milkbowl.vault.permission.plugins.Permission_Privileges;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_SimplyPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_Starburst;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_SuperPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_Xperms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_bPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_bPermissions2;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_zPermissions;
|
||||
@ -303,6 +304,9 @@ public class Vault extends JavaPlugin {
|
||||
// Try to load Permissions 3 (Yeti)
|
||||
hookPermission("Permissions 3 (Yeti)", Permission_Permissions3.class, ServicePriority.Normal, "com.nijiko.permissions.ModularControl");
|
||||
|
||||
// Try to load Xperms
|
||||
hookPermission("Xperms", Permission_Xperms.class, ServicePriority.Low, "com.github.sebc722.Xperms");
|
||||
|
||||
Permission perms = new Permission_SuperPerms(this);
|
||||
sm.register(Permission.class, perms, this, ServicePriority.Lowest);
|
||||
log.info(String.format("[%s][Permission] SuperPermissions loaded as backup permission system.", getDescription().getName()));
|
||||
|
@ -32,13 +32,13 @@ import org.bukkit.plugin.Plugin;
|
||||
public class Permission_Xperms extends Permission {
|
||||
|
||||
private final String name = "Xperms";
|
||||
private Xmain permission = null;
|
||||
private Xmain perms = null;
|
||||
|
||||
public Permission_Xperms(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin)
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||
|
||||
if(permission == null){
|
||||
if(perms == null){
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
|
||||
if(perms != null){
|
||||
if(perms.isEnabled()){
|
||||
@ -48,51 +48,45 @@ public class Permission_Xperms extends Permission {
|
||||
}
|
||||
} catch(NumberFormatException e){
|
||||
// version is first release, numbered 1.0.0
|
||||
log.info(String.format("[%s] [Permission] %s Current version is not compatibe with vault! Please Update!", plugin.getDescription().getName(), name);
|
||||
log.info(String.format("[%s] [Permission] %s Current version is not compatibe with vault! Please Update!", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
permission = (Xmain) perms;
|
||||
perms = (Xmain) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Xmain permission = null;
|
||||
Permission_Xperms permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_Xperms permission){
|
||||
public PermissionServerListener(Permission_Xperms permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
this.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin)
|
||||
|
||||
if(permission == null){
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
|
||||
if(perms != null){
|
||||
if(perms.isEnabled()){
|
||||
try{
|
||||
if (event.getPlugin().getDescription().getName().equals("Xperms")) {
|
||||
Plugin perms = event.getPlugin();
|
||||
try {
|
||||
if(Double.valueOf(perms.getDescription().getVersion()) < 1.1){
|
||||
log.info(String.format("[%s] [Permission] %s Current version is not compatible with vault! Please Update!", plugin.getDescription().getName(), name));
|
||||
}
|
||||
} catch(NumberFormatException e){
|
||||
// version is first release, numbered 1.0.0
|
||||
log.info(String.format("[%s] [Permission] %s Current version is not compatibe with vault! Please Update!", plugin.getDescription().getName(), name);
|
||||
log.info(String.format("[%s] [Permission] %s Current version is not compatibe with vault! Please Update!", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
permission.permission = (Xmain) perms;
|
||||
permission.perms = (Xmain) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if(permission.permission != null){
|
||||
if(permission.perms != null){
|
||||
if(event.getPlugin().getName().equals("Xperms")){
|
||||
permission.permission = null;
|
||||
permission.perms = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
@ -106,7 +100,7 @@ public class Permission_Xperms extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return permission.isEnabled();
|
||||
return perms.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,37 +110,37 @@ public class Permission_Xperms extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String world, String player, String permission) {
|
||||
return permission.getXplayer().hasPermission(player, permission);
|
||||
return perms.getXplayer().hasPermission(player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
return permission.getXplayer().addPermission(player, permission);
|
||||
return perms.getXplayer().addPermission(player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, String player, String permission) {
|
||||
return permission.getXplayer().removePermission(player, permission);
|
||||
return perms.getXplayer().removePermission(player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String world, String group, String permission) {
|
||||
return permission.getXgroup().hasPermission(group, permission);
|
||||
return perms.getXgroup().hasPermission(group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, String group, String permission) {
|
||||
return permission.getXgroup().addPermission(group, permission);
|
||||
return perms.getXgroup().addPermission(group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String world, String group, String permission) {
|
||||
return permission.getXgroup().removePermission(group, permission)
|
||||
return perms.getXgroup().removePermission(group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, String player, String group) {
|
||||
String userGroup = permission.getXusers().getUserGroup(player);
|
||||
String userGroup = perms.getXusers().getUserGroup(player);
|
||||
if(userGroup == group){
|
||||
return true;
|
||||
}
|
||||
@ -157,18 +151,18 @@ public class Permission_Xperms extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, String player, String group) {
|
||||
return permission.getXplayer().setGroup(player, group);
|
||||
return perms.getXplayer().setGroup(player, group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, String player, String group) {
|
||||
return permission.getXplayer().setGroup(player, "def");
|
||||
return perms.getXplayer().setGroup(player, "def");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String player) {
|
||||
ArrayList<String> playerGroup = new ArrayList<String>();
|
||||
playerGroup.add(permission.getXusers().getUserGroup(player));
|
||||
playerGroup.add(perms.getXusers().getUserGroup(player));
|
||||
String[] playerGroupArray = playerGroup.toArray(new String[0]);
|
||||
|
||||
return playerGroupArray;
|
||||
@ -176,11 +170,11 @@ public class Permission_Xperms extends Permission {
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String player) {
|
||||
return permission.getXusers().getUserGroup(player);
|
||||
return perms.getXusers().getUserGroup(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return permission.getXperms().getGroups();
|
||||
return perms.getXperms().getGroups();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user