Add config updater.

This commit is contained in:
drtshock
2013-03-30 18:42:12 -05:00
parent 3bea5284be
commit 703844073c
44 changed files with 702 additions and 543 deletions
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PlayerVaults</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
+5
View File
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
+4
View File
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
@@ -112,19 +112,56 @@ public class Main extends JavaPlugin {
if (getServer().getPluginManager().getPlugin("Vault") == null) { if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false; return false;
} }
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) { if (rsp == null) {
return false; return false;
} }
econ = rsp.getProvider(); econ = rsp.getProvider();
useVault = true; useVault = true;
return econ != null; return econ != null;
} }
public void updateConfig() {
if(getConfig().get("check-update") == null) {
getConfig().set("check-update", true);
}
if(getConfig().get("economy.enabled") == null) {
getConfig().set("economy.enabled", false);
}
if(getConfig().get("economy.cost-to-create") == null) {
getConfig().set("economy.cost-to-create", 100);
}
if(getConfig().get("economy.cost-to-open") == null) {
getConfig().set("economy.cost-to-create", 10);
}
if(getConfig().get("economy.refund-on-delete") == null) {
getConfig().set("economy.refund-on-delete", 50);
}
if(getConfig().get("drop-on-death.enabled") == null) {
getConfig().set("drop-on-death.enabled", false);
}
if(getConfig().get("drop-on-death.inventories") == null) {
getConfig().set("drop-on-death.inventories", 1);
}
saveConfig();
}
public void loadConfig() { public void loadConfig() {
File config = new File(getDataFolder() + File.separator + "config.yml"); File config = new File(getDataFolder() + File.separator + "config.yml");
if(!config.exists()) { if(!config.exists()) {
saveDefaultConfig(); saveDefaultConfig();
} else {
updateConfig();
} }
} }
@@ -83,6 +83,7 @@ public class BackwardsCompatibility {
return inventory; return inventory;
} }
@SuppressWarnings("unused")
private static CraftItemStack getCraftVersion(org.bukkit.inventory.ItemStack stack) { private static CraftItemStack getCraftVersion(org.bukkit.inventory.ItemStack stack) {
if ((stack instanceof CraftItemStack)) if ((stack instanceof CraftItemStack))
return (CraftItemStack) stack; return (CraftItemStack) stack;
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
# PlayerVaults by drsthock and gomeow!
# http://dev.bukkit.org/server-mods/playervaults
# Made with love :3
# Whether or not you want to check for updates.
# Will not download an update, that is your job :)
check-update: true
# Settings here are for economy integration. playervaults.free bypasses it.
economy:
enabled: false
# Cost to create a vault. You can give players playervaults.free to bypass this.
cost-to-create: 100
cost-to-open: 10
refund-on-delete: 50
# Configuration for dropping inventories on death.
# Bypass with playervaults.ignore.drop
drop-on-death:
enabled: false
# Max amount of inventories you want to be dropped.
# Set to 99 (or highest amount you give people) if you want all inventories to be dropped.
# WARNING: This can cause a lot of items to be dropped on the ground. Use caution :3
inventories: 1
+19
View File
@@ -0,0 +1,19 @@
# Use & for color codes.
# %p is where the player name will get inserted.
# %v is where the vault number will get inserted.
# %price is the price.
# Made with love :)
title-name: "&4[&fPlayerVaults&4]:"
open-vault: "&fOpening vault &a%v"
open-other-vault: "&fOpening vault &a%v &fof &a%p"
delete-vault: "&fDeleted vault &a%v"
delete-other-vault: "&fDeleted vault &a%v &fof &a%p"
player-only: "Sorry but that can only be run by a player!"
must-be-number: "&cYou need to specify a number between 1-99"
invalid-args: "&cInvalid args!"
delete-vault-error: "&cError deleting vault :("
no-permissions: "&cYou don't have permission for that!"
insufficient-funds: "&cYou don't have enough money for that!"
refund-amount: "&fYou were refunded &a%price &ffor deleting that vault."
cost-to-create: "&fYou were charged &c%price &ffor creating that vault."
cost-to-open: "&fYou were charged &c%price &ffor opening that vault."
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
name: PlayerVaults
main: com.drtshock.playervaults.Main
authors: [drtshock, gomeow, Chester]
version: 3.0.0
website: http://dev.bukkit.org/server-mods/PlayerVaults
softdepend: [Vault]
commands:
pv:
description: Open a vault with /vault <number>
aliases: [vault]
pvdel:
description: Delete a vault.
aliases: [vaultdel]