Created
June 26, 2012 04:33
-
-
Save aarontwf/2993303 to your computer and use it in GitHub Desktop.
Untested example of hooking into BattleNight
This file contains hidden or 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
package me.limebyte.bnhookexample; | |
import java.util.logging.Logger; | |
import me.limebyte.battlenight.core.BattleNight; | |
import org.bukkit.ChatColor; | |
import org.bukkit.entity.Player; | |
import org.bukkit.plugin.Plugin; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class BNHookExample extends JavaPlugin { | |
private Logger log; | |
private BattleNight battleNight; | |
public void onEnable() { | |
log = this.getLogger(); | |
Plugin bnPlugin = this.getServer().getPluginManager().getPlugin("BattleNight"); | |
if (bnPlugin == null) { | |
log.severe(ChatColor.RED + "BattleNight not found!"); | |
} | |
else { | |
battleNight = new BattleNight(); | |
} | |
} | |
private boolean isPlayingBattleNight(Player player) { | |
if (battleNight == null) return false; | |
return battleNight.BattleUsersTeam.containsKey(player.getName()); | |
} | |
private boolean isWatchingBattleNight(Player player) { | |
if (battleNight == null) return false; | |
return battleNight.BattleSpectators.containsKey(player.getName()); | |
} | |
private String getBattleNightTeam(Player player) { | |
if (!isPlayingBattleNight(player)) return "none"; | |
return battleNight.BattleUsersTeam.get(player.getName()); | |
} | |
private String getBattleNightClass(Player player) { | |
if (!isPlayingBattleNight(player)) return "none"; | |
return battleNight.BattleUsersClass.get(player.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment