Changes up to 0.8.1

This commit is contained in:
nossr50 2011-02-25 16:33:00 -08:00
parent 4cf35a317d
commit ab7fe5320a
5 changed files with 55 additions and 31 deletions

View File

@ -43,7 +43,7 @@ public class mcMMO extends JavaPlugin {
*/
//herp
public void onEnable() {
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(1000));
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
//Make the directory if it does not exist
new File(maindirectory).mkdir();
//Make the file if it does not exist

View File

@ -45,24 +45,15 @@ public class mcTimer extends TimerTask{
public void run() {
for(World world : plugin.getServer().getWorlds()){
for(Entity entity : world.getEntities()){
if(entity == null || getHealth(entity) <= 0)
if(entity == null)
return;
if(mcConfig.getInstance().getBleedCount(entity) < 1)
/*
if(!mcConfig.getInstance().isBleedTracked(entity))
return;
if(mcConfig.getInstance().isBleedTracked(entity)){
if(entity instanceof Player){
Player player = (Player)entity;
if(player.getHealth() >= 1){
player.setHealth(calculateMinusHealth(player.getHealth(), 1));
player.sendMessage(ChatColor.RED+"**BLEED**");
if(player.getHealth() <= 0){
for(ItemStack items : player.getInventory().getContents()){
if(items.getTypeId() != 0)
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), items);
}
}
}
}
*/
if(getHealth(entity) <= 0)
return;
/*
if(entity instanceof Animals){
Animals animals = (Animals)entity;
if(animals.getHealth() >= 1){
@ -77,22 +68,28 @@ public class mcTimer extends TimerTask{
if(monster.getHealth() >= 1){
monster.setHealth(calculateMinusHealth(monster.getHealth(), 1));
if(monster.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(entity);
mcm.getInstance().simulateNaturalDrops(entity);
}
}
}
}
}
}
for(World world : plugin.getServer().getWorlds()){
for(Entity entity : world.getEntities()){
if(mcConfig.getInstance().isBleedTracked(entity)){
if(mcConfig.getInstance().getBleedCount(entity) >= 2){
mcConfig.getInstance().removeBleedCount(entity, 1);
} else if(mcConfig.getInstance().getBleedCount(entity) == 1){
mcConfig.getInstance().removeBleedTrack(entity);
*/
if(entity instanceof Player){
Player player = (Player)entity;
if(player.getHealth() >= 1 && mcUsers.getProfile(player).getBleedTicks() >= 1){
player.setHealth(calculateMinusHealth(player.getHealth(), 1));
player.sendMessage(ChatColor.RED+"**BLEED**");
if(player.getHealth() <= 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){
mcUsers.getProfile(player).setBleedTicks(mcUsers.getProfile(player).getBleedTicks() - 1);
}
}
}
}
}
}
if(thecount == 10 || thecount == 20 || thecount == 30 || thecount == 40){

View File

@ -156,7 +156,7 @@ class PlayerList
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead;
private int recentlyhurt = 0;
private int recentlyhurt = 0, bleedticks = 0;
Player thisplayer;
char defaultColor;
@ -421,6 +421,17 @@ class PlayerList
recentlyhurt--;
}
}
public void decreaseBleedTicks(){
if(bleedticks >= 1){
bleedticks--;
}
}
public Integer getBleedTicks(){
return bleedticks;
}
public void setBleedTicks(Integer newvalue){
bleedticks = newvalue;
}
public Integer getRecentlyHurt(){
return recentlyhurt;
}

View File

@ -753,21 +753,37 @@ public class mcm {
if(mcUsers.getProfile(attacker).getSwordsInt() >= 50 && mcUsers.getProfile(attacker).getSwordsInt() < 200){
if(Math.random() * 10 > 8){
mcConfig.getInstance().addBleedTrack(x, 4);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(4);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 200 && mcUsers.getProfile(attacker).getSwordsInt() < 600){
if(Math.random() * 10 > 6){
mcConfig.getInstance().addBleedTrack(x, 4);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(4);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 600 && mcUsers.getProfile(attacker).getSwordsInt() < 900){
if(Math.random() * 10 > 4){
mcConfig.getInstance().addBleedTrack(x, 6);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(6);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
} else if(mcUsers.getProfile(attacker).getSwordsInt() >= 900){
if(Math.random() * 100 > 75){
mcConfig.getInstance().addBleedTrack(x, 6);
if(x instanceof Player){
Player target = (Player)x;
mcUsers.getProfile(target).setBleedTicks(6);
}
attacker.sendMessage(ChatColor.RED+"**Your target is bleeding**");
}
}

View File

@ -1,3 +1,3 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 0.8
version: 0.8.1