Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions src/main/java/ga/ganma/foofledrive/bukkitRunnable/Runnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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フォルダに不正なファイル名のデータがあります。");
}
}

}
}
}
}
17 changes: 10 additions & 7 deletions src/main/java/ga/ganma/foofledrive/economy/Economy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -174,4 +177,4 @@ public static int getplanmoney(plan plan){

return 0;
}
}
}