mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2026-06-05 15:56:54 +00:00
Update this to Plex 1.4
This commit is contained in:
@@ -4,7 +4,7 @@ import dev.plex.extras.TFMExtras;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "admininfo", description = "Information on how to apply for admin", aliases = "ai,si,staffinfo")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.admininfo")
|
||||
@CommandPermissions( permission = "plex.tfmextras.admininfo")
|
||||
public class AdminInfoCommand extends PlexCommand
|
||||
{
|
||||
private static final List<Component> ADMIN_INFO = TFMExtras.getModule().getConfig().getStringList("server.admininfo")
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.plex.extras.command;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Arrays;
|
||||
|
||||
@CommandParameters(name = "attributes", description = "Lists all possible attributes", aliases = "attributelist,attrlist")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.attrlist")
|
||||
@CommandPermissions( permission = "plex.tfmextras.attrlist")
|
||||
public class AttributeListCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "autoclear", description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/<command> <player>", aliases = "aclear,ac")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.autoclear")
|
||||
@CommandPermissions(permission = "plex.tfmextras.autoclear")
|
||||
public class AutoClearCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "autoteleport", description = "If a player is specified, it will toggle whether or not the player is automatically teleported when they join. If no player is specified, you will be randomly teleported", usage = "/<command> [player]", aliases = "autotp,rtp,randomtp,tpr")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.autotp")
|
||||
@CommandPermissions( permission = "plex.tfmextras.autotp")
|
||||
public class AutoTeleportCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
@@ -33,7 +33,7 @@ public class AutoTeleportCommand extends PlexCommand
|
||||
player.teleportAsync(TFMExtras.getRandomLocation(player.getWorld()));
|
||||
return null;
|
||||
}
|
||||
checkRank(sender, Rank.ADMIN, "plex.tfmextras.autotp.other");
|
||||
checkPermission(sender, "plex.tfmextras.autotp.other");
|
||||
PlexPlayer target = DataUtils.getPlayer(args[0]);
|
||||
if (target == null)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -15,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.banlist")
|
||||
@CommandPermissions(permission = "plex.tfmextras.banlist")
|
||||
public class BanListCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
@@ -37,7 +36,7 @@ public class BanListCommand extends PlexCommand
|
||||
}
|
||||
if (!sender.getName().equalsIgnoreCase("console"))
|
||||
{
|
||||
if (!checkRank(sender, Rank.EXECUTIVE, "plex.tfmextras.banlist.clear"))
|
||||
if (!checkPermission(sender, "plex.tfmextras.banlist.clear"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.plex.extras.command;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import dev.plex.util.item.ItemBuilder;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "cake", description = "For the people that are still alive - gives a cake to everyone on the server")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.cake")
|
||||
@CommandPermissions(permission = "plex.tfmextras.cake")
|
||||
public class CakeCommand extends PlexCommand
|
||||
{
|
||||
private static final ItemStack CAKE = new ItemBuilder(Material.CAKE)
|
||||
|
||||
@@ -4,7 +4,7 @@ import dev.plex.Plex;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandParameters(name = "cartsit", description = "Sit in nearest minecart. If target is in a minecart already, they will be ejected", aliases = "minecartsit")
|
||||
@CommandPermissions(level = Rank.NONOP, permission = "plex.tfmextras.cartsit")
|
||||
@CommandPermissions(permission = "plex.tfmextras.cartsit")
|
||||
public class CartSitCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.plex.extras.command;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -13,13 +13,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "clearchat", description = "Clears the chat", aliases = "cc,cleanchat,chatclear")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.clearchat")
|
||||
@CommandPermissions(permission = "plex.tfmextras.clearchat")
|
||||
public class ClearChatCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
|
||||
{
|
||||
Bukkit.getOnlinePlayers().stream().filter(p -> !silentCheckRank(p, Rank.ADMIN, "plex.tfmextras.clearchat"))
|
||||
Bukkit.getOnlinePlayers().stream().filter(p -> !silentCheckPermission(p, "plex.tfmextras.clearchat"))
|
||||
.forEach(p ->
|
||||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.plex.extras.command;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@@ -19,7 +19,7 @@ import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@CommandParameters(name = "cloudclear", description = "Clears lingering potion area effect clouds", aliases = "clearcloud,aeclear")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.cloudclear")
|
||||
@CommandPermissions(permission = "plex.tfmextras.cloudclear")
|
||||
public class CloudClearCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "eject", description = "Removes all passengers from a player")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME)
|
||||
@CommandPermissions( permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME)
|
||||
public class EjectCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -22,7 +22,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "enchant", description = "Enchants an item", usage = "/<command> <add | reset | list | addall | remove>", aliases = "enchantment")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME)
|
||||
@CommandPermissions( permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME)
|
||||
public class EnchantCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ package dev.plex.extras.command;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
|
||||
@CommandParameters(name = "emf", description = "Speak english.", usage = "/<command> <player>")
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.tfmextras.emf")
|
||||
@CommandPermissions(permission = "plex.tfmextras.emf")
|
||||
public class EnglishMfCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.extras.jumppads.JumpPads;
|
||||
import dev.plex.extras.jumppads.Mode;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import dev.plex.util.PlexUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@@ -23,7 +23,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "jumppads", usage = "/jumppads <mode> [player]", description = "Enables jump pads for yourself or another player. Mode types available: none, regular, enhanced, extreme, ultimate", aliases = "jp,pads,launchpads")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY)
|
||||
@CommandPermissions( permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY)
|
||||
public class JumpPadsCommand extends PlexCommand
|
||||
{
|
||||
JumpPads jumpPads = TFMExtras.getModule().jumpPads;
|
||||
@@ -96,7 +96,7 @@ public class JumpPadsCommand extends PlexCommand
|
||||
|
||||
Mode mode = Mode.valueOf(args[0]);
|
||||
|
||||
if (!checkRank(sender, Rank.ADMIN, "plex.tfmextras.jumppads.others"))
|
||||
if (!checkPermission(sender, "plex.tfmextras.jumppads.others"))
|
||||
{
|
||||
return permissionMessage();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@CommandParameters(name = "randomfish", description = "Spawns a random type of fish at your location", aliases = "rfish,bird")
|
||||
@CommandPermissions(level = Rank.OP, permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME)
|
||||
@CommandPermissions( permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME)
|
||||
public class RandomFishCommand extends PlexCommand
|
||||
{
|
||||
private static final List<EntityType> FISH_TYPES = Arrays.asList(EntityType.COD, EntityType.SALMON, EntityType.PUFFERFISH, EntityType.TROPICAL_FISH);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package dev.plex.extras.command.slime;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.PlayerNotFoundException;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.extras.TFMExtras;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Taah
|
||||
* @since 7:43 PM [24-08-2023]
|
||||
*/
|
||||
|
||||
@CommandParameters(name = "myworld", usage = "/<command> <create | goto | manage | members | shared | add | remove | settings> [player]")
|
||||
@CommandPermissions( permission = "plex.tfmextras.myworld", source = RequiredCommandSource.IN_GAME)
|
||||
public class MyWorldCommand extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
|
||||
{
|
||||
assert player != null;
|
||||
if (args.length == 0)
|
||||
{
|
||||
return usage();
|
||||
}
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "create" ->
|
||||
{
|
||||
if (TFMExtras.getModule().getSlimeWorldHook().isWorldLoaded(player.getUniqueId().toString()))
|
||||
{
|
||||
return messageComponent("playerWorldExists");
|
||||
}
|
||||
TFMExtras.getModule().getSlimeWorldHook().createPlayerWorld(player.getUniqueId());
|
||||
return messageComponent("createdPlayerWorld");
|
||||
}
|
||||
case "goto" ->
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
if (!TFMExtras.getModule().getSlimeWorldHook().isWorldLoaded(player.getUniqueId().toString()))
|
||||
{
|
||||
return messageComponent("selfPlayerWorldNotFound");
|
||||
}
|
||||
World world = Bukkit.getWorld(player.getUniqueId().toString());
|
||||
if (world == null)
|
||||
{
|
||||
return messageComponent("worldLoadError");
|
||||
}
|
||||
player.teleportAsync(world.getSpawnLocation());
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1f, 1f);
|
||||
return null;
|
||||
}
|
||||
final Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target == null)
|
||||
{
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
if (!TFMExtras.getModule().getSlimeWorldHook().isWorldLoaded(target.getUniqueId().toString()))
|
||||
{
|
||||
return messageComponent("playerWorldNotFound");
|
||||
}
|
||||
World world = Bukkit.getWorld(target.getUniqueId().toString());
|
||||
if (world == null)
|
||||
{
|
||||
return messageComponent("worldLoadError");
|
||||
}
|
||||
player.teleportAsync(world.getSpawnLocation());
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1f, 1f);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package dev.plex.extras.command.slime;
|
||||
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.extras.TFMExtras;
|
||||
|
||||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Taah
|
||||
* @since 7:11 PM [24-08-2023]
|
||||
*/
|
||||
|
||||
@CommandParameters(name = "slimemanager", usage = "/<command> <delete | list> [world | all]", description = "Manages the slime worlds handled by the plugin")
|
||||
@CommandPermissions(source = RequiredCommandSource.CONSOLE, permission = "plex.tfmextras.slimemanager")
|
||||
public class SlimeManagerCommand extends PlexCommand
|
||||
{
|
||||
private ScheduledTask task = null;
|
||||
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return usage();
|
||||
}
|
||||
try
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("delete"))
|
||||
{
|
||||
if (args.length != 2)
|
||||
{
|
||||
return usage("/slimemanager delete <world | all>");
|
||||
}
|
||||
String argument = args[1];
|
||||
if (TFMExtras.getModule().getSlimeWorldHook().getLoader().listWorlds().isEmpty())
|
||||
{
|
||||
return mmString("<red>There are currently no loaded worlds.");
|
||||
}
|
||||
else if (!argument.equalsIgnoreCase("all") && TFMExtras.getModule().getSlimeWorldHook().getLoader().listWorlds().stream().noneMatch(s -> s.equalsIgnoreCase(argument)))
|
||||
{
|
||||
return mmString("<red>There is no world called " + argument);
|
||||
}
|
||||
if (task != null)
|
||||
{
|
||||
if (argument.equalsIgnoreCase("all"))
|
||||
{
|
||||
TFMExtras.getModule().getSlimeWorldHook().getLoader().listWorlds().forEach(s ->
|
||||
TFMExtras.getModule().getSlimeWorldHook().deleteWorld(s));
|
||||
if (task != null && !task.isCancelled())
|
||||
{
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
return mmString("<green>Successfully permanently deleted all slime module loaded worlds!");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFMExtras.getModule().getSlimeWorldHook().deleteWorld(argument);
|
||||
if (task != null && !task.isCancelled())
|
||||
{
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
return mmString("<green>Successfully permanently deleted the world <dark_green>" + argument);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
task = Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask ->
|
||||
{
|
||||
this.task = null;
|
||||
sender.sendMessage(PlexUtils.mmDeserialize("<red>You did not confirm the deletion in time!"));
|
||||
}, 10 * 20L);
|
||||
return mmString("<green>Run this command again to confirm deletion.");
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
return mmString("<blue>Current worlds: <white>" + StringUtils.join(TFMExtras.getModule().getSlimeWorldHook().getLoader().listWorlds(), ", "));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PlexLog.debug("{0}: {1}", e.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user