2012-02-18 22:47:38 +00:00
|
|
|
package com.earth2me.essentials.perm;
|
|
|
|
|
|
|
|
import de.bananaco.bpermissions.api.ApiLayer;
|
|
|
|
import de.bananaco.bpermissions.api.util.CalculableType;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
|
|
|
|
public class BPermissions2Handler extends SuperpermsHandler
|
|
|
|
{
|
|
|
|
public BPermissions2Handler()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getGroup(final Player base)
|
|
|
|
{
|
|
|
|
final List<String> groups = getGroups(base);
|
|
|
|
if (groups == null || groups.isEmpty())
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return groups.get(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<String> getGroups(final Player base)
|
|
|
|
{
|
|
|
|
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
|
|
|
|
return Arrays.asList(groups);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean inGroup(final Player base, final String group)
|
|
|
|
{
|
2012-12-06 23:26:21 +00:00
|
|
|
return ApiLayer.hasGroupRecursive(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
|
2012-02-18 22:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canBuild(final Player base, final String group)
|
|
|
|
{
|
2012-08-18 20:19:00 +00:00
|
|
|
return hasPermission(base, "bPermissions.build");
|
2012-02-18 22:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getPrefix(final Player base)
|
|
|
|
{
|
|
|
|
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getSuffix(final Player base)
|
|
|
|
{
|
|
|
|
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|