Skip to content

Commit 06ada4d

Browse files
committed
feat(event): add CargoWithdrawEvent
0 parents  commit 06ada4d

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/bin/
2+
/plugins/
3+
/sonar/
4+
/.settings/
5+
/target/
6+
/.idea/
7+
/.vscode/
8+
9+
.classpath
10+
.factorypath
11+
.project
12+
*.iml
13+
*.bak
14+
.DS_Store
15+
16+
dependency-reduced-pom.xml

pom.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>SlimefunCompLib</artifactId>
9+
<version>1.0.0</version>
10+
11+
<properties>
12+
<maven.compiler.source>17</maven.compiler.source>
13+
<maven.compiler.target>17</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<repositories>
18+
<repository>
19+
<id>spigotmc-repo</id>
20+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
21+
</repository>
22+
</repositories>
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.spigotmc</groupId>
27+
<artifactId>spigot-api</artifactId>
28+
<version>1.19-R0.1-SNAPSHOT</version>
29+
<scope>provided</scope>
30+
</dependency>
31+
</dependencies>
32+
33+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.xzavier0722.mc.plugin.slimefuncomplib.event;
2+
3+
import org.bukkit.block.Block;
4+
import org.bukkit.event.Cancellable;
5+
import org.bukkit.event.Event;
6+
import org.bukkit.event.HandlerList;
7+
import org.bukkit.inventory.Inventory;
8+
9+
import javax.annotation.Nonnull;
10+
import javax.annotation.ParametersAreNonnullByDefault;
11+
12+
public class CargoWithdrawEvent extends Event implements Cancellable {
13+
private static final HandlerList handlers = new HandlerList();
14+
private boolean cancelled;
15+
private final Block node;
16+
private final Block target;
17+
private final Inventory inv;
18+
19+
20+
/**
21+
* @param node: cargo node
22+
* @param target: target container
23+
* @param inv: target inventory
24+
*/
25+
@ParametersAreNonnullByDefault
26+
public CargoWithdrawEvent(Block node, Block target, Inventory inv) {
27+
this.node = node;
28+
this.target = target;
29+
this.inv = inv;
30+
}
31+
32+
@Override
33+
public boolean isCancelled() {
34+
return cancelled;
35+
}
36+
37+
@Override
38+
public void setCancelled(boolean cancelled) {
39+
this.cancelled = cancelled;
40+
}
41+
42+
@Override
43+
@Nonnull
44+
public HandlerList getHandlers() {
45+
return handlers;
46+
}
47+
48+
public Block getNode() {
49+
return node;
50+
}
51+
52+
public Inventory getInv() {
53+
return inv;
54+
}
55+
56+
public Block getTarget() {
57+
return target;
58+
}
59+
}

0 commit comments

Comments
 (0)