Another WIP build of 0.9

This commit is contained in:
nossr50 2011-03-14 01:43:52 -07:00
parent 8b5cfbf347
commit 3812ef5bb5
15 changed files with 383 additions and 104 deletions

View File

@ -1,11 +1,27 @@
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 Version 0.9
/<skillname> now shows much more information to the player regarding their stats --NEW CONTENT--
Unarmed disarm is now based directly on your skill level Woodcutting now has the "Tree Feller" Ability
Axe crits is now based directly on your skill level Mining now has the "Super Breaker" Ability
Herbalism now applies double drops to herbs Unarmed now has the "Deflect Arrows" passive skill
/mmoedit is no longer case sensitive Chimaera Wing Item Added
--CHANGES--
Herbalism now applies double drops to herbs
/<skillname> now shows much more information to the player regarding their stats
Axes skill Critical Strikes are now based directly on your skill level
Swords skill Bleed is now based directly on your skill level
Unarmed disarm is now based directly on your skill level
Acrobatics now gives XP when you roll
--BUGFIXES--
/mmoedit is no longer case sensitive
More NPE errors fixed
--PLUGIN COMPATABILITY FIXES--
If combat interactions are cancelled by other plugins mcMMO should ignore the event
If block damage interactions are cancelled by other plugins mcMMO should ignore the event
Version 0.8.22 Version 0.8.22
Fixed bug where Axes did less damage than normal Fixed bug where Axes did less damage than normal

View File

@ -39,12 +39,14 @@ public class mcBlockListener extends BlockListener {
Block block = event.getBlock(); Block block = event.getBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
if(block != null && player != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == 42){ if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getBlock().getTypeId() == 42){
mcRepair.getInstance().repairCheck(player, is, block); mcRepair.getInstance().repairCheck(player, is, event.getBlock());
} }
} }
//put all Block related code here //put all Block related code here
public void onBlockDamage(BlockDamageEvent event) { public void onBlockDamage(BlockDamageEvent event) {
if(event.isCancelled())
return;
//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();
@ -87,6 +89,10 @@ public class mcBlockListener extends BlockListener {
/* /*
* WOOD CUTTING * WOOD CUTTING
*/ */
//Check for axe prep
if(mcUsers.getProfile(player).getAxePreparationMode())
mcWoodCutting.getInstance().treeFellerCheck(player, block);
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
if(mcLoadProperties.woodcuttingrequiresaxe){ if(mcLoadProperties.woodcuttingrequiresaxe){
if(mcm.getInstance().isAxes(inhand)){ if(mcm.getInstance().isAxes(inhand)){
@ -105,23 +111,21 @@ public class mcBlockListener extends BlockListener {
mcWoodCutting.getInstance().treeFeller(block, player); mcWoodCutting.getInstance().treeFeller(block, player);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){ for(Block blockx : mcConfig.getInstance().getTreeFeller()){
if(blockx != null){ if(blockx != null){
Material mat = Material.getMaterial(17); Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0; byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
blockx.setType(Material.AIR); if(blockx.getTypeId() == 17){
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(blockx.getTypeId() == 18){
if(item.getTypeId() == 18){
mat = Material.getMaterial(6); mat = Material.getMaterial(6);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
if(Math.random() * 10 > 8) if(Math.random() * 10 > 8)
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item); blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
} }
blockx.setType(Material.AIR);
} }
} }
/* /*
@ -132,12 +136,11 @@ public class mcBlockListener extends BlockListener {
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);
} }
} }

View File

@ -374,7 +374,6 @@ public class mcCombat {
*/ */
if(x instanceof Animals){ if(x instanceof Animals){
Animals defender = (Animals)x; Animals defender = (Animals)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)
@ -390,7 +389,6 @@ public class mcCombat {
* Defender is Squid * Defender is Squid
*/ */
if(x instanceof Squid){ if(x instanceof Squid){
Squid defender = (Squid)x;
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)

View File

@ -50,6 +50,7 @@ public class mcEntityListener extends EntityListener {
mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z); mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z);
} }
} }
/* /*
* ARCHERY CHECKS * ARCHERY CHECKS
*/ */
@ -57,10 +58,14 @@ public class mcEntityListener extends EntityListener {
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 && event.getDamage() >= 1){ if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){
if(event.isCancelled()){
return;
}
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
@ -71,9 +76,6 @@ public class mcEntityListener extends EntityListener {
Player defender = (Player)e; Player defender = (Player)e;
if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName())) if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName()))
event.setCancelled(true); event.setCancelled(true);
if(f instanceof Monster && defender != null){
mcUsers.getProfile(defender).setRecentlyHurt(30);
}
/* /*
* PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT * PARRYING CHECK, CHECK TO SEE IF ITS A SUCCESSFUL PARRY OR NOT
*/ */
@ -104,6 +106,9 @@ public class mcEntityListener extends EntityListener {
*/ */
mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid); mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
} }
/*
* CHECK FOR PVP INTERACTIONS
*/
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp) if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true); event.setCancelled(true);
if(e instanceof Monster || e instanceof Animals){ if(e instanceof Monster || e instanceof Animals){
@ -121,6 +126,14 @@ public class mcEntityListener extends EntityListener {
} }
} }
} }
/*
* Check to see if the defender took damage so we can apply recently hurt
*/
if(x instanceof Player && !event.isCancelled()){
Player herpderp = (Player)x;
mcUsers.getProfile(herpderp).setRecentlyHurt(30);
}
} }
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
Entity x = event.getEntity(); Entity x = event.getEntity();

View File

@ -0,0 +1,73 @@
package com.gmail.nossr50;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class mcItem {
private static mcMMO plugin;
public mcItem(mcMMO instance) {
plugin = instance;
}
private static volatile mcItem instance;
public static mcItem getInstance() {
if (instance == null) {
instance = new mcItem(plugin);
}
return instance;
}
public void itemChecks(Player player){
ItemStack inhand = player.getItemInHand();
if(inhand.getTypeId() == 288){
chimaerawing(player);
}
}
public void chimaerawing(Player player){
ItemStack is = player.getItemInHand();
Block block = player.getLocation().getBlock();
if(mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == 288){
if(mcUsers.getProfile(player).getRecentlyHurt() == 0 && is.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing){
Block derp = player.getLocation().getBlock();
int y = derp.getY();
ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){
if(x.getTypeId() == 288){
if(x.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing + 1){
x.setAmount(x.getAmount() - mcLoadProperties.feathersConsumedByChimaeraWing);
player.getInventory().setContents(inventory);
player.updateInventory();
break;
} else {
x.setAmount(0);
x.setTypeId(0);
player.getInventory().setContents(inventory);
player.updateInventory();
break;
}
}
}
while(y < 127){
y++;
if(player != null){
if(player.getLocation().getWorld().getBlockAt(block.getX(), y, block.getZ()).getType() != Material.AIR){
player.sendMessage("**CHIMAERA WING FAILED!**");
player.teleportTo(player.getLocation().getWorld().getBlockAt(block.getX(), (y - 1), block.getZ()).getLocation());
return;
}
}
}
if(mcUsers.getProfile(player).getMySpawn(player) != null){
player.teleportTo(mcUsers.getProfile(player).getMySpawn(player));
} else {
player.teleportTo(player.getWorld().getSpawnLocation());
}
player.sendMessage("**CHIMAERA WING**");
} else if (mcUsers.getProfile(player).getRecentlyHurt() >= 1 && is.getAmount() >= 10) {
player.sendMessage("You were injured recently and must wait to use this.");
} else if (is.getTypeId() == 288 && is.getAmount() <= 9){
player.sendMessage("You need more of that to use it");
}
}
}
}

View File

@ -2,14 +2,15 @@ package com.gmail.nossr50;
public class mcLoadProperties { public class mcLoadProperties {
public static Boolean pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static Boolean pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages;
public static String mcmmo, mcc, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static String mcmmo, mcc, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static int 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";
mcProperties properties = new mcProperties(propertiesFile); mcProperties properties = new mcProperties(propertiesFile);
properties.load(); properties.load();
feathersConsumedByChimaeraWing = properties.getInteger("feathersConsumedByChimaeraWing", 10);
pvpxp = properties.getBoolean("pvpGivesXP", true); pvpxp = properties.getBoolean("pvpGivesXP", true);
pvpxprewardmodifier = properties.getInteger("pvpXpRewardModifier", 1); pvpxprewardmodifier = properties.getInteger("pvpXpRewardModifier", 1);
miningrequirespickaxe = properties.getBoolean("miningRequiresPickaxe", true); miningrequirespickaxe = properties.getBoolean("miningRequiresPickaxe", true);
@ -55,6 +56,7 @@ public class mcLoadProperties {
/* /*
* CUSTOM COMMANDS * CUSTOM COMMANDS
*/ */
mcitem = properties.getString("/mcitem", "mcitem");
mcmmo = properties.getString("/mcmmo", "mcmmo"); mcmmo = properties.getString("/mcmmo", "mcmmo");
mcc = properties.getString("/mcc", "mcc"); mcc = properties.getString("/mcc", "mcc");
mcgod = properties.getString("/mcgod", "mcgod"); mcgod = properties.getString("/mcgod", "mcgod");

View File

@ -26,17 +26,23 @@ public class mcMining {
return; return;
} }
int miningticks = 8; int miningticks = 3;
if(mcUsers.getProfile(player).getMiningInt() >= 100) if(mcUsers.getProfile(player).getMiningInt() >= 50)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250) if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 500) if(mcUsers.getProfile(player).getMiningInt() >= 350)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750) if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 1000)
miningticks++;
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");

View File

@ -16,11 +16,15 @@ 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).getParty().equals(mcUsers.getProfile(playerb).getParty())){ if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){
return true; if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){
} else { return true;
return false; } else {
} return false;
}
} else {
return false;
}
} }
public int partyCount(Player player, Player[] players){ public int partyCount(Player player, Player[] players){
int x = 0; int x = 0;

View File

@ -37,6 +37,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean chimaeraWing(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.item.chimaerawing");
} else {
return true;
}
}
public boolean miningability(Player player){ public boolean miningability(Player player){
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.ability.mining"); return permission(player, "mcmmo.ability.mining");
@ -44,6 +51,20 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean axesAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.axes");
} else {
return true;
}
}
public boolean swordsability(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.swords");
} 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

@ -5,6 +5,7 @@ import java.util.logging.Logger;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
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.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -72,17 +73,16 @@ public class mcPlayerListener extends PlayerListener {
/* /*
* ABILITY ACTIVATION CHECKS * ABILITY ACTIVATION CHECKS
*/ */
if(mcPermissions.getInstance().woodcuttingability(player)){ mcSkills.getInstance().abilityActivationCheck(player, block);
mcWoodCutting.getInstance().treeFellerCheck(player, block); /*
} * ITEM INTERACTIONS
if(mcPermissions.getInstance().miningability(player)){ */
mcMining.getInstance().superBreakerCheck(player, block); mcItem.getInstance().itemChecks(player);
} /*
* HERBALISM MODIFIERS
*/
if(mcPermissions.getInstance().herbalism(player)){ if(mcPermissions.getInstance().herbalism(player)){
//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
mcHerbalism.getInstance().stewCheck(player, is); mcHerbalism.getInstance().stewCheck(player, is);
} }
} }
@ -92,6 +92,9 @@ public class mcPlayerListener extends PlayerListener {
String playerName = player.getName(); String playerName = player.getName();
//Check if the command is an mcMMO related help command //Check if the command is an mcMMO related help command
mcm.getInstance().mcmmoHelpCheck(split, player, event); mcm.getInstance().mcmmoHelpCheck(split, player, event);
if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcitem)){
}
/* /*
* GODMODE COMMAND * GODMODE COMMAND
*/ */

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
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;
@ -34,13 +35,86 @@ public class mcSkills {
} }
} }
public void decreaseCooldowns(Player player){ public void decreaseCooldowns(Player player){
mcUsers.getProfile(player).decreaseTreeFellerCooldown(); if(mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ mcUsers.getProfile(player).decreaseTreeFellerCooldown();
player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!"); if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!");
}
}
if(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!");
}
}
if(mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){
mcUsers.getProfile(player).decreaseSerratedStrikesCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Serrated Strikes ability is refreshed!");
}
}
}
public void axeActivationCheck(Player player, Block block){
if(mcPermissions.getInstance().axes(player) && mcPermissions.getInstance().woodcutting(player)){
if(!mcUsers.getProfile(player).getAxePreparationMode() && mcm.getInstance().isAxes(player.getItemInHand())){
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**");
mcUsers.getProfile(player).setAxePreparationTicks(2);
mcUsers.getProfile(player).setAxePreparationMode(true);
}
} else if(mcPermissions.getInstance().woodcutting(player)){
mcWoodCutting.getInstance().treeFellerCheck(player, block);
} else if (mcPermissions.getInstance().axes(player)){
/*
* PUT CODE RELATED TO ACTIVATING THE AXE MODE HERE
*/
}
}
public void abilityActivationCheck(Player player, Block block){
if(mcPermissions.getInstance().miningability(player)){
mcMining.getInstance().superBreakerCheck(player, block);
}
}
public void monitorSkills(Player player){
/*
* AXE PREPARATION MODE
*/
if(mcPermissions.getInstance().woodcuttingability(player) && mcPermissions.getInstance().axes(player)){
//Monitor the length of TreeFeller mode
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).decreaseAxePreparationTicks();
if(mcUsers.getProfile(player).getAxePreparationTicks() <= 0){
mcUsers.getProfile(player).setAxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
}
}
} }
mcUsers.getProfile(player).decreaseSuperBreakerCooldown(); /*
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ * WOODCUTTING ABILITY
player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!"); */
if(mcPermissions.getInstance().woodcuttingability(player)){
//Monitor the length of TreeFeller mode
if(mcUsers.getProfile(player).getTreeFellerMode()){
mcUsers.getProfile(player).decreaseTreeFellerTicks();
if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){
mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerCooldown(120);
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
}
}
}
/*
* 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**");
}
}
} }
} }
public void XpCheck(Player player){ public void XpCheck(Player player){

View File

@ -47,33 +47,9 @@ public class mcTimer extends TimerTask{
} }
} }
/* /*
* WOODCUTTING ABILITY * MONITOR SKILLS
*/ */
if(mcPermissions.getInstance().woodcuttingability(player)){ mcSkills.getInstance().monitorSkills(player);
//Monitor the length of TreeFeller mode
if(mcUsers.getProfile(player).getTreeFellerMode()){
mcUsers.getProfile(player).decreaseTreeFellerTicks();
if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){
mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerCooldown(120);
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
}
}
}
/*
* 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**");
}
}
}
/* /*
* COOLDOWN MONITORING * COOLDOWN MONITORING
*/ */

View File

@ -156,8 +156,10 @@ 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, superbreakermode; private boolean dead, treeFellerMode, superbreakermode, serratedStrikesMode, axePreparationMode;
private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0, treefellerticks = 0, treefellercooldown = 0; private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0,
serratedStrikesTicks = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0,
axePreparationTicks = 0;
Player thisplayer; Player thisplayer;
char defaultColor; char defaultColor;
@ -206,7 +208,7 @@ class PlayerList
//gather = "0"; //gather = "0";
party = null; party = null;
dead = false; dead = false;
treefellermode = false; treeFellerMode = false;
//Try to load the player and if they aren't found, append them //Try to load the player and if they aren't found, append them
if(!load()) if(!load())
addPlayer(); addPlayer();
@ -434,41 +436,92 @@ class PlayerList
bleedticks = newvalue; bleedticks = newvalue;
} }
public Boolean hasCooldowns(){ public Boolean hasCooldowns(){
if((treefellercooldown + superbreakercooldown) >= 1){ if((treeFellerCooldown + superbreakercooldown) >= 1){
return true; return true;
} else { } else {
return false; return false;
} }
} }
/*
* AXE PREPARATION
*/
public boolean getAxePreparationMode(){
return axePreparationMode;
}
public void setAxePreparationMode(Boolean bool){
axePreparationMode = bool;
}
public Integer getAxePreparationTicks(){
return axePreparationTicks;
}
public void setAxePreparationTicks(Integer newvalue){
axePreparationTicks = newvalue;
}
public void decreaseAxePreparationTicks(){
if(axePreparationTicks >= 1){
axePreparationTicks--;
}
}
/*
* SERRATED STRIKES
*/
public boolean getSerratedStrikesMode(){
return serratedStrikesMode;
}
public void setSerratedStrikesMode(Boolean bool){
serratedStrikesMode = bool;
}
public Integer getSerratedStrikesTicks(){
return serratedStrikesTicks;
}
public void setSerratedStrikesTicks(Integer newvalue){
serratedStrikesTicks = newvalue;
}
public void decreaseSerratedStrikesTicks(){
if(serratedStrikesTicks >= 1){
serratedStrikesTicks--;
}
}
public void setSerratedStrikesCooldown(Integer newvalue){
serratedStrikesCooldown = newvalue;
}
public int getSerratedStrikesCooldown(){
return serratedStrikesCooldown;
}
public void decreaseSerratedStrikesCooldown(){
if(serratedStrikesCooldown >= 1){
serratedStrikesCooldown--;
}
}
/* /*
* TREE FELLER STUFF * TREE FELLER STUFF
*/ */
public boolean getTreeFellerMode(){ public boolean getTreeFellerMode(){
return treefellermode; return treeFellerMode;
} }
public void setTreeFellerMode(Boolean bool){ public void setTreeFellerMode(Boolean bool){
treefellermode = bool; treeFellerMode = bool;
} }
public Integer getTreeFellerTicks(){ public Integer getTreeFellerTicks(){
return treefellerticks; return treeFellerTicks;
} }
public void setTreeFellerTicks(Integer newvalue){ public void setTreeFellerTicks(Integer newvalue){
treefellerticks = newvalue; treeFellerTicks = newvalue;
} }
public void decreaseTreeFellerTicks(){ public void decreaseTreeFellerTicks(){
if(treefellerticks >= 1){ if(treeFellerTicks >= 1){
treefellerticks--; treeFellerTicks--;
} }
} }
public void setTreeFellerCooldown(Integer newvalue){ public void setTreeFellerCooldown(Integer newvalue){
treefellercooldown = newvalue; treeFellerCooldown = newvalue;
} }
public int getTreeFellerCooldown(){ public int getTreeFellerCooldown(){
return treefellercooldown; return treeFellerCooldown;
} }
public void decreaseTreeFellerCooldown(){ public void decreaseTreeFellerCooldown(){
if(treefellercooldown >= 1){ if(treeFellerCooldown >= 1){
treefellercooldown--; treeFellerCooldown--;
} }
} }
/* /*

View File

@ -41,18 +41,30 @@ public class mcWoodCutting {
if(!mcm.getInstance().abilityBlockCheck(block)) if(!mcm.getInstance().abilityBlockCheck(block))
return; return;
} }
/*
int treefellticks = 8; * CHECK FOR AXE PREP MODE
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 100) */
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
}
int treefellticks = 3;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
treefellticks++; treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250) if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
treefellticks++; treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 500) if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
treefellticks++; treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750) if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
treefellticks++; treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 1000)
treefellticks++;
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");

View File

@ -32,7 +32,7 @@ public class mcm {
} }
public static double getDistance(Location loca, Location locb) public static double getDistance(Location loca, Location locb)
{ {
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2) return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
+ Math.pow(loca.getZ() - locb.getZ(), 2)); + Math.pow(loca.getZ() - locb.getZ(), 2));
} }
public boolean abilityBlockCheck(Block block){ public boolean abilityBlockCheck(Block block){
@ -235,6 +235,23 @@ public class mcm {
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)mcUsers.getProfile(player).getWoodCuttingInt();
int treefellticks = 3;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650)
treefellticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750)
treefellticks++;
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees");
@ -242,6 +259,7 @@ public class mcm {
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+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+"Tree Feller Length: "+ChatColor.YELLOW+(treefellticks * 2)+"s");
} }
if(split[0].equalsIgnoreCase("/archery")){ if(split[0].equalsIgnoreCase("/archery")){
event.setCancelled(true); event.setCancelled(true);
@ -336,17 +354,23 @@ 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; int miningticks = 3;
if(mcUsers.getProfile(player).getMiningInt() >= 100) if(mcUsers.getProfile(player).getMiningInt() >= 50)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 150)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 250) if(mcUsers.getProfile(player).getMiningInt() >= 250)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 500) if(mcUsers.getProfile(player).getMiningInt() >= 350)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 450)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 550)
miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 650)
miningticks++; miningticks++;
if(mcUsers.getProfile(player).getMiningInt() >= 750) if(mcUsers.getProfile(player).getMiningInt() >= 750)
miningticks++; 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");
@ -383,9 +407,9 @@ public class mcm {
} }
if(mcUsers.getProfile(player).getUnarmedInt() < 1000){ if(mcUsers.getProfile(player).getUnarmedInt() < 1000){
percentage = String.valueOf(((skillvalue / 1000) * 100) / 2); arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
} else { } else {
percentage = "50"; arrowpercentage = "50";
} }
if(mcUsers.getProfile(player).getUnarmedInt() >= 50) if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
@ -411,6 +435,7 @@ public class mcm {
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.DARK_AQUA+"Arrow Deflect: "+ChatColor.GREEN+"Deflect arrows");
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+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Disarm Chance: "+ChatColor.YELLOW+percentage+"%");
player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage"); player.sendMessage(ChatColor.RED+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage");
} }