Fix for customer support server.

Fix for Boss bar junk.
Fix for Disguises.
This commit is contained in:
Jonathan Williams 2014-09-05 14:36:10 -07:00
parent d01529a344
commit 2f8b53f771
4 changed files with 49 additions and 10 deletions

View File

@ -83,6 +83,8 @@ public class UtilDisplay
{
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)world).getHandle()));
health = Math.max(151, health);
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
watcher.a(6, (Float) (float) health);
watcher.a(2, (String) text); //Entity name
@ -132,11 +134,11 @@ public class UtilDisplay
hasHealthBar.put(player.getName(), true);
new BukkitRunnable(){
int health = (loadUp ? 100 : 200);
int health = (loadUp ? 150 : 300);
@Override
public void run(){
if((loadUp ? health < 200 : health > 100)){
if((loadUp ? health < 300 : health > 150)){
DataWatcher watcher = getWatcher(text, health, player.getWorld());
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
@ -148,7 +150,7 @@ public class UtilDisplay
health -= healthAdd;
}
} else {
DataWatcher watcher = getWatcher(text, (loadUp ? 200 : 100), player.getWorld());
DataWatcher watcher = getWatcher(text, (loadUp ? 300 : 150), player.getWorld());
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
@ -157,12 +159,12 @@ public class UtilDisplay
hasHealthBar.put(player.getName(), false);
//Complete text
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 100, player.getLocation());
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 150, player.getLocation());
sendPacket(player, mobPacket);
hasHealthBar.put(player.getName(), true);
DataWatcher watcher2 = getWatcher(completeText, 200, player.getWorld());
DataWatcher watcher2 = getWatcher(completeText, 300, player.getWorld());
PacketPlayOutEntityMetadata metaPacket2 = getMetadataPacket(watcher2);
sendPacket(player, metaPacket2);
@ -184,7 +186,7 @@ public class UtilDisplay
}
public static void displayLoadingBar(final String text, final String completeText, final Player player, final int secondsDelay, final boolean loadUp, JavaPlugin plugin){
final int healthChangePerSecond = 100 / secondsDelay;
final int healthChangePerSecond = 150 / secondsDelay;
displayLoadingBar(text, completeText, player, healthChangePerSecond, 20L, loadUp, plugin);
}

View File

@ -2,7 +2,6 @@ package mineplex.core.disguise;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
@ -215,15 +214,16 @@ public class DisguiseManager extends MiniPlugin
{
public void run()
{
Collection<? extends Player> players = (disguise.Global ? Bukkit.getOnlinePlayers() : _disguisePlayerMap.get(disguise));
_handlingPacket = true;
Packet spawnPacket = disguise.GetSpawnPacket();
for (Player player : _disguisePlayerMap.get(disguise))
for (Player player : players)
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(spawnPacket);
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
for (Packet packet : armorPackets)
{

View File

@ -0,0 +1,30 @@
package mineplex.core.packethandler;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
public class PacketHandler extends MiniPlugin
{
public PacketHandler(JavaPlugin plugin)
{
super("PacketHandler", plugin);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.addPacketVerifier(new PacketVerifier(event.getPlayer()));
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event)
{
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.clearVerifiers();
}
}

View File

@ -18,6 +18,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -48,6 +49,12 @@ public class CustomerSupport extends MiniPlugin
@EventHandler
public void Join(PlayerJoinEvent event)
{
if (!_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR))
{
event.getPlayer().kickPlayer("Only for staff.");
return;
}
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
}