Fix issue with tracking falling sand & gravel.

This commit is contained in:
GJ
2013-01-17 23:26:18 -05:00
parent 2f16dbc9b5
commit db1c0647ed
4 changed files with 65 additions and 60 deletions

View File

@@ -9,6 +9,7 @@ import java.util.List;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
@@ -96,6 +97,7 @@ 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;
@@ -519,6 +521,44 @@ 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;
}