From 67fbde3ebd13187ce9deecf8ce45b67dcae1f6b8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 22 Feb 2011 06:57:03 -0800 Subject: [PATCH] All updated to 0.7.1 - Major XP Overhaul! --- mcMMO/Changelog.txt | 4 + mcMMO/com/gmail/nossr50/mcBlockListener.java | 13 +- mcMMO/com/gmail/nossr50/mcLoadProperties.java | 5 + mcMMO/com/gmail/nossr50/mcMMO.java | 1 + mcMMO/com/gmail/nossr50/mcPlayerListener.java | 108 ++++- mcMMO/com/gmail/nossr50/mcUsers.java | 376 +++++++++++++++++- mcMMO/com/gmail/nossr50/mcm.java | 253 ++++++------ mcMMO/plugin.yml | 2 +- 8 files changed, 612 insertions(+), 150 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 3ddcc003a..abe9ac0b3 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,9 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.7 + Completely rewrote the XP system + Added an XP skillrate modifier to the settings file + Version 0.6.2 Axes now do critical strikes against farm animals Removed the "Stupidly Long Constructor" diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 0c897c4ee..e007403f7 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -58,10 +58,10 @@ public class mcBlockListener extends BlockListener { */ if(block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ - mcUsers.getProfile(player).addwgather(1); + mcUsers.getProfile(player).addWoodcuttingGather(1); mcm.getInstance().woodCuttingProcCheck(player, block, loc); + mcUsers.getProfile(player).addWoodcuttingGather(3); } - mcm.getInstance().simulateSkillUp(player); /* * EXCAVATION */ @@ -78,6 +78,15 @@ public class mcBlockListener extends BlockListener { */ mcConfig.getInstance().addCoordsWatch(xyz); mcConfig.getInstance().addBlockWatch(block); + if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= (mcUsers.getProfile(player).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= (mcUsers.getProfile(player).getWoodCuttingInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeWoodCuttingGather((mcUsers.getProfile(player).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpWoodCutting(1); + } + player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")"); + } } } diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index 6de28c540..b3d9d7d9d 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -3,12 +3,17 @@ package com.gmail.nossr50; public class mcLoadProperties { public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept; + public static int xpmodifier; public static void loadMain(){ String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; mcProperties properties = new mcProperties(propertiesFile); properties.load(); + /* + * EXPERIENCE RATE MODIFIER + */ + xpmodifier = properties.getInteger("xpmodifier", 2); /* * TOGGLE CLAY */ diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 5d6342a67..62259be94 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -69,6 +69,7 @@ public class mcMMO extends JavaPlugin { writer.append("stats=stats"); writer.append("clay=true"); writer.append("anvilmessages=true"); + writer.append("xpmodifier=2"); writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n"); } catch (Exception e) { log.log(Level.SEVERE, "Exception while creating " + Properties, e); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index adf5f6eec..6e6009460 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -109,6 +109,9 @@ public class mcPlayerListener extends PlayerListener { String playerName = player.getName(); //Check if the command is an mcMMO related help command mcm.getInstance().mcmmoHelpCheck(split, player, event); + /* + * MMOEDIT COMMAND + */ if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ if(split.length < 3){ player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue"); @@ -150,6 +153,9 @@ public class mcPlayerListener extends PlayerListener { } } } + /* + * WHOIS COMMAND + */ if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/"+mcLoadProperties.whois)){ event.setCancelled(true); if(split.length < 2){ @@ -170,22 +176,57 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)"); player.sendMessage("OP: " + target.isOp()); player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~"); - player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining()); - player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair()); - player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting()); - player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed()); - player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism()); - player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation()); - player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery()); - player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords()); - player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes()); - player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics()); + player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getMiningGather() + +"/"+(mcUsers.getProfile(target).getMiningInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getRepairGather() + +"/"+(mcUsers.getProfile(target).getRepairInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getWoodCuttingGather() + +"/"+(mcUsers.getProfile(target).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getUnarmed()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getUnarmedGather() + +"/"+(mcUsers.getProfile(target).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getHerbalism()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getHerbalismGather() + +"/"+(mcUsers.getProfile(target).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getExcavationGather() + +"/"+(mcUsers.getProfile(target).getExcavationInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getArcheryGather() + +"/"+(mcUsers.getProfile(target).getArcheryInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getSwords()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getSwordsGather() + +"/"+(mcUsers.getProfile(target).getSwordsInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAxes()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getAxesGather() + +"/"+(mcUsers.getProfile(target).getAxesInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAcrobatics()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(target).getAcrobaticsGather() + +"/"+(mcUsers.getProfile(target).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+ + (mcUsers.getProfile(target).getAcrobaticsInt()+ + mcUsers.getProfile(target).getArcheryInt()+ + mcUsers.getProfile(target).getAxesInt()+ + mcUsers.getProfile(target).getExcavationInt()+ + mcUsers.getProfile(target).getHerbalismInt()+ + mcUsers.getProfile(target).getMiningInt()+ + mcUsers.getProfile(target).getRepairInt()+ + mcUsers.getProfile(target).getSwordsInt()+ + mcUsers.getProfile(target).getUnarmedInt()+ + mcUsers.getProfile(target).getWoodCuttingInt()) + ); player.sendMessage(ChatColor.GREEN+"~~COORDINATES~~"); player.sendMessage("X: "+x); player.sendMessage("Y: "+y); player.sendMessage("Z: "+z); } } + /* + * SETMYSPAWN COMMAND + */ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){ if(!mcPermissions.getInstance().setMySpawn(player)){ player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); @@ -198,20 +239,43 @@ public class mcPlayerListener extends PlayerListener { mcUsers.getProfile(player).setMySpawn(x, y, z); player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location."); } + /* + * STATS COMMAND + */ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){ event.setCancelled(true); player.sendMessage(ChatColor.DARK_RED + "mcMMO stats"); - player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()); - player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()); - player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()); - player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()); - player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()); - player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()); - player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery()); - player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()); - player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()); - player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()); - player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+ + player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getMiningGather() + +"/"+(mcUsers.getProfile(player).getMiningInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getRepairGather() + +"/"+(mcUsers.getProfile(player).getRepairInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getWoodCuttingGather() + +"/"+(mcUsers.getProfile(player).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getUnarmedGather() + +"/"+(mcUsers.getProfile(player).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getHerbalismGather() + +"/"+(mcUsers.getProfile(player).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getExcavationGather() + +"/"+(mcUsers.getProfile(player).getExcavationInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getArchery()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getArcheryGather() + +"/"+(mcUsers.getProfile(player).getArcheryInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getSwordsGather() + +"/"+(mcUsers.getProfile(player).getSwordsInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getAxesGather() + +"/"+(mcUsers.getProfile(player).getAxesInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()+ChatColor.DARK_AQUA + + " XP("+mcUsers.getProfile(player).getAcrobaticsGather() + +"/"+(mcUsers.getProfile(player).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier+")"); + player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+ (mcUsers.getProfile(player).getAcrobaticsInt()+ mcUsers.getProfile(player).getArcheryInt()+ mcUsers.getProfile(player).getAxesInt()+ @@ -221,7 +285,7 @@ public class mcPlayerListener extends PlayerListener { mcUsers.getProfile(player).getRepairInt()+ mcUsers.getProfile(player).getSwordsInt()+ mcUsers.getProfile(player).getUnarmedInt()+ - mcUsers.getProfile(player).getWoodCuttingint()) + mcUsers.getProfile(player).getWoodCuttingInt()) ); } //Invite Command diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index d7f45f885..e52ffe416 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -252,6 +252,22 @@ class PlayerList axes = character[13]; if(character.length > 14) acrobatics = character[14]; + if(character.length > 15) + repairgather = character[15]; + if(character.length > 16) + unarmedgather = character[16]; + if(character.length > 17) + herbalismgather = character[17]; + if(character.length > 18) + excavationgather = character[18]; + if(character.length > 19) + archerygather = character[19]; + if(character.length > 20) + swordsgather = character[20]; + if(character.length > 21) + axesgather = character[21]; + if(character.length > 22) + acrobaticsgather = character[22]; in.close(); return true; } @@ -305,6 +321,14 @@ class PlayerList writer.append(swords+":"); writer.append(axes+":"); writer.append(acrobatics+":"); + writer.append(repairgather+":"); + writer.append(unarmedgather+":"); + writer.append(herbalismgather+":"); + writer.append(excavationgather+":"); + writer.append(archerygather+":"); + writer.append(swordsgather+":"); + writer.append(axesgather+":"); + writer.append(acrobaticsgather+":"); writer.append("\r\n"); } } @@ -340,6 +364,14 @@ class PlayerList out.append(0+":"); //swords out.append(0+":"); //axes out.append(0+":"); //acrobatics + out.append(0+":"); //repairgather + out.append(0+":"); //unarmedgather + out.append(0+":"); //herbalismgather + out.append(0+":"); //excavationgather + out.append(0+":"); //archerygather + out.append(0+":"); //swordsgather + out.append(0+":"); //axesgather + out.append(0+":"); //acrobaticsgather //Add more in the same format as the line above out.newLine(); @@ -485,7 +517,7 @@ class PlayerList excavation = Integer.toString(x); save(); } - public void skillUpWoodcutting(int newskill){ + public void skillUpWoodCutting(int newskill){ int x = 0; if(woodcutting != null){ if(isInt(woodcutting)){ @@ -634,7 +666,7 @@ class PlayerList return 0; } } - public int getWoodCuttingint(){ + public int getWoodCuttingInt(){ if(isInt(woodcutting)){ int x = Integer.parseInt(woodcutting); return x; @@ -649,8 +681,114 @@ class PlayerList return "0"; } } - - public void addwgather(int newgather) + /* + * EXPERIENCE STUFF + */ + public void clearRepairGather(){ + repairgather = "0"; + } + public void clearUnarmedGather(){ + unarmedgather = "0"; + } + public void clearHerbalismGather(){ + herbalismgather = "0"; + } + public void clearExcavationGather(){ + excavationgather = "0"; + } + public void clearArcheryGather(){ + archerygather = "0"; + } + public void clearSwordsGather(){ + swordsgather = "0"; + } + public void clearAxesGather(){ + axesgather = "0"; + } + public void clearAcrobaticsGather(){ + acrobaticsgather = "0"; + } + public void addAcrobaticsGather(int newgather) + { + int x = 0; + if(isInt(acrobaticsgather)){ + x = Integer.parseInt(acrobaticsgather); + } + x += newgather; + acrobaticsgather = String.valueOf(x); + save(); + } + public void addAxesGather(int newgather) + { + int x = 0; + if(isInt(axesgather)){ + x = Integer.parseInt(axesgather); + } + x += newgather; + axesgather = String.valueOf(x); + save(); + } + public void addSwordsGather(int newgather) + { + int x = 0; + if(isInt(swordsgather)){ + x = Integer.parseInt(swordsgather); + } + x += newgather; + swordsgather = String.valueOf(x); + save(); + } + public void addArcheryGather(int newgather) + { + int x = 0; + if(isInt(archerygather)){ + x = Integer.parseInt(archerygather); + } + x += newgather; + archerygather = String.valueOf(x); + save(); + } + public void addExcavationGather(int newgather) + { + int x = 0; + if(isInt(excavationgather)){ + x = Integer.parseInt(excavationgather); + } + x += newgather; + excavationgather = String.valueOf(x); + save(); + } + public void addHerbalismGather(int newgather) + { + int x = 0; + if(isInt(herbalismgather)){ + x = Integer.parseInt(herbalismgather); + } + x += newgather; + herbalismgather = String.valueOf(x); + save(); + } + public void addRepairGather(int newgather) + { + int x = 0; + if(isInt(repairgather)){ + x = Integer.parseInt(repairgather); + } + x += newgather; + repairgather = String.valueOf(x); + save(); + } + public void addUnarmedGather(int newgather) + { + int x = 0; + if(isInt(unarmedgather)){ + x = Integer.parseInt(unarmedgather); + } + x += newgather; + unarmedgather = String.valueOf(x); + save(); + } + public void addWoodcuttingGather(int newgather) { int x = 0; if(isInt(wgather)){ @@ -660,7 +798,7 @@ class PlayerList wgather = String.valueOf(x); save(); } - public void removewgather(int newgather){ + public void removeWoodCuttingGather(int newgather){ int x = 0; if(isInt(wgather)){ x = Integer.parseInt(wgather); @@ -669,7 +807,7 @@ class PlayerList wgather = String.valueOf(x); save(); } - public void addgather(int newgather) + public void addMiningGather(int newgather) { int x = 0; if(isInt(gather)){ @@ -681,7 +819,7 @@ class PlayerList gather = String.valueOf(x); save(); } - public void removegather(int newgather){ + public void removeMiningGather(int newgather){ int x = 0; if(isInt(gather)){ x = Integer.parseInt(gather); @@ -690,6 +828,78 @@ class PlayerList gather = String.valueOf(x); save(); } + public void removeRepairGather(int newgather){ + int x = 0; + if(isInt(repairgather)){ + x = Integer.parseInt(repairgather); + } + x -= newgather; + repairgather = String.valueOf(x); + save(); + } + public void removeUnarmedGather(int newgather){ + int x = 0; + if(isInt(unarmedgather)){ + x = Integer.parseInt(unarmedgather); + } + x -= newgather; + unarmedgather = String.valueOf(x); + save(); + } + public void removeHerbalismGather(int newgather){ + int x = 0; + if(isInt(herbalismgather)){ + x = Integer.parseInt(herbalismgather); + } + x -= newgather; + herbalismgather = String.valueOf(x); + save(); + } + public void removeExcavationGather(int newgather){ + int x = 0; + if(isInt(excavationgather)){ + x = Integer.parseInt(excavationgather); + } + x -= newgather; + excavationgather = String.valueOf(x); + save(); + } + public void removeArcheryGather(int newgather){ + int x = 0; + if(isInt(archerygather)){ + x = Integer.parseInt(archerygather); + } + x -= newgather; + archerygather = String.valueOf(x); + save(); + } + public void removeSwordsGather(int newgather){ + int x = 0; + if(isInt(swordsgather)){ + x = Integer.parseInt(swordsgather); + } + x -= newgather; + swordsgather = String.valueOf(x); + save(); + } + public void removeAxesGather(int newgather){ + int x = 0; + if(isInt(axesgather)){ + x = Integer.parseInt(axesgather); + } + x -= newgather; + axesgather = String.valueOf(x); + save(); + } + public void removeAcrobaticsGather(int newgather){ + int x = 0; + if(isInt(acrobaticsgather)){ + x = Integer.parseInt(acrobaticsgather); + } + x -= newgather; + acrobaticsgather = String.valueOf(x); + save(); + } public boolean isInt(String string){ try { @@ -718,19 +928,159 @@ class PlayerList invite = invitename; } //Returns player gather - public String getgather() { return gather; } + public String getMiningGather(){ + if(gather != null && !gather.equals("") && !gather.equals("null")){ + return gather; + } else { + return "0"; + } + } public String getInvite() { return invite; } - public String getwgather() { return wgather; } + public String getWoodCuttingGather(){ + if(wgather != null && !wgather.equals("") && !wgather.equals("null")){ + return wgather; + } else { + return "0"; + } + } + public String getRepairGather(){ + if(repairgather != null && !repairgather.equals("") && !repairgather.equals("null")){ + return repairgather; + } else { + return "0"; + } + } + public String getHerbalismGather(){ + if(herbalismgather != null && !herbalismgather.equals("") && !herbalismgather.equals("null")){ + return herbalismgather; + } else { + return "0"; + } + } + public String getExcavationGather(){ + if(excavationgather != null && !excavationgather.equals("") && !excavationgather.equals("null")){ + return excavationgather; + } else { + return "0"; + } + } + public String getArcheryGather(){ + if(archerygather != null && !archerygather.equals("") && !archerygather.equals("null")){ + return archerygather; + } else { + return "0"; + } + } + public String getSwordsGather(){ + if(swordsgather != null && !swordsgather.equals("") && !swordsgather.equals("null")){ + return swordsgather; + } else { + return "0"; + } + } + public String getAxesGather(){ + if(axesgather != null && !axesgather.equals("") && !axesgather.equals("null")){ + return axesgather; + } else { + return "0"; + } + } + public String getAcrobaticsGather(){ + if(acrobaticsgather != null && !acrobaticsgather.equals("") && !acrobaticsgather.equals("null")){ + return acrobaticsgather; + } else { + return "0"; + } + } + public String getUnarmedGather(){ + if(unarmedgather != null && !unarmedgather.equals("") && !unarmedgather.equals("null")){ + return unarmedgather; + } else { + return "0"; + } + } - public int getwgatheramt() { + public int getWoodCuttingGatherInt() { if(isInt(wgather)){ - return Integer.parseInt(getwgather()); + return Integer.parseInt(wgather); } else { wgather = "0"; save(); return 0; } } + public int getRepairGatherInt() { + if(isInt(repairgather)){ + return Integer.parseInt(repairgather); + } else { + repairgather = "0"; + save(); + return 0; + } + } + public int getUnarmedGatherInt() { + if(isInt(unarmedgather)){ + return Integer.parseInt(unarmedgather); + } else { + unarmedgather = "0"; + save(); + return 0; + } + } + public int getHerbalismGatherInt() { + if(isInt(herbalismgather)){ + return Integer.parseInt(herbalismgather); + } else { + herbalismgather = "0"; + save(); + return 0; + } + } + public int getExcavationGatherInt() { + if(isInt(excavationgather)){ + return Integer.parseInt(excavationgather); + } else { + excavationgather = "0"; + save(); + return 0; + } + } + public int getArcheryGatherInt() { + if(isInt(archerygather)){ + return Integer.parseInt(archerygather); + } else { + archerygather = "0"; + save(); + return 0; + } + } + public int getSwordsGatherInt() { + if(isInt(swordsgather)){ + return Integer.parseInt(swordsgather); + } else { + swordsgather = "0"; + save(); + return 0; + } + } + public int getAxesGatherInt() { + if(isInt(axesgather)){ + return Integer.parseInt(axesgather); + } else { + axesgather = "0"; + save(); + return 0; + } + } + public int getAcrobaticsGatherInt() { + if(isInt(acrobaticsgather)){ + return Integer.parseInt(acrobaticsgather); + } else { + acrobaticsgather = "0"; + save(); + return 0; + } + } public void modifyskill(int newvalue, String skillname){ if(skillname.equals("mining")){ mining = String.valueOf(newvalue); @@ -764,9 +1114,9 @@ class PlayerList } save(); } - public int getgatheramt() { + public int getMiningGatherInt() { if(isInt(gather)){ - return Integer.parseInt(getgather()); + return Integer.parseInt(gather); } else { gather = "0"; save(); diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 03c72ebda..54db1ec96 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -133,8 +133,16 @@ public class mcm { mcm.getInstance().simulateNaturalDrops(defender); //XP if(Math.random() * 10 > 7){ - mcUsers.getProfile(attacker).skillUpArchery(1); - attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")"); + mcUsers.getProfile(attacker).addArcheryGather(1); + if(mcUsers.getProfile(attacker).getArcheryGatherInt() >= (mcUsers.getProfile(attacker).getArcheryInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getArcheryGatherInt() >= (mcUsers.getProfile(attacker).getArcheryInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeArcheryGather((mcUsers.getProfile(attacker).getArcheryInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpArchery(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getArchery()+")"); + } } } /* @@ -298,18 +306,15 @@ public class mcm { return; if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && mcPermissions.getInstance().acrobatics(player)){ - if(event.getDamage() >= 2 && event.getDamage() < 6){ - mcUsers.getProfile(player).skillUpAcrobatics(1); - player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); - } - if(event.getDamage() >= 6 && event.getDamage() < 19){ - mcUsers.getProfile(player).skillUpAcrobatics(2); - player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); - } - if(event.getDamage() >= 19){ - mcUsers.getProfile(player).skillUpAcrobatics(3); - player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); - } + mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage()); + if(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= (mcUsers.getProfile(player).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= (mcUsers.getProfile(player).getAcrobaticsInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeAcrobaticsGather((mcUsers.getProfile(player).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpAcrobatics(1); + } + player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); } mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z)); if(player.getHealth() - event.getDamage() <= 0){ @@ -317,6 +322,7 @@ public class mcm { return; mcUsers.getProfile(player).setDead(true); } + } } public void simulateNaturalDrops(Entity entity){ Location loc = entity.getLocation(); @@ -558,39 +564,48 @@ public class mcm { } public void miningBlockCheck(Player player, Block block){ if(block.getTypeId() == 1){ - mcUsers.getProfile(player).addgather(1); + mcUsers.getProfile(player).addMiningGather(1); mcm.getInstance().blockProcCheck(block, player); } //COAL if(block.getTypeId() == 16){ - mcUsers.getProfile(player).addgather(3); + mcUsers.getProfile(player).addMiningGather(3); mcm.getInstance().blockProcCheck(block, player); } //GOLD if(block.getTypeId() == 14){ - mcUsers.getProfile(player).addgather(20); + mcUsers.getProfile(player).addMiningGather(50); mcm.getInstance().blockProcCheck(block, player); } //DIAMOND if(block.getTypeId() == 56){ - mcUsers.getProfile(player).addgather(50); + mcUsers.getProfile(player).addMiningGather(50); mcm.getInstance().blockProcCheck(block, player); } //IRON if(block.getTypeId() == 15){ - mcUsers.getProfile(player).addgather(10); + mcUsers.getProfile(player).addMiningGather(10); mcm.getInstance().blockProcCheck(block, player); } //REDSTONE if(block.getTypeId() == 73 || block.getTypeId() == 74){ - mcUsers.getProfile(player).addgather(15); + mcUsers.getProfile(player).addMiningGather(10); mcm.getInstance().blockProcCheck(block, player); } //LAPUS if(block.getTypeId() == 21){ - mcUsers.getProfile(player).addgather(50); + mcUsers.getProfile(player).addMiningGather(20); mcm.getInstance().blockProcCheck(block, player); } + if(mcUsers.getProfile(player).getMiningGatherInt() >= (mcUsers.getProfile(player).getMiningInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getMiningGatherInt() >= (mcUsers.getProfile(player).getMiningInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeMiningGather((mcUsers.getProfile(player).getMiningInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpMining(1); + } + player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")"); + } } public void breadCheck(Player player, ItemStack is){ if(is.getTypeId() == 297){ @@ -772,18 +787,30 @@ public class mcm { if(x instanceof Squid){ Squid defender = (Squid)event.getEntity(); if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ - if(Math.random() * 10 > 9){ - mcUsers.getProfile(attacker).skillUpSwords(1); - attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")"); - } + mcUsers.getProfile(attacker).addSwordsGather(1); + if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeSwordsGather((mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpSwords(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")"); + } } if(isAxes(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().axes(attacker)){ - if(Math.random() * 10 > 9){ - mcUsers.getProfile(attacker).skillUpAxes(1); - attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")"); - } + mcUsers.getProfile(attacker).addAxesGather(1); + if(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeAxesGather((mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpAxes(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")"); + } } if(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(defender.getHealth() <= 0) @@ -820,8 +847,16 @@ public class mcm { //XP if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){ if(defender.getHealth() != 0){ - mcUsers.getProfile(attacker).skillUpUnarmed(1); - attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); + mcUsers.getProfile(attacker).addUnarmedGather(1); + if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= (mcUsers.getProfile(attacker).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= (mcUsers.getProfile(attacker).getUnarmedInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeUnarmedGather((mcUsers.getProfile(attacker).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpUnarmed(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); + } } } if(defender.getHealth() <= 0) @@ -910,18 +945,30 @@ public class mcm { if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ - if(Math.random() * 10 > 9){ - mcUsers.getProfile(attacker).skillUpSwords(1); - attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")"); + mcUsers.getProfile(attacker).addSwordsGather(1); + if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeSwordsGather((mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpSwords(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")"); + } } - } if(isAxes(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().axes(attacker)){ - if(Math.random() * 10 > 9){ - mcUsers.getProfile(attacker).skillUpAxes(1); - attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")"); - } + mcUsers.getProfile(attacker).addAxesGather(1); + if(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeAxesGather((mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(attacker).skillUpAxes(1); + } + attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")"); + } } /* * AXE DAMAGE SCALING && LOOT CHECKS @@ -956,29 +1003,15 @@ public class mcm { defender.setHealth(calculateDamage(defender, 8)); } //XP - if(x instanceof Skeleton && Math.random() * 100 > 95){ - if(defender.getHealth() != 0){ + mcUsers.getProfile(attacker).addUnarmedGather(1); + if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= (mcUsers.getProfile(attacker).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= (mcUsers.getProfile(attacker).getUnarmedInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(attacker).removeUnarmedGather((mcUsers.getProfile(attacker).getUnarmedInt() + 5) * mcLoadProperties.xpmodifier); mcUsers.getProfile(attacker).skillUpUnarmed(1); - attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); - } - } - if(x instanceof Spider&& Math.random() * 10 > 9){ - if(defender.getHealth() != 0){ - mcUsers.getProfile(attacker).skillUpUnarmed(1); - attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); - } - } - if(x instanceof Zombie && Math.random() * 100 > 95){ - if(defender.getHealth() != 0){ - mcUsers.getProfile(attacker).skillUpUnarmed(1); - attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); - } - } - if(x instanceof Creeper && Math.random() * 100 > 90){ - if(defender.getHealth() != 0){ - mcUsers.getProfile(attacker).skillUpUnarmed(2); - attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 2. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); - } + } + attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); } if(defender.getHealth() <= 0) mcm.getInstance().simulateNaturalDrops(defender); @@ -1421,13 +1454,14 @@ public class mcm { if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player)){ mcm.getInstance().removeDiamond(player); player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player)); - mcUsers.getProfile(player).skillUpRepair(1); - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); + mcUsers.getProfile(player).addRepairGather(20); } else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){ mcm.getInstance().removeIron(player); player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player)); - mcUsers.getProfile(player).skillUpRepair(1); - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); + /* + * DISTRIBUTE REPAIR XP + */ + mcUsers.getProfile(player).addRepairGather(5); } else { needMoreVespeneGas(is, player); } @@ -1439,13 +1473,11 @@ public class mcm { if(mcm.getInstance().isIronTools(is) && mcm.getInstance().hasIron(player)){ is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player)); mcm.getInstance().removeIron(player); - mcUsers.getProfile(player).skillUpRepair(1); - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); + mcUsers.getProfile(player).addRepairGather(5); } else if (mcm.getInstance().isDiamondTools(is) && mcm.getInstance().hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ //Check if its diamond and the player has diamonds is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player)); mcm.getInstance().removeDiamond(player); - mcUsers.getProfile(player).skillUpRepair(1); - player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")"); + mcUsers.getProfile(player).addRepairGather(20); } else { needMoreVespeneGas(is, player); } @@ -1455,7 +1487,19 @@ public class mcm { player.sendMessage("That is at full durability."); } player.updateInventory(); - } //end if block is iron block bracket + /* + * GIVE SKILL IF THERE IS ENOUGH XP + */ + if(mcUsers.getProfile(player).getRepairGatherInt() >= (mcUsers.getProfile(player).getRepairInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getRepairGatherInt() >= (mcUsers.getProfile(player).getRepairInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeRepairGather((mcUsers.getProfile(player).getRepairInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpRepair(1); + } + player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")"); + } + } } public void herbalismProcCheck(Block block, Player player){ int type = block.getTypeId(); @@ -1464,21 +1508,18 @@ public class mcm { Material mat = null; if(!mcConfig.getInstance().isBlockWatched(block)){ if(type == 39 || type == 40){ - mcUsers.getProfile(player).skillUpHerbalism(3); - player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 3. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")"); + mcUsers.getProfile(player).addHerbalismGather(20); } if(type == 37 || type == 38){ if(Math.random() * 10 > 8){ - mcUsers.getProfile(player).skillUpHerbalism(1); - player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")"); + mcUsers.getProfile(player).addHerbalismGather(2); } } if(type == 59 && block.getData() == (byte) 0x7){ mat = Material.getMaterial(296); is = new ItemStack(mat, 1, (byte)0, (byte)0); if(Math.random() * 100 > 80){ - mcUsers.getProfile(player).skillUpHerbalism(1); - player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")"); + mcUsers.getProfile(player).addHerbalismGather(3); } if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(Math.random() * 10 > 8) @@ -1497,6 +1538,15 @@ public class mcm { loc.getWorld().dropItemNaturally(loc, is); } } + if(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeHerbalismGather((mcUsers.getProfile(player).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpHerbalism(1); + } + player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")"); + } } } public void excavationProcCheck(Block block, Player player){ @@ -1520,11 +1570,7 @@ public class mcm { } //DIRT SAND OR GRAVEL if(type == 3 || type == 13 || type == 2 || type == 12){ - if(Math.random() * 100 > 95){ - mcUsers.getProfile(player).skillUpExcavation(1); - player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by 1. Total ("+mcUsers.getProfile(player).getExcavationInt()+")"); - - } + mcUsers.getProfile(player).addExcavationGather(1); if(mcUsers.getProfile(player).getExcavationInt() > 750){ //CHANCE TO GET CAKE if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ @@ -1613,49 +1659,48 @@ public class mcm { loc.getWorld().dropItemNaturally(loc, is); } } - //CHANCE TO GET COAL - /* - if(mcLoadProperties.coal == true && mcUsers.getProfile(player).getExcavationInt() > 125){ - if(Math.random() * 100 > 99){ - mat = Material.getMaterial(263); - is = new ItemStack(mat, 1, (byte)0, (byte)0); - loc.getWorld().dropItemNaturally(loc, is); - } - } - */ } + if(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() + 5) * mcLoadProperties.xpmodifier){ + int skillups = 0; + while(mcUsers.getProfile(player).getExcavationGatherInt() >= (mcUsers.getProfile(player).getExcavationInt() +5) * mcLoadProperties.xpmodifier){ + skillups++; + mcUsers.getProfile(player).removeExcavationGather((mcUsers.getProfile(player).getExcavationInt() + 5) * mcLoadProperties.xpmodifier); + mcUsers.getProfile(player).skillUpExcavation(1); + } + player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")"); + } } public void woodCuttingProcCheck(Player player, Block block, Location loc){ byte type = block.getData(); Material mat = Material.getMaterial(block.getTypeId()); byte damage = 0; - if(mcUsers.getProfile(player).getWoodCuttingint() > 1000){ + if(mcUsers.getProfile(player).getWoodCuttingInt() > 1000){ ItemStack item = new ItemStack(mat, 1, type, damage); loc.getWorld().dropItemNaturally(loc, item); return; } - if(mcUsers.getProfile(player).getWoodCuttingint() > 750){ + if(mcUsers.getProfile(player).getWoodCuttingInt() > 750){ if((Math.random() * 10) > 2){ ItemStack item = new ItemStack(mat, 1, type, damage); loc.getWorld().dropItemNaturally(loc, item); return; } } - if(mcUsers.getProfile(player).getWoodCuttingint() > 300){ + if(mcUsers.getProfile(player).getWoodCuttingInt() > 300){ if((Math.random() * 10) > 4){ ItemStack item = new ItemStack(mat, 1, type, damage); loc.getWorld().dropItemNaturally(loc, item); return; } } - if(mcUsers.getProfile(player).getWoodCuttingint() > 100){ + if(mcUsers.getProfile(player).getWoodCuttingInt() > 100){ if((Math.random() * 10) > 6){ ItemStack item = new ItemStack(mat, 1, type, damage); loc.getWorld().dropItemNaturally(loc, item); return; } } - if(mcUsers.getProfile(player).getWoodCuttingint() > 10){ + if(mcUsers.getProfile(player).getWoodCuttingInt() > 10){ if((Math.random() * 10) > 8){ ItemStack item = new ItemStack(mat, 1, type, damage); loc.getWorld().dropItemNaturally(loc, item); @@ -1663,22 +1708,6 @@ public class mcm { } } } - public void simulateSkillUp(Player player){ - if(mcUsers.getProfile(player).getwgatheramt() > 10){ - while(mcUsers.getProfile(player).getwgatheramt() > 10){ - mcUsers.getProfile(player).removewgather(10); - mcUsers.getProfile(player).skillUpWoodcutting(1); - player.sendMessage(ChatColor.YELLOW+"Wood Cutting skill increased by 1. Total ("+mcUsers.getProfile(player).getWoodCutting()+")"); - } - } - if(mcUsers.getProfile(player).getgatheramt() > 50){ - while(mcUsers.getProfile(player).getgatheramt() > 50){ - mcUsers.getProfile(player).removegather(50); - mcUsers.getProfile(player).skillUpMining(1); - player.sendMessage(ChatColor.YELLOW+"Mining skill increased by 1. Total ("+mcUsers.getProfile(player).getMining()+")"); - } - } - } // IS TOOLS FUNCTION public boolean isArmor(ItemStack is){ if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index db1e30820..abe54e374 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.6.4 \ No newline at end of file +version: 0.7.1 \ No newline at end of file