Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Löschen:
  2.  
  3. public void onJoin(PlayerJoinEvent e) {
  4.        
  5.        
  6.        
  7.         Player p= e.getPlayer();
  8.        
  9.         String playername= p.getName();
  10.  
  11.         File Vill = new File("plugins//Lol//Vill//"+playername+".yml");
  12.     YamlConfiguration vil= YamlConfiguration.loadConfiguration(Vill);  
  13.         Entity villager = (Entity) Bukkit.getWorld("world").getEntitiesByClass(Villager.class);
  14.         String lalo =vil.getString(p.getName());
  15.        
  16.  
  17.  
  18.         String UUidvill=  villager.getUniqueId().toString();
  19.        
  20.         if(UUidvill == lalo) {
  21.             p.sendMessage("loool");
  22.             villager.setCustomName("aaaa");
  23.         villager.remove();
  24. Vill.delete();
  25.     }}
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. Speichern:
  33.  
  34.  
  35. public void onQuit(PlayerQuitEvent e) {
  36.         Player p= e.getPlayer();
  37.        
  38.        
  39.        
  40.        
  41.         String playername= p.getName();
  42.  
  43.    
  44.         File Vill = new File("plugins//Lol//Vill//"+playername+".yml");
  45.        
  46.         Villager person =(Villager) p.getWorld().spawnEntity(p.getLocation(), EntityType.VILLAGER);
  47.         person.setCustomName(p.getName());
  48.        
  49.         YamlConfiguration vil= YamlConfiguration.loadConfiguration(Vill);
  50.  
  51.    
  52.        
  53.         person.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 500000, 200));
  54.    
  55.        
  56.    
  57.        
  58.         if(!Vill.exists()) {
  59.             try {
  60.                 Vill.createNewFile();
  61.             } catch (IOException jh) {
  62.                 // TODO Auto-generated catch block
  63.         p.sendMessage("§4Der angegebene Pfad wurde nicht gefunde!");               }
  64.            
  65.        
  66.  
  67.         vil.createSection("Offline:");
  68.         vil.set(p.getName(), person.getUniqueId().toString());
  69.  
  70.            
  71.  
  72.  
  73.  
  74.         try {
  75.                 vil.save(Vill);
  76.             } catch (IOException jh) {
  77.                 // TODO Auto-generated catch block
  78.             p.sendMessage("§4Pfad wurde nicht gefunden");
  79.             }
  80.        
  81.            
  82.         }
  83.        
  84.        
  85.     }
  86.    
  87.    
  88.     public  void checkOrdner() {
  89.  
  90.         File Offline = new File("plugins//Lol//Offline");
  91.         File Vill = new File("plugins//Lol//Vill");
  92.        
  93.         if(!Offline.exists()) {
  94.             Offline.mkdir();
  95.         }
  96.        
  97.         if(!Vill.exists()) {
  98.             Vill.mkdir();
  99.         }
  100.        
  101.        
  102.     }