Have getMPlayersWhere use MUtil's transform method
Minor reduction in redundant code and safely handles null passed as the predicate Added a new signature of getMPlayers which accomadates for all of MUtil.transform's parameters, similar to what is available in CollAbstract.
This commit is contained in:
		
				
					committed by
					
						
						Olof Larsson
					
				
			
			
				
	
			
			
			
						parent
						
							faf736a013
						
					
				
				
					commit
					3f123922ba
				
			@@ -31,6 +31,7 @@ import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -984,14 +985,14 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
		return new MassiveList<>(FactionsIndex.get().getMPlayers(this));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public List<MPlayer> getMPlayers(Predicate<? super MPlayer> where, Comparator<? super MPlayer> orderby, Integer limit, Integer offset)
 | 
			
		||||
	{
 | 
			
		||||
		return MUtil.transform(this.getMPlayers(), where, orderby, limit, offset);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public List<MPlayer> getMPlayersWhere(Predicate<? super MPlayer> predicate)
 | 
			
		||||
	{
 | 
			
		||||
		List<MPlayer> ret = this.getMPlayers();
 | 
			
		||||
		for (Iterator<MPlayer> it = ret.iterator(); it.hasNext();)
 | 
			
		||||
		{
 | 
			
		||||
			if ( ! predicate.apply(it.next())) it.remove();
 | 
			
		||||
		}
 | 
			
		||||
		return ret;
 | 
			
		||||
		return this.getMPlayers(predicate, null, null, null);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public List<MPlayer> getMPlayersWhereOnline(boolean online)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user