Add CommandSimulator.permissionCheck
Dieser Commit ist enthalten in:
Ursprung
d5ed63f938
Commit
e127144223
@ -21,7 +21,10 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.canonsimulator.TNTSimulator;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -29,11 +32,23 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandSimulator implements CommandExecutor {
|
||||
|
||||
private boolean permissionCheck(Player player) {
|
||||
if (Welt.noPermission(player, Permission.build)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Simulator nutzen");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||
if(!(commandSender instanceof Player))
|
||||
if (!(commandSender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) commandSender;
|
||||
if (permissionCheck(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("wand")) {
|
||||
player.getInventory().setItemInMainHand(TNTSimulator.WAND);
|
||||
player.updateInventory();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren