1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package com.encrox.instancedregions;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.sk89q.worldedit.BlockVector;
public class Commander implements CommandExecutor {
private Plugin plugin;
public Commander(Plugin plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
if(arg0 instanceof Player) {
Player player = (Player)arg0;
switch(arg3[0]) {
case "create":
InstancedProtectedCuboidRegion rg = new InstancedProtectedCuboidRegion(plugin, player.getWorld(), "testInstance", new BlockVector(Integer.parseInt(arg3[1]),0,Integer.parseInt(arg3[2])), new BlockVector(Integer.parseInt(arg3[3]),255,Integer.parseInt(arg3[4])));
rg.addPlayer(player);
InstancedRegions.region.add(rg);
return true;
case "dispose":
Iterator<InstancedProtectedCuboidRegion> iter = InstancedRegions.region.iterator();
while(iter.hasNext())
iter.next().dispose();
return true;
/*case "test":
InstancedRegions.region.addToChangeWhitelist(new BlockVector(Integer.parseInt(arg3[1]), Integer.parseInt(arg3[2]), Integer.parseInt(arg3[3])));
player.sendBlockChange(new Location(player.getWorld(), Integer.parseInt(arg3[1]), Integer.parseInt(arg3[2]), Integer.parseInt(arg3[3])), Material.STONE, (byte) 0);
return true;*/
}
}
return false;
}
}
|