Skip to content

Commit

Permalink
Added command /uh resurrect <player>
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryCarrade committed Jul 10, 2014
1 parent 56ac602 commit c0ee451
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 44 deletions.
Empty file modified .gitignore
100755 → 100644
Empty file.
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
8 changes: 4 additions & 4 deletions TODO
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
[OK] /uh team addplayer <joueur> <équipe>
→ (ajoute un joueur dans une équipe ET le retire de toutes les autres)
[OK] /uh team removeplayer <joueur>
/uh heal <joueur> <nombre de cœurs=20>
/uh hellall <cœurs>
/uh resurrect <player>
[OK] /uh heal <joueur> <nombre de demi-cœurs=20>
[OK] /uh hellall <cœurs>
[OK] /uh resurrect <player>
/uh tpback <player>
- Désactiver le spawn de mobs nocifs avant le début de la partie
- Ajouter un mode de démarrage progressif :
Expand All @@ -28,7 +28,7 @@
- Ne pas couper le titre du jeu (actuellement coupé à 16 caractères) si possible.
- [OK] Corriger le bug d'arrondi des cœurs.
- [OK] Remplacer « team » par « équipe ». PARTOUT.
- Ne pas perdre de la faim avant le début du jeu.
- [OK] Ne pas perdre de la faim avant le début du jeu.
- Les OPs peuvent placer des blocs même avant le début
- [PARTIAL] Commenter le code
- [ALMOST DONE] Réorganiser le code
35 changes: 0 additions & 35 deletions TODO~

This file was deleted.

Empty file modified config.yml
100755 → 100644
Empty file.
Empty file modified plugin.yml
100755 → 100644
Empty file.
20 changes: 19 additions & 1 deletion src/me/azenet/UHPlugin/UHGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,25 @@ public void shiftEpisode() {
}



/**
* Resurrect a player
*
* @param player
* @return true if the player was dead, false otherwise.
*/
public boolean resurrect(Player player) {
if(!this.isPlayerDead(player.getName())) {
return false;
}

this.alivePlayers.add(player.getName());
this.updateAliveCounters();
this.updatePlayerListName(player);

this.p.getServer().broadcastMessage(ChatColor.GOLD + player.getName() + " returned from the dead!");

return true;
}



Expand Down
Empty file modified src/me/azenet/UHPlugin/UHPlugin.java
100755 → 100644
Empty file.
40 changes: 38 additions & 2 deletions src/me/azenet/UHPlugin/UHPluginCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ else if(args[0].equalsIgnoreCase("healall")) {
doHealAll(sender, command, label, args);
return true;
}
else if(args[0].equalsIgnoreCase("resurrect")) {
doResurrect(sender, command, label, args);
return true;
}

else {
help(sender, true);
Expand Down Expand Up @@ -91,8 +95,9 @@ private void help(CommandSender sender, boolean error) {
sender.sendMessage(ChatColor.GRAY + "------ Bugs-related commands ------");
sender.sendMessage(cc + "/uh heal <player> [half-hearts=20] " + ci + ": heals a player to the number of half-hearts provided, or to 20 without the last argument.");
sender.sendMessage(cc + "/uh healall [half-hearts=20] " + ci + ": heals all players instead of only one.");

sender.sendMessage(ChatColor.DARK_GRAY + "Tip: you can put one coordinate per line, following the format “x,y” in a “plugins/UHPlugin/positions.txt” file instead of using /uh addspawn each time.");
sender.sendMessage(cc + "/uh resurrect <player> " + ci + ": resurrects a player.");
sender.sendMessage("");
sender.sendMessage(ChatColor.GRAY + "Tip: you can put one coordinate per line, following the format “x,y” in a “plugins/UHPlugin/positions.txt” file instead of using /uh addspawn each time.");
}

/**
Expand Down Expand Up @@ -498,4 +503,35 @@ private void doHealAll(CommandSender sender, Command command, String label, Stri
}
}


/**
* This command resurrect a player.
* Usage: /uh resurrect <player>
*
* @param sender
* @param command
* @param label
* @param args
*/
private void doResurrect(CommandSender sender, Command command, String label, String[] args) {
if(!isAllowed(sender, "resurrect")) {
unauthorized(sender, command);
return;
}

if(args.length != 2) {
sender.sendMessage(ce + "Usage: /uh resurrect <player>");
return;
}

Player player = p.getServer().getPlayer(args[1]);
if(player == null) {
sender.sendMessage(ce + "The player " + args[1] + " is not online.");
return;
}

p.getGameManager().resurrect(player);

}

}
5 changes: 3 additions & 2 deletions src/me/azenet/UHPlugin/UHPluginListener.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.FoodLevelChangeEvent;
Expand Down Expand Up @@ -337,7 +336,9 @@ public void onEntityDeath(EntityDeathEvent ev) {


/**
* Used to update the scoreboard.
* Used to:
* - update the scoreboard;
* - disable any damages if the game has not started.
*
* @param ev
*/
Expand Down
Empty file modified src/me/azenet/UHPlugin/UHTeam.java
100755 → 100644
Empty file.

0 comments on commit c0ee451

Please sign in to comment.