use of com.sk89q.worldedit.bukkit.selections.Polygonal2DSelection in project MyMaid2 by jaoafa.
the class Cmd_Protector method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
SendMessage(sender, cmd, "このコマンドはプレイヤーからのみ実行できます。");
return true;
}
Player player = (Player) sender;
WorldGuardPlugin wg = MyMaid2.getWorldGuard();
WorldEditPlugin we = MyMaid2.getWorldEdit();
Location loc = player.getLocation();
Vector v = new Vector(loc.getX(), loc.getY(), loc.getZ());
RegionManager rm = wg.getRegionManager(player.getWorld());
List<String> regionlist = rm.getApplicableRegionsIDs(v);
if (regionlist.size() == 0) {
SendMessage(sender, cmd, "この場所は登録されていません。");
return true;
}
String last_ID = regionlist.get(0);
ProtectedRegion region = rm.getRegion(last_ID);
Polygonal2DSelection selection = new Polygonal2DSelection(player.getWorld(), region.getPoints(), region.getMinimumPoint().getBlockY(), region.getMaximumPoint().getBlockY());
we.setSelection(player, selection);
SendMessage(sender, cmd, "リージョン「" + last_ID + "」の範囲をWorldEditにセットしました。");
SendMessage(sender, cmd, "WorldEditCUI等で確認してください。");
return true;
}
Aggregations