blob: 9fd87905ea4fe4e13f352b072b7c674a8715b287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
package com.earth2me.essentials.perm;
import com.platymuus.bukkit.permissions.Group;
import com.platymuus.bukkit.permissions.PermissionInfo;
import com.platymuus.bukkit.permissions.PermissionsPlugin;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class PermissionsBukkitHandler extends SuperpermsHandler
{
private final transient PermissionsPlugin plugin;
public PermissionsBukkitHandler(final Plugin plugin)
{
this.plugin = (PermissionsPlugin)plugin;
}
@Override
public String getGroup(final Player base)
{
final PermissionInfo info = plugin.getPlayerInfo(base.getName());
if (info == null)
{
return "default";
}
final List<Group> groups = info.getGroups();
if (groups == null || groups.isEmpty())
{
return "default";
}
return groups.get(0).getName();
}
@Override
public boolean inGroup(final Player base, final String group)
{
final PermissionInfo info = plugin.getPlayerInfo(base.getName());
if (info == null)
{
return false;
}
final List<Group> groups = info.getGroups();
if (groups == null || groups.isEmpty())
{
return false;
}
for (Group group1 : groups)
{
if (group1.getName().equalsIgnoreCase(group))
{
return true;
}
}
return false;
}
}
|