mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Changes up to 0.8.1
This commit is contained in:
parent
4cf35a317d
commit
ab7fe5320a
@ -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
|
||||
|
@ -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){
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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**");
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 0.8
|
||||
version: 0.8.1
|
Loading…
Reference in New Issue
Block a user