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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1468 - (show annotations) (download)
Wed May 18 18:25:09 2011 UTC (13 years ago) by torben
File size: 849 byte(s)
last part of grass plugin
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.Location;
4 import org.bukkit.World;
5 import org.bukkit.block.Block;
6 import org.bukkit.command.Command;
7 import org.bukkit.command.CommandExecutor;
8 import org.bukkit.command.CommandSender;
9 import org.bukkit.entity.Player;
10
11 public class GrassCommand implements CommandExecutor {
12
13 @Override
14 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
15 if (! (sender instanceof Player)) { //what are you then ?
16 return false;
17 }
18
19 Player p = (Player) sender;
20
21 Location loc = p.getLocation();
22 World w = loc.getWorld();
23 Block b = w.getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ());
24
25 if (b.getTypeId() == 3) {
26 b.setTypeId(2);
27 } else {
28 p.sendMessage("Can only plant grass on dirt");
29 }
30
31
32 return true;
33 }
34
35 }

  ViewVC Help
Powered by ViewVC 1.1.20