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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1653 - (hide annotations) (download)
Fri Dec 9 17:06:52 2011 UTC (12 years, 5 months ago) by torben
File size: 849 byte(s)
deprecate all of the more experimental / non-survival commands
1 torben 1465 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 torben 1468 Location loc = p.getLocation();
22     World w = loc.getWorld();
23     Block b = w.getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ());
24 torben 1465
25 torben 1468 if (b.getTypeId() == 3) {
26     b.setTypeId(2);
27     } else {
28     p.sendMessage("Can only plant grass on dirt");
29     }
30 torben 1465
31    
32     return true;
33     }
34    
35     }

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.20