Misc.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.Location;
  18. import org.bukkit.block.Block;
  19. import org.bukkit.entity.Entity;
  20. import org.bukkit.entity.LivingEntity;
  21. import org.bukkit.entity.Player;
  22. import com.gmail.nossr50.mcMMO;
  23. public class Misc
  24. {
  25. String location = "mcmmo.properties";
  26. protected static final Logger log = Logger.getLogger("Minecraft");
  27. public ArrayList<Integer> mobSpawnerList = new ArrayList<Integer>();
  28. public HashSet<Block> blockWatchList = new HashSet<Block>();
  29. public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
  30. public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
  31. public HashMap<Location, Player> tntTracker = new HashMap<Location, Player>();
  32. mcMMO plugin = null;
  33. //BLEED QUE STUFF
  34. public LivingEntity[] bleedQue = new LivingEntity[20];
  35. public int bleedQuePos = 0;
  36. public LivingEntity[] bleedRemovalQue = new LivingEntity[20];
  37. public int bleedRemovalQuePos = 0;
  38. public Misc(mcMMO mcMMO)
  39. {
  40. plugin = mcMMO;
  41. }
  42. public void addToBleedQue(LivingEntity entity)
  43. {
  44. //Assign entity to empty position
  45. bleedQue[bleedQuePos] = entity;
  46. //Move position up by 1 increment
  47. bleedQuePos++;
  48. //Check if array is full
  49. if(bleedQuePos >= bleedQue.length)
  50. {
  51. //Create new temporary array
  52. LivingEntity[] temp = new LivingEntity[bleedQue.length*2];
  53. //Copy data from bleedQue to temporary array
  54. System.arraycopy(bleedQue, 0, temp, 0, bleedQue.length);
  55. //Point bleedQue to new array
  56. bleedQue = temp;
  57. }
  58. }
  59. public void addToBleedRemovalQue(LivingEntity entity)
  60. {
  61. //Assign entity to empty position
  62. bleedRemovalQue[bleedRemovalQuePos] = entity;
  63. //Move position up by 1 increment
  64. bleedRemovalQuePos++;
  65. //Check if array is full
  66. if(bleedRemovalQuePos >= bleedRemovalQue.length)
  67. {
  68. //Create new temporary array
  69. LivingEntity[] temp = new LivingEntity[bleedRemovalQue.length*2];
  70. //Copy data from bleedRemovalQue to temporary array
  71. System.arraycopy(bleedRemovalQue, 0, temp, 0, bleedRemovalQue.length);
  72. //Point bleedRemovalQue to new array
  73. bleedRemovalQue = temp;
  74. }
  75. }
  76. }