1.1 fix folialib

This commit is contained in:
MidnightTale 2023-04-11 22:50:54 +07:00
commit 4c02f68e4b
3 changed files with 13 additions and 12 deletions

View file

@ -3,7 +3,7 @@ plugins {
} }
group = 'xyz.hynse' group = 'xyz.hynse'
version = '1.0-SNAPSHOT' version = '1.1-SNAPSHOT'
repositories { repositories {
mavenCentral() mavenCentral()
@ -22,9 +22,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly "dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT" compileOnly "dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT"}
implementation "com.tcoded:FoliaLib:0.2.0"
}
def targetJavaVersion = 17 def targetJavaVersion = 17
java { java {

View file

@ -1,5 +1,6 @@
package xyz.hynse.bbsdfia; package xyz.hynse.bbsdfia;
import com.tcoded.folialib.FoliaLib; import com.tcoded.folialib.FoliaLib;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -40,10 +41,11 @@ public class Bbsdfia extends JavaPlugin implements Listener {
if(movingTo != null && movingTo.getType() == Material.END_PORTAL){ if(movingTo != null && movingTo.getType() == Material.END_PORTAL){
//Entity Scheduler Task
foliaLib.getImpl().runAtLocation(loc, () -> foliaLib.getImpl().runAtLocation(loc2, () -> foliaLib.getImpl().runAtEntity(entity, () -> {
//spawn new falling block in the end dimension and have same properties entity type and material same form entity that detect near end portal
try { try {
//Entity Scheduler Task
foliaLib.getImpl().runAtEntity(entity, () -> {
//spawn new falling block in the end dimension and have same properties entity type and material same form entity that detect near end portal
FallingBlock dummy = (FallingBlock) loc2.getWorld().spawnEntity(loc2, EntityType.FALLING_BLOCK); FallingBlock dummy = (FallingBlock) loc2.getWorld().spawnEntity(loc2, EntityType.FALLING_BLOCK);
Vector dummyVel = vel.clone(); Vector dummyVel = vel.clone();
dummy.setVelocity(dummyVel); dummy.setVelocity(dummyVel);
@ -55,11 +57,12 @@ public class Bbsdfia extends JavaPlugin implements Listener {
dummy.setVelocity(new Vector(1, 0, 0)); dummy.setVelocity(new Vector(1, 0, 0));
//velocity to west //velocity to west
dummy.setVelocity(new Vector(-1, 0, 0)); dummy.setVelocity(new Vector(-1, 0, 0));
});
} catch (Exception ex) { } catch (Exception ex) {
getLogger().severe("Error spawning falling block entity: " + ex.getMessage()); getLogger().severe("Error spawning falling block entity: " + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
} }
})));
} }
} }
} }