Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
297 additions
and
2 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
55 changes: 55 additions & 0 deletions
55
src/main/java/net/gnomeffinway/depenizen/events/PVPArenaEvents.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,55 @@ | ||
package net.gnomeffinway.depenizen.events; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import net.aufdemrand.denizen.objects.Element; | ||
import net.aufdemrand.denizen.objects.dList; | ||
import net.aufdemrand.denizen.objects.dObject; | ||
import net.aufdemrand.denizen.objects.dPlayer; | ||
import net.aufdemrand.denizen.scripts.containers.core.WorldScriptHelper; | ||
import net.gnomeffinway.depenizen.Depenizen; | ||
import net.slipcor.pvparena.arena.Arena; | ||
import net.slipcor.pvparena.arena.ArenaPlayer; | ||
import net.slipcor.pvparena.events.PAStartEvent; | ||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
public class PVPArenaEvents implements Listener { | ||
|
||
public PVPArenaEvents(Depenizen depenizen) { | ||
depenizen.getServer().getPluginManager().registerEvents(this, depenizen); | ||
} | ||
|
||
// <--[event] | ||
// @events arena starts | ||
// @triggers when an arena starts a round. | ||
// @context | ||
// <context.arena> returns the arena name. | ||
// <context.fighters> returns a dList of the fighters in the round. | ||
// @plugin PvP Arena | ||
// --> | ||
@EventHandler | ||
public void onArenaStarts(PAStartEvent event) { | ||
|
||
Map<String, dObject> context = new HashMap<String, dObject>(); | ||
Arena arena = event.getArena(); | ||
|
||
context.put("arena", new Element(arena.getName())); | ||
|
||
ArrayList<dPlayer> fighters = new ArrayList<dPlayer>(); | ||
for (ArenaPlayer player : event.getArena().getFighters()) | ||
fighters.add(new dPlayer(player.get())); | ||
|
||
context.put("fighters", new dList(fighters)); | ||
|
||
WorldScriptHelper.doEvents(Arrays.asList | ||
("arena starts"), | ||
null, null, 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
20 changes: 20 additions & 0 deletions
20
src/main/java/net/gnomeffinway/depenizen/support/PVPArenaSupport.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,20 @@ | ||
package net.gnomeffinway.depenizen.support; | ||
|
||
import net.gnomeffinway.depenizen.Depenizen; | ||
import net.gnomeffinway.depenizen.events.PVPArenaEvents; | ||
import net.gnomeffinway.depenizen.tags.PVPArenaTags; | ||
|
||
public class PVPArenaSupport { | ||
|
||
public Depenizen depenizen; | ||
|
||
public PVPArenaSupport(Depenizen depenizen) { | ||
this.depenizen = depenizen; | ||
} | ||
|
||
public void register() { | ||
new PVPArenaTags(depenizen); | ||
new PVPArenaEvents(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
Oops, something went wrong.