Advertisement
SimonBHB

sav/load

Aug 30th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.92 KB | None | 0 0
  1.                             FileConfig conf = FileConfig.getS("AnimationLoader");
  2.                             try {
  3.                                 if(!conf.getConfig().getNode(animationloader).isVirtual()) {
  4.                                     conf.getConfig().removeChild(animationloader);
  5.                                     player.sendMessage(Text.of("Item enlevé de la conf!"));
  6.                                 } else {
  7.                                     player.sendMessage(Text.of("Item sauvegardé en conf!"));
  8.                                     conf.getConfig().getNode(animationloader).setValue(new TypeToken<ItemStack>() {}, hand);
  9.                                 }
  10.                             } catch (ObjectMappingException e) {
  11.                                 e.printStackTrace();
  12.                             }
  13.                             conf.save();
  14.  
  15.  
  16. ...
  17.  
  18.                         FileConfig conf = FileConfig.getS("AnimationLoader");
  19.                         for (Map.Entry<Object, ? extends ConfigurationNode> entry : conf.getConfig().getChildrenMap().entrySet()) {
  20.                             String key = (String) entry.getKey();
  21.                             ItemStack itemStackConf = null;
  22.                             try {
  23.                                 itemStackConf = entry.getValue().getValue(new TypeToken<ItemStack>() {});
  24.                                 Tool.getLogger().info(itemStackConf.toContainer().toString());
  25.  
  26.                                 if(itemStackConf.get(ToolKeys.INVENTORY).isPresent()) {
  27.                                     Tool.getLogger().info("INVENTORY!!!");
  28.                                 } else {
  29.                                     Tool.getLogger().info("!INVENTORY ");
  30.                                 }
  31.                             } catch (ObjectMappingException e) {
  32.                                 e.printStackTrace();
  33.                             }
  34.                         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement