Compare commits

...
Sign in to create a new pull request.

23 commits

Author SHA1 Message Date
99af88ee82 Update README.md
Some checks failed
Build JAR / build (push) Has been cancelled
2026-08-04 21:22:05 +02:00
b9c87885de updated to 26.1.2
Some checks are pending
Build JAR / build (push) Waiting to run
please work
2026-08-04 21:20:10 +02:00
MidnightTale
8acab44797 fix: detect vertical falling blocks entering end portals 2026-08-03 16:46:04 +07:00
MidnightTale
a5172407b5 Merge MoRanYue/FoliaFlow 2026-08-03 11:24:15 +07:00
MidnightTale
6b4d10faf3 bump to 3.0 2026-08-03 11:18:36 +07:00
MoRanYue
4f5818c272 feat: update to 26.1.2 and use modern API 2026-07-04 19:24:30 +08:00
MidnightTale
a2df8bbe7d
Update build.yml 2024-06-03 11:49:36 +07:00
MidnightTale
3d428ffcfa
Update build.yml 2024-06-03 11:48:26 +07:00
MidnightTale
d83991f028
Update build.yml 2024-05-31 10:18:24 +07:00
MidnightTale
1f26c62b31
Update README.md 2024-05-28 04:59:00 +07:00
MidnightTale
672f3d2b94
change to java 17 2024-05-28 04:37:37 +07:00
MidnightTale
0a87ba80c6
update 2.4 2024-05-28 04:34:43 +07:00
MidnightTale
d84aef8126 Fix block disappear 2023-08-29 19:09:05 +07:00
MidnightTale
99b4c3d08c for got to update config 2023-08-29 17:46:32 +07:00
MidnightTale
79789db92c version bump 2023-08-29 17:41:57 +07:00
MidnightTale
f301f159e6 is happen on paper 1.20 build 169 teleportation is a bit below vanilla 2023-08-29 17:33:07 +07:00
Mid
d974903c34
Merge pull request #21 from xiaoyueyoqwq/patch-1
Update config.yml
2023-06-09 22:33:06 +07:00
xiaoyueyoqwq
211fd88d80
Update config.yml
After testing, the -1 value solves many problems in the sand brushing process, such as momentum instability, obsidian platform problems, sand block rotation, jumping flight, etc
2023-06-04 02:00:10 +08:00
Mid
79b594aec0
Merge pull request #19 from KaiijuMC/master
Add +x permission to gradlew
2023-05-02 15:43:18 +07:00
kugge
b4e08f7778 Add +x permission to gradlew 2023-05-02 10:43:25 +02:00
Mid
70c2fb1500
Update build.yml 2023-04-30 18:09:22 +07:00
Mid
962d08c8a6
Update build.yml 2023-04-30 18:07:26 +07:00
Mid
9ef9f85bec
Create build.yml 2023-04-30 18:07:11 +07:00
11 changed files with 157 additions and 37 deletions

27
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Build JAR
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Get project version
run: echo "version=$(grep '^version' build.gradle | cut -d' ' -f3 | tr -d '\"')" >> $GITHUB_ENV
- name: Build with Gradle
run: ./gradlew build -x test
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
name: FoliaFlow-${{ env.version }}-${{ github.sha }}
path: build/libs/FoliaFlow-${{ env.version }}.jar

1
.gitignore vendored
View file

@ -116,3 +116,4 @@ run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
niri-rpc/

View file

@ -1,3 +1,5 @@
# THIS IS NOT MY PLUGIN, I JUST EDITED ONE SINGLE LINE IN PLUGIN.YML, THE ORIGINAL IS AT: https://github.com/MidnightTale/FoliaFlow
FoliaFlow is a Minecraft plugin that allows players to using gravity block duplication glitch again in Paper and Folia
## How is work?
@ -26,13 +28,20 @@ To install FoliaFlow, follow these steps:
# If you find values that seems more vanilla please create a PR
# https://github.com/Hynse/FoliaFlow
# Optimize value for horizontal_coefficient
# Default value for horizontal_coefficient
# - Folia (1.499)
# - Paper (1.3)
# - Paper (2)
horizontal_coefficient: 1.499
# -----------------------------------------
vertical_coefficient: -1.7
spawn_height: 0.08
folia_offset: 0.5
# Default value for teleport_offset
# - Folia (0.5)
# - Paper (2.4)
teleport_offset: 0.5
# -----------------------------------------
```
## Permissions

View file

@ -3,7 +3,7 @@ plugins {
}
group = 'xyz.hynse'
version = "2.2"
version = "3.0"
repositories {
mavenCentral()
@ -14,7 +14,7 @@ repositories {
}
dependencies {
compileOnly "dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT"
compileOnly "dev.folia:folia-api:1.20.4-R0.1-SNAPSHOT"
}
def targetJavaVersion = 17

0
gradlew vendored Normal file → Executable file
View file

View file

@ -4,7 +4,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import xyz.hynse.foliaflow.command.ReloadCommand;
import xyz.hynse.foliaflow.util.SchedulerUtil;
import xyz.hynse.foliaflow.util.CheckSafeTeleportation;
import xyz.hynse.foliaflow.watcher.PortalWatcher;
import java.io.File;
@ -14,11 +14,13 @@ import java.io.InputStreamReader;
public class FoliaFlow extends JavaPlugin {
private boolean isFirstEnable = true;
//public boolean isUnSafeTeleport = false;
public static FoliaFlow instance;
public static double horizontalCoefficient;
public static double verticalCoefficient;
public static double spawnHeight;
public static double foliaOffset;
public static double TeleportOffset;
//public static CheckSafeTeleportation checkSafeTeleportation;
@Override
public void onEnable() {
@ -46,11 +48,6 @@ public class FoliaFlow extends JavaPlugin {
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(defaultConfigStream));
config.options().copyDefaults(true);
config.setDefaults(defaultConfig);
boolean isFolia = SchedulerUtil.isFolia();
if (!config.contains("horizontal_coefficient")) {
double horizontalCoefficient = isFolia ? 1.499 : 1.3;
config.set("horizontal_coefficient", horizontalCoefficient);
}
try {
config.save(configFile);
} catch (IOException e) {
@ -64,11 +61,13 @@ public class FoliaFlow extends JavaPlugin {
horizontalCoefficient = getConfig().getDouble("horizontal_coefficient");
verticalCoefficient = getConfig().getDouble("vertical_coefficient");
spawnHeight = getConfig().getDouble("spawn_height");
foliaOffset = getConfig().getDouble("folia_offset");
TeleportOffset = getConfig().getDouble("teleport_offset");
}
private void register() {
getCommand("flowreload").setExecutor(new ReloadCommand());
// checkSafeTeleportation = new CheckSafeTeleportation();
// checkSafeTeleportation.updateSafeTeleportation();
getServer().getPluginManager().registerEvents(new PortalWatcher(), this);
}
}

View file

@ -0,0 +1,49 @@
package xyz.hynse.foliaflow.util;
import org.yaml.snakeyaml.Yaml;
import xyz.hynse.foliaflow.FoliaFlow;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import static org.bukkit.Bukkit.getServer;
public class CheckSafeTeleportation {
public boolean checkUnsafeEndPortalTeleportation() {
File configFile = new File(getServer().getWorldContainer(), "config/paper-global.yml");
if (!configFile.exists()) {
FoliaFlow.instance.getLogger().warning("paper-global.yml not found!");
return false;
}
try (FileInputStream fis = new FileInputStream(configFile)) {
Yaml yaml = new Yaml();
Map<String, Object> config = yaml.load(fis);
Map<String, Object> unsupportedSettings = (Map<String, Object>) config.get("unsupported-settings");
if (unsupportedSettings != null) {
Boolean setting = (Boolean) unsupportedSettings.get("allow-unsafe-end-portal-teleportation");
return setting != null && setting;
}
} catch (IOException e) {
FoliaFlow.instance.getLogger().severe("Failed to read paper-global.yml: " + e.getMessage());
}
return false;
}
// public void updateSafeTeleportation() {
// boolean safeTeleportation = checkUnsafeEndPortalTeleportation();
// if (safeTeleportation) {
// FoliaFlow.instance.isUnSafeTeleport = true;
// FoliaFlow.instance.getLogger().info("Unsafe End Portal Teleportation is true.");
// } else {
// FoliaFlow.instance.isUnSafeTeleport = false;
// FoliaFlow.instance.getLogger().info("Unsafe End Portal Teleportation is false.");
// }
// }
}

View file

@ -10,11 +10,12 @@ public class SchedulerUtil {
private static boolean tryFolia() {
try {
Bukkit.getAsyncScheduler();
Class.forName("io.papermc.paper.threadedregions.RegionizedServer");
return true;
} catch (Throwable ignored) {}
} catch (ClassNotFoundException e) {
return false;
}
}
public static Boolean isFolia() {
if (IS_FOLIA == null) IS_FOLIA = tryFolia();
@ -22,7 +23,10 @@ public class SchedulerUtil {
}
public static void runLaterEntity(Entity entity, Plugin plugin, Runnable runnable, int ticks) {
if (isFolia()) entity.getScheduler().runDelayed(plugin, (task) -> runnable.run(), null, ticks);
else Bukkit.getScheduler().runTaskLater(plugin, runnable, ticks);
if (isFolia()) {
entity.getScheduler().runDelayed(plugin, (task) -> runnable.run(), null, ticks);
} else {
Bukkit.getScheduler().runTaskLater(plugin, runnable, ticks);
}
}
}

View file

@ -9,6 +9,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.util.Vector;
import xyz.hynse.foliaflow.FoliaFlow;
@ -18,32 +19,55 @@ import static xyz.hynse.foliaflow.util.VelocityUtil.getBlockMovingTo;
public class PortalWatcher implements Listener {
private static final String DUPE_TAG = "foliaflow_dupe";
@EventHandler
public void onFallingBlockToBlock(EntityChangeBlockEvent e){
if(e.getEntityType() != EntityType.FALLING_BLOCK) return;
Entity entity = e.getEntity();
if(entity.getScoreboardTags().contains(DUPE_TAG)) return;
Location loc = entity.getLocation();
Vector vel = entity.getVelocity();
Block movingTo = getBlockMovingTo(loc, vel);
if(movingTo.getType() == Material.END_PORTAL){
Location spawnLoc = movingTo.getLocation();
spawnDupe(entity, movingTo, false);
}
}
@EventHandler
public void onPortalEnter(EntityPortalEnterEvent e){
if(e.getEntityType() != EntityType.FALLING_BLOCK) return;
Entity entity = e.getEntity();
if(entity.getScoreboardTags().contains(DUPE_TAG)) return;
Block portal = e.getLocation().getBlock();
if(portal.getType() == Material.END_PORTAL && portal.getRelative(0, -1, 0).getType().name().endsWith("_FENCE")){
spawnDupe(entity, portal, true);
}
}
private void spawnDupe(Entity entity, Block portal, boolean passThrough){
Location spawnLoc = portal.getLocation();
spawnLoc.add(0.5, FoliaFlow.spawnHeight, 0.5);
FallingBlock dummy = loc.getWorld().spawnFallingBlock(spawnLoc, ((FallingBlock) entity).getBlockData());
Vector dummyVel = vel.clone();
FallingBlock dummy = entity.getWorld().spawnFallingBlock(spawnLoc, ((FallingBlock) entity).getBlockData());
dummy.addScoreboardTag(DUPE_TAG);
Vector dummyVel = entity.getVelocity().clone();
dummyVel.multiply(FoliaFlow.horizontalCoefficient);
dummyVel.setY(vel.getY() * FoliaFlow.verticalCoefficient);
if(passThrough){
dummyVel.setY(entity.getVelocity().getY());
} else {
dummyVel.setY(entity.getVelocity().getY() * FoliaFlow.verticalCoefficient);
}
dummy.setVelocity(dummyVel);
// Add vector seems vanilla.
SchedulerUtil.runLaterEntity(dummy, FoliaFlow.instance, () -> {
// Portal teleportation on Folia is a bit below vanilla, so we teleport it above
if (SchedulerUtil.isFolia()) dummy.teleportAsync(dummy.getLocation().add(0, FoliaFlow.foliaOffset, 0));
// Portal teleportation is a bit below vanilla, so we teleport it above
dummy.teleportAsync(dummy.getLocation().add(0, FoliaFlow.TeleportOffset, 0));
dummy.setVelocity(dummyVel);
},
2
);
}
}
}

View file

@ -3,10 +3,17 @@
# If you find values that seems more vanilla please create a PR
# https://github.com/Hynse/FoliaFlow
# Optimize value for horizontal_coefficient
# Default value for horizontal_coefficient
# - Folia (1.499)
# - Paper (1.3)
# - Paper (2)
horizontal_coefficient: 1.499
# -----------------------------------------
vertical_coefficient: -1.7
spawn_height: 0.08
folia_offset: 0.5
# Default value for teleport_offset
# - Folia (0.5)
# - Paper (2.4)
teleport_offset: 0.5
# -----------------------------------------

View file

@ -1,7 +1,7 @@
name: FoliaFlow
version: '${version}'
main: xyz.hynse.foliaflow.FoliaFlow
api-version: 1.19
api-version: 26.1.2
folia-supported: true
commands:
flowreload: