mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-06 07:21:27 +01:00
Fixed spelling error in /god and allowed use of /god on others.
This commit is contained in:
parent
c62c5f5cae
commit
e42be555b1
@ -307,12 +307,36 @@ public boolean onCommand(Player player, String[] split) {
|
|||||||
return true;
|
return true;
|
||||||
} else if (split[0].equalsIgnoreCase("/god")
|
} else if (split[0].equalsIgnoreCase("/god")
|
||||||
&& player.canUseCommand("/god")) {
|
&& player.canUseCommand("/god")) {
|
||||||
if (!invinciblePlayers.contains(player.getName())) {
|
// Allow setting other people invincible
|
||||||
invinciblePlayers.add(player.getName());
|
if (split.length > 1) {
|
||||||
player.sendMessage(Colors.Yellow + "You are now invicible!");
|
if (!player.canUseCommand("/godother")) {
|
||||||
|
player.sendMessage(Colors.Rose + "You don't have permission to make others invincible.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player other = etc.getServer().matchPlayer(split[1]);
|
||||||
|
if (other == null) {
|
||||||
|
player.sendMessage(Colors.Rose + "Player not found.");
|
||||||
|
} else {
|
||||||
|
if (!invinciblePlayers.contains(other.getName())) {
|
||||||
|
invinciblePlayers.add(other.getName());
|
||||||
|
player.sendMessage(Colors.Yellow + other.getName() + " is now invincible!");
|
||||||
|
other.sendMessage(Colors.Yellow + player.getName() + " has made you invincible!");
|
||||||
|
} else {
|
||||||
|
invinciblePlayers.remove(other.getName());
|
||||||
|
player.sendMessage(Colors.Yellow + other.getName() + " is no longer invincible.");
|
||||||
|
other.sendMessage(Colors.Yellow + player.getName() + " has taken away your invincibility.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Invincibility for one's self
|
||||||
} else {
|
} else {
|
||||||
invinciblePlayers.remove(player.getName());
|
if (!invinciblePlayers.contains(player.getName())) {
|
||||||
player.sendMessage(Colors.Yellow + "You are no longer invicible.");
|
invinciblePlayers.add(player.getName());
|
||||||
|
player.sendMessage(Colors.Yellow + "You are now invincible!");
|
||||||
|
} else {
|
||||||
|
invinciblePlayers.remove(player.getName());
|
||||||
|
player.sendMessage(Colors.Yellow + "You are no longer invincible.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user