mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-19 10:22:58 +01:00
Cleanup & a few memory leak fixes.
This commit is contained in:
@@ -10,7 +10,7 @@ public class BlockChecks {
|
||||
/**
|
||||
* Checks to see if a block type awards XP.
|
||||
*
|
||||
* @param material {@link Block} type to check
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block type awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Material material) {
|
||||
@@ -58,7 +58,7 @@ public class BlockChecks {
|
||||
/**
|
||||
* Check if a block should allow for the activation of abilities.
|
||||
*
|
||||
* @param material Type of {@link Block} to check
|
||||
* @param material The type of Block to check
|
||||
* @return true if the block should allow ability activation, false otherwise
|
||||
*/
|
||||
public static boolean abilityBlockCheck(Material material) {
|
||||
@@ -99,7 +99,7 @@ public class BlockChecks {
|
||||
/**
|
||||
* Check if a block type is an ore.
|
||||
*
|
||||
* @param material The type of {@link Block} to check
|
||||
* @param material The type of Block to check
|
||||
* @return true if the Block is an ore, false otherwise
|
||||
*/
|
||||
public static boolean isOre(Material material) {
|
||||
@@ -117,4 +117,45 @@ public class BlockChecks {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the block the the appropriate watchlist.
|
||||
*
|
||||
* @param material the type of Block to watch
|
||||
* @param block the Block to watch
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void watchBlock(Material material, Block block, mcMMO plugin) {
|
||||
|
||||
boolean addToChangeQueue = true;
|
||||
|
||||
switch (material) {
|
||||
case CACTUS:
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case JACK_O_LANTERN:
|
||||
case LOG:
|
||||
case PUMPKIN:
|
||||
case REDSTONE_ORE:
|
||||
case SUGAR_CANE_BLOCK:
|
||||
case VINE:
|
||||
addToChangeQueue = false; //We don't want these added to changeQueue - these use their data
|
||||
plugin.misc.blockWatchList.add(block);
|
||||
break;
|
||||
|
||||
case BROWN_MUSHROOM:
|
||||
case RED_MUSHROOM:
|
||||
case RED_ROSE:
|
||||
case YELLOW_FLOWER:
|
||||
case WATER_LILY:
|
||||
addToChangeQueue = false; //We don't want these added to chaneQueue - they're already being added to the fast queue
|
||||
plugin.fastChangeQueue.push(block);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(addToChangeQueue)
|
||||
plugin.changeQueue.push(block);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user