setBlockInEndDimension
This commit is contained in:
parent
a01dbd13cb
commit
c44b286d87
1 changed files with 16 additions and 15 deletions
|
|
@ -37,6 +37,19 @@ public class Bbsdfia extends JavaPlugin implements Listener {
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
getServer().getLogger().info("Bbsdfia plugin stopped");
|
getServer().getLogger().info("Bbsdfia plugin stopped");
|
||||||
}
|
}
|
||||||
|
public void setBlockInEndDimension(Location location) {
|
||||||
|
if (!location.getWorld().getEnvironment().equals(World.Environment.THE_END)) {
|
||||||
|
// The location is not in the End dimension
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Block block = location.getBlock();
|
||||||
|
if (block.getType() != Material.AIR) {
|
||||||
|
// The block is not already air
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
||||||
|
|
@ -73,32 +86,20 @@ public class Bbsdfia extends JavaPlugin implements Listener {
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (!(entity instanceof FallingBlock)) {
|
if (!(entity instanceof FallingBlock)) {
|
||||||
Location location = new Location(getWorld("world_the_end"), 100, 49, 0);
|
|
||||||
|
|
||||||
String commandString = String.format("/execute in minecraft:the_end run setblock %d %d %d air", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this, () -> Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), commandString));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity.getWorld().getEnvironment() != World.Environment.THE_END) {
|
if (entity.getWorld().getEnvironment() != World.Environment.THE_END) {
|
||||||
Location location = new Location(getWorld("world_the_end"), 100, 49, 0);
|
|
||||||
|
|
||||||
String commandString = String.format("/execute in minecraft:the_end run setblock %d %d %d air", location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this, () -> Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), commandString));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location locationx = new Location(getWorld("world_the_end"), 100, 49, 0);
|
|
||||||
|
|
||||||
String commandString = String.format("/execute in minecraft:the_end run setblock %d %d %d air", locationx.getBlockX(), locationx.getBlockY(), locationx.getBlockZ());
|
|
||||||
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), commandString);
|
|
||||||
// Spawn a new falling block entity with velocity
|
// Spawn a new falling block entity with velocity
|
||||||
|
|
||||||
World world = entity.getWorld();
|
World world = entity.getWorld();
|
||||||
Location location = entity.getLocation();
|
Location location = entity.getLocation();
|
||||||
byte data = ((FallingBlock) entity).getBlockData().getAsString().getBytes()[0];
|
byte data = ((FallingBlock) entity).getBlockData().getAsString().getBytes()[0];
|
||||||
Material material = ((FallingBlock) entity).getBlockData().getMaterial();
|
Material material = ((FallingBlock) entity).getBlockData().getMaterial();
|
||||||
|
Location locationblock = new Location(world, 100,49 ,0);
|
||||||
|
setBlockInEndDimension(locationblock);
|
||||||
|
|
||||||
int index = counter % 4;
|
int index = counter % 4;
|
||||||
Vector velocity = velocities[index];
|
Vector velocity = velocities[index];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue