From 3890201b7b3d9bbc47f3824b7cb821cee7487ddb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 06:58:41 +0000 Subject: [PATCH 1/2] Initial plan From 9998ee6af56069de1ed8b790e93135ca5da5e770 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 07:03:05 +0000 Subject: [PATCH 2/2] fix: harden periodic FP withdrawal task against runtime failures Co-authored-by: Alpha9n <42644369+Alpha9n@users.noreply.github.com> --- .../foofledrive/bukkitRunnable/Runnable.java | 45 +++++++++++-------- .../ga/ganma/foofledrive/economy/Economy.java | 17 ++++--- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/main/java/ga/ganma/foofledrive/bukkitRunnable/Runnable.java b/src/main/java/ga/ganma/foofledrive/bukkitRunnable/Runnable.java index 67254df..2e38f3c 100644 --- a/src/main/java/ga/ganma/foofledrive/bukkitRunnable/Runnable.java +++ b/src/main/java/ga/ganma/foofledrive/bukkitRunnable/Runnable.java @@ -16,22 +16,31 @@ public Runnable(Plugin pl) { plugin = pl; } - @Override - public void run() { - String FS = File.separator; - File folder = new File(plugin.getDataFolder() + FS + "playerdata"); - if (folder.exists()) { - File[] list = folder.listFiles(); - if (list != null) { - for (File f : list) { - String name = f.getName(); - name = name.substring(0, name.lastIndexOf('.')); - UUID id = UUID.fromString(name); - OfflinePlayer pl = Bukkit.getOfflinePlayer(id); - Economy.paymoney(pl); - } - - } - } - } + @Override + public void run() { + String FS = File.separator; + File folder = new File(plugin.getDataFolder() + FS + "playerdata"); + if (folder.exists()) { + File[] list = folder.listFiles(); + if (list != null) { + for (File f : list) { + try { + String name = f.getName(); + int ext = name.lastIndexOf('.'); + if (ext <= 0) { + continue; + } + name = name.substring(0, ext); + UUID id = UUID.fromString(name); + OfflinePlayer pl = Bukkit.getOfflinePlayer(id); + Economy.paymoney(pl); + } + catch (IllegalArgumentException e) { + plugin.getLogger().warning("playerdataフォルダに不正なファイル名のデータがあります。"); + } + } + + } + } + } } diff --git a/src/main/java/ga/ganma/foofledrive/economy/Economy.java b/src/main/java/ga/ganma/foofledrive/economy/Economy.java index ac15e4a..67380f0 100644 --- a/src/main/java/ga/ganma/foofledrive/economy/Economy.java +++ b/src/main/java/ga/ganma/foofledrive/economy/Economy.java @@ -83,12 +83,15 @@ public static void paymoney(Player p) { } } - public static void paymoney(OfflinePlayer p) { - Playerdata pd = Filerelation.readFile(p); - if (p != null){ - double bal = Foofledrive.econ.getBalance(p); - if (pd.getFinish() != null) { - if (pd.getFinish().before(Calendar.getInstance())) { + public static void paymoney(OfflinePlayer p) { + if (p == null || Foofledrive.econ == null) { + return; + } + Playerdata pd = Filerelation.readFile(p); + if (pd != null){ + double bal = Foofledrive.econ.getBalance(p); + if (pd.getFinish() != null) { + if (pd.getFinish().before(Calendar.getInstance())) { int[] amout = Foofledrive.configamout; switch (pd.getPlan()) { case LIGHT: @@ -174,4 +177,4 @@ public static int getplanmoney(plan plan){ return 0; } -} \ No newline at end of file +}