daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.ericlam.config;
  2.  
  3. import com.ericlam.main.ItemAunction;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.configuration.file.FileConfiguration;
  6. import org.bukkit.configuration.file.YamlConfiguration;
  7. import org.bukkit.plugin.Plugin;
  8.  
  9. import java.io.File;
  10.  
  11. public class Config {
  12.     private static Config manager;
  13.     private final FileConfiguration config;
  14.     private final FileConfiguration msg;
  15.     private final FileConfiguration inventory;
  16.  
  17.     public static String selltable;
  18.     public static String pre_remove_table;
  19.  
  20.     public static String air;
  21.     public static String upload_success;
  22.     public static String few_arug;
  23.     public static String long_arug;
  24.     public static String[] help;
  25.     public static String exist;
  26.     public static String upload_fail;
  27.     public static String take_success;
  28.     public static String take_fail;
  29.     public static String no_exist;
  30.     public static String full_inv;
  31.     public static String list;
  32.     public static String list_item;
  33.     public static String[] list_remind;
  34.     public static String no_perm;
  35.     public static String not_number;
  36.     public static String max_number;
  37.     public static String no_money;
  38.     public static String money_not_same;
  39.     public static String no_next;
  40.     public static String no_previous;
  41.     public static String wait;
  42.     public static String list_page;
  43.     public static String no_this_page;
  44.     public static String empty;
  45.     public static String name_long;
  46.     public static String remove_full;
  47.  
  48.     public static boolean enable;
  49.  
  50.     public static int max_money;
  51.     public static String server;
  52.  
  53.     private Config(){
  54.         Plugin plugin = ItemAunction.plugin;
  55.         File configFile = new File(plugin.getDataFolder(), "config.yml");
  56.         if (!configFile.exists()) plugin.saveResource("config.yml", true);
  57.         File msgFile = new File(plugin.getDataFolder(),"lang.yml");
  58.         if (!msgFile.exists()) plugin.saveResource("lang.yml", true);
  59.         File inventoryFile = new File(plugin.getDataFolder(),"inventory.yml");
  60.         if (!inventoryFile.exists()) plugin.saveResource("inventory.yml",true);
  61.  
  62.         config = YamlConfiguration.loadConfiguration(configFile);
  63.         msg = YamlConfiguration.loadConfiguration(msgFile);
  64.         inventory = YamlConfiguration.loadConfiguration(inventoryFile);
  65.  
  66.         selltable = config.getString("MySQL.sell-table");
  67.         pre_remove_table = config.getString("MySQL.pre-remove-table");
  68.  
  69.         String prefix = msg.getString("prefix");
  70.         air = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("air"));
  71.         upload_success = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("upload-success"));
  72.         few_arug = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("few-arug"));
  73.         long_arug = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("long-arug"));
  74.         help = msg.getStringList("help").stream().map(help -> ChatColor.translateAlternateColorCodes('&',prefix+help)).toArray(String[]::new);
  75.         exist = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("exist"));
  76.         upload_fail = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("upload-fail"));
  77.         take_success = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("take-success"));
  78.         take_fail = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("take-fail"));
  79.         no_exist = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("no-exist"));
  80.         full_inv = ChatColor.translateAlternateColorCodes('&', prefix +msg.getString("full-inv"));
  81.         list = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("list"));
  82.         list_item = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("list-item"));
  83.         list_remind = msg.getStringList("list-remind").stream().map(remind -> ChatColor.translateAlternateColorCodes('&',prefix+remind)).toArray(String[]::new);
  84.         no_perm = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("no-perm"));
  85.         not_number = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("not-number"));
  86.         max_number = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("max-number"));
  87.         no_money = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("no-money"));
  88.         money_not_same = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("money-not-same"));
  89.         no_next = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("no-next"));
  90.         no_previous = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("no-previous"));
  91.         wait = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("wait"));
  92.         list_page = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("list-page"));
  93.         no_this_page = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("no-this-page"));
  94.         empty = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("empty"));
  95.         name_long = ChatColor.translateAlternateColorCodes('&',prefix+msg.getString("name-long"));
  96.         remove_full = ChatColor.translateAlternateColorCodes('&', prefix + msg.getString("remove-full"));
  97.  
  98.         enable = config.getBoolean("enabled");
  99.  
  100.         max_money = config.getInt("max-money");
  101.         server = config.getString("server");
  102.     }
  103.  
  104.     public static Config getInstance() {
  105.         if (manager == null) manager = new Config();
  106.         return manager;
  107.     }
  108.  
  109.     public final FileConfiguration getConfig() {
  110.         return config;
  111.     }
  112.  
  113.     public final FileConfiguration getMsg(){
  114.         return msg;
  115.     }
  116.  
  117.     public final FileConfiguration getInventory() {
  118.         return inventory;
  119.     }
  120. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top