Merge branch 'master' of ZeroHD/MinecraftManagerPlugin into master

master
Etzelia 2018-10-24 16:16:32 +02:00 committed by Gitea
commit 2a6362882e
1 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package xyz.etztech.minecraftmanager.listeners; package xyz.etztech.minecraftmanager.listeners;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -14,7 +15,7 @@ import xyz.etztech.minecraftmanager.MCMUtil;
import xyz.etztech.minecraftmanager.MinecraftManager; import xyz.etztech.minecraftmanager.MinecraftManager;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -22,6 +23,8 @@ public class CommandPreprocessListener implements Listener {
MinecraftManager plugin; MinecraftManager plugin;
private LinkedHashSet<String> hasReadRules = new LinkedHashSet<>();
public CommandPreprocessListener(MinecraftManager plugin) { public CommandPreprocessListener(MinecraftManager plugin) {
this.plugin = plugin; this.plugin = plugin;
@ -71,6 +74,17 @@ 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.contains(sender.getUniqueId().toString())) {
event.setCancelled(true);
sender.spigot().sendMessage(new TextComponent(ChatColor.RED + "Make sure to check /rules before applying!"));
}
}
}
} }