-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
CrackShotPlayerPlacesLandmineEvent.java
64 lines (55 loc) · 1.78 KB
/
CrackShotPlayerPlacesLandmineEvent.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.denizenscript.depenizen.bukkit.events.crackshot;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.shampaggon.crackshot.events.WeaponPlaceMineEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class CrackShotPlayerPlacesLandmineEvent extends BukkitScriptEvent implements Listener {
// <--[event]
// @Events
// crackshot player places landmine
//
// @Regex ^on crackshot player places landmine$
//
// @Triggers when a player places a landmine.
//
// @Cancellable false
//
// @Context
// <context.landmine> returns the EntityTag for the landmine.
//
// @Plugin Depenizen, CrackShot
//
// @Player Always
//
// @Group Depenizen
//
// -->
public static CrackShotPlayerPlacesLandmineEvent instance;
public WeaponPlaceMineEvent event;
public CrackShotPlayerPlacesLandmineEvent() {
}
@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(event.getPlayer());
}
@Override
public boolean couldMatch(ScriptPath path) {
return path.eventLower.startsWith("crackshot player places landmine");
}
@Override
public ObjectTag getContext(String name) {
if (name.equals("landmine")) {
return new EntityTag(event.getMine());
}
return super.getContext(name);
}
@EventHandler
public void onPlacesLandmine(WeaponPlaceMineEvent event) {
this.event = event;
fire(event);
}
}