3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 12:00:07 +01:00

Message updates

Dieser Commit ist enthalten in:
MattBDev 2019-11-02 15:53:25 -04:00
Ursprung 678a99667d
Commit f262271519
26 geänderte Dateien mit 221 neuen und 236 gelöschten Zeilen

Datei anzeigen

@ -27,7 +27,6 @@ import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.Jars;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.WEManager;
import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
@ -122,7 +121,7 @@ public class FaweBukkit implements IFawe, Listener {
}
@Override
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player fp) {
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player player) {
if (listeningImages && imageListener == null) return null;
try {
listeningImages = true;
@ -143,7 +142,7 @@ public class FaweBukkit implements IFawe, Listener {
fos.write(jarData);
}
}
BukkitImageViewer viewer = new BukkitImageViewer(BukkitAdapter.adapt(fp));
BukkitImageViewer viewer = new BukkitImageViewer(BukkitAdapter.adapt(player));
if (imageListener == null) {
this.imageListener = new BukkitImageListener(plugin);
}

Datei anzeigen

@ -63,17 +63,17 @@ public class BukkitImageListener implements Listener {
Iterator<Player> iter = recipients.iterator();
while (iter.hasNext()) {
Player player = iter.next();
BukkitPlayer fp = BukkitAdapter.adapt(player);
CFICommands.CFISettings settings = fp.getMeta("CFISettings");
if (player.equals(event.getPlayer()) || !fp.hasMeta() || settings == null || !settings.hasGenerator()) {
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
if (player.equals(event.getPlayer()) || !bukkitPlayer.hasMeta() || settings == null || !settings.hasGenerator()) {
continue;
}
String name = player.getName().toLowerCase();
if (!event.getMessage().toLowerCase().contains(name)) {
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
ArrayDeque<String> buffered = bukkitPlayer.getMeta("CFIBufferedMessages");
if (buffered == null) {
fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
bukkitPlayer.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
}
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(),
event.getMessage());
@ -106,8 +106,8 @@ public class BukkitImageListener implements Listener {
}
Player player = event.getPlayer();
BukkitPlayer fp = BukkitAdapter.adapt(player);
if (fp.getMeta("CFISettings") == null) {
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
if (bukkitPlayer.getMeta("CFISettings") == null) {
return;
}
try {
@ -189,8 +189,8 @@ public class BukkitImageListener implements Listener {
}
ItemFrame itemFrame = (ItemFrame) entity;
BukkitPlayer fp = BukkitAdapter.adapt(player);
CFICommands.CFISettings settings = fp.getMeta("CFISettings");
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
HeightMapMCAGenerator generator = settings == null ? null : settings.getGenerator();
BukkitImageViewer viewer = get(generator);
if (viewer == null) {
@ -201,10 +201,10 @@ public class BukkitImageListener implements Listener {
itemFrame.setRotation(Rotation.NONE);
}
LocalSession session = fp.getSession();
LocalSession session = bukkitPlayer.getSession();
BrushTool tool;
try {
tool = session.getBrushTool(fp, false);
tool = session.getBrushTool(bukkitPlayer, false);
} catch (InvalidToolBindException e) {
return;
}
@ -275,7 +275,7 @@ public class BukkitImageListener implements Listener {
return;
}
fp.runAction(() -> {
bukkitPlayer.runAction(() -> {
BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ);
viewer.refresh();
int topY = generator
@ -283,7 +283,7 @@ public class BukkitImageListener implements Listener {
0, 255);
wPos = wPos.withY(topY);
EditSession es = new EditSessionBuilder(fp.getWorld()).player(fp)
EditSession es = new EditSessionBuilder(bukkitPlayer.getWorld()).player(bukkitPlayer)
.combineStages(false).autoQueue(false).blockBag(null).limitUnlimited()
.build();
ExtentTraverser last = new ExtentTraverser(es.getExtent()).last();

Datei anzeigen

@ -25,9 +25,9 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
}
@Override
public FaweMask getMask(final com.sk89q.worldedit.entity.Player fp, MaskType type) {
final Player player = BukkitAdapter.adapt(fp);
final Claim claim = GriefPrevention.instance.dataStore.getClaimAt(BukkitAdapter.adapt(fp.getLocation()), true, null);
public FaweMask getMask(final com.sk89q.worldedit.entity.Player wePlayer, MaskType type) {
final Player player = BukkitAdapter.adapt(wePlayer);
final Claim claim = GriefPrevention.instance.dataStore.getClaimAt(player.getLocation(), true, null);
if (claim != null) {
if (isAllowed(player, claim, type)) {
claim.getGreaterBoundaryCorner().getBlockX();
@ -36,7 +36,7 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
return new FaweMask(pos1, pos2) {
@Override
public boolean isValid(com.sk89q.worldedit.entity.Player fp, MaskType type) {
public boolean isValid(com.sk89q.worldedit.entity.Player wePlayer, MaskType type) {
return isAllowed(player, claim, type);
}
};

Datei anzeigen

@ -27,8 +27,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
}
@Override
public FaweMask getMask(final com.sk89q.worldedit.entity.Player fp, final MaskType type) {
final Player player = BukkitAdapter.adapt(fp);
public FaweMask getMask(final com.sk89q.worldedit.entity.Player wePlayer, final MaskType type) {
final Player player = BukkitAdapter.adapt(wePlayer);
final Location location = player.getLocation();
ClaimedResidence residence = Residence.getInstance().getResidenceManager().getByLoc(location);
if (residence != null) {

Datei anzeigen

@ -61,8 +61,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
}
@Override
public FaweMask getMask(com.sk89q.worldedit.entity.Player fp) {
final Player player = BukkitAdapter.adapt(fp);
public FaweMask getMask(com.sk89q.worldedit.entity.Player wePlayer) {
final Player player = BukkitAdapter.adapt(wePlayer);
final Location location = player.getLocation();
try {
final PlayerCache cache = ((Towny) this.towny).getCache(player);

Datei anzeigen

@ -165,7 +165,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
player.sendMessage("\u00A7c" + part);
player.sendMessage("§c" + part);
}
}

Datei anzeigen

@ -31,6 +31,7 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
@ -74,8 +75,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.IntStream;
import javax.imageio.ImageIO;
import javax.xml.soap.Text;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -373,9 +372,9 @@ public class CFICommands {
"Below 50 will prefer to color with blocks"
)
@CommandPermissions("worldedit.anvil.cfi")
public void biomepriority(Player fp, int value) {
assertSettings(fp).getGenerator().setBiomePriority(value);
coloring(fp);
public void biomepriority(Player player, int value) {
assertSettings(player).getGenerator().setBiomePriority(value);
coloring(player);
}
@Command(
@ -553,10 +552,10 @@ public class CFICommands {
desc = "Generate vanilla caves"
)
@CommandPermissions("worldedit.anvil.cfi")
public void caves(Player fp) throws WorldEditException {
assertSettings(fp).getGenerator().addCaves();
fp.print(TextComponent.of("Added caves!"));
populate(fp);
public void caves(Player player) throws WorldEditException {
assertSettings(player).getGenerator().addCaves();
player.print(TextComponent.of("Added caves!"));
populate(player);
}
@Command(
@ -565,10 +564,10 @@ public class CFICommands {
descFooter = "Use a specific pattern and settings to generate ore"
)
@CommandPermissions("worldedit.anvil.cfi")
public void ore(Player fp, @Arg(name = "mask", desc = "Mask") Mask mask, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, int size, int frequency, int rariry, int minY, int maxY) throws WorldEditException {
assertSettings(fp).getGenerator().addOre(mask, patternArg, size, frequency, rariry, minY, maxY);
fp.print(TextComponent.of("Added ore!"));
populate(fp);
public void ore(Player player, @Arg(name = "mask", desc = "Mask") Mask mask, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, int size, int frequency, int rariry, int minY, int maxY) throws WorldEditException {
assertSettings(player).getGenerator().addOre(mask, patternArg, size, frequency, rariry, minY, maxY);
player.print(TextComponent.of("Added ore!"));
populate(player);
}
@Command(
@ -576,10 +575,10 @@ public class CFICommands {
desc = "Generate the vanilla ores"
)
@CommandPermissions("worldedit.anvil.cfi")
public void ores(Player fp, @Arg(name = "mask", desc = "Mask") Mask mask) throws WorldEditException {
assertSettings(fp).getGenerator().addDefaultOres(mask);
fp.print(TextComponent.of("Added ores!"));
populate(fp);
public void ores(Player player, @Arg(name = "mask", desc = "Mask") Mask mask) throws WorldEditException {
assertSettings(player).getGenerator().addDefaultOres(mask);
player.print(TextComponent.of("Added ores!"));
populate(player);
}
@Command(
@ -588,15 +587,15 @@ public class CFICommands {
descFooter = "Set the terrain height either based on an image heightmap, or a numeric value."
)
@CommandPermissions("worldedit.anvil.cfi")
public void height(Player fp, String imageStr) throws WorldEditException {
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
public void height(Player player, String imageStr) throws WorldEditException {
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
if (!MathMan.isInteger(imageStr)) {
gen.setHeight(ImageUtil.getImage(imageStr));
} else {
gen.setHeights(Integer.parseInt(imageStr));
}
fp.print("Set Height!");
component(fp);
player.print("Set Height!");
component(player);
}
@Command(
@ -604,13 +603,13 @@ public class CFICommands {
desc = "Change the block used for water\ne.g. Lava"
)
@CommandPermissions("worldedit.anvil.cfi")
public void waterId(Player fp, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void waterId(Player player, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(player);
settings.getGenerator().setWaterId(block.getBlockType().getInternalId());
fp.print("Set water id!");
player.print("Set water id!");
settings.resetComponent();
component(fp);
component(player);
}
@Command(
@ -619,12 +618,12 @@ public class CFICommands {
desc = "Change the block used for the base\ne.g. Bedrock"
)
@CommandPermissions("worldedit.anvil.cfi")
public void baseId(Player fp, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void baseId(Player player, BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(player);
settings.getGenerator().setBedrockId(block.getBlockType().getInternalId());
fp.print(TextComponent.of("Set base id!"));
player.print(TextComponent.of("Set base id!"));
settings.resetComponent();
component(fp);
component(player);
}
@Command(
@ -634,10 +633,10 @@ public class CFICommands {
" - A value of 0 is the default and will not modify the height"
)
@CommandPermissions("worldedit.anvil.cfi")
public void worldthickness(Player fp, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(fp).getGenerator().setWorldThickness(heightArg);
fp.print("Set world thickness!");
component(fp);
public void worldthickness(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(player).getGenerator().setWorldThickness(heightArg);
player.print("Set world thickness!");
component(player);
}
@Command(
@ -647,10 +646,10 @@ public class CFICommands {
" - A value of 0 is the default and will only set the top block"
)
@CommandPermissions("worldedit.anvil.cfi")
public void floorthickness(Player fp, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(fp).getGenerator().setFloorThickness(heightArg);
fp.print("Set floor thickness!");
component(fp);
public void floorthickness(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(player).getGenerator().setFloorThickness(heightArg);
player.print("Set floor thickness!");
component(player);
}
@Command(
@ -659,10 +658,10 @@ public class CFICommands {
desc = "Resend the CFI chunks"
)
@CommandPermissions("worldedit.anvil.cfi")
public void update(Player fp) throws WorldEditException {
assertSettings(fp).getGenerator().update();
fp.print("Chunks refreshed!");
mainMenu(fp);
public void update(Player player) throws WorldEditException {
assertSettings(player).getGenerator().update();
player.print("Chunks refreshed!");
mainMenu(player);
}
@Command(
@ -688,10 +687,10 @@ public class CFICommands {
" - By default water is disabled (with a value of 0)"
)
@CommandPermissions("worldedit.anvil.cfi")
public void waterheight(Player fp, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(fp).getGenerator().setWaterHeight(heightArg);
fp.print("Set water height!");
component(fp);
public void waterheight(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
assertSettings(player).getGenerator().setWaterHeight(heightArg);
player.print("Set water height!");
component(player);
}
@Command(
@ -701,12 +700,12 @@ public class CFICommands {
)
// ![79,174,212,5:3,5:4,18,161,20]
@CommandPermissions("worldedit.anvil.cfi")
public void glass(Player fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void glass(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(player);
settings.getGenerator().setColorWithGlass(load(image));
fp.print("Set color with glass!");
player.print("Set color with glass!");
settings.resetColoring();
mainMenu(fp);
mainMenu(player);
}
@Command(
@ -718,8 +717,8 @@ public class CFICommands {
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
)
@CommandPermissions("worldedit.anvil.cfi")
public void color(Player fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void color(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(player);
HeightMapMCAGenerator gen = settings.getGenerator();
if (imageMask != null) {
gen.setColor(load(image), load(imageMask), !disableWhiteOnly);
@ -729,8 +728,8 @@ public class CFICommands {
gen.setColor(load(image));
}
settings.resetColoring();
fp.print("Set color with blocks!");
mainMenu(fp);
player.print("Set color with blocks!");
mainMenu(player);
}
@Command(
@ -742,12 +741,12 @@ public class CFICommands {
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
)
@CommandPermissions("worldedit.anvil.cfi")
public void blockbiome(Player fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void blockbiome(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(player);
settings.getGenerator().setBlockAndBiomeColor(load(image), maskOpt, load(imageMask), !disableWhiteOnly);
fp.print(TextComponent.of("Set color with blocks and biomes!"));
player.print(TextComponent.of("Set color with blocks and biomes!"));
settings.resetColoring();
mainMenu(fp);
mainMenu(player);
}
@Command(
@ -758,12 +757,12 @@ public class CFICommands {
" - If you changed the block to something other than grass you will not see anything."
)
@CommandPermissions("worldedit.anvil.cfi")
public void biomecolor(Player fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(fp);
public void biomecolor(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
CFISettings settings = assertSettings(player);
settings.getGenerator().setBiomeColor(load(image));
fp.print(TextComponent.of("Set color with biomes!"));
player.print(TextComponent.of("Set color with biomes!"));
settings.resetColoring();
mainMenu(fp);
mainMenu(player);
}
@ -773,9 +772,9 @@ public class CFICommands {
desc = "Color the world using an image"
)
@CommandPermissions("worldedit.anvil.cfi")
public void coloring(Player fp) {
CFISettings settings = assertSettings(fp);
settings.popMessages(fp);
public void coloring(Player player) {
CFISettings settings = assertSettings(player);
settings.popMessages(player);
settings.setCategory(this::coloring);
HeightMapMCAGenerator gen = settings.getGenerator();
boolean rand = gen.getTextureRandomVariation();
@ -850,7 +849,7 @@ public class CFICommands {
.append("[None]");//.cmdTip("/cfi " + Commands.getAlias(Command.class, "image")).append(newline());
}
builder.append("< [Back]");//.cmdTip(alias()).send(fp);
fp.print(builder.build());
player.print(builder.build());
}
@Command(
@ -858,8 +857,8 @@ public class CFICommands {
desc = "Select a mask"
)
@CommandPermissions("worldedit.anvil.cfi")
public void mask(Player fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
CFISettings settings = assertSettings(fp);
public void mask(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
CFISettings settings = assertSettings(player);
String[] split = getArguments(context).split(" ");
int index = 2;
settings.imageMask = imageMask;
@ -885,7 +884,7 @@ public class CFICommands {
.append(
TextComponent.of("< [Back]").hoverEvent(HoverEvent.showText(TextComponent.of(s2)))
.clickEvent(ClickEvent.runCommand(s2))).build();
fp.print(build);
player.print(build);
}
@Command(
@ -893,8 +892,8 @@ public class CFICommands {
desc = "Select a pattern"
)
@CommandPermissions("worldedit.anvil.cfi")
public void pattern(Player fp, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern patternArg, InjectedValueAccess context)throws CommandException {
CFISettings settings = assertSettings(fp);
public void pattern(Player player, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern patternArg, InjectedValueAccess context)throws CommandException {
CFISettings settings = assertSettings(player);
String[] split = getArguments(context).split(" ");
int index = 2;
settings.pattern = patternArg;
@ -903,7 +902,7 @@ public class CFICommands {
StringBuilder cmd = new StringBuilder("/cfi pattern ");
if (patternArg != null) {
settings.getCategory().accept(fp);
settings.getCategory().accept(player);
} else {
String s = cmd + " stone";
String s1 = "/cfi " + settings.getCategory();
@ -915,7 +914,7 @@ public class CFICommands {
.append(TextComponent.of("< [Back]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
.clickEvent(ClickEvent.runCommand(s1))).build();
fp.print(build);
player.print(build);
}
}
@ -945,8 +944,8 @@ public class CFICommands {
desc = "Select an image"
)
@CommandPermissions("worldedit.anvil.cfi")
public void image(Player fp, @Arg(desc = "image url or filename", def = "") ProvideBindings.ImageUri image, InjectedValueAccess context)throws CommandException {
CFISettings settings = getSettings(fp);
public void image(Player player, @Arg(desc = "image url or filename", def = "") ProvideBindings.ImageUri image, InjectedValueAccess context)throws CommandException {
CFISettings settings = getSettings(player);
String[] split = getArguments(context).split(" ");
int index = 2;
@ -960,14 +959,12 @@ public class CFICommands {
.append(newline())
.append("From a file: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image file://")))
.build();
fp.print(build);
player.print(build);
} else {
if (settings.hasGenerator()) {
coloring(fp);
return;
coloring(player);
} else {
heightmap(fp, image, 1);
return;
heightmap(player, image, 1);
}
}
}
@ -1061,12 +1058,12 @@ public class CFICommands {
if (pattern != null) {
String disabled = "You must specify a pattern";
msg.append(TextComponent.of("[&cWaterId]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline())
.append(TextComponent.of("[&cBedrockId]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[&cFloor]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[&cMain]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[&cColumn]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[&cOverlay]").hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline());
msg.append(TextComponent.of("[WaterId]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline())
.append(TextComponent.of("[BedrockId]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[Floor]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[Main]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[Column]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
.append(TextComponent.of("[Overlay]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline());
} else {
StringBuilder compArgs = new StringBuilder();
compArgs.append(" " + settings.patternArg + maskArgs);
@ -1110,9 +1107,9 @@ public class CFICommands {
}
protected static CFISettings getSettings(Player fp) {
CFISettings settings = fp.getMeta("CFISettings");
return settings == null ? new CFISettings(fp) : settings;
protected static CFISettings getSettings(Player player) {
CFISettings settings = player.getMeta("CFISettings");
return settings == null ? new CFISettings(player) : settings;
}
public static class CFISettings {
@ -1237,7 +1234,7 @@ public class CFICommands {
}
@SuppressWarnings("unused")
protected static void mainMenu(Player player) {
protected static void mainMenu(Actor actor) {
TextComponentProducer producer = new TextComponentProducer();
producer.append(TextComponent.of("What do you want to do now?"));
producer.newline();
@ -1266,6 +1263,6 @@ public class CFICommands {
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "done"))
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("done"))));
player.print(producer.create());
actor.print(producer.create());
}
}

Datei anzeigen

@ -15,7 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import java.io.File;
import java.io.IOException;
import java.util.function.Function;
@ -36,15 +36,15 @@ public class PlotLoader {
() -> autoClaimFromDatabase(player, area, plot.getId(), whenDone));
}
public void load(Player fp, CFISettings settings,
public void load(Actor actor, CFISettings settings,
Function<File, Boolean> createTask) throws IOException {
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;
SinglePlotArea area = sManager.getArea();
PlotPlayer player = PlotPlayer.get(fp.getName());
PlotPlayer player = PlotPlayer.get(actor.getName());
fp.print("Claiming world");
actor.print("Claiming world");
Plot plot = TaskManager.IMP.sync(new RunnableVal<Plot>() {
@Override
public void run(Plot o) {

Datei anzeigen

@ -30,7 +30,7 @@ public abstract class FaweCommand<T> {
TaskManager.IMP.async(() -> execute(player, args));
} else {
if (!player.runAction(() -> execute(player, args), true, true)) {
BBC.WORLDEDIT_COMMAND_LIMIT.send(player);
player.printError(BBC.WORLDEDIT_COMMAND_LIMIT.s());
return true;
}
}

Datei anzeigen

@ -42,7 +42,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
@Override
public boolean reset() {
session.setClipboard(null);
BBC.BRUSH_RESET.send(player);
player.print(BBC.BRUSH_RESET.s());
return true;
}

Datei anzeigen

@ -48,14 +48,18 @@ public class SweepBrush implements Brush, ResettableTool {
boolean newPos = !position.equals(this.position);
this.position = position;
Player player = editSession.getPlayer();
if (player == null) {
//TODO Insert Error Message here or modify EditSession to not require a player.
return;
}
if (newPos) {
BBC.BRUSH_SPLINE_PRIMARY_2.send(player);
player.print(BBC.BRUSH_SPLINE_PRIMARY_2.s());
positions.add(position);
return;
}
if (positions.size() < 2) {
BBC.BRUSH_SPLINE_SECONDARY_ERROR.send(player);
player.printError(BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
return;
}
@ -118,7 +122,7 @@ public class SweepBrush implements Brush, ResettableTool {
break;
}
}
BBC.BRUSH_SPLINE_SECONDARY.send(player);
player.print(BBC.BRUSH_SPLINE_SECONDARY.s());
reset();
}

Datei anzeigen

@ -6,8 +6,8 @@ import com.sk89q.worldedit.math.BlockVector3;
public class BufferedPattern2D extends BufferedPattern {
public BufferedPattern2D(Actor fp, Pattern parent) {
super(fp, parent);
public BufferedPattern2D(Actor actor, Pattern parent) {
super(actor, parent);
}
@Override

Datei anzeigen

@ -103,11 +103,11 @@ public class PlotSquaredFeature extends FaweMaskManager {
}
@Override
public FaweMask getMask(Player fp, MaskType type) {
final PlotPlayer pp = PlotPlayer.wrap(fp);
public FaweMask getMask(Player player, MaskType type) {
final PlotPlayer pp = PlotPlayer.wrap(player);
final HashSet<RegionWrapper> regions;
Plot plot = pp.getCurrentPlot();
if (isAllowed(fp, plot, type)) {
if (isAllowed(player, plot, type)) {
regions = plot.getRegions();
} else {
plot = null;

Datei anzeigen

@ -1,5 +1,7 @@
package com.boydti.fawe.util;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
@ -18,7 +20,6 @@ import com.boydti.fawe.object.changeset.BlockBagChangeSet;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.FaweRegionExtent;
import com.boydti.fawe.object.extent.MultiRegionExtent;
import com.boydti.fawe.object.extent.NullExtent;
@ -35,13 +36,10 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jetbrains.annotations.NotNull;
public class EditSessionBuilder {
private World world;
@ -106,10 +104,10 @@ public class EditSessionBuilder {
return limit(FaweLimit.MAX.copy());
}
public EditSessionBuilder limitUnprocessed(@Nonnull Player fp) {
checkNotNull(fp);
public EditSessionBuilder limitUnprocessed(@Nonnull Player player) {
checkNotNull(player);
limitUnlimited();
FaweLimit tmp = fp.getLimit();
FaweLimit tmp = player.getLimit();
limit.INVENTORY_MODE = tmp.INVENTORY_MODE;
return setDirty();
}
@ -306,7 +304,7 @@ public class EditSessionBuilder {
if (checkMemory) {
if (MemUtil.isMemoryLimitedSlow()) {
if (Permission.hasPermission(player, "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(player);
player.print(BBC.WORLDEDIT_OOM_ADMIN.s());
}
throw FaweCache.LOW_MEMORY;
}

Datei anzeigen

@ -992,9 +992,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
BBC.WORLDEDIT_SOME_FAILS.send(player, used.MAX_FAILS);
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null){
BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION.send(player);
player.printError(BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION.s());
} else {
BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_LEVEL.send(player);
player.printError(BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_LEVEL.s());
}
}
// Reset limit

Datei anzeigen

@ -80,10 +80,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.snapshot.Snapshot;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -91,7 +88,6 @@ import java.io.IOException;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
@ -464,9 +460,9 @@ public class LocalSession implements TextureHolder {
return;
}
Player fp = editSession.getPlayer();
if (fp != null) {
loadSessionHistoryFromDisk(fp.getUniqueId(), editSession.getWorld());
Player player = editSession.getPlayer();
if (player != null) {
loadSessionHistoryFromDisk(player.getUniqueId(), editSession.getWorld());
}
// Destroy any sessions after this undo point
if (append) {

Datei anzeigen

@ -61,7 +61,6 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.minecraft.util.commands.Step;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
@ -383,7 +382,7 @@ public class BrushCommands {
switch (type.getInternalId()) {
case BlockID.SAND:
case BlockID.GRAVEL:
BBC.BRUSH_TRY_OTHER.send(player);
player.print(BBC.BRUSH_TRY_OTHER.s());
falling = true;
}
}
@ -1017,7 +1016,7 @@ public class BrushCommands {
}
BBC.SCHEMATIC_SAVED.send(player, name);
} else {
BBC.BRUSH_NONE.send(player);
player.printError(BBC.BRUSH_NONE.s());
}
}
@ -1050,7 +1049,7 @@ public class BrushCommands {
BBC.BRUSH_EQUIPPED.send(player, name);
} catch (Throwable e) {
e.printStackTrace();
BBC.BRUSH_INCOMPATIBLE.send(player);
player.printError(BBC.BRUSH_INCOMPATIBLE.s());
}
}

Datei anzeigen

@ -39,8 +39,6 @@ import com.boydti.fawe.object.schematic.Schematic;
import com.boydti.fawe.util.ImgurUtility;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MaskTraverser;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -381,7 +379,7 @@ public class ClipboardCommands {
}
}
if (url == null) {
BBC.GENERATING_LINK_FAILED.send(player);
player.printError(BBC.GENERATING_LINK_FAILED.s());
} else {
String urlText = url.toString();
if (Settings.IMP.WEB.SHORTEN_URLS) {
@ -422,7 +420,7 @@ public class ClipboardCommands {
}
URL url = format.uploadPublic(target, category.replaceAll("[/|\\\\]", "."), player.getName());
if (url == null) {
BBC.GENERATING_LINK_FAILED.send(player);
player.printError(BBC.GENERATING_LINK_FAILED.s());
} else {
BBC.DOWNLOAD_LINK.send(player, Settings.IMP.WEB.ASSETS);
}

Datei anzeigen

@ -37,7 +37,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -318,7 +317,7 @@ public class GeneralCommands {
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
if (arguments.isEmpty()) {
session.setTextureUtil(null);
BBC.TEXTURE_DISABLED.send(player);
player.print(BBC.TEXTURE_DISABLED.s());
} else {
String arg = arguments.get(0);
String argLower = arg.toLowerCase(Locale.ROOT);
@ -375,9 +374,9 @@ public class GeneralCommands {
public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The mask to set", def = "") Mask maskOpt) throws WorldEditException {
session.setSourceMask(maskOpt);
if (maskOpt == null) {
BBC.SOURCE_MASK_DISABLED.send(player);
player.print(BBC.SOURCE_MASK_DISABLED.s());
} else {
BBC.SOURCE_MASK.send(player);
player.print(BBC.SOURCE_MASK.s());
}
}
@ -391,9 +390,9 @@ public class GeneralCommands {
public void gtransform(Player player, EditSession editSession, LocalSession session, ResettableExtent transform) throws WorldEditException {
session.setTransform(transform);
if (transform == null) {
BBC.TRANSFORM_DISABLED.send(player);
player.print(BBC.TRANSFORM_DISABLED.s());
} else {
BBC.TRANSFORM.send(player);
player.print(BBC.TRANSFORM.s());
}
}
@ -405,9 +404,9 @@ public class GeneralCommands {
@CommandPermissions("fawe.tips")
public void tips(Player player, LocalSession session) throws WorldEditException {
if (player.togglePermission("fawe.tips")) {
BBC.WORLDEDIT_TOGGLE_TIPS_ON.send(player);
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_ON.s());
} else {
BBC.WORLDEDIT_TOGGLE_TIPS_OFF.send(player);
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_OFF.s());
}
}
}

Datei anzeigen

@ -186,7 +186,7 @@ public class HistoryCommands {
Region[] allowedRegions = player.getCurrentRegions(FaweMaskManager.MaskType.OWNER);
if (allowedRegions == null) {
BBC.NO_REGION.send(player);
player.printError(BBC.NO_REGION.s());
return;
}
// TODO mask the regions bot / top to the bottom and top coord in the allowedRegions

Datei anzeigen

@ -175,14 +175,14 @@ public class RegionCommands {
public void nbtinfo(Player player, EditSession editSession) {
Location pos = player.getBlockTrace(128);
if (pos == null) {
BBC.NO_BLOCK.send(player);
player.printError(BBC.NO_BLOCK.s());
return;
}
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) {
player.print(nbt.getValue().toString());
} else {
BBC.NO_BLOCK.send(player);
player.printError(BBC.NO_BLOCK.s());
}
}
@ -314,8 +314,8 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.region.overlay")
@Logging(REGION)
public void lay(Player fp, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
fp.checkConfirmationRegion(() -> {
public void lay(Player player, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> {
BlockVector3 max = region.getMaximumPoint();
int maxY = max.getBlockY();
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
@ -330,7 +330,7 @@ public class RegionCommands {
editSession.setBlock(x, y, z, patternArg);
affected++;
}
BBC.VISITOR_BLOCK.send(fp, affected);
BBC.VISITOR_BLOCK.send(player, affected);
}, getArguments(context), region, context);
}
@ -629,27 +629,27 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.regen")
@Logging(REGION)
public void regenerateChunk(Player fp, LocalSession session, EditSession editSession, @Selection Region region,
public void regenerateChunk(Player player, LocalSession session, EditSession editSession, @Selection Region region,
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
@Arg(def = "", desc = "Regenerate with seed") Long seed,
InjectedValueAccess context) throws WorldEditException {
fp.checkConfirmationRegion(() -> {
player.checkConfirmationRegion(() -> {
Mask mask = session.getMask();
session.setMask((Mask) null);
session.setSourceMask((Mask) null);
editSession.regenerate(region, biome, seed);
session.setMask(mask);
session.setSourceMask(mask);
if (!fp.hasPermission("fawe.tips")) {
BBC.COMMAND_REGEN_2.send(fp);
if (!player.hasPermission("fawe.tips")) {
player.print(BBC.COMMAND_REGEN_2.s());
} else if (biome == null) {
BBC.COMMAND_REGEN_0.send(fp);
if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(fp);
BBC.COMMAND_REGEN_0.send(player);
if (!player.hasPermission("fawe.tips")) player.print(BBC.TIP_REGEN_0.s());
} else if (seed == null) {
BBC.COMMAND_REGEN_1.send(fp);
if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(fp);
player.print(BBC.COMMAND_REGEN_1.s());
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
} else {
BBC.COMMAND_REGEN_2.send(fp);
player.print(BBC.COMMAND_REGEN_2.s());
}
}, getArguments(context), region, context);

Datei anzeigen

@ -28,7 +28,6 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper;
import com.boydti.fawe.object.function.QuadFunction;
import com.boydti.fawe.object.schematic.MinecraftStructure;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
@ -152,7 +151,7 @@ public class SchematicCommands {
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
public void clear(Player player, LocalSession session) throws WorldEditException {
session.setClipboard(null);
BBC.CLIPBOARD_CLEARED.send(player);
player.print(BBC.CLIPBOARD_CLEARED.s());
}
@Command(
@ -182,7 +181,7 @@ public class SchematicCommands {
} else {
session.setClipboard(null);
}
BBC.CLIPBOARD_CLEARED.send(player);
player.print(BBC.CLIPBOARD_CLEARED.s());
return;
}
}
@ -398,7 +397,7 @@ public class SchematicCommands {
ClipboardHolder clipboard = session.getClipboard();
List<File> sources = getFiles(clipboard);
if (sources.isEmpty()) {
BBC.SCHEMATIC_NONE.send(player);
player.printError(BBC.SCHEMATIC_NONE.s());
return;
}
if (!destDir.exists() && !destDir.mkdirs()) {
@ -449,7 +448,7 @@ public class SchematicCommands {
}
if (files.isEmpty()) {
BBC.SCHEMATIC_NONE.send(actor);
actor.printError(BBC.SCHEMATIC_NONE.s());
return;
}
for (File f : files) {
@ -604,12 +603,12 @@ public class SchematicCommands {
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
String schemCmd = "/schematic";
String loadSingle = schemCmd + " " + "load";
String loadMulti = schemCmd + " " + "loadall";
String unload = schemCmd + " " + "unload";
String delete = schemCmd + " " + "delete";
String list = schemCmd + " " + "list";
String showCmd = schemCmd + " " + "show";
String loadSingle = schemCmd + " load";
String loadMulti = schemCmd + " loadall";
String unload = schemCmd + " unload";
String delete = schemCmd + " delete";
String list = schemCmd + " list";
String showCmd = schemCmd + " show";
List<String> args = filter.isEmpty() ? Collections.emptyList() : Arrays.asList(filter.split(" "));
@ -634,9 +633,8 @@ public class SchematicCommands {
Function<URI, Boolean> isLoaded = multi == null ? f -> false : multi::contains;
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded, new QuadFunction<String, String, UtilityCommands.URIType, Boolean, Component>() {
@Override
public Component apply(String name, String path, UtilityCommands.URIType type, Boolean loaded) {
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded,
(name, path, type, loaded) -> {
TextColor color = TextColor.GRAY;
switch (type) {
case URL:
@ -685,8 +683,7 @@ public class SchematicCommands {
msg.append(msgElem);
return msg.create();
}
});
});
PaginationBox paginationBox = PaginationBox.fromStrings("Available schematics", pageCommand, components);
actor.print(paginationBox.create(page));
}
@ -764,7 +761,7 @@ public class SchematicCommands {
log.info(actor.getName() + " saved " + file.getCanonicalPath());
BBC.SCHEMATIC_SAVED.send(actor, file.getName());
} else {
BBC.WORLDEDIT_CANCEL_REASON_MANUAL.send(actor);
actor.printError(BBC.WORLDEDIT_CANCEL_REASON_MANUAL.s());
}
}
return null;

Datei anzeigen

@ -190,7 +190,7 @@ public class ToolUtilCommands {
)
public void none(Player player, LocalSession session) throws WorldEditException {
session.setTool(player, null);
BBC.TOOL_NONE.send(player);
player.print(BBC.TOOL_NONE.s());
}
@Command(
@ -203,20 +203,19 @@ public class ToolUtilCommands {
@Arg(desc = "state", def = "on") String state) throws WorldEditException {
if (session.hasSuperPickAxe()) {
if ("on".equals(state)) {
BBC.SUPERPICKAXE_ENABLED.send(player);
player.print(BBC.SUPERPICKAXE_ENABLED.s());
return;
}
session.disableSuperPickAxe();
BBC.SUPERPICKAXE_DISABLED.send(player);
player.print(BBC.SUPERPICKAXE_DISABLED.s());
} else {
if ("off".equals(state)) {
BBC.SUPERPICKAXE_DISABLED.send(player);
player.print(BBC.SUPERPICKAXE_DISABLED.s());
return;
}
session.enableSuperPickAxe();
BBC.SUPERPICKAXE_ENABLED.send(player);
player.print(BBC.SUPERPICKAXE_ENABLED.s());
}
}

Datei anzeigen

@ -19,6 +19,8 @@
package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings;
@ -68,13 +70,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import javax.imageio.ImageIO;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
@ -93,8 +88,12 @@ import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import javax.imageio.ImageIO;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
/**
* Utility commands.
@ -176,9 +175,9 @@ public class UtilityCommands {
)
@CommandPermissions("fawe.cancel")
@SkipQueue
public void cancel(Player fp) {
int cancelled = fp.cancel(false);
BBC.WORLDEDIT_CANCEL_COUNT.send(fp, cancelled);
public void cancel(Player player) {
int cancelled = player.cancel(false);
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
}
@Command(

Datei anzeigen

@ -1,59 +1,59 @@
package com.sk89q.worldedit.entity;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
public interface MapMetadatable extends Metadatable {
Map<String, Object> getRawMeta();
/**
* Set some session only metadata for the player
*
* @param key
* @param value
* {@inheritDoc}
*/
@Override
default void setMeta(String key, Object value) {
getRawMeta().put(key, value);
}
/**
* {@inheritDoc}
*/
@Override
default <T> T getAndSetMeta(String key, T value) {
return (T) getRawMeta().put(key, value);
}
/**
* {@inheritDoc}
*/
@Override
default boolean hasMeta() {
return !getRawMeta().isEmpty();
}
/**
* Get the metadata for a key.
*
* @param <V>
* @param key
* @return
* {@inheritDoc}
*/
@Override
default <V> V getMeta(String key) {
return (V) getRawMeta().get(key);
}
/**
* Get the metadata for a specific key (or return the default provided)
*
* @param key
* @param def
* @param <V>
* @return
* {@inheritDoc}
*/
default <V> V getMeta(String key, V def) {
@NotNull
@Override
default <V> V getMeta(String key, @NotNull V def) {
V value = (V) getRawMeta().get(key);
return value == null ? def : value;
}
/**
* Delete the metadata for a key.
* - metadata is session only
* - deleting other plugin's metadata may cause issues
*
* @param key
* {@inheritDoc}
*/
@Override
default <V> V deleteMeta(String key) {
return (V) getRawMeta().remove(key);
}

Datei anzeigen

@ -42,7 +42,7 @@ public interface Metadatable {
*/
@NotNull
default <V> V getMeta(String key, @NotNull V defaultValue) {
V value = (V) getMeta(key);
V value = getMeta(key);
return value == null ? defaultValue : value; }
/**