Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. @SubscribeEvent
  2.     public void onEntityJoinWorld(PlayerEvent.PlayerLoggedInEvent event) {
  3.  
  4.         String player = event.player.getDisplayName();
  5.        
  6.             File ficheJoueur = new File("Heimnor/Joueurs.dat");
  7.             System.out.println("test");
  8.             File fiche = new File("Heimnor/Fiches.dat");
  9.  
  10.             try {
  11.                 if (!ficheJoueur.exists()) {
  12.  
  13.                     ficheJoueur.getParentFile().mkdirs();
  14.                     ficheJoueur.createNewFile();
  15.                     NBTTagCompound indextag = new NBTTagCompound();
  16.                     NBTTagCompound compound = new NBTTagCompound();
  17.                     indextag.setTag(player, compound);
  18.                     NbtCsFile.setNbtTagCompound(ficheJoueur, "index", indextag);
  19.                 }
  20.             } catch (IOException e) {
  21.                 e.printStackTrace();
  22.             }
  23.  
  24.             if (!fiche.exists()) {
  25.                 try {
  26.                     fiche.createNewFile();
  27.                     NbtCsFile.setNbtTagCompound(fiche, "index", new NBTTagCompound());
  28.                 } catch (IOException e) {
  29.                     e.printStackTrace();
  30.                 }
  31.             }
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement