Advertisement
Guest User

Project.java

a guest
Sep 1st, 2014
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. package com.bwfcwalshy.kickstarter;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5. import java.util.UUID;
  6. import org.bukkit.configuration.file.FileConfiguration;
  7.  
  8. public class Project
  9. {
  10.   private Kickstarter plugin;
  11.   private UUID owner;
  12.   private String name;
  13.   private double target;
  14.   private double collected;
  15.   private Map<String, Double> funders;
  16.  
  17.   public Project(Kickstarter instance, UUID owner, String name, double target, double collected)
  18.   {
  19.     this.plugin = instance;
  20.    
  21.     this.owner = owner;
  22.     this.name = name;
  23.     this.target = target;
  24.     this.collected = collected;
  25.    
  26.     this.funders = new HashMap();
  27.     loadFunders();
  28.   }
  29.  
  30.   private void loadFunders()
  31.   {
  32.     if (this.plugin.getConfiguration().contains(getOwner().toString() + ".funders")) {
  33.       for (String s : this.plugin.getConfiguration().getStringList(getOwner().toString() + ".funders"))
  34.       {
  35.         String[] r = s.split(":");
  36.         String n = r[0];
  37.         double k = 0.0D;
  38.         try
  39.         {
  40.           k = Double.parseDouble(r[1]);
  41.         }
  42.         catch (NumberFormatException ex)
  43.         {
  44.           ex.printStackTrace();
  45.           return;
  46.         }
  47.         this.funders.put(n, Double.valueOf(k));
  48.       }
  49.     }
  50.   }
  51.  
  52.   public void addFunder(String name, double amount)
  53.   {
  54.     this.funders.put(name, Double.valueOf(amount));
  55.   }
  56.  
  57.   public Map<String, Double> getFunders()
  58.   {
  59.     return this.funders;
  60.   }
  61.  
  62.   public UUID getOwner()
  63.   {
  64.     return this.owner;
  65.   }
  66.  
  67.   public String getName()
  68.   {
  69.     return this.name;
  70.   }
  71.  
  72.   public double getTarget()
  73.   {
  74.     return this.target;
  75.   }
  76.  
  77.   public void addToCollected(double amount)
  78.   {
  79.     this.collected += amount;
  80.   }
  81.  
  82.   public double getCollected()
  83.   {
  84.     return this.collected;
  85.   }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement