9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-26 18:39:11 +00:00

fix scheduler and browser on linux

This commit is contained in:
XiaoMoMi
2024-01-03 18:21:07 +08:00
parent 0847df9909
commit 73e6b4a3ca
4 changed files with 8 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ public class BackToFolderItem extends AbstractItem implements Icon {
@Override
public ItemProvider getItemProvider() {
if (file != null && file.getPath().startsWith("plugins\\CustomFishing\\contents")) {
if (file != null && (file.getPath().startsWith("plugins\\CustomFishing\\contents") || file.getPath().startsWith("plugins/CustomFishing/contents"))) {
return new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE)
.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(
CFLocale.GUI_BACK_TO_PARENT_FOLDER
@@ -59,7 +59,7 @@ public class BackToFolderItem extends AbstractItem implements Icon {
@Override
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
if (file != null && file.getPath().startsWith("plugins\\CustomFishing\\contents"))
if (file != null && (file.getPath().startsWith("plugins\\CustomFishing\\contents") || file.getPath().startsWith("plugins/CustomFishing/contents")))
new FileSelector(player, file);
}
}

View File

@@ -56,7 +56,7 @@ public class FileSelector {
if (file.isFile() && file.getName().endsWith(".yml")) {
items.addLast(new FileItem(file));
} else if (file.isDirectory()) {
String path = file.getPath();
String path = file.getPath().replace("/", "\\");
String[] split = path.split("\\\\");
String type = split[3];
switch (type) {
@@ -117,7 +117,7 @@ public class FileSelector {
@Override
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
String path = file.getPath();
String path = file.getPath().replace("/", "\\");
String[] split = path.split("\\\\");
String type = split[3];
switch (type) {

View File

@@ -72,6 +72,9 @@ public class FoliaSchedulerImpl implements SyncScheduler {
*/
@Override
public CancellableTask runTaskSyncLater(Runnable runnable, Location location, long delay) {
if (delay == 0) {
return new FoliaSchedulerImpl.FoliaCancellableTask(Bukkit.getRegionScheduler().run(plugin, location, (scheduledTask -> runnable.run())));
}
return new FoliaCancellableTask(Bukkit.getRegionScheduler().runDelayed(plugin, location, (scheduledTask -> runnable.run()), delay));
}