-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Made command event optional and removed redundant comments
feat: Created example command
- Loading branch information
IanTapply22
committed
May 28, 2024
1 parent
9d57032
commit 8a6bdf5
Showing
3 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/com/iantapply/wynncraft/command/commands/ExampleCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.iantapply.wynncraft.command.commands; | ||
|
||
import com.iantapply.wynncraft.command.WynncraftCommand; | ||
import org.bukkit.command.CommandSender; | ||
|
||
public class ExampleCommand extends WynncraftCommand { | ||
/** | ||
* The name that is appended after the leading '/' character | ||
* | ||
* @return The name | ||
*/ | ||
@Override | ||
public String name() { | ||
return "example"; | ||
} | ||
|
||
/** | ||
* The syntax of the command to display in the help menu and other places | ||
* This should be in the format of "command [args]" | ||
* | ||
* @return The syntax | ||
*/ | ||
@Override | ||
public String syntax() { | ||
return "example"; | ||
} | ||
|
||
/** | ||
* The description of the command to display in the help menu and other places | ||
* | ||
* @return The description | ||
*/ | ||
@Override | ||
public String description() { | ||
return "An example command using the Wynncraft command framework"; | ||
} | ||
|
||
/** | ||
* The minimum amount of arguments that are required to execute the command | ||
* | ||
* @return The minimum amount of arguments | ||
*/ | ||
@Override | ||
public int minArgs() { | ||
return 0; | ||
} | ||
|
||
/** | ||
* The maximum amount of arguments that are required to execute the command | ||
* | ||
* @return The maximum amount of arguments | ||
*/ | ||
@Override | ||
public int maxArgs() { | ||
return 0; | ||
} | ||
/** | ||
* The method that is called when the command is executed | ||
* | ||
* @param sender The sender of the command | ||
* @param args The arguments of the command | ||
* @return | ||
*/ | ||
@Override | ||
public boolean execute(CommandSender sender, String[] args) throws Exception { | ||
sender.sendMessage("This is an example command!"); | ||
return false; | ||
} | ||
} |