Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log hanging entities rather than only paintings. #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion src/main/java/uk/co/oliwali/HawkEye/DataType.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public enum DataType {
ENDERMAN_PLACE(33, BlockChangeEntry.class, "enderman-place", true, true),
TREE_GROW(34, BlockChangeEntry.class, "tree-grow", true, true),
MUSHROOM_GROW(35, BlockChangeEntry.class, "mushroom-grow", true, true),
ENTITY_KILL(36, DataEntry.class, "entity-kill", false, false);
ENTITY_KILL(36, DataEntry.class, "entity-kill", false, false),
HANGING_PLACE(37, DataEntry.class, "hanging-place", true, false),
HANGING_BREAK(38, DataEntry.class, "hanging-break", true, false);

private int id;
private boolean canHere;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
import org.bukkit.block.BlockState;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.painting.PaintingBreakEvent;
import org.bukkit.event.painting.PaintingBreakEvent.RemoveCause;
Expand Down Expand Up @@ -118,6 +123,16 @@ public void onPaintingBreak(PaintingBreakEvent event) {
public void onPaintingPlace(PaintingPlaceEvent event) {
DataManager.addEntry(new DataEntry(event.getPlayer(), DataType.PAINTING_PLACE, event.getPainting().getLocation(), ""));
}

@HawkEvent(dataType = DataType.HANGING_PLACE)
public void onHangingPlace(HangingPlaceEvent event) {
DataManager.addEntry(new DataEntry(event.getPlayer(), DataType.HANGING_PLACE, event.getEntity().getLocation(), event.getEntity().getType().toString()));
}

@HawkEvent(dataType = DataType.HANGING_BREAK)
public void onHangingBreak(HangingBreakByEntityEvent event) {
DataManager.addEntry(new DataEntry((Player)event.getRemover(), DataType.HANGING_BREAK, event.getEntity().getLocation(), event.getEntity().getType().toString()));
}

@HawkEvent(dataType = {DataType.ENDERMAN_PICKUP, DataType.ENDERMAN_PLACE})
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/uk/co/oliwali/HawkEye/util/Permission.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package uk.co.oliwali.HawkEye.util;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;

import org.bukkit.permissions.*;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
Expand All @@ -23,7 +22,6 @@ public class Permission {
private final HawkEye plugin;
private static PermissionPlugin handler = PermissionPlugin.BUKKITPERMS;
private static net.milkbowl.vault.permission.Permission vaultPermissions;
private static PermissionHandler permissionPlugin;
private static PermissionManager permissionsEx;

/**
Expand Down Expand Up @@ -51,11 +49,6 @@ public Permission(HawkEye instance) {
permissionsEx = PermissionsEx.getPermissionManager();
Util.info("Using PermissionsEx for user permissions");
}
else if (pm.isPluginEnabled("Permissions")) {
permissionPlugin = ((Permissions)plugin.getServer().getPluginManager().getPlugin("Permissions")).getHandler();
handler = PermissionPlugin.PERMISSIONS;
Util.info("Using Permissions for user permissions");
}
else {
Util.info("No permission handler detected, defaulting to superperms");
}
Expand All @@ -79,8 +72,6 @@ private static boolean hasPermission(CommandSender sender, String node) {
return vaultPermissions.has(player, node);
case PERMISSIONSEX:
return permissionsEx.has(player, node);
case PERMISSIONS:
return permissionPlugin.has(player, node);
case BUKKITPERMS:
return player.hasPermission(node);
}
Expand Down Expand Up @@ -202,8 +193,6 @@ public static boolean inGroup(String world, String player, String group) {
return vaultPermissions.playerInGroup(world, player, group);
case PERMISSIONSEX:
return permissionsEx.getUser(player).inGroup(group);
case PERMISSIONS:
return permissionPlugin.inGroup(world, player, group);
}
return false;
}
Expand Down