diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 49e6f6ae1..05284beeb 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -39,7 +39,7 @@ public class MotdManager implements Listener, Runnable if (new File("updateMOTD.dat").exists()) { List lines = new ArrayList(); - 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(" §f§l◄§c§lMAINTENANCE§f§l►"); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java index 09160ddc7..9f3ba3614 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAction.java @@ -1,14 +1,23 @@ package mineplex.core.common.util; - -import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; 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) { velocity(ent, ent.getLocation().getDirection(), str, false, 0, yAdd, yMax, groundBoost); @@ -17,8 +26,11 @@ public class UtilAction 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) + { + zeroVelocity(ent); return; - + } + //YSet if (ySet) vec.setY(yBase); @@ -26,28 +38,43 @@ public class UtilAction //Modify vec.normalize(); vec.multiply(str); - + //YAdd vec.setY(vec.getY() + yAdd); - + //Limit if (vec.getY() > yMax) vec.setY(yMax); - + if (groundBoost) if (UtilEnt.isGrounded(ent)) vec.setY(vec.getY() + 0.2); - + //Velocity ent.setFallDistance(0); - - - //Debug - if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR)) + + //Store It! + if (ent instanceof Player && _velocityFix != null) { - Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length())); - } - + _velocityFix.setPlayerVelocity(((Player)ent), 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); } + + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/VelocityReceiver.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/VelocityReceiver.java new file mode 100644 index 000000000..8d621dab8 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/VelocityReceiver.java @@ -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); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index a76be2fcd..9d11610a5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -227,7 +227,7 @@ public class CoreClientManager extends MiniPlugin Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid)); if (client.getAccountId() > 0) - _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId())); + _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6); } catch (Exception exception) { @@ -301,7 +301,16 @@ public class CoreClientManager extends MiniPlugin System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId()); 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()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 525ca469a..64d6215aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -88,7 +88,7 @@ public enum Achievement SKYWARS_WINS("Sky King",2000, new String[]{"Skywars.Wins"}, new String[]{"Win 20 Games of Skywars"}, - new int[]{30}, + new int[]{20}, AchievementCategory.SKYWARS), SKYWARS_BOMBER("Master Bomber",500, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java index 62ff23a36..14ade61ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java @@ -170,7 +170,7 @@ public class MorphWither extends MorphGadget player.setFlying(true); 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); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 6b7eb9053..e58b10020 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -484,7 +484,7 @@ public class NpcManager extends MiniPlugin String serverType = getServerName(); try (Connection connection = DBPool.ACCOUNT.getConnection()) - { + { Result result = DSL.using(connection) .selectFrom(Tables.npcs) .where(Tables.npcs.server.eq(serverType)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java index db709fd28..466a26d50 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java @@ -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, - 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() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java index c63e2c6b3..0452a13cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java @@ -87,23 +87,10 @@ public abstract class ShopBase implements Listene 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 (!canOpenShop(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; - } + if (entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(_name))) + { + return attemptShopOpen(player); + } return false; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java index 5901a17e1..eb13e4940 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java @@ -18,6 +18,7 @@ import org.jooq.impl.DSL; import mineplex.core.account.ILoginProcessor; import mineplex.core.database.DBPool; import mineplex.database.Tables; +import org.jooq.types.ULong; public class SecondaryStatHandler implements ILoginProcessor { @@ -58,7 +59,7 @@ public class SecondaryStatHandler implements ILoginProcessor .insertInto(Tables.accountStat) .set(Tables.accountStat.accountId, accountId) .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); } @@ -99,13 +100,13 @@ public class SecondaryStatHandler implements ILoginProcessor .insertInto(Tables.accountStat) .set(Tables.accountStat.accountId, accountId) .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); Update update = context .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)) .and(Tables.accountStat.statId.eq(statId)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index 683cca93d..e1524436d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -22,6 +22,7 @@ import org.jooq.Result; import org.jooq.SQLDialect; import org.jooq.Update; import org.jooq.impl.DSL; +import org.jooq.types.ULong; public class StatsRepository extends RepositoryBase { @@ -102,7 +103,7 @@ public class StatsRepository extends RepositoryBase .insertInto(Tables.accountStat) .set(Tables.accountStat.accountId, accountId) .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); } @@ -137,7 +138,7 @@ public class StatsRepository extends RepositoryBase context = DSL.using(getConnectionPool(), SQLDialect.MYSQL); } - Result> result = context.select(Tables.stats.name, Tables.accountStat.value).from(Tables.accountStat) + Result> result = context.select(Tables.stats.name, Tables.accountStat.value).from(Tables.accountStat) .join(Tables.stats) .on(Tables.stats.id.eq(Tables.accountStat.statId)) .where(Tables.accountStat.accountId.eq(DSL.select(Tables.accounts.id) @@ -149,9 +150,9 @@ public class StatsRepository extends RepositoryBase if (result.isNotEmpty()) { playerStats = new PlayerStats(); - for (Record2 record : result) + for (Record2 record : result) { - playerStats.addStat(record.value1(), record.value2()); + playerStats.addStat(record.value1(), record.value2().longValue()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java index 2033584ba..520d2417e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusManager.java @@ -116,10 +116,8 @@ public class ServerStatusManager extends MiniPlugin if (event.getType() != UpdateType.FASTER) return; - if (!_enabled) - return; - - saveServerStatus(); + if (_enabled) + saveServerStatus(); } /** @@ -139,19 +137,6 @@ public class ServerStatusManager extends MiniPlugin if (server != null && !server.getPublicAddress().equalsIgnoreCase(serverSnapshot.getPublicAddress())) { timeout = -DEFAULT_SERVER_TIMEOUT; - /* - ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", "/home/mineplex/config/killServer.sh", serverSnapshot.getName()}); - pr.start(new GenericRunnable() - { - public void run(Boolean error) - { - if (error) - log("Error Killing myself."); - else - log("It worked."); - } - }); - */ } _repository.updataServerStatus(serverSnapshot, timeout); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java index 79c342ce9..57e62c7df 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -20,6 +20,7 @@ import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; @@ -285,7 +286,7 @@ public class Teleport extends MiniPlugin } 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); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/velocity/VelocityFix.java b/Plugins/Mineplex.Core/src/mineplex/core/velocity/VelocityFix.java new file mode 100644 index 000000000..7649f3431 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/velocity/VelocityFix.java @@ -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 _velocityData = new NautHashMap(); + + 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 keyIter = _velocityData.keySet().iterator(); + + while (keyIter.hasNext()) + { + Player player = keyIter.next(); + + if (player.isOnline()) + keyIter.remove(); + } + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Account.java b/Plugins/Mineplex.Database/src/mineplex/database/Account.java index 9e66bafa8..745edad55 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Account.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Account.java @@ -16,7 +16,7 @@ package mineplex.database; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) 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 Account @@ -54,6 +54,7 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.ActiveTournaments.activeTournaments, mineplex.database.tables.Bonus.bonus, + mineplex.database.tables.Chatsnap.chatsnap, mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanMember.clanMember, diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java index 4eb24c54d..58b66870c 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java @@ -34,6 +34,7 @@ public class Keys { public static final org.jooq.Identity IDENTITY_accountTasks = Identities0.IDENTITY_accountTasks; public static final org.jooq.Identity IDENTITY_accountTransactions = Identities0.IDENTITY_accountTransactions; public static final org.jooq.Identity IDENTITY_bonus = Identities0.IDENTITY_bonus; + public static final org.jooq.Identity IDENTITY_chatsnap = Identities0.IDENTITY_chatsnap; public static final org.jooq.Identity IDENTITY_clanAlliances = Identities0.IDENTITY_clanAlliances; public static final org.jooq.Identity IDENTITY_clanEnemies = Identities0.IDENTITY_clanEnemies; public static final org.jooq.Identity IDENTITY_clans = Identities0.IDENTITY_clans; @@ -83,6 +84,7 @@ public class Keys { public static final org.jooq.UniqueKey KEY_accountTransactions_PRIMARY = UniqueKeys0.KEY_accountTransactions_PRIMARY; public static final org.jooq.UniqueKey KEY_activeTournaments_PRIMARY = UniqueKeys0.KEY_activeTournaments_PRIMARY; public static final org.jooq.UniqueKey KEY_bonus_PRIMARY = UniqueKeys0.KEY_bonus_PRIMARY; + public static final org.jooq.UniqueKey KEY_chatsnap_PRIMARY = UniqueKeys0.KEY_chatsnap_PRIMARY; public static final org.jooq.UniqueKey KEY_clanAlliances_PRIMARY = UniqueKeys0.KEY_clanAlliances_PRIMARY; public static final org.jooq.UniqueKey KEY_clanEnemies_PRIMARY = UniqueKeys0.KEY_clanEnemies_PRIMARY; public static final org.jooq.UniqueKey KEY_clanEnemies_unique_clanId = UniqueKeys0.KEY_clanEnemies_unique_clanId; @@ -175,6 +177,7 @@ public class Keys { public static org.jooq.Identity IDENTITY_accountTasks = createIdentity(mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTasks.accountTasks.id); public static org.jooq.Identity IDENTITY_accountTransactions = createIdentity(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id); public static org.jooq.Identity IDENTITY_bonus = createIdentity(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId); + public static org.jooq.Identity IDENTITY_chatsnap = createIdentity(mineplex.database.tables.Chatsnap.chatsnap, mineplex.database.tables.Chatsnap.chatsnap.id); public static org.jooq.Identity IDENTITY_clanAlliances = createIdentity(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id); public static org.jooq.Identity IDENTITY_clanEnemies = createIdentity(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id); public static org.jooq.Identity 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 KEY_accountTransactions_PRIMARY = createUniqueKey(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id); public static final org.jooq.UniqueKey KEY_activeTournaments_PRIMARY = createUniqueKey(mineplex.database.tables.ActiveTournaments.activeTournaments, mineplex.database.tables.ActiveTournaments.activeTournaments.name); public static final org.jooq.UniqueKey KEY_bonus_PRIMARY = createUniqueKey(mineplex.database.tables.Bonus.bonus, mineplex.database.tables.Bonus.bonus.accountId); + public static final org.jooq.UniqueKey KEY_chatsnap_PRIMARY = createUniqueKey(mineplex.database.tables.Chatsnap.chatsnap, mineplex.database.tables.Chatsnap.chatsnap.id); public static final org.jooq.UniqueKey KEY_clanAlliances_PRIMARY = createUniqueKey(mineplex.database.tables.ClanAlliances.clanAlliances, mineplex.database.tables.ClanAlliances.clanAlliances.id); public static final org.jooq.UniqueKey KEY_clanEnemies_PRIMARY = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.id); public static final org.jooq.UniqueKey KEY_clanEnemies_unique_clanId = createUniqueKey(mineplex.database.tables.ClanEnemies.clanEnemies, mineplex.database.tables.ClanEnemies.clanEnemies.clanId); diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java index 21ae7415e..9a5c0f4de 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java @@ -54,6 +54,19 @@ public class Routines { return p; } + /** + * Call Account.check_vote + */ + 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 Account.createLeaderboard */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java index 36f9b2e67..6036ed719 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java @@ -91,6 +91,11 @@ public class Tables { */ 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 */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_vote.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_vote.java new file mode 100644 index 000000000..847580a4c --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_vote.java @@ -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 implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 2035299030; + + /** + * The parameter Account.check_vote.accountId_in. + */ + public static final org.jooq.Parameter accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_vote.coinsChange. + */ + public static final org.jooq.Parameter coinsChange = createParameter("coinsChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_vote.gemsChange. + */ + public static final org.jooq.Parameter gemsChange = createParameter("gemsChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_vote.pass. + */ + public static final org.jooq.Parameter pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false); + + /** + * The parameter Account.check_vote.outTime. + */ + public static final org.jooq.Parameter 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 accountId_in 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 coinsChange parameter IN value to the routine + */ + public void setCoinsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_vote.coinsChange, value); + } + + /** + * Set the gemsChange parameter IN value to the routine + */ + public void setGemsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_vote.gemsChange, value); + } + + /** + * Get the pass parameter OUT value from the routine + */ + public java.lang.Byte getPass() { + return getValue(pass); + } + + /** + * Get the outTime parameter OUT value from the routine + */ + public java.sql.Date getOutTime() { + return getValue(outTime); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java index fead0616c..a73aa75b4 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java @@ -16,7 +16,7 @@ package mineplex.database.tables; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class AccountStat extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = 956897097; + private static final long serialVersionUID = 34581219; /** * The reference instance of Account.accountStat @@ -44,7 +44,7 @@ public class AccountStat extends org.jooq.impl.TableImplAccount.accountStat.value. */ - public final org.jooq.TableField value = createField("value", org.jooq.impl.SQLDataType.BIGINT.defaulted(true), this, ""); + public final org.jooq.TableField value = createField("value", org.jooq.impl.SQLDataType.BIGINTUNSIGNED.defaulted(true), this, ""); /** * Create a Account.accountStat table reference diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java index a2acbbbb5..93914d875 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java @@ -16,7 +16,7 @@ package mineplex.database.tables; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Bonus extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = -70389593; + private static final long serialVersionUID = -524321170; /** * The reference instance of Account.bonus @@ -46,6 +46,36 @@ public class Bonus extends org.jooq.impl.TableImpl ranktime = createField("ranktime", org.jooq.impl.SQLDataType.DATE, this, ""); + /** + * The column Account.bonus.votetime. + */ + public final org.jooq.TableField votetime = createField("votetime", org.jooq.impl.SQLDataType.DATE, this, ""); + + /** + * The column Account.bonus.dailyStreak. + */ + public final org.jooq.TableField dailyStreak = createField("dailyStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.bonus.maxDailyStreak. + */ + public final org.jooq.TableField maxDailyStreak = createField("maxDailyStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.bonus.voteStreak. + */ + public final org.jooq.TableField voteStreak = createField("voteStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.bonus.maxVoteStreak. + */ + public final org.jooq.TableField maxVoteStreak = createField("maxVoteStreak", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.bonus.tickets. + */ + public final org.jooq.TableField tickets = createField("tickets", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + /** * Create a Account.bonus table reference */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Chatsnap.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Chatsnap.java new file mode 100644 index 000000000..044ee5e36 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Chatsnap.java @@ -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 implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = -176946707; + + /** + * The reference instance of Account.chatsnap + */ + 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 getRecordType() { + return mineplex.database.tables.records.ChatsnapRecord.class; + } + + /** + * The column Account.chatsnap.id. + */ + public final org.jooq.TableField id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.chatsnap.reporterId. + */ + public final org.jooq.TableField reporterId = createField("reporterId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.chatsnap.reporteeId. + */ + public final org.jooq.TableField reporteeId = createField("reporteeId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.chatsnap.time. + */ + public final org.jooq.TableField time = createField("time", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.chatsnap.status. + */ + public final org.jooq.TableField status = createField("status", org.jooq.impl.SQLDataType.VARCHAR.length(10).nullable(false).defaulted(true), this, ""); + + /** + * The column Account.chatsnap.reason. + */ + public final org.jooq.TableField reason = createField("reason", org.jooq.impl.SQLDataType.CLOB.length(65535).nullable(false), this, ""); + + /** + * The column Account.chatsnap.data. + */ + public final org.jooq.TableField data = createField("data", org.jooq.impl.SQLDataType.CLOB.length(16777215).nullable(false), this, ""); + + /** + * Create a Account.chatsnap table reference + */ + public Chatsnap() { + this("chatsnap", null); + } + + /** + * Create an aliased Account.chatsnap table reference + */ + public Chatsnap(java.lang.String alias) { + this(alias, mineplex.database.tables.Chatsnap.chatsnap); + } + + private Chatsnap(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private Chatsnap(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Identity getIdentity() { + return mineplex.database.Keys.IDENTITY_chatsnap; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_chatsnap_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>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); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java index 83dc0a684..df8d59c6e 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java @@ -14,9 +14,9 @@ package mineplex.database.tables.records; comments = "This class is generated by jOOQ" ) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { +public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { - private static final long serialVersionUID = 1109290129; + private static final long serialVersionUID = -516667486; /** * Setter for Account.accountStat.accountId. @@ -49,15 +49,15 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImplAccount.accountStat.value. */ - public void setValue(java.lang.Long value) { + public void setValue(org.jooq.types.ULong value) { setValue(2, value); } /** * Getter for Account.accountStat.value. */ - public java.lang.Long getValue() { - return (java.lang.Long) getValue(2); + public org.jooq.types.ULong getValue() { + return (org.jooq.types.ULong) getValue(2); } // ------------------------------------------------------------------------- @@ -80,7 +80,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl fieldsRow() { + public org.jooq.Row3 fieldsRow() { return (org.jooq.Row3) super.fieldsRow(); } @@ -88,7 +88,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl valuesRow() { + public org.jooq.Row3 valuesRow() { return (org.jooq.Row3) super.valuesRow(); } @@ -112,7 +112,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl field3() { + public org.jooq.Field field3() { return mineplex.database.tables.AccountStat.accountStat.value; } @@ -136,7 +136,7 @@ public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { +public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record9 { - private static final long serialVersionUID = -64019858; + private static final long serialVersionUID = -785434679; /** * Setter for Account.bonus.accountId. @@ -60,6 +60,90 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImplAccount.bonus.votetime. + */ + public void setVotetime(java.sql.Date value) { + setValue(3, value); + } + + /** + * Getter for Account.bonus.votetime. + */ + public java.sql.Date getVotetime() { + return (java.sql.Date) getValue(3); + } + + /** + * Setter for Account.bonus.dailyStreak. + */ + public void setDailyStreak(java.lang.Integer value) { + setValue(4, value); + } + + /** + * Getter for Account.bonus.dailyStreak. + */ + public java.lang.Integer getDailyStreak() { + return (java.lang.Integer) getValue(4); + } + + /** + * Setter for Account.bonus.maxDailyStreak. + */ + public void setMaxDailyStreak(java.lang.Integer value) { + setValue(5, value); + } + + /** + * Getter for Account.bonus.maxDailyStreak. + */ + public java.lang.Integer getMaxDailyStreak() { + return (java.lang.Integer) getValue(5); + } + + /** + * Setter for Account.bonus.voteStreak. + */ + public void setVoteStreak(java.lang.Integer value) { + setValue(6, value); + } + + /** + * Getter for Account.bonus.voteStreak. + */ + public java.lang.Integer getVoteStreak() { + return (java.lang.Integer) getValue(6); + } + + /** + * Setter for Account.bonus.maxVoteStreak. + */ + public void setMaxVoteStreak(java.lang.Integer value) { + setValue(7, value); + } + + /** + * Getter for Account.bonus.maxVoteStreak. + */ + public java.lang.Integer getMaxVoteStreak() { + return (java.lang.Integer) getValue(7); + } + + /** + * Setter for Account.bonus.tickets. + */ + public void setTickets(java.lang.Integer value) { + setValue(8, value); + } + + /** + * Getter for Account.bonus.tickets. + */ + public java.lang.Integer getTickets() { + return (java.lang.Integer) getValue(8); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -73,23 +157,23 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl fieldsRow() { - return (org.jooq.Row3) super.fieldsRow(); + public org.jooq.Row9 fieldsRow() { + return (org.jooq.Row9) super.fieldsRow(); } /** * {@inheritDoc} */ @Override - public org.jooq.Row3 valuesRow() { - return (org.jooq.Row3) super.valuesRow(); + public org.jooq.Row9 valuesRow() { + return (org.jooq.Row9) super.valuesRow(); } /** @@ -116,6 +200,54 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field4() { + return mineplex.database.tables.Bonus.bonus.votetime; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field5() { + return mineplex.database.tables.Bonus.bonus.dailyStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field6() { + return mineplex.database.tables.Bonus.bonus.maxDailyStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field7() { + return mineplex.database.tables.Bonus.bonus.voteStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field8() { + return mineplex.database.tables.Bonus.bonus.maxVoteStreak; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field9() { + return mineplex.database.tables.Bonus.bonus.tickets; + } + /** * {@inheritDoc} */ @@ -140,6 +272,54 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7 { + + private static final long serialVersionUID = 2087133341; + + /** + * Setter for Account.chatsnap.id. + */ + public void setId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.chatsnap.id. + */ + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.chatsnap.reporterId. + */ + public void setReporterId(java.lang.Integer value) { + setValue(1, value); + } + + /** + * Getter for Account.chatsnap.reporterId. + */ + public java.lang.Integer getReporterId() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for Account.chatsnap.reporteeId. + */ + public void setReporteeId(java.lang.Integer value) { + setValue(2, value); + } + + /** + * Getter for Account.chatsnap.reporteeId. + */ + public java.lang.Integer getReporteeId() { + return (java.lang.Integer) getValue(2); + } + + /** + * Setter for Account.chatsnap.time. + */ + public void setTime(java.sql.Timestamp value) { + setValue(3, value); + } + + /** + * Getter for Account.chatsnap.time. + */ + public java.sql.Timestamp getTime() { + return (java.sql.Timestamp) getValue(3); + } + + /** + * Setter for Account.chatsnap.status. + */ + public void setStatus(java.lang.String value) { + setValue(4, value); + } + + /** + * Getter for Account.chatsnap.status. + */ + public java.lang.String getStatus() { + return (java.lang.String) getValue(4); + } + + /** + * Setter for Account.chatsnap.reason. + */ + public void setReason(java.lang.String value) { + setValue(5, value); + } + + /** + * Getter for Account.chatsnap.reason. + */ + public java.lang.String getReason() { + return (java.lang.String) getValue(5); + } + + /** + * Setter for Account.chatsnap.data. + */ + public void setData(java.lang.String value) { + setValue(6, value); + } + + /** + * Getter for Account.chatsnap.data. + */ + public java.lang.String getData() { + return (java.lang.String) getValue(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record7 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 fieldsRow() { + return (org.jooq.Row7) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 valuesRow() { + return (org.jooq.Row7) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.Chatsnap.chatsnap.id; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.Chatsnap.chatsnap.reporterId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return mineplex.database.tables.Chatsnap.chatsnap.reporteeId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field4() { + return mineplex.database.tables.Chatsnap.chatsnap.time; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field5() { + return mineplex.database.tables.Chatsnap.chatsnap.status; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field6() { + return mineplex.database.tables.Chatsnap.chatsnap.reason; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field 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); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 1cf6b3b8f..0873db91b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -46,6 +46,7 @@ import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; +import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.hub.modules.StackerManager; import mineplex.hub.poll.PollManager; @@ -78,6 +79,9 @@ public class Hub extends JavaPlugin implements IRelation //Logger.initialize(this); + //Velocity Fix + new VelocityFix(this); + //Static Modules CommandCenter.Initialize(this); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index ba341104a..efc323beb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -77,15 +77,8 @@ public class NewsManager extends MiniPlugin for (Iterator iterator = newsEntries.keySet().iterator(); iterator.hasNext();) { int newsPos = Integer.parseInt(iterator.next()); - - ChatColor col = ChatColor.RED; - 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 + ""); + + newsStrings[newsPos - 1] = newsEntries.get(newsPos + ""); if (newsStrings[newsPos - 1].length() > 64) newsStrings[newsPos - 1] = newsStrings[newsPos - 1].substring(0, 64); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 43002d101..b1bd4551e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -255,7 +255,8 @@ public class StackerManager extends MiniPlugin implements IThrown Manager.SetPortalDelay(rider); 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(); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java index a9dcdccba..235b7c99b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java @@ -10,4 +10,9 @@ public class ServerInfo public String ServerType; public String Game; public boolean HostedByStaff; + + public int getAvailableSlots() + { + return MaxPlayers - CurrentPlayers; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index bba026899..909827f6e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -10,8 +10,11 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Random; import java.util.Set; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -56,7 +59,9 @@ import mineplex.hub.queue.QueueManager; import mineplex.hub.queue.ui.QueueShop; import mineplex.hub.server.ui.LobbyShop; import mineplex.hub.server.ui.QuickShop; +import mineplex.hub.server.ui.ServerCountSorter; import mineplex.hub.server.ui.ServerNpcShop; +import mineplex.serverdata.Region; import mineplex.serverdata.data.MinecraftServer; 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 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 DonationManager _donationManager; private Portal _portal; @@ -73,7 +83,8 @@ public class ServerManager extends MiniPlugin private HubManager _hubManager; private StackerManager _stackerManager; private QueueManager _queueManager; - + + private NautHashMap _queueCooldowns = new NautHashMap(); private NautHashMap> _serverKeyInfoMap = new NautHashMap>(); private NautHashMap _serverKeyTagMap = new NautHashMap(); private NautHashMap _serverPlayerCounts = new NautHashMap(); @@ -108,7 +119,7 @@ public class ServerManager extends MiniPlugin plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord"); - LoadServers(); + loadServers(); _quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu"); _lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu"); @@ -278,18 +289,6 @@ public class ServerManager extends MiniPlugin 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; } @@ -303,18 +302,18 @@ public class ServerManager extends MiniPlugin _serverInfoMap.remove(serverName); } - public void addServerGroup(String serverKey, String...serverTag) + public void addServerGroup(ServerGroup serverGroup) { - _serverKeyInfoMap.put(serverKey, new HashSet()); + _serverKeyInfoMap.put(serverGroup.getName(), new HashSet()); + _serverKeyTagMap.put(serverGroup.getPrefix(), serverGroup.getName()); - for (String tag : serverTag) - _serverKeyTagMap.put(tag, serverKey); + if (!serverGroup.getServerNpcName().isEmpty()) + _serverKeyTagMap.put(serverGroup.getServerNpcName(), serverGroup.getName()); } - public void AddServerNpc(String serverNpcName, String...serverTag) + public void AddServerNpc(ServerGroup serverGroup) { - addServerGroup(serverNpcName, serverTag); - _serverNpcShopMap.put(serverNpcName, new ServerNpcShop(this, _clientManager, _donationManager, serverNpcName)); + _serverNpcShopMap.put(serverGroup.getServerNpcName(), new ServerNpcShop(this, _clientManager, _donationManager, serverGroup)); } public void RemoveServerNpc(String serverNpcName) @@ -396,7 +395,6 @@ public class ServerManager extends MiniPlugin _retrieving = true; - _statusManager.retrieveServerGroups(new Callback>() { public void run(final Collection serverGroups) @@ -482,6 +480,8 @@ public class ServerManager extends MiniPlugin }); } }); + + updateCooldowns(); } public void Help(Player caller, String message) @@ -521,6 +521,113 @@ public class ServerManager extends MiniPlugin _portal.sendPlayerToServer(player, serverInfo.Name); } } + + /** + * 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 serverList = GetServerList(serverKey); + if (serverList == null) return null; + + List servers = new ArrayList(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 fetchOpenServers(Player player, List servers, int count) + { + List results = new ArrayList(); + 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) { @@ -555,7 +662,7 @@ public class ServerManager extends MiniPlugin } } - public void LoadServers() + public void loadServers() { _serverInfoMap.clear(); _serverUpdate.clear(); @@ -567,83 +674,59 @@ public class ServerManager extends MiniPlugin _serverKeyTagMap.clear(); - FileInputStream fstream = null; - BufferedReader br = null; - - HashSet npcNames = new HashSet(); + Region region = getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU; try { - File npcFile = new File("ServerManager.dat"); - - if (npcFile.exists()) + for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null)) { - fstream = new FileInputStream(npcFile); - br = new BufferedReader(new InputStreamReader(fstream)); - - String line = br.readLine(); - - while (line != null) + if (!serverGroup.getServerNpcName().isEmpty()) { - String serverNpcName = line.substring(0, line.indexOf('|')).trim(); - 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(","); + if (!HasServerNpc(serverGroup.getServerNpcName())) + { + AddServerNpc(serverGroup); + addServerGroup(serverGroup); + } + } - for (String location : locations) + if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty()) + { + 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(ParseVector(location), serverNpcName); + _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()))); + } + + blocks++; } - if (!HasServerNpc(serverNpcName)) - { - AddServerNpc(serverNpcName, serverTags); - } - - npcNames.add(serverNpcName); - - line = br.readLine(); + _serverPortalLocations.put(bottomVector, serverGroup.getServerNpcName()); } } } catch (Exception e) { - System.out.println("ServerManager - Error parsing servers file : " + e.getMessage()); - } - finally - { - if (br != null) - { - try - { - br.close(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - if (fstream != null) - { - try - { - fstream.close(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } + System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage()); } - for (String npcName : npcNames) - { - if (!_serverNpcShopMap.containsKey(npcName)) - _serverNpcShopMap.remove(npcName); - - if (!_serverKeyInfoMap.containsKey(npcName)) - _serverKeyInfoMap.remove(npcName); - } + ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT"); + ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS"); + + AddServerNpc(eventGroup); + addServerGroup(eventGroup); + AddServerNpc(mpsGroup); + addServerGroup(mpsGroup); } public int GetRequiredSlots(Player player, String serverType) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java index 8cd3347df..dc7f9477e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyShop.java @@ -14,7 +14,8 @@ public class LobbyShop extends ShopBase { super(plugin, clientManager, donationManager, name); - plugin.addServerGroup("Lobby", "Lobby"); + // TODO: Why is this needed? Re-add? + //plugin.addServerGroup("Lobby", "Lobby"); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerCountSorter.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerCountSorter.java new file mode 100644 index 000000000..91065658c --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerCountSorter.java @@ -0,0 +1,13 @@ +package mineplex.hub.server.ui; + +import java.util.Comparator; + +import mineplex.hub.server.ServerInfo; + +public class ServerCountSorter implements Comparator +{ + public int compare(ServerInfo a, ServerInfo b) + { + return a.CurrentPlayers - b.CurrentPlayers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 47a0e34d0..f63540cbf 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -72,7 +72,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Stay away from the borders!", ChatColor.RESET + "", ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("HG") + ChatColor.RESET + " other players!", - })); + })); setItem(4, ItemStackFactory.Instance.CreateStack(Material.FEATHER.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Skywars " + C.cGray + "Solo Survival", new String[] { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index b44045870..d484f1cbc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -17,6 +17,7 @@ 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; @@ -41,7 +42,7 @@ public class ServerNpcPage extends ShopPageBase im 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; @@ -51,7 +52,25 @@ public class ServerNpcPage extends ShopPageBase im @Override 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 serverList = new ArrayList(getPlugin().GetServerList(_serverNpcKey)); + int slotsNeeded = 1; if (serverList.size() > 0) @@ -401,7 +420,7 @@ public class ServerNpcPage extends ShopPageBase im { 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); return; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java index 0c4af2d90..2dd75eaad 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java @@ -11,18 +11,31 @@ import mineplex.core.party.Party; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; +import mineplex.serverdata.data.ServerGroup; public class ServerNpcShop extends ShopBase { - 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 protected ShopPageBase> 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 @@ -65,4 +78,16 @@ public class ServerNpcShop extends ShopBase { 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); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java new file mode 100644 index 000000000..1c070d71d --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java @@ -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 +{ + + 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()); + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTypeButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTypeButton.java new file mode 100644 index 000000000..847cb3933 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTypeButton.java @@ -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); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java index 5616119ee..9075c6d31 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java @@ -26,6 +26,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.core.common.util.F; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -209,7 +210,8 @@ public class Blizzard extends SkillActive if (damagee == null) return; 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 diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index 1d699e938..ec5e4113c 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -395,7 +395,7 @@ public class DamageManager extends MiniPlugin if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR)) { 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())); } @@ -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) { for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java index 1a23e9669..72080881d 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/mechanics/PistonJump.java @@ -6,6 +6,7 @@ import java.util.HashSet; import mineplex.core.MiniPlugin; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilTime; import org.bukkit.Material; @@ -54,8 +55,7 @@ public class PistonJump extends MiniPlugin //Vector Vector vec = new Vector(0,1.2,0); - player.setVelocity(vec); - player.setFallDistance(0); + UtilAction.velocity(player, vec); } final Block block = below; diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index 40d36f875..0aa8a16e7 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -57,6 +57,12 @@ public class ServerGroup private boolean _staffOnly; private String _resourcePack = ""; + private String _npcName = ""; + private String _portalBottomCornerLocation = ""; + private String _portalTopCornerLocation = ""; + + private String _teamServerKey = ""; + private Region _region; private Set _servers; @@ -101,6 +107,10 @@ public class ServerGroup _resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : ""; _host = data.get("host"); _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) 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 , 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 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; _prefix = prefix; @@ -148,6 +159,17 @@ public class ServerGroup _whitelist = whitelist; _resourcePack = resourcePack; _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; } @@ -196,6 +218,12 @@ public class ServerGroup public String getResourcePack() { return _resourcePack; } 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 getServers() { return _servers; } public int getServerCount() @@ -350,6 +378,10 @@ public class ServerGroup _dataMap.put("resourcePack", _resourcePack); _dataMap.put("host", _host); _dataMap.put("region", _region.name()); + _dataMap.put("teamServerKey", _teamServerKey); + _dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation); + _dataMap.put("portalTopCornerLocation", _portalTopCornerLocation); + _dataMap.put("npcName", _npcName); } return _dataMap; diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/servers/ServerManager.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/servers/ServerManager.java index 1c173ae09..fbf5d563b 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/servers/ServerManager.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/servers/ServerManager.java @@ -28,7 +28,7 @@ public class ServerManager // The cached repository instances private static Map repositories = new HashMap(); - + /** * @param host - the host url used to connect to the database * @param port - the port to connect to the repository diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index b61c92d36..772f894ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -48,6 +48,7 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.teleport.Teleport; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; +import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; @@ -86,10 +87,14 @@ public class Arcade extends JavaPlugin _clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(_clientManager); + ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); VisibilityManager.Initialize(this); Give.Initialize(this); + + //Velocity Fix + new VelocityFix(this); _donationManager = new DonationManager(this, _clientManager, webServerAddress); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 131fd4fb4..cc264d1e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -49,6 +49,7 @@ import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; @@ -1333,7 +1334,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.teleport(GetGame().GetSpectatorLocation()); //Set Spec State - player.setVelocity(new Vector(0,1,0)); + UtilAction.velocity(player, new Vector(0,1,0)); player.setAllowFlight(true); player.setFlying(true); player.setFlySpeed(0.1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 52f199735..e17db6abc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -45,6 +45,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; @@ -1178,7 +1179,7 @@ public class Bridge extends TeamGame implements OreObsfucation UtilPlayer.message(event.getPlayer(), F.main("Game", "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); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 1d7ee11d3..92ead83b8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -67,6 +67,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -707,7 +708,7 @@ public class Build extends SoloGame event.setTo(event.getFrom()); //Velocity - event.getPlayer().setVelocity(UtilAlg.getTrajectory(event.getTo(), data.Spawn)); + UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory(event.getTo(), data.Spawn)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 9caea2e88..d385a752f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -34,6 +34,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilServer; @@ -526,8 +527,7 @@ public class DragonEscape extends SoloGame //Teleport player.teleport(target.getLocation().add(0, 0.5, 0)); - player.setVelocity(new Vector(0,0,0)); - player.setFallDistance(0); + UtilAction.velocity(player, new Vector(0,0,0)); //Record _warpTime.put(player, System.currentTimeMillis()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java index 9460a9d67..01e439add 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java @@ -26,6 +26,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; @@ -540,8 +541,7 @@ public class DragonEscapeTeams extends TeamGame //Teleport player.teleport(target.getLocation().add(0, 0.5, 0)); - player.setVelocity(new Vector(0,0,0)); - player.setFallDistance(0); + UtilAction.velocity(player, new Vector(0,0,0)); //Record _warpTime.put(player, System.currentTimeMillis()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index 509ebd349..917bf5f77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -15,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.kit.Kit; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -225,7 +227,8 @@ public class HoleInTheWall extends SoloGame { 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); } /*Location toTeleport = player.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 010eaf74c..d35daf11e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -1305,7 +1305,7 @@ public class MineStrike extends TeamGame //Mini-Stun else { - event.GetDamageePlayer().setVelocity(new Vector(0,0,0)); + UtilAction.velocity(event.GetDamageePlayer(), new Vector(0,0,0)); } event.SetKnockback(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 75982a00d..550bdb153 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -35,6 +35,7 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -307,7 +308,7 @@ public class Paintball extends TeamGame ((CraftPlayer)player).getHandle().spectating = true; ((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())); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index 25b8b8fee..2bffb2d60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -5,18 +5,6 @@ import java.util.Arrays; import java.util.HashMap; 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.F; import mineplex.core.common.util.UtilPlayer; @@ -32,12 +20,28 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; 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.stats.SharpShooterStatTracker; import nautilus.game.arcade.stats.WinWithoutBowStatTracker; 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 { private ArrayList _ranks = new ArrayList(); @@ -56,7 +60,8 @@ public class Quiver extends SoloGame new KitLeaper(manager), new KitBrawler(manager), new KitEnchanter(manager), - new KitSlamShot(manager) + new KitSlamShot(manager), + new KitNinja(manager) }, new String[] @@ -75,6 +80,8 @@ public class Quiver extends SoloGame this.BlockBreakAllow.add(102); this.BlockBreakAllow.add(20); + this.DeathSpectateSecs = 2; + _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java new file mode 100644 index 000000000..21636cee3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java @@ -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); + } + } + + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java index 6acd3aea3..543a7c58b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java @@ -21,9 +21,8 @@ public class KitSlamShot extends Kit { public KitSlamShot(ArcadeManager manager) { - super(manager, "Slam Shooter", KitAvailability.Achievement, - - new String[] + super(manager, "Slam Shooter", KitAvailability.Gem, + 5000, new String[] { "Gets 2 arrows for killing slammed players!" }, @@ -33,7 +32,7 @@ public class KitSlamShot extends Kit new PerkSeismicSlamOITQ() }, EntityType.ZOMBIE, - new ItemStack(Material.IRON_SPADE)); + new ItemStack(Material.DIAMOND_SPADE)); this.setAchievementRequirements(new Achievement[] { @@ -47,7 +46,7 @@ public class KitSlamShot extends Kit @Override 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)); if (Manager.GetGame().GetState() == GameState.Live) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index e042dd7b5..00eb0798a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -982,7 +982,7 @@ public abstract class Skywars extends Game if (vel.getY() < 0.1) vel.setY(0.1); - event.GetDamageeEntity().setVelocity(vel); + UtilAction.velocity(event.GetDamageeEntity(), vel); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index fbe0dbf2b..7eb916b53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -51,6 +51,8 @@ public class TeamSkywars extends Skywars this.SpawnNearAllies = true; this.DamageTeamSelf = false; + + this.DontAllowOverfill = true; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 1d3b3052c..2ffd3f82d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -51,6 +51,8 @@ public class TeamSuperSmash extends SuperSmash this.DamageTeamSelf = false; this.TeamArmorHotbar = true; + + this.DontAllowOverfill = true; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 92931afd8..e64d87f04 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -55,6 +55,8 @@ public class TeamSurvivalGames extends SurvivalGames this.DamageTeamSelf = false; + this.DontAllowOverfill = true; + } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java index 93b52fbda..581a9511c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlizzard.java @@ -14,13 +14,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.util.Vector; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; - import nautilus.game.arcade.kit.Perk; public class PerkBlizzard extends Perk @@ -108,8 +108,9 @@ public class PerkBlizzard extends Perk if (damagee == null) return; 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 if (damagee instanceof Player) if (Recharge.Instance.use((Player)damagee, GetName(), 200, false, false)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java index e802a911b..d04a88096 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java @@ -162,7 +162,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown DamageCause.CUSTOM, damage, false, true, false, UtilEnt.getName(data.GetThrower()), reason); - target.setVelocity(data.GetThrown().getVelocity()); + UtilAction.velocity(target, data.GetThrown().getVelocity()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index 4e1c99624..6c4d9c096 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -106,6 +106,7 @@ public class PerkCreeperExplode extends SmashPerk //Idle in Air player.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(player); //Sound player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index 4ceaaee33..51883a447 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -145,7 +145,7 @@ public class PerkDeathsGrasp extends Perk 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); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDisruptor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDisruptor.java index 71f774580..844c49551 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDisruptor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDisruptor.java @@ -16,6 +16,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; @@ -126,7 +127,7 @@ public class PerkDisruptor extends Perk _tntMap.remove(event.getItem()); 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().playEffect(EntityEffect.HURT); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java index 8530d4b8f..727a2bfc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEggGun.java @@ -14,6 +14,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; @@ -130,6 +131,6 @@ public class PerkEggGun extends SmashPerk DamageCause.PROJECTILE, 1, true, true, false, UtilEnt.getName((LivingEntity)egg.getShooter()), GetName()); - event.GetDamageeEntity().setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(event.GetDamageeEntity()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index c8c2946a3..2907433d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -17,6 +17,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; @@ -101,7 +102,7 @@ public class PerkFirefly extends SmashPerk //Teleport 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.Location = data.Player.getLocation(); @@ -115,8 +116,7 @@ public class PerkFirefly extends SmashPerk //Velocity 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))); - //data.Player.setVelocity(data.Location.getDirection().multiply(0.7).add(new Vector(0,0.1,0))); + UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0))); data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); if (_tick == 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java index fd0222205..041bae71c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java @@ -13,6 +13,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; @@ -123,7 +124,7 @@ public class PerkFlameDash extends Perk vel.normalize(); vel.setY(0.05); - data.Player.setVelocity(vel); + UtilAction.velocity(data.Player, vel); //Sound data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java index 5c17248c1..9db75a2b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameSlam.java @@ -100,7 +100,7 @@ public class PerkFlameSlam extends Perk Vector vel = player.getLocation().getDirection(); vel.setY(0); UtilAlg.Normalize(vel); - player.setVelocity(vel.multiply(0.8)); + UtilAction.velocity(player, vel.multiply(0.8)); //Particle UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 5, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java index 5039514ff..e0eb24ebd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFleshArrow.java @@ -92,7 +92,7 @@ public class PerkFleshArrow extends SmashPerk 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 diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java index 61b79625a..bc1bbd109 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java @@ -13,6 +13,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; @@ -59,7 +60,7 @@ public class PerkIcePath extends Perk if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) return; - player.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(player); player.teleport(player.getLocation().add(0, 0.75, 0)); _data.add(new IcePathData(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 8a52c396c..029ef5bf4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -132,7 +132,7 @@ public class PerkSnowTurret extends SmashPerk if (damagee.equals(_snowball.get(proj))) 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 if (!(damagee instanceof LivingEntity)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index 5106fa728..f2e8b18b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -73,7 +73,7 @@ public class PerkSpiderLeap extends Perk { 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)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTakedown.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTakedown.java index 4d181426d..040155793 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTakedown.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTakedown.java @@ -112,7 +112,7 @@ public class PerkTakedown extends Perk DamageCause.CUSTOM, 8, true, true, false, damager.getName(), GetName()); - damager.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(damager); //Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVanishing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVanishing.java new file mode 100644 index 000000000..919f4ffdf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVanishing.java @@ -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); +// } +// } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index 699067767..b51869b2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -100,7 +100,7 @@ public class PerkWebShot extends SmashPerk implements IThrown DamageCause.PROJECTILE, 6, false, false, false, UtilEnt.getName(data.GetThrower()), GetName()); - target.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(target); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index 8877ef3a5..57a79f2f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -152,7 +152,7 @@ public class PerkWolf extends SmashPerk _tackle.put(wolf, damagee); wolf.setVelocity(new Vector(0,-0.6,0)); - damagee.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(damagee); //Damage Manager.GetDamage().NewDamageEvent(damagee, damager, null, @@ -190,7 +190,7 @@ public class PerkWolf extends SmashPerk if (UtilMath.offset(wolf, ent) < 2.5) { 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 @@ -305,7 +305,7 @@ public class PerkWolf extends SmashPerk public void StrikeHit(Player damager, LivingEntity damagee) { - damager.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(damager); //Remove Tackle Iterator wolfIterator = _tackle.keySet().iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index 384ba20bb..b0255ff8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -538,7 +538,7 @@ public class PerkWolfPack extends Perk public void TackleHit(Player damager, LivingEntity damagee) { - damager.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(damager); Manager.GetDamage().NewDamageEvent(damagee, damager, null, DamageCause.CUSTOM, 7, false, true, false, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index dafbc7416..759ab84d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -696,7 +696,7 @@ public class GameFlagManager implements Listener public void run() { player.setFireTicks(0); - player.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(player); } }, 0); } @@ -745,7 +745,7 @@ public class GameFlagManager implements Listener } player.setFireTicks(0); - player.setVelocity(new Vector(0,0,0)); + UtilAction.zeroVelocity(player); } }, (int)(time * 20d)); }