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'
version = '1.0-SNAPSHOT'
version = '1.1-SNAPSHOT'
repositories {
mavenCentral()
@ -22,9 +22,7 @@ repositories {
}
dependencies {
compileOnly "dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT"
implementation "com.tcoded:FoliaLib:0.2.0"
}
compileOnly "dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT"}
def targetJavaVersion = 17
java {

View file

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

View file

@ -2,4 +2,4 @@ name: bbsdfia
version: '${version}'
main: xyz.hynse.bbsdfia.Bbsdfia
api-version: 1.19
folia-supported: true
folia-supported: true