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

This commit is contained in:
William Burns 2015-08-03 08:53:38 +01:00
commit 6ccc897841
77 changed files with 1710 additions and 258 deletions

View File

@ -39,7 +39,7 @@ public class MotdManager implements Listener, Runnable
if (new File("updateMOTD.dat").exists()) if (new File("updateMOTD.dat").exists())
{ {
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
lines.add(" §b§l◄§f§lNEW§b§l► §f§l◄§b§lSKYWARS§f§l► §b§l◄§f§lNEW§b§l►"); lines.add(" §f§l◄ §6§lNEW ARCADE GAME §f§l▬ §c§lBOMB LOBBERS §f§l►");
//lines.add(" §d§lRank Sale §a§l40% Off"); //lines.add(" §d§lRank Sale §a§l40% Off");
//lines.add(" §f§l◄§c§lMAINTENANCE§f§l►"); //lines.add(" §f§l◄§c§lMAINTENANCE§f§l►");

View File

@ -1,14 +1,23 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class UtilAction public class UtilAction
{ {
private static VelocityReceiver _velocityFix;
public static void velocity(Entity ent, Vector vec)
{
velocity(ent, vec, 1, false, 0, 0, vec.length(), false);
}
public static void registerVelocityFix(VelocityReceiver velocityFix)
{
_velocityFix = velocityFix;
}
public static void velocity(Entity ent, double str, double yAdd, double yMax, boolean groundBoost) public static void velocity(Entity ent, double str, double yAdd, double yMax, boolean groundBoost)
{ {
velocity(ent, ent.getLocation().getDirection(), str, false, 0, yAdd, yMax, groundBoost); velocity(ent, ent.getLocation().getDirection(), str, false, 0, yAdd, yMax, groundBoost);
@ -17,7 +26,10 @@ public class UtilAction
public static void velocity(Entity ent, Vector vec, double str, boolean ySet, double yBase, double yAdd, double yMax, boolean groundBoost) public static void velocity(Entity ent, Vector vec, double str, boolean ySet, double yBase, double yAdd, double yMax, boolean groundBoost)
{ {
if (Double.isNaN(vec.getX()) || Double.isNaN(vec.getY()) || Double.isNaN(vec.getZ()) || vec.length() == 0) if (Double.isNaN(vec.getX()) || Double.isNaN(vec.getY()) || Double.isNaN(vec.getZ()) || vec.length() == 0)
{
zeroVelocity(ent);
return; return;
}
//YSet //YSet
if (ySet) if (ySet)
@ -41,13 +53,28 @@ public class UtilAction
//Velocity //Velocity
ent.setFallDistance(0); ent.setFallDistance(0);
//Store It!
//Debug if (ent instanceof Player && _velocityFix != null)
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
{ {
Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length())); _velocityFix.setPlayerVelocity(((Player)ent), vec);
} }
ent.setVelocity(vec); ent.setVelocity(vec);
} }
public static void zeroVelocity(Entity ent)
{
Vector vec = new Vector(0,0,0);
ent.setFallDistance(0);
//Store It!
if (ent instanceof Player && _velocityFix != null)
{
_velocityFix.setPlayerVelocity(((Player)ent), vec);
}
ent.setVelocity(vec);
}
} }

View File

@ -0,0 +1,9 @@
package mineplex.core.common.util;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public interface VelocityReceiver
{
public void setPlayerVelocity(Player player, Vector velocity);
}

View File

@ -227,7 +227,7 @@ public class CoreClientManager extends MiniPlugin
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid)); Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
if (client.getAccountId() > 0) if (client.getAccountId() > 0)
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId())); _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -301,7 +301,16 @@ public class CoreClientManager extends MiniPlugin
System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId()); System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId());
if (client.getAccountId() > 0) if (client.getAccountId() > 0)
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId())); {
try
{
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
}
catch (Exception e)
{
e.printStackTrace();
}
}
return !_clientLoginLock.containsKey(client.GetPlayerName()); return !_clientLoginLock.containsKey(client.GetPlayerName());
} }

View File

@ -88,7 +88,7 @@ public enum Achievement
SKYWARS_WINS("Sky King",2000, SKYWARS_WINS("Sky King",2000,
new String[]{"Skywars.Wins"}, new String[]{"Skywars.Wins"},
new String[]{"Win 20 Games of Skywars"}, new String[]{"Win 20 Games of Skywars"},
new int[]{30}, new int[]{20},
AchievementCategory.SKYWARS), AchievementCategory.SKYWARS),
SKYWARS_BOMBER("Master Bomber",500, SKYWARS_BOMBER("Master Bomber",500,

View File

@ -170,7 +170,7 @@ public class MorphWither extends MorphGadget
player.setFlying(true); player.setFlying(true);
if (UtilEnt.isGrounded(player)) if (UtilEnt.isGrounded(player))
player.setVelocity(new Vector(0,1,0)); UtilAction.velocity(player, new Vector(0,1,0), 1, false, 0, 0, 1, true);
} }
} }

View File

@ -157,7 +157,7 @@ public class PersonalServerManager extends MiniPlugin
} }
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers, final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU); true, false, false, games, "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{ {

View File

@ -87,22 +87,9 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
private boolean attemptShopOpen(Player player, LivingEntity entity) private boolean attemptShopOpen(Player player, LivingEntity entity)
{ {
if (!_openedShop.contains(player.getName()) && entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(_name))) if (entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(_name)))
{ {
if (!canOpenShop(player)) return attemptShopOpen(player);
return false;
_openedShop.add(player.getName());
openShopForPlayer(player);
if (!_playerPageMap.containsKey(player.getName()))
{
_playerPageMap.put(player.getName(), buildPagesFor(player));
}
openPageForPlayer(player, getOpeningPageForPlayer(player));
return true;
} }
return false; return false;

View File

@ -18,6 +18,7 @@ import org.jooq.impl.DSL;
import mineplex.core.account.ILoginProcessor; import mineplex.core.account.ILoginProcessor;
import mineplex.core.database.DBPool; import mineplex.core.database.DBPool;
import mineplex.database.Tables; import mineplex.database.Tables;
import org.jooq.types.ULong;
public class SecondaryStatHandler implements ILoginProcessor public class SecondaryStatHandler implements ILoginProcessor
{ {
@ -58,7 +59,7 @@ public class SecondaryStatHandler implements ILoginProcessor
.insertInto(Tables.accountStat) .insertInto(Tables.accountStat)
.set(Tables.accountStat.accountId, accountId) .set(Tables.accountStat.accountId, accountId)
.set(Tables.accountStat.statId, statId) .set(Tables.accountStat.statId, statId)
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)); .set(Tables.accountStat.value, ULong.valueOf(Math.max(oldPlayerStats.getStat(statName), 0L)));
inserts.add(insert); inserts.add(insert);
} }
@ -99,13 +100,13 @@ public class SecondaryStatHandler implements ILoginProcessor
.insertInto(Tables.accountStat) .insertInto(Tables.accountStat)
.set(Tables.accountStat.accountId, accountId) .set(Tables.accountStat.accountId, accountId)
.set(Tables.accountStat.statId, statId) .set(Tables.accountStat.statId, statId)
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)); .set(Tables.accountStat.value, ULong.valueOf(Math.max(oldPlayerStats.getStat(statName), 0L)));
inserts.add(insert); inserts.add(insert);
Update update = context Update update = context
.update(Tables.accountStat) .update(Tables.accountStat)
.set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)) .set(Tables.accountStat.value, ULong.valueOf(Math.max(oldPlayerStats.getStat(statName), 0L)))
.where(Tables.accountStat.accountId.eq(accountId)) .where(Tables.accountStat.accountId.eq(accountId))
.and(Tables.accountStat.statId.eq(statId)); .and(Tables.accountStat.statId.eq(statId));

View File

@ -22,6 +22,7 @@ import org.jooq.Result;
import org.jooq.SQLDialect; import org.jooq.SQLDialect;
import org.jooq.Update; import org.jooq.Update;
import org.jooq.impl.DSL; import org.jooq.impl.DSL;
import org.jooq.types.ULong;
public class StatsRepository extends RepositoryBase public class StatsRepository extends RepositoryBase
{ {
@ -102,7 +103,7 @@ public class StatsRepository extends RepositoryBase
.insertInto(Tables.accountStat) .insertInto(Tables.accountStat)
.set(Tables.accountStat.accountId, accountId) .set(Tables.accountStat.accountId, accountId)
.set(Tables.accountStat.statId, statId) .set(Tables.accountStat.statId, statId)
.set(Tables.accountStat.value, uploadQueue.get(accountId).get(statId)); .set(Tables.accountStat.value, ULong.valueOf(uploadQueue.get(accountId).get(statId)));
inserts.add(insert); inserts.add(insert);
} }
@ -137,7 +138,7 @@ public class StatsRepository extends RepositoryBase
context = DSL.using(getConnectionPool(), SQLDialect.MYSQL); context = DSL.using(getConnectionPool(), SQLDialect.MYSQL);
} }
Result<Record2<String, Long>> result = context.select(Tables.stats.name, Tables.accountStat.value).from(Tables.accountStat) Result<Record2<String, ULong>> result = context.select(Tables.stats.name, Tables.accountStat.value).from(Tables.accountStat)
.join(Tables.stats) .join(Tables.stats)
.on(Tables.stats.id.eq(Tables.accountStat.statId)) .on(Tables.stats.id.eq(Tables.accountStat.statId))
.where(Tables.accountStat.accountId.eq(DSL.select(Tables.accounts.id) .where(Tables.accountStat.accountId.eq(DSL.select(Tables.accounts.id)
@ -149,9 +150,9 @@ public class StatsRepository extends RepositoryBase
if (result.isNotEmpty()) if (result.isNotEmpty())
{ {
playerStats = new PlayerStats(); playerStats = new PlayerStats();
for (Record2<String, Long> record : result) for (Record2<String, ULong> record : result)
{ {
playerStats.addStat(record.value1(), record.value2()); playerStats.addStat(record.value1(), record.value2().longValue());
} }
} }

View File

@ -116,9 +116,7 @@ public class ServerStatusManager extends MiniPlugin
if (event.getType() != UpdateType.FASTER) if (event.getType() != UpdateType.FASTER)
return; return;
if (!_enabled) if (_enabled)
return;
saveServerStatus(); saveServerStatus();
} }
@ -139,19 +137,6 @@ public class ServerStatusManager extends MiniPlugin
if (server != null && !server.getPublicAddress().equalsIgnoreCase(serverSnapshot.getPublicAddress())) if (server != null && !server.getPublicAddress().equalsIgnoreCase(serverSnapshot.getPublicAddress()))
{ {
timeout = -DEFAULT_SERVER_TIMEOUT; timeout = -DEFAULT_SERVER_TIMEOUT;
/*
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", "/home/mineplex/config/killServer.sh", serverSnapshot.getName()});
pr.start(new GenericRunnable<Boolean>()
{
public void run(Boolean error)
{
if (error)
log("Error Killing myself.");
else
log("It worked.");
}
});
*/
} }
_repository.updataServerStatus(serverSnapshot, timeout); _repository.updataServerStatus(serverSnapshot, timeout);

View File

@ -20,6 +20,7 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
@ -285,7 +286,7 @@ public class Teleport extends MiniPlugin
} }
player.setFallDistance(0); player.setFallDistance(0);
player.setVelocity(new Vector(0,0,0)); UtilAction.velocity(player, new Vector(0,1,0), 0, false, 0, 0, 0, false);
player.teleport(loc); player.teleport(loc);
} }

View File

@ -0,0 +1,78 @@
package mineplex.core.velocity;
import java.util.Iterator;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.VelocityReceiver;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class VelocityFix extends MiniPlugin implements VelocityReceiver
{
/*
* The purpose of this class is to fix a bug inherent in Minecraft,
* where player join order will somehow modify the velocity sent to players.
*
* To fix it, we simply save the velocity that the player should have received,
* then we re-set those values in CB the moment its about to actually apply the velocity to a player.
*
* The problem was caused by the fact that CB does not run a PlayerVelocityEvent the moment we
* set a players velocity, instead it waits until the next tick, and the velocity may have been changed.
*
*/
private NautHashMap<Player, Vector> _velocityData = new NautHashMap<Player,Vector>();
public VelocityFix(JavaPlugin plugin)
{
super("Velocity Fix", plugin);
UtilAction.registerVelocityFix(this);
}
@Override
public void setPlayerVelocity(Player player, Vector velocity)
{
_velocityData.put(player, velocity);
}
@EventHandler(priority = EventPriority.LOWEST)
public void fixVelocity(PlayerVelocityEvent event)
{
if (_velocityData.containsKey(event.getPlayer()))
event.getPlayer().setVelocity(_velocityData.remove(event.getPlayer()));
}
@EventHandler
public void cleanVelocity(PlayerQuitEvent event)
{
_velocityData.remove(event.getPlayer());
}
@EventHandler
public void cleanVelocity(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Iterator<Player> keyIter = _velocityData.keySet().iterator();
while (keyIter.hasNext())
{
Player player = keyIter.next();
if (player.isOnline())
keyIter.remove();
}
}
}

View File

@ -16,7 +16,7 @@ package mineplex.database;
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Account extends org.jooq.impl.SchemaImpl implements java.io.Serializable, java.lang.Cloneable { public class Account extends org.jooq.impl.SchemaImpl implements java.io.Serializable, java.lang.Cloneable {
private static final long serialVersionUID = 625106486; private static final long serialVersionUID = 2034846771;
/** /**
* The reference instance of <code>Account</code> * The reference instance of <code>Account</code>
@ -54,6 +54,7 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali
mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions,
mineplex.database.tables.ActiveTournaments.activeTournaments, mineplex.database.tables.ActiveTournaments.activeTournaments,
mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus,
mineplex.database.tables.Chatsnap.chatsnap,
mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances,
mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies,
mineplex.database.tables.ClanMember.clanMember, mineplex.database.tables.ClanMember.clanMember,

View File

@ -34,6 +34,7 @@ public class Keys {
public static final org.jooq.Identity<mineplex.database.tables.records.AccountTasksRecord, java.lang.Integer> IDENTITY_accountTasks = Identities0.IDENTITY_accountTasks; public static final org.jooq.Identity<mineplex.database.tables.records.AccountTasksRecord, java.lang.Integer> IDENTITY_accountTasks = Identities0.IDENTITY_accountTasks;
public static final org.jooq.Identity<mineplex.database.tables.records.AccountTransactionsRecord, java.lang.Integer> IDENTITY_accountTransactions = Identities0.IDENTITY_accountTransactions; public static final org.jooq.Identity<mineplex.database.tables.records.AccountTransactionsRecord, java.lang.Integer> IDENTITY_accountTransactions = Identities0.IDENTITY_accountTransactions;
public static final org.jooq.Identity<mineplex.database.tables.records.BonusRecord, java.lang.Integer> IDENTITY_bonus = Identities0.IDENTITY_bonus; public static final org.jooq.Identity<mineplex.database.tables.records.BonusRecord, java.lang.Integer> IDENTITY_bonus = Identities0.IDENTITY_bonus;
public static final org.jooq.Identity<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> IDENTITY_chatsnap = Identities0.IDENTITY_chatsnap;
public static final org.jooq.Identity<mineplex.database.tables.records.ClanAlliancesRecord, java.lang.Integer> IDENTITY_clanAlliances = Identities0.IDENTITY_clanAlliances; public static final org.jooq.Identity<mineplex.database.tables.records.ClanAlliancesRecord, java.lang.Integer> IDENTITY_clanAlliances = Identities0.IDENTITY_clanAlliances;
public static final org.jooq.Identity<mineplex.database.tables.records.ClanEnemiesRecord, java.lang.Integer> IDENTITY_clanEnemies = Identities0.IDENTITY_clanEnemies; public static final org.jooq.Identity<mineplex.database.tables.records.ClanEnemiesRecord, java.lang.Integer> IDENTITY_clanEnemies = Identities0.IDENTITY_clanEnemies;
public static final org.jooq.Identity<mineplex.database.tables.records.ClansRecord, java.lang.Integer> IDENTITY_clans = Identities0.IDENTITY_clans; public static final org.jooq.Identity<mineplex.database.tables.records.ClansRecord, java.lang.Integer> IDENTITY_clans = Identities0.IDENTITY_clans;
@ -83,6 +84,7 @@ public class Keys {
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountTransactionsRecord> KEY_accountTransactions_PRIMARY = UniqueKeys0.KEY_accountTransactions_PRIMARY; public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountTransactionsRecord> KEY_accountTransactions_PRIMARY = UniqueKeys0.KEY_accountTransactions_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ActiveTournamentsRecord> KEY_activeTournaments_PRIMARY = UniqueKeys0.KEY_activeTournaments_PRIMARY; public static final org.jooq.UniqueKey<mineplex.database.tables.records.ActiveTournamentsRecord> KEY_activeTournaments_PRIMARY = UniqueKeys0.KEY_activeTournaments_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.BonusRecord> KEY_bonus_PRIMARY = UniqueKeys0.KEY_bonus_PRIMARY; public static final org.jooq.UniqueKey<mineplex.database.tables.records.BonusRecord> KEY_bonus_PRIMARY = UniqueKeys0.KEY_bonus_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ChatsnapRecord> KEY_chatsnap_PRIMARY = UniqueKeys0.KEY_chatsnap_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanAlliancesRecord> KEY_clanAlliances_PRIMARY = UniqueKeys0.KEY_clanAlliances_PRIMARY; public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanAlliancesRecord> KEY_clanAlliances_PRIMARY = UniqueKeys0.KEY_clanAlliances_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_PRIMARY = UniqueKeys0.KEY_clanEnemies_PRIMARY; public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_PRIMARY = UniqueKeys0.KEY_clanEnemies_PRIMARY;
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_unique_clanId = UniqueKeys0.KEY_clanEnemies_unique_clanId; public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_unique_clanId = UniqueKeys0.KEY_clanEnemies_unique_clanId;
@ -175,6 +177,7 @@ public class Keys {
public static org.jooq.Identity<mineplex.database.tables.records.AccountTasksRecord, java.lang.Integer> IDENTITY_accountTasks = createIdentity(mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTasks.accountTasks.id); public static org.jooq.Identity<mineplex.database.tables.records.AccountTasksRecord, java.lang.Integer> IDENTITY_accountTasks = createIdentity(mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTasks.accountTasks.id);
public static org.jooq.Identity<mineplex.database.tables.records.AccountTransactionsRecord, java.lang.Integer> IDENTITY_accountTransactions = createIdentity(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id); public static org.jooq.Identity<mineplex.database.tables.records.AccountTransactionsRecord, java.lang.Integer> IDENTITY_accountTransactions = createIdentity(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id);
public static org.jooq.Identity<mineplex.database.tables.records.BonusRecord, java.lang.Integer> IDENTITY_bonus = createIdentity(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId); public static org.jooq.Identity<mineplex.database.tables.records.BonusRecord, java.lang.Integer> IDENTITY_bonus = createIdentity(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId);
public static org.jooq.Identity<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> IDENTITY_chatsnap = createIdentity(mineplex.database.tables.Chatsnap.chatsnap, mineplex.database.tables.Chatsnap.chatsnap.id);
public static org.jooq.Identity<mineplex.database.tables.records.ClanAlliancesRecord, java.lang.Integer> IDENTITY_clanAlliances = createIdentity(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id); public static org.jooq.Identity<mineplex.database.tables.records.ClanAlliancesRecord, java.lang.Integer> IDENTITY_clanAlliances = createIdentity(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id);
public static org.jooq.Identity<mineplex.database.tables.records.ClanEnemiesRecord, java.lang.Integer> IDENTITY_clanEnemies = createIdentity(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id); public static org.jooq.Identity<mineplex.database.tables.records.ClanEnemiesRecord, java.lang.Integer> IDENTITY_clanEnemies = createIdentity(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id);
public static org.jooq.Identity<mineplex.database.tables.records.ClansRecord, java.lang.Integer> IDENTITY_clans = createIdentity(mineplex.database.tables.Clans.clans, mineplex.database.tables.Clans.clans.id); public static org.jooq.Identity<mineplex.database.tables.records.ClansRecord, java.lang.Integer> IDENTITY_clans = createIdentity(mineplex.database.tables.Clans.clans, mineplex.database.tables.Clans.clans.id);
@ -222,6 +225,7 @@ public class Keys {
public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountTransactionsRecord> KEY_accountTransactions_PRIMARY = createUniqueKey(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id); public static final org.jooq.UniqueKey<mineplex.database.tables.records.AccountTransactionsRecord> KEY_accountTransactions_PRIMARY = createUniqueKey(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ActiveTournamentsRecord> KEY_activeTournaments_PRIMARY = createUniqueKey(mineplex.database.tables.ActiveTournaments.activeTournaments, mineplex.database.tables.ActiveTournaments.activeTournaments.name); public static final org.jooq.UniqueKey<mineplex.database.tables.records.ActiveTournamentsRecord> KEY_activeTournaments_PRIMARY = createUniqueKey(mineplex.database.tables.ActiveTournaments.activeTournaments, mineplex.database.tables.ActiveTournaments.activeTournaments.name);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.BonusRecord> KEY_bonus_PRIMARY = createUniqueKey(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId); public static final org.jooq.UniqueKey<mineplex.database.tables.records.BonusRecord> KEY_bonus_PRIMARY = createUniqueKey(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ChatsnapRecord> KEY_chatsnap_PRIMARY = createUniqueKey(mineplex.database.tables.Chatsnap.chatsnap, mineplex.database.tables.Chatsnap.chatsnap.id);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanAlliancesRecord> KEY_clanAlliances_PRIMARY = createUniqueKey(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id); public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanAlliancesRecord> KEY_clanAlliances_PRIMARY = createUniqueKey(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_PRIMARY = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id); public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_PRIMARY = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id);
public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_unique_clanId = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.clanId); public static final org.jooq.UniqueKey<mineplex.database.tables.records.ClanEnemiesRecord> KEY_clanEnemies_unique_clanId = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.clanId);

View File

@ -54,6 +54,19 @@ public class Routines {
return p; return p;
} }
/**
* Call <code>Account.check_vote</code>
*/
public static mineplex.database.routines.Check_vote callCheckVote(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer coinsChange, java.lang.Integer gemsChange) {
mineplex.database.routines.Check_vote p = new mineplex.database.routines.Check_vote();
p.setAccountId_in(accountId_in);
p.setCoinsChange(coinsChange);
p.setGemsChange(gemsChange);
p.execute(configuration);
return p;
}
/** /**
* Call <code>Account.createLeaderboard</code> * Call <code>Account.createLeaderboard</code>
*/ */

View File

@ -91,6 +91,11 @@ public class Tables {
*/ */
public static final mineplex.database.tables.Bonus bonus = mineplex.database.tables.Bonus.bonus; public static final mineplex.database.tables.Bonus bonus = mineplex.database.tables.Bonus.bonus;
/**
* The table Account.chatsnap
*/
public static final mineplex.database.tables.Chatsnap chatsnap = mineplex.database.tables.Chatsnap.chatsnap;
/** /**
* The table Account.clanAlliances * The table Account.clanAlliances
*/ */

View File

@ -0,0 +1,93 @@
/**
* This class is generated by jOOQ
*/
package mineplex.database.routines;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.5.2"
},
comments = "This class is generated by jOOQ"
)
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Check_vote extends org.jooq.impl.AbstractRoutine<java.lang.Void> implements java.io.Serializable, java.lang.Cloneable {
private static final long serialVersionUID = 2035299030;
/**
* The parameter <code>Account.check_vote.accountId_in</code>.
*/
public static final org.jooq.Parameter<java.lang.Integer> accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false);
/**
* The parameter <code>Account.check_vote.coinsChange</code>.
*/
public static final org.jooq.Parameter<java.lang.Integer> coinsChange = createParameter("coinsChange", org.jooq.impl.SQLDataType.INTEGER, false);
/**
* The parameter <code>Account.check_vote.gemsChange</code>.
*/
public static final org.jooq.Parameter<java.lang.Integer> gemsChange = createParameter("gemsChange", org.jooq.impl.SQLDataType.INTEGER, false);
/**
* The parameter <code>Account.check_vote.pass</code>.
*/
public static final org.jooq.Parameter<java.lang.Byte> pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false);
/**
* The parameter <code>Account.check_vote.outTime</code>.
*/
public static final org.jooq.Parameter<java.sql.Date> outTime = createParameter("outTime", org.jooq.impl.SQLDataType.DATE, false);
/**
* Create a new routine call instance
*/
public Check_vote() {
super("check_vote", mineplex.database.Account.Account);
addInParameter(accountId_in);
addInParameter(coinsChange);
addInParameter(gemsChange);
addOutParameter(pass);
addOutParameter(outTime);
}
/**
* Set the <code>accountId_in</code> parameter IN value to the routine
*/
public void setAccountId_in(java.lang.Integer value) {
setValue(mineplex.database.routines.Check_vote.accountId_in, value);
}
/**
* Set the <code>coinsChange</code> parameter IN value to the routine
*/
public void setCoinsChange(java.lang.Integer value) {
setValue(mineplex.database.routines.Check_vote.coinsChange, value);
}
/**
* Set the <code>gemsChange</code> parameter IN value to the routine
*/
public void setGemsChange(java.lang.Integer value) {
setValue(mineplex.database.routines.Check_vote.gemsChange, value);
}
/**
* Get the <code>pass</code> parameter OUT value from the routine
*/
public java.lang.Byte getPass() {
return getValue(pass);
}
/**
* Get the <code>outTime</code> parameter OUT value from the routine
*/
public java.sql.Date getOutTime() {
return getValue(outTime);
}
}

View File

@ -16,7 +16,7 @@ package mineplex.database.tables;
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AccountStat extends org.jooq.impl.TableImpl<mineplex.database.tables.records.AccountStatRecord> implements java.io.Serializable, java.lang.Cloneable { public class AccountStat extends org.jooq.impl.TableImpl<mineplex.database.tables.records.AccountStatRecord> implements java.io.Serializable, java.lang.Cloneable {
private static final long serialVersionUID = 956897097; private static final long serialVersionUID = 34581219;
/** /**
* The reference instance of <code>Account.accountStat</code> * The reference instance of <code>Account.accountStat</code>
@ -44,7 +44,7 @@ public class AccountStat extends org.jooq.impl.TableImpl<mineplex.database.table
/** /**
* The column <code>Account.accountStat.value</code>. * The column <code>Account.accountStat.value</code>.
*/ */
public final org.jooq.TableField<mineplex.database.tables.records.AccountStatRecord, java.lang.Long> value = createField("value", org.jooq.impl.SQLDataType.BIGINT.defaulted(true), this, ""); public final org.jooq.TableField<mineplex.database.tables.records.AccountStatRecord, org.jooq.types.ULong> value = createField("value", org.jooq.impl.SQLDataType.BIGINTUNSIGNED.defaulted(true), this, "");
/** /**
* Create a <code>Account.accountStat</code> table reference * Create a <code>Account.accountStat</code> table reference

View File

@ -16,7 +16,7 @@ package mineplex.database.tables;
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Bonus extends org.jooq.impl.TableImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable { public class Bonus extends org.jooq.impl.TableImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable {
private static final long serialVersionUID = -70389593; private static final long serialVersionUID = -524321170;
/** /**
* The reference instance of <code>Account.bonus</code> * The reference instance of <code>Account.bonus</code>
@ -46,6 +46,36 @@ public class Bonus extends org.jooq.impl.TableImpl<mineplex.database.tables.reco
*/ */
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Date> ranktime = createField("ranktime", org.jooq.impl.SQLDataType.DATE, this, ""); public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Date> ranktime = createField("ranktime", org.jooq.impl.SQLDataType.DATE, this, "");
/**
* The column <code>Account.bonus.votetime</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.sql.Date> votetime = createField("votetime", org.jooq.impl.SQLDataType.DATE, this, "");
/**
* The column <code>Account.bonus.dailyStreak</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.lang.Integer> dailyStreak = createField("dailyStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.bonus.maxDailyStreak</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.lang.Integer> maxDailyStreak = createField("maxDailyStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.bonus.voteStreak</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.lang.Integer> voteStreak = createField("voteStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.bonus.maxVoteStreak</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.lang.Integer> maxVoteStreak = createField("maxVoteStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.bonus.tickets</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.BonusRecord, java.lang.Integer> tickets = createField("tickets", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/** /**
* Create a <code>Account.bonus</code> table reference * Create a <code>Account.bonus</code> table reference
*/ */

View File

@ -0,0 +1,129 @@
/**
* This class is generated by jOOQ
*/
package mineplex.database.tables;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.5.2"
},
comments = "This class is generated by jOOQ"
)
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Chatsnap extends org.jooq.impl.TableImpl<mineplex.database.tables.records.ChatsnapRecord> implements java.io.Serializable, java.lang.Cloneable {
private static final long serialVersionUID = -176946707;
/**
* The reference instance of <code>Account.chatsnap</code>
*/
public static final mineplex.database.tables.Chatsnap chatsnap = new mineplex.database.tables.Chatsnap();
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<mineplex.database.tables.records.ChatsnapRecord> getRecordType() {
return mineplex.database.tables.records.ChatsnapRecord.class;
}
/**
* The column <code>Account.chatsnap.id</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.chatsnap.reporterId</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> reporterId = createField("reporterId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.chatsnap.reporteeId</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> reporteeId = createField("reporteeId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Account.chatsnap.time</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.sql.Timestamp> time = createField("time", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, "");
/**
* The column <code>Account.chatsnap.status</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.String> status = createField("status", org.jooq.impl.SQLDataType.VARCHAR.length(10).nullable(false).defaulted(true), this, "");
/**
* The column <code>Account.chatsnap.reason</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.String> reason = createField("reason", org.jooq.impl.SQLDataType.CLOB.length(65535).nullable(false), this, "");
/**
* The column <code>Account.chatsnap.data</code>.
*/
public final org.jooq.TableField<mineplex.database.tables.records.ChatsnapRecord, java.lang.String> data = createField("data", org.jooq.impl.SQLDataType.CLOB.length(16777215).nullable(false), this, "");
/**
* Create a <code>Account.chatsnap</code> table reference
*/
public Chatsnap() {
this("chatsnap", null);
}
/**
* Create an aliased <code>Account.chatsnap</code> table reference
*/
public Chatsnap(java.lang.String alias) {
this(alias, mineplex.database.tables.Chatsnap.chatsnap);
}
private Chatsnap(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.ChatsnapRecord> aliased) {
this(alias, aliased, null);
}
private Chatsnap(java.lang.String alias, org.jooq.Table<mineplex.database.tables.records.ChatsnapRecord> aliased, org.jooq.Field<?>[] parameters) {
super(alias, mineplex.database.Account.Account, aliased, parameters, "");
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Identity<mineplex.database.tables.records.ChatsnapRecord, java.lang.Integer> getIdentity() {
return mineplex.database.Keys.IDENTITY_chatsnap;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.UniqueKey<mineplex.database.tables.records.ChatsnapRecord> getPrimaryKey() {
return mineplex.database.Keys.KEY_chatsnap_PRIMARY;
}
/**
* {@inheritDoc}
*/
@Override
public java.util.List<org.jooq.UniqueKey<mineplex.database.tables.records.ChatsnapRecord>> getKeys() {
return java.util.Arrays.<org.jooq.UniqueKey<mineplex.database.tables.records.ChatsnapRecord>>asList(mineplex.database.Keys.KEY_chatsnap_PRIMARY);
}
/**
* {@inheritDoc}
*/
@Override
public mineplex.database.tables.Chatsnap as(java.lang.String alias) {
return new mineplex.database.tables.Chatsnap(alias, this);
}
/**
* Rename this table
*/
public mineplex.database.tables.Chatsnap rename(java.lang.String name) {
return new mineplex.database.tables.Chatsnap(name, null);
}
}

View File

@ -14,9 +14,9 @@ package mineplex.database.tables.records;
comments = "This class is generated by jOOQ" comments = "This class is generated by jOOQ"
) )
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.AccountStatRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3<java.lang.Integer, java.lang.Integer, java.lang.Long> { public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.AccountStatRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3<java.lang.Integer, java.lang.Integer, org.jooq.types.ULong> {
private static final long serialVersionUID = 1109290129; private static final long serialVersionUID = -516667486;
/** /**
* Setter for <code>Account.accountStat.accountId</code>. * Setter for <code>Account.accountStat.accountId</code>.
@ -49,15 +49,15 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
/** /**
* Setter for <code>Account.accountStat.value</code>. * Setter for <code>Account.accountStat.value</code>.
*/ */
public void setValue(java.lang.Long value) { public void setValue(org.jooq.types.ULong value) {
setValue(2, value); setValue(2, value);
} }
/** /**
* Getter for <code>Account.accountStat.value</code>. * Getter for <code>Account.accountStat.value</code>.
*/ */
public java.lang.Long getValue() { public org.jooq.types.ULong getValue() {
return (java.lang.Long) getValue(2); return (org.jooq.types.ULong) getValue(2);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -80,7 +80,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public org.jooq.Row3<java.lang.Integer, java.lang.Integer, java.lang.Long> fieldsRow() { public org.jooq.Row3<java.lang.Integer, java.lang.Integer, org.jooq.types.ULong> fieldsRow() {
return (org.jooq.Row3) super.fieldsRow(); return (org.jooq.Row3) super.fieldsRow();
} }
@ -88,7 +88,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public org.jooq.Row3<java.lang.Integer, java.lang.Integer, java.lang.Long> valuesRow() { public org.jooq.Row3<java.lang.Integer, java.lang.Integer, org.jooq.types.ULong> valuesRow() {
return (org.jooq.Row3) super.valuesRow(); return (org.jooq.Row3) super.valuesRow();
} }
@ -112,7 +112,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public org.jooq.Field<java.lang.Long> field3() { public org.jooq.Field<org.jooq.types.ULong> field3() {
return mineplex.database.tables.AccountStat.accountStat.value; return mineplex.database.tables.AccountStat.accountStat.value;
} }
@ -136,7 +136,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public java.lang.Long value3() { public org.jooq.types.ULong value3() {
return getValue(); return getValue();
} }
@ -162,7 +162,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public AccountStatRecord value3(java.lang.Long value) { public AccountStatRecord value3(org.jooq.types.ULong value) {
setValue(value); setValue(value);
return this; return this;
} }
@ -171,7 +171,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public AccountStatRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.Long value3) { public AccountStatRecord values(java.lang.Integer value1, java.lang.Integer value2, org.jooq.types.ULong value3) {
return this; return this;
} }
@ -189,7 +189,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl<mineple
/** /**
* Create a detached, initialised AccountStatRecord * Create a detached, initialised AccountStatRecord
*/ */
public AccountStatRecord(java.lang.Integer accountId, java.lang.Integer statId, java.lang.Long value) { public AccountStatRecord(java.lang.Integer accountId, java.lang.Integer statId, org.jooq.types.ULong value) {
super(mineplex.database.tables.AccountStat.accountStat); super(mineplex.database.tables.AccountStat.accountStat);
setValue(0, accountId); setValue(0, accountId);

View File

@ -14,9 +14,9 @@ package mineplex.database.tables.records;
comments = "This class is generated by jOOQ" comments = "This class is generated by jOOQ"
) )
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3<java.lang.Integer, java.sql.Timestamp, java.sql.Date> { public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.BonusRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> {
private static final long serialVersionUID = -64019858; private static final long serialVersionUID = -785434679;
/** /**
* Setter for <code>Account.bonus.accountId</code>. * Setter for <code>Account.bonus.accountId</code>.
@ -60,6 +60,90 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
return (java.sql.Date) getValue(2); return (java.sql.Date) getValue(2);
} }
/**
* Setter for <code>Account.bonus.votetime</code>.
*/
public void setVotetime(java.sql.Date value) {
setValue(3, value);
}
/**
* Getter for <code>Account.bonus.votetime</code>.
*/
public java.sql.Date getVotetime() {
return (java.sql.Date) getValue(3);
}
/**
* Setter for <code>Account.bonus.dailyStreak</code>.
*/
public void setDailyStreak(java.lang.Integer value) {
setValue(4, value);
}
/**
* Getter for <code>Account.bonus.dailyStreak</code>.
*/
public java.lang.Integer getDailyStreak() {
return (java.lang.Integer) getValue(4);
}
/**
* Setter for <code>Account.bonus.maxDailyStreak</code>.
*/
public void setMaxDailyStreak(java.lang.Integer value) {
setValue(5, value);
}
/**
* Getter for <code>Account.bonus.maxDailyStreak</code>.
*/
public java.lang.Integer getMaxDailyStreak() {
return (java.lang.Integer) getValue(5);
}
/**
* Setter for <code>Account.bonus.voteStreak</code>.
*/
public void setVoteStreak(java.lang.Integer value) {
setValue(6, value);
}
/**
* Getter for <code>Account.bonus.voteStreak</code>.
*/
public java.lang.Integer getVoteStreak() {
return (java.lang.Integer) getValue(6);
}
/**
* Setter for <code>Account.bonus.maxVoteStreak</code>.
*/
public void setMaxVoteStreak(java.lang.Integer value) {
setValue(7, value);
}
/**
* Getter for <code>Account.bonus.maxVoteStreak</code>.
*/
public java.lang.Integer getMaxVoteStreak() {
return (java.lang.Integer) getValue(7);
}
/**
* Setter for <code>Account.bonus.tickets</code>.
*/
public void setTickets(java.lang.Integer value) {
setValue(8, value);
}
/**
* Getter for <code>Account.bonus.tickets</code>.
*/
public java.lang.Integer getTickets() {
return (java.lang.Integer) getValue(8);
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Primary key information // Primary key information
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -73,23 +157,23 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Record3 type implementation // Record9 type implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public org.jooq.Row3<java.lang.Integer, java.sql.Timestamp, java.sql.Date> fieldsRow() { public org.jooq.Row9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> fieldsRow() {
return (org.jooq.Row3) super.fieldsRow(); return (org.jooq.Row9) super.fieldsRow();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public org.jooq.Row3<java.lang.Integer, java.sql.Timestamp, java.sql.Date> valuesRow() { public org.jooq.Row9<java.lang.Integer, java.sql.Timestamp, java.sql.Date, java.sql.Date, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer> valuesRow() {
return (org.jooq.Row3) super.valuesRow(); return (org.jooq.Row9) super.valuesRow();
} }
/** /**
@ -116,6 +200,54 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
return mineplex.database.tables.Bonus.bonus.ranktime; return mineplex.database.tables.Bonus.bonus.ranktime;
} }
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.sql.Date> field4() {
return mineplex.database.tables.Bonus.bonus.votetime;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field5() {
return mineplex.database.tables.Bonus.bonus.dailyStreak;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field6() {
return mineplex.database.tables.Bonus.bonus.maxDailyStreak;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field7() {
return mineplex.database.tables.Bonus.bonus.voteStreak;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field8() {
return mineplex.database.tables.Bonus.bonus.maxVoteStreak;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field9() {
return mineplex.database.tables.Bonus.bonus.tickets;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -140,6 +272,54 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
return getRanktime(); return getRanktime();
} }
/**
* {@inheritDoc}
*/
@Override
public java.sql.Date value4() {
return getVotetime();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value5() {
return getDailyStreak();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value6() {
return getMaxDailyStreak();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value7() {
return getVoteStreak();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value8() {
return getMaxVoteStreak();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value9() {
return getTickets();
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -171,7 +351,61 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public BonusRecord values(java.lang.Integer value1, java.sql.Timestamp value2, java.sql.Date value3) { public BonusRecord value4(java.sql.Date value) {
setVotetime(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord value5(java.lang.Integer value) {
setDailyStreak(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord value6(java.lang.Integer value) {
setMaxDailyStreak(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord value7(java.lang.Integer value) {
setVoteStreak(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord value8(java.lang.Integer value) {
setMaxVoteStreak(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord value9(java.lang.Integer value) {
setTickets(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BonusRecord values(java.lang.Integer value1, java.sql.Timestamp value2, java.sql.Date value3, java.sql.Date value4, java.lang.Integer value5, java.lang.Integer value6, java.lang.Integer value7, java.lang.Integer value8, java.lang.Integer value9) {
return this; return this;
} }
@ -189,11 +423,17 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.data
/** /**
* Create a detached, initialised BonusRecord * Create a detached, initialised BonusRecord
*/ */
public BonusRecord(java.lang.Integer accountId, java.sql.Timestamp dailytime, java.sql.Date ranktime) { public BonusRecord(java.lang.Integer accountId, java.sql.Timestamp dailytime, java.sql.Date ranktime, java.sql.Date votetime, java.lang.Integer dailyStreak, java.lang.Integer maxDailyStreak, java.lang.Integer voteStreak, java.lang.Integer maxVoteStreak, java.lang.Integer tickets) {
super(mineplex.database.tables.Bonus.bonus); super(mineplex.database.tables.Bonus.bonus);
setValue(0, accountId); setValue(0, accountId);
setValue(1, dailytime); setValue(1, dailytime);
setValue(2, ranktime); setValue(2, ranktime);
setValue(3, votetime);
setValue(4, dailyStreak);
setValue(5, maxDailyStreak);
setValue(6, voteStreak);
setValue(7, maxVoteStreak);
setValue(8, tickets);
} }
} }

View File

@ -0,0 +1,359 @@
/**
* This class is generated by jOOQ
*/
package mineplex.database.tables.records;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.5.2"
},
comments = "This class is generated by jOOQ"
)
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ChatsnapRecord extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.ChatsnapRecord> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.sql.Timestamp, java.lang.String, java.lang.String, java.lang.String> {
private static final long serialVersionUID = 2087133341;
/**
* Setter for <code>Account.chatsnap.id</code>.
*/
public void setId(java.lang.Integer value) {
setValue(0, value);
}
/**
* Getter for <code>Account.chatsnap.id</code>.
*/
public java.lang.Integer getId() {
return (java.lang.Integer) getValue(0);
}
/**
* Setter for <code>Account.chatsnap.reporterId</code>.
*/
public void setReporterId(java.lang.Integer value) {
setValue(1, value);
}
/**
* Getter for <code>Account.chatsnap.reporterId</code>.
*/
public java.lang.Integer getReporterId() {
return (java.lang.Integer) getValue(1);
}
/**
* Setter for <code>Account.chatsnap.reporteeId</code>.
*/
public void setReporteeId(java.lang.Integer value) {
setValue(2, value);
}
/**
* Getter for <code>Account.chatsnap.reporteeId</code>.
*/
public java.lang.Integer getReporteeId() {
return (java.lang.Integer) getValue(2);
}
/**
* Setter for <code>Account.chatsnap.time</code>.
*/
public void setTime(java.sql.Timestamp value) {
setValue(3, value);
}
/**
* Getter for <code>Account.chatsnap.time</code>.
*/
public java.sql.Timestamp getTime() {
return (java.sql.Timestamp) getValue(3);
}
/**
* Setter for <code>Account.chatsnap.status</code>.
*/
public void setStatus(java.lang.String value) {
setValue(4, value);
}
/**
* Getter for <code>Account.chatsnap.status</code>.
*/
public java.lang.String getStatus() {
return (java.lang.String) getValue(4);
}
/**
* Setter for <code>Account.chatsnap.reason</code>.
*/
public void setReason(java.lang.String value) {
setValue(5, value);
}
/**
* Getter for <code>Account.chatsnap.reason</code>.
*/
public java.lang.String getReason() {
return (java.lang.String) getValue(5);
}
/**
* Setter for <code>Account.chatsnap.data</code>.
*/
public void setData(java.lang.String value) {
setValue(6, value);
}
/**
* Getter for <code>Account.chatsnap.data</code>.
*/
public java.lang.String getData() {
return (java.lang.String) getValue(6);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Record1<java.lang.Integer> key() {
return (org.jooq.Record1) super.key();
}
// -------------------------------------------------------------------------
// Record7 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Row7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.sql.Timestamp, java.lang.String, java.lang.String, java.lang.String> fieldsRow() {
return (org.jooq.Row7) super.fieldsRow();
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Row7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.sql.Timestamp, java.lang.String, java.lang.String, java.lang.String> valuesRow() {
return (org.jooq.Row7) super.valuesRow();
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field1() {
return mineplex.database.tables.Chatsnap.chatsnap.id;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field2() {
return mineplex.database.tables.Chatsnap.chatsnap.reporterId;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.Integer> field3() {
return mineplex.database.tables.Chatsnap.chatsnap.reporteeId;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.sql.Timestamp> field4() {
return mineplex.database.tables.Chatsnap.chatsnap.time;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.String> field5() {
return mineplex.database.tables.Chatsnap.chatsnap.status;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.String> field6() {
return mineplex.database.tables.Chatsnap.chatsnap.reason;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Field<java.lang.String> field7() {
return mineplex.database.tables.Chatsnap.chatsnap.data;
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value1() {
return getId();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value2() {
return getReporterId();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.Integer value3() {
return getReporteeId();
}
/**
* {@inheritDoc}
*/
@Override
public java.sql.Timestamp value4() {
return getTime();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.String value5() {
return getStatus();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.String value6() {
return getReason();
}
/**
* {@inheritDoc}
*/
@Override
public java.lang.String value7() {
return getData();
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value1(java.lang.Integer value) {
setId(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value2(java.lang.Integer value) {
setReporterId(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value3(java.lang.Integer value) {
setReporteeId(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value4(java.sql.Timestamp value) {
setTime(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value5(java.lang.String value) {
setStatus(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value6(java.lang.String value) {
setReason(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord value7(java.lang.String value) {
setData(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ChatsnapRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.Integer value3, java.sql.Timestamp value4, java.lang.String value5, java.lang.String value6, java.lang.String value7) {
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached ChatsnapRecord
*/
public ChatsnapRecord() {
super(mineplex.database.tables.Chatsnap.chatsnap);
}
/**
* Create a detached, initialised ChatsnapRecord
*/
public ChatsnapRecord(java.lang.Integer id, java.lang.Integer reporterId, java.lang.Integer reporteeId, java.sql.Timestamp time, java.lang.String status, java.lang.String reason, java.lang.String data) {
super(mineplex.database.tables.Chatsnap.chatsnap);
setValue(0, id);
setValue(1, reporterId);
setValue(2, reporteeId);
setValue(3, time);
setValue(4, status);
setValue(5, reason);
setValue(6, data);
}
}

View File

@ -46,6 +46,7 @@ import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater; import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater; import mineplex.core.updater.Updater;
import mineplex.core.velocity.VelocityFix;
import mineplex.core.visibility.VisibilityManager; import mineplex.core.visibility.VisibilityManager;
import mineplex.hub.modules.StackerManager; import mineplex.hub.modules.StackerManager;
import mineplex.hub.poll.PollManager; import mineplex.hub.poll.PollManager;
@ -78,6 +79,9 @@ public class Hub extends JavaPlugin implements IRelation
//Logger.initialize(this); //Logger.initialize(this);
//Velocity Fix
new VelocityFix(this);
//Static Modules //Static Modules
CommandCenter.Initialize(this); CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);

View File

@ -78,14 +78,7 @@ public class NewsManager extends MiniPlugin
{ {
int newsPos = Integer.parseInt(iterator.next()); int newsPos = Integer.parseInt(iterator.next());
ChatColor col = ChatColor.RED; newsStrings[newsPos - 1] = newsEntries.get(newsPos + "");
if (newsPos == 1) col = ChatColor.GOLD;
else if (newsPos == 2) col = ChatColor.YELLOW;
else if (newsPos == 3) col = ChatColor.GREEN;
else if (newsPos == 4) col = ChatColor.AQUA;
else if (newsPos == 5) col = ChatColor.LIGHT_PURPLE;
newsStrings[newsPos - 1] = col + C.Bold + "MINEPLEX" + ChatColor.RESET + " - " + newsEntries.get(newsPos + "");
if (newsStrings[newsPos - 1].length() > 64) if (newsStrings[newsPos - 1].length() > 64)
newsStrings[newsPos - 1] = newsStrings[newsPos - 1].substring(0, 64); newsStrings[newsPos - 1] = newsStrings[newsPos - 1].substring(0, 64);

View File

@ -255,7 +255,8 @@ public class StackerManager extends MiniPlugin implements IThrown
Manager.SetPortalDelay(rider); Manager.SetPortalDelay(rider);
rider.leaveVehicle(); rider.leaveVehicle();
rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2)); UtilAction.velocity(rider, new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2),
1, false, 0, 0, 0, false);
rider = rider.getPassenger(); rider = rider.getPassenger();
} }

View File

@ -10,4 +10,9 @@ public class ServerInfo
public String ServerType; public String ServerType;
public String Game; public String Game;
public boolean HostedByStaff; public boolean HostedByStaff;
public int getAvailableSlots()
{
return MaxPlayers - CurrentPlayers;
}
} }

View File

@ -10,8 +10,11 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set; import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -56,7 +59,9 @@ import mineplex.hub.queue.QueueManager;
import mineplex.hub.queue.ui.QueueShop; import mineplex.hub.queue.ui.QueueShop;
import mineplex.hub.server.ui.LobbyShop; import mineplex.hub.server.ui.LobbyShop;
import mineplex.hub.server.ui.QuickShop; import mineplex.hub.server.ui.QuickShop;
import mineplex.hub.server.ui.ServerCountSorter;
import mineplex.hub.server.ui.ServerNpcShop; import mineplex.hub.server.ui.ServerNpcShop;
import mineplex.serverdata.Region;
import mineplex.serverdata.data.MinecraftServer; import mineplex.serverdata.data.MinecraftServer;
import mineplex.serverdata.data.ServerGroup; import mineplex.serverdata.data.ServerGroup;
@ -64,7 +69,12 @@ public class ServerManager extends MiniPlugin
{ {
private static final Long FREE_PORTAL_TIMER = 20000L; private static final Long FREE_PORTAL_TIMER = 20000L;
private static final Long BETA_PORTAL_TIMER = 120000L; private static final Long BETA_PORTAL_TIMER = 120000L;
private static final Random random = new Random();
public final int TOP_SERVERS = 3; // The number of top contending servers for auto-joining games
public final int MIN_SLOTS_REQUIRED = 12; // The number of slots the max server must have for auto-join
public final long QUEUE_COOLDOWN = 2000; // Cooldown (in milliseconds) between queueing again for players
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private Portal _portal; private Portal _portal;
@ -74,6 +84,7 @@ public class ServerManager extends MiniPlugin
private StackerManager _stackerManager; private StackerManager _stackerManager;
private QueueManager _queueManager; private QueueManager _queueManager;
private NautHashMap<String, Long> _queueCooldowns = new NautHashMap<String, Long>();
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>(); private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
private NautHashMap<String, String> _serverKeyTagMap = new NautHashMap<String, String>(); private NautHashMap<String, String> _serverKeyTagMap = new NautHashMap<String, String>();
private NautHashMap<String, Integer> _serverPlayerCounts = new NautHashMap<String, Integer>(); private NautHashMap<String, Integer> _serverPlayerCounts = new NautHashMap<String, Integer>();
@ -108,7 +119,7 @@ public class ServerManager extends MiniPlugin
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord"); plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
LoadServers(); loadServers();
_quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu"); _quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu");
_lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu"); _lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu");
@ -278,18 +289,6 @@ public class ServerManager extends MiniPlugin
timeLeft = 0; timeLeft = 0;
} }
// if (party != null)
// {
// if (player.getName().equals(party.GetLeader()))
// {
// for (Player partyPlayer : party.GetPlayersOnline())
// {
// if (!partyPlayer.equals(player))
// timeLeft = Math.max(timeLeft, getMillisecondsUntilPortal(partyPlayer));
// }
// }
// }
return timeLeft; return timeLeft;
} }
@ -303,18 +302,18 @@ public class ServerManager extends MiniPlugin
_serverInfoMap.remove(serverName); _serverInfoMap.remove(serverName);
} }
public void addServerGroup(String serverKey, String...serverTag) public void addServerGroup(ServerGroup serverGroup)
{ {
_serverKeyInfoMap.put(serverKey, new HashSet<ServerInfo>()); _serverKeyInfoMap.put(serverGroup.getName(), new HashSet<ServerInfo>());
_serverKeyTagMap.put(serverGroup.getPrefix(), serverGroup.getName());
for (String tag : serverTag) if (!serverGroup.getServerNpcName().isEmpty())
_serverKeyTagMap.put(tag, serverKey); _serverKeyTagMap.put(serverGroup.getServerNpcName(), serverGroup.getName());
} }
public void AddServerNpc(String serverNpcName, String...serverTag) public void AddServerNpc(ServerGroup serverGroup)
{ {
addServerGroup(serverNpcName, serverTag); _serverNpcShopMap.put(serverGroup.getServerNpcName(), new ServerNpcShop(this, _clientManager, _donationManager, serverGroup));
_serverNpcShopMap.put(serverNpcName, new ServerNpcShop(this, _clientManager, _donationManager, serverNpcName));
} }
public void RemoveServerNpc(String serverNpcName) public void RemoveServerNpc(String serverNpcName)
@ -396,7 +395,6 @@ public class ServerManager extends MiniPlugin
_retrieving = true; _retrieving = true;
_statusManager.retrieveServerGroups(new Callback<Collection<ServerGroup>>() _statusManager.retrieveServerGroups(new Callback<Collection<ServerGroup>>()
{ {
public void run(final Collection<ServerGroup> serverGroups) public void run(final Collection<ServerGroup> serverGroups)
@ -482,6 +480,8 @@ public class ServerManager extends MiniPlugin
}); });
} }
}); });
updateCooldowns();
} }
public void Help(Player caller, String message) public void Help(Player caller, String message)
@ -522,6 +522,113 @@ public class ServerManager extends MiniPlugin
} }
} }
/**
* Select a {@code serverType} for a {@code player} that wishes to automatically join the best server
* available for that server type.
* @param player - the player hoping to select a server
* @param serverType - the name of the type of server to be joined
*/
public void selectServer(Player player, String serverType)
{
if (isOnCooldown(player))
{
return;
}
ServerInfo bestServer = getBestServer(player, serverType);
if (bestServer != null)
{
SelectServer(player, bestServer);
addCooldown(player);
}
}
private boolean isOnCooldown(Player player)
{
if (_queueCooldowns.containsKey(player.getName()))
{
long elapsed = System.currentTimeMillis() - _queueCooldowns.get(player.getName());
return elapsed < QUEUE_COOLDOWN;
}
return false;
}
private void addCooldown(Player player)
{
_queueCooldowns.put(player.getName(), System.currentTimeMillis());
}
private void updateCooldowns()
{
for (String playerName : _queueCooldowns.keySet())
{
Player player = Bukkit.getPlayer(playerName);
if (player == null || !isOnCooldown(player))
{
_queueCooldowns.remove(playerName);
}
}
}
/**
* @param serverType - the type of server that should be fetched
* @return the best server that a new player should join according to a {@code serverType} constraint.
*/
public ServerInfo getBestServer(Player player, String serverKey)
{
if (_serverKeyTagMap.containsKey(serverKey)) // Update key to full-name if a tag pair exists
{
serverKey = _serverKeyTagMap.get(serverKey);
}
Collection<ServerInfo> serverList = GetServerList(serverKey);
if (serverList == null) return null;
List<ServerInfo> servers = new ArrayList<ServerInfo>(serverList);
Collections.sort(servers, new ServerCountSorter());
servers = fetchOpenServers(player, servers, servers.size()); // Removes all full servers from list
int count = Math.min(servers.size(), TOP_SERVERS);
if (count > 0)
{
ServerInfo largestServer = servers.get(0);
if (largestServer.getAvailableSlots() >= MIN_SLOTS_REQUIRED)
{
return largestServer;
}
else
{
return servers.get(random.nextInt(count));
}
}
return null;
}
public List<ServerInfo> fetchOpenServers(Player player, List<ServerInfo> servers, int count)
{
List<ServerInfo> results = new ArrayList<ServerInfo>();
int requiredSlots = (servers.size() > 0) ? GetRequiredSlots(player, servers.get(0).ServerType) : 0;
for (ServerInfo server : servers)
{
if (results.size() >= count) break;
if (server.getAvailableSlots() > requiredSlots)
{
results.add(server);
}
}
return results;
}
public void ListServerNpcs(Player caller) public void ListServerNpcs(Player caller)
{ {
UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:")); UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:"));
@ -555,7 +662,7 @@ public class ServerManager extends MiniPlugin
} }
} }
public void LoadServers() public void loadServers()
{ {
_serverInfoMap.clear(); _serverInfoMap.clear();
_serverUpdate.clear(); _serverUpdate.clear();
@ -567,83 +674,59 @@ public class ServerManager extends MiniPlugin
_serverKeyTagMap.clear(); _serverKeyTagMap.clear();
FileInputStream fstream = null; Region region = getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
BufferedReader br = null;
HashSet<String> npcNames = new HashSet<String>();
try try
{ {
File npcFile = new File("ServerManager.dat"); for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null))
if (npcFile.exists())
{ {
fstream = new FileInputStream(npcFile); if (!serverGroup.getServerNpcName().isEmpty())
br = new BufferedReader(new InputStreamReader(fstream));
String line = br.readLine();
while (line != null)
{ {
String serverNpcName = line.substring(0, line.indexOf('|')).trim(); if (!HasServerNpc(serverGroup.getServerNpcName()))
String[] serverTags = line.substring(line.indexOf('|') + 1, line.indexOf('|', line.indexOf('|') + 1)).trim().split(",");
String[] locations = line.substring(line.indexOf('|', line.indexOf('|') + 1) + 1).trim().split(",");
for (String location : locations)
{ {
_serverPortalLocations.put(ParseVector(location), serverNpcName); AddServerNpc(serverGroup);
addServerGroup(serverGroup);
}
} }
if (!HasServerNpc(serverNpcName)) if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty())
{ {
AddServerNpc(serverNpcName, serverTags); Vector bottomVector = ParseVector(serverGroup.getPortalBottomCornerLocation());
Vector topVector = ParseVector(serverGroup.getPortalTopCornerLocation());
int blocks = 0;
while (blocks < 10 && (bottomVector.getBlockX() != topVector.getBlockX() || bottomVector.getBlockZ() != topVector.getBlockZ()))
{
_serverPortalLocations.put(new Vector(bottomVector.getBlockX(), bottomVector.getBlockY(), bottomVector.getBlockZ()), serverGroup.getServerNpcName());
if (bottomVector.getBlockX() != topVector.getBlockX())
{
bottomVector.add(new Vector(-(bottomVector.getBlockX() - topVector.getBlockX()) / Math.abs(bottomVector.getBlockX() - topVector.getBlockX()), 0, 0));
}
else if (bottomVector.getBlockZ() != topVector.getBlockZ())
{
bottomVector.add(new Vector(0, 0, -(bottomVector.getBlockZ() - topVector.getBlockZ()) / Math.abs(bottomVector.getBlockZ() - topVector.getBlockZ())));
} }
npcNames.add(serverNpcName); blocks++;
}
line = br.readLine(); _serverPortalLocations.put(bottomVector, serverGroup.getServerNpcName());
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("ServerManager - Error parsing servers file : " + e.getMessage()); System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage());
}
finally
{
if (br != null)
{
try
{
br.close();
}
catch (IOException e)
{
e.printStackTrace();
}
} }
if (fstream != null) ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT");
{ ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS");
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
for (String npcName : npcNames) AddServerNpc(eventGroup);
{ addServerGroup(eventGroup);
if (!_serverNpcShopMap.containsKey(npcName)) AddServerNpc(mpsGroup);
_serverNpcShopMap.remove(npcName); addServerGroup(mpsGroup);
if (!_serverKeyInfoMap.containsKey(npcName))
_serverKeyInfoMap.remove(npcName);
}
} }
public int GetRequiredSlots(Player player, String serverType) public int GetRequiredSlots(Player player, String serverType)

View File

@ -14,7 +14,8 @@ public class LobbyShop extends ShopBase<ServerManager>
{ {
super(plugin, clientManager, donationManager, name); super(plugin, clientManager, donationManager, name);
plugin.addServerGroup("Lobby", "Lobby"); // TODO: Why is this needed? Re-add?
//plugin.addServerGroup("Lobby", "Lobby");
} }
@Override @Override

View File

@ -0,0 +1,13 @@
package mineplex.hub.server.ui;
import java.util.Comparator;
import mineplex.hub.server.ServerInfo;
public class ServerCountSorter implements Comparator<ServerInfo>
{
public int compare(ServerInfo a, ServerInfo b)
{
return a.CurrentPlayers - b.CurrentPlayers;
}
}

View File

@ -17,6 +17,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.game.GameDisplay; import mineplex.core.game.GameDisplay;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
@ -41,7 +42,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey) public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey)
{ {
super(plugin, shop, clientManager, donationManager, name, player, 54); super(plugin, shop, clientManager, donationManager, name, player, 27);
_serverNpcKey = serverNpcKey; _serverNpcKey = serverNpcKey;
@ -51,7 +52,25 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
@Override @Override
protected void buildPage() protected void buildPage()
{ {
/*
setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Solo " + C.cGray + getName(), new String[]
{
ChatColor.RESET + "Solo Mode",
ChatColor.RESET + "",
ChatColor.RESET + "Click to play!",
ChatColor.RESET + "",
ChatColor.RESET + "Teaming in Solo Mode is bannable!",
}));
setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL.getId(), (byte)0, 2, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Team " + C.cGray + getName(), new String[]
{
ChatColor.RESET + "Team Mode",
ChatColor.RESET + "",
ChatColor.RESET + "Click to play!"
}));
*/
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().GetServerList(_serverNpcKey)); List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().GetServerList(_serverNpcKey));
int slotsNeeded = 1; int slotsNeeded = 1;
if (serverList.size() > 0) if (serverList.size() > 0)
@ -401,7 +420,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
{ {
int slots = getPlugin().GetRequiredSlots(player, serverInfo.ServerType); int slots = getPlugin().GetRequiredSlots(player, serverInfo.ServerType);
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || getClient().GetRank().Has(Rank.ULTRA))) if (serverInfo.getAvailableSlots() < slots && !(getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || getClient().GetRank().Has(Rank.ULTRA)))
{ {
playDenySound(player); playDenySound(player);
return; return;

View File

@ -11,18 +11,31 @@ import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.serverdata.data.ServerGroup;
public class ServerNpcShop extends ShopBase<ServerManager> public class ServerNpcShop extends ShopBase<ServerManager>
{ {
public ServerNpcShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name) private ServerGroup _serverGroup;
public ServerNpcShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager, ServerGroup serverGroup)
{ {
super(plugin, clientManager, donationManager, name); super(plugin, clientManager, donationManager, serverGroup.getServerNpcName());
_serverGroup = serverGroup;
} }
@Override @Override
protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player) protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player)
{ {
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), getName(), player, getName()); if (_serverGroup.getPrefix().equalsIgnoreCase("MPS") || _serverGroup.getPrefix().equalsIgnoreCase("EVENT"))
{
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
}
else
{
return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
}
} }
@Override @Override
@ -65,4 +78,16 @@ public class ServerNpcShop extends ShopBase<ServerManager>
{ {
getPlugin().getHubManager().GetVisibility().removeHiddenPlayer(player); getPlugin().getHubManager().GetVisibility().removeHiddenPlayer(player);
} }
@Override
public boolean attemptShopOpen(Player player)
{
if (_serverGroup.getTeamServerKey().isEmpty() && !_serverGroup.getPrefix().equalsIgnoreCase("EVENT") && !_serverGroup.getPrefix().equalsIgnoreCase("MPS")) // Has no team server key, so auto-join
{
getPlugin().selectServer(player, getName());
return false;
}
return super.attemptShopOpen(player);
}
} }

View File

@ -0,0 +1,90 @@
package mineplex.hub.server.ui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.meta.SkullMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager;
import mineplex.core.game.GameDisplay;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerInfo;
import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ServerSorter;
import mineplex.hub.server.ui.button.JoinServerButton;
import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectTypeButton;
import mineplex.serverdata.data.ServerGroup;
public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
{
private ServerGroup _serverGroup;
public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager,
Player player, ServerGroup serverGroup)
{
super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27);
_serverGroup = serverGroup;
buildPage();
}
@Override
protected void buildPage()
{
String name = _serverGroup.getName();
setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 1, ChatColor.RESET + C.cYellow + "Solo " + C.cGray + name, new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + C.cRed + C.Bold + "WARNING:" + ChatColor.RESET + "Teaming in Solo Mode is bannable!",
ChatColor.RESET + "",
ChatColor.RESET + C.cGreen + "Click to Play",
}));
setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 2, ChatColor.RESET + C.cYellow + "Team " + name, new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + C.cGray + "2 Player Teams",
ChatColor.RESET + "",
ChatColor.RESET + C.cGreen + "Click to Play"
}));
getButtonMap().put(12, new SelectTypeButton(this, false));
getButtonMap().put(14, new SelectTypeButton(this, true));
}
public void Update()
{
getButtonMap().clear();
buildPage();
}
public void selectServer(Player player, boolean team)
{
if (team)
{
getPlugin().selectServer(player, _serverGroup.getTeamServerKey()); // TODO: Grab the team-key instead of regular game key
}
else
{
getPlugin().selectServer(player, _serverGroup.getPrefix());
}
}
}

View File

@ -0,0 +1,28 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ServerInfo;
import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.IServerPage;
import mineplex.hub.server.ui.ServerTypePage;
public class SelectTypeButton implements IButton
{
private ServerTypePage _page;
private boolean _teamBased;
public SelectTypeButton(ServerTypePage page, boolean teamBased)
{
_page = page;
_teamBased = teamBased;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_page.selectServer(player, _teamBased);
}
}

View File

@ -26,6 +26,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -209,7 +210,8 @@ public class Blizzard extends SkillActive
if (damagee == null) return; if (damagee == null) return;
event.SetCancelled(GetName()); event.SetCancelled(GetName());
damagee.setVelocity(proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0))); UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)),
1, false, 0, 0, 0, false);
} }
@EventHandler @EventHandler

View File

@ -395,7 +395,7 @@ public class DamageManager extends MiniPlugin
if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR)) if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
{ {
Bukkit.broadcastMessage("--------- " + Bukkit.broadcastMessage("--------- " +
UtilEnt.getName(event.GetDamageeEntity()) + " hurt by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" ); UtilEnt.getName(event.GetDamageeEntity()) + " hit by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage())); Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage()));
} }
@ -422,15 +422,6 @@ public class DamageManager extends MiniPlugin
} }
} }
@EventHandler
public void debugVel2(PlayerVelocityEvent event)
{
if (UtilGear.isMat(((Player)event.getPlayer()).getItemInHand(), Material.SUGAR))
{
Bukkit.broadcastMessage(F.main("Debug", "Event: " + event.getVelocity().length()));
}
}
private void DisplayDamage(CustomDamageEvent event) private void DisplayDamage(CustomDamageEvent event)
{ {
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import org.bukkit.Material; import org.bukkit.Material;
@ -54,8 +55,7 @@ public class PistonJump extends MiniPlugin
//Vector //Vector
Vector vec = new Vector(0,1.2,0); Vector vec = new Vector(0,1.2,0);
player.setVelocity(vec); UtilAction.velocity(player, vec);
player.setFallDistance(0);
} }
final Block block = below; final Block block = below;

View File

@ -57,6 +57,12 @@ public class ServerGroup
private boolean _staffOnly; private boolean _staffOnly;
private String _resourcePack = ""; private String _resourcePack = "";
private String _npcName = "";
private String _portalBottomCornerLocation = "";
private String _portalTopCornerLocation = "";
private String _teamServerKey = "";
private Region _region; private Region _region;
private Set<MinecraftServer> _servers; private Set<MinecraftServer> _servers;
@ -101,6 +107,10 @@ public class ServerGroup
_resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : ""; _resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : "";
_host = data.get("host"); _host = data.get("host");
_region = data.containsKey("region") ? Region.valueOf(data.get("region")) : Region.ALL; _region = data.containsKey("region") ? Region.valueOf(data.get("region")) : Region.ALL;
_teamServerKey = data.containsKey("teamServerKey") ? data.get("teamServerKey") : "";
_portalBottomCornerLocation = data.containsKey("portalBottomCornerLocation") ? data.get("portalBottomCornerLocation") : "";
_portalTopCornerLocation = data.containsKey("portalTopCornerLocation") ? data.get("portalTopCornerLocation") : "";
_npcName = data.containsKey("npcName") ? data.get("npcName") : "";
if (serverStatuses != null) if (serverStatuses != null)
parseServers(serverStatuses); parseServers(serverStatuses);
@ -109,7 +119,8 @@ public class ServerGroup
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats , boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region) , boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
, String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName)
{ {
_name = name; _name = name;
_prefix = prefix; _prefix = prefix;
@ -148,6 +159,17 @@ public class ServerGroup
_whitelist = whitelist; _whitelist = whitelist;
_resourcePack = resourcePack; _resourcePack = resourcePack;
_region = region; _region = region;
_teamServerKey = teamServerKey;
_portalBottomCornerLocation = portalBottomCornerLocation;
_portalTopCornerLocation = portalTopCornerLocation;
_npcName = npcName;
}
public ServerGroup(String name, String npcName, String prefix)
{
_name = name;
_npcName = npcName;
_prefix = prefix;
} }
public String getName() { return _name; } public String getName() { return _name; }
@ -196,6 +218,12 @@ public class ServerGroup
public String getResourcePack() { return _resourcePack; } public String getResourcePack() { return _resourcePack; }
public Region getRegion() { return _region; } public Region getRegion() { return _region; }
public String getTeamServerKey() { return _teamServerKey; }
public String getServerNpcName() { return _npcName; }
public String getPortalBottomCornerLocation() { return _portalBottomCornerLocation; }
public String getPortalTopCornerLocation() { return _portalTopCornerLocation; }
public Set<MinecraftServer> getServers() { return _servers; } public Set<MinecraftServer> getServers() { return _servers; }
public int getServerCount() public int getServerCount()
@ -350,6 +378,10 @@ public class ServerGroup
_dataMap.put("resourcePack", _resourcePack); _dataMap.put("resourcePack", _resourcePack);
_dataMap.put("host", _host); _dataMap.put("host", _host);
_dataMap.put("region", _region.name()); _dataMap.put("region", _region.name());
_dataMap.put("teamServerKey", _teamServerKey);
_dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation);
_dataMap.put("portalTopCornerLocation", _portalTopCornerLocation);
_dataMap.put("npcName", _npcName);
} }
return _dataMap; return _dataMap;

View File

@ -48,6 +48,7 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater; import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater; import mineplex.core.updater.Updater;
import mineplex.core.velocity.VelocityFix;
import mineplex.core.visibility.VisibilityManager; import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
@ -86,11 +87,15 @@ public class Arcade extends JavaPlugin
_clientManager = new CoreClientManager(this, webServerAddress); _clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(_clientManager); CommandCenter.Instance.setClientManager(_clientManager);
ItemStackFactory.Initialize(this, false); ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this); Recharge.Initialize(this);
VisibilityManager.Initialize(this); VisibilityManager.Initialize(this);
Give.Initialize(this); Give.Initialize(this);
//Velocity Fix
new VelocityFix(this);
_donationManager = new DonationManager(this, _clientManager, webServerAddress); _donationManager = new DonationManager(this, _clientManager, webServerAddress);
_serverConfiguration = new ServerConfiguration(this, _clientManager); _serverConfiguration = new ServerConfiguration(this, _clientManager);

View File

@ -49,6 +49,7 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -1333,7 +1334,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.teleport(GetGame().GetSpectatorLocation()); player.teleport(GetGame().GetSpectatorLocation());
//Set Spec State //Set Spec State
player.setVelocity(new Vector(0,1,0)); UtilAction.velocity(player, new Vector(0,1,0));
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(true); player.setFlying(true);
player.setFlySpeed(0.1f); player.setFlySpeed(0.1f);

View File

@ -45,6 +45,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
@ -1178,7 +1179,7 @@ public class Bridge extends TeamGame implements OreObsfucation
UtilPlayer.message(event.getPlayer(), F.main("Game", UtilPlayer.message(event.getPlayer(), F.main("Game",
"Cannot place blocks in liquids until Bridge is down.")); "Cannot place blocks in liquids until Bridge is down."));
event.getPlayer().setVelocity(new Vector(0,-0.5,0)); UtilAction.velocity(event.getPlayer(), new Vector(0, -0.5, 0));
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -67,6 +67,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
@ -707,7 +708,7 @@ public class Build extends SoloGame
event.setTo(event.getFrom()); event.setTo(event.getFrom());
//Velocity //Velocity
event.getPlayer().setVelocity(UtilAlg.getTrajectory(event.getTo(), data.Spawn)); UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory(event.getTo(), data.Spawn));
} }
} }

View File

@ -34,6 +34,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -526,8 +527,7 @@ public class DragonEscape extends SoloGame
//Teleport //Teleport
player.teleport(target.getLocation().add(0, 0.5, 0)); player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0)); UtilAction.velocity(player, new Vector(0,0,0));
player.setFallDistance(0);
//Record //Record
_warpTime.put(player, System.currentTimeMillis()); _warpTime.put(player, System.currentTimeMillis());

View File

@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
@ -540,8 +541,7 @@ public class DragonEscapeTeams extends TeamGame
//Teleport //Teleport
player.teleport(target.getLocation().add(0, 0.5, 0)); player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0)); UtilAction.velocity(player, new Vector(0,0,0));
player.setFallDistance(0);
//Record //Record
_warpTime.put(player, System.currentTimeMillis()); _warpTime.put(player, System.currentTimeMillis());

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -15,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -225,7 +227,8 @@ public class HoleInTheWall extends SoloGame
{ {
wall.getKnockedPlayers().add(player.getUniqueId()); wall.getKnockedPlayers().add(player.getUniqueId());
player.setVelocity(_wallVector.clone().normalize().multiply(5).setY(0.3));
UtilAction.velocity(player, _wallVector.clone().normalize().multiply(5).setY(0.3));
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2, 1F); player.playSound(player.getLocation(), Sound.NOTE_BASS, 2, 1F);
} }
/*Location toTeleport = player.getLocation(); /*Location toTeleport = player.getLocation();

View File

@ -1305,7 +1305,7 @@ public class MineStrike extends TeamGame
//Mini-Stun //Mini-Stun
else else
{ {
event.GetDamageePlayer().setVelocity(new Vector(0,0,0)); UtilAction.velocity(event.GetDamageePlayer(), new Vector(0,0,0));
} }
event.SetKnockback(false); event.SetKnockback(false);

View File

@ -35,6 +35,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -307,7 +308,7 @@ public class Paintball extends TeamGame
((CraftPlayer)player).getHandle().spectating = true; ((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false; ((CraftPlayer)player).getHandle().k = false;
player.setVelocity(new Vector(0,1.2,0)); UtilAction.velocity(player, new Vector(0,1.2,0));
_doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor())); _doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor()));
} }

View File

@ -5,18 +5,6 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -32,12 +20,28 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.quiver.kits.*; import nautilus.game.arcade.game.games.quiver.kits.KitBrawler;
import nautilus.game.arcade.game.games.quiver.kits.KitEnchanter;
import nautilus.game.arcade.game.games.quiver.kits.KitLeaper;
import nautilus.game.arcade.game.games.quiver.kits.KitNinja;
import nautilus.game.arcade.game.games.quiver.kits.KitSlamShot;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.SharpShooterStatTracker; import nautilus.game.arcade.stats.SharpShooterStatTracker;
import nautilus.game.arcade.stats.WinWithoutBowStatTracker; import nautilus.game.arcade.stats.WinWithoutBowStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
public class Quiver extends SoloGame public class Quiver extends SoloGame
{ {
private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>(); private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>();
@ -56,7 +60,8 @@ public class Quiver extends SoloGame
new KitLeaper(manager), new KitLeaper(manager),
new KitBrawler(manager), new KitBrawler(manager),
new KitEnchanter(manager), new KitEnchanter(manager),
new KitSlamShot(manager) new KitSlamShot(manager),
new KitNinja(manager)
}, },
new String[] new String[]
@ -75,6 +80,8 @@ public class Quiver extends SoloGame
this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20); this.BlockBreakAllow.add(20);
this.DeathSpectateSecs = 2;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.quiver.kits;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkVanishing;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitNinja extends Kit
{
public KitNinja(ArcadeManager manager)
{
super(manager, "Ninja", KitAvailability.Achievement, 0, new String[]
{
"You're a sneaky one, you!"
}, new Perk[]
{
new PerkVanishing()
}, EntityType.ZOMBIE, new ItemBuilder(Material.GOLD_SWORD).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build());
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
}
}

View File

@ -21,9 +21,8 @@ public class KitSlamShot extends Kit
{ {
public KitSlamShot(ArcadeManager manager) public KitSlamShot(ArcadeManager manager)
{ {
super(manager, "Slam Shooter", KitAvailability.Achievement, super(manager, "Slam Shooter", KitAvailability.Gem,
5000, new String[]
new String[]
{ {
"Gets 2 arrows for killing slammed players!" "Gets 2 arrows for killing slammed players!"
}, },
@ -33,7 +32,7 @@ public class KitSlamShot extends Kit
new PerkSeismicSlamOITQ() new PerkSeismicSlamOITQ()
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
new ItemStack(Material.IRON_SPADE)); new ItemStack(Material.DIAMOND_SPADE));
this.setAchievementRequirements(new Achievement[] this.setAchievementRequirements(new Achievement[]
{ {
@ -47,7 +46,7 @@ public class KitSlamShot extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live) if (Manager.GetGame().GetState() == GameState.Live)

View File

@ -982,7 +982,7 @@ public abstract class Skywars extends Game
if (vel.getY() < 0.1) if (vel.getY() < 0.1)
vel.setY(0.1); vel.setY(0.1);
event.GetDamageeEntity().setVelocity(vel); UtilAction.velocity(event.GetDamageeEntity(), vel);
} }
} }

View File

@ -51,6 +51,8 @@ public class TeamSkywars extends Skywars
this.SpawnNearAllies = true; this.SpawnNearAllies = true;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.DontAllowOverfill = true;
} }
@EventHandler @EventHandler

View File

@ -51,6 +51,8 @@ public class TeamSuperSmash extends SuperSmash
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.TeamArmorHotbar = true; this.TeamArmorHotbar = true;
this.DontAllowOverfill = true;
} }
@Override @Override

View File

@ -55,6 +55,8 @@ public class TeamSurvivalGames extends SurvivalGames
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.DontAllowOverfill = true;
} }
@EventHandler @EventHandler

View File

@ -14,13 +14,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
public class PerkBlizzard extends Perk public class PerkBlizzard extends Perk
@ -108,7 +108,8 @@ public class PerkBlizzard extends Perk
if (damagee == null) return; if (damagee == null) return;
event.SetCancelled("Blizzard"); event.SetCancelled("Blizzard");
damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
//Damage Event //Damage Event
if (damagee instanceof Player) if (damagee instanceof Player)

View File

@ -162,7 +162,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown
DamageCause.CUSTOM, damage, false, true, false, DamageCause.CUSTOM, damage, false, true, false,
UtilEnt.getName(data.GetThrower()), reason); UtilEnt.getName(data.GetThrower()), reason);
target.setVelocity(data.GetThrown().getVelocity()); UtilAction.velocity(target, data.GetThrown().getVelocity());
} }
@Override @Override

View File

@ -106,6 +106,7 @@ public class PerkCreeperExplode extends SmashPerk
//Idle in Air //Idle in Air
player.setVelocity(new Vector(0,0,0)); player.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(player);
//Sound //Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed)); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed));

View File

@ -145,7 +145,7 @@ public class PerkDeathsGrasp extends Perk
UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 1.8, false, 0, 1, 1.8, true); UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 1.8, false, 0, 1, 1.8, true);
damager.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(damager);
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f); damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f);

View File

@ -16,6 +16,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -126,7 +127,7 @@ public class PerkDisruptor extends Perk
_tntMap.remove(event.getItem()); _tntMap.remove(event.getItem());
event.getItem().remove(); event.getItem().remove();
event.getPlayer().setVelocity(new Vector(0,0.5,0)); UtilAction.velocity(event.getPlayer(), new Vector(0, 0.5, 0));
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EXPLODE, 1f, 2f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EXPLODE, 1f, 2f);
event.getPlayer().playEffect(EntityEffect.HURT); event.getPlayer().playEffect(EntityEffect.HURT);

View File

@ -14,6 +14,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -130,6 +131,6 @@ public class PerkEggGun extends SmashPerk
DamageCause.PROJECTILE, 1, true, true, false, DamageCause.PROJECTILE, 1, true, true, false,
UtilEnt.getName((LivingEntity)egg.getShooter()), GetName()); UtilEnt.getName((LivingEntity)egg.getShooter()), GetName());
event.GetDamageeEntity().setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(event.GetDamageeEntity());
} }
} }

View File

@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -101,7 +102,7 @@ public class PerkFirefly extends SmashPerk
//Teleport //Teleport
if (!UtilTime.elapsed(data.Time, 1500) && !superActive) if (!UtilTime.elapsed(data.Time, 1500) && !superActive)
{ {
data.Player.setVelocity(new Vector(0,0,0));//.teleport(data.Location); UtilAction.zeroVelocity(data.Player);
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);
data.Location = data.Player.getLocation(); data.Location = data.Player.getLocation();
@ -115,8 +116,7 @@ public class PerkFirefly extends SmashPerk
//Velocity //Velocity
else if (!UtilTime.elapsed(data.Time, 2500) || superActive) else if (!UtilTime.elapsed(data.Time, 2500) || superActive)
{ {
data.Player.setVelocity(data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0))); UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0)));
//data.Player.setVelocity(data.Location.getDirection().multiply(0.7).add(new Vector(0,0.1,0)));
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f);
if (_tick == 0) if (_tick == 0)

View File

@ -13,6 +13,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
@ -123,7 +124,7 @@ public class PerkFlameDash extends Perk
vel.normalize(); vel.normalize();
vel.setY(0.05); vel.setY(0.05);
data.Player.setVelocity(vel); UtilAction.velocity(data.Player, vel);
//Sound //Sound
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f); data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f);

View File

@ -100,7 +100,7 @@ public class PerkFlameSlam extends Perk
Vector vel = player.getLocation().getDirection(); Vector vel = player.getLocation().getDirection();
vel.setY(0); vel.setY(0);
UtilAlg.Normalize(vel); UtilAlg.Normalize(vel);
player.setVelocity(vel.multiply(0.8)); UtilAction.velocity(player, vel.multiply(0.8));
//Particle //Particle
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 5, UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 5,

View File

@ -92,7 +92,7 @@ public class PerkFleshArrow extends SmashPerk
Manager.GetCondition().Factory().Slow(GetName(), ent, event.GetDamagerEntity(true), 4, 3, false, false, false, false); Manager.GetCondition().Factory().Slow(GetName(), ent, event.GetDamagerEntity(true), 4, 3, false, false, false, false);
ent.setVelocity(new Vector(0,-0.5,0)); UtilAction.velocity(ent, new Vector(0,-0.5,0));
} }
@EventHandler @EventHandler

View File

@ -13,6 +13,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -59,7 +60,7 @@ public class PerkIcePath extends Perk
if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
return; return;
player.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(player);
player.teleport(player.getLocation().add(0, 0.75, 0)); player.teleport(player.getLocation().add(0, 0.75, 0));
_data.add(new IcePathData(player)); _data.add(new IcePathData(player));

View File

@ -132,7 +132,7 @@ public class PerkSnowTurret extends SmashPerk
if (damagee.equals(_snowball.get(proj))) if (damagee.equals(_snowball.get(proj)))
return; return;
damagee.setVelocity(proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0))); UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0)));
//Damage Event //Damage Event
if (!(damagee instanceof LivingEntity)) if (!(damagee instanceof LivingEntity))

View File

@ -73,7 +73,7 @@ public class PerkSpiderLeap extends Perk
{ {
if (!UtilBlock.airFoliage(block) && !block.isLiquid()) if (!UtilBlock.airFoliage(block) && !block.isLiquid())
{ {
player.setVelocity(new Vector(0,0.2,0)); UtilAction.velocity(player, new Vector(0, 0.2, 0));
if (!_secondJump.contains(player)) if (!_secondJump.contains(player))
{ {

View File

@ -112,7 +112,7 @@ public class PerkTakedown extends Perk
DamageCause.CUSTOM, 8, true, true, false, DamageCause.CUSTOM, 8, true, true, false,
damager.getName(), GetName()); damager.getName(), GetName());
damager.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(damager);
//Inform //Inform
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));

View File

@ -0,0 +1,107 @@
package nautilus.game.arcade.kit.perks;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class PerkVanishing extends Perk
{
public PerkVanishing()
{
super("Vanishing Act", new String[]
{
"Become invisible for 2 seconds each kill.",
"Attacking with melee removes invisibility."
});
}
@EventHandler
public void kill(CombatDeathEvent event)
{
if (!Manager.GetGame().IsLive())
return;
// //If it's an arrow kill (OITQ)
// if (!event.GetLog().GetKiller().GetReason().toLowerCase().contains("instagib"))
// return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (!Manager.IsAlive(killer))
return;
if (!Kit.HasKit(killer))
return;
Manager.GetCondition().Factory().Cloak("Vanishing Act", killer, null, 2, false, true);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, killer.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
killer.getWorld().playSound(killer.getLocation(), Sound.FIZZ, 1f, 2f);
}
@EventHandler
public void remove(CustomDamageEvent event)
{
if (event.isCancelled())
return;
if (!Manager.GetGame().IsLive())
return;
//Arrow damage, ignore it!
if (event.GetDamage() > 10)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
if (!Manager.IsAlive(damager))
return;
if (!Kit.HasKit(damager))
return;
Manager.GetCondition().EndCondition(damager, ConditionType.CLOAK, null);
}
// @EventHandler
// public void remove(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// if (!Manager.GetGame().IsLive())
// return;
//
// for (Player player : Manager.GetGame().GetPlayers(true))
// {
// if (!Kit.HasKit(player))
// continue;
//
// if (!UtilPlayer.isChargingBow(player))
// continue;
//
// if (Manager.GetCondition().IsCloaked(player))
// Manager.GetCondition().Clean(player);
// }
// }
}

View File

@ -100,7 +100,7 @@ public class PerkWebShot extends SmashPerk implements IThrown
DamageCause.PROJECTILE, 6, false, false, false, DamageCause.PROJECTILE, 6, false, false, false,
UtilEnt.getName(data.GetThrower()), GetName()); UtilEnt.getName(data.GetThrower()), GetName());
target.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(target);
return; return;
} }

View File

@ -152,7 +152,7 @@ public class PerkWolf extends SmashPerk
_tackle.put(wolf, damagee); _tackle.put(wolf, damagee);
wolf.setVelocity(new Vector(0,-0.6,0)); wolf.setVelocity(new Vector(0,-0.6,0));
damagee.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(damagee);
//Damage //Damage
Manager.GetDamage().NewDamageEvent(damagee, damager, null, Manager.GetDamage().NewDamageEvent(damagee, damager, null,
@ -190,7 +190,7 @@ public class PerkWolf extends SmashPerk
if (UtilMath.offset(wolf, ent) < 2.5) if (UtilMath.offset(wolf, ent) < 2.5)
{ {
Manager.GetCondition().Factory().Slow("Cub Table", ent, wolf, 0.9, 1, false, false, false, false); Manager.GetCondition().Factory().Slow("Cub Table", ent, wolf, 0.9, 1, false, false, false, false);
ent.setVelocity(new Vector(0,-0.3,0)); UtilAction.velocity(ent, new Vector(0,-0.3,0));
} }
//Move //Move
@ -305,7 +305,7 @@ public class PerkWolf extends SmashPerk
public void StrikeHit(Player damager, LivingEntity damagee) public void StrikeHit(Player damager, LivingEntity damagee)
{ {
damager.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(damager);
//Remove Tackle //Remove Tackle
Iterator<Wolf> wolfIterator = _tackle.keySet().iterator(); Iterator<Wolf> wolfIterator = _tackle.keySet().iterator();

View File

@ -538,7 +538,7 @@ public class PerkWolfPack extends Perk
public void TackleHit(Player damager, LivingEntity damagee) public void TackleHit(Player damager, LivingEntity damagee)
{ {
damager.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(damager);
Manager.GetDamage().NewDamageEvent(damagee, damager, null, Manager.GetDamage().NewDamageEvent(damagee, damager, null,
DamageCause.CUSTOM, 7, false, true, false, DamageCause.CUSTOM, 7, false, true, false,

View File

@ -696,7 +696,7 @@ public class GameFlagManager implements Listener
public void run() public void run()
{ {
player.setFireTicks(0); player.setFireTicks(0);
player.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(player);
} }
}, 0); }, 0);
} }
@ -745,7 +745,7 @@ public class GameFlagManager implements Listener
} }
player.setFireTicks(0); player.setFireTicks(0);
player.setVelocity(new Vector(0,0,0)); UtilAction.zeroVelocity(player);
} }
}, (int)(time * 20d)); }, (int)(time * 20d));
} }