Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/battle-royale
This commit is contained in:
commit
2facabbe2d
20
Plugins/Mineplex.Core.Common.Base/pom.xml
Normal file
20
Plugins/Mineplex.Core.Common.Base/pom.xml
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>mineplex-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mineplex-core-common-base</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
@ -122,7 +122,7 @@ public enum Rank
|
||||
|
||||
if (inform)
|
||||
{
|
||||
UtilPlayer.message(player, C.mHead + "Permissions> " +
|
||||
UtilPlayerBase.message(player, C.mHead + "Permissions> " +
|
||||
C.mBody + "This requires Permission Rank [" +
|
||||
C.mHead + rank.Name.toUpperCase() +
|
||||
C.mBody + "].");
|
@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -0,0 +1,38 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
public class UtilBlockBase
|
||||
{
|
||||
|
||||
public static ArrayList<Block> getSurrounding(Block block, boolean diagonals)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
if (diagonals)
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int y = 1; y >= -1; y--)
|
||||
{
|
||||
if (x == 0 && y == 0 && z == 0) continue;
|
||||
|
||||
blocks.add(block.getRelative(x, y, z));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||
blocks.add(block.getRelative(BlockFace.EAST));
|
||||
blocks.add(block.getRelative(BlockFace.WEST));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.events.PlayerMessageEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class UtilPlayerBase
|
||||
{
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList)
|
||||
{
|
||||
message(client, messageList, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message)
|
||||
{
|
||||
message(client, message, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList, boolean wiki)
|
||||
{
|
||||
for (String curMessage : messageList)
|
||||
{
|
||||
message(client, curMessage, wiki);
|
||||
}
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message, boolean wiki)
|
||||
{
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (!(client instanceof Player))
|
||||
return;
|
||||
|
||||
/*
|
||||
if (wiki)
|
||||
message = UtilWiki.link(message);
|
||||
*/
|
||||
|
||||
PlayerMessageEvent event = new PlayerMessageEvent((Player) client, message);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
((Player) client).sendMessage(message);
|
||||
}
|
||||
|
||||
public static Player searchOnline(Player caller, String player, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
// No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
// Inform
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem
|
||||
+ player + C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (Player cur : matchList)
|
||||
matchString += F.elem(cur.getName()) + ", ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0, matchString.length() - 2);
|
||||
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
}
|
@ -6,8 +6,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class UtilTime
|
||||
{
|
||||
public static final ZoneId CENTRAL_ZONE = ZoneId.of("America/Chicago"); // This means "CST"
|
||||
@ -54,15 +52,6 @@ public class UtilTime
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the current global server tick. Is reset on server restart. Starts out negative. Counts upwards.
|
||||
*/
|
||||
public static int getServerTick()
|
||||
{
|
||||
return MinecraftServer.currentTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a {@link Timestamp} to a {@link LocalDateTime}.
|
||||
* This method will only work for timestamp's stored using {@link #CENTRAL_ZONE}, if stored using
|
@ -3,6 +3,7 @@ package mineplex.core.common.util;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -10,19 +11,16 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldBorder;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
|
||||
public class UtilWorld
|
||||
{
|
||||
public static World getWorld(String world)
|
||||
{
|
||||
return UtilServer.getServer().getWorld(world);
|
||||
return Bukkit.getServer().getWorld(world);
|
||||
}
|
||||
|
||||
public static boolean areChunksEqual(Location first, Location second)
|
||||
@ -100,7 +98,7 @@ public class UtilWorld
|
||||
|
||||
try
|
||||
{
|
||||
for (World cur : UtilServer.getServer().getWorlds())
|
||||
for (World cur : Bukkit.getServer().getWorlds())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(parts[0]))
|
||||
{
|
||||
@ -154,7 +152,7 @@ public class UtilWorld
|
||||
|
||||
try
|
||||
{
|
||||
for (World cur : UtilServer.getServer().getWorlds())
|
||||
for (World cur : Bukkit.getServer().getWorlds())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(tokens[0]))
|
||||
{
|
||||
@ -188,7 +186,7 @@ public class UtilWorld
|
||||
|
||||
public static World getWorldType(Environment env)
|
||||
{
|
||||
for (World cur : UtilServer.getServer().getWorlds())
|
||||
for (World cur : Bukkit.getServer().getWorlds())
|
||||
if (cur.getEnvironment() == env)
|
||||
return cur;
|
||||
|
||||
@ -305,16 +303,4 @@ public class UtilWorld
|
||||
|
||||
return startX >= minX && startZ <= maxX && endX >= minZ && endZ <= maxZ;
|
||||
}
|
||||
|
||||
public static double distanceSquared(Entity a, Entity b)
|
||||
{
|
||||
if (a.getWorld() != b.getWorld())
|
||||
throw new IllegalArgumentException("Different worlds: " + a.getWorld().getName() + " and " + b.getWorld().getName());
|
||||
net.minecraft.server.v1_8_R3.Entity entityA = ((CraftEntity) a).getHandle();
|
||||
net.minecraft.server.v1_8_R3.Entity entityB = ((CraftEntity) b).getHandle();
|
||||
double dx = entityA.locX - entityB.locX;
|
||||
double dy = entityA.locY - entityB.locY;
|
||||
double dz = entityA.locZ - entityB.locZ;
|
||||
return (dx * dx) + (dy * dy) + (dz * dz);
|
||||
}
|
||||
}
|
@ -20,6 +20,11 @@
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mineplex-core-common-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>mineplex-serverdata</artifactId>
|
||||
|
@ -0,0 +1,79 @@
|
||||
package mineplex.core.common.geom;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class Point2D implements Comparable<Point2D>
|
||||
{
|
||||
private static final Comparator<Point2D> COMPARE_BY_Y_THEN_X =
|
||||
Comparator.comparingDouble(Point2D::getY).thenComparingDouble(Point2D::getX);
|
||||
private final double _x;
|
||||
private final double _y;
|
||||
|
||||
private Point2D(double x, double y)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
}
|
||||
|
||||
public static Point2D of(double x, double y)
|
||||
{
|
||||
return new Point2D(x, y);
|
||||
}
|
||||
|
||||
public static Point2D of(Location location)
|
||||
{
|
||||
return new Point2D(location.getX(), location.getZ());
|
||||
}
|
||||
|
||||
public double getX()
|
||||
{
|
||||
return _x;
|
||||
}
|
||||
|
||||
public double getY()
|
||||
{
|
||||
return _y;
|
||||
}
|
||||
|
||||
public Comparator<Point2D> polarOrder()
|
||||
{
|
||||
return (p2, p3) ->
|
||||
{
|
||||
double dx1 = p2._x - _x;
|
||||
double dy1 = p2._y - _y;
|
||||
double dx2 = p3._x - _x;
|
||||
double dy2 = p3._y - _y;
|
||||
|
||||
if (dy1 >= 0 && dy2 < 0) return -1; // p2 above; p3 below
|
||||
else if (dy2 >= 0 && dy1 < 0) return 1; // p2 below; p3 above
|
||||
else if (dy1 == 0 && dy2 == 0) { // 3-collinear and horizontal
|
||||
if (dx1 >= 0 && dx2 < 0) return -1; // p2 right; p3 left
|
||||
else if (dx2 >= 0 && dx1 < 0) return 1; // p2 left ; p3 right
|
||||
else return 0; // all the same point
|
||||
}
|
||||
else return -ccw(Point2D.this, p2, p3); // both above or below
|
||||
};
|
||||
}
|
||||
|
||||
public static int ccw(Point2D a, Point2D b, Point2D c) {
|
||||
double area2 = (b._x-a._x)*(c._y-a._y) - (b._y-a._y)*(c._x-a._x);
|
||||
if (area2 < 0) return -1;
|
||||
else if (area2 > 0) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@Nonnull Point2D that)
|
||||
{
|
||||
return COMPARE_BY_Y_THEN_X.compare(this, that);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Point2D{_x=" + _x + ",_y=" + _y + "}";
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package mineplex.core.common.geom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
public class Polygon2D
|
||||
{
|
||||
private final List<Point2D> _points;
|
||||
|
||||
private Polygon2D(List<Point2D> points)
|
||||
{
|
||||
_points = points;
|
||||
// Ensure points[points.size-1] = points[0]
|
||||
if (!_points.get(0).equals(points.get(_points.size()-1)))
|
||||
{
|
||||
_points.add(points.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(Point2D point)
|
||||
{
|
||||
boolean result = false;
|
||||
for (int i = 0, j = _points.size() - 1; i < _points.size(); j = i++)
|
||||
{
|
||||
if ((_points.get(i).getY() > point.getY()) != (_points.get(j).getY() > point.getY()) &&
|
||||
(point.getX() < (_points.get(j).getX() - _points.get(i).getX()) * (point.getY() - _points.get(i).getY()) / (_points.get(j).getY() - _points.get(i).getY()) + _points.get(i).getX()))
|
||||
{
|
||||
result = !result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Polygon2D fromUnorderedPoints(List<Point2D> points)
|
||||
{
|
||||
Stack<Point2D> hull = new Stack<>();
|
||||
|
||||
Collections.sort(points);
|
||||
points.subList(1, points.size()).sort(points.get(0).polarOrder());
|
||||
|
||||
hull.push(points.get(0));
|
||||
hull.push(points.get(1));
|
||||
|
||||
// find first extreme point (not collinear with first and second elements)
|
||||
int extreme;
|
||||
for (extreme = 2; extreme < points.size(); extreme++)
|
||||
if (Point2D.ccw(points.get(0), points.get(1), points.get(extreme)) != 0) break;
|
||||
|
||||
for (int i = extreme; i < points.size(); i++)
|
||||
{
|
||||
Point2D top = hull.pop();
|
||||
while (Point2D.ccw(hull.peek(), top, points.get(i)) <= 0) {
|
||||
top = hull.pop();
|
||||
}
|
||||
hull.push(top);
|
||||
hull.push(points.get(i));
|
||||
}
|
||||
|
||||
return new Polygon2D(new ArrayList<>(hull));
|
||||
}
|
||||
|
||||
public static Polygon2D fromPoints(List<Point2D> points)
|
||||
{
|
||||
return new Polygon2D(new ArrayList<>(points));
|
||||
}
|
||||
}
|
@ -615,30 +615,7 @@ public class UtilBlock
|
||||
|
||||
public static ArrayList<Block> getSurrounding(Block block, boolean diagonals)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
if (diagonals)
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
for (int y = 1; y >= -1; y--)
|
||||
{
|
||||
if (x == 0 && y == 0 && z == 0) continue;
|
||||
|
||||
blocks.add(block.getRelative(x, y, z));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks.add(block.getRelative(BlockFace.UP));
|
||||
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||
blocks.add(block.getRelative(BlockFace.EAST));
|
||||
blocks.add(block.getRelative(BlockFace.WEST));
|
||||
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
return blocks;
|
||||
return UtilBlockBase.getSurrounding(block, diagonals);
|
||||
}
|
||||
|
||||
public static boolean isVisible(Block block)
|
||||
|
@ -348,42 +348,22 @@ public class UtilPlayer
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList)
|
||||
{
|
||||
message(client, messageList, false);
|
||||
UtilPlayerBase.message(client, messageList);
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message)
|
||||
{
|
||||
message(client, message, false);
|
||||
UtilPlayerBase.message(client, message);
|
||||
}
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList, boolean wiki)
|
||||
{
|
||||
for (String curMessage : messageList)
|
||||
{
|
||||
message(client, curMessage, wiki);
|
||||
}
|
||||
UtilPlayerBase.message(client, messageList, wiki);
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message, boolean wiki)
|
||||
{
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (!(client instanceof Player))
|
||||
return;
|
||||
|
||||
/*
|
||||
if (wiki)
|
||||
message = UtilWiki.link(message);
|
||||
*/
|
||||
|
||||
PlayerMessageEvent event = UtilServer.CallEvent(new PlayerMessageEvent((Player) client, message));
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
((Player) client).sendMessage(message);
|
||||
UtilPlayerBase.message(client, message, wiki);
|
||||
}
|
||||
|
||||
public static Player searchExact(String name)
|
||||
@ -454,44 +434,7 @@ public class UtilPlayer
|
||||
|
||||
public static Player searchOnline(Player caller, String player, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
// No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
// Inform
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem
|
||||
+ player + C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (Player cur : matchList)
|
||||
matchString += F.elem(cur.getName()) + ", ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0, matchString.length() - 2);
|
||||
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
return UtilPlayerBase.searchOnline(caller, player, inform);
|
||||
}
|
||||
|
||||
public static void searchOffline(List<String> matches, final Callback<String> callback, final Player caller,
|
||||
|
@ -78,39 +78,39 @@ public class AntiHackGuardian implements Listener
|
||||
{
|
||||
UtilServer.RegisterEvents(this);
|
||||
|
||||
this.MAX_DISTANCE_X = maxX;
|
||||
this.MIN_DISTANCE_X = minX;
|
||||
this.MAX_DISTANCE_Y = maxY;
|
||||
this.MIN_DISTANCE_Y = minY;
|
||||
this.MAX_DISTANCE_Z = maxZ;
|
||||
this.MIN_DISTANCE_Z = minZ;
|
||||
MAX_DISTANCE_X = maxX;
|
||||
MIN_DISTANCE_X = minX;
|
||||
MAX_DISTANCE_Y = maxY;
|
||||
MIN_DISTANCE_Y = minY;
|
||||
MAX_DISTANCE_Z = maxZ;
|
||||
MIN_DISTANCE_Z = minZ;
|
||||
|
||||
this.CENTER_X = MIN_DISTANCE_X + ((MAX_DISTANCE_X - MIN_DISTANCE_X) / 2.0);
|
||||
this.CENTER_Y = MIN_DISTANCE_Y + ((MAX_DISTANCE_Y - MIN_DISTANCE_Y) / 2.0);
|
||||
this.CENTER_Z = MIN_DISTANCE_Z + ((MAX_DISTANCE_Z - MIN_DISTANCE_Z) / 2.0);
|
||||
CENTER_X = MIN_DISTANCE_X + ((MAX_DISTANCE_X - MIN_DISTANCE_X) / 2.0);
|
||||
CENTER_Y = MIN_DISTANCE_Y + ((MAX_DISTANCE_Y - MIN_DISTANCE_Y) / 2.0);
|
||||
CENTER_Z = MIN_DISTANCE_Z + ((MAX_DISTANCE_Z - MIN_DISTANCE_Z) / 2.0);
|
||||
|
||||
//debug("Spawning ArmorStand at " + center + "");
|
||||
|
||||
CoreClientManager clientManager = Managers.get(CoreClientManager.class);
|
||||
DisguiseManager disguiseManager = Managers.get(DisguiseManager.class);
|
||||
|
||||
this._center = center;
|
||||
this._center.getChunk().load();
|
||||
_center = center;
|
||||
_center.getChunk().load();
|
||||
|
||||
this._armorStand = (ArmorStand) new EntityArmorStand(((CraftWorld) this._center.getWorld()).getHandle(), this._center.getX(), this._center.getY(), this._center.getZ()).getBukkitEntity();
|
||||
this._armorStand.setGravity(false);
|
||||
this._armorStand.setVisible(false);
|
||||
this._armorStand.setRemoveWhenFarAway(false);
|
||||
this._nmsEntity = ((CraftArmorStand) this._armorStand).getHandle();
|
||||
this._nmsEntity.maxNoDamageTicks = 86400;
|
||||
this._nmsEntity.noDamageTicks = 86400;
|
||||
_armorStand = (ArmorStand) new EntityArmorStand(((CraftWorld) _center.getWorld()).getHandle(), _center.getX(), _center.getY(), _center.getZ()).getBukkitEntity();
|
||||
_armorStand.setGravity(false);
|
||||
_armorStand.setVisible(false);
|
||||
_armorStand.setRemoveWhenFarAway(false);
|
||||
_nmsEntity = ((CraftArmorStand) _armorStand).getHandle();
|
||||
_nmsEntity.maxNoDamageTicks = 86400;
|
||||
_nmsEntity.noDamageTicks = 86400;
|
||||
|
||||
this._entityUUID = this._armorStand.getUniqueId();
|
||||
_entityUUID = _armorStand.getUniqueId();
|
||||
|
||||
this._disguise = new DisguiseGuardian(this._armorStand);
|
||||
this._disguise.setHideIfNotDisguised(true);
|
||||
_disguise = new DisguiseGuardian(_armorStand);
|
||||
_disguise.setHideIfNotDisguised(true);
|
||||
|
||||
disguiseManager.disguise(this._disguise, player ->
|
||||
disguiseManager.disguise(_disguise, player ->
|
||||
{
|
||||
if (!hideForStaff) return true;
|
||||
|
||||
@ -141,17 +141,17 @@ public class AntiHackGuardian implements Listener
|
||||
@EventHandler
|
||||
public void onLoad(ChunkAddEntityEvent event)
|
||||
{
|
||||
if (event.getEntity().getUniqueId().equals(this._entityUUID))
|
||||
if (event.getEntity().getUniqueId().equals(_entityUUID))
|
||||
{
|
||||
this._armorStand = (ArmorStand) event.getEntity();
|
||||
this._nmsEntity = ((CraftArmorStand) this._armorStand).getHandle();
|
||||
_armorStand = (ArmorStand) event.getEntity();
|
||||
_nmsEntity = ((CraftArmorStand) _armorStand).getHandle();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onStack(StackerEvent event)
|
||||
{
|
||||
if (event.getEntity().getUniqueId().equals(this._entityUUID))
|
||||
if (event.getEntity().getUniqueId().equals(_entityUUID))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -159,27 +159,27 @@ public class AntiHackGuardian implements Listener
|
||||
|
||||
public void tick()
|
||||
{
|
||||
if (this._nmsEntity.dead || !this._nmsEntity.valid)
|
||||
if (_nmsEntity.dead || !_nmsEntity.valid)
|
||||
{
|
||||
//debug("Skipping because " + this._armorStand.isDead() + " " + this._armorStand.isValid());
|
||||
//debug("Skipping because " + _armorStand.isDead() + " " + _armorStand.isValid());
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._target == null)
|
||||
if (_target == null)
|
||||
{
|
||||
regularTick();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._stalkTime++;
|
||||
_stalkTime++;
|
||||
targetTick();
|
||||
}
|
||||
//debug("Ticking " + this._armorStand + " " + this._armorStand.isDead() + " " + this._armorStand.getLocation() + " " + this._ticksUntilReset);
|
||||
//debug("Ticking " + _armorStand + " " + _armorStand.isDead() + " " + _armorStand.getLocation() + " " + _ticksUntilReset);
|
||||
}
|
||||
|
||||
private void regularTick()
|
||||
{
|
||||
if (this._ticksUntilReset <= 0)
|
||||
if (_ticksUntilReset <= 0)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
@ -187,8 +187,8 @@ public class AntiHackGuardian implements Listener
|
||||
//debug("===== Begin Calculations =====");
|
||||
|
||||
|
||||
//debug("Target: " + this._targetX + " " + this._targetY + " " + this._targetZ);
|
||||
//debug("Start: " + this._armorStand.getLocation());
|
||||
//debug("Target: " + _targetX + " " + _targetY + " " + _targetZ);
|
||||
//debug("Start: " + _armorStand.getLocation());
|
||||
double deltaX = _targetX - _nmsEntity.locX;
|
||||
double deltaY = _targetY - _nmsEntity.locY;
|
||||
double deltaZ = _targetZ - _nmsEntity.locZ;
|
||||
@ -210,28 +210,28 @@ public class AntiHackGuardian implements Listener
|
||||
_nmsEntity.locY += dy;
|
||||
_nmsEntity.locZ += dz;
|
||||
|
||||
//debug("Dest: " + this._nmsEntity.locX + " " + this._nmsEntity.locY + " " + this._nmsEntity.locZ);
|
||||
//debug("Dest: " + _nmsEntity.locX + " " + _nmsEntity.locY + " " + _nmsEntity.locZ);
|
||||
//debug("===== End Calculations =====");
|
||||
|
||||
// Only send look update every second
|
||||
if (this._nmsEntity.ticksLived % 20 == 0)
|
||||
if (_nmsEntity.ticksLived % 20 == 0)
|
||||
{
|
||||
UtilEnt.CreatureLook(_armorStand, _nmsEntity.locX, _nmsEntity.locY, _nmsEntity.locZ, _targetX, _targetY, _targetZ);
|
||||
}
|
||||
|
||||
this._ticksUntilReset--;
|
||||
_ticksUntilReset--;
|
||||
}
|
||||
|
||||
private void targetTick()
|
||||
{
|
||||
//debug("===== Stalking " + this._target.getName() + " =====");
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) this._target).getHandle();
|
||||
//debug("===== Stalking " + _target.getName() + " =====");
|
||||
EntityPlayer entityPlayer = ((CraftPlayer) _target).getHandle();
|
||||
|
||||
Vector direction = this._target.getLocation().getDirection().normalize().multiply(-6);
|
||||
Vector direction = _target.getLocation().getDirection().normalize().multiply(-6);
|
||||
|
||||
this._nmsEntity.locX = entityPlayer.locX + direction.getX();
|
||||
this._nmsEntity.locZ = entityPlayer.locZ + direction.getZ();
|
||||
this._nmsEntity.locY = entityPlayer.locY + 10.0 + nextDouble(-1.0, 1.0);
|
||||
_nmsEntity.locX = entityPlayer.locX + direction.getX();
|
||||
_nmsEntity.locZ = entityPlayer.locZ + direction.getZ();
|
||||
_nmsEntity.locY = entityPlayer.locY + 10.0 + nextDouble(-1.0, 1.0);
|
||||
|
||||
UtilEnt.CreatureLook(_armorStand, _nmsEntity.locX, _nmsEntity.locY, _nmsEntity.locZ, entityPlayer.locX, entityPlayer.locY, entityPlayer.locZ);
|
||||
}
|
||||
@ -261,7 +261,7 @@ public class AntiHackGuardian implements Listener
|
||||
cy = MAGICAL_FUNCTION.apply(cy) * (y > CENTER_Y ? -(MAX_DISTANCE_Y - CENTER_Y) : (CENTER_Y - MIN_DISTANCE_Y));
|
||||
cz = MAGICAL_FUNCTION.apply(cz) * (z > CENTER_Z ? -(MAX_DISTANCE_Z - CENTER_Z) : (CENTER_Z - MIN_DISTANCE_Z));
|
||||
|
||||
//debug("Start: " + this._armorStand.getLocation());
|
||||
//debug("Start: " + _armorStand.getLocation());
|
||||
//debug("Changes: " + cx + " " + cy + " " + cz);
|
||||
|
||||
int ex = nextInt(8, 12);
|
||||
@ -285,18 +285,18 @@ public class AntiHackGuardian implements Listener
|
||||
|
||||
//debug("Deltas: " + dx + " " + dy + " " + dz);
|
||||
|
||||
this._targetX = x + dx;
|
||||
this._targetY = y + dy;
|
||||
this._targetZ = z + dz;
|
||||
//debug("End: " + this._targetX + " " + this._targetY + " " + this._targetZ);
|
||||
_targetX = x + dx;
|
||||
_targetY = y + dy;
|
||||
_targetZ = z + dz;
|
||||
//debug("End: " + _targetX + " " + _targetY + " " + _targetZ);
|
||||
|
||||
|
||||
// If we can't find a good position, just go to the center
|
||||
if (!locCheck())
|
||||
{
|
||||
this._targetX = CENTER_X;
|
||||
this._targetY = CENTER_Y;
|
||||
this._targetZ = CENTER_Z;
|
||||
_targetX = CENTER_X;
|
||||
_targetY = CENTER_Y;
|
||||
_targetZ = CENTER_Z;
|
||||
|
||||
dx = (int) (CENTER_X - x);
|
||||
dy = (int) (CENTER_Y - y);
|
||||
@ -305,46 +305,46 @@ public class AntiHackGuardian implements Listener
|
||||
|
||||
double maxDelta = Math.max(Math.max(Math.abs(dx), Math.abs(dy)), Math.abs(dz));
|
||||
|
||||
this._ticksUntilReset = (int) (maxDelta / DELTA_MOVE_PER_TICK);
|
||||
_ticksUntilReset = (int) (maxDelta / DELTA_MOVE_PER_TICK);
|
||||
|
||||
// Send look update for new target
|
||||
UtilEnt.CreatureLook(_armorStand, _nmsEntity.locX, _nmsEntity.locY, _nmsEntity.locZ, _targetX, _targetY, _targetZ);
|
||||
|
||||
//debug("Ticks: " + this._ticksUntilReset);
|
||||
//debug("Ticks: " + _ticksUntilReset);
|
||||
//debug("======= END RESET ======");
|
||||
}
|
||||
|
||||
public void target(Player player)
|
||||
{
|
||||
this._target = player;
|
||||
_target = player;
|
||||
}
|
||||
|
||||
public boolean isTargeting()
|
||||
{
|
||||
return this._target != null;
|
||||
return _target != null;
|
||||
}
|
||||
|
||||
public int getTargetingTime()
|
||||
{
|
||||
return this._stalkTime;
|
||||
return _stalkTime;
|
||||
}
|
||||
|
||||
public void stopTargeting()
|
||||
{
|
||||
this._target = null;
|
||||
this._stalkTime = 0;
|
||||
_target = null;
|
||||
_stalkTime = 0;
|
||||
reset();
|
||||
}
|
||||
|
||||
public void shoot(Player player)
|
||||
{
|
||||
this._disguise.setTarget(player == null ? 0 : player.getEntityId());
|
||||
Managers.get(DisguiseManager.class).updateDisguise(this._disguise);
|
||||
_disguise.setTarget(player == null ? 0 : player.getEntityId());
|
||||
Managers.get(DisguiseManager.class).updateDisguise(_disguise);
|
||||
}
|
||||
|
||||
public Player getTarget()
|
||||
{
|
||||
return this._target;
|
||||
return _target;
|
||||
}
|
||||
|
||||
private boolean locCheck()
|
||||
@ -376,31 +376,31 @@ public class AntiHackGuardian implements Listener
|
||||
|
||||
public void remove()
|
||||
{
|
||||
this._target = null;
|
||||
_target = null;
|
||||
UtilServer.Unregister(this);
|
||||
Managers.get(DisguiseManager.class).undisguise(this._disguise);
|
||||
this._armorStand.remove();
|
||||
this._nmsEntity = null;
|
||||
this._armorStand = null;
|
||||
this._center = null;
|
||||
Managers.get(DisguiseManager.class).undisguise(_disguise);
|
||||
_armorStand.remove();
|
||||
_nmsEntity = null;
|
||||
_armorStand = null;
|
||||
_center = null;
|
||||
}
|
||||
|
||||
public ArmorStand getEntity()
|
||||
{
|
||||
return this._armorStand;
|
||||
return _armorStand;
|
||||
}
|
||||
|
||||
public void moveDelta(double dx, double dy, double dz)
|
||||
{
|
||||
this._nmsEntity.locX += dx;
|
||||
this._nmsEntity.locY += dy;
|
||||
this._nmsEntity.locZ += dz;
|
||||
_nmsEntity.locX += dx;
|
||||
_nmsEntity.locY += dy;
|
||||
_nmsEntity.locZ += dz;
|
||||
}
|
||||
|
||||
public void move(double x, double y, double z)
|
||||
{
|
||||
this._nmsEntity.locX = x;
|
||||
this._nmsEntity.locY = y;
|
||||
this._nmsEntity.locZ = z;
|
||||
_nmsEntity.locX = x;
|
||||
_nmsEntity.locY = y;
|
||||
_nmsEntity.locZ = z;
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ public class GuardianManager extends MiniPlugin
|
||||
{
|
||||
super("GuardianManager");
|
||||
|
||||
this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () ->
|
||||
_plugin.getServer().getScheduler().runTaskTimer(_plugin, () ->
|
||||
{
|
||||
for (AntiHackGuardian guardian : this._guardians)
|
||||
for (AntiHackGuardian guardian : _guardians)
|
||||
{
|
||||
if (guardian.getTarget() != null && !guardian.getTarget().isOnline())
|
||||
{
|
||||
this._stalking.remove(guardian.getTarget().getUniqueId());
|
||||
_stalking.remove(guardian.getTarget().getUniqueId());
|
||||
guardian.stopTargeting();
|
||||
}
|
||||
else if (guardian.getTargetingTime() > MIN_STALK_TIME)
|
||||
@ -55,7 +55,7 @@ public class GuardianManager extends MiniPlugin
|
||||
double threshold = STALK_END_PROBABILITY_EQUATION.apply(guardian.getTargetingTime() - MIN_STALK_TIME);
|
||||
if (Math.random() <= threshold)
|
||||
{
|
||||
this._stalking.remove(guardian.getTarget().getUniqueId());
|
||||
_stalking.remove(guardian.getTarget().getUniqueId());
|
||||
_stalkingCooldown.put(guardian.getTarget().getUniqueId(), true);
|
||||
guardian.stopTargeting();
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class GuardianManager extends MiniPlugin
|
||||
}
|
||||
}, 0L, 1L);
|
||||
|
||||
this._plugin.getServer().getScheduler().runTaskTimer(this._plugin, () ->
|
||||
_plugin.getServer().getScheduler().runTaskTimer(_plugin, () ->
|
||||
{
|
||||
if (_stalking.size() >= MAX_STALKED_PLAYERS)
|
||||
{
|
||||
@ -124,6 +124,6 @@ public class GuardianManager extends MiniPlugin
|
||||
|
||||
public void registerGuardian(AntiHackGuardian guardian)
|
||||
{
|
||||
this._guardians.add(guardian);
|
||||
_guardians.add(guardian);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class BetaWhitelist extends MiniPlugin
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Rank rank = _clientManager.Get(player).GetRank(true);
|
||||
if (rank.has(Rank.TITAN) // If this player is Titan+
|
||||
if (rank.has(Rank.ULTRA) // If this player is Ultra+
|
||||
|| _powerPlayClubRepository.getCachedData(player).isSubscribed() // a PPC subscriber,
|
||||
|| EXTRA_PLAYERS.contains(player.getUniqueId())) // or explicitly whitelisted,
|
||||
{
|
||||
|
@ -10,10 +10,11 @@ import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ArrowEffectGadget;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class ArrowTrailCandyCane extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
@ -29,7 +30,7 @@ public class ArrowTrailCandyCane extends ArrowEffectGadget
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
int data = 15;
|
||||
int tick = Math.abs(UtilTime.getServerTick()%3);
|
||||
int tick = Math.abs(MinecraftServer.currentTick%3);
|
||||
if(tick == 1) data = 1;
|
||||
if(tick == 2) data = 2;
|
||||
Location loc = arrow.getLocation();
|
||||
|
@ -104,7 +104,8 @@ public enum GameDisplay
|
||||
|
||||
AlienInvasion("Alien Invasion", Material.ENDER_STONE, (byte) 0, GameCategory.EVENT, 69, false),
|
||||
|
||||
MOBA("Heroes of GWEN", Material.SKULL_ITEM, (byte)1, GameCategory.CLASSICS, 70, true),
|
||||
MOBA("Heroes of GWEN", Material.PRISMARINE, (byte)0, GameCategory.CLASSICS, 70, true),
|
||||
MOBATraining("Heroes of GWEN Training", Material.PRISMARINE, (byte)0, GameCategory.CLASSICS, 70, false),
|
||||
|
||||
GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.SURVIVAL, 71, false),
|
||||
|
||||
|
@ -6,7 +6,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
@ -19,7 +18,6 @@ import mineplex.core.TimingsFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.antihack.guardians.AntiHackGuardian;
|
||||
import mineplex.core.antihack.guardians.GuardianManager;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
@ -161,81 +159,6 @@ public class Clans extends JavaPlugin
|
||||
|
||||
new EternalGiveawayManager(this, _clientManager, serverStatusManager);
|
||||
|
||||
{
|
||||
// West Shop
|
||||
int maxX = -385;
|
||||
int minX = -462;
|
||||
int maxY = 100;
|
||||
int minY = 90;
|
||||
int maxZ = 46;
|
||||
int minZ = -30;
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), -422, 95, 8);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// East Shop
|
||||
int maxX = 385;
|
||||
int minX = -463;
|
||||
int maxY = 100;
|
||||
int minY = 90;
|
||||
int maxZ = 31;
|
||||
int minZ = -46;
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), 424, 95, -8);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// North Spawn
|
||||
int maxX = 25;
|
||||
int minX = -8;
|
||||
int maxY = 215;
|
||||
int minY = 205;
|
||||
int maxZ = -376;
|
||||
int minZ = -410;
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), 9, 210, -393);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// South Spawn
|
||||
int maxX = 25;
|
||||
int minX = -8;
|
||||
int maxY = 215;
|
||||
int minY = 205;
|
||||
int maxZ = 407;
|
||||
int minZ = 373;
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), 8, 210, 390);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Fields
|
||||
int maxX = 50;
|
||||
int minX = -60;
|
||||
int maxY = 110;
|
||||
int minY = 100;
|
||||
int maxZ = 70;
|
||||
int minZ = -70;
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), 0, 100, 0);
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
guardianManager.registerGuardian(new AntiHackGuardian(spawn.clone(), maxX, minX, maxY, minY, maxZ, minZ));
|
||||
}
|
||||
}
|
||||
|
||||
BlockRestore blockRestore = require(BlockRestore.class);
|
||||
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||
|
@ -377,7 +377,7 @@ public class ClansGame extends MiniPlugin
|
||||
@EventHandler
|
||||
public void respawn(PlayerRespawnEvent event)
|
||||
{
|
||||
_clans.getItemMapManager().setMap(event.getPlayer());
|
||||
//_clans.getItemMapManager().setMap(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
|
@ -221,7 +221,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
private ProjectileManager _projectileManager;
|
||||
private WorldEventManager _worldEvent;
|
||||
private Chat _chat;
|
||||
private ItemMapManager _itemMapManager;
|
||||
// private ItemMapManager _itemMapManager;
|
||||
private DisguiseManager _disguiseManager;
|
||||
private NpcManager _npcManager;
|
||||
private Explosion _explosion;
|
||||
@ -305,7 +305,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
_clanGame = new ClansGame(plugin, this);
|
||||
_clanUtility = new ClansUtility(this);
|
||||
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, this, _npcManager, _taskManager);
|
||||
_itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
|
||||
// _itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
|
||||
new TntGeneratorManager(plugin, this);
|
||||
new SupplyDropManager(plugin, this);
|
||||
|
||||
@ -492,7 +492,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
addCommand(new ClansChatCommand(this));
|
||||
addCommand(new ClansAllyChatCommand(this));
|
||||
addCommand(new ClanManagementCommand(this));
|
||||
addCommand(new MapCommand(this));
|
||||
// addCommand(new MapCommand(this));
|
||||
addCommand(new SpeedCommand(this));
|
||||
}
|
||||
|
||||
@ -563,10 +563,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
public ItemMapManager getItemMapManager()
|
||||
{
|
||||
return _itemMapManager;
|
||||
}
|
||||
// public ItemMapManager getItemMapManager()
|
||||
// {
|
||||
// return _itemMapManager;
|
||||
// }
|
||||
|
||||
public Explosion getExplosion()
|
||||
{
|
||||
@ -1273,10 +1273,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
online++;
|
||||
}
|
||||
|
||||
if (online >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
|
||||
if (online >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && rank != Rank.YOUTUBE && rank != Rank.YOUTUBE_SMALL && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "This Clans server is full! Try again soon");
|
||||
event.setKickMessage("This Clans server is full! Try again soon");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -987,18 +987,18 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanUtility().unclaimAll(caller);
|
||||
}
|
||||
|
||||
public void map(Player caller, String[] args)
|
||||
{
|
||||
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "map");
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getItemMapManager().setMap(caller);
|
||||
}
|
||||
// public void map(Player caller, String[] args)
|
||||
// {
|
||||
// ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "map");
|
||||
// UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
//
|
||||
// if (event.isCancelled())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Plugin.getItemMapManager().setMap(caller);
|
||||
// }
|
||||
|
||||
public void home(final Player caller, String[] args)
|
||||
{
|
||||
|
@ -33,6 +33,6 @@ public class MapCommand extends CommandBase<ClansManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.getItemMapManager().setMap(caller);
|
||||
//Plugin.getItemMapManager().setMap(caller);
|
||||
}
|
||||
}
|
||||
|
@ -469,13 +469,13 @@ public class NetherManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
UtilServer.getPlayersCollection()
|
||||
.stream()
|
||||
.filter(player -> isInNether(player))
|
||||
.forEach(player ->
|
||||
{
|
||||
ClansManager.getInstance().getItemMapManager().removeMap(player);
|
||||
});
|
||||
// UtilServer.getPlayersCollection()
|
||||
// .stream()
|
||||
// .filter(player -> isInNether(player))
|
||||
// .forEach(player ->
|
||||
// {
|
||||
// ClansManager.getInstance().getItemMapManager().removeMap(player);
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,17 +157,17 @@ public class RaidManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
UtilServer.getPlayersCollection()
|
||||
.stream()
|
||||
.filter(player -> isInRaid(player.getLocation()))
|
||||
.forEach(player ->
|
||||
{
|
||||
ClansManager.getInstance().getItemMapManager().removeMap(player);
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (event.getType() == UpdateType.TICK)
|
||||
// {
|
||||
// UtilServer.getPlayersCollection()
|
||||
// .stream()
|
||||
// .filter(player -> isInRaid(player.getLocation()))
|
||||
// .forEach(player ->
|
||||
// {
|
||||
// ClansManager.getInstance().getItemMapManager().removeMap(player);
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
|
@ -128,7 +128,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
UtilInv.Clear(player);
|
||||
|
||||
ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||
// ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||
}, 20 * 10L);
|
||||
|
||||
player.setWalkSpeed(0.2F);
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class WorldManager extends MiniPlugin
|
||||
{
|
||||
@ -77,6 +78,9 @@ public class WorldManager extends MiniPlugin
|
||||
{
|
||||
List<Player> players = world.getPlayers();
|
||||
Map<EntityType, Set<Entity>> entities = new HashMap<>();
|
||||
// For optimization reasons reuse location objects
|
||||
Location entityLocation = new Location(world, 0, 0, 0);
|
||||
Location playerLocation = new Location(world, 0, 0, 0);
|
||||
|
||||
for (Entity entity : world.getEntities())
|
||||
{
|
||||
@ -104,11 +108,11 @@ public class WorldManager extends MiniPlugin
|
||||
else if (CULL_LIMITS.containsKey(entityType))
|
||||
{
|
||||
boolean cull = true;
|
||||
entity.getLocation(entityLocation);
|
||||
for (Player player : players)
|
||||
{
|
||||
// Using NMS because this is going to be called quite a few times
|
||||
// and each getLocation() call creates a new Location object
|
||||
if (UtilWorld.distanceSquared(player, entity) <= MIN_RANGE_SQUARED)
|
||||
player.getLocation(playerLocation);
|
||||
if (playerLocation.distanceSquared(entityLocation) <= MIN_RANGE_SQUARED)
|
||||
{
|
||||
cull = false;
|
||||
break;
|
||||
|
@ -14,9 +14,13 @@
|
||||
<artifactId>mineplex-mapparser</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mineplex-core-common</artifactId>
|
||||
<artifactId>mineplex-core-common-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -23,9 +24,8 @@ import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilBlockBase;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.command.AddLoreCommand;
|
||||
import mineplex.mapparser.command.AddSplashTextCommand;
|
||||
import mineplex.mapparser.command.AdminCommand;
|
||||
@ -144,7 +144,7 @@ public class MapParser extends JavaPlugin
|
||||
|
||||
public void sendValidGameTypes(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", "Valid Game Types;"));
|
||||
UtilPlayerBase.message(player, F.main("Parser", "Valid Game Types;"));
|
||||
|
||||
String gameTypes = "";
|
||||
|
||||
@ -256,7 +256,7 @@ public class MapParser extends JavaPlugin
|
||||
|
||||
public void announce(String msg)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.sendMessage(C.cGold + msg);
|
||||
}
|
||||
@ -390,7 +390,7 @@ public class MapParser extends JavaPlugin
|
||||
if (!blocks.add(current))
|
||||
return blocks;
|
||||
|
||||
for (Block other : UtilBlock.getSurrounding(current, true))
|
||||
for (Block other : UtilBlockBase.getSurrounding(current, true))
|
||||
{
|
||||
if (current.getType() != Material.LOG && current.getType() != Material.LEAVES)
|
||||
continue;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.mapparser;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.ZipUtil;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -24,7 +23,7 @@ public class WorldManager
|
||||
public World prepMapParse(World world)
|
||||
{
|
||||
//Unload World
|
||||
MapUtil.UnloadWorld(Host, world, true);
|
||||
Host.getServer().unloadWorld(world, true);
|
||||
|
||||
//Delete Non-Map Files
|
||||
String[] folders = new File(world.getName()).list();
|
||||
@ -69,7 +68,7 @@ public class WorldManager
|
||||
|
||||
public void finalizeParsedWorld(World world)
|
||||
{
|
||||
MapUtil.UnloadWorld(Host, world, true);
|
||||
Host.getServer().unloadWorld(world, true);
|
||||
|
||||
ArrayList<String> fileList = new ArrayList<String>();
|
||||
ArrayList<String> dirList = new ArrayList<String>();
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
@ -42,7 +42,7 @@ public class AdminCommand extends BaseCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
Player other = UtilPlayer.searchOnline(player, args[0], true);
|
||||
Player other = UtilPlayerBase.searchOnline(player, args[0], true);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
/**
|
||||
@ -59,6 +59,6 @@ public abstract class BaseCommand
|
||||
|
||||
protected void message(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", message));
|
||||
UtilPlayerBase.message(player, F.main("Parser", message));
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -73,7 +72,7 @@ public class CopyCommand extends BaseCommand
|
||||
other.teleport(getPlugin().getSpawnLocation());
|
||||
message(other, "Unloading world for copy...");
|
||||
}
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
}
|
||||
|
||||
File source = new File(worldName);
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -66,7 +65,7 @@ public class DeleteCommand extends BaseCommand
|
||||
|
||||
//Unload World
|
||||
//Things break if this isn't set to true for saving the world
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
}
|
||||
|
||||
//Delete
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
@ -69,7 +68,7 @@ public class GameTypeCommand extends BaseCommand
|
||||
other.teleport(getPlugin().getSpawnLocation());
|
||||
message(player, "Unloading world for rename...");
|
||||
}
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
|
||||
File typeFolder = new File("map/" + type.GetName());
|
||||
if (!typeFolder.exists())
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
@ -28,7 +28,7 @@ public class ListCommand extends BaseCommand
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", "Listing Maps;"));
|
||||
UtilPlayerBase.message(player, F.main("Parser", "Listing Maps;"));
|
||||
|
||||
boolean colorSwitch = false;
|
||||
|
||||
@ -60,7 +60,7 @@ public class ListCommand extends BaseCommand
|
||||
}
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
|
||||
UtilPlayerBase.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
|
||||
listMaps(player, gameType, false);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
@ -32,7 +32,7 @@ public class MapCommand extends BaseCommand
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
//UtilPlayer.message(event.getPlayer(), F.main("Parser", "Invalid Input. " + F.elem("/map <MapName> [GameType]")));
|
||||
//UtilPlayerBase.message(event.getPlayer(), F.main("Parser", "Invalid Input. " + F.elem("/map <MapName> [GameType]")));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public class MapCommand extends BaseCommand
|
||||
{
|
||||
message(player, "Found more than one possible match:");
|
||||
for (String s : possibleMaps)
|
||||
UtilPlayer.message(player, s);
|
||||
UtilPlayerBase.message(player, s);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -126,9 +126,9 @@ public class MapCommand extends BaseCommand
|
||||
|
||||
MapData data = getPlugin().getData(worldName);
|
||||
|
||||
UtilPlayer.message(player, F.value("Map Name", data.MapName));
|
||||
UtilPlayer.message(player, F.value("Author", data.MapCreator));
|
||||
UtilPlayer.message(player, F.value("Game Type", data.MapGameType.GetName()));
|
||||
UtilPlayerBase.message(player, F.value("Map Name", data.MapName));
|
||||
UtilPlayerBase.message(player, F.value("Author", data.MapCreator));
|
||||
UtilPlayerBase.message(player, F.value("Game Type", data.MapGameType.GetName()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mineplex.mapparser.command;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -38,14 +37,14 @@ public class PMCommand extends BaseCommand
|
||||
{
|
||||
builder.append(s).append(" ");
|
||||
}
|
||||
for (Player ops : UtilServer.getPlayers())
|
||||
for (Player ops : getPlugin().getServer().getOnlinePlayers())
|
||||
{
|
||||
if (!ops.isOp())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ops.sendMessage(F.main("Message", builder.toString().trim()));
|
||||
ops.playSound(ops.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
|
||||
ops.playSound(ops.getLocation(), Sound.BLOCK_NOTE_PLING, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
@ -56,7 +55,7 @@ public class RenameCommand extends BaseCommand
|
||||
other.teleport(getPlugin().getSpawnLocation());
|
||||
message(other, "Unloading world for rename...");
|
||||
}
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
message(player, "World unloaded!");
|
||||
|
||||
|
||||
|
@ -6,8 +6,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
/**
|
||||
@ -37,7 +36,7 @@ public class SaveCommand extends BaseCommand
|
||||
{
|
||||
message(player, "More than one map found:");
|
||||
for (String s : possibleMaps)
|
||||
UtilPlayer.message(player, s);
|
||||
UtilPlayerBase.message(player, s);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -63,7 +62,7 @@ public class SaveCommand extends BaseCommand
|
||||
other.teleport(getPlugin().getSpawnLocation());
|
||||
|
||||
//Unload World
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3,8 +3,6 @@ package mineplex.mapparser.command;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,7 @@ package mineplex.mapparser.module.modules;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.command.BaseCommand;
|
||||
import mineplex.mapparser.module.Module;
|
||||
@ -38,7 +38,7 @@ public class CommandModule extends Module
|
||||
|
||||
if (getPlugin().getCurParse() != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", "Cannot use commands during Map Parse!"));
|
||||
UtilPlayerBase.message(player, F.main("Parser", "Cannot use commands during Map Parse!"));
|
||||
return;
|
||||
}
|
||||
if (event.getMessage().toLowerCase().startsWith("/help"))
|
||||
@ -83,8 +83,8 @@ public class CommandModule extends Module
|
||||
|
||||
if (!baseCommand.execute(player, commandLabel, args))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Parser", "Invalid Input."));
|
||||
UtilPlayer.message(player, F.elem(baseCommand.getUsage()));
|
||||
UtilPlayerBase.message(player, F.main("Parser", "Invalid Input."));
|
||||
UtilPlayerBase.message(player, F.elem(baseCommand.getUsage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.BackupTask;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
@ -135,7 +133,7 @@ public class EventModule extends Module
|
||||
if (world.getPlayers().isEmpty())
|
||||
{
|
||||
getPlugin().announce("Saving & Closing World: " + F.elem(world.getName()));
|
||||
MapUtil.UnloadWorld(getPlugin(), world, true);
|
||||
getPlugin().getServer().unloadWorld(world, true);
|
||||
_updated.remove(world);
|
||||
getPlugin()._mapsBeingZipped.add(world.getName());
|
||||
System.out.println("Starting backup of " + world);
|
||||
@ -164,7 +162,7 @@ public class EventModule extends Module
|
||||
String grayName = C.cBlue + event.getPlayer().getName();
|
||||
String grayWorld = C.cBlue + C.Bold + event.getPlayer().getWorld().getName();
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
for (Player player : getPlugin().getServer().getOnlinePlayers())
|
||||
{
|
||||
if (player.getWorld().equals(event.getPlayer().getWorld()))
|
||||
{
|
||||
@ -212,7 +210,7 @@ public class EventModule extends Module
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(player, tokens[1], true);
|
||||
Player target = UtilPlayerBase.searchOnline(player, tokens[1], true);
|
||||
if (target != null)
|
||||
{
|
||||
if (!target.getWorld().getName().equals("world"))
|
||||
@ -224,7 +222,7 @@ public class EventModule extends Module
|
||||
return;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + "."));
|
||||
UtilPlayerBase.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + "."));
|
||||
player.teleport(target);
|
||||
}
|
||||
}
|
||||
@ -246,7 +244,7 @@ public class EventModule extends Module
|
||||
//Permission
|
||||
if (!getPlugin().getData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
|
||||
UtilPlayerBase.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -276,10 +274,10 @@ public class EventModule extends Module
|
||||
|
||||
player.setFlySpeed(speed);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Fly Speed set to " + F.elem("" + speed) + "."));
|
||||
UtilPlayerBase.message(player, F.main("Game", "Fly Speed set to " + F.elem("" + speed) + "."));
|
||||
} catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Invalid Speed Input."));
|
||||
UtilPlayerBase.message(player, F.main("Game", "Invalid Speed Input."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@ import nautilus.game.arcade.game.games.minestrike.Minestrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.modes.SuperPaintstrike;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.MobaClassic;
|
||||
import nautilus.game.arcade.game.games.moba.training.MobaTraining;
|
||||
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
|
||||
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
@ -232,7 +234,8 @@ public enum GameType
|
||||
|
||||
AlienInvasion(AlienInvasion.class, GameDisplay.AlienInvasion),
|
||||
|
||||
MOBA(Moba.class, GameDisplay.MOBA),
|
||||
MOBA(MobaClassic.class, GameDisplay.MOBA),
|
||||
MOBATraining(MobaTraining.class, GameDisplay.MOBATraining),
|
||||
|
||||
Event(EventGame.class, GameDisplay.Event, new GameType[]{
|
||||
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
|
||||
|
@ -14,7 +14,8 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class Crypt
|
||||
{
|
||||
@ -42,10 +43,10 @@ public class Crypt
|
||||
{
|
||||
if(isDestroyed()) return false;
|
||||
Integer lastTime = _damageCooldown.get(mob);
|
||||
if(lastTime != null && lastTime > UtilTime.getServerTick()) return false;
|
||||
if(lastTime != null && lastTime > MinecraftServer.currentTick) return false;
|
||||
|
||||
_health -= damage;
|
||||
_damageCooldown.put(mob, UtilTime.getServerTick() + cooldown);
|
||||
_damageCooldown.put(mob, MinecraftServer.currentTick + cooldown);
|
||||
|
||||
updateState(damage);
|
||||
|
||||
|
@ -4,11 +4,9 @@ import mineplex.core.Managers;
|
||||
import mineplex.core.beta.BetaWhitelist;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.leaderboard.Leaderboard;
|
||||
@ -23,7 +21,6 @@ import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.moba.boss.BossManager;
|
||||
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
|
||||
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
|
||||
import nautilus.game.arcade.game.games.moba.fountain.MobaFountain;
|
||||
import nautilus.game.arcade.game.games.moba.general.ArrowKBManager;
|
||||
@ -46,7 +43,6 @@ import nautilus.game.arcade.game.games.moba.kit.rowena.HeroRowena;
|
||||
import nautilus.game.arcade.game.games.moba.minion.MinionManager;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareManager;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
|
||||
import nautilus.game.arcade.game.games.moba.recall.Recall;
|
||||
import nautilus.game.arcade.game.games.moba.shop.MobaShop;
|
||||
import nautilus.game.arcade.game.games.moba.structure.point.CapturePointManager;
|
||||
import nautilus.game.arcade.game.games.moba.structure.tower.TowerManager;
|
||||
@ -55,13 +51,10 @@ import nautilus.game.arcade.game.modules.CustomScoreboardModule;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -76,34 +69,30 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Moba extends TeamGame
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"..."
|
||||
};
|
||||
private static final long PREPARE_TIME = TimeUnit.MINUTES.toMillis(1);
|
||||
|
||||
private final HeroKit[] _kits;
|
||||
|
||||
private final Set<MobaPlayer> _playerData = new HashSet<>();
|
||||
|
||||
private final Set<Listener> _listeners = new HashSet<>();
|
||||
|
||||
private final MobaShop _shop;
|
||||
private final GoldManager _goldManager;
|
||||
private final BossManager _boss;
|
||||
private final TowerManager _tower;
|
||||
private final CapturePointManager _capturePoint;
|
||||
private final ArrowKBManager _arrowKb;
|
||||
private final BuffManager _buffs;
|
||||
protected final MobaShop _shop;
|
||||
protected final GoldManager _goldManager;
|
||||
protected final BossManager _boss;
|
||||
protected final BuffManager _buffs;
|
||||
protected final ArrowKBManager _arrowKb;
|
||||
protected final TowerManager _tower;
|
||||
protected final CapturePointManager _capturePoint;
|
||||
protected final MinionManager _minion;
|
||||
private BetaWhitelist _betaWhitelist;
|
||||
|
||||
public Moba(ArcadeManager manager)
|
||||
private int _inPlayers;
|
||||
|
||||
public Moba(ArcadeManager manager, GameType gameType, String[] description)
|
||||
{
|
||||
super(manager, GameType.MOBA, new Kit[]{new KitPlayer(manager)}, DESCRIPTION);
|
||||
super(manager, gameType, new Kit[]{new KitPlayer(manager)}, description);
|
||||
|
||||
_kits = new HeroKit[]{
|
||||
new HeroHattori(Manager),
|
||||
@ -118,16 +107,7 @@ public class Moba extends TeamGame
|
||||
};
|
||||
|
||||
AllowParticles = false;
|
||||
DontAllowOverfill = true;
|
||||
PrepareAutoAnnounce = false;
|
||||
PrepareFreeze = false;
|
||||
PrepareTime = PREPARE_TIME;
|
||||
DeathOut = false;
|
||||
DeathSpectateSecs = 12;
|
||||
HungerSet = 20;
|
||||
DamageFall = false;
|
||||
|
||||
manager.getCosmeticManager().setHideParticles(true);
|
||||
manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
// Instantiate managers
|
||||
@ -135,34 +115,19 @@ public class Moba extends TeamGame
|
||||
// Global managers
|
||||
_shop = registerManager(new MobaShop(this));
|
||||
_goldManager = registerManager(new GoldManager(this));
|
||||
_boss = registerManager(new BossManager(this));
|
||||
_buffs = registerManager(new BuffManager());
|
||||
_arrowKb = registerManager(new ArrowKBManager(this));
|
||||
_minion = registerManager(new MinionManager(this));
|
||||
registerManager(new HPManager(this));
|
||||
registerManager(new MobaDamageManager(this));
|
||||
registerManager(new MobaFountain(this));
|
||||
registerManager(new Recall(this));
|
||||
|
||||
// Pregame managers
|
||||
registerManager(new PrepareManager(this));
|
||||
registerManager(new PrepareSelection(this));
|
||||
|
||||
// Bosses
|
||||
_boss = registerManager(new BossManager(this));
|
||||
registerManager(new EnderPearlManager());
|
||||
|
||||
// Structures
|
||||
_tower = registerManager(new TowerManager(this));
|
||||
_capturePoint = registerManager(new CapturePointManager(this));
|
||||
|
||||
// Minions
|
||||
registerManager(new MinionManager(this));
|
||||
|
||||
// Arrow Knockback
|
||||
_arrowKb = registerManager(new ArrowKBManager(this));
|
||||
|
||||
// Ender Pearls
|
||||
registerManager(new EnderPearlManager());
|
||||
|
||||
// Buffs
|
||||
_buffs = registerManager(new BuffManager());
|
||||
|
||||
// Beta Message
|
||||
registerManager(new BetaManager(this));
|
||||
|
||||
@ -183,66 +148,6 @@ public class Moba extends TeamGame
|
||||
.setGiveCompassToAlive(false)
|
||||
.register(this);
|
||||
|
||||
new CustomScoreboardModule()
|
||||
.setSidebar((player, scoreboard) ->
|
||||
{
|
||||
GameState state = GetState();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case Prepare:
|
||||
writePrepare(player, scoreboard);
|
||||
break;
|
||||
case Live:
|
||||
writeLive(player, scoreboard);
|
||||
break;
|
||||
}
|
||||
})
|
||||
.setPrefix((perspective, subject) ->
|
||||
{
|
||||
if (!IsAlive(subject))
|
||||
{
|
||||
return C.cGray;
|
||||
}
|
||||
|
||||
GameTeam team = GetTeam(subject);
|
||||
|
||||
return team.GetColor().toString();
|
||||
})
|
||||
.setSuffix((perspective, subject) ->
|
||||
{
|
||||
GameState state = GetState();
|
||||
GameTeam perspectiveTeam = GetTeam(perspective);
|
||||
GameTeam subjectTeam = GetTeam(subject);
|
||||
|
||||
if (!IsAlive(subject) || perspectiveTeam == null || subjectTeam == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
MobaPlayer mobaPlayer = getMobaData(subject);
|
||||
String suffix;
|
||||
|
||||
if (state == GameState.Prepare && !perspectiveTeam.equals(subjectTeam))
|
||||
{
|
||||
suffix = C.cYellow + " Unknown";
|
||||
}
|
||||
else if (mobaPlayer.getKit() == null)
|
||||
{
|
||||
suffix = C.cYellow + " Selecting";
|
||||
}
|
||||
else
|
||||
{
|
||||
suffix = mobaPlayer.getRole().getChatColor() + " " + mobaPlayer.getKit().GetName();
|
||||
}
|
||||
|
||||
return suffix + C.Reset;
|
||||
})
|
||||
.setUnderNameObjective(C.cRed + "❤")
|
||||
.setUnderName((perspective, subject) ->
|
||||
(int) (Math.ceil(subject.getHealth() / 2D)))
|
||||
.register(this);
|
||||
|
||||
registerDebugCommand(new DebugCommand("kit", Rank.ADMIN)
|
||||
{
|
||||
@Override
|
||||
@ -271,7 +176,7 @@ public class Moba extends TeamGame
|
||||
});
|
||||
}
|
||||
|
||||
private <T extends Listener> T registerManager(T listener)
|
||||
protected <T extends Listener> T registerManager(T listener)
|
||||
{
|
||||
_listeners.add(listener);
|
||||
return listener;
|
||||
@ -330,97 +235,6 @@ public class Moba extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
private void writePrepare(Player player, GameScoreboard scoreboard)
|
||||
{
|
||||
MobaPlayer mobaPlayer = getMobaData(player);
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Hero Selection");
|
||||
scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Hero");
|
||||
scoreboard.write((mobaPlayer == null || mobaPlayer.getKit() == null) ? "Unselected " : mobaPlayer.getKit().GetName() + " (" + mobaPlayer.getRole().getName() + ")");
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Players");
|
||||
int kits = 0;
|
||||
|
||||
for (MobaPlayer otherMobaPlayer : _playerData)
|
||||
{
|
||||
if (otherMobaPlayer.getKit() != null)
|
||||
{
|
||||
kits++;
|
||||
}
|
||||
}
|
||||
|
||||
scoreboard.write(kits + "/" + GetPlayers(true).size());
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
}
|
||||
|
||||
private void writeLive(Player player, GameScoreboard scoreboard)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
boolean alive = IsAlive(player);
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
// Towers
|
||||
GameTeam red = GetTeam(ChatColor.RED);
|
||||
GameTeam blue = GetTeam(ChatColor.AQUA);
|
||||
String redTitle;
|
||||
String blueTitle;
|
||||
|
||||
if (alive)
|
||||
{
|
||||
boolean playerRed = team.equals(red);
|
||||
redTitle = playerRed ? "Your Team" : "Enemy Team";
|
||||
blueTitle = playerRed ? "Enemy Team" : "Your Team";
|
||||
}
|
||||
else
|
||||
{
|
||||
redTitle = "Red Team";
|
||||
blueTitle = "Blue Team";
|
||||
}
|
||||
|
||||
scoreboard.write(red.GetColor() + C.Bold + redTitle);
|
||||
scoreboard.write("Base: " + _tower.getDisplayString(red) + _boss.getWitherDisplayString(red));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(blue.GetColor() + C.Bold + blueTitle);
|
||||
scoreboard.write("Base: " + _tower.getDisplayString(blue) + _boss.getWitherDisplayString(blue));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cGreenB + "Beacons");
|
||||
scoreboard.write(_capturePoint.getDisplayString());
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
// Gold
|
||||
scoreboard.write(C.cGoldB + "Your Gold");
|
||||
if (alive)
|
||||
{
|
||||
int gold = _goldManager.getGold(player);
|
||||
|
||||
scoreboard.write(String.valueOf(gold));
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard.write("None");
|
||||
}
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Time");
|
||||
scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
@ -445,7 +259,7 @@ public class Moba extends TeamGame
|
||||
{
|
||||
Player player = event.GetPlayer();
|
||||
|
||||
if (GetPlayers(true).size() > 8)
|
||||
if (++_inPlayers > 8)
|
||||
{
|
||||
SetPlayerState(player, GameTeam.PlayerState.OUT);
|
||||
Manager.addSpectator(player, true);
|
||||
@ -453,68 +267,6 @@ public class Moba extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only one team online check
|
||||
List<GameTeam> teamsWithPlayers = new ArrayList<>(GetTeamList().size());
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(true).isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
teamsWithPlayers.add(team);
|
||||
}
|
||||
|
||||
if (teamsWithPlayers.size() == 1)
|
||||
{
|
||||
AnnounceEnd(teamsWithPlayers.get(0));
|
||||
SetState(GameState.End);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wither Dead check
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
WitherBoss boss = _boss.getWitherBoss(team);
|
||||
LivingEntity entity = boss.getEntity();
|
||||
|
||||
// Dead Wither
|
||||
if (entity == null || !entity.isValid() || entity.isDead())
|
||||
{
|
||||
// Get the other team
|
||||
for (GameTeam otherTeam : GetTeamList())
|
||||
{
|
||||
for (Player player : otherTeam.GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
if (team.equals(otherTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Player player : otherTeam.GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 20, "Winning", false, false);
|
||||
}
|
||||
|
||||
AnnounceEnd(otherTeam);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RespawnPlayer(Player player)
|
||||
{
|
||||
@ -529,6 +281,17 @@ public class Moba extends TeamGame
|
||||
_listeners.forEach(UtilServer::Unregister);
|
||||
_listeners.clear();
|
||||
_betaWhitelist.deregisterSelf();
|
||||
|
||||
// Undisguise all players
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
|
||||
|
||||
if (disguise != null && disguise instanceof DisguisePlayer)
|
||||
{
|
||||
Manager.GetDisguise().undisguise(disguise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -567,26 +330,6 @@ public class Moba extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
// Undisguise everyone upon game end
|
||||
@EventHandler
|
||||
public void end(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End && event.GetState() != GameState.Dead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);
|
||||
|
||||
if (disguise != null && disguise instanceof DisguisePlayer)
|
||||
{
|
||||
Manager.GetDisguise().undisguise(disguise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Location> getLocationStartsWith(String s)
|
||||
{
|
||||
Map<String, Location> map = new HashMap<>();
|
||||
@ -753,6 +496,11 @@ public class Moba extends TeamGame
|
||||
return _goldManager;
|
||||
}
|
||||
|
||||
public BuffManager getBuffManager()
|
||||
{
|
||||
return _buffs;
|
||||
}
|
||||
|
||||
public TowerManager getTowerManager()
|
||||
{
|
||||
return _tower;
|
||||
@ -772,9 +520,4 @@ public class Moba extends TeamGame
|
||||
{
|
||||
return _arrowKb;
|
||||
}
|
||||
|
||||
public BuffManager getBuffManager()
|
||||
{
|
||||
return _buffs;
|
||||
}
|
||||
}
|
@ -0,0 +1,263 @@
|
||||
package nautilus.game.arcade.game.games.moba;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareManager;
|
||||
import nautilus.game.arcade.game.games.moba.prepare.PrepareSelection;
|
||||
import nautilus.game.arcade.game.modules.CustomScoreboardModule;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MobaClassic extends Moba
|
||||
{
|
||||
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Select your Role and Hero.",
|
||||
"Kill the enemy Team!",
|
||||
"Capture the Beacons to earn gold to spent in the shop!",
|
||||
"Destroy the enemy's Towers and Wither!"
|
||||
};
|
||||
private static final long PREPARE_TIME = TimeUnit.MINUTES.toMillis(1);
|
||||
|
||||
public MobaClassic(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.MOBA, DESCRIPTION);
|
||||
|
||||
DontAllowOverfill = true;
|
||||
PrepareAutoAnnounce = false;
|
||||
PrepareFreeze = false;
|
||||
PrepareTime = PREPARE_TIME;
|
||||
DeathOut = false;
|
||||
DeathSpectateSecs = 12;
|
||||
HungerSet = 20;
|
||||
DamageFall = false;
|
||||
|
||||
// Pregame managers
|
||||
registerManager(new PrepareManager(this));
|
||||
registerManager(new PrepareSelection(this));
|
||||
|
||||
new CustomScoreboardModule()
|
||||
.setSidebar((player, scoreboard) ->
|
||||
{
|
||||
GameState state = GetState();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case Prepare:
|
||||
writePrepare(player, scoreboard);
|
||||
break;
|
||||
case Live:
|
||||
writeLive(player, scoreboard);
|
||||
break;
|
||||
}
|
||||
})
|
||||
.setPrefix((perspective, subject) ->
|
||||
{
|
||||
if (!IsAlive(subject))
|
||||
{
|
||||
return C.cGray;
|
||||
}
|
||||
|
||||
GameTeam team = GetTeam(subject);
|
||||
|
||||
return team.GetColor().toString();
|
||||
})
|
||||
.setSuffix((perspective, subject) ->
|
||||
{
|
||||
GameState state = GetState();
|
||||
GameTeam perspectiveTeam = GetTeam(perspective);
|
||||
GameTeam subjectTeam = GetTeam(subject);
|
||||
|
||||
if (!IsAlive(subject) || perspectiveTeam == null || subjectTeam == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
MobaPlayer mobaPlayer = getMobaData(subject);
|
||||
String suffix;
|
||||
|
||||
if (state == GameState.Prepare && !perspectiveTeam.equals(subjectTeam))
|
||||
{
|
||||
suffix = C.cYellow + " Unknown";
|
||||
}
|
||||
else if (mobaPlayer.getKit() == null)
|
||||
{
|
||||
suffix = C.cYellow + " Selecting";
|
||||
}
|
||||
else
|
||||
{
|
||||
suffix = mobaPlayer.getRole().getChatColor() + " [" + mobaPlayer.getKit().GetName() + "]";
|
||||
}
|
||||
|
||||
return suffix + C.Reset;
|
||||
})
|
||||
.setUnderNameObjective(C.cRed + "❤")
|
||||
.setUnderName((perspective, subject) ->
|
||||
(int) (Math.ceil(subject.getHealth() / 2D)))
|
||||
.register(this);
|
||||
}
|
||||
|
||||
private void writePrepare(Player player, GameScoreboard scoreboard)
|
||||
{
|
||||
MobaPlayer mobaPlayer = getMobaData(player);
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Hero Selection");
|
||||
scoreboard.write(UtilTime.MakeStr(GetStateTime() + PREPARE_TIME - System.currentTimeMillis()));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Hero");
|
||||
scoreboard.write((mobaPlayer == null || mobaPlayer.getKit() == null) ? "Unselected " : mobaPlayer.getKit().GetName() + " (" + mobaPlayer.getRole().getName() + ")");
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Players");
|
||||
int kits = 0;
|
||||
|
||||
for (MobaPlayer otherMobaPlayer : getMobaData())
|
||||
{
|
||||
if (otherMobaPlayer.getKit() != null)
|
||||
{
|
||||
kits++;
|
||||
}
|
||||
}
|
||||
|
||||
scoreboard.write(kits + "/" + GetPlayers(true).size());
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
}
|
||||
|
||||
private void writeLive(Player player, GameScoreboard scoreboard)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
boolean alive = IsAlive(player);
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
// Towers
|
||||
GameTeam red = GetTeam(ChatColor.RED);
|
||||
GameTeam blue = GetTeam(ChatColor.AQUA);
|
||||
String redTitle;
|
||||
String blueTitle;
|
||||
|
||||
if (alive)
|
||||
{
|
||||
boolean playerRed = team.equals(red);
|
||||
redTitle = playerRed ? "Your Team" : "Enemy Team";
|
||||
blueTitle = playerRed ? "Enemy Team" : "Your Team";
|
||||
}
|
||||
else
|
||||
{
|
||||
redTitle = "Red Team";
|
||||
blueTitle = "Blue Team";
|
||||
}
|
||||
|
||||
scoreboard.write(red.GetColor() + C.Bold + redTitle);
|
||||
scoreboard.write("Base: " + _tower.getDisplayString(red) + _boss.getWitherDisplayString(red));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(blue.GetColor() + C.Bold + blueTitle);
|
||||
scoreboard.write("Base: " + _tower.getDisplayString(blue) + _boss.getWitherDisplayString(blue));
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cGreenB + "Beacons");
|
||||
scoreboard.write(_capturePoint.getDisplayString());
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
// Gold
|
||||
scoreboard.write(C.cGoldB + "Your Gold");
|
||||
if (alive)
|
||||
{
|
||||
int gold = _goldManager.getGold(player);
|
||||
|
||||
scoreboard.write(String.valueOf(gold));
|
||||
}
|
||||
else
|
||||
{
|
||||
scoreboard.write("None");
|
||||
}
|
||||
|
||||
scoreboard.writeNewLine();
|
||||
|
||||
scoreboard.write(C.cYellowB + "Time");
|
||||
scoreboard.write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only one team online check
|
||||
List<GameTeam> teamsWithPlayers = new ArrayList<>(GetTeamList().size());
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(true).isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
teamsWithPlayers.add(team);
|
||||
}
|
||||
|
||||
if (teamsWithPlayers.size() == 1)
|
||||
{
|
||||
AnnounceEnd(teamsWithPlayers.get(0));
|
||||
SetState(GameState.End);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wither Dead check
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
WitherBoss boss = _boss.getWitherBoss(team);
|
||||
LivingEntity entity = boss.getEntity();
|
||||
|
||||
// Dead Wither
|
||||
if (entity == null || !entity.isValid() || entity.isDead())
|
||||
{
|
||||
// Get the other team
|
||||
for (GameTeam otherTeam : GetTeamList())
|
||||
{
|
||||
for (Player player : otherTeam.GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
if (team.equals(otherTeam))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Player player : otherTeam.GetPlayers(true))
|
||||
{
|
||||
AddGems(player, 20, "Winning", false, false);
|
||||
}
|
||||
|
||||
AnnounceEnd(otherTeam);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -32,6 +32,7 @@ public class MobaPlayer
|
||||
|
||||
public void setKit(HeroKit kit)
|
||||
{
|
||||
_role = kit.getRole();
|
||||
_kit = kit;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.Color;
|
||||
public enum MobaRole
|
||||
{
|
||||
|
||||
ASSASSIN("Assassin", Color.GRAY, ChatColor.DARK_GRAY),
|
||||
ASSASSIN("Assassin", Color.GRAY, ChatColor.GRAY),
|
||||
HUNTER("Hunter", Color.LIME, ChatColor.GREEN),
|
||||
MAGE("Mage", Color.PURPLE, ChatColor.DARK_PURPLE),
|
||||
WARRIOR("Warrior", Color.YELLOW, ChatColor.GOLD),
|
||||
|
@ -1,14 +1,19 @@
|
||||
package nautilus.game.arcade.game.games.moba.ai;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import mineplex.core.common.geom.Point2D;
|
||||
import mineplex.core.common.geom.Polygon2D;
|
||||
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.ai.goal.MobaAIMethod;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MobaAI
|
||||
{
|
||||
@ -16,7 +21,7 @@ public class MobaAI
|
||||
private final GameTeam _owner;
|
||||
private final float _speedTarget;
|
||||
private final float _speedHome;
|
||||
private final List<Location> _boundaries;
|
||||
private final Polygon2D _boundaries;
|
||||
|
||||
private LivingEntity _entity;
|
||||
private LivingEntity _target;
|
||||
@ -32,7 +37,12 @@ public class MobaAI
|
||||
_entity = entity;
|
||||
_home = home;
|
||||
_aiMethod = aiMethod;
|
||||
_boundaries = host.WorldData.GetDataLocs(getBoundaryKey());
|
||||
|
||||
List<Point2D> boundaryPoints = host.WorldData.GetDataLocs(getBoundaryKey()).stream()
|
||||
.map(Point2D::of)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
_boundaries = Polygon2D.fromUnorderedPoints(boundaryPoints);
|
||||
}
|
||||
|
||||
public void updateTarget()
|
||||
@ -80,7 +90,7 @@ public class MobaAI
|
||||
return _target;
|
||||
}
|
||||
|
||||
public List<Location> getBoundaries()
|
||||
public Polygon2D getBoundaries()
|
||||
{
|
||||
return _boundaries;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ public class BossManager implements Listener
|
||||
private Map<GameTeam, WitherBoss> _teamBosses;
|
||||
private PumpkinBoss _pumpkinBoss;
|
||||
|
||||
private boolean _dummyBosses;
|
||||
|
||||
public BossManager(Moba host)
|
||||
{
|
||||
_host = host;
|
||||
@ -32,6 +34,11 @@ public class BossManager implements Listener
|
||||
|
||||
private void spawnBosses()
|
||||
{
|
||||
if (_dummyBosses)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_host.CreatureAllowOverride = true;
|
||||
|
||||
WorldData worldData = _host.WorldData;
|
||||
@ -72,7 +79,11 @@ public class BossManager implements Listener
|
||||
}
|
||||
|
||||
_teamBosses.forEach((team, witherBoss) -> witherBoss.cleanup());
|
||||
_pumpkinBoss.cleanup();
|
||||
|
||||
if (_pumpkinBoss != null)
|
||||
{
|
||||
_pumpkinBoss.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public String getWitherDisplayString(GameTeam team)
|
||||
@ -96,4 +107,9 @@ public class BossManager implements Listener
|
||||
|
||||
return bosses;
|
||||
}
|
||||
|
||||
public void setDummyBosses(boolean dummyBosses)
|
||||
{
|
||||
_dummyBosses = dummyBosses;
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,16 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.ai.MobaAI;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public abstract class MobaBoss implements Listener
|
||||
{
|
||||
@ -85,7 +79,7 @@ public abstract class MobaBoss implements Listener
|
||||
@EventHandler
|
||||
public void updateMovement(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK || _entity == null || !_host.IsLive())
|
||||
if (event.getType() != UpdateType.TICK || !_host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class WitherBoss extends MobaBoss
|
||||
private static final MobaAIMethod AI_METHOD = new MobaDirectAIMethod();
|
||||
private static final int MIN_INFORM_TIME = (int) TimeUnit.SECONDS.toMillis(30);
|
||||
|
||||
private GameTeam _team;
|
||||
private final GameTeam _team;
|
||||
private MobaAI _ai;
|
||||
private DisguiseWither _disguise;
|
||||
private boolean _damageable;
|
||||
|
@ -1,39 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.moba.buff.buffs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.buff.Buff;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BuffCripple extends Buff<Player>
|
||||
{
|
||||
|
||||
private static final ItemStack ITEM = new ItemBuilder(Material.IRON_INGOT)
|
||||
.setTitle(C.cGray + "Crippled")
|
||||
.build();
|
||||
|
||||
public static ItemStack getItemRepresentation()
|
||||
{
|
||||
return ITEM;
|
||||
}
|
||||
|
||||
public BuffCripple(Moba host, Player entity, long duration)
|
||||
{
|
||||
super(host, entity, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply()
|
||||
{
|
||||
UtilTextMiddle.display("", C.cRed + "Crippled", 10, 20, 10, _entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire()
|
||||
{
|
||||
}
|
||||
}
|
@ -43,14 +43,7 @@ public class MobaDamageManager implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (damageeTeam.equals(damagerTeam))
|
||||
{
|
||||
event.SetCancelled("Team Damage");
|
||||
}
|
||||
else
|
||||
{
|
||||
_host.getScoreboardModule().refreshAsSubject(damagee);
|
||||
}
|
||||
_host.getScoreboardModule().refreshAsSubject(damagee);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -67,20 +67,6 @@ public class GoldManager implements Listener
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
_playerGold.put(player, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
@ -146,7 +132,7 @@ public class GoldManager implements Listener
|
||||
|
||||
public int getGold(Player player)
|
||||
{
|
||||
return _playerGold.get(player);
|
||||
return _playerGold.getOrDefault(player, 0);
|
||||
}
|
||||
|
||||
public void addGold(Player player, int amount)
|
||||
@ -156,6 +142,7 @@ public class GoldManager implements Listener
|
||||
|
||||
public void addGold(Player player, int amount, String reason)
|
||||
{
|
||||
_playerGold.putIfAbsent(player, 0);
|
||||
_playerGold.put(player, _playerGold.get(player) + amount);
|
||||
_host.getArcadeManager().GetStatsManager().incrementStat(player, _host.GetName() + ".GoldEarned", amount);
|
||||
|
||||
@ -168,12 +155,13 @@ public class GoldManager implements Listener
|
||||
|
||||
public void removeGold(Player player, int amount)
|
||||
{
|
||||
_playerGold.putIfAbsent(player, 0);
|
||||
_playerGold.put(player, _playerGold.get(player) - amount);
|
||||
}
|
||||
|
||||
public boolean hasGold(Player player, int amount)
|
||||
{
|
||||
return _playerGold.get(player) >= amount;
|
||||
return _playerGold.getOrDefault(player, 0) >= amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.moba.kit;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -41,14 +40,10 @@ public class HeroKit extends Kit
|
||||
private int _maxAmmo;
|
||||
private SkinData _skin;
|
||||
|
||||
private static final int RECALL_SLOT = 8;
|
||||
private static final ItemStack RECALL_ITEM = new ItemBuilder(Material.BED)
|
||||
.setTitle(C.cGreenB + "Recall to your Base")
|
||||
.addLore("Clicking this item will teleport you back to your", "base after " + F.time("5") + " seconds.", "Taking damage or moving will cancel", "your teleport.")
|
||||
.build();
|
||||
private static final int SHOP_SLOT = 8;
|
||||
private static final ItemStack SHOP_ITEM = new ItemBuilder(Material.GOLD_INGOT)
|
||||
.setTitle(C.cGold + "Open Gold Upgrades")
|
||||
.addLore("Click to open the Gold Upgrades", "shop while you are respawning.")
|
||||
.addLore("Click to open the Gold Upgrades Shop")
|
||||
.build();
|
||||
|
||||
private boolean _visible = true;
|
||||
@ -173,8 +168,7 @@ public class HeroKit extends Kit
|
||||
|
||||
// Give standard items
|
||||
inventory.setItem(AMMO_SLOT, _ammo);
|
||||
//inventory.setItem(RECALL_SLOT, RECALL_ITEM);
|
||||
inventory.setItem(RECALL_SLOT, SHOP_ITEM);
|
||||
inventory.setItem(SHOP_SLOT, SHOP_ITEM);
|
||||
|
||||
Moba game = (Moba) Manager.GetGame();
|
||||
List<MobaItem> items = game.getShop().getOwnedItems(player);
|
||||
@ -268,6 +262,11 @@ public class HeroKit extends Kit
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
public SkinData getSkinData()
|
||||
{
|
||||
return _skin;
|
||||
}
|
||||
|
||||
public boolean isVisible()
|
||||
{
|
||||
return _visible;
|
||||
|
@ -14,7 +14,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCripple;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -108,13 +107,13 @@ public class HeroSkill extends Perk
|
||||
|
||||
_item = new ItemBuilder(_item)
|
||||
.setTitle((action != null ? C.cYellowB + action + C.cGray + " - " : "") + C.cGreenB + GetName())
|
||||
.addLore(GetDesc())
|
||||
.setLore(GetDesc())
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
|
||||
_cooldownItem = new ItemBuilder(Material.INK_SACK, (byte) 8)
|
||||
.setTitle(C.cRed + GetName())
|
||||
.addLore(GetDesc())
|
||||
.setLore(GetDesc())
|
||||
.setUnbreakable(true)
|
||||
.build();
|
||||
}
|
||||
@ -280,13 +279,6 @@ public class HeroSkill extends Perk
|
||||
|
||||
boolean done = UtilTime.elapsed(start, cooldown);
|
||||
|
||||
// If the player is crippled say they are
|
||||
if (moba.getBuffManager().hasBuff(player, BuffCripple.class))
|
||||
{
|
||||
player.getInventory().setItem(_slot, BuffCripple.getItemRepresentation());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (done)
|
||||
{
|
||||
_lastSkill.remove(player.getUniqueId());
|
||||
@ -359,7 +351,12 @@ public class HeroSkill extends Perk
|
||||
|
||||
protected boolean isTeamDamage(LivingEntity damagee, LivingEntity damager)
|
||||
{
|
||||
if (!(damager instanceof Player))
|
||||
if (damagee.equals(damager))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(damager instanceof Player) || Manager.GetGame().DamageTeamSelf)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.moba.kit.anath;
|
||||
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
|
||||
@ -37,7 +38,7 @@ public class SkillFireProjectile extends HeroSkill
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!_kit.useAmmo(player, 1))
|
||||
if (!Recharge.Instance.use(player, GetName(), 500, false, true) || !_kit.useAmmo(player, 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -89,6 +89,12 @@ public class SkillFullMoon extends HeroSkill
|
||||
kit.disguise(player);
|
||||
player.setWalkSpeed(player.getWalkSpeed() - data.getLastSpeedIncrease());
|
||||
|
||||
ItemStack itemStack = player.getInventory().getItem(1);
|
||||
if (itemStack != null)
|
||||
{
|
||||
itemStack.setAmount(1);
|
||||
}
|
||||
|
||||
for (Wolf wolf : data.getWolves())
|
||||
{
|
||||
wolf.setHealth(0);
|
||||
|
@ -20,7 +20,9 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class DashSkill extends HeroSkill
|
||||
@ -127,10 +129,12 @@ public class DashSkill extends HeroSkill
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<Player, Long> entry : _startTime.entrySet())
|
||||
Iterator<Player> iterator = _startTime.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = entry.getKey();
|
||||
long start = entry.getValue();
|
||||
Player player = iterator.next();
|
||||
long start = _startTime.get(player);
|
||||
|
||||
if (UtilTime.elapsed(start, _velocityTime))
|
||||
{
|
||||
@ -138,7 +142,8 @@ public class DashSkill extends HeroSkill
|
||||
{
|
||||
UtilAction.zeroVelocity(player);
|
||||
}
|
||||
_startTime.remove(player);
|
||||
|
||||
iterator.remove();
|
||||
postDash(player);
|
||||
}
|
||||
else
|
||||
|
@ -6,7 +6,6 @@ import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
|
||||
import nautilus.game.arcade.game.games.moba.shop.MobaItem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -33,7 +33,7 @@ public class SkillSnowball extends HeroSkill implements IThrown
|
||||
{
|
||||
super("Shuriken", DESCRIPTION, SKILL_ITEM, slot, ActionType.ANY);
|
||||
|
||||
setCooldown(1000);
|
||||
setCooldown(1500);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -31,6 +31,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -81,6 +82,12 @@ public class SkillAOEHeal extends HeroSkill implements IThrown
|
||||
Manager.GetProjectile().AddThrow(item, player, this, 1000, true, true, true, false, 1F);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void emptyBucket(PlayerBucketEmptyEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
@ -113,6 +120,13 @@ public class SkillAOEHeal extends HeroSkill implements IThrown
|
||||
AOEHealData data = iterator.next();
|
||||
Player owner = data.Owner;
|
||||
GameTeam team = Manager.GetGame().GetTeam(owner);
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
DustSpellColor colour = new DustSpellColor(team.GetColor() == ChatColor.RED ? java.awt.Color.RED : java.awt.Color.CYAN);
|
||||
|
||||
if (UtilTime.elapsed(data.Start, DURATION))
|
||||
|
@ -47,7 +47,7 @@ public class SkillAquaCannon extends HeroSkill
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!_kit.useAmmo(player, 1))
|
||||
if (!Recharge.Instance.use(player, GetName(), 500, false, true) || !_kit.useAmmo(player, 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3,10 +3,6 @@ package nautilus.game.arcade.game.games.moba.kit.larissa;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
|
||||
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCripple;
|
||||
import nautilus.game.arcade.game.games.moba.kit.common.DashSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -22,7 +18,6 @@ public class SkillWaterDash extends DashSkill
|
||||
"come into contact with."
|
||||
};
|
||||
private static final ItemStack SKILL_ITEM = new ItemStack(Material.FEATHER);
|
||||
private static final long CRIPPLE_DURATION = TimeUnit.SECONDS.toMillis(3);
|
||||
|
||||
public SkillWaterDash(int slot)
|
||||
{
|
||||
@ -40,18 +35,6 @@ public class SkillWaterDash extends DashSkill
|
||||
public void dashTick(Player player)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.DRIP_WATER, player.getLocation().add(0, 1, 0), 0.5F, 0.5F, 0.5F, 0.01F, 5, ViewDist.LONG);
|
||||
Moba moba = (Moba) Manager.GetGame();
|
||||
BuffManager buffManager = moba.getBuffManager();
|
||||
|
||||
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), 2))
|
||||
{
|
||||
if (isTeamDamage(nearby, player) || buffManager.hasBuff(nearby, BuffCripple.class))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
buffManager.apply(new BuffCripple(moba, nearby, CRIPPLE_DURATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,10 +148,6 @@ public class SkillBombardment extends HeroSkill
|
||||
data.Block.setType(Material.AIR);
|
||||
iterator.remove();
|
||||
}
|
||||
else if (data.Block != null)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, data.Block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.001F, 3, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class SkillLightArrows extends HeroSkill
|
||||
{
|
||||
LineParticle lineParticle = iterator.next();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (!lineParticle.update())
|
||||
{
|
||||
|
@ -4,11 +4,9 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
|
||||
import nautilus.game.arcade.game.DebugCommand;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
@ -17,9 +15,6 @@ import nautilus.game.arcade.game.games.moba.structure.tower.TowerDestroyEvent;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Zombie;
|
||||
@ -36,7 +31,6 @@ import java.util.concurrent.TimeUnit;
|
||||
public class MinionManager implements Listener
|
||||
{
|
||||
|
||||
private static final int MINION_SPAWN_DELAY_TICKS = 40;
|
||||
private static final long MINION_SPAWN_TIME = TimeUnit.SECONDS.toMillis(30);
|
||||
|
||||
private final Moba _host;
|
||||
@ -51,6 +45,7 @@ public class MinionManager implements Listener
|
||||
{
|
||||
_host = host;
|
||||
_waves = new HashSet<>();
|
||||
_enabled = true;
|
||||
|
||||
host.registerDebugCommand(new DebugCommand("removeminions", Rank.DEVELOPER)
|
||||
{
|
||||
@ -67,12 +62,6 @@ public class MinionManager implements Listener
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gameCountdownCommence(GamePrepareCountdownCommence event)
|
||||
{
|
||||
UtilServer.runSyncLater(() -> setEnabled(true), MINION_SPAWN_DELAY_TICKS);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void spawnMinions(UpdateEvent event)
|
||||
{
|
||||
@ -83,6 +72,11 @@ public class MinionManager implements Listener
|
||||
|
||||
_lastWave = System.currentTimeMillis();
|
||||
|
||||
if (_path == null)
|
||||
{
|
||||
preparePath();
|
||||
}
|
||||
|
||||
for (GameTeam team : _host.GetTeamList())
|
||||
{
|
||||
List<Location> path = new ArrayList<>(_path);
|
||||
@ -131,14 +125,9 @@ public class MinionManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
public void disableMinions()
|
||||
{
|
||||
_enabled = enabled;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
preparePath();
|
||||
}
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
public void unregisterWave(MinionWave wave)
|
||||
|
@ -14,10 +14,8 @@ import nautilus.game.arcade.game.games.moba.ai.goal.MobaDirectAIMethod;
|
||||
import nautilus.game.arcade.game.games.moba.boss.MobaBoss;
|
||||
import nautilus.game.arcade.game.games.moba.boss.wither.WitherBoss;
|
||||
import nautilus.game.arcade.game.games.moba.structure.tower.Tower;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,15 +25,11 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jooq.util.derby.sys.Sys;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MinionWave implements Listener
|
||||
{
|
||||
|
@ -112,8 +112,6 @@ public class PrepareSelection implements Listener, IPacketHandler
|
||||
|
||||
List<HeroKit> heroKits = _host.getKits(mobaPlayer.getRole());
|
||||
|
||||
ItemStack head = new ItemBuilder(Material.SKULL_ITEM, (byte) 2).build();
|
||||
|
||||
UtilServer.runSyncLater(() ->
|
||||
{
|
||||
for (Location location : spawns.values())
|
||||
@ -126,10 +124,10 @@ public class PrepareSelection implements Listener, IPacketHandler
|
||||
stand.setCustomNameVisible(true);
|
||||
stand.setCustomName(C.cGreenB + kit.GetName());
|
||||
stand.setArms(true);
|
||||
stand.setHelmet(head);
|
||||
// stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, role));
|
||||
// stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, role));
|
||||
// stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, role));
|
||||
stand.setHelmet(kit.getSkinData().getSkull());
|
||||
stand.setChestplate(buildColouredStack(Material.LEATHER_CHESTPLATE, kit.getRole()));
|
||||
stand.setLeggings(buildColouredStack(Material.LEATHER_LEGGINGS, kit.getRole()));
|
||||
stand.setBoots(buildColouredStack(Material.LEATHER_BOOTS, kit.getRole()));
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1, 0.5F);
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, location.clone().add(0, 2, 0), 0.5F, 0.5F, 0.5F, 0.01F, 20, ViewDist.LONG, player);
|
||||
|
||||
|
@ -1,153 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.moba.recall;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
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.game.games.moba.Moba;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Recall implements Listener
|
||||
{
|
||||
|
||||
private static final int RECALL_TIME = 5000;
|
||||
private static final double PARTICLE_HEIGHT = 2.5;
|
||||
private static final double PARTICLE_RADIUS = 1.5;
|
||||
|
||||
private final Moba _host;
|
||||
|
||||
private final Set<RecallSession> _sessions;
|
||||
|
||||
public Recall(Moba host)
|
||||
{
|
||||
_host = host;
|
||||
|
||||
_sessions = new HashSet<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interactBed(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (itemStack == null || itemStack.getType() != Material.BED || getSession(player) != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Recharge.Instance.use(player, "Recall", RECALL_TIME, false, true))
|
||||
{
|
||||
_sessions.add(new RecallSession(player));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
RecallSession session = getSession(player);
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(session.Start, RECALL_TIME))
|
||||
{
|
||||
_host.GetTeam(player).SpawnTeleport(player);
|
||||
removeSession(player, null);
|
||||
}
|
||||
else if (UtilMath.offsetSquared(player.getLocation(), session.Location) > 4)
|
||||
{
|
||||
removeSession(player, "You moved!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Location location = session.Location.clone();
|
||||
double height = (double) (now - session.Start) / (double) RECALL_TIME;
|
||||
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 10)
|
||||
{
|
||||
double x = PARTICLE_RADIUS * Math.sin(theta);
|
||||
double z = PARTICLE_RADIUS * Math.cos(theta);
|
||||
|
||||
for (double y = 0.25; y < height * PARTICLE_HEIGHT; y += 0.5)
|
||||
{
|
||||
location.add(x, y, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0.1F, 1, ViewDist.LONG);
|
||||
|
||||
location.subtract(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamageePlayer() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
removeSession(event.GetDamageePlayer(), "You took damage!");
|
||||
}
|
||||
|
||||
private void removeSession(Player player, String reason)
|
||||
{
|
||||
boolean had = _sessions.removeIf(session -> session.Player.equals(player));
|
||||
|
||||
if (had && reason != null)
|
||||
{
|
||||
player.sendMessage(F.main("Game", reason + " You recall has been cancelled"));
|
||||
}
|
||||
}
|
||||
|
||||
private RecallSession getSession(Player player)
|
||||
{
|
||||
for (RecallSession session : _sessions)
|
||||
{
|
||||
if (session.Player.equals(player))
|
||||
{
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.moba.recall;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class RecallSession
|
||||
{
|
||||
|
||||
public Player Player;
|
||||
public long Start;
|
||||
public Location Location;
|
||||
|
||||
public RecallSession(Player player)
|
||||
{
|
||||
Player = player;
|
||||
Start = System.currentTimeMillis();
|
||||
Location = player.getLocation();
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ import nautilus.game.arcade.game.games.moba.shop.warrior.MobaWarriorShop;
|
||||
import nautilus.game.arcade.game.games.moba.util.MobaConstants;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -131,7 +132,7 @@ public class MobaShop implements Listener
|
||||
LivingEntity entity = entry.getKey();
|
||||
Location location = entry.getValue();
|
||||
|
||||
((CraftLivingEntity) entity).getHandle().setPosition(location.getX(), location.getY(), location.getZ());
|
||||
((CraftEntity) entity).getHandle().setPosition(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +223,7 @@ public class MobaShop implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
_host.GetKit(player).ApplyKit(player);
|
||||
_host.GetKit(player).GiveItems(player);
|
||||
}
|
||||
|
||||
public boolean ownsItem(Player player, MobaItem item)
|
||||
@ -251,6 +252,11 @@ public class MobaShop implements Listener
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clearPurchases(Player player)
|
||||
{
|
||||
_upgrades.put(player, new ArrayList<>());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
@ -322,6 +328,11 @@ public class MobaShop implements Listener
|
||||
Player player = event.getPlayer();
|
||||
List<MobaItem> items = _upgrades.get(player);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -342,6 +353,11 @@ public class MobaShop implements Listener
|
||||
Player player = event.getPlayer();
|
||||
List<MobaItem> items = _upgrades.get(player);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -374,6 +390,11 @@ public class MobaShop implements Listener
|
||||
|
||||
List<MobaItem> items = _upgrades.get(damager);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -409,6 +430,11 @@ public class MobaShop implements Listener
|
||||
|
||||
List<MobaItem> items = _upgrades.get(killer);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -429,6 +455,11 @@ public class MobaShop implements Listener
|
||||
Player player = event.getPlayer();
|
||||
List<MobaItem> items = _upgrades.get(player);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -453,6 +484,11 @@ public class MobaShop implements Listener
|
||||
|
||||
List<MobaItem> items = _upgrades.get(event.getSource());
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
@ -473,6 +509,11 @@ public class MobaShop implements Listener
|
||||
Player player = event.GetPlayer();
|
||||
List<MobaItem> items = _upgrades.get(player);
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MobaItem item : items)
|
||||
{
|
||||
if (item.getEffects() == null)
|
||||
|
@ -30,7 +30,7 @@ public class MobaAssassinShop extends MobaShopMenu
|
||||
.build(), 1000),
|
||||
new MobaItem(new ItemBuilder(Material.DIAMOND_SWORD)
|
||||
.setTitle(C.cDRedB + "Pumpkin King's Blade")
|
||||
.addEnchantment(Enchantment.DAMAGE_ALL, 3)
|
||||
.addEnchantment(Enchantment.DAMAGE_ALL, 2)
|
||||
.build(), 1750)
|
||||
), new ItemStack(Material.WOOD_SWORD));
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class MobaBasicAttackDamageEffect extends MobaItemEffect
|
||||
@Override
|
||||
protected void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!event.GetReason().contains(MobaConstants.BASIC_ATTACK))
|
||||
if (event.GetReason() == null || !event.GetReason().contains(MobaConstants.BASIC_ATTACK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.moba.Moba;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user