当前位置: 首页>>代码示例>>Java>>正文


Java InvalidFlagFormat类代码示例

本文整理汇总了Java中com.sk89q.worldguard.protection.flags.InvalidFlagFormat的典型用法代码示例。如果您正苦于以下问题:Java InvalidFlagFormat类的具体用法?Java InvalidFlagFormat怎么用?Java InvalidFlagFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InvalidFlagFormat类属于com.sk89q.worldguard.protection.flags包,在下文中一共展示了InvalidFlagFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public PotionEffect parseInput(FlagContext context) throws InvalidFlagFormat
{
	String[] splitd = context.getUserInput().trim().split(" ");
	if (splitd.length == 2)
	{
		PotionEffectType potionEffect = PotionEffectType.getByName(splitd[0]);
		if (potionEffect != null)
		{
			return new PotionEffect(potionEffect, 160, new Integer(splitd[1]));
		}
		else
		{
			throw new InvalidFlagFormat("Unable to find the potion effect!");
		}
	}
	else
	{
		throw new InvalidFlagFormat("Please use format: <effect name> <effect amplifier>");
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:22,代码来源:PotionEffectFlag.java

示例2: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
   public Set<T> parseInput(FlagContext context) throws InvalidFlagFormat
{
       String input = context.getUserInput();
       if (input.isEmpty())
       {
           return Sets.newHashSet();
       }
       else
       {
           Set<T> items = Sets.newHashSet();

           for (String str : input.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1))
           {
           	if (str.startsWith("\"") && str.endsWith("\""))
           	{
           		str = str.substring(1, str.length() - 1);
           	}
               FlagContext copy = context.copyWith(null, str, null);
               items.add(this.getType().parseInput(copy));
           }

           return items;
       }
   }
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:26,代码来源:CustomSetFlag.java

示例3: setFlag

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
public static <T> void setFlag(ProtectedRegion region, Flag<T> flag, String value) throws CommandException, InvalidFlagFormat {
	CommandContext ccontext = new CommandContext("rg "+value, valueFlags);
	region.setFlag(flag, flag.parseInput(WGBukkit.getPlugin(), Bukkit.getConsoleSender(), ccontext.getRemainingString(0)));
	if (ccontext.hasFlag('g')) {
		String group = ccontext.getFlag('g');
		RegionGroupFlag groupFlag = flag.getRegionGroupFlag();
		if (groupFlag == null) {
			return;
		}
		RegionGroup groupValue = groupFlag.parseInput(WGBukkit.getPlugin(), Bukkit.getConsoleSender(), group);
		if (groupValue == groupFlag.getDefault()) {
			region.setFlag(groupFlag, null);
		} else {
			region.setFlag(groupFlag, groupValue);
		}
	}
}
 
开发者ID:Shevchik,项目名称:WGBuyFlags,代码行数:18,代码来源:Utils.java

示例4: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public AudioDelay parseInput(String input) throws InvalidFlagFormat {
    Range delayTime = null;
    String trackId = null;
    String[] properties = input.split(":");
    if (!properties[0].startsWith("time=")) {
        properties[0] = "time=" + properties[0];
    }
    for (String property : properties) {
        String[] keyValuePair = property.split("=");
        if (keyValuePair.length != 2) {
            throw new InvalidFlagFormat("AudioDelay must be in the format ':<key>=<value>' following the delay range or constant");
        }
        String key = keyValuePair[0], value = keyValuePair[1];
        if (delayTime == null && key.equals("time")) {
            delayTime = Range.parse(value);
            if (delayTime == null) {
                throw new InvalidFlagFormat(plugin.getMessenger().getMessage("failed.invalid-delay-range", true, value));
            }
        } else if (trackId == null && key.equals("track")) {
            trackId = value;
            try {
                ConnectUtils.validateIdentifier(trackId);
            } catch (IdentifierSyntaxException e) {
                throw new InvalidFlagFormat("track " + e.getMessage());
            }
        } else {
            throw new InvalidFlagFormat("Duplicate or unknown AudioDelay property '" + key + "'");
        }
    }
    if (delayTime == null) {
        throw new InvalidFlagFormat("AudioDelay is missing required 'time' property");
    }

    return new AudioDelay(delayTime, trackId);
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:37,代码来源:AudioDelayFlag.java

示例5: convertCommandArg

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public Result<T> convertCommandArg(String argName, String arg) {
    try {
        return Result.success(flag.parseInput(arg));
    } catch (InvalidFlagFormat e) {
        return Result.fail(e.getMessage());
    }
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:9,代码来源:CommandHandler.java

示例6: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public SoundData parseInput(FlagContext context) throws InvalidFlagFormat
{
	String[] splitd = context.getUserInput().trim().split(" ");
	if (splitd.length == 2)
	{
		return new SoundData(splitd[0], new Integer(splitd[1]));
	}
	else
	{
		throw new InvalidFlagFormat("Please use format: <sound name> <interval in ticks>");
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:14,代码来源:SoundDataFlag.java

示例7: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public Material parseInput(FlagContext context) throws InvalidFlagFormat
{
	Material material = Material.getMaterial(context.getUserInput().trim().toUpperCase());
	if (material != null)
	{
		return material;
	}
	else
	{
		throw new InvalidFlagFormat("Unable to find the material!");
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:14,代码来源:MaterialFlag.java

示例8: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public PotionEffectType parseInput(FlagContext context) throws InvalidFlagFormat
{
	PotionEffectType potionEffect = PotionEffectType.getByName(context.getUserInput().trim());
	if (potionEffect != null)
	{
		return potionEffect;
	}
	else
	{
		throw new InvalidFlagFormat("Unable to find the potion effect!");
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:14,代码来源:PotionEffectTypeFlag.java

示例9: setFlag

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
/**
 * Set a WorldGuard region flag.
 * @param region The WorldGuard region to set
 * @param flag   The flag to set
 * @param value  The value to set the flag to
 * @param <V>    They type of flag to set
 * @throws InvalidFlagFormat When the value of the flag is wrong
 */
private <V> void setFlag(ProtectedRegion region, Flag<V> flag, String value) throws InvalidFlagFormat {
	V current = region.getFlag(flag);
	V next = plugin.getWorldGuardHandler().parseFlagInput(flag, value);

	if(!Objects.equals(current, next)) {
		region.setFlag(flag, next);
	}
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:17,代码来源:WorldGuardRegionFlagsFeature.java

示例10: setFlag

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
private <V> void setFlag(Target t, ProtectedRegion region,
						 Flag<V> flag, CommandSender sender, String value)
		throws InvalidFlagFormat {
	try {
		region.setFlag(flag, flag.parseInput(FlagContext.create().setSender(sender).setInput(value).build()));
	} catch (NoClassDefFoundError ex) {
		// probably WorldGuard 3.1.2 or earlier
		region.setFlag(flag, flag.unmarshal(ReflectionUtils.invokeMethod(flag, "parseInput", WorldGuardPlugin.inst(), sender, value)));
	}
}
 
开发者ID:jb-aero,项目名称:SKCompat,代码行数:11,代码来源:CHWorldGuard.java

示例11: parseInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public AudioTrack parseInput(FlagContext context) throws InvalidFlagFormat {
    return parseInput(stringFlag.parseInput(context));
}
 
开发者ID:DeadmanDungeons,项目名称:AudioConnect,代码行数:5,代码来源:AudioTrackFlag.java

示例12: setRegionFlags

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
private static ProtectedCuboidRegion setRegionFlags(IslandInfo islandConfig) throws InvalidFlagFormat {
    String regionName = islandConfig.getName() + "island";
    return setRegionFlags(islandConfig, regionName);
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:5,代码来源:WorldGuardHandler.java

示例13: parseFlagInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public <V> V parseFlagInput(Flag<V> flag, String input) throws InvalidFlagFormat {
	return flag.parseInput(FlagContext.create().setInput(input).build());
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:5,代码来源:WorldGuardHandler6_1_3.java

示例14: parseFlagGroupInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public RegionGroup parseFlagGroupInput(RegionGroupFlag flag, String input) throws InvalidFlagFormat {
	return flag.parseInput(FlagContext.create().setInput(input).build());
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:5,代码来源:WorldGuardHandler6_1_3.java

示例15: parseFlagInput

import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; //导入依赖的package包/类
@Override
public <V> V parseFlagInput(Flag<V> flag, String input) throws InvalidFlagFormat {
	return flag.parseInput(WorldGuardPlugin.inst(), null, input);
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:5,代码来源:WorldGuardHandler5.java


注:本文中的com.sk89q.worldguard.protection.flags.InvalidFlagFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。