Advertisement
Guest User

Untitled

a guest
Mar 31st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  2. if (!(sender instanceof Player)) {
  3. sender.sendMessage("inventoryRestore > This Plugin Cannot Be Run Through Console");
  4. return true;
  5. }
  6. // if (sender instanceof Player && !(sender.hasPermission("irestore.use"))) {
  7. // System.out.println(sender.getName() + " tried running inventoryRestore");
  8. // }
  9. Player p = (Player) sender;
  10. if (p.hasPermission("irestore.use") && player_died == false) {
  11. p.sendMessage(Utils.chat("&cinventoryRestore &f> Command Can Only Be Used Once Every &nDeath"));
  12. return true;
  13. }
  14. else if (p.hasPermission("irestore.use") && player_died == true) {
  15. for (ItemStack drop : playerDrops) { //playerDrops is a ItemStack list that contains all dropped items of a player on their death
  16. p.getInventory().addItem(drop);
  17. }
  18. player_died = false; //player_died is a boolean, stops the player from abusing the command
  19. return true;
  20. }
  21. else {
  22. p.sendMessage(Utils.chat("&cinventoryRestore &f> Insufficient Perms"));
  23. }
  24. return false;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement