Java Code Examples for org.spongepowered.api.command.args.CommandContext#hasAny()
The following examples show how to use
org.spongepowered.api.command.args.CommandContext#hasAny() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnregisterCommand.java From FlexibleLogin with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource src, CommandContext args) { if (args.hasAny("a")) { Task.builder().execute(plugin.getDatabase()::clearTable).async().submit(plugin); src.sendMessage(settings.getText().getTableCleared()); return CommandResult.success(); } User user = args.<User>getOne("user").get(); Task.builder() //Async as it could run a SQL query .async() .execute(new UnregisterTask(plugin, src, user.getUniqueId())) .submit(plugin); return CommandResult.success(); }
Example 2
Source File: SurvivalCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_BASE); checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_SURVIVAL); if (!args.hasAny("player")) { checkIfPlayer(sender); Player p = (Player) sender; p.offer(Keys.GAME_MODE, GameModes.SURVIVAL); Messages.send(sender, "gamemode.command.gamemode.success", "%gamemode%", "survival"); return CommandResult.success(); } else { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_BASE); checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_SURVIVAL); Player t = args.<Player>getOne("player").get(); t.offer(Keys.GAME_MODE, GameModes.SURVIVAL); Messages.send(t, "gamemode.command.gamemode.success.others", "%sender%", sender, "%gamemode%", "survival"); Messages.send(sender, "gamemode.command.gamemode.success.self", "%player%", t, "%gamemode%", "survival"); return CommandResult.success(); } }
Example 3
Source File: CreativeCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_BASE); checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_CREATIVE); if (!args.hasAny("player")) { checkIfPlayer(sender); Player p = (Player) sender; p.offer(Keys.GAME_MODE, GameModes.CREATIVE); Messages.send(sender, "gamemode.command.gamemode.success", "%gamemode%", "creative"); return CommandResult.success(); } else { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_BASE); checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_CREATIVE); Player t = args.<Player>getOne("player").get(); t.offer(Keys.GAME_MODE, GameModes.CREATIVE); Messages.send(t, "gamemode.command.gamemode.success.others", "%sender%", sender, "%gamemode%", "creative"); Messages.send(sender, "gamemode.command.gamemode.success.self", "%player%", t, "%gamemode%", "creative"); return CommandResult.success(); } }
Example 4
Source File: TeleportacceptCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkIfPlayer(sender); checkPermission(sender, TeleportPermissions.UC_TELEPORT_TELEPORTACCEPT_BASE); Player p = (Player) sender; //Find request String id = args.hasAny("tpid") ? args.<String>getOne("tpid").get() : null; TpaRequest request = TeleportUtil.getRequestFor(p, id).orElse(null); if (request == null) { throw new ErrorMessageException(Messages.getFormatted(sender, "teleport.command.teleportaccept.none")); } request.getTeleportation().start(); Messages.send(sender, "teleport.command.teleportaccept.success"); return CommandResult.success(); }
Example 5
Source File: TeleportdenyCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkIfPlayer(sender); checkPermission(sender, TeleportPermissions.UC_TELEPORT_TELEPORTDENY_BASE); Player p = (Player) sender; //Find request String id = args.hasAny("tpid") ? args.<String>getOne("tpid").get() : null; List<TpaRequest> requests = TeleportUtil.getRequestsFor(p, id); if (requests.isEmpty()) { throw new ErrorMessageException(Messages.getFormatted(sender, "teleport.command.teleportdeny.none")); } requests.forEach(request -> request.getTeleportation().cancel("tpdeny")); requests = requests.stream().filter(request -> request.getAskerPlayer().isPresent()).collect(Collectors.toList()); Messages.send(sender, "teleport.command.teleportdeny.success", "%player%", requests.get(0).getAskerPlayer().get()); return CommandResult.success(); }
Example 6
Source File: NightTimeCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { World world; if (!args.hasAny("world")) { checkIfPlayer(sender); world = ((Player) sender).getWorld(); } else { world = args.<World>getOne("world").get(); } //Players can enter their bed at 12541 ticks Long ticks = 12541 - (world.getProperties().getWorldTime() % 24000); world.getProperties().setWorldTime(world.getProperties().getWorldTime() + ticks); Messages.send(sender, "time.command.time.set.night"); return CommandResult.success(); }
Example 7
Source File: SetwarpCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, WarpPermissions.UC_WARP_SETWARP_BASE); checkIfPlayer(sender); Player p = (Player) sender; String name = args.<String>getOne("name").get(); String description = args.hasAny("description") ? args.<String>getOne("description").get() : Messages.getFormatted("warp.command.setwarp.defaultdescription").toPlain(); //Create warp instance Warp warp = new Warp(name, description, new Transform<>(p.getLocation(), p.getRotation(), p.getScale())); List<Warp> warps = GlobalData.get(WarpKeys.WARPS).get(); warps = warps.stream().filter(w -> !w.getName().equalsIgnoreCase(name)).collect(Collectors.toList()); //Did the warp already exist? boolean replace = GlobalData.get(WarpKeys.WARPS).get().size() != warps.size(); warps.add(warp); GlobalData.offer(WarpKeys.WARPS, warps); if (replace) { Messages.send(sender, "warp.command.setwarp.replace", "%warp%", warp.getName()); } else { Messages.send(sender, "warp.command.setwarp.set", "%warp%", warp.getName()); } return CommandResult.success(); }
Example 8
Source File: FoodCommand.java From UltimateCore with MIT License | 6 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, FoodPermissions.UC_FOOD_FOOD_BASE); if (!args.hasAny("player")) { checkIfPlayer(sender); Player p = (Player) sender; p.offer(Keys.FOOD_LEVEL, p.get(FoodData.class).get().foodLevel().getMaxValue()); p.offer(Keys.SATURATION, ItemStack.builder().itemType(ItemTypes.COOKED_BEEF).build().getProperty(SaturationProperty.class).get().getValue()); Messages.send(p, "food.command.food.success.self"); return CommandResult.success(); } else { checkPermission(sender, FoodPermissions.UC_FOOD_FOOD_OTHERS); Player t = args.<Player>getOne("player").get(); t.offer(Keys.FOOD_LEVEL, t.get(FoodData.class).get().foodLevel().getMaxValue()); t.offer(Keys.SATURATION, ItemStack.builder().itemType(ItemTypes.COOKED_BEEF).build().getProperty(SaturationProperty.class).get().getValue()); Messages.send(sender, "food.command.food.success.others.self", "%player%", t); Messages.send(t, "food.command.food.success.others.others", "%player%", sender); return CommandResult.success(); } }
Example 9
Source File: ItemenchantCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkIfPlayer(sender); checkPermission(sender, ItemPermissions.UC_ITEM_ITEMENCHANT_BASE); Player p = (Player) sender; if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) { throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand")); } ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND); EnchantmentType ench = args.<EnchantmentType>getOne("enchantment").get(); int level = args.hasAny("level") ? args.<Integer>getOne("level").get() : 1; if (level > ItemPermissions.UC_ITEM_ITEMENCHANT_MAXLEVEL.getIntFor(p)) { throw Messages.error(p, "item.command.itemenchant.maxlevel", "%max%", ItemPermissions.UC_ITEM_ITEMENCHANT_MAXLEVEL.getIntFor(p)); } List<Enchantment> enchs = stack.get(Keys.ITEM_ENCHANTMENTS).orElse(new ArrayList<>()); if (level > 0) { enchs.add(Enchantment.builder().type(ench).level(level).build()); stack.offer(Keys.ITEM_ENCHANTMENTS, enchs); p.setItemInHand(HandTypes.MAIN_HAND, stack); Messages.send(sender, "item.command.itemenchant.success", "%enchant%", ench.getTranslation().get(), "%level%", level); return CommandResult.success(); } else { enchs = enchs.stream().filter(e -> !e.getType().equals(ench)).collect(Collectors.toList()); stack.offer(Keys.ITEM_ENCHANTMENTS, enchs); p.setItemInHand(HandTypes.MAIN_HAND, stack); Messages.send(sender, "item.command.itemenchant.success2", "%enchant%", ench.getTranslation().get(), "%level%", level); return CommandResult.success(); } }
Example 10
Source File: HealCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, HealPermissions.UC_HEAL_HEAL_BASE); if (!args.hasAny("player")) { checkIfPlayer(sender); Player p = (Player) sender; p.offer(Keys.HEALTH, p.get(Keys.MAX_HEALTH).orElse(20.0)); p.offer(Keys.POTION_EFFECTS, new ArrayList<>()); p.offer(Keys.REMAINING_AIR, p.get(Keys.MAX_AIR).orElse(10)); p.offer(Keys.FOOD_LEVEL, 20); p.offer(Keys.FIRE_TICKS, 0); Messages.send(sender, "heal.command.heal.success"); return CommandResult.success(); } else { checkPermission(sender, HealPermissions.UC_HEAL_HEAL_OTHERS); Player t = args.<Player>getOne("player").get(); t.offer(Keys.HEALTH, t.get(Keys.MAX_HEALTH).orElse(20.0)); t.offer(Keys.POTION_EFFECTS, new ArrayList<>()); t.offer(Keys.REMAINING_AIR, t.get(Keys.MAX_AIR).orElse(10)); t.offer(Keys.FOOD_LEVEL, 20); t.offer(Keys.FIRE_TICKS, 0); Messages.send(sender, "heal.command.heal.success.self", "%player%", VariableUtil.getNameEntity(t)); Messages.send(t, "heal.command.heal.success.others", "%sender%", sender); return CommandResult.success(); } }
Example 11
Source File: GamemodeCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_BASE); GameMode gm = args.<GameMode>getOne("gamemode").get(); if (!args.hasAny("player")) { checkIfPlayer(sender); Player p = (Player) sender; //Perm check if (gm == GameModes.SURVIVAL) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_ADVENTURE); } else if (gm == GameModes.CREATIVE) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_CREATIVE); } else if (gm == GameModes.ADVENTURE) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_ADVENTURE); } else if (gm == GameModes.SPECTATOR) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_SELF_SPECTATOR); } p.offer(Keys.GAME_MODE, gm); Messages.send(sender, "gamemode.command.gamemode.success", "%gamemode%", gm.getName()); return CommandResult.success(); } else { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_BASE); Player t = args.<Player>getOne("player").get(); //Perm check if (gm == GameModes.SURVIVAL) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_ADVENTURE); } else if (gm == GameModes.CREATIVE) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_CREATIVE); } else if (gm == GameModes.ADVENTURE) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_ADVENTURE); } else if (gm == GameModes.SPECTATOR) { checkPermission(sender, GamemodePermissions.UC_GAMEMODE_GAMEMODE_OTHERS_SPECTATOR); } t.offer(Keys.GAME_MODE, gm); Messages.send(t, "gamemode.command.gamemode.success.others", "%sender%", sender, "%gamemode%", gm.getName()); Messages.send(sender, "gamemode.command.gamemode.success.self", "%player%", t, "%gamemode%", gm.getName()); return CommandResult.success(); } }
Example 12
Source File: AddTimeCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { World world; if (!args.hasAny("world")) { checkIfPlayer(sender); world = ((Player) sender).getWorld(); } else { world = args.<World>getOne("world").get(); } Integer ticks = args.<Integer>getOne("ticks").get(); world.getProperties().setWorldTime(world.getProperties().getWorldTime() + ticks); Messages.send(sender, "time.command.time.set.add", "%ticks%", ticks); return CommandResult.success(); }
Example 13
Source File: RandomCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, RandomPermissions.UC_RANDOM_RANDOM_BASE); int min = args.hasAny("second") ? args.<Integer>getOne("first").get() : 1; int max = args.hasAny("second") ? args.<Integer>getOne("second").get() : args.<Integer>getOne("first").get(); if (min > max) { throw new ErrorMessageException(Messages.getFormatted(sender, "random.command.random.invalid", "%min%", min, "%max%", max)); } int rand = random.nextInt((max + 1) - min) + min; Messages.send(sender, "random.command.random.success", "%min%", min, "%max%", max, "%value%", rand); return CommandResult.success(); }
Example 14
Source File: DisableTimeCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { World world; if (!args.hasAny("world")) { checkIfPlayer(sender); world = ((Player) sender).getWorld(); } else { world = args.<World>getOne("world").get(); } world.getProperties().setGameRule("doDaylightCycle", "false"); Messages.send(sender, "time.command.time.disable"); return CommandResult.success(); }
Example 15
Source File: DayTimeCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { World world; if (!args.hasAny("world")) { checkIfPlayer(sender); world = ((Player) sender).getWorld(); } else { world = args.<World>getOne("world").get(); } Long ticks = 24000 - (world.getProperties().getWorldTime() % 24000); world.getProperties().setWorldTime(world.getProperties().getWorldTime() + ticks); Messages.send(sender, "time.command.time.set.day"); return CommandResult.success(); }
Example 16
Source File: MuteCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, MutePermissions.UC_MUTE_MUTE_BASE); //Get player & Check exempt Player t = args.<Player>getOne("player").get(); if ((MutePermissions.UC_MUTE_EXEMPTPOWER.getIntFor(t) > MutePermissions.UC_MUTE_POWER.getIntFor(sender)) && sender instanceof Player) { throw new ErrorMessageException(Messages.getFormatted(sender, "mute.command.mute.exempt", "%player%", t)); } //Get time & reason Long time = args.hasAny("time") ? args.<Long>getOne("time").get() : -1L; Text reason = args.hasAny("reason") ? Text.of(args.<String>getOne("reason").get()) : Messages.getFormatted("mute.command.mute.defaultreason"); Long endtime = time == -1L ? -1L : System.currentTimeMillis() + time; Long starttime = System.currentTimeMillis(); UUID muter = sender instanceof Player ? ((Player) sender).getUniqueId() : UUID.fromString("00000000-0000-0000-0000-000000000000"); UUID muted = t.getUniqueId(); Mute mute = new Mute(muted, muter, endtime, starttime, reason); UltimateUser ut = UltimateCore.get().getUserService().getUser(t); ut.offer(MuteKeys.MUTE, mute); Messages.send(sender, "mute.command.mute.success", "%player%", VariableUtil.getNameEntity(t), "%time%", (time == -1L ? Messages.getFormatted("core.time.ever") : TimeUtil.format(time)), "%reason%", reason); Messages.send(t, "mute.muted", "%time%", (time == -1L ? Messages.getFormatted("core.time.ever") : TimeUtil.format(time)), "%reason%", reason); return CommandResult.success(); }
Example 17
Source File: KickallCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, KickPermissions.UC_KICK_KICKALL_BASE); Text reason = args.hasAny("reason") ? Text.of(args.getOne("reason")) : Messages.getFormatted(sender, "kick.command.kickall.defaultreason"); for (Player p : Sponge.getServer().getOnlinePlayers()) { if (p.equals(sender)) { continue; } p.kick(Messages.getFormatted("kick.command.kickall.message", "%kicker%", sender, "%reason%", reason)); } Messages.send(sender, "kick.command.kickall.success"); return CommandResult.success(); }
Example 18
Source File: JailCommand.java From UltimateCore with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, JailPermissions.UC_JAIL_JAIL_BASE); //Find player UUID suuid = sender instanceof Player ? ((Player) sender).getUniqueId() : UUID.fromString("00000000-0000-0000-0000-000000000000"); Player t = args.<Player>getOne("player").get(); UltimateUser ut = UltimateCore.get().getUserService().getUser(t); //Exempt power if ((JailPermissions.UC_JAIL_EXEMPTPOWER.getIntFor(t) > JailPermissions.UC_JAIL_POWER.getIntFor(sender)) && sender instanceof Player) { throw new ErrorMessageException(Messages.getFormatted(sender, "jail.command.jail.exempt", "%player%", t)); } //Find jail, time and reason List<Jail> jails = GlobalData.get(JailKeys.JAILS).get(); if (jails.isEmpty() && !args.hasAny("jail")) { throw new ErrorMessageException(Messages.getFormatted(sender, "jail.command.jaillist.empty")); } Jail jail = args.hasAny("jail") ? args.<Jail>getOne("jail").get() : jails.get(random.nextInt(jails.size())); Long time = args.hasAny("time") ? args.<Long>getOne("time").get() : -1L; Text reason = args.hasAny("reason") ? Text.of(args.<String>getOne("reason").get()) : Messages.getFormatted("jail.command.jail.defaultreason"); //If jail is not available if (!jail.getLocation().isPresent()) { throw Messages.error(sender, "jail.command.jail.notavailable"); } JailData data = new JailData(t.getUniqueId(), suuid, time == -1 ? -1 : (time + System.currentTimeMillis()), System.currentTimeMillis(), reason, jail.getName()); ut.offer(JailKeys.JAIL, data); Messages.send(sender, "jail.command.jail.success", "%player%", t, "%jail%", jail.getName(), "%time%", (time == -1L ? Messages.getFormatted("core.time.ever") : TimeUtil.format(time)), "%reason%", reason); Messages.send(t, "jail.target.jailed", "%player%", sender, "%jail%", jail.getName(), "%time%", (time == -1L ? Messages.getFormatted("core.time.ever") : TimeUtil.format(time)), "%reason%", reason); return CommandResult.success(); }
Example 19
Source File: SetCommand.java From ChangeSkin with MIT License | 5 votes |
@Override public CommandResult execute(CommandSource src, CommandContext args) { if (!(src instanceof Player)) { plugin.sendMessage(src, "no-console"); return CommandResult.empty(); } UUID uniqueId = ((Player) src).getUniqueId(); if (core.getCooldownService().isTracked(uniqueId)) { plugin.sendMessage(src, "cooldown"); return CommandResult.empty(); } Player receiver = (Player) src; String targetSkin = args.<String>getOne("skin").get(); boolean keepSkin = args.hasAny("keep"); if ("reset".equals(targetSkin)) { targetSkin = receiver.getUniqueId().toString(); } if (targetSkin.length() > 16) { UUID targetUUID = UUID.fromString(targetSkin); if (core.getConfig().getBoolean("skinPermission") && !plugin.hasSkinPermission(src, targetUUID, true)) { return CommandResult.empty(); } plugin.sendMessage(src, "skin-change-queue"); Runnable skinDownloader = new SkinDownloader(plugin, src, receiver, targetUUID, keepSkin); Task.builder().async().execute(skinDownloader).submit(plugin); return CommandResult.success(); } Runnable nameResolver = new NameResolver(plugin, src, targetSkin, receiver, keepSkin); Task.builder().async().execute(nameResolver).submit(plugin); return CommandResult.success(); }
Example 20
Source File: AfkCommand.java From UltimateCore with MIT License | 4 votes |
@Override public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException { checkPermission(sender, AfkPermissions.UC_AFK_AFK_BASE); UltimateUser user; if (args.hasAny("player")) { checkPermission(sender, AfkPermissions.UC_AFK_AFK_OTHERS_BASE); user = UltimateCore.get().getUserService().getUser(args.<Player>getOne("player").get()); } else { checkIfPlayer(sender); user = UltimateCore.get().getUserService().getUser((Player) sender); } //No isPresent() needed because IS_AFK has a default value boolean newafk = !user.get(AfkKeys.IS_AFK).get(); if (user.offer(AfkKeys.IS_AFK, newafk)) { if (newafk) { user.offer(AfkKeys.AFK_TIME, System.currentTimeMillis()); if (args.hasAny("message")) { //Check perms if (!args.hasAny("player")) { checkPermission(sender, AfkPermissions.UC_AFK_AFK_MESSAGE); } else { checkPermission(sender, AfkPermissions.UC_AFK_AFK_OTHERS_MESSAGE); } String message = args.<String>getOne("message").get(); user.offer(AfkKeys.AFK_MESSAGE, message); Sponge.getServer().getBroadcastChannel().send(sender, Messages.getFormatted("afk.broadcast.afk.message", "%player%", user.getUser(), "%message%", message)); } else { Sponge.getServer().getBroadcastChannel().send(sender, Messages.getFormatted("afk.broadcast.afk", "%player%", user.getUser())); } //Make sure the player is not un-afked instantly AfkDetectionListener.afktime.put(user.getIdentifier(), 0L); user.offer(AfkKeys.LAST_LOCATION, new Transform<>(user.getPlayer().get().getLocation(), user.getPlayer().get().getRotation(), user.getPlayer().get().getScale())); } else { Sponge.getServer().getBroadcastChannel().send(sender, Messages.getFormatted("afk.broadcast.nolonger", "%player%", user.getUser(), "%time%", TimeUtil.formatDateDiff(user.get(AfkKeys.AFK_TIME).get(), 2, null))); user.offer(AfkKeys.AFK_TIME, null); user.offer(AfkKeys.AFK_MESSAGE, null); } } else { throw new DataFailedException(Messages.getFormatted(sender, "afk.command.afk.datafailed")); } return CommandResult.success(); }