-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
VotifierEvents.java
38 lines (29 loc) · 1.21 KB
/
VotifierEvents.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
package net.gnomeffinway.depenizen.events;
import com.vexsoftware.votifier.model.Vote;
import com.vexsoftware.votifier.model.VotifierEvent;
import net.aufdemrand.denizen.events.EventManager;
import net.aufdemrand.denizen.objects.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.*;
public class VotifierEvents implements Listener {
// <--[event]
// @Events
// votifier vote
// @Triggers when a Votifier vote is made.
// @Context
// <context.time> returns the time the vote was sent.
// <context.service> returns what service was used to send the vote.
// <context.username> returns the username input with the vote.
// @Plugin Votifier
// -->
@EventHandler
public void onVotifierEvent(VotifierEvent event) {
Map<String, dObject> context = new HashMap<String, dObject>();
Vote vote = event.getVote();
context.put("time", new Element(vote.getTimeStamp()));
context.put("service", new Element(vote.getServiceName()));
context.put("username", new Element(vote.getUsername()));
EventManager.doEvents(Arrays.asList("votifier vote"), null, dPlayer.valueOf(vote.getUsername()), context);
}
}