本文整理汇总了Java中net.dmulloy2.util.Util.toBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Util.toBoolean方法的具体用法?Java Util.toBoolean怎么用?Java Util.toBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dmulloy2.util.Util
的用法示例。
在下文中一共展示了Util.toBoolean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public void perform()
{
String key = args[0];
Object val = null;
String valStr = FormatUtil.join(" ", Arrays.copyOfRange(args, 1, args.length));
valStr = valStr.replaceAll("\"", "");
valStr = valStr.trim();
if (valStr.contains("b:"))
val = Util.toBoolean(valStr);
else if (valStr.contains("i:"))
val = NumberUtil.toInt(valStr);
else if (valStr.contains("d:"))
val = NumberUtil.toDouble(valStr);
else if (! valStr.equalsIgnoreCase("null") && ! valStr.isEmpty())
val = valStr;
group.setOption(key, val);
if (val == null)
sendpMessage("Option ''&b{0}&e'' removed from group &b{1}&e.", key, group.getName());
else
sendpMessage("Option ''&b{0}&e'' set to ''&b{1}&e'' for group &b{2}&e.", key, val, group.getName());
}
示例2: perform
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public void perform()
{
String key = args[0];
Object val = null;
String valStr = FormatUtil.join(" ", Arrays.copyOfRange(args, 1, args.length));
valStr = valStr.replaceAll("\"", "");
valStr = valStr.trim();
if (valStr.contains("b:"))
val = Util.toBoolean(valStr);
else if (valStr.contains("i:"))
val = NumberUtil.toInt(valStr);
else if (valStr.contains("d:"))
val = NumberUtil.toDouble(valStr);
else if (! valStr.equalsIgnoreCase("null") && ! valStr.isEmpty())
val = valStr;
user.setOption(key, val);
if (val == null)
sendpMessage("Option ''&b{0}&e'' removed from user &b{1}&e.", key, user.getName());
else
sendpMessage("Option ''&b{0}&e'' set to ''&b{1}&e'' for user &b{2}&e.", key, val, user.getName());
}
示例3: argAsBoolean
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
protected final boolean argAsBoolean(int arg)
{
return Util.toBoolean(args[arg]);
}
示例4: getPlayerInfoBoolean
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue)
{
return Util.toBoolean(getPlayerInfo(world, player, node, defaultValue));
}
示例5: getGroupInfoBoolean
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue)
{
return Util.toBoolean(getGroupInfo(world, group, node, defaultValue));
}
示例6: argAsBoolean
import net.dmulloy2.util.Util; //导入方法依赖的package包/类
/**
* Gets an argument as a boolean, falling back to the default if it's out of
* range
*
* @param arg Argument index
* @param def Default value
* @return The boolean
*/
protected boolean argAsBoolean(int arg, boolean def)
{
return args.length > arg ? Util.toBoolean(args[arg]) : def;
}