From 3812ef5bb54377c32a23558e8534af8b561b5c2d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 14 Mar 2011 01:43:52 -0700 Subject: [PATCH] Another WIP build of 0.9 --- mcMMO/Changelog.txt | 26 ++++-- mcMMO/com/gmail/nossr50/mcBlockListener.java | 29 ++++--- mcMMO/com/gmail/nossr50/mcCombat.java | 2 - mcMMO/com/gmail/nossr50/mcEntityListener.java | 19 +++- mcMMO/com/gmail/nossr50/mcItem.java | 73 ++++++++++++++++ mcMMO/com/gmail/nossr50/mcLoadProperties.java | 6 +- mcMMO/com/gmail/nossr50/mcMining.java | 16 ++-- mcMMO/com/gmail/nossr50/mcParty.java | 14 +-- mcMMO/com/gmail/nossr50/mcPermissions.java | 21 +++++ mcMMO/com/gmail/nossr50/mcPlayerListener.java | 21 +++-- mcMMO/com/gmail/nossr50/mcSkills.java | 86 +++++++++++++++++-- mcMMO/com/gmail/nossr50/mcTimer.java | 28 +----- mcMMO/com/gmail/nossr50/mcUsers.java | 81 ++++++++++++++--- mcMMO/com/gmail/nossr50/mcWoodCutting.java | 24 ++++-- mcMMO/com/gmail/nossr50/mcm.java | 41 +++++++-- 15 files changed, 383 insertions(+), 104 deletions(-) create mode 100644 mcMMO/com/gmail/nossr50/mcItem.java diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index edc9c076e..4392deda8 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,11 +1,27 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# Version 0.9 - / 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 +--NEW CONTENT-- +Woodcutting now has the "Tree Feller" Ability +Mining now has the "Super Breaker" Ability +Unarmed now has the "Deflect Arrows" passive skill +Chimaera Wing Item Added + +--CHANGES-- +Herbalism now applies double drops to herbs +/ 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 Fixed bug where Axes did less damage than normal diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 81a8f614d..3fd7a2b52 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -39,12 +39,14 @@ public class mcBlockListener extends BlockListener { Block block = event.getBlock(); Player player = event.getPlayer(); ItemStack is = player.getItemInHand(); - if(block != null && player != null && mcPermissions.getInstance().repair(player) && block.getTypeId() == 42){ - mcRepair.getInstance().repairCheck(player, is, block); + if(block != null && player != null && mcPermissions.getInstance().repair(player) && event.getBlock().getTypeId() == 42){ + mcRepair.getInstance().repairCheck(player, is, event.getBlock()); } } //put all Block related code here public void onBlockDamage(BlockDamageEvent event) { + if(event.isCancelled()) + return; //STARTED(0), DIGGING(1), BROKEN(3), STOPPED(2); Player player = event.getPlayer(); ItemStack inhand = player.getItemInHand(); @@ -87,6 +89,10 @@ public class mcBlockListener extends BlockListener { /* * 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(mcLoadProperties.woodcuttingrequiresaxe){ if(mcm.getInstance().isAxes(inhand)){ @@ -105,23 +111,21 @@ public class mcBlockListener extends BlockListener { mcWoodCutting.getInstance().treeFeller(block, player); for(Block blockx : mcConfig.getInstance().getTreeFeller()){ if(blockx != null){ - Material mat = Material.getMaterial(17); + Material mat = Material.getMaterial(block.getTypeId()); byte damage = 0; ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - blockx.setType(Material.AIR); - - if(item.getTypeId() == 17){ + if(blockx.getTypeId() == 17){ blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item); mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation()); mcUsers.getProfile(player).addWoodcuttingGather(7); } - - if(item.getTypeId() == 18){ + if(blockx.getTypeId() == 18){ mat = Material.getMaterial(6); item = new ItemStack(mat, 1, (byte)0, damage); if(Math.random() * 10 > 8) blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item); } + blockx.setType(Material.AIR); } } /* @@ -132,12 +136,11 @@ public class mcBlockListener extends BlockListener { mcConfig.getInstance().clearTreeFeller(); } } - /* - * EXCAVATION - */ - if(mcPermissions.getInstance().excavation(player) && block != null && player != null) + /* + * EXCAVATION + */ + if(mcPermissions.getInstance().excavation(player) && block != null && player != null) mcExcavation.getInstance().excavationProcCheck(block, player); - } } diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index 9c3b2c0b0..d83d21d08 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -374,7 +374,6 @@ public class mcCombat { */ if(x instanceof Animals){ Animals defender = (Animals)x; - int healthbefore = defender.getHealth(); if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) @@ -390,7 +389,6 @@ public class mcCombat { * Defender is Squid */ if(x instanceof Squid){ - Squid defender = (Squid)x; if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) event.setDamage(calculateDamage(event, 1)); if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index 5c86a34dd..93061c1e4 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -50,6 +50,7 @@ public class mcEntityListener extends EntityListener { mcAcrobatics.getInstance().acrobaticsCheck(player, event, loc, xx, y, z); } } + /* * ARCHERY CHECKS */ @@ -57,10 +58,14 @@ public class mcEntityListener extends EntityListener { EntityDamageByProjectileEvent c = (EntityDamageByProjectileEvent)event; mcCombat.getInstance().archeryCheck(c); } + /* * Entity Damage by Entity checks */ if(event instanceof EntityDamageByEntityEvent && event.getDamage() >= 1){ + if(event.isCancelled()){ + return; + } EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event; Entity e = eventb.getEntity(); //Defender Entity f = eventb.getDamager(); //Attacker @@ -71,9 +76,6 @@ public class mcEntityListener extends EntityListener { Player defender = (Player)e; if(defender != null && mcConfig.getInstance().isGodModeToggled(defender.getName())) 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 */ @@ -104,6 +106,9 @@ public class mcEntityListener extends EntityListener { */ mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid); } + /* + * CHECK FOR PVP INTERACTIONS + */ if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp) event.setCancelled(true); 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) { Entity x = event.getEntity(); diff --git a/mcMMO/com/gmail/nossr50/mcItem.java b/mcMMO/com/gmail/nossr50/mcItem.java new file mode 100644 index 000000000..d8e404b66 --- /dev/null +++ b/mcMMO/com/gmail/nossr50/mcItem.java @@ -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"); + } + } + } +} diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index d97c86448..6df264a09 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -2,14 +2,15 @@ package com.gmail.nossr50; 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 String mcmmo, mcc, 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 String mcmmo, mcc, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; + public static int feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static void loadMain(){ String propertiesFile = mcMMO.maindirectory + "mcmmo.properties"; mcProperties properties = new mcProperties(propertiesFile); properties.load(); + feathersConsumedByChimaeraWing = properties.getInteger("feathersConsumedByChimaeraWing", 10); pvpxp = properties.getBoolean("pvpGivesXP", true); pvpxprewardmodifier = properties.getInteger("pvpXpRewardModifier", 1); miningrequirespickaxe = properties.getBoolean("miningRequiresPickaxe", true); @@ -55,6 +56,7 @@ public class mcLoadProperties { /* * CUSTOM COMMANDS */ + mcitem = properties.getString("/mcitem", "mcitem"); mcmmo = properties.getString("/mcmmo", "mcmmo"); mcc = properties.getString("/mcc", "mcc"); mcgod = properties.getString("/mcgod", "mcgod"); diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index c74670f73..4b55fb956 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -26,17 +26,23 @@ public class mcMining { return; } - int miningticks = 8; - if(mcUsers.getProfile(player).getMiningInt() >= 100) + int miningticks = 3; + if(mcUsers.getProfile(player).getMiningInt() >= 50) + miningticks++; + if(mcUsers.getProfile(player).getMiningInt() >= 150) miningticks++; if(mcUsers.getProfile(player).getMiningInt() >= 250) 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++; 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**"); diff --git a/mcMMO/com/gmail/nossr50/mcParty.java b/mcMMO/com/gmail/nossr50/mcParty.java index 721b1ede9..d42a3c179 100644 --- a/mcMMO/com/gmail/nossr50/mcParty.java +++ b/mcMMO/com/gmail/nossr50/mcParty.java @@ -16,11 +16,15 @@ public class mcParty { return instance; } public boolean inSameParty(Player playera, Player playerb){ - if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ - return true; - } else { - return false; - } + if(mcUsers.getProfile(playera).inParty() && mcUsers.getProfile(playerb).inParty()){ + if(mcUsers.getProfile(playera).getParty().equals(mcUsers.getProfile(playerb).getParty())){ + return true; + } else { + return false; + } + } else { + return false; + } } public int partyCount(Player player, Player[] players){ int x = 0; diff --git a/mcMMO/com/gmail/nossr50/mcPermissions.java b/mcMMO/com/gmail/nossr50/mcPermissions.java index c4c5ae336..43bb3bbd6 100644 --- a/mcMMO/com/gmail/nossr50/mcPermissions.java +++ b/mcMMO/com/gmail/nossr50/mcPermissions.java @@ -37,6 +37,13 @@ public class mcPermissions { return true; } } + public boolean chimaeraWing(Player player){ + if (permissionsEnabled) { + return permission(player, "mcmmo.item.chimaerawing"); + } else { + return true; + } + } public boolean miningability(Player player){ if (permissionsEnabled) { return permission(player, "mcmmo.ability.mining"); @@ -44,6 +51,20 @@ public class mcPermissions { 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) { if (permissionsEnabled) { return permission(player, "mcmmo.ability.woodcutting"); diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index 4483352dd..fe9545176 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -5,6 +5,7 @@ import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; @@ -72,17 +73,16 @@ public class mcPlayerListener extends PlayerListener { /* * ABILITY ACTIVATION CHECKS */ - if(mcPermissions.getInstance().woodcuttingability(player)){ - mcWoodCutting.getInstance().treeFellerCheck(player, block); - } - if(mcPermissions.getInstance().miningability(player)){ - mcMining.getInstance().superBreakerCheck(player, block); - } - + mcSkills.getInstance().abilityActivationCheck(player, block); + /* + * ITEM INTERACTIONS + */ + mcItem.getInstance().itemChecks(player); + /* + * HERBALISM MODIFIERS + */ if(mcPermissions.getInstance().herbalism(player)){ - //BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS mcHerbalism.getInstance().breadCheck(player, is); - //STEW, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS mcHerbalism.getInstance().stewCheck(player, is); } } @@ -92,6 +92,9 @@ public class mcPlayerListener extends PlayerListener { String playerName = player.getName(); //Check if the command is an mcMMO related help command mcm.getInstance().mcmmoHelpCheck(split, player, event); + if(split[0].equalsIgnoreCase("/"+mcLoadProperties.mcitem)){ + + } /* * GODMODE COMMAND */ diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index 7191c99ff..7a2b1c31a 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -1,6 +1,7 @@ package com.gmail.nossr50; import org.bukkit.ChatColor; +import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -34,13 +35,86 @@ public class mcSkills { } } public void decreaseCooldowns(Player player){ - mcUsers.getProfile(player).decreaseTreeFellerCooldown(); - if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!"); + if(mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){ + mcUsers.getProfile(player).decreaseTreeFellerCooldown(); + 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){ - player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!"); + /* + * WOODCUTTING ABILITY + */ + 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){ diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index 9acf6ff2f..1dc49c19c 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -47,33 +47,9 @@ public class mcTimer extends TimerTask{ } } /* - * WOODCUTTING ABILITY + * MONITOR SKILLS */ - 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**"); - } - } - } + mcSkills.getInstance().monitorSkills(player); /* * COOLDOWN MONITORING */ diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 00274285f..d0eb456bb 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -156,8 +156,10 @@ class PlayerList protected final Logger log = Logger.getLogger("Minecraft"); 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; - private boolean dead, treefellermode, superbreakermode; - private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0, treefellerticks = 0, treefellercooldown = 0; + private boolean dead, treeFellerMode, superbreakermode, serratedStrikesMode, axePreparationMode; + private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0, + serratedStrikesTicks = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0, + axePreparationTicks = 0; Player thisplayer; char defaultColor; @@ -206,7 +208,7 @@ class PlayerList //gather = "0"; party = null; dead = false; - treefellermode = false; + treeFellerMode = false; //Try to load the player and if they aren't found, append them if(!load()) addPlayer(); @@ -434,41 +436,92 @@ class PlayerList bleedticks = newvalue; } public Boolean hasCooldowns(){ - if((treefellercooldown + superbreakercooldown) >= 1){ + if((treeFellerCooldown + superbreakercooldown) >= 1){ return true; } else { 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 */ public boolean getTreeFellerMode(){ - return treefellermode; + return treeFellerMode; } public void setTreeFellerMode(Boolean bool){ - treefellermode = bool; + treeFellerMode = bool; } public Integer getTreeFellerTicks(){ - return treefellerticks; + return treeFellerTicks; } public void setTreeFellerTicks(Integer newvalue){ - treefellerticks = newvalue; + treeFellerTicks = newvalue; } public void decreaseTreeFellerTicks(){ - if(treefellerticks >= 1){ - treefellerticks--; + if(treeFellerTicks >= 1){ + treeFellerTicks--; } } public void setTreeFellerCooldown(Integer newvalue){ - treefellercooldown = newvalue; + treeFellerCooldown = newvalue; } public int getTreeFellerCooldown(){ - return treefellercooldown; + return treeFellerCooldown; } public void decreaseTreeFellerCooldown(){ - if(treefellercooldown >= 1){ - treefellercooldown--; + if(treeFellerCooldown >= 1){ + treeFellerCooldown--; } } /* diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index 912bbf9bd..f9e6412f3 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -41,18 +41,30 @@ public class mcWoodCutting { if(!mcm.getInstance().abilityBlockCheck(block)) return; } - - int treefellticks = 8; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 100) + /* + * CHECK FOR AXE PREP MODE + */ + 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++; if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250) 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++; 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**"); diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index c6b1b9b91..9c4be6aa6 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -32,7 +32,7 @@ public class mcm { } 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)); } public boolean abilityBlockCheck(Block block){ @@ -235,6 +235,23 @@ public class mcm { if(split[0].equalsIgnoreCase("/woodcutting")){ event.setCancelled(true); 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); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----"); 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.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); 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")){ event.setCancelled(true); @@ -336,17 +354,23 @@ public class mcm { if(split[0].equalsIgnoreCase("/mining")){ float skillvalue = (float)mcUsers.getProfile(player).getMiningInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); - int miningticks = 8; - if(mcUsers.getProfile(player).getMiningInt() >= 100) + int miningticks = 3; + if(mcUsers.getProfile(player).getMiningInt() >= 50) + miningticks++; + if(mcUsers.getProfile(player).getMiningInt() >= 150) miningticks++; if(mcUsers.getProfile(player).getMiningInt() >= 250) 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++; if(mcUsers.getProfile(player).getMiningInt() >= 750) miningticks++; - if(mcUsers.getProfile(player).getMiningInt() >= 1000) - miningticks++; event.setCancelled(true); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"MINING"+ChatColor.RED+"[]-----"); 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){ - percentage = String.valueOf(((skillvalue / 1000) * 100) / 2); + arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); } else { - percentage = "50"; + arrowpercentage = "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+"Arrow Deflect: "+ChatColor.GREEN+"Deflect arrows"); 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+"Damage+ (Rank"+rank+"): Bonus "+rank+" damage"); }