/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/SpawnCommand.java
ViewVC logotype

Contents of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/SpawnCommand.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3201 - (show annotations) (download)
Wed May 31 08:56:00 2017 UTC (6 years, 11 months ago) by torben
File size: 712 byte(s)
Code cleanup(still doesn't compile)
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.Location;
4 import org.bukkit.command.Command;
5 import org.bukkit.command.CommandExecutor;
6 import org.bukkit.command.CommandSender;
7 import org.bukkit.entity.Player;
8
9 public class SpawnCommand implements CommandExecutor {
10
11 @Override
12 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
13
14 if (!(sender instanceof Player)) { // it's not a console command
15 return false;
16 }
17
18 Player p = (Player) sender;
19 Location spawn = p.getLocation().getWorld().getSpawnLocation();
20 int clearY = spawn.getWorld().getHighestBlockYAt( spawn );
21 spawn.setY( clearY );
22
23
24 p.teleport( spawn );
25
26 return true;
27 }
28 }

  ViewVC Help
Powered by ViewVC 1.1.20