0.9.18 - This patch is now Diamonds

This commit is contained in:
nossr50 2011-04-10 02:38:54 -07:00
parent 04b233c861
commit 5ceb50d8c5
18 changed files with 619 additions and 484 deletions

View File

@ -1,5 +1,30 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code# #Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
Version 0.9.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 Version 0.9.16
Logs placed by the player won't grant XP/Double Drops anymore Logs placed by the player won't grant XP/Double Drops anymore
Added more functions plugin authors can call Added more functions plugin authors can call

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50; package com.gmail.nossr50;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -14,14 +15,27 @@ public class mcAcrobatics {
return instance; return instance;
} }
public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){ public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
if(player != null && mcPermissions.getInstance().acrobatics(player)&& event.getDamage() < 21){ if(player != null && mcPermissions.getInstance().acrobatics(player)){
if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){ int acrovar = mcUsers.getProfile(player).getAcrobaticsInt();
player.sendMessage("**ROLLED**"); if(player.isSneaking())
if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))){ 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()) if(!event.isCancelled())
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier); mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 8) * mcLoadProperties.xpGainMultiplier);
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
event.setDamage(newDamage);
if(event.getDamage() <= 0)
event.setCancelled(true); 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()){ } else if (!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z)) && !event.isCancelled()){
mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier); mcUsers.getProfile(player).addAcrobaticsGather((event.getDamage() * 12) * mcLoadProperties.xpGainMultiplier);

View File

@ -12,6 +12,8 @@ import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcBlockListener extends BlockListener { public class mcBlockListener extends BlockListener {
private final mcMMO plugin; private final mcMMO plugin;
@ -29,20 +31,25 @@ public class mcBlockListener extends BlockListener {
else { else {
block = event.getBlock(); block = event.getBlock();
} }
if(player != null && mcm.getInstance().shouldBeWatched(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); mcConfig.getInstance().addBlockWatch(block);
}
if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages) if(block.getTypeId() == 42 && mcLoadProperties.anvilmessages)
event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor."); event.getPlayer().sendMessage(ChatColor.DARK_RED+"You have placed an anvil, anvils can repair tools and armor.");
} }
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player);
Block block = event.getBlock(); Block block = event.getBlock();
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
if(event.isCancelled())
if (event instanceof FakeBlockBreakEvent) { return;
if (event instanceof FakeBlockBreakEvent)
return; return;
}
/* /*
* MINING * MINING
@ -64,13 +71,13 @@ public class mcBlockListener extends BlockListener {
if(mcm.getInstance().isAxes(inhand)){ if(mcm.getInstance().isAxes(inhand)){
if(!mcConfig.getInstance().isBlockWatched(block)){ if(!mcConfig.getInstance().isBlockWatched(block)){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); mcWoodCutting.getInstance().woodCuttingProcCheck(player, block);
mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier);
} }
} }
} else { } else {
if(!mcConfig.getInstance().isBlockWatched(block)){ if(block.getData() != 5){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, block); mcWoodCutting.getInstance().woodCuttingProcCheck(player, block);
mcUsers.getProfile(player).addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier); PP.addWoodcuttingGather(7 * mcLoadProperties.xpGainMultiplier);
} }
} }
mcSkills.getInstance().XpCheck(player); mcSkills.getInstance().XpCheck(player);
@ -79,9 +86,14 @@ public class mcBlockListener extends BlockListener {
* IF PLAYER IS USING TREEFELLER * IF PLAYER IS USING TREEFELLER
*/ */
if(mcPermissions.getInstance().woodCuttingAbility(player) if(mcPermissions.getInstance().woodCuttingAbility(player)
&& mcUsers.getProfile(player).getTreeFellerMode() && PP.getTreeFellerMode()
&& block.getTypeId() == 17 && block.getTypeId() == 17
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){ && mcm.getInstance().blockBreakSimulate(block, player, plugin)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
mcWoodCutting.getInstance().treeFeller(block, player); mcWoodCutting.getInstance().treeFeller(block, player);
for(Block blockx : mcConfig.getInstance().getTreeFeller()){ for(Block blockx : mcConfig.getInstance().getTreeFeller()){
if(blockx != null){ if(blockx != null){
@ -95,7 +107,7 @@ public class mcBlockListener extends BlockListener {
//XP WOODCUTTING //XP WOODCUTTING
if(!mcConfig.getInstance().isBlockWatched(block)){ if(!mcConfig.getInstance().isBlockWatched(block)){
mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx); mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx);
mcUsers.getProfile(player).addWoodcuttingGather(7); PP.addWoodcuttingGather(7);
} }
} }
if(blockx.getTypeId() == 18){ if(blockx.getTypeId() == 18){
@ -109,11 +121,6 @@ public class mcBlockListener extends BlockListener {
} }
if(mcLoadProperties.toolsLoseDurabilityFromAbilities) if(mcLoadProperties.toolsLoseDurabilityFromAbilities)
mcm.getInstance().damageTool(player, (short) mcLoadProperties.abilityDurabilityLoss); 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(); mcConfig.getInstance().clearTreeFeller();
} }
} }
@ -127,32 +134,40 @@ public class mcBlockListener extends BlockListener {
*/ */
if(mcPermissions.getInstance().herbalism(player)) if(mcPermissions.getInstance().herbalism(player))
mcHerbalism.getInstance().herbalismProcCheck(block, 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) { public void onBlockDamage(BlockDamageEvent event) {
if(event.isCancelled()) if(event.isCancelled())
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = mcUsers.getProfile(player);
ItemStack inhand = player.getItemInHand(); ItemStack inhand = player.getItemInHand();
Block block = event.getBlock(); Block block = event.getBlock();
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS
*/ */
if(mcUsers.getProfile(player).getAxePreparationMode() && block.getTypeId() == 17) if(PP.getAxePreparationMode() && block.getTypeId() == 17)
mcWoodCutting.getInstance().treeFellerCheck(player, block); mcWoodCutting.getInstance().treeFellerCheck(player, block);
if(mcUsers.getProfile(player).getPickaxePreparationMode()) if(PP.getPickaxePreparationMode())
mcMining.getInstance().superBreakerCheck(player, block); 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); 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); mcSkills.getInstance().berserkActivationCheck(player);
/* /*
* GIGA DRILL BREAKER CHECKS * GIGA DRILL BREAKER CHECKS
*/ */
if(mcUsers.getProfile(player).getGigaDrillBreakerMode() if(PP.getGigaDrillBreakerMode()
&& mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcm.getInstance().blockBreakSimulate(block, player, plugin)
&& mcExcavation.getInstance().canBeGigaDrillBroken(block) && mcExcavation.getInstance().canBeGigaDrillBroken(block)
&& mcm.getInstance().isShovel(inhand)){ && mcm.getInstance().isShovel(inhand)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
if(mcm.getInstance().getTier(player) >= 2) if(mcm.getInstance().getTier(player) >= 2)
mcExcavation.getInstance().excavationProcCheck(block, player); mcExcavation.getInstance().excavationProcCheck(block, player);
if(mcm.getInstance().getTier(player) >= 3) if(mcm.getInstance().getTier(player) >= 3)
@ -172,10 +187,14 @@ public class mcBlockListener extends BlockListener {
/* /*
* BERSERK MODE CHECKS * BERSERK MODE CHECKS
*/ */
if(mcUsers.getProfile(player).getBerserkMode() if(PP.getBerserkMode()
&& mcm.getInstance().blockBreakSimulate(block, player, plugin) && mcm.getInstance().blockBreakSimulate(block, player, plugin)
&& player.getItemInHand().getTypeId() == 0 && player.getItemInHand().getTypeId() == 0
&& mcExcavation.getInstance().canBeGigaDrillBroken(block)){ && mcExcavation.getInstance().canBeGigaDrillBroken(block)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
if(block.getTypeId() == 2) if(block.getTypeId() == 2)
mat = Material.DIRT; mat = Material.DIRT;
@ -188,9 +207,14 @@ public class mcBlockListener extends BlockListener {
/* /*
* SUPER BREAKER CHECKS * SUPER BREAKER CHECKS
*/ */
if(mcUsers.getProfile(player).getSuperBreakerMode() if(PP.getSuperBreakerMode()
&& mcMining.getInstance().canBeSuperBroken(block) && mcMining.getInstance().canBeSuperBroken(block)
&& mcm.getInstance().blockBreakSimulate(block, player, plugin)){ && mcm.getInstance().blockBreakSimulate(block, player, plugin)){
/*
* Check if the Timer is doing its job
*/
mcSkills.getInstance().monitorSkills(player);
if(mcLoadProperties.miningrequirespickaxe){ if(mcLoadProperties.miningrequirespickaxe){
if(mcm.getInstance().isMiningPick(inhand)) if(mcm.getInstance().isMiningPick(inhand))
mcMining.getInstance().SuperBreakerBlockCheck(player, block); mcMining.getInstance().SuperBreakerBlockCheck(player, block);

View File

@ -59,13 +59,12 @@ public class mcCombat {
if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
//Bonus just for having unarmed //Bonus just for having unarmed
if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ int bonus = 2;
event.setDamage(calculateDamage(event, 2)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250)
} else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ bonus++;
event.setDamage(calculateDamage(event, 3)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500)
} else { bonus++;
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, bonus));
}
//PROC //PROC
if(simulateUnarmedProc(attacker)){ if(simulateUnarmedProc(attacker)){
@ -130,13 +129,12 @@ public class mcCombat {
return; return;
//Bonus just for having unarmed //Bonus just for having unarmed
if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ int bonus = 2;
event.setDamage(calculateDamage(event, 2)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250)
} else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ bonus++;
event.setDamage(calculateDamage(event, 3)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500)
} else { bonus++;
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, bonus));
}
//XP //XP
if(defender.getHealth() != 0){ if(defender.getHealth() != 0){
@ -161,13 +159,12 @@ public class mcCombat {
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
//Bonus just for having unarmed //Bonus just for having unarmed
if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ int bonus = 2;
event.setDamage(calculateDamage(event, 2)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250)
} else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ bonus++;
event.setDamage(calculateDamage(event, 3)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500)
} else { bonus++;
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, bonus));
}
} }
} }
} }
@ -228,13 +225,12 @@ public class mcCombat {
return; return;
//Bonus just for having unarmed //Bonus just for having unarmed
if(mcUsers.getProfile(attacker).getUnarmedInt() < 250){ int bonus = 2;
event.setDamage(calculateDamage(event, 2)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 250)
} else if (mcUsers.getProfile(attacker).getUnarmedInt() < 500 && mcUsers.getProfile(attacker).getUnarmedInt() >= 250){ bonus++;
event.setDamage(calculateDamage(event, 3)); if (mcUsers.getProfile(attacker).getUnarmedInt() >= 500)
} else { bonus++;
event.setDamage(calculateDamage(event, 4)); event.setDamage(calculateDamage(event, bonus));
}
//XP //XP
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
@ -42,6 +43,8 @@ public class mcEntityListener extends EntityListener {
} }
} }
public void onEntityDamage(EntityDamageEvent event) { public void onEntityDamage(EntityDamageEvent event) {
if(event.isCancelled())
return;
/* /*
* CHECK FOR INVULNERABILITY * CHECK FOR INVULNERABILITY
*/ */
@ -145,11 +148,21 @@ public class mcEntityListener extends EntityListener {
* This will do AOE damage from the axes ability * This will do AOE damage from the axes ability
*/ */
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode() && mcm.getInstance().isAxes(attacker.getItemInHand())) if(!event.isCancelled() && 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); mcCombat.getInstance().applyAoeDamage(attacker, eventb, x);
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSerratedStrikesMode() && mcm.getInstance().isSwords(attacker.getItemInHand())) }
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); mcCombat.getInstance().applySerratedStrikes(attacker, eventb, x);
} }
}
/* /*
* DODGE / COUNTERATTACK CHECKS * DODGE / COUNTERATTACK CHECKS
*/ */
@ -196,16 +209,22 @@ public class mcEntityListener extends EntityListener {
if(mcPermissions.getInstance().acrobatics(defender)){ if(mcPermissions.getInstance().acrobatics(defender)){
if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){ if(mcUsers.getProfile(defender).getAcrobaticsInt() <= 800){
if(Math.random() * 4000 <= mcUsers.getProfile(defender).getAcrobaticsInt()){ 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); mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender); mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2); event.setDamage(event.getDamage() / 2);
//Needs to do minimal damage
if(event.getDamage() <= 0)
event.setDamage(1);
} }
} else if(Math.random() * 4000 <= 800) { } 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); mcUsers.getProfile(defender).addAcrobaticsGather(event.getDamage() * 12);
mcSkills.getInstance().XpCheck(defender); mcSkills.getInstance().XpCheck(defender);
event.setDamage(event.getDamage() / 2); event.setDamage(event.getDamage() / 2);
//Needs to do minimal damage
if(event.getDamage() <= 0)
event.setDamage(1);
} }
} }
} }
@ -216,7 +235,7 @@ public class mcEntityListener extends EntityListener {
*/ */
if(x instanceof Player && !event.isCancelled()){ if(x instanceof Player && !event.isCancelled()){
Player herpderp = (Player)x; Player herpderp = (Player)x;
mcUsers.getProfile(herpderp).setRecentlyHurt(30); mcUsers.getProfile(herpderp).setRecentlyHurt(System.currentTimeMillis());
} }
} }
} }

View File

@ -28,7 +28,6 @@ public class mcExcavation {
} }
if(mcUsers.getProfile(player).getShovelPreparationMode()){ if(mcUsers.getProfile(player).getShovelPreparationMode()){
mcUsers.getProfile(player).setShovelPreparationMode(false); mcUsers.getProfile(player).setShovelPreparationMode(false);
mcUsers.getProfile(player).setShovelPreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getExcavationInt() >= 50) if(mcUsers.getProfile(player).getExcavationInt() >= 50)
@ -50,7 +49,8 @@ public class mcExcavation {
if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){ if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**GIGA DRILL BREAKER ACTIVATED**"); 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); mcUsers.getProfile(player).setGigaDrillBreakerMode(true);
} }
@ -69,7 +69,7 @@ public class mcExcavation {
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = null; ItemStack is = null;
Material mat = null; Material mat = null;
if(mcConfig.getInstance().isBlockWatched(block)){ if(block.getData() == 5){
return; return;
} }
if(type == 2){ if(type == 2){

View File

@ -34,7 +34,7 @@ public class mcItem {
int y = derp.getY(); int y = derp.getY();
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 288){ if(x != null && x.getTypeId() == 288){
if(x.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing + 1){ if(x.getAmount() >= mcLoadProperties.feathersConsumedByChimaeraWing + 1){
x.setAmount(x.getAmount() - mcLoadProperties.feathersConsumedByChimaeraWing); x.setAmount(x.getAmount() - mcLoadProperties.feathersConsumedByChimaeraWing);
player.getInventory().setContents(inventory); player.getInventory().setContents(inventory);

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50; package com.gmail.nossr50;
public class mcLoadProperties { 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 String addxp, mcability, mcmmo, mcc, mcrefresh, mcitem, mcgod, stats, mmoedit, ptp, party, myspawn, setmyspawn, whois, invite, accept, clearmyspawn;
public static int xpGainMultiplier, superBreakerCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, feathersConsumedByChimaeraWing, pvpxprewardmodifier, repairdiamondlevel, globalxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; public static int xpGainMultiplier, superBreakerCooldown, 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 * OTHER
*/ */
archeryFireRateLimit = properties.getBoolean("archeryFireRateLimit", true);
myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true); myspawnclearsinventory = properties.getBoolean("mySpawnClearsInventory", true);
xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1); xpGainMultiplier = properties.getInteger("xpGainMultiplier", 1);
toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true); toolsLoseDurabilityFromAbilities = properties.getBoolean("toolsLoseDurabilityFromAbilities", true);

View File

@ -4,9 +4,13 @@ import com.nijikokun.bukkit.Permissions.Permissions;
import com.nijiko.Messaging; import com.nijiko.Messaging;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Timer; import java.util.Timer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -63,6 +67,7 @@ public class mcMMO extends JavaPlugin {
mcUsers.addUser(player); mcUsers.addUser(player);
} }
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_BED_ENTER, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this); pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this);
@ -116,6 +121,37 @@ public class mcMMO extends JavaPlugin {
public void modifySkill(Player player, String skillname, Integer newvalue){ public void modifySkill(Player player, String skillname, Integer newvalue){
mcUsers.getProfile(player).modifyskill(newvalue, skillname); mcUsers.getProfile(player).modifyskill(newvalue, skillname);
} }
public ArrayList<String> getParties(){
String location = "plugins/mcMMO/mcmmo.users";
ArrayList<String> parties = new ArrayList<String>();
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){ public boolean isAdminChatToggled(Player player){
if(mcConfig.getInstance().isAdminToggled(player.getName())){ if(mcConfig.getInstance().isAdminToggled(player.getName())){
return true; return true;

View File

@ -20,6 +20,7 @@ public class mcMining {
} }
return instance; return instance;
} }
public void superBreakerCheck(Player player, Block block){ public void superBreakerCheck(Player player, Block block){
if(mcm.getInstance().isMiningPick(player.getItemInHand())){ if(mcm.getInstance().isMiningPick(player.getItemInHand())){
if(block != null){ if(block != null){
@ -28,7 +29,6 @@ public class mcMining {
} }
if(mcUsers.getProfile(player).getPickaxePreparationMode()){ if(mcUsers.getProfile(player).getPickaxePreparationMode()){
mcUsers.getProfile(player).setPickaxePreparationMode(false); mcUsers.getProfile(player).setPickaxePreparationMode(false);
mcUsers.getProfile(player).setPickaxePreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getMiningInt() >= 50) if(mcUsers.getProfile(player).getMiningInt() >= 50)
@ -50,7 +50,8 @@ public class mcMining {
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){ if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SUPER BREAKER ACTIVATED**");
mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 2); mcUsers.getProfile(player).setSuperBreakerTicks(ticks * 1000);
mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp(System.currentTimeMillis());
mcUsers.getProfile(player).setSuperBreakerMode(true); mcUsers.getProfile(player).setSuperBreakerMode(true);
} }

View File

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
@ -72,6 +73,19 @@ public class mcPlayerListener extends PlayerListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
Action action = event.getAction(); Action action = event.getAction();
Block block = event.getClickedBlock(); 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 * Ability checks
*/ */
@ -103,6 +117,14 @@ public class mcPlayerListener extends PlayerListener {
mcItem.getInstance().itemChecks(player); 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) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
String[] split = event.getMessage().split(" "); String[] split = event.getMessage().split(" ");
@ -130,40 +152,37 @@ public class mcPlayerListener extends PlayerListener {
player = getPlayer(split[1]); player = getPlayer(split[1]);
} }
/* /*
* AXE PREPARATION MODE * PREP MODES
*/ */
mcUsers.getProfile(player).setAxePreparationMode(false); 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 * GIGA DRILL BREAKER
*/ */
mcUsers.getProfile(player).setGigaDrillBreakerCooldown(0);
mcUsers.getProfile(player).setGigaDrillBreakerMode(false); mcUsers.getProfile(player).setGigaDrillBreakerMode(false);
mcUsers.getProfile(player).setGigaDrillBreakerTicks(0); mcUsers.getProfile(player).setGigaDrillBreakerActivatedTimeStamp((long) 0);
/* /*
* SERRATED STRIKE * SERRATED STRIKE
*/ */
mcUsers.getProfile(player).setSerratedStrikesCooldown(0);
mcUsers.getProfile(player).setSerratedStrikesMode(false); mcUsers.getProfile(player).setSerratedStrikesMode(false);
mcUsers.getProfile(player).setSerratedStrikesTicks(0); mcUsers.getProfile(player).setSerratedStrikesActivatedTimeStamp((long) 0);
/* /*
* SUPER BREAKER * SUPER BREAKER
*/ */
mcUsers.getProfile(player).setSuperBreakerCooldown(0);
mcUsers.getProfile(player).setSuperBreakerMode(false); mcUsers.getProfile(player).setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerTicks(0); mcUsers.getProfile(player).setSuperBreakerActivatedTimeStamp((long) 0);
/* /*
* TREE FELLER * TREE FELLER
*/ */
mcUsers.getProfile(player).setTreeFellerCooldown(0);
mcUsers.getProfile(player).setTreeFellerMode(false); mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerTicks(0); mcUsers.getProfile(player).setTreeFellerActivatedTimeStamp((long) 0);
/* /*
* BERSERK * BERSERK
*/ */
mcUsers.getProfile(player).setBerserkCooldown(0);
mcUsers.getProfile(player).setBerserkMode(false); mcUsers.getProfile(player).setBerserkMode(false);
mcUsers.getProfile(player).setBerserkTicks(0); mcUsers.getProfile(player).setBerserkActivatedTimeStamp((long)0);
player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**"); player.sendMessage(ChatColor.GREEN+"**ABILITIES REFRESHED!**");
} }
@ -358,26 +377,6 @@ public class mcPlayerListener extends PlayerListener {
player.sendMessage("Z: "+z); 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 * STATS COMMAND
*/ */
@ -569,7 +568,7 @@ public class mcPlayerListener extends PlayerListener {
mySpawn.setWorld(plugin.getServer().getWorlds().get(0)); mySpawn.setWorld(plugin.getServer().getWorlds().get(0));
} }
//player.sendMessage("mcMMO DEBUG CODE 3"); //player.sendMessage("mcMMO DEBUG CODE 3");
player.teleportTo(mySpawn); player.teleportTo(mySpawn); //It's done twice because teleporting from one world to another is weird
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. //Two lines of teleporting to prevent a bug when players try teleporting from one world to another bringing them to that worlds spawn at first.
//player.sendMessage("mcMMO DEBUG CODE 4"); //player.sendMessage("mcMMO DEBUG CODE 4");
@ -595,12 +594,11 @@ public class mcPlayerListener extends PlayerListener {
} }
return; return;
} }
if((player.isOp() || mcPermissions.getInstance().adminChat(player)) if((player.isOp() || mcPermissions.getInstance().adminChat(player)) && mcConfig.getInstance().isAdminToggled(player.getName())){
&& mcConfig.getInstance().isAdminToggled(player.getName())){
log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage()); log.log(Level.INFO, "[A]"+"<"+player.getName()+"> "+event.getMessage());
event.setCancelled(true); event.setCancelled(true);
for(Player herp : plugin.getServer().getOnlinePlayers()){ for(Player herp : plugin.getServer().getOnlinePlayers()){
if(herp.isOp()){ if((herp.isOp() || mcPermissions.getInstance().adminChat(herp))){
herp.sendMessage(y+event.getMessage()); herp.sendMessage(y+event.getMessage());
} }
} }

View File

@ -19,6 +19,9 @@ public class mcRepair {
return instance; return instance;
} }
public void repairCheck(Player player, ItemStack is, Block block){ public void repairCheck(Player player, ItemStack is, Block block){
short durabilityBefore = is.getDurability();
short durabilityAfter = 0;
short dif = 0;
if(block != null if(block != null
&& mcPermissions.getInstance().repair(player)){ && mcPermissions.getInstance().repair(player)){
if(player.getItemInHand().getDurability() > 0){ if(player.getItemInHand().getDurability() > 0){
@ -32,19 +35,26 @@ public class mcRepair {
if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ if(isDiamondArmor(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){
removeDiamond(player); removeDiamond(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, 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)){ } else if (isIronArmor(is) && hasIron(player)){
/* /*
* IRON ARMOR * IRON ARMOR
*/ */
removeIron(player); removeIron(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
mcUsers.getProfile(player).addRepairGather(20 * mcLoadProperties.xpGainMultiplier); durabilityAfter = is.getDurability();
dif = (short) (durabilityBefore - durabilityAfter);
mcUsers.getProfile(player).addRepairGather(dif * mcLoadProperties.xpGainMultiplier);
//GOLD ARMOR //GOLD ARMOR
} else if (isGoldArmor(is) && hasGold(player)){ } else if (isGoldArmor(is) && hasGold(player)){
removeGold(player); removeGold(player);
player.getItemInHand().setDurability(getArmorRepairAmount(is, player)); player.getItemInHand().setDurability(getArmorRepairAmount(is, player));
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 { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -59,18 +69,43 @@ public class mcRepair {
if(isIronTools(is) && hasIron(player)){ if(isIronTools(is) && hasIron(player)){
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeIron(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 } else if (isDiamondTools(is) && hasDiamond(player) && mcUsers.getProfile(player).getRepairInt() >= mcLoadProperties.repairdiamondlevel){ //Check if its diamond and the player has diamonds
/* /*
* DIAMOND TOOLS * DIAMOND TOOLS
*/ */
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeDiamond(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)){ } else if(isGoldTools(is) && hasGold(player)){
is.setDurability(getToolRepairAmount(is, player)); is.setDurability(getToolRepairAmount(is, player));
removeGold(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 { } else {
needMoreVespeneGas(is, player); needMoreVespeneGas(is, player);
} }
@ -155,7 +190,7 @@ public class mcRepair {
public void removeIron(Player player){ public void removeIron(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 265){ if(x != null && x.getTypeId() == 265){
if(x.getAmount() == 1){ if(x.getAmount() == 1){
x.setTypeId(0); x.setTypeId(0);
x.setAmount(0); x.setAmount(0);
@ -171,7 +206,7 @@ public class mcRepair {
public void removeGold(Player player){ public void removeGold(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 266){ if(x != null && x.getTypeId() == 266){
if(x.getAmount() == 1){ if(x.getAmount() == 1){
x.setTypeId(0); x.setTypeId(0);
x.setAmount(0); x.setAmount(0);
@ -187,7 +222,7 @@ public class mcRepair {
public void removeDiamond(Player player){ public void removeDiamond(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 264){ if(x != null && x.getTypeId() == 264){
if(x.getAmount() == 1){ if(x.getAmount() == 1){
x.setTypeId(0); x.setTypeId(0);
x.setAmount(0); x.setAmount(0);
@ -203,7 +238,7 @@ public class mcRepair {
public boolean hasGold(Player player){ public boolean hasGold(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 266){ if(x != null && x.getTypeId() == 266){
return true; return true;
} }
} }
@ -212,7 +247,7 @@ public class mcRepair {
public boolean hasDiamond(Player player){ public boolean hasDiamond(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 264){ if(x != null && x.getTypeId() == 264){
return true; return true;
} }
} }
@ -221,7 +256,7 @@ public class mcRepair {
public boolean hasIron(Player player){ public boolean hasIron(Player player){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ for(ItemStack x : inventory){
if(x.getTypeId() == 265){ if(x != null && x.getTypeId() == 265){
return true; return true;
} }
} }

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcSkills { public class mcSkills {
private static mcMMO plugin; private static mcMMO plugin;
@ -19,6 +21,14 @@ public class mcSkills {
} }
return instance; 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){ public boolean hasArrows(Player player){
for(ItemStack x : player.getInventory().getContents()){ for(ItemStack x : player.getInventory().getContents()){
if (x.getTypeId() == 262){ if (x.getTypeId() == 262){
@ -35,92 +45,90 @@ public class mcSkills {
} }
} }
} }
public void decreaseCooldowns(Player player){ public int calculateTimeLeft(Player player, long deactivatedTimeStamp, int cooldown){
if(mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){ long currentTime = System.currentTimeMillis();
mcUsers.getProfile(player).decreaseTreeFellerCooldown(); int x = 0;
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ while(currentTime < deactivatedTimeStamp + (cooldown * 1000)){
currentTime += 1000;
x++;
}
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!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Tree Feller "+ChatColor.GREEN+"ability is refreshed!");
} }
} if(!mcUsers.getProfile(player).getSuperBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSuperBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
if(mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ mcUsers.getProfile(player).setSuperBreakerInformed(true);
mcUsers.getProfile(player).decreaseSuperBreakerCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Super Breaker "+ChatColor.GREEN+"ability is refreshed!");
} }
} if(!mcUsers.getProfile(player).getSerratedStrikesInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSerratedStrikesDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
if(mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){ mcUsers.getProfile(player).setSerratedStrikesInformed(true);
mcUsers.getProfile(player).decreaseSerratedStrikesCooldown();
if(mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Serrated Strikes "+ChatColor.GREEN+"ability is refreshed!");
} }
} if(!mcUsers.getProfile(player).getBerserkInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getBerserkDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
if(mcUsers.getProfile(player).getBerserkCooldown() >= 1){ mcUsers.getProfile(player).setBerserkInformed(true);
mcUsers.getProfile(player).decreaseBerserkCooldown();
if(mcUsers.getProfile(player).getBerserkCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Berserk "+ChatColor.GREEN+"ability is refreshed!");
} }
} if(!mcUsers.getProfile(player).getSkullSplitterInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getSkullSplitterDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
if(mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){ mcUsers.getProfile(player).setSkullSplitterInformed(true);
mcUsers.getProfile(player).decreaseSkullSplitterCooldown();
if(mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Skull Splitter "+ChatColor.GREEN+"ability is refreshed!");
} }
} if(!mcUsers.getProfile(player).getGigaDrillBreakerInformed() && System.currentTimeMillis() - mcUsers.getProfile(player).getGigaDrillBreakerDeactivatedTimeStamp() >= (mcLoadProperties.berserkCooldown * 1000)){
if(mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){ mcUsers.getProfile(player).setGigaDrillBreakerInformed(true);
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!"); player.sendMessage(ChatColor.GREEN+"Your "+ChatColor.YELLOW+"Giga Drill Breaker "+ChatColor.GREEN+"ability is refreshed!");
} }
} }
}
public void abilityActivationCheck(Player player){ public void abilityActivationCheck(Player player){
if(!mcUsers.getProfile(player).getAbilityUse()) PlayerProfile PP = mcUsers.getProfile(player);
if(!PP.getAbilityUse())
return; return;
if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){ if(mcPermissions.getInstance().miningAbility(player) && mcm.getInstance().isMiningPick(player.getItemInHand()) && !mcUsers.getProfile(player).getPickaxePreparationMode()){
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){ if(!PP.getSuperBreakerMode() && !cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."+ChatColor.YELLOW+" (" player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+mcUsers.getProfile(player).getSuperBreakerCooldown()+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSuperBreakerDeactivatedTimeStamp(), mcLoadProperties.superBreakerCooldown)+"s)");
return; return;
} }
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**"); player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR PICKAXE**");
mcUsers.getProfile(player).setPickaxePreparationTicks(4); PP.setPickaxePreparationATS(System.currentTimeMillis());
mcUsers.getProfile(player).setPickaxePreparationMode(true); PP.setPickaxePreparationMode(true);
} }
if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !mcUsers.getProfile(player).getShovelPreparationMode()){ if(mcPermissions.getInstance().excavationAbility(player) && mcm.getInstance().isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode()){
if(!mcUsers.getProfile(player).getGigaDrillBreakerMode() && mcUsers.getProfile(player).getGigaDrillBreakerCooldown() >= 1){ if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getGigaDrillBreakerCooldown()+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getGigaDrillBreakerDeactivatedTimeStamp(), mcLoadProperties.gigaDrillBreakerCooldown)+"s)");
return; return;
} }
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**"); player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SHOVEL**");
mcUsers.getProfile(player).setShovelPreparationTicks(4); PP.setShovelPreparationATS(System.currentTimeMillis());
mcUsers.getProfile(player).setShovelPreparationMode(true); PP.setShovelPreparationMode(true);
} }
if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !mcUsers.getProfile(player).getSwordsPreparationMode()){ if(mcPermissions.getInstance().swordsAbility(player) && mcm.getInstance().isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode()){
if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() >= 1){ if(!PP.getSerratedStrikesMode() && !cooldownOver(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getSerratedStrikesCooldown()+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getSerratedStrikesDeactivatedTimeStamp(), mcLoadProperties.serratedStrikeCooldown)+"s)");
return; return;
} }
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**"); player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR SWORD**");
mcUsers.getProfile(player).setSwordsPreparationTicks(4); PP.setSwordsPreparationATS(System.currentTimeMillis());
mcUsers.getProfile(player).setSwordsPreparationMode(true); PP.setSwordsPreparationMode(true);
} }
if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !mcUsers.getProfile(player).getFistsPreparationMode()){ if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode()){
if(!mcUsers.getProfile(player).getBerserkMode() && mcUsers.getProfile(player).getBerserkCooldown() >= 1){ if(!PP.getBerserkMode() && !cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again." player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+mcUsers.getProfile(player).getBerserkCooldown()+"s)"); +ChatColor.YELLOW+" ("+calculateTimeLeft(player, PP.getBerserkDeactivatedTimeStamp(), mcLoadProperties.berserkCooldown)+"s)");
return; return;
} }
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**"); player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR FISTS**");
mcUsers.getProfile(player).setFistsPreparationTicks(4); PP.setFistsPreparationATS(System.currentTimeMillis());
mcUsers.getProfile(player).setFistsPreparationMode(true); 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())){ if(mcm.getInstance().isAxes(player.getItemInHand())){
player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**"); player.sendMessage(ChatColor.GREEN+"**YOU READY YOUR AXE**");
mcUsers.getProfile(player).setAxePreparationTicks(4); PP.setAxePreparationATS(System.currentTimeMillis());
mcUsers.getProfile(player).setAxePreparationMode(true); PP.setAxePreparationMode(true);
} }
} }
} }
@ -128,7 +136,6 @@ public class mcSkills {
if(mcm.getInstance().isSwords(player.getItemInHand())){ if(mcm.getInstance().isSwords(player.getItemInHand())){
if(mcUsers.getProfile(player).getSwordsPreparationMode()){ if(mcUsers.getProfile(player).getSwordsPreparationMode()){
mcUsers.getProfile(player).setSwordsPreparationMode(false); mcUsers.getProfile(player).setSwordsPreparationMode(false);
mcUsers.getProfile(player).setSwordsPreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getSwordsInt() >= 50) if(mcUsers.getProfile(player).getSwordsInt() >= 50)
@ -150,7 +157,8 @@ public class mcSkills {
if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){ if(!mcUsers.getProfile(player).getSerratedStrikesMode() && mcUsers.getProfile(player).getSerratedStrikesCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SERRATED STRIKES ACTIVATED**"); 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); mcUsers.getProfile(player).setSerratedStrikesMode(true);
} }
@ -160,7 +168,6 @@ public class mcSkills {
if(player.getItemInHand().getTypeId() == 0){ if(player.getItemInHand().getTypeId() == 0){
if(mcUsers.getProfile(player).getFistsPreparationMode()){ if(mcUsers.getProfile(player).getFistsPreparationMode()){
mcUsers.getProfile(player).setFistsPreparationMode(false); mcUsers.getProfile(player).setFistsPreparationMode(false);
mcUsers.getProfile(player).setFistsPreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getUnarmedInt() >= 50) if(mcUsers.getProfile(player).getUnarmedInt() >= 50)
@ -180,104 +187,90 @@ public class mcSkills {
if(mcUsers.getProfile(player).getUnarmedInt() >= 750) if(mcUsers.getProfile(player).getUnarmedInt() >= 750)
ticks++; 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**"); 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); mcUsers.getProfile(player).setBerserkMode(true);
} }
} }
} }
public void skullSplitterCheck(Player player){ 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 * CHECK FOR AXE PREP MODE
*/ */
if(mcUsers.getProfile(player).getAxePreparationMode()){ if(PP.getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false); PP.setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getAxesInt() >= 50) if(PP.getAxesInt() >= 50)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 150) if(PP.getAxesInt() >= 150)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 250) if(PP.getAxesInt() >= 250)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 350) if(PP.getAxesInt() >= 350)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 450) if(PP.getAxesInt() >= 450)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 550) if(PP.getAxesInt() >= 550)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 650) if(PP.getAxesInt() >= 650)
ticks++; ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 750) if(PP.getAxesInt() >= 750)
ticks++; ticks++;
if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){ if(!PP.getSkullSplitterMode() && PP.getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
mcUsers.getProfile(player).setSkullSplitterTicks(ticks * 2); PP.setSkullSplitterTicks(ticks * 1000);
mcUsers.getProfile(player).setSkullSplitterMode(true); 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." 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){ public void monitorSkills(Player player){
PlayerProfile PP = mcUsers.getProfile(player);
/* /*
* AXE PREPARATION MODE * AXE PREPARATION MODE
*/ */
if(mcUsers.getProfile(player) == null) if(PP == null)
mcUsers.addUser(player); mcUsers.addUser(player);
if(mcUsers.getProfile(player).getAxePreparationMode()){ if(PP.getAxePreparationMode() && System.currentTimeMillis() - PP.getAxePreparationATS() >= 4000){
mcUsers.getProfile(player).decreaseAxePreparationTicks(); PP.setAxePreparationMode(false);
if(mcUsers.getProfile(player).getAxePreparationTicks() <= 0){
mcUsers.getProfile(player).setAxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
} }
} if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - PP.getPickaxePreparationATS() >= 4000){
if(mcUsers.getProfile(player).getPickaxePreparationMode()){ PP.setPickaxePreparationMode(false);
mcUsers.getProfile(player).decreasePickaxePreparationTicks();
if(mcUsers.getProfile(player).getPickaxePreparationTicks() <= 0){
mcUsers.getProfile(player).setPickaxePreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR PICKAXE**");
} }
} if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - PP.getSwordsPreparationATS() >= 4000){
if(mcUsers.getProfile(player).getSwordsPreparationMode()){ PP.setSwordsPreparationMode(false);
mcUsers.getProfile(player).decreaseSwordsPreparationTicks();
if(mcUsers.getProfile(player).getSwordsPreparationTicks() <= 0){
mcUsers.getProfile(player).setSwordsPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SWORD**");
} }
} if(PP.getFistsPreparationMode() && System.currentTimeMillis() - PP.getFistsPreparationATS() >= 4000){
if(mcUsers.getProfile(player).getFistsPreparationMode()){ PP.setFistsPreparationMode(false);
mcUsers.getProfile(player).decreaseFistsPreparationTicks();
if(mcUsers.getProfile(player).getFistsPreparationTicks() <= 0){
mcUsers.getProfile(player).setFistsPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**"); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR FISTS**");
} }
} if(PP.getShovelPreparationMode() && System.currentTimeMillis() - PP.getShovelPreparationATS() >= 4000){
if(mcUsers.getProfile(player).getShovelPreparationMode()){ PP.setShovelPreparationMode(false);
mcUsers.getProfile(player).decreaseShovelPreparationTicks(); player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR AXE**");
if(mcUsers.getProfile(player).getShovelPreparationTicks() <= 0){
mcUsers.getProfile(player).setShovelPreparationMode(false);
player.sendMessage(ChatColor.GRAY+"**YOU LOWER YOUR SHOVEL**");
}
} }
/* /*
* AXES ABILITY * AXES ABILITY
*/ */
if(mcPermissions.getInstance().axesAbility(player)){ if(mcPermissions.getInstance().axesAbility(player)){
//Monitor the length of Skull Splitter mode if(mcPermissions.getInstance().unarmedAbility(player)){
if(mcUsers.getProfile(player).getSkullSplitterMode()){ if(PP.getSkullSplitterMode() && PP.getSkullSplitterActivatedTimeStamp() + PP.getSkullSplitterTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseSkullSplitterTicks(); PP.setSkullSplitterMode(false);
if(mcUsers.getProfile(player).getSkullSplitterTicks() <= 0){ PP.setSkullSplitterInformed(false);
mcUsers.getProfile(player).setSkullSplitterMode(false);
mcUsers.getProfile(player).setSkullSplitterCooldown(mcLoadProperties.skullSplitterCooldown);
player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**"); player.sendMessage(ChatColor.RED+"**Skull Splitter has worn off**");
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
} }
@ -285,65 +278,55 @@ public class mcSkills {
* WOODCUTTING ABILITY * WOODCUTTING ABILITY
*/ */
if(mcPermissions.getInstance().woodCuttingAbility(player)){ if(mcPermissions.getInstance().woodCuttingAbility(player)){
if(mcUsers.getProfile(player).getTreeFellerMode()){ if(PP.getTreeFellerMode() && PP.getTreeFellerActivatedTimeStamp() + PP.getTreeFellerTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseTreeFellerTicks(); PP.setTreeFellerMode(false);
if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){ PP.setTreeFellerInformed(false);
mcUsers.getProfile(player).setTreeFellerMode(false);
mcUsers.getProfile(player).setTreeFellerCooldown(mcLoadProperties.treeFellerCooldown);
player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**"); player.sendMessage(ChatColor.RED+"**Tree Feller has worn off**");
} PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
/* /*
* MINING ABILITY * MINING ABILITY
*/ */
if(mcPermissions.getInstance().miningAbility(player)){ if(mcPermissions.getInstance().miningAbility(player)){
if(mcUsers.getProfile(player).getSuperBreakerMode()){ if(PP.getSuperBreakerMode() && PP.getSuperBreakerActivatedTimeStamp() + PP.getSuperBreakerTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseSuperBreakerTicks(); PP.setSuperBreakerMode(false);
if(mcUsers.getProfile(player).getSuperBreakerTicks() <= 0){ PP.setSuperBreakerInformed(false);
mcUsers.getProfile(player).setSuperBreakerMode(false);
mcUsers.getProfile(player).setSuperBreakerCooldown(mcLoadProperties.superBreakerCooldown);
player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**"); player.sendMessage(ChatColor.RED+"**Super Breaker has worn off**");
} PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
/* /*
* EXCAVATION ABILITY * EXCAVATION ABILITY
*/ */
if(mcPermissions.getInstance().excavationAbility(player)){ if(mcPermissions.getInstance().excavationAbility(player)){
if(mcUsers.getProfile(player).getGigaDrillBreakerMode()){ if(PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerActivatedTimeStamp() + PP.getGigaDrillBreakerTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseGigaDrillBreakerTicks(); PP.setGigaDrillBreakerMode(false);
if(mcUsers.getProfile(player).getGigaDrillBreakerTicks() <= 0){ PP.setGigaDrillBreakerInformed(false);
mcUsers.getProfile(player).setGigaDrillBreakerMode(false); player.sendMessage(ChatColor.RED+"**Giga Drill Breaker has worn off**");
mcUsers.getProfile(player).setGigaDrillBreakerCooldown(mcLoadProperties.gigaDrillBreakerCooldown); PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis());
player.sendMessage(ChatColor.RED+"**You feel spiral energy leaving you**");
}
} }
} }
/* /*
* SWORDS ABILITY * SWORDS ABILITY
*/ */
if(mcPermissions.getInstance().swordsAbility(player)){ if(mcPermissions.getInstance().swordsAbility(player)){
if(mcUsers.getProfile(player).getSerratedStrikesMode()){ if(PP.getSerratedStrikesMode() && PP.getSerratedStrikesActivatedTimeStamp() + PP.getSerratedStrikesTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseSerratedStrikesTicks(); PP.setSerratedStrikesMode(false);
if(mcUsers.getProfile(player).getSerratedStrikesTicks() <= 0){ PP.setSerratedStrikesInformed(false);
mcUsers.getProfile(player).setSerratedStrikesMode(false);
mcUsers.getProfile(player).setSerratedStrikesCooldown(mcLoadProperties.serratedStrikeCooldown);
player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**"); player.sendMessage(ChatColor.RED+"**Serrated Strikes has worn off**");
} PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
/* /*
* UNARMED ABILITY * UNARMED ABILITY
*/ */
if(mcPermissions.getInstance().unarmedAbility(player)){ if(mcPermissions.getInstance().unarmedAbility(player)){
if(mcUsers.getProfile(player).getBerserkMode()){ if(PP.getBerserkMode() && PP.getBerserkActivatedTimeStamp() + PP.getBerserkTicks() <= System.currentTimeMillis()){
mcUsers.getProfile(player).decreaseBerserkTicks(); PP.setBerserkMode(false);
if(mcUsers.getProfile(player).getBerserkTicks() <= 0){ PP.setBerserkInformed(false);
mcUsers.getProfile(player).setBerserkMode(false);
mcUsers.getProfile(player).setBerserkCooldown(mcLoadProperties.berserkCooldown);
player.sendMessage(ChatColor.RED+"**Berserk has worn off**"); player.sendMessage(ChatColor.RED+"**Berserk has worn off**");
} PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis());
} }
} }
} }

View File

@ -28,7 +28,7 @@ public class mcTimer extends TimerTask{
/* /*
* COOLDOWN MONITORING * COOLDOWN MONITORING
*/ */
mcSkills.getInstance().decreaseCooldowns(player); mcSkills.getInstance().watchCooldowns(player);
/* /*
* PLAYER BLEED MONITORING * PLAYER BLEED MONITORING
@ -38,12 +38,11 @@ public class mcTimer extends TimerTask{
mcUsers.getProfile(player).decreaseBleedTicks(); 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(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) >= 1000 && mcUsers.getProfile(player).getPowerLevel(player) >= 1000){
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }
@ -51,22 +50,17 @@ public class mcTimer extends TimerTask{
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) >= 500 && mcUsers.getProfile(player).getPowerLevel(player) >= 500
&& mcUsers.getProfile(player).getPowerLevel(player) < 1000 && mcUsers.getProfile(player).getPowerLevel(player) < 1000){
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }
if(thecount == 40){ if(thecount == 40){
if(player != null && if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20 player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel(player) < 500 && mcUsers.getProfile(player).getPowerLevel(player) < 500){
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1)); player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
} }
} }
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
mcUsers.getProfile(player).decreaseLastHurt();
}
} }
} }

View File

@ -157,10 +157,14 @@ class PlayerList
protected final Logger log = Logger.getLogger("Minecraft"); protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode, pickaxePreparationMode, axePreparationMode, skullSplitterMode, berserkMode; 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 int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0, private long gigaDrillBreakerCooldown = 0, berserkCooldown = 0, superBreakerCooldown = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0,
serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0, treeFellerCooldown = 0, recentlyHurt = 0, archeryShotATS = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0,
axePreparationTicks = 0, pickaxePreparationTicks = 0, fistsPreparationTicks = 0, shovelPreparationTicks = 0, swordsPreparationTicks = 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; Player thisplayer;
char defaultColor; char defaultColor;
@ -430,11 +434,6 @@ class PlayerList
abilityuse = false; abilityuse = false;
} }
} }
public void decreaseLastHurt(){
if(recentlyhurt >= 1){
recentlyhurt--;
}
}
public void decreaseBleedTicks(){ public void decreaseBleedTicks(){
if(bleedticks >= 1){ if(bleedticks >= 1){
bleedticks--; bleedticks--;
@ -456,6 +455,12 @@ class PlayerList
return false; return false;
} }
} }
/*
* ARCHERY NERF STUFF
*/
public long getArcheryShotATS() {return archeryShotATS;}
public void setArcheryShotATS(long newvalue) {archeryShotATS = newvalue;}
/* /*
* SWORDS PREPARATION * SWORDS PREPARATION
*/ */
@ -465,16 +470,11 @@ class PlayerList
public void setSwordsPreparationMode(Boolean bool){ public void setSwordsPreparationMode(Boolean bool){
swordsPreparationMode = bool; swordsPreparationMode = bool;
} }
public Integer getSwordsPreparationTicks(){ public long getSwordsPreparationATS(){
return swordsPreparationTicks; 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 * SHOVEL PREPARATION
@ -485,16 +485,11 @@ class PlayerList
public void setShovelPreparationMode(Boolean bool){ public void setShovelPreparationMode(Boolean bool){
shovelPreparationMode = bool; shovelPreparationMode = bool;
} }
public Integer getShovelPreparationTicks(){ public long getShovelPreparationATS(){
return shovelPreparationTicks; 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 * FISTS PREPARATION
@ -505,16 +500,11 @@ class PlayerList
public void setFistsPreparationMode(Boolean bool){ public void setFistsPreparationMode(Boolean bool){
fistsPreparationMode = bool; fistsPreparationMode = bool;
} }
public Integer getFistsPreparationTicks(){ public long getFistsPreparationATS(){
return fistsPreparationTicks; 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 * AXE PREPARATION
@ -525,16 +515,11 @@ class PlayerList
public void setAxePreparationMode(Boolean bool){ public void setAxePreparationMode(Boolean bool){
axePreparationMode = bool; axePreparationMode = bool;
} }
public Integer getAxePreparationTicks(){ public long getAxePreparationATS(){
return axePreparationTicks; 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 * PICKAXE PREPARATION
@ -545,209 +530,192 @@ class PlayerList
public void setPickaxePreparationMode(Boolean bool){ public void setPickaxePreparationMode(Boolean bool){
pickaxePreparationMode = bool; pickaxePreparationMode = bool;
} }
public Integer getPickaxePreparationTicks(){ public long getPickaxePreparationATS(){
return pickaxePreparationTicks; 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 * BERSERK MODE
*/ */
public boolean getBerserkInformed() {return berserkInformed;}
public void setBerserkInformed(Boolean bool){
berserkInformed = bool;
}
public boolean getBerserkMode(){ public boolean getBerserkMode(){
return berserkMode; return berserkMode;
} }
public void setBerserkMode(Boolean bool){ public void setBerserkMode(Boolean bool){
berserkMode = bool; berserkMode = bool;
} }
public Integer getBerserkTicks(){ public long getBerserkActivatedTimeStamp() {return berserkATS;}
return berserkTicks; public void setBerserkActivatedTimeStamp(Long newvalue){
berserkATS = newvalue;
} }
public void setBerserkTicks(Integer newvalue){ public long getBerserkDeactivatedTimeStamp() {return berserkDATS;}
berserkTicks = newvalue; public void setBerserkDeactivatedTimeStamp(Long newvalue){
berserkDATS = newvalue;
} }
public void decreaseBerserkTicks(){ public void setBerserkCooldown(Long newvalue){
if(berserkTicks >= 1){
berserkTicks--;
}
}
public void setBerserkCooldown(Integer newvalue){
berserkCooldown = newvalue; berserkCooldown = newvalue;
} }
public int getBerserkCooldown(){ public long getBerserkCooldown(){
return berserkCooldown; return berserkCooldown;
} }
public void decreaseBerserkCooldown(){ public void setBerserkTicks(Integer newvalue){berserkTicks = newvalue;}
if(berserkCooldown >= 1){ public int getBerserkTicks(){return berserkTicks;}
berserkCooldown--;
}
}
/* /*
* SKULL SPLITTER * SKULL SPLITTER
*/ */
public boolean getSkullSplitterInformed() {return skullSplitterInformed;}
public void setSkullSplitterInformed(Boolean bool){
skullSplitterInformed = bool;
}
public boolean getSkullSplitterMode(){ public boolean getSkullSplitterMode(){
return skullSplitterMode; return skullSplitterMode;
} }
public void setSkullSplitterMode(Boolean bool){ public void setSkullSplitterMode(Boolean bool){
skullSplitterMode = bool; skullSplitterMode = bool;
} }
public Integer getSkullSplitterTicks(){ public long getSkullSplitterActivatedTimeStamp() {return skullSplitterATS;}
return skullSplitterTicks; public void setSkullSplitterActivatedTimeStamp(Long newvalue){
skullSplitterATS = newvalue;
} }
public void setSkullSplitterTicks(Integer newvalue){ public long getSkullSplitterDeactivatedTimeStamp() {return skullSplitterDATS;}
skullSplitterTicks = newvalue; public void setSkullSplitterDeactivatedTimeStamp(Long newvalue){
skullSplitterDATS = newvalue;
} }
public void decreaseSkullSplitterTicks(){ public void setSkullSplitterCooldown(Long newvalue){
if(skullSplitterTicks >= 1){
skullSplitterTicks--;
}
}
public void setSkullSplitterCooldown(Integer newvalue){
skullSplitterCooldown = newvalue; skullSplitterCooldown = newvalue;
} }
public int getSkullSplitterCooldown(){ public long getSkullSplitterCooldown(){
return skullSplitterCooldown; return skullSplitterCooldown;
} }
public void decreaseSkullSplitterCooldown(){ public void setSkullSplitterTicks(Integer newvalue){skullSplitterTicks = newvalue;}
if(skullSplitterCooldown >= 1){ public int getSkullSplitterTicks(){return skullSplitterTicks;}
skullSplitterCooldown--;
}
}
/* /*
* SERRATED STRIKES * SERRATED STRIKES
*/ */
public boolean getSerratedStrikesInformed() {return serratedStrikesInformed;}
public void setSerratedStrikesInformed(Boolean bool){
serratedStrikesInformed = bool;
}
public boolean getSerratedStrikesMode(){ public boolean getSerratedStrikesMode(){
return serratedStrikesMode; return serratedStrikesMode;
} }
public void setSerratedStrikesMode(Boolean bool){ public void setSerratedStrikesMode(Boolean bool){
serratedStrikesMode = bool; serratedStrikesMode = bool;
} }
public Integer getSerratedStrikesTicks(){ public long getSerratedStrikesActivatedTimeStamp() {return serratedStrikesATS;}
return serratedStrikesTicks; public void setSerratedStrikesActivatedTimeStamp(Long newvalue){
serratedStrikesATS = newvalue;
} }
public void setSerratedStrikesTicks(Integer newvalue){ public long getSerratedStrikesDeactivatedTimeStamp() {return serratedStrikesDATS;}
serratedStrikesTicks = newvalue; public void setSerratedStrikesDeactivatedTimeStamp(Long newvalue){
serratedStrikesDATS = newvalue;
} }
public void decreaseSerratedStrikesTicks(){ public void setSerratedStrikesCooldown(Long newvalue){
if(serratedStrikesTicks >= 1){
serratedStrikesTicks--;
}
}
public void setSerratedStrikesCooldown(Integer newvalue){
serratedStrikesCooldown = newvalue; serratedStrikesCooldown = newvalue;
} }
public int getSerratedStrikesCooldown(){ public long getSerratedStrikesCooldown(){
return serratedStrikesCooldown; return serratedStrikesCooldown;
} }
public void decreaseSerratedStrikesCooldown(){ public void setSerratedStrikesTicks(Integer newvalue){serratedStrikesTicks = newvalue;}
if(serratedStrikesCooldown >= 1){ public int getSerratedStrikesTicks(){return serratedStrikesTicks;}
serratedStrikesCooldown--;
}
}
/* /*
* GIGA DRILL BREAKER * GIGA DRILL BREAKER
*/ */
public boolean getGigaDrillBreakerInformed() {return gigaDrillBreakerInformed;}
public void setGigaDrillBreakerInformed(Boolean bool){
gigaDrillBreakerInformed = bool;
}
public boolean getGigaDrillBreakerMode(){ public boolean getGigaDrillBreakerMode(){
return gigaDrillBreakerMode; return gigaDrillBreakerMode;
} }
public void setGigaDrillBreakerMode(Boolean bool){ public void setGigaDrillBreakerMode(Boolean bool){
gigaDrillBreakerMode = bool; gigaDrillBreakerMode = bool;
} }
public Integer getGigaDrillBreakerTicks(){ public long getGigaDrillBreakerActivatedTimeStamp() {return gigaDrillBreakerATS;}
return gigaDrillBreakerTicks; public void setGigaDrillBreakerActivatedTimeStamp(Long newvalue){
gigaDrillBreakerATS = newvalue;
} }
public void setGigaDrillBreakerTicks(Integer newvalue){ public long getGigaDrillBreakerDeactivatedTimeStamp() {return gigaDrillBreakerDATS;}
gigaDrillBreakerTicks = newvalue; public void setGigaDrillBreakerDeactivatedTimeStamp(Long newvalue){
gigaDrillBreakerDATS = newvalue;
} }
public void decreaseGigaDrillBreakerTicks(){ public void setGigaDrillBreakerCooldown(Long newvalue){
if(gigaDrillBreakerTicks >= 1){
gigaDrillBreakerTicks--;
}
}
public void setGigaDrillBreakerCooldown(Integer newvalue){
gigaDrillBreakerCooldown = newvalue; gigaDrillBreakerCooldown = newvalue;
} }
public int getGigaDrillBreakerCooldown(){ public long getGigaDrillBreakerCooldown(){
return gigaDrillBreakerCooldown; return gigaDrillBreakerCooldown;
} }
public void decreaseGigaDrillBreakerCooldown(){ public void setGigaDrillBreakerTicks(Integer newvalue){gigaDrillBreakerTicks = newvalue;}
if(gigaDrillBreakerCooldown >= 1){ public int getGigaDrillBreakerTicks(){return gigaDrillBreakerTicks;}
gigaDrillBreakerCooldown--;
}
}
/* /*
* TREE FELLER STUFF * TREE FELLER STUFF
*/ */
public boolean getTreeFellerInformed() {return treeFellerInformed;}
public void setTreeFellerInformed(Boolean bool){
treeFellerInformed = bool;
}
public boolean getTreeFellerMode(){ public boolean getTreeFellerMode(){
return treeFellerMode; return treeFellerMode;
} }
public void setTreeFellerMode(Boolean bool){ public void setTreeFellerMode(Boolean bool){
treeFellerMode = bool; treeFellerMode = bool;
} }
public Integer getTreeFellerTicks(){ public long getTreeFellerActivatedTimeStamp() {return treeFellerATS;}
return treeFellerTicks; public void setTreeFellerActivatedTimeStamp(Long newvalue){
treeFellerATS = newvalue;
} }
public void setTreeFellerTicks(Integer newvalue){ public long getTreeFellerDeactivatedTimeStamp() {return treeFellerDATS;}
treeFellerTicks = newvalue; public void setTreeFellerDeactivatedTimeStamp(Long newvalue){
treeFellerDATS = newvalue;
} }
public void decreaseTreeFellerTicks(){ public void setTreeFellerCooldown(Long newvalue){
if(treeFellerTicks >= 1){
treeFellerTicks--;
}
}
public void setTreeFellerCooldown(Integer newvalue){
treeFellerCooldown = newvalue; treeFellerCooldown = newvalue;
} }
public int getTreeFellerCooldown(){ public long getTreeFellerCooldown(){
return treeFellerCooldown; return treeFellerCooldown;
} }
public void decreaseTreeFellerCooldown(){ public void setTreeFellerTicks(Integer newvalue){treeFellerTicks = newvalue;}
if(treeFellerCooldown >= 1){ public int getTreeFellerTicks(){return treeFellerTicks;}
treeFellerCooldown--;
}
}
/* /*
* MINING * MINING
*/ */
public boolean getSuperBreakerInformed() {return superBreakerInformed;}
public void setSuperBreakerInformed(Boolean bool){
superBreakerInformed = bool;
}
public boolean getSuperBreakerMode(){ public boolean getSuperBreakerMode(){
return superBreakerMode; return superBreakerMode;
} }
public void setSuperBreakerMode(Boolean bool){ public void setSuperBreakerMode(Boolean bool){
superBreakerMode = bool; superBreakerMode = bool;
} }
public Integer getSuperBreakerTicks(){ public long getSuperBreakerActivatedTimeStamp() {return superBreakerATS;}
return superBreakerTicks; public void setSuperBreakerActivatedTimeStamp(Long newvalue){
superBreakerATS = newvalue;
} }
public void setSuperBreakerTicks(Integer newvalue){ public long getSuperBreakerDeactivatedTimeStamp() {return superBreakerDATS;}
superBreakerTicks = newvalue; public void setSuperBreakerDeactivatedTimeStamp(Long newvalue){
superBreakerDATS = newvalue;
} }
public void decreaseSuperBreakerTicks(){ public void setSuperBreakerCooldown(Long newvalue){
if(superBreakerTicks >= 1){
superBreakerTicks--;
}
}
public void setSuperBreakerCooldown(Integer newvalue){
superBreakerCooldown = newvalue; superBreakerCooldown = newvalue;
} }
public int getSuperBreakerCooldown(){ public long getSuperBreakerCooldown(){
return superBreakerCooldown; return superBreakerCooldown;
} }
public void decreaseSuperBreakerCooldown(){ public void setSuperBreakerTicks(Integer newvalue){superBreakerTicks = newvalue;}
if(superBreakerCooldown >= 1){ public int getSuperBreakerTicks(){return superBreakerTicks;}
superBreakerCooldown--;
}
}
public Integer getRecentlyHurt(){ public long getRecentlyHurt(){
return recentlyhurt; return recentlyHurt;
} }
public void setRecentlyHurt(Integer newvalue){ public void setRecentlyHurt(long newvalue){
recentlyhurt = newvalue; recentlyHurt = newvalue;
} }
public void skillUpAxes(int newskill){ public void skillUpAxes(int newskill){
int x = 0; int x = 0;

View File

@ -9,6 +9,8 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.PlayerList.PlayerProfile;
public class mcWoodCutting { public class mcWoodCutting {
int w = 0; int w = 0;
@ -35,6 +37,7 @@ public class mcWoodCutting {
} }
} }
public void treeFellerCheck(Player player, Block block){ public void treeFellerCheck(Player player, Block block){
PlayerProfile PP = mcUsers.getProfile(player);
if(mcm.getInstance().isAxes(player.getItemInHand())){ if(mcm.getInstance().isAxes(player.getItemInHand())){
if(block != null){ if(block != null){
if(!mcm.getInstance().abilityBlockCheck(block)) if(!mcm.getInstance().abilityBlockCheck(block))
@ -43,36 +46,36 @@ public class mcWoodCutting {
/* /*
* CHECK FOR AXE PREP MODE * CHECK FOR AXE PREP MODE
*/ */
if(mcUsers.getProfile(player).getAxePreparationMode()){ if(PP.getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false); PP.setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
} }
int ticks = 2; int ticks = 2;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 50) if(PP.getWoodCuttingInt() >= 50)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 150) if(PP.getWoodCuttingInt() >= 150)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 250) if(PP.getWoodCuttingInt() >= 250)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 350) if(PP.getWoodCuttingInt() >= 350)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 450) if(PP.getWoodCuttingInt() >= 450)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 550) if(PP.getWoodCuttingInt() >= 550)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 650) if(PP.getWoodCuttingInt() >= 650)
ticks++; ticks++;
if(mcUsers.getProfile(player).getWoodCuttingInt() >= 750) if(PP.getWoodCuttingInt() >= 750)
ticks++; ticks++;
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){ if(!PP.getTreeFellerMode() && PP.getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**"); player.sendMessage(ChatColor.GREEN+"**TREE FELLING ACTIVATED**");
mcUsers.getProfile(player).setTreeFellerTicks(ticks * 2); PP.setTreeFellerTicks(ticks * 1000);
mcUsers.getProfile(player).setTreeFellerMode(true); 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." 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)");
} }
} }
} }

View File

@ -30,6 +30,7 @@ public class mcm {
return instance; return instance;
} }
public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){ public boolean blockBreakSimulate(Block block, Player player, Plugin plugin){
FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player); FakeBlockBreakEvent event = new FakeBlockBreakEvent(block, player);
@ -53,7 +54,7 @@ public class mcm {
if(player.getItemInHand().getDurability() >= getMaxDurability(mcm.getInstance().getTier(player), player.getItemInHand())){ if(player.getItemInHand().getDurability() >= getMaxDurability(mcm.getInstance().getTier(player), player.getItemInHand())){
ItemStack[] inventory = player.getInventory().getContents(); ItemStack[] inventory = player.getInventory().getContents();
for(ItemStack x : inventory){ 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.setTypeId(0);
x.setAmount(0); x.setAmount(0);
player.getInventory().setContents(inventory); 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){ public Integer getTier(Player player){
int i = player.getItemInHand().getTypeId(); int i = player.getItemInHand().getTypeId();
if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){ if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){
@ -103,7 +123,7 @@ public class mcm {
} }
public boolean abilityBlockCheck(Block block){ public boolean abilityBlockCheck(Block block){
int i = block.getTypeId(); 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; return false;
} else { } else {
return true; return true;
@ -219,6 +239,14 @@ public class mcm {
return false; 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){ public boolean isShovel(ItemStack is){
if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){ if(is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256){
return true; return true;
@ -240,6 +268,14 @@ public class mcm {
return false; 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){ public void mcmmoHelpCheck(String[] split, Player player, PlayerChatEvent event){
if(split[0].equalsIgnoreCase("/woodcutting")){ if(split[0].equalsIgnoreCase("/woodcutting")){
event.setCancelled(true); event.setCancelled(true);
@ -426,6 +462,7 @@ public class mcm {
String dodgepercentage; String dodgepercentage;
float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt(); float skillvalue = (float)mcUsers.getProfile(player).getAcrobaticsInt();
String percentage = String.valueOf((skillvalue / 1000) * 100); String percentage = String.valueOf((skillvalue / 1000) * 100);
String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2);
if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){ if(mcUsers.getProfile(player).getAcrobaticsInt() <= 800){
dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
} else { } else {
@ -434,10 +471,12 @@ public class mcm {
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ACROBATICS"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"ACROBATICS"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Falling"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Falling");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); 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.DARK_AQUA+"Dodge: "+ChatColor.GREEN+"Reduce damage by half");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Roll Chance: "+ChatColor.YELLOW+percentage+"%"); 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+"%"); player.sendMessage(ChatColor.RED+"Dodge Chance: "+ChatColor.YELLOW+dodgepercentage+"%");
} }
if(split[0].equalsIgnoreCase("/mining")){ if(split[0].equalsIgnoreCase("/mining")){
@ -539,6 +578,7 @@ public class mcm {
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)"); player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 250+ SKILL (UNARMED APPRENTICE)");
} else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){ } else if(mcUsers.getProfile(player).getUnarmedInt() >= 250 && mcUsers.getProfile(player).getUnarmedInt() < 500){
player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade"); player.sendMessage(ChatColor.RED+"Unarmed Apprentice: "+ChatColor.YELLOW+"Damage Upgrade");
player.sendMessage(ChatColor.GRAY+"LOCKED UNTIL 500+ SKILL (UNARMED MASTERY)");
} else { } else {
player.sendMessage(ChatColor.RED+"Unarmed Mastery: "+ChatColor.YELLOW+"Large Damage Upgrade"); 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(ChatColor.GREEN+"--MYSPAWN COMMANDS--");
player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn"); player.sendMessage("/"+mcLoadProperties.myspawn+" "+ChatColor.RED+"- Clears inventory & teleports to myspawn");
player.sendMessage("/"+mcLoadProperties.clearmyspawn+" "+ChatColor.RED+"- Clears your 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--"); player.sendMessage(ChatColor.GREEN+"--OTHER COMMANDS--");
if(mcPermissions.getInstance().mcAbility(player)) if(mcPermissions.getInstance().mcAbility(player))

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.9.16 version: 0.9.18