This commit is contained in:
parent
f68b80a30a
commit
c5eb4e6035
@ -129,7 +129,7 @@ Debug: false
|
||||
|
||||
- [X] 从潜影盒中自动补充材料
|
||||
|
||||
- [ ] 选区可视化
|
||||
- [X] 选区可视化
|
||||
|
||||
- [X] 可手动暂停、恢复任务
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>LiteWorldEdit</artifactId>
|
||||
<version>2.4.2.0</version>
|
||||
<version>2.4.3.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>LiteWorldEdit</name>
|
||||
|
@ -55,5 +55,11 @@ public class Events implements Listener {
|
||||
Notification.info(player, "已选择第二个点: " + x + " " + y + " " + z);
|
||||
xplayer.addPoint(2, point);
|
||||
}
|
||||
|
||||
if (xplayer.getPoints().get(1) != null && xplayer.getPoints().get(2) != null) {
|
||||
Point p1 = xplayer.getPoints().get(1);
|
||||
Point p2 = xplayer.getPoints().get(2);
|
||||
ParticleRender.showBoxBorder(LiteWorldEdit.instance, player.getWorld().getName(), p1.x, p1.y, p1.z, p2.x, p2.y, p2.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
51
src/main/java/cn/lunadeer/liteworldedit/ParticleRender.java
Normal file
51
src/main/java/cn/lunadeer/liteworldedit/ParticleRender.java
Normal file
@ -0,0 +1,51 @@
|
||||
package cn.lunadeer.liteworldedit;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class ParticleRender {
|
||||
|
||||
public static void showBoxBorder(JavaPlugin plugin, String world, int x1, int y1, int z1, int x2, int y2, int z2) {
|
||||
showBoxBorder(plugin, new Location(plugin.getServer().getWorld(world), x1, y1, z1),
|
||||
new Location(plugin.getServer().getWorld(world), x2, y2, z2));
|
||||
}
|
||||
|
||||
public static void showBoxBorder(JavaPlugin plugin, Location loc1, Location loc2) {
|
||||
plugin.getServer().getGlobalRegionScheduler().run(LiteWorldEdit.instance, (instance) -> {
|
||||
if (!loc1.getWorld().equals(loc2.getWorld())) {
|
||||
return;
|
||||
}
|
||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
||||
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
||||
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()) + 1;
|
||||
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()) + 1;
|
||||
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()) + 1;
|
||||
World world = loc1.getWorld();
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
spawnParticle(world, x, minY, minZ);
|
||||
spawnParticle(world, x, minY, maxZ);
|
||||
spawnParticle(world, x, maxY, minZ);
|
||||
spawnParticle(world, x, maxY, maxZ);
|
||||
}
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
spawnParticle(world, minX, y, minZ);
|
||||
spawnParticle(world, minX, y, maxZ);
|
||||
spawnParticle(world, maxX, y, minZ);
|
||||
spawnParticle(world, maxX, y, maxZ);
|
||||
}
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
spawnParticle(world, minX, minY, z);
|
||||
spawnParticle(world, minX, maxY, z);
|
||||
spawnParticle(world, maxX, minY, z);
|
||||
spawnParticle(world, maxX, maxY, z);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void spawnParticle(World world, double x, double y, double z) {
|
||||
world.spawnParticle(Particle.FLAME, x, y, z, 10, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user