mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-30 22:24:28 +01:00
Fixed who command and detatched the argument reading a bit.
This commit is contained in:
parent
3cc7766fa7
commit
27c45bf7f3
@ -33,8 +33,12 @@ public class CmdShow extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction faction = this.argAsFaction(0, myFaction);
|
Faction faction = myFaction;
|
||||||
|
if (this.argIsSet(0))
|
||||||
|
{
|
||||||
|
faction = this.argAsFaction(0);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
}
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(Conf.econCostShow)) return;
|
if ( ! payForCommand(Conf.econCostShow)) return;
|
||||||
|
@ -331,9 +331,8 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// INT ======================
|
// INT ======================
|
||||||
public int argAsInt(int idx, int def)
|
public int strAsInt(String str, int def)
|
||||||
{
|
{
|
||||||
String str = this.argAsString(idx);
|
|
||||||
if (str == null) return def;
|
if (str == null) return def;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -345,15 +344,18 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public int argAsInt(int idx, int def)
|
||||||
|
{
|
||||||
|
return strAsInt(this.argAsString(idx), def);
|
||||||
|
}
|
||||||
public int argAsInt(int idx)
|
public int argAsInt(int idx)
|
||||||
{
|
{
|
||||||
return this.argAsInt(idx, -1);
|
return this.argAsInt(idx, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double ======================
|
// Double ======================
|
||||||
public double argAsDouble(int idx, double def)
|
public double strAsDouble(String str, double def)
|
||||||
{
|
{
|
||||||
String str = this.argAsString(idx);
|
|
||||||
if (str == null) return def;
|
if (str == null) return def;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -365,6 +367,10 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public double argAsDouble(int idx, double def)
|
||||||
|
{
|
||||||
|
return strAsDouble(this.argAsString(idx), def);
|
||||||
|
}
|
||||||
public double argAsDouble(int idx)
|
public double argAsDouble(int idx)
|
||||||
{
|
{
|
||||||
return this.argAsDouble(idx, -1d);
|
return this.argAsDouble(idx, -1d);
|
||||||
@ -381,7 +387,6 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean argAsBool(int idx, boolean def)
|
public Boolean argAsBool(int idx, boolean def)
|
||||||
{
|
{
|
||||||
String str = this.argAsString(idx);
|
String str = this.argAsString(idx);
|
||||||
@ -395,12 +400,10 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PLAYER ======================
|
// PLAYER ======================
|
||||||
|
public Player strAsPlayer(String name, Player def, boolean msg)
|
||||||
public Player argAsPlayer(int idx, Player def, boolean msg)
|
|
||||||
{
|
{
|
||||||
Player ret = def;
|
Player ret = def;
|
||||||
|
|
||||||
String name = this.argAsString(idx);
|
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
Player player = Bukkit.getServer().getPlayer(name);
|
Player player = Bukkit.getServer().getPlayer(name);
|
||||||
@ -417,6 +420,11 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player argAsPlayer(int idx, Player def, boolean msg)
|
||||||
|
{
|
||||||
|
return this.strAsPlayer(this.argAsString(idx), def, msg);
|
||||||
|
}
|
||||||
public Player argAsPlayer(int idx, Player def)
|
public Player argAsPlayer(int idx, Player def)
|
||||||
{
|
{
|
||||||
return this.argAsPlayer(idx, def, true);
|
return this.argAsPlayer(idx, def, true);
|
||||||
@ -427,11 +435,10 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BEST PLAYER MATCH ======================
|
// BEST PLAYER MATCH ======================
|
||||||
public Player argAsBestPlayerMatch(int idx, Player def, boolean msg)
|
public Player strAsBestPlayerMatch(String name, Player def, boolean msg)
|
||||||
{
|
{
|
||||||
Player ret = def;
|
Player ret = def;
|
||||||
|
|
||||||
String name = this.argAsString(idx);
|
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
List<Player> players = Bukkit.getServer().matchPlayer(name);
|
List<Player> players = Bukkit.getServer().matchPlayer(name);
|
||||||
@ -448,6 +455,10 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
public Player argAsBestPlayerMatch(int idx, Player def, boolean msg)
|
||||||
|
{
|
||||||
|
return this.strAsBestPlayerMatch(this.argAsString(idx), def, msg);
|
||||||
|
}
|
||||||
public Player argAsBestPlayerMatch(int idx, Player def)
|
public Player argAsBestPlayerMatch(int idx, Player def)
|
||||||
{
|
{
|
||||||
return this.argAsBestPlayerMatch(idx, def, true);
|
return this.argAsBestPlayerMatch(idx, def, true);
|
||||||
@ -456,8 +467,4 @@ public abstract class MCommand<T extends MPlugin>
|
|||||||
{
|
{
|
||||||
return this.argAsPlayer(idx, null);
|
return this.argAsPlayer(idx, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user