mirror of
https://github.com/MeowLynxSea/MeowBattle.git
synced 2025-07-09 02:44:36 +00:00
修复了墙壁不显示的问题
This commit is contained in:
parent
618aa33d8c
commit
c6af6a4f94
@ -33,7 +33,7 @@ public final class MeowBattle extends JavaPlugin {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if(args.length == 1) {
|
||||
if (Objects.equals(args[0], "start")) {
|
||||
if (Objects.equals(args[0], "init")) {
|
||||
List<borderChangeTask> borderChangeTasks = new ArrayList<>();
|
||||
borderChangeTasks.add(new borderChangeTask(10, 8, 0.75, 0.5));
|
||||
borderChangeTasks.add(new borderChangeTask(30, 8, 0.45, 1));
|
||||
@ -41,6 +41,8 @@ public final class MeowBattle extends JavaPlugin {
|
||||
borderChangeTasks.add(new borderChangeTask(70, 15, 0, 2.5));
|
||||
World world = Objects.requireNonNull(Bukkit.getWorld("world"));
|
||||
battleWorld = new BattleWorld(world, new Location(world,495, 0, 210), new Location(world, 595, 0, 310), 0, borderChangeTasks);
|
||||
// battleWorld.startBorderChange();
|
||||
} else if(Objects.equals(args[0], "start")) {
|
||||
battleWorld.startBorderChange();
|
||||
} else if (Objects.equals(args[0], "stop")) {
|
||||
battleWorld.stopAllActivities();
|
||||
|
@ -53,15 +53,23 @@ public class BattleWorld {
|
||||
// }
|
||||
// }
|
||||
|
||||
// Bukkit.broadcastMessage("Moving walls...");
|
||||
|
||||
BlockData data = Material.RED_STAINED_GLASS.createBlockData();
|
||||
|
||||
Location bLocation = worldBorder.getCenter();
|
||||
|
||||
// Bukkit.broadcastMessage("bLocation: " + bLocation);
|
||||
//
|
||||
// Bukkit.broadcastMessage("Wall1 Pos BEFORE: " + wall1.getLocation().getX() + " " + wall1.getLocation().getY() + " " + wall1.getLocation().getZ());
|
||||
// Bukkit.broadcastMessage("Trying to tp to: " + new Location(world, bLocation.getX() - worldBorder.getSize() / 2, world.getMaxHeight(), bLocation.getZ() - worldBorder.getSize() / 2));
|
||||
wall1.setViewRange(Float.MAX_VALUE);
|
||||
wall1.setTransformation(new Transformation(new Vector3f(), new AxisAngle4f(), new Vector3f((float) worldBorder.getSize(), -(float) (world.getMaxHeight() - baseY), 0), new AxisAngle4f()));
|
||||
wall1.teleport(new Location(world, bLocation.getX() - worldBorder.getSize() / 2, world.getMaxHeight(), bLocation.getZ() - worldBorder.getSize() / 2));
|
||||
wall1.setBlock(data);
|
||||
|
||||
// Bukkit.broadcastMessage("Wall1 Pos AFTER: " + wall1.getLocation().getX() + " " + wall1.getLocation().getY() + " " + wall1.getLocation().getZ());
|
||||
|
||||
wall2.setViewRange(Float.MAX_VALUE);
|
||||
wall2.setTransformation(new Transformation(new Vector3f(), new AxisAngle4f(), new Vector3f((float) worldBorder.getSize(), -(float) (world.getMaxHeight() - baseY), 0), new AxisAngle4f()));
|
||||
wall2.teleport(new Location(world, bLocation.getX() - worldBorder.getSize() / 2, world.getMaxHeight(), bLocation.getZ() + worldBorder.getSize() / 2));
|
||||
@ -132,6 +140,7 @@ public class BattleWorld {
|
||||
}
|
||||
if(world != null) {
|
||||
createParticleWall(worldBorder.getCenter().getX() - worldBorder.getSize() / 2, worldBorder.getCenter().getZ() - worldBorder.getSize() / 2, worldBorder.getCenter().getX() + worldBorder.getSize() / 2, worldBorder.getCenter().getZ() + worldBorder.getSize() / 2);
|
||||
// Bukkit.broadcastMessage("Wall1 Pos: " + wall1.getLocation().getX() + " " + wall1.getLocation().getY() + " " + wall1.getLocation().getZ());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -199,11 +208,6 @@ public class BattleWorld {
|
||||
player.setResourcePack("http://ys-n.ysepan.com/wap/meowlynxsea/A2BcPlIE3EGQ6JeAeQ/kDN3lgB,AB52M5yRa48aV7EQ3yge8/MeowBattle.zip");
|
||||
}
|
||||
|
||||
wall1 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall2 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall3 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall4 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
|
||||
//borderChangeTasks中最后一个任务的size必须为0
|
||||
if(!borderChangeTasks.isEmpty()) {
|
||||
borderChangeTasks.getLast().size = 0;
|
||||
@ -263,6 +267,11 @@ public class BattleWorld {
|
||||
}
|
||||
|
||||
public void startBorderChange() {
|
||||
wall1 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall2 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall3 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
wall4 = (BlockDisplay) world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLOCK_DISPLAY);
|
||||
|
||||
renderTask = renderer.runTaskTimer(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("MeowBattle")), 0, 2);
|
||||
soundManagerTask = soundManager.runTaskTimer(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("MeowBattle")), 0, 7);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user