2011-03-19 23:39:51 +01:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.User;
|
2011-11-18 18:42:26 +01:00
|
|
|
import org.bukkit.Server;
|
2011-03-19 23:39:51 +01:00
|
|
|
|
2015-04-15 06:06:16 +02:00
|
|
|
public class Commanddepth extends EssentialsCommand {
|
|
|
|
public Commanddepth() {
|
|
|
|
super("depth");
|
|
|
|
}
|
2011-03-19 23:39:51 +01:00
|
|
|
|
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 {
|
2020-05-13 06:05:57 +02:00
|
|
|
final int depth = user.getLocation().getBlockY() - user.getWorld().getSeaLevel();
|
2015-04-15 06:06:16 +02:00
|
|
|
if (depth > 0) {
|
2024-02-03 21:38:14 +01:00
|
|
|
user.sendTl("depthAboveSea", depth);
|
2015-04-15 06:06:16 +02:00
|
|
|
} else if (depth < 0) {
|
2024-02-03 21:38:14 +01:00
|
|
|
user.sendTl("depthBelowSea", -depth);
|
2015-04-15 06:06:16 +02:00
|
|
|
} else {
|
2024-02-03 21:38:14 +01:00
|
|
|
user.sendTl("depth");
|
2015-04-15 06:06:16 +02:00
|
|
|
}
|
|
|
|
}
|
2011-03-19 23:39:51 +01:00
|
|
|
}
|