Add healthbar changes for PlayerBuffData.
This commit is contained in:
parent
8291b4a690
commit
c4108da16d
@ -53,6 +53,40 @@ public class PlayerBuffData {
|
|||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String healthbar(double curHP,double maxHP,int hunger) {
|
||||||
|
//笆<EFBFBD>笆<EFBFBD>
|
||||||
|
int bits=(int)(Math.ceil(curHP/maxHP*10));
|
||||||
|
String bar=" ";
|
||||||
|
if (hunger==20) {
|
||||||
|
if (bits>6) {
|
||||||
|
bar+=ChatColor.GREEN+"";
|
||||||
|
} else
|
||||||
|
if (bits>3) {
|
||||||
|
bar+=ChatColor.YELLOW+"";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
bar+=ChatColor.RED+"";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bits>6) {
|
||||||
|
bar+=ChatColor.DARK_GREEN+"";
|
||||||
|
} else
|
||||||
|
if (bits>3) {
|
||||||
|
bar+=ChatColor.GOLD+"";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
bar+=ChatColor.DARK_RED+"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i=0;i<bits/2;i++) {
|
||||||
|
bar+=Character.toString((char)0x2588);
|
||||||
|
}
|
||||||
|
if (bits%2!=0) {
|
||||||
|
bar+=Character.toString((char)0x258C);
|
||||||
|
}
|
||||||
|
return bar;
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerBuffData(Player p, Main thisplugin) {
|
public PlayerBuffData(Player p, Main thisplugin) {
|
||||||
this.p=p;
|
this.p=p;
|
||||||
this.base_spdlv=0;
|
this.base_spdlv=0;
|
||||||
@ -232,7 +266,7 @@ public class PlayerBuffData {
|
|||||||
}
|
}
|
||||||
money_gained=0;
|
money_gained=0;
|
||||||
}
|
}
|
||||||
p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth()));
|
p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user