Merge branch 'master' of ZeroHD/QoL into master

master
Etzelia 2018-10-30 19:51:50 +01:00 committed by Gitea
commit 2b2c732850
6 changed files with 35 additions and 8 deletions

View File

@ -10,3 +10,4 @@ Changelogs
v1.3 <v1.3>
v1.4 <v1.4>
v1.5 <v1.5>

View File

@ -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

View File

@ -39,6 +39,6 @@ Alias ``/names`` and ``/name``
``/karattrophy <name>`` awards the player the 24 Karat Trophy Advancement.
``/deathmute <name>`` mutes death messages from a player until a sever restart.
``/deathmute <name>`` toggles death messages on or off for a player.

View File

@ -3,7 +3,7 @@
<groupId>xyz.etztech</groupId>
<artifactId>QoL</artifactId>
<!-- Version is used in plugin.yml -->
<version>1.4</version>
<version>1.5</version>
<packaging>jar</packaging>
<!-- Plugin Information -->

View File

@ -220,9 +220,13 @@ public class QoL extends JavaPlugin {
}
}
public static void addDeathMute(Player player) {
public static boolean toggleDeathMute(Player player) {
if (!deathMutes.contains(player.getUniqueId())) {
deathMutes.add(player.getUniqueId());
return true;
} else {
deathMutes.remove(player.getUniqueId());
return false;
}
}

View File

@ -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 <player>");
EtzTechUtil.sms(commandSender, ChatColor.RED + "/deathmute <player>");
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.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();
}
EtzTechUtil.sms(commandSender, message);
QoL.addDeathMute(player);
return true;
}