This would be all ArgReaders?
This commit is contained in:
		
							parent
							
								
									b396595b64
								
							
						
					
					
						commit
						958155e43c
					
				
							
								
								
									
										51
									
								
								src/com/massivecraft/factions/cmd/arg/ARFFlag.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/com/massivecraft/factions/cmd/arg/ARFFlag.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| package com.massivecraft.factions.cmd.arg; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.bukkit.command.CommandSender; | ||||
| 
 | ||||
| import com.massivecraft.factions.FFlag; | ||||
| import com.massivecraft.mcore.cmd.arg.ARAbstractSelect; | ||||
| import com.massivecraft.mcore.util.Txt; | ||||
| 
 | ||||
| public class ARFFlag extends ARAbstractSelect<FFlag> | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// INSTANCE & CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	private static ARFFlag i = new ARFFlag(); | ||||
| 	public static ARFFlag get() { return i; } | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String typename() | ||||
| 	{ | ||||
| 		return "faction flag"; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public FFlag select(String str, CommandSender sender) | ||||
| 	{ | ||||
| 		return FFlag.parse(str); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public Collection<String> altNames(CommandSender sender) | ||||
| 	{ | ||||
| 		List<String> ret = new ArrayList<String>();  | ||||
| 		 | ||||
| 		for (FFlag fflag : FFlag.values()) | ||||
| 		{ | ||||
| 			ret.add(Txt.getNicedEnum(fflag)); | ||||
| 		} | ||||
| 		 | ||||
| 		return ret; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
							
								
								
									
										26
									
								
								src/com/massivecraft/factions/cmd/arg/ARFPlayer.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/com/massivecraft/factions/cmd/arg/ARFPlayer.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| package com.massivecraft.factions.cmd.arg; | ||||
| 
 | ||||
| import com.massivecraft.factions.FPlayer; | ||||
| import com.massivecraft.factions.FPlayerColl; | ||||
| import com.massivecraft.mcore.cmd.arg.ARSenderEntity; | ||||
| import com.massivecraft.mcore.cmd.arg.ArgReader; | ||||
| 
 | ||||
| public class ARFPlayer | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// INSTANCE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	private static ArgReader<FPlayer> fullAny = ARSenderEntity.getFullAny(FPlayerColl.get()); | ||||
| 	public static ArgReader<FPlayer> getFullAny() { return fullAny; } | ||||
| 	 | ||||
| 	private static ArgReader<FPlayer> startAny = ARSenderEntity.getStartAny(FPlayerColl.get()); | ||||
| 	public static ArgReader<FPlayer> getStartAny() { return startAny; } | ||||
| 	 | ||||
| 	private static ArgReader<FPlayer> fullOnline = ARSenderEntity.getFullOnline(FPlayerColl.get()); | ||||
| 	public static ArgReader<FPlayer> getFullOnline() { return fullOnline; } | ||||
| 	 | ||||
| 	private static ArgReader<FPlayer> startOnline = ARSenderEntity.getStartOnline(FPlayerColl.get()); | ||||
| 	public static ArgReader<FPlayer> getStartOnline() { return startOnline; } | ||||
| 	 | ||||
| } | ||||
							
								
								
									
										52
									
								
								src/com/massivecraft/factions/cmd/arg/ARFaction.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/com/massivecraft/factions/cmd/arg/ARFaction.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | ||||
| package com.massivecraft.factions.cmd.arg; | ||||
| 
 | ||||
| import org.bukkit.command.CommandSender; | ||||
| 
 | ||||
| import com.massivecraft.factions.FPlayer; | ||||
| import com.massivecraft.factions.FPlayerColl; | ||||
| import com.massivecraft.factions.Faction; | ||||
| import com.massivecraft.factions.FactionColl; | ||||
| import com.massivecraft.mcore.cmd.arg.ArgReaderAbstract; | ||||
| import com.massivecraft.mcore.cmd.arg.ArgResult; | ||||
| import com.massivecraft.mcore.util.Txt; | ||||
| 
 | ||||
| public class ARFaction extends ArgReaderAbstract<Faction> | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// INSTANCE & CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	private static ARFaction i = new ARFaction(); | ||||
| 	public static ARFaction get() { return i; } | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	@Override | ||||
| 	public ArgResult<Faction> read(String str, CommandSender sender) | ||||
| 	{ | ||||
| 		ArgResult<Faction> result = new ArgResult<Faction>(); | ||||
| 		 | ||||
| 		// Faction Tag Exact  | ||||
| 		result.setResult(FactionColl.get().getByTag(str)); | ||||
| 		if (result.hasResult()) return result; | ||||
| 		 | ||||
| 		// Faction Tag Match | ||||
| 		result.setResult(FactionColl.get().getBestTagMatch(str)); | ||||
| 		if (result.hasResult()) return result; | ||||
| 		 | ||||
| 		// FPlayer Name Exact | ||||
| 		FPlayer fplayer = FPlayerColl.get().get(str); | ||||
| 		if (fplayer != null) | ||||
| 		{ | ||||
| 			result.setResult(fplayer.getFaction()); | ||||
| 			return result; | ||||
| 		} | ||||
| 		 | ||||
| 		result.setErrors(Txt.parse("<b>No faction or player matching \"<p>%s<b>\".", str)); | ||||
| 		return result; | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
							
								
								
									
										51
									
								
								src/com/massivecraft/factions/cmd/arg/ARRel.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/com/massivecraft/factions/cmd/arg/ARRel.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| package com.massivecraft.factions.cmd.arg; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import org.bukkit.command.CommandSender; | ||||
| 
 | ||||
| import com.massivecraft.factions.Rel; | ||||
| import com.massivecraft.mcore.cmd.arg.ARAbstractSelect; | ||||
| import com.massivecraft.mcore.util.Txt; | ||||
| 
 | ||||
| public class ARRel extends ARAbstractSelect<Rel> | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// INSTANCE & CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	private static ARRel i = new ARRel(); | ||||
| 	public static ARRel get() { return i; } | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String typename() | ||||
| 	{ | ||||
| 		return "role"; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public Rel select(String str, CommandSender sender) | ||||
| 	{ | ||||
| 		return Rel.parse(str); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public Collection<String> altNames(CommandSender sender) | ||||
| 	{ | ||||
| 		List<String> ret = new ArrayList<String>();  | ||||
| 		 | ||||
| 		for (Rel rel : Rel.values()) | ||||
| 		{ | ||||
| 			ret.add(Txt.getNicedEnum(rel)); | ||||
| 		} | ||||
| 		 | ||||
| 		return ret; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user