Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (!(sender instanceof Player)) {
- sender.sendMessage("inventoryRestore > This Plugin Cannot Be Run Through Console");
- return true;
- }
- // if (sender instanceof Player && !(sender.hasPermission("irestore.use"))) {
- // System.out.println(sender.getName() + " tried running inventoryRestore");
- // }
- Player p = (Player) sender;
- if (p.hasPermission("irestore.use") && player_died == false) {
- p.sendMessage(Utils.chat("&cinventoryRestore &f> Command Can Only Be Used Once Every &nDeath"));
- return true;
- }
- else if (p.hasPermission("irestore.use") && player_died == true) {
- for (ItemStack drop : playerDrops) { //playerDrops is a ItemStack list that contains all dropped items of a player on their death
- p.getInventory().addItem(drop);
- }
- player_died = false; //player_died is a boolean, stops the player from abusing the command
- return true;
- }
- else {
- p.sendMessage(Utils.chat("&cinventoryRestore &f> Insufficient Perms"));
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement