@Override
 public void onPlayerCommand(PlayerChatEvent event) {
   String[] split = event.getMessage().split(" ");
   Player player = event.getPlayer();
   if (split[0].equalsIgnoreCase(debugCommand)) {
     addDebugee(player);
     event.setCancelled(true);
   } else if (split[0].equalsIgnoreCase(undebugCommand)) {
     removeDebugee(player);
     event.setCancelled(true);
   }
 }
  @Override
  public void onPlayerChat(final PlayerChatEvent event) {
    if (isAborted(event)) {
      return;
    }

    /**
     * This file should handle detection of the local chat features... if local chat is enabled, we
     * need to handle it here
     */
    final User user = ess.getUser(event.getPlayer());
    final String chatType = getChatType(event.getMessage());
    long radius = ess.getSettings().getChatRadius();
    if (radius < 1) {
      return;
    }
    radius *= radius;
    try {
      if (event.getMessage().length() > 0 && chatType.length() > 0) {
        StringBuilder permission = new StringBuilder();
        permission.append("essentials.chat.").append(chatType);

        StringBuilder command = new StringBuilder();
        command.append("chat-").append(chatType);

        StringBuilder format = new StringBuilder();
        format.append(chatType).append("Format");

        StringBuilder errorMsg = new StringBuilder();
        errorMsg
            .append("notAllowedTo")
            .append(chatType.substring(0, 1).toUpperCase())
            .append(chatType.substring(1));

        if (user.isAuthorized(permission.toString())) {
          charge(user, command.toString());
          event.setMessage(event.getMessage().substring(1));
          event.setFormat(Util.format(format.toString(), event.getFormat()));
          return;
        }

        user.sendMessage(Util.i18n(errorMsg.toString()));
        event.setCancelled(true);
        return;
      }
    } catch (ChargeException ex) {
      ess.showError(user, ex, "Shout");
      event.setCancelled(true);
      return;
    }
    sendLocalChat(user, radius, event);
  }
 @EventHandler
 public void HeMan(PlayerChatEvent e) {
   if (e.isCancelled()) return;
   if (!e.getMessage().matches("(?i)by the power of gr[a|e]yskull!?")) return;
   Player p = e.getPlayer();
   if (!plugin.isAuthorized(p, "rcmds.heman")) return;
   ItemStack is = p.getItemInHand();
   if (is.getType() != Material.DIAMOND_SWORD) return;
   if (is.getEnchantments().isEmpty()) return;
   e.setCancelled(true);
   p.getWorld().strikeLightningEffect(p.getLocation());
   Matcher m = Pattern.compile("(?i)by the power of gr[a|e]yskull!?").matcher(e.getMessage());
   StringBuilder sb = new StringBuilder();
   int last = 0;
   while (m.find()) {
     sb.append(e.getMessage().substring(last, m.start()));
     sb.append(m.group(0).toUpperCase());
     last = m.end();
   }
   sb.append(e.getMessage().substring(last));
   plugin
       .getServer()
       .broadcastMessage(
           e.getFormat().replaceAll("(?i)by the power of gr[a|e]yskull!?", sb.toString()));
   e.setFormat("");
   List<PotionEffect> effects = new ArrayList<PotionEffect>();
   effects.add(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1200, 2));
   effects.add(new PotionEffect(PotionEffectType.REGENERATION, 1200, 2));
   effects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1200, 2));
   effects.add(new PotionEffect(PotionEffectType.SPEED, 1200, 2));
   p.addPotionEffects(effects);
 }
Example #4
0
  @EventHandler
  public void syncChatTrigger(final PlayerChatEvent event) {
    if (event.isCancelled()) return;

    // Return if "Use asynchronous event" is true in config file
    if (Settings.ChatAsynchronous()) return;

    Boolean cancelled = process(event.getPlayer(), event.getMessage());
    event.setCancelled(cancelled);
  }
  @Override
  public void onPlayerCommand(PlayerChatEvent event) {
    String[] split = event.getMessage().split(" ");
    Player player = event.getPlayer();
    String command = split[0];

    if ((!event.isCancelled()) && command.equalsIgnoreCase("/" + DailyBibleVerse.command)) {
      plugin.displayVOTD(player);
      event.setCancelled(true);
    }
  }
Example #6
0
 public void onPlayerChat(PlayerChatEvent event) {
   Player p = event.getPlayer();
   Builder fb = plugin.getBattlefieldManager().getBuilder(p);
   if (fb == null) return;
   if (fb.getTool() != null) {
     Tool tool = fb.getTool();
     if (tool == null) return;
     if (tool.isAwaitingText()) {
       tool.retrieveText(event.getMessage());
       event.setCancelled(true);
     }
   }
 }
 public void onPlayerChat(PlayerChatEvent event) {
   Player player = event.getPlayer();
   PlayerProfile PP = Users.getProfile(player);
   String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
   String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
   if (Config.getInstance().isPartyToggled(player.getName())) {
     event.setCancelled(true);
     log.log(
         Level.INFO,
         "[P](" + PP.getParty() + ")" + "<" + player.getName() + "> " + event.getMessage());
     for (Player herp : plugin.getServer().getOnlinePlayers()) {
       if (Users.getProfile(herp).inParty()) {
         if (Party.getInstance().inSameParty(herp, player)) {
           herp.sendMessage(x + event.getMessage());
         }
       }
     }
     return;
   }
   if ((player.isOp() || mcPermissions.getInstance().adminChat(player))
       && Config.getInstance().isAdminToggled(player.getName())) {
     log.log(Level.INFO, "[A]" + "<" + player.getName() + "> " + event.getMessage());
     event.setCancelled(true);
     for (Player herp : plugin.getServer().getOnlinePlayers()) {
       if ((herp.isOp() || mcPermissions.getInstance().adminChat(herp))) {
         herp.sendMessage(y + event.getMessage());
       }
     }
     return;
   }
   /*
    * Remove from normal chat if toggled
   for(Player z : event.getRecipients()){
   	if(Users.getProfile(z.getName()).getPartyChatOnlyToggle() == true)
   		event.getRecipients().remove(z);
   }
   */
 }
 @Override
 public void onPlayerChat(final PlayerChatEvent event) {
   final User user = ess.getUser(event.getPlayer());
   if (user.isMuted()) {
     event.setCancelled(true);
     user.sendMessage(Util.i18n("playerMuted"));
     LOGGER.info(Util.format("mutedUserSpeaks", user.getName()));
   }
   final Iterator<Player> it = event.getRecipients().iterator();
   while (it.hasNext()) {
     final User u = ess.getUser(it.next());
     if (u.isIgnoredPlayer(user.getName())) {
       it.remove();
     }
   }
   user.updateActivity(true);
   if (ess.getSettings().changeDisplayName()) {
     user.setDisplayName(user.getNick());
   }
 }
Example #9
0
  @EventHandler(event = PlayerChatEvent.class)
  public void onPlayerChat(PlayerChatEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Matcher matcher = cuipattern.matcher(event.getMessage());
    if (matcher.find()) {
      String type = matcher.group(1);
      String args = matcher.group(2);

      if (type.equals("v")) {
        try {
          plugin.getSession(event.getPlayer()).setCUIVersion(Integer.parseInt(args));
          event.setCancelled(true);
        } catch (NumberFormatException e) {
        }
      }
    }
  }
 @EventHandler(priority = EventPriority.LOW)
 public void onPlayerChat(PlayerChatEvent event) {
   if (event.isCancelled()) return;
   if (AFKUtils.isAfk(event.getPlayer())) {
     AFKUtils.unsetAfk(event.getPlayer());
     plugin.getServer().broadcastMessage(event.getPlayer().getName() + " is no longer AFK.");
   }
   if (PConfManager.getPValBoolean(event.getPlayer(), "muted")) {
     if (PConfManager.getPVal(event.getPlayer(), "mutetime") != null
         && !RUtils.isTimeStampValid(event.getPlayer(), "mutetime"))
       PConfManager.setPValBoolean(event.getPlayer(), false, "muted");
     event.setFormat("");
     event.setCancelled(true);
     event.getPlayer().sendMessage(ChatColor.RED + "You are muted.");
     plugin.log.info(
         "[RoyalCommands] "
             + event.getPlayer().getName()
             + " tried to speak, but has been muted.");
   }
 }
Example #11
0
  public void onPlayerChat(PlayerChatEvent event) {
    for (myPlayer player : parent.universe.players.values()) {
      if (player.player == event.getPlayer()) {
        if (player.target != null) {

          // System.out.println("npcx : player chat event ("+ player.player.getName()+")");
          player.player.sendMessage(
              "You say to " + player.target.getName() + ", '" + event.getMessage() + "'");

          if (player.target.parent != null) {
            // this is not a temporary spawn

            // does it have a category set?
            if (player.target.parent.category != null) {

              // check what type of category it is
              if (player.target.parent.category.matches("merchant")) {
                // merchant
                player.target.parent.onPlayerChat(player, event.getMessage(), "merchant");

              } else {
                // normal chat event / unknown category
                player.target.parent.onPlayerChat(player, event.getMessage(), "");
              }
            } else {
              // normal chat event
              player.target.parent.onPlayerChat(player, event.getMessage(), "");
            }
          } else {
            player.player.sendMessage("You cannot talk to temporary spawns");
          }
          event.setCancelled(true);
        }
      }
    }
  }
  @Override
  public void onPlayerChat(PlayerChatEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Player talkingPlayer = event.getPlayer();
    String msg = event.getMessage();

    // ... it was not a command. This means that it is a chat message!
    FPlayer me = FPlayer.get(talkingPlayer);

    // Are we to insert the Faction tag into the format?
    // If we are not to insert it - we are done.
    if (!Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) {
      return;
    }

    int InsertIndex = 0;
    String eventFormat = event.getFormat();

    if (!Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) {
      // we're using the "replace" method of inserting the faction tags
      // if they stuck "{FACTION_TITLE}" in there, go ahead and do it too
      if (eventFormat.contains("{FACTION_TITLE}")) {
        eventFormat = eventFormat.replace("{FACTION_TITLE}", me.getTitle());
      }
      InsertIndex = eventFormat.indexOf(Conf.chatTagReplaceString);
      eventFormat = eventFormat.replace(Conf.chatTagReplaceString, "");
      Conf.chatTagPadAfter = false;
      Conf.chatTagPadBefore = false;
    } else if (!Conf.chatTagInsertAfterString.isEmpty()
        && eventFormat.contains(Conf.chatTagInsertAfterString)) {
      // we're using the "insert after string" method
      InsertIndex =
          eventFormat.indexOf(Conf.chatTagInsertAfterString)
              + Conf.chatTagInsertAfterString.length();
    } else if (!Conf.chatTagInsertBeforeString.isEmpty()
        && eventFormat.contains(Conf.chatTagInsertBeforeString)) {
      // we're using the "insert before string" method
      InsertIndex = eventFormat.indexOf(Conf.chatTagInsertBeforeString);
    } else {
      // we'll fall back to using the index place method
      InsertIndex = Conf.chatTagInsertIndex;
      if (InsertIndex > eventFormat.length()) return;
    }

    String formatStart =
        eventFormat.substring(0, InsertIndex)
            + ((Conf.chatTagPadBefore && !me.getChatTag().isEmpty()) ? " " : "");
    String formatEnd =
        ((Conf.chatTagPadAfter && !me.getChatTag().isEmpty()) ? " " : "")
            + eventFormat.substring(InsertIndex);

    String nonColoredMsgFormat = formatStart + me.getChatTag().trim() + formatEnd;

    // Relation Colored?
    if (Conf.chatTagRelationColored) {
      // We must choke the standard message and send out individual messages to all players
      // Why? Because the relations will differ.
      event.setCancelled(true);

      for (Player listeningPlayer : event.getRecipients()) {
        FPlayer you = FPlayer.get(listeningPlayer);
        String yourFormat = formatStart + me.getChatTag(you).trim() + formatEnd;
        try {
          listeningPlayer.sendMessage(
              String.format(yourFormat, talkingPlayer.getDisplayName(), msg));
        } catch (UnknownFormatConversionException ex) {
          Factions.log(
              Level.SEVERE,
              "Critical error in chat message formatting! Complete format string: " + yourFormat);
          Factions.log(Level.SEVERE, "First half of event.getFormat() string: " + formatStart);
          Factions.log(Level.SEVERE, "Second half of event.getFormat() string: " + formatEnd);
          Factions.log(
              Level.SEVERE,
              "NOTE: To fix this quickly, running this command should work: f config chatTagInsertIndex 0");
          Factions.log(
              Level.SEVERE,
              "For a more proper fix, please read the chat configuration notes on the configuration page of the Factions user guide.");
          ex.printStackTrace();
          return;
        }
      }

      // Write to the log... We will write the non colored message.
      String nonColoredMsg =
          ChatColor.stripColor(
              String.format(nonColoredMsgFormat, talkingPlayer.getDisplayName(), msg));
      Logger.getLogger("Minecraft").info(nonColoredMsg);
    } else {
      // No relation color.
      event.setFormat(nonColoredMsgFormat);
    }
  }
 @Override
 public void onPlayerChat(PlayerChatEvent event) {
   if (ChatManager.handleMessage(event.getPlayer(), event.getMessage())) event.setCancelled(true);
 }
Example #14
0
  /**
   * Monitor PlayerChat events.
   *
   * @param event The event to watch
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onPlayerChat(PlayerChatEvent event) {
    Player player = event.getPlayer();
    PlayerProfile profile = Users.getProfile(player);

    if (profile == null) {
      return;
    }

    if (profile.getPartyChatMode()) {
      Party party = profile.getParty();

      if (party == null) {
        player.sendMessage(
            "You're not in a party, type /p to leave party chat mode."); // TODO: Use mcLocale
        return;
      }

      String partyName = party.getName();
      String playerName = player.getName();
      McMMOPartyChatEvent chatEvent =
          new McMMOPartyChatEvent(playerName, partyName, event.getMessage());
      plugin.getServer().getPluginManager().callEvent(chatEvent);

      if (chatEvent.isCancelled()) {
        return;
      }

      String prefix = ChatColor.GREEN + "(" + ChatColor.WHITE + playerName + ChatColor.GREEN + ") ";

      plugin
          .getLogger()
          .info("[P](" + partyName + ")" + "<" + playerName + "> " + chatEvent.getMessage());

      for (Player member : party.getOnlineMembers()) {
        member.sendMessage(prefix + chatEvent.getMessage());
      }

      event.setCancelled(true);
    } else if (profile.getAdminChatMode()) {
      String playerName = player.getName();
      McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(playerName, event.getMessage());
      plugin.getServer().getPluginManager().callEvent(chatEvent);

      if (chatEvent.isCancelled()) {
        return;
      }

      String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + playerName + ChatColor.AQUA + "} ";

      plugin.getLogger().info("[A]<" + playerName + "> " + chatEvent.getMessage());

      for (Player otherPlayer : plugin.getServer().getOnlinePlayers()) {
        if (Permissions.getInstance().adminChat(otherPlayer) || otherPlayer.isOp()) {
          otherPlayer.sendMessage(prefix + chatEvent.getMessage());
        }
      }

      event.setCancelled(true);
    }
  }
 private void IsSilent(String[] components, PlayerChatEvent ev2, int i) {
   int l = components.length;
   if (l < 2) return;
   if ((components[(l - 2)].equalsIgnoreCase("augere"))
       && (components[(l - 1)].equalsIgnoreCase("silentium"))) ev2.setCancelled(true);
 }
  public void CastSpell(String[] components, PlayerChatEvent ev) {
    this.config = Vicincantatio.config;
    this.components = components;
    this.ev = ev;
    this.n = 0;
    this.size = 2;
    this.book_augment = false;

    String spellName = "";
    Spell toCast = null;
    Material material = null;
    Map augments = new HashMap();

    for (int i = 0; i < components.length; i++) {
      components[i] = components[i].toLowerCase();
    }
    for (int i = 0; i < components.length; i++) {
      if ((spellName.equals("")) || (spellName.equals("bulla"))) {
        String foundSpell = "";

        if (Spell.GetSpell(components[i]) != null) foundSpell = components[i];
        if (i < components.length - 1) {
          String twoWords = components[i] + " " + components[(i + 1)];
          if (Spell.GetSpell(twoWords) != null) {
            foundSpell = twoWords;
            i++;
          }
        }

        if (!foundSpell.equals("")) {
          if (spellName.equals("bulla")) augments.put("bubble", Boolean.valueOf(true));
          spellName = foundSpell;
          toCast = Spell.GetSpell(spellName);
          Vicincantatio.log.info("Spell name: " + spellName);
          continue;
        }
      }

      if (this.size == 2) {
        if (Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")) {
          PermissionManager permissions = PermissionsEx.getPermissionManager();

          if ((components[i].equalsIgnoreCase("ultima"))
              && (Vicincantatio.config.getBoolean("world_maiming" + "_enabled", true))) {
            if (permissions.has(ev.getPlayer(), "ultima.allow")) {
              this.size = 9;
            } else {
              Vicincantatio.log.info("Ultima size not allowed!");
              toCast = null;
            }
          } else if ((components[i].equalsIgnoreCase("supera"))
              && (Vicincantatio.config.getBoolean("world_maiming" + "_enabled", true))) {
            if (permissions.has(ev.getPlayer(), "supera.allow")) {
              this.size = 6;
            } else {
              Vicincantatio.log.info("Supera size not allowed!");
              toCast = null;
            }
          } else if (components[i].equalsIgnoreCase("magna")) this.size = 4;
          else if (components[i].equalsIgnoreCase("parva")) this.size = 1;
          else if (components[i].equalsIgnoreCase("infera")) {
            this.size = 0;
          }
          if (this.size != 2) {
            continue;
          }

        } else {
          if ((components[i].equalsIgnoreCase("ultima"))
              && (Vicincantatio.config.getBoolean("world_maiming" + "_enabled", true)))
            this.size = 9;
          else if ((components[i].equalsIgnoreCase("supera"))
              && (Vicincantatio.config.getBoolean("world_maiming" + "_enabled", true)))
            this.size = 6;
          else if (components[i].equalsIgnoreCase("magna")) this.size = 4;
          else if (components[i].equalsIgnoreCase("parva")) this.size = 1;
          else if (components[i].equalsIgnoreCase("infera")) {
            this.size = 0;
          }
          if (this.size != 2) {
            continue;
          }
        }
      }

      if (material == null) {
        if (Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")) {
          PermissionManager permissions = PermissionsEx.getPermissionManager();
          if (listOfMaterials.containsKey(components[i])) {
            if (permissions.has(ev.getPlayer(), components[i] + ".allow")) {
              material = (Material) listOfMaterials.get(components[i]);
              Vicincantatio.log.info("Material: " + components[i]);
              continue;
            }

            Vicincantatio.log.info("Material not allowed.");
            ev.getPlayer().sendMessage("Sorry, you don't have the permissions for that material");
          }

        } else if (listOfMaterials.containsKey(components[i])) {
          material = (Material) listOfMaterials.get(components[i]);
          Vicincantatio.log.info("Material: " + components[i]);
          continue;
        }
      }

      if ((components[i].equalsIgnoreCase("augere")) && (i + 1 < components.length)) {
        if (components[(i + 1)].equalsIgnoreCase("vi")) {
          augments.put("force", Boolean.valueOf(true));
        } else if (components[(i + 1)].equalsIgnoreCase("volo")) {
          augments.put("flight", Boolean.valueOf(true));
        } else if (components[(i + 1)].equalsIgnoreCase("motor")) {
          augments.put("motion", Boolean.valueOf(true));
        } else if (components[(i + 1)].equalsIgnoreCase("silentium")) {
          augments.put("silence", Boolean.valueOf(true));
        } else if (components[(i + 1)].equalsIgnoreCase("mora")) {
          Delay.delay(spellName, toCast, ev, material, this.size, augments);

          toCast = null;
        }
      }

      if (components[i].equalsIgnoreCase("bulla")) {
        augments.put("bubble", Boolean.valueOf(true));
      }

      if (components[i].equalsIgnoreCase("libero")) {
        Delay.release(ev);
      }

      components[i].equalsIgnoreCase("praevenio");
    }

    if (!spellName.equals("")) {
      boolean canCast = true;

      if (Vicincantatio.config.getBoolean(spellName + "_consumes_book", false)) {
        if (!PlayerSpendReagent(ev.getPlayer(), Material.BOOK, 1)) canCast = false;
      }
      if (Vicincantatio.config.getBoolean(spellName + "_book_augment", false)) {
        if (PlayerSpendReagent(ev.getPlayer(), Material.BOOK, 1)) {
          augments.put("book", Boolean.valueOf(true));
        }
      }
      if ((toCast != null) && (canCast)) {
        if (Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx")) {
          PermissionManager permissions = PermissionsEx.getPermissionManager();
          if (permissions.has(ev.getPlayer(), spellName + ".allow")) {
            toCast.CastSpell(ev, material, this.size, augments);
          } else {
            Vicincantatio.log.info("Spell not allowed by user.");
            ev.getPlayer().sendMessage("Sorry, you do not have permission to do that.");
          }

        } else {
          toCast.CastSpell(ev, material, this.size, augments);
        }
      }

      if (augments.containsKey("silence")) ev.setCancelled(true);
    }
  }
  public void onPlayerCommand(PlayerChatEvent event) {
    String[] split = event.getMessage().split(" ");
    if (split.length >= 1) {
      if (split[0].equalsIgnoreCase("/follow")) {
        HashMap<Player, ArrayList<Player>> players = plugin.getPlayers();
        Player player = event.getPlayer();
        if (split.length == 1) {
          // Stop following
          for (Entry<Player, ArrayList<Player>> entry : players.entrySet()) {
            for (Player iter : entry.getValue()) {
              if (iter.getName().equalsIgnoreCase(player.getName())) {
                // System.out.println(player.getName() + " has stopped following " +
                // entry.getKey().getName());
                player.sendMessage("§eYou stopped following " + entry.getKey().getName());
                entry.getValue().remove(iter);
              }
            }
          }
          player.sendMessage("§eYou weren't following anybody.");
        } else if (split.length >= 2) {
          String name = split[1].trim();

          Player target = plugin.getServer().getPlayer(name);
          if (target != null) {
            // Check the distance between the two to disallow teleporting using it
            double distance =
                Math.sqrt(
                    Math.pow((target.getLocation().getX() - player.getLocation().getX()), 2)
                        + Math.pow((target.getLocation().getY() - player.getLocation().getY()), 2)
                        + Math.pow((target.getLocation().getZ() - player.getLocation().getZ()), 2));
            if (distance > 4) {
              player.sendMessage("§eYou are too far away.");
            }

            for (Entry<Player, ArrayList<Player>> entry : players.entrySet()) {
              for (Player iter : entry.getValue()) {
                if (iter.getName().equalsIgnoreCase(player.getName())) {
                  // System.out.println(player.getName() + " forcibly stopped following " +
                  // entry.getKey().getName());
                  entry.getValue().remove(player);
                  break;
                }
              }
            }

            // Find the player
            boolean foundTarget = false;
            boolean foundPlayer = false;
            for (Player iter : players.keySet()) {
              if (iter.getName().equalsIgnoreCase(name)) {
                foundTarget = true;
                for (Player iter2 : players.get(target)) {
                  if (iter2.getName().equalsIgnoreCase(player.getName())) {
                    // Already following, don't add
                    foundPlayer = true;
                    // System.out.println(player.getName() + " is already following " +
                    // target.getName());
                    player.sendMessage("You are already following " + target.getName());
                  }
                }
              }
            }
            if (!foundTarget) {
              // System.out.println("New player to follow. Adding " + target.getName() + " to the
              // follow list and adding "
              // + player.getName() + " to follow them.");
              // Make a new follow list and tie it to the player to follow
              ArrayList<Player> temp = new ArrayList<Player>();
              temp.add(player);
              players.put(target, temp);
            }
            if (!foundPlayer) {
              // System.out.println("Player not found on the following list, adding them");
              players.get(target).add(player);
              player.sendMessage("§eYou are now following " + target.getName());
            }
          } else {
            player.sendMessage("§ePlease give a valid player name.");
          }
        } else {
          player.sendMessage("§eUsage is /follow [player]");
        }
        event.setCancelled(true);
      }
    }
  }