Fix permissions

This commit is contained in:
Jesse Boyd 2019-11-22 15:30:45 +00:00
parent 9b31f39219
commit 85382ad109
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 12 additions and 17 deletions

View File

@ -210,7 +210,9 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override @Override
public boolean hasPermission(String perm) { public boolean hasPermission(String perm) {
return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp()); return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp())
|| plugin.getPermissionsResolver().hasPermission(
player.getWorld().getName(), player, perm);
} }
@Override @Override

View File

@ -74,6 +74,7 @@ import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch; import org.enginehub.piston.annotation.param.Switch;
import org.jetbrains.annotations.Range; import org.jetbrains.annotations.Range;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -137,12 +138,9 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.test") @CommandPermissions("worldedit.region.test")
@Logging(REGION) @Logging(REGION)
public void test(Player player, EditSession editSession, @Arg(desc = "test") @Confirm(RADIUS) BlockVector3 radius) throws WorldEditException { public void test(Player player, EditSession editSession, @Arg(desc = "test") String world, BlockVector2 mcaFile) throws WorldEditException {
// editSession.addProcessor(new ChunkSendProcessor(editSession.getWorld(), () -> Collections.singleton(player))); file = new File(world, "region" + File.separator)
// editSession.addProcessor(NullProcessor.INSTANCE);
// FlatRegionFunction replace = new BiomeReplace(editSession, biome);
// FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(region), replace);
// Operations.completeLegacy(visitor);
} }
@Command( @Command(

View File

@ -24,6 +24,7 @@ import com.boydti.fawe.command.AnvilCommands;
import com.boydti.fawe.command.AnvilCommandsRegistration; import com.boydti.fawe.command.AnvilCommandsRegistration;
import com.boydti.fawe.command.CFICommands; import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.command.CFICommandsRegistration; import com.boydti.fawe.command.CFICommandsRegistration;
import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
@ -729,24 +730,18 @@ public final class PlatformCommandManager {
} }
} catch (ConditionFailedException e) { } catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) { if (e.getCondition() instanceof PermissionCondition) {
actor.printError("You are not permitted to do that. Are you in the right mode?"); actor.printError(TranslatableComponent.of("fawe.error.no.perm", StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions())));
} else { } else {
actor.print(e.getRichMessage()); actor.print(e.getRichMessage());
} }
} catch (FaweException e) { } catch (FaweException e) {
actor.printError(TextComponent.builder().append("Edit cancelled: ").append(e.getComponent()).build()); actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", e.getComponent()));
} catch (UsageException e) { } catch (UsageException e) {
ImmutableList<Command> cmd = e.getCommands(); ImmutableList<Command> cmd = e.getCommands();
if (!cmd.isEmpty()) { if (!cmd.isEmpty()) {
actor.print(TextComponent.builder("Usage: ") actor.printError(TranslatableComponent.of("fawe.error.command.syntax", HelpGenerator.create(e.getCommandParseResult()).getUsage()));
.color(TextColor.RED)
.append(HelpGenerator.create(e.getCommandParseResult()).getUsage())
.build());
} }
actor.print(TextComponent.builder("") actor.printError(e.getRichMessage());
.color(TextColor.RED)
.append(e.getRichMessage())
.build());
} catch (CommandExecutionException e) { } catch (CommandExecutionException e) {
handleUnknownException(actor, e.getCause()); handleUnknownException(actor, e.getCause());
} catch (CommandException e) { } catch (CommandException e) {