Exemplo n.º 1
0
  @Override
  public void run(CommandSender sender, String[] args) {
    Player player = null;
    boolean self;
    if (args.length > 1) {
      Util.Message("Usage: /lim notify [<player>]", sender);
    }

    if (args.length == 0) {
      if (sender instanceof Player) {
        player = (Player) sender;
        self = true;
      } else {
        Util.Message("You have to execute /lim notify as player!", sender);
        return;
      }
    } else {
      player = LimboPlugin.instance.getServer().getPlayer(args[0]);
      self = false;
    }

    if (player == null) {
      Util.Message("Could not find player called " + args[0], sender);
      return;
    }

    if (self == false
        && sender instanceof Player
        && ((Player) sender).getUniqueId().equals(player.getUniqueId())) {
      self = true;
    }

    switch (LimboManager.getPrisonerStatus(player)) {
      case DURING:
        Prisoner prisoner = Prisoners.getPrisoner(player);

        prisoner.notify = !prisoner.notify;
        Prisoners.save(prisoner);

        if (prisoner.notify) {
          Util.Message(Settings.MESSAGE_NOTIFICATION_ON.string(), sender);
          if (self == false) {
            Util.Message(Settings.MESSAGE_NOTIFICATION_ON.string(), player);
          }
        } else {
          Util.Message(Settings.MESSAGE_NOTIFICATION_OFF.string(), sender);
          if (self == false) {
            Util.Message(Settings.MESSAGE_NOTIFICATION_ON.string(), player);
          }
        }
        break;
      case AFTER:
        Util.Message(Settings.MESSAGE_NOTIFICATION_CANT_USE.string(), sender);
        break;
      case OUTSIDE:
        Util.Message(Settings.MESSAGE_NOTIFICATION_CANT_USE.string(), sender);
        break;
    }
  }
Exemplo n.º 2
0
 public static void Broadcast(String message, String exclusion) {
   for (Player p : Bukkit.getOnlinePlayers()) {
     if (!p.getName().equals(exclusion)) Util.Message(message, p);
   }
 }
Exemplo n.º 3
0
 public static void Multicast(String message, List<Player> players) {
   for (Player p : players) {
     Util.Message(message, p);
   }
 }
Exemplo n.º 4
0
 public static void Broadcast(String message) {
   for (Player p : Bukkit.getOnlinePlayers()) {
     Util.Message(message, p);
   }
 }