Fishing TNT traps should not destroy blocks

This commit is contained in:
TfT_02 2013-10-12 03:30:10 +02:00
parent 800786111c
commit 67e9d9c535
3 changed files with 18 additions and 0 deletions

View File

@ -459,6 +459,22 @@ public class EntityListener implements Listener {
}
}
/**
* Monitor EntityExplode events.
*
* @param event The event to monitor
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEnitityExplodeMonitor(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (!entity.hasMetadata(mcMMO.tntsafeMetadataKey)) {
return;
}
event.blockList().clear();
}
/**
* Handle FoodLevelChange events that involve modifying the event.
*

View File

@ -91,6 +91,7 @@ public class mcMMO extends JavaPlugin {
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
public final static String tntMetadataKey = "mcMMO: Tracked TNT";
public final static String tntsafeMetadataKey = "mcMMO: Safe TNT";
public final static String customNameKey = "mcMMO: Custom Name";
public final static String customVisibleKey = "mcMMO: Name Visibility";
public final static String droppedItemKey = "mcMMO: Tracked Item";

View File

@ -499,6 +499,7 @@ public class FishingManager extends SkillManager {
double magnitude = velocity.length();
fishingCatch.setVelocity(velocity.multiply((magnitude + 1) / magnitude));
tnt.setMetadata(mcMMO.tntsafeMetadataKey, mcMMO.metadataValue);
tnt.setFuseTicks(3 * Misc.TICK_CONVERSION_FACTOR);
}
else {