Example #1
0
 public void execute(Player player, String message) {
   String name = extractArgument(message);
   if (name == null) {
     player.setAttemptedAction(Action.Unlock);
     player.addMessage("\u00a77The next chest you open will get unlocked.");
   } else {
     List<Chest> chests = player.getServer().chests.getChestsByName(name);
     for (Chest chest : chests) {
       chest.unlock();
     }
     player.getServer().chests.save();
     if (chests.size() > 1) {
       player.addMessage("\u00a77" + chests.size() + " chests have been unlocked!");
     } else {
       player.addMessage("\u00a77The chest has been unlocked!");
     }
   }
 }
  @Override
  protected void executeWithTarget(Player player, String message, Player target) {
    target.teleportTo(player);

    player
        .getServer()
        .adminLog(
            "Admin "
                + player.getName()
                + " teleported:\t "
                + target.getName()
                + "\tto\t"
                + player.getName());
  }