First commit, converted to a truely maven project and switching over to my own repository for better management.
This commit is contained in:
@ -0,0 +1,61 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.beans.Cell;
|
||||
import com.graywolf336.jail.beans.Jail;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 2,
|
||||
minimumArgs = 2,
|
||||
needsPlayer = true,
|
||||
pattern = "jailcreatecells|jcc",
|
||||
permission = "jail.command.jailcreatecells",
|
||||
usage = "/jailcellcreate [jail] [cellname]"
|
||||
)
|
||||
public class CellCreateCommand implements Command {
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
Player player = (Player) sender;
|
||||
String name = player.getName();
|
||||
String jail = args[0].toLowerCase();
|
||||
String cell = args[1];
|
||||
|
||||
//Check if the player is currently creating something else
|
||||
if(jm.isCreatingSomething(name)) {
|
||||
String message = jm.getStepMessage(name);
|
||||
if(!message.isEmpty()) {
|
||||
player.sendMessage(ChatColor.RED + message);
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "You're already creating something else, please finish it or cancel.");
|
||||
}
|
||||
}else {
|
||||
//Not creating anything, so let them create some cells.
|
||||
if(jm.isValidJail(jail)) {
|
||||
Jail j = jm.getJail(jail);
|
||||
Cell c = j.getCell(cell);
|
||||
|
||||
//No cell found
|
||||
if(c == null) {
|
||||
if(jm.addCreatingCell(name, jail, cell)) {
|
||||
jm.getCellCreationSteps().startStepping(player);
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "Appears you're creating a cell or something went wrong on our side.");
|
||||
}
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "There's already a cell with the name '" + cell + "', please pick a new one or remove that cell.");
|
||||
}
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "No such jail found by the name of '" + jail + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 1,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = true,
|
||||
pattern = "jailcheck|jcheck",
|
||||
permission = "jail.command.jailcheck",
|
||||
usage = "/jailcheck (Player name)"
|
||||
)
|
||||
public class JailCheckCommand implements Command{
|
||||
|
||||
// Checks the status of the specified prisoner, if no args, will display all players currently jailed
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
return true; //If they made it this far, the command is intact and ready to be processed. :)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 1,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "jailclear|jclear",
|
||||
permission = "jail.command.jailclear",
|
||||
usage = "/jailclear (Jail name)"
|
||||
)
|
||||
public class JailClearCommand implements Command {
|
||||
|
||||
// If Jail is specified clear all prisoners from that Jail (new feature) else, clear all players from all jails
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
return true; //If they made it this far, the command is intact and ready to be processed. :)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = -1,
|
||||
minimumArgs = 1,
|
||||
needsPlayer = false,
|
||||
pattern = "jail|j",
|
||||
permission = "jail.command.jail",
|
||||
usage = "/jail [name] (time) (j:Jail name) (c:Cell name) (r:Reason) (m:Muted)"
|
||||
)
|
||||
public class JailCommand implements Command {
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
return true; //If they made it this far, the command is intact and ready to be processed. :)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 1,
|
||||
minimumArgs = 1,
|
||||
needsPlayer = true,
|
||||
pattern = "jailcreate|jc",
|
||||
permission = "jail.command.jailcreate",
|
||||
usage = "/jailcreate [name]"
|
||||
)
|
||||
public class JailCreateCommand implements Command {
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
Player player = (Player) sender;
|
||||
String name = player.getName();
|
||||
String jail = args[0];
|
||||
|
||||
//Check if the player is currently creating something else
|
||||
if(jm.isCreatingSomething(name)) {
|
||||
String message = jm.getStepMessage(name);
|
||||
if(!message.isEmpty()) {
|
||||
player.sendMessage(ChatColor.RED + message);
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "You're already creating something else, please finish it or cancel.");
|
||||
}
|
||||
}else {
|
||||
if(jm.isValidJail(jail)) {
|
||||
player.sendMessage(ChatColor.RED + "Jail by the name of '" + jail + "' already exist!");
|
||||
}else {
|
||||
if(jm.addCreatingJail(name, jail)) {
|
||||
jm.getJailCreationSteps().startStepping(player);
|
||||
}else {
|
||||
player.sendMessage(ChatColor.RED + "Seems like you're already creating a Jail or something went wrong on our side.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 2,
|
||||
minimumArgs = 1,
|
||||
needsPlayer = true,
|
||||
pattern = "jailremovecell|jrcell",
|
||||
permission = "jail.command.jailremovecell",
|
||||
usage = "/jailremovecell [Jail Name] (Cell Name)"
|
||||
)
|
||||
public class JailRemoveCellCommand implements Command{
|
||||
|
||||
// Remove the specified Cell from the Specified Jail, if no cell specified will delete nearest cell
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
return true; //If they made it this far, the command is intact and ready to be processed. :)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 0,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = true,
|
||||
pattern = "jailstop",
|
||||
permission = "jail.command.jailstop",
|
||||
usage = "/jailstop"
|
||||
)
|
||||
public class JailStopCommand implements Command {
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
jm.removeJailCreationPlayer(sender.getName());
|
||||
jm.removeCellCreationPlayer(sender.getName());
|
||||
|
||||
sender.sendMessage("Any creations, jail or cell, have been stopped.");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 0,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "jailversion|jv",
|
||||
permission = "jail.command.jailversion",
|
||||
usage = "/jailversion"
|
||||
)
|
||||
public class JailVersionCommand implements Command{
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
// Sends the version number to the sender
|
||||
sender.sendMessage("Jail Version: " + jm.getPlugin().getDescription().getVersion());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user