forked from LogBlock/LogBlock
@ -28,7 +28,8 @@ public class EntityChange implements LookupCacheElement {
|
||||
KILL,
|
||||
MODIFY,
|
||||
ADDEQUIP,
|
||||
REMOVEEQUIP;
|
||||
REMOVEEQUIP,
|
||||
GET_STUNG;
|
||||
|
||||
private static EntityChangeType[] values = values();
|
||||
|
||||
@ -113,6 +114,8 @@ public class EntityChange implements LookupCacheElement {
|
||||
}
|
||||
} else if (changeType == EntityChangeType.MODIFY) {
|
||||
msg.addExtra(createTextComponentWithColor("modified ", INTERACT.getColor()));
|
||||
} else if (changeType == EntityChangeType.GET_STUNG) {
|
||||
msg.addExtra(createTextComponentWithColor("got stung by ", DESTROY.getColor()));
|
||||
} else {
|
||||
msg.addExtra(createTextComponentWithColor("did an unknown action to ", INTERACT.getColor()));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import org.bukkit.block.data.type.TechnicalPiston.Type;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
@ -324,6 +325,12 @@ public class WorldEditor implements Runnable {
|
||||
}
|
||||
}
|
||||
return PerformResult.NO_ACTION; // the entity is not there, or equip does not match
|
||||
} else if (changeType == EntityChangeType.GET_STUNG) {
|
||||
UUID uuid = getReplacedUUID(entityId, entityUUID);
|
||||
Entity existing = BukkitUtils.loadEntityAround(loc.getChunk(), uuid);
|
||||
if (existing != null && existing instanceof Bee) {
|
||||
((Bee) existing).setHasStung(!rollback);
|
||||
}
|
||||
}
|
||||
return PerformResult.NO_ACTION;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
@ -226,6 +227,17 @@ public class AdvancedEntityLogging extends LoggingListener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity damager = event.getDamager();
|
||||
if (damager instanceof Bee && !((Bee) damager).hasStung()) {
|
||||
if (Config.isLogging(damager.getWorld(), EntityLogging.MODIFY, damager)) {
|
||||
Actor actor = Actor.actorFromEntity(event.getEntity());
|
||||
consumer.queueEntityModification(actor, damager.getUniqueId(), damager.getType(), damager.getLocation(), EntityChange.EntityChangeType.GET_STUNG, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
|
||||
ArmorStand entity = event.getRightClicked();
|
||||
|
Reference in New Issue
Block a user