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();
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("");
for (int i = 1; i <= answers.length; i++)
@ -151,7 +151,7 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
}
player.sendMessage("");
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);
}

View File

@ -102,7 +102,7 @@ public class PollCommand extends CommandBase<PollManager>
UtilPlayer.message(caller, "Reward: " + C.cYellow + poll.getCoinReward());
UtilPlayer.message(caller, "");
DecimalFormat decimalFormat = new DecimalFormat("#.##");
DecimalFormat decimalFormat = new DecimalFormat("#.#");
double aPercent = stats.getAPercent();
double bPercent = stats.getBPercent();
double cPercent = stats.getCPercent();
@ -123,7 +123,7 @@ public class PollCommand extends CommandBase<PollManager>
percent = dPercent;
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, " ");

View File

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

View File

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

View File

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