Minecraft version : 1.8.8 Suggested name : Keep Item What I want: I'd like If Someone Make Me A Plugin ^-^ Its A Keep Item Plugin . So U Can Set A List Of Items In The Config File . Those Items U Won't Lose Them When U Die . When U Respawn U Will Keep Them In Your Inventory . Also Please Make It Compatible With Non Enchanted Items And Enchanted Item ^^ That's All Ideas for commands : Nothing Ideas for permissions : keep.items To keep items after death When I'd like it by : As Soon As You Can . And Thank UUUU
Just had a crazy thought, /gamerule keepInventory true I’ll give it a shot because the only things that set the gamerule and a plug-in apart is the permission node. (After school)
Got it. Easy. Made it with CommandHelper, so its open source and you can edit anything (Messages etc) as you like. Also I didnt use a config file, as i hate fiddling around with these. You can use ingame commands to add/remove items to the keep-list. [Installation] 1) Install Scripting Engine "CommandHelper" (.jar to plugins/): https://builds.enginehub.org/job/commandhelper?branch=master 2) Restart server 3) Remove every script in plugins/CommandHelper/ (main.ms, aliases.msa, auto_include.ms) 4) Copy Script in main.ms: Code: bind('player_death', null, null, @e){ @drops = @e['drops'] @p = @e['player'] if(!has_value("keep_item.items")){ store_value("keep_item.items", array()) } @save_drops = get_value("keep_item.items") @saved_drops = array() foreach(@item in @drops){ @itemname = @item['name'] if(!array_contains(@save_drops, @item['name'])){ continue() } array_push(@saved_drops, @item) } modify_event('drops', null) store_value("keep_item.players.".@p, @saved_drops) } bind('player_spawn', null, null, @e){ @p = @e['player'] if(!has_permission("keep.items")){ die("No permission") } if(!has_value("keep_item.players.".@p)){ die("[KeepItem] No items saved") } @saved_drops = get_value("keep_item.players.".@p) foreach(@item in @saved_drops){ try(msg("[KeepItem] Saved you your item: ".@item['name'])) pgive_item(@p, @item) } clear_value("keep_item.players.".@p) } register_command('keepitem', array( 'permission': 'keep.admin', 'tabcompleter': closure(@a, @p, @args){ return(array("add", "remove", "removeall", "clear_players_saves", "list")) }, "executor": closure(@a, @p, @args){ if(!has_value("keep_item.items")){ store_value("keep_item.items", array()) } @save_drops = get_value("keep_item.items") # /keepitem add if(length(@args) == 1 && @args[0] == "add"){ @item = get_inventory_item(puuid(@p), pheld_slot()) array_push(@save_drops, @item['name']) store_value("keep_item.items", @save_drops) die("[KeepItem] Item added to keep-list: ".@save_drops) } # /keepitem remove if(length(@args) == 1 && @args[0] == "remove"){ @item = get_inventory_item(puuid(@p), pheld_slot()) array_remove_values(@save_drops, @item) store_value("keep_item.items", @save_drops) die("[KeepItem] Item removed from keep-list") } # /keepitem removeall if(length(@args) == 1 && @args[0] == "removeall"){ store_value("keep_item.items", array()) die("[KeepItem] Removed all items from keep-list") } # /keepitem list if(length(@args) == 1 && @args[0] == "list"){ @save_drops = get_value("keep_item.items") die("[KeepItem] All items in keep-list: ".@save_drops) } # /keepitem clear_players_saves Notch if(length(@args) == 2 && @args[0] == "clear_players_saves"){ @player = @args[1] clear_value("keep_item.players.".@player) die("[KeepItem] Removed ".@player."'s drops-list") } } )) 5) Recompile scripts on server: /recompile [Usage] The commands need the 'keep.admin' permission (or OP). /keepitem add -- Adds item you are holding in your hand to the keep-list /keepitem remove -- Removes item you are holding in your hand from the keep-list /keepitem list -- Lists items currently on the keep-list /keepitem removeall -- Clears the whole keep-list /keepitem clear_players_saves <player> -- Clears the players list of items to be saved (actually not needed, maybe for debug)