diff --git a/pom.xml b/pom.xml
index 592f269..085cf1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
xyz.etztech
EtzCore
- 1.2
+ 1.0.4
compile
@@ -58,12 +58,6 @@
2.6
provided
-
- org.apache.httpcomponents
- httpclient
- 4.5.5
- provided
-
diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java
index 7c567b8..532936e 100644
--- a/src/main/java/xyz/etztech/qol/QoL.java
+++ b/src/main/java/xyz/etztech/qol/QoL.java
@@ -13,14 +13,12 @@ import xyz.etztech.qol.other.TPSRunnable;
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import java.util.logging.Logger;
-@MavenLibrary(group = "org.apache.httpcomponents", artifact = "httpcore", version = "4.4.9")
-@MavenLibrary(group = "org.apache.httpcomponents", artifact = "httpclient", version = "4.5.5")
@MavenLibrary(group = "net.ess3", artifact = "Essentials", version = "2.13.1", repository = "http://repo.ess3.net/content/groups/essentials")
@MavenLibrary(group = "us.dynmap", artifact = "dynmap-api", version = "1.9.4", repository = "http://repo.mikeprimm.com/")
@MavenLibrary(group = "commons-lang", artifact = "commons-lang", version = "2.6")
-@MavenLibrary(group = "commons-logging", artifact = "commons-logging", version = "1.2")
public class QoL extends MavenPlugin {
private static QoL instance;
@@ -30,7 +28,8 @@ public class QoL extends MavenPlugin {
public static FileConfiguration config;
private Logger log = Logger.getLogger( "Minecraft" );
- private static List mutes = new ArrayList<>();
+ private static List mutes = new ArrayList<>();
+ private static List deathMutes = new ArrayList<>();
private static boolean whitelist = false;
private static boolean timeout = false;
private static List audits = new ArrayList<>();
@@ -96,6 +95,10 @@ public class QoL extends MavenPlugin {
this.getCommand("colors").setExecutor(colorsCommand);
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
+ DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
+ this.getCommand("deathmute").setExecutor(deathMuteCommand);
+ KaratTrophyCommand karatTrophyCommand = new KaratTrophyCommand(this);
+ this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
if (getConfig().getStringList("list").size() > 0) {
ListCommand listCommand = new ListCommand(this);
@@ -216,19 +219,25 @@ public class QoL extends MavenPlugin {
}
public static void addSM(Player player) {
- if (!mutes.contains(player.getUniqueId().toString())) {
- mutes.add(player.getUniqueId().toString());
+ if (!mutes.contains(player.getUniqueId())) {
+ mutes.add(player.getUniqueId());
}
}
-
-
- public static boolean hasSM(Player player) {
- return mutes.contains(player.getUniqueId().toString());
+ public static void addDeathMute(Player player) {
+ if (!deathMutes.contains(player.getUniqueId())) {
+ deathMutes.add(player.getUniqueId());
+ }
}
+ public static boolean hasSM(Player player) {
+ return mutes.contains(player.getUniqueId());
+ }
+
+ public static boolean hasDeathMute(Player player) { return deathMutes.contains(player.getUniqueId()); }
+
public static void removeSM(Player player) {
- mutes.remove(player.getUniqueId().toString());
+ mutes.remove(player.getUniqueId());
}
public static boolean getWhitelist() {
diff --git a/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java
new file mode 100644
index 0000000..d885c56
--- /dev/null
+++ b/src/main/java/xyz/etztech/qol/commands/DeathMuteCommand.java
@@ -0,0 +1,51 @@
+package xyz.etztech.qol.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import xyz.etztech.qol.EtzTechUtil;
+import xyz.etztech.qol.Lang;
+import xyz.etztech.qol.QoL;
+
+public class DeathMuteCommand implements CommandExecutor {
+
+ QoL plugin;
+
+ public DeathMuteCommand(QoL paramQoL)
+ {
+ this.plugin = paramQoL;
+ }
+
+ @Override
+ public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
+ if (!commandSender.hasPermission("qol.deathmute")) {
+ EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
+ return true;
+ }
+
+ if (args.length < 1) {
+ EtzTechUtil.sms(commandSender, ChatColor.RED + "/dm ");
+ return true;
+ }
+
+ Player argPlayer = Bukkit.getPlayer(args[0]);
+
+ if (argPlayer == null) {
+ EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
+ return true;
+ }
+
+ final Player player = argPlayer;
+
+ EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Death Muting " + ChatColor.YELLOW +
+ player.getName());
+
+ QoL.addDeathMute(player);
+ return true;
+ }
+
+
+}
diff --git a/src/main/java/xyz/etztech/qol/commands/KaratTrophyCommand.java b/src/main/java/xyz/etztech/qol/commands/KaratTrophyCommand.java
new file mode 100644
index 0000000..322f95a
--- /dev/null
+++ b/src/main/java/xyz/etztech/qol/commands/KaratTrophyCommand.java
@@ -0,0 +1,50 @@
+package xyz.etztech.qol.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.advancement.Advancement;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.NamespacedKey;
+import xyz.etztech.qol.EtzTechUtil;
+import xyz.etztech.qol.Lang;
+import xyz.etztech.qol.QoL;
+
+public class KaratTrophyCommand implements CommandExecutor {
+
+ QoL plugin;
+
+ public KaratTrophyCommand(QoL plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public boolean onCommand(CommandSender commandSender, Command command, String s, String args[]) {
+ if (!commandSender.hasPermission("qol.karattrophy")) {
+ EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
+ return true;
+ }
+
+ Player argPlayer = Bukkit.getPlayer(args[0]);
+
+ if (argPlayer == null) {
+ EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
+ return true;
+ }
+
+ final Player player = argPlayer;
+
+ Advancement adv = Bukkit.getAdvancement(new NamespacedKey("carrotcraft", "24_karat_trophy"));
+
+ if (!player.getAdvancementProgress(adv).isDone()) {
+ EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Awarding 24 Karat Trophy to " + player.getName());
+ player.getAdvancementProgress(adv).awardCriteria("win");
+ } else {
+ EtzTechUtil.sms(commandSender, ChatColor.RED + player.getName() + " already has the 24 Karat Trophy");
+ }
+
+ return true;
+ }
+}
diff --git a/src/main/java/xyz/etztech/qol/commands/ShadowMuteCommand.java b/src/main/java/xyz/etztech/qol/commands/ShadowMuteCommand.java
index 1e52dab..160f75c 100644
--- a/src/main/java/xyz/etztech/qol/commands/ShadowMuteCommand.java
+++ b/src/main/java/xyz/etztech/qol/commands/ShadowMuteCommand.java
@@ -2,8 +2,6 @@ package xyz.etztech.qol.commands;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -13,14 +11,6 @@ import xyz.etztech.qol.Lang;
import xyz.etztech.qol.QoL;
import xyz.etztech.qol.other.ShadowMuteTime;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
public class ShadowMuteCommand implements CommandExecutor {
@@ -44,17 +34,13 @@ public class ShadowMuteCommand implements CommandExecutor {
return true;
}
- Player argPlayer = null;
- for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
- if (onlinePlayer.getName().equalsIgnoreCase(args[0])) {
- argPlayer = onlinePlayer;
- }
- }
+ Player argPlayer = Bukkit.getPlayer(args[0]);
if (argPlayer == null) {
EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
return true;
}
+
final Player player = argPlayer;
ShadowMuteTime smt;
diff --git a/src/main/java/xyz/etztech/qol/listeners/DeathListener.java b/src/main/java/xyz/etztech/qol/listeners/DeathListener.java
index c958dae..116db78 100644
--- a/src/main/java/xyz/etztech/qol/listeners/DeathListener.java
+++ b/src/main/java/xyz/etztech/qol/listeners/DeathListener.java
@@ -26,16 +26,19 @@ public class DeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent event) {
String message = event.getDeathMessage();
+
event.setDeathMessage("");
- Location location = event.getEntity().getLocation();
- String coords = StringUtils.join(Arrays.asList(location.getBlockX(), location.getBlockY(), location.getBlockZ()), ", ");
+ if (!plugin.hasDeathMute(event.getEntity().getPlayer())) {
+ Location location = event.getEntity().getLocation();
+ String coords = StringUtils.join(Arrays.asList(location.getBlockX(), location.getBlockY(), location.getBlockZ()), ", ");
- TextComponent newMessage = new TextComponent(message);
- newMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Location: " + coords).create()));
+ TextComponent newMessage = new TextComponent(message);
+ newMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Location: " + coords).create()));
- for (Player player : Bukkit.getOnlinePlayers()) {
- player.spigot().sendMessage(newMessage);
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ player.spigot().sendMessage(newMessage);
+ }
}
}
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 05091c3..1456734 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -33,10 +33,16 @@ commands:
shadowmute:
description: Shadow Mute command
aliases: [sm]
+ deathmute:
+ description: Death mute command
+ aliases: [dm]
whitelist:
description: Whitelist command
timeout:
description: Timeout command
+ karattrophy:
+ description: 24 karat trophy command
+ aliases: [trophy]
permissions:
qol.admin:
description: Ability to reload the plugin
@@ -65,6 +71,12 @@ permissions:
qol.shadowmute:
description: Ability to use the Shadow Mute command
default: op
+ qol.deathmute:
+ description: Ability to use the Death Mute command
+ default: op
+ qol.karattrophy:
+ description: to use the Karat Trophy Command
+ default: op
qol.auditable:
description: Audits command usage
default: op
@@ -91,3 +103,4 @@ permissions:
children:
qol.timeout.bypass: true
+