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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1592 - (hide annotations) (download)
Wed Aug 24 18:45:40 2011 UTC (12 years, 9 months ago) by torben
File size: 1235 byte(s)
Added my own home implementation and a command to control weather
1 torben 1592 package dk.thoerup.bukkit.hoeruputils;
2    
3     import org.bukkit.Location;
4     import org.bukkit.World;
5     import org.bukkit.command.Command;
6     import org.bukkit.command.CommandExecutor;
7     import org.bukkit.command.CommandSender;
8     import org.bukkit.entity.Player;
9    
10     public class WeatherCommand implements CommandExecutor {
11    
12    
13     @Override
14     public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
15    
16     if (!(sender instanceof Player)) {
17     return false;
18     }
19    
20     Player p = (Player) sender;
21    
22     if (args.length != 1 || !( args[0].equals("clear") || args[0].equals("rain") || args[0].equals("thunder") ) ) {
23     p.sendMessage("Usage /weather <clear|rain|thunder>");
24     return true;
25     }
26    
27     World w = p.getWorld();
28     if ( args[0].equals("clear") ) {
29     w.setThundering( false );
30     w.setStorm( false );
31     p.getServer().broadcastMessage("A nice blue sky appears");
32     } else if (args[0].equals("rain") ) {
33     w.setStorm( true );
34     w.setThundering( false );
35     p.getServer().broadcastMessage("Dark clouds are gathering");
36     } else if (args[0].equals("thunder") ) {
37     w.setStorm( true );
38     w.setThundering( true );
39     p.getServer().broadcastMessage("looks like a thunderstorm is comming");
40     }
41    
42    
43     return true;
44     }
45     }

  ViewVC Help
Powered by ViewVC 1.1.20