Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.eml.phl.utils;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.UUID;
- import org.bukkit.ChatColor;
- import org.bukkit.entity.Player;
- public class HitlistManager {
- public HashMap<UUID, List<UUID>> hitlistMap = new HashMap<UUID, List<UUID>>();
- private String prefix = ChatColor.GOLD + "[PHL] ";
- public void addToHitlist(Player playerAdding, Player playerAdded) {
- if (playerAdded.isOnline()) {
- UUID uuidOfAdding = playerAdding.getUniqueId();
- UUID uuidOfAdded = playerAdded.getUniqueId();
- if (!hitlistMap.containsKey(uuidOfAdding)) {
- hitlistMap.put(uuidOfAdding, new ArrayList<UUID>());
- hitlistMap.get(uuidOfAdding).add(uuidOfAdded);
- playerAdding.sendMessage(prefix + ChatColor.GREEN
- + playerAdded.getDisplayName()
- + " has been added to your hitlist!");
- } else {
- playerAdding.sendMessage(prefix + ChatColor.GREEN
- + playerAdded.getDisplayName()
- + " is already on your hitlist!");
- }
- }
- }
- public void removeFromHitlist(Player playerRemoving, Player playerRemoved) {
- if (playerRemoved.isOnline()) {
- UUID uuidOfRemoving = playerRemoving.getUniqueId();
- UUID uuidOfRemoved = playerRemoved.getUniqueId();
- if (hitlistMap.containsKey(uuidOfRemoving)) {
- if (hitlistMap.get(uuidOfRemoving).contains(uuidOfRemoved))
- hitlistMap.get(uuidOfRemoving).remove(uuidOfRemoved);
- playerRemoving.sendMessage(prefix + ChatColor.GREEN
- + playerRemoved.getDisplayName()
- + " has been removed from your hitlist.");
- } else {
- playerRemoving.sendMessage(prefix + ChatColor.GREEN
- + playerRemoved.getDisplayName()
- + " is not on your hitlist.");
- }
- }
- }
- public void listPlayersOnHitlist(Player playerChecking) {
- UUID uuidOfPlayerChecking = playerChecking.getUniqueId();
- playerChecking.sendMessage(prefix + ChatColor.GREEN
- + hitlistMap.get(uuidOfPlayerChecking));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement