Essentials/Essentials/src/main/java/com/earth2me/essentials/commands/Commanddepth.java

23 lines
674 B
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
2011-11-18 18:42:26 +01:00
import org.bukkit.Server;
2015-04-15 06:06:16 +02:00
public class Commanddepth extends EssentialsCommand {
public Commanddepth() {
super("depth");
}
2015-04-15 06:06:16 +02:00
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
final int depth = user.getLocation().getBlockY() - user.getWorld().getSeaLevel();
2015-04-15 06:06:16 +02:00
if (depth > 0) {
user.sendTl("depthAboveSea", depth);
2015-04-15 06:06:16 +02:00
} else if (depth < 0) {
user.sendTl("depthBelowSea", -depth);
2015-04-15 06:06:16 +02:00
} else {
user.sendTl("depth");
2015-04-15 06:06:16 +02:00
}
}
}