All updated to 0.7.1 - Major XP Overhaul!

This commit is contained in:
nossr50 2011-02-22 06:57:03 -08:00
parent 244f356331
commit 67fbde3ebd
8 changed files with 612 additions and 150 deletions

View File

@ -1,5 +1,9 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code# #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 Version 0.6.2
Axes now do critical strikes against farm animals Axes now do critical strikes against farm animals
Removed the "Stupidly Long Constructor" Removed the "Stupidly Long Constructor"

View File

@ -58,10 +58,10 @@ public class mcBlockListener extends BlockListener {
*/ */
if(block.getTypeId() == 17 if(block.getTypeId() == 17
&& mcPermissions.getInstance().woodcutting(player)){ && mcPermissions.getInstance().woodcutting(player)){
mcUsers.getProfile(player).addwgather(1); mcUsers.getProfile(player).addWoodcuttingGather(1);
mcm.getInstance().woodCuttingProcCheck(player, block, loc); mcm.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(3);
} }
mcm.getInstance().simulateSkillUp(player);
/* /*
* EXCAVATION * EXCAVATION
*/ */
@ -78,6 +78,15 @@ public class mcBlockListener extends BlockListener {
*/ */
mcConfig.getInstance().addCoordsWatch(xyz); mcConfig.getInstance().addCoordsWatch(xyz);
mcConfig.getInstance().addBlockWatch(block); 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()+")");
}
} }
} }

View File

@ -3,12 +3,17 @@ package com.gmail.nossr50;
public class mcLoadProperties { public class mcLoadProperties {
public static Boolean pvp, eggs, apples, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; 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 String mcmmo, mcc, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept;
public static int xpmodifier;
public static void loadMain(){ public static void loadMain(){
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
mcProperties properties = new mcProperties(propertiesFile); mcProperties properties = new mcProperties(propertiesFile);
properties.load(); properties.load();
/*
* EXPERIENCE RATE MODIFIER
*/
xpmodifier = properties.getInteger("xpmodifier", 2);
/* /*
* TOGGLE CLAY * TOGGLE CLAY
*/ */

View File

@ -69,6 +69,7 @@ public class mcMMO extends JavaPlugin {
writer.append("stats=stats"); writer.append("stats=stats");
writer.append("clay=true"); writer.append("clay=true");
writer.append("anvilmessages=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"); writer.append("#Appreciate the plugin? Send me a donation via paypal nossr50@gmail.com\r\n");
} catch (Exception e) { } catch (Exception e) {
log.log(Level.SEVERE, "Exception while creating " + Properties, e); log.log(Level.SEVERE, "Exception while creating " + Properties, e);

View File

@ -109,6 +109,9 @@ public class mcPlayerListener extends PlayerListener {
String playerName = player.getName(); String playerName = player.getName();
//Check if the command is an mcMMO related help command //Check if the command is an mcMMO related help command
mcm.getInstance().mcmmoHelpCheck(split, player, event); mcm.getInstance().mcmmoHelpCheck(split, player, event);
/*
* MMOEDIT COMMAND
*/
if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ if(mcPermissions.getInstance().mmoedit(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
if(split.length < 3){ if(split.length < 3){
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.mmoedit+" playername skillname newvalue"); 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)){ if((player.isOp() || mcPermissions.getInstance().whois(player)) && split[0].equalsIgnoreCase("/"+mcLoadProperties.whois)){
event.setCancelled(true); event.setCancelled(true);
if(split.length < 2){ 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("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)");
player.sendMessage("OP: " + target.isOp()); player.sendMessage("OP: " + target.isOp());
player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~"); player.sendMessage(ChatColor.GREEN+"~~mcMMO stats~~");
player.sendMessage("Mining Skill: "+mcUsers.getProfile(target).getMining()); player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA
player.sendMessage("Repair Skill: "+mcUsers.getProfile(target).getRepair()); + " XP("+mcUsers.getProfile(target).getMiningGather()
player.sendMessage("Woodcutting Skill: "+mcUsers.getProfile(target).getWoodCutting()); +"/"+(mcUsers.getProfile(target).getMiningInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage("Unarmed Skill: "+mcUsers.getProfile(target).getUnarmed()); player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA
player.sendMessage("Herbalism Skill: "+mcUsers.getProfile(target).getHerbalism()); + " XP("+mcUsers.getProfile(target).getRepairGather()
player.sendMessage("Excavation Skill: "+mcUsers.getProfile(target).getExcavation()); +"/"+(mcUsers.getProfile(target).getRepairInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage("Archery Skill: "+mcUsers.getProfile(target).getArchery()); player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA
player.sendMessage("Swords Skill: "+mcUsers.getProfile(target).getSwords()); + " XP("+mcUsers.getProfile(target).getWoodCuttingGather()
player.sendMessage("Axes Skill: "+mcUsers.getProfile(target).getAxes()); +"/"+(mcUsers.getProfile(target).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage("Acrobatics Skill: "+mcUsers.getProfile(target).getAcrobatics()); 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(ChatColor.GREEN+"~~COORDINATES~~");
player.sendMessage("X: "+x); player.sendMessage("X: "+x);
player.sendMessage("Y: "+y); player.sendMessage("Y: "+y);
player.sendMessage("Z: "+z); player.sendMessage("Z: "+z);
} }
} }
/*
* SETMYSPAWN COMMAND
*/
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){
if(!mcPermissions.getInstance().setMySpawn(player)){ if(!mcPermissions.getInstance().setMySpawn(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); 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); mcUsers.getProfile(player).setMySpawn(x, y, z);
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location."); player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
} }
/*
* STATS COMMAND
*/
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){ if(split[0].equalsIgnoreCase("/"+mcLoadProperties.stats)){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(ChatColor.DARK_RED + "mcMMO stats"); player.sendMessage(ChatColor.DARK_RED + "mcMMO stats");
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()); player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()); + " XP("+mcUsers.getProfile(player).getMiningGather()
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()); +"/"+(mcUsers.getProfile(player).getMiningInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()); player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()); + " XP("+mcUsers.getProfile(player).getRepairGather()
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()); +"/"+(mcUsers.getProfile(player).getRepairInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage(ChatColor.YELLOW + "Archery Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getArchery()); player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()); + " XP("+mcUsers.getProfile(player).getWoodCuttingGather()
player.sendMessage(ChatColor.YELLOW+ "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()); +"/"+(mcUsers.getProfile(player).getWoodCuttingInt() + 5) * mcLoadProperties.xpmodifier+")");
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()); player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA
player.sendMessage(ChatColor.DARK_RED+"TOTAL SKILL: "+ChatColor.GREEN+ + " 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).getAcrobaticsInt()+
mcUsers.getProfile(player).getArcheryInt()+ mcUsers.getProfile(player).getArcheryInt()+
mcUsers.getProfile(player).getAxesInt()+ mcUsers.getProfile(player).getAxesInt()+
@ -221,7 +285,7 @@ public class mcPlayerListener extends PlayerListener {
mcUsers.getProfile(player).getRepairInt()+ mcUsers.getProfile(player).getRepairInt()+
mcUsers.getProfile(player).getSwordsInt()+ mcUsers.getProfile(player).getSwordsInt()+
mcUsers.getProfile(player).getUnarmedInt()+ mcUsers.getProfile(player).getUnarmedInt()+
mcUsers.getProfile(player).getWoodCuttingint()) mcUsers.getProfile(player).getWoodCuttingInt())
); );
} }
//Invite Command //Invite Command

View File

@ -252,6 +252,22 @@ class PlayerList
axes = character[13]; axes = character[13];
if(character.length > 14) if(character.length > 14)
acrobatics = character[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(); in.close();
return true; return true;
} }
@ -305,6 +321,14 @@ class PlayerList
writer.append(swords+":"); writer.append(swords+":");
writer.append(axes+":"); writer.append(axes+":");
writer.append(acrobatics+":"); 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"); writer.append("\r\n");
} }
} }
@ -340,6 +364,14 @@ class PlayerList
out.append(0+":"); //swords out.append(0+":"); //swords
out.append(0+":"); //axes out.append(0+":"); //axes
out.append(0+":"); //acrobatics 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 //Add more in the same format as the line above
out.newLine(); out.newLine();
@ -485,7 +517,7 @@ class PlayerList
excavation = Integer.toString(x); excavation = Integer.toString(x);
save(); save();
} }
public void skillUpWoodcutting(int newskill){ public void skillUpWoodCutting(int newskill){
int x = 0; int x = 0;
if(woodcutting != null){ if(woodcutting != null){
if(isInt(woodcutting)){ if(isInt(woodcutting)){
@ -634,7 +666,7 @@ class PlayerList
return 0; return 0;
} }
} }
public int getWoodCuttingint(){ public int getWoodCuttingInt(){
if(isInt(woodcutting)){ if(isInt(woodcutting)){
int x = Integer.parseInt(woodcutting); int x = Integer.parseInt(woodcutting);
return x; return x;
@ -649,8 +681,114 @@ class PlayerList
return "0"; 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; int x = 0;
if(isInt(wgather)){ if(isInt(wgather)){
@ -660,7 +798,7 @@ class PlayerList
wgather = String.valueOf(x); wgather = String.valueOf(x);
save(); save();
} }
public void removewgather(int newgather){ public void removeWoodCuttingGather(int newgather){
int x = 0; int x = 0;
if(isInt(wgather)){ if(isInt(wgather)){
x = Integer.parseInt(wgather); x = Integer.parseInt(wgather);
@ -669,7 +807,7 @@ class PlayerList
wgather = String.valueOf(x); wgather = String.valueOf(x);
save(); save();
} }
public void addgather(int newgather) public void addMiningGather(int newgather)
{ {
int x = 0; int x = 0;
if(isInt(gather)){ if(isInt(gather)){
@ -681,7 +819,7 @@ class PlayerList
gather = String.valueOf(x); gather = String.valueOf(x);
save(); save();
} }
public void removegather(int newgather){ public void removeMiningGather(int newgather){
int x = 0; int x = 0;
if(isInt(gather)){ if(isInt(gather)){
x = Integer.parseInt(gather); x = Integer.parseInt(gather);
@ -690,6 +828,78 @@ class PlayerList
gather = String.valueOf(x); gather = String.valueOf(x);
save(); 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){ public boolean isInt(String string){
try { try {
@ -718,19 +928,159 @@ class PlayerList
invite = invitename; invite = invitename;
} }
//Returns player gather //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 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)){ if(isInt(wgather)){
return Integer.parseInt(getwgather()); return Integer.parseInt(wgather);
} else { } else {
wgather = "0"; wgather = "0";
save(); save();
return 0; 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){ public void modifyskill(int newvalue, String skillname){
if(skillname.equals("mining")){ if(skillname.equals("mining")){
mining = String.valueOf(newvalue); mining = String.valueOf(newvalue);
@ -764,9 +1114,9 @@ class PlayerList
} }
save(); save();
} }
public int getgatheramt() { public int getMiningGatherInt() {
if(isInt(gather)){ if(isInt(gather)){
return Integer.parseInt(getgather()); return Integer.parseInt(gather);
} else { } else {
gather = "0"; gather = "0";
save(); save();

View File

@ -133,8 +133,16 @@ public class mcm {
mcm.getInstance().simulateNaturalDrops(defender); mcm.getInstance().simulateNaturalDrops(defender);
//XP //XP
if(Math.random() * 10 > 7){ if(Math.random() * 10 > 7){
mcUsers.getProfile(attacker).skillUpArchery(1); mcUsers.getProfile(attacker).addArcheryGather(1);
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by 1. Total ("+mcUsers.getProfile(attacker).getArchery()+")"); 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; return;
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
if(event.getDamage() >= 2 && event.getDamage() < 6){ mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage());
mcUsers.getProfile(player).skillUpAcrobatics(1); if(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= (mcUsers.getProfile(player).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier){
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 1. Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); int skillups = 0;
} while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= (mcUsers.getProfile(player).getAcrobaticsInt() +5) * mcLoadProperties.xpmodifier){
if(event.getDamage() >= 6 && event.getDamage() < 19){ skillups++;
mcUsers.getProfile(player).skillUpAcrobatics(2); mcUsers.getProfile(player).removeAcrobaticsGather((mcUsers.getProfile(player).getAcrobaticsInt() + 5) * mcLoadProperties.xpmodifier);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 2. Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); mcUsers.getProfile(player).skillUpAcrobatics(1);
} }
if(event.getDamage() >= 19){ player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
mcUsers.getProfile(player).skillUpAcrobatics(3);
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by 3. Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
} }
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z)); mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){ if(player.getHealth() - event.getDamage() <= 0){
@ -317,6 +322,7 @@ public class mcm {
return; return;
mcUsers.getProfile(player).setDead(true); mcUsers.getProfile(player).setDead(true);
} }
}
} }
public void simulateNaturalDrops(Entity entity){ public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation(); Location loc = entity.getLocation();
@ -558,39 +564,48 @@ public class mcm {
} }
public void miningBlockCheck(Player player, Block block){ public void miningBlockCheck(Player player, Block block){
if(block.getTypeId() == 1){ if(block.getTypeId() == 1){
mcUsers.getProfile(player).addgather(1); mcUsers.getProfile(player).addMiningGather(1);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//COAL //COAL
if(block.getTypeId() == 16){ if(block.getTypeId() == 16){
mcUsers.getProfile(player).addgather(3); mcUsers.getProfile(player).addMiningGather(3);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//GOLD //GOLD
if(block.getTypeId() == 14){ if(block.getTypeId() == 14){
mcUsers.getProfile(player).addgather(20); mcUsers.getProfile(player).addMiningGather(50);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//DIAMOND //DIAMOND
if(block.getTypeId() == 56){ if(block.getTypeId() == 56){
mcUsers.getProfile(player).addgather(50); mcUsers.getProfile(player).addMiningGather(50);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//IRON //IRON
if(block.getTypeId() == 15){ if(block.getTypeId() == 15){
mcUsers.getProfile(player).addgather(10); mcUsers.getProfile(player).addMiningGather(10);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//REDSTONE //REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){ if(block.getTypeId() == 73 || block.getTypeId() == 74){
mcUsers.getProfile(player).addgather(15); mcUsers.getProfile(player).addMiningGather(10);
mcm.getInstance().blockProcCheck(block, player); mcm.getInstance().blockProcCheck(block, player);
} }
//LAPUS //LAPUS
if(block.getTypeId() == 21){ if(block.getTypeId() == 21){
mcUsers.getProfile(player).addgather(50); mcUsers.getProfile(player).addMiningGather(20);
mcm.getInstance().blockProcCheck(block, player); 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){ public void breadCheck(Player player, ItemStack is){
if(is.getTypeId() == 297){ if(is.getTypeId() == 297){
@ -772,18 +787,30 @@ public class mcm {
if(x instanceof Squid){ if(x instanceof Squid){
Squid defender = (Squid)event.getEntity(); Squid defender = (Squid)event.getEntity();
if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ if(isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){
if(Math.random() * 10 > 9){ mcUsers.getProfile(attacker).addSwordsGather(1);
mcUsers.getProfile(attacker).skillUpSwords(1); if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier){
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")"); 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()) if(isAxes(attacker.getItemInHand())
&& defender.getHealth() > 0 && defender.getHealth() > 0
&& mcPermissions.getInstance().axes(attacker)){ && mcPermissions.getInstance().axes(attacker)){
if(Math.random() * 10 > 9){ mcUsers.getProfile(attacker).addAxesGather(1);
mcUsers.getProfile(attacker).skillUpAxes(1); if(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier){
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")"); 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(isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
@ -820,8 +847,16 @@ public class mcm {
//XP //XP
if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){ if(attacker.getItemInHand().getTypeId() == 0 && Math.random() * 10 > 8){
if(defender.getHealth() != 0){ if(defender.getHealth() != 0){
mcUsers.getProfile(attacker).skillUpUnarmed(1); mcUsers.getProfile(attacker).addUnarmedGather(1);
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); 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) if(defender.getHealth() <= 0)
@ -910,18 +945,30 @@ public class mcm {
if(isSwords(attacker.getItemInHand()) if(isSwords(attacker.getItemInHand())
&& defender.getHealth() > 0 && defender.getHealth() > 0
&& mcPermissions.getInstance().swords(attacker)){ && mcPermissions.getInstance().swords(attacker)){
if(Math.random() * 10 > 9){ mcUsers.getProfile(attacker).addSwordsGather(1);
mcUsers.getProfile(attacker).skillUpSwords(1); if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= (mcUsers.getProfile(attacker).getSwordsInt() + 5) * mcLoadProperties.xpmodifier){
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by 1. Total ("+mcUsers.getProfile(attacker).getSwords()+")"); 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()) if(isAxes(attacker.getItemInHand())
&& defender.getHealth() > 0 && defender.getHealth() > 0
&& mcPermissions.getInstance().axes(attacker)){ && mcPermissions.getInstance().axes(attacker)){
if(Math.random() * 10 > 9){ mcUsers.getProfile(attacker).addAxesGather(1);
mcUsers.getProfile(attacker).skillUpAxes(1); if(mcUsers.getProfile(attacker).getAxesGatherInt() >= (mcUsers.getProfile(attacker).getAxesInt() + 5) * mcLoadProperties.xpmodifier){
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by 1. Total ("+mcUsers.getProfile(attacker).getAxes()+")"); 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 * AXE DAMAGE SCALING && LOOT CHECKS
@ -956,29 +1003,15 @@ public class mcm {
defender.setHealth(calculateDamage(defender, 8)); defender.setHealth(calculateDamage(defender, 8));
} }
//XP //XP
if(x instanceof Skeleton && Math.random() * 100 > 95){ mcUsers.getProfile(attacker).addUnarmedGather(1);
if(defender.getHealth() != 0){ 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); mcUsers.getProfile(attacker).skillUpUnarmed(1);
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by 1. Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); }
} attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" 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()+")");
}
} }
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
mcm.getInstance().simulateNaturalDrops(defender); mcm.getInstance().simulateNaturalDrops(defender);
@ -1421,13 +1454,14 @@ public class mcm {
if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player)){ if(mcm.getInstance().isDiamondArmor(is) && mcm.getInstance().hasDiamond(player)){
mcm.getInstance().removeDiamond(player); mcm.getInstance().removeDiamond(player);
player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, player));
mcUsers.getProfile(player).skillUpRepair(1); mcUsers.getProfile(player).addRepairGather(20);
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")");
} else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){ } else if (mcm.getInstance().isIronArmor(is) && mcm.getInstance().hasIron(player)){
mcm.getInstance().removeIron(player); mcm.getInstance().removeIron(player);
player.getItemInHand().setDurability(mcm.getInstance().getArmorRepairAmount(is, 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 { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -1439,13 +1473,11 @@ public class mcm {
if(mcm.getInstance().isIronTools(is) && mcm.getInstance().hasIron(player)){ if(mcm.getInstance().isIronTools(is) && mcm.getInstance().hasIron(player)){
is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player)); is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player));
mcm.getInstance().removeIron(player); mcm.getInstance().removeIron(player);
mcUsers.getProfile(player).skillUpRepair(1); mcUsers.getProfile(player).addRepairGather(5);
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")");
} else if (mcm.getInstance().isDiamondTools(is) && mcm.getInstance().hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= 50){ //Check if its diamond and the player has diamonds } 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)); is.setDurability(mcm.getInstance().getToolRepairAmount(is, durability, player));
mcm.getInstance().removeDiamond(player); mcm.getInstance().removeDiamond(player);
mcUsers.getProfile(player).skillUpRepair(1); mcUsers.getProfile(player).addRepairGather(20);
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by 1. Total ("+mcUsers.getProfile(player).getRepair()+")");
} else { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -1455,7 +1487,19 @@ public class mcm {
player.sendMessage("That is at full durability."); player.sendMessage("That is at full durability.");
} }
player.updateInventory(); 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){ public void herbalismProcCheck(Block block, Player player){
int type = block.getTypeId(); int type = block.getTypeId();
@ -1464,21 +1508,18 @@ public class mcm {
Material mat = null; Material mat = null;
if(!mcConfig.getInstance().isBlockWatched(block)){ if(!mcConfig.getInstance().isBlockWatched(block)){
if(type == 39 || type == 40){ if(type == 39 || type == 40){
mcUsers.getProfile(player).skillUpHerbalism(3); mcUsers.getProfile(player).addHerbalismGather(20);
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 3. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
} }
if(type == 37 || type == 38){ if(type == 37 || type == 38){
if(Math.random() * 10 > 8){ if(Math.random() * 10 > 8){
mcUsers.getProfile(player).skillUpHerbalism(1); mcUsers.getProfile(player).addHerbalismGather(2);
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
} }
} }
if(type == 59 && block.getData() == (byte) 0x7){ if(type == 59 && block.getData() == (byte) 0x7){
mat = Material.getMaterial(296); mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(Math.random() * 100 > 80){ if(Math.random() * 100 > 80){
mcUsers.getProfile(player).skillUpHerbalism(1); mcUsers.getProfile(player).addHerbalismGather(3);
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by 1. Total ("+mcUsers.getProfile(player).getHerbalismInt()+")");
} }
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
if(Math.random() * 10 > 8) if(Math.random() * 10 > 8)
@ -1497,6 +1538,15 @@ public class mcm {
loc.getWorld().dropItemNaturally(loc, is); 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){ public void excavationProcCheck(Block block, Player player){
@ -1520,11 +1570,7 @@ public class mcm {
} }
//DIRT SAND OR GRAVEL //DIRT SAND OR GRAVEL
if(type == 3 || type == 13 || type == 2 || type == 12){ if(type == 3 || type == 13 || type == 2 || type == 12){
if(Math.random() * 100 > 95){ mcUsers.getProfile(player).addExcavationGather(1);
mcUsers.getProfile(player).skillUpExcavation(1);
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by 1. Total ("+mcUsers.getProfile(player).getExcavationInt()+")");
}
if(mcUsers.getProfile(player).getExcavationInt() > 750){ if(mcUsers.getProfile(player).getExcavationInt() > 750){
//CHANCE TO GET CAKE //CHANCE TO GET CAKE
if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){ if(mcLoadProperties.cake == true && Math.random() * 2000 > 1999){
@ -1613,49 +1659,48 @@ public class mcm {
loc.getWorld().dropItemNaturally(loc, is); 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){ public void woodCuttingProcCheck(Player player, Block block, Location loc){
byte type = block.getData(); byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0; byte damage = 0;
if(mcUsers.getProfile(player).getWoodCuttingint() > 1000){ if(mcUsers.getProfile(player).getWoodCuttingInt() > 1000){
ItemStack item = new ItemStack(mat, 1, type, damage); ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
return; return;
} }
if(mcUsers.getProfile(player).getWoodCuttingint() > 750){ if(mcUsers.getProfile(player).getWoodCuttingInt() > 750){
if((Math.random() * 10) > 2){ if((Math.random() * 10) > 2){
ItemStack item = new ItemStack(mat, 1, type, damage); ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
return; return;
} }
} }
if(mcUsers.getProfile(player).getWoodCuttingint() > 300){ if(mcUsers.getProfile(player).getWoodCuttingInt() > 300){
if((Math.random() * 10) > 4){ if((Math.random() * 10) > 4){
ItemStack item = new ItemStack(mat, 1, type, damage); ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
return; return;
} }
} }
if(mcUsers.getProfile(player).getWoodCuttingint() > 100){ if(mcUsers.getProfile(player).getWoodCuttingInt() > 100){
if((Math.random() * 10) > 6){ if((Math.random() * 10) > 6){
ItemStack item = new ItemStack(mat, 1, type, damage); ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
return; return;
} }
} }
if(mcUsers.getProfile(player).getWoodCuttingint() > 10){ if(mcUsers.getProfile(player).getWoodCuttingInt() > 10){
if((Math.random() * 10) > 8){ if((Math.random() * 10) > 8){
ItemStack item = new ItemStack(mat, 1, type, damage); ItemStack item = new ItemStack(mat, 1, type, damage);
loc.getWorld().dropItemNaturally(loc, item); 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 // IS TOOLS FUNCTION
public boolean isArmor(ItemStack is){ public boolean isArmor(ItemStack is){
if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || if(is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 ||

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.6.4 version: 0.7.1