Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. package me.bowlerguy66.bukkitsandbox;
  2.  
  3. import java.util.HashMap;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.inventory.ItemStack;
  7.  
  8. import net.md_5.bungee.api.ChatColor;
  9.  
  10. public class DropTable {
  11.  
  12. private String name;
  13. private HashMap<ItemStack, Double> table;
  14.  
  15. public DropTable() {
  16.  
  17. this.name = "Default name";
  18. this.table = new HashMap<ItemStack, Double>();
  19.  
  20. }
  21.  
  22. public HashMap<ItemStack, Double> getFinalTable() {
  23.  
  24. if(!isUsable()) {
  25. return null;
  26. }
  27.  
  28. int multiplier = 1;
  29.  
  30. for(ItemStack i : table.keySet()) {
  31.  
  32. double d = table.get(i);
  33.  
  34. if(d < 0.1) {
  35. multiplier = 10;
  36. }
  37.  
  38. if(d < 0.01) {
  39. multiplier = 100;
  40. }
  41.  
  42. if(d < 0.001) {
  43. multiplier = 1000;
  44. }
  45.  
  46. }
  47.  
  48. for() {
  49.  
  50. }
  51.  
  52. }
  53.  
  54. public boolean isUsable() {
  55.  
  56. double total = 0;
  57.  
  58. if(table.isEmpty()) {
  59. return false;
  60. }
  61.  
  62. for(ItemStack i : table.keySet()) {
  63. double d = table.get(i);
  64. total += d;
  65. }
  66.  
  67. if(total == 100) {
  68. return true;
  69. } else if(total > 100) {
  70. Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "The table \"" + name + "\" has a total that is over 100. (" + total + ")");
  71. return false;
  72. } else if(total < 100) {
  73. Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "The table \"" + name + "\" has a total that is below 100. (" + total + ")");
  74. return false;
  75. }
  76.  
  77. return false;
  78.  
  79. }
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement