mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 15:46:42 +00:00
- Add the ability to customize game rules per world in config
- Add gamerules argument to /debug
This commit is contained in:
@ -508,6 +508,17 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
return LegacyComponentSerializer.legacyAmpersand().deserialize(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string to a mini message kyori component
|
||||
*
|
||||
* @param s The string to convert
|
||||
* @return A Kyori component
|
||||
*/
|
||||
protected Component mmString(String s)
|
||||
{
|
||||
return MiniMessage.miniMessage().parse(s);
|
||||
}
|
||||
|
||||
public Rank getLevel()
|
||||
{
|
||||
return level;
|
||||
|
@ -5,16 +5,20 @@ 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.PlexLog;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> redis-reset [player]")
|
||||
import java.util.List;
|
||||
|
||||
@CommandParameters(name = "debug", description = "Debug command", usage = "/<command> <redis-reset | gamerules> [player]")
|
||||
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
||||
public class DebugCMD extends PlexCommand
|
||||
{
|
||||
@ -35,6 +39,15 @@ public class DebugCMD extends PlexCommand
|
||||
}
|
||||
return componentFromString("Couldn't find player in Redis punishments.");
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("gamerules"))
|
||||
{
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
PlexUtils.commitGameRules(world);
|
||||
PlexLog.debug("Set gamerules for world: " + world.getName());
|
||||
}
|
||||
return mmString("<aqua>Re-applied game all the game rules!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user