#100: Allow sending messages from specific UUIDs
Dieser Commit ist enthalten in:
Ursprung
f011ca24f2
Commit
aa477927d3
@ -1,4 +1,4 @@
|
||||
From 258412605b7549c50690d1dd9f2610dc30f03bc5 Mon Sep 17 00:00:00 2001
|
||||
From b3ebfbe086f7c3e7130f5badfee718b6982ba5fc Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sat, 13 Dec 2014 02:59:14 +0100
|
||||
Subject: [PATCH] BungeeCord Chat API
|
||||
@ -322,10 +322,10 @@ index f786ce9a..c74493f7 100644
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
|
||||
index 6d9708dc..fe6b162f 100644
|
||||
index 6d9708dc..ac772bf3 100644
|
||||
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
||||
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
||||
@@ -57,6 +57,23 @@ public interface CommandSender extends Permissible {
|
||||
@@ -57,6 +57,43 @@ public interface CommandSender extends Permissible {
|
||||
// Spigot start
|
||||
public class Spigot {
|
||||
|
||||
@ -345,15 +345,43 @@ index 6d9708dc..fe6b162f 100644
|
||||
+ */
|
||||
+ public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends this sender a chat component.
|
||||
+ *
|
||||
+ * @param component the components to send
|
||||
+ * @param sender the sender of the message
|
||||
+ */
|
||||
+ public void sendMessage(@Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the sender.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @param sender the sender of the message
|
||||
+ */
|
||||
+ public void sendMessage(@Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
}
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index a00880dd..0859d2bc 100644
|
||||
index a00880dd..40345617 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1339,6 +1339,36 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
+import java.util.UUID;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -1339,6 +1340,58 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public java.util.Set<Player> getHiddenPlayers() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@ -386,6 +414,28 @@ index a00880dd..0859d2bc 100644
|
||||
+ */
|
||||
+ public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the component to the specified screen position of this player
|
||||
+ *
|
||||
+ * @param position the screen position
|
||||
+ * @param sender the sender of the message
|
||||
+ * @param component the components to send
|
||||
+ */
|
||||
+ public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the specified screen position of this player
|
||||
+ *
|
||||
+ * @param position the screen position
|
||||
+ * @param sender the sender of the message
|
||||
+ * @param components the components to send
|
||||
+ */
|
||||
+ public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From ebbe4f9a3f0a96f73f502b78391195c102f43936 Mon Sep 17 00:00:00 2001
|
||||
From bf3042910480d5cca6a4763c1481a8e3f6980f3e Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sat, 13 Dec 2014 03:06:05 +0100
|
||||
Subject: [PATCH] BungeeCord Chat API
|
||||
@ -66,10 +66,10 @@ index f3c95cc62..0986d666b 100644
|
||||
|
||||
public Spigot spigot()
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java
|
||||
index 06686cd02..14043b9db 100644
|
||||
index 06686cd02..7f88b109b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java
|
||||
@@ -103,6 +103,17 @@ public abstract class ServerCommandSender implements CommandSender {
|
||||
@@ -103,6 +103,29 @@ public abstract class ServerCommandSender implements CommandSender {
|
||||
// Spigot start
|
||||
private final Spigot spigot = new Spigot()
|
||||
{
|
||||
@ -83,15 +83,35 @@ index 06686cd02..14043b9db 100644
|
||||
+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components)
|
||||
+ {
|
||||
+ ServerCommandSender.this.sendMessage(net.md_5.bungee.api.chat.TextComponent.toLegacyText(components));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(UUID sender, net.md_5.bungee.api.chat.BaseComponent... components)
|
||||
+ {
|
||||
+ this.sendMessage(components);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(UUID sender, net.md_5.bungee.api.chat.BaseComponent component)
|
||||
+ {
|
||||
+ this.sendMessage(component);
|
||||
+ }
|
||||
};
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 54cb0e39d..e753eb4c5 100644
|
||||
index 54cb0e39d..8c1a66b92 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1009,6 +1009,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
+import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.minecraft.server.AxisAlignedBB;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.DamageSource;
|
||||
@@ -1009,6 +1010,26 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
// Spigot start
|
||||
private final Spigot spigot = new Spigot()
|
||||
{
|
||||
@ -104,12 +124,22 @@ index 54cb0e39d..e753eb4c5 100644
|
||||
+ @Override
|
||||
+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(UUID sender, BaseComponent... components)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(UUID sender, BaseComponent component)
|
||||
+ {
|
||||
+ }
|
||||
};
|
||||
|
||||
public Spigot spigot()
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index ac82877b8..68da8e398 100644
|
||||
index ac82877b8..a225e85c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -122,6 +122,8 @@ import org.bukkit.plugin.Plugin;
|
||||
@ -121,7 +151,7 @@ index ac82877b8..68da8e398 100644
|
||||
@DelegateDeserialization(CraftOfflinePlayer.class)
|
||||
public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private long firstPlayed = 0;
|
||||
@@ -1767,6 +1769,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1767,6 +1769,48 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
return java.util.Collections.unmodifiableSet( ret );
|
||||
}
|
||||
@ -152,6 +182,20 @@ index ac82877b8..68da8e398 100644
|
||||
+ PacketPlayOutChat packet = new PacketPlayOutChat(null, net.minecraft.server.ChatMessageType.a((byte) position.ordinal()), SystemUtils.b);
|
||||
+ packet.components = components;
|
||||
+ getHandle().playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(net.md_5.bungee.api.ChatMessageType position, UUID sender, BaseComponent component) {
|
||||
+ sendMessage( position, sender, new BaseComponent[] { component } );
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(net.md_5.bungee.api.ChatMessageType position, UUID sender, BaseComponent... components) {
|
||||
+ if ( getHandle().playerConnection == null ) return;
|
||||
+
|
||||
+ PacketPlayOutChat packet = new PacketPlayOutChat(null, net.minecraft.server.ChatMessageType.a((byte) position.ordinal()), sender == null ? SystemUtils.b : sender);
|
||||
+ packet.components = components;
|
||||
+ getHandle().playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
};
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren