コード例 #1
0
ファイル: AtpSet.java プロジェクト: EriolEandur/AutoTeleport
 @Override
 public void confirmed(Player player) {
   Location target = area.getTarget();
   boolean keepOrientation = area.isKeepOrientation();
   if (cuboid) {
     area = new CuboidTeleportationArea(center);
   } else {
     area = new SphericalTeleportationArea(center);
   }
   area.setDynamic(newDynamic);
   area.setTarget(target);
   area.setKeepOrientation(keepOrientation);
   PluginData.addTeleportationArea(areaName, area);
   saveData(player);
   sendCenterAndShapeMessage(player);
 }
コード例 #2
0
ファイル: AtpSet.java プロジェクト: EriolEandur/AutoTeleport
 @Override
 protected void execute(CommandSender cs, String... args) {
   areaName = args[0];
   area = PluginData.getTeleportationArea(args[0]);
   center = ((Player) cs).getLocation().clone();
   cuboid = true;
   if (args.length > 1) {
     if (args[1].equalsIgnoreCase("sphere")) {
       cuboid = false;
     } else if (!args[1].equalsIgnoreCase("cuboid")) {
       sentInvalidArgumentMessage(cs);
     }
   }
   if (area == null) {
     if (cuboid) {
       area = new CuboidTeleportationArea(center);
     } else {
       area = new SphericalTeleportationArea(center);
     }
     PluginData.addTeleportationArea(areaName, area);
     saveData(cs);
     sendNewAreaMessage(cs);
   } else {
     newDynamic = area.isDynamic();
     if (area.isDynamic() && !area.getTarget().getWorld().equals(((Player) cs).getWorld())) {
       newDynamic = false;
       sendDynamicToStaticMessage(cs);
     }
     boolean wasCuboid = area instanceof CuboidTeleportationArea;
     if (cuboid != wasCuboid) {
       new ConfirmationFactory(AutoTeleportPlugin.getPluginInstance())
           .start(
               (Player) cs,
               "Specified shape differs from current shape. "
                   + "You will need to define area size again. Do you want to continue?",
               this);
       return;
     }
     area.setCenter(center);
     area.setDynamic(newDynamic);
     saveData(cs);
     sendCenterSetMessage(cs);
   }
 }