@Override
  public CommandResult executeCommand(CommandSource src, CommandContext args) throws Exception {
    Optional<Player> opl = this.getUser(Player.class, src, player, args);
    if (!opl.isPresent()) {
      return CommandResult.empty();
    }

    Player pl = opl.get();

    InternalQuickStartUser uc = plugin.getUserLoader().getUser(pl);
    boolean fly = args.<Boolean>getOne(toggle).orElse(!uc.isFlying());

    if (!uc.setFlying(fly)) {
      src.sendMessages(Text.of(TextColors.RED, Util.getMessageWithFormat("command.fly.error")));
      return CommandResult.empty();
    }

    if (pl != src) {
      src.sendMessages(
          Text.of(
              TextColors.GREEN,
              MessageFormat.format(
                  Util.getMessageWithFormat(
                      fly ? "command.fly.player.on" : "command.fly.player.off"),
                  pl.getName())));
    }

    pl.sendMessage(
        Text.of(
            TextColors.GREEN,
            Util.getMessageWithFormat(fly ? "command.fly.on" : "command.fly.off")));
    return CommandResult.success();
  }
  @Override
  public CommandResult executeCommand(Player src, CommandContext args) throws Exception {
    // Get the home.
    Optional<WarpLocation> owl = args.<WarpLocation>getOne(home);
    if (!owl.isPresent()) {
      owl = plugin.getUserLoader().getUser(src).getHome("home");

      if (!owl.isPresent()) {
        src.sendMessage(
            Text.of(TextColors.RED, Util.getMessageWithFormat("args.home.nohome", "home")));
        return CommandResult.empty();
      }
    }

    WarpLocation wl = owl.get();

    // Warp to it safely.
    if (src.setLocationAndRotationSafely(wl.getLocation(), wl.getRotation())) {
      src.sendMessage(
          Text.of(
              TextColors.GREEN, Util.getMessageWithFormat("command.home.success", wl.getName())));
      return CommandResult.success();
    } else {
      src.sendMessage(
          Text.of(TextColors.RED, Util.getMessageWithFormat("command.home.fail", wl.getName())));
      return CommandResult.empty();
    }
  }
Exemple #3
0
  @Override
  public CommandResult executeCommand(final CommandSource src, CommandContext args)
      throws Exception {
    if (service == null) {
      service = Sponge.getServiceManager().provideUnchecked(NucleusWarpService.class);
    }

    PaginationService ps = Sponge.getServiceManager().provideUnchecked(PaginationService.class);

    // Get the warp list.
    Set<String> ws = service.getWarpNames();
    if (ws.isEmpty()) {
      src.sendMessage(Util.getTextMessageWithFormat("command.warps.list.nowarps"));
      return CommandResult.empty();
    }

    List<Text> lt =
        ws.stream()
            .filter(s -> canView(src, s.toLowerCase()))
            .map(
                s -> {
                  if (service.getWarp(s).isPresent()) {
                    return Text.builder(s)
                        .color(TextColors.GREEN)
                        .style(TextStyles.UNDERLINE)
                        .onClick(TextActions.runCommand("/warp " + s))
                        .onHover(
                            TextActions.showText(
                                Util.getTextMessageWithFormat("command.warps.warpprompt", s)))
                        .build();
                  } else {
                    return Text.builder(s)
                        .color(TextColors.RED)
                        .onHover(
                            TextActions.showText(
                                Util.getTextMessageWithFormat("command.warps.unavailable")))
                        .build();
                  }
                })
            .collect(Collectors.toList());

    PaginationList.Builder pb =
        ps.builder()
            .title(Util.getTextMessageWithFormat("command.warps.list.header"))
            .padding(Text.of(TextColors.GREEN, "-"))
            .contents(lt);
    if (!(src instanceof Player)) {
      pb.linesPerPage(-1);
    }

    pb.sendTo(src);
    return CommandResult.success();
  }
  @Override
  public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {

    if (src instanceof Player) {
      Player player = (Player) src;
      Optional<String> optionalKitName = args.getOne("kitName");
      Optional<String> optionalArgs = args.getOne("args");
      if (optionalKitName.isPresent()) {
        String kitName = optionalKitName.get().toUpperCase();
        CommandKitManager kitManager = plugin.getKitManager();
        if (kitManager.isKit(kitName)) {
          CommandKit kit = kitManager.getKit(kitName);
          if (kit.hasPermission(player)) {
            if (kit.hasRequirements(player)) {
              if (kitManager.checkInterval(player, kitName) == 0) {
                String[] argArray = new String[0];
                if (optionalArgs.isPresent()) {
                  argArray = optionalArgs.get().split(" ");
                }
                kit.execute(player, argArray);
                kitManager.markInterval(player, kitName);
              } else {
                src.sendMessage(
                    Text.of(
                        TextColors.RED,
                        Strings.getInstance().getStrings().get("intervalDenial")
                            + kitManager.checkInterval(player, kitName)));
              }
            } else {
              src.sendMessage(
                  Text.of(
                      TextColors.RED, Strings.getInstance().getStrings().get("requirementDenial")));
            }
          } else {
            src.sendMessage(
                Text.of(
                    TextColors.RED, Strings.getInstance().getStrings().get("permissionDenial")));
          }
        } else {
          src.sendMessage(
              Text.of(TextColors.RED, Strings.getInstance().getStrings().get("unknownKit")));
        }
        return CommandResult.success();
      }
      src.sendMessage(
          Text.of(TextColors.RED, Strings.getInstance().getStrings().get("unknownKit")));
    }
    return CommandResult.empty();
  }
  public static CommandSpec getCommand() {
    return CommandSpec.builder()
        .arguments(
            GenericArguments.player(Text.of("player")), new ChannelArgument(Text.of("channel")))
        .description(Text.of("Unban player from channel."))
        .permission("darmok.mod")
        .executor(
            (source, args) -> {
              Player player = args.<Player>getOne("player").get();
              Channel channel = args.<Channel>getOne("channel").get();

              Darmok.getPlayerRegistry().unbanFromChannel(player, channel);

              player.sendMessage(
                  Format.error(
                      String.format(
                          "You have been unbanned from the %s channel.", channel.getName())));
              source.sendMessage(
                  Format.heading(
                      String.format(
                          "You have unbanned %s from channel %s",
                          player.getName(), channel.getName())));

              return CommandResult.success();
            })
        .build();
  }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    if (src instanceof Player) {
      Player player = (Player) src;
      ExperienceHolderData expHolderData = player.getOrCreate(ExperienceHolderData.class).get();
      player.sendMessage(
          Text.of(
              TextColors.GOLD,
              "Your current experience: ",
              TextColors.GRAY,
              expHolderData.totalExperience().get()));
      player.sendMessage(
          Text.of(
              TextColors.GOLD,
              "Experience to next level: ",
              TextColors.GRAY,
              expHolderData.getExperienceBetweenLevels().get()
                  - expHolderData.experienceSinceLevel().get()));
    } else {
      src.sendMessage(
          Text.of(
              TextColors.DARK_RED,
              "Error! ",
              TextColors.RED,
              "You must be an in-game player to use this command!"));
    }

    return CommandResult.success();
  }
 @Override
 public CommandResult execute(CommandSource commandSource, CommandContext commandContext)
     throws CommandException {
   SpongeDiscord.getInstance().loadConfiguration();
   SpongeDiscord.getInstance().getLogger().info("Configuration Reloaded!");
   return CommandResult.success();
 }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    if (src instanceof Player) {
      Player player = (Player) src;

      if (player.getItemInHand().isPresent()) {
        ItemStack itemInHand = player.getItemInHand().get();
        player.sendMessage(
            Text.of(
                TextColors.GOLD,
                "The ID of the item in your hand is: ",
                TextColors.GRAY,
                itemInHand.getItem().getName()));
        player.sendMessage(
            Text.of(
                TextColors.GOLD,
                "The meta of the item in your hand is: ",
                TextColors.GRAY,
                itemInHand.toContainer().get(DataQuery.of("UnsafeDamage")).get().toString()));
      } else {
        player.sendMessage(
            Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must hold an item."));
      }
    } else {
      src.sendMessage(
          Text.of(
              TextColors.DARK_RED,
              "Error! ",
              TextColors.RED,
              "You must be an in-game player to use this command."));
    }

    return CommandResult.success();
  }
  @Override
  public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {

    Player player = (Player) src;

    PlayerGymInfoData playerGymInfoData = player.get(PlayerGymInfoData.class).get();
    List<ItemStackSnapshot> itemStackSnapshots = playerGymInfoData.badgeItems().get();
    InventoryBasic inventoryBasic = new InventoryBasic("Badges", true, 54);

    for (int i = 0; i < itemStackSnapshots.size(); i++) {
      if (i < inventoryBasic.getSizeInventory()) {
        ItemStackSnapshot snapshot = itemStackSnapshots.get(i);
        ItemStack stack = snapshot.createStack();
        inventoryBasic.setInventorySlotContents(i, (net.minecraft.item.ItemStack) stack);
      }
    }
    ((EntityPlayerMP) player).displayGUIChest(inventoryBasic);

    /*
    try {
        GameProfile gameProfile = Sponge.getServer().getGameProfileManager().get("clienthax").get(); // <-- why the hell doesnt this return a optional.. -.-
        System.out.println(gameProfile.getUniqueId());

    } catch (Exception e) {
        e.printStackTrace();
    }*/

    return CommandResult.success();
  }
Exemple #10
0
  @Override
  public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {

    String name = args.<String>getOne("name").get();
    if (src instanceof Player && EzpzPvpKit.getInstance().isQueueExisting(name)) {
      Player player = (Player) src;
      PvPPlayer pvpPlayer = EzpzPvpKit.getInstance().getPlayer(player.getIdentifier());
      Team team = EzpzPvpKit.getInstance().getTeam(pvpPlayer.getTeam());
      DuelQueue queue = EzpzPvpKit.getInstance().getQueue(name);
      // Size ?
      if (team.getSize() != queue.getSize())
        Utils.sendKitMessage(
            player, Text.of(TextColors.RED, "Party size doesn't match queue size"));
      // Is in duel ?
      else if (team.getInMatch())
        Utils.sendKitMessage(player, Text.of(TextColors.RED, "Cannot join queue in duel"));
      else {
        // is in other queue ?
        if (team.getQueue() != null) EzpzPvpKit.getInstance().getQueue(team.getQueue()).leave(team);
        queue.join(team);
        for (String it : team.getPlayers())
          Utils.sendKitMessage(
              EzpzPvpKit.getInstance().getPlayer(it).getPlayer(),
              Text.of("You joined queue : " + name));
      }

    } else if (src instanceof Player && !EzpzPvpKit.getInstance().isQueueExisting(name))
      Utils.sendKitMessage((Player) src, Text.of(TextColors.RED, "this queue doesn't exist"));
    else if (src instanceof ConsoleSource) Utils.sendMessageC(src);
    else if (src instanceof CommandBlockSource) Utils.sendMessageCB(src);

    return CommandResult.success();
  }
Exemple #11
0
  @Override
  public CommandResult process(CommandSource sender, String arguments) throws CommandException {

    String[] args = arguments.split(" ");

    if (sender instanceof Player == false) {
      sender.sendMessage(
          Text.builder("Cannot be run by the console!").color(TextColors.RED).build());
      return CommandResult.success();
    }

    if (args.length < 1 || args.length > 2) {
      sender.sendMessage(usage);
      return CommandResult.success();
    }

    if (args[0].equalsIgnoreCase("day")) {
      new CommandTimeDay(sender, args, game);
      return CommandResult.success();
    } else if (args[0].equalsIgnoreCase("night")) {
      new CommandTimeNight(sender, args, game);
      return CommandResult.success();
    } else if (args[0].equalsIgnoreCase("sunrise")) {
      new CommandTimeSunrise(sender, args, game);
      return CommandResult.success();
    } else if (args[0].equalsIgnoreCase("sunset")) {
      new CommandTimeSunset(sender, args, game);
      return CommandResult.success();
    } else {
      sender.sendMessage(usage);
    }

    return CommandResult.success();
  }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    if (src instanceof Player) {
      Player player = (Player) src;
      String playerTeamName = ConfigManager.getTeam(player.getUniqueId());

      if (playerTeamName != null
          && !ConfigManager.getMembers(playerTeamName).contains(player.getUniqueId().toString())) {
        BigDecimal money =
            ConfigManager.getClaimCost()
                .multiply(new BigDecimal(ConfigManager.getClaims(playerTeamName)));
        Polis.economyService
            .getOrCreateAccount(playerTeamName)
            .get()
            .deposit(
                Polis.economyService.getDefaultCurrency(),
                money,
                Cause.of(NamedCause.source(player)));
        ConfigManager.depositToTownBank(money, playerTeamName);
        ConfigManager.removeClaims(playerTeamName);
        player.sendMessage(
            Text.of(
                TextColors.GREEN,
                "[Polis]: ",
                TextColors.GOLD,
                "Successfully removed all claims!"));
      } else if (playerTeamName != null) {
        player.sendMessage(
            Text.of(
                TextColors.GREEN,
                "[Polis]: ",
                TextColors.DARK_RED,
                "Error! ",
                TextColors.RED,
                "Ask your leader to remove all claims!"));
      } else {
        player.sendMessage(
            Text.of(
                TextColors.GREEN,
                "[Polis]: ",
                TextColors.DARK_RED,
                "Error! ",
                TextColors.RED,
                "You're not part of a town!"));
      }
    } else {
      src.sendMessage(
          Text.of(
              TextColors.DARK_RED,
              "Error! ",
              TextColors.RED,
              "Must be an in-game player to use /polis unclaimall!"));
    }

    return CommandResult.success();
  }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    if (src instanceof Player) {
      Player player = (Player) src;
      Player target = ctx.<Player>getOne("target").get();

      player.sendMessage(Text.of(TextColors.DARK_AQUA, "You have slapped ", target.getName()));
      target.sendMessage(
          Text.of(TextColors.DARK_AQUA, "You have been slapped by ", player.getName()));
    }
    return CommandResult.success();
  }
  @Override
  public CommandResult execute(CommandSource source, CommandContext args) throws CommandException {
    int index = args.<Integer>getOne("index").get();

    List<String> messages = plugin.getConfigManager().getConfiguration().getMessages();
    if (index > messages.size()) {
      source.sendMessage(
          Text.of(
              TextColors.DARK_RED,
              index + '/' + messages.size() + " Number is higher than the available messages"));
    } else {
      Text removedMessage = plugin.translateColorCodes(messages.remove(index - 1));
      plugin.getConfigManager().save();

      source.sendMessage(Text.of(TextColors.DARK_GREEN, "Removed the following message"));
      source.sendMessage(removedMessage);
      return CommandResult.builder().successCount(1).build();
    }

    return CommandResult.success();
  }
Exemple #15
0
 @Override
 public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
   int expLevel = ctx.<Integer>getOne("exp").get();
   Player player = ctx.<Player>getOne("target").get();
   player.offer(Keys.TOTAL_EXPERIENCE, player.get(Keys.TOTAL_EXPERIENCE).get() - expLevel);
   src.sendMessage(
       Text.of(
           TextColors.GREEN,
           "Success! ",
           TextColors.YELLOW,
           "Took " + expLevel + " experience from " + player.getName() + "."));
   return CommandResult.success();
 }
Exemple #16
0
  @Override
  public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    if (!args.hasAny("old")) {
      src.sendMessage(invalidArg());
      return CommandResult.empty();
    }

    String oldWorldName = args.<String>getOne("old").get();

    if (oldWorldName.equalsIgnoreCase("@w")) {
      if (src instanceof Player) {
        oldWorldName = ((Player) src).getWorld().getName();
      }
    }

    if (!args.hasAny("new")) {
      src.sendMessage(invalidArg());
      return CommandResult.empty();
    }

    String newWorldName = args.<String>getOne("new").get();

    for (WorldProperties world : Main.getGame().getServer().getAllWorldProperties()) {
      if (!world.getWorldName().equalsIgnoreCase(newWorldName)) {
        continue;
      }

      src.sendMessage(Text.of(TextColors.DARK_RED, newWorldName, " already exists"));
      return CommandResult.empty();
    }

    if (!Main.getGame().getServer().getWorld(oldWorldName).isPresent()) {
      src.sendMessage(Text.of(TextColors.DARK_RED, "World ", oldWorldName, " does not exists"));
      return CommandResult.empty();
    }

    Optional<WorldProperties> copy = null;
    try {
      copy =
          Main.getGame()
              .getServer()
              .copyWorld(
                  Main.getGame().getServer().getWorld(oldWorldName).get().getProperties(),
                  newWorldName)
              .get();
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }

    if (!copy.isPresent()) {
      src.sendMessage(Text.of(TextColors.DARK_RED, "Could not copy ", oldWorldName));
      return CommandResult.empty();
    }

    src.sendMessage(Text.of(TextColors.DARK_GREEN, oldWorldName, " copied to ", newWorldName));

    return CommandResult.success();
  }
Exemple #17
0
  @Override
  public CommandResult process(CommandSource sender, String arguments) throws CommandException {

    String[] args = arguments.split(" ");

    if (!PermissionsUtils.has(sender, "core.heal")) {
      sender.sendMessage(
          Text.builder("You do not have permissions!").color(TextColors.RED).build());
      return CommandResult.success();
    }

    if (args.length > 1) {
      sender.sendMessage(Text.of(TextColors.YELLOW, "Usage: ", TextColors.GRAY, "/heal [player]"));
      return CommandResult.success();
    }

    if (arguments.equalsIgnoreCase("")) {

      if (sender instanceof Player == false) {
        sender.sendMessage(
            Text.builder("Cannot be run by the console!").color(TextColors.RED).build());
        return CommandResult.success();
      }

      Player p = (Player) sender;
      double max = p.get(Keys.MAX_HEALTH).get();
      p.offer(Keys.HEALTH, max);

      sender.sendMessage(Text.of(TextColors.YELLOW, "You ", TextColors.GRAY, "have been healed."));

    } else if (args.length == 1) {

      if (!PermissionsUtils.has(sender, "core.heal-others")) {
        sender.sendMessage(
            Text.builder("You do not have permissions to heal other players!")
                .color(TextColors.RED)
                .build());
        return CommandResult.success();
      }

      Player p = ServerUtils.getPlayer(args[0]);
      if (p == null) {
        sender.sendMessage(Text.builder("Player not found!").color(TextColors.RED).build());
        return CommandResult.success();
      }

      double max = p.get(Keys.MAX_HEALTH).get();
      p.offer(Keys.HEALTH, max);

      sender.sendMessage(
          Text.of(TextColors.YELLOW, p.getName(), TextColors.GRAY, " has been healed."));
      p.sendMessage(
          Text.of(
              TextColors.GRAY, "You have been healed by ", TextColors.YELLOW, sender.getName()));
    }

    return CommandResult.success();
  }
 public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
   URL memberLink = null;
   try {
     memberLink = new URL(ConfigHandler.get().getMemberLink());
     src.sendMessage(
         Text.of(
             TextColors.DARK_AQUA,
             "Become a Member for free by following the instructions ",
             TextColors.AQUA,
             Text.builder("here").onClick(TextActions.openUrl(memberLink)).build()));
   } catch (MalformedURLException e) {
     DTEssentialsPlugin.getLogger().error("Invalid URL format for memberLink in config file");
   }
   return CommandResult.success();
 }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    setLocalVariables();
    Optional<Player> player = ctx.<Player>getOne("player");
    // if reason is not there use default reason
    Optional<String> oReason = ctx.<String>getOne("reason");

    if (oReason.isPresent()) {
      String reason = oReason.get();
      if (player.isPresent()) {
        Player players = player.get();
        players
            .getPlayer()
            .get()
            .kick(
                Text.builder()
                    .append(
                        Text.of(
                            TextColors.DARK_RED,
                            "You have been tempbanned!\n",
                            TextColors.RED,
                            "Reason: "))
                    .append(TextSerializers.formattingCode('&').deserialize(reason), Text.of("\n"))
                    .build());
        return CommandResult.success();
      }
      src.sendMessage(
          Text.of(
              TextColors.RED, "Need to specify a player. Correct useage: /kick <player> <reason>"));
      return CommandResult.empty();
    } else {
      src.sendMessage(
          Text.of(
              TextColors.RED, "Need to specify a Reason. Correct useage: /kick <player> <reason>"));
      return CommandResult.empty();
    }
  }
  @Override
  protected CommandResult ExecCommand(Player player, CommandContext context) {
    int id, permId, permId2, permId3;
    String name = null;

    id = Core.getPlayerHandler().<Integer>getElement(player, GlobalPlayer.cityId);
    name = Core.getCityHandler().<String>getElement(id, GlobalCity.displayName);
    permId = Core.getCityHandler().<Integer>getElement(id, GlobalCity.permRes);
    permId2 = Core.getCityHandler().<Integer>getElement(id, GlobalCity.permOutside);
    permId3 = Core.getCityHandler().<Integer>getElement(id, GlobalCity.permAllies);
    Core.getCityHandler().delete(id);
    Core.getPermissionHandler().delete(permId);
    Core.getPermissionHandler().delete(permId2);
    Core.getPermissionHandler().delete(permId3);
    Text message = Text.of("[BREAKING NEWS] " + name + " has fallen !");
    Core.SendText(Text.of(TextColors.GOLD, message, TextColors.RESET));

    return CommandResult.success();
  }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    EntityType entityType = ctx.<EntityType>getOne("mob").get();

    if (src instanceof Player) {
      Player player = (Player) src;

      ItemStack mobSpawnerStack =
          ItemStack.builder().itemType(ItemTypes.MOB_SPAWNER).quantity(1).build();
      Optional<MobSpawnerData> mobSpawnerData = mobSpawnerStack.getOrCreate(MobSpawnerData.class);

      if (mobSpawnerData.isPresent()) {
        MobSpawnerData data = mobSpawnerData.get();
        data.nextEntityToSpawn().set(entityType, null);

        if (mobSpawnerStack.offer(data).isSuccessful()) {
          player.setItemInHand(mobSpawnerStack);
          player.sendMessage(
              Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Created mob spawner."));
        } else {
          player.sendMessage(
              Text.of(
                  TextColors.DARK_RED,
                  "Error! ",
                  TextColors.RED,
                  "Failed to set mob spawner entity."));
        }
      } else {
        player.sendMessage(
            Text.of(
                TextColors.DARK_RED, "Error! ", TextColors.RED, "Failed to create mob spawner."));
      }
    } else {
      src.sendMessage(
          Text.of(
              TextColors.DARK_RED,
              "Error! ",
              TextColors.RED,
              "Must be an in-game player to use /mobspawner!"));
    }

    return CommandResult.success();
  }
  @Override
  public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    if (!args.hasAny("name")) {
      src.sendMessage(invalidArg());
      return CommandResult.empty();
    }
    String worldName = args.<String>getOne("name").get();

    if (worldName.equalsIgnoreCase("@w") && src instanceof Player) {
      worldName = ((Player) src).getWorld().getName();
    }

    Collection<WorldProperties> worlds = new ArrayList<>();

    if (worldName.equalsIgnoreCase("@a")) {
      worlds = Main.getGame().getServer().getAllWorldProperties();
    } else {
      if (!Main.getGame().getServer().getWorldProperties(worldName).isPresent()) {
        src.sendMessage(Text.of(TextColors.DARK_RED, worldName, " does not exist"));
        return CommandResult.empty();
      }
      worlds.add(Main.getGame().getServer().getWorldProperties(worldName).get());
    }

    String value = null;

    if (args.hasAny("value")) {
      value = args.<String>getOne("value").get();

      if ((!value.equalsIgnoreCase("true")) && (!value.equalsIgnoreCase("false"))) {
        src.sendMessage(invalidArg());
        return CommandResult.empty();
      }
    }

    List<Text> list = new ArrayList<>();

    for (WorldProperties properties : worlds) {
      if (value == null) {
        list.add(
            Text.of(
                TextColors.GREEN,
                properties.getWorldName(),
                ": ",
                TextColors.WHITE,
                Boolean.toString(properties.isHardcore()).toUpperCase()));
        continue;
      }

      properties.setHardcore(Boolean.getBoolean(value));

      src.sendMessage(
          Text.of(
              TextColors.DARK_GREEN,
              "Set hardcore of ",
              worldName,
              " to ",
              TextColors.YELLOW,
              value.toUpperCase()));
    }

    if (!list.isEmpty()) {
      if (src instanceof Player) {
        PaginationList.Builder pages =
            Main.getGame().getServiceManager().provide(PaginationService.class).get().builder();

        pages.title(
            Text.builder()
                .color(TextColors.DARK_GREEN)
                .append(Text.of(TextColors.GREEN, "Hardcore"))
                .build());

        pages.contents(list);

        pages.sendTo(src);
      } else {
        for (Text text : list) {
          src.sendMessage(text);
        }
      }
    }

    return CommandResult.success();
  }
  public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException {
    Optional<Player> optionalTarget = ctx.<Player>getOne("player");

    if (!optionalTarget.isPresent()) {
      if (src instanceof Player) {
        Player player = (Player) src;
        BlockRay<World> playerBlockRay = BlockRay.from(player).blockLimit(350).build();

        Location<World> spawnLocation = null;
        int i = 0;

        while (playerBlockRay.hasNext()) {
          // TODO: Come up with a better way of making sure it doesn't hit the player.
          i++;

          BlockRayHit<World> currentHitRay = playerBlockRay.next();

          if (i > 5) {
            // We can set the spawn location, so break here.
            spawnLocation = currentHitRay.getLocation();
            break;
          }
        }

        Vector3d velocity = player.getTransform().getRotationAsQuaternion().getDirection();
        spawnEntity(spawnLocation, velocity, player);
        player.sendMessage(
            Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Created Fireball!"));
      } else if (src instanceof ConsoleSource) {
        src.sendMessage(
            Text.of(
                TextColors.DARK_RED,
                "Error! ",
                TextColors.RED,
                "Must be an in-game player to use /fireball!"));
      } else if (src instanceof CommandBlockSource) {
        src.sendMessage(
            Text.of(
                TextColors.DARK_RED,
                "Error! ",
                TextColors.RED,
                "Must be an in-game player to use /fireball!"));
      }
    } else {
      Player player = optionalTarget.get();
      Location<World> playerLocation = player.getLocation();

      Vector3d velocity = player.getTransform().getRotationAsQuaternion().getDirection();
      spawnEntity(playerLocation, velocity, src);
      player.sendMessage(
          Text.of(
              TextColors.GRAY, src.getName(), TextColors.GOLD, " has struck you with a fireball."));
      src.sendMessage(
          Text.of(
              TextColors.GREEN,
              "Success! ",
              TextColors.YELLOW,
              "Struck " + player.getName() + " with fireball."));
    }

    return CommandResult.success();
  }
  @Override
  public CommandResult execute(CommandSource src, CommandContext ctx) {
    Player player;
    try {
      player = GriefPrevention.checkPlayer(src);
    } catch (CommandException e) {
      src.sendMessage(e.getText());
      return CommandResult.success();
    }
    // which claim is being abandoned?
    PlayerData playerData =
        GriefPrevention.instance.dataStore.getOrCreatePlayerData(
            player.getWorld(), player.getUniqueId());
    Claim claim =
        GriefPrevention.instance.dataStore.getClaimAtPlayer(playerData, player.getLocation(), true);
    UUID ownerId = claim.ownerID;
    if (claim.parent != null) {
      ownerId = claim.parent.ownerID;
    }
    if (claim.isWildernessClaim()) {
      GriefPrevention.sendMessage(player, TextMode.Instr, Messages.AbandonClaimMissing);
      return CommandResult.success();
    } else if (claim.allowEdit(player) != null
        || (!claim.isAdminClaim() && !player.getUniqueId().equals(ownerId))) {
      // verify ownership
      GriefPrevention.sendMessage(player, TextMode.Err, Messages.NotYourClaim);
      return CommandResult.success();
    }

    // warn if has children and we're not explicitly deleting a top level claim
    else if (claim.children.size() > 0 && !deleteTopLevelClaim) {
      GriefPrevention.sendMessage(player, TextMode.Instr, Messages.DeleteTopLevelClaim);
      return CommandResult.empty();
    } else {
      // delete it
      claim.removeSurfaceFluids(null);
      // remove all context permissions
      player.getSubjectData().clearPermissions(ImmutableSet.of(claim.getContext()));
      GriefPrevention.GLOBAL_SUBJECT
          .getSubjectData()
          .clearPermissions(ImmutableSet.of(claim.getContext()));
      GriefPrevention.instance.dataStore.deleteClaim(claim, true);

      // if in a creative mode world, restore the claim area
      if (GriefPrevention.instance.claimModeIsActive(
          claim.getLesserBoundaryCorner().getExtent().getProperties(), ClaimsMode.Creative)) {
        GriefPrevention.addLogEntry(
            player.getName()
                + " abandoned a claim @ "
                + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()));
        GriefPrevention.sendMessage(player, TextMode.Warn, Messages.UnclaimCleanupWarning);
        GriefPrevention.instance.restoreClaim(claim, 20L * 60 * 2);
      }

      // this prevents blocks being gained without spending adjust claim blocks when abandoning a
      // top level claim
      if (!claim.isSubdivision() && !claim.isAdminClaim()) {
        int newAccruedClaimCount =
            playerData.getAccruedClaimBlocks()
                - ((int) Math.ceil(claim.getArea() * (1 - playerData.optionAbandonReturnRatio)));
        playerData.setAccruedClaimBlocks(newAccruedClaimCount);
      }

      // tell the player how many claim blocks he has left
      int remainingBlocks = playerData.getRemainingClaimBlocks();
      GriefPrevention.sendMessage(
          player, TextMode.Success, Messages.AbandonSuccess, String.valueOf(remainingBlocks));
      // revert any current visualization
      playerData.revertActiveVisual(player);
      playerData.warnedAboutMajorDeletion = false;
    }

    return CommandResult.success();
  }