gpt4 book ai didi

com.sk89q.worldguard.internal.platform.WorldGuardPlatform.getGlobalStateManager()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 08:43:05 31 4
gpt4 key购买 nike

本文整理了Java中com.sk89q.worldguard.internal.platform.WorldGuardPlatform.getGlobalStateManager()方法的一些代码示例,展示了WorldGuardPlatform.getGlobalStateManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorldGuardPlatform.getGlobalStateManager()方法的具体详情如下:
包路径:com.sk89q.worldguard.internal.platform.WorldGuardPlatform
类名称:WorldGuardPlatform
方法名:getGlobalStateManager

WorldGuardPlatform.getGlobalStateManager介绍

[英]Get the global ConfigurationManager. Use this to access global configuration values and per-world configuration values.
[中]获取全球配置管理器。使用此选项可以访问全局配置值和每个世界的配置值。

代码示例

代码示例来源:origin: EngineHub/WorldGuard

/**
 * Create a new instance.
 *
 * @param cache the query cache
 */
public RegionQuery(QueryCache cache) {
  checkNotNull(cache);
  this.config = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  this.cache = cache;
  //noinspection deprecation
}

代码示例来源:origin: EngineHub/WorldGuard

/**
 * Get the global configuration.
 *
 * @return the configuration
 */
protected ConfigurationManager getConfig() {
  return WorldGuard.getInstance().getPlatform().getGlobalStateManager();
}

代码示例来源:origin: EngineHub/WorldGuard

private void playDenyEffect(Player player, Location location) {
  //player.playSound(location, Sound.SUCCESSFUL_HIT, 0.2f, 0.4f);
  if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().particleEffects) {
    player.playEffect(location, Effect.SMOKE, BlockFace.UP);
  }
}

代码示例来源:origin: EngineHub/WorldGuard

/**
 * Get the world configuration given a world.
 *
 * @param world The world to get the configuration for.
 * @return The configuration for {@code world}
 */
protected WorldConfiguration getWorldConfig(World world) {
  return WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(BukkitAdapter.adapt(world));
}

代码示例来源:origin: EngineHub/WorldGuard

private void playDenyEffect(Location location) {
  if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().particleEffects) {
    location.getWorld().playEffect(location, Effect.SMOKE, BlockFace.UP);
  }
}

代码示例来源:origin: EngineHub/WorldGuard

public void registerEvents() {
  if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().usePlayerMove) {
    PluginManager pm = plugin.getServer().getPluginManager();
    pm.registerEvents(this, plugin);
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler
  public void onPluginDisable(PluginDisableEvent event) {
    if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
      ((BukkitConfigurationManager) WorldGuard.getInstance().getPlatform().getGlobalStateManager()).updateCommandBookGodMode();
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler
public void onPluginEnable(PluginEnableEvent event) {
  if (event.getPlugin().getDescription().getName().equalsIgnoreCase("CommandBook")) {
    ((BukkitConfigurationManager) WorldGuard.getInstance().getPlatform().getGlobalStateManager()).updateCommandBookGodMode();
  }
}

代码示例来源:origin: EngineHub/WorldGuard

/**
 * Initialize the region container.
 */
public void initialize() {
  ConfigurationManager config = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  container = new RegionContainerImpl(config.selectedRegionStoreDriver, WorldGuard.getInstance().getFlagRegistry());
  loadWorlds();
  // Migrate to UUIDs
  autoMigrate();
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPigZap(PigZapEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getEntity().getWorld()));
  if (wcfg.disablePigZap) {
    event.setCancelled(true);
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onCreeperPower(CreeperPowerEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getEntity().getWorld()));
  if (wcfg.disableCreeperPower) {
    event.setCancelled(true);
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH)
public void onEntityDeath(EntityDeathEvent event) {
  WorldConfiguration wcfg =
      WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(BukkitAdapter.adapt(event.getEntity().getWorld()));
  if (event instanceof PlayerDeathEvent && wcfg.disableDeathMessages) {
    ((PlayerDeathEvent) event).setDeathMessage("");
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
  Entity ent = event.getEntity();
  World world = ent.getWorld();
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(world));
  if (wcfg.disableHealthRegain) {
    event.setCancelled(true);
    return;
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onCreatePortal(EntityCreatePortalEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getEntity().getWorld()));
  switch (event.getEntityType()) {
    case ENDER_DRAGON:
      if (wcfg.blockEnderDragonPortalCreation) event.setCancelled(true);
      break;
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onThunderChange(ThunderChangeEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getWorld()));
  if (event.toThunderState()) {
    if (wcfg.disableThunder) {
      event.setCancelled(true);
    }
  } else {
    if (!wcfg.disableWeather && wcfg.alwaysThundering) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getWorld()));
  if (event.toWeatherState()) {
    if (wcfg.disableWeather) {
      event.setCancelled(true);
    }
  } else {
    if (!wcfg.disableWeather && wcfg.alwaysRaining) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityInteract(EntityInteractEvent event) {
  Entity entity = event.getEntity();
  Block block = event.getBlock();
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(entity.getWorld()));
  if (block.getType() == Material.FARMLAND) {
    if (/* entity instanceof Creature && // catch for any entity (not thrown for players) */
      wcfg.disableCreatureCropTrampling) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(ignoreCancelled = true)
public void onBlockDispense(BlockDispenseEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getBlock().getWorld()));
  if (wcfg.getBlacklist() != null) {
    if (!wcfg.getBlacklist().check(new BlockDispenseBlacklistEvent(null, BukkitAdapter.asBlockVector(event.getBlock().getLocation()),
        createTarget(event.getItem())), false, false)) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(ignoreCancelled = true)
public void onPlayerDropItem(PlayerDropItemEvent event) {
  ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
  WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(event.getPlayer().getWorld()));
  if (wcfg.getBlacklist() != null) {
    Item ci = event.getItemDrop();
    if (!wcfg.getBlacklist().check(
        new ItemDropBlacklistEvent(getPlugin().wrapPlayer(event.getPlayer()),
            BukkitAdapter.asBlockVector(ci.getLocation()), createTarget(ci.getItemStack())), false, false)) {
      event.setCancelled(true);
    }
  }
}

代码示例来源:origin: EngineHub/WorldGuard

@EventHandler(ignoreCancelled = true)
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
  Player player = event.getPlayer();
  Inventory inventory = player.getInventory();
  ItemStack item = inventory.getItem(event.getNewSlot());
  if (item != null) {
    ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(BukkitAdapter.adapt(player.getWorld()));
    LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
    if (wcfg.getBlacklist() != null && !wcfg.getBlacklist().check(
        new ItemAcquireBlacklistEvent(localPlayer, BukkitAdapter.asBlockVector(player.getLocation()), createTarget(item)), false, false)) {
      inventory.setItem(event.getNewSlot(), null);
    }
  }
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com