示例#1
0
 private boolean canGetItem(Player sender) {
   if (General.plugin.permissions.hasPermission(sender, "general.give.any")) return true;
   ConfigurationNode permissions = General.plugin.config.getNode("give");
   if (permissions == null) return true;
   List<String> groups = permissions.getKeys("groups");
   if (groups == null) return true;
   for (String group : groups) {
     List<Integer> items = permissions.getIntList("groups." + group, null);
     if (items.isEmpty()) continue;
     if (items.contains(item.getId())) {
       return General.plugin.permissions.hasPermission(sender, "general.give.group." + group);
     }
   }
   return permissions.getBoolean("others-for-all", true);
 }
  public static EntityModifier fromConfiguration(
      ConfigurationNode configuration, int groupSize, Plugin plugin) {
    if (configuration == null) {
      OmnistacheSC.logger.info("EntityModifier configuration null, no modification will occur.");
      return null;
    }

    int damage = configuration.getInt("damage", -1);
    int health = configuration.getInt("health", -1);
    boolean immuneToSunlight = configuration.getBoolean("immuneToSunlight", false);

    // default is unchanging, just return null
    if (damage == -1 && health == -1 && immuneToSunlight == false) {
      OmnistacheSC.logger.info("EntityModifier configuration was default");
      return null;
    }

    EntityModifier entityModifier =
        new EntityModifier(plugin, health, damage, groupSize, immuneToSunlight);
    return entityModifier;
  }