-
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.
- Loading branch information
1 parent
667b139
commit 05e84a5
Showing
5 changed files
with
102 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
src/main/java/net/lewmc/jailhouse/commands/JailhouseCommand.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,43 @@ | ||
package net.lewmc.jailhouse.commands; | ||
|
||
import net.lewmc.jailhouse.Jailhouse; | ||
import net.lewmc.jailhouse.utils.MessageUtil; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class JailhouseCommand implements CommandExecutor { | ||
private final Jailhouse plugin; | ||
|
||
/** | ||
* Constructor for the JailhouseCommand class. | ||
* @param plugin References to the main plugin class. | ||
*/ | ||
public JailhouseCommand(Jailhouse plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
/** | ||
* /jailhouse command handler. | ||
* @param commandSender Information about who sent the command - player or console. | ||
* @param command Information about what command was sent. | ||
* @param s Command label - not used here. | ||
* @param args The command's arguments. | ||
* @return boolean true/false - was the command accepted and processed or not? | ||
*/ | ||
@Override | ||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) { | ||
|
||
MessageUtil message = new MessageUtil(commandSender, this.plugin); | ||
|
||
if (command.getName().equalsIgnoreCase("jailhouse")) { | ||
message.PrivateMessage("Running Jailhouse version " + plugin.getDescription().getVersion()); | ||
message.PrivateMessage("Created by LewMC."); | ||
|
||
return true; | ||
} | ||
|
||
return true; | ||
} | ||
} |
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,42 @@ | ||
package net.lewmc.jailhouse.utils; | ||
|
||
import net.lewmc.jailhouse.Jailhouse; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.CommandSender; | ||
|
||
/** | ||
* Jailhouse's Messaging Utility | ||
*/ | ||
public class MessageUtil { | ||
|
||
private final CommandSender cs; | ||
private final Jailhouse plugin; | ||
|
||
/** | ||
* Constructor for the MessageUtil class | ||
* | ||
* @param cs CommandSender - the user who sent the command. | ||
* @param plugin Reference to the main Essence class. | ||
*/ | ||
public MessageUtil(CommandSender cs, Jailhouse plugin) { | ||
this.cs = cs; | ||
this.plugin = plugin; | ||
} | ||
|
||
/** | ||
* Send a message to the user. | ||
* @param message String - The message taken from the language file. | ||
*/ | ||
public void PrivateMessage(String message) { | ||
this.cs.sendMessage(ChatColor.GOLD + "[Jailhouse] " + ChatColor.YELLOW + message); | ||
} | ||
|
||
/** | ||
* Send a message to a specific user. | ||
* @param cs CommandSender - Who to send the message to. | ||
* @param message String - The message taken from the language file. | ||
*/ | ||
public void SendTo(CommandSender cs, String message) { | ||
cs.sendMessage(ChatColor.GOLD + "[Jailhouse] " + ChatColor.YELLOW + message); | ||
} | ||
} |
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 @@ | ||
bans: |
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