From e68092cae4c67400fbfdfadaacc3c046a1cc00bf Mon Sep 17 00:00:00 2001 From: TheYeti Date: Mon, 30 Jan 2012 10:49:15 -0800 Subject: [PATCH 1/3] Hard Reset to origin/master due to merge issues --- .../Leaderboards/ACROBATICS.mcmmo | 0 .../FlatFileStuff/Leaderboards/ALCHEMY.mcmmo | 0 .../FlatFileStuff/Leaderboards/ALL.mcmmo | 0 .../FlatFileStuff/Leaderboards/ARCHERY.mcmmo | 0 .../FlatFileStuff/Leaderboards/AXES.mcmmo | 0 .../Leaderboards/ENCHANTING.mcmmo | 0 .../Leaderboards/EXCAVATION.mcmmo | 0 .../FlatFileStuff/Leaderboards/FISHING.mcmmo | 0 .../Leaderboards/HERBALISM.mcmmo | 0 .../FlatFileStuff/Leaderboards/MINING.mcmmo | 0 .../FlatFileStuff/Leaderboards/REPAIR.mcmmo | 0 .../FlatFileStuff/Leaderboards/SWORDS.mcmmo | 0 .../FlatFileStuff/Leaderboards/TAMING.mcmmo | 0 .../FlatFileStuff/Leaderboards/UNARMED.mcmmo | 0 .../Leaderboards/WOODCUTTING.mcmmo | 0 .../resources/mcMMO/FlatFileStuff/mcmmo.users | 0 src/main/resources/mcMMO/VERSION | 1 + src/main/resources/mcMMO/config.yml | 305 ++++++++++++++++++ 18 files changed, 306 insertions(+) create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ACROBATICS.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALCHEMY.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALL.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ARCHERY.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/AXES.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ENCHANTING.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/EXCAVATION.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/FISHING.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/HERBALISM.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/MINING.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/REPAIR.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/SWORDS.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/TAMING.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/UNARMED.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/Leaderboards/WOODCUTTING.mcmmo create mode 100644 src/main/resources/mcMMO/FlatFileStuff/mcmmo.users create mode 100644 src/main/resources/mcMMO/VERSION create mode 100644 src/main/resources/mcMMO/config.yml diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ACROBATICS.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ACROBATICS.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALCHEMY.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALCHEMY.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALL.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ALL.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ARCHERY.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ARCHERY.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/AXES.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/AXES.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ENCHANTING.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/ENCHANTING.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/EXCAVATION.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/EXCAVATION.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/FISHING.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/FISHING.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/HERBALISM.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/HERBALISM.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/MINING.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/MINING.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/REPAIR.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/REPAIR.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/SWORDS.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/SWORDS.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/TAMING.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/TAMING.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/UNARMED.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/UNARMED.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/WOODCUTTING.mcmmo b/src/main/resources/mcMMO/FlatFileStuff/Leaderboards/WOODCUTTING.mcmmo new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/FlatFileStuff/mcmmo.users b/src/main/resources/mcMMO/FlatFileStuff/mcmmo.users new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/resources/mcMMO/VERSION b/src/main/resources/mcMMO/VERSION new file mode 100644 index 000000000..d5a541918 --- /dev/null +++ b/src/main/resources/mcMMO/VERSION @@ -0,0 +1 @@ +1.2.08 \ No newline at end of file diff --git a/src/main/resources/mcMMO/config.yml b/src/main/resources/mcMMO/config.yml new file mode 100644 index 000000000..d07f9e113 --- /dev/null +++ b/src/main/resources/mcMMO/config.yml @@ -0,0 +1,305 @@ +Items: + Chimaera_Wing: + Enabled: true + Feather_Cost: 10 + Item_ID: 288 +Spout: + Menu: + Key: KEY_M + XP: + Bar: + Enabled: true + X_POS: 95 + Y_POS: 6 + Icon: + Enabled: true + X_POS: 78 + Y_POS: 2 + Party: + HUD: + Show_Faces: true + Enabled: true + Show_Display_Name: false + Images: + URL_DIR: http://mcmmo.rycochet.net/mcmmo/ + HUD: + Default: STANDARD + Retro: + Colors: + Swords: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Taming: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Acrobatics: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Border: + BLUE: 0.0 + GREEN: 0.0 + RED: 0.0 + Background: + BLUE: 0.75 + GREEN: 0.75 + RED: 0.75 + Woodcutting: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Archery: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Axes: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Repair: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Fishing: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Excavation: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Herbalism: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Unarmed: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Mining: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 +Skills: + Taming: + Call_Of_The_Wild: + Bones_Required: 10 + Excavation: + Requires_Shovel: true + Woodcutting: + Requires_Axe: true + Herbalism: + Green_Thumb: + Cobble_To_Mossy: true + Mining: + Requires_Pickaxe: true + Repair: + Leather: + ID: 334 + String: + Name: Leather + ID: 287 + Stone: + Name: Cobblestone + ID: 4 + Wood: + Name: Wood Planks + ID: 5 + Gold: + Name: Gold Bars + ID: 266 + Anvil_Messages: true + Diamond: + Name: Diamond + Level_Required: 50 + ID: 264 + Iron: + Name: Iron Bars + ID: 265 +Experience: + Fishing: + Base: 800 + Formula: + Multiplier: + Swords: 1.0 + Taming: 1.0 + Acrobatics: 1.0 + Sorcery: 1.0 + Excavation: 1.0 + Herbalism: 1.0 + Unarmed: 1.0 + Woodcutting: 1.0 + Mining: 1.0 + Archery: 1.0 + Axes: 1.0 + Repair: 1.0 + Gains: + Mobspawners: + Enabled: false + Multiplier: + PVP: 1 + Global: 1.0 + PVP: + Rewards: true + Excavation: + Base: 40 + Cake: 3000 + Sulphur: 30 + Bones: 30 + Map: 200 + Slimeballs: 100 + Bucket: 100 + Apple: 100 + Mushroom: 80 + Eggs: 100 + Slowsand: 80 + Watch: 200 + Web: 150 + String: 200 + Glowstone: 80 + Music: 3000 + Diamond: 1000 + Cocoa_Beans: 100 + Woodcutting: + Birch: 70 + Spruce: 80 + Pine: 90 + Herbalism: + Sugar_Cane: 30 + Cactus: 30 + Flowers: 100 + Pumpkin: 550 + Mushrooms: 150 + Wheat: 50 + Melon: 40 + Mining: + Sandstone: 30 + Glowstone: 30 + Obsidian: 150 + Stone: 30 + Netherrack: 30 + Gold: 350 + Redstone: 150 + Coal: 100 + Diamond: 750 + lapis: 400 + Iron: 250 +MySQL: + Enabled: false + Database: + User: + Name: UserName + Password: UserPassword + Name: DataBaseName + TablePrefix: mcmmo_ + Server: + Port: 3306 + Address: localhost +XP: + Gains: + Mobspawners: + Enabled: false + PVP: + Rewards: true +General: + HP_Regeneration: + Enabled: true + Locale: en_us + MySpawn: + Enabled: true + MOTD: + Enabled: true +Excavation: + Drops: + Cake: true + Sulphur: true + Bones: true + Apples: true + Map: true + Slimeballs: true + Bucket: true + Netherrack: true + Mushrooms: true + Eggs: true + Slowsand: true + Watch: true + Web: true + String: true + Glowstone: true + Music: true + Diamond: true + Cocoa_Beans: true +Abilities: + Activation: + Only_Activate_When_Sneaking: false + Enabled: true + Messages: true + Cooldowns: + Giga_Drill_Breaker: 240 + Berserk: 240 + Green_Terra: 240 + Skull_Splitter: 240 + Serrated_Strikes: 240 + Tree_Feller: 240 + Super_Breaker: 240 + Tools: + Durability_Loss: 2 + Durability_Loss_Enabled: true +Commands: + invite: + Name: invite + Enabled: true + mctop: + Name: mctop + Enabled: true + xplock: + Name: xplock + Enabled: true + whois: + Name: whois + Enabled: true + mcc: + Name: mcc + Enabled: true + mmoedit: + Name: mmoedit + Enabled: true + accept: + Name: accept + Enabled: true + stats: + Name: stats + Enabled: true + mcability: + Name: mcability + Enabled: true + party: + Name: party + Enabled: true + xprate: + Name: xprate + Enabled: true + mcgod: + Name: mcgod + Enabled: true + mcmmo: + Name: mcmmo + Enabled: true + Donate_Message: true + mcrefresh: + Name: mcrefresh + Enabled: true + myspawn: + Name: myspawn + Enabled: true + addxp: + Name: addxp + Enabled: true + clearmyspawn: + Name: clearmyspawn + Enabled: true + ptp: + Name: ptp + Enabled: true From 401af172ae902244eedeab4f932b49b9baaba428 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Mon, 30 Jan 2012 12:20:43 -0800 Subject: [PATCH 2/3] Update LoadProperties to use new FileConfiguration --- Changelog.txt | 3 +- .../gmail/nossr50/config/LoadProperties.java | 57 ++++++++++++------- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 3d5163762..146f8fafa 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -7,7 +7,8 @@ Version 1.2.09-dev - Changed timer to be a bit more efficient (Issue #19) - Changed to fire EntityDamageEvents for all damage done by mcMMO - New custom event for developers McMMOPlayerLevelUpEvent - - New custmo event for developers McMMOItemSpawnEvent + - New custom event for developers McMMOItemSpawnEvent + - Fishing Configuration inclusion (Pull Request #60) Version 1.2.08 - Changed Bukkit events to new event system diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 3f3194928..20a170bb2 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -16,8 +16,11 @@ */ package com.gmail.nossr50.config; +import com.gmail.nossr50.mcMMO; import java.io.File; -import org.bukkit.util.config.Configuration; +import java.io.IOException; + +import org.bukkit.configuration.file.FileConfiguration; import com.gmail.nossr50.datatypes.HUDType; @@ -53,21 +56,27 @@ public class LoadProperties archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static HUDType defaulthud; + protected static File configFile; + protected static File dataFolder; + protected final mcMMO plugin; + protected static FileConfiguration config; - public String directory = "plugins/mcMMO/"; - - File file = new File(directory + File.separator + "config.yml"); - static Configuration config = null; + public LoadProperties(mcMMO plugin) + { + this.plugin = plugin; + dataFolder = plugin.getDataFolder(); + configFile = new File(dataFolder, "config.yml"); + } public void configCheck() { - new File(directory).mkdir(); - config = load(); - if(!file.exists()) + load(); + if(!configFile.exists()) { try { - file.createNewFile(); + configFile.getParentFile().mkdir(); + configFile.createNewFile(); addDefaults(); } catch (Exception ex) @@ -83,27 +92,26 @@ public class LoadProperties private void write(String root, Object x) { //Configuration config = load(); - config.setProperty(root, x); - config.save(); + config.set(root, x); } private Boolean readBoolean(String root, Boolean def) { //Configuration config = load(); Boolean result = config.getBoolean(root, def); - config.save(); + saveConfig(); return result; } private Double readDouble(String root, Double def) { Double result = config.getDouble(root, def); - config.save(); + saveConfig(); return result; } private Integer readInteger(String root, Integer def) { //Configuration config = load(); Integer result = config.getInt(root, def); - config.save(); + saveConfig(); return result; } @@ -111,22 +119,31 @@ public class LoadProperties { //Configuration config = load(); String result = config.getString(root, def); - config.save(); + saveConfig(); return result; } - private Configuration load() + private FileConfiguration load() { try { - Configuration configx = new Configuration(file); - configx.load(); - return configx; + config.load(configFile); + return config; } catch (Exception e) { e.printStackTrace(); } return null; } + + private static void saveConfig() + { + try { + config.save(configFile); + } catch (IOException e) { + e.printStackTrace(); + } + } + private void addDefaults() { System.out.println("Generating Config File..."); @@ -389,6 +406,7 @@ public class LoadProperties write("Fishing.Drops.Glowstone_Dust", true); write("Fishing.Drops.Diamonds", true); + saveConfig(); loadkeys(); } private void loadkeys() @@ -396,6 +414,7 @@ public class LoadProperties System.out.println("Loading Config File..."); //Setup default HUD + load(); String temp = readString("Spout.HUD.Default", "STANDARD"); for(HUDType x : HUDType.values()) { diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 75c799fd7..b80b9fbce 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -97,7 +97,7 @@ public class mcMMO extends JavaPlugin public Misc misc = new Misc(this); //Config file stuff - LoadProperties config = new LoadProperties(); + LoadProperties config = new LoadProperties(this); //Jar stuff public static File mcmmo; From 96a395af233b8e14ce274255b484220ecfb6f243 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Mon, 30 Jan 2012 12:39:32 -0800 Subject: [PATCH 3/3] Updating changelog --- Changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.txt b/Changelog.txt index 90f67ce4d..3d2319c5a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ Version 1.2.09-dev - Changed to fire EntityDamageEvents for all damage done by mcMMO - New custom event for developers McMMOPlayerLevelUpEvent - New custom event for developers McMMOItemSpawnEvent + - Changed LoadProperties from the old Configuration to FileConfiguration Version 1.2.08 - Changed Bukkit events to new event system