Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Chiss 2014-09-06 10:58:23 +10:00
commit a3545d074d
9 changed files with 170 additions and 12 deletions

View File

@ -1,4 +1,4 @@
From dab2987baf7b1908affbdda61b2019d4338d2d72 Mon Sep 17 00:00:00 2001
From 52ffc1e292f4a6ead573bdfcd884c800b8c4b1a5 Mon Sep 17 00:00:00 2001
From: Jonathan Williams <jonathan@mineplex.com>
Date: Tue, 2 Sep 2014 21:54:15 -0700
Subject: [PATCH] Mineplex Patches
@ -1834,6 +1834,36 @@ index ea786ae..20ab405 100644
world.addEntity(entity, reason);
return (T) entity.getBukkitEntity();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0c4976d..28ab76a 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -49,25 +49,6 @@ public class Main {
+ "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
Enumeration<URL> resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" );
- while ( resources.hasMoreElements() )
- {
- Manifest manifest = new Manifest( resources.nextElement().openStream() );
- String ts = manifest.getMainAttributes().getValue( "Timestamp" );
- if ( ts != null )
- {
- Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts );
-
- Calendar cal = Calendar.getInstance();
- cal.add( Calendar.DAY_OF_YEAR, -2 );
- if ( buildDate.before(cal.getTime() ) )
- {
- System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" );
- System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" );
- System.err.println( "The server will start in 10 seconds!" );
- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
- }
- }
- }
// Spigot End
// Todo: Installation script
OptionParser parser = new OptionParser() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 35f2bfa..8a6ca55 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java

Binary file not shown.

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

@ -10,6 +10,7 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -396,6 +397,11 @@ public class UtilPlayer
return (((CraftEntity)player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
}
public static boolean is1_8(Player player)
{
return ((CraftPlayer)player).getHandle().playerConnection.networkManager.getVersion() >= 47;
}
/*
public void setListName(Player player, CoreClient client)

View File

@ -0,0 +1,82 @@
package mineplex.core.common.util;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R4.ChatMessage;
import org.spigotmc.ProtocolInjector.PacketTitle;
import org.spigotmc.ProtocolInjector.PacketTitle.Action;
/**
* Created by Shaun on 9/5/2014.
*/
public class UtilTitle
{
/**
* Show Title text for a player with their current set timings.
*
* Default timings are 20, 60, 20 (in ticks)
*/
public static void showTitle(String text, Player... players)
{
ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.TITLE, message);
sendPacket(packet, players);
}
/**
* Set the current subtitle for a player.
*
* This stays unless reset or cleared, and doesn't appear unless a title is showing
*/
public static void setSubtitle(String text, Player... players)
{
ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message);
sendPacket(packet, players);
}
/**
* Set timings for a player.
*
* Remember these are in ticks
*/
public static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
{
PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks);
sendPacket(packet, players);
}
/**
* Clear the title that is currently being displayed, has no affect on timings or subtitle.
*/
public static void clear(Player... players)
{
PacketTitle packet = new PacketTitle(Action.CLEAR);
sendPacket(packet, players);
}
/**
* Reset subtitle and timings for a player.
*
* This will set the subtitle to nothing and timings back to default (20, 60, 20)
*/
public static void reset(Player... players)
{
PacketTitle packet = new PacketTitle(Action.RESET);
sendPacket(packet, players);
}
private static void sendPacket(PacketTitle packet, Player... players)
{
for (Player player : players)
{
if (UtilPlayer.is1_8(player))
{
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import mineplex.core.common.DummyEntity;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.packethandler.PacketVerifier;
import mineplex.core.packethandler.PlayerPacketEvent;
import net.minecraft.server.v1_7_R4.DataWatcher;
@ -58,7 +59,7 @@ public class CustomTagFix extends MiniPlugin
Player owner = event.getPlayer();
PacketVerifier verifier = event.getVerifier();
if (((CraftPlayer)owner).getHandle().playerConnection.networkManager.getVersion() >= 47)
if (UtilPlayer.is1_8(event.getPlayer()))
{
if (packet instanceof PacketPlayOutSpawnEntityLiving)
{

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