Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ log:
worldedit-break: false
crop-trample: true
block-ignite: false
sheep-eat: true
general:
max-lines: 0
log-item-drops-on-death: false
Expand Down
1 change: 1 addition & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ permissions:
hawkeye.search.tree-grow: true
hawkeye.search.mushroom-grow: true
hawkeye.search.entity-kill: true
hawkeye.search.sheep-eat: true
5 changes: 3 additions & 2 deletions src/uk/co/oliwali/HawkEye/DataType.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author oliverw92
*/
public enum DataType {

BLOCK_BREAK(0, BlockEntry.class, "block-break", true, true),
BLOCK_PLACE(1, BlockChangeEntry.class, "block-place", true, true),
SIGN_PLACE(2, SignEntry.class, "sign-place", true, true),
Expand Down Expand Up @@ -64,7 +64,8 @@ public enum DataType {
WORLDEDIT_BREAK(42, BlockEntry.class, "worldedit-break", true, true),
WORLDEDIT_PLACE(43, BlockChangeEntry.class, "worldedit-place", true, true),
CROP_TRAMPLE(44, BlockEntry.class, "crop-trample", true, true),
BLOCK_IGNITE(45, SimpleRollbackEntry.class, "block-ignite", true, true);
BLOCK_IGNITE(45, SimpleRollbackEntry.class, "block-ignite", true, true),
SHEEP_EAT(46, BlockChangeEntry.class, "sheep-eat", true, true);

private int id;
private boolean canHere;
Expand Down
2 changes: 1 addition & 1 deletion src/uk/co/oliwali/HawkEye/SearchParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,4 @@ public void parseLocations() {

}

}
}
20 changes: 18 additions & 2 deletions src/uk/co/oliwali/HawkEye/listeners/MonitorEntityListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Silverfish;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
Expand Down Expand Up @@ -194,11 +195,11 @@ public void onHangingPlace(HangingPlaceEvent event) {

@HawkEvent(dataType = {DataType.ENDERMAN_PICKUP, DataType.ENDERMAN_PLACE})
public void onEntityChangeBlock(EntityChangeBlockEvent event) {

if (!(event.getEntity() instanceof Enderman)) return;

Block block = event.getBlock();

// Enderman picking up block
if (event.getTo() == Material.AIR && Config.isLogged(DataType.ENDERMAN_PICKUP)) {
if (block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)
Expand All @@ -218,4 +219,19 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
DataManager.addEntry(new BlockChangeEntry("Environment", DataType.ENDERMAN_PLACE, block.getLocation(), block.getState(), newState));
}
}

@HawkEvent(dataType = {DataType.SHEEP_EAT})
public void onEntityEatBlock(EntityChangeBlockEvent event) {

if (!(event.getEntity() instanceof Sheep)) return;

Block block = event.getBlock();

// Enderman picking up block
if (Config.isLogged(DataType.SHEEP_EAT) && event.getTo() == Material.DIRT && block.getType() == Material.GRASS) {
BlockState newState =block.getState();
newState.setType(Material.DIRT);
DataManager.addEntry(new BlockChangeEntry("Environment", DataType.SHEEP_EAT, block.getLocation(), block.getState(), newState));
}
}
}