it has been fixed
This commit is contained in:
parent
7f00245206
commit
9e56a30ac4
2 changed files with 52 additions and 36 deletions
|
|
@ -2,10 +2,8 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
def loader = 'folia'
|
|
||||||
def server = '1.19.4'
|
|
||||||
group = 'xyz.hynse'
|
group = 'xyz.hynse'
|
||||||
version = "1.5-${server}-${loader}"
|
version = "1.6"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
@ -13,10 +11,6 @@ repositories {
|
||||||
name = "papermc-repo"
|
name = "papermc-repo"
|
||||||
url = "https://repo.papermc.io/repository/maven-public/"
|
url = "https://repo.papermc.io/repository/maven-public/"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/groups/public/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package xyz.hynse.foliaflow;
|
package xyz.hynse.foliaflow;
|
||||||
|
|
||||||
import io.papermc.paper.threadedregions.scheduler.AsyncScheduler;
|
import io.papermc.paper.threadedregions.scheduler.AsyncScheduler;
|
||||||
|
import io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler;
|
||||||
import io.papermc.paper.threadedregions.scheduler.RegionScheduler;
|
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.*;
|
||||||
|
|
@ -11,7 +12,12 @@ import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.bukkit.event.block.EntityBlockFormEvent;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
|
@ -32,15 +38,14 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
private final Set<Location> movingBlocks = new HashSet<>();
|
private final Set<Location> movingBlocks = new HashSet<>();
|
||||||
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
private final Map<Entity, Vector> velocitiesMap = new HashMap<>();
|
||||||
private ScheduledTask Foliaflow_Setblock_Task;
|
private ScheduledTask task;
|
||||||
private ScheduledTask Foliaflow_Blockvelocity_Task;
|
private ScheduledTask blockktask;
|
||||||
|
private boolean blockCreated = false;
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
try {
|
RegionScheduler schedulerblock = getServer().getRegionScheduler();
|
||||||
RegionScheduler Foliaflow_Setblock = getServer().getRegionScheduler();
|
blockktask = schedulerblock.runAtFixedRate(this, Objects.requireNonNull(Bukkit.getWorld("world_the_end")), 1, 1, (schedulerTask) -> {
|
||||||
Foliaflow_Setblock_Task = Foliaflow_Setblock.runAtFixedRate(this, Objects.requireNonNull(Bukkit.getWorld("world_the_end")), 1, 1, (schedulerTask) -> {
|
|
||||||
Block block = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getBlockAt(100, 48, 0);
|
Block block = Objects.requireNonNull(Bukkit.getWorld("world_the_end")).getBlockAt(100, 48, 0);
|
||||||
if (block.getType() == Material.OBSIDIAN) {
|
if (block.getType() == Material.OBSIDIAN) {
|
||||||
block.setType(Material.COBBLED_DEEPSLATE_SLAB);
|
block.setType(Material.COBBLED_DEEPSLATE_SLAB);
|
||||||
|
|
@ -51,12 +56,8 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 1L, 1L);
|
}, 1L, 1L);
|
||||||
} catch (NullPointerException block) {
|
/*AsyncScheduler scheduler = getServer().getAsyncScheduler();
|
||||||
getServer().getLogger().info("Region Scheduler erorr (likly chunky it not load)");
|
task = scheduler.runAtFixedRate(this, (scheduledTask) -> getScheduler().runTask(this, () -> {
|
||||||
}
|
|
||||||
try {
|
|
||||||
AsyncScheduler Foliaflow_Blockvelocity = getServer().getAsyncScheduler();
|
|
||||||
Foliaflow_Blockvelocity_Task = Foliaflow_Blockvelocity.runAtFixedRate(this, (scheduledTask) -> getServer().getScheduler().runTaskAsynchronously(this, () -> {
|
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
for (Entity entity : world.getEntities()) {
|
for (Entity entity : world.getEntities()) {
|
||||||
if (entity.getType() == EntityType.FALLING_BLOCK && entity.getWorld().getEnvironment() == World.Environment.THE_END) {
|
if (entity.getType() == EntityType.FALLING_BLOCK && entity.getWorld().getEnvironment() == World.Environment.THE_END) {
|
||||||
|
|
@ -75,22 +76,43 @@ public class FoliaFlow extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), 0L, 1L, TimeUnit.MILLISECONDS);
|
}), 0L, 1L, TimeUnit.MILLISECONDS);*/
|
||||||
} catch (UnsupportedOperationException ignored) {
|
|
||||||
|
GlobalRegionScheduler scheduler = this.getServer().getGlobalRegionScheduler();
|
||||||
|
|
||||||
|
task = scheduler.runAtFixedRate(this, (scheduledTask) -> {
|
||||||
|
for (World world : Bukkit.getWorlds()) {
|
||||||
|
for (Entity entity : world.getEntities()) {
|
||||||
|
if (entity.getType() == EntityType.FALLING_BLOCK && entity.getWorld().getEnvironment() == World.Environment.THE_END) {
|
||||||
|
Location centerLoc = new Location(entity.getWorld(), 100, 48.5, 0);
|
||||||
|
Location loc = entity.getLocation();
|
||||||
|
if (loc.distance(centerLoc) <= 1) {
|
||||||
|
if (!velocitiesMap.containsKey(entity)) {
|
||||||
|
int index = counter % 4;
|
||||||
|
counter++;
|
||||||
|
Vector velocity = velocities[index];
|
||||||
|
entity.setVelocity(velocity);
|
||||||
|
velocitiesMap.put(entity, velocity);
|
||||||
|
movingBlocks.add(entity.getLocation());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 20L, 1L);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
try {
|
|
||||||
Foliaflow_Setblock_Task.cancel();
|
|
||||||
Foliaflow_Blockvelocity_Task.cancel();
|
|
||||||
} catch (UnsupportedOperationException ignored) {
|
|
||||||
}
|
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
|
||||||
if(e.getEntityType() == EntityType.FALLING_BLOCK){
|
if(e.getEntityType() == EntityType.FALLING_BLOCK){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue