Skip to content

Commit

Permalink
Fixed some bugs in commands (others than /uh).
Browse files Browse the repository at this point in the history
Fixed /life not working at all.
  • Loading branch information
ThePooN committed Mar 4, 2014
1 parent 2ee0206 commit 66b4fe8
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/me/azenet/UHPlugin/UHPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,26 @@ public void run() {
}*/
}
else if(c.getName().equalsIgnoreCase("life")) {
Player p = Bukkit.getPlayer(a[1]);
if(p == null) {
if(a.length > 0) {
int i = 1;
String pseudo = a[0];
while(a.length > i) {
pseudo = pseudo+" "+a[i];
i++;
}
Player p = Bukkit.getPlayer(pseudo);
if(p == null) {
s.sendMessage(ChatColor.RED+"Unknown player");
return true;
}
double life = p.getHealth();
s.sendMessage(ChatColor.GREEN+p.getName()+"'s life is "+life+".");
return true;
}
else {
s.sendMessage(ChatColor.RED+"Usage: /life <player>");
return true;
}
double life = p.getHealth();
s.sendMessage(p.getName()+"'s life is "+life+".");
return true;
}
else if(c.getName().equalsIgnoreCase("cast")) {
if(s.isOp()) {
Expand Down Expand Up @@ -450,14 +462,17 @@ else if(c.getName().equalsIgnoreCase("head")) {
skullMeta.setDisplayName(ChatColor.RESET + pseudo + "'s head");
skull.setItemMeta(skullMeta);
pl.getInventory().addItem(skull);
s.sendMessage(ChatColor.RED+pseudo+"'s head given.");
s.sendMessage(ChatColor.GREEN+pseudo+"'s head given.");
return true;
}
else {
s.sendMessage(ChatColor.RED+"Please.");
return true;
}
}
else {
s.sendMessage(ChatColor.RED+"Lolnope.");
return true;
}
}
return false;
Expand Down

0 comments on commit 66b4fe8

Please sign in to comment.