diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index 1729f6a..42f4955 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -19,8 +19,11 @@ import com.graywolf336.jail.command.commands.JailCommand; import com.graywolf336.jail.command.commands.JailCreateCommand; import com.graywolf336.jail.command.commands.JailListCellsCommand; import com.graywolf336.jail.command.commands.JailListCommand; +import com.graywolf336.jail.command.commands.JailMuteCommand; import com.graywolf336.jail.command.commands.JailRemoveCellCommand; import com.graywolf336.jail.command.commands.JailStopCommand; +import com.graywolf336.jail.command.commands.JailTeleInCommand; +import com.graywolf336.jail.command.commands.JailTeleOutCommand; import com.graywolf336.jail.command.commands.JailVersionCommand; import com.graywolf336.jail.command.commands.UnHandCuffCommand; import com.graywolf336.jail.command.commands.UnjailCommand; @@ -156,8 +159,11 @@ public class CommandHandler { load(JailCreateCommand.class); load(JailListCellsCommand.class); load(JailListCommand.class); + load(JailMuteCommand.class); load(JailRemoveCellCommand.class); load(JailStopCommand.class); + load(JailTeleInCommand.class); + load(JailTeleOutCommand.class); load(JailVersionCommand.class); load(UnHandCuffCommand.class); load(UnjailCommand.class); diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailListCommand.java b/src/main/java/com/graywolf336/jail/command/commands/JailListCommand.java index e7bba19..11dedb1 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailListCommand.java +++ b/src/main/java/com/graywolf336/jail/command/commands/JailListCommand.java @@ -18,8 +18,6 @@ import com.graywolf336.jail.enums.LangString; usage = "/jaillist" ) public class JailListCommand implements Command { - - @Override public boolean execute(JailManager jm, CommandSender sender, String... args) { sender.sendMessage(ChatColor.AQUA + "----------Jails----------"); diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java b/src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java new file mode 100644 index 0000000..3c52366 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java @@ -0,0 +1,38 @@ +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; +import com.graywolf336.jail.enums.LangString; + +@CommandInfo( + maxArgs = 1, + minimumArgs = 1, + needsPlayer = false, + pattern = "jailmute|jmute", + permission = "jail.command.jailmute", + usage = "/jailmute " + ) +public class JailMuteCommand implements Command { + public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { + //Let's check if the player they're sending us is jailed + if(jm.isPlayerJailed(args[0])) { + //They are, so let's toggle whether they are muted or not + boolean muted = !jm.getPrisoner(args[0]).isMuted(); + jm.getPrisoner(args[0]).setMuted(muted); + + //Send the message to the sender based upon whether they are muted or unmuted + if(muted) + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWMUTED, args[0])); + else + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWUNMUTED, args[0])); + }else { + //The player provided is not jailed, so let's tell the sender that + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOTJAILED, args[0])); + } + + return true; + } +} diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java b/src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java new file mode 100644 index 0000000..41780f9 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java @@ -0,0 +1,54 @@ +package com.graywolf336.jail.command.commands; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.graywolf336.jail.JailManager; +import com.graywolf336.jail.beans.Jail; +import com.graywolf336.jail.command.Command; +import com.graywolf336.jail.command.CommandInfo; +import com.graywolf336.jail.enums.LangString; + +@CommandInfo( + maxArgs = 2, + minimumArgs = 1, + needsPlayer = false, + pattern = "jailtelein|jailteleportin", + permission = "jail.command.jailtelein", + usage = "/jailtelein (player)" + ) +public class JailTeleInCommand implements Command { + public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { + Jail j = jm.getJail(args[0]); + + //The jail doesn't exist + if(j == null) { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[0])); + }else { + //The jail does exist + //now let's check the size of the command + //if it has two args then someone is sending someone else in + //otherwise it is just the sender going in + if(args.length == 2) { + Player p = jm.getPlugin().getServer().getPlayer(args[1]); + + //If the player they're trying to send is offline, don't do anything + if(p == null) { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[1])); + }else { + p.teleport(j.getTeleportIn()); + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { args[1], args[0] })); + } + }else { + if(sender instanceof Player) { + ((Player) sender).teleport(j.getTeleportIn()); + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEIN, new String[] { sender.getName(), args[0] })); + }else { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED)); + } + } + } + + return true; + } +} diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java b/src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java new file mode 100644 index 0000000..b30247d --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java @@ -0,0 +1,54 @@ +package com.graywolf336.jail.command.commands; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.graywolf336.jail.JailManager; +import com.graywolf336.jail.beans.Jail; +import com.graywolf336.jail.command.Command; +import com.graywolf336.jail.command.CommandInfo; +import com.graywolf336.jail.enums.LangString; + +@CommandInfo( + maxArgs = 2, + minimumArgs = 1, + needsPlayer = false, + pattern = "jailteleout|jailteleportout", + permission = "jail.command.jailteleout", + usage = "/jailteleout (player)" + ) +public class JailTeleOutCommand implements Command { + public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { + Jail j = jm.getJail(args[0]); + + //The jail doesn't exist + if(j == null) { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[0])); + }else { + //The jail does exist + //now let's check the size of the command + //if it has two args then someone is sending someone else in + //otherwise it is just the sender going in + if(args.length == 2) { + Player p = jm.getPlugin().getServer().getPlayer(args[1]); + + //If the player they're trying to send is offline, don't do anything + if(p == null) { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE, args[1])); + }else { + p.teleport(j.getTeleportFree()); + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { args[1], args[0] })); + } + }else { + if(sender instanceof Player) { + ((Player) sender).teleport(j.getTeleportFree()); + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.TELEOUT, new String[] { sender.getName(), args[0] })); + }else { + sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERCONTEXTREQUIRED)); + } + } + } + + return true; + } +} diff --git a/src/main/java/com/graywolf336/jail/enums/LangString.java b/src/main/java/com/graywolf336/jail/enums/LangString.java index fa8b72e..3975521 100644 --- a/src/main/java/com/graywolf336/jail/enums/LangString.java +++ b/src/main/java/com/graywolf336/jail/enums/LangString.java @@ -48,6 +48,10 @@ public enum LangString { NOEMPTYCELLS ("jailing"), /** The message sent when a player is not jailed and the sender is trying to see/do something about it. */ NOTJAILED ("jailing"), + /** The message sent to the sender when they mute a prisoner. */ + NOWMUTED ("jailing"), + /** The message sent to the sender when they unmute a prisoner. */ + NOWUNMUTED ("jailing"), /** The message sent to the jailer when they jail someone offline. */ OFFLINEJAIL ("jailing"), /** The message sent to the jailer when they jail someone who is online. */ @@ -58,6 +62,10 @@ public enum LangString { PROTECTIONMESSAGENOPENALTY ("jailing"), /** The message sent to the sender of a command when suggesting a cell. */ SUGGESTEDCELL ("jailing"), + /** The message sent to the sender when they teleport someone to a jail's teleport in location. */ + TELEIN ("jailing"), + /** The message sent to the sender when they teleport someone to a jail's teleport out location. */ + TELEOUT ("jailing"), /** The message sent when players are released from jail. */ UNJAILED ("jailing"), /** The message went when an offline player is unjailed. */ diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index 3407ebb..b17c275 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -36,11 +36,15 @@ language: muted: '&cStop talking, you are in jail.' noemptycells: '&cNo empty cells were found for %0%, all them appear to be full.' notjailed: '&c%0% is not jailed.' + nowmuted: '&9%0% is now muted.' + nowunmuted: '&9%0% is now unmuted.' offlinejail: '&2%0% is offline and will be jailed when they next come online for %1% minutes.' onlinejail: '&2%0% was jailed for %1% minutes.' protectionmessage: '&c%0% minutes have been added to your time for %1%.' protectionmessagenopenalty: '&cProtection enabled for %0%, do not do it again.' suggestedcell: '&cAn empty cell in the same jail, %0%, was found: %1%' + telein: "&9Teleported %0% to %1%'s teleport in location." + teleout: "&9Teleported %0% to %1%'s teleport out location." unjailed: '&2You have been released! Please respect the server rules.' willbeunjailed: '&2%0% will be released the next time they log on.' handcuffing: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e81041d..c4bb4f3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ version: ${project.version}-b${BUILD_NUMBER} description: Ban too harsh? Kick/mute/whatever not enough? Jail bad players! authors: [matejdro,multidude,graywolf336] website: dev.bukkit.org/server-mods/jail/ -softdepend: [Spout, WorldEdit, Vault, Notifications] +softdepend: [WorldEdit, Vault] load: POSTWORLD commands: jailcreate: