private void inGameInteractEntity(PlayerInteractEntityEvent iee, Game game, Player player) {

    if (iee.getPlayer().getItemInHand().getType().equals(Material.MONSTER_EGG)
        || iee.getPlayer().getItemInHand().getType().equals(Material.MONSTER_EGGS)
        || iee.getPlayer().getItemInHand().getType().equals(Material.DRAGON_EGG)) {
      iee.setCancelled(true);
      return;
    }

    if (iee.getRightClicked() != null) {
      if (!iee.getRightClicked().getType().equals(EntityType.VILLAGER)) {
        List<EntityType> preventClickTypes = Arrays.asList(EntityType.ITEM_FRAME);

        // armor stand in 1.8
        try {
          preventClickTypes.add(EntityType.valueOf("ARMOR_STAND"));
        } catch (Exception ex) {
          // nothing will happen, just not supported
        }

        if (preventClickTypes.contains(iee.getRightClicked().getType())) {
          iee.setCancelled(true);
        }

        return;
      }
    }

    iee.setCancelled(true);

    if (game.isSpectator(player)) {
      return;
    }

    BedwarsOpenShopEvent openShopEvent =
        new BedwarsOpenShopEvent(game, player, game.getItemShopCategories(), iee.getRightClicked());
    Main.getInstance().getServer().getPluginManager().callEvent(openShopEvent);

    if (openShopEvent.isCancelled()) {
      return;
    }

    if (game.isUsingOldShop(player)) {
      MerchantCategory.openCategorySelection(player, game);
    } else {
      NewItemShop itemShop = game.getNewItemShop(player);
      if (itemShop == null) {
        itemShop = game.openNewItemShop(player);
      }

      itemShop.setCurrentCategory(null);
      itemShop.openCategoryInventory(player);
    }
  }
Esempio n. 2
0
 @Override
 public void loadSettings(FileConfiguration config) {
   ConfigurationSection sectionE = config.getConfigurationSection("Skills.Weaponry.Entities");
   ConfigurationSection section = config.getConfigurationSection("Skills.Weaponry");
   if (sectionE.getKeys(false) != null) {
     for (String s : sectionE.getKeys(false)) {
       if (EntityType.valueOf(s.toUpperCase()) != null) {
         EntityType type = EntityType.valueOf(s.toUpperCase());
         Double val = sectionE.getDouble(s);
         entities.put(type, val);
       }
     }
   }
   if (section.getStringList("Weapons") != null) {
     for (String s : section.getStringList("Weapons")) {
       if (Material.valueOf(s.toUpperCase()) != null) {
         Material type = Material.valueOf(s.toUpperCase());
         weapons.add(type);
       }
     }
   }
 }
  private static Map<EntityType, Double> convertToDropMap(List<String> toParse) {
    Map<EntityType, Double> parsed = new HashMap<EntityType, Double>();
    for (String line : toParse) {
      String[] split = line.split(Pattern.quote(";"));
      if (split.length != 2) continue;

      try {
        EntityType type = EntityType.valueOf(split[0].replace(" ", "_").toUpperCase());
        double percent = Double.parseDouble(split[1]);

        parsed.put(type, percent);
      } catch (Throwable exp) {
      }
    }

    return parsed;
  }
Esempio n. 4
0
 public SpawnMobEvent(String packName, String instructions) throws InstructionParseException {
   super(packName, instructions);
   staticness = true;
   String[] parts = instructions.split(" ");
   if (parts.length < 4) {
     throw new InstructionParseException("Not enough arguments");
   }
   String[] coords = parts[1].split(";");
   if (coords.length < 4) {
     throw new InstructionParseException("Wrong location format");
   }
   World world = Bukkit.getWorld(coords[3]);
   if (world == null) {
     throw new InstructionParseException("World does not exist");
   }
   double x, y, z;
   try {
     x = Double.parseDouble(coords[0]);
     y = Double.parseDouble(coords[1]);
     z = Double.parseDouble(coords[2]);
   } catch (NumberFormatException e) {
     throw new InstructionParseException("Could not parse coordinates");
   }
   loc = new Location(world, x, y, z);
   try {
     type = EntityType.valueOf(parts[2].toUpperCase());
   } catch (IllegalArgumentException e) {
     throw new InstructionParseException("Entity type does not exist");
   }
   try {
     amount = Integer.parseInt(parts[3]);
   } catch (NumberFormatException e) {
     throw new InstructionParseException("Could not parse amount");
   }
   String tempName = null;
   for (String part : parts) {
     if (part.startsWith("name:")) {
       tempName = part.substring(5).replace("_", " ");
       break;
     }
   }
   name = tempName;
 }
  @Override
  public void prepare(CastContext context, ConfigurationSection parameters) {
    super.prepare(context, parameters);

    doVelocity = parameters.getBoolean("apply_velocity", true);
    doTeleport = parameters.getBoolean("teleport", true);
    noTarget = parameters.getBoolean("no_target", true);
    orient = parameters.getBoolean("orient", true);
    velocityOffset = ConfigurationUtils.getVector(parameters, "velocity_offset");
    locationOffset = ConfigurationUtils.getVector(parameters, "location_offset");

    try {
      String entityTypeName = parameters.getString("type", "");
      if (!entityTypeName.isEmpty()) {
        entityType = EntityType.valueOf(entityTypeName.toUpperCase());
      }
    } catch (Exception ex) {
      entityType = null;
    }

    if (parameters.contains("spawn_reason")) {
      String reasonText = parameters.getString("spawn_reason").toUpperCase();
      try {
        spawnReason = CreatureSpawnEvent.SpawnReason.valueOf(reasonText);
      } catch (Exception ex) {
        context.getMage().sendMessage("Unknown spawn reason: " + reasonText);
      }
    }

    customName = parameters.getString("name");
    isBaby = parameters.getBoolean("baby", false);
    variantName = parameters.getString("variant");
    if (variantName != null && variantName.isEmpty()) {
      variantName = null;
    }
  }
  @Override
  public void onBuild(List<String> args) {
    for (String arg : args) {
      if (aH.matchesValueArg("TYPE", arg, ArgumentType.Custom)) {
        try {
          type = ItemDropType.valueOf(aH.getStringFrom(arg).toUpperCase());
          dB.echoDebug("...type set to: " + type.name());
          continue;
        } catch (Exception e) {
          dB.echoDebug("...type " + aH.getStringFrom(arg) + " is not valid.");
        }

      } else if (aH.matchesItem(arg)) {
        item = aH.getItemFrom(arg).getItemStack();
        dB.echoDebug("...item set to: " + item);
        continue;

      } else if (aH.matchesValueArg("REGION", arg, ArgumentType.Custom)) {
        region = aH.getStringFrom(arg);
        dB.echoDebug("...region set to: " + region);
        continue;

      } else if (aH.matchesLocation(arg)) {
        location = aH.getLocationFrom(arg);
        dB.echoDebug("...location set to: " + location);
        continue;

      } else if (aH.matchesValueArg("RADIUS", arg, ArgumentType.Integer)) {
        radius = aH.getIntegerFrom(arg);
        dB.echoDebug("...radius set to: " + radius);
        continue;

      } else if (aH.matchesValueArg("DROPRATE", arg, ArgumentType.Integer)) {
        dropRate = aH.getIntegerFrom(arg);
        dB.echoDebug("...drop rate set to: " + dropRate + "/100");
        continue;

      } else if (aH.matchesValueArg("DROPSFROM", arg, ArgumentType.Custom)) {
        dropper = aH.getStringFrom(arg);
        dB.echoDebug("...dropper set to: " + dropper);
        continue;

      } else if (aH.matchesQuantity(arg)) {
        quantity = aH.getIntegerFrom(arg);
        dB.echoDebug("...quantity set to: " + quantity);
        continue;
      }
    }

    if (item == null) {
      dB.echoDebug("...item could not be set");
      cancel();
    }

    switch (type) {
      case BLOCKPLACE:

      case BLOCKBREAK:
        try {
          block = Material.valueOf(dropper);
          dB.echoDebug("...DROPSFROM material set");
        } catch (Exception e) {
          dB.echoDebug("...DROPSFROM is not a valid material");
        }
        break;

      case MOBKILL:
        if (aH.matchesEntityType("entity:" + dropper)) {
          mob = EntityType.valueOf(dropper.toUpperCase());
          dB.echoDebug("...mob selected from DROPSFROM");
        } else dB.echoDebug("...could not select mob from DROPSFROM");
        break;

      default:
        dB.echoDebug("...error setting type");
        cancel();
        break;
    }
  }
Esempio n. 7
0
  @Override
  public boolean onCommand(CommandSender sender, Command command, String name, String[] args) {
    switch (command.getName().toLowerCase()) {
      case "spawn":
        if (sender instanceof Player) {
          ((Player) sender).teleport(config.spawn.LOCATION);
          sender.sendMessage(ChatColor.RED + "Wooosh!");
        } else {
          sender.sendMessage(ChatColor.RED + "Only usable by players, sorry!");
        }

        break;
      case "o3-reload":
        config.reload();
        sender.sendMessage(String.format("%sDone.", ChatColor.RED));
        break;
      case "world":
        if (args.length == 0) return false;
        if (!(args.length == 4 || args.length == 1)) return false;
        if (!(sender instanceof Player)) {
          sender.sendMessage("Only usable by players");
          return false;
        }
        World world = getServer().getWorld(args[0]);
        if (world == null) {
          sender.sendMessage(
              "This world doesn't exist. Try 'world', 'world_nether', or 'world_the_end'");
          return true;
        }

        if (args.length == 4) {
          ((Player) sender)
              .teleport(
                  new Location(
                      world,
                      Double.parseDouble(args[1]),
                      Double.parseDouble(args[2]),
                      Double.parseDouble(args[3])));
        } else {
          ((Player) sender).teleport(world.getSpawnLocation());
        }
        break;
      case "coords":
        if (sender instanceof Player) {
          Location loc = ((Player) sender).getLocation();
          sender.sendMessage(
              String.format(
                  "%sx: %d %sy: %d %sz: %d",
                  ChatColor.RED,
                  loc.getBlockX(),
                  ChatColor.BLUE,
                  loc.getBlockY(),
                  ChatColor.AQUA,
                  loc.getBlockZ()));
        } else {
          sender.sendMessage(
              String.format("%sThis command is only usable by players", ChatColor.RED));
        }
        break;
      case "item":
        if (sender instanceof Player) {
          Player player = (Player) sender;
          if (args.length < 1 || args.length > 2) return false;
          String blockID = "";
          String blockData = "";
          String amount = "64";
          if (args[0].contains(":")) {
            String[] temp = args[0].split(":");
            blockID = temp[0];
            blockData = temp[1];
          } else {
            blockID = args[0];
          }

          if (args.length == 2) {
            amount = args[1];
          }

          getServer()
              .dispatchCommand(
                  player,
                  String.format("give %s %s %s %s", player.getName(), blockID, amount, blockData));

        } else {
          sender.sendMessage(
              String.format("%sThis command is only usable by players", ChatColor.RED));
        }
        break;
      case "staffchest":
        getServer().dispatchCommand(sender, "cmodify g:base_assistance");
        break;
      case "unstaff":
        getServer().dispatchCommand(sender, "cmodify -g:base_assistance");
        break;
      case "trace":
        if (args.length < 1 || args.length > 2) {
          return false;
        } else if (args.length == 1) {
          getServer()
              .dispatchCommand(
                  sender,
                  String.format(
                      "lb lookup player %s sum blocks block 1 block 56 block 14 block 129",
                      args[0]));
        } else if (args.length == 2) {
          getServer()
              .dispatchCommand(
                  sender,
                  String.format(
                      "lb lookup player %s sum blocks block 1 block 56 block 14 block 129 since %s days",
                      args[0], args[1]));
        }
        break;
      case "tppos":
        if (args.length == 4) {
          getServer()
              .dispatchCommand(
                  sender, String.format("world %s %s %s %s", args[0], args[1], args[2], args[3]));
        } else if (args.length == 3) {
          getServer()
              .dispatchCommand(sender, String.format("tp %s %s %s", args[0], args[1], args[2]));
        } else {
          return false;
        }
        break;
      case "entity-magnet":
        if (args.length != 2) {
          return false;
        } else {
          if (sender instanceof Player) {

            Player player = (Player) sender;
            EntityType entityType = null;
            try {
              entityType = EntityType.valueOf(args[0].toUpperCase());
            } catch (Exception e) {
              player.sendMessage("Entity type does not exist");
              return true;
            }
            double range = 0;
            if (range > 50) {
              sender.sendMessage(
                  "You don't have enough power! Entity magnet only works up to 50 blocks away.");
              return true;
            }

            if (blockedEntities.contains(entityType)) {
              sender.sendMessage("Magnet doesn't work on this block :(");
              return true;
            }

            try {
              range = Double.parseDouble(args[1]) / 2;
            } catch (Exception e) {
              player.sendMessage("Invalid range");
              return true;
            }

            for (Entity e : player.getNearbyEntities(range, range, range)) {
              if (e.getType().equals(entityType)) {
                e.teleport(player);
              }
            }
          }
        }
        break;
      case "swap-player":
        if (args.length != 2) {
          return false;
        }
        Player p = getServer().getPlayer(args[0]);
        bungeePluginChannel = new DataOutputStream(new ByteArrayOutputStream());
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(b);
        try {
          out.writeUTF("Connect");
          out.writeUTF(args[1]);
          p.sendPluginMessage(this, "BungeeCord", b.toByteArray());
        } catch (Exception e) {
          e.printStackTrace();
        }
        break;
      case "give-pet":
        if (sender instanceof Player) {
          Player player = (Player) sender;
          if (args.length == 1) {
            if (getServer().getPlayer(args[0]) != null) {
              player.setMetadata("give-pet", new FixedMetadataValue(this, args[0]));
              player.sendMessage(
                  "Right click the pet you want to give away. This cannot be undone");
            } else {
              player.sendMessage("This player is not online");
            }
          } else {
            return false;
          }
        }
        break;
      case "thor":
        if (args.length == 1) {
          Player player = getServer().getPlayer(args[0]);
          if (player == null) return false;

          player.getWorld().strikeLightning(player.getLocation());
          player.setHealth(0);
          sender.sendMessage(
              String.format(
                  "%sThou hast smote the evil player %s with thy mighty hand.",
                  ChatColor.LIGHT_PURPLE, player.getDisplayName()));
          player.sendMessage(
              String.format("%sYou have been smote by Thor's Hammer!", ChatColor.RED));
          getServer()
              .dispatchCommand(
                  sender,
                  String.format(
                      "transmission:staffchat I have smitten %s", player.getDisplayName()));

        } else {
          return false;
        }
        break;
      case "lsd":
        for (int j = 0; j < 10; j++) {
          StringBuilder lsd = new StringBuilder();
          for (int i = 0; i < 40; i++) {

            lsd.append(colors.get(rand.nextInt(colors.size())));
            lsd.append(ChatColor.MAGIC);
            lsd.append('x');
          }
          sender.sendMessage(String.format("%s%s", ChatColor.MAGIC, lsd.toString()));
        }

        if (sender instanceof Player) {
          Player player = (Player) sender;
          player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 600, 1));
        }

        break;
    }
    return true;
  }
 public EntityFilterParser(final Element element) {
   super(element);
   this.entityType = EntityType.valueOf(element.getText().toUpperCase().replace(" ", "_"));
 }
  @EventHandler(priority = EventPriority.HIGH)
  public void onInteractEntity(PlayerInteractEntityEvent event) {
    if (event.getRightClicked() == null) {
      return;
    }

    Entity entity = event.getRightClicked();
    Player player = event.getPlayer();
    if (!player.hasMetadata("bw-addteamjoin")) {
      if (!(entity instanceof LivingEntity)) {
        return;
      }

      LivingEntity livEntity = (LivingEntity) entity;
      Game game = Main.getInstance().getGameManager().getGameOfPlayer(player);
      if (game == null) {
        return;
      }

      if (game.getState() != GameState.WAITING) {
        return;
      }

      Team team = game.getTeam(ChatColor.stripColor(livEntity.getCustomName()));
      if (team == null) {
        return;
      }

      game.playerJoinTeam(player, team);
      event.setCancelled(true);
      return;
    }

    List<MetadataValue> values = player.getMetadata("bw-addteamjoin");
    if (values == null || values.size() == 0) {
      return;
    }

    event.setCancelled(true);
    TeamJoinMetaDataValue value = (TeamJoinMetaDataValue) values.get(0);
    if (!((boolean) value.value())) {
      return;
    }

    if (!(entity instanceof LivingEntity)) {
      player.sendMessage(
          ChatWriter.pluginMessage(ChatColor.RED + Main._l("errors.entitynotcompatible")));
      return;
    }

    LivingEntity living = (LivingEntity) entity;
    living.setRemoveWhenFarAway(false);
    living.setCanPickupItems(false);
    living.setCustomName(value.getTeam().getChatColor() + value.getTeam().getDisplayName());
    living.setCustomNameVisible(
        Main.getInstance().getBooleanConfig("jointeam-entity.show-name", true));

    if (Utils.isSupportingTitles()) {
      if (living.getType().equals(EntityType.valueOf("ARMOR_STAND"))) {
        Utils.equipArmorStand(living, value.getTeam());
      }
    }

    player.removeMetadata("bw-addteamjoin", Main.getInstance());
    player.sendMessage(
        ChatWriter.pluginMessage(
            ChatColor.GREEN
                + Main._l(
                    "success.teamjoinadded",
                    ImmutableMap.of(
                        "team",
                        value.getTeam().getChatColor()
                            + value.getTeam().getDisplayName()
                            + ChatColor.GREEN))));
  }
Esempio n. 10
0
  @Override
  public SpellResult perform(CastContext context) {
    Block targetBlock = context.getTargetBlock();
    Entity currentEntity = current == null ? null : current.get();
    current = null;
    if (currentEntity != null) {
      currentEntity.remove();
    }

    targetBlock = targetBlock.getRelative(BlockFace.UP);

    Location spawnLocation = targetBlock.getLocation();
    Location sourceLocation = context.getLocation();
    spawnLocation.setPitch(sourceLocation.getPitch());
    spawnLocation.setYaw(sourceLocation.getYaw());

    MageController controller = context.getController();
    if (entityData == null) {
      String randomType = RandomUtils.weightedRandom(entityTypeProbability);
      try {
        entityData = controller.getMob(randomType);
        if (entityData == null) {
          entityData =
              new com.elmakers.mine.bukkit.entity.EntityData(
                  EntityType.valueOf(randomType.toUpperCase()));
        }
      } catch (Throwable ex) {
        entityData = null;
      }
    }
    if (entityData == null) {
      return SpellResult.FAIL;
    }

    if (force) {
      controller.setForceSpawn(true);
    }
    Entity spawnedEntity = null;
    try {
      spawnedEntity = entityData.spawn(context.getController(), spawnLocation, spawnReason);
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    if (force) {
      controller.setForceSpawn(false);
    }

    if (spawnedEntity == null) {
      return SpellResult.FAIL;
    }

    if (!loot) {
      spawnedEntity.setMetadata("nodrops", new FixedMetadataValue(controller.getPlugin(), true));
    }
    if (speed > 0) {
      Vector motion = direction;
      if (motion == null) {
        motion = context.getDirection();
      } else {
        motion = motion.clone();
      }

      if (dyOffset != 0) {
        motion.setY(motion.getY() + dyOffset);
      }
      motion.normalize();
      motion.multiply(speed);
      CompatibilityUtils.setEntityMotion(spawnedEntity, motion);
    }

    Collection<EffectPlayer> projectileEffects = context.getEffects("spawned");
    for (EffectPlayer effectPlayer : projectileEffects) {
      effectPlayer.start(spawnedEntity.getLocation(), spawnedEntity, null, null);
    }
    context.registerForUndo(spawnedEntity);

    if (track) {
      current = new WeakReference<Entity>(spawnedEntity);
    }
    if (setTarget) {
      context.setTargetEntity(spawnedEntity);
    }
    return SpellResult.CAST;
  }
  /*
   * (non-Javadoc)
   * @see de.oppermann.bastian.spleef.util.command.AbstractArgument#executeForPlayer(org.bukkit.entity.Player, org.bukkit.command.Command, java.lang.String[])
   */
  @Override
  public CommandResult executeForPlayer(Player player, Command cmd, String[] args) {
    if (args.length == 4) {

      if (!player.hasPermission(getPermission())) {
        return CommandResult.NO_PERMISSION;
      }

      SpleefArena arena = null;
      for (SpleefArena sArena : SpleefArena.getSpleefArenas()) {
        if (sArena.getName().equals(args[1])) {
          arena = sArena;
          break;
        }
      }

      if (arena == null) {
        player.sendMessage(Language.NO_ARENA_WITH_NAME.toString().replace("%arena%", args[1]));
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_ENABLED.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_ENABLED.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setDisabled(!enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("enabled", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_SNOWBALLS_ENABLED.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_ENABLED.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setEnableSnowballs(enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("snowballs.enabled", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_MAX_SNOWBALLS.toString())) {
        int maxSnowballs;
        try {
          maxSnowballs = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_ENABLED.toString())
                .replace("%value%", String.valueOf(maxSnowballs)));

        arena.getConfiguration().setMaxSnowballs(maxSnowballs);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("snowballs.maxSnowballs", maxSnowballs);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_MODE.toString())) {
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_NORMAL.toString())) {
          arena.getConfiguration().setMode(SpleefMode.NORMAL);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_NORMAL.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_BOWSPLEEF.toString())) {
          arena.getConfiguration().setMode(SpleefMode.BOWSPLEEF);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_BOWSPLEEF.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_SPLEGG.toString())) {
          arena.getConfiguration().setMode(SpleefMode.SPLEGG);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_SPLEGG.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_SPLEEF_RUN.toString())) {
          arena.getConfiguration().setMode(SpleefMode.SPLEEF_RUN);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_SPLEEF_RUN.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_SUPER_SPLEEF.toString())) {
          arena.getConfiguration().setMode(SpleefMode.SUPER_SPLEEF);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_SUPER_SPLEEF.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        if (args[3].equalsIgnoreCase(Language.VALUE_MODE_SUPER_SPLEGG.toString())) {
          arena.getConfiguration().setMode(SpleefMode.SUPER_SPLEGG);
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_MODE.toString())
                  .replace("%value%", Language.VALUE_MODE_SUPER_SPLEGG.toString()));
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("mode", arena.getConfiguration().getMode().name().toLowerCase());
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          return CommandResult.SUCCESS;
        }
        player.sendMessage(Language.UNKNOWN_MODE.toString());
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_CUSTOMINVENTORY_ENABLED.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_CUSTOMINVENTORY_ENABLED.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setCustomInventory(enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("customInventory.enabled", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_VEHICLE.toString())) {
        if (args[3].equalsIgnoreCase("none")) {
          arena.getConfiguration().setVehicle(null);
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("vehicle", "none");
          SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
          player.sendMessage(
              Language.SUCCESSFULLY_SET_VALUE
                  .toString()
                  .replace("%flag%", Language.FLAG_VEHICLE.toString())
                  .replace("%value%", "none"));
          return CommandResult.SUCCESS;
        }
        EntityType type;
        try {
          type = EntityType.valueOf(args[3].toUpperCase());
        } catch (IllegalArgumentException e) {
          player.sendMessage(Language.UNKNOWN_ENTITY.toString());
          return CommandResult.SUCCESS;
        }
        if (!type.isSpawnable()) {
          player.sendMessage(Language.UNKNOWN_ENTITY.toString());
          return CommandResult.SUCCESS;
        }
        /* TODO
        if (!type.getEntityClass().isAssignableFrom(LivingEntity.class)) {
        	player.sendMessage(Language.UNKNOWN_ENTITY.toString());
        	return CommandResult.SUCCESS;
        }
        */
        arena.getConfiguration().setVehicle(type);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("vehicle", type.name().toLowerCase());
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_VEHICLE.toString())
                .replace("%value%", type.name().toLowerCase()));
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_INSTANT_BLOCK_DESTORY.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_INSTANT_BLOCK_DESTORY.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setInstanstBlockDestroy(enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("instantBlockDestroy", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_REWARD_MONEY_PARTICIPATION.toString())) {
        int reward;
        try {
          reward = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_REWARD_MONEY_PARTICIPATION.toString())
                .replace("%value%", String.valueOf(reward)));

        arena.getConfiguration().setMoneyParticipationReward(reward);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("reward.money.participation", reward);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_REWARD_MONEY_WINNING.toString())) {
        int reward;
        try {
          reward = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_REWARD_MONEY_WINNING.toString())
                .replace("%value%", String.valueOf(reward)));

        arena.getConfiguration().setMoneyWinningReward(reward);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("reward.money.winning", reward);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_REWARD_POINTS_PARTICIPATION.toString())) {
        int reward;
        try {
          reward = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_REWARD_POINTS_PARTICIPATION.toString())
                .replace("%value%", String.valueOf(reward)));

        arena.getConfiguration().setPointsParticipationReward(reward);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("reward.points.participation", reward);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_REWARD_POINTS_WINNING.toString())) {
        int reward;
        try {
          reward = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_REWARD_POINTS_WINNING.toString())
                .replace("%value%", String.valueOf(reward)));

        arena.getConfiguration().setPointsWinningReward(reward);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("reward.points.winning", reward);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_FREEZE_PLAYERS.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_FREEZE_PLAYERS.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setFreezePlayers(enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("freezePlayers", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_MODIFY_GRAVITY.toString())) {
        boolean enabled = args[3].equalsIgnoreCase(Language.VALUE_TRUE.toString());
        String strValue =
            enabled ? Language.VALUE_TRUE.toString() : Language.VALUE_FALSE.toString();
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_MODIFY_GRAVITY.toString())
                .replace("%value%", strValue));

        arena.getConfiguration().setModifyGravity(enabled);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("modifygravity.enable", enabled);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_GRAVITY.toString())) {
        double gravity;
        try {
          gravity = Double.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER_BETWEEN_0_AND_1.toString());
          return CommandResult.SUCCESS;
        }
        if (gravity <= 0 || gravity >= 1) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER_BETWEEN_0_AND_1.toString());
          return CommandResult.SUCCESS;
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_GRAVITY.toString())
                .replace("%value%", String.valueOf(gravity)));

        arena.getConfiguration().setGravity(gravity);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("modifygravity.gravity", gravity);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_MIN_PLAYERS.toString())) {
        int minPlayers;
        try {
          minPlayers = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }

        minPlayers = minPlayers < 2 ? 2 : minPlayers; // must be at least 2
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_MIN_PLAYERS.toString())
                .replace("%value%", String.valueOf(minPlayers)));

        arena.getConfiguration().setMinPlayers(minPlayers);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("minPlayers", minPlayers);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_REQUIRED_PLAYERS_TO_START_COUNTDOWN.toString())) {
        int requiredPlayersToStartCountdown;
        try {
          requiredPlayersToStartCountdown = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }

        requiredPlayersToStartCountdown =
            requiredPlayersToStartCountdown < 2
                ? 2
                : requiredPlayersToStartCountdown; // must be at least 2
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_REQUIRED_PLAYERS_TO_START_COUNTDOWN.toString())
                .replace("%value%", String.valueOf(requiredPlayersToStartCountdown)));

        arena.getConfiguration().setMinPlayers(requiredPlayersToStartCountdown);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("requiredPlayersToStartCountdown", requiredPlayersToStartCountdown);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_SPECTATE_TYPE.toString())) {

        SpectateType spectateType = SpectateType.NONE;
        String spectateTypeName = Language.SPECTATE_TYPE_NONE.toString();
        if (args[3].equalsIgnoreCase(Language.SPECTATE_TYPE_NORMAL.toString())) {
          spectateType = SpectateType.NORMAL;
          spectateTypeName = Language.SPECTATE_TYPE_NORMAL.toString();
        }
        if (args[3].equalsIgnoreCase(Language.SPECTATE_TYPE_NORMAL_FLYING.toString())) {
          spectateType = SpectateType.NORMAL_FLYING;
          spectateTypeName = Language.SPECTATE_TYPE_NORMAL_FLYING.toString();
        }
        if (args[3].equalsIgnoreCase(Language.SPECTATE_TYPE_GAMEMODE_3.toString())) {
          spectateType = SpectateType.GAMEMODE_3;
          spectateTypeName = Language.SPECTATE_TYPE_GAMEMODE_3.toString();
        }
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_SPECTATE_TYPE.toString())
                .replace("%value%", spectateTypeName));

        arena.getConfiguration().setSpectateType(spectateType);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateType", spectateType.name().toLowerCase());
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_ARENA_COUNTDOWN.toString())) {
        int arenaCountdown;
        try {
          arenaCountdown = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }

        arenaCountdown = arenaCountdown < 0 ? 0 : arenaCountdown; // must be at least 0
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_ARENA_COUNTDOWN.toString())
                .replace("%value%", String.valueOf(arenaCountdown)));

        arena.getConfiguration().setArenaCountdown(arenaCountdown);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("arenaCountdown", arenaCountdown);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_LOBBY_COUNTDOWN.toString())) {
        int lobbyCountdown;
        try {
          lobbyCountdown = Integer.valueOf(args[3]);
        } catch (NumberFormatException e) {
          player.sendMessage(Language.VALUE_MUST_BE_A_NUMBER.toString());
          return CommandResult.SUCCESS;
        }

        lobbyCountdown = lobbyCountdown < 5 ? 5 : lobbyCountdown; // must be at least 5
        player.sendMessage(
            Language.SUCCESSFULLY_SET_VALUE
                .toString()
                .replace("%flag%", Language.FLAG_LOBBY_COUNTDOWN.toString())
                .replace("%value%", String.valueOf(lobbyCountdown)));

        arena.getConfiguration().setLobbyCountdown(lobbyCountdown);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("lobbyCountdown", lobbyCountdown);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        return CommandResult.SUCCESS;
      }

      player.sendMessage(Language.UNKNOWN_FLAG.toString().replace("%flag%", args[2]));
      return CommandResult.SUCCESS;
    }

    // flags without arguments
    if (args.length == 3) {
      if (!player.hasPermission(getPermission())) {
        return CommandResult.NO_PERMISSION;
      }

      SpleefArena arena = null;
      for (SpleefArena sArena : SpleefArena.getSpleefArenas()) {
        if (sArena.getName().equals(args[1])) {
          arena = sArena;
          break;
        }
      }

      if (arena == null) {
        player.sendMessage(Language.NO_ARENA_WITH_NAME.toString().replace("%arena%", args[1]));
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_CUSTOMINVENTORY.toString())) {
        ItemStack[] contents = player.getInventory().getContents();
        for (int i = 0; i < contents.length; i++) {
          SpleefMain.getInstance()
              .getArenaAccessor(arena.getName())
              .getConfig()
              .set("customInventory.items." + i, contents[i]);
        }

        arena.getConfiguration().setCustomInventoryContents(contents);
        arena.getConfiguration().setCustomInventory(true);
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("customInventory.enabled", true);
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        player.sendMessage(Language.SUCCESSFULLY_SET_CUSTOMINVENTORY.toString());
        return CommandResult.SUCCESS;
      }

      if (args[2].equalsIgnoreCase(Language.FLAG_SPECTATE_LOCATION.toString())) {
        arena.getConfiguration().setSpectateLocation(player.getLocation());

        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateLocation.x", player.getLocation().getX());
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateLocation.y", player.getLocation().getY());
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateLocation.z", player.getLocation().getZ());
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateLocation.yaw", player.getLocation().getYaw());
        SpleefMain.getInstance()
            .getArenaAccessor(arena.getName())
            .getConfig()
            .set("spectateLocation.pitch", player.getLocation().getPitch());
        SpleefMain.getInstance().getArenaAccessor(arena.getName()).saveConfig();
        player.sendMessage(Language.SUCCESSFULLY_SET_SPECTATE_LOCATION.toString());
        return CommandResult.SUCCESS;
      }
    }
    return CommandResult.ERROR;
  }
  private Object getMaterialKey(String materialName) {
    boolean isMat = false, isTree = false, isEntity = false;
    // test to see if the material has a "type" specifier, record the specifier and remover it
    if (materialName.startsWith("mat_")) {
      materialName = materialName.replaceFirst("mat\\_", "");
      isMat = true;
    } else if (materialName.startsWith("tree_")) {
      materialName = materialName.replaceFirst("tree\\_", "");
      isTree = true;
    } else if (materialName.startsWith("entity_")) {
      materialName = materialName.replaceFirst("entity\\_", "");
      isEntity = true;
    }

    // match name to bukkit objects
    TreeType treeType;
    try {
      treeType = TreeType.valueOf(materialName);
    } catch (IllegalArgumentException e) {
      treeType = null;
    }

    Material material = Material.getMaterial(materialName);
    EntityType entityType;

    try {
      entityType = EntityType.valueOf(materialName);
    } catch (IllegalArgumentException e) {
      entityType = null;
    }

    // if the type was specifically specified, thenregister only for that type of object
    // warn if that object doesn't actully match anything
    if (isMat) {
      if (material != null) return material;
      LOG.warning("config: \"" + materialName + "\" specified material but does not match one.");
    }
    if (isTree) {
      if (treeType != null) return treeType;
      LOG.warning(
          "config: \"" + materialName + "\" specified tree type name but does not match one.");
    }
    if (isEntity) {
      if (entityType != null) return entityType;
      LOG.warning(
          "config: \"" + materialName + "\" specified entity type name but does not match one.");
    }

    // wanr user if they are unsing an ambiguous name
    if (material != null && entityType != null && treeType != null)
      LOG.warning(
          "config name: \""
              + materialName
              + "\" ambiguous, could be material, tree type, or entity type.");
    if (treeType != null && material != null)
      LOG.warning(
          "config name: \"" + materialName + "\" ambiguous, could be material or tree type.");
    if (material != null && entityType != null)
      LOG.warning(
          "config name: \"" + materialName + "\" ambiguous, could be material or entity type.");
    if (treeType != null && entityType != null)
      LOG.warning(
          "config name: \"" + materialName + "\" ambiguous, could be tree type or entity type.");

    // finally just match any type
    if (material != null) return material;
    if (treeType != null) return treeType;
    if (entityType != null) return entityType;

    return null;
  }