From 86419f8772e4f1fa6907f1ea71bf05fead722416 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 29 Oct 2018 18:11:37 -0500 Subject: [PATCH 1/5] Added toggle to deathmute command --- src/main/java/xyz/etztech/qol/QoL.java | 6 +++++- .../xyz/etztech/qol/commands/DeathMuteCommand.java | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java index b731f2e..bc88a4d 100644 --- a/src/main/java/xyz/etztech/qol/QoL.java +++ b/src/main/java/xyz/etztech/qol/QoL.java @@ -220,9 +220,13 @@ public class QoL extends JavaPlugin { } } - public static void addDeathMute(Player player) { + public static boolean addDeathMute(Player player) { if (!deathMutes.contains(player.getUniqueId())) { deathMutes.add(player.getUniqueId()); + return true; + } else { + deathMutes.remove(player.getUniqueId()); + return false; } } diff --git a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java index d885c56..2e5fe47 100644 --- a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java +++ b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java @@ -21,13 +21,15 @@ public class DeathMuteCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) { + String message; + if (!commandSender.hasPermission("qol.deathmute")) { EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef()); return true; } if (args.length < 1) { - EtzTechUtil.sms(commandSender, ChatColor.RED + "/dm "); + EtzTechUtil.sms(commandSender, ChatColor.RED + "/deathmute "); return true; } @@ -40,10 +42,14 @@ public class DeathMuteCommand implements CommandExecutor { final Player player = argPlayer; - EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Death Muting " + ChatColor.YELLOW + - player.getName()); + if (QoL.addDeathMute(player)) { + message = ChatColor.GREEN + "Muting death messages from" + ChatColor.YELLOW + player.getName(); + } else { + message = ChatColor.GREEN + "Unmuting death messages from" + ChatColor.YELLOW + player.getName(); + } + + EtzTechUtil.sms(commandSender, message); - QoL.addDeathMute(player); return true; } From e9e43b84a758b8d01794cf8726d41ac3a3878cc5 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 29 Oct 2018 18:25:09 -0500 Subject: [PATCH 2/5] Added space in death mute message --- src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java index 2e5fe47..49c9926 100644 --- a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java +++ b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java @@ -43,9 +43,9 @@ public class DeathMuteCommand implements CommandExecutor { final Player player = argPlayer; if (QoL.addDeathMute(player)) { - message = ChatColor.GREEN + "Muting death messages from" + ChatColor.YELLOW + player.getName(); + message = ChatColor.GREEN + "Muting death messages from " + ChatColor.YELLOW + player.getName(); } else { - message = ChatColor.GREEN + "Unmuting death messages from" + ChatColor.YELLOW + player.getName(); + message = ChatColor.GREEN + "Unmuting death messages from " + ChatColor.YELLOW + player.getName(); } EtzTechUtil.sms(commandSender, message); From 2cdc56c6e293455daf196c384c0a7e3dabc39cac Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 30 Oct 2018 13:39:53 -0500 Subject: [PATCH 3/5] renamed addDeathMute() to toggleDeathMute --- src/main/java/xyz/etztech/qol/QoL.java | 2 +- src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java index bc88a4d..48507c4 100644 --- a/src/main/java/xyz/etztech/qol/QoL.java +++ b/src/main/java/xyz/etztech/qol/QoL.java @@ -220,7 +220,7 @@ public class QoL extends JavaPlugin { } } - public static boolean addDeathMute(Player player) { + public static boolean toggleDeathMute(Player player) { if (!deathMutes.contains(player.getUniqueId())) { deathMutes.add(player.getUniqueId()); return true; diff --git a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java index 49c9926..add16b2 100644 --- a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java +++ b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java @@ -42,7 +42,7 @@ public class DeathMuteCommand implements CommandExecutor { final Player player = argPlayer; - if (QoL.addDeathMute(player)) { + if (QoL.toggleDeathMute(player)) { message = ChatColor.GREEN + "Muting death messages from " + ChatColor.YELLOW + player.getName(); } else { message = ChatColor.GREEN + "Unmuting death messages from " + ChatColor.YELLOW + player.getName(); From 0d3c081bac0b262082080a3ad07f0a3811752fd7 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 30 Oct 2018 13:47:21 -0500 Subject: [PATCH 4/5] Updated docs for v1.5 Added /deathmute changes to docs --- docs/source/changelog/index.rst | 3 ++- docs/source/changelog/v1.5.rst | 16 ++++++++++++++++ docs/source/commands.rst | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 docs/source/changelog/v1.5.rst diff --git a/docs/source/changelog/index.rst b/docs/source/changelog/index.rst index 3323717..2378709 100644 --- a/docs/source/changelog/index.rst +++ b/docs/source/changelog/index.rst @@ -9,4 +9,5 @@ Changelogs :maxdepth: 1 v1.3 - v1.4 \ No newline at end of file + v1.4 + v1.5 \ No newline at end of file diff --git a/docs/source/changelog/v1.5.rst b/docs/source/changelog/v1.5.rst new file mode 100644 index 0000000..5b24afc --- /dev/null +++ b/docs/source/changelog/v1.5.rst @@ -0,0 +1,16 @@ +.. include:: ../common.rst + +.. _qol_v1.5: + +QoL v1.5 +======== + +Additions +--------- +* `Death Mutes Now Toggleable`_ - ``/deathmute`` now toggles death messages on or off for a player + +.. _Death Mutes Now Toggleable: https://git.etztech.xyz/Etzelia/QoL/issues/20 + +Bug Fixes +--------- +None \ No newline at end of file diff --git a/docs/source/commands.rst b/docs/source/commands.rst index 6654170..0d3659e 100644 --- a/docs/source/commands.rst +++ b/docs/source/commands.rst @@ -39,6 +39,6 @@ Alias ``/names`` and ``/name`` ``/karattrophy `` awards the player the 24 Karat Trophy Advancement. -``/deathmute `` mutes death messages from a player until a sever restart. +``/deathmute `` toggles death messages on or off for a player. From 678d549c2bee669ec0ca1c38a3dda21df207462a Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 30 Oct 2018 13:50:41 -0500 Subject: [PATCH 5/5] Updated version to 1.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 91c1ba3..f2b4272 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xyz.etztech QoL - 1.4 + 1.5 jar