diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 2dd99e02e..9c2f7444f 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,6 +1,8 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code Version 1.0.35 +Added a Toggle for Chimaera Wing in config.yml +Added customization of what item is used for Chimaera Wing in config.yml Fixed bug with randomly receiving Taming XP mcmmo.users file moved into /plugins/mcMMO/FlatFileStuff/ Leaderboard files now moved into /plugins/mcMMO/FlatFileStuff/Leaderboards diff --git a/mcMMO/com/gmail/nossr50/Item.java b/mcMMO/com/gmail/nossr50/Item.java index 316a64cf9..185a06f31 100644 --- a/mcMMO/com/gmail/nossr50/Item.java +++ b/mcMMO/com/gmail/nossr50/Item.java @@ -15,9 +15,11 @@ import com.gmail.nossr50.datatypes.PlayerProfile; public class Item { - public static void itehecks(Player player, Plugin plugin){ + public static void itemhecks(Player player, Plugin plugin) + { ItemStack inhand = player.getItemInHand(); - if(inhand.getTypeId() == 288){ + if(LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId) + { chimaerawing(player, plugin); } } @@ -28,7 +30,7 @@ public class Item { PlayerProfile PP = Users.getProfile(player); ItemStack is = player.getItemInHand(); Block block = player.getLocation().getBlock(); - if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288) + if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == LoadProperties.chimaeraId) { if(Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing) { @@ -36,7 +38,7 @@ public class Item { int y = derp.getY(); ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x != null && x.getTypeId() == 288){ + if(x != null && x.getTypeId() == LoadProperties.chimaeraId){ if(x.getAmount() >= LoadProperties.feathersConsumedByChimaeraWing + 1) { x.setAmount(x.getAmount() - LoadProperties.feathersConsumedByChimaeraWing); @@ -81,7 +83,7 @@ public class Item { } else if (!Skills.cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) { player.sendMessage(mcLocale.getString("Item.InjuredWait", new Object[] {Skills.calculateTimeLeft(player, PP.getRecentlyHurt(), 60)})); //$NON-NLS-1$ - } else if (is.getTypeId() == 288 && is.getAmount() <= 9){ + } else if (is.getTypeId() == LoadProperties.chimaeraId && is.getAmount() <= 9){ player.sendMessage(mcLocale.getString("Item.NeedFeathers")); //$NON-NLS-1$ } } diff --git a/mcMMO/com/gmail/nossr50/Leaderboard.java b/mcMMO/com/gmail/nossr50/Leaderboard.java index 136d97bd3..21361f2ac 100644 --- a/mcMMO/com/gmail/nossr50/Leaderboard.java +++ b/mcMMO/com/gmail/nossr50/Leaderboard.java @@ -12,14 +12,16 @@ import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerStat; import com.gmail.nossr50.datatypes.Tree; -public class Leaderboard { - static String location = "plugins/mcMMO/mcmmo.users"; //$NON-NLS-1$ +public class Leaderboard +{ + static String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; //$NON-NLS-1$ protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$ /* * Read from the file */ - public static void makeLeaderboards(){ + public static void makeLeaderboards() + { //Make Trees Tree Mining = new Tree(); Tree WoodCutting = new Tree(); @@ -42,7 +44,6 @@ public class Leaderboard { String line = ""; //$NON-NLS-1$ while((line = in.readLine()) != null) { - String[] character = line.split(":"); //$NON-NLS-1$ String p = character[0]; @@ -121,7 +122,8 @@ public class Leaderboard { String theLocation = "plugins/mcMMO/FlatFileStuff/Leaderboards/" + statName + ".mcmmo"; //$NON-NLS-1$ //$NON-NLS-2$ //CHECK IF THE FILE EXISTS File theDir = new File(theLocation); - if(!theDir.exists()){ + if(!theDir.exists()) + { //properties = new PropertiesFile(location); FileWriter writer = null; try { diff --git a/mcMMO/com/gmail/nossr50/Users.java b/mcMMO/com/gmail/nossr50/Users.java index d9a9e89ca..11218571e 100644 --- a/mcMMO/com/gmail/nossr50/Users.java +++ b/mcMMO/com/gmail/nossr50/Users.java @@ -14,6 +14,8 @@ public class Users { private static volatile Users instance; protected static final Logger log = Logger.getLogger("Minecraft"); String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; + String directory = "plugins/mcMMO/FlatFileStuff/"; + String directoryb = "plugins/mcMMO/FlatFileStuff/Leaderboards/"; //public static ArrayList players; public static HashMap players = new HashMap(); @@ -36,14 +38,18 @@ public class Users { public void loadUsers() { + new File(directory).mkdir(); + new File(directoryb).mkdir(); File theDir = new File(location); - if(!theDir.exists()){ + if(!theDir.exists()) + { //properties = new PropertiesFile(location); FileWriter writer = null; try { writer = new FileWriter(location); //writer.write("#Storage place for user information\r\n"); - } catch (Exception e) { + } catch (Exception e) + { log.log(Level.SEVERE, "Exception while creating " + location, e); } finally { try { diff --git a/mcMMO/com/gmail/nossr50/config/LoadProperties.java b/mcMMO/com/gmail/nossr50/config/LoadProperties.java index 530bfc6aa..3b0a9fae5 100644 --- a/mcMMO/com/gmail/nossr50/config/LoadProperties.java +++ b/mcMMO/com/gmail/nossr50/config/LoadProperties.java @@ -6,9 +6,9 @@ import org.bukkit.util.config.Configuration; public class LoadProperties { - public static Boolean xpGainsMobSpawners=false, myspawnEnable = true, mccEnable = true, mcmmoEnable = true, partyEnable = true, inviteEnable = true, acceptEnable = true, whoisEnable = true, statsEnable = true, addxpEnable = true, ptpEnable = true, mmoeditEnable = true, clearmyspawnEnable = true, mcgodEnable = true, mcabilityEnable = true, mctopEnable = true, mcrefreshEnable = true, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; + public static Boolean chimaeraWingEnable=true, xpGainsMobSpawners=false, myspawnEnable = true, mccEnable = true, mcmmoEnable = true, partyEnable = true, inviteEnable = true, acceptEnable = true, whoisEnable = true, statsEnable = true, addxpEnable = true, ptpEnable = true, mmoeditEnable = true, clearmyspawnEnable = true, mcgodEnable = true, mcabilityEnable = true, mctopEnable = true, mcrefreshEnable = true, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, nIron, nGold, nDiamond, locale; - public static int msandstone, mcocoa = 10, water_thunder = 75, cure_self = 5, cure_other = 5, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapus, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond; + public static int chimaeraId=288, msandstone, mcocoa = 10, water_thunder = 75, cure_self = 5, cure_other = 5, mbones, msulphur, mslowsand, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapus, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, superBreakerCooldown = 240, greenTerraCooldown = 240, gigaDrillBreakerCooldown = 240, treeFellerCooldown = 240, berserkCooldown = 240, serratedStrikeCooldown = 240, skullSplitterCooldown = 240, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier = 2, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier, rWood, rStone, rIron, rGold, rDiamond; public String directory = "plugins/mcMMO/"; File file = new File(directory + File.separator + "config.yml"); @@ -100,7 +100,9 @@ public class LoadProperties write("General.HP_Regeneration.Enabled", true); write("General.Performance.Print_Reports", false); + write("Items.Chimaera_Wing.Enabled", true); write("Items.Chimaera_Wing.Feather_Cost", 10); + write("Items.Chimaera_Wing.Item_ID", 288); write("XP.PVP.Rewards", true); write("XP.Gains.Multiplier.PVP", 1); @@ -313,6 +315,9 @@ public class LoadProperties abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss"); feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost"); + chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID"); + chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled"); + pvpxp = readBoolean("XP.PVP.Rewards"); pvpxprewardmodifier = readInteger("XP.Gains.Multiplier.PVP"); miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe"); diff --git a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java index 76a82b729..e08d468d9 100644 --- a/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/mcMMO/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -50,7 +50,7 @@ public class PlayerProfile //Time to HashMap this shiz HashMap stats = new HashMap(); //Skills and XP - String location = "plugins/mcMMO/mcmmo.users"; + String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users"; public PlayerProfile(Player player) { diff --git a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java index eb3ed0727..ce1255984 100644 --- a/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -192,11 +192,11 @@ public class mcPlayerListener extends PlayerListener * ITEM CHECKS */ if(action == Action.RIGHT_CLICK_AIR) - Item.itehecks(player, plugin); + Item.itemhecks(player, plugin); if(action == Action.RIGHT_CLICK_BLOCK) { if(m.abilityBlockCheck(event.getClickedBlock())) - Item.itehecks(player, plugin); + Item.itemhecks(player, plugin); } } diff --git a/mcMMO/com/gmail/nossr50/skills/Skills.java b/mcMMO/com/gmail/nossr50/skills/Skills.java index c1226b856..f2ce8797e 100644 --- a/mcMMO/com/gmail/nossr50/skills/Skills.java +++ b/mcMMO/com/gmail/nossr50/skills/Skills.java @@ -116,8 +116,6 @@ public class Skills { } public static void monitorSkills(Player player){ PlayerProfile PP = Users.getProfile(player); - if(PP == null) - Users.addUser(player); if(PP != null) { if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){