fix all the errors.

This commit is contained in:
Nick Minkler 2013-02-07 23:48:05 -08:00
parent be7551b813
commit 20159ae028
4 changed files with 84 additions and 79 deletions

BIN
lib/Xperms.jar Normal file

Binary file not shown.

View File

@ -11,7 +11,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.4.7-R0.1</version> <version>1.4.7-R1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.hydrox.bukkit.DroxPerms</groupId> <groupId>de.hydrox.bukkit.DroxPerms</groupId>
@ -74,6 +74,13 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/lib/bpermissions.jar</systemPath> <systemPath>${project.basedir}/lib/bpermissions.jar</systemPath>
</dependency> </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> <dependency>
<groupId>ca.agnate.EconXP.EconXP</groupId> <groupId>ca.agnate.EconXP.EconXP</groupId>
<artifactId>EconXP</artifactId> <artifactId>EconXP</artifactId>

View File

@ -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_SimplyPerms;
import net.milkbowl.vault.permission.plugins.Permission_Starburst; import net.milkbowl.vault.permission.plugins.Permission_Starburst;
import net.milkbowl.vault.permission.plugins.Permission_SuperPerms; 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_bPermissions;
import net.milkbowl.vault.permission.plugins.Permission_bPermissions2; import net.milkbowl.vault.permission.plugins.Permission_bPermissions2;
import net.milkbowl.vault.permission.plugins.Permission_zPermissions; import net.milkbowl.vault.permission.plugins.Permission_zPermissions;
@ -302,6 +303,9 @@ public class Vault extends JavaPlugin {
// Try to load Permissions 3 (Yeti) // Try to load Permissions 3 (Yeti)
hookPermission("Permissions 3 (Yeti)", Permission_Permissions3.class, ServicePriority.Normal, "com.nijiko.permissions.ModularControl"); 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); Permission perms = new Permission_SuperPerms(this);
sm.register(Permission.class, perms, this, ServicePriority.Lowest); sm.register(Permission.class, perms, this, ServicePriority.Lowest);

View File

@ -32,155 +32,149 @@ import org.bukkit.plugin.Plugin;
public class Permission_Xperms extends Permission { public class Permission_Xperms extends Permission {
private final String name = "Xperms"; private final String name = "Xperms";
private Xmain permission = null; private Xmain perms = null;
public Permission_Xperms(Plugin plugin) { public Permission_Xperms(Plugin plugin) {
this.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"); Plugin perms = plugin.getServer().getPluginManager().getPlugin("Xperms");
if(perms != null){ if(perms != null){
if(perms.isEnabled()){ if(perms.isEnabled()){
try{ try{
if(Double.valueOf(perms.getDescription().getVersion()) < 1.1){ 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)); log.info(String.format("[%s] [Permission] %s Current version is not compatible with vault! Please Update!", plugin.getDescription().getName(), name));
} }
} catch(NumberFormatException e){ } catch(NumberFormatException e){
// version is first release, numbered 1.0.0 // 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)); log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name));
} }
} }
} }
public class PermissionServerListener implements Listener { 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; 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));
}
}
} }
@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) @EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(PluginDisableEvent event) { public void onPluginDisable(PluginDisableEvent event) {
if(permission.permission != null){ if(permission.perms != null){
if(event.getPlugin().getName().equals("Xperms")){ 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)); log.info(String.format("[%s][Permission] %s un-hooked.", plugin.getDescription().getName(), permission.name));
} }
} }
} }
} }
@Override @Override
public String getName() { public String getName() {
return name; return name;
} }
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return permission.isEnabled(); return perms.isEnabled();
} }
@Override @Override
public boolean hasSuperPermsCompat() { public boolean hasSuperPermsCompat() {
return true; return true;
} }
@Override @Override
public boolean playerHas(String world, String player, String permission) { public boolean playerHas(String world, String player, String permission) {
return permission.getXplayer().hasPermission(player, permission); return perms.getXplayer().hasPermission(player, permission);
} }
@Override @Override
public boolean playerAdd(String world, String player, String permission) { public boolean playerAdd(String world, String player, String permission) {
return permission.getXplayer().addPermission(player, permission); return perms.getXplayer().addPermission(player, permission);
} }
@Override @Override
public boolean playerRemove(String world, String player, String permission) { public boolean playerRemove(String world, String player, String permission) {
return permission.getXplayer().removePermission(player, permission); return perms.getXplayer().removePermission(player, permission);
} }
@Override @Override
public boolean groupHas(String world, String group, String permission) { public boolean groupHas(String world, String group, String permission) {
return permission.getXgroup().hasPermission(group, permission); return perms.getXgroup().hasPermission(group, permission);
} }
@Override @Override
public boolean groupAdd(String world, String group, String permission) { public boolean groupAdd(String world, String group, String permission) {
return permission.getXgroup().addPermission(group, permission); return perms.getXgroup().addPermission(group, permission);
} }
@Override @Override
public boolean groupRemove(String world, String group, String permission) { public boolean groupRemove(String world, String group, String permission) {
return permission.getXgroup().removePermission(group, permission) return perms.getXgroup().removePermission(group, permission);
} }
@Override @Override
public boolean playerInGroup(String world, String player, String group) { public boolean playerInGroup(String world, String player, String group) {
String userGroup = permission.getXusers().getUserGroup(player); String userGroup = perms.getXusers().getUserGroup(player);
if(userGroup == group){ if(userGroup == group){
return true; return true;
} }
else{ else{
return false; return false;
} }
} }
@Override @Override
public boolean playerAddGroup(String world, String player, String group) { public boolean playerAddGroup(String world, String player, String group) {
return permission.getXplayer().setGroup(player, group); return perms.getXplayer().setGroup(player, group);
} }
@Override @Override
public boolean playerRemoveGroup(String world, String player, String group) { public boolean playerRemoveGroup(String world, String player, String group) {
return permission.getXplayer().setGroup(player, "def"); return perms.getXplayer().setGroup(player, "def");
} }
@Override @Override
public String[] getPlayerGroups(String world, String player) { public String[] getPlayerGroups(String world, String player) {
ArrayList<String> playerGroup = new ArrayList<String>(); 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]); String[] playerGroupArray = playerGroup.toArray(new String[0]);
return playerGroupArray; return playerGroupArray;
} }
@Override @Override
public String getPrimaryGroup(String world, String player) { public String getPrimaryGroup(String world, String player) {
return permission.getXusers().getUserGroup(player); return perms.getXusers().getUserGroup(player);
} }
@Override @Override
public String[] getGroups() { public String[] getGroups() {
return permission.getXperms().getGroups(); return perms.getXperms().getGroups();
} }
} }