Implement the debug command
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,4 @@
 | 
				
			|||||||
target/
 | 
					target/
 | 
				
			||||||
.idea/
 | 
					.idea/
 | 
				
			||||||
 | 
					*.secret
 | 
				
			||||||
 | 
					*.db
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					package net.knarcraft.stargate.command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import net.md_5.bungee.api.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
 | 
					import org.bukkit.command.Command;
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandExecutor;
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
 | 
					import org.bukkit.plugin.Plugin;
 | 
				
			||||||
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class CommandDebug implements CommandExecutor {
 | 
				
			||||||
 | 
					    private final Plugin plugin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public CommandDebug(Plugin stargate){
 | 
				
			||||||
 | 
					        this.plugin = stargate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
 | 
				
			||||||
 | 
					        ChatColor textColor = ChatColor.GOLD;
 | 
				
			||||||
 | 
					        ChatColor highlightColor = ChatColor.GREEN;
 | 
				
			||||||
 | 
					        commandSender.sendMessage(textColor + "Stargate version " + highlightColor + plugin.getDescription().getVersion()
 | 
				
			||||||
 | 
					                + textColor + "running on " + highlightColor + Bukkit.getServer().getVersion());
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -5,6 +5,7 @@ import net.md_5.bungee.api.ChatColor;
 | 
				
			|||||||
import org.bukkit.command.Command;
 | 
					import org.bukkit.command.Command;
 | 
				
			||||||
import org.bukkit.command.CommandExecutor;
 | 
					import org.bukkit.command.CommandExecutor;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
 | 
					import org.bukkit.plugin.Plugin;
 | 
				
			||||||
import org.jetbrains.annotations.NotNull;
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
@@ -16,6 +17,11 @@ import java.util.Arrays;
 | 
				
			|||||||
 * the plugin itself, not commands for functions of the plugin.</p>
 | 
					 * the plugin itself, not commands for functions of the plugin.</p>
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class CommandStarGate implements CommandExecutor {
 | 
					public class CommandStarGate implements CommandExecutor {
 | 
				
			||||||
 | 
					    private final Plugin stargate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public CommandStarGate(Plugin stargate) {
 | 
				
			||||||
 | 
					        this.stargate = stargate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
 | 
					    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
 | 
				
			||||||
@@ -28,6 +34,8 @@ public class CommandStarGate implements CommandExecutor {
 | 
				
			|||||||
            } else if (args[0].equalsIgnoreCase("config")) {
 | 
					            } else if (args[0].equalsIgnoreCase("config")) {
 | 
				
			||||||
                String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
 | 
					                String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
 | 
				
			||||||
                return new CommandConfig().onCommand(commandSender, command, s, subArgs);
 | 
					                return new CommandConfig().onCommand(commandSender, command, s, subArgs);
 | 
				
			||||||
 | 
					            } else if (args[0].equalsIgnoreCase("debug")) {
 | 
				
			||||||
 | 
					                return new CommandDebug(this.stargate).onCommand(commandSender, command, s, args);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user