Improve resource pack system to use proper intervals of versioned packs

This commit is contained in:
AlexTheCoder 2018-07-18 04:01:47 -04:00
parent adfa2d8bc3
commit b71055b0b4
19 changed files with 109 additions and 89 deletions

View File

@ -1,16 +1,23 @@
package mineplex.core.common; package mineplex.core.common;
import com.google.common.base.Preconditions;
/**
* Used to declare specific milestone versions
*/
public enum MinecraftVersion public enum MinecraftVersion
{ {
ALL("Any"), Version1_9("1.9", 48),
Version1_9("1.9"), Version1_8("1.8", Integer.MIN_VALUE), //Any player will at minimum be 1.8, we can't handle anything below that
Version1_8("1.8"),
; ;
private final String _friendlyName;
MinecraftVersion(String friendlyName) private final String _friendlyName;
private final int _minimum;
MinecraftVersion(String friendlyName, int minimum)
{ {
_friendlyName = friendlyName; _friendlyName = friendlyName;
_minimum = minimum;
} }
public String friendlyName() public String friendlyName()
@ -18,8 +25,25 @@ public enum MinecraftVersion
return _friendlyName; return _friendlyName;
} }
public boolean atOrAbove(MinecraftVersion other)
{
Preconditions.checkNotNull(other);
return ordinal() <= other.ordinal();
}
public static MinecraftVersion fromInt(int version) public static MinecraftVersion fromInt(int version)
{ {
return version <= 47 ? Version1_8 : Version1_9; MinecraftVersion v = null;
for (MinecraftVersion test : values())
{
if (version >= test._minimum)
{
v = test;
break;
}
}
return v;
} }
} }

View File

@ -143,11 +143,6 @@ public class UtilPlayer
return entry.trackedPlayers.contains(ep); return entry.trackedPlayers.contains(ep);
} }
public static boolean is1_9(Player player)
{
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() > 47;
}
private static class Vector3D private static class Vector3D
{ {
@ -926,10 +921,9 @@ public class UtilPlayer
public static MinecraftVersion getVersion(Player player) public static MinecraftVersion getVersion(Player player)
{ {
if (is1_9(player)) int version = ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();
return MinecraftVersion.Version1_9;
return MinecraftVersion.Version1_8; return MinecraftVersion.fromInt(version);
} }
/** /**

View File

@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.DummyEntity; import mineplex.core.common.DummyEntity;
import mineplex.core.common.MinecraftVersion;
import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_8_R3.EntityLiving;
@ -69,7 +70,7 @@ public class UtilTextTop
runnable.runTaskLater(UtilServer.getPlugin(), 20); runnable.runTaskLater(UtilServer.getPlugin(), 20);
if (UtilPlayer.is1_9(player)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))
{ {
sendBossBar(player, healthPercent, text); sendBossBar(player, healthPercent, text);
@ -128,7 +129,7 @@ public class UtilTextTop
private static void deleteOld(Player player) private static void deleteOld(Player player)
{ {
if (UtilPlayer.is1_9(player)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))
{ {
PacketPlayOutBossBar bossBar = new PacketPlayOutBossBar(); PacketPlayOutBossBar bossBar = new PacketPlayOutBossBar();
@ -156,7 +157,7 @@ public class UtilTextTop
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
if (UtilPlayer.is1_9(event.getPlayer())) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(event.getPlayer())))
{ {
deleteOld(event.getPlayer()); deleteOld(event.getPlayer());
} }

View File

@ -31,11 +31,6 @@
<artifactId>mineplex-serverdata</artifactId> <artifactId>mineplex-serverdata</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mineplex-questmanager</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId> <artifactId>commons-dbcp2</artifactId>

View File

@ -477,7 +477,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
UtilPlayer.sendPacket(owner, spawnPacket); UtilPlayer.sendPacket(owner, spawnPacket);
if (UtilPlayer.is1_9(owner)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(owner)))
{ {
UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityId, new int[] UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityId, new int[]
{ {
@ -507,7 +507,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
UtilPlayer.sendPacket(owner, spawnPacket); UtilPlayer.sendPacket(owner, spawnPacket);
if (UtilPlayer.is1_9(owner)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(owner)))
{ {
UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityIds[1], new int[] UtilPlayer.sendPacket(owner, new PacketPlayOutNewAttachEntity(entityIds[1], new int[]
{ {

View File

@ -54,6 +54,7 @@ import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton; import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
import mineplex.core.bonuses.redis.VoteHandler; import mineplex.core.bonuses.redis.VoteHandler;
import mineplex.core.bonuses.redis.VotifierCommand; import mineplex.core.bonuses.redis.VotifierCommand;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -1034,7 +1035,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (client.getHologram() == null) if (client.getHologram() == null)
{ {
double yAdd = 2.3; double yAdd = 2.3;
if(!UtilPlayer.is1_9(player)) if (!MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))
{ {
yAdd = 2.45; yAdd = 2.45;
} }

View File

@ -144,9 +144,6 @@ public class MorphDinnerbone extends MorphGadget implements IPacketHandler
case Version1_8: case Version1_8:
summonForEntity18(receiver, player); summonForEntity18(receiver, player);
break; break;
case ALL:
// do nothing
break;
} }
} }

View File

@ -16,6 +16,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle; import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -111,7 +112,7 @@ public class OutfitReindeerAntlers extends OutfitReindeer implements IPacketHand
{ {
Player player = packetInfo.getPlayer(); Player player = packetInfo.getPlayer();
if (UtilPlayer.is1_9(player)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))
{ {
return; return;
} }

View File

@ -23,6 +23,7 @@ import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -358,7 +359,7 @@ public class MineplexGameManager extends MiniClientPlugin<Map<GameKit, PlayerKit
public void handle(PacketInfo packetInfo) public void handle(PacketInfo packetInfo)
{ {
// Only need to handle this for 1.9+ // Only need to handle this for 1.9+
if (!UtilPlayer.is1_9(packetInfo.getPlayer())) if (!MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(packetInfo.getPlayer())))
{ {
return; return;
} }

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.DataWatcher;
@ -518,7 +519,7 @@ public class Hologram {
_playersTracking.add(player); _playersTracking.add(player);
itel.remove(); itel.remove();
UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); UtilPlayer.sendPacket(player, (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player))) ? _packets1_9 : _packets1_8);
} }
} }
@ -582,7 +583,7 @@ public class Hologram {
for (Player player : canSee) for (Player player : canSee)
{ {
if (UtilPlayer.is1_9(player)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))
{ {
for (Packet packet : packets1_9) for (Packet packet : packets1_9)
{ {
@ -731,7 +732,7 @@ public class Hologram {
for (Player player : _playersTracking) for (Player player : _playersTracking)
{ {
List<Packet> packets = UtilPlayer.is1_9(player) ? packets1_9 : packets1_8; List<Packet> packets = (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player))) ? packets1_9 : packets1_8;
for (Packet packet : packets) for (Packet packet : packets)
{ {
@ -790,7 +791,7 @@ public class Hologram {
for (Player player : _playersTracking) for (Player player : _playersTracking)
{ {
UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); UtilPlayer.sendPacket(player, (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player))) ? _packets1_9 : _packets1_8);
} }
} }
@ -805,7 +806,7 @@ public class Hologram {
{ {
checkSpawnPackets(); checkSpawnPackets();
return UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8; return (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player))) ? _packets1_9 : _packets1_8;
} }
/** /**

View File

@ -28,18 +28,18 @@ import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Intent; import mineplex.core.portal.Intent;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.resourcepack.redis.RedisUnloadResPack; import mineplex.core.resourcepack.redis.RedisUnloadResPack;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.commands.CommandCallback; import mineplex.serverdata.commands.CommandCallback;
import mineplex.serverdata.commands.ServerCommand;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
public class ResourcePackManager extends MiniPlugin implements CommandCallback public class ResourcePackManager extends MiniPlugin implements CommandCallback<RedisUnloadResPack>
{ {
private Pair<MinecraftVersion, String>[] _resourcePackUrls; private Pair<MinecraftVersion, String>[] _resourcePackUrls;
private boolean _resourcePackRequired; private boolean _resourcePackRequired;
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>(); private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<>();
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<>();
private Portal _portal; private final Portal _portal;
public ResourcePackManager(JavaPlugin plugin, Portal portal) public ResourcePackManager(JavaPlugin plugin, Portal portal)
{ {
@ -57,16 +57,31 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
if (_resourcePackUrls == null || _resourcePackUrls.length == 0) if (_resourcePackUrls == null || _resourcePackUrls.length == 0)
return; return;
int lastOrdinal = -1;
String pack = null;
for (Pair<MinecraftVersion, String> entry : _resourcePackUrls) for (Pair<MinecraftVersion, String> entry : _resourcePackUrls)
{ {
if (entry.getLeft() == version || entry.getLeft() == MinecraftVersion.ALL) if (lastOrdinal != -1 && entry.getLeft().ordinal() > lastOrdinal)
{ {
player.setResourcePack(entry.getRight()); continue;
return; }
if (version.atOrAbove(entry.getLeft()))
{
lastOrdinal = entry.getLeft().ordinal();
pack = entry.getRight();
} }
} }
player.setResourcePack(_resourcePackUrls[0].getRight()); if (pack != null)
{
player.setResourcePack(pack);
}
else
{
player.setResourcePack(_resourcePackUrls[0].getRight());
}
} }
@EventHandler @EventHandler
@ -92,6 +107,11 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
@EventHandler @EventHandler
public void onSecond(UpdateEvent event) public void onSecond(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC)
{
return;
}
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator(); Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
while (itel.hasNext()) while (itel.hasNext())
@ -240,26 +260,21 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
} }
@Override @Override
public void run(ServerCommand command) public void run(RedisUnloadResPack command)
{ {
if (command instanceof RedisUnloadResPack) Player player = Bukkit.getPlayerExact(command.getPlayer());
if (player == null)
{ {
RedisUnloadResPack redisCommand = (RedisUnloadResPack) command; return;
Player player = Bukkit.getPlayerExact(redisCommand.getPlayer());
if (player == null)
{
return;
}
if (_resourcePackUsers.containsKey(player.getName()))
{
return;
}
//player.setResourcePack("http://file.mineplex.com/ResReset.zip");
player.setResourcePack("http://198.20.72.74/ResReset.zip");
} }
if (_resourcePackUsers.containsKey(player.getName()))
{
return;
}
//player.setResourcePack("http://file.mineplex.com/ResReset.zip");
player.setResourcePack("http://198.20.72.74/ResReset.zip");
} }
} }

View File

@ -4,11 +4,10 @@ import mineplex.serverdata.commands.ServerCommand;
public class RedisUnloadResPack extends ServerCommand public class RedisUnloadResPack extends ServerCommand
{ {
private String _player; private final String _player;
public RedisUnloadResPack(String player) public RedisUnloadResPack(String player)
{ {
_player = player; _player = player;
} }

View File

@ -252,8 +252,6 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
case Version1_8: case Version1_8:
giveBook19(player, open); giveBook19(player, open);
break; break;
case ALL:
break;
} }
} }
@ -771,9 +769,6 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
case Version1_8: case Version1_8:
summonForEntity18(receiver, player); summonForEntity18(receiver, player);
break; break;
case ALL:
// do nothing
break;
} }
} }
@ -960,9 +955,6 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
case Version1_8: case Version1_8:
updateArmorStand18(owner, receiver, newName, entityId); updateArmorStand18(owner, receiver, newName, entityId);
break; break;
case ALL:
// do nothing
break;
} }
} }

View File

@ -24,7 +24,6 @@ import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup; import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.portal.GenericServer; import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Intent; import mineplex.core.portal.Intent;

View File

@ -106,7 +106,7 @@ public enum GameType implements Voteable
Christmas(Christmas.class, GameDisplay.Christmas, new Pair[] Christmas(Christmas.class, GameDisplay.Christmas, new Pair[]
{ {
//Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip") //Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip")
Pair.create(MinecraftVersion.ALL, "http://198.20.72.74/ResChristmas.zip") Pair.create(MinecraftVersion.Version1_8, "http://198.20.72.74/ResChristmas.zip")
}, true), }, true),
ChristmasNew(ChristmasNew.class, GameDisplay.ChristmasNew, new Pair[] ChristmasNew(ChristmasNew.class, GameDisplay.ChristmasNew, new Pair[]
{ {
@ -124,7 +124,7 @@ public enum GameType implements Voteable
Draw(Draw.class, GameDisplay.Draw, new Pair[] Draw(Draw.class, GameDisplay.Draw, new Pair[]
{ {
//Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResDrawMyThing.zip") //Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResDrawMyThing.zip")
Pair.create(MinecraftVersion.ALL, "http://198.20.72.74/ResDrawMyThing.zip") Pair.create(MinecraftVersion.Version1_8, "http://198.20.72.74/ResDrawMyThing.zip")
}, true), }, true),
ElytraRings(ElytraRings.class, GameDisplay.ElytraRings), ElytraRings(ElytraRings.class, GameDisplay.ElytraRings),
Evolution(Evolution.class, GameDisplay.Evolution), Evolution(Evolution.class, GameDisplay.Evolution),
@ -132,7 +132,7 @@ public enum GameType implements Voteable
Halloween(Halloween.class, GameDisplay.Halloween, new Pair[] Halloween(Halloween.class, GameDisplay.Halloween, new Pair[]
{ {
//Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip") //Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip")
Pair.create(MinecraftVersion.ALL, "http://198.20.72.74/ResHalloween.zip") Pair.create(MinecraftVersion.Version1_8, "http://198.20.72.74/ResHalloween.zip")
}, true), }, true),
Halloween2016(Halloween2016.class, GameDisplay.Halloween2016), Halloween2016(Halloween2016.class, GameDisplay.Halloween2016),
HideSeek(HideSeek.class, GameDisplay.HideSeek), HideSeek(HideSeek.class, GameDisplay.HideSeek),
@ -177,7 +177,7 @@ public enum GameType implements Voteable
Wizards(Wizards.class, GameDisplay.Wizards, new Pair[] Wizards(Wizards.class, GameDisplay.Wizards, new Pair[]
{ {
//Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResWizards.zip") //Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResWizards.zip")
Pair.create(MinecraftVersion.ALL, "http://198.20.72.74/ResWizards.zip") Pair.create(MinecraftVersion.Version1_8, "http://198.20.72.74/ResWizards.zip")
}, true), }, true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
Build(Build.class, GameDisplay.Build), Build(Build.class, GameDisplay.Build),

View File

@ -67,6 +67,7 @@ import com.mineplex.anticheat.checks.combat.KillauraTypeA;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
@ -266,7 +267,7 @@ public class HideSeek extends TeamGame
final Player player = packetInfo.getPlayer(); final Player player = packetInfo.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilPlayer.sendPacket(player, blockForm.getBlockPackets(UtilPlayer.is1_9(player)))); Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilPlayer.sendPacket(player, blockForm.getBlockPackets(MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(player)))));
break; break;
} }
} }

View File

@ -30,6 +30,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
@ -116,7 +117,7 @@ public class BlockForm extends Form
packet1.uuid = UUID.randomUUID(); packet1.uuid = UUID.randomUUID();
packets[0] = packet1; packets[0] = packet1;
if (UtilPlayer.is1_9(Player)) if (MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(Player)))
{ {
packets[2] = new PacketPlayOutNewAttachEntity(_fakeSilverfishId, new int[] packets[2] = new PacketPlayOutNewAttachEntity(_fakeSilverfishId, new int[]
{ {
@ -291,7 +292,7 @@ public class BlockForm extends Form
_sawDiff = new Vector(); _sawDiff = new Vector();
} }
UtilPlayer.sendPacket(Player, packet[UtilPlayer.is1_9(Player) ? 1 : 0]); UtilPlayer.sendPacket(Player, packet[(MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(Player))) ? 1 : 0]);
} }
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -334,7 +335,7 @@ public class BlockForm extends Form
{ {
for (EntityPlayer entity : tracker.trackedPlayers) for (EntityPlayer entity : tracker.trackedPlayers)
{ {
UtilPlayer.sendPacket(entity.getBukkitEntity(), getBlockPackets(UtilPlayer.is1_9(entity.getBukkitEntity()))); UtilPlayer.sendPacket(entity.getBukkitEntity(), getBlockPackets(MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(entity.getBukkitEntity()))));
} }
} }
} }
@ -384,7 +385,7 @@ public class BlockForm extends Form
if (packet != null) if (packet != null)
{ {
if (!UtilPlayer.is1_9(Player) && packet[0] instanceof PacketPlayOutRelEntityMove) if (!MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(Player)) && packet[0] instanceof PacketPlayOutRelEntityMove)
{ {
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet[0]; PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet[0];
_sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D)); _sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D));
@ -394,7 +395,7 @@ public class BlockForm extends Form
_sawDiff = new Vector(); _sawDiff = new Vector();
} }
UtilPlayer.sendPacket(Player, packet[UtilPlayer.is1_9(Player) ? 1 : 0]); UtilPlayer.sendPacket(Player, packet[(MinecraftVersion.Version1_9.atOrAbove(UtilPlayer.getVersion(Player))) ? 1 : 0]);
} }
} }
} }

View File

@ -21,8 +21,7 @@ import mineplex.core.portal.Portal;
*/ */
public class VersionModule extends Module public class VersionModule extends Module
{ {
private final MinecraftVersion _minecraftVersion;
private MinecraftVersion _minecraftVersion;
public VersionModule(MinecraftVersion minecraftVersion) public VersionModule(MinecraftVersion minecraftVersion)
{ {

View File

@ -46,7 +46,6 @@
<module>mavericks-review-hub</module> <module>mavericks-review-hub</module>
<module>mineplex-game-gemhunters</module> <module>mineplex-game-gemhunters</module>
<module>mineplex-google-sheets</module> <module>mineplex-google-sheets</module>
<module>mineplex-questmanager</module>
</modules> </modules>
<repositories> <repositories>