Another WIP of 0.9, not recommended for use

This commit is contained in:
nossr50 2011-03-12 22:18:15 -08:00
parent 0111d992eb
commit cdb5547ed1
19 changed files with 707 additions and 501 deletions

View File

@ -1,5 +1,16 @@
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
/<skillname> now shows much more information to the player regarding their stats
Unarmed disarm is now based directly on your skill level
Axe crits is now based directly on your skill level
Herbalism now applies double drops to herbs
/mmoedit is no longer case sensitive
Version 0.8.22
Fixed bug where Axes did less damage than normal
Acrobatic rolls now give XP
Acrobatics XP increased for non-rolls
Version 0.8.21 Version 0.8.21
Fixed bug where axe criticals would dupe items Fixed bug where axe criticals would dupe items
Version 0.8.20 Version 0.8.20

View File

@ -18,6 +18,11 @@ public class mcAcrobatics {
if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){ if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){
event.setCancelled(true); event.setCancelled(true);
player.sendMessage("**ROLLED**"); player.sendMessage("**ROLLED**");
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){
mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 8);
mcSkills.getInstance().XpCheck(player);
}
return; return;
} }
} }
@ -25,16 +30,8 @@ public class mcAcrobatics {
return; return;
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
&& mcPermissions.getInstance().acrobatics(player)){ && mcPermissions.getInstance().acrobatics(player)){
mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 8); mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 12);
if(player != null && mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){ mcSkills.getInstance().XpCheck(player);
int skillups = 0;
while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
skillups++;
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics"));
mcUsers.getProfile(player).skillUpAcrobatics(1);
}
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z)); mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
if(player.getHealth() - event.getDamage() <= 0){ if(player.getHealth() - event.getDamage() <= 0){
if(mcUsers.getProfile(player).isDead()) if(mcUsers.getProfile(player).isDead())

View File

@ -45,99 +45,102 @@ public class mcBlockListener extends BlockListener {
} }
//put all Block related code here //put all Block related code here
public void onBlockDamage(BlockDamageEvent event) { public void onBlockDamage(BlockDamageEvent event) {
//STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2); //STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2);
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
//player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")"); //player.sendMessage("mcMMO DEBUG: EVENT-OK DMG LEVEL ("+event.getDamageLevel().getLevel()+")");
Block block = event.getBlock(); Block block = event.getBlock();
Location loc = block.getLocation(); Location loc = block.getLocation();
int dmg = event.getDamageLevel().getLevel(); int dmg = event.getDamageLevel().getLevel();
/*
* HERBALISM /*
*/ * SUPER BREAKER CHECKS
if(dmg == 3){ */
if(mcPermissions.getInstance().herbalism(player)) if(mcUsers.getProfile(player).getSuperBreakerMode() && dmg == 0 && mcMining.getInstance().canBeSuperBroken(block)){
mcHerbalism.getInstance().herbalismProcCheck(block, player); if(mcLoadProperties.miningrequirespickaxe){
if(mcm.getInstance().isMiningPick(inhand))
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
} else {
mcMining.getInstance().SuperBreakerBlockCheck(player, block);
} }
}
/*
* HERBALISM
*/
if(dmg == 3){
if(mcPermissions.getInstance().herbalism(player))
mcHerbalism.getInstance().herbalismProcCheck(block, player);
}
if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){
/* /*
* MINING * MINING
*/ */
if(player != null && dmg == 2 && !mcConfig.getInstance().isBlockWatched(block)){ if(mcPermissions.getInstance().mining(player)){
if(mcPermissions.getInstance().mining(player)){ if(mcLoadProperties.miningrequirespickaxe){
if(mcLoadProperties.miningrequirespickaxe){ if(mcm.getInstance().isMiningPick(inhand))
if(mcm.getInstance().isMiningPick(inhand)) mcMining.getInstance().miningBlockCheck(player, block);
mcMining.getInstance().miningBlockCheck(player, block); } else {
} else { mcMining.getInstance().miningBlockCheck(player, block);
mcMining.getInstance().miningBlockCheck(player, block);
}
} }
/* }
* WOOD CUTTING /*
*/ * WOOD CUTTING
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ */
if(mcLoadProperties.woodcuttingrequiresaxe){ if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
if(mcm.getInstance().isAxes(inhand)){ if(mcLoadProperties.woodcuttingrequiresaxe){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc); if(mcm.getInstance().isAxes(inhand)){
mcUsers.getProfile(player).addWoodcuttingGather(7);
}
} else {
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc); mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(7); mcUsers.getProfile(player).addWoodcuttingGather(7);
} }
/* } else {
* IF PLAYER IS USING TREEFELLER mcWoodCutting.getInstance().woodCuttingProcCheck(player, block, loc);
*/ mcUsers.getProfile(player).addWoodcuttingGather(7);
if(mcPermissions.getInstance().woodcuttingability(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){ }
mcWoodCutting.getInstance().treeFeller(block, player); mcSkills.getInstance().XpCheck(player);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){ /*
if(blockx != null){ * IF PLAYER IS USING TREEFELLER
Material mat = Material.getMaterial(blockx.getTypeId()); */
byte damage = 0; if(mcPermissions.getInstance().woodcuttingability(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); mcWoodCutting.getInstance().treeFeller(block, player);
blockx.setTypeId(0); for(Block blockx : mcConfig.getInstance().getTreeFeller()){
if(item.getTypeId() == 17){ if(blockx != null){
Material mat = Material.getMaterial(17);
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
blockx.setType(Material.AIR);
if(item.getTypeId() == 17){
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item); blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation()); mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation());
mcUsers.getProfile(player).addWoodcuttingGather(7); mcUsers.getProfile(player).addWoodcuttingGather(7);
} }
if(item.getTypeId() == 18){
mat = Material.getMaterial(6); if(item.getTypeId() == 18){
item = new ItemStack(mat, 1, (byte)0, damage); mat = Material.getMaterial(6);
if(Math.random() * 10 > 8) item = new ItemStack(mat, 1, (byte)0, damage);
if(Math.random() * 10 > 8)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item); blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
}
} }
} }
}
/* /*
* NOTE TO SELF * NOTE TO SELF
* I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED * I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED
* OR ELSE IT COULD BE A MEMORY LEAK SITUATION * OR ELSE IT COULD BE A MEMORY LEAK SITUATION
*/ */
mcConfig.getInstance().clearTreeFeller(); mcConfig.getInstance().clearTreeFeller();
} }
} }
/* /*
* EXCAVATION * EXCAVATION
*/ */
if(mcPermissions.getInstance().excavation(player) && block != null && player != null) if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
mcExcavation.getInstance().excavationProcCheck(block, player); mcExcavation.getInstance().excavationProcCheck(block, player);
/*
* EXPLOIT COUNTERMEASURES
*/
mcConfig.getInstance().addBlockWatch(block);
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
int skillups = 0;
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
skillups++;
mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
mcUsers.getProfile(player).skillUpWoodCutting(1);
}
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");
}
} }
} }
public void onBlockFlow(BlockFromToEvent event) { public void onBlockFlow(BlockFromToEvent event) {
//Code borrowed from WorldGuard by sk89q //Code borrowed from WorldGuard by sk89q
World world = event.getBlock().getWorld(); World world = event.getBlock().getWorld();

View File

@ -40,7 +40,7 @@ public class mcCombat {
//This may help compatability with NPC mods //This may help compatability with NPC mods
if(mcUsers.getProfile(defender) == null) if(mcUsers.getProfile(defender) == null)
mcUsers.addUser(defender); mcUsers.addUser(defender);
if(mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){ if(attacker != null && defender != null && mcUsers.getProfile(attacker).inParty() && mcUsers.getProfile(defender).inParty()){
if(mcParty.getInstance().inSameParty(defender, attacker)){ if(mcParty.getInstance().inSameParty(defender, attacker)){
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -51,11 +51,10 @@ public class mcCombat {
/* /*
* AXE CRITICAL CHECK * AXE CRITICAL CHECK
*/ */
axeCriticalCheckPlayer(attacker, event, x, plugin); axeCriticalCheck(attacker, event, x);
if(!mcConfig.getInstance().isBleedTracked(x)){ if(!mcConfig.getInstance().isBleedTracked(x)){
bleedCheck(attacker, x); bleedCheck(attacker, x);
} }
int healthbefore = defender.getHealth();
if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
//DMG MODIFIER //DMG MODIFIER
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
@ -106,33 +105,7 @@ public class mcCombat {
/* /*
* CHECK FOR LEVEL UPS * CHECK FOR LEVEL UPS
*/ */
if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
skillups++;
mcUsers.getProfile(attacker).removeSwordsGather(mcUsers.getProfile(attacker).getXpToLevel("swords"));
mcUsers.getProfile(attacker).skillUpSwords(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")");
}
if(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
int skillups = 0;
while(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
skillups++;
mcUsers.getProfile(attacker).removeAxesGather(mcUsers.getProfile(attacker).getXpToLevel("axes"));
mcUsers.getProfile(attacker).skillUpAxes(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")");
}
if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
int skillups = 0;
while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
skillups++;
mcUsers.getProfile(attacker).removeUnarmedGather(mcUsers.getProfile(attacker).getXpToLevel("unarmed"));
mcUsers.getProfile(attacker).skillUpUnarmed(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
}
} }
} }
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
@ -143,35 +116,17 @@ public class mcCombat {
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); mcUsers.getProfile(attacker).addSwordsGather(10);
if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
int skillups = 0;
while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
skillups++;
mcUsers.getProfile(attacker).removeSwordsGather(mcUsers.getProfile(attacker).getXpToLevel("swords"));
mcUsers.getProfile(attacker).skillUpSwords(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")");
}
} }
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); mcUsers.getProfile(attacker).addAxesGather(10);
if(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
skillups++;
mcUsers.getProfile(attacker).removeAxesGather(mcUsers.getProfile(attacker).getXpToLevel("axes"));
mcUsers.getProfile(attacker).skillUpAxes(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")");
}
} }
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(defender.getHealth() <= 0)
return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, 4));
} }
} }
/* /*
@ -200,15 +155,7 @@ public class mcCombat {
//XP //XP
if(defender.getHealth() != 0){ if(defender.getHealth() != 0){
mcUsers.getProfile(attacker).addUnarmedGather(10); mcUsers.getProfile(attacker).addUnarmedGather(10);
if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
skillups++;
mcUsers.getProfile(attacker).removeUnarmedGather(mcUsers.getProfile(attacker).getXpToLevel("unarmed"));
mcUsers.getProfile(attacker).skillUpUnarmed(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
}
} }
} }
} }
@ -223,12 +170,10 @@ public class mcCombat {
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, 4));
} }
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
if(defender.getHealth() <= 0)
return;
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
@ -254,7 +199,7 @@ public class mcCombat {
/* /*
* AXE PROC CHECKS * AXE PROC CHECKS
*/ */
axeCriticalCheckMonster(attacker, event, x); axeCriticalCheck(attacker, event, x);
if(!mcConfig.getInstance().isBleedTracked(x)){ if(!mcConfig.getInstance().isBleedTracked(x)){
bleedCheck(attacker, x); bleedCheck(attacker, x);
} }
@ -274,15 +219,7 @@ public class mcCombat {
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addSwordsGather(7); mcUsers.getProfile(attacker).addSwordsGather(7);
} }
if(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getSwordsGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("swords")){
skillups++;
mcUsers.getProfile(attacker).removeSwordsGather(mcUsers.getProfile(attacker).getXpToLevel("swords"));
mcUsers.getProfile(attacker).skillUpSwords(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getSwords()+")");
}
} }
if(mcm.getInstance().isAxes(attacker.getItemInHand()) if(mcm.getInstance().isAxes(attacker.getItemInHand())
&& defender.getHealth() > 0 && defender.getHealth() > 0
@ -300,24 +237,14 @@ public class mcCombat {
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addAxesGather(7); mcUsers.getProfile(attacker).addAxesGather(7);
} }
if(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getAxesGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("axes")){
skillups++;
mcUsers.getProfile(attacker).removeAxesGather(mcUsers.getProfile(attacker).getXpToLevel("axes"));
mcUsers.getProfile(attacker).skillUpAxes(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getAxes()+")");
}
} }
/* /*
* AXE DAMAGE SCALING && LOOT CHECKS * AXE DAMAGE SCALING && LOOT CHECKS
*/ */
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(defender.getHealth() <= 0)
return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, 4));
} }
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
@ -353,23 +280,31 @@ public class mcCombat {
if(x instanceof PigZombie) if(x instanceof PigZombie)
mcUsers.getProfile(attacker).addUnarmedGather(15); mcUsers.getProfile(attacker).addUnarmedGather(15);
} }
if(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getUnarmedGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("unarmed")){
skillups++;
mcUsers.getProfile(attacker).removeUnarmedGather(mcUsers.getProfile(attacker).getXpToLevel("unarmed"));
mcUsers.getProfile(attacker).skillUpUnarmed(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
}
} }
} }
} }
public void archeryCheck(EntityDamageByProjectileEvent event){ public void archeryCheck(EntityDamageByProjectileEvent event){
Entity y = event.getDamager(); Entity y = event.getDamager();
Entity x = event.getEntity(); Entity x = event.getEntity();
if(x instanceof Player){
Player defender = (Player)x;
if(mcPermissions.getInstance().unarmed(defender) && defender.getItemInHand().getTypeId() == 0){
if(mcUsers.getProfile(defender).getUnarmedInt() >= 1000){
if(Math.random() * 1000 >= 500){
event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return;
}
} else if(Math.random() * 1000 <= (mcUsers.getProfile(defender).getUnarmedInt() / 2)){
event.setCancelled(true);
defender.sendMessage(ChatColor.WHITE+"**ARROW DEFLECT**");
return;
}
}
}
/* /*
* Defender is player * If attacker is player
*/ */
if(y instanceof Player){ if(y instanceof Player){
Player attacker = (Player)y; Player attacker = (Player)y;
@ -407,7 +342,6 @@ public class mcCombat {
* Defender is Monster * Defender is Monster
*/ */
if(x instanceof Monster){ if(x instanceof Monster){
Monster defender = (Monster)x;
/* /*
* TRACK ARROWS USED AGAINST THE ENTITY * TRACK ARROWS USED AGAINST THE ENTITY
*/ */
@ -457,7 +391,6 @@ public class mcCombat {
*/ */
if(x instanceof Squid){ if(x instanceof Squid){
Squid defender = (Squid)x; Squid defender = (Squid)x;
int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
event.setDamage(calculateDamage(event, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
@ -528,24 +461,16 @@ public class mcCombat {
event.setDamage(calculateDamage(event, 5)); event.setDamage(calculateDamage(event, 5));
} }
} }
if(mcUsers.getProfile(attacker).getArcheryGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("archery")){ mcSkills.getInstance().XpCheck(attacker);
int skillups = 0;
while(mcUsers.getProfile(attacker).getArcheryGatherInt() >= mcUsers.getProfile(attacker).getXpToLevel("archery")){
skillups++;
mcUsers.getProfile(attacker).removeArcheryGather(mcUsers.getProfile(attacker).getXpToLevel("archery"));
mcUsers.getProfile(attacker).skillUpArchery(1);
}
attacker.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getArchery()+")");
}
} }
} }
public boolean simulateUnarmedProc(Player player){ public boolean simulateUnarmedProc(Player player){
if(mcUsers.getProfile(player).getUnarmedInt() >= 750){ if(mcUsers.getProfile(player).getUnarmedInt() >= 750){
if(Math.random() * 10 > 4){ if(Math.random() * 1000 >= 750){
return true; return true;
} }
}if(mcUsers.getProfile(player).getUnarmedInt() >= 350 && mcUsers.getProfile(player).getUnarmedInt() < 750){ } else {
if(Math.random() * 10 > 4){ if(Math.random() * 1000 <= mcUsers.getProfile(player).getUnarmedInt()){
return true; return true;
} }
} }
@ -553,26 +478,8 @@ public class mcCombat {
} }
public void bleedCheck(Player attacker, Entity x){ public void bleedCheck(Player attacker, Entity x){
if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand()) && !mcConfig.getInstance().isBleedTracked(x)){ if(mcPermissions.getInstance().swords(attacker) && mcm.getInstance().isSwords(attacker.getItemInHand()) && !mcConfig.getInstance().isBleedTracked(x)){
if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){ if(mcUsers.getProfile(attacker).getSwordsInt() >= 750){
if(Math.random() * 10 > 8){ if(Math.random() * 1000 >= 750){
mcConfig.getInstance().addBleedTrack(x);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(4);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){
if(Math.random() * 10 > 6){
mcConfig.getInstance().addBleedTrack(x);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(4);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){
if(Math.random() * 10 > 4){
mcConfig.getInstance().addBleedTrack(x); mcConfig.getInstance().addBleedTrack(x);
if(x instanceof Player){ if(x instanceof Player){
Player target = (Player)x; Player target = (Player)x;
@ -580,181 +487,36 @@ public class mcCombat {
} }
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**"); attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
} }
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){ } else if (Math.random() * 1000 <= mcUsers.getProfile(attacker).getSwordsInt()){
if(Math.random() * 100 > 25){ mcConfig.getInstance().addBleedTrack(x);
mcConfig.getInstance().addBleedTrack(x); if(x instanceof Player){
if(x instanceof Player){ Player target = (Player)x;
Player target = (Player)x; mcUsers.getProfile(target).setBleedTicks(4);
mcUsers.getProfile(target).setBleedTicks(6);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
} }
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
} }
} }
} }
public int axeNerf(int type){
//GOLD OR WOOD
if(type == 271 || type == 286){
return 3;
} else if (type == 258){
return 1;
} else if (type == 275){
return 1;
} else {
return 0;
}
}
public int calculateDamage(EntityDamageEvent event, int dmg){ public int calculateDamage(EntityDamageEvent event, int dmg){
return event.getDamage() + dmg; return event.getDamage() + dmg;
} }
public void axeCriticalCheckAnimals(Player attacker, EntityDamageByEntityEvent event, Entity x){ public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
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() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){ if(mcUsers.getProfile(attacker).getAxesInt() >= 750){
if(Math.random() * 100 > 95){ if(Math.random() * 1000 >= 750){
if(x instanceof Animals){ event.setDamage(event.getDamage() * 2);
Animals animal = (Animals)x; attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
event.setDamage(event.getDamage() + animal.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
if(Math.random() * 10 > 9){
if(x instanceof Animals){
Animals animal = (Animals)x;
event.setDamage(event.getDamage() + animal.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
if(Math.random() * 10 > 8){
if(x instanceof Animals){
Animals animal = (Animals)x;
event.setDamage(event.getDamage() + animal.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
if(Math.random() * 10 > 7){
if(x instanceof Animals){
Animals animal = (Animals)x;
event.setDamage(event.getDamage() + animal.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
if(Math.random() * 10 > 6){
if(x instanceof Animals){
Animals animal = (Animals)x;
event.setDamage(event.getDamage() + animal.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
}
}
public void axeCriticalCheckMonster(Player attacker, EntityDamageByEntityEvent event, Entity x){
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
if(Math.random() * 100 > 95){
if(x instanceof Monster){
Monster monster = (Monster)x;
event.setDamage(event.getDamage() + monster.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){
if(Math.random() * 10 > 9){
if(x instanceof Monster){
Monster monster = (Monster)x;
event.setDamage(event.getDamage() + monster.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
if(Math.random() * 10 > 8){
if(x instanceof Monster){
Monster monster = (Monster)x;
event.setDamage(event.getDamage() + monster.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
if(Math.random() * 10 > 7){
if(x instanceof Monster){
Monster monster = (Monster)x;
event.setDamage(event.getDamage() + monster.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
if(Math.random() * 10 > 6){
if(x instanceof Monster){
Monster monster = (Monster)x;
event.setDamage(event.getDamage() + monster.getHealth() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
}
}
}
}
public void axeCriticalCheckPlayer(Player attacker, EntityDamageByEntityEvent event, Entity x, Plugin plugin){
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 50 && mcUsers.getProfile(attacker).getAxesInt() < 250){
if(Math.random() * 100 > 95){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }
} }
} } else if(Math.random() * 1000 <= mcUsers.getProfile(attacker).getAxesInt()){
if(mcUsers.getProfile(attacker).getAxesInt() >= 250 && mcUsers.getProfile(attacker).getAxesInt() < 500){ if(x instanceof Player){
if(Math.random() * 10 > 9){ Player player = (Player)x;
if(x instanceof Player){ event.setDamage(event.getDamage() * 2);
Player player = (Player)x; attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
event.setDamage(event.getDamage() * 2); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 500 && mcUsers.getProfile(attacker).getAxesInt() < 750){
if(Math.random() * 10 > 8){
if(x instanceof Player){
Player player = (Player)x;
event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 750 && mcUsers.getProfile(attacker).getAxesInt() < 1000){
if(Math.random() * 10 > 7){
if(x instanceof Player){
Player player = (Player)x;
event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
}
}
if(mcUsers.getProfile(attacker).getAxesInt() >= 1000){
if(Math.random() * 10 > 6){
if(x instanceof Player){
Player player = (Player)x;
event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
} }
} }
} }

View File

@ -15,6 +15,7 @@ public class mcConfig {
static ArrayList<String> partyChatList = new ArrayList<String>(); static ArrayList<String> partyChatList = new ArrayList<String>();
static ArrayList<String> godModeList = new ArrayList<String>(); static ArrayList<String> godModeList = new ArrayList<String>();
HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>(); HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
//HashMap<Entity, Player, String[]> xptracker = new HashMap<Entity, Player, String[]>();
static ArrayList<Entity> bleedTracker = new ArrayList<Entity>(); static ArrayList<Entity> bleedTracker = new ArrayList<Entity>();
static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>(); static ArrayList<Entity> mobSpawnTracker = new ArrayList<Entity>();
public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);} public boolean isBlockWatched(Block block) {return blockWatchList.contains(block);}

View File

@ -53,14 +53,14 @@ public class mcEntityListener extends EntityListener {
/* /*
* ARCHERY CHECKS * ARCHERY CHECKS
*/ */
if(event instanceof EntityDamageByProjectileEvent){ if(event instanceof EntityDamageByProjectileEvent && event.getDamage() >= 1){
EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event; EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event;
mcCombat.getInstance().archeryCheck(c); mcCombat.getInstance().archeryCheck(c);
} }
/* /*
* Entity Damage by Entity checks * Entity Damage by Entity checks
*/ */
if(event instanceof EntityDamageByEntityEvent){ if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event; EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
Entity e = eventb.getEntity(); //Defender Entity e = eventb.getEntity(); //Defender
Entity f = eventb.getDamager(); //Attacker Entity f = eventb.getDamager(); //Attacker

View File

@ -127,12 +127,12 @@ public class mcExcavation {
} }
//CHANCE TO GET SULPHUR //CHANCE TO GET SULPHUR
if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){ if(mcLoadProperties.sulphur == true && mcUsers.getProfile(player).getExcavationInt() > 75){
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
mcUsers.getProfile(player).addExcavationGather(3); mcUsers.getProfile(player).addExcavationGather(3);
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 && mcUsers.getProfile(player).getExcavationInt() > 175){
@ -142,16 +142,8 @@ public class mcExcavation {
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).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){ mcSkills.getInstance().XpCheck(player);
int skillups = 0;
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
skillups++;
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation"));
mcUsers.getProfile(player).skillUpExcavation(1);
}
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")");
}
} }
} }

View File

@ -38,22 +38,28 @@ public class mcHerbalism {
* 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(!mcConfig.getInstance().isBlockWatched(block)){
if(type == 39 || type == 40){ if(type == 39 || type == 40){
mcUsers.getProfile(player).addHerbalismGather(10); mat = Material.getMaterial(block.getTypeId());
} is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(type == 37 || type == 38){ if(player != null){
mcUsers.getProfile(player).addHerbalismGather(3); if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
mcUsers.getProfile(player).addHerbalismGather(10);
}
if(type == 37 || type == 38){
mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getHerbalismInt()){
loc.getWorld().dropItemNaturally(loc, is);
}
}
mcUsers.getProfile(player).addHerbalismGather(3);
}
} }
} mcSkills.getInstance().XpCheck(player);
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
skillups++;
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism"));
mcUsers.getProfile(player).skillUpHerbalism(1);
}
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
}
} }
public void breadCheck(Player player, ItemStack is){ public void breadCheck(Player player, ItemStack is){
if(is.getTypeId() == 297){ if(is.getTypeId() == 297){

View File

@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin {
//herp //herp
public void onEnable() { public void onEnable() {
//mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000)); mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
//Make the directory if it does not exist //Make the directory if it does not exist
new File(maindirectory).mkdir(); new File(maindirectory).mkdir();
//Make the file if it does not exist //Make the file if it does not exist

View File

@ -19,6 +19,36 @@ public class mcMining {
} }
return instance; return instance;
} }
public void superBreakerCheck(Player player, Block block){
if(mcm.getInstance().isMiningPick(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
int miningticks = 8;
if(mcUsers.getProfile(player).getMiningInt() >= 100)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 500)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 1000)
miningticks++;
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
mcUsers.getProfile(player).setSuperBreakerTicks(miningticks);
mcUsers.getProfile(player).setSuperBreakerMode(true);
}
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
}
}
}
public void blockProcSimulate(Block block){ public void blockProcSimulate(Block block){
Location loc = block.getLocation(); Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
@ -36,29 +66,29 @@ public class mcMining {
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
} }
} }
if(block.getTypeId() == 21){ if(block.getTypeId() == 21){
mat = Material.getMaterial(351); mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4); item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
} }
if(block.getTypeId() == 56){ if(block.getTypeId() == 56){
mat = Material.getMaterial(264); mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
} }
if(block.getTypeId() == 1){ if(block.getTypeId() == 1){
mat = Material.getMaterial(4); mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
} }
if(block.getTypeId() == 16){ if(block.getTypeId() == 16){
mat = Material.getMaterial(263); mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item); loc.getWorld().dropItemNaturally(loc, item);
} }
} }
public void blockProcCheck(Block block, Player player){ public void blockProcCheck(Block block, Player player){
if(player != null){ if(player != null){
@ -72,46 +102,129 @@ public class mcMining {
if(block.getTypeId() == 1 || block.getTypeId() == 24){ if(block.getTypeId() == 1 || block.getTypeId() == 24){
mcUsers.getProfile(player).addMiningGather(3); mcUsers.getProfile(player).addMiningGather(3);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//COAL //COAL
if(block.getTypeId() == 16){ if(block.getTypeId() == 16){
mcUsers.getProfile(player).addMiningGather(10); mcUsers.getProfile(player).addMiningGather(10);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//GOLD //GOLD
if(block.getTypeId() == 14){ if(block.getTypeId() == 14){
mcUsers.getProfile(player).addMiningGather(35); mcUsers.getProfile(player).addMiningGather(35);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//DIAMOND //DIAMOND
if(block.getTypeId() == 56){ if(block.getTypeId() == 56){
mcUsers.getProfile(player).addMiningGather(75); mcUsers.getProfile(player).addMiningGather(75);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//IRON //IRON
if(block.getTypeId() == 15){ if(block.getTypeId() == 15){
mcUsers.getProfile(player).addMiningGather(25); mcUsers.getProfile(player).addMiningGather(25);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//REDSTONE //REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){ if(block.getTypeId() == 73 || block.getTypeId() == 74){
mcUsers.getProfile(player).addMiningGather(15); mcUsers.getProfile(player).addMiningGather(15);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
//LAPUS //LAPUS
if(block.getTypeId() == 21){ if(block.getTypeId() == 21){
mcUsers.getProfile(player).addMiningGather(40); mcUsers.getProfile(player).addMiningGather(40);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
if(player != null && mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ mcSkills.getInstance().XpCheck(player);
int skillups = 0; }
while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){ /*
skillups++; * Handling SuperBreaker stuff
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining")); */
mcUsers.getProfile(player).skillUpMining(1); public Boolean canBeSuperBroken(Block block){
} int t = block.getTypeId();
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")"); if(t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15){
} return true;
} else {
return false;
}
}
public void SuperBreakerBlockCheck(Player player, Block block){
Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56 && block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
loc.getWorld().dropItemNaturally(loc, item);
if(block.getTypeId() == 1 || block.getTypeId() == 24){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(3);
blockProcCheck(block, player);
}
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
//COAL
if(block.getTypeId() == 16){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(10);
blockProcCheck(block, player);
}
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
//GOLD
if(block.getTypeId() == 14){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(35);
blockProcCheck(block, player);
}
}
//DIAMOND
if(block.getTypeId() == 56){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(75);
blockProcCheck(block, player);
}
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
}
//IRON
if(block.getTypeId() == 15){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(25);
blockProcCheck(block, player);
}
}
//REDSTONE
if(block.getTypeId() == 73 || block.getTypeId() == 74){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(15);
blockProcCheck(block, player);
}
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
if(Math.random() * 10 > 5){
loc.getWorld().dropItemNaturally(loc, item);
}
}
//LAPUS
if(block.getTypeId() == 21){
if(!mcConfig.getInstance().isBlockWatched(block)){
mcUsers.getProfile(player).addMiningGather(40);
blockProcCheck(block, player);
}
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
loc.getWorld().dropItemNaturally(loc, item);
}
mcSkills.getInstance().XpCheck(player);
block.setType(Material.AIR);
} }
} }

View File

@ -37,6 +37,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean miningability(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.mining");
} else {
return true;
}
}
public boolean woodcuttingability(Player player) { public boolean woodcuttingability(Player player) {
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.ability.woodcutting"); return permission(player, "mcmmo.ability.woodcutting");

View File

@ -70,26 +70,20 @@ public class mcPlayerListener extends PlayerListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
/* /*
if(mcPermissions.getInstance().woodcuttingability(player) && mcm.getInstance().isAxes(is)){ * ABILITY ACTIVATION CHECKS
if(block != null){ */
if(!mcm.getInstance().abilityBlockCheck(block)) if(mcPermissions.getInstance().woodcuttingability(player)){
return; mcWoodCutting.getInstance().treeFellerCheck(player, block);
}
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GRAY+"You feel great strength enter you");
mcUsers.getProfile(player).setTreeFellerTicks(8);
mcUsers.getProfile(player).setTreeFellerMode(true);
}
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
}
} }
*/ if(mcPermissions.getInstance().miningability(player)){
mcMining.getInstance().superBreakerCheck(player, block);
}
if(mcPermissions.getInstance().herbalism(player)){ if(mcPermissions.getInstance().herbalism(player)){
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS //BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
mcHerbalism.getInstance().breadCheck(player, is); mcHerbalism.getInstance().breadCheck(player, is);
//STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS //STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
mcHerbalism.getInstance().stewCheck(player, is); mcHerbalism.getInstance().stewCheck(player, is);
} }
} }
public void onPlayerCommandPreprocess(PlayerChatEvent event){ public void onPlayerCommandPreprocess(PlayerChatEvent event){

View File

@ -82,15 +82,7 @@ public class mcRepair {
/* /*
* GIVE SKILL IF THERE IS ENOUGH XP * GIVE SKILL IF THERE IS ENOUGH XP
*/ */
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){ mcSkills.getInstance().XpCheck(player);
int skillups = 0;
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
skillups++;
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair"));
mcUsers.getProfile(player).skillUpRepair(1);
}
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")");
}
} }
} }
public boolean isArmor(ItemStack is){ public boolean isArmor(ItemStack is){

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import org.bukkit.ChatColor;
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;
@ -32,6 +33,128 @@ public class mcSkills {
} }
} }
} }
public void XpCheck(Player player){
/*
* ACROBATICS
*/
if(player != null && mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
int skillups = 0;
while(mcUsers.getProfile(player).getAcrobaticsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("acrobatics")){
skillups++;
mcUsers.getProfile(player).removeAcrobaticsGather(mcUsers.getProfile(player).getXpToLevel("acrobatics"));
mcUsers.getProfile(player).skillUpAcrobatics(1);
}
player.sendMessage(ChatColor.YELLOW+"Acrobatics skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAcrobatics()+")");
}
/*
* ARCHERY
*/
if(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){
int skillups = 0;
while(mcUsers.getProfile(player).getArcheryGatherInt() >= mcUsers.getProfile(player).getXpToLevel("archery")){
skillups++;
mcUsers.getProfile(player).removeArcheryGather(mcUsers.getProfile(player).getXpToLevel("archery"));
mcUsers.getProfile(player).skillUpArchery(1);
}
player.sendMessage(ChatColor.YELLOW+"Archery skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getArchery()+")");
}
/*
* SWORDS
*/
if(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){
int skillups = 0;
while(mcUsers.getProfile(player).getSwordsGatherInt() >= mcUsers.getProfile(player).getXpToLevel("swords")){
skillups++;
mcUsers.getProfile(player).removeSwordsGather(mcUsers.getProfile(player).getXpToLevel("swords"));
mcUsers.getProfile(player).skillUpSwords(1);
}
player.sendMessage(ChatColor.YELLOW+"Swords skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getSwords()+")");
}
/*
* AXES
*/
if(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){
int skillups = 0;
while(mcUsers.getProfile(player).getAxesGatherInt() >= mcUsers.getProfile(player).getXpToLevel("axes")){
skillups++;
mcUsers.getProfile(player).removeAxesGather(mcUsers.getProfile(player).getXpToLevel("axes"));
mcUsers.getProfile(player).skillUpAxes(1);
}
player.sendMessage(ChatColor.YELLOW+"Axes skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getAxes()+")");
}
/*
* UNARMED
*/
if(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){
int skillups = 0;
while(mcUsers.getProfile(player).getUnarmedGatherInt() >= mcUsers.getProfile(player).getXpToLevel("unarmed")){
skillups++;
mcUsers.getProfile(player).removeUnarmedGather(mcUsers.getProfile(player).getXpToLevel("unarmed"));
mcUsers.getProfile(player).skillUpUnarmed(1);
}
player.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getUnarmed()+")");
}
/*
* HERBALISM
*/
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= mcUsers.getProfile(player).getXpToLevel("herbalism")){
skillups++;
mcUsers.getProfile(player).removeHerbalismGather(mcUsers.getProfile(player).getXpToLevel("herbalism"));
mcUsers.getProfile(player).skillUpHerbalism(1);
}
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
}
/*
* MINING
*/
if(player != null && mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){
int skillups = 0;
while(mcUsers.getProfile(player).getMiningGatherInt() >= mcUsers.getProfile(player).getXpToLevel("mining")){
skillups++;
mcUsers.getProfile(player).removeMiningGather(mcUsers.getProfile(player).getXpToLevel("mining"));
mcUsers.getProfile(player).skillUpMining(1);
}
player.sendMessage(ChatColor.YELLOW+"Mining skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getMining()+")");
}
/*
* WOODCUTTING
*/
if(player != null && mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
int skillups = 0;
while(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= mcUsers.getProfile(player).getXpToLevel("woodcutting")){
skillups++;
mcUsers.getProfile(player).removeWoodCuttingGather(mcUsers.getProfile(player).getXpToLevel("woodcutting"));
mcUsers.getProfile(player).skillUpWoodCutting(1);
}
player.sendMessage(ChatColor.YELLOW+"WoodCutting skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getWoodCutting()+")");
}
/*
* REPAIR
*/
if(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
int skillups = 0;
while(mcUsers.getProfile(player).getRepairGatherInt() >= mcUsers.getProfile(player).getXpToLevel("repair")){
skillups++;
mcUsers.getProfile(player).removeRepairGather(mcUsers.getProfile(player).getXpToLevel("repair"));
mcUsers.getProfile(player).skillUpRepair(1);
}
player.sendMessage(ChatColor.YELLOW+"Repair skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getRepair()+")");
}
/*
* EXCAVATION
*/
if(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
int skillups = 0;
while(mcUsers.getProfile(player).getExcavationGatherInt() >= mcUsers.getProfile(player).getXpToLevel("excavation")){
skillups++;
mcUsers.getProfile(player).removeExcavationGather(mcUsers.getProfile(player).getXpToLevel("excavation"));
mcUsers.getProfile(player).skillUpExcavation(1);
}
player.sendMessage(ChatColor.YELLOW+"Excavation skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getExcavation()+")");
}
}
public boolean isSkill(String skillname){ public boolean isSkill(String skillname){
if(skillname.equals("mining")){ if(skillname.equals("mining")){
return true; return true;

View File

@ -62,10 +62,14 @@ public class mcTimer extends TimerTask{
} }
mcCombat.getInstance().bleedSimulate(); mcCombat.getInstance().bleedSimulate();
*/ */
/* /*
* TREE FELLER INTERACTIONS * COOLDOWN INTERACTIONS
*/ */
for(Player player : playerlist){ for(Player player : playerlist){
/*
* WOODCUTTING ABILITY
*/
if(mcPermissions.getInstance().woodcuttingability(player)){ if(mcPermissions.getInstance().woodcuttingability(player)){
//Monitor the length of TreeFeller mode //Monitor the length of TreeFeller mode
if(mcUsers.getProfile(player).getTreeFellerMode()){ if(mcUsers.getProfile(player).getTreeFellerMode()){
@ -84,6 +88,27 @@ public class mcTimer extends TimerTask{
} }
} }
} }
/*
* MINING ABILITY
*/
if(mcPermissions.getInstance().miningability(player)){
//Monitor the length of SuperBreaker mode
if(mcUsers.getProfile(player).getSuperBreakerMode()){
mcUsers.getProfile(player).decreaseSuperBreakerTicks();
if(mcUsers.getProfile(player).getSuperBreakerTicks() <= 0){
mcUsers.getProfile(player).setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerCooldown(120);
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
}
}
//Monitor the cooldown
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
mcUsers.getProfile(player).decreaseSuperBreakerCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!");
}
}
}
} }
} }
} }

View File

@ -156,8 +156,8 @@ 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 dead, treefellermode; private boolean dead, treefellermode, superbreakermode;
private int recentlyhurt = 0, bleedticks = 0, treefellerticks = 0, treefellercooldown = 0; private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0, treefellerticks = 0, treefellercooldown = 0;
Player thisplayer; Player thisplayer;
char defaultColor; char defaultColor;
@ -433,6 +433,9 @@ class PlayerList
public void setBleedTicks(Integer newvalue){ public void setBleedTicks(Integer newvalue){
bleedticks = newvalue; bleedticks = newvalue;
} }
/*
* TREE FELLER STUFF
*/
public boolean getTreeFellerMode(){ public boolean getTreeFellerMode(){
return treefellermode; return treefellermode;
} }
@ -461,6 +464,38 @@ class PlayerList
treefellercooldown--; treefellercooldown--;
} }
} }
/*
* MINING
*/
public boolean getSuperBreakerMode(){
return superbreakermode;
}
public void setSuperBreakerMode(Boolean bool){
superbreakermode = bool;
}
public Integer getSuperBreakerTicks(){
return superbreakerticks;
}
public void setSuperBreakerTicks(Integer newvalue){
superbreakerticks = newvalue;
}
public void decreaseSuperBreakerTicks(){
if(superbreakerticks >= 1){
superbreakerticks--;
}
}
public void setSuperBreakerCooldown(Integer newvalue){
superbreakercooldown = newvalue;
}
public int getSuperBreakerCooldown(){
return superbreakercooldown;
}
public void decreaseSuperBreakerCooldown(){
if(superbreakercooldown >= 1){
superbreakercooldown--;
}
}
public Integer getRecentlyHurt(){ public Integer getRecentlyHurt(){
return recentlyhurt; return recentlyhurt;
} }
@ -1158,34 +1193,34 @@ class PlayerList
} }
} }
public void modifyskill(int newvalue, String skillname){ public void modifyskill(int newvalue, String skillname){
if(skillname.equals("mining")){ if(skillname.toLowerCase().equals("mining")){
mining = String.valueOf(newvalue); mining = String.valueOf(newvalue);
} }
if(skillname.equals("woodcutting")){ if(skillname.toLowerCase().equals("woodcutting")){
woodcutting = String.valueOf(newvalue); woodcutting = String.valueOf(newvalue);
} }
if(skillname.equals("repair")){ if(skillname.toLowerCase().equals("repair")){
repair = String.valueOf(newvalue); repair = String.valueOf(newvalue);
} }
if(skillname.equals("herbalism")){ if(skillname.toLowerCase().equals("herbalism")){
herbalism = String.valueOf(newvalue); herbalism = String.valueOf(newvalue);
} }
if(skillname.equals("acrobatics")){ if(skillname.toLowerCase().equals("acrobatics")){
acrobatics = String.valueOf(newvalue); acrobatics = String.valueOf(newvalue);
} }
if(skillname.equals("swords")){ if(skillname.toLowerCase().equals("swords")){
swords = String.valueOf(newvalue); swords = String.valueOf(newvalue);
} }
if(skillname.equals("archery")){ if(skillname.toLowerCase().equals("archery")){
archery = String.valueOf(newvalue); archery = String.valueOf(newvalue);
} }
if(skillname.equals("unarmed")){ if(skillname.toLowerCase().equals("unarmed")){
unarmed = String.valueOf(newvalue); unarmed = String.valueOf(newvalue);
} }
if(skillname.equals("excavation")){ if(skillname.toLowerCase().equals("excavation")){
excavation = String.valueOf(newvalue); excavation = String.valueOf(newvalue);
} }
if(skillname.equals("axes")){ if(skillname.toLowerCase().equals("axes")){
axes = String.valueOf(newvalue); axes = String.valueOf(newvalue);
} }
save(); save();

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -34,6 +35,35 @@ public class mcWoodCutting {
} }
} }
} }
public void treeFellerCheck(Player player, Block block){
if(mcm.getInstance().isAxes(player.getItemInHand())){
if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block))
return;
}
int treefellticks = 8;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 100)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 500)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 1000)
treefellticks++;
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
mcUsers.getProfile(player).setTreeFellerTicks(treefellticks);
mcUsers.getProfile(player).setTreeFellerMode(true);
}
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
}
}
}
public void treeFeller(Block block, Player player){ public void treeFeller(Block block, Player player){
int radius = 1; int radius = 1;
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500) if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500)
@ -43,7 +73,7 @@ public class mcWoodCutting {
ArrayList<Block> blocklist = new ArrayList<Block>(); ArrayList<Block> blocklist = new ArrayList<Block>();
ArrayList<Block> toAdd = new ArrayList<Block>(); ArrayList<Block> toAdd = new ArrayList<Block>();
if(block != null) if(block != null)
blocklist.add(block); blocklist.add(block);
while(isdone == false){ while(isdone == false){
addBlocksToTreeFelling(blocklist, toAdd, radius); addBlocksToTreeFelling(blocklist, toAdd, radius);
} }
@ -55,7 +85,7 @@ public class mcWoodCutting {
*/ */
for(Block x : toAdd){ for(Block x : toAdd){
if(!mcConfig.getInstance().isTreeFellerWatched(x)) if(!mcConfig.getInstance().isTreeFellerWatched(x))
mcConfig.getInstance().addTreeFeller(x); mcConfig.getInstance().addTreeFeller(x);
} }
} }
public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){ public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
@ -69,6 +99,7 @@ public class mcWoodCutting {
int vx = x.getX(); int vx = x.getX();
int vy = x.getY(); int vy = x.getY();
int vz = x.getZ(); int vz = x.getZ();
/* /*
* Run through the blocks around the broken block to see if they qualify to be 'felled' * Run through the blocks around the broken block to see if they qualify to be 'felled'
*/ */

View File

@ -245,6 +245,17 @@ public class mcm {
} }
if(split[0].equalsIgnoreCase("/archery")){ if(split[0].equalsIgnoreCase("/archery")){
event.setCancelled(true); event.setCancelled(true);
Integer rank = 0;
if(mcUsers.getProfile(player).getArcheryInt() >= 50)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 250)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 575)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 725)
rank++;
if(mcUsers.getProfile(player).getArcheryInt() >= 1000)
rank++;
float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt(); float skillvalue = (float)mcUsers.getProfile(player).getArcheryInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String percentagefire = String.valueOf((skillvalue / 1500) * 100); String percentagefire = String.valueOf((skillvalue / 1500) * 100);
@ -258,23 +269,58 @@ 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+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Chance to Retrieve Arrows: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Chance for Ignition: "+ChatColor.YELLOW+percentagefire+"%"); player.sendMessage(ChatColor.RED+"Chance for Ignition: "+ChatColor.YELLOW+percentagefire+"%");
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
} }
if(split[0].equalsIgnoreCase("/axes")){ if(split[0].equalsIgnoreCase("/axes")){
event.setCancelled(true); event.setCancelled(true);
String percentage;
float skillvalue = (float)mcUsers.getProfile(player).getAxesInt();
if(mcUsers.getProfile(player).getAxesInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes (Monster): "+ChatColor.GREEN+"Instant kill"); player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes (Players): "+ChatColor.GREEN+"Double Damage");
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+"Chance to crtically strike: "+ChatColor.YELLOW+percentage+"%");
if(mcUsers.getProfile(player).getAxesInt() < 500){
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (AXEMASTERY)");
} else {
player.sendMessage(ChatColor.GREEN+"Axe Mastery - Bonus 4 damage");
}
} }
if(split[0].equalsIgnoreCase("/swords")){ if(split[0].equalsIgnoreCase("/swords")){
event.setCancelled(true); event.setCancelled(true);
String percentage, parrypercentage = null;
float skillvalue = (float)mcUsers.getProfile(player).getSwordsInt();
if(mcUsers.getProfile(player).getSwordsInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
if(mcUsers.getProfile(player).getSwordsInt() >= 775){
parrypercentage = "20";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 445){
parrypercentage = "15";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 250){
parrypercentage = "10";
} else if (mcUsers.getProfile(player).getSwordsInt() >= 25){
parrypercentage = "5";
} else {
parrypercentage = "0";
}
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"SWORDS"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"SWORDS"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Parrying: "+ChatColor.GREEN+"Negates Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Parrying: "+ChatColor.GREEN+"Negates Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a 2 second bleed DoT to enemies"); player.sendMessage(ChatColor.DARK_AQUA+"Bleed: "+ChatColor.GREEN+"Apply a 2 second bleed DoT to enemies");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Bleed Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Parry Chance:"+ChatColor.YELLOW+parrypercentage+"%");
} }
if(split[0].equalsIgnoreCase("/acrobatics")){ if(split[0].equalsIgnoreCase("/acrobatics")){
event.setCancelled(true); event.setCancelled(true);
@ -290,13 +336,26 @@ public class mcm {
if(split[0].equalsIgnoreCase("/mining")){ if(split[0].equalsIgnoreCase("/mining")){
float skillvalue = (float)mcUsers.getProfile(player).getMiningInt(); float skillvalue = (float)mcUsers.getProfile(player).getMiningInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
int miningticks = 8;
if(mcUsers.getProfile(player).getMiningInt() >= 100)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 500)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 1000)
miningticks++;
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Mining Stone & Ore"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Mining Stone & Ore");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Super Breaker (ABILITY): "+ChatColor.GREEN+"Fast mining");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+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+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Super Breaker Length: "+ChatColor.YELLOW+(miningticks * 2)+"s");
} }
if(split[0].equalsIgnoreCase("/repair")){ if(split[0].equalsIgnoreCase("/repair")){
float skillvalue = (float)mcUsers.getProfile(player).getRepairInt(); float skillvalue = (float)mcUsers.getProfile(player).getRepairInt();
@ -306,20 +365,75 @@ public class mcm {
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Repairing"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Repairing");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Repair: "+ChatColor.GREEN+"Repair Iron Tools & Armor"); player.sendMessage(ChatColor.DARK_AQUA+"Repair: "+ChatColor.GREEN+"Repair Iron Tools & Armor");
player.sendMessage(ChatColor.DARK_AQUA+"Super Repair: "+ChatColor.GREEN+"Fully Repair an item");
player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair ("+mcLoadProperties.repairdiamondlevel+"+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor"); player.sendMessage(ChatColor.DARK_AQUA+"Diamond Repair ("+mcLoadProperties.repairdiamondlevel+"+ SKILL): "+ChatColor.GREEN+"Repair Diamond Tools & Armor");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Super Repair Chance: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Super Repair Chance: "+ChatColor.YELLOW+percentage+"%");
} }
if(split[0].equalsIgnoreCase("/unarmed")){ if(split[0].equalsIgnoreCase("/unarmed")){
event.setCancelled(true); event.setCancelled(true);
int rank = 0;
String percentage, arrowpercentage;
float skillvalue = (float)mcUsers.getProfile(player).getUnarmedInt();
if(mcUsers.getProfile(player).getUnarmedInt() < 750){
percentage = String.valueOf((skillvalue / 1000) * 100);
} else {
percentage = "75";
}
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){
percentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
} else {
percentage = "50";
}
if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 100)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 200)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 325)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 475)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 600)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 775)
rank++;
if(mcUsers.getProfile(player).getUnarmedInt() >= 950)
rank++;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"UNARMED"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"UNARMED"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Disarm (Players): "+ChatColor.GREEN+"Drops the foes item held in hand"); player.sendMessage(ChatColor.DARK_AQUA+"Disarm (Players): "+ChatColor.GREEN+"Drops the foes item held in hand");
player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Damage+: "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Arrow Deflect: "+ChatColor.GREEN+"Deflect arrows");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
} }
if(split[0].equalsIgnoreCase("/herbalism")){ if(split[0].equalsIgnoreCase("/herbalism")){
event.setCancelled(true); event.setCancelled(true);
int rank = 0;
if(mcUsers.getProfile(player).getHerbalismInt() >= 50){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 150){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 250){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 350){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 450){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 550){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 650){
rank++;
} else if (mcUsers.getProfile(player).getHerbalismInt() >= 750){
rank++;
}
float skillvalue = (float)mcUsers.getProfile(player).getHerbalismInt(); float skillvalue = (float)mcUsers.getProfile(player).getHerbalismInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"HERBALISM"+ChatColor.RED+"[]-----");
@ -329,9 +443,9 @@ public class mcm {
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.DARK_AQUA+"Double Drops (Wheat): "+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+"Double Drop Chance: "+percentage+"%"); player.sendMessage(ChatColor.RED+"Double Drop Chance: "+percentage+"%");
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);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"EXCAVATION"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"EXCAVATION"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Digging and finding treasures"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Digging and finding treasures");

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.8.20 version: 0.9 WIP