本文整理汇总了Java中com.sk89q.worldguard.protection.flags.StateFlag类的典型用法代码示例。如果您正苦于以下问题:Java StateFlag类的具体用法?Java StateFlag怎么用?Java StateFlag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StateFlag类属于com.sk89q.worldguard.protection.flags包,在下文中一共展示了StateFlag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
@SuppressWarnings("serial")
public RegionData enablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.MOB_DAMAGE, StateFlag.State.DENY);
regionData.praseWGRegion().getFlags().put(DefaultFlag.DENY_SPAWN, new HashSet<EntityType>() {
{
add(EntityType.CREEPER);
add(EntityType.ZOMBIE);
add(EntityType.SKELETON);
add(EntityType.SILVERFISH);
add(EntityType.ENDER_DRAGON);
add(EntityType.WITHER);
add(EntityType.WITHER_SKULL);
add(EntityType.GIANT);
add(EntityType.PIG_ZOMBIE);
add(EntityType.CAVE_SPIDER);
add(EntityType.SPIDER);
add(EntityType.WITCH);
add(EntityType.ENDERMITE);
add(EntityType.GUARDIAN);
}
});
return regionData;
}
示例2: getFlags
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
public Map<Flag<?>, Object> getFlags(String player) {
Map<Flag<?>, Object> flags = new TreeMap<>(new WorldGuardManager.FlagComparator());
for (Flag<?> df : DefaultFlag.flagsList) {
for (String key : fc.getConfigurationSection("ps-default.flags").getKeys(false)) {
if (df.getName().toString().equalsIgnoreCase(key)) {
if (fc.getString("ps-default.flags.".concat(key)).equalsIgnoreCase("deny")) {
flags.put(df, StateFlag.State.DENY);
} else if (fc.getString("ps-default.flags.".concat(key)).equalsIgnoreCase("allow")) {
flags.put(df, StateFlag.State.ALLOW);
} else {
flags.put(df, (Object) fc.getString("ps-default.flags.".concat(key)).replace("%player%", player));
}
}
}
}
return flags;
}
示例3: fillRegion
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
private static void fillRegion(ProtectedRegion region) {
region.setPriority(42);
region.getOwners().addPlayer(UUID.randomUUID());
region.getOwners().addGroup("owner_test_group");
region.getMembers().addPlayer(UUID.randomUUID());
region.getMembers().addGroup("member_test_group");
region.setFlag(DefaultFlag.ENTRY_DENY_MESSAGE, "Test entry deny message");
region.setFlag(DefaultFlag.BUILD, StateFlag.State.ALLOW);
region.setFlag(DefaultFlag.BLOCK_PLACE, StateFlag.State.ALLOW);
region.setFlag(DefaultFlag.NOTIFY_ENTER, true);
region.setFlag(DefaultFlag.GAME_MODE, GameMode.CREATIVE);
region.setFlag(DefaultFlag.ALLOWED_CMDS, (Set<String>) ImmutableSet.of("/test", "/mongowg"));
region.setFlag(DefaultFlag.DENY_SPAWN, (Set<EntityType>) ImmutableSet.of(EntityType.HORSE));
region.setFlag(DefaultFlag.HEAL_AMOUNT, 21);
region.setFlag(DefaultFlag.MAX_HEAL, 42.0);
}
示例4: run
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public void run() throws Exception {
if(!Config.REGION_WORLDGUARD.getBoolean()) {
LoggerUtils.info("Skipping WorldGuardFlag Injector. Disabled in config");
return;
}
plugin.getRegionManager().createWorldGuardFlag();
FieldAccessor<Flag[]> defaultFlagFlagListField = Reflections.getField(DefaultFlag.class, "flagsList", Flag[].class);
defaultFlagFlagListField.setNotFinal();
Flag[] array = defaultFlagFlagListField.get(null);
List<Flag> list = new ArrayList<>();
Collections.addAll(list, array);
list.add((StateFlag) RegionManager.WORLDGUARD_FLAG);
defaultFlagFlagListField.set(list.toArray(new Flag[list.size()]));
LoggerUtils.info("Successfully injected WorldGuard Flag");
}
示例5: setVersionSpecificFlags
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
private static void setVersionSpecificFlags(ProtectedCuboidRegion region) {
WorldGuardPlugin worldGuard = getWorldGuard();
if (worldGuard != null && worldGuard.isEnabled() && worldGuard.getDescription() != null) {
VersionUtil.Version wgVersion = VersionUtil.getVersion(worldGuard.getDescription().getVersion());
if (wgVersion.isGTE("6.0")) {
// Default values sort of bring us there... niiiiice
} else {
// 5.9 or below
region.setFlag(DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.DENY);
region.setFlag(DefaultFlag.ENTITY_PAINTING_DESTROY, StateFlag.State.DENY);
region.setFlag(DefaultFlag.CHEST_ACCESS, StateFlag.State.DENY);
region.setFlag(DefaultFlag.USE, StateFlag.State.DENY);
region.setFlag(DefaultFlag.DESTROY_VEHICLE, StateFlag.State.DENY);
}
}
}
示例6: reloadConfigs
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
static void reloadConfigs()
{
YamlConfiguration mainConfig = load(configFolder + "/" + MAIN_CONFIG);
WORLDGUARD_DEFAULT = mainConfig.getBoolean("worldguard_flag_enable");
PRISON_PICK_FLAG = new StateFlag("prison-picks", WORLDGUARD_DEFAULT);
EXPLOSIVE_COLOR = ChatColor.getByChar(mainConfig.getString("explosive_color").charAt(1));
PICK_O_PLENTY_COLOR = ChatColor.getByChar(mainConfig.getString("pick_o_plenty_color").charAt(1));
FAKE_EXPLOSIVE_PICK_O_PLENTY_COLOR = ChatColor.getByChar(mainConfig.getString("fake_xpop_color").charAt(1));
CHAT_SUCCESS_COLOR = ChatColor.getByChar(mainConfig.getString("success_color").charAt(1));
CHAT_FAIL_COLOR = ChatColor.getByChar(mainConfig.getString("fail_color").charAt(1));
CHAT_PICK_BREAK = ChatColor.getByChar(mainConfig.getString("pick_break_color").charAt(1));
CHAT_EXPLOSIVE_REPAIR = ChatColor.getByChar(mainConfig.getString("explosive_repair_msg").charAt(1));
CHAT_POP_REPAIR = ChatColor.getByChar(mainConfig.getString("pop_repair_msg").charAt(1));
CHAT_XPOP_REPAIR = ChatColor.getByChar(mainConfig.getString("xpop_repair_msg").charAt(1));
COAL_PRIORITY = mainConfig.getInt("coal_priority");
IRON_PRIORITY = mainConfig.getInt("iron_priority");
REDSTONE_PRIORITY = mainConfig.getInt("redstone_priority");
LAPIS_PRIORITY = mainConfig.getInt("lapis_priority");
GOLD_PRIORITY = mainConfig.getInt("gold_priority");
QUARTZ_PRIORITY = mainConfig.getInt("quartz_priority");
DIAMOND_PRIORITY = mainConfig.getInt("diamond_priority");
DIAMOND_BLOCK_PRIORITY = mainConfig.getInt("diamond_block_priority");
EMERALD_PRIORITY = mainConfig.getInt("emerald_priority");
}
示例7: isAllowedQuery
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
private boolean isAllowedQuery(BukkitPlayer ass, Location loc, StateFlag flag, boolean valueIfNull) {
if (ass != null
&& !flag.equals(DefaultFlag.PVP)
&& ass.hasPermission("worldguard.region.bypass." + loc.getWorld().getName()))
return true;
StateFlag.State state = wg.getRegionContainer().createQuery().queryState(loc, ass, flag);
boolean isAllowed = valueIfNull;
if (state != null) isAllowed = state.equals(StateFlag.State.ALLOW);
return isAllowed;
}
示例8: enablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData enablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.DENY);
regionData.praseWGRegion().setFlag(DefaultFlag.LAVA_FIRE, StateFlag.State.DENY);
regionData.praseWGRegion().setFlag(DefaultFlag.LIGHTER, StateFlag.State.DENY);
regionData.praseWGRegion().setFlag(DefaultFlag.LIGHTNING, StateFlag.State.DENY);
return regionData;
}
示例9: disablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData disablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.FIRE_SPREAD, StateFlag.State.ALLOW);
regionData.praseWGRegion().setFlag(DefaultFlag.LAVA_FIRE, StateFlag.State.ALLOW);
regionData.praseWGRegion().setFlag(DefaultFlag.LIGHTER, StateFlag.State.ALLOW);
regionData.praseWGRegion().setFlag(DefaultFlag.LIGHTNING, StateFlag.State.ALLOW);
return regionData;
}
示例10: enablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData enablePacket(RegionData regionData) {
RegionGroupFlag groupFlag = DefaultFlag.USE.getRegionGroupFlag();
regionData.praseWGRegion().setFlag(groupFlag, RegionGroup.NON_MEMBERS);
regionData.praseWGRegion().setFlag(DefaultFlag.USE, StateFlag.State.DENY);
return regionData;
}
示例11: disablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData disablePacket(RegionData regionData) {
RegionGroupFlag groupFlag = DefaultFlag.USE.getRegionGroupFlag();
regionData.praseWGRegion().setFlag(groupFlag, RegionGroup.ALL);
regionData.praseWGRegion().setFlag(DefaultFlag.USE, StateFlag.State.ALLOW);
return regionData;
}
示例12: enablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData enablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.CREEPER_EXPLOSION, StateFlag.State.DENY);
regionData.praseWGRegion().setFlag(DefaultFlag.TNT, StateFlag.State.DENY);
regionData.praseWGRegion().setFlag(DefaultFlag.OTHER_EXPLOSION, StateFlag.State.DENY);
return regionData;
}
示例13: disablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
public RegionData disablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.CREEPER_EXPLOSION, StateFlag.State.ALLOW);
regionData.praseWGRegion().setFlag(DefaultFlag.TNT, StateFlag.State.ALLOW);
regionData.praseWGRegion().setFlag(DefaultFlag.OTHER_EXPLOSION, StateFlag.State.ALLOW);
return regionData;
}
示例14: disablePacket
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@Override
@SuppressWarnings("serial")
public RegionData disablePacket(RegionData regionData) {
regionData.praseWGRegion().setFlag(DefaultFlag.MOB_DAMAGE, StateFlag.State.ALLOW);
regionData.praseWGRegion().getFlags().put(DefaultFlag.DENY_SPAWN, new HashSet<EntityType>() {
{
}
});
return regionData;
}
示例15: setFlag
import com.sk89q.worldguard.protection.flags.StateFlag; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void setFlag(Player player, Flag flag, String value) {
PSBlocks psb = getPs(player.getLocation());
if (psb == null) {
player.sendMessage(ChatColor.RED + plugin.i18n.getText("not_in_ps_area"));
return;
}
if (!validatePlayerPermission(player, psb)) {
return;
}
if (value == null) {
psb.region.setFlag(flag, null);
return;
}
switch (value.toLowerCase()) {
case "allow":
psb.region.setFlag(flag, StateFlag.State.ALLOW);
break;
case "deny":
psb.region.setFlag(flag, StateFlag.State.DENY);
break;
default:
switch (flag.getName().toLowerCase()) {
case "farewell":
case "greeting":
psb.region.setFlag(flag, value);
default:
return;
}
}
}