From d23875cc3a0ea150d8110510b86dfffe705b27d5 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 15 Nov 2020 14:10:11 +0100 Subject: [PATCH] Add Permission Check in CommandTPSLimiter --- .../bausystem/commands/CommandTPSLimiter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java index af5d181..b373a7e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java @@ -20,6 +20,8 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.world.Welt; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import net.minecraft.server.v1_15_R1.PacketPlayOutEntityVelocity; @@ -67,6 +69,14 @@ public class CommandTPSLimiter implements CommandExecutor { }, 0, 1); } + private boolean permissionCheck(Player player) { + if(Welt.noPermission(player, Permission.world)){ + player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TPS-Limiter nutzen"); + return false; + } + return true; + } + @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { @@ -77,6 +87,8 @@ public class CommandTPSLimiter implements CommandExecutor { return false; } Player player = (Player) sender; + // TODO: Remove on final push + // if (permissionCheck(player)) return false; String tpsLimit = args[0]; if (tpsLimit.equals("default")) {