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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1975 - (show annotations) (download)
Mon Apr 29 19:53:34 2013 UTC (11 years ago) by torben
File size: 1021 byte(s)
trees generate correctly now
1 package dk.thoerup.bukkit.hoeruputils;
2
3 import org.bukkit.Chunk;
4 import org.bukkit.Location;
5 import org.bukkit.World;
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 RegenerateCommand implements CommandExecutor {
12
13
14 @Override
15 public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
16
17 if (!(sender instanceof Player)) {
18 return false;
19 }
20
21 Player p = (Player) sender;
22
23 if ( p.isOp() == false) {
24 p.sendMessage("Needs to be operator to use /regenerate");
25 return true;
26 }
27
28 Location loc = p.getLocation();
29 World world = loc.getWorld();
30
31 Chunk chunk = world.getChunkAt( loc );
32 int cx = chunk.getX();
33 int cz = chunk.getZ();
34
35 final int radius = 5;
36
37 for (int x= (cx+radius); x>=(cx-radius); x--) {
38 for (int z=(cz+radius); z>=(cz-radius); z--) {
39 world.regenerateChunk(x,z);
40 }
41 }
42
43 p.sendMessage("ok");
44
45 return true;
46 }
47 }

  ViewVC Help
Powered by ViewVC 1.1.20