mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-01-30 12:51:17 +08:00
Make block positions copy on click for //size (#1546)
* Make block positions copy on click for //size * PR feedback
This commit is contained in:
parent
2b868ce0c1
commit
6925d3715a
@ -556,4 +556,12 @@ public int hashCode() {
|
||||
public String toString() {
|
||||
return "(" + x + ", " + z + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation that is supported by the parser.
|
||||
* @return string
|
||||
*/
|
||||
public String toParserString() {
|
||||
return x + "," + z;
|
||||
}
|
||||
}
|
||||
|
@ -705,4 +705,11 @@ public String toString() {
|
||||
return "(" + x + ", " + y + ", " + z + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation that is supported by the parser.
|
||||
* @return string
|
||||
*/
|
||||
public String toParserString() {
|
||||
return x + "," + y + "," + z;
|
||||
}
|
||||
}
|
||||
|
@ -481,4 +481,11 @@ public String toString() {
|
||||
return "(" + x + ", " + z + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation that is supported by the parser.
|
||||
* @return string
|
||||
*/
|
||||
public String toParserString() {
|
||||
return x + "," + z;
|
||||
}
|
||||
}
|
||||
|
@ -612,4 +612,11 @@ public String toString() {
|
||||
return "(" + x + ", " + y + ", " + z + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation that is supported by the parser.
|
||||
* @return string
|
||||
*/
|
||||
public String toParserString() {
|
||||
return x + "," + y + "," + z;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -255,11 +257,15 @@ public List<Component> getSelectionInfoLines() {
|
||||
final List<Component> lines = new ArrayList<>();
|
||||
|
||||
if (position1 != null) {
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cuboid.info.pos1", TextComponent.of(position1.toString())));
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cuboid.info.pos1", TextComponent.of(position1.toString())
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.COPY_TO_CLIPBOARD, position1.toParserString()))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to copy")))));
|
||||
}
|
||||
|
||||
if (position2 != null) {
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cuboid.info.pos2", TextComponent.of(position2.toString())));
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cuboid.info.pos2", TextComponent.of(position2.toString())
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.COPY_TO_CLIPBOARD, position2.toParserString()))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to copy")))));
|
||||
}
|
||||
|
||||
return lines;
|
||||
|
@ -37,6 +37,8 @@
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
@ -244,7 +246,10 @@ public List<Component> getSelectionInfoLines() {
|
||||
final List<Component> lines = new ArrayList<>();
|
||||
|
||||
if (!region.getCenter().equals(Vector3.ZERO)) {
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cylinder.info.center", TextComponent.of(region.getCenter().toString())));
|
||||
Vector3 center = region.getCenter();
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cylinder.info.center", TextComponent.of(center.toString())
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.COPY_TO_CLIPBOARD, center.toParserString()))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to copy")))));
|
||||
}
|
||||
if (!region.getRadius().equals(Vector2.ZERO)) {
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.cylinder.info.radius", TextComponent.of(region.getRadius().toString())));
|
||||
|
@ -34,6 +34,8 @@
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -225,7 +227,9 @@ public List<Component> getSelectionInfoLines() {
|
||||
|
||||
final Vector3 center = region.getCenter();
|
||||
if (center.lengthSq() > 0) {
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.ellipsoid.info.center", TextComponent.of(center.toString())));
|
||||
lines.add(TranslatableComponent.of("worldedit.selection.ellipsoid.info.center", TextComponent.of(center.toString())
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.COPY_TO_CLIPBOARD, center.toParserString()))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to copy")))));
|
||||
}
|
||||
|
||||
final Vector3 radius = region.getRadius();
|
||||
|
Loading…
Reference in New Issue
Block a user