diff --git a/src/main/java/xyz/etztech/minecraftmanager/listeners/CommandPreprocessListener.java b/src/main/java/xyz/etztech/minecraftmanager/listeners/CommandPreprocessListener.java index fe148b9..df40975 100644 --- a/src/main/java/xyz/etztech/minecraftmanager/listeners/CommandPreprocessListener.java +++ b/src/main/java/xyz/etztech/minecraftmanager/listeners/CommandPreprocessListener.java @@ -1,6 +1,7 @@ package xyz.etztech.minecraftmanager.listeners; import org.apache.commons.lang.StringUtils; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -14,7 +15,7 @@ import xyz.etztech.minecraftmanager.MCMUtil; import xyz.etztech.minecraftmanager.MinecraftManager; import java.util.Arrays; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -22,6 +23,8 @@ public class CommandPreprocessListener implements Listener { MinecraftManager plugin; + private ArrayList hasReadRules = new ArrayList<>(); + public CommandPreprocessListener(MinecraftManager plugin) { this.plugin = plugin; @@ -71,6 +74,16 @@ public class CommandPreprocessListener implements Listener { } } } + else if (sender.hasPermission("minecraftmanager.guest")) { + if ("rules".equalsIgnoreCase(base)) { + hasReadRules.add(sender.getUniqueId().toString()); + } + else if ("apply".equalsIgnoreCase(base)) { + if(!hasReadRules.remove(sender.getUniqueId().toString())) { + sender.spigot().sendMessage(new TextComponent(ChatColor.RED + "Make sure to check /rules before applying!")); + } + } + } }