-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
CrackShotPlayerZoomsWeaponScopeEvent.java
68 lines (59 loc) · 1.96 KB
/
CrackShotPlayerZoomsWeaponScopeEvent.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
65
66
67
68
package com.denizenscript.depenizen.bukkit.events.crackshot;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.shampaggon.crackshot.events.WeaponScopeEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class CrackShotPlayerZoomsWeaponScopeEvent extends BukkitScriptEvent implements Listener {
// <--[event]
// @Events
// crackshot player zooms weapon scope
//
// @Regex ^on crackshot player zooms weapon scope$
//
// @Triggers when a player zooms their CrackShot weapon scope.
//
// @Cancellable true
//
// @Context
// <context.weapon> returns the name of the weapon.
// <context.zoomed> returns whether the player zoomed in.
//
// @Plugin Depenizen, CrackShot
//
// @Player Always
//
// @Group Depenizen
//
// -->
public static CrackShotPlayerZoomsWeaponScopeEvent instance;
public WeaponScopeEvent event;
public CrackShotPlayerZoomsWeaponScopeEvent() {
}
@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(event.getPlayer());
}
@Override
public boolean couldMatch(ScriptPath path) {
return path.eventLower.startsWith("crackshot player zooms weapon scope");
}
@Override
public ObjectTag getContext(String name) {
if (name.equals("weapon")) {
return new ElementTag(event.getWeaponTitle());
}
else if (name.equals("zoomed")) {
return new ElementTag(event.isZoomIn());
}
return super.getContext(name);
}
@EventHandler
public void onZoomsWeapon(WeaponScopeEvent event) {
this.event = event;
fire(event);
}
}