mirror of
				https://github.com/proxiodev/RedisBungee.git
				synced 2025-10-29 06:48:02 +00:00 
			
		
		
		
	debug command introduction
This commit is contained in:
		
							parent
							
								
									23aeb81308
								
							
						
					
					
						commit
						96c0dff8c1
					
				| @ -10,14 +10,19 @@ | ||||
| 
 | ||||
| package com.imaginarycode.minecraft.redisbungee.commands; | ||||
| 
 | ||||
| import co.aikar.commands.CommandContexts; | ||||
| import co.aikar.commands.CommandManager; | ||||
| import co.aikar.commands.InvalidCommandArgument; | ||||
| import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; | ||||
| 
 | ||||
| import com.imaginarycode.minecraft.redisbungee.commands.legacy.LegacyRedisBungeeCommands; | ||||
| 
 | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| public class CommandLoader { | ||||
| 
 | ||||
|     public static void initCommands(CommandManager<?, ?, ?, ?, ?, ?> commandManager, RedisBungeePlugin<?> plugin) { | ||||
|         registerContexts(commandManager); | ||||
|         var commandsConfiguration = plugin.configuration().commandsConfiguration(); | ||||
|         if (commandsConfiguration.redisbungeeEnabled()) { | ||||
|             commandManager.registerCommand(new CommandRedisBungee(plugin)); | ||||
| @ -26,6 +31,20 @@ public class CommandLoader { | ||||
|             commandManager.registerCommand(new LegacyRedisBungeeCommands(commandManager,plugin)); | ||||
|         } | ||||
| 
 | ||||
|         commandManager.registerCommand(new CommandRedisBungeeDebug(plugin)); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
|     private static void registerContexts(CommandManager<?, ?, ?, ?, ?, ?> commandManager) { | ||||
|         CommandContexts<?> commandContexts = commandManager.getCommandContexts(); | ||||
|         commandContexts.registerContext(UUID.class, c -> { | ||||
|             String uuidString = c.popFirstArg(); | ||||
|             try { | ||||
|                 return UUID.fromString(uuidString); | ||||
|             } catch (IllegalArgumentException e) { | ||||
|                 throw new InvalidCommandArgument("invaild uuid"); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,49 @@ | ||||
| /* | ||||
|  * Copyright (c) 2013-present RedisBungee contributors | ||||
|  * | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  * | ||||
|  *  http://www.eclipse.org/legal/epl-v10.html | ||||
|  */ | ||||
| 
 | ||||
| package com.imaginarycode.minecraft.redisbungee.commands; | ||||
| 
 | ||||
| import co.aikar.commands.CommandIssuer; | ||||
| import co.aikar.commands.annotation.*; | ||||
| import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; | ||||
| import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; | ||||
| import net.kyori.adventure.text.Component; | ||||
| 
 | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| @CommandAlias("rbd|redisbungeedebug") | ||||
| @CommandPermission("redisbungee.command.debug.use") | ||||
| @Description("debug commands") | ||||
| public class CommandRedisBungeeDebug extends AdventureBaseCommand { | ||||
| 
 | ||||
|     private final RedisBungeePlugin<?> plugin; | ||||
| 
 | ||||
|     public CommandRedisBungeeDebug(RedisBungeePlugin<?> plugin) { | ||||
|         this.plugin = plugin; | ||||
|     } | ||||
| 
 | ||||
|     @Subcommand("kickByName") | ||||
|     @Description("kicks a player from the network by name") | ||||
|     @Private | ||||
|     public void kick(CommandIssuer issuer, String playerName) { | ||||
| 
 | ||||
|         plugin.getAbstractRedisBungeeApi().kickPlayer(playerName, Component.text("debug kick")); | ||||
|     } | ||||
| 
 | ||||
|     @Subcommand("kickByUUID") | ||||
|     @Description("kicks a player from the network by UUID") | ||||
|     @Private | ||||
|     public void kick(CommandIssuer issuer, UUID uuid) { | ||||
| 
 | ||||
|         plugin.getAbstractRedisBungeeApi().kickPlayer(uuid, Component.text("debug kick")); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -4,7 +4,7 @@ jedis = "5.2.0" | ||||
| okhttp = "4.12.0" | ||||
| configurateV3 = "3.7.3" | ||||
| caffeine = "3.1.8" | ||||
| adventure = "4.18.0" | ||||
| adventure = "4.19.0" | ||||
| adventure-bungeecord-platform = "4.3.4" | ||||
| acf = "e2005dd62d" | ||||
| bungeecordApi = "1.21-R0.1-SNAPSHOT" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user