blob: 11c17761c53bad23a3a3c628ca666f1be0e814e6 (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package com.earth2me.essentials;
import lombok.Delegate;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.IInventory;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.ServerOperator;
public class PlayerExtension implements Player
{
protected final transient IEssentials ess;
@Delegate(types =
{
Player.class, Entity.class, CommandSender.class, ServerOperator.class,
HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class,
Permissible.class
})
protected Player base;
public PlayerExtension(final Player base, final IEssentials ess)
{
this.base = base;
this.ess = ess;
}
public final Player getBase()
{
return base;
}
public final Player setBase(final Player base)
{
return this.base = base;
}
public void showInventory(final IInventory inventory)
{
getHandle().a(inventory);
}
public void showInventory(final CraftInventoryPlayer inventory)
{
showInventory((IInventory)inventory.getInventory());
}
public TargetBlock getTarget()
{
return new TargetBlock(getBase());
}
public String getGroup()
{
return ess.getPermissionsHandler().getGroup(base);
}
public boolean inGroup(final String group)
{
return ess.getPermissionsHandler().inGroup(base, group);
}
public boolean canBuild()
{
return ess.getPermissionsHandler().canBuild(base, getGroup());
}
public EntityPlayer getHandle()
{
return getCraftPlayer().getHandle();
}
public CraftPlayer getCraftPlayer()
{
return (CraftPlayer)base;
}
}
|