Main.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. package de.Linus122.TimeIsMoney;
  2. import com.earth2me.essentials.Essentials;
  3. import de.Linus122.TimeIsMoney.tools.ActionBarUtils;
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.Location;
  6. import org.bukkit.Server;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.ConsoleCommandSender;
  9. import org.bukkit.command.PluginCommand;
  10. import org.bukkit.command.SimpleCommandMap;
  11. import org.bukkit.configuration.file.YamlConfiguration;
  12. import org.bukkit.entity.Player;
  13. import org.bukkit.plugin.Plugin;
  14. import org.bukkit.plugin.PluginManager;
  15. import org.bukkit.plugin.RegisteredServiceProvider;
  16. import org.bukkit.plugin.SimplePluginManager;
  17. import org.bukkit.plugin.java.JavaPlugin;
  18. import org.bukkit.scheduler.BukkitWorker;
  19. import java.io.File;
  20. import java.io.FileInputStream;
  21. import java.io.FileOutputStream;
  22. import java.io.FileReader;
  23. import java.io.IOException;
  24. import java.io.ObjectInputStream;
  25. import java.io.ObjectOutputStream;
  26. import java.io.PrintWriter;
  27. import java.lang.reflect.Field;
  28. import java.sql.Timestamp;
  29. import java.util.ArrayList;
  30. import java.util.Calendar;
  31. import java.util.Date;
  32. import java.util.HashMap;
  33. import java.util.Iterator;
  34. import java.util.List;
  35. import java.util.Map;
  36. import java.util.Random;
  37. import java.util.UUID;
  38. import static de.Linus122.TimeIsMoney.tools.Utils.CC;
  39. /**
  40. * The main class for TimeIsMoney
  41. *
  42. * @author Linus122
  43. * @since 1.9.6.1
  44. */
  45. public class Main extends JavaPlugin {
  46. /**
  47. * The economy being used by vault.
  48. */
  49. static net.milkbowl.vault.economy.Economy economy = null;
  50. /**
  51. * The actionbar utils class, null if not using a supported server version.
  52. */
  53. private static ActionBarUtils actionBarUtils = null;
  54. /**
  55. * The config version number.
  56. */
  57. private static final int CFG_VERSION = 12;
  58. /**
  59. * The TimeIsMoney version.
  60. */
  61. static String PL_VERSION;
  62. /**
  63. * The TimeIsMoney config.
  64. */
  65. static YamlConfiguration finalconfig;
  66. /**
  67. * The list of worlds where the payout feature will be disabled.
  68. */
  69. private static List<String> disabledWorlds;
  70. /**
  71. * The IPs of each UUID.
  72. */
  73. private static final HashMap<String, UUID> boundIPs = new HashMap<>();
  74. /**
  75. * The payouts listed in the config.
  76. */
  77. private final List<Payout> payouts = new ArrayList<>();
  78. /**
  79. * The payouts for the day.
  80. */
  81. private HashMap<String, Double> payedMoney = new HashMap<>();
  82. /**
  83. * The time online in seconds of each player by UUID.
  84. */
  85. private final HashMap<UUID, Integer> onlineSeconds = new HashMap<>();
  86. /**
  87. * The last location of each player by UUID.
  88. */
  89. private final HashMap<UUID, Location> lastLocation = new HashMap<>();
  90. /**
  91. * The chat message.
  92. */
  93. private String message;
  94. /**
  95. * The actionbar message.
  96. */
  97. private String messageActionbar;
  98. /**
  99. * The console logger.
  100. */
  101. private final ConsoleCommandSender clogger = this.getServer().getConsoleSender();
  102. /**
  103. * The current day.
  104. */
  105. private int currentDay = 0;
  106. /**
  107. * If actionbars are supported for the server's version.
  108. */
  109. private boolean useActionbars = true;
  110. /**
  111. * {@inheritDoc}
  112. */
  113. @SuppressWarnings({"deprecation", "unchecked"})
  114. @Override
  115. public void onEnable() {
  116. this.getCommand("timeismoney").setExecutor(new Cmd(this));
  117. PL_VERSION = this.getDescription().getVersion();
  118. currentDay = (new Date()).getDay();
  119. this.reloadConfig();
  120. File config = new File("plugins/TimeIsMoney/config.yml");
  121. if (config.exists()) {
  122. YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
  123. String old_config = "config_old " + cfg.getInt("configuration-version") + ".yml";
  124. if (cfg.contains("configuration-version")) {
  125. if (cfg.getInt("configuration-version") < CFG_VERSION) {
  126. clogger.sendMessage(CC("[TimeIsMoney] &cYOU ARE USING AN OLD CONFIG-VERSION. The plugin CANT work with this."));
  127. clogger.sendMessage(CC("[TimeIsMoney] &cI have created an new config for you. The old one is saved as config_old.yml."));
  128. config.renameTo(new File("plugins/TimeIsMoney/" + old_config));
  129. }
  130. }
  131. this.saveDefaultConfig();
  132. for (String key : cfg.getConfigurationSection("").getKeys(true)) {
  133. if (!this.getConfig().contains(key)) {
  134. this.getConfig().set(key, cfg.get(key));
  135. }
  136. }
  137. } else {
  138. this.saveDefaultConfig();
  139. }
  140. finalconfig = YamlConfiguration.loadConfiguration(config);
  141. disabledWorlds = getConfig().getStringList("disabled_in_worlds");
  142. if (getConfig().getBoolean("enable_atm")) new ATM(this);
  143. final int seconds = getConfig().getInt("give_money_every_second");
  144. Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
  145. try {
  146. for (Player p : Bukkit.getOnlinePlayers()) {
  147. if (disabledWorlds.contains(p.getWorld().getName())) continue;
  148. if (!boundIPs.containsKey(p.getAddress().getHostName())) {
  149. boundIPs.put(p.getAddress().getHostName(), p.getUniqueId());
  150. }
  151. if (onlineSeconds.containsKey(p.getUniqueId())) {
  152. onlineSeconds.put(p.getUniqueId(), onlineSeconds.get(p.getUniqueId()) + 1);
  153. } else {
  154. onlineSeconds.put(p.getUniqueId(), 1);
  155. }
  156. if (onlineSeconds.get(p.getUniqueId()) >= seconds) {
  157. pay(p);
  158. onlineSeconds.remove(p.getUniqueId());
  159. }
  160. }
  161. } catch (NullPointerException ignored) {
  162. }
  163. }, 20L, 20L);
  164. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
  165. if (currentDay != new Date().getDay()) { //Next day, clear payouts!
  166. log("Cleared all payouts");
  167. payedMoney.clear();
  168. currentDay = new Date().getDay();
  169. }
  170. }, 20L * 60, 20L * 60 * 15);
  171. setupEconomy();
  172. message = finalconfig.getString("message");
  173. message = CC(message);
  174. messageActionbar = finalconfig.getString("message_actionbar");
  175. messageActionbar = CC(messageActionbar);
  176. try {
  177. FileInputStream fis = new FileInputStream(new File("plugins/TimeIsMoney/payed_today.data"));
  178. ObjectInputStream ois = new ObjectInputStream(fis);
  179. payedMoney = (HashMap<String, Double>) ((HashMap<String, Double>) ois.readObject()).clone();
  180. ois.close();
  181. } catch (Exception ignored) {
  182. }
  183. loadPayouts();
  184. String packageName = this.getServer().getClass().getPackage().getName();
  185. // Get full package string of CraftServer.
  186. // org.bukkit.craftbukkit.version
  187. String Bukkitversion = packageName.substring(packageName.lastIndexOf('.') + 1);
  188. // Get the last element of the package
  189. try {
  190. final Class<?> clazz = Class.forName("de.Linus122.TimeIsMoney.version." + Bukkitversion + ".NBTUtils");
  191. // Check if we have a NMSHandler class at that location.
  192. if (ActionBarUtils.class.isAssignableFrom(clazz)) { // Make sure it actually implements NMS
  193. actionBarUtils = (ActionBarUtils) clazz.getConstructor().newInstance(); // Set our handler
  194. }
  195. } catch (final Exception e) {
  196. this.getLogger().severe("Actionbars are not supported on your spigot version, sorry.");
  197. useActionbars = false;
  198. return;
  199. }
  200. if (Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
  201. clogger.sendMessage("Time is Money: Essentials found. Hook in it -> Will use Essentials's AFK feature if afk is enabled.");
  202. }
  203. new Metrics(this);
  204. clogger.sendMessage(CC("&aTime is Money &2v" + PL_VERSION + " &astarted."));
  205. }
  206. /**
  207. * {@inheritDoc}
  208. */
  209. @Override
  210. public void onDisable() {
  211. FileOutputStream fos;
  212. try {
  213. fos = new FileOutputStream(new File("plugins/TimeIsMoney/payed_today.data"));
  214. ObjectOutputStream oos = new ObjectOutputStream(fos);
  215. oos.writeObject(payedMoney);
  216. oos.close();
  217. } catch (Exception ignored) {
  218. }
  219. }
  220. /**
  221. * Reloads TimeIsMoney.
  222. */
  223. void reload() {
  224. // cancelling current tasks
  225. for (BukkitWorker bw: Bukkit.getScheduler().getActiveWorkers()) {
  226. if (bw.getOwner() == this) {
  227. Bukkit.getScheduler().cancelTask(bw.getTaskId());
  228. }
  229. }
  230. Bukkit.getPluginManager().disablePlugin(this);
  231. Bukkit.getPluginManager().enablePlugin(this);
  232. }
  233. /**
  234. * Loads the payouts.
  235. */
  236. private void loadPayouts() {
  237. try {
  238. payouts.clear();
  239. for (String key : finalconfig.getConfigurationSection("payouts").getKeys(false)) {
  240. Payout payout = new Payout();
  241. payout.max_payout_per_day = finalconfig.getDouble("payouts." + key + ".max_payout_per_day");
  242. payout.payout_amount = finalconfig.getDouble("payouts." + key + ".payout_amount");
  243. if (finalconfig.getString("payouts." + key + ".permission") != null) {
  244. payout.permission = finalconfig.getString("payouts." + key + ".permission");
  245. }
  246. if (finalconfig.getString("payouts." + key + ".commands") != null) {
  247. payout.commands = finalconfig.getStringList("payouts." + key + ".commands");
  248. }
  249. if (finalconfig.getString("payouts." + key + ".chance") != null) {
  250. payout.chance = finalconfig.getInt("payouts." + key + ".chance");
  251. }
  252. payouts.add(payout);
  253. }
  254. clogger.sendMessage(CC("[TimeIsMoney] &aLoaded " + finalconfig.getConfigurationSection("payouts").getKeys(false).size() + " Payouts!"));
  255. } catch (Exception e) {
  256. clogger.sendMessage(CC("[TimeIsMoney] &aFailed to load Payouts! (May made a mistake in config.yml?)"));
  257. }
  258. }
  259. /**
  260. * Sets up the vault economy.
  261. *
  262. * @return True if the economy was set up, false otherwise.
  263. */
  264. private boolean setupEconomy() {
  265. RegisteredServiceProvider<net.milkbowl.vault.economy.Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
  266. if (economyProvider != null) {
  267. economy = economyProvider.getProvider();
  268. }
  269. return economy != null;
  270. }
  271. /**
  272. * Gets the payout for the specified player.
  273. *
  274. * @param p The player to get the payout of.
  275. * @return The payout of the player.
  276. */
  277. private Payout getPayOutForPlayer(Player p) {
  278. Payout finalpayout = null;
  279. if (!this.getConfig().getBoolean("choose-payout-by-chance")) {
  280. //by Permission
  281. for (Payout payout : payouts) {
  282. if (payout.permission.equalsIgnoreCase("")) finalpayout = payout;
  283. if (p.hasPermission(payout.permission)) {
  284. finalpayout = payout;
  285. }
  286. }
  287. } else {
  288. //by Chance
  289. Random rnd = new Random();
  290. List<Payout> list = new ArrayList<>();
  291. for (Payout payout : payouts) {
  292. for (int i = 0; i < payout.chance; i++) list.add(payout);
  293. }
  294. finalpayout = list.get(rnd.nextInt(list.size() - 1));
  295. }
  296. return finalpayout;
  297. }
  298. /**
  299. * Pays the specified player.
  300. *
  301. * @param p The player to pay.
  302. */
  303. @SuppressWarnings("deprecation")
  304. private void pay(Player p) {
  305. if (p == null) return;
  306. //REACHED MAX PAYOUT CHECK
  307. double payed = 0;
  308. if (payedMoney.containsKey(p.getName())) {
  309. payed = payedMoney.get(p.getName());
  310. }
  311. Payout payout = getPayOutForPlayer(p);
  312. if (payout == null) return;
  313. if (payout.max_payout_per_day != -1) {
  314. if (payed >= payout.max_payout_per_day) { //Reached max payout
  315. if (finalconfig.getBoolean("display-messages-in-chat")) {
  316. sendMessage(p, finalconfig.getString("message_payoutlimit_reached"));
  317. }
  318. if (finalconfig.getBoolean("display-messages-in-actionbar") && useActionbars) {
  319. sendActionbar(p, finalconfig.getString("message_payoutlimit_reached_actionbar"));
  320. }
  321. return;
  322. }
  323. }
  324. if (!finalconfig.getBoolean("allow-multiple-accounts")) {
  325. if (boundIPs.containsKey(p.getAddress().getHostName())) {
  326. if (!boundIPs.get(p.getAddress().getHostName()).equals(p.getUniqueId())) {
  327. sendMessage(p, finalconfig.getString("message_multiple_ips"));
  328. return;
  329. }
  330. }
  331. }
  332. //AFK CHECK
  333. if (!finalconfig.getBoolean("afk_payout") && !p.hasPermission("tim.afkbypass")) {
  334. //ESENTIALS_AFK_FEATURE
  335. if (Bukkit.getServer().getPluginManager().isPluginEnabled("Essentials")) {
  336. Essentials essentials = (com.earth2me.essentials.Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
  337. if (essentials.getUser(p).isAfk()) {
  338. //AFK
  339. if (finalconfig.getBoolean("display-messages-in-chat")) {
  340. sendMessage(p, finalconfig.getString("message_afk"));
  341. }
  342. if (finalconfig.getBoolean("display-messages-in-actionbar") && useActionbars) {
  343. sendActionbar(p, finalconfig.getString("message_afk_actionbar"));
  344. }
  345. return;
  346. }
  347. } else {
  348. //PLUGIN_AFK_FEATURE
  349. if (lastLocation.containsKey(p.getUniqueId())) { //AntiAFK
  350. if (lastLocation.get(p.getUniqueId()).getX() == p.getLocation().getX() && lastLocation.get(p.getUniqueId()).getY() == p.getLocation().getY() && lastLocation.get(p.getUniqueId()).getZ() == p.getLocation().getZ() || lastLocation.get(p.getUniqueId()).getYaw() == p.getLocation().getYaw()) {
  351. //AFK
  352. if (finalconfig.getBoolean("display-messages-in-chat")) {
  353. sendMessage(p, finalconfig.getString("message_afk"));
  354. }
  355. if (finalconfig.getBoolean("display-messages-in-actionbar") && useActionbars) {
  356. sendActionbar(p, finalconfig.getString("message_afk_actionbar"));
  357. }
  358. return;
  359. }
  360. }
  361. }
  362. }
  363. //DEPOSIT
  364. if (finalconfig.getBoolean("store-money-in-bank")) {
  365. ATM.depositBank(p, payout.payout_amount);
  366. } else {
  367. double before = 0;
  368. if (economy.hasAccount(p)) {
  369. before = economy.getBalance(p);
  370. }
  371. economy.depositPlayer(p, payout.payout_amount);
  372. log(p.getName() + ": Deposited: " + payout.payout_amount + " Balance-before: " + before + " Balance-now: " + economy.getBalance(p));
  373. }
  374. if (finalconfig.getBoolean("display-messages-in-chat")) {
  375. sendMessage(p, message.replace("%money%", economy.format(payout.payout_amount)));
  376. }
  377. if (finalconfig.getBoolean("display-messages-in-actionbar") && useActionbars) {
  378. sendActionbar(p, messageActionbar.replace("%money%", economy.format(payout.payout_amount)));
  379. }
  380. for (String cmd : payout.commands) {
  381. dispatchCommandSync(cmd.replace("/", "").replaceAll("%player%", p.getName()));
  382. }
  383. //ADD PAYED MONEY
  384. if (payedMoney.containsKey(p.getName())) {
  385. payedMoney.put(p.getName(), payedMoney.get(p.getName()) + payout.payout_amount);
  386. } else {
  387. payedMoney.put(p.getName(), payout.payout_amount);
  388. }
  389. lastLocation.put(p.getUniqueId(), p.getLocation());
  390. }
  391. /**
  392. * Dispatches a command as sync.
  393. *
  394. * @param cmd The command to dispatch sync.
  395. */
  396. private void dispatchCommandSync(final String cmd) {
  397. final Server server = this.getServer();
  398. this.getServer().getScheduler().runTask(this, () -> server.dispatchCommand(server.getConsoleSender(), cmd));
  399. }
  400. /**
  401. * Logs debug information if enabled in the config.
  402. *
  403. * @param msg The debug message to log.
  404. */
  405. @SuppressWarnings("deprecation")
  406. private void log(String msg) {
  407. if (!this.getConfig().getBoolean("debug-log")) {
  408. return;
  409. }
  410. Timestamp currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());
  411. File file = new File("plugins/TimeIsMoney/log.txt");
  412. try {
  413. if (!file.exists()) {
  414. file.createNewFile();
  415. }
  416. FileReader pr = new FileReader(file);
  417. int number;
  418. StringBuffer text = new StringBuffer();
  419. while ((number = pr.read()) != -1) {
  420. text.append((char) number);
  421. }
  422. text.append(currentTimestamp.toGMTString()).append(":").append(msg).append("\n");
  423. PrintWriter pw = new PrintWriter(file);
  424. pw.print(text);
  425. pw.close();
  426. } catch (IOException e) {
  427. e.printStackTrace();
  428. }
  429. }
  430. /**
  431. * Sends a chat message that supports color codes to the specified player.
  432. *
  433. * @param p The player to send the chat message to.
  434. * @param msg The message the chat should give the player.
  435. */
  436. private void sendMessage(Player p, String msg) {
  437. if (msg == null) return;
  438. if (msg.length() == 0) return;
  439. p.sendMessage(CC(msg));
  440. }
  441. /**
  442. * Sends an actionbar message to the specified player.
  443. *
  444. * @param p The player to send the actionbar message to.
  445. * @param msg The message the actionbar should give to the player.
  446. */
  447. private void sendActionbar(final Player p, final String msg) {
  448. if (msg.length() == 0) return;
  449. int times = finalconfig.getInt("display-messages-in-actionbar-time");
  450. if (times == 1) {
  451. if (actionBarUtils != null) {
  452. actionBarUtils.sendActionBarMessage(p, msg);
  453. }
  454. } else if (times > 1) {
  455. if (actionBarUtils != null) {
  456. actionBarUtils.sendActionBarMessage(p, msg);
  457. }
  458. times--;
  459. for (int i = 0; i < times; i++) {
  460. Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> actionBarUtils.sendActionBarMessage(p, CC(msg)), 20L * i);
  461. }
  462. }
  463. }
  464. /**
  465. * Unloads the specified plugin.
  466. *
  467. * @param pluginName The name of the plugin to unload.
  468. * @return True if the specified plugin was unloaded, false otherwise.
  469. */
  470. private boolean unloadPlugin(String pluginName)
  471. throws Exception {
  472. PluginManager manager = getServer().getPluginManager();
  473. SimplePluginManager spmanager = (SimplePluginManager) manager;
  474. if (spmanager != null) {
  475. Field pluginsField = spmanager.getClass().getDeclaredField("plugins");
  476. pluginsField.setAccessible(true);
  477. List<Plugin> plugins = (List) pluginsField.get(spmanager);
  478. Field lookupNamesField = spmanager.getClass().getDeclaredField("lookupNames");
  479. lookupNamesField.setAccessible(true);
  480. Map<String, Plugin> lookupNames = (Map) lookupNamesField.get(spmanager);
  481. Field commandMapField = spmanager.getClass().getDeclaredField("commandMap");
  482. commandMapField.setAccessible(true);
  483. SimpleCommandMap commandMap = (SimpleCommandMap) commandMapField.get(spmanager);
  484. Field knownCommandsField;
  485. Map<String, Command> knownCommands = null;
  486. if (commandMap != null) {
  487. knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
  488. knownCommandsField.setAccessible(true);
  489. knownCommands = (Map) knownCommandsField.get(commandMap);
  490. }
  491. Plugin plugin;
  492. Iterator<Map.Entry<String, Command>> it;
  493. for (Plugin plugin1 : manager.getPlugins()) {
  494. if (plugin1.getDescription().getName().equalsIgnoreCase(pluginName)) {
  495. manager.disablePlugin(plugin1);
  496. if ((plugins != null) && (plugins.contains(plugin1))) {
  497. plugins.remove(plugin1);
  498. }
  499. if ((lookupNames != null) && (lookupNames.containsKey(pluginName))) {
  500. lookupNames.remove(pluginName);
  501. }
  502. if (commandMap != null) {
  503. for (it = knownCommands.entrySet().iterator(); it.hasNext(); ) {
  504. Map.Entry<String, Command> entry = it.next();
  505. if ((entry.getValue() instanceof PluginCommand)) {
  506. PluginCommand command = (PluginCommand) entry.getValue();
  507. if (command.getPlugin() == plugin1) {
  508. command.unregister(commandMap);
  509. it.remove();
  510. }
  511. }
  512. }
  513. }
  514. }
  515. }
  516. } else {
  517. return true;
  518. }
  519. return true;
  520. }
  521. /**
  522. * Loads the specified plugin.
  523. *
  524. * @param pluginName The name of the plugin to load.
  525. * @return True if the specified plugin was loaded, false otherwise.
  526. */
  527. private boolean loadPlugin(String pluginName) {
  528. try {
  529. PluginManager manager = getServer().getPluginManager();
  530. Plugin plugin = manager.loadPlugin(new File("plugins", pluginName + ".jar"));
  531. if (plugin == null) {
  532. return false;
  533. }
  534. plugin.onLoad();
  535. manager.enablePlugin(plugin);
  536. } catch (Exception e) {
  537. return false;
  538. }
  539. return true;
  540. }
  541. /**
  542. * Reloads the specified plugin.
  543. *
  544. * @param pluginName The name of the plugin to reload.
  545. * @return True if the plugin was reloaded, false otherwise.
  546. * @throws Exception If an error occurred while loading or unloading the specified plugin.
  547. */
  548. private boolean reloadPlugin(String pluginName)
  549. throws Exception {
  550. boolean unload = unloadPlugin(pluginName);
  551. boolean load = loadPlugin(pluginName);
  552. return unload && load;
  553. }
  554. }