mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-20 15:35:08 +00:00

We now first test, if the user could pay it, do the stuff and then charge him. If the command throws an exception, the user will not be charged.
26 lines
777 B
Java
26 lines
777 B
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.Trade;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Server;
|
|
import com.earth2me.essentials.User;
|
|
import com.earth2me.essentials.Util;
|
|
|
|
|
|
public class Commandtop extends EssentialsCommand
|
|
{
|
|
public Commandtop()
|
|
{
|
|
super("top");
|
|
}
|
|
|
|
@Override
|
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
|
{
|
|
int topX = user.getLocation().getBlockX();
|
|
int topZ = user.getLocation().getBlockZ();
|
|
int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
|
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
|
|
user.sendMessage(Util.i18n("teleportTop"));
|
|
}
|
|
}
|