mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-23 11:05:48 +01:00
fix all the errors.
This commit is contained in:
parent
be7551b813
commit
20159ae028
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>
|
||||
@ -74,6 +74,13 @@
|
||||
<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>
|
||||
<artifactId>EconXP</artifactId>
|
||||
|
@ -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;
|
||||
@ -302,6 +303,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);
|
||||
|
@ -32,155 +32,149 @@ 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)
|
||||
|
||||
if(permission == null){
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
|
||||
if(perms != null){
|
||||
if(perms.isEnabled()){
|
||||
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);
|
||||
}
|
||||
}
|
||||
permission = (Xmain) perms;
|
||||
this.plugin = plugin;
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(this), plugin);
|
||||
|
||||
if(perms == null){
|
||||
Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
|
||||
if(perms != null){
|
||||
if(perms.isEnabled()){
|
||||
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));
|
||||
}
|
||||
}
|
||||
perms = (Xmain) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Xmain permission = null;
|
||||
|
||||
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(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);
|
||||
}
|
||||
}
|
||||
permission.permission = (Xmain) perms;
|
||||
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
|
||||
}
|
||||
}
|
||||
Permission_Xperms permission = null;
|
||||
|
||||
public PermissionServerListener(Permission_Xperms permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
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));
|
||||
}
|
||||
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(event.getPlugin().getName().equals("Xperms")){
|
||||
permission.permission = null;
|
||||
if(permission.perms != null){
|
||||
if(event.getPlugin().getName().equals("Xperms")){
|
||||
permission.perms = null;
|
||||
log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return permission.isEnabled();
|
||||
return perms.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@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);
|
||||
if(userGroup == group){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
String userGroup = perms.getXusers().getUserGroup(player);
|
||||
if(userGroup == group){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@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));
|
||||
String[] playerGroupArray = playerGroup.toArray(new String[0]);
|
||||
|
||||
return playerGroupArray;
|
||||
ArrayList<String> playerGroup = new ArrayList<String>();
|
||||
playerGroup.add(perms.getXusers().getUserGroup(player));
|
||||
String[] playerGroupArray = playerGroup.toArray(new String[0]);
|
||||
|
||||
return playerGroupArray;
|
||||
}
|
||||
|
||||
@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