mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Fixed falling sand/gravel stuff not being tracked
This commit is contained in:
parent
23d916f191
commit
5c9371c575
@ -11,6 +11,7 @@ Version 1.3.09
|
|||||||
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
|
= Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
|
||||||
= Fixed bug where you could receive Archery XP from Potions
|
= Fixed bug where you could receive Archery XP from Potions
|
||||||
= Fixed bug with duping blocks via piston pushing
|
= Fixed bug with duping blocks via piston pushing
|
||||||
|
= Fixed bug with falling sand/gravel not being tracked
|
||||||
! Changed Spout settings to be in their own config file (spout.yml)
|
! Changed Spout settings to be in their own config file (spout.yml)
|
||||||
|
|
||||||
Version 1.3.08
|
Version 1.3.08
|
||||||
|
@ -32,6 +32,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -72,6 +73,25 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Monitor BlockPhysics events.
|
||||||
|
*
|
||||||
|
* @param event The event to monitor
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
|
//TODO: Figure out how to REMOVE metadata from the location the sand fell from.
|
||||||
|
Material type = event.getChangedType();
|
||||||
|
|
||||||
|
if (type == Material.GRAVEL || type == Material.SAND) {
|
||||||
|
Block fallenBlock = event.getBlock().getRelative(BlockFace.UP);
|
||||||
|
|
||||||
|
if (fallenBlock.getType() == type) {
|
||||||
|
mcMMO.placeStore.setTrue(fallenBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor BlockPistonRetract events.
|
* Monitor BlockPistonRetract events.
|
||||||
*
|
*
|
||||||
@ -99,21 +119,6 @@ public class BlockListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
int id = block.getTypeId();
|
int id = block.getTypeId();
|
||||||
Material mat = block.getType();
|
|
||||||
|
|
||||||
/* Code to prevent issues with placed falling Sand/Gravel not being tracked */
|
|
||||||
if (mat.equals(Material.SAND) || mat.equals(Material.GRAVEL)) {
|
|
||||||
for (int y = -1; y + block.getY() >= 0; y--) {
|
|
||||||
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Block newLocation = block.getRelative(0, y + 1, 0);
|
|
||||||
mcMMO.placeStore.setTrue(newLocation);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||||
if (BlockChecks.shouldBeWatched(block)) {
|
if (BlockChecks.shouldBeWatched(block)) {
|
||||||
@ -144,6 +149,11 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DEBUG MESSAGES
|
||||||
|
if (!mcMMO.placeStore.isTrue(block) && BlockChecks.shouldBeWatched(block)) {
|
||||||
|
player.sendMessage("Why aren't you watching me?");
|
||||||
|
}
|
||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
if (BlockChecks.canBeGreenTerra(block)) {
|
if (BlockChecks.canBeGreenTerra(block)) {
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
|
Loading…
Reference in New Issue
Block a user