Toggle worldedit /tips
This commit is contained in:
parent
70812e78c8
commit
95715da039
@ -42,14 +42,14 @@ public class BukkitPlayer extends FawePlayer<Player> {
|
||||
* - The `/wea` command will give/remove the required bypass permission
|
||||
*/
|
||||
if (Fawe.<FaweBukkit> imp().getVault() == null || Fawe.<FaweBukkit> imp().getVault().permission == null) {
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission("fawe.bypass", flag);
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(perm, flag);
|
||||
} else if (flag) {
|
||||
if (!Fawe.<FaweBukkit> imp().getVault().permission.playerAdd(this.parent, perm)) {
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission("fawe.bypass", flag);
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(perm, flag);
|
||||
}
|
||||
} else {
|
||||
if (!Fawe.<FaweBukkit> imp().getVault().permission.playerRemove(this.parent, perm)) {
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission("fawe.bypass", flag);
|
||||
this.parent.addAttachment(Fawe.<FaweBukkit> imp().getPlugin()).setPermission(perm, flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ commands:
|
||||
permissions:
|
||||
fawe.bypass:
|
||||
default: false
|
||||
fawe.tips:
|
||||
default: false
|
||||
fawe.admin:
|
||||
default: op
|
||||
fawe.reload:
|
||||
|
@ -38,8 +38,12 @@ public enum BBC {
|
||||
WORLDEDIT_DANGEROUS_WORLDEDIT("&cFAWE processed unsafe WorldEdit at %s0 by %s1", "Info"),
|
||||
WORLDEDIT_BYPASS("&7&oTo bypass your restrictions use &c/wea", "Info"),
|
||||
WORLDEDIT_EXTEND("&cYour WorldEdit may have extended outside your allowed region.", "Error"),
|
||||
WORLDEDIT_TOGGLE_TIPS_ON("&7Disabled WorldEdit tips.", "Info"),
|
||||
WORLDEDIT_TOGGLE_TIPS_OFF("&7Enabled WorldEdit tips.", "Info"),
|
||||
|
||||
WORLDEDIT_BYPASSED("&7Currently bypassing WorldEdit restriction.", "Info"),
|
||||
WORLDEDIT_UNMASKED("&6Your WorldEdit is now unrestricted.", "Info"),
|
||||
|
||||
WORLDEDIT_RESTRICTED("&6Your WorldEdit is now restricted.", "Info"),
|
||||
WORLDEDIT_OOM_ADMIN("&cPossible options:\n&8 - &7//fast\n&8 - &7Do smaller edits\n&8 - &7Allocate more memory\n&8 - &7Disable `max-memory-percent`", "Info"),
|
||||
COMPRESSED("History compressed. Saved ~ %s0b (%s1x smaller)", "Info"),
|
||||
|
@ -105,6 +105,16 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean toggle(String perm) {
|
||||
if (this.hasPermission(perm)) {
|
||||
this.setPermission(perm, false);
|
||||
return false;
|
||||
} else {
|
||||
this.setPermission(perm, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private AtomicInteger runningCount = new AtomicInteger();
|
||||
|
||||
public void queueAction(final Runnable run) {
|
||||
|
@ -216,7 +216,7 @@ public class BrushCommands {
|
||||
}
|
||||
}
|
||||
player.print(BBC.getPrefix() + BBC.BRUSH_SPHERE.f(radius));
|
||||
BBC.TIP_BRUSH_COMMAND.or(BBC.TIP_BRUSH_RELATIVE, BBC.TIP_BRUSH_TRANSFORM, BBC.TIP_BRUSH_MASK_SOURCE, BBC.TIP_BRUSH_MASK, BBC.TIP_BRUSH_COPY, BBC.TIP_BRUSH_HEIGHT, BBC.TIP_BRUSH_SPLINE).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_BRUSH_COMMAND.or(BBC.TIP_BRUSH_RELATIVE, BBC.TIP_BRUSH_TRANSFORM, BBC.TIP_BRUSH_MASK_SOURCE, BBC.TIP_BRUSH_MASK, BBC.TIP_BRUSH_COPY, BBC.TIP_BRUSH_HEIGHT, BBC.TIP_BRUSH_SPLINE).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RunnableVal2;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
import com.boydti.fawe.object.clipboard.WorldCutClipboard;
|
||||
@ -118,7 +119,7 @@ public class ClipboardCommands {
|
||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
||||
session.setClipboard(new ClipboardHolder(clipboard, editSession.getWorldData()));
|
||||
BBC.COMMAND_COPY.send(player, region.getArea());
|
||||
BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +157,7 @@ public class ClipboardCommands {
|
||||
Operations.completeLegacy(copy);
|
||||
session.setClipboard(new ClipboardHolder(clipboard, editSession.getWorldData()));
|
||||
BBC.COMMAND_COPY.send(player, region.getArea());
|
||||
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -320,7 +321,7 @@ public class ClipboardCommands {
|
||||
selector.explainRegionAdjust(player, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(player);
|
||||
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -433,7 +434,7 @@ public class ClipboardCommands {
|
||||
transform = transform.rotateZ(-(zRotate != null ? zRotate : 0));
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
BBC.COMMAND_ROTATE.send(player);
|
||||
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.extent.DefaultTransformParser;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
@ -40,6 +41,20 @@ public class GeneralCommands {
|
||||
transformParser = new DefaultTransformParser(worldEdit);
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "/tips", "tips" },
|
||||
desc = "Toggle WorldEdit tips"
|
||||
)
|
||||
@CommandPermissions("fawe.use")
|
||||
public void tips(Player player, LocalSession session) throws WorldEditException {
|
||||
FawePlayer<Object> fp = FawePlayer.wrap(player);
|
||||
if (fp.toggle("fawe.tips")) {
|
||||
BBC.WORLDEDIT_TOGGLE_TIPS_ON.send(player);
|
||||
} else {
|
||||
BBC.WORLDEDIT_TOGGLE_TIPS_OFF.send(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "/limit" },
|
||||
usage = "<limit>",
|
||||
|
@ -288,7 +288,7 @@ public class RegionCommands {
|
||||
}
|
||||
int affected = editSession.replaceBlocks(region, from, Patterns.wrap(to));
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -378,7 +378,7 @@ public class RegionCommands {
|
||||
int affected = editSession.setBlocks(selection, Patterns.wrap(to));
|
||||
if (affected != 0) {
|
||||
BBC.OPERATION.send(player, affected);
|
||||
BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
|
||||
import com.google.common.base.Optional;
|
||||
@ -273,7 +274,7 @@ public class SelectionCommands {
|
||||
public void wand(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
player.giveItem(we.getConfiguration().wandItem, 1);
|
||||
BBC.SELECTION_WAND.send(player);
|
||||
BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND).send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -356,6 +356,10 @@ public final class CommandManager {
|
||||
editSession.flushQueue();
|
||||
worldEdit.flushBlockBag(finalActor, editSession);
|
||||
session.remember(editSession);
|
||||
final long time = System.currentTimeMillis() - start;
|
||||
if (time > 250 && hasSession) {
|
||||
BBC.ACTION_COMPLETE.send(finalActor, (time / 1000d));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user