Plugin loads fine :)

This commit is contained in:
Trent Hensler
2013-02-07 00:30:45 -06:00
parent 9a79df540e
commit f0a25d3e88
5 changed files with 385 additions and 419 deletions
@@ -4,7 +4,6 @@ import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import me.shock.playervaults.Commands;
import me.shock.playervaults.Main;
import org.bukkit.ChatColor;
@@ -19,14 +18,12 @@ public class VaultManager
{
private Main plugin;
Config config = new Config();
private Commands commands = new Commands();
String title;
public void checkFile(Player player)
{
String name = player.getName().toLowerCase();
File file = new File(plugin.getDataFolder() + File.separator + "vaults" + name + ".yml");
if(!file.exists())
{
@@ -34,7 +31,7 @@ public class VaultManager
}
return;
}
/**
* Method to save player's vault.
* Serialize his inventory.
@@ -44,24 +41,24 @@ public class VaultManager
*/
public void saveVault(Inventory inv, Player player, int number) throws IOException
{
if(commands.inVault.containsKey(player.getName()))
if(plugin.inVault().containsKey(player.getName()))
{
// Get the player's file and serialize the inventory.
String name = player.getName().toLowerCase();
String ser = Serialization.toBase64(inv);
File file = new File(plugin.getDataFolder() + File.separator + "vaults" + name + ".yml");
FileConfiguration playerFile = YamlConfiguration.loadConfiguration(file);
// Prepare to save D:
playerFile.set("vault" + number + "", ser);
if(config.debugMode())
if(plugin.debugMode())
{
plugin.getLogger().log(Level.INFO, "[PlayerVaults] Saved " + " " + number + " for " + player.getName());
}
playerFile.save(file);
}
}
/**
* Method to load player's vault.
* Deserialize his inventory
@@ -81,16 +78,16 @@ public class VaultManager
player.openInventory(inv);
player.sendMessage(title + " Opening " + ChatColor.GREEN + " " + number);
return;
}
else
{
sender.sendMessage(title + " That doesn't exist!");
return;
}
}
public void deleteVault(CommandSender sender, String target, int number) throws IOException
{
String name = target.toLowerCase();
@@ -103,7 +100,7 @@ public class VaultManager
sender.sendMessage(title + "Deleting " + ChatColor.GREEN + " " + number);
playerFile.save(file);
return;
}
else
{