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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1518 - (show annotations) (download)
Wed Jun 15 18:24:59 2011 UTC (12 years, 11 months ago) by torben
File size: 1243 byte(s)
things that makes you go 'boom'
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.ChatColor;
4 import org.bukkit.Location;
5 import org.bukkit.Server;
6 import org.bukkit.World;
7 import org.bukkit.command.Command;
8 import org.bukkit.command.CommandExecutor;
9 import org.bukkit.command.CommandSender;
10 import org.bukkit.entity.Player;
11 import org.bukkit.plugin.Plugin;
12
13 public class BoomCommand implements CommandExecutor {
14
15 Plugin plugin;
16
17 public BoomCommand(Plugin plugin) {
18 this.plugin = plugin;
19 }
20
21
22 @Override
23 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
24
25 if (!(sender instanceof Player)) {
26 return false;
27 }
28 Player p = (Player) sender;
29
30 if (!p.isOp() ) {
31 p.sendMessage("Only ops can make it go boom");
32 return true;
33 }
34
35 final Server server = sender.getServer();
36
37 final World w = p.getWorld();
38 final Location l = p.getLocation();
39
40 Runnable r = new Runnable() {
41 @Override
42 public void run() {
43 w.createExplosion(l, 16.0f);
44 server.broadcastMessage( ChatColor.YELLOW + "BOOOM!!!" );
45 }
46 };
47
48 server.getScheduler().scheduleSyncDelayedTask(plugin, r, 15*20);
49
50 server.broadcastMessage( ChatColor.YELLOW + "Run Forrest!! Things are about to go boom" );
51
52 return true;
53 }
54 }

  ViewVC Help
Powered by ViewVC 1.1.20