-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathCustomBlockDataMoveEvent.java
More file actions
51 lines (44 loc) · 2 KB
/
CustomBlockDataMoveEvent.java
File metadata and controls
51 lines (44 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (c) 2022 Alexander Majka (mfnalex) / JEFF Media GbR
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License.
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* If you need help or have any suggestions, feel free to join my Discord and head to #programming-help:
*
* Discord: https://discord.jeff-media.com/
*
* If you find this library helpful or if you're using it one of your paid plugins, please consider leaving a donation
* to support the further development of this project :)
*
* Donations: https://paypal.me/mfnalex
*/
package com.jeff_media.customblockdata.events;
import com.jeff_media.customblockdata.CustomBlockData;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
/**
* Called when a block with CustomBlockData is moved by a piston to a new location.
*
* Blocks with protected CustomBlockData (see {@link CustomBlockData#isProtected()} will not trigger this event, however
* it is possible that unprotected CustomBlockData will be moved to a destination block with protected CustomBlockData. You have
* to cancel this event yourself to prevent this.
*/
public class CustomBlockDataMoveEvent extends CustomBlockDataEvent {
private final @NotNull Block blockTo;
public CustomBlockDataMoveEvent(@NotNull Plugin plugin, @NotNull Block blockFrom, @NotNull Block blockTo, @NotNull Event bukkitEvent) {
super(plugin, blockFrom, bukkitEvent);
this.blockTo = blockTo;
}
public @NotNull Block getBlockTo() {
return blockTo;
}
}