Misc.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. This file is part of mcMMO.
  3. mcMMO is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. mcMMO is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. package com.gmail.nossr50.config;
  15. import java.util.*;
  16. import java.util.logging.Logger;
  17. import org.bukkit.block.Block;
  18. import org.bukkit.entity.Entity;
  19. import org.bukkit.entity.LivingEntity;
  20. import com.gmail.nossr50.mcMMO;
  21. public class Misc
  22. {
  23. String location = "mcmmo.properties";
  24. protected static final Logger log = Logger.getLogger("Minecraft");
  25. public ArrayList<Entity> mobSpawnerList = new ArrayList<Entity>();
  26. public ArrayList<Block> blockWatchList = new ArrayList<Block>();
  27. public ArrayList<Block> treeFeller = new ArrayList<Block>();
  28. public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
  29. public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
  30. mcMMO plugin = null;
  31. //BLEED QUE STUFF
  32. public LivingEntity[] bleedQue = new LivingEntity[20];
  33. public int bleedQuePos = 0;
  34. public LivingEntity[] bleedRemovalQue = new LivingEntity[20];
  35. public int bleedRemovalQuePos = 0;
  36. public Misc(mcMMO mcMMO)
  37. {
  38. plugin = mcMMO;
  39. }
  40. public void addToBleedQue(LivingEntity entity)
  41. {
  42. //Assign entity to empty position
  43. bleedQue[bleedQuePos] = entity;
  44. //Move position up by 1 increment
  45. bleedQuePos++;
  46. //Check if array is full
  47. if(bleedQuePos >= bleedQue.length)
  48. {
  49. //Create new temporary array
  50. LivingEntity[] temp = new LivingEntity[bleedQue.length*2];
  51. //Copy data from bleedQue to temporary array
  52. System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length);
  53. //Point bleedQue to new array
  54. bleedQue = temp;
  55. }
  56. }
  57. public void addToBleedRemovalQue(LivingEntity entity)
  58. {
  59. //Assign entity to empty position
  60. bleedRemovalQue[bleedRemovalQuePos] = entity;
  61. //Move position up by 1 increment
  62. bleedRemovalQuePos++;
  63. //Check if array is full
  64. if(bleedRemovalQuePos >= bleedRemovalQue.length)
  65. {
  66. //Create new temporary array
  67. LivingEntity[] temp = new LivingEntity[bleedRemovalQue.length*2];
  68. //Copy data from bleedRemovalQue to temporary array
  69. System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length);
  70. //Point bleedRemovalQue to new array
  71. bleedRemovalQue = temp;
  72. }
  73. }
  74. }