private Inventory getFuelInventory(Player player) { if (isValidFuelJacket(player.getInventory().getChestplate())) { FileConfiguration fuelConfig = getFuelConfig(player); Material jacket = player.getInventory().getChestplate().getType(); int jacketSize = getFuelJacketSize(jacket); String jacketType = getFuelJacketConfigString(jacket); if (fuelConfig.get(jacketType) != null) { Inventory fuelInventory; ArrayList<ItemStack> itemStack = new ArrayList<>(); itemStack.addAll( fuelConfig .getList(jacketType) .stream() .map(fuelCurrentItem -> (ItemStack) fuelCurrentItem) .collect(Collectors.toList())); fuelInventory = Bukkit.createInventory( player, jacketSize, "" + ChatColor.DARK_RED + ChatColor.BOLD + "Rocket Boot Fuel Jacket"); fuelInventory.setContents(itemStack.toArray(new ItemStack[itemStack.size()])); return fuelInventory; } } return null; }
public void reloadFlyZones(boolean showMessage) { RocketInit.rocketZoneLocations.clear(); List<String> zoneList = RocketInit.getPlugin().getConfig().getStringList("zones"); if (zoneList.size() > 0) { for (String zone : zoneList) { String[] zoneSection = zone.split("\\|"); final Location zoneLocationStart = new Location( Bukkit.getWorld(zoneSection[1]), Integer.parseInt(zoneSection[2]) - 25, Integer.parseInt(zoneSection[3]) - 5, Integer.parseInt(zoneSection[4]) - 25); final Location zoneLocationEnd = new Location( Bukkit.getWorld(zoneSection[1]), Integer.parseInt(zoneSection[2]) + 25, Integer.parseInt(zoneSection[3]) + 50, Integer.parseInt(zoneSection[4]) + 25); RocketInit.rocketZoneLocations.put( UUID.fromString(zoneSection[0]), new ConcurrentHashMap<Location, Location>() { { put(zoneLocationStart, zoneLocationEnd); } }); } if (showMessage) RocketInit.registerMap.put("zone", zoneList.size()); } }
public void disableRocketBoots( Player player, Boolean keepUsage, Boolean keepPower, Boolean keepFlight, Boolean keepVariant, Boolean keepEnhancement) { UUID playerUUID = player.getUniqueId(); if (!keepUsage && RocketInit.rocketUsage.contains(playerUUID)) RocketInit.rocketUsage.remove(playerUUID); if (RocketInit.rocketSprint.containsKey(playerUUID)) RocketInit.rocketSprint.remove(playerUUID); if (!keepPower && RocketInit.rocketPower.containsKey(playerUUID)) RocketInit.rocketPower.remove(playerUUID); if (!RocketInit.rocketFire.isEmpty()) RocketInit.rocketFire.clear(); if (RocketInit.rocketWater.contains(playerUUID)) RocketInit.rocketWater.remove(playerUUID); if (RocketInit.rocketRepair.containsKey(playerUUID)) RocketInit.rocketRepair.remove(playerUUID); if (!keepEnhancement && RocketInit.rocketEnhancement.containsKey(playerUUID)) RocketInit.rocketEnhancement.remove(playerUUID); if (!keepVariant && RocketInit.rocketVariant.containsKey(playerUUID)) { switch (RocketInit.rocketVariant.get(playerUUID)) { case ENDER: player.removePotionEffect(PotionEffectType.NIGHT_VISION); player.removePotionEffect(PotionEffectType.HEALTH_BOOST); break; case ZERO: player.removePotionEffect(PotionEffectType.CONFUSION); player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE); break; case STEALTH: for (Player onlinePlayer : Bukkit.getOnlinePlayers()) onlinePlayer.showPlayer(player); break; case DRUNK: player.removePotionEffect(PotionEffectType.CONFUSION); player.removePotionEffect(PotionEffectType.FAST_DIGGING); break; case BOOST: player.removePotionEffect(PotionEffectType.HEAL); break; case RUNNER: player.removePotionEffect(PotionEffectType.SPEED); break; } RocketInit.rocketVariant.remove(playerUUID); } if (player.isOnline() && gamemodeCheck.check(player, GameMode.SURVIVAL, GameMode.ADVENTURE)) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) onlinePlayer.showPlayer(player); player.setFlySpeed(0.1f); player.setFlying(false); if (!keepFlight) player.setAllowFlight(false); player.setNoDamageTicks(100); player.setFallDistance(0); } }