2011-06-08 01:18:33 +00:00
|
|
|
package com.earth2me.essentials.signs;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.IEssentials;
|
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
import net.minecraft.server.InventoryPlayer;
|
|
|
|
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
|
|
|
|
public class SignFree extends EssentialsSign
|
|
|
|
{
|
|
|
|
public SignFree()
|
|
|
|
{
|
|
|
|
super("Free");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
|
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
getItemStack(sign.getLine(1), 9 * 4 * 64, ess);
|
2011-06-08 01:18:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
|
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
final ItemStack item = getItemStack(sign.getLine(1), 9 * 4 * 64, ess);
|
2011-06-08 01:18:33 +00:00
|
|
|
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new InventoryPlayer(player.getHandle()));
|
|
|
|
inv.clear();
|
|
|
|
inv.addItem(item);
|
|
|
|
player.showInventory(inv);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|