Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Fix compile
Dieser Commit ist enthalten in:
Ursprung
59b8465493
Commit
6f32783e52
@ -46,7 +46,6 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||||
@ -300,7 +299,7 @@ public class SelectionCommands {
|
|||||||
session.setTool(itemType, NavigationWand.INSTANCE);
|
session.setTool(itemType, NavigationWand.INSTANCE);
|
||||||
player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info"));
|
player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info"));
|
||||||
} else {
|
} else {
|
||||||
session.setTool(itemType, new SelectionWand());
|
session.setTool(itemType, SelectionWand.INSTANCE);
|
||||||
player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info"));
|
player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info"));
|
||||||
}
|
}
|
||||||
if (!player.hasPermission("fawe.tips"))
|
if (!player.hasPermission("fawe.tips"))
|
||||||
@ -453,7 +452,7 @@ public class SelectionCommands {
|
|||||||
desc = "Get information about the selection"
|
desc = "Get information about the selection"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.selection.size")
|
@CommandPermissions("worldedit.selection.size")
|
||||||
public void size(Player player, LocalSession session,
|
public void size(Actor actor, World world, LocalSession session,
|
||||||
@Switch(name = 'c', desc = "Get clipboard info instead")
|
@Switch(name = 'c', desc = "Get clipboard info instead")
|
||||||
boolean clipboardInfo) throws WorldEditException {
|
boolean clipboardInfo) throws WorldEditException {
|
||||||
Region region;
|
Region region;
|
||||||
@ -477,16 +476,17 @@ public class SelectionCommands {
|
|||||||
region = clipboard.getRegion();
|
region = clipboard.getRegion();
|
||||||
BlockVector3 size = region.getMaximumPoint()
|
BlockVector3 size = region.getMaximumPoint()
|
||||||
.subtract(region.getMinimumPoint()).
|
.subtract(region.getMinimumPoint()).
|
||||||
add(1, 1, 1);
|
add(1, 1, 1);
|
||||||
BlockVector3 origin = clipboard.getOrigin();
|
BlockVector3 origin = clipboard.getOrigin();
|
||||||
|
|
||||||
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ();
|
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ();
|
||||||
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
|
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
|
||||||
|
|
||||||
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
|
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
|
||||||
|
actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(name), TextComponent.of(sizeStr), TextComponent.of(originStr), TextComponent.of(numBlocks)));
|
||||||
BlockVector3 origin = clipboard.getOrigin();
|
index++;
|
||||||
actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(origin.toString())));
|
}
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
region = session.getSelection(world);
|
region = session.getSelection(world);
|
||||||
|
|
||||||
@ -524,11 +524,13 @@ public class SelectionCommands {
|
|||||||
desc = "Get the distribution of blocks in the selection"
|
desc = "Get the distribution of blocks in the selection"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.analysis.distr")
|
@CommandPermissions("worldedit.analysis.distr")
|
||||||
public void distr(Player player, LocalSession session, EditSession editSession,
|
public void distr(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||||
@Switch(name = 'c', desc = "Get the distribution of the clipboard instead")
|
@Switch(name = 'c', desc = "Get the distribution of the clipboard instead")
|
||||||
boolean clipboardDistr,
|
boolean clipboardDistr,
|
||||||
@Switch(name = 'd', desc = "Separate blocks by state")
|
@Switch(name = 'd', desc = "Separate blocks by state")
|
||||||
boolean separateStates) throws WorldEditException {
|
boolean separateStates,
|
||||||
|
@ArgFlag(name = 'p', desc = "Gets page from a previous distribution.", def = "")
|
||||||
|
Integer page) throws WorldEditException {
|
||||||
List<Countable> distribution;
|
List<Countable> distribution;
|
||||||
|
|
||||||
Region region;
|
Region region;
|
||||||
@ -538,7 +540,7 @@ public class SelectionCommands {
|
|||||||
region = clipboard.getRegion();
|
region = clipboard.getRegion();
|
||||||
new ExtentTraverser<AbstractDelegateExtent>(editSession).setNext(new AbstractDelegateExtent(clipboard));
|
new ExtentTraverser<AbstractDelegateExtent>(editSession).setNext(new AbstractDelegateExtent(clipboard));
|
||||||
} else {
|
} else {
|
||||||
region = session.getSelection(player.getWorld());
|
region = session.getSelection(world);
|
||||||
}
|
}
|
||||||
if (separateStates)
|
if (separateStates)
|
||||||
distribution = (List) editSession.getBlockDistributionWithData(region);
|
distribution = (List) editSession.getBlockDistributionWithData(region);
|
||||||
@ -553,16 +555,16 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
BlockDistributionResult res = new BlockDistributionResult(distribution, separateStates);
|
BlockDistributionResult res = new BlockDistributionResult(distribution, separateStates);
|
||||||
if (!actor.isPlayer()) res.formatForConsole();
|
if (!actor.isPlayer()) res.formatForConsole();
|
||||||
return res.create(finalPage);
|
actor.print(res.create(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BlockDistributionResult extends PaginationBox {
|
private static class BlockDistributionResult extends PaginationBox {
|
||||||
|
|
||||||
private final List<Countable<BlockState>> distribution;
|
private final List<Countable> distribution;
|
||||||
private final int totalBlocks;
|
private final int totalBlocks;
|
||||||
private final boolean separateStates;
|
private final boolean separateStates;
|
||||||
|
|
||||||
BlockDistributionResult(List<Countable<BlockState>> distribution, boolean separateStates) {
|
BlockDistributionResult(List<Countable> distribution, boolean separateStates) {
|
||||||
super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : ""));
|
super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : ""));
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
||||||
|
@ -143,7 +143,6 @@ public class WorldEditCommands {
|
|||||||
public void report(Actor actor) throws WorldEditException, IOException {
|
public void report(Actor actor) throws WorldEditException, IOException {
|
||||||
String dest = IncendoPaster.debugPaste();
|
String dest = IncendoPaster.debugPaste();
|
||||||
actor.printInfo(TranslatableComponent.of("worldedit.report.written", TextComponent.of(dest)));
|
actor.printInfo(TranslatableComponent.of("worldedit.report.written", TextComponent.of(dest)));
|
||||||
BBC.DOWNLOAD_LINK.send(actor, );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.util.formatting.component;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.sk89q.worldedit.util.Countable;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockDistributionResult extends PaginationBox {
|
|
||||||
|
|
||||||
private final List<Countable> distribution;
|
|
||||||
private final int totalBlocks;
|
|
||||||
private final boolean separateStates;
|
|
||||||
|
|
||||||
public BlockDistributionResult(List<Countable> distribution, boolean separateStates) {
|
|
||||||
super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : ""));
|
|
||||||
this.distribution = distribution;
|
|
||||||
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
|
||||||
this.totalBlocks = distribution.stream().mapToInt(Countable::getAmount).sum();
|
|
||||||
this.separateStates = separateStates;
|
|
||||||
setComponentsPerPage(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getComponent(int number) {
|
|
||||||
Countable<BlockState> c = distribution.get(number);
|
|
||||||
TextComponent.Builder line = TextComponent.builder();
|
|
||||||
|
|
||||||
final int count = c.getAmount();
|
|
||||||
|
|
||||||
final double perc = count / (double) totalBlocks * 100;
|
|
||||||
final int maxDigits = (int) (Math.log10(totalBlocks) + 1);
|
|
||||||
final int curDigits = (int) (Math.log10(count) + 1);
|
|
||||||
line.append(String.format("%s%.3f%% ", perc < 10 ? " " : "", perc), TextColor.GOLD);
|
|
||||||
final int space = maxDigits - curDigits;
|
|
||||||
String pad = Strings.repeat(" ", space == 0 ? 2 : 2 * space + 1);
|
|
||||||
line.append(String.format("%s%s", count, pad), TextColor.YELLOW);
|
|
||||||
|
|
||||||
final BlockState state = c.getID();
|
|
||||||
final BlockType blockType = state.getBlockType();
|
|
||||||
TextComponent blockName = TextComponent.of(blockType.getName(), TextColor.LIGHT_PURPLE);
|
|
||||||
TextComponent toolTip;
|
|
||||||
if (separateStates && state != blockType.getDefaultState()) {
|
|
||||||
toolTip = TextComponent.of(state.getAsString(), TextColor.GRAY);
|
|
||||||
blockName = blockName.append(TextComponent.of("*", TextColor.LIGHT_PURPLE));
|
|
||||||
} else {
|
|
||||||
toolTip = TextComponent.of(blockType.getId(), TextColor.GRAY);
|
|
||||||
}
|
|
||||||
blockName = blockName.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, toolTip));
|
|
||||||
line.append(blockName);
|
|
||||||
|
|
||||||
return line.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getComponentsSize() {
|
|
||||||
return distribution.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component create(int page) throws InvalidComponentException {
|
|
||||||
super.getContents().append(TextComponent.of("Total Block Count: " + totalBlocks, TextColor.GRAY))
|
|
||||||
.append(TextComponent.newline());
|
|
||||||
return super.create(page);
|
|
||||||
}
|
|
||||||
}
|
|
@ -115,7 +115,7 @@
|
|||||||
"worldedit.shift.shifted": "Region shifted.",
|
"worldedit.shift.shifted": "Region shifted.",
|
||||||
"worldedit.outset.outset": "Region outset.",
|
"worldedit.outset.outset": "Region outset.",
|
||||||
"worldedit.inset.inset": "Region inset.",
|
"worldedit.inset.inset": "Region inset.",
|
||||||
"worldedit.size.offset": "Offset: {0}",
|
"worldedit.size.offset": "{0}: {1} @ {2} ({3} blocks)",
|
||||||
"worldedit.size.type": "Type: {0}",
|
"worldedit.size.type": "Type: {0}",
|
||||||
"worldedit.size.size": "Size: {0}",
|
"worldedit.size.size": "Size: {0}",
|
||||||
"worldedit.size.distance": "Cuboid distance: {0}",
|
"worldedit.size.distance": "Cuboid distance: {0}",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren