SHARE
TWEET

Untitled

a guest Oct 17th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.mcme.mcmeproject.data;
  2.  
  3. import com.mcmiddleearth.pluginutil.region.Region;
  4. import java.io.File;
  5. import java.io.IOException;
  6. import static java.lang.Integer.parseInt;
  7. import java.util.Calendar;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.UUID;
  12. import lombok.Getter;
  13. import org.bukkit.Location;
  14. import org.bukkit.configuration.ConfigurationSection;
  15. import org.bukkit.configuration.file.YamlConfiguration;
  16.  
  17. /**
  18.  *
  19.  * @author Fraspace5
  20.  */
  21. public class ProjectData {
  22.  
  23.     @Getter
  24.     public String name;
  25.  
  26.     public String description;
  27.  
  28.     public Double minutes;
  29.  
  30.     public UUID head;  
  31.    
  32.     public Long updated;
  33.  
  34.     public Long time;
  35.  
  36.     public Double percentage;
  37.    
  38.     public String link;
  39.  
  40.     protected List<Region> region;
  41.  
  42.     protected HashMap<String,Location> warp;
  43.  
  44.     public List<String> people;
  45.    
  46.     public List<String> managers;
  47.  
  48.     public ProjectData(ConfigurationSection config) {
  49.  
  50.         if (config.contains("name")) {
  51.             name =((String) config.get("name"));
  52.             description = (String) config.get("description");
  53.             minutes =((Double) config.getDouble("minutes"));
  54.             head =((UUID) config.get("head"));
  55.             time = ((Long) config.getLong("time"));
  56.             percentage = ((Double) config.getDouble("percentage"));
  57.             link = ((String) config.get("link"));
  58.             people = ((List<String>) config.getList("people"));
  59.             managers = ((List<String>) config.getList("managers"));
  60.             updated = ((Long) config.getLong("updated"));
  61.            
  62.         }
  63.  
  64.     }
  65.  
  66.     public void save(File file) throws IOException {
  67.  
  68.         YamlConfiguration config = new YamlConfiguration();
  69.  
  70.         config.set("minutes", minutes);
  71.         config.set("name", name);
  72.         config.set("managers", managers);
  73.         config.set("head", head);
  74.         config.set("time", time);
  75.         config.set("percentage", percentage);
  76.         config.set("link", link);
  77.         config.set("people",people);
  78.         config.set("updated", updated);
  79.        
  80.         ConfigurationSection regionSection = config.createSection("regions");
  81.         for (Region regions : region){
  82.        
  83.         regions.save(regionSection);
  84.        
  85.        
  86.         }
  87.    
  88.         config.save(file);
  89.     }
  90.    
  91.      public Location getLocation(Integer i) {
  92.         return region.get(i).getLocation();
  93.     }
  94.    
  95.    
  96.     public boolean isInside(Location loc,Integer i) {
  97.        
  98.      return region.get(i).isInside(loc);
  99.        
  100.        
  101.     }
  102.  
  103. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top