diff --git a/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml b/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml index c5431aad9..e5a5301f0 100644 --- a/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml +++ b/Plugins/.idea/artifacts/Mineplex_Game_Clans_jar.xml @@ -19,6 +19,7 @@ + \ No newline at end of file diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml index 4fb524c0b..be0eb0bae 100644 --- a/Plugins/.idea/modules.xml +++ b/Plugins/.idea/modules.xml @@ -9,6 +9,7 @@ + diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java index 7c5f2ce64..abe69d33e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java @@ -65,7 +65,7 @@ public class UtilMath public static double offset(Vector a, Vector b) { - return a.subtract(b).length(); + return a.clone().subtract(b).length(); } public static double offsetSquared(Entity a, Entity b) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index ef9fbad63..a29cff0c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -221,6 +221,6 @@ public class StatsManager extends MiniDbClientPlugin @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT stats.name, value FROM accountStats INNER JOIN stats ON stats.id = accountStats.statId WHERE accountStats.accountId = '" + accountId + "';"; + return "SELECT stats.name, value FROM accountStat INNER JOIN stats ON stats.id = accountStat.statId WHERE accountStat.accountId = '" + accountId + "';"; } } diff --git a/Plugins/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml b/Plugins/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml new file mode 100644 index 000000000..d33a27278 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/Mineplex.Game.Clans.iml b/Plugins/Mineplex.Game.Clans/Mineplex.Game.Clans.iml index 18f36b74f..c5914c65c 100644 --- a/Plugins/Mineplex.Game.Clans/Mineplex.Game.Clans.iml +++ b/Plugins/Mineplex.Game.Clans/Mineplex.Game.Clans.iml @@ -10,6 +10,7 @@ + diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 6d7733441..66a0cd8ac 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -777,11 +777,11 @@ public class ClansManager extends MiniClientPlugin implements IRelat public void onJoin(PlayerLoginEvent event) { Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); - if (!rank.Has(Rank.MAPDEV) && !event.getPlayer().isWhitelisted()) + if (!rank.Has(Rank.DEVELOPER)/* && !event.getPlayer().isWhitelisted()*/) { event.setResult(PlayerLoginEvent.Result.KICK_OTHER); // event.setKickMessage("This server is whitelisted!"); - event.setKickMessage("Only Builder+ can join this server"); + event.setKickMessage("Only Dev+ can join this server"); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansLoginManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansLoginManager.java index 9fd73a193..50d6c5a44 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansLoginManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansLoginManager.java @@ -3,6 +3,7 @@ package mineplex.game.clans.clans.commands; import java.sql.ResultSet; import java.sql.SQLException; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -10,6 +11,8 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.portal.Portal; import mineplex.database.Tables; import org.jooq.impl.DSL; @@ -27,10 +30,20 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor clientManager.addStoredProcedureLoginProcessor(this); } - private void kickPlayer(Player player, String homeServer) + private void kickPlayer(final String playerName, final String homeServer) { - player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer); - + runSyncLater(new Runnable() + { + @Override + public void run() + { + Player player = UtilPlayer.searchExact(playerName); + if (player != null && player.isOnline()) + { + player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer); + } + } + }, 30); } @Override @@ -45,20 +58,9 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor if (serverName != null) { System.out.println("Player " + playerName + " is from server: " + serverName); - - if (!serverName.equals(_serverName)) { - runSyncLater(new Runnable() - { - @Override - public void run() - { - final Player player = UtilPlayer.searchExact(playerName); - if (player != null) - kickPlayer(player, serverName); - } - }, 20); + kickPlayer(playerName, serverName); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java index 1e9b23e73..c9e09f8d2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOre.java @@ -243,9 +243,9 @@ public class FieldOre extends MiniPlugin return _oreInactive; } - public Set GetLocations() + public HashMap getLocationMap() { - return _oreLocations.keySet(); + return _oreLocations; } public void load() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java index 54ee6210a..85bc87bb0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java @@ -31,7 +31,7 @@ public class FieldOreData _loc = loc; _server = server; - Field.GetLocations().add(_loc); + Field.getLocationMap().put(_loc, server); for (FieldOreData other : Field.GetInactive()) { @@ -194,7 +194,7 @@ public class FieldOreData for (FieldOreData other : _neighbours) other.RemoveNeighbour(this); - Field.GetLocations().remove(_loc); + Field.getLocationMap().remove(_loc); _neighbours.clear(); _neighbours = null; diff --git a/Plugins/Mineplex.Hub/Mineplex.Hub.iml b/Plugins/Mineplex.Hub/Mineplex.Hub.iml index 5c4477b27..474bfecac 100644 --- a/Plugins/Mineplex.Hub/Mineplex.Hub.iml +++ b/Plugins/Mineplex.Hub/Mineplex.Hub.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java index 629e41461..8c8dea852 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java @@ -1,6 +1,7 @@ package mineplex.minecraft.game.core.boss.snake; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -34,10 +35,13 @@ public class SnakeCreature extends EventCreature private ArrayList _segments = new ArrayList(); private double _seperator = 0.5; private ArrayList _canSee = new ArrayList(); - + private Location _waypoint; + private Vector _velocity = new Vector(0, 0, 0); + + private boolean _enabled = true; - private boolean _enabled = false; + private int _ticks = 0; public SnakeCreature(WorldEvent event, Location spawnLocation) { @@ -52,23 +56,21 @@ public class SnakeCreature extends EventCreature UtilEnt.ghost(getEntity(), true, false); Vector dir = new Vector(UtilMath.rr(1, true), 0, UtilMath.rr(1, true)).normalize().multiply(_seperator); - getNewWaypoint(); - + getNewWaypoint(); + for (int i = 0; i < getHealth() / 50; i++) { SnakeSegment tail = new SnakeSegment(getSpawnLocation().toVector().subtract(dir.clone().multiply(-i)), new ItemStack(i == 0 ? Material.EMERALD_BLOCK : Material.STONE)); _segments.add(tail); - - break; } } - private void getNewWaypoint() + private void getNewWaypoint() { - Bukkit.broadcastMessage("NEW WAYPOINT!"); - _waypoint = getSpawnLocation().clone().add(Math.random() * 40 - 20, Math.random() * 24 - 8, Math.random() * 40 - 20); + // Bukkit.broadcastMessage("NEW WAYPOINT!"); + _waypoint = getSpawnLocation().clone().add(Math.random() * 60 - 30, Math.random() * 24 - 16, Math.random() * 60 - 30); } @EventHandler @@ -151,21 +153,39 @@ public class SnakeCreature extends EventCreature return; } - Packet[] packets = new Packet[_segments.size()]; + ArrayList packets = new ArrayList(); - - for (int i = _segments.size()-1; i>=0; i--) + for (int i = _segments.size() - 1; i >= 0; i--) { SnakeSegment seg = _segments.get(i); - - Vector vec = seg.getLocation(); + + Vector vec = seg.getLocation().clone(); if (i == 0) { - vec.add(UtilAlg.getTrajectory(vec, _waypoint.toVector()).multiply(0.1)); + Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector()); + +// Vector target = vec.clone().add(moveTo.multiply(3)); +// +// //MATHS +// double speed = 10d; +// double right = -Math.sin(_ticks/speed) * 4; +// double up = Math.cos(_ticks/speed) * 4; +// +// target.add(UtilAlg.getRight(vec).multiply(right)); +// target.add(UtilAlg.getUp(vec).multiply(up)); - Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec)); + _velocity.add(moveTo.normalize().multiply(0.04)); + if (_velocity.length() > 0.5) + _velocity.normalize().multiply(0.5); + + // Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(moveTo)); + + vec.add(_velocity); + + // Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec)); + if (UtilMath.offset(vec, _waypoint.toVector()) < 5) { getNewWaypoint(); @@ -173,18 +193,20 @@ public class SnakeCreature extends EventCreature } else { - vec = _segments.get(i-1).getLocation(); + vec = _segments.get(i - 1).getLocation(); } - packets[i] = seg.moveEntity(new Vector(UtilMath.rr(10, true), 12, UtilMath.rr(10, true))); + packets.addAll(Arrays.asList(seg.moveEntity(vec))); } + Packet[] packetArray = packets.toArray(new Packet[0]); + for (Player player : _canSee) { - UtilPlayer.sendPacket(player, packets); + UtilPlayer.sendPacket(player, packetArray); } } - + @EventHandler public void command(PlayerCommandPreprocessEvent event) { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeSegment.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeSegment.java index 2a2c1aaf7..2d3fe6e84 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeSegment.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeSegment.java @@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilEnt; import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; @@ -19,6 +20,7 @@ public class SnakeSegment private int _entityId = UtilEnt.getNewEntityId(); private Vector _entityLocation; private ItemStack _item; + private Vector _prevDir = new Vector(); public SnakeSegment(Vector location, ItemStack item) { @@ -31,9 +33,10 @@ public class SnakeSegment return _entityId; } - public Packet moveEntity(Vector newLocation) + public Packet[] moveEntity(Vector newLocation) { Vector toMove = newLocation.clone().subtract(_entityLocation); + Packet packet1; int x = (int) Math.floor(32 * toMove.getX()); int y = (int) Math.floor(32 * toMove.getY()); @@ -49,10 +52,10 @@ public class SnakeSegment relMove.b = (byte) x; relMove.c = (byte) y; relMove.d = (byte) z; - relMove.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F); - relMove.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F); + //relMove.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F); + //relMove.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F); - return relMove; + packet1 = relMove; } else { @@ -67,11 +70,45 @@ public class SnakeSegment teleportPacket.b = x; teleportPacket.c = y; teleportPacket.d = z; - teleportPacket.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F); - teleportPacket.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F); + //teleportPacket.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F); + //teleportPacket.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F); - return teleportPacket; + packet1 = teleportPacket; } + + toMove.normalize(); + + if (toMove.equals(_prevDir)) + { + return new Packet[] + { + packet1 + }; + } + + _prevDir = toMove; + + DataWatcher watcher = new DataWatcher(null); + watcher.a(0, (byte) 32); + watcher.a(1, 0); + watcher.a(10, (byte) 0); + + watcher.a(11, toMove); + + for (int i = 12; i < 17; i++) + { + watcher.a(i, new Vector(0, 0, 0)); + } + + PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata(); + + meta.a = getId(); + meta.b = watcher.c(); + + return new Packet[] + { + packet1, meta + }; } public Vector getLocation() @@ -84,7 +121,7 @@ public class SnakeSegment PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); DataWatcher watcher = new DataWatcher(null); - watcher.a(0, (byte) 0); + watcher.a(0, (byte) 32); watcher.a(1, 0); packet.a = getId(); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/SpiderCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/SpiderCreature.java index d3b5877a0..1650fe3a3 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/SpiderCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/SpiderCreature.java @@ -26,12 +26,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.boss.BossAbility; import mineplex.minecraft.game.core.boss.EventCreature; -import mineplex.minecraft.game.core.boss.ironwizard.GolemBoss; import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature; -import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemBlockHail; -import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemCaveIn; -import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemEarthquake; -import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemSlam; import mineplex.minecraft.game.core.boss.spider.attacks.SpiderEggplosm; public class SpiderCreature extends EventCreature diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java index 6cadf9887..b2e144f35 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java @@ -56,6 +56,7 @@ public class BossBattles extends TeamGame HungerSet = 20; CreatureAllowOverride = true; + PrepareFreeze = false; } @EventHandler