mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Spawnmob sign
This commit is contained in:
parent
2530a5018f
commit
feb1c53004
2 changed files with 48 additions and 0 deletions
|
@ -0,0 +1,47 @@
|
|||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.commands.Commandspawnmob;
|
||||
|
||||
|
||||
public class SignSpawnmob extends EssentialsSign
|
||||
{
|
||||
|
||||
public SignSpawnmob()
|
||||
{
|
||||
super("Spawnmob");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSignCreate(ISign sign, User player, String username, IEssentials ess) throws SignException, ChargeException
|
||||
{
|
||||
validateInteger(sign, 1);
|
||||
validateTrade(sign, 3, ess);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSignInteract(ISign sign, User player, String username, IEssentials ess) throws SignException, ChargeException
|
||||
{
|
||||
final Trade charge = getTrade(sign, 3, ess);
|
||||
charge.isAffordableFor(player);
|
||||
Commandspawnmob command = new Commandspawnmob();
|
||||
command.setEssentials(ess);
|
||||
String[] args = new String[] {
|
||||
sign.getLine(2), sign.getLine(1)
|
||||
};
|
||||
try
|
||||
{
|
||||
command.run(ess.getServer(), player, "spawnmob", args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new SignException(ex.getMessage(), ex);
|
||||
}
|
||||
charge.charge(player);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ public enum Signs
|
|||
MAIL(new SignMail()),
|
||||
PROTECTION(new SignProtection()),
|
||||
SELL(new SignSell()),
|
||||
SPAWNMOB(new SignSpawnmob()),
|
||||
TIME(new SignTime()),
|
||||
TRADE(new SignTrade()),
|
||||
WARP(new SignWarp()),
|
||||
|
|
Loading…
Reference in a new issue