|
40 | 40 | import java.io.File;
|
41 | 41 | import java.util.*;
|
42 | 42 |
|
43 |
| -import static me.sat7.dynamicshop.utilities.LangUtil.t; |
44 |
| - |
45 | 43 | public final class DynamicShop extends JavaPlugin implements Listener
|
46 | 44 | {
|
47 | 45 | private static Economy econ = null; // 볼트에 물려있는 이코노미
|
@@ -84,6 +82,7 @@ public static String dsPrefix(Player player)
|
84 | 82 | private BukkitTask periodicRepetitiveTask;
|
85 | 83 | private BukkitTask saveLogsTask;
|
86 | 84 | private BukkitTask cullLogsTask;
|
| 85 | + private BukkitTask backupTask; |
87 | 86 | private BukkitTask shopSaveTask;
|
88 | 87 | private BukkitTask userDataRepetitiveTask;
|
89 | 88 |
|
@@ -149,11 +148,11 @@ public static void DebugLog()
|
149 | 148 |
|
150 | 149 | UIManager.DebugLog();
|
151 | 150 |
|
152 |
| - //console.sendMessage("---------------------"); |
| 151 | + console.sendMessage("---------------------"); |
153 | 152 |
|
154 |
| - //console.sendMessage("RotationTaskMap: size" + RotationUtil.RotationTaskMap.size()); |
155 |
| - //for(Map.Entry<String, Integer> entry : RotationUtil.RotationTaskMap.entrySet()) |
156 |
| - // console.sendMessage(entry.getKey() + ": " + entry.getValue()); |
| 153 | + console.sendMessage("RotationTaskMap: size: " + RotationUtil.RotationTaskMap.size()); |
| 154 | + for(Map.Entry<String, Integer> entry : RotationUtil.RotationTaskMap.entrySet()) |
| 155 | + console.sendMessage(entry.getKey() + ": " + entry.getValue()); |
157 | 156 |
|
158 | 157 | console.sendMessage("---------------------");
|
159 | 158 |
|
@@ -195,11 +194,14 @@ private void Init()
|
195 | 194 | PeriodicRepetitiveTask();
|
196 | 195 | startSaveLogsTask();
|
197 | 196 | startCullLogsTask();
|
| 197 | + StartBackupTask(); |
198 | 198 | StartShopSaveTask();
|
199 | 199 | StartUserDataTask();
|
200 | 200 | hookIntoJobs();
|
201 | 201 | hookIntoPlayerPoints();
|
202 | 202 | InitPapi();
|
| 203 | + |
| 204 | + RotationUtil.RestartAllRotationTask(); |
203 | 205 |
|
204 | 206 | // 완료
|
205 | 207 | console.sendMessage(Constants.DYNAMIC_SHOP_PREFIX + " Enabled! :)");
|
@@ -400,6 +402,19 @@ private void RepeatAction()
|
400 | 402 | UIManager.RefreshUI();
|
401 | 403 | }
|
402 | 404 |
|
| 405 | + public void StartBackupTask() |
| 406 | + { |
| 407 | + if (!ConfigUtil.GetShopYmlBackup_Enable()) |
| 408 | + return; |
| 409 | + |
| 410 | + if (backupTask != null) |
| 411 | + { |
| 412 | + backupTask.cancel(); |
| 413 | + } |
| 414 | + long interval = (20L * 60L * (long) ConfigUtil.GetShopYmlBackup_IntervalMinutes()); |
| 415 | + backupTask = Bukkit.getScheduler().runTaskTimer(DynamicShop.plugin, ShopUtil::ShopYMLBackup, interval, interval); |
| 416 | + } |
| 417 | + |
403 | 418 | public void StartShopSaveTask()
|
404 | 419 | {
|
405 | 420 | if (shopSaveTask != null)
|
@@ -471,6 +486,9 @@ private void makeFolders()
|
471 | 486 | File shopFolder = new File(getDataFolder(), "Shop");
|
472 | 487 | shopFolder.mkdir(); // new 하고 같은줄에서 바로 하면 폴더 안만들어짐.
|
473 | 488 |
|
| 489 | + File rotationFolder = new File(getDataFolder(), "Rotation"); |
| 490 | + rotationFolder.mkdir(); |
| 491 | + |
474 | 492 | File LogFolder = new File(getDataFolder(), "Log");
|
475 | 493 | LogFolder.mkdir();
|
476 | 494 | }
|
@@ -519,13 +537,4 @@ public void onDisable()
|
519 | 537 | Bukkit.getScheduler().cancelTasks(this);
|
520 | 538 | console.sendMessage(Constants.DYNAMIC_SHOP_PREFIX + " Disabled");
|
521 | 539 | }
|
522 |
| - |
523 |
| - public static void PaidOnlyMsg(Player p) |
524 |
| - { |
525 |
| - TextComponent text = new TextComponent(""); |
526 |
| - text.addExtra(DynamicShop.dsPrefix(p) + t(p, "PAID_VERSION.DESC")); |
527 |
| - text.addExtra(DynamicShop.CreateLink(t(p, "PAID_VERSION.GET_PREMIUM"), false, ChatColor.WHITE, "https://spigotmc.org/resources/100058")); |
528 |
| - |
529 |
| - p.spigot().sendMessage(text); |
530 |
| - } |
531 | 540 | }
|
0 commit comments