diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 7cfad2f51..2586285a0 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,30 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code# +Version 0.9.18 +Added failsafe to prevent abilities from going on forever, abilities will check if they should've expired when being used in case the Timer fails +Archery Spam has been nerf'd, you can only fire once per second now (Toggle-able in config file) +Fixed bug when just having the Admin Chat permission wouldn't allow you to see Admin Chat +Fixed bug where Axes ability could be used without permission +Abilities are monitored with Timestamps rather than a Timer monitored tick rate +When players were last hurt is now monitored with Timestamps rather than a Timer monitored tick rate +Made Anti XP-Exploits more Robust +Repair XP is now based on durability restored +Acrobatics rolling will now reduce damage if you go over the damage threshold +Acrobatics rolling damage threshold lowered to 10 from 20 +Added Graceful Roll to Acrobatics, hold Shift when falling to do a Graceful Roll +mcMMO now checks for the blockBreak and EntityDamage events being canceled before proceeding +Dodge notification shortened +Dodge won't negate damage completely anymore +Added 3 more functions for plugin authors to call, getPartyName(Player player), inParty(Player player), and getParties() + +Version 0.9.17 +Players now set their MySpawn by entering a bed, it requires the setmyspawn permission node +/setmyspawn has been removed +Compatible with CB 670 +Fixed errors related to Repair +Abilities will no longer trigger from Bed interactions +/unarmed will now tell the player when they will receive unarmed master (if they have apprentice) + Version 0.9.16 Logs placed by the player won't grant XP/Double Drops anymore Added more functions plugin authors can call diff --git a/mcMMO/com/gmail/nossr50/mcAcrobatics.java b/mcMMO/com/gmail/nossr50/mcAcrobatics.java index 4dd56c6c4..d483ff277 100644 --- a/mcMMO/com/gmail/nossr50/mcAcrobatics.java +++ b/mcMMO/com/gmail/nossr50/mcAcrobatics.java @@ -1,5 +1,6 @@ package com.gmail.nossr50; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; @@ -14,14 +15,27 @@ public class mcAcrobatics { return instance; } public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ - if(player != null && mcPermissions.getInstance().acrobatics(player)&& event.getDamage() < 21){ - if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){ - player.sendMessage("**ROLLED**"); - if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))){ - if(!event.isCancelled()) - mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); - mcSkills.getInstance().XpCheck(player); + if(player != null && mcPermissions.getInstance().acrobatics(player)){ + int acrovar = mcUsers.getProfile(player).getAcrobaticsInt(); + if(player.isSneaking()) + acrovar = acrovar * 2; + if(Math.random() * 1000 <= acrovar){ + int threshold = 7; + if(player.isSneaking()) + threshold = 14; + int newDamage = event.getDamage() - threshold; + if(newDamage < 0) + newDamage = 0; + if(!event.isCancelled()) + mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); + mcSkills.getInstance().XpCheck(player); + event.setDamage(newDamage); + if(event.getDamage() <= 0) event.setCancelled(true); + if(player.isSneaking()){ + player.sendMessage(ChatColor.GREEN+"**GRACEFUL ROLL**"); + } else { + player.sendMessage("**ROLL**"); } } else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){ mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 7cf649b56..d497751ea 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -12,6 +12,8 @@ import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcBlockListener extends BlockListener { private final mcMMO plugin; @@ -29,20 +31,25 @@ public class mcBlockListener extends BlockListener { else { block = event.getBlock(); } - if(player != null && mcm.getInstance().shouldBeWatched(block)) - mcConfig.getInstance().addBlockWatch(block); + if(player != null && mcm.getInstance().shouldBeWatched(block)){ + if(block.getTypeId() != 17) + block.setData((byte) 5); //Change the byte + if(block.getTypeId() == 17) + mcConfig.getInstance().addBlockWatch(block); + } if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages) event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor."); } public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player); Block block = event.getBlock(); ItemStack inhand = player.getItemInHand(); - - if (event instanceof FakeBlockBreakEvent) { + if(event.isCancelled()) + return; + if (event instanceof FakeBlockBreakEvent) return; - } /* * MINING @@ -64,13 +71,13 @@ public class mcBlockListener extends BlockListener { if(mcm.getInstance().isAxes(inhand)){ if(!mcConfig.getInstance().isBlockWatched(block)){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); - mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); + PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); } } } else { - if(!mcConfig.getInstance().isBlockWatched(block)){ + if(block.getData() != 5){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); - mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); + PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); } } mcSkills.getInstance().XpCheck(player); @@ -79,9 +86,14 @@ public class mcBlockListener extends BlockListener { * IF PLAYER IS USING TREEFELLER */ if(mcPermissions.getInstance().woodCuttingAbility(player) - && mcUsers.getProfile(player).getTreeFellerMode() + && PP.getTreeFellerMode() && block.getTypeId() == 17 && mcm.getInstance().blockBreakSimulate(block, player, plugin)){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); + mcWoodCutting.getInstance().treeFeller(block, player); for(Block blockx : mcConfig.getInstance().getTreeFeller()){ if(blockx != null){ @@ -95,7 +107,7 @@ public class mcBlockListener extends BlockListener { //XP WOODCUTTING if(!mcConfig.getInstance().isBlockWatched(block)){ mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx); - mcUsers.getProfile(player).addWoodcuttingGather(7); + PP.addWoodcuttingGather(7); } } if(blockx.getTypeId() == 18){ @@ -109,11 +121,6 @@ public class mcBlockListener extends BlockListener { } if(mcLoadProperties.toolsLoseDurabilityFromAbilities) mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss); - /* - * NOTE TO SELF - * I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED - * OR ELSE IT COULD BE A MEMORY LEAK SITUATION - */ mcConfig.getInstance().clearTreeFeller(); } } @@ -127,32 +134,40 @@ public class mcBlockListener extends BlockListener { */ if(mcPermissions.getInstance().herbalism(player)) mcHerbalism.getInstance().herbalismProcCheck(block, player); + //Change the byte back when broken + if(block.getData() == 5) + block.setData((byte) 0); } public void onBlockDamage(BlockDamageEvent event) { if(event.isCancelled()) return; Player player = event.getPlayer(); + PlayerProfile PP = mcUsers.getProfile(player); ItemStack inhand = player.getItemInHand(); Block block = event.getBlock(); - /* * ABILITY PREPARATION CHECKS */ - if(mcUsers.getProfile(player).getAxePreparationMode() && block.getTypeId() == 17) + if(PP.getAxePreparationMode() && block.getTypeId() == 17) mcWoodCutting.getInstance().treeFellerCheck(player, block); - if(mcUsers.getProfile(player).getPickaxePreparationMode()) + if(PP.getPickaxePreparationMode()) mcMining.getInstance().superBreakerCheck(player, block); - if(mcUsers.getProfile(player).getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) + if(PP.getShovelPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) mcExcavation.getInstance().gigaDrillBreakerActivationCheck(player, block); - if(mcUsers.getProfile(player).getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) + if(PP.getFistsPreparationMode() && mcExcavation.getInstance().canBeGigaDrillBroken(block)) mcSkills.getInstance().berserkActivationCheck(player); /* * GIGA DRILL BREAKER CHECKS */ - if(mcUsers.getProfile(player).getGigaDrillBreakerMode() + if(PP.getGigaDrillBreakerMode() && mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcExcavation.getInstance().canBeGigaDrillBroken(block) && mcm.getInstance().isShovel(inhand)){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); + if(mcm.getInstance().getTier(player) >= 2) mcExcavation.getInstance().excavationProcCheck(block, player); if(mcm.getInstance().getTier(player) >= 3) @@ -172,25 +187,34 @@ public class mcBlockListener extends BlockListener { /* * BERSERK MODE CHECKS */ - if(mcUsers.getProfile(player).getBerserkMode() - && mcm.getInstance().blockBreakSimulate(block, player, plugin) - && player.getItemInHand().getTypeId() == 0 - && mcExcavation.getInstance().canBeGigaDrillBroken(block)){ - Material mat = Material.getMaterial(block.getTypeId()); - if(block.getTypeId() == 2) - mat = Material.DIRT; - byte type = block.getData(); - ItemStack item = new ItemStack(mat, 1, (byte)0, type); - block.setType(Material.AIR); - block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item); + if(PP.getBerserkMode() + && mcm.getInstance().blockBreakSimulate(block, player, plugin) + && player.getItemInHand().getTypeId() == 0 + && mcExcavation.getInstance().canBeGigaDrillBroken(block)){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); + Material mat = Material.getMaterial(block.getTypeId()); + if(block.getTypeId() == 2) + mat = Material.DIRT; + byte type = block.getData(); + ItemStack item = new ItemStack(mat, 1, (byte)0, type); + block.setType(Material.AIR); + block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item); } /* * SUPER BREAKER CHECKS */ - if(mcUsers.getProfile(player).getSuperBreakerMode() + if(PP.getSuperBreakerMode() && mcMining.getInstance().canBeSuperBroken(block) && mcm.getInstance().blockBreakSimulate(block, player, plugin)){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(player); + if(mcLoadProperties.miningrequirespickaxe){ if(mcm.getInstance().isMiningPick(inhand)) mcMining.getInstance().SuperBreakerBlockCheck(player, block); diff --git a/mcMMO/com/gmail/nossr50/mcCombat.java b/mcMMO/com/gmail/nossr50/mcCombat.java index 8a8898491..d719d7bed 100644 --- a/mcMMO/com/gmail/nossr50/mcCombat.java +++ b/mcMMO/com/gmail/nossr50/mcCombat.java @@ -59,13 +59,12 @@ public class mcCombat { if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ //Bonus just for having unarmed - if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ - event.setDamage(calculateDamage(event, 2)); - } else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ - event.setDamage(calculateDamage(event, 3)); - } else { - event.setDamage(calculateDamage(event, 4)); - } + int bonus = 2; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + bonus++; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + bonus++; + event.setDamage(calculateDamage(event, bonus)); //PROC if(simulateUnarmedProc(attacker)){ @@ -130,13 +129,12 @@ public class mcCombat { return; //Bonus just for having unarmed - if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ - event.setDamage(calculateDamage(event, 2)); - } else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ - event.setDamage(calculateDamage(event, 3)); - } else { - event.setDamage(calculateDamage(event, 4)); - } + int bonus = 2; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + bonus++; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + bonus++; + event.setDamage(calculateDamage(event, bonus)); //XP if(defender.getHealth() != 0){ @@ -161,13 +159,12 @@ public class mcCombat { } if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ //Bonus just for having unarmed - if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ - event.setDamage(calculateDamage(event, 2)); - } else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ - event.setDamage(calculateDamage(event, 3)); - } else { - event.setDamage(calculateDamage(event, 4)); - } + int bonus = 2; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + bonus++; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + bonus++; + event.setDamage(calculateDamage(event, bonus)); } } } @@ -228,13 +225,12 @@ public class mcCombat { return; //Bonus just for having unarmed - if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ - event.setDamage(calculateDamage(event, 2)); - } else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ - event.setDamage(calculateDamage(event, 3)); - } else { - event.setDamage(calculateDamage(event, 4)); - } + int bonus = 2; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250) + bonus++; + if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500) + bonus++; + event.setDamage(calculateDamage(event, bonus)); //XP if(!mcConfig.getInstance().isMobSpawnTracked(x)){ diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index abe4c5488..080d838b5 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent; @@ -42,6 +43,8 @@ public class mcEntityListener extends EntityListener { } } public void onEntityDamage(EntityDamageEvent event) { + if(event.isCancelled()) + return; /* * CHECK FOR INVULNERABILITY */ @@ -145,10 +148,20 @@ public class mcEntityListener extends EntityListener { * This will do AOE damage from the axes ability */ - if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())) - mcCombat.getInstance().applyAoeDamage(attacker, eventb, x); - if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())) - mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x); + if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(attacker); + mcCombat.getInstance().applyAoeDamage(attacker, eventb, x); + } + if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())){ + /* + * Check if the Timer is doing its job + */ + mcSkills.getInstance().monitorSkills(attacker); + mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x); + } } /* * DODGE / COUNTERATTACK CHECKS @@ -196,16 +209,22 @@ public class mcEntityListener extends EntityListener { if(mcPermissions.getInstance().acrobatics(defender)){ if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){ if(Math.random() * 4000 <= mcUsers.getProfile(defender).getAcrobaticsInt()){ - defender.sendMessage(ChatColor.RED+"**DODGE - DAMAGE REDUCED**"); + defender.sendMessage(ChatColor.GREEN+"**DODGE**"); mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); + //Needs to do minimal damage + if(event.getDamage() <= 0) + event.setDamage(1); } } else if(Math.random() * 4000 <= 800) { - defender.sendMessage(ChatColor.RED+"**DODGE - DAMAGE REDUCED**"); + defender.sendMessage(ChatColor.GREEN+"**DODGE**"); mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12); mcSkills.getInstance().XpCheck(defender); event.setDamage(event.getDamage() / 2); + //Needs to do minimal damage + if(event.getDamage() <= 0) + event.setDamage(1); } } } @@ -216,7 +235,7 @@ public class mcEntityListener extends EntityListener { */ if(x instanceof Player && !event.isCancelled()){ Player herpderp = (Player)x; - mcUsers.getProfile(herpderp).setRecentlyHurt(30); + mcUsers.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis()); } } } diff --git a/mcMMO/com/gmail/nossr50/mcExcavation.java b/mcMMO/com/gmail/nossr50/mcExcavation.java index 6da795e79..7bd68f05e 100644 --- a/mcMMO/com/gmail/nossr50/mcExcavation.java +++ b/mcMMO/com/gmail/nossr50/mcExcavation.java @@ -28,7 +28,6 @@ public class mcExcavation { } if(mcUsers.getProfile(player).getShovelPreparationMode()){ mcUsers.getProfile(player).setShovelPreparationMode(false); - mcUsers.getProfile(player).setShovelPreparationTicks(0); } int ticks = 2; if(mcUsers.getProfile(player).getExcavationInt() >= 50) @@ -50,7 +49,8 @@ public class mcExcavation { if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); - mcUsers.getProfile(player).setGigaDrillBreakerTicks(ticks * 2); + mcUsers.getProfile(player).setGigaDrillBreakerTicks(ticks * 1000); + mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis()); mcUsers.getProfile(player).setGigaDrillBreakerMode(true); } @@ -69,7 +69,7 @@ public class mcExcavation { Location loc = block.getLocation(); ItemStack is = null; Material mat = null; - if(mcConfig.getInstance().isBlockWatched(block)){ + if(block.getData() == 5){ return; } if(type == 2){ diff --git a/mcMMO/com/gmail/nossr50/mcItem.java b/mcMMO/com/gmail/nossr50/mcItem.java index 476cbc480..38ed8419e 100644 --- a/mcMMO/com/gmail/nossr50/mcItem.java +++ b/mcMMO/com/gmail/nossr50/mcItem.java @@ -34,7 +34,7 @@ public class mcItem { int y = derp.getY(); ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 288){ + if(x != null && x.getTypeId() == 288){ if(x.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing + 1){ x.setAmount(x.getAmount() - mcLoadProperties.feathersConsumedByChimaeraWing); player.getInventory().setContents(inventory); diff --git a/mcMMO/com/gmail/nossr50/mcLoadProperties.java b/mcMMO/com/gmail/nossr50/mcLoadProperties.java index 9cb9bb697..89a846b16 100644 --- a/mcMMO/com/gmail/nossr50/mcLoadProperties.java +++ b/mcMMO/com/gmail/nossr50/mcLoadProperties.java @@ -1,7 +1,7 @@ package com.gmail.nossr50; public class mcLoadProperties { - public static Boolean mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; + public static Boolean archeryFireRateLimit, mushrooms, toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, woodcuttingrequiresaxe, pvp, eggs, apples, myspawnclearsinventory, cake, music, diamond, glowstone, slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages; public static String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn; public static int xpGainMultiplier, superBreakerCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; @@ -22,6 +22,7 @@ public class mcLoadProperties { /* * OTHER */ + archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true); myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true); xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1); toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true); diff --git a/mcMMO/com/gmail/nossr50/mcMMO.java b/mcMMO/com/gmail/nossr50/mcMMO.java index 4c3b7291a..dc676dd31 100644 --- a/mcMMO/com/gmail/nossr50/mcMMO.java +++ b/mcMMO/com/gmail/nossr50/mcMMO.java @@ -4,9 +4,13 @@ import com.nijikokun.bukkit.Permissions.Permissions; import com.nijiko.Messaging; import com.nijiko.permissions.PermissionHandler; import org.bukkit.plugin.Plugin; + +import java.io.BufferedReader; import java.io.File; +import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Timer; import java.util.logging.Level; import java.util.logging.Logger; @@ -63,6 +67,7 @@ public class mcMMO extends JavaPlugin { mcUsers.addUser(player); } PluginManager pm = getServer().getPluginManager(); + pm.registerEvent(Event.Type.PLAYER_BED_ENTER, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this); @@ -116,6 +121,37 @@ public class mcMMO extends JavaPlugin { public void modifySkill(Player player, String skillname, Integer newvalue){ mcUsers.getProfile(player).modifyskill(newvalue, skillname); } + public ArrayList getParties(){ + String location = "plugins/mcMMO/mcmmo.users"; + ArrayList parties = new ArrayList(); + try { + //Open the users file + FileReader file = new FileReader(location); + BufferedReader in = new BufferedReader(file); + String line = ""; + while((line = in.readLine()) != null) + { + String[] character = line.split(":"); + String theparty = null; + //Party + if(character.length > 3) + theparty = character[3]; + if(!parties.contains(theparty)) + parties.add(theparty); + } + in.close(); + } catch (Exception e) { + log.log(Level.SEVERE, "Exception while reading " + + location + " (Are you sure you formatted it correctly?)", e); + } + return parties; + } + public static String getPartyName(Player player){ + return mcUsers.getProfile(player).getParty(); + } + public static boolean inParty(Player player){ + return mcUsers.getProfile(player).inParty(); + } public boolean isAdminChatToggled(Player player){ if(mcConfig.getInstance().isAdminToggled(player.getName())){ return true; diff --git a/mcMMO/com/gmail/nossr50/mcMining.java b/mcMMO/com/gmail/nossr50/mcMining.java index 7ce84a395..4c1b7b52a 100644 --- a/mcMMO/com/gmail/nossr50/mcMining.java +++ b/mcMMO/com/gmail/nossr50/mcMining.java @@ -20,6 +20,7 @@ public class mcMining { } return instance; } + public void superBreakerCheck(Player player, Block block){ if(mcm.getInstance().isMiningPick(player.getItemInHand())){ if(block != null){ @@ -28,7 +29,6 @@ public class mcMining { } if(mcUsers.getProfile(player).getPickaxePreparationMode()){ mcUsers.getProfile(player).setPickaxePreparationMode(false); - mcUsers.getProfile(player).setPickaxePreparationTicks(0); } int ticks = 2; if(mcUsers.getProfile(player).getMiningInt() >= 50) @@ -50,7 +50,8 @@ public class mcMining { if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); - mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 2); + mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 1000); + mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp(System.currentTimeMillis()); mcUsers.getProfile(player).setSuperBreakerMode(true); } diff --git a/mcMMO/com/gmail/nossr50/mcPlayerListener.java b/mcMMO/com/gmail/nossr50/mcPlayerListener.java index f16cdedfa..45374966a 100644 --- a/mcMMO/com/gmail/nossr50/mcPlayerListener.java +++ b/mcMMO/com/gmail/nossr50/mcPlayerListener.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerEvent; @@ -72,6 +73,19 @@ public class mcPlayerListener extends PlayerListener { Player player = event.getPlayer(); Action action = event.getAction(); Block block = event.getClickedBlock(); + //Archery Nerf + if(player.getItemInHand().getTypeId() == 261 && mcLoadProperties.archeryFireRateLimit){ + if(System.currentTimeMillis() < mcUsers.getProfile(player).getArcheryShotATS() + 1000){ + /* + if(mcm.getInstance().hasArrows(player)) + mcm.getInstance().addArrows(player); + */ + player.updateInventory(); + event.setCancelled(true); + } else { + mcUsers.getProfile(player).setArcheryShotATS(System.currentTimeMillis()); + } + } /* * Ability checks */ @@ -103,6 +117,14 @@ public class mcPlayerListener extends PlayerListener { mcItem.getInstance().itemChecks(player); } } + public void onPlayerBedEnter(PlayerBedEnterEvent event) { + Player player = event.getPlayer(); + Location loc = player.getLocation(); + if(mcPermissions.getInstance().setMySpawn(player)){ + mcUsers.getProfile(player).setMySpawn(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName()); + } + player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set to your current location."); + } public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { Player player = event.getPlayer(); String[] split = event.getMessage().split(" "); @@ -130,40 +152,37 @@ public class mcPlayerListener extends PlayerListener { player = getPlayer(split[1]); } /* - * AXE PREPARATION MODE + * PREP MODES */ mcUsers.getProfile(player).setAxePreparationMode(false); - mcUsers.getProfile(player).setAxePreparationTicks(0); + mcUsers.getProfile(player).setFistsPreparationMode(false); + mcUsers.getProfile(player).setSwordsPreparationMode(false); + mcUsers.getProfile(player).setPickaxePreparationMode(false); /* * GIGA DRILL BREAKER */ - mcUsers.getProfile(player).setGigaDrillBreakerCooldown(0); mcUsers.getProfile(player).setGigaDrillBreakerMode(false); - mcUsers.getProfile(player).setGigaDrillBreakerTicks(0); + mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp((long) 0); /* * SERRATED STRIKE */ - mcUsers.getProfile(player).setSerratedStrikesCooldown(0); mcUsers.getProfile(player).setSerratedStrikesMode(false); - mcUsers.getProfile(player).setSerratedStrikesTicks(0); + mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp((long) 0); /* * SUPER BREAKER */ - mcUsers.getProfile(player).setSuperBreakerCooldown(0); mcUsers.getProfile(player).setSuperBreakerMode(false); - mcUsers.getProfile(player).setSuperBreakerTicks(0); + mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp((long) 0); /* * TREE FELLER */ - mcUsers.getProfile(player).setTreeFellerCooldown(0); mcUsers.getProfile(player).setTreeFellerMode(false); - mcUsers.getProfile(player).setTreeFellerTicks(0); + mcUsers.getProfile(player).setTreeFellerActivatedTimeStamp((long) 0); /* * BERSERK */ - mcUsers.getProfile(player).setBerserkCooldown(0); mcUsers.getProfile(player).setBerserkMode(false); - mcUsers.getProfile(player).setBerserkTicks(0); + mcUsers.getProfile(player).setBerserkActivatedTimeStamp((long)0); player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**"); } @@ -358,26 +377,6 @@ public class mcPlayerListener extends PlayerListener { player.sendMessage("Z: "+z); } } - /* - * SETMYSPAWN COMMAND - */ - if(split[0].equalsIgnoreCase("/"+mcLoadProperties.setmyspawn)){ - event.setCancelled(true); - if(!mcPermissions.getInstance().setMySpawn(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +" Insufficient permissions."); - return; - } - if((mcPermissions.getInstance().setMySpawnOther(player) || player.isOp()) && split.length >= 2 && isPlayer(split[1])){ - player.sendMessage("You have set "+split[1]+"'s spawn!"); - player = getPlayer(split[1]); - } - double x = player.getLocation().getX(); - double y = player.getLocation().getY(); - double z = player.getLocation().getZ(); - String myspawnworld = player.getWorld().getName(); - mcUsers.getProfile(player).setMySpawn(x, y, z, myspawnworld); - player.sendMessage(ChatColor.DARK_AQUA + "Myspawn has been set."); - } /* * STATS COMMAND */ @@ -538,7 +537,7 @@ public class mcPlayerListener extends PlayerListener { } event.setCancelled(true); if(mcConfig.getInstance().isPartyToggled(player.getName())) - mcConfig.getInstance().togglePartyChat(playerName); + mcConfig.getInstance().togglePartyChat(playerName); mcConfig.getInstance().toggleAdminChat(playerName); if(mcConfig.getInstance().isAdminToggled(playerName)){ player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On"); @@ -556,24 +555,24 @@ public class mcPlayerListener extends PlayerListener { return; } if(mcUsers.getProfile(player).getMySpawn(player) != null){ - if(mcLoadProperties.myspawnclearsinventory) - player.getInventory().clear(); - player.setHealth(20); - Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); - //player.sendMessage("mcMMO DEBUG CODE 1"); - if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("")){ - mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); - //player.sendMessage("mcMMO DEBUG CODE 2"); - } else { - //player.sendMessage("mcMMO DEBUG CODE 5"); - mySpawn.setWorld(plugin.getServer().getWorlds().get(0)); - } - //player.sendMessage("mcMMO DEBUG CODE 3"); - player.teleportTo(mySpawn); - player.teleportTo(mySpawn); - //Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first. - //player.sendMessage("mcMMO DEBUG CODE 4"); - player.sendMessage("Inventory cleared & health restored"); + if(mcLoadProperties.myspawnclearsinventory) + player.getInventory().clear(); + player.setHealth(20); + Location mySpawn = mcUsers.getProfile(player).getMySpawn(player); + //player.sendMessage("mcMMO DEBUG CODE 1"); + if(mcUsers.getProfile(player).getMySpawnWorld(plugin) != null && !mcUsers.getProfile(player).getMySpawnWorld(plugin).equals("")){ + mySpawn.setWorld(plugin.getServer().getWorld(mcUsers.getProfile(player).getMySpawnWorld(plugin))); + //player.sendMessage("mcMMO DEBUG CODE 2"); + } else { + //player.sendMessage("mcMMO DEBUG CODE 5"); + mySpawn.setWorld(plugin.getServer().getWorlds().get(0)); + } + //player.sendMessage("mcMMO DEBUG CODE 3"); + player.teleportTo(mySpawn); //It's done twice because teleporting from one world to another is weird + player.teleportTo(mySpawn); + //Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first. + //player.sendMessage("mcMMO DEBUG CODE 4"); + player.sendMessage("Inventory cleared & health restored"); }else{ player.sendMessage(ChatColor.RED+"Configure your myspawn first with /setmyspawn"); } @@ -595,12 +594,11 @@ public class mcPlayerListener extends PlayerListener { } return; } - if((player.isOp() || mcPermissions.getInstance().adminChat(player)) - && mcConfig.getInstance().isAdminToggled(player.getName())){ + if((player.isOp() || mcPermissions.getInstance().adminChat(player)) && mcConfig.getInstance().isAdminToggled(player.getName())){ log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage()); event.setCancelled(true); for(Player herp : plugin.getServer().getOnlinePlayers()){ - if(herp.isOp()){ + if((herp.isOp() || mcPermissions.getInstance().adminChat(herp))){ herp.sendMessage(y+event.getMessage()); } } diff --git a/mcMMO/com/gmail/nossr50/mcRepair.java b/mcMMO/com/gmail/nossr50/mcRepair.java index 4275b07a4..8d855df10 100644 --- a/mcMMO/com/gmail/nossr50/mcRepair.java +++ b/mcMMO/com/gmail/nossr50/mcRepair.java @@ -19,6 +19,9 @@ public class mcRepair { return instance; } public void repairCheck(Player player, ItemStack is, Block block){ + short durabilityBefore = is.getDurability(); + short durabilityAfter = 0; + short dif = 0; if(block != null && mcPermissions.getInstance().repair(player)){ if(player.getItemInHand().getDurability() > 0){ @@ -32,19 +35,26 @@ public class mcRepair { if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ removeDiamond(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else if (isIronArmor(is) && hasIron(player)){ /* * IRON ARMOR */ removeIron(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); //GOLD ARMOR } else if (isGoldArmor(is) && hasGold(player)){ removeGold(player); player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); - mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + dif = (short) (dif * 4); //Boost XP of Gold to around Iron + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -59,18 +69,43 @@ public class mcRepair { if(isIronTools(is) && hasIron(player)){ is.setDurability(getToolRepairAmount(is, player)); removeIron(player); - mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + if(mcm.getInstance().isShovel(is)) + dif = (short) (dif / 3); + if(mcm.getInstance().isSwords(is)) + dif = (short) (dif / 2); + if(mcm.getInstance().isHoe(is)) + dif = (short) (dif / 2); + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds /* * DIAMOND TOOLS */ is.setDurability(getToolRepairAmount(is, player)); removeDiamond(player); - mcUsers.getProfile(player).addRepairGather(75 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + if(mcm.getInstance().isShovel(is)) + dif = (short) (dif / 3); + if(mcm.getInstance().isSwords(is)) + dif = (short) (dif / 2); + if(mcm.getInstance().isHoe(is)) + dif = (short) (dif / 2); + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else if(isGoldTools(is) && hasGold(player)){ is.setDurability(getToolRepairAmount(is, player)); removeGold(player); - mcUsers.getProfile(player).addRepairGather(50 * mcLoadProperties.xpGainMultiplier); + durabilityAfter = is.getDurability(); + dif = (short) (durabilityBefore - durabilityAfter); + dif = (short) (dif * 7.6); //Boost XP for Gold to that of around Iron + if(mcm.getInstance().isShovel(is)) + dif = (short) (dif / 3); + if(mcm.getInstance().isSwords(is)) + dif = (short) (dif / 2); + if(mcm.getInstance().isHoe(is)) + dif = (short) (dif / 2); + mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier); } else { needMoreVespeneGas(is, player); } @@ -155,7 +190,7 @@ public class mcRepair { public void removeIron(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 265){ + if(x != null && x.getTypeId() == 265){ if(x.getAmount() == 1){ x.setTypeId(0); x.setAmount(0); @@ -171,7 +206,7 @@ public class mcRepair { public void removeGold(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 266){ + if(x != null && x.getTypeId() == 266){ if(x.getAmount() == 1){ x.setTypeId(0); x.setAmount(0); @@ -187,7 +222,7 @@ public class mcRepair { public void removeDiamond(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 264){ + if(x != null && x.getTypeId() == 264){ if(x.getAmount() == 1){ x.setTypeId(0); x.setAmount(0); @@ -203,7 +238,7 @@ public class mcRepair { public boolean hasGold(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 266){ + if(x != null && x.getTypeId() == 266){ return true; } } @@ -212,7 +247,7 @@ public class mcRepair { public boolean hasDiamond(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 264){ + if(x != null && x.getTypeId() == 264){ return true; } } @@ -221,7 +256,7 @@ public class mcRepair { public boolean hasIron(Player player){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == 265){ + if(x != null && x.getTypeId() == 265){ return true; } } diff --git a/mcMMO/com/gmail/nossr50/mcSkills.java b/mcMMO/com/gmail/nossr50/mcSkills.java index d95c33e6c..a227f49ce 100644 --- a/mcMMO/com/gmail/nossr50/mcSkills.java +++ b/mcMMO/com/gmail/nossr50/mcSkills.java @@ -6,6 +6,8 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcSkills { private static mcMMO plugin; @@ -19,6 +21,14 @@ public class mcSkills { } return instance; } + public boolean cooldownOver(Player player, long oldTime, int cooldown){ + long currentTime = System.currentTimeMillis(); + if(currentTime - oldTime >= (cooldown * 1000)){ + return true; + } else { + return false; + } + } public boolean hasArrows(Player player){ for(ItemStack x : player.getInventory().getContents()){ if (x.getTypeId() == 262){ @@ -35,92 +45,90 @@ public class mcSkills { } } } - public void decreaseCooldowns(Player player){ - if(mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){ - mcUsers.getProfile(player).decreaseTreeFellerCooldown(); - if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!"); - } + public int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown){ + long currentTime = System.currentTimeMillis(); + int x = 0; + while(currentTime < deactivatedTimeStamp + (cooldown * 1000)){ + currentTime += 1000; + x++; } - if(mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ - mcUsers.getProfile(player).decreaseSuperBreakerCooldown(); - if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); - } + return x; + } + public void watchCooldowns(Player player){ + if(!mcUsers.getProfile(player).getTreeFellerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getTreeFellerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setTreeFellerInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!"); } - if(mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){ - mcUsers.getProfile(player).decreaseSerratedStrikesCooldown(); - if(mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); - } + if(!mcUsers.getProfile(player).getSuperBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setSuperBreakerInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); } - if(mcUsers.getProfile(player).getBerserkCooldown() >= 1){ - mcUsers.getProfile(player).decreaseBerserkCooldown(); - if(mcUsers.getProfile(player).getBerserkCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); - } + if(!mcUsers.getProfile(player).getSerratedStrikesInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setSerratedStrikesInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); } - if(mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){ - mcUsers.getProfile(player).decreaseSkullSplitterCooldown(); - if(mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); - } + if(!mcUsers.getProfile(player).getBerserkInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setBerserkInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); } - if(mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){ - mcUsers.getProfile(player).decreaseGigaDrillBreakerCooldown(); - if(mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ - player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!"); - } + if(!mcUsers.getProfile(player).getSkullSplitterInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setSkullSplitterInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); + } + if(!mcUsers.getProfile(player).getGigaDrillBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){ + mcUsers.getProfile(player).setGigaDrillBreakerInformed(true); + player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!"); } } public void abilityActivationCheck(Player player){ - if(!mcUsers.getProfile(player).getAbilityUse()) + PlayerProfile PP = mcUsers.getProfile(player); + if(!PP.getAbilityUse()) return; if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){ - if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ - player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."+ChatColor.YELLOW+" (" - +mcUsers.getProfile(player).getSuperBreakerCooldown()+"s)"); + if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){ + player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)"); return; } player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**"); - mcUsers.getProfile(player).setPickaxePreparationTicks(4); - mcUsers.getProfile(player).setPickaxePreparationMode(true); + PP.setPickaxePreparationATS(System.currentTimeMillis()); + PP.setPickaxePreparationMode(true); } - if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !mcUsers.getProfile(player).getShovelPreparationMode()){ - if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){ + if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()){ + if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getGigaDrillBreakerCooldown()+"s)"); + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)+"s)"); return; } player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**"); - mcUsers.getProfile(player).setShovelPreparationTicks(4); - mcUsers.getProfile(player).setShovelPreparationMode(true); + PP.setShovelPreparationATS(System.currentTimeMillis()); + PP.setShovelPreparationMode(true); } - if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !mcUsers.getProfile(player).getSwordsPreparationMode()){ - if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){ + if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()){ + if(!PP.getSerratedStrikesMode() && !cooldownOver(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getSerratedStrikesCooldown()+"s)"); + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)+"s)"); return; } player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**"); - mcUsers.getProfile(player).setSwordsPreparationTicks(4); - mcUsers.getProfile(player).setSwordsPreparationMode(true); + PP.setSwordsPreparationATS(System.currentTimeMillis()); + PP.setSwordsPreparationMode(true); } - if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !mcUsers.getProfile(player).getFistsPreparationMode()){ - if(!mcUsers.getProfile(player).getBerserkMode() && mcUsers.getProfile(player).getBerserkCooldown() >= 1){ + if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode()){ + if(!PP.getBerserkMode() && !cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getBerserkCooldown()+"s)"); + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)+"s)"); return; } player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**"); - mcUsers.getProfile(player).setFistsPreparationTicks(4); - mcUsers.getProfile(player).setFistsPreparationMode(true); + PP.setFistsPreparationATS(System.currentTimeMillis()); + PP.setFistsPreparationMode(true); } - if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !mcUsers.getProfile(player).getAxePreparationMode()){ + if((mcPermissions.getInstance().axes(player) || mcPermissions.getInstance().woodcutting(player)) && !PP.getAxePreparationMode()){ if(mcm.getInstance().isAxes(player.getItemInHand())){ player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**"); - mcUsers.getProfile(player).setAxePreparationTicks(4); - mcUsers.getProfile(player).setAxePreparationMode(true); + PP.setAxePreparationATS(System.currentTimeMillis()); + PP.setAxePreparationMode(true); } } } @@ -128,7 +136,6 @@ public class mcSkills { if(mcm.getInstance().isSwords(player.getItemInHand())){ if(mcUsers.getProfile(player).getSwordsPreparationMode()){ mcUsers.getProfile(player).setSwordsPreparationMode(false); - mcUsers.getProfile(player).setSwordsPreparationTicks(0); } int ticks = 2; if(mcUsers.getProfile(player).getSwordsInt() >= 50) @@ -150,7 +157,8 @@ public class mcSkills { if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); - mcUsers.getProfile(player).setSerratedStrikesTicks(ticks * 2); + mcUsers.getProfile(player).setSerratedStrikesTicks(ticks * 1000); + mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis()); mcUsers.getProfile(player).setSerratedStrikesMode(true); } @@ -160,7 +168,6 @@ public class mcSkills { if(player.getItemInHand().getTypeId() == 0){ if(mcUsers.getProfile(player).getFistsPreparationMode()){ mcUsers.getProfile(player).setFistsPreparationMode(false); - mcUsers.getProfile(player).setFistsPreparationTicks(0); } int ticks = 2; if(mcUsers.getProfile(player).getUnarmedInt() >= 50) @@ -180,170 +187,146 @@ public class mcSkills { if(mcUsers.getProfile(player).getUnarmedInt() >= 750) ticks++; - if(!mcUsers.getProfile(player).getBerserkMode() && mcUsers.getProfile(player).getBerserkCooldown() == 0){ + if(!mcUsers.getProfile(player).getBerserkMode() && cooldownOver(player, mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){ player.sendMessage(ChatColor.GREEN+"**BERSERK ACTIVATED**"); - mcUsers.getProfile(player).setBerserkTicks(ticks * 2); + mcUsers.getProfile(player).setBerserkTicks(ticks * 1000); + mcUsers.getProfile(player).setBerserkActivatedTimeStamp(System.currentTimeMillis()); mcUsers.getProfile(player).setBerserkMode(true); } - } } public void skullSplitterCheck(Player player){ - if(mcm.getInstance().isAxes(player.getItemInHand())){ + PlayerProfile PP = mcUsers.getProfile(player); + if(mcm.getInstance().isAxes(player.getItemInHand()) && mcPermissions.getInstance().axesAbility(player)){ /* * CHECK FOR AXE PREP MODE */ - if(mcUsers.getProfile(player).getAxePreparationMode()){ - mcUsers.getProfile(player).setAxePreparationMode(false); - mcUsers.getProfile(player).setAxePreparationTicks(0); + if(PP.getAxePreparationMode()){ + PP.setAxePreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getAxesInt() >= 50) + if(PP.getAxesInt() >= 50) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 150) + if(PP.getAxesInt() >= 150) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 250) + if(PP.getAxesInt() >= 250) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 350) + if(PP.getAxesInt() >= 350) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 450) + if(PP.getAxesInt() >= 450) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 550) + if(PP.getAxesInt() >= 550) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 650) + if(PP.getAxesInt() >= 650) ticks++; - if(mcUsers.getProfile(player).getAxesInt() >= 750) + if(PP.getAxesInt() >= 750) ticks++; - if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){ + if(!PP.getSkullSplitterMode() && PP.getSkullSplitterCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); - mcUsers.getProfile(player).setSkullSplitterTicks(ticks * 2); - mcUsers.getProfile(player).setSkullSplitterMode(true); + PP.setSkullSplitterTicks(ticks * 1000); + PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis()); + PP.setSkullSplitterMode(true); } - if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){ + if(!PP.getSkullSplitterMode() && !cooldownOver(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getSkullSplitterCooldown()+"s)"); + +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSkullSplitterDeactivatedTimeStamp(), mcLoadProperties.skullSplitterCooldown)+"s)"); } } } public void monitorSkills(Player player){ + PlayerProfile PP = mcUsers.getProfile(player); /* * AXE PREPARATION MODE */ - if(mcUsers.getProfile(player) == null) + if(PP == null) mcUsers.addUser(player); - if(mcUsers.getProfile(player).getAxePreparationMode()){ - mcUsers.getProfile(player).decreaseAxePreparationTicks(); - if(mcUsers.getProfile(player).getAxePreparationTicks() <= 0){ - mcUsers.getProfile(player).setAxePreparationMode(false); + if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){ + PP.setAxePreparationMode(false); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); - } } - if(mcUsers.getProfile(player).getPickaxePreparationMode()){ - mcUsers.getProfile(player).decreasePickaxePreparationTicks(); - if(mcUsers.getProfile(player).getPickaxePreparationTicks() <= 0){ - mcUsers.getProfile(player).setPickaxePreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**"); - } + if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - PP.getPickaxePreparationATS() >= 4000){ + PP.setPickaxePreparationMode(false); + player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**"); } - if(mcUsers.getProfile(player).getSwordsPreparationMode()){ - mcUsers.getProfile(player).decreaseSwordsPreparationTicks(); - if(mcUsers.getProfile(player).getSwordsPreparationTicks() <= 0){ - mcUsers.getProfile(player).setSwordsPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**"); - } + if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - PP.getSwordsPreparationATS() >= 4000){ + PP.setSwordsPreparationMode(false); + player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**"); } - if(mcUsers.getProfile(player).getFistsPreparationMode()){ - mcUsers.getProfile(player).decreaseFistsPreparationTicks(); - if(mcUsers.getProfile(player).getFistsPreparationTicks() <= 0){ - mcUsers.getProfile(player).setFistsPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**"); - } + if(PP.getFistsPreparationMode() && System.currentTimeMillis() - PP.getFistsPreparationATS() >= 4000){ + PP.setFistsPreparationMode(false); + player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**"); } - if(mcUsers.getProfile(player).getShovelPreparationMode()){ - mcUsers.getProfile(player).decreaseShovelPreparationTicks(); - if(mcUsers.getProfile(player).getShovelPreparationTicks() <= 0){ - mcUsers.getProfile(player).setShovelPreparationMode(false); - player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**"); - } + if(PP.getShovelPreparationMode() && System.currentTimeMillis() - PP.getShovelPreparationATS() >= 4000){ + PP.setShovelPreparationMode(false); + player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); } /* * AXES ABILITY */ if(mcPermissions.getInstance().axesAbility(player)){ - //Monitor the length of Skull Splitter mode - if(mcUsers.getProfile(player).getSkullSplitterMode()){ - mcUsers.getProfile(player).decreaseSkullSplitterTicks(); - if(mcUsers.getProfile(player).getSkullSplitterTicks() <= 0){ - mcUsers.getProfile(player).setSkullSplitterMode(false); - mcUsers.getProfile(player).setSkullSplitterCooldown(mcLoadProperties.skullSplitterCooldown); - player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); - } - } + if(mcPermissions.getInstance().unarmedAbility(player)){ + if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){ + PP.setSkullSplitterMode(false); + PP.setSkullSplitterInformed(false); + player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); + PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis()); + } + } } /* * WOODCUTTING ABILITY */ - if(mcPermissions.getInstance().woodCuttingAbility(player)){ - if(mcUsers.getProfile(player).getTreeFellerMode()){ - mcUsers.getProfile(player).decreaseTreeFellerTicks(); - if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){ - mcUsers.getProfile(player).setTreeFellerMode(false); - mcUsers.getProfile(player).setTreeFellerCooldown(mcLoadProperties.treeFellerCooldown); + if(mcPermissions.getInstance().woodCuttingAbility(player)){ + if(PP.getTreeFellerMode() && PP.getTreeFellerActivatedTimeStamp() + PP.getTreeFellerTicks() <= System.currentTimeMillis()){ + PP.setTreeFellerMode(false); + PP.setTreeFellerInformed(false); player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**"); - } + PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis()); } } /* * MINING ABILITY */ if(mcPermissions.getInstance().miningAbility(player)){ - if(mcUsers.getProfile(player).getSuperBreakerMode()){ - mcUsers.getProfile(player).decreaseSuperBreakerTicks(); - if(mcUsers.getProfile(player).getSuperBreakerTicks() <= 0){ - mcUsers.getProfile(player).setSuperBreakerMode(false); - mcUsers.getProfile(player).setSuperBreakerCooldown(mcLoadProperties.superBreakerCooldown); + if(PP.getSuperBreakerMode() && PP.getSuperBreakerActivatedTimeStamp() + PP.getSuperBreakerTicks() <= System.currentTimeMillis()){ + PP.setSuperBreakerMode(false); + PP.setSuperBreakerInformed(false); player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**"); - } + PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis()); } } /* * EXCAVATION ABILITY */ if(mcPermissions.getInstance().excavationAbility(player)){ - if(mcUsers.getProfile(player).getGigaDrillBreakerMode()){ - mcUsers.getProfile(player).decreaseGigaDrillBreakerTicks(); - if(mcUsers.getProfile(player).getGigaDrillBreakerTicks() <= 0){ - mcUsers.getProfile(player).setGigaDrillBreakerMode(false); - mcUsers.getProfile(player).setGigaDrillBreakerCooldown(mcLoadProperties.gigaDrillBreakerCooldown); - player.sendMessage(ChatColor.RED+"**You feel spiral energy leaving you**"); - } + if(PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerActivatedTimeStamp() + PP.getGigaDrillBreakerTicks() <= System.currentTimeMillis()){ + PP.setGigaDrillBreakerMode(false); + PP.setGigaDrillBreakerInformed(false); + player.sendMessage(ChatColor.RED+"**Giga Drill Breaker has worn off**"); + PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis()); } } /* * SWORDS ABILITY */ if(mcPermissions.getInstance().swordsAbility(player)){ - if(mcUsers.getProfile(player).getSerratedStrikesMode()){ - mcUsers.getProfile(player).decreaseSerratedStrikesTicks(); - if(mcUsers.getProfile(player).getSerratedStrikesTicks() <= 0){ - mcUsers.getProfile(player).setSerratedStrikesMode(false); - mcUsers.getProfile(player).setSerratedStrikesCooldown(mcLoadProperties.serratedStrikeCooldown); + if(PP.getSerratedStrikesMode() && PP.getSerratedStrikesActivatedTimeStamp() + PP.getSerratedStrikesTicks() <= System.currentTimeMillis()){ + PP.setSerratedStrikesMode(false); + PP.setSerratedStrikesInformed(false); player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**"); - } + PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis()); } } /* * UNARMED ABILITY */ if(mcPermissions.getInstance().unarmedAbility(player)){ - if(mcUsers.getProfile(player).getBerserkMode()){ - mcUsers.getProfile(player).decreaseBerserkTicks(); - if(mcUsers.getProfile(player).getBerserkTicks() <= 0){ - mcUsers.getProfile(player).setBerserkMode(false); - mcUsers.getProfile(player).setBerserkCooldown(mcLoadProperties.berserkCooldown); + if(PP.getBerserkMode() && PP.getBerserkActivatedTimeStamp() + PP.getBerserkTicks() <= System.currentTimeMillis()){ + PP.setBerserkMode(false); + PP.setBerserkInformed(false); player.sendMessage(ChatColor.RED+"**Berserk has worn off**"); - } + PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis()); } } } diff --git a/mcMMO/com/gmail/nossr50/mcTimer.java b/mcMMO/com/gmail/nossr50/mcTimer.java index 35b4ad1d5..bcd76d3e5 100644 --- a/mcMMO/com/gmail/nossr50/mcTimer.java +++ b/mcMMO/com/gmail/nossr50/mcTimer.java @@ -28,7 +28,7 @@ public class mcTimer extends TimerTask{ /* * COOLDOWN MONITORING */ - mcSkills.getInstance().decreaseCooldowns(player); + mcSkills.getInstance().watchCooldowns(player); /* * PLAYER BLEED MONITORING @@ -38,12 +38,11 @@ public class mcTimer extends TimerTask{ mcUsers.getProfile(player).decreaseBleedTicks(); } - if(mcPermissions.getInstance().regeneration(player)){ + if(mcPermissions.getInstance().regeneration(player) && System.currentTimeMillis() >= mcUsers.getProfile(player).getRecentlyHurt() + 60000){ if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel(player) >= 1000 - && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + && mcUsers.getProfile(player).getPowerLevel(player) >= 1000){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } @@ -51,22 +50,17 @@ public class mcTimer extends TimerTask{ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 && mcUsers.getProfile(player).getPowerLevel(player) >= 500 - && mcUsers.getProfile(player).getPowerLevel(player) < 1000 - && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + && mcUsers.getProfile(player).getPowerLevel(player) < 1000){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } if(thecount == 40){ if(player != null && player.getHealth() > 0 && player.getHealth() < 20 - && mcUsers.getProfile(player).getPowerLevel(player) < 500 - && mcUsers.getProfile(player).getRecentlyHurt() == 0){ + && mcUsers.getProfile(player).getPowerLevel(player) < 500){ player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); } } - if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){ - mcUsers.getProfile(player).decreaseLastHurt(); - } } } diff --git a/mcMMO/com/gmail/nossr50/mcUsers.java b/mcMMO/com/gmail/nossr50/mcUsers.java index 05e7b827b..cb3c22068 100644 --- a/mcMMO/com/gmail/nossr50/mcUsers.java +++ b/mcMMO/com/gmail/nossr50/mcUsers.java @@ -157,10 +157,14 @@ 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, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; - private int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0, - serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0, - axePreparationTicks = 0, pickaxePreparationTicks = 0, fistsPreparationTicks = 0, shovelPreparationTicks = 0, swordsPreparationTicks = 0; + private boolean berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; + private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, + treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0, + superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0, + skullSplitterATS = 0, skullSplitterDATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0; + private int berserkTicks = 0, bleedticks = 0, gigaDrillBreakerTicks = 0, superBreakerTicks = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, treeFellerTicks = 0; + //ATS = (Time of) Activation Time Stamp + //DATS = (Time of) Deactivation Time Stamp Player thisplayer; char defaultColor; @@ -430,11 +434,6 @@ class PlayerList abilityuse = false; } } - public void decreaseLastHurt(){ - if(recentlyhurt >= 1){ - recentlyhurt--; - } - } public void decreaseBleedTicks(){ if(bleedticks >= 1){ bleedticks--; @@ -456,6 +455,12 @@ class PlayerList return false; } } + /* + * ARCHERY NERF STUFF + */ + public long getArcheryShotATS() {return archeryShotATS;} + public void setArcheryShotATS(long newvalue) {archeryShotATS = newvalue;} + /* * SWORDS PREPARATION */ @@ -465,16 +470,11 @@ class PlayerList public void setSwordsPreparationMode(Boolean bool){ swordsPreparationMode = bool; } - public Integer getSwordsPreparationTicks(){ - return swordsPreparationTicks; + public long getSwordsPreparationATS(){ + return swordsPreparationATS; } - public void setSwordsPreparationTicks(Integer newvalue){ - swordsPreparationTicks = newvalue; - } - public void decreaseSwordsPreparationTicks(){ - if(swordsPreparationTicks >= 1){ - swordsPreparationTicks--; - } + public void setSwordsPreparationATS(long newvalue){ + swordsPreparationATS = newvalue; } /* * SHOVEL PREPARATION @@ -485,16 +485,11 @@ class PlayerList public void setShovelPreparationMode(Boolean bool){ shovelPreparationMode = bool; } - public Integer getShovelPreparationTicks(){ - return shovelPreparationTicks; + public long getShovelPreparationATS(){ + return shovelPreparationATS; } - public void setShovelPreparationTicks(Integer newvalue){ - shovelPreparationTicks = newvalue; - } - public void decreaseShovelPreparationTicks(){ - if(shovelPreparationTicks >= 1){ - shovelPreparationTicks--; - } + public void setShovelPreparationATS(long newvalue){ + shovelPreparationATS = newvalue; } /* * FISTS PREPARATION @@ -505,16 +500,11 @@ class PlayerList public void setFistsPreparationMode(Boolean bool){ fistsPreparationMode = bool; } - public Integer getFistsPreparationTicks(){ - return fistsPreparationTicks; + public long getFistsPreparationATS(){ + return fistsPreparationATS; } - public void setFistsPreparationTicks(Integer newvalue){ - fistsPreparationTicks = newvalue; - } - public void decreaseFistsPreparationTicks(){ - if(fistsPreparationTicks >= 1){ - fistsPreparationTicks--; - } + public void setFistsPreparationATS(long newvalue){ + fistsPreparationATS = newvalue; } /* * AXE PREPARATION @@ -525,16 +515,11 @@ class PlayerList public void setAxePreparationMode(Boolean bool){ axePreparationMode = bool; } - public Integer getAxePreparationTicks(){ - return axePreparationTicks; + public long getAxePreparationATS(){ + return axePreparationATS; } - public void setAxePreparationTicks(Integer newvalue){ - axePreparationTicks = newvalue; - } - public void decreaseAxePreparationTicks(){ - if(axePreparationTicks >= 1){ - axePreparationTicks--; - } + public void setAxePreparationATS(long newvalue){ + axePreparationATS = newvalue; } /* * PICKAXE PREPARATION @@ -545,209 +530,192 @@ class PlayerList public void setPickaxePreparationMode(Boolean bool){ pickaxePreparationMode = bool; } - public Integer getPickaxePreparationTicks(){ - return pickaxePreparationTicks; + public long getPickaxePreparationATS(){ + return pickaxePreparationATS; } - public void setPickaxePreparationTicks(Integer newvalue){ - pickaxePreparationTicks = newvalue; - } - public void decreasePickaxePreparationTicks(){ - if(pickaxePreparationTicks >= 1){ - pickaxePreparationTicks--; - } + public void setPickaxePreparationATS(long newvalue){ + pickaxePreparationATS = newvalue; } /* * BERSERK MODE */ + public boolean getBerserkInformed() {return berserkInformed;} + public void setBerserkInformed(Boolean bool){ + berserkInformed = bool; + } public boolean getBerserkMode(){ return berserkMode; } public void setBerserkMode(Boolean bool){ berserkMode = bool; } - public Integer getBerserkTicks(){ - return berserkTicks; + public long getBerserkActivatedTimeStamp() {return berserkATS;} + public void setBerserkActivatedTimeStamp(Long newvalue){ + berserkATS = newvalue; } - public void setBerserkTicks(Integer newvalue){ - berserkTicks = newvalue; + public long getBerserkDeactivatedTimeStamp() {return berserkDATS;} + public void setBerserkDeactivatedTimeStamp(Long newvalue){ + berserkDATS = newvalue; } - public void decreaseBerserkTicks(){ - if(berserkTicks >= 1){ - berserkTicks--; - } - } - public void setBerserkCooldown(Integer newvalue){ + public void setBerserkCooldown(Long newvalue){ berserkCooldown = newvalue; } - public int getBerserkCooldown(){ + public long getBerserkCooldown(){ return berserkCooldown; } - public void decreaseBerserkCooldown(){ - if(berserkCooldown >= 1){ - berserkCooldown--; - } - } + public void setBerserkTicks(Integer newvalue){berserkTicks = newvalue;} + public int getBerserkTicks(){return berserkTicks;} /* * SKULL SPLITTER */ + public boolean getSkullSplitterInformed() {return skullSplitterInformed;} + public void setSkullSplitterInformed(Boolean bool){ + skullSplitterInformed = bool; + } public boolean getSkullSplitterMode(){ return skullSplitterMode; } public void setSkullSplitterMode(Boolean bool){ skullSplitterMode = bool; } - public Integer getSkullSplitterTicks(){ - return skullSplitterTicks; + public long getSkullSplitterActivatedTimeStamp() {return skullSplitterATS;} + public void setSkullSplitterActivatedTimeStamp(Long newvalue){ + skullSplitterATS = newvalue; } - public void setSkullSplitterTicks(Integer newvalue){ - skullSplitterTicks = newvalue; + public long getSkullSplitterDeactivatedTimeStamp() {return skullSplitterDATS;} + public void setSkullSplitterDeactivatedTimeStamp(Long newvalue){ + skullSplitterDATS = newvalue; } - public void decreaseSkullSplitterTicks(){ - if(skullSplitterTicks >= 1){ - skullSplitterTicks--; - } - } - public void setSkullSplitterCooldown(Integer newvalue){ + public void setSkullSplitterCooldown(Long newvalue){ skullSplitterCooldown = newvalue; } - public int getSkullSplitterCooldown(){ + public long getSkullSplitterCooldown(){ return skullSplitterCooldown; } - public void decreaseSkullSplitterCooldown(){ - if(skullSplitterCooldown >= 1){ - skullSplitterCooldown--; - } - } + public void setSkullSplitterTicks(Integer newvalue){skullSplitterTicks = newvalue;} + public int getSkullSplitterTicks(){return skullSplitterTicks;} /* * SERRATED STRIKES */ + public boolean getSerratedStrikesInformed() {return serratedStrikesInformed;} + public void setSerratedStrikesInformed(Boolean bool){ + serratedStrikesInformed = bool; + } public boolean getSerratedStrikesMode(){ return serratedStrikesMode; } public void setSerratedStrikesMode(Boolean bool){ serratedStrikesMode = bool; } - public Integer getSerratedStrikesTicks(){ - return serratedStrikesTicks; + public long getSerratedStrikesActivatedTimeStamp() {return serratedStrikesATS;} + public void setSerratedStrikesActivatedTimeStamp(Long newvalue){ + serratedStrikesATS = newvalue; } - public void setSerratedStrikesTicks(Integer newvalue){ - serratedStrikesTicks = newvalue; + public long getSerratedStrikesDeactivatedTimeStamp() {return serratedStrikesDATS;} + public void setSerratedStrikesDeactivatedTimeStamp(Long newvalue){ + serratedStrikesDATS = newvalue; } - public void decreaseSerratedStrikesTicks(){ - if(serratedStrikesTicks >= 1){ - serratedStrikesTicks--; - } - } - public void setSerratedStrikesCooldown(Integer newvalue){ + public void setSerratedStrikesCooldown(Long newvalue){ serratedStrikesCooldown = newvalue; } - public int getSerratedStrikesCooldown(){ + public long getSerratedStrikesCooldown(){ return serratedStrikesCooldown; } - public void decreaseSerratedStrikesCooldown(){ - if(serratedStrikesCooldown >= 1){ - serratedStrikesCooldown--; - } - } + public void setSerratedStrikesTicks(Integer newvalue){serratedStrikesTicks = newvalue;} + public int getSerratedStrikesTicks(){return serratedStrikesTicks;} /* * GIGA DRILL BREAKER */ + public boolean getGigaDrillBreakerInformed() {return gigaDrillBreakerInformed;} + public void setGigaDrillBreakerInformed(Boolean bool){ + gigaDrillBreakerInformed = bool; + } public boolean getGigaDrillBreakerMode(){ return gigaDrillBreakerMode; } public void setGigaDrillBreakerMode(Boolean bool){ gigaDrillBreakerMode = bool; } - public Integer getGigaDrillBreakerTicks(){ - return gigaDrillBreakerTicks; + public long getGigaDrillBreakerActivatedTimeStamp() {return gigaDrillBreakerATS;} + public void setGigaDrillBreakerActivatedTimeStamp(Long newvalue){ + gigaDrillBreakerATS = newvalue; } - public void setGigaDrillBreakerTicks(Integer newvalue){ - gigaDrillBreakerTicks = newvalue; + public long getGigaDrillBreakerDeactivatedTimeStamp() {return gigaDrillBreakerDATS;} + public void setGigaDrillBreakerDeactivatedTimeStamp(Long newvalue){ + gigaDrillBreakerDATS = newvalue; } - public void decreaseGigaDrillBreakerTicks(){ - if(gigaDrillBreakerTicks >= 1){ - gigaDrillBreakerTicks--; - } - } - public void setGigaDrillBreakerCooldown(Integer newvalue){ + public void setGigaDrillBreakerCooldown(Long newvalue){ gigaDrillBreakerCooldown = newvalue; } - public int getGigaDrillBreakerCooldown(){ + public long getGigaDrillBreakerCooldown(){ return gigaDrillBreakerCooldown; } - public void decreaseGigaDrillBreakerCooldown(){ - if(gigaDrillBreakerCooldown >= 1){ - gigaDrillBreakerCooldown--; - } - } + public void setGigaDrillBreakerTicks(Integer newvalue){gigaDrillBreakerTicks = newvalue;} + public int getGigaDrillBreakerTicks(){return gigaDrillBreakerTicks;} /* * TREE FELLER STUFF */ + public boolean getTreeFellerInformed() {return treeFellerInformed;} + public void setTreeFellerInformed(Boolean bool){ + treeFellerInformed = bool; + } public boolean getTreeFellerMode(){ return treeFellerMode; } public void setTreeFellerMode(Boolean bool){ treeFellerMode = bool; } - public Integer getTreeFellerTicks(){ - return treeFellerTicks; + public long getTreeFellerActivatedTimeStamp() {return treeFellerATS;} + public void setTreeFellerActivatedTimeStamp(Long newvalue){ + treeFellerATS = newvalue; } - public void setTreeFellerTicks(Integer newvalue){ - treeFellerTicks = newvalue; + public long getTreeFellerDeactivatedTimeStamp() {return treeFellerDATS;} + public void setTreeFellerDeactivatedTimeStamp(Long newvalue){ + treeFellerDATS = newvalue; } - public void decreaseTreeFellerTicks(){ - if(treeFellerTicks >= 1){ - treeFellerTicks--; - } - } - public void setTreeFellerCooldown(Integer newvalue){ + public void setTreeFellerCooldown(Long newvalue){ treeFellerCooldown = newvalue; } - public int getTreeFellerCooldown(){ + public long getTreeFellerCooldown(){ return treeFellerCooldown; } - public void decreaseTreeFellerCooldown(){ - if(treeFellerCooldown >= 1){ - treeFellerCooldown--; - } - } + public void setTreeFellerTicks(Integer newvalue){treeFellerTicks = newvalue;} + public int getTreeFellerTicks(){return treeFellerTicks;} /* * MINING */ + public boolean getSuperBreakerInformed() {return superBreakerInformed;} + public void setSuperBreakerInformed(Boolean bool){ + superBreakerInformed = bool; + } public boolean getSuperBreakerMode(){ return superBreakerMode; } public void setSuperBreakerMode(Boolean bool){ superBreakerMode = bool; } - public Integer getSuperBreakerTicks(){ - return superBreakerTicks; + public long getSuperBreakerActivatedTimeStamp() {return superBreakerATS;} + public void setSuperBreakerActivatedTimeStamp(Long newvalue){ + superBreakerATS = newvalue; } - public void setSuperBreakerTicks(Integer newvalue){ - superBreakerTicks = newvalue; + public long getSuperBreakerDeactivatedTimeStamp() {return superBreakerDATS;} + public void setSuperBreakerDeactivatedTimeStamp(Long newvalue){ + superBreakerDATS = newvalue; } - public void decreaseSuperBreakerTicks(){ - if(superBreakerTicks >= 1){ - superBreakerTicks--; - } - } - public void setSuperBreakerCooldown(Integer newvalue){ + public void setSuperBreakerCooldown(Long newvalue){ superBreakerCooldown = newvalue; } - public int getSuperBreakerCooldown(){ + public long getSuperBreakerCooldown(){ return superBreakerCooldown; } - public void decreaseSuperBreakerCooldown(){ - if(superBreakerCooldown >= 1){ - superBreakerCooldown--; - } - } + public void setSuperBreakerTicks(Integer newvalue){superBreakerTicks = newvalue;} + public int getSuperBreakerTicks(){return superBreakerTicks;} - public Integer getRecentlyHurt(){ - return recentlyhurt; + public long getRecentlyHurt(){ + return recentlyHurt; } - public void setRecentlyHurt(Integer newvalue){ - recentlyhurt = newvalue; + public void setRecentlyHurt(long newvalue){ + recentlyHurt = newvalue; } public void skillUpAxes(int newskill){ int x = 0; diff --git a/mcMMO/com/gmail/nossr50/mcWoodCutting.java b/mcMMO/com/gmail/nossr50/mcWoodCutting.java index 553142021..33e122141 100644 --- a/mcMMO/com/gmail/nossr50/mcWoodCutting.java +++ b/mcMMO/com/gmail/nossr50/mcWoodCutting.java @@ -9,6 +9,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.PlayerList.PlayerProfile; + public class mcWoodCutting { int w = 0; @@ -35,6 +37,7 @@ public class mcWoodCutting { } } public void treeFellerCheck(Player player, Block block){ + PlayerProfile PP = mcUsers.getProfile(player); if(mcm.getInstance().isAxes(player.getItemInHand())){ if(block != null){ if(!mcm.getInstance().abilityBlockCheck(block)) @@ -43,36 +46,36 @@ public class mcWoodCutting { /* * CHECK FOR AXE PREP MODE */ - if(mcUsers.getProfile(player).getAxePreparationMode()){ - mcUsers.getProfile(player).setAxePreparationMode(false); - mcUsers.getProfile(player).setAxePreparationTicks(0); + if(PP.getAxePreparationMode()){ + PP.setAxePreparationMode(false); } int ticks = 2; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50) + if(PP.getWoodCuttingInt() >= 50) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150) + if(PP.getWoodCuttingInt() >= 150) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250) + if(PP.getWoodCuttingInt() >= 250) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350) + if(PP.getWoodCuttingInt() >= 350) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450) + if(PP.getWoodCuttingInt() >= 450) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550) + if(PP.getWoodCuttingInt() >= 550) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650) + if(PP.getWoodCuttingInt() >= 650) ticks++; - if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750) + if(PP.getWoodCuttingInt() >= 750) ticks++; - if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ + if(!PP.getTreeFellerMode() && PP.getTreeFellerCooldown() == 0){ player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); - mcUsers.getProfile(player).setTreeFellerTicks(ticks * 2); - mcUsers.getProfile(player).setTreeFellerMode(true); + PP.setTreeFellerTicks(ticks * 1000); + PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis()); + PP.setTreeFellerMode(true); } - if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){ + if(!PP.getTreeFellerMode() && !mcSkills.getInstance().cooldownOver(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)){ player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." - +ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getTreeFellerCooldown()+"s)"); + +ChatColor.YELLOW+" ("+mcSkills.getInstance().calculateTimeLeft(player, PP.getTreeFellerDeactivatedTimeStamp(), mcLoadProperties.treeFellerCooldown)+"s)"); } } } diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index c279ed3a0..2ac8afca2 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -30,6 +30,7 @@ public class mcm { return instance; } + public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){ FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); @@ -53,7 +54,7 @@ public class mcm { if(player.getItemInHand().getDurability() >= getMaxDurability(mcm.getInstance().getTier(player), player.getItemInHand())){ ItemStack[] inventory = player.getInventory().getContents(); for(ItemStack x : inventory){ - if(x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){ + if(x != null && x.getTypeId() == player.getItemInHand().getTypeId() && x.getDurability() == player.getItemInHand().getDurability()){ x.setTypeId(0); x.setAmount(0); player.getInventory().setContents(inventory); @@ -62,6 +63,25 @@ public class mcm { } } } + public boolean hasArrows(Player player){ + for(ItemStack x : player.getInventory().getContents()){ + if(x.getTypeId() == 262) + return true; + } + return false; + } + public void addArrows(Player player){ + ItemStack[] inventory = player.getInventory().getContents(); + for(ItemStack x : inventory){ + if(x != null && x.getTypeId() == 262){ + if(x.getAmount() >= 1 && x.getAmount() < 64){ + x.setAmount(x.getAmount() + 1); + player.getInventory().setContents(inventory); + } + return; + } + } + } public Integer getTier(Player player){ int i = player.getItemInHand().getTypeId(); if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){ @@ -103,7 +123,7 @@ public class mcm { } public boolean abilityBlockCheck(Block block){ int i = block.getTypeId(); - if(i == 68 || i == 355 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){ + if(i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){ return false; } else { return true; @@ -219,6 +239,14 @@ public class mcm { return false; } } + public boolean isHoe(ItemStack is){ + int id = is.getTypeId(); + if(id == 290 || id == 291 || id == 292 || id == 293 || id == 294){ + return true; + } else { + return false; + } + } public boolean isShovel(ItemStack is){ if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){ return true; @@ -240,6 +268,14 @@ public class mcm { return false; } } + public boolean isGold(ItemStack is){ + int i = is.getTypeId(); + if(i == 283 || i == 284 || i == 285 || i == 286 || i == 294 || i == 314 || i == 315 || i == 316 || i == 317){ + return true; + } else { + return false; + } + } public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){ if(split[0].equalsIgnoreCase("/woodcutting")){ event.setCancelled(true); @@ -426,6 +462,7 @@ public class mcm { String dodgepercentage; float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt(); String percentage = String.valueOf((skillvalue / 1000) * 100); + String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){ dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); } else { @@ -434,10 +471,12 @@ public class mcm { player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ACROBATICS"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Falling"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); - player.sendMessage(ChatColor.DARK_AQUA+"Roll: "+ChatColor.GREEN+"Negates Damage"); + player.sendMessage(ChatColor.DARK_AQUA+"Roll: "+ChatColor.GREEN+"Reduces or Negates damage"); + player.sendMessage(ChatColor.DARK_AQUA+"Graceful Roll: "+ChatColor.GREEN+"Twice as effective as Roll"); player.sendMessage(ChatColor.DARK_AQUA+"Dodge: "+ChatColor.GREEN+"Reduce damage by half"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"Roll Chance: "+ChatColor.YELLOW+percentage+"%"); + player.sendMessage(ChatColor.RED+"Graceful Roll Chance: "+ChatColor.YELLOW+gracepercentage+"%"); player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%"); } if(split[0].equalsIgnoreCase("/mining")){ @@ -539,6 +578,7 @@ public class mcm { player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)"); } else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){ player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade"); + player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)"); } else { player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"Large Damage Upgrade"); } @@ -643,8 +683,6 @@ public class mcm { player.sendMessage(ChatColor.GREEN+"--MYSPAWN COMMANDS--"); player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn"); player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your MySpawn"); - if(mcPermissions.getInstance().setMySpawn(player)) - player.sendMessage("/"+mcLoadProperties.setmyspawn+" "+ChatColor.RED+"- Set your MySpawn"); } player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--"); if(mcPermissions.getInstance().mcAbility(player)) diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 7039a5a3e..8c42e2a99 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.9.16 \ No newline at end of file +version: 0.9.18 \ No newline at end of file