Merge branch 'clans-beta' of http://184.154.0.242:7990/scm/min/mineplex into clans_custom_gear

This commit is contained in:
Ty Sayers 2015-08-29 17:33:08 -07:00
commit f47c1b5c14
15 changed files with 134 additions and 56 deletions

View File

@ -19,6 +19,7 @@
<element id="module-output" name="Mineplex.ServerData" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Game.Clans.Core" />
</root>
</artifact>
</component>

View File

@ -9,6 +9,7 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" filepath="$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" filepath="$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans.Core/Mineplex.Game.Clans.Core.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />

View File

@ -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)

View File

@ -221,6 +221,6 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
@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 + "';";
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Mineplex.Core" />
<orderEntry type="module" module-name="Mineplex.Database" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="library" name="jooq" level="project" />
</component>
</module>

View File

@ -10,6 +10,7 @@
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="module" module-name="Mineplex.Game.Clans.Core" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="module" module-name="Mineplex.Database" />

View File

@ -777,11 +777,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> 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");
}
}
}

View File

@ -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)
{
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);
}
}
}

View File

@ -243,9 +243,9 @@ public class FieldOre extends MiniPlugin
return _oreInactive;
}
public Set<Location> GetLocations()
public HashMap<Location, String> getLocationMap()
{
return _oreLocations.keySet();
return _oreLocations;
}
public void load()

View File

@ -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;

View File

@ -21,5 +21,6 @@
<orderEntry type="module" module-name="Mineplex.Database" />
<orderEntry type="library" name="jooq" level="project" />
<orderEntry type="library" name="jedis" level="project" />
<orderEntry type="module" module-name="Mineplex.Game.Clans.Core" />
</component>
</module>

View File

@ -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;
@ -36,8 +37,11 @@ public class SnakeCreature extends EventCreature<Silverfish>
private ArrayList<Player> _canSee = new ArrayList<Player>();
private Location _waypoint;
private Vector _velocity = new Vector(0, 0, 0);
private boolean _enabled = false;
private boolean _enabled = true;
private int _ticks = 0;
public SnakeCreature(WorldEvent event, Location spawnLocation)
{
@ -60,15 +64,13 @@ public class SnakeCreature extends EventCreature<Silverfish>
new ItemStack(i == 0 ? Material.EMERALD_BLOCK : Material.STONE));
_segments.add(tail);
break;
}
}
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,20 +153,38 @@ public class SnakeCreature extends EventCreature<Silverfish>
return;
}
Packet[] packets = new Packet[_segments.size()];
ArrayList<Packet> packets = new ArrayList<Packet>();
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());
Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec));
// 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));
_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)
{
@ -176,12 +196,14 @@ public class SnakeCreature extends EventCreature<Silverfish>
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);
}
}

View File

@ -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();

View File

@ -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<Spider>

View File

@ -56,6 +56,7 @@ public class BossBattles extends TeamGame
HungerSet = 20;
CreatureAllowOverride = true;
PrepareFreeze = false;
}
@EventHandler