Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Votifier support. (World event "on votifier vote" with contexts: …
…player, time, service)
- Loading branch information
Showing
8 changed files
with
103 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/net/gnomeffinway/depenizen/events/VotifierEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package net.gnomeffinway.depenizen.events; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
import com.vexsoftware.votifier.model.Vote; | ||
import com.vexsoftware.votifier.model.VotifierEvent; | ||
|
||
import net.aufdemrand.denizen.objects.dPlayer; | ||
import net.aufdemrand.denizen.scripts.containers.core.WorldScriptHelper; | ||
import net.gnomeffinway.depenizen.Depenizen; | ||
|
||
public class VotifierEvents implements Listener { | ||
|
||
public VotifierEvents(Depenizen depenizen) { | ||
depenizen.getServer().getPluginManager().registerEvents(this, depenizen); | ||
} | ||
|
||
@EventHandler | ||
public void onVotifierEvent(VotifierEvent event) { | ||
|
||
Map<String, Object> context = new HashMap<String, Object>(); | ||
Vote vote = event.getVote(); | ||
Player player = Bukkit.getPlayer(vote.getUsername()); | ||
|
||
context.put("player", new dPlayer(player)); | ||
context.put("time", vote.getTimeStamp()); | ||
context.put("service", vote.getServiceName()); | ||
|
||
WorldScriptHelper.doEvents(Arrays.asList | ||
("votifier vote"), | ||
null, player, context); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/net/gnomeffinway/depenizen/support/VotifierSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package net.gnomeffinway.depenizen.support; | ||
|
||
import net.gnomeffinway.depenizen.Depenizen; | ||
import net.gnomeffinway.depenizen.events.VotifierEvents; | ||
|
||
public class VotifierSupport { | ||
|
||
public Depenizen depenizen; | ||
|
||
public VotifierSupport(Depenizen depenizen) { | ||
this.depenizen = depenizen; | ||
} | ||
|
||
public void register() { | ||
new VotifierEvents(depenizen); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters