revert blacklist api
This commit is contained in:
		
							parent
							
								
									3ebd0070b8
								
							
						
					
					
						commit
						22108fd6d9
					
				
					 3 changed files with 0 additions and 43 deletions
				
			
		| 
						 | 
					@ -100,28 +100,6 @@ public interface Npc extends PropertyHolder {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void respawn(Player player);
 | 
					    void respawn(Player player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Blacklists a player from sending packets for this NPC
 | 
					 | 
				
			||||||
     * This means that the run task won't send packets to the player
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param player The player to be blacklisted
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void blacklist(Player player);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Removes a player from the blacklist, allowing packets to be sent to them for this NPC.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param player The player to be removed from the blacklist
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void unblacklist(Player player);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Gets if a player is blacklisted from sending packets for this NPC
 | 
					 | 
				
			||||||
     * @param player The player to check
 | 
					 | 
				
			||||||
     * @return If the player is blacklisted
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean isBlacklisted(Player player);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets the head rotation of this NPC for a player
 | 
					     * Sets the head rotation of this NPC for a player
 | 
				
			||||||
     * @param player The {@link Player} to set the head rotation for
 | 
					     * @param player The {@link Player} to set the head rotation for
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,11 +47,6 @@ public class NpcProcessorTask extends BukkitRunnable {
 | 
				
			||||||
                    if (npc.isVisibleTo(player)) npc.hide(player);
 | 
					                    if (npc.isVisibleTo(player)) npc.hide(player);
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (npc.isBlacklisted(player)) {
 | 
					 | 
				
			||||||
                    continue;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                double distance = player.getLocation().distanceSquared(npc.getBukkitLocation());
 | 
					                double distance = player.getLocation().distanceSquared(npc.getBukkitLocation());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // visibility
 | 
					                // visibility
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,6 @@ public abstract class Viewable {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Set<Player> viewers = ConcurrentHashMap.newKeySet();
 | 
					    private final Set<Player> viewers = ConcurrentHashMap.newKeySet();
 | 
				
			||||||
    private final Set<Player> blacklisted = ConcurrentHashMap.newKeySet();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Viewable() {
 | 
					    public Viewable() {
 | 
				
			||||||
        all.add(new WeakReference<>(this));
 | 
					        all.add(new WeakReference<>(this));
 | 
				
			||||||
| 
						 | 
					@ -31,7 +30,6 @@ public abstract class Viewable {
 | 
				
			||||||
    public void delete() {
 | 
					    public void delete() {
 | 
				
			||||||
        UNSAFE_hideAll();
 | 
					        UNSAFE_hideAll();
 | 
				
			||||||
        viewers.clear();
 | 
					        viewers.clear();
 | 
				
			||||||
        blacklisted.clear();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void respawn() {
 | 
					    public void respawn() {
 | 
				
			||||||
| 
						 | 
					@ -57,22 +55,8 @@ public abstract class Viewable {
 | 
				
			||||||
        UNSAFE_hide(player);
 | 
					        UNSAFE_hide(player);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void blacklist(Player player) {
 | 
					 | 
				
			||||||
        blacklisted.add(player);
 | 
					 | 
				
			||||||
        hide(player);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void unblacklist(Player player) {
 | 
					 | 
				
			||||||
        blacklisted.remove(player);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean isBlacklisted(Player player) {
 | 
					 | 
				
			||||||
        return blacklisted.contains(player);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void UNSAFE_removeViewer(Player player) {
 | 
					    public void UNSAFE_removeViewer(Player player) {
 | 
				
			||||||
        viewers.remove(player);
 | 
					        viewers.remove(player);
 | 
				
			||||||
        blacklisted.remove(player);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected void UNSAFE_hideAll() {
 | 
					    protected void UNSAFE_hideAll() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue