Ejemplo n.º 1
0
 public PointCommand(MyWarp plugin) {
   super("Point");
   this.plugin = plugin;
   setDescription(LanguageManager.getString("help.description.point"));
   setUsage("<" + LanguageManager.getColorlessString("help.usage.name") + ">");
   setArgumentRange(1, 255);
   setIdentifiers("point");
   setPermission("mywarp.warp.basic.compass");
   setPlayerOnly(true);
 }
Ejemplo n.º 2
0
  @Override
  public void execute(CommandSender sender, String identifier, String[] args)
      throws CommandException {
    Warp warp = CommandUtils.getWarpForUsage(sender, CommandUtils.toWarpName(args));

    plugin.getWarpList().point(warp, (Player) sender);
    sender.sendMessage(LanguageManager.getEffectiveString("warp.point", "%warp%", warp.name));
  }
Ejemplo n.º 3
0
 /**
  * Teleports the player to the given location if it is safe. If not, it searches the closest safe
  * location and teleports the player there.
  *
  * @param player the player
  * @param l the location
  * @param name the name of the warp
  * @return True if the player could be teleported to the given location
  */
 public static boolean safeTeleport(Player player, Location l, String name) {
   // warp height is always the block's Y so we may need to adjust the
   // height for blocks that are smaller than one full block (steps,
   // skulls...)
   if (isNotFullHeight(l.getBlock().getType())) {
     l.add(0, 1, 0);
   }
   if (WarpSettings.useWarpSafety) {
     Location safe = SafeLocation.getSafeLocation(l);
     if (safe == null) {
       player.sendMessage(LanguageManager.getEffectiveString("safety.notFound", "%warp%", name));
       return false;
     }
     if (safe != l) {
       teleport(player, safe);
       player.sendMessage(LanguageManager.getEffectiveString("safety.found", "%warp%", name));
       return false;
     }
   }
   teleport(player, l);
   return true;
 }