Fix afkcheck not being picked up by spy
This commit is contained in:
parent
f30954cef5
commit
6b548bc8d6
|
|
@ -18,7 +18,7 @@ public enum Lang {
|
||||||
AFK_PREFIX("afk-prefix", "[AFK]"),
|
AFK_PREFIX("afk-prefix", "[AFK]"),
|
||||||
AFKCHECKTITLE("afkcheck-title", "AFK CHECK"),
|
AFKCHECKTITLE("afkcheck-title", "AFK CHECK"),
|
||||||
AFKCHECKSUBTITLE("afkcheck-subtitle", "Please respond to the dm from staff!"),
|
AFKCHECKSUBTITLE("afkcheck-subtitle", "Please respond to the dm from staff!"),
|
||||||
AFKCHECKCMESSAGE("afkcheck-message", "Hey, since you're near a farm and not moving I'm making sure you aren't afk. Please respond to me if you're not AFK.");
|
AFKCHECKCMESSAGE("afkcheck-message", "Hey, since you're near a farm and not moving. I'm making sure you aren't afk. Please respond to me if you're not AFK.");
|
||||||
|
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -40,7 +41,14 @@ public class AFKCheckCommand implements CommandExecutor, TabCompleter {
|
||||||
}
|
}
|
||||||
target.showTitle(Title.title(Component.text(Lang.AFKCHECKTITLE.toString(), NamedTextColor.RED),
|
target.showTitle(Title.title(Component.text(Lang.AFKCHECKTITLE.toString(), NamedTextColor.RED),
|
||||||
Component.text(Lang.AFKCHECKSUBTITLE.toString(), NamedTextColor.RED)));
|
Component.text(Lang.AFKCHECKSUBTITLE.toString(), NamedTextColor.RED)));
|
||||||
Bukkit.dispatchCommand(sender, "msg " + args[0] + " " + Lang.AFKCHECKCMESSAGE.toString());
|
if(sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
PlayerCommandPreprocessEvent commandEvent = new PlayerCommandPreprocessEvent(player, "/" + "msg " + args[0] + " " + Lang.AFKCHECKCMESSAGE.toString());
|
||||||
|
Bukkit.getPluginManager().callEvent(commandEvent);
|
||||||
|
player.performCommand("msg " + args[0] + " " + Lang.AFKCHECKCMESSAGE.toString());
|
||||||
|
} else {
|
||||||
|
Bukkit.dispatchCommand(sender, "msg " + args[0] + " " + Lang.AFKCHECKCMESSAGE.toString());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,14 @@ public class AFKListCommand implements CommandExecutor, TabCompleter {
|
||||||
if(System.currentTimeMillis() - standingTime > plugin.toggletime * 60 * 1000) {
|
if(System.currentTimeMillis() - standingTime > plugin.toggletime * 60 * 1000) {
|
||||||
afkplayers += 1;
|
afkplayers += 1;
|
||||||
message = message.append(Component.newline());
|
message = message.append(Component.newline());
|
||||||
Component userinfo = Component.text(afkplayer.getPlayerName(), NamedTextColor.DARK_PURPLE)
|
Component userinfo = Component.text(afkplayer.getPlayerName(), NamedTextColor.GOLD)
|
||||||
.append(Component.text(" has been afk for " + (System.currentTimeMillis() - standingTime) / 1000 + " seconds."))
|
.append(Component.text(" has been afk for " + (System.currentTimeMillis() - standingTime) / 1000 + " seconds.", NamedTextColor.WHITE))
|
||||||
.hoverEvent(Component.text("Click here to send an afkcheck to " + afkplayer.getPlayerName() + "!" , NamedTextColor.GRAY).asHoverEvent())
|
.hoverEvent(Component.text("Click here to send an afkcheck to " + afkplayer.getPlayerName() + "!" , NamedTextColor.GRAY).asHoverEvent())
|
||||||
.clickEvent(net.kyori.adventure.text.event.ClickEvent.runCommand("/afkcheck " + afkplayer.getPlayerName()));
|
.clickEvent(net.kyori.adventure.text.event.ClickEvent.runCommand("/afkcheck " + afkplayer.getPlayerName()));
|
||||||
message = message.append(userinfo);
|
message = message.append(userinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component component = Component.text(Lang.AFK_LIST.toString().replaceAll("%afkplayers%", Integer.toString(afkplayers)), NamedTextColor.YELLOW, TextDecoration.BOLD);
|
Component component = Component.text(Lang.AFK_LIST.toString().replaceAll("%afkplayers%", Integer.toString(afkplayers)), NamedTextColor.YELLOW);
|
||||||
sender.sendMessage(component.append(message));
|
sender.sendMessage(component.append(message));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user