Class PlayerRemoveObjectEvent

All Implemented Interfaces:
Cancellable

public final class PlayerRemoveObjectEvent extends PlayerObjectEvent
Called when a player removes an object (furniture, doors, lamps etc) without destroying it (usually this is called when a player deconstructs an object, i.e. when he picks it up by holding his interaction key or by using a sledgehammer).
Example: Check if object is a door
1@EventMethod
2public void onPlayerRemoveObjectEvent(PlayerRemoveObjectEvent event){
3 //Get the object definition
4 Objects.ObjectDefinition definition = event.getObjectDefinition();
5
6 //The object definition allows you to check the object type
7 if (definition.type == Objects.Type.Door) {
8 //Now you can do something with the door...
9 evt.getPlayer().sendTextMessage("Removed a door!");
10 }
11}