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 //herp
public void onEnable() { 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 //Make the directory if it does not exist
new File(maindirectory).mkdir(); new File(maindirectory).mkdir();
//Make the file if it does not exist //Make the file if it does not exist

View File

@ -45,24 +45,15 @@ public class mcTimer extends TimerTask{
public void run() { public void run() {
for(World world : plugin.getServer().getWorlds()){ for(World world : plugin.getServer().getWorlds()){
for(Entity entity : world.getEntities()){ for(Entity entity : world.getEntities()){
if(entity == null || getHealth(entity) <= 0) if(entity == null)
return; return;
if(mcConfig.getInstance().getBleedCount(entity) < 1) /*
if(!mcConfig.getInstance().isBleedTracked(entity))
return; return;
if(mcConfig.getInstance().isBleedTracked(entity)){ */
if(entity instanceof Player){ if(getHealth(entity) <= 0)
Player player = (Player)entity; return;
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(entity instanceof Animals){ if(entity instanceof Animals){
Animals animals = (Animals)entity; Animals animals = (Animals)entity;
if(animals.getHealth() >= 1){ if(animals.getHealth() >= 1){
@ -81,16 +72,22 @@ public class mcTimer extends TimerTask{
} }
} }
} }
*/
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);
} }
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);
} }
} }
} }

View File

@ -156,7 +156,7 @@ class PlayerList
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; private boolean dead;
private int recentlyhurt = 0; private int recentlyhurt = 0, bleedticks = 0;
Player thisplayer; Player thisplayer;
char defaultColor; char defaultColor;
@ -421,6 +421,17 @@ class PlayerList
recentlyhurt--; recentlyhurt--;
} }
} }
public void decreaseBleedTicks(){
if(bleedticks >= 1){
bleedticks--;
}
}
public Integer getBleedTicks(){
return bleedticks;
}
public void setBleedTicks(Integer newvalue){
bleedticks = newvalue;
}
public Integer getRecentlyHurt(){ public Integer getRecentlyHurt(){
return recentlyhurt; return recentlyhurt;
} }

View File

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

View File

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