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

This commit is contained in:
CoderTim 2015-02-23 20:56:34 -05:00
commit 0bf6866ad7
24 changed files with 497 additions and 163 deletions

View File

@ -0,0 +1,80 @@
package mineplex.core.leaderboard;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.spawn.command.SpawnCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Manages dynamic Leaderboard statistics.
*
* Used for recording stat events, retrieving customized leaderboards, etc.
* @author MrTwiggy
*
*/
public class LeaderboardManager extends MiniPlugin
{
private static LeaderboardManager _instance; // Singleton instance of Leaderboard Manager
private StatEventsRepository _statEvents; // 'statEvents' table repository.
private CoreClientManager _clientManager;
private String _serverGroup;
/**
* Private class constructor to prevent non-singleton instances.
*/
public LeaderboardManager(JavaPlugin plugin, CoreClientManager clientManager)
{
super("Leaderboard Manager", plugin);
_instance = this;
_clientManager = clientManager;
_statEvents = new StatEventsRepository(plugin);
_serverGroup = _plugin.getConfig().getString("serverstatus.group");
}
/**
* Attempt to trigger a stat event.
* @param player - the player responsible for the statistic
* @param stat - the display name of the statistic to be added
* @param value - the counter value used to increment the statistic
* @return true, if a stat event was successfully triggered and logged, false otherwise.
*/
public boolean attemptStatEvent(Player player, String stat, int gamemode, int value)
{
StatType type = StatType.getType(stat);
return (type == null) ? false : onStatEvent(player, type, gamemode, value);
}
/**
* Trigger a stat event to be recorded.
* @param player - the player responsible for the statistic
* @param type - the unique type id designating the statistic being recorded
* @param gamemode - the unique gamemode id associated with the stat event
* @param value - the counter value used to increment the statistic
* @return true, if the stat event was successfully triggered and logged, false otherwise.
*/
public boolean onStatEvent(Player player, StatType type, int gamemode, int value)
{
_statEvents.insertStatEvent(player.getName(), gamemode, _serverGroup, type.getTypeId(), value);
return true;
}
@Override
public void AddCommands()
{
addCommand(new SetTournamentCommand(this));
}
/**
* @return the singleton instance for {@link LeaderboardManager}.
*/
public static LeaderboardManager getInstance()
{
return _instance;
}
}

View File

@ -0,0 +1,27 @@
package mineplex.core.leaderboard;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import org.bukkit.entity.Player;
public class SetTournamentCommand extends CommandBase<LeaderboardManager>
{
public SetTournamentCommand(LeaderboardManager plugin)
{
super(plugin, Rank.ADMIN, "settournament", "set-tournament");
}
@Override
public void Execute(Player caller, String[] args)
{
// TODO: Implement set tournament command.
/*if (args.length == 3)
{
String statType = args[0];
int gamemode = Integer.parseInt(args[1]);
int value = Integer.parseInt(args[2]);
LeaderboardManager.getInstance().attemptStatEvent(caller, statType, gamemode, value);
}*/
}
}

View File

@ -0,0 +1,69 @@
package mineplex.core.leaderboard;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
import org.bukkit.plugin.java.JavaPlugin;
/**
* StatEventsRepository offers the ability to insert and log newly generated stat events.
*
* Intended for the purpose of statistical tracking of players.
* @author MrTwiggy
*
*/
public class StatEventsRepository extends RepositoryBase
{
// Insert or update stat events query
/*private static String INSERT_EVENT =
"INSERT INTO statEvents(accountId, gamemode, serverGroup, type, value, date) "
+ "VALUES (?, ?, ?, ?, ?, CURRENT_DATE()) "
+ "ON DUPLICATE KEY UPDATE value=value+";*/
private static String INSERT_EVENT =
"INSERT INTO statEvents(accountId, gamemode, serverGroup, type, value, date) "
+ "SELECT accounts.id, ?, ?, ?, ?, CURRENT_DATE() "
+ "FROM accounts WHERE name = ? "
+ "ON DUPLICATE KEY UPDATE value=value+";
/**
* Class constructor
* @param plugin - the plugin responsible for instantiating this repository.
*/
public StatEventsRepository(JavaPlugin plugin)
{
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
}
@Override
protected void initialize()
{
//executeUpdate(CREATE_EVENTS_TABLE);
//executeUpdate(CREATE_STAT_RELATION_TABLE);
}
@Override
protected void update()
{
}
/**
* Insert (or update) a new stat event record for today into the repository.
* @param accountId - the id of the account responsible for the stat event.
* @param gamemode - the id of the gamemode type at the time of the stat event.
* @param serverGroup - the server group id associated with the stat event.
* @param type - the type of stat event to be inserted (id of type).
* @param value - the integer based value denoting the actual statistic being logged.
*/
public void insertStatEvent(String playerName, int gamemode, String serverGroup, int type, int value)
{
// Hacky string concatanation - Don't judge me!!
// TODO: How to handle outside value block parameters
executeUpdate(INSERT_EVENT + value + ";", new ColumnInt("gamemode", gamemode), new ColumnVarChar("serverGroup", 100, serverGroup),
new ColumnInt("type", type), new ColumnInt("value", value), new ColumnVarChar("name", 100, playerName));
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.leaderboard;
/**
* An enumeration delegating the various types of statistics to be dynamically tracked.
* @author MrTwiggy
*
*/
public enum StatType
{
WIN(1),
LOSS(2),
KILL(3),
DEATH(4);
private int _typeId; // Unique id for stat type
public int getTypeId() { return _typeId; }
/**
* Private class constructor
* @param typeId - the unique identifying id for this {@link StatType}
*/
private StatType(int typeId)
{
_typeId = typeId;
}
/**
* @param stat - the display name for the stat type
* @return the {@link StatType} corresponding to the passed in {@code stat}, if one exists,
* null otherwise.
*/
public static StatType getType(String stat)
{
switch(stat.toUpperCase().trim())
{
case "WINS":
return WIN;
case "LOSSES":
return LOSS;
case "KILLS":
return KILL;
case "DEATHS":
return DEATH;
default:
return null;
}
}
}

View File

@ -6,6 +6,9 @@ import java.util.Collection;
import java.util.Iterator;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -15,6 +18,8 @@ import mineplex.core.party.redis.RedisPartyData;
import mineplex.serverdata.Region;
import mineplex.serverdata.ServerGroup;
import mineplex.serverdata.ServerManager;
import mineplex.serverdata.transfers.ServerTransfer;
import mineplex.serverdata.transfers.TransferCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -29,7 +34,8 @@ public class Party
private PartyManager _manager;
private boolean _isHub;
private String _creator = null;
private String _creator;
private String _previousServer;
private ArrayList<String> _players = new ArrayList<String>();
private NautHashMap<String, Long> _invitee = new NautHashMap<String, Long>();
@ -47,6 +53,7 @@ public class Party
_players = new ArrayList(Arrays.asList(partyData.getPlayers()));
_creator = partyData.getLeader();
_previousServer = partyData.getPreviousServer();
}
public Party(PartyManager manager)
@ -135,12 +142,27 @@ public class Party
// Instruct
if (inviteeInParty)
{
UtilPlayer.message(player,
F.main("Party", "Type " + F.link("/party leave") + " then " + F.link("/party " + GetLeader()) + " to join."));
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party leave")).click(ClickEvent.RUN_COMMAND, "/party leave");
message.add(C.mBody + " then ");
message.add(F.link("/party " + GetLeader())).click(ClickEvent.RUN_COMMAND, "/party " + GetLeader());
message.add(C.mBody + " to join.");
message.sendToPlayer(player);
}
else
{
UtilPlayer.message(player, F.main("Party", "Type " + F.link("/party " + GetLeader()) + " to join."));
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party " + GetLeader())).click(ClickEvent.RUN_COMMAND, "/party " + GetLeader());
message.add(C.mBody + " to join.");
message.sendToPlayer(player);
}
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1.5f);
@ -191,7 +213,32 @@ public class Party
_players.remove(player.getName());
_players.add(0, player.getName());
Announce("Party Leadership returned to " + F.name(GetLeader()) + ".");
if (_informNewLeaderTimer < System.currentTimeMillis())
{
Announce("Party Leadership returned to " + F.name(GetLeader()) + ".");
}
if (_previousServer != null)
{
for (String playerName : _players)
{
Player p = Bukkit.getPlayerExact(playerName);
if (p != null)
{
continue;
}
TransferCommand transferCommand = new TransferCommand(
new ServerTransfer(playerName, _manager.getServerName()));
transferCommand.setTargetServers(_previousServer);
transferCommand.publish();
}
_previousServer = null;
}
}
}
@ -201,7 +248,7 @@ public class Party
if (player.getName().equals(GetLeader()))
{
_players.remove(player.getName());
_players.add(0, player.getName());
_players.add(player.getName());
if (_informNewLeaderTimer < System.currentTimeMillis())
{
@ -365,20 +412,24 @@ public class Party
}
else
{
if (UtilTime.elapsed(_partyOfflineTimer, online == 0 ? 15000 : 120000)) // 15 seconds for no players, 2 minutes if
if (UtilTime.elapsed(_partyOfflineTimer, online == 0 ? 5000 : 120000)) // 5 seconds for no players, 2 minutes if
// one player.
{
return true;
}
}
}
else if (_partyOfflineTimer > 0)
{
_partyOfflineTimer = -1;
}
return false;
}
public void resetWaitingTime()
{
_partyOfflineTimer = System.currentTimeMillis();
_partyOfflineTimer = -1;
}
public void switchedServer()

View File

@ -27,6 +27,7 @@ public class PartyManager extends MiniPlugin
private CoreClientManager _clientManager;
private PreferencesManager _preferenceManager;
private Portal _portal;
private String _serverName;
public HashSet<Party> _parties = new HashSet<Party>();
@ -37,6 +38,7 @@ public class PartyManager extends MiniPlugin
_portal = portal;
_clientManager = clientManager;
_preferenceManager = preferenceManager;
_serverName = GetPlugin().getConfig().getString("serverstatus.name");
ServerCommandManager.getInstance().registerCommandType("RedisPartyData", RedisPartyData.class,
new RedisPartyHandler(this));
@ -67,6 +69,11 @@ public class PartyManager extends MiniPlugin
return party;
}
public String getServerName()
{
return _serverName;
}
public void addParty(Party party)
{
for (Party parties : _parties)
@ -91,14 +98,25 @@ public class PartyManager extends MiniPlugin
{
party.switchedServer();
RedisPartyData data = new RedisPartyData(party, event.getServer());
boolean destLobby = event.getServer().equalsIgnoreCase("lobby");
RedisPartyData data = new RedisPartyData(party, destLobby ? _serverName : null);
if (!destLobby)
{
data.setTargetServers(event.getServer());
}
data.publish();
for (Player player : party.GetPlayersOnline())
if (!destLobby)
{
if (player != event.getPlayer())
for (Player player : party.GetPlayersOnline())
{
_portal.sendPlayerToServer(player, event.getServer());
if (player != event.getPlayer())
{
_portal.sendPlayerToServer(player, event.getServer());
}
}
}

View File

@ -2,12 +2,17 @@ package mineplex.core.party.commands;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -15,7 +20,10 @@ public class PartyCommand extends CommandBase<PartyManager>
{
public PartyCommand(PartyManager plugin)
{
super(plugin, Rank.ALL, new String[] {"party","z"});
super(plugin, Rank.ALL, new String[]
{
"party", "z"
});
}
@Override
@ -31,10 +39,10 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Callers Party
// Callers Party
Party party = Plugin.GetParty(caller);
//Leave
// Leave
if (args[0].equalsIgnoreCase("leave"))
{
if (party == null)
@ -49,7 +57,7 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Leave
// Leave
if (args[0].equalsIgnoreCase("kick"))
{
if (party == null)
@ -61,7 +69,8 @@ public class PartyCommand extends CommandBase<PartyManager>
if (party.GetLeader().equals(caller.getName()))
{
String target = UtilPlayer.searchCollection(caller, args[1], party.GetPlayers(), "Party ", true);
if (target == null) return;
if (target == null)
return;
if (target.equals(caller.getName()))
{
@ -80,9 +89,10 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Main
// Main
Player target = UtilPlayer.searchOnline(caller, args[0], true);
if (target == null) return;
if (target == null)
return;
if (target.equals(caller))
{
@ -93,11 +103,14 @@ public class PartyCommand extends CommandBase<PartyManager>
// Preference check
if (!Plugin.getPreferenceManager().Get(target).PartyRequests)
{
UtilPlayer.message(caller, F.main("Party", "You may not party with " + F.name(UtilEnt.getName(target)) + "! They are not accepting party requests!"));
UtilPlayer.message(
caller,
F.main("Party", "You may not party with " + F.name(UtilEnt.getName(target))
+ "! They are not accepting party requests!"));
return;
}
//Invite or Suggest
// Invite or Suggest
if (party != null)
{
if (party.GetPlayers().size() + party.GetInvitees().size() >= 16)
@ -105,36 +118,48 @@ public class PartyCommand extends CommandBase<PartyManager>
UtilPlayer.message(caller, "Your party cannot be larger than 16 players.");
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Decline
// Decline
else if (party.GetPlayers().contains(target.getName()))
{
UtilPlayer.message(caller, F.main("Party", F.name(target.getName()) + " is already in the Party."));
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Decline
// Decline
else if (party.GetInvitees().contains(target.getName()))
{
UtilPlayer.message(caller, F.main("Party", F.name(target.getName()) + " is already invited to the Party."));
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Invite
// Invite
else if (party.GetLeader().equals(caller.getName()))
{
party.InviteParty(target, Plugin.GetParty(target) != null);
}
//Suggest
// Suggest
else
{
party.Announce(F.name(caller.getName()) + " suggested " + F.name(target.getName()) + " be invited to the Party.");
UtilPlayer.message(UtilPlayer.searchExact(party.GetLeader()), F.main("Party", "Type " + F.link("/party " + target.getName()) + " to invite them."));
Player leader = Bukkit.getPlayerExact(party.GetLeader());
if (leader != null)
{
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party " + target.getName())).click(ClickEvent.RUN_COMMAND, "/party " + target.getName());
message.add(C.mBody + " to invite them.");
message.sendToPlayer(leader);
}
}
}
//Create or Join
// Create or Join
else
{
Party targetParty = Plugin.GetParty(target);
//Try to Join
// Try to Join
if (targetParty != null)
{
if (targetParty.GetInvitees().contains(caller.getName()))
@ -144,7 +169,7 @@ public class PartyCommand extends CommandBase<PartyManager>
}
}
//Create
// Create
party = Plugin.CreateParty(caller);
party.InviteParty(target, Plugin.GetParty(target) != null);
}

View File

@ -8,13 +8,18 @@ public class RedisPartyData extends ServerCommand
private String[] _players;
private String _leader;
private String _previousServer;
public RedisPartyData(Party party, String newServer)
public RedisPartyData(Party party, String previousServer)
{
_players = party.GetPlayers().toArray(new String[0]);
_leader = party.GetLeader();
_previousServer = previousServer;
}
setTargetServers(newServer);
public String getPreviousServer()
{
return _previousServer;
}
public String[] getPlayers()

View File

@ -68,12 +68,12 @@ public class Teleport extends MiniPlugin
runnable.cancel();
}
Player player = Bukkit.getPlayerExact(callback.getTarget());
Player player = Bukkit.getPlayerExact(callback.getReceivingPlayer());
if (player != null)
{
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Locate" + "> " + C.mBody + "Located [" + C.mElem
+ callback.getPlayer() + C.mBody + "] at ");
+ callback.getLocatedPlayer() + C.mBody + "] at ");
message.add(C.cBlue + callback.getServer()).click(ClickEvent.RUN_COMMAND,
"/server " + callback.getServer());

View File

@ -6,24 +6,24 @@ import mineplex.serverdata.ServerCommand;
public class RedisLocateCallback extends ServerCommand
{
private String _player;
private String _locatedPlayer;
private String _server;
private String _target;
private String _receivingPlayer;
private UUID _uuid;
public RedisLocateCallback(RedisLocate command, String server)
public RedisLocateCallback(RedisLocate command, String server, String targetName)
{
_uuid = command.getUUID();
_target = command.getSender();
_player = command.getTarget();
_receivingPlayer = command.getSender();
_locatedPlayer = targetName;
_server = server;
setTargetServers(command.getServer());
}
public String getPlayer()
public String getLocatedPlayer()
{
return _player;
return _locatedPlayer;
}
public String getServer()
@ -31,9 +31,9 @@ public class RedisLocateCallback extends ServerCommand
return _server;
}
public String getTarget()
public String getReceivingPlayer()
{
return _target;
return _receivingPlayer;
}
public UUID getUUID()

View File

@ -28,7 +28,7 @@ public class RedisLocateHandler implements CommandCallback
if (target != null)
{
RedisLocateCallback callback = new RedisLocateCallback(locate, _serverName);
RedisLocateCallback callback = new RedisLocateCallback(locate, _serverName, target.getName());
callback.publish();
}
}

View File

@ -101,7 +101,6 @@ public class Hub extends JavaPlugin implements IRelation
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
@ -111,6 +110,9 @@ public class Hub extends JavaPlugin implements IRelation
StatsManager statsManager = new StatsManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this));
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);

View File

@ -43,6 +43,7 @@ public class CustomExplosion extends Explosion
private boolean _dropItems = true;
private boolean _damageBlocksEqually;
private boolean _createFire;
private boolean _ignoreRate = true;
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
{
@ -52,6 +53,12 @@ public class CustomExplosion extends Explosion
_damageReason = deathCause;
}
public CustomExplosion setIgnoreRate(boolean ignoreRate)
{
_ignoreRate = ignoreRate;
return this;
}
public CustomExplosion setBlocksDamagedEqually(boolean damageEqually)
{
_damageBlocksEqually = damageEqually;
@ -185,7 +192,7 @@ public class CustomExplosion extends Explosion
if (entity.getBukkitEntity() instanceof LivingEntity)
{
_manager.NewDamageEvent((LivingEntity) entity.getBukkitEntity(), _owner, null,
DamageCause.ENTITY_EXPLOSION, damage, true, true, false, _damageReason, _damageReason);
DamageCause.ENTITY_EXPLOSION, damage, true, _ignoreRate, false, _damageReason, _damageReason);
}
else
{

View File

@ -25,13 +25,13 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.leaderboard.LeaderboardManager;
import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.mount.MountManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
@ -92,6 +92,7 @@ public class Arcade extends JavaPlugin
Creature creature = new Creature(this);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager);
new Spawn(this, serverStatusManager.getCurrentServerName());
Teleport teleport = new Teleport(this);
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
@ -124,8 +125,6 @@ public class Arcade extends JavaPlugin
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null);
cosmeticManager.setInterfaceSlot(7);
PartyManager partyManager = new PartyManager(this, portal, _clientManager, preferenceManager);
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress);

View File

@ -58,6 +58,7 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
@ -162,6 +163,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private HologramManager _hologramManager;
private AchievementManager _achievementManager;
private StatsManager _statsManager;
private PartyManager _partyManager;
private TaskManager _taskManager;
private ArcadeRepository _arcadeRepository;
@ -230,6 +232,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_packetHandler = packetHandler;
_partyManager = new PartyManager(plugin, portal, _clientManager, preferences);
_statsManager = new StatsManager(plugin, clientManager);
_taskManager = new TaskManager(plugin, webAddress);
_achievementManager = new AchievementManager(_statsManager, clientManager, donationManager);
@ -1172,4 +1175,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
HandlerList.unregisterAll(_classShop);
}
}
public PartyManager getPartyManager()
{
return _partyManager;
}
}

View File

@ -5,55 +5,55 @@ import org.bukkit.Material;
public enum GameType
{
//Mini
BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE),
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.ARCADE),
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL),
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS),
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS),
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS),
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS),
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS),
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE),
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE),
DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE),
DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE),
Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE),
DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE),
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS),
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE),
FlappyBird("Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE),
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.ARCADE),
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS),
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS),
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL),
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL),
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE),
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS),
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE),
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE),
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE),
QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.ARCADE),
Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE),
SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL),
Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE),
Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS),
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS),
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS),
Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE),
SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE),
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.ARCADE),
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE),
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE),
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE),
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE),
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL),
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE),
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL),
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL);
BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1),
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.ARCADE, 2),
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10),
DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 11),
DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12),
Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13),
DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 14),
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
FlappyBird("Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.ARCADE, 18),
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 23),
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25),
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE, 26),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.ARCADE, 30),
Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31),
SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32),
Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33),
Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34),
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 35),
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 36),
Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37),
SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38),
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.ARCADE, 39),
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40),
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 41),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48),
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49);
String _name;
String _lobbyName;
@ -61,22 +61,22 @@ public enum GameType
byte _data;
GameCategory _gameCategory;
GameType(String name, Material mat, byte data, GameCategory gameCategory)
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
public int getGameId() { return _gameId; }
GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId)
{
_name = name;
_lobbyName = name;
_mat = mat;
_data = data;
_gameCategory = gameCategory;
this(name, name, mat, data, gameCategory, gameId);
}
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory)
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId)
{
_name = name;
_lobbyName = lobbyName;
_mat = mat;
_data = data;
_gameCategory = gameCategory;
_gameId = gameId;
}
public String GetName()

View File

@ -293,10 +293,10 @@ public enum SpellType // ❤
15, // Mana cost
5, // Spell cooldown
-2, // Mana cost change per level
-1, // Cooldown change per level
0, // Cooldown change per level
15, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2.5",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 15",
@ -340,7 +340,7 @@ public enum SpellType // ❤
0, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 1.5) + 2.5",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",

View File

@ -43,21 +43,6 @@ public class SpellImplode extends Spell implements SpellClick
Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
/* for (Entity entity : centerLocation.getWorld().getEntities())
{
if (!(entity instanceof Player) || Wizards.IsAlive(entity))
{
Location loc = entity.getLocation();
if (loc.distance(centerLocation) <= size * 2)
{
entity.setVelocity(centerLocation.toVector().subtract(loc.toVector()).normalize()
.multiply((size * 2D) / Math.max(1, loc.distance(centerLocation))));
entity.setFallDistance(-2);
}
}
}*/
for (int x = -size * 2; x <= size * 2; x++)
{
for (int y = -size; y <= size; y++)

View File

@ -94,6 +94,8 @@ public class SpellLance extends Spell implements SpellClick
explosion.setDropItems(false);
explosion.setIgnoreRate(false);
explosion.explode();
}
}

View File

@ -26,7 +26,7 @@ public class SpellMagicMissile extends Spell implements SpellClick
final Vector direction = missileLocation.getDirection().normalize().multiply(0.3);
final int maxRange = 15 * getSpellLevel(player);
final int maxDings = maxRange * 3;
final int damage = 5 + getSpellLevel(player);
final int damage = 4 + getSpellLevel(player);
new BukkitRunnable()
{

View File

@ -50,7 +50,7 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
final BlockFace moveDirection = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
final int spellLevel = getSpellLevel(player);
final int damage = 5 + (spellLevel * 3);
final int damage = 4 + (spellLevel * 2);
final int maxDist = 10 * spellLevel;
player.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, target.getTypeId());

View File

@ -2,12 +2,11 @@ package nautilus.game.arcade.managers;
import java.util.Iterator;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.party.Party;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
@ -84,6 +83,24 @@ public class GameChatManager implements Listener
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
}
if (event.getMessage().charAt(0) == '@')
{
//Party Chat
Party party = Manager.getPartyManager().GetParty(sender);
if (party != null)
{
event.getRecipients().clear();
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
event.getRecipients().addAll(party.GetPlayersOnline());
return;
}
}
//Base Format
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.UUID;
import mineplex.core.common.util.C;
import mineplex.core.leaderboard.LeaderboardManager;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
@ -60,7 +61,13 @@ public class GameStatManager implements Listener
{
for (String stat : event.GetGame().GetStats().get(player).keySet())
{
Manager.GetStatsManager().incrementStat(player, stat, event.GetGame().GetStats().get(player).get(stat));
int value = event.GetGame().GetStats().get(player).get(stat);
Manager.GetStatsManager().incrementStat(player, stat, value);
// Leaderboard hook for logging appropriate stat events
// Note: Rejects stat events that are not of the appropriate types.
int gameId = event.GetGame().GetType().getGameId();
LeaderboardManager.getInstance().attemptStatEvent(player, stat.split("\\.")[1], gameId, value);
}
}
}

View File

@ -27,8 +27,8 @@
<div class="jumbotron" style="text-align: center">
<div class="container" style="text-align: center">
<img src="mineplex.png" alt="Mineplex"/>
<h1>The Fall Invitational</h1>
<h2>Tournament Leaderboard</h2>
<h1>The Tournament</h1>
<h2>Leaderboard</h2>
</div>
</div>
@ -39,9 +39,10 @@
<?php
$tournamentTypes = array('Super Smash Mobs', 'Survival Games', 'Mixed Arcade');
$tournamentTypes = array('Tournament');
$con = mysqli_connect('db.mineplex.com', 'root', 'tAbechAk3wR7tuTh', 'Account');
//$con = mysqli_connect('localhost', 'root', 'ZXquwQyEdKMB', 'Development');
for ($i = 0; $i < count($tournamentTypes); $i++)
{
@ -60,49 +61,32 @@ for ($i = 0; $i < count($tournamentTypes); $i++)
<th class="center">Rank</th>
<th>Player</th>
<th class="center">Wins</th>
<th class="center">Losses</th>
<th class="center">Score*</th>
</tr>
<?php
$query = <<<QUERY
SELECT name, wins, total, score
FROM tournamentLeaderboard
JOIN accounts ON accounts.id = accountId
WHERE tournamentId = 0
AND gameId = $i
AND score IS NOT NULL
ORDER BY score DESC, name ASC
$query = <<<QUERY
SELECT LB.rank, accounts.name, LB.value AS 'wins'
FROM TournamentLB LB
INNER JOIN accounts ON accounts.id = accountId
ORDER BY rank ASC
LIMIT 30;
QUERY;
$result = mysqli_query($con, $query);
$index = 1;
$rank = 1;
$lastScore = null;
while($row = mysqli_fetch_array($result))
while($row = mysqli_fetch_array($result))
{
$score = $row['score'];
if ($score != $lastScore)
{
$rank = $index;
}
?>
<tr>
<td class="center"><?php echo $rank ?></td>
<td class="center"><?php echo $row['rank'] ?></td>
<td><?php echo $row['name'] ?></td>
<td class="center"><?php echo $row['wins'] ?></td>
<td class="center"><?php echo ($row['total'] - $row['wins']) ?></td>
<td class="center"><?php echo round($score*100, 3) ?></td>
</tr>
<?php
$index++;
$lastScore = $score;
}
?>