Group Prefix & Suffix

This commit is contained in:
Morgan 2011-08-12 12:43:41 -04:00
parent 1b810dda8a
commit bfe8259216
5 changed files with 165 additions and 0 deletions

View File

@ -836,4 +836,72 @@ public abstract class Permission {
public void setPlayerSuffix(Player player, String suffix) {
setPlayerSuffix(player.getWorld().getName(), player.getName(), suffix);
}
/**
* Get group prefix
* @param world World name
* @param group Group name
* @return Prefix
*/
abstract public String getGroupPrefix(String world, String group);
/**
* Get group prefix
* @param world World Object
* @param group Group name
* @return Prefix
*/
public String getGroupPrefix(World world, String group) {
return getGroupPrefix(world.getName(), group);
}
/**
* Set group prefix
* @param world World name
* @param group Group name
* @param prefix Prefix
*/
abstract public void setGroupPrefix(String world, String group, String prefix);
/**
* Set group prefix
* @param world World Object
* @param group Group name
* @param prefix Prefix
*/
public void setGroupPrefix(World world, String group, String prefix) {
setGroupPrefix(world.getName(), group, prefix);
}
/**
* Get group suffix
* @param world World name
* @param group Group name
* @return Suffix
*/
abstract public String getGroupSuffix(String world, String group);
/**
* Get group suffix
* @param world World Object
* @param group Group name
* @return Suffix
*/
public String getGroupSuffix(World world, String group) {
return getGroupSuffix(world.getName(), group);
}
/**
* Set group suffix
* @param world World name
* @param group Group name
* @param suffix Suffix
*/
abstract public void setGroupSuffix(String world, String group, String suffix);
/**
* Set group suffix
* @param world World Object
* @param group Group name
* @param suffix Suffix
*/
public void setGroupSuffix(World world, String group, String suffix) {
setGroupSuffix(world.getName(), group, suffix);
}
}

View File

@ -251,4 +251,24 @@ public class Permission_GroupManager extends Permission {
public void setPlayerPrefix(String world, String player, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
}

View File

@ -261,4 +261,24 @@ public class Permission_Permissions2 extends Permission {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(world, group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(world, group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
}
}

View File

@ -292,4 +292,24 @@ public class Permission_Permissions3 extends Permission {
public void setPlayerPrefix(String world, String player, String prefix) {
this.perms.addUserInfo(world, player, "prefix", prefix);
}
@Override
public String getGroupPrefix(String world, String group) {
return perms.getGroupPrefix(world, group);
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
this.perms.addGroupInfo(world, group, "prefix", prefix);
}
@Override
public String getGroupSuffix(String world, String group) {
return perms.getGroupSuffix(world, group);
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
this.perms.addGroupInfo(world, group, "suffix", suffix);
}
}

View File

@ -405,4 +405,41 @@ public class Permission_PermissionsEx extends Permission {
user.setPrefix(prefix);
}
}
@Override
public String getGroupPrefix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if(group != null) {
return pGroup.getPrefix();
} else {
return null;
}
}
@Override
public void setGroupPrefix(String world, String group, String prefix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if(group != null) {
pGroup.setPrefix(prefix);
}
}
@Override
public String getGroupSuffix(String world, String group) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if(group != null) {
return pGroup.getSuffix();
} else {
return null;
}
}
@Override
public void setGroupSuffix(String world, String group, String suffix) {
PermissionGroup pGroup = PermissionsEx.getPermissionManager().getGroup(group);
if(group != null) {
pGroup.setSuffix(suffix);
}
}
}