mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 18:31:29 +01:00
192 lines
9.0 KiB
Diff
192 lines
9.0 KiB
Diff
From 8d77dcd164e3f844c3bda9310b37aa857f50a72a Mon Sep 17 00:00:00 2001
|
|
From: md_5 <git@md-5.net>
|
|
Date: Fri, 12 Sep 2014 17:16:43 -0700
|
|
Subject: [PATCH] Spigot Update - 20140909b
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
index fdbdcc6..416a349 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
@@ -1,10 +1,14 @@
|
|
package net.minecraft.server;
|
|
|
|
+import net.md_5.bungee.api.chat.BaseComponent;
|
|
+import net.md_5.bungee.chat.ComponentSerializer;
|
|
+
|
|
import java.io.IOException;
|
|
|
|
public class PacketPlayOutChat extends Packet {
|
|
|
|
private IChatBaseComponent a;
|
|
+ public BaseComponent[] components; // Spigot - Update 20140909b
|
|
private boolean b;
|
|
|
|
public PacketPlayOutChat() {
|
|
@@ -26,7 +30,16 @@ public class PacketPlayOutChat extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.a(ChatSerializer.a(this.a));
|
|
+ // Spigot start - Update 20140909b
|
|
+ if (components != null)
|
|
+ {
|
|
+ packetdataserializer.a( ComponentSerializer.toString(components) );
|
|
+ }
|
|
+ else {
|
|
+ packetdataserializer.a( ChatSerializer.a(a) );
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
// Spigot start - protocol patch
|
|
if ( packetdataserializer.version >= 16 )
|
|
{
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 5b6aa3f..3964ba0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -23,6 +23,7 @@ import java.util.regex.Pattern;
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
|
+import net.md_5.bungee.api.chat.BaseComponent;
|
|
import net.minecraft.server.ChunkCoordinates;
|
|
import net.minecraft.server.CommandAchievement;
|
|
import net.minecraft.server.CommandBan;
|
|
@@ -1837,6 +1838,24 @@ public final class CraftServer implements Server {
|
|
{
|
|
return org.spigotmc.SpigotConfig.config;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void broadcast( BaseComponent component )
|
|
+ {
|
|
+ for ( Player player : getOnlinePlayers() )
|
|
+ {
|
|
+ player.spigot().sendMessage( component );
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void broadcast( BaseComponent... components )
|
|
+ {
|
|
+ for ( Player player : getOnlinePlayers() )
|
|
+ {
|
|
+ player.spigot().sendMessage( components );
|
|
+ }
|
|
+ }
|
|
};
|
|
|
|
public Spigot spigot()
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index a993b1d..ba744b1 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -22,33 +22,6 @@ public class Main {
|
|
public static boolean useConsole = true;
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
- // Spigot Start
|
|
- File lock = new File( ".update-lock" );
|
|
- if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null )
|
|
- {
|
|
- System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." );
|
|
- System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" );
|
|
- System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" );
|
|
- System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" );
|
|
- System.err.println( "Please type yes to continue starting the server. You have been warned :)" );
|
|
- System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" );
|
|
- System.err.println( "=================================================================================" );
|
|
- System.err.println( "Starting server in 10 seconds" );
|
|
- lock.createNewFile();
|
|
- try
|
|
- {
|
|
- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
|
|
- } catch ( InterruptedException ex )
|
|
- {
|
|
- }
|
|
- }
|
|
-
|
|
- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
|
|
- + "*** It is imperative that backups be taken before running this build on your server! ***\n"
|
|
- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
|
|
- + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
|
|
-
|
|
- // Spigot End
|
|
// Todo: Installation script
|
|
OptionParser parser = new OptionParser() {
|
|
{
|
|
@@ -166,6 +139,34 @@ public class Main {
|
|
} else if (options.has("v")) {
|
|
System.out.println(CraftServer.class.getPackage().getImplementationVersion());
|
|
} else {
|
|
+ // Spigot start - Update 20140909b
|
|
+ File lock = new File( ".update-lock" );
|
|
+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null )
|
|
+ {
|
|
+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." );
|
|
+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" );
|
|
+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" );
|
|
+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" );
|
|
+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" );
|
|
+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" );
|
|
+ System.err.println( "=================================================================================" );
|
|
+ System.err.println( "Starting server in 10 seconds" );
|
|
+ lock.createNewFile();
|
|
+ try
|
|
+ {
|
|
+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
|
|
+ } catch ( InterruptedException ex )
|
|
+ {
|
|
+ }
|
|
+ }
|
|
+
|
|
+ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
|
|
+ + "*** It is imperative that backups be taken before running this build on your server! ***\n"
|
|
+ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
|
|
+ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
|
|
+
|
|
+ // Spigot end
|
|
+
|
|
try {
|
|
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
|
|
String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'});
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 35f2bfa..ca1d027 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -17,6 +17,7 @@ import java.util.UUID;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
+import net.md_5.bungee.api.chat.BaseComponent;
|
|
import net.minecraft.server.*;
|
|
|
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
@@ -1402,6 +1403,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
return java.util.Collections.unmodifiableSet( ret );
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void sendMessage( BaseComponent component )
|
|
+ {
|
|
+ sendMessage( new BaseComponent[] { component } );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void sendMessage( BaseComponent... components )
|
|
+ {
|
|
+ if ( getHandle().playerConnection == null ) return;
|
|
+
|
|
+ PacketPlayOutChat packet = new PacketPlayOutChat();
|
|
+ packet.components = components;
|
|
+ getHandle().playerConnection.sendPacket( packet );
|
|
+ }
|
|
};
|
|
|
|
public Player.Spigot spigot()
|
|
--
|
|
1.9.4.msysgit.0
|
|
|