0.9.25 - Herbalism Overhaul

This commit is contained in:
nossr50 2011-04-12 06:25:03 -07:00
parent 7090a772cb
commit 7d67e68cd6
23 changed files with 1186 additions and 609 deletions

View File

@ -1,5 +1,35 @@
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.9.25
Fixed issue with anti-exploits and Herbalism
MySpawn works like a hearthstone now, no inv pentality, 1hr cooldown
Added Green Terra Ability to Herbalism
Added Green Thumb ability to Herbalism
Fixed Repair not working for Iron Tools
Fixed bug where Axes Ability checked for Unarmed Ability Permission
Added Cocoa Beans to Excavation XP/Loot Tables, Found in Grass/Dirt
Using Super Breaker on Obsidian significantly damages it compared to other materials
Added Obsidian to Mining XP Table/Super Breaker
Added Pumpkins/Reeds/Cactus to Herbalism XP Tables/Double Drops
Corrected "mcMMMO" to "mcMMO" in MOTD
Version 0.9.24
PLAYER_BED_ENTER removed due to its unusual issues
Added info about the Wiki to the motd
/mcrefresh will reset if you were recently hurt (Chimaera Wing/HP Regen)
Fixed Armor Repair not adding XP
Boosted Repair XP of Armor to match Tools
Repairing Armor won't trigger Super Repair twice anymore
Setting your MySpawn now just requires right clicking a bed (still requires the setmyspawn permission node)
Version 0.9.23
Players will now announce ability usage within a short distance to nearby players
Chimaera Wing now takes the world into account
Acrobatics won't give XP on death, and will fail if you would've died after the damage reduction
Added yet another check to see if a Player is not in the Users system for NPC mod compatibility
Version 0.9.22 Version 0.9.22
Fixed bug where chimaera wing was unusable after being hurt even after the cooldown Fixed bug where chimaera wing was unusable after being hurt even after the cooldown

View File

@ -0,0 +1,26 @@
package com.gmail.nossr50;
import java.util.ArrayList;
import org.bukkit.entity.Player;
public class Tree {
TreeNode root;
public Tree(){}
public void add(Player p, int in )
{
if(root == null)
root = new TreeNode(p, in);
else
root.add(p,in);
}
public Player[] inOrder()
{
return (Player[]) root.inOrder(new ArrayList<Player>()).toArray();
}
}

View File

@ -0,0 +1,44 @@
package com.gmail.nossr50;
import java.util.ArrayList;
import org.bukkit.entity.Player;
public class TreeNode {
TreeNode left = null
, right = null;
Player player;
int stat;
public TreeNode(Player p, int in) {stat = in; player = p;}
public void add (Player p, int in) {
if (in <= stat)
{
if (left == null)
left = new TreeNode(p,in);
else
left.add(p, in);
}
else if(in > stat)
{
if (right == null)
right = new TreeNode(p,in);
else
right.add(p, in);
}
}
public ArrayList<Player> inOrder(ArrayList<Player> a)
{
if(left != null)
a = left.inOrder(a);
a.add(player);
if(right != null)
a = right.inOrder(a);
return a;
}
}

View File

@ -5,6 +5,8 @@ import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcAcrobatics { public class mcAcrobatics {
private static volatile mcAcrobatics instance; private static volatile mcAcrobatics instance;
@ -16,7 +18,8 @@ public class mcAcrobatics {
} }
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
if(player != null && mcPermissions.getInstance().acrobatics(player)){ if(player != null && mcPermissions.getInstance().acrobatics(player)){
int acrovar = mcUsers.getProfile(player).getAcrobaticsInt(); PlayerProfile PP = mcUsers.getProfile(player.getName());
int acrovar = PP.getAcrobaticsInt();
if(player.isSneaking()) if(player.isSneaking())
acrovar = acrovar * 2; acrovar = acrovar * 2;
if(Math.random() * 1000 <= acrovar){ if(Math.random() * 1000 <= acrovar){
@ -26,8 +29,12 @@ public class mcAcrobatics {
int newDamage = event.getDamage() - threshold; int newDamage = event.getDamage() - threshold;
if(newDamage < 0) if(newDamage < 0)
newDamage = 0; newDamage = 0;
/*
* Check for death
*/
if(player.getHealth() - newDamage >= 1){
if(!event.isCancelled()) if(!event.isCancelled())
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); PP.addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
event.setDamage(newDamage); event.setDamage(newDamage);
if(event.getDamage() <= 0) if(event.getDamage() <= 0)
@ -37,8 +44,9 @@ public class mcAcrobatics {
} else { } else {
player.sendMessage("**ROLL**"); player.sendMessage("**ROLL**");
} }
}
} else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){ } else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); PP.addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
} }
} }

View File

@ -43,13 +43,26 @@ public class mcBlockListener extends BlockListener {
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
Block block = event.getBlock(); Block block = event.getBlock();
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
if(event.isCancelled()) if(event.isCancelled())
return; return;
if (event instanceof FakeBlockBreakEvent) if (event instanceof FakeBlockBreakEvent)
return; return;
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
/*
* HERBALISM
*/
if(mcPermissions.getInstance().herbalismAbility(player)&& PP.getGreenTerraMode() && block.getTypeId() == 59 && block.getData() == (byte) 0x07){
mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
mcHerbalism.getInstance().greenTerraWheat(player, block, event);
}
/* /*
* MINING * MINING
@ -89,10 +102,6 @@ public class mcBlockListener extends BlockListener {
&& PP.getTreeFellerMode() && PP.getTreeFellerMode()
&& block.getTypeId() == 17 && block.getTypeId() == 17
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){ && mcm.getInstance().blockBreakSimulate(block, player, plugin)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
mcWoodCutting.getInstance().treeFeller(block, player); mcWoodCutting.getInstance().treeFeller(block, player);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){ for(Block blockx : mcConfig.getInstance().getTreeFeller()){
@ -132,8 +141,11 @@ public class mcBlockListener extends BlockListener {
/* /*
* HERBALISM * HERBALISM
*/ */
if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5) if(mcPermissions.getInstance().herbalism(player) && mcHerbalism.getInstance().canBeGreenTerra(block)){
mcHerbalism.getInstance().herbalismProcCheck(block, player); mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
if(block.getData() != (byte) 5)
mcHerbalism.getInstance().herbalismProcCheck(block, player, event);
}
//Change the byte back when broken //Change the byte back when broken
if(block.getData() == 5) if(block.getData() == 5)
block.setData((byte) 0); block.setData((byte) 0);
@ -142,20 +154,33 @@ public class mcBlockListener extends BlockListener {
if(event.isCancelled()) if(event.isCancelled())
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
Block block = event.getBlock(); Block block = event.getBlock();
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS
*/ */
if(PP.getHoePreparationMode() && mcHerbalism.getInstance().canBeGreenTerra(block))
mcHerbalism.getInstance().greenTerraCheck(player, block, plugin);
if(PP.getAxePreparationMode() && block.getTypeId() == 17) if(PP.getAxePreparationMode() && block.getTypeId() == 17)
mcWoodCutting.getInstance().treeFellerCheck(player, block); mcWoodCutting.getInstance().treeFellerCheck(player, block, plugin);
if(PP.getPickaxePreparationMode()) if(PP.getPickaxePreparationMode())
mcMining.getInstance().superBreakerCheck(player, block); mcMining.getInstance().superBreakerCheck(player, block, plugin);
if(PP.getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) if(PP.getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block); mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block, plugin);
if(PP.getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) if(PP.getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block))
mcSkills.getInstance().berserkActivationCheck(player); mcSkills.getInstance().berserkActivationCheck(player, plugin);
/*
* GREEN TERRA STUFF
*/
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()){
mcHerbalism.getInstance().greenTerra(player, block);
}
/* /*
* GIGA DRILL BREAKER CHECKS * GIGA DRILL BREAKER CHECKS
*/ */
@ -163,10 +188,6 @@ public class mcBlockListener extends BlockListener {
&& mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcm.getInstance().blockBreakSimulate(block, player, plugin)
&& mcExcavation.getInstance().canBeGigaDrillBroken(block) && mcExcavation.getInstance().canBeGigaDrillBroken(block)
&& mcm.getInstance().isShovel(inhand)){ && mcm.getInstance().isShovel(inhand)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
if(mcm.getInstance().getTier(player) >= 2) if(mcm.getInstance().getTier(player) >= 2)
mcExcavation.getInstance().excavationProcCheck(block, player); mcExcavation.getInstance().excavationProcCheck(block, player);
@ -191,10 +212,6 @@ public class mcBlockListener extends BlockListener {
&& mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcm.getInstance().blockBreakSimulate(block, player, plugin)
&& player.getItemInHand().getTypeId() == 0 && player.getItemInHand().getTypeId() == 0
&& mcExcavation.getInstance().canBeGigaDrillBroken(block)){ && mcExcavation.getInstance().canBeGigaDrillBroken(block)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2) if(block.getTypeId() == 2)
mat = Material.DIRT; mat = Material.DIRT;
@ -210,10 +227,6 @@ public class mcBlockListener extends BlockListener {
if(PP.getSuperBreakerMode() if(PP.getSuperBreakerMode()
&& mcMining.getInstance().canBeSuperBroken(block) && mcMining.getInstance().canBeSuperBroken(block)
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){ && mcm.getInstance().blockBreakSimulate(block, player, plugin)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
if(mcLoadProperties.miningrequirespickaxe){ if(mcLoadProperties.miningrequirespickaxe){
if(mcm.getInstance().isMiningPick(inhand)) if(mcm.getInstance().isMiningPick(inhand))

View File

@ -18,6 +18,8 @@ import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcCombat { public class mcCombat {
private static mcMMO plugin; private static mcMMO plugin;
@ -37,13 +39,16 @@ public class mcCombat {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
Player defender = (Player)x; Player defender = (Player)x;
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
/* /*
* COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...) * COMPATABILITY CHECKS (Stuff that wouldn't happen normally in MC basically...)
*/ */
if(mcUsers.getProfile(defender) == null) if(mcUsers.getProfile(defender.getName()) == null)
mcUsers.addUser(defender); mcUsers.addUser(defender);
if(attacker != null && defender != null && mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ if(attacker != null && defender != null && mcUsers.getProfile(attacker.getName()).inParty() && mcUsers.getProfile(defender.getName()).inParty()){
if(mcParty.getInstance().inSameParty(defender, attacker)){ if(mcParty.getInstance().inSameParty(defender, attacker)){
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -60,9 +65,9 @@ public class mcCombat {
//Bonus just for having unarmed //Bonus just for having unarmed
int bonus = 2; int bonus = 2;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) if (PPa.getUnarmedInt() >= 250)
bonus++; bonus++;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) if (PPa.getUnarmedInt() >= 500)
bonus++; bonus++;
event.setDamage(calculateDamage(event, bonus)); event.setDamage(calculateDamage(event, bonus));
@ -85,14 +90,14 @@ public class mcCombat {
* PVP XP * PVP XP
*/ */
if(attacker != null && defender != null && mcLoadProperties.pvpxp){ if(attacker != null && defender != null && mcLoadProperties.pvpxp){
if(mcUsers.getProfile(defender).inParty() && mcUsers.getProfile(attacker).inParty() && mcParty.getInstance().inSameParty(attacker, defender)) if(PPd.inParty() && PPa.inParty() && mcParty.getInstance().inSameParty(attacker, defender))
return; return;
if(mcm.getInstance().isAxes(attacker.getItemInHand())) if(mcm.getInstance().isAxes(attacker.getItemInHand()))
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
if(mcm.getInstance().isSwords(attacker.getItemInHand())) if(mcm.getInstance().isSwords(attacker.getItemInHand()))
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
if(attacker.getItemInHand().getTypeId() == 0) if(attacker.getItemInHand().getTypeId() == 0)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
} }
/* /*
* CHECK FOR LEVEL UPS * CHECK FOR LEVEL UPS
@ -101,23 +106,24 @@ public class mcCombat {
} }
} }
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(x instanceof Squid){ if(x instanceof Squid){
if(!mcConfig.getInstance().isBleedTracked(x)){ if(!mcConfig.getInstance().isBleedTracked(x)){
bleedCheck(attacker, x); bleedCheck(attacker, x);
} }
Squid defender = (Squid)event.getEntity(); Squid defender = (Squid)event.getEntity();
if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){ if(mcm.getInstance().isSwords(attacker.getItemInHand()) && defender.getHealth() > 0 && mcPermissions.getInstance().swords(attacker)){
mcUsers.getProfile(attacker).addSwordsGather(10 * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather(10 * mcLoadProperties.xpGainMultiplier);
} }
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
if(mcm.getInstance().isAxes(attacker.getItemInHand()) if(mcm.getInstance().isAxes(attacker.getItemInHand())
&& defender.getHealth() > 0 && defender.getHealth() > 0
&& mcPermissions.getInstance().axes(attacker)){ && mcPermissions.getInstance().axes(attacker)){
mcUsers.getProfile(attacker).addAxesGather(10 * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather(10 * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
} }
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(PPa.getAxesInt() >= 500){
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
} }
} }
@ -130,21 +136,22 @@ public class mcCombat {
//Bonus just for having unarmed //Bonus just for having unarmed
int bonus = 2; int bonus = 2;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) if (PPa.getUnarmedInt() >= 250)
bonus++; bonus++;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) if (PPa.getUnarmedInt() >= 500)
bonus++; bonus++;
event.setDamage(calculateDamage(event, bonus)); event.setDamage(calculateDamage(event, bonus));
//XP //XP
if(defender.getHealth() != 0){ if(defender.getHealth() != 0){
mcUsers.getProfile(attacker).addUnarmedGather(10 * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather(10 * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
} }
} }
} }
} }
public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){ public void playerVersusAnimalsChecks(Entity x, Player attacker, EntityDamageByEntityEvent event, int type){
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(x instanceof Animals){ if(x instanceof Animals){
if(!mcConfig.getInstance().isBleedTracked(x)){ if(!mcConfig.getInstance().isBleedTracked(x)){
bleedCheck(attacker, x); bleedCheck(attacker, x);
@ -153,22 +160,23 @@ public class mcCombat {
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(PPa.getAxesInt() >= 500){
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
} }
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
//Bonus just for having unarmed //Bonus just for having unarmed
int bonus = 2; int bonus = 2;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) if (PPa.getUnarmedInt() >= 250)
bonus++; bonus++;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) if (PPa.getUnarmedInt() >= 500)
bonus++; bonus++;
event.setDamage(calculateDamage(event, bonus)); event.setDamage(calculateDamage(event, bonus));
} }
} }
} }
public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ public void playerVersusMonsterChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(x instanceof Monster){ if(x instanceof Monster){
/* /*
* AXE PROC CHECKS * AXE PROC CHECKS
@ -183,15 +191,15 @@ public class mcCombat {
&& mcPermissions.getInstance().swords(attacker)){ && mcPermissions.getInstance().swords(attacker)){
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
if(x instanceof Creeper) if(x instanceof Creeper)
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Spider) if(x instanceof Spider)
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Skeleton) if(x instanceof Skeleton)
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Zombie) if(x instanceof Zombie)
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addSwordsGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
} }
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
} }
@ -200,15 +208,15 @@ public class mcCombat {
&& mcPermissions.getInstance().axes(attacker)){ && mcPermissions.getInstance().axes(attacker)){
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
if(x instanceof Creeper) if(x instanceof Creeper)
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Spider) if(x instanceof Spider)
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Skeleton) if(x instanceof Skeleton)
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Zombie) if(x instanceof Zombie)
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addAxesGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
} }
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
} }
@ -216,7 +224,7 @@ public class mcCombat {
* AXE DAMAGE SCALING && LOOT CHECKS * AXE DAMAGE SCALING && LOOT CHECKS
*/ */
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(PPa.getAxesInt() >= 500){
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
} }
} }
@ -226,24 +234,24 @@ public class mcCombat {
//Bonus just for having unarmed //Bonus just for having unarmed
int bonus = 2; int bonus = 2;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) if (PPa.getUnarmedInt() >= 250)
bonus++; bonus++;
if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) if (PPa.getUnarmedInt() >= 500)
bonus++; bonus++;
event.setDamage(calculateDamage(event, bonus)); event.setDamage(calculateDamage(event, bonus));
//XP //XP
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
if(x instanceof Creeper) if(x instanceof Creeper)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Spider) if(x instanceof Spider)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Skeleton) if(x instanceof Skeleton)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Zombie) if(x instanceof Zombie)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addUnarmedGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
} }
mcSkills.getInstance().XpCheck(attacker); mcSkills.getInstance().XpCheck(attacker);
} }
@ -254,16 +262,17 @@ public class mcCombat {
Entity x = event.getEntity(); Entity x = event.getEntity();
if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){ if(event.getProjectile().toString().equals("CraftArrow") && x instanceof Player){
Player defender = (Player)x; Player defender = (Player)x;
if(mcUsers.getProfile(defender) == null) PlayerProfile PPd = mcUsers.getProfile(defender.getName());
if(PPd == null)
mcUsers.addUser(defender); mcUsers.addUser(defender);
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){ if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){
if(defender != null && mcUsers.getProfile(defender).getUnarmedInt() >= 1000){ if(defender != null && PPd.getUnarmedInt() >= 1000){
if(Math.random() * 1000 <= 500){ if(Math.random() * 1000 <= 500){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return; return;
} }
} else if(defender != null && Math.random() * 1000 <= (mcUsers.getProfile(defender).getUnarmedInt() / 2)){ } else if(defender != null && Math.random() * 1000 <= (PPd.getUnarmedInt() / 2)){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**"); defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return; return;
@ -275,18 +284,19 @@ public class mcCombat {
*/ */
if(y instanceof Player){ if(y instanceof Player){
Player attacker = (Player)y; Player attacker = (Player)y;
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){ if(event.getProjectile().toString().equals("CraftArrow") && mcPermissions.getInstance().archery(attacker)){
if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){ if(!mcConfig.getInstance().isTracked(x) && event.getDamage() > 0){
mcConfig.getInstance().addArrowTrack(x, 0); mcConfig.getInstance().addArrowTrack(x, 0);
if(attacker != null){ if(attacker != null){
if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getArcheryInt()){ if(Math.random() * 1000 <= PPa.getArcheryInt()){
mcConfig.getInstance().addArrowCount(x, 1); mcConfig.getInstance().addArrowCount(x, 1);
} }
} }
} else { } else {
if(event.getDamage() > 0){ if(event.getDamage() > 0){
if(attacker != null){ if(attacker != null){
if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getArcheryInt()){ if(Math.random() * 1000 <= PPa.getArcheryInt()){
mcConfig.getInstance().addArrowCount(x, 1); mcConfig.getInstance().addArrowCount(x, 1);
} }
} }
@ -298,15 +308,15 @@ public class mcCombat {
if(Math.random() * 100 >= 75){ if(Math.random() * 100 >= 75){
int ignition = 20; int ignition = 20;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 200) if(PPa.getArcheryInt() >= 200)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 400) if(PPa.getArcheryInt() >= 400)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 600) if(PPa.getArcheryInt() >= 600)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 800) if(PPa.getArcheryInt() >= 800)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(PPa.getArcheryInt() >= 1000)
ignition+=20; ignition+=20;
if(x instanceof Player){ if(x instanceof Player){
@ -328,58 +338,58 @@ public class mcCombat {
/* /*
* TRACK ARROWS USED AGAINST THE ENTITY * TRACK ARROWS USED AGAINST THE ENTITY
*/ */
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575)
event.setDamage(calculateDamage(event, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725)
event.setDamage(calculateDamage(event, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000)
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(PPa.getArcheryInt() >= 1000)
event.setDamage(calculateDamage(event, 5)); event.setDamage(calculateDamage(event, 5));
//XP //XP
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
if(x instanceof Creeper) if(x instanceof Creeper)
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier); PPa.addArcheryGather((event.getDamage() * 4) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Spider) if(x instanceof Spider)
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Skeleton) if(x instanceof Skeleton)
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof Zombie) if(x instanceof Zombie)
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier); PPa.addArcheryGather((event.getDamage() * 2) * mcLoadProperties.xpGainMultiplier);
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier); PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.xpGainMultiplier);
} }
} }
/* /*
* Defender is Animals * Defender is Animals
*/ */
if(x instanceof Animals){ if(x instanceof Animals){
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575)
event.setDamage(calculateDamage(event, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725)
event.setDamage(calculateDamage(event, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000)
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(PPa.getArcheryInt() >= 1000)
event.setDamage(calculateDamage(event, 5)); event.setDamage(calculateDamage(event, 5));
} }
/* /*
* Defender is Squid * Defender is Squid
*/ */
if(x instanceof Squid){ if(x instanceof Squid){
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575)
event.setDamage(calculateDamage(event, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725)
event.setDamage(calculateDamage(event, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000)
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(PPa.getArcheryInt() >= 1000)
event.setDamage(calculateDamage(event, 5)); event.setDamage(calculateDamage(event, 5));
} }
/* /*
@ -391,10 +401,11 @@ public class mcCombat {
return; return;
} }
Player defender = (Player)x; Player defender = (Player)x;
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
/* /*
* Stuff for the daze proc * Stuff for the daze proc
*/ */
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ if(PPa.inParty() && PPd.inParty()){
if(mcParty.getInstance().inSameParty(defender, attacker)){ if(mcParty.getInstance().inSameParty(defender, attacker)){
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -404,7 +415,7 @@ public class mcCombat {
* PVP XP * PVP XP
*/ */
if(mcLoadProperties.pvpxp && !mcParty.getInstance().inSameParty(attacker, defender)){ if(mcLoadProperties.pvpxp && !mcParty.getInstance().inSameParty(attacker, defender)){
mcUsers.getProfile(attacker).addArcheryGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier); PPa.addArcheryGather((event.getDamage() * 3) * mcLoadProperties.pvpxprewardmodifier);
} }
/* /*
* DAZE PROC * DAZE PROC
@ -415,27 +426,27 @@ public class mcCombat {
} else { } else {
loc.setPitch(-90); loc.setPitch(-90);
} }
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000){ if(PPa.getArcheryInt() >= 1000){
if(Math.random() * 1000 <= 500){ if(Math.random() * 1000 <= 500){
defender.teleportTo(loc); defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
} }
} else if(Math.random() * 2000 <= mcUsers.getProfile(attacker).getArcheryInt()){ } else if(Math.random() * 2000 <= PPa.getArcheryInt()){
defender.teleportTo(loc); defender.teleportTo(loc);
defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy."); defender.sendMessage(ChatColor.DARK_RED+"Touched Fuzzy. Felt Dizzy.");
attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed"); attacker.sendMessage("Target was "+ChatColor.DARK_RED+"Dazed");
} }
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(PPa.getArcheryInt() >= 50 && PPa.getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(PPa.getArcheryInt() >= 250 && PPa.getArcheryInt() < 575)
event.setDamage(calculateDamage(event, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(PPa.getArcheryInt() >= 575 && PPa.getArcheryInt() < 725)
event.setDamage(calculateDamage(event, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(PPa.getArcheryInt() >= 725 && PPa.getArcheryInt() < 1000)
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(PPa.getArcheryInt() >= 1000)
event.setDamage(calculateDamage(event, 5)); event.setDamage(calculateDamage(event, 5));
} }
} }
@ -443,35 +454,37 @@ public class mcCombat {
} }
} }
public boolean simulateUnarmedProc(Player player){ public boolean simulateUnarmedProc(Player player){
if(mcUsers.getProfile(player).getUnarmedInt() >= 1000){ PlayerProfile PP = mcUsers.getProfile(player.getName());
if(PP.getUnarmedInt() >= 1000){
if(Math.random() * 4000 <= 1000){ if(Math.random() * 4000 <= 1000){
return true; return true;
} }
} else { } else {
if(Math.random() * 4000 <= mcUsers.getProfile(player).getUnarmedInt()){ if(Math.random() * 4000 <= PP.getUnarmedInt()){
return true; return true;
} }
} }
return false; return false;
} }
public void bleedCheck(Player attacker, Entity x){ public void bleedCheck(Player attacker, Entity x){
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand())){ if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand())){
if(mcUsers.getProfile(attacker).getSwordsInt() >= 750){ if(PPa.getSwordsInt() >= 750){
if(Math.random() * 1000 >= 750){ if(Math.random() * 1000 >= 750){
if(!(x instanceof Player)) if(!(x instanceof Player))
mcConfig.getInstance().addToBleedQue(x); mcConfig.getInstance().addToBleedQue(x);
if(x instanceof Player){ if(x instanceof Player){
Player target = (Player)x; Player target = (Player)x;
mcUsers.getProfile(target).addBleedTicks(3); mcUsers.getProfile(target.getName()).addBleedTicks(3);
} }
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
} }
} else if (Math.random() * 1000 <= mcUsers.getProfile(attacker).getSwordsInt()){ } else if (Math.random() * 1000 <= PPa.getSwordsInt()){
if(!(x instanceof Player)) if(!(x instanceof Player))
mcConfig.getInstance().addToBleedQue(x); mcConfig.getInstance().addToBleedQue(x);
if(x instanceof Player){ if(x instanceof Player){
Player target = (Player)x; Player target = (Player)x;
mcUsers.getProfile(target).addBleedTicks(2); mcUsers.getProfile(target.getName()).addBleedTicks(2);
} }
attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**"); attacker.sendMessage(ChatColor.GREEN+"**ENEMY BLEEDING**");
} }
@ -534,7 +547,7 @@ public class mcCombat {
if(!target.getName().equals(attacker.getName()) && targets >= 1){ if(!target.getName().equals(attacker.getName()) && targets >= 1){
target.damage(event.getDamage() / 4); target.damage(event.getDamage() / 4);
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!"); target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
mcUsers.getProfile(target).addBleedTicks(5); mcUsers.getProfile(target.getName()).addBleedTicks(5);
targets--; targets--;
} }
} }
@ -560,8 +573,9 @@ public class mcCombat {
} }
} }
public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){ public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 750){ if(PPa.getAxesInt() >= 750){
if(Math.random() * 1000 <= 750){ if(Math.random() * 1000 <= 750){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
@ -574,7 +588,7 @@ public class mcCombat {
} }
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} else if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getAxesInt()){ } else if(Math.random() * 1000 <= PPa.getAxesInt()){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
@ -589,9 +603,10 @@ public class mcCombat {
} }
} }
public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){ public void parryCheck(Player defender, EntityDamageByEntityEvent event, Entity y){
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
if(defender != null && mcm.getInstance().isSwords(defender.getItemInHand()) if(defender != null && mcm.getInstance().isSwords(defender.getItemInHand())
&& mcPermissions.getInstance().swords(defender)){ && mcPermissions.getInstance().swords(defender)){
if(mcUsers.getProfile(defender).getSwordsInt() >= 900){ if(PPd.getSwordsInt() >= 900){
if(Math.random() * 3000 <= 900){ if(Math.random() * 3000 <= 900){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.GREEN+"**PARRIED**"); defender.sendMessage(ChatColor.GREEN+"**PARRIED**");
@ -602,7 +617,7 @@ public class mcCombat {
} }
} }
} else { } else {
if(Math.random() * 3000 <= mcUsers.getProfile(defender).getSwordsInt()){ if(Math.random() * 3000 <= PPd.getSwordsInt()){
event.setCancelled(true); event.setCancelled(true);
defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*"); defender.sendMessage(ChatColor.YELLOW+"*CLANG* SUCCESSFUL PARRY *CLANG*");
defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1)); defender.getItemInHand().setDurability((short) (defender.getItemInHand().getDurability() + 1));

View File

@ -5,12 +5,9 @@ import net.minecraft.server.EntityLiving;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
@ -19,7 +16,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityListener;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcEntityListener extends EntityListener { public class mcEntityListener extends EntityListener {
@ -84,8 +81,11 @@ public class mcEntityListener extends EntityListener {
*/ */
if(e instanceof Player){ if(e instanceof Player){
Player defender = (Player)e; Player defender = (Player)e;
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName())) if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
event.setCancelled(true); event.setCancelled(true);
if(PPd == null)
mcUsers.addUser(defender);
/* /*
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT * PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
*/ */
@ -113,19 +113,25 @@ public class mcEntityListener extends EntityListener {
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!"); //((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
int typeid = ((Player) f).getItemInHand().getTypeId(); int typeid = ((Player) f).getItemInHand().getTypeId();
Player attacker = (Player)f; Player attacker = (Player)f;
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(attacker);
PlayerProfile PPa = mcUsers.getProfile(attacker.getName());
/* /*
* ACTIVATE ABILITIES * ACTIVATE ABILITIES
*/ */
if(mcUsers.getProfile(attacker).getAxePreparationMode()) if(PPa.getAxePreparationMode())
mcSkills.getInstance().skullSplitterCheck(attacker); mcSkills.getInstance().skullSplitterCheck(attacker, plugin);
if(mcUsers.getProfile(attacker).getSwordsPreparationMode()) if(PPa.getSwordsPreparationMode())
mcSkills.getInstance().serratedStrikesActivationCheck(attacker); mcSkills.getInstance().serratedStrikesActivationCheck(attacker, plugin);
if(mcUsers.getProfile(attacker).getFistsPreparationMode()) if(PPa.getFistsPreparationMode())
mcSkills.getInstance().berserkActivationCheck(attacker); mcSkills.getInstance().berserkActivationCheck(attacker, plugin);
/* /*
* BERSERK DAMAGE MODIFIER * BERSERK DAMAGE MODIFIER
*/ */
if(mcUsers.getProfile(attacker).getBerserkMode()) if(PPa.getBerserkMode())
event.setDamage(event.getDamage() + (event.getDamage() / 2)); event.setDamage(event.getDamage() + (event.getDamage() / 2));
/* /*
* Player versus Monster checks, this handles all skill damage modifiers and any procs. * Player versus Monster checks, this handles all skill damage modifiers and any procs.
@ -148,18 +154,10 @@ public class mcEntityListener extends EntityListener {
* This will do AOE damage from the axes ability * This will do AOE damage from the axes ability
*/ */
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){ if(!event.isCancelled() && PPa.getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(attacker);
mcCombat.getInstance().applyAoeDamage(attacker, eventb, x); mcCombat.getInstance().applyAoeDamage(attacker, eventb, x);
} }
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){ if(!event.isCancelled() && PPa.getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(attacker);
mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x); mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x);
} }
} }
@ -168,6 +166,7 @@ public class mcEntityListener extends EntityListener {
*/ */
if(e instanceof Player){ if(e instanceof Player){
Player defender = (Player)e; Player defender = (Player)e;
PlayerProfile PPd = mcUsers.getProfile(defender.getName());
if(f instanceof Player){ if(f instanceof Player){
Player attacker = (Player)f; Player attacker = (Player)f;
if(mcParty.getInstance().inSameParty(defender, attacker)){ if(mcParty.getInstance().inSameParty(defender, attacker)){
@ -188,14 +187,14 @@ public class mcEntityListener extends EntityListener {
} }
if(isArrow == false){ if(isArrow == false){
//defender.sendMessage("isArrow ="+isArrow); //defender.sendMessage("isArrow ="+isArrow);
if(mcUsers.getProfile(defender).getSwordsInt() >= 600){ if(PPd.getSwordsInt() >= 600){
if(Math.random() * 2000 <= 600){ if(Math.random() * 2000 <= 600){
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2); mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**"); defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
if(f instanceof Player) if(f instanceof Player)
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!"); ((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
} }
} else if (Math.random() * 2000 <= mcUsers.getProfile(defender).getSwordsInt()){ } else if (Math.random() * 2000 <= PPd.getSwordsInt()){
mcCombat.getInstance().dealDamage(f, event.getDamage() / 2); mcCombat.getInstance().dealDamage(f, event.getDamage() / 2);
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**"); defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
if(f instanceof Player) if(f instanceof Player)
@ -207,10 +206,10 @@ public class mcEntityListener extends EntityListener {
* DODGE STUFF * DODGE STUFF
*/ */
if(mcPermissions.getInstance().acrobatics(defender)){ if(mcPermissions.getInstance().acrobatics(defender)){
if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){ if(PPd.getAcrobaticsInt() <= 800){
if(Math.random() * 4000 <= mcUsers.getProfile(defender).getAcrobaticsInt()){ if(Math.random() * 4000 <= PPd.getAcrobaticsInt()){
defender.sendMessage(ChatColor.GREEN+"**DODGE**"); defender.sendMessage(ChatColor.GREEN+"**DODGE**");
mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); PPd.addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender); mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2); event.setDamage(event.getDamage() / 2);
//Needs to do minimal damage //Needs to do minimal damage
@ -219,7 +218,7 @@ public class mcEntityListener extends EntityListener {
} }
} else if(Math.random() * 4000 <= 800) { } else if(Math.random() * 4000 <= 800) {
defender.sendMessage(ChatColor.GREEN+"**DODGE**"); defender.sendMessage(ChatColor.GREEN+"**DODGE**");
mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); PPd.addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender); mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2); event.setDamage(event.getDamage() / 2);
//Needs to do minimal damage //Needs to do minimal damage
@ -235,7 +234,7 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Player && !event.isCancelled()){ if(x instanceof Player && !event.isCancelled()){
Player herpderp = (Player)x; Player herpderp = (Player)x;
mcUsers.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis()); mcUsers.getProfile(herpderp.getName()).setRecentlyHurt(System.currentTimeMillis());
} }
} }
} }
@ -255,7 +254,7 @@ public class mcEntityListener extends EntityListener {
} }
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
mcUsers.getProfile(player).setBleedTicks(0); mcUsers.getProfile(player.getName()).setBleedTicks(0);
} }
} }
public boolean isPlayer(Entity entity){ public boolean isPlayer(Entity entity){

View File

@ -6,6 +6,9 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcExcavation { public class mcExcavation {
@ -20,27 +23,32 @@ public class mcExcavation {
} }
return instance; return instance;
} }
public void gigaDrillBreakerActivationCheck(Player player, Block block){ public void gigaDrillBreakerActivationCheck(Player player, Block block, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isShovel(player.getItemInHand())){ if(mcm.getInstance().isShovel(player.getItemInHand())){
if(block != null){ if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block)) if(!mcm.getInstance().abilityBlockCheck(block))
return; return;
} }
if(mcUsers.getProfile(player).getShovelPreparationMode()){ if(PP.getShovelPreparationMode()){
mcUsers.getProfile(player).setShovelPreparationMode(false); PP.setShovelPreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getExcavationInt(); int x = PP.getExcavationInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
} }
if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**");
mcUsers.getProfile(player).setGigaDrillBreakerTicks(ticks * 1000); for(Player y : pluginx.getServer().getOnlinePlayers()){
mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
mcUsers.getProfile(player).setGigaDrillBreakerMode(true); y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Giga Drill Breaker!");
}
PP.setGigaDrillBreakerTicks(ticks * 1000);
PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis());
PP.setGigaDrillBreakerMode(true);
} }
} }
@ -54,6 +62,7 @@ public class mcExcavation {
} }
} }
public void excavationProcCheck(Block block, Player player){ public void excavationProcCheck(Block block, Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
int type = block.getTypeId(); int type = block.getTypeId();
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = null; ItemStack is = null;
@ -62,17 +71,17 @@ public class mcExcavation {
return; return;
} }
if(type == 2){ if(type == 2){
if(mcUsers.getProfile(player).getExcavationInt() > 250){ if(PP.getExcavationInt() > 250){
//CHANCE TO GET EGGS //CHANCE TO GET EGGS
if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){ if(mcLoadProperties.eggs == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(344); mat = Material.getMaterial(344);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
//CHANCE TO GET APPLES //CHANCE TO GET APPLES
if(mcLoadProperties.apples == true && Math.random() * 100 > 99){ if(mcLoadProperties.apples == true && Math.random() * 100 > 99){
mcUsers.getProfile(player).addExcavationGather(10 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(260); mat = Material.getMaterial(260);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
@ -81,39 +90,39 @@ public class mcExcavation {
} }
//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){
mcUsers.getProfile(player).addExcavationGather(4 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(4 * mcLoadProperties.xpGainMultiplier);
if(mcUsers.getProfile(player).getExcavationInt() > 750){ if(PP.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){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(354); mat = Material.getMaterial(354);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
if(mcUsers.getProfile(player).getExcavationInt() > 350){ if(PP.getExcavationInt() > 350){
//CHANCE TO GET DIAMOND //CHANCE TO GET DIAMOND
if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){ if(mcLoadProperties.diamond == true && Math.random() * 750 > 749){
mcUsers.getProfile(player).addExcavationGather(100 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(100 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(264); mat = Material.getMaterial(264);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
if(mcUsers.getProfile(player).getExcavationInt() > 250){ if(PP.getExcavationInt() > 250){
//CHANCE TO GET YELLOW MUSIC //CHANCE TO GET YELLOW MUSIC
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(2256); mat = Material.getMaterial(2256);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
if(mcUsers.getProfile(player).getExcavationInt() > 350){ if(PP.getExcavationInt() > 350){
//CHANCE TO GET GREEN MUSIC //CHANCE TO GET GREEN MUSIC
if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){ if(mcLoadProperties.music == true && Math.random() * 2000 > 1999){
mcUsers.getProfile(player).addExcavationGather(300 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(300 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(2257); mat = Material.getMaterial(2257);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
@ -123,15 +132,15 @@ public class mcExcavation {
//SAND //SAND
if(type == 12){ if(type == 12){
//CHANCE TO GET GLOWSTONE //CHANCE TO GET GLOWSTONE
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 50 && Math.random() * 100 > 95){ if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 50 && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(348); mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
//CHANCE TO GET SLOWSAND //CHANCE TO GET SLOWSAND
if(mcLoadProperties.slowsand == true && mcUsers.getProfile(player).getExcavationInt() > 650 && Math.random() * 200 > 199){ if(mcLoadProperties.slowsand == true && PP.getExcavationInt() > 650 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(88); mat = Material.getMaterial(88);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
@ -139,9 +148,19 @@ public class mcExcavation {
} }
//GRASS OR DIRT //GRASS OR DIRT
if(type == 2 || type == 3){ if(type == 2 || type == 3){
if(PP.getExcavationInt() > 50){
//CHANCE FOR COCOA BEANS
if(mcLoadProperties.eggs == true && Math.random() * 75 > 74){
PP.addExcavationGather(10 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(351);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
is.setDurability((byte) 3); //COCOA
loc.getWorld().dropItemNaturally(loc, is);
}
}
//CHANCE FOR SHROOMS //CHANCE FOR SHROOMS
if(mcLoadProperties.mushrooms == true && mcUsers.getProfile(player).getExcavationInt() > 500 && Math.random() * 200 > 199){ if(mcLoadProperties.mushrooms == true && PP.getExcavationInt() > 500 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
if(Math.random() * 10 > 5){ if(Math.random() * 10 > 5){
mat = Material.getMaterial(39); mat = Material.getMaterial(39);
} else { } else {
@ -151,8 +170,8 @@ public class mcExcavation {
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
//CHANCE TO GET GLOWSTONE //CHANCE TO GET GLOWSTONE
if(mcLoadProperties.glowstone == true && mcUsers.getProfile(player).getExcavationInt() > 25 && Math.random() * 100 > 95){ if(mcLoadProperties.glowstone == true && PP.getExcavationInt() > 25 && Math.random() * 100 > 95){
mcUsers.getProfile(player).addExcavationGather(8 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(8 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(348); mat = Material.getMaterial(348);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
@ -161,25 +180,25 @@ public class mcExcavation {
//GRAVEL //GRAVEL
if(type == 13){ if(type == 13){
//CHANCE TO GET NETHERRACK //CHANCE TO GET NETHERRACK
if(mcLoadProperties.netherrack == true && mcUsers.getProfile(player).getExcavationInt() > 850 && Math.random() * 200 > 199){ if(mcLoadProperties.netherrack == true && PP.getExcavationInt() > 850 && Math.random() * 200 > 199){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(87); mat = Material.getMaterial(87);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
//CHANCE TO GET SULPHUR //CHANCE TO GET SULPHUR
if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){ if(mcLoadProperties.sulphur == true && PP.getExcavationInt() > 75){
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(289); mat = Material.getMaterial(289);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
//CHANCE TO GET BONES //CHANCE TO GET BONES
if(mcLoadProperties.bones == true && mcUsers.getProfile(player).getExcavationInt() > 175){ if(mcLoadProperties.bones == true && PP.getExcavationInt() > 175){
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3 * mcLoadProperties.xpGainMultiplier); PP.addExcavationGather(3 * mcLoadProperties.xpGainMultiplier);
mat = Material.getMaterial(352); mat = Material.getMaterial(352);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);

View File

@ -3,9 +3,14 @@ package com.gmail.nossr50;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcHerbalism { public class mcHerbalism {
@ -20,7 +25,94 @@ public class mcHerbalism {
} }
return instance; return instance;
} }
public void herbalismProcCheck(Block block, Player player){ public void greenTerraWheat(Player player, Block block, BlockBreakEvent event){
event.setCancelled(true);
PlayerProfile PP = mcUsers.getProfile(player.getName());
Material mat = Material.getMaterial(296);
Location loc = block.getLocation();
ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier);
loc.getWorld().dropItemNaturally(loc, is);
herbalismProcCheck(block, player, event);
herbalismProcCheck(block, player, event);
block.setData((byte) 0x03);
}
public void greenTerra(Player player, Block block){
if(!hasSeeds(player) && block.getType() != Material.WHEAT)
player.sendMessage("You need more seeds to spread Green Terra");
if(hasSeeds(player) && block.getType() != Material.WHEAT){
removeSeeds(player);
if(block.getType() == Material.DIRT)
block.setType(Material.GRASS);
if(block.getType() == Material.COBBLESTONE)
block.setType(Material.MOSSY_COBBLESTONE);
}
}
public Boolean canBeGreenTerra(Block block){
int t = block.getTypeId();
if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){
return true;
} else {
return false;
}
}
public boolean hasSeeds(Player player){
ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){
if(x != null && x.getTypeId() == 295){
return true;
}
}
return false;
}
public void removeSeeds(Player player){
ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){
if(x != null && x.getTypeId() == 295){
if(x.getAmount() == 1){
x.setTypeId(0);
x.setAmount(0);
player.getInventory().setContents(inventory);
} else{
x.setAmount(x.getAmount() - 1);
player.getInventory().setContents(inventory);
}
return;
}
}
}
public void greenTerraCheck(Player player, Block block, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isHoe(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
if(PP.getHoePreparationMode()){
PP.setHoePreparationMode(false);
}
int ticks = 2;
int x = PP.getHerbalismInt();
while(x >= 50){
x-=50;
ticks++;
}
if(!PP.getGreenTerraMode() && PP.getGreenTerraCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**GREEN TERRA ACTIVATED**");
for(Player y : pluginx.getServer().getOnlinePlayers()){
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Green Terra!");
}
PP.setGreenTerraTicks(ticks * 1000);
PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis());
PP.setGreenTerraMode(true);
}
}
}
public void herbalismProcCheck(Block block, Player player, BlockBreakEvent event){
PlayerProfile PP = mcUsers.getProfile(player.getName());
int type = block.getTypeId(); int type = block.getTypeId();
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = null; ItemStack is = null;
@ -32,80 +124,139 @@ public class mcHerbalism {
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);
mcUsers.getProfile(player).addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier); PP.addHerbalismGather(5 * mcLoadProperties.xpGainMultiplier);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){ if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
//GREEN THUMB
if(Math.random() * 1500 <= PP.getHerbalismInt()){
event.setCancelled(true);
loc.getWorld().dropItemNaturally(loc, is);
//block.setType(Material.WHEAT); //Change broken block to wheat
block.setData((byte) 0x1); //Change it to first stage
//Setup the bonuses
int bonus = 0;
if(PP.getHerbalismInt() >= 200)
bonus++;
if(PP.getHerbalismInt() >= 400)
bonus++;
if(PP.getHerbalismInt() >= 600)
bonus++;
//Change wheat to be whatever stage based on the bonus
if(bonus == 1)
block.setData((byte) 0x2);
if(bonus == 2)
block.setData((byte) 0x3);
if(bonus == 3)
block.setData((byte) 0x4);
}
} }
/* /*
* We need to check not-wheat stuff for if it was placed by the player or not * We need to check not-wheat stuff for if it was placed by the player or not
*/ */
if(!mcConfig.getInstance().isBlockWatched(block)){ if(block.getData() != (byte) 5){
//Cactus
if(type == 81){
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier);
}
//Sugar Canes
if(type == 83){
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
PP.addHerbalismGather(3 * mcLoadProperties.xpGainMultiplier);
}
//Pumpkins
if(type == 91 || type == 86){
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
PP.addHerbalismGather(55 * mcLoadProperties.xpGainMultiplier);
}
//Mushroom //Mushroom
if(type == 39 || type == 40){ if(type == 39 || type == 40){
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){ if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
mcUsers.getProfile(player).addHerbalismGather(40 * mcLoadProperties.xpGainMultiplier); PP.addHerbalismGather(40 * mcLoadProperties.xpGainMultiplier);
} }
//Flower //Flower
if(type == 37 || type == 38){ if(type == 37 || type == 38){
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){ if(Math.random() * 1000 <= PP.getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
mcUsers.getProfile(player).addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier); PP.addHerbalismGather(10 * mcLoadProperties.xpGainMultiplier);
} }
} }
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
} }
public void breadCheck(Player player, ItemStack is){ public void breadCheck(Player player, ItemStack is){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(is.getTypeId() == 297){ if(is.getTypeId() == 297){
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
player.setHealth(player.getHealth() + 1); player.setHealth(player.getHealth() + 1);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){
player.setHealth(player.getHealth() + 2); player.setHealth(player.getHealth() + 2);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){ } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){
player.setHealth(player.getHealth() + 3); player.setHealth(player.getHealth() + 3);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){ } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){
player.setHealth(player.getHealth() + 4); player.setHealth(player.getHealth() + 4);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){ } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){
player.setHealth(player.getHealth() + 5); player.setHealth(player.getHealth() + 5);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){ } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){
player.setHealth(player.getHealth() + 6); player.setHealth(player.getHealth() + 6);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){ } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){
player.setHealth(player.getHealth() + 7); player.setHealth(player.getHealth() + 7);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){ } else if (PP.getHerbalismInt() >= 750){
player.setHealth(player.getHealth() + 8); player.setHealth(player.getHealth() + 8);
} }
} }
} }
public void stewCheck(Player player, ItemStack is){ public void stewCheck(Player player, ItemStack is){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(is.getTypeId() == 282){ if(is.getTypeId() == 282){
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(PP.getHerbalismInt() >= 50 && PP.getHerbalismInt() < 150){
player.setHealth(player.getHealth() + 1); player.setHealth(player.getHealth() + 1);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150 && mcUsers.getProfile(player).getHerbalismInt() < 250){ } else if (PP.getHerbalismInt() >= 150 && PP.getHerbalismInt() < 250){
player.setHealth(player.getHealth() + 2); player.setHealth(player.getHealth() + 2);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250 && mcUsers.getProfile(player).getHerbalismInt() < 350){ } else if (PP.getHerbalismInt() >= 250 && PP.getHerbalismInt() < 350){
player.setHealth(player.getHealth() + 3); player.setHealth(player.getHealth() + 3);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350 && mcUsers.getProfile(player).getHerbalismInt() < 450){ } else if (PP.getHerbalismInt() >= 350 && PP.getHerbalismInt() < 450){
player.setHealth(player.getHealth() + 4); player.setHealth(player.getHealth() + 4);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450 && mcUsers.getProfile(player).getHerbalismInt() < 550){ } else if (PP.getHerbalismInt() >= 450 && PP.getHerbalismInt() < 550){
player.setHealth(player.getHealth() + 5); player.setHealth(player.getHealth() + 5);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550 && mcUsers.getProfile(player).getHerbalismInt() < 650){ } else if (PP.getHerbalismInt() >= 550 && PP.getHerbalismInt() < 650){
player.setHealth(player.getHealth() + 6); player.setHealth(player.getHealth() + 6);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650 && mcUsers.getProfile(player).getHerbalismInt() < 750){ } else if (PP.getHerbalismInt() >= 650 && PP.getHerbalismInt() < 750){
player.setHealth(player.getHealth() + 7); player.setHealth(player.getHealth() + 7);
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){ } else if (PP.getHerbalismInt() >= 750){
player.setHealth(player.getHealth() + 8); player.setHealth(player.getHealth() + 8);
} }
} }

View File

@ -1,10 +1,14 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcItem { public class mcItem {
@ -19,17 +23,18 @@ public class mcItem {
} }
return instance; return instance;
} }
public void itemChecks(Player player){ public void itemChecks(Player player, Plugin pluginx){
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
if(inhand.getTypeId() == 288){ if(inhand.getTypeId() == 288){
chimaerawing(player); chimaerawing(player, pluginx);
} }
} }
public void chimaerawing(Player player){ public void chimaerawing(Player player, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){ if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
if(mcSkills.getInstance().cooldownOver(player, mcUsers.getProfile(player).getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){ if(mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){
Block derp = player.getLocation().getBlock(); Block derp = player.getLocation().getBlock();
int y = derp.getY(); int y = derp.getY();
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
@ -59,15 +64,21 @@ public class mcItem {
} }
} }
} }
if(mcUsers.getProfile(player).getMySpawn(player) != null){ if(PP.getMySpawn(player) != null){
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player)); Location mySpawn = PP.getMySpawn(player);
if(mySpawn != null && pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx)) != null)
mySpawn.setWorld(pluginx.getServer().getWorld(PP.getMySpawnWorld(pluginx)));
if(mySpawn != null){
player.teleportTo(mySpawn);//Do it twice to prevent weird stuff
player.teleportTo(mySpawn);
}
} else { } else {
player.teleportTo(player.getWorld().getSpawnLocation()); player.teleportTo(player.getWorld().getSpawnLocation());
} }
player.sendMessage("**CHIMAERA WING**"); player.sendMessage("**CHIMAERA WING**");
} else if (!mcSkills.getInstance().cooldownOver(player, mcUsers.getProfile(player).getRecentlyHurt(), 60) && is.getAmount() >= 10) { } else if (!mcSkills.getInstance().cooldownOver(player, PP.getRecentlyHurt(), 60) && is.getAmount() >= 10) {
player.sendMessage("You were injured recently and must wait to use this." player.sendMessage("You were injured recently and must wait to use this."
+ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, mcUsers.getProfile(player).getRecentlyHurt(), 60)+"s)"); +ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, PP.getRecentlyHurt(), 60)+"s)");
} else if (is.getTypeId() == 288 && is.getAmount() <= 9){ } else if (is.getTypeId() == 288 && is.getAmount() <= 9){
player.sendMessage("You need more of that to use it"); player.sendMessage("You need more of that to use it");
} }

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50; package com.gmail.nossr50;
public class mcLoadProperties { public class mcLoadProperties {
public static Boolean archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static Boolean cocoabeans, archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int xpGainMultiplier, superBreakerCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static int xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public static void loadMain(){ public static void loadMain(){
String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; String propertiesFile = mcMMO.maindirectory + "mcmmo.properties";
@ -13,6 +13,7 @@ public class mcLoadProperties {
/* /*
* COOLDOWN CONTROL * COOLDOWN CONTROL
*/ */
greenTerraCooldown = properties.getInteger("greenTerraCooldown", 240);
superBreakerCooldown = properties.getInteger("superBreakerCooldown", 240); superBreakerCooldown = properties.getInteger("superBreakerCooldown", 240);
gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 240); gigaDrillBreakerCooldown = properties.getInteger("gigaDrillBreakerCooldown", 240);
treeFellerCooldown = properties.getInteger("treeFellerCooldown", 240); treeFellerCooldown = properties.getInteger("treeFellerCooldown", 240);
@ -58,6 +59,7 @@ public class mcLoadProperties {
/* /*
* EXCAVATION LOOT TOGGLES * EXCAVATION LOOT TOGGLES
*/ */
cocoabeans = properties.getBoolean("canExcavateCocoaBeans", true);
mushrooms = properties.getBoolean("canExcavateMushrooms", true); mushrooms = properties.getBoolean("canExcavateMushrooms", true);
glowstone = properties.getBoolean("canExcavateGlowstone", true); glowstone = properties.getBoolean("canExcavateGlowstone", true);
pvp = properties.getBoolean("pvp", true); pvp = properties.getBoolean("pvp", true);

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import com.gmail.nossr50.PlayerList.PlayerProfile;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
import com.nijiko.Messaging; import com.nijiko.Messaging;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
@ -67,7 +68,6 @@ public class mcMMO extends JavaPlugin {
mcUsers.addUser(player); mcUsers.addUser(player);
} }
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_BED_ENTER, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this); pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this);
@ -105,8 +105,8 @@ public class mcMMO extends JavaPlugin {
} }
} }
public boolean inSameParty(Player playera, Player playerb){ public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){
return true; return true;
} else { } else {
return false; return false;
@ -116,10 +116,12 @@ public class mcMMO extends JavaPlugin {
} }
} }
public void addXp(Player player, String skillname, Integer newvalue){ public void addXp(Player player, String skillname, Integer newvalue){
mcUsers.getProfile(player).addXpToSkill(newvalue, skillname); PlayerProfile PP = mcUsers.getProfile(player.getName());
PP.addXpToSkill(newvalue, skillname);
} }
public void modifySkill(Player player, String skillname, Integer newvalue){ public void modifySkill(Player player, String skillname, Integer newvalue){
mcUsers.getProfile(player).modifyskill(newvalue, skillname); PlayerProfile PP = mcUsers.getProfile(player.getName());
PP.modifyskill(newvalue, skillname);
} }
public ArrayList<String> getParties(){ public ArrayList<String> getParties(){
String location = "plugins/mcMMO/mcmmo.users"; String location = "plugins/mcMMO/mcmmo.users";
@ -147,10 +149,12 @@ public class mcMMO extends JavaPlugin {
return parties; return parties;
} }
public static String getPartyName(Player player){ public static String getPartyName(Player player){
return mcUsers.getProfile(player).getParty(); PlayerProfile PP = mcUsers.getProfile(player.getName());
return PP.getParty();
} }
public static boolean inParty(Player player){ public static boolean inParty(Player player){
return mcUsers.getProfile(player).inParty(); PlayerProfile PP = mcUsers.getProfile(player.getName());
return PP.inParty();
} }
public boolean isAdminChatToggled(Player player){ public boolean isAdminChatToggled(Player player){
if(mcConfig.getInstance().isAdminToggled(player.getName())){ if(mcConfig.getInstance().isAdminToggled(player.getName())){

View File

@ -6,6 +6,9 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcMining { public class mcMining {
@ -21,27 +24,32 @@ public class mcMining {
return instance; return instance;
} }
public void superBreakerCheck(Player player, Block block){ public void superBreakerCheck(Player player, Block block, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isMiningPick(player.getItemInHand())){ if(mcm.getInstance().isMiningPick(player.getItemInHand())){
if(block != null){ if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block)) if(!mcm.getInstance().abilityBlockCheck(block))
return; return;
} }
if(mcUsers.getProfile(player).getPickaxePreparationMode()){ if(PP.getPickaxePreparationMode()){
mcUsers.getProfile(player).setPickaxePreparationMode(false); PP.setPickaxePreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getMiningInt(); int x = PP.getMiningInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
} }
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ if(!PP.getSuperBreakerMode() && PP.getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 1000); for(Player y : pluginx.getServer().getOnlinePlayers()){
mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
mcUsers.getProfile(player).setSuperBreakerMode(true); y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Super Breaker!");
}
PP.setSuperBreakerTicks(ticks * 1000);
PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis());
PP.setSuperBreakerMode(true);
} }
} }
@ -93,14 +101,16 @@ public class mcMining {
} }
} }
public void blockProcCheck(Block block, Player player){ public void blockProcCheck(Block block, Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getMiningInt()){ if(Math.random() * 1000 <= PP.getMiningInt()){
blockProcSimulate(block); blockProcSimulate(block);
return; return;
} }
} }
} }
public void miningBlockCheck(Player player, Block block){ public void miningBlockCheck(Player player, Block block){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5) if(mcConfig.getInstance().isBlockWatched(block) || block.getData() == (byte) 5)
return; return;
int xp = 0; int xp = 0;
@ -108,6 +118,11 @@ public class mcMining {
xp += 3; xp += 3;
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//OBSIDIAN
if(block.getTypeId() == 49){
xp += 15;
blockProcCheck(block, player);
}
//NETHERRACK //NETHERRACK
if(block.getTypeId() == 87){ if(block.getTypeId() == 87){
xp += 3; xp += 3;
@ -148,7 +163,7 @@ public class mcMining {
xp += 40; xp += 40;
blockProcCheck(block, player); blockProcCheck(block, player);
} }
mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier); PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
} }
/* /*
@ -156,13 +171,14 @@ public class mcMining {
*/ */
public Boolean canBeSuperBroken(Block block){ public Boolean canBeSuperBroken(Block block){
int t = block.getTypeId(); int t = block.getTypeId();
if(t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){ if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){
return true; return true;
} else { } else {
return false; return false;
} }
} }
public void SuperBreakerBlockCheck(Player player, Block block){ public void SuperBreakerBlockCheck(Player player, Block block){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcLoadProperties.toolsLoseDurabilityFromAbilities) if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss); mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss);
Location loc = block.getLocation(); Location loc = block.getLocation();
@ -232,6 +248,20 @@ public class mcMining {
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR); block.setType(Material.AIR);
} }
//OBSIDIAN
if(block.getTypeId() == 49 && mcm.getInstance().getTier(player) >= 4){
if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) 104);
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
xp += 15;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
mat = Material.getMaterial(49);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
block.setType(Material.AIR);
}
//DIAMOND //DIAMOND
if(block.getTypeId() == 56 && mcm.getInstance().getTier(player) >= 3){ if(block.getTypeId() == 56 && mcm.getInstance().getTier(player) >= 3){
if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){ if(!mcConfig.getInstance().isBlockWatched(block)&& block.getData() != (byte) 5){
@ -288,7 +318,7 @@ public class mcMining {
block.setType(Material.AIR); block.setType(Material.AIR);
} }
if(block.getData() != (byte) 5) if(block.getData() != (byte) 5)
mcUsers.getProfile(player).addMiningGather(xp * mcLoadProperties.xpGainMultiplier); PP.addMiningGather(xp * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
} }
} }

View File

@ -17,12 +17,12 @@ public class mcParty {
return instance; return instance;
} }
public boolean inSameParty(Player playera, Player playerb){ public boolean inSameParty(Player playera, Player playerb){
if(mcUsers.getProfile(playera) == null || mcUsers.getProfile(playerb) == null){ if(mcUsers.getProfile(playera.getName()) == null || mcUsers.getProfile(playerb.getName()) == null){
mcUsers.addUser(playera); mcUsers.addUser(playera);
mcUsers.addUser(playerb); mcUsers.addUser(playerb);
} }
if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ if(mcUsers.getProfile(playera.getName()).inParty() && mcUsers.getProfile(playerb.getName()).inParty()){
if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ if(mcUsers.getProfile(playera.getName()).getParty().equals(mcUsers.getProfile(playerb.getName()).getParty())){
return true; return true;
} else { } else {
return false; return false;
@ -31,11 +31,12 @@ public class mcParty {
return false; return false;
} }
} }
public int partyCount(Player player, Player[] players){ public int partyCount(Player player, Player[] players){
int x = 0; int x = 0;
for(Player hurrdurr : players){ for(Player hurrdurr : players){
if(player != null && hurrdurr != null){ if(player != null && hurrdurr != null){
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(hurrdurr).getParty())) if(mcUsers.getProfile(player.getName()).getParty().equals(mcUsers.getProfile(hurrdurr.getName()).getParty()))
x++; x++;
} }
} }

View File

@ -44,6 +44,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean herbalismAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.herbalism");
} else {
return true;
}
}
public boolean excavationAbility(Player player){ public boolean excavationAbility(Player player){
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.ability.excavation"); return permission(player, "mcmmo.ability.excavation");
@ -135,13 +142,6 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean setMySpawnOther(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.setmyspawnother");
} else {
return true;
}
}
public boolean partyChat(Player player) { public boolean partyChat(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.chat.partychat"); return permission(player, "mcmmo.chat.partychat");

View File

@ -9,10 +9,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerListener;
@ -20,6 +18,8 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcPlayerListener extends PlayerListener { public class mcPlayerListener extends PlayerListener {
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
@ -31,10 +31,11 @@ public class mcPlayerListener extends PlayerListener {
} }
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(player != null){ if(player != null){
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); Location mySpawn = PP.getMySpawn(player);
if(mySpawn != null && plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin)) != null) if(mySpawn != null && plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)) != null)
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){ if(mcPermissions.getInstance().mySpawn(player) && mySpawn != null){
event.setRespawnLocation(mySpawn); event.setRespawnLocation(mySpawn);
} }
@ -67,15 +68,17 @@ public class mcPlayerListener extends PlayerListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(mcPermissions.getInstance().motd(player)){ if(mcPermissions.getInstance().motd(player)){
player.sendMessage(ChatColor.BLUE +"This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help."); player.sendMessage(ChatColor.BLUE +"This server is running mcMMO "+plugin.getDescription().getVersion()+" type /"+ChatColor.YELLOW+mcLoadProperties.mcmmo+ChatColor.BLUE+ " for help.");
player.sendMessage(ChatColor.GREEN+"http://mcmmo.wikia.com"+ChatColor.BLUE+" - mcMMO Wiki");
} }
} }
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player.getName());
Action action = event.getAction(); Action action = event.getAction();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
//Archery Nerf //Archery Nerf
if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){ if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){
if(System.currentTimeMillis() < mcUsers.getProfile(player).getArcheryShotATS() + 1000){ if(System.currentTimeMillis() < PP.getArcheryShotATS() + 1000){
/* /*
if(mcm.getInstance().hasArrows(player)) if(mcm.getInstance().hasArrows(player))
mcm.getInstance().addArrows(player); mcm.getInstance().addArrows(player);
@ -83,7 +86,7 @@ public class mcPlayerListener extends PlayerListener {
player.updateInventory(); player.updateInventory();
event.setCancelled(true); event.setCancelled(true);
} else { } else {
mcUsers.getProfile(player).setArcheryShotATS(System.currentTimeMillis()); PP.setArcheryShotATS(System.currentTimeMillis());
} }
} }
/* /*
@ -91,15 +94,45 @@ public class mcPlayerListener extends PlayerListener {
*/ */
if(action == Action.RIGHT_CLICK_BLOCK){ if(action == Action.RIGHT_CLICK_BLOCK){
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
if(block != null && player != null){
if(block.getTypeId() == 26 && mcPermissions.getInstance().setMySpawn(player)){
Location loc = player.getLocation();
if(mcPermissions.getInstance().setMySpawn(player)){
PP.setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName());
}
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
}
}
if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getClickedBlock().getTypeId() == 42){ if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getClickedBlock().getTypeId() == 42){
mcRepair.getInstance().repairCheck(player, is, event.getClickedBlock()); mcRepair.getInstance().repairCheck(player, is, event.getClickedBlock());
} }
if(mcm.getInstance().abilityBlockCheck(block)) if(mcm.getInstance().abilityBlockCheck(block))
{ {
if(block != null && mcm.getInstance().isHoe(player.getItemInHand()) && block.getTypeId() != 3){
mcSkills.getInstance().hoeReadinessCheck(player);
}
mcSkills.getInstance().abilityActivationCheck(player); mcSkills.getInstance().abilityActivationCheck(player);
} }
//GREEN THUMB
if(block != null && block.getType() == Material.COBBLESTONE && player.getItemInHand().getType() == Material.SEEDS){
boolean pass = false;
if(mcHerbalism.getInstance().hasSeeds(player)){
mcHerbalism.getInstance().removeSeeds(player);
if(Math.random() * 1500 <= PP.getHerbalismInt()){
player.sendMessage(ChatColor.GREEN+"**GREEN THUMB**");
block.setType(Material.MOSSY_COBBLESTONE);
pass = true;
}
if(pass == false)
player.sendMessage(ChatColor.RED+"**GREEN THUMB FAIL**");
}
return;
}
} }
if(action == Action.RIGHT_CLICK_AIR){ if(action == Action.RIGHT_CLICK_AIR){
mcSkills.getInstance().hoeReadinessCheck(player);
mcSkills.getInstance().abilityActivationCheck(player); mcSkills.getInstance().abilityActivationCheck(player);
/* /*
@ -114,36 +147,39 @@ public class mcPlayerListener extends PlayerListener {
* ITEM CHECKS * ITEM CHECKS
*/ */
if(action == Action.RIGHT_CLICK_AIR) if(action == Action.RIGHT_CLICK_AIR)
mcItem.getInstance().itemChecks(player); mcItem.getInstance().itemChecks(player, plugin);
if(action == Action.RIGHT_CLICK_BLOCK){ if(action == Action.RIGHT_CLICK_BLOCK){
if(mcm.getInstance().abilityBlockCheck(event.getClickedBlock())) if(mcm.getInstance().abilityBlockCheck(event.getClickedBlock()))
mcItem.getInstance().itemChecks(player); mcItem.getInstance().itemChecks(player, plugin);
} }
} }
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
Player player = event.getPlayer();
Location loc = player.getLocation();
if(mcPermissions.getInstance().setMySpawn(player)){
mcUsers.getProfile(player).setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName());
}
player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location.");
}
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player.getName());
String[] split = event.getMessage().split(" "); String[] split = event.getMessage().split(" ");
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);
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){ if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcability)){
event.setCancelled(true); event.setCancelled(true);
if(mcUsers.getProfile(player).getAbilityUse()){ if(PP.getAbilityUse()){
player.sendMessage("Ability use toggled off"); player.sendMessage("Ability use toggled off");
mcUsers.getProfile(player).toggleAbilityUse(); PP.toggleAbilityUse();
} else { } else {
player.sendMessage("Ability use toggled on"); player.sendMessage("Ability use toggled on");
mcUsers.getProfile(player).toggleAbilityUse(); PP.toggleAbilityUse();
} }
} }
/*
if(split[0].equalsIgnoreCase("/mutechat")){
event.setCancelled(true);
if(PP.getPartyChatOnlyToggle() == true)
player.sendMessage("Party Chat Only "+ChatColor.RED+"Off");
if(PP.getPartyChatOnlyToggle() == false)
player.sendMessage("Party Chat Only "+ChatColor.RED+"On");
PP.togglePartyChatOnly();
}
*/
if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){ if(mcPermissions.getInstance().mcAbility(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.mcrefresh)){
event.setCancelled(true); event.setCancelled(true);
if(!mcPermissions.getInstance().mcrefresh(player)){ if(!mcPermissions.getInstance().mcrefresh(player)){
@ -157,35 +193,43 @@ public class mcPlayerListener extends PlayerListener {
/* /*
* PREP MODES * PREP MODES
*/ */
mcUsers.getProfile(player).setAxePreparationMode(false); PP.setRecentlyHurt((long) 0);
mcUsers.getProfile(player).setFistsPreparationMode(false); PP.setHoePreparationMode(false);
mcUsers.getProfile(player).setSwordsPreparationMode(false); PP.setAxePreparationMode(false);
mcUsers.getProfile(player).setPickaxePreparationMode(false); PP.setFistsPreparationMode(false);
PP.setSwordsPreparationMode(false);
PP.setPickaxePreparationMode(false);
/*
* GREEN TERRA
*/
PP.setGreenTerraMode(false);
PP.setGreenTerraDeactivatedTimeStamp((long) 0);
/* /*
* GIGA DRILL BREAKER * GIGA DRILL BREAKER
*/ */
mcUsers.getProfile(player).setGigaDrillBreakerMode(false); PP.setGigaDrillBreakerMode(false);
mcUsers.getProfile(player).setGigaDrillBreakerDeactivatedTimeStamp((long) 0); PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0);
/* /*
* SERRATED STRIKE * SERRATED STRIKE
*/ */
mcUsers.getProfile(player).setSerratedStrikesMode(false); PP.setSerratedStrikesMode(false);
mcUsers.getProfile(player).setSerratedStrikesDeactivatedTimeStamp((long) 0); PP.setSerratedStrikesDeactivatedTimeStamp((long) 0);
/* /*
* SUPER BREAKER * SUPER BREAKER
*/ */
mcUsers.getProfile(player).setSuperBreakerMode(false); PP.setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerDeactivatedTimeStamp((long) 0); PP.setSuperBreakerDeactivatedTimeStamp((long) 0);
/* /*
* TREE FELLER * TREE FELLER
*/ */
mcUsers.getProfile(player).setTreeFellerMode(false); PP.setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerDeactivatedTimeStamp((long) 0); PP.setTreeFellerDeactivatedTimeStamp((long) 0);
/* /*
* BERSERK * BERSERK
*/ */
mcUsers.getProfile(player).setBerserkMode(false); PP.setBerserkMode(false);
mcUsers.getProfile(player).setBerserkDeactivatedTimeStamp((long)0); PP.setBerserkDeactivatedTimeStamp((long)0);
player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**"); player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**");
} }
@ -215,7 +259,7 @@ public class mcPlayerListener extends PlayerListener {
double y = plugin.getServer().getWorlds().get(0).getSpawnLocation().getY(); double y = plugin.getServer().getWorlds().get(0).getSpawnLocation().getY();
double z = plugin.getServer().getWorlds().get(0).getSpawnLocation().getZ(); double z = plugin.getServer().getWorlds().get(0).getSpawnLocation().getZ();
String worldname = plugin.getServer().getWorlds().get(0).getName(); String worldname = plugin.getServer().getWorlds().get(0).getName();
mcUsers.getProfile(player).setMySpawn(x, y, z, worldname); PP.setMySpawn(x, y, z, worldname);
player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared."); player.sendMessage(ChatColor.DARK_AQUA+"Myspawn is now cleared.");
} }
if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){ if(mcPermissions.permissionsEnabled && split[0].equalsIgnoreCase("/"+mcLoadProperties.mmoedit)){
@ -231,14 +275,14 @@ public class mcPlayerListener extends PlayerListener {
if(split.length == 4){ if(split.length == 4){
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){ if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
int newvalue = Integer.valueOf(split[3]); int newvalue = Integer.valueOf(split[3]);
mcUsers.getProfile(getPlayer(split[1])).modifyskill(newvalue, split[2]); mcUsers.getProfile(getPlayer(split[1]).getName()).modifyskill(newvalue, split[2]);
player.sendMessage(ChatColor.RED+split[2]+" has been modified."); player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
} }
} }
else if(split.length == 3){ else if(split.length == 3){
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){ if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
int newvalue = Integer.valueOf(split[2]); int newvalue = Integer.valueOf(split[2]);
mcUsers.getProfile(player).modifyskill(newvalue, split[1]); PP.modifyskill(newvalue, split[1]);
player.sendMessage(ChatColor.RED+split[1]+" has been modified."); player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
} }
} else { } else {
@ -261,7 +305,7 @@ public class mcPlayerListener extends PlayerListener {
if(split.length == 4){ if(split.length == 4){
if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){ if(isPlayer(split[1]) && mcm.getInstance().isInt(split[3]) && mcSkills.getInstance().isSkill(split[2])){
int newvalue = Integer.valueOf(split[3]); int newvalue = Integer.valueOf(split[3]);
mcUsers.getProfile(getPlayer(split[1])).addXpToSkill(newvalue, split[2]); mcUsers.getProfile(getPlayer(split[1]).getName()).addXpToSkill(newvalue, split[2]);
getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!");
player.sendMessage(ChatColor.RED+split[2]+" has been modified."); player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
} }
@ -269,7 +313,7 @@ public class mcPlayerListener extends PlayerListener {
else if(split.length == 3){ else if(split.length == 3){
if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){ if(mcm.getInstance().isInt(split[2]) && mcSkills.getInstance().isSkill(split[1])){
int newvalue = Integer.valueOf(split[2]); int newvalue = Integer.valueOf(split[2]);
mcUsers.getProfile(player).addXpToSkill(newvalue, split[1]); PP.addXpToSkill(newvalue, split[1]);
player.sendMessage(ChatColor.RED+split[1]+" has been modified."); player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
} }
} else { } else {
@ -277,7 +321,7 @@ public class mcPlayerListener extends PlayerListener {
} }
} }
if(mcUsers.getProfile(player).inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){ if(PP.inParty() && split[0].equalsIgnoreCase("/"+mcLoadProperties.ptp)){
event.setCancelled(true); event.setCancelled(true);
if(!mcPermissions.getInstance().partyTeleport(player)){ if(!mcPermissions.getInstance().partyTeleport(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
@ -292,7 +336,8 @@ public class mcPlayerListener extends PlayerListener {
} }
if(isPlayer(split[1])){ if(isPlayer(split[1])){
Player target = getPlayer(split[1]); Player target = getPlayer(split[1]);
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(target).getParty())){ PlayerProfile PPt = mcUsers.getProfile(target.getName());
if(PP.getParty().equals(PPt.getParty())){
player.teleportTo(target); player.teleportTo(target);
player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName()); player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName());
target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you."); target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you.");
@ -311,58 +356,59 @@ public class mcPlayerListener extends PlayerListener {
//if split[1] is a player //if split[1] is a player
if(isPlayer(split[1])){ if(isPlayer(split[1])){
Player target = getPlayer(split[1]); Player target = getPlayer(split[1]);
PlayerProfile PPt = mcUsers.getProfile(target.getName());
double x,y,z; double x,y,z;
x = target.getLocation().getX(); x = target.getLocation().getX();
y = target.getLocation().getY(); y = target.getLocation().getY();
z = target.getLocation().getZ(); z = target.getLocation().getZ();
player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~"); player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~");
player.sendMessage(target.getName()); player.sendMessage(target.getName());
if(mcUsers.getProfile(target).inParty()) if(PPt.inParty())
player.sendMessage("Party: "+mcUsers.getProfile(target).getParty()); player.sendMessage("Party: "+PPt.getParty());
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 for "+ChatColor.YELLOW+target.getName()); player.sendMessage(ChatColor.GREEN+"mcMMO Stats for "+ChatColor.YELLOW+target.getName());
if(mcPermissions.getInstance().mining(target)) if(mcPermissions.getInstance().mining(target))
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getMining()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PPt.getMining()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getMiningGather() + " XP("+PPt.getMiningGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("mining")+")"); +"/"+PPt.getXpToLevel("mining")+")");
if(mcPermissions.getInstance().repair(target)) if(mcPermissions.getInstance().repair(target))
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getRepair()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PPt.getRepair()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getRepairGather() + " XP("+PPt.getRepairGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("repair")+")"); +"/"+PPt.getXpToLevel("repair")+")");
if(mcPermissions.getInstance().woodcutting(target)) if(mcPermissions.getInstance().woodcutting(target))
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getWoodCutting()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PPt.getWoodCutting()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getWoodCuttingGather() + " XP("+PPt.getWoodCuttingGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("woodcutting")+")"); +"/"+PPt.getXpToLevel("woodcutting")+")");
if(mcPermissions.getInstance().unarmed(target)) if(mcPermissions.getInstance().unarmed(target))
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getUnarmed()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PPt.getUnarmed()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getUnarmedGather() + " XP("+PPt.getUnarmedGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("unarmed")+")"); +"/"+PPt.getXpToLevel("unarmed")+")");
if(mcPermissions.getInstance().herbalism(target)) if(mcPermissions.getInstance().herbalism(target))
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getHerbalism()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PPt.getHerbalism()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getHerbalismGather() + " XP("+PPt.getHerbalismGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("herbalism")+")"); +"/"+PPt.getXpToLevel("herbalism")+")");
if(mcPermissions.getInstance().excavation(target)) if(mcPermissions.getInstance().excavation(target))
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(target).getExcavation()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PPt.getExcavation()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getExcavationGather() + " XP("+PPt.getExcavationGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("excavation")+")"); +"/"+PPt.getXpToLevel("excavation")+")");
if(mcPermissions.getInstance().archery(target)) if(mcPermissions.getInstance().archery(target))
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getArchery()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PPt.getArchery()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getArcheryGather() + " XP("+PPt.getArcheryGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("archery")+")"); +"/"+PPt.getXpToLevel("archery")+")");
if(mcPermissions.getInstance().swords(target)) if(mcPermissions.getInstance().swords(target))
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getSwords()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PPt.getSwords()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getSwordsGather() + " XP("+PPt.getSwordsGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("swords")+")"); +"/"+PPt.getXpToLevel("swords")+")");
if(mcPermissions.getInstance().axes(target)) if(mcPermissions.getInstance().axes(target))
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAxes()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PPt.getAxes()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getAxesGather() + " XP("+PPt.getAxesGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("axes")+")"); +"/"+PPt.getXpToLevel("axes")+")");
if(mcPermissions.getInstance().acrobatics(target)) if(mcPermissions.getInstance().acrobatics(target))
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(target).getAcrobatics()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PPt.getAcrobatics()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(target).getAcrobaticsGather() + " XP("+PPt.getAcrobaticsGather()
+"/"+mcUsers.getProfile(target).getXpToLevel("acrobatics")+")"); +"/"+PPt.getXpToLevel("acrobatics")+")");
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcUsers.getProfile(target).getPowerLevel())); player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(target)));
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);
@ -378,51 +424,51 @@ public class mcPlayerListener extends PlayerListener {
if(mcPermissions.getInstance().permissionsEnabled) if(mcPermissions.getInstance().permissionsEnabled)
player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here."); player.sendMessage(ChatColor.DARK_GRAY+"If you don't have access to a skill it will not be shown here.");
if(mcPermissions.getInstance().mining(player)) if(mcPermissions.getInstance().mining(player))
player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getMining()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Mining Skill: " + ChatColor.GREEN + PP.getMining()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getMiningGather() + " XP("+PP.getMiningGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("mining")+")"); +"/"+PP.getXpToLevel("mining")+")");
if(mcPermissions.getInstance().repair(player)) if(mcPermissions.getInstance().repair(player))
player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getRepair()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Repair Skill: "+ ChatColor.GREEN + PP.getRepair()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getRepairGather() + " XP("+PP.getRepairGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("repair")+")"); +"/"+PP.getXpToLevel("repair")+")");
if(mcPermissions.getInstance().woodcutting(player)) if(mcPermissions.getInstance().woodcutting(player))
player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getWoodCutting()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Woodcutting Skill: "+ ChatColor.GREEN + PP.getWoodCutting()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getWoodCuttingGather() + " XP("+PP.getWoodCuttingGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("woodcutting")+")"); +"/"+PP.getXpToLevel("woodcutting")+")");
if(mcPermissions.getInstance().unarmed(player)) if(mcPermissions.getInstance().unarmed(player))
player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getUnarmed()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Unarmed Skill: " + ChatColor.GREEN + PP.getUnarmed()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getUnarmedGather() + " XP("+PP.getUnarmedGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("unarmed")+")"); +"/"+PP.getXpToLevel("unarmed")+")");
if(mcPermissions.getInstance().herbalism(player)) if(mcPermissions.getInstance().herbalism(player))
player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getHerbalism()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Herbalism Skill: "+ ChatColor.GREEN + PP.getHerbalism()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getHerbalismGather() + " XP("+PP.getHerbalismGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("herbalism")+")"); +"/"+PP.getXpToLevel("herbalism")+")");
if(mcPermissions.getInstance().excavation(player)) if(mcPermissions.getInstance().excavation(player))
player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + mcUsers.getProfile(player).getExcavation()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Excavation Skill: "+ ChatColor.GREEN + PP.getExcavation()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getExcavationGather() + " XP("+PP.getExcavationGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("excavation")+")"); +"/"+PP.getXpToLevel("excavation")+")");
if(mcPermissions.getInstance().archery(player)) if(mcPermissions.getInstance().archery(player))
player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getArchery()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Archery Skill: " + ChatColor.GREEN + PP.getArchery()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getArcheryGather() + " XP("+PP.getArcheryGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("archery")+")"); +"/"+PP.getXpToLevel("archery")+")");
if(mcPermissions.getInstance().swords(player)) if(mcPermissions.getInstance().swords(player))
player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getSwords()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Swords Skill: " + ChatColor.GREEN + PP.getSwords()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getSwordsGather() + " XP("+PP.getSwordsGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("swords")+")"); +"/"+PP.getXpToLevel("swords")+")");
if(mcPermissions.getInstance().axes(player)) if(mcPermissions.getInstance().axes(player))
player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAxes()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Axes Skill: " + ChatColor.GREEN + PP.getAxes()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getAxesGather() + " XP("+PP.getAxesGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("axes")+")"); +"/"+PP.getXpToLevel("axes")+")");
if(mcPermissions.getInstance().acrobatics(player)) if(mcPermissions.getInstance().acrobatics(player))
player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + mcUsers.getProfile(player).getAcrobatics()+ChatColor.DARK_AQUA player.sendMessage(ChatColor.YELLOW + "Acrobatics Skill: " + ChatColor.GREEN + PP.getAcrobatics()+ChatColor.DARK_AQUA
+ " XP("+mcUsers.getProfile(player).getAcrobaticsGather() + " XP("+PP.getAcrobaticsGather()
+"/"+mcUsers.getProfile(player).getXpToLevel("acrobatics")+")"); +"/"+PP.getXpToLevel("acrobatics")+")");
player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcUsers.getProfile(player).getPowerLevel())); player.sendMessage(ChatColor.DARK_RED+"POWER LEVEL: "+ChatColor.GREEN+(mcm.getInstance().getPowerLevel(player)));
} }
//Invite Command //Invite Command
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){ if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.invite)){
event.setCancelled(true); event.setCancelled(true);
if(!mcUsers.getProfile(player).inParty()){ if(!PP.inParty()){
player.sendMessage(ChatColor.RED+"You are not in a party."); player.sendMessage(ChatColor.RED+"You are not in a party.");
return; return;
} }
@ -430,24 +476,25 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" <playername>"); player.sendMessage(ChatColor.RED+"Usage is /"+mcLoadProperties.invite+" <playername>");
return; return;
} }
if(mcUsers.getProfile(player).inParty() && split.length >= 2 && isPlayer(split[1])){ if(PP.inParty() && split.length >= 2 && isPlayer(split[1])){
Player target = getPlayer(split[1]); Player target = getPlayer(split[1]);
mcUsers.getProfile(target).modifyInvite(mcUsers.getProfile(player).getParty()); PlayerProfile PPt = mcUsers.getProfile(target.getName());
PPt.modifyInvite(PP.getParty());
player.sendMessage(ChatColor.GREEN+"Invite sent successfully"); player.sendMessage(ChatColor.GREEN+"Invite sent successfully");
target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+mcUsers.getProfile(target).getInvite()+" from "+player.getName()); target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite"); target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+"/"+mcLoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
} }
} }
//Accept invite //Accept invite
if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){ if(mcPermissions.getInstance().party(player) && split[0].equalsIgnoreCase("/"+mcLoadProperties.accept)){
event.setCancelled(true); event.setCancelled(true);
if(mcUsers.getProfile(player).hasPartyInvite()){ if(PP.hasPartyInvite()){
if(mcUsers.getProfile(player).inParty()){ if(PP.inParty()){
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
} }
mcUsers.getProfile(player).acceptInvite(); PP.acceptInvite();
mcParty.getInstance().informPartyMembers(player, getPlayersOnline()); mcParty.getInstance().informPartyMembers(player, getPlayersOnline());
player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+mcUsers.getProfile(player).getParty()+")"); player.sendMessage(ChatColor.GREEN+"Invite accepted. You have joined party ("+PP.getParty()+")");
} else { } else {
player.sendMessage(ChatColor.RED+"You have no invites at this time"); player.sendMessage(ChatColor.RED+"You have no invites at this time");
} }
@ -459,16 +506,16 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
if(split.length == 1 && !mcUsers.getProfile(player).inParty()){ if(split.length == 1 && !PP.inParty()){
player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit"); player.sendMessage("Proper usage is "+"/"+mcLoadProperties.party+" <name> or 'q' to quit");
return; return;
} }
if(split.length == 1 && mcUsers.getProfile(player).inParty()){ if(split.length == 1 && PP.inParty()){
String tempList = ""; String tempList = "";
int x = 0; int x = 0;
for(Player p : plugin.getServer().getOnlinePlayers()) for(Player p : plugin.getServer().getOnlinePlayers())
{ {
if(mcUsers.getProfile(player).getParty().equals(mcUsers.getProfile(p).getParty())){ if(PP.getParty().equals(mcUsers.getProfile(p.getName()).getParty())){
if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){ if(p != null && x+1 >= mcParty.getInstance().partyCount(player, getPlayersOnline())){
tempList+= p.getName(); tempList+= p.getName();
x++; x++;
@ -479,19 +526,19 @@ public class mcPlayerListener extends PlayerListener {
} }
} }
} }
player.sendMessage(ChatColor.GREEN+"You are in party \""+mcUsers.getProfile(player).getParty()+"\""); player.sendMessage(ChatColor.GREEN+"You are in party \""+PP.getParty()+"\"");
player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")"); player.sendMessage(ChatColor.GREEN + "Party Members ("+ChatColor.WHITE+tempList+ChatColor.GREEN+")");
} }
if(split.length > 1 && split[1].equals("q") && mcUsers.getProfile(player).inParty()){ if(split.length > 1 && split[1].equals("q") && PP.inParty()){
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
mcUsers.getProfile(player).removeParty(); PP.removeParty();
player.sendMessage(ChatColor.RED + "You have left that party"); player.sendMessage(ChatColor.RED + "You have left that party");
return; return;
} }
if(split.length >= 2){ if(split.length >= 2){
if(mcUsers.getProfile(player).inParty()) if(PP.inParty())
mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline()); mcParty.getInstance().informPartyMembersQuit(player, getPlayersOnline());
mcUsers.getProfile(player).setParty(split[1]); PP.setParty(split[1]);
player.sendMessage("Joined Party: " + split[1]); player.sendMessage("Joined Party: " + split[1]);
mcParty.getInstance().informPartyMembers(player, getPlayersOnline()); mcParty.getInstance().informPartyMembers(player, getPlayersOnline());
} }
@ -535,14 +582,28 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions.");
return; return;
} }
if(mcUsers.getProfile(player).getMySpawn(player) != null){ if(System.currentTimeMillis() < PP.getMySpawnATS() + 3600000){
if(mcLoadProperties.myspawnclearsinventory) long x = System.currentTimeMillis();
player.getInventory().clear(); int seconds = 0;
int minutes = 0;
while(x < PP.getMySpawnATS() + 3600000){
x+=1000;
seconds++;
}
while(seconds >= 60){
seconds-=60;
minutes++;
}
player.sendMessage("You must wait "+minutes+"m"+seconds+"s"+" to use myspawn");
return;
}
PP.setMySpawnATS(System.currentTimeMillis());
if(PP.getMySpawn(player) != null){
player.setHealth(20); player.setHealth(20);
Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); Location mySpawn = PP.getMySpawn(player);
//player.sendMessage("mcMMO DEBUG CODE 1"); //player.sendMessage("mcMMO DEBUG CODE 1");
if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("")){ if(PP.getMySpawnWorld(plugin) != null && !PP.getMySpawnWorld(plugin).equals("")){
mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); mySpawn.setWorld(plugin.getServer().getWorld(PP.getMySpawnWorld(plugin)));
//player.sendMessage("mcMMO DEBUG CODE 2"); //player.sendMessage("mcMMO DEBUG CODE 2");
} else { } else {
//player.sendMessage("mcMMO DEBUG CODE 5"); //player.sendMessage("mcMMO DEBUG CODE 5");
@ -554,23 +615,22 @@ public class mcPlayerListener extends PlayerListener {
//Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first. //Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first.
//player.sendMessage("mcMMO DEBUG CODE 4"); //player.sendMessage("mcMMO DEBUG CODE 4");
if(mcLoadProperties.myspawnclearsinventory) if(mcLoadProperties.myspawnclearsinventory)
player.sendMessage("Traveled to your MySpawn, Inventory cleared & health restored"); player.sendMessage("Traveled to your MySpawn");
else
player.sendMessage("Traveled to your MySpawn, Health has been restored.");
} else { } else {
player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn"); player.sendMessage(ChatColor.RED+"Configure your myspawn first with a bed.");
} }
} }
} }
public void onPlayerChat(PlayerChatEvent event) { public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player.getName());
String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") "; String x = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getName() + ChatColor.GREEN + ") ";
String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} "; String y = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
if(mcConfig.getInstance().isPartyToggled(player.getName())){ if(mcConfig.getInstance().isPartyToggled(player.getName())){
event.setCancelled(true); event.setCancelled(true);
log.log(Level.INFO, "[P]("+mcUsers.getProfile(player).getParty()+")"+"<"+player.getName()+"> "+event.getMessage()); log.log(Level.INFO, "[P]("+PP.getParty()+")"+"<"+player.getName()+"> "+event.getMessage());
for(Player herp : plugin.getServer().getOnlinePlayers()){ for(Player herp : plugin.getServer().getOnlinePlayers()){
if(mcUsers.getProfile(herp).inParty()){ if(mcUsers.getProfile(herp.getName()).inParty()){
if(mcParty.getInstance().inSameParty(herp, player)){ if(mcParty.getInstance().inSameParty(herp, player)){
herp.sendMessage(x+event.getMessage()); herp.sendMessage(x+event.getMessage());
} }
@ -588,5 +648,12 @@ public class mcPlayerListener extends PlayerListener {
} }
return; return;
} }
/*
* Remove from normal chat if toggled
for(Player z : event.getRecipients()){
if(mcUsers.getProfile(z.getName()).getPartyChatOnlyToggle() == true)
event.getRecipients().remove(z);
}
*/
} }
} }

View File

@ -5,6 +5,8 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcRepair { public class mcRepair {
private static mcMMO plugin; private static mcMMO plugin;
@ -19,12 +21,13 @@ public class mcRepair {
return instance; return instance;
} }
public void repairCheck(Player player, ItemStack is, Block block){ public void repairCheck(Player player, ItemStack is, Block block){
short durabilityBefore = is.getDurability(); PlayerProfile PP = mcUsers.getProfile(player.getName());
short durabilityBefore = player.getItemInHand().getDurability();
short durabilityAfter = 0; short durabilityAfter = 0;
short dif = 0; short dif = 0;
if(block != null if(block != null
&& mcPermissions.getInstance().repair(player)){ && mcPermissions.getInstance().repair(player)){
if(player.getItemInHand().getDurability() > 0){ if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){
/* /*
* ARMOR * ARMOR
*/ */
@ -32,29 +35,32 @@ public class mcRepair {
/* /*
* DIAMOND ARMOR * DIAMOND ARMOR
*/ */
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ if(isDiamondArmor(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){
removeDiamond(player); removeDiamond(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
durabilityAfter = is.getDurability(); durabilityAfter = player.getItemInHand().getDurability();
player.sendMessage(String.valueOf(durabilityBefore - durabilityAfter));
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); dif = (short) (dif * 6); //Boost XP
PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
} else if (isIronArmor(is) && hasIron(player)){ } else if (isIronArmor(is) && hasIron(player)){
/* /*
* IRON ARMOR * IRON ARMOR
*/ */
removeIron(player); removeIron(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
durabilityAfter = is.getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); dif = (short) (dif * 2); //Boost XP
PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
//GOLD ARMOR //GOLD ARMOR
} else if (isGoldArmor(is) && hasGold(player)){ } else if (isGoldArmor(is) && hasGold(player)){
removeGold(player); removeGold(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
durabilityAfter = is.getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 4); //Boost XP of Gold to around Iron dif = (short) (dif * 4); //Boost XP of Gold to around Iron
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
} else { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -67,9 +73,12 @@ public class mcRepair {
* IRON TOOLS * IRON TOOLS
*/ */
if(isIronTools(is) && hasIron(player)){ if(isIronTools(is) && hasIron(player)){
is.setDurability(getToolRepairAmount(is, player));
removeIron(player); removeIron(player);
durabilityAfter = is.getDurability(); /*
* Repair Durability and calculate dif
*/
player.getItemInHand().setDurability(getToolRepairAmount(is, player));
durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
if(mcm.getInstance().isShovel(is)) if(mcm.getInstance().isShovel(is))
dif = (short) (dif / 3); dif = (short) (dif / 3);
@ -77,14 +86,14 @@ public class mcRepair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(mcm.getInstance().isHoe(is)) if(mcm.getInstance().isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
} else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds } else if (isDiamondTools(is) && hasDiamond(player) && PP.getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
/* /*
* DIAMOND TOOLS * DIAMOND TOOLS
*/ */
is.setDurability(getToolRepairAmount(is, player)); player.getItemInHand().setDurability(getToolRepairAmount(is, player));
removeDiamond(player); removeDiamond(player);
durabilityAfter = is.getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
if(mcm.getInstance().isShovel(is)) if(mcm.getInstance().isShovel(is))
dif = (short) (dif / 3); dif = (short) (dif / 3);
@ -92,11 +101,11 @@ public class mcRepair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(mcm.getInstance().isHoe(is)) if(mcm.getInstance().isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
} else if(isGoldTools(is) && hasGold(player)){ } else if(isGoldTools(is) && hasGold(player)){
is.setDurability(getToolRepairAmount(is, player)); player.getItemInHand().setDurability(getToolRepairAmount(is, player));
removeGold(player); removeGold(player);
durabilityAfter = is.getDurability(); durabilityAfter = player.getItemInHand().getDurability();
dif = (short) (durabilityBefore - durabilityAfter); dif = (short) (durabilityBefore - durabilityAfter);
dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron
if(mcm.getInstance().isShovel(is)) if(mcm.getInstance().isShovel(is))
@ -105,7 +114,7 @@ public class mcRepair {
dif = (short) (dif / 2); dif = (short) (dif / 2);
if(mcm.getInstance().isHoe(is)) if(mcm.getInstance().isHoe(is))
dif = (short) (dif / 2); dif = (short) (dif / 2);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); PP.addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
} else { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -263,7 +272,8 @@ public class mcRepair {
return false; return false;
} }
public short repairCalculate(Player player, short durability, short ramt){ public short repairCalculate(Player player, short durability, short ramt){
float bonus = (mcUsers.getProfile(player).getRepairInt() / 500); PlayerProfile PP = mcUsers.getProfile(player.getName());
float bonus = (PP.getRepairInt() / 500);
bonus = (ramt * bonus); bonus = (ramt * bonus);
ramt = ramt+=bonus; ramt = ramt+=bonus;
if(checkPlayerProcRepair(player)){ if(checkPlayerProcRepair(player)){
@ -388,12 +398,11 @@ public class mcRepair {
} }
if(durability < 0) if(durability < 0)
durability = 0; durability = 0;
if(checkPlayerProcRepair(player))
durability = 0;
return repairCalculate(player, durability, ramt); return repairCalculate(player, durability, ramt);
} }
public void needMoreVespeneGas(ItemStack is, Player player){ public void needMoreVespeneGas(ItemStack is, Player player){
if ((isDiamondTools(is) || isDiamondArmor(is)) && mcUsers.getProfile(player).getRepairInt() < mcLoadProperties.repairdiamondlevel){ PlayerProfile PP = mcUsers.getProfile(player.getName());
if ((isDiamondTools(is) || isDiamondArmor(is)) && PP.getRepairInt() < mcLoadProperties.repairdiamondlevel){
player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond"); player.sendMessage(ChatColor.DARK_RED +"You're not adept enough to repair Diamond");
} else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){ } else if (isDiamondTools(is) && !hasDiamond(player) || isIronTools(is) && !hasIron(player) || isGoldTools(is) && !hasGold(player)){
if(isDiamondTools(is) && !hasDiamond(player)) if(isDiamondTools(is) && !hasDiamond(player))
@ -407,12 +416,15 @@ public class mcRepair {
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds"); player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.BLUE+ "Diamonds");
} else if (isIronArmor(is) && !hasIron(player)){ } else if (isIronArmor(is) && !hasIron(player)){
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron"); player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GRAY+ "Iron");
} else if (isGoldArmor(is) && !hasGold(player)) } else if (isGoldArmor(is) && !hasGold(player)){
player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold"); player.sendMessage(ChatColor.DARK_RED+"You need more "+ChatColor.GOLD+"Gold");
} else if (is.getAmount() > 1)
player.sendMessage(ChatColor.DARK_RED+"You can't repair stacked items");
} }
public boolean checkPlayerProcRepair(Player player){ public boolean checkPlayerProcRepair(Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getRepairInt()){ if(Math.random() * 1000 <= PP.getRepairInt()){
player.sendMessage(ChatColor.GRAY + "That felt easy."); player.sendMessage(ChatColor.GRAY + "That felt easy.");
return true; return true;
} }

View File

@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile; import com.gmail.nossr50.PlayerList.PlayerProfile;
@ -55,36 +56,54 @@ public class mcSkills {
return x; return x;
} }
public void watchCooldowns(Player player){ public void watchCooldowns(Player player){
if(!mcUsers.getProfile(player).getTreeFellerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ PlayerProfile PP = mcUsers.getProfile(player.getName());
mcUsers.getProfile(player).setTreeFellerInformed(true); if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - PP.getGreenTerraDeactivatedTimeStamp() >= (mcLoadProperties.greenTerraCooldown * 1000)){
PP.setGreenTerraInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Green Terra "+ChatColor.GREEN+"ability is refreshed!");
}
if(!PP.getTreeFellerInformed() && System.currentTimeMillis() - PP.getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
PP.setTreeFellerInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!");
} }
if(!mcUsers.getProfile(player).getSuperBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ if(!PP.getSuperBreakerInformed() && System.currentTimeMillis() - PP.getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
mcUsers.getProfile(player).setSuperBreakerInformed(true); PP.setSuperBreakerInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!");
} }
if(!mcUsers.getProfile(player).getSerratedStrikesInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ if(!PP.getSerratedStrikesInformed() && System.currentTimeMillis() - PP.getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
mcUsers.getProfile(player).setSerratedStrikesInformed(true); PP.setSerratedStrikesInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!");
} }
if(!mcUsers.getProfile(player).getBerserkInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ if(!PP.getBerserkInformed() && System.currentTimeMillis() - PP.getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
mcUsers.getProfile(player).setBerserkInformed(true); PP.setBerserkInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!");
} }
if(!mcUsers.getProfile(player).getSkullSplitterInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ if(!PP.getSkullSplitterInformed() && System.currentTimeMillis() - PP.getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
mcUsers.getProfile(player).setSkullSplitterInformed(true); PP.setSkullSplitterInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!");
} }
if(!mcUsers.getProfile(player).getGigaDrillBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ if(!PP.getGigaDrillBreakerInformed() && System.currentTimeMillis() - PP.getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
mcUsers.getProfile(player).setGigaDrillBreakerInformed(true); PP.setGigaDrillBreakerInformed(true);
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
} }
} }
public void hoeReadinessCheck(Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcPermissions.getInstance().herbalismAbility(player) && mcm.getInstance().isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
if(!PP.getGreenTerraMode() && !cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGreenTerraDeactivatedTimeStamp(), mcLoadProperties.greenTerraCooldown)+"s)");
return;
}
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR HOE**");
PP.setHoePreparationATS(System.currentTimeMillis());
PP.setHoePreparationMode(true);
}
}
public void abilityActivationCheck(Player player){ public void abilityActivationCheck(Player player){
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
if(!PP.getAbilityUse()) if(!PP.getAbilityUse())
return; return;
if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){ if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode()){
if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){ if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)");
@ -132,49 +151,59 @@ public class mcSkills {
} }
} }
} }
public void serratedStrikesActivationCheck(Player player){ public void serratedStrikesActivationCheck(Player player, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isSwords(player.getItemInHand())){ if(mcm.getInstance().isSwords(player.getItemInHand())){
if(mcUsers.getProfile(player).getSwordsPreparationMode()){ if(PP.getSwordsPreparationMode()){
mcUsers.getProfile(player).setSwordsPreparationMode(false); PP.setSwordsPreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getSwordsInt(); int x = PP.getSwordsInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
} }
if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**");
mcUsers.getProfile(player).setSerratedStrikesTicks((ticks * 2) * 1000); for(Player y : pluginx.getServer().getOnlinePlayers()){
mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
mcUsers.getProfile(player).setSerratedStrikesMode(true); y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Serrated Strikes!");
}
PP.setSerratedStrikesTicks((ticks * 2) * 1000);
PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis());
PP.setSerratedStrikesMode(true);
} }
} }
} }
public void berserkActivationCheck(Player player){ public void berserkActivationCheck(Player player, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(player.getItemInHand().getTypeId() == 0){ if(player.getItemInHand().getTypeId() == 0){
if(mcUsers.getProfile(player).getFistsPreparationMode()){ if(PP.getFistsPreparationMode()){
mcUsers.getProfile(player).setFistsPreparationMode(false); PP.setFistsPreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getUnarmedInt(); int x = PP.getUnarmedInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
} }
if(!mcUsers.getProfile(player).getBerserkMode() && cooldownOver(player, mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ if(!PP.getBerserkMode() && cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){
player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**");
mcUsers.getProfile(player).setBerserkTicks(ticks * 1000); for(Player y : pluginx.getServer().getOnlinePlayers()){
mcUsers.getProfile(player).setBerserkActivatedTimeStamp(System.currentTimeMillis()); if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
mcUsers.getProfile(player).setBerserkMode(true); y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Berserk!");
}
PP.setBerserkTicks(ticks * 1000);
PP.setBerserkActivatedTimeStamp(System.currentTimeMillis());
PP.setBerserkMode(true);
} }
} }
} }
public void skullSplitterCheck(Player player){ public void skullSplitterCheck(Player player, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){ if(mcm.getInstance().isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){
/* /*
* CHECK FOR AXE PREP MODE * CHECK FOR AXE PREP MODE
@ -183,7 +212,7 @@ public class mcSkills {
PP.setAxePreparationMode(false); PP.setAxePreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getAxesInt(); int x = PP.getAxesInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -191,6 +220,10 @@ public class mcSkills {
if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ if(!PP.getSkullSplitterMode() && cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
for(Player y : pluginx.getServer().getOnlinePlayers()){
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Skull Splitter!");
}
PP.setSkullSplitterTicks(ticks * 1000); PP.setSkullSplitterTicks(ticks * 1000);
PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis()); PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis());
PP.setSkullSplitterMode(true); PP.setSkullSplitterMode(true);
@ -202,12 +235,13 @@ public class mcSkills {
} }
} }
public void monitorSkills(Player player){ public void monitorSkills(Player player){
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
/*
* AXE PREPARATION MODE
*/
if(PP == null) if(PP == null)
mcUsers.addUser(player); mcUsers.addUser(player);
if(PP.getHoePreparationMode() && System.currentTimeMillis() - PP.getHoePreparationATS() >= 4000){
PP.setHoePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR HOE**");
}
if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){ if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){
PP.setAxePreparationMode(false); PP.setAxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
@ -228,11 +262,21 @@ public class mcSkills {
PP.setShovelPreparationMode(false); PP.setShovelPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**");
} }
/*
* HERBALISM ABILITY
*/
if(mcPermissions.getInstance().herbalismAbility(player)){
if(PP.getGreenTerraMode() && PP.getGreenTerraActivatedTimeStamp() + PP.getGreenTerraTicks() <= System.currentTimeMillis()){
PP.setGreenTerraMode(false);
PP.setGreenTerraInformed(false);
player.sendMessage(ChatColor.RED+"**Green Terra has worn off**");
PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis());
}
}
/* /*
* AXES ABILITY * AXES ABILITY
*/ */
if(mcPermissions.getInstance().axesAbility(player)){ if(mcPermissions.getInstance().axesAbility(player)){
if(mcPermissions.getInstance().unarmedAbility(player)){
if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){ if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){
PP.setSkullSplitterMode(false); PP.setSkullSplitterMode(false);
PP.setSkullSplitterInformed(false); PP.setSkullSplitterInformed(false);
@ -240,7 +284,6 @@ public class mcSkills {
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis()); PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
}
/* /*
* WOODCUTTING ABILITY * WOODCUTTING ABILITY
*/ */
@ -298,125 +341,136 @@ public class mcSkills {
} }
} }
public void XpCheck(Player player){ public void XpCheck(Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
/* /*
* ACROBATICS * ACROBATICS
*/ */
if(player != null && mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ if(player != null && PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ while(PP.getAcrobaticsGatherInt() >= PP.getXpToLevel("acrobatics")){
skillups++; skillups++;
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics")); PP.removeAcrobaticsGather(PP.getXpToLevel("acrobatics"));
mcUsers.getProfile(player).skillUpAcrobatics(1); PP.skillUpAcrobatics(1);
} }
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")"); if(player != null && PP.getAcrobatics() != null)
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+PP.getAcrobatics()+")");
} }
/* /*
* ARCHERY * ARCHERY
*/ */
if(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){ if(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){ while(PP.getArcheryGatherInt() >= PP.getXpToLevel("archery")){
skillups++; skillups++;
mcUsers.getProfile(player).removeArcheryGather(mcUsers.getProfile(player).getXpToLevel("archery")); PP.removeArcheryGather(PP.getXpToLevel("archery"));
mcUsers.getProfile(player).skillUpArchery(1); PP.skillUpArchery(1);
} }
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getArchery()+")"); if(player != null && PP.getArchery() != null)
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+PP.getArchery()+")");
} }
/* /*
* SWORDS * SWORDS
*/ */
if(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){ if(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){ while(PP.getSwordsGatherInt() >= PP.getXpToLevel("swords")){
skillups++; skillups++;
mcUsers.getProfile(player).removeSwordsGather(mcUsers.getProfile(player).getXpToLevel("swords")); PP.removeSwordsGather(PP.getXpToLevel("swords"));
mcUsers.getProfile(player).skillUpSwords(1); PP.skillUpSwords(1);
} }
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getSwords()+")"); if(player != null && PP.getSwords() != null)
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+PP.getSwords()+")");
} }
/* /*
* AXES * AXES
*/ */
if(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){ if(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){ while(PP.getAxesGatherInt() >= PP.getXpToLevel("axes")){
skillups++; skillups++;
mcUsers.getProfile(player).removeAxesGather(mcUsers.getProfile(player).getXpToLevel("axes")); PP.removeAxesGather(PP.getXpToLevel("axes"));
mcUsers.getProfile(player).skillUpAxes(1); PP.skillUpAxes(1);
} }
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAxes()+")"); if(player != null && PP.getAxes() != null)
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+PP.getAxes()+")");
} }
/* /*
* UNARMED * UNARMED
*/ */
if(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){ if(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){ while(PP.getUnarmedGatherInt() >= PP.getXpToLevel("unarmed")){
skillups++; skillups++;
mcUsers.getProfile(player).removeUnarmedGather(mcUsers.getProfile(player).getXpToLevel("unarmed")); PP.removeUnarmedGather(PP.getXpToLevel("unarmed"));
mcUsers.getProfile(player).skillUpUnarmed(1); PP.skillUpUnarmed(1);
} }
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getUnarmed()+")"); if(player != null && PP.getUnarmed() != null)
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+PP.getUnarmed()+")");
} }
/* /*
* HERBALISM * HERBALISM
*/ */
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){ if(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){ while(PP.getHerbalismGatherInt() >= PP.getXpToLevel("herbalism")){
skillups++; skillups++;
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism")); PP.removeHerbalismGather(PP.getXpToLevel("herbalism"));
mcUsers.getProfile(player).skillUpHerbalism(1); PP.skillUpHerbalism(1);
} }
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")"); if(player != null && PP.getHerbalism() != null)
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+PP.getHerbalism()+")");
} }
/* /*
* MINING * MINING
*/ */
if(player != null && mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ if(player != null && PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ while(PP.getMiningGatherInt() >= PP.getXpToLevel("mining")){
skillups++; skillups++;
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining")); PP.removeMiningGather(PP.getXpToLevel("mining"));
mcUsers.getProfile(player).skillUpMining(1); PP.skillUpMining(1);
} }
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")"); if(player != null && PP.getMining() != null)
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+PP.getMining()+")");
} }
/* /*
* WOODCUTTING * WOODCUTTING
*/ */
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){ if(player != null && PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){ while(PP.getWoodCuttingGatherInt() >= PP.getXpToLevel("woodcutting")){
skillups++; skillups++;
mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting")); PP.removeWoodCuttingGather(PP.getXpToLevel("woodcutting"));
mcUsers.getProfile(player).skillUpWoodCutting(1); PP.skillUpWoodCutting(1);
} }
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")"); if(player != null && PP.getWoodCutting() != null)
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+PP.getWoodCutting()+")");
} }
/* /*
* REPAIR * REPAIR
*/ */
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){ if(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){ while(PP.getRepairGatherInt() >= PP.getXpToLevel("repair")){
skillups++; skillups++;
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair")); PP.removeRepairGather(PP.getXpToLevel("repair"));
mcUsers.getProfile(player).skillUpRepair(1); PP.skillUpRepair(1);
} }
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")"); if(player != null && PP.getRepair() != null)
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+PP.getRepair()+")");
} }
/* /*
* EXCAVATION * EXCAVATION
*/ */
if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){ if(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){ while(PP.getExcavationGatherInt() >= PP.getXpToLevel("excavation")){
skillups++; skillups++;
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation")); PP.removeExcavationGather(PP.getXpToLevel("excavation"));
mcUsers.getProfile(player).skillUpExcavation(1); PP.skillUpExcavation(1);
} }
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")"); if(player != null && PP.getExcavation() != null)
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+PP.getExcavation()+")");
} }
} }
public boolean isSkill(String skillname){ public boolean isSkill(String skillname){

View File

@ -5,6 +5,8 @@ import java.util.TimerTask;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcTimer extends TimerTask{ public class mcTimer extends TimerTask{
private final mcMMO plugin; private final mcMMO plugin;
@ -17,9 +19,10 @@ public class mcTimer extends TimerTask{
public void run() { public void run() {
Player[] playerlist = plugin.getServer().getOnlinePlayers(); Player[] playerlist = plugin.getServer().getOnlinePlayers();
for(Player player : playerlist){ for(Player player : playerlist){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(player == null) if(player == null)
continue; continue;
if(mcUsers.getProfile(player) == null) if(PP == null)
mcUsers.addUser(player); mcUsers.addUser(player);
/* /*
* MONITOR SKILLS * MONITOR SKILLS
@ -33,31 +36,31 @@ public class mcTimer extends TimerTask{
/* /*
* PLAYER BLEED MONITORING * PLAYER BLEED MONITORING
*/ */
if(thecount % 2 == 0 && player != null && mcUsers.getProfile(player).getBleedTicks() >= 1){ if(thecount % 2 == 0 && player != null && PP.getBleedTicks() >= 1){
player.damage(2); player.damage(2);
mcUsers.getProfile(player).decreaseBleedTicks(); PP.decreaseBleedTicks();
} }
if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= mcUsers.getProfile(player).getRecentlyHurt() + 60000){ if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= PP.getRecentlyHurt() + 60000){
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){ if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 1000){ && mcm.getInstance().getPowerLevel(player) >= 1000){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }
if(thecount == 20 || thecount == 40){ if(thecount == 20 || thecount == 40){
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 500 && mcm.getInstance().getPowerLevel(player) >= 500
&& mcUsers.getProfile(player).getPowerLevel() < 1000){ && mcm.getInstance().getPowerLevel(player) < 1000){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }
if(thecount == 40){ if(thecount == 40){
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() < 500){ && mcm.getInstance().getPowerLevel(player) < 500){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }

View File

@ -77,8 +77,8 @@ public class mcUsers {
//Output: none //Output: none
//Use: Creates the player profile //Use: Creates the player profile
//===================================================================== //=====================================================================
public static void removeUser(Player player){ public static void removeUser(String playername){
players.removePlayer(player); players.removePlayer(playername);
} }
//===================================================================== //=====================================================================
@ -87,8 +87,8 @@ public class mcUsers {
//Output: PlayerList.PlayerProfile: The profile //Output: PlayerList.PlayerProfile: The profile
//Use: Gets the player profile //Use: Gets the player profile
//===================================================================== //=====================================================================
public static PlayerList.PlayerProfile getProfile(Player player){ public static PlayerList.PlayerProfile getProfile(String playername){
return players.findProfile(player); return players.findProfile(playername);
} }
public static mcUsers getInstance() { public static mcUsers getInstance() {
@ -131,9 +131,9 @@ class PlayerList
//Output: None //Output: None
//Use: Remove the profile of the specified player //Use: Remove the profile of the specified player
//===================================================================== //=====================================================================
public void removePlayer(Player player) public void removePlayer(String playername)
{ {
players.remove(findProfile(player)); players.remove(findProfile(playername));
} }
//===================================================================== //=====================================================================
@ -142,11 +142,11 @@ class PlayerList
//Output: PlayerProfile: The profile of the specified player //Output: PlayerProfile: The profile of the specified player
//Use: Get the profile for the specified player //Use: Get the profile for the specified player
//===================================================================== //=====================================================================
public PlayerProfile findProfile(Player player) public PlayerProfile findProfile(String playername)
{ {
for(PlayerProfile ply : players) for(PlayerProfile ply : players)
{ {
if(ply.isPlayer(player)) if(ply.isPlayer(playername))
return ply; return ply;
} }
return null; return null;
@ -157,12 +157,12 @@ class PlayerList
protected final Logger log = Logger.getLogger("Minecraft"); protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; private boolean greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode;
private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0,
treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, greenTerraCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0,
superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0, mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0,
skullSplitterATS = 0, skullSplitterDATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0; skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0;
private int berserkTicks = 0, bleedticks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0; private int berserkTicks = 0, bleedticks = 0, greenTerraTicks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0;
//ATS = (Time of) Activation Time Stamp //ATS = (Time of) Activation Time Stamp
//DATS = (Time of) Deactivation Time Stamp //DATS = (Time of) Deactivation Time Stamp
Player thisplayer; Player thisplayer;
@ -420,10 +420,12 @@ class PlayerList
//Output: Player: The player this profile belongs to //Output: Player: The player this profile belongs to
//Use: Finds if this profile belongs to a specified player //Use: Finds if this profile belongs to a specified player
//===================================================================== //=====================================================================
public boolean isPlayer(Player player) public boolean isPlayer(String player)
{ {
return player.getName().equals(playerName); return player.equals(playerName);
} }
public boolean getPartyChatOnlyToggle(){return partyChatOnly;}
public void togglePartyChatOnly(){partyChatOnly = !partyChatOnly;}
public boolean getAbilityUse(){ public boolean getAbilityUse(){
return abilityuse; return abilityuse;
} }
@ -434,6 +436,12 @@ class PlayerList
abilityuse = false; abilityuse = false;
} }
} }
public long getMySpawnATS(){
return mySpawnATS;
}
public void setMySpawnATS(long newvalue){
mySpawnATS = newvalue;
}
public void decreaseBleedTicks(){ public void decreaseBleedTicks(){
if(bleedticks >= 1){ if(bleedticks >= 1){
bleedticks--; bleedticks--;
@ -461,6 +469,22 @@ class PlayerList
public long getArcheryShotATS() {return archeryShotATS;} public long getArcheryShotATS() {return archeryShotATS;}
public void setArcheryShotATS(long newvalue) {archeryShotATS = newvalue;} public void setArcheryShotATS(long newvalue) {archeryShotATS = newvalue;}
/*
* HOE PREPARATION
*/
public boolean getHoePreparationMode(){
return hoePreparationMode;
}
public void setHoePreparationMode(Boolean bool){
hoePreparationMode = bool;
}
public long getHoePreparationATS(){
return hoePreparationATS;
}
public void setHoePreparationATS(long newvalue){
hoePreparationATS = newvalue;
}
/* /*
* SWORDS PREPARATION * SWORDS PREPARATION
*/ */
@ -536,6 +560,35 @@ class PlayerList
public void setPickaxePreparationATS(long newvalue){ public void setPickaxePreparationATS(long newvalue){
pickaxePreparationATS = newvalue; pickaxePreparationATS = newvalue;
} }
/*
* GREEN TERRA MODE
*/
public boolean getGreenTerraInformed() {return greenTerraInformed;}
public void setGreenTerraInformed(Boolean bool){
greenTerraInformed = bool;
}
public boolean getGreenTerraMode(){
return greenTerraMode;
}
public void setGreenTerraMode(Boolean bool){
greenTerraMode = bool;
}
public long getGreenTerraActivatedTimeStamp() {return greenTerraATS;}
public void setGreenTerraActivatedTimeStamp(Long newvalue){
greenTerraATS = newvalue;
}
public long getGreenTerraDeactivatedTimeStamp() {return greenTerraDATS;}
public void setGreenTerraDeactivatedTimeStamp(Long newvalue){
greenTerraDATS = newvalue;
}
public void setGreenTerraCooldown(Long newvalue){
greenTerraCooldown = newvalue;
}
public long getGreenTerraCooldown(){
return greenTerraCooldown;
}
public void setGreenTerraTicks(Integer newvalue){greenTerraTicks = newvalue;}
public int getGreenTerraTicks(){return greenTerraTicks;}
/* /*
* BERSERK MODE * BERSERK MODE
*/ */
@ -1472,8 +1525,10 @@ class PlayerList
axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue); axesgather = String.valueOf(Integer.valueOf(axesgather)+newvalue);
} }
save(); save();
if(isPlayer(playerName)){
mcSkills.getInstance().XpCheck(thisplayer); mcSkills.getInstance().XpCheck(thisplayer);
} }
}
public void modifyskill(int newvalue, String skillname){ public void modifyskill(int newvalue, String skillname){
if(skillname.toLowerCase().equals("mining")){ if(skillname.toLowerCase().equals("mining")){
mining = String.valueOf(newvalue); mining = String.valueOf(newvalue);
@ -1553,30 +1608,6 @@ class PlayerList
return 0; return 0;
} }
} }
public int getPowerLevel(){
int x = 0;
if(mcPermissions.getInstance().mining(thisplayer))
x+=getMiningInt();
if(mcPermissions.getInstance().woodcutting(thisplayer))
x+=getWoodCuttingInt();
if(mcPermissions.getInstance().unarmed(thisplayer))
x+=getUnarmedInt();
if(mcPermissions.getInstance().herbalism(thisplayer))
x+=getHerbalismInt();
if(mcPermissions.getInstance().excavation(thisplayer))
x+=getExcavationInt();
if(mcPermissions.getInstance().archery(thisplayer))
x+=getArcheryInt();
if(mcPermissions.getInstance().swords(thisplayer))
x+=getSwordsInt();
if(mcPermissions.getInstance().axes(thisplayer))
x+=getAxesInt();
if(mcPermissions.getInstance().acrobatics(thisplayer))
x+=getAcrobaticsInt();
if(mcPermissions.getInstance().repair(thisplayer))
x+=getRepairInt();
return x;
}
public int getMiningGatherInt() { public int getMiningGatherInt() {
if(isInt(gather)){ if(isInt(gather)){
return Integer.parseInt(gather); return Integer.parseInt(gather);
@ -1654,9 +1685,9 @@ class PlayerList
public Location getMySpawn(Player player){ public Location getMySpawn(Player player){
Location loc = player.getWorld().getSpawnLocation(); Location loc = player.getWorld().getSpawnLocation();
if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){ if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){
loc.setX(Double.parseDouble(mcUsers.getProfile(player).getX())); loc.setX(Double.parseDouble(mcUsers.getProfile(player.getName()).getX()));
loc.setY(Double.parseDouble(mcUsers.getProfile(player).getY())); loc.setY(Double.parseDouble(mcUsers.getProfile(player.getName()).getY()));
loc.setZ(Double.parseDouble(mcUsers.getProfile(player).getZ())); loc.setZ(Double.parseDouble(mcUsers.getProfile(player.getName()).getZ()));
} else { } else {
return null; return null;
} }

View File

@ -8,6 +8,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile; import com.gmail.nossr50.PlayerList.PlayerProfile;
@ -27,17 +28,18 @@ public class mcWoodCutting {
return instance; return instance;
} }
public void woodCuttingProcCheck(Player player, Block block){ public void woodCuttingProcCheck(Player player, Block block){
PlayerProfile PP = mcUsers.getProfile(player.getName());
byte type = block.getData(); byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(player != null){ if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getWoodCuttingInt()){ if(Math.random() * 1000 <= PP.getWoodCuttingInt()){
ItemStack item = new ItemStack(mat, 1, (short) 0, type); ItemStack item = new ItemStack(mat, 1, (short) 0, type);
block.getWorld().dropItemNaturally(block.getLocation(), item); block.getWorld().dropItemNaturally(block.getLocation(), item);
} }
} }
} }
public void treeFellerCheck(Player player, Block block){ public void treeFellerCheck(Player player, Block block, Plugin pluginx){
PlayerProfile PP = mcUsers.getProfile(player); PlayerProfile PP = mcUsers.getProfile(player.getName());
if(mcm.getInstance().isAxes(player.getItemInHand())){ if(mcm.getInstance().isAxes(player.getItemInHand())){
if(block != null){ if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block)) if(!mcm.getInstance().abilityBlockCheck(block))
@ -50,7 +52,7 @@ public class mcWoodCutting {
PP.setAxePreparationMode(false); PP.setAxePreparationMode(false);
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getWoodCuttingInt(); int x = PP.getWoodCuttingInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -58,6 +60,10 @@ public class mcWoodCutting {
if(!PP.getTreeFellerMode() && mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ if(!PP.getTreeFellerMode() && mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
for(Player y : pluginx.getServer().getOnlinePlayers()){
if(y != null && y != player && mcm.getInstance().getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(ChatColor.GREEN+player.getName()+ChatColor.DARK_GREEN+" has used "+ChatColor.RED+"Tree Feller!");
}
PP.setTreeFellerTicks(ticks * 1000); PP.setTreeFellerTicks(ticks * 1000);
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis()); PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
PP.setTreeFellerMode(true); PP.setTreeFellerMode(true);
@ -69,10 +75,11 @@ public class mcWoodCutting {
} }
} }
public void treeFeller(Block block, Player player){ public void treeFeller(Block block, Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
int radius = 1; int radius = 1;
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500) if(PP.getWoodCuttingGatherInt() >= 500)
radius++; radius++;
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 950) if(PP.getWoodCuttingGatherInt() >= 950)
radius++; radius++;
ArrayList<Block> blocklist = new ArrayList<Block>(); ArrayList<Block> blocklist = new ArrayList<Block>();
ArrayList<Block> toAdd = new ArrayList<Block>(); ArrayList<Block> toAdd = new ArrayList<Block>();

View File

@ -14,11 +14,14 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcm { public class mcm {
/* /*
* I'm storing my functions/methods in here in an unorganized manner. Spheal with it. * I'm storing my functions/methods in here in an unorganized manner. Spheal with it.
*/ */
private static mcMMO plugin; private static mcMMO plugin;
private static mcMMO pluginx;
public mcm(mcMMO instance) { public mcm(mcMMO instance) {
plugin = instance; plugin = instance;
} }
@ -30,7 +33,31 @@ public class mcm {
return instance; return instance;
} }
public int getPowerLevel(Player player){
PlayerProfile PP = mcUsers.getProfile(player.getName());
int x = 0;
if(mcPermissions.getInstance().mining(player))
x+=PP.getMiningInt();
if(mcPermissions.getInstance().woodcutting(player))
x+=PP.getWoodCuttingInt();
if(mcPermissions.getInstance().unarmed(player))
x+=PP.getUnarmedInt();
if(mcPermissions.getInstance().herbalism(player))
x+=PP.getHerbalismInt();
if(mcPermissions.getInstance().excavation(player))
x+=PP.getExcavationInt();
if(mcPermissions.getInstance().archery(player))
x+=PP.getArcheryInt();
if(mcPermissions.getInstance().swords(player))
x+=PP.getSwordsInt();
if(mcPermissions.getInstance().axes(player))
x+=PP.getAxesInt();
if(mcPermissions.getInstance().acrobatics(player))
x+=PP.getAcrobaticsInt();
if(mcPermissions.getInstance().repair(player))
x+=PP.getRepairInt();
return x;
}
public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){ public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
@ -180,7 +207,7 @@ public class mcm {
} }
public boolean shouldBeWatched(Block block){ public boolean shouldBeWatched(Block block){
int id = block.getTypeId(); int id = block.getTypeId();
if(id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){ if(id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24){
return true; return true;
} else { } else {
return false; return false;
@ -277,11 +304,12 @@ public class mcm {
} }
} }
public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){ public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
PlayerProfile PP = mcUsers.getProfile(player.getName());
if(split[0].equalsIgnoreCase("/woodcutting")){ if(split[0].equalsIgnoreCase("/woodcutting")){
event.setCancelled(true); event.setCancelled(true);
float skillvalue = (float)mcUsers.getProfile(player).getWoodCuttingInt(); float skillvalue = (float)PP.getWoodCuttingInt();
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getWoodCuttingInt(); int x = PP.getWoodCuttingInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -299,33 +327,33 @@ public class mcm {
if(split[0].equalsIgnoreCase("/archery")){ if(split[0].equalsIgnoreCase("/archery")){
event.setCancelled(true); event.setCancelled(true);
Integer rank = 0; Integer rank = 0;
if(mcUsers.getProfile(player).getArcheryInt() >= 50) if(PP.getArcheryInt() >= 50)
rank++; rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 250) if(PP.getArcheryInt() >= 250)
rank++; rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 575) if(PP.getArcheryInt() >= 575)
rank++; rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 725) if(PP.getArcheryInt() >= 725)
rank++; rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 1000) if(PP.getArcheryInt() >= 1000)
rank++; rank++;
float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt(); float skillvalue = (float)PP.getArcheryInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
int ignition = 20; int ignition = 20;
if(mcUsers.getProfile(player).getArcheryInt() >= 200) if(PP.getArcheryInt() >= 200)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 400) if(PP.getArcheryInt() >= 400)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 600) if(PP.getArcheryInt() >= 600)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 800) if(PP.getArcheryInt() >= 800)
ignition+=20; ignition+=20;
if(mcUsers.getProfile(player).getArcheryInt() >= 1000) if(PP.getArcheryInt() >= 1000)
ignition+=20; ignition+=20;
String percentagedaze; String percentagedaze;
if(mcUsers.getProfile(player).getArcheryInt() < 1000){ if(PP.getArcheryInt() < 1000){
percentagedaze = String.valueOf((skillvalue / 2000) * 100); percentagedaze = String.valueOf((skillvalue / 2000) * 100);
} else { } else {
percentagedaze = "50"; percentagedaze = "50";
@ -346,14 +374,14 @@ public class mcm {
if(split[0].equalsIgnoreCase("/axes")){ if(split[0].equalsIgnoreCase("/axes")){
event.setCancelled(true); event.setCancelled(true);
String percentage; String percentage;
float skillvalue = (float)mcUsers.getProfile(player).getAxesInt(); float skillvalue = (float)PP.getAxesInt();
if(mcUsers.getProfile(player).getAxesInt() < 750){ if(PP.getAxesInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100); percentage = String.valueOf((skillvalue / 1000) * 100);
} else { } else {
percentage = "75"; percentage = "75";
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getAxesInt(); int x = PP.getAxesInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -367,7 +395,7 @@ public class mcm {
player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%");
if(mcUsers.getProfile(player).getAxesInt() < 500){ if(PP.getAxesInt() < 500){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)"); player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)");
} else { } else {
player.sendMessage(ChatColor.RED+"Axe Mastery:"+ChatColor.YELLOW+" Bonus 4 damage"); player.sendMessage(ChatColor.RED+"Axe Mastery:"+ChatColor.YELLOW+" Bonus 4 damage");
@ -378,8 +406,8 @@ public class mcm {
event.setCancelled(true); event.setCancelled(true);
int bleedrank = 2; int bleedrank = 2;
String percentage, parrypercentage = null, counterattackpercentage; String percentage, parrypercentage = null, counterattackpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getSwordsInt(); float skillvalue = (float)PP.getSwordsInt();
if(mcUsers.getProfile(player).getSwordsInt() < 750){ if(PP.getSwordsInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100); percentage = String.valueOf((skillvalue / 1000) * 100);
} else { } else {
percentage = "75"; percentage = "75";
@ -387,20 +415,20 @@ public class mcm {
if(skillvalue >= 750) if(skillvalue >= 750)
bleedrank+=1; bleedrank+=1;
if(mcUsers.getProfile(player).getSwordsInt() <= 900){ if(PP.getSwordsInt() <= 900){
parrypercentage = String.valueOf((skillvalue / 3000) * 100); parrypercentage = String.valueOf((skillvalue / 3000) * 100);
} else { } else {
parrypercentage = "30"; parrypercentage = "30";
} }
if(mcUsers.getProfile(player).getSwordsInt() <= 600){ if(PP.getSwordsInt() <= 600){
counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
} else { } else {
counterattackpercentage = "30"; counterattackpercentage = "30";
} }
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getSwordsInt(); int x = PP.getSwordsInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -426,10 +454,10 @@ public class mcm {
if(split[0].equalsIgnoreCase("/acrobatics")){ if(split[0].equalsIgnoreCase("/acrobatics")){
event.setCancelled(true); event.setCancelled(true);
String dodgepercentage; String dodgepercentage;
float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt(); float skillvalue = (float)PP.getAcrobaticsInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2);
if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){ if(PP.getAcrobaticsInt() <= 800){
dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
} else { } else {
dodgepercentage = "20"; dodgepercentage = "20";
@ -446,10 +474,10 @@ public class mcm {
player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%"); player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%");
} }
if(split[0].equalsIgnoreCase("/mining")){ if(split[0].equalsIgnoreCase("/mining")){
float skillvalue = (float)mcUsers.getProfile(player).getMiningInt(); float skillvalue = (float)PP.getMiningInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getMiningInt(); int x = PP.getMiningInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -465,7 +493,7 @@ public class mcm {
player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+ticks+"s"); player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+ticks+"s");
} }
if(split[0].equalsIgnoreCase("/repair")){ if(split[0].equalsIgnoreCase("/repair")){
float skillvalue = (float)mcUsers.getProfile(player).getRepairInt(); float skillvalue = (float)PP.getRepairInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String repairmastery = String.valueOf((skillvalue / 500) * 100); String repairmastery = String.valueOf((skillvalue / 500) * 100);
event.setCancelled(true); event.setCancelled(true);
@ -483,15 +511,15 @@ public class mcm {
if(split[0].equalsIgnoreCase("/unarmed")){ if(split[0].equalsIgnoreCase("/unarmed")){
event.setCancelled(true); event.setCancelled(true);
String percentage, arrowpercentage; String percentage, arrowpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getUnarmedInt(); float skillvalue = (float)PP.getUnarmedInt();
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){ if(PP.getUnarmedInt() < 1000){
percentage = String.valueOf((skillvalue / 4000) * 100); percentage = String.valueOf((skillvalue / 4000) * 100);
} else { } else {
percentage = "25"; percentage = "25";
} }
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){ if(PP.getUnarmedInt() < 1000){
arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
} else { } else {
arrowpercentage = "50"; arrowpercentage = "50";
@ -499,7 +527,7 @@ public class mcm {
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getUnarmedInt(); int x = PP.getUnarmedInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;
@ -516,9 +544,9 @@ public class mcm {
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Arrow Deflect Chance: "+ChatColor.YELLOW+arrowpercentage+"%"); player.sendMessage(ChatColor.RED+"Arrow Deflect Chance: "+ChatColor.YELLOW+arrowpercentage+"%");
player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%");
if(mcUsers.getProfile(player).getUnarmedInt() < 250){ if(PP.getUnarmedInt() < 250){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)"); player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)");
} else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){ } else if(PP.getUnarmedInt() >= 250 && PP.getUnarmedInt() < 500){
player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade"); player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade");
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)"); player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)");
} else { } else {
@ -529,37 +557,59 @@ public class mcm {
if(split[0].equalsIgnoreCase("/herbalism")){ if(split[0].equalsIgnoreCase("/herbalism")){
event.setCancelled(true); event.setCancelled(true);
int rank = 0; int rank = 0;
if(mcUsers.getProfile(player).getHerbalismInt() >= 50) if(PP.getHerbalismInt() >= 50)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 150) if (PP.getHerbalismInt() >= 150)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 250) if (PP.getHerbalismInt() >= 250)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 350) if (PP.getHerbalismInt() >= 350)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 450) if (PP.getHerbalismInt() >= 450)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 550) if (PP.getHerbalismInt() >= 550)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 650) if (PP.getHerbalismInt() >= 650)
rank++; rank++;
if (mcUsers.getProfile(player).getHerbalismInt() >= 750) if (PP.getHerbalismInt() >= 750)
rank++; rank++;
float skillvalue = (float)mcUsers.getProfile(player).getHerbalismInt(); int bonus = 0;
if(PP.getHerbalismInt() >= 200)
bonus++;
if(PP.getHerbalismInt() >= 400)
bonus++;
if(PP.getHerbalismInt() >= 600)
bonus++;
int ticks = 2;
int x = PP.getHerbalismInt();
while(x >= 50){
x-=50;
ticks++;
}
float skillvalue = (float)PP.getHerbalismInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String gpercentage = String.valueOf((skillvalue / 1500) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Harvesting Herbs"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Harvesting Herbs");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Green Terra (ABILITY): "+ChatColor.GREEN+"Spread the Terra, 3x Drops");
player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Wheat): "+ChatColor.GREEN+"Auto-Plants wheat when harvesting");
player.sendMessage(ChatColor.DARK_AQUA+"Green Thumb (Cobble): "+ChatColor.GREEN+"Cobblestone -> Mossy w/ Seeds");
player.sendMessage(ChatColor.DARK_AQUA+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew"); player.sendMessage(ChatColor.DARK_AQUA+"Food+: "+ChatColor.GREEN+"Modifies health received from bread/stew");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (All Herbs): "+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Green Terra Length: "+ChatColor.YELLOW+ticks+"s");
player.sendMessage(ChatColor.RED+"Green Thumb Chance: "+gpercentage+"%");
player.sendMessage(ChatColor.RED+"Green Thumb Stage: Wheat grows in stage "+bonus);
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%"); player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%");
player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing"); player.sendMessage(ChatColor.RED+"Food+ (Rank"+rank+"): Bonus "+rank+" healing");
} }
if(split[0].equalsIgnoreCase("/excavation")){ if(split[0].equalsIgnoreCase("/excavation")){
event.setCancelled(true); event.setCancelled(true);
int ticks = 2; int ticks = 2;
int x = mcUsers.getProfile(player).getExcavationInt(); int x = PP.getExcavationInt();
while(x >= 50){ while(x >= 50){
x-=50; x-=50;
ticks++; ticks++;

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.9.21 version: 0.9.25