Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-08-28 14:01:49 -07:00
commit 5281558cdb
6 changed files with 39 additions and 21 deletions

View File

@ -119,7 +119,7 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
{ {
String[] answers = poll.getAnswers(); String[] answers = poll.getAnswers();
player.sendMessage(C.cGold + C.Bold + "-----------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "-----------"); player.sendMessage(C.cGold + C.Bold + "--------------" + C.cYellow + C.Bold + "POLL" + C.cGold + C.Bold + "--------------");
player.sendMessage(poll.getQuestion()); player.sendMessage(poll.getQuestion());
player.sendMessage(""); player.sendMessage("");
for (int i = 1; i <= answers.length; i++) for (int i = 1; i <= answers.length; i++)
@ -151,7 +151,7 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
} }
player.sendMessage(""); player.sendMessage("");
player.sendMessage("Click an answer to receive " + C.cGreen + poll.getCoinReward() + " Gems"); player.sendMessage("Click an answer to receive " + C.cGreen + poll.getCoinReward() + " Gems");
player.sendMessage(C.cGold + C.Bold + "--------------------------"); player.sendMessage(C.cGold + C.Bold + "--------------------------------");
player.playSound(player.getEyeLocation(), Sound.ORB_PICKUP, 2f, 0f); player.playSound(player.getEyeLocation(), Sound.ORB_PICKUP, 2f, 0f);
} }

View File

@ -102,7 +102,7 @@ public class PollCommand extends CommandBase<PollManager>
UtilPlayer.message(caller, "Reward: " + C.cYellow + poll.getCoinReward()); UtilPlayer.message(caller, "Reward: " + C.cYellow + poll.getCoinReward());
UtilPlayer.message(caller, ""); UtilPlayer.message(caller, "");
DecimalFormat decimalFormat = new DecimalFormat("#.##"); DecimalFormat decimalFormat = new DecimalFormat("#.#");
double aPercent = stats.getAPercent(); double aPercent = stats.getAPercent();
double bPercent = stats.getBPercent(); double bPercent = stats.getBPercent();
double cPercent = stats.getCPercent(); double cPercent = stats.getCPercent();
@ -123,7 +123,7 @@ public class PollCommand extends CommandBase<PollManager>
percent = dPercent; percent = dPercent;
UtilPlayer.message(caller, answer); UtilPlayer.message(caller, answer);
UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(percent) + "%" + C.cWhite + ")"); UtilPlayer.message(caller, getProgressBar(percent, 60) + " " + C.cWhite + "(" + C.cYellow + decimalFormat.format(100d*percent) + "%" + C.cWhite + ")");
} }
} }
UtilPlayer.message(caller, " "); UtilPlayer.message(caller, " ");

View File

@ -18,7 +18,9 @@ import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -43,6 +45,27 @@ import nautilus.game.arcade.stats.WinMapStatTracker;
public class DragonEscape extends SoloGame public class DragonEscape extends SoloGame
{ {
public static class PlayerFinishEvent extends PlayerEvent
{
private static final HandlerList HANDLER_LIST = new HandlerList();
public static HandlerList getHandlerList()
{
return HANDLER_LIST;
}
public PlayerFinishEvent(Player who)
{
super(who);
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>(); private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>(); private ArrayList<String> _lastScoreboard = new ArrayList<String>();
@ -254,6 +277,8 @@ public class DragonEscape extends SoloGame
_winner = player; _winner = player;
this.SetCustomWinLine(player.getName() + " reached the end of the course!"); this.SetCustomWinLine(player.getName() + " reached the end of the course!");
Bukkit.getPluginManager().callEvent(new PlayerFinishEvent(player));
return true; return true;
} }
} }

View File

@ -82,7 +82,7 @@ public class GameAchievementManager implements Listener
//Display //Display
for (final Achievement type : log.keySet()) for (final Achievement type : log.keySet())
{ {
UtilPlayer.message(player, "");
AchievementData data = Manager.GetAchievement().get(player, type); AchievementData data = Manager.GetAchievement().get(player, type);
@ -100,6 +100,7 @@ public class GameAchievementManager implements Listener
//Finishing for the first time //Finishing for the first time
if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName())) if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName()))
{ {
UtilPlayer.message(player, "");
UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") + UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") +
" " + F.elem(C.cGreen + C.Bold + "+" + type.getGemReward() + " Gems")); " " + F.elem(C.cGreen + C.Bold + "+" + type.getGemReward() + " Gems"));
@ -122,6 +123,7 @@ public class GameAchievementManager implements Listener
//Multi-Level Achievements //Multi-Level Achievements
else if (log.get(type).LevelUp) else if (log.get(type).LevelUp)
{ {
UtilPlayer.message(player, "");
UtilPlayer.message(player, nameLevel + " " + progress + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(C.cAqua + C.Bold + "LEVEL UP!")); " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!"));
@ -132,6 +134,7 @@ public class GameAchievementManager implements Listener
//Single Level //Single Level
if (type.getMaxLevel() == 1) if (type.getMaxLevel() == 1)
{ {
UtilPlayer.message(player, "");
UtilPlayer.message(player, nameLevel + " " + progress + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete"));
} }
@ -140,12 +143,14 @@ public class GameAchievementManager implements Listener
//Multi Level - Almost Finished //Multi Level - Almost Finished
if (data.getLevel() == type.getMaxLevel() - 1) if (data.getLevel() == type.getMaxLevel() - 1)
{ {
UtilPlayer.message(player, "");
UtilPlayer.message(player, nameLevel + " " + progress + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete")); " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Complete"));
} }
//Multi Level - Many levels to go //Multi Level - Many levels to go
else else
{ {
UtilPlayer.message(player, "");
UtilPlayer.message(player, nameLevel + " " + progress + UtilPlayer.message(player, nameLevel + " " + progress +
" " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level")); " " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level"));
} }

View File

@ -1,13 +1,10 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
public class WinMapStatTracker extends StatTracker<Game> public class WinMapStatTracker extends StatTracker<Game>
{ {
@ -17,17 +14,8 @@ public class WinMapStatTracker extends StatTracker<Game>
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event) public void onDragonEscapePlayerFinish(DragonEscape.PlayerFinishEvent event)
{ {
if (event.GetState() == Game.GameState.End) addStat(event.getPlayer(), "Win." + getGame().WorldData.MapName, 1, true, false);
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
addStat(winner, "Win." + getGame().WorldData.MapName, 1, true, false);
}
}
} }
} }