Use proper conventions.
This commit is contained in:
@@ -5,17 +5,17 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.drtshock.playervaults.Main;
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
public class DropOnDeath {
|
||||
|
||||
public static Main plugin;
|
||||
public static PlayerVaults PLUGIN;
|
||||
|
||||
public DropOnDeath(Main instance) {
|
||||
DropOnDeath.plugin = instance;
|
||||
public DropOnDeath(PlayerVaults instance) {
|
||||
DropOnDeath.PLUGIN = instance;
|
||||
}
|
||||
|
||||
static VaultManager vm = new VaultManager(plugin);
|
||||
static VaultManager VAULT_MANAGER = new VaultManager(PLUGIN);
|
||||
|
||||
/**
|
||||
* Drops all items when a player dies.
|
||||
@@ -24,8 +24,8 @@ public class DropOnDeath {
|
||||
public static void drop(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
|
||||
for(int count = 1; count <= Main.inventoriesToDrop; count++) {
|
||||
Inventory inv = vm.getVault(player, count);
|
||||
for(int count = 1; count <= PlayerVaults.INVENTORIES_TO_DROP; count++) {
|
||||
Inventory inv = VAULT_MANAGER.getVault(player, count);
|
||||
ItemStack[] stack = inv.getContents();
|
||||
for(ItemStack is:stack) {
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
|
||||
@@ -11,19 +11,19 @@ import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.drtshock.playervaults.Main;
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
public class EconomyOperations {
|
||||
|
||||
private static File configFile;
|
||||
private static YamlConfiguration bukkitConfig = new YamlConfiguration();
|
||||
private static File CONFIG_FILE;
|
||||
private static YamlConfiguration BUKKIT_CONFIG = new YamlConfiguration();
|
||||
|
||||
public static Main plugin;
|
||||
public static PlayerVaults PLUGIN;
|
||||
|
||||
public EconomyOperations(Main instance) throws FileNotFoundException, IOException, InvalidConfigurationException {
|
||||
plugin = instance;
|
||||
configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
bukkitConfig.load(configFile);
|
||||
public EconomyOperations(PlayerVaults instance) throws FileNotFoundException, IOException, InvalidConfigurationException {
|
||||
PLUGIN = instance;
|
||||
CONFIG_FILE = new File(PLUGIN.getDataFolder(), "config.yml");
|
||||
BUKKIT_CONFIG.load(CONFIG_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,11 +33,11 @@ public class EconomyOperations {
|
||||
* @return transaction success
|
||||
*/
|
||||
public static boolean payToOpen(Player player) {
|
||||
if(!bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault)
|
||||
if(!BUKKIT_CONFIG.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !PlayerVaults.USE_VAULT)
|
||||
return true;
|
||||
|
||||
double cost = bukkitConfig.getDouble("economy.cost-to-open", 10);
|
||||
EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost);
|
||||
double cost = BUKKIT_CONFIG.getDouble("economy.cost-to-open", 10);
|
||||
EconomyResponse resp = PlayerVaults.ECON.withdrawPlayer(player.getName(), cost);
|
||||
if(resp.transactionSuccess()) {
|
||||
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_OPEN.toString().replaceAll("%price", "" + cost));
|
||||
return true;
|
||||
@@ -53,11 +53,11 @@ public class EconomyOperations {
|
||||
* @return transaction success
|
||||
*/
|
||||
public static boolean payToCreate(Player player) {
|
||||
if(!bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault)
|
||||
if(!BUKKIT_CONFIG.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !PlayerVaults.USE_VAULT)
|
||||
return true;
|
||||
|
||||
double cost = bukkitConfig.getDouble("economy.cost-to-create", 100);
|
||||
EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost);
|
||||
double cost = BUKKIT_CONFIG.getDouble("economy.cost-to-create", 100);
|
||||
EconomyResponse resp = PlayerVaults.ECON.withdrawPlayer(player.getName(), cost);
|
||||
if(resp.transactionSuccess()) {
|
||||
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_CREATE.toString().replaceAll("%price", "" + cost));
|
||||
return true;
|
||||
@@ -75,7 +75,7 @@ public class EconomyOperations {
|
||||
public static boolean refundOnDelete(Player player, int number) {
|
||||
String directory = "plugins" + File.separator + "PlayerVaults" + File.separator + "vaults";
|
||||
|
||||
if(!bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault)
|
||||
if(!BUKKIT_CONFIG.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !PlayerVaults.USE_VAULT)
|
||||
return true;
|
||||
String name = player.getName().toLowerCase();
|
||||
File file = new File(directory + File.separator + name.toLowerCase() + ".yml");
|
||||
@@ -90,8 +90,8 @@ public class EconomyOperations {
|
||||
player.sendMessage(Lang.TITLE.toString() + ChatColor.RED + Lang.VAULT_DOES_NOT_EXIST);
|
||||
return false;
|
||||
}
|
||||
double cost = bukkitConfig.getDouble("economy.refund-on-delete");
|
||||
EconomyResponse resp = Main.econ.depositPlayer(player.getName(), cost);
|
||||
double cost = BUKKIT_CONFIG.getDouble("economy.refund-on-delete");
|
||||
EconomyResponse resp = PlayerVaults.ECON.depositPlayer(player.getName(), cost);
|
||||
if(resp.transactionSuccess()) {
|
||||
player.sendMessage(Lang.TITLE.toString() + Lang.REFUND_AMOUNT.toString().replaceAll("%price", String.valueOf(cost)));
|
||||
return true;
|
||||
|
||||
@@ -23,7 +23,7 @@ public enum Lang {
|
||||
|
||||
private String path;
|
||||
private String def; // Default string
|
||||
private static YamlConfiguration lang;
|
||||
private static YamlConfiguration LANG;
|
||||
|
||||
Lang(String path, String start) {
|
||||
this.path = path;
|
||||
@@ -31,14 +31,14 @@ public enum Lang {
|
||||
}
|
||||
|
||||
public static void setFile(YamlConfiguration yc) {
|
||||
lang = yc;
|
||||
LANG = yc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if(this == TITLE)
|
||||
return ChatColor.translateAlternateColorCodes('&', lang.getString(this.path, def)) + " ";
|
||||
return ChatColor.translateAlternateColorCodes('&', lang.getString(this.path, def));
|
||||
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + " ";
|
||||
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def));
|
||||
}
|
||||
|
||||
public String getDefault() {
|
||||
|
||||
@@ -11,9 +11,9 @@ import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.drtshock.playervaults.Main;
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
public class Updater extends Main {
|
||||
public class Updater extends PlayerVaults {
|
||||
|
||||
SortedMap<String, String> lang = new TreeMap<String, String>();
|
||||
String version;
|
||||
|
||||
@@ -13,13 +13,13 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import com.drtshock.playervaults.Main;
|
||||
import com.drtshock.playervaults.PlayerVaults;
|
||||
|
||||
public class VaultManager {
|
||||
|
||||
public Main plugin;
|
||||
public PlayerVaults plugin;
|
||||
|
||||
public VaultManager(Main instance) {
|
||||
public VaultManager(PlayerVaults instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user