More changes - 0.9 WIP

This commit is contained in:
nossr50 2011-03-12 23:01:28 -08:00
parent cdb5547ed1
commit 8b5cfbf347
7 changed files with 72 additions and 75 deletions

View File

@ -584,33 +584,29 @@ public class mcCombat {
if(x instanceof Animals){ if(x instanceof Animals){
Animals animals = (Animals)x; Animals animals = (Animals)x;
if(animals.getHealth() >= 1){ if(animals.getHealth() >= 1){
animals.setHealth(mcm.getInstance().calculateMinusHealth(animals.getHealth(), 2)); animals.damage(1);
} }
if(animals.getHealth() <= 0){ if(animals.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(x); animals.damage(1);
} }
} }
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
if(monster.getHealth() >= 1){ if(monster.getHealth() >= 1){
monster.setHealth(mcm.getInstance().calculateMinusHealth(monster.getHealth(), 2)); monster.damage(1);
} }
if(monster.getHealth() <= 0){ if(monster.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(x); monster.damage(1);
} }
} }
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){ if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){
player.setHealth(mcm.getInstance().calculateMinusHealth(player.getHealth(), 1)); player.damage(1);
player.sendMessage(ChatColor.RED+"**BLEED**"); player.sendMessage(ChatColor.RED+"**BLEED**");
if(player.getHealth() <= 0){ if(player.getHealth() <= 0){
mcUsers.getProfile(player).setBleedTicks(0); mcUsers.getProfile(player).setBleedTicks(0);
for(ItemStack items : player.getInventory().getContents()){
if(items.getTypeId() != 0)
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items);
}
} }
if(mcUsers.getProfile(player).getBleedTicks() >= 1){ if(mcUsers.getProfile(player).getBleedTicks() >= 1){
mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1); mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1);
@ -618,7 +614,7 @@ public class mcCombat {
} }
} }
} }
} }
} }

View File

@ -27,6 +27,7 @@ public class mcConfig {
public void addTreeFeller(Block block) {treeFeller.add(block);} public void addTreeFeller(Block block) {treeFeller.add(block);}
public void addBleedTrack(Entity entity) {bleedTracker.add(entity);} public void addBleedTrack(Entity entity) {bleedTracker.add(entity);}
public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);} public void addMobSpawnTrack(Entity entity) {mobSpawnTracker.add(entity);}
public void removeMobSpawnTrack(Entity entity) {mobSpawnTracker.remove(entity);}
public ArrayList<Entity> getBleedTracked() {return bleedTracker;} public ArrayList<Entity> getBleedTracked() {return bleedTracker;}
public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);} public void addArrowTrack(Entity entity, Integer arrowcount) {arrowTracker.put(entity, arrowcount);}
public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);} public Integer getArrowCount(Entity entity) {return arrowTracker.get(entity);}

View File

@ -125,6 +125,9 @@ public class mcEntityListener extends EntityListener {
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
Entity x = event.getEntity(); Entity x = event.getEntity();
mcSkills.getInstance().arrowRetrievalCheck(x); mcSkills.getInstance().arrowRetrievalCheck(x);
if(mcConfig.getInstance().isMobSpawnTracked(x)){
mcConfig.getInstance().removeMobSpawnTrack(x);
}
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
if(mcUsers.getProfile(player).isDead()){ if(mcUsers.getProfile(player).isDead()){

View File

@ -33,6 +33,16 @@ public class mcSkills {
} }
} }
} }
public void decreaseCooldowns(Player player){
mcUsers.getProfile(player).decreaseTreeFellerCooldown();
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!");
}
mcUsers.getProfile(player).decreaseSuperBreakerCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!");
}
}
public void XpCheck(Player player){ public void XpCheck(Player player){
/* /*
* ACROBATICS * ACROBATICS

View File

@ -15,58 +15,37 @@ public class mcTimer extends TimerTask{
public void run() { public void run() {
Player[] playerlist = plugin.getServer().getOnlinePlayers(); Player[] playerlist = plugin.getServer().getOnlinePlayers();
/*
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
if(thecount == 10 || thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 500
&& mcUsers.getProfile(player).getPowerLevel() < 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
if(thecount == 20){
for(Player player : playerlist){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() < 500
&& mcUsers.getProfile(player).getRecentlyHurt() == 0
&& mcPermissions.getInstance().regeneration(player)){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
}
for(Player player : playerlist){ for(Player player : playerlist){
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){ if(mcPermissions.getInstance().regeneration(player)){
mcUsers.getProfile(player).decreaseLastHurt(); if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 10 || thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() >= 500
&& mcUsers.getProfile(player).getPowerLevel() < 1000
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(thecount == 20){
if(player != null &&
player.getHealth() > 0 && player.getHealth() < 20
&& mcUsers.getProfile(player).getPowerLevel() < 500
&& mcUsers.getProfile(player).getRecentlyHurt() == 0){
player.setHealth(mcm.getInstance().calculateHealth(player.getHealth(), 1));
}
}
if(player != null && mcUsers.getProfile(player).getRecentlyHurt() >= 1){
mcUsers.getProfile(player).decreaseLastHurt();
}
} }
}
if(thecount < 20){
thecount++;
} else {
thecount = 1;
}
mcCombat.getInstance().bleedSimulate();
*/
/*
* COOLDOWN INTERACTIONS
*/
for(Player player : playerlist){
/* /*
* WOODCUTTING ABILITY * WOODCUTTING ABILITY
*/ */
@ -80,13 +59,6 @@ public class mcTimer extends TimerTask{
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**"); player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
} }
} }
//Monitor the cooldown
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
mcUsers.getProfile(player).decreaseTreeFellerCooldown();
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!");
}
}
} }
/* /*
* MINING ABILITY * MINING ABILITY
@ -101,14 +73,21 @@ public class mcTimer extends TimerTask{
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**"); player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
} }
} }
//Monitor the cooldown
if(!mcUsers.getProfile(player).getSuperBreakerMode() && mcUsers.getProfile(player).getSuperBreakerCooldown() >= 1){
mcUsers.getProfile(player).decreaseSuperBreakerCooldown();
if(mcUsers.getProfile(player).getSuperBreakerCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Super Breaker ability is refreshed!");
}
}
} }
/*
* COOLDOWN MONITORING
*/
if(mcUsers.getProfile(player).hasCooldowns())
mcSkills.getInstance().decreaseCooldowns(player);
} }
if(thecount < 20){
thecount++;
} else {
thecount = 1;
}
/*
* BLEED MONITORING
*/
mcCombat.getInstance().bleedSimulate();
} }
} }

View File

@ -433,6 +433,13 @@ class PlayerList
public void setBleedTicks(Integer newvalue){ public void setBleedTicks(Integer newvalue){
bleedticks = newvalue; bleedticks = newvalue;
} }
public Boolean hasCooldowns(){
if((treefellercooldown + superbreakercooldown) >= 1){
return true;
} else {
return false;
}
}
/* /*
* TREE FELLER STUFF * TREE FELLER STUFF
*/ */

View File

@ -87,6 +87,7 @@ public class mcWoodCutting {
if(!mcConfig.getInstance().isTreeFellerWatched(x)) if(!mcConfig.getInstance().isTreeFellerWatched(x))
mcConfig.getInstance().addTreeFeller(x); mcConfig.getInstance().addTreeFeller(x);
} }
toAdd.clear();
} }
public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){ public void addBlocksToTreeFelling(ArrayList<Block> blocklist, ArrayList<Block> toAdd, Integer radius){
int u = 0; int u = 0;