Example #1
0
  private void addWarning(String[] args, CommandSender sender) {

    String playerName = args[0];

    if (!databaseManager.isMCNickInMCTable(playerName)) {
      ChatUtils.writeError(sender, pluginName, "Spieler '" + playerName + "' existiert nicht!");
      return;
    }

    String text = ChatUtils.getMessage(args, " ", 1);

    if (databaseManager.addWarning(playerName, text, sender.getName())) {
      ChatUtils.writeSuccess(sender, pluginName, "Spieler '" + playerName + "' wurde verwarnt!");
      Player target = PlayerUtils.getOnlinePlayer(playerName);
      if (target != null) {
        PlayerUtils.sendMessage(
            target, ChatColor.RED, sender.getName() + " hat dich verwarnt aus folgendem Grund :");
        PlayerUtils.sendMessage(target, ChatColor.RED, text);
      }
    } else ChatUtils.writeError(sender, pluginName, "Fehler beim Verwarnen!");
  }
Example #2
0
 @Override
 public void execute(String[] args, Player player) {
   Player target = PlayerUtils.getOnlinePlayer(args[0]);
   if (target == null || !target.isOnline()) {
     TextUtils.sendError(player, "Player '" + args[0] + "' doesn't exist or is offline!");
     return;
   } else {
     recipients.put(player, target);
     recipients.put(target, player);
     String message = ChatColor.GRAY + ChatUtils.getMessage(args, " ", 1);
     player.sendMessage(ChatColor.GOLD + "[me -> " + target.getName() + "] : " + message);
     target.sendMessage(ChatColor.GOLD + "[" + player.getName() + " -> me] : " + message);
   }
 }