SteamWar/BauSystem
Archiviert
13
0

Add Permission Check in CommandTPSLimiter

Dieser Commit ist enthalten in:
jojo 2020-11-15 14:10:11 +01:00
Ursprung 179632cd21
Commit d23875cc3a

Datei anzeigen

@ -20,6 +20,8 @@
package de.steamwar.bausystem.commands; package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem; 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.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityVelocity; import net.minecraft.server.v1_15_R1.PacketPlayOutEntityVelocity;
@ -67,6 +69,14 @@ public class CommandTPSLimiter implements CommandExecutor {
}, 0, 1); }, 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 @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
@ -77,6 +87,8 @@ public class CommandTPSLimiter implements CommandExecutor {
return false; return false;
} }
Player player = (Player) sender; Player player = (Player) sender;
// TODO: Remove on final push
// if (permissionCheck(player)) return false;
String tpsLimit = args[0]; String tpsLimit = args[0];
if (tpsLimit.equals("default")) { if (tpsLimit.equals("default")) {