mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-04 05:25:28 +02:00
Condensing entity tracking into a single set of storage, to reduce CPU use. Also handily causes invalid falling blocks to be removed. (Fell out of the world, etc)
This commit is contained in:
@@ -97,7 +97,6 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
private HashMap<String, String> aliasMap = new HashMap<String, String>(); //Alias - Command
|
||||
private HashMap<Integer, String> tntTracker = new HashMap<Integer, String>();
|
||||
private HashMap<Integer, Block> fallingBlockTracker = new HashMap<Integer, Block>();
|
||||
|
||||
private static Database database;
|
||||
public static mcMMO p;
|
||||
@@ -521,44 +520,6 @@ public class mcMMO extends JavaPlugin {
|
||||
tntTracker.remove(tntID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an ID value to the FallingBlock tracker.
|
||||
*
|
||||
* @param fallingBlockID The EntityID of the FallingBlock
|
||||
*/
|
||||
public void addToFallingBlockTracker(int fallingBlockID, Block sourceBlock) {
|
||||
fallingBlockTracker.put(fallingBlockID, sourceBlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a given FallingBlock Entity is tracked.
|
||||
*
|
||||
* @param tntID The EntityID of the FallingBlock
|
||||
* @return true if the FallingBlock is being tracked, false otherwise
|
||||
*/
|
||||
public boolean fallingBlockIsTracked(int fallingBlockID) {
|
||||
return fallingBlockTracker.containsKey(fallingBlockID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the initial location of the FallingBlock.
|
||||
*
|
||||
* @param fallingBlockID The EntityID of the FallingBlock
|
||||
* @return the Player who detonated it
|
||||
*/
|
||||
public Block getSourceBlock(int fallingBlockID) {
|
||||
return fallingBlockTracker.get(fallingBlockID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove FallingBlock from the tracker after it lands.
|
||||
*
|
||||
* @param fallingBlockID The EntityID of the FallingBlock
|
||||
*/
|
||||
public void removeFromFallingBlockTracker(int fallingBlockID) {
|
||||
fallingBlockTracker.remove(fallingBlockID);
|
||||
}
|
||||
|
||||
public static String getMainDirectory() {
|
||||
return mainDirectory;
|
||||
}
|
||||
|
Reference in New Issue
Block a user