mirror of
https://github.com/MilkBowl/Vault.git
synced 2025-02-11 09:51:41 +01:00
Add transient player permissions
This commit is contained in:
parent
d783b66be0
commit
4f63ad2113
@ -127,6 +127,34 @@ public abstract class Permission {
|
|||||||
public boolean playerAdd(Player player, String permission) {
|
public boolean playerAdd(Player player, String permission) {
|
||||||
return playerAdd(player.getWorld().getName(), player.getName(), permission);
|
return playerAdd(player.getWorld().getName(), player.getName(), permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add transient permission to a player.
|
||||||
|
* @param world World name
|
||||||
|
* @param player Player name
|
||||||
|
* @param permission Permission node
|
||||||
|
* @return Success or Failure
|
||||||
|
*/
|
||||||
|
abstract public boolean playerAddTransient(String world, String player, String permission);
|
||||||
|
/**
|
||||||
|
* Add transient permission to a player.
|
||||||
|
* @param world World Object
|
||||||
|
* @param player Player name
|
||||||
|
* @param permission Permission node
|
||||||
|
* @return Success or Failure
|
||||||
|
*/
|
||||||
|
public boolean playerAddTransient(World world, String player, String permission) {
|
||||||
|
return playerAddTransient(world.getName(), player, permission);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Add transient permission to a player.
|
||||||
|
* @param player Player Object
|
||||||
|
* @param permission Permission node
|
||||||
|
* @return Success or Failure
|
||||||
|
*/
|
||||||
|
public boolean playerAddTransient(Player player, String permission) {
|
||||||
|
return playerAddTransient(player.getWorld().getName(), player.getName(), permission);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove permission from a player.
|
* Remove permission from a player.
|
||||||
|
@ -272,4 +272,9 @@ public class Permission_GroupManager extends Permission {
|
|||||||
public void setGroupSuffix(String world, String group, String suffix) {
|
public void setGroupSuffix(String world, String group, String suffix) {
|
||||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerAddTransient(String world, String player, String permission) {
|
||||||
|
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,4 +281,9 @@ public class Permission_Permissions2 extends Permission {
|
|||||||
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerAddTransient(String world, String player, String permission) {
|
||||||
|
throw new UnsupportedOperationException(getName() + " cannot modify permissions.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,11 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupPrefix(String world, String group) {
|
public String getGroupPrefix(String world, String group) {
|
||||||
return perms.getGroupPrefix(world, group);
|
try {
|
||||||
|
return perms.safeGetGroup(world, group).getPrefix();
|
||||||
|
} catch(Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -306,11 +310,25 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGroupSuffix(String world, String group) {
|
public String getGroupSuffix(String world, String group) {
|
||||||
return perms.getGroupSuffix(world, group);
|
try {
|
||||||
|
return perms.safeGetGroup(world, group).getSuffix();
|
||||||
|
} catch(Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGroupSuffix(String world, String group, String suffix) {
|
public void setGroupSuffix(String world, String group, String suffix) {
|
||||||
this.perms.addGroupInfo(world, group, "suffix", suffix);
|
this.perms.addGroupInfo(world, group, "suffix", suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerAddTransient(String world, String player, String permission) {
|
||||||
|
try {
|
||||||
|
perms.safeGetUser(world, player).addTimedPermission(permission, 0);
|
||||||
|
return true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -444,4 +444,15 @@ public class Permission_PermissionsEx extends Permission {
|
|||||||
pGroup.setSuffix(suffix);
|
pGroup.setSuffix(suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerAddTransient(String world, String player, String permission) {
|
||||||
|
PermissionUser pPlayer = PermissionsEx.getPermissionManager().getUser(player);
|
||||||
|
if (pPlayer != null) {
|
||||||
|
pPlayer.addTimedPermission(permission, world, 0);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user