예제 #1
0
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (sender instanceof Player && !Perm.hasPermission((Player) sender, "dc.delworld")) {
     return V.return_;
   }
   if (args.length == 1
       || args.length == 2
           && (args[1].equalsIgnoreCase("delete") || args[1].equalsIgnoreCase("remove"))) {
     if (Misc.getConfig(args[0]) != null) {
       Misc.removeWorld(
           args[0],
           !(args.length == 2
               && (args[1].equalsIgnoreCase("delete") || args[1].equalsIgnoreCase("remove"))));
       Misc.sendMessage(
           sender,
           Misc.getColoredString("c_delworld")
               .replace("<player>", Misc.getSenderName(sender))
               .replace("<world>", args[0]));
       L.log(
           Misc.getColoredString("c_delworld")
               .replace("<player>", Misc.getSenderName(sender))
               .replace("<world>", args[0]));
       return true;
     } else {
       Misc.sendString(sender, "invalid_world");
     }
   }
   return false;
 }
  @Override
  public void onVehicleMove(VehicleMoveEvent event) {
    if (event.getVehicle().getPassenger() != null
        && event.getVehicle().getPassenger() instanceof Player) {
      if (event.getFrom().getBlock() != event.getTo().getBlock()) {
        DCPortal dcportal = Misc.getPortal(event.getTo());

        if (dcportal != null
            && dcportal.getTarget((Player) event.getVehicle().getPassenger()) != null) {
          event
              .getVehicle()
              .teleport(dcportal.getTarget((Player) event.getVehicle().getPassenger()));
        }
      }
    }
  }