simple way 💀
This commit is contained in:
parent
58a1f99cfa
commit
88c3e15ba1
1 changed files with 3 additions and 21 deletions
|
|
@ -5,9 +5,7 @@ import io.papermc.paper.threadedregions.scheduler.RegionScheduler;
|
||||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.block.data.type.Slab;
|
import org.bukkit.block.data.type.Slab;
|
||||||
import org.bukkit.entity.BlockDisplay;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
|
@ -36,7 +34,6 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
||||||
private ScheduledTask task;
|
private ScheduledTask task;
|
||||||
private ScheduledTask blockktask;
|
private ScheduledTask blockktask;
|
||||||
private BlockDisplay display;
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
|
|
@ -80,29 +77,14 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
}), 0L, 1L, TimeUnit.MILLISECONDS);
|
}), 0L, 1L, TimeUnit.MILLISECONDS);
|
||||||
} catch (UnsupportedOperationException ignored) {
|
} catch (UnsupportedOperationException ignored) {
|
||||||
}
|
}
|
||||||
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
|
||||||
Location loc = new Location(Bukkit.getWorld("world_the_end"), 100, 48, 0);
|
"summon minecraft:block_display 100.0005 48 -0.0005 {block_state:{Name:\"minecraft:obsidian\"},Tags:[\"FoliaFlow_FakeBlock\"]}");
|
||||||
BlockData blockData = Material.OBSIDIAN.createBlockData();
|
|
||||||
display = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).spawn(loc, BlockDisplay.class);
|
|
||||||
if (display == null) {
|
|
||||||
getLogger().severe("Failed to spawn BlockDisplay entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
display.setBlock(blockData);
|
|
||||||
getLogger().info("BlockDisplay entity spawned successfully.");
|
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (display != null) {
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "kill @e[tag=FoliaFlow_FakeBlock]");
|
||||||
display.remove();
|
|
||||||
display = null;
|
|
||||||
}
|
|
||||||
for (Entity entity : Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getEntitiesByClass(BlockDisplay.class)) {
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
getLogger().info("BlockDisplay entity removed successfully.");
|
|
||||||
task.cancel();
|
task.cancel();
|
||||||
blockktask.cancel();
|
blockktask.cancel();
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue