forked from Minecraft/QoL
commit
5c8265d468
|
@ -13,6 +13,7 @@ import xyz.etztech.qol.other.TPSRunnable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@MavenLibrary(group = "net.ess3", artifact = "Essentials", version = "2.13.1", repository = "http://repo.ess3.net/content/groups/essentials")
|
@MavenLibrary(group = "net.ess3", artifact = "Essentials", version = "2.13.1", repository = "http://repo.ess3.net/content/groups/essentials")
|
||||||
|
@ -27,7 +28,8 @@ public class QoL extends MavenPlugin {
|
||||||
public static FileConfiguration config;
|
public static FileConfiguration config;
|
||||||
private Logger log = Logger.getLogger( "Minecraft" );
|
private Logger log = Logger.getLogger( "Minecraft" );
|
||||||
|
|
||||||
private static List<String> mutes = new ArrayList<>();
|
private static List<UUID> mutes = new ArrayList<>();
|
||||||
|
private static List<UUID> deathMutes = new ArrayList<>();
|
||||||
private static boolean whitelist = false;
|
private static boolean whitelist = false;
|
||||||
private static boolean timeout = false;
|
private static boolean timeout = false;
|
||||||
private static List<String> audits = new ArrayList<>();
|
private static List<String> audits = new ArrayList<>();
|
||||||
|
@ -93,6 +95,8 @@ public class QoL extends MavenPlugin {
|
||||||
this.getCommand("colors").setExecutor(colorsCommand);
|
this.getCommand("colors").setExecutor(colorsCommand);
|
||||||
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
|
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
|
||||||
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
|
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
|
||||||
|
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
|
||||||
|
this.getCommand("deathmute").setExecutor(deathMuteCommand);
|
||||||
|
|
||||||
if (getConfig().getStringList("list").size() > 0) {
|
if (getConfig().getStringList("list").size() > 0) {
|
||||||
ListCommand listCommand = new ListCommand(this);
|
ListCommand listCommand = new ListCommand(this);
|
||||||
|
@ -213,19 +217,25 @@ public class QoL extends MavenPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addSM(Player player) {
|
public static void addSM(Player player) {
|
||||||
if (!mutes.contains(player.getUniqueId().toString())) {
|
if (!mutes.contains(player.getUniqueId())) {
|
||||||
mutes.add(player.getUniqueId().toString());
|
mutes.add(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addDeathMute(Player player) {
|
||||||
|
if (!deathMutes.contains(player.getUniqueId())) {
|
||||||
|
deathMutes.add(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasSM(Player player) {
|
public static boolean hasSM(Player player) {
|
||||||
return mutes.contains(player.getUniqueId().toString());
|
return mutes.contains(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasDeathMute(Player player) { return deathMutes.contains(player.getUniqueId()); }
|
||||||
|
|
||||||
public static void removeSM(Player player) {
|
public static void removeSM(Player player) {
|
||||||
mutes.remove(player.getUniqueId().toString());
|
mutes.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getWhitelist() {
|
public static boolean getWhitelist() {
|
||||||
|
|
|
@ -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 <player>");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,8 +2,6 @@ package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -13,14 +11,6 @@ import xyz.etztech.qol.Lang;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
import xyz.etztech.qol.other.ShadowMuteTime;
|
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 {
|
public class ShadowMuteCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,17 +34,13 @@ public class ShadowMuteCommand implements CommandExecutor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player argPlayer = null;
|
Player argPlayer = Bukkit.getPlayer(args[0]);
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (onlinePlayer.getName().equalsIgnoreCase(args[0])) {
|
|
||||||
argPlayer = onlinePlayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argPlayer == null) {
|
if (argPlayer == null) {
|
||||||
EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
|
EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player player = argPlayer;
|
final Player player = argPlayer;
|
||||||
|
|
||||||
ShadowMuteTime smt;
|
ShadowMuteTime smt;
|
||||||
|
|
|
@ -26,8 +26,10 @@ public class DeathListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
String message = event.getDeathMessage();
|
String message = event.getDeathMessage();
|
||||||
|
|
||||||
event.setDeathMessage("");
|
event.setDeathMessage("");
|
||||||
|
|
||||||
|
if (!plugin.hasDeathMute(event.getEntity().getPlayer())) {
|
||||||
Location location = event.getEntity().getLocation();
|
Location location = event.getEntity().getLocation();
|
||||||
String coords = StringUtils.join(Arrays.asList(location.getBlockX(), location.getBlockY(), location.getBlockZ()), ", ");
|
String coords = StringUtils.join(Arrays.asList(location.getBlockX(), location.getBlockY(), location.getBlockZ()), ", ");
|
||||||
|
|
||||||
|
@ -38,4 +40,5 @@ public class DeathListener implements Listener {
|
||||||
player.spigot().sendMessage(newMessage);
|
player.spigot().sendMessage(newMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ commands:
|
||||||
shadowmute:
|
shadowmute:
|
||||||
description: Shadow Mute command
|
description: Shadow Mute command
|
||||||
aliases: [sm]
|
aliases: [sm]
|
||||||
|
deathmute:
|
||||||
|
description: Death mute command
|
||||||
|
aliases: [dm]
|
||||||
whitelist:
|
whitelist:
|
||||||
description: Whitelist command
|
description: Whitelist command
|
||||||
timeout:
|
timeout:
|
||||||
|
@ -65,6 +68,9 @@ permissions:
|
||||||
qol.shadowmute:
|
qol.shadowmute:
|
||||||
description: Ability to use the Shadow Mute command
|
description: Ability to use the Shadow Mute command
|
||||||
default: op
|
default: op
|
||||||
|
qol.deathmute:
|
||||||
|
description: Ability to use the Death Mute command
|
||||||
|
default: op
|
||||||
qol.auditable:
|
qol.auditable:
|
||||||
description: Audits command usage
|
description: Audits command usage
|
||||||
default: op
|
default: op
|
||||||
|
|
Loading…
Reference in New Issue