forked from Minecraft/QoL
Made changes based on the conversation of Issue #6.
parent
0f47791795
commit
408a5e0045
|
@ -24,15 +24,9 @@ public class CommandPreprocessListener implements Listener {
|
||||||
QoL plugin;
|
QoL plugin;
|
||||||
private Map<UUID, String> confirmTpMap = new HashMap<>();
|
private Map<UUID, String> confirmTpMap = new HashMap<>();
|
||||||
private Map<UUID, Boolean> dynmapVisibleStatusMap = new HashMap<>();
|
private Map<UUID, Boolean> dynmapVisibleStatusMap = new HashMap<>();
|
||||||
private DynmapAPI dynmap;
|
|
||||||
|
|
||||||
public CommandPreprocessListener(QoL plugin) {
|
public CommandPreprocessListener(QoL plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
if (plugin.getDynmap() != null) {
|
|
||||||
this.dynmap = plugin.getDynmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -41,12 +35,13 @@ public class CommandPreprocessListener implements Listener {
|
||||||
String command = event.getMessage();
|
String command = event.getMessage();
|
||||||
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
|
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
|
||||||
Player sender = event.getPlayer();
|
Player sender = event.getPlayer();
|
||||||
|
DynmapAPI dynmap = plugin.getDynmap();
|
||||||
|
|
||||||
// Spec dynmap hide
|
// Spec dynmap hide
|
||||||
if (base.equals("spec") && this.dynmap != null && sender.hasPermission("qol.audit")) {
|
if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) {
|
||||||
boolean visibleStatus;
|
boolean visibleStatus;
|
||||||
if (sender.getGameMode() != GameMode.SPECTATOR){
|
if (sender.getGameMode() != GameMode.SPECTATOR){
|
||||||
dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getDisplayName()));
|
dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getName()));
|
||||||
visibleStatus = false;
|
visibleStatus = false;
|
||||||
}
|
}
|
||||||
else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){
|
else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){
|
||||||
|
@ -62,7 +57,7 @@ public class CommandPreprocessListener implements Listener {
|
||||||
// Spec TP confirmation
|
// Spec TP confirmation
|
||||||
if (sender.hasPermission("qol.tpconfirm")) {
|
if (sender.hasPermission("qol.tpconfirm")) {
|
||||||
//check if the command is a tp command
|
//check if the command is a tp command
|
||||||
if (noSlash(base).equals("tp") || noSlash(base).startsWith("tele") || noSlash(command).toLowerCase().startsWith("lagg tpchunk")) {
|
if (noSlash(base).equals("tp") || noSlash(base).toLowerCase().startsWith("tele") || noSlash(command).toLowerCase().startsWith("lagg tpchunk")) {
|
||||||
//If the user is in the confirm tp map, remove them and let the command run
|
//If the user is in the confirm tp map, remove them and let the command run
|
||||||
if (command.equals(confirmTpMap.get(sender.getUniqueId()))) {
|
if (command.equals(confirmTpMap.get(sender.getUniqueId()))) {
|
||||||
confirmTpMap.remove(sender.getUniqueId());
|
confirmTpMap.remove(sender.getUniqueId());
|
||||||
|
@ -105,10 +100,6 @@ public class CommandPreprocessListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noSlash(base).equals("spec")) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
for (LinkCommand linkCommand : QoL.getLinks()) {
|
for (LinkCommand linkCommand : QoL.getLinks()) {
|
||||||
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
||||||
|
|
Loading…
Reference in New Issue