Add handcuffing, next commit will be handcuff listeners.
This commit is contained in:
@ -12,6 +12,7 @@ import com.graywolf336.jail.JailMain;
|
||||
import com.graywolf336.jail.JailManager;
|
||||
|
||||
import com.graywolf336.jail.command.commands.CellCreateCommand;
|
||||
import com.graywolf336.jail.command.commands.HandCuffCommand;
|
||||
import com.graywolf336.jail.command.commands.JailCheckCommand;
|
||||
import com.graywolf336.jail.command.commands.JailClearCommand;
|
||||
import com.graywolf336.jail.command.commands.JailCommand;
|
||||
@ -21,6 +22,7 @@ import com.graywolf336.jail.command.commands.JailListCommand;
|
||||
import com.graywolf336.jail.command.commands.JailRemoveCellCommand;
|
||||
import com.graywolf336.jail.command.commands.JailStopCommand;
|
||||
import com.graywolf336.jail.command.commands.JailVersionCommand;
|
||||
import com.graywolf336.jail.command.commands.UnHandCuffCommand;
|
||||
import com.graywolf336.jail.command.commands.UnjailCommand;
|
||||
|
||||
/**
|
||||
@ -139,6 +141,7 @@ public class CommandHandler {
|
||||
/** Loads all the commands into the hashmap. */
|
||||
private void loadCommands() {
|
||||
load(CellCreateCommand.class);
|
||||
load(HandCuffCommand.class);
|
||||
load(JailCheckCommand.class);
|
||||
load(JailClearCommand.class);
|
||||
load(JailCommand.class);
|
||||
@ -148,6 +151,7 @@ public class CommandHandler {
|
||||
load(JailRemoveCellCommand.class);
|
||||
load(JailStopCommand.class);
|
||||
load(JailVersionCommand.class);
|
||||
load(UnHandCuffCommand.class);
|
||||
load(UnjailCommand.class);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
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 = false,
|
||||
pattern = "handcuff|hc",
|
||||
permission = "jail.command.handcuff",
|
||||
usage = "/handcuff [player]"
|
||||
)
|
||||
public class HandCuffCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
Player player = jm.getPlugin().getServer().getPlayer(args[0]);
|
||||
|
||||
if(player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That player is not online!");
|
||||
}else if(player.hasPermission("jail.cantbehandcuffed")) {
|
||||
sender.sendMessage(ChatColor.RED + "That player can't be handcuffed.");
|
||||
}else if(jm.isPlayerJailed(player.getName())) {
|
||||
sender.sendMessage(ChatColor.RED + "That player is currently jailed, you can't handcuff a prisoner.");
|
||||
}else if(jm.getPlugin().getHandCuffManager().isHandCuffed(player.getName())) {
|
||||
sender.sendMessage(ChatColor.GREEN + "That player is already handcuffed, releasing them now!");
|
||||
jm.getPlugin().getHandCuffManager().removeHandCuffs(player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "Your handcuffs have been rmeoved.");
|
||||
}else {
|
||||
jm.getPlugin().getHandCuffManager().addHandCuffs(player.getName(), player.getLocation());
|
||||
sender.sendMessage(ChatColor.BLUE + args[0] + ChatColor.GREEN + " has been handcuffed!");
|
||||
player.sendMessage(ChatColor.RED + "You've been handcuffed.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
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 = false,
|
||||
pattern = "unhandcuff|uhc",
|
||||
permission = "jail.command.handcuff",
|
||||
usage = "/unhandcuff [player]"
|
||||
)
|
||||
public class UnHandCuffCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
Player player = jm.getPlugin().getServer().getPlayerExact(args[0]);
|
||||
|
||||
if(player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That player is not online!");
|
||||
}else if(jm.getPlugin().getHandCuffManager().isHandCuffed(player.getName())) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Releasing them now!");
|
||||
jm.getPlugin().getHandCuffManager().removeHandCuffs(player.getName());
|
||||
player.sendMessage(ChatColor.GREEN + "Your handcuffs have been rmeoved.");
|
||||
}else {
|
||||
sender.sendMessage(ChatColor.BLUE + player.getName() + ChatColor.RED + " doesn't have any handcuffs to remove!");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user