13
0
geforkt von Mirrors/Paper

Fix chat not being cancellable when not using deprecated API.

Dieser Commit ist enthalten in:
Wesley Wolfe 2012-08-04 05:44:16 -05:00
Ursprung 9bed5272d3
Commit a5da834258

Datei anzeigen

@ -810,21 +810,21 @@ public class NetServerHandler extends NetHandler {
} }
} }
public boolean chat(String s, boolean async) { public void chat(String s, boolean async) {
if (!this.player.dead) { if (!this.player.dead) {
if (s.length() == 0) { if (s.length() == 0) {
logger.warning(this.player.name + " tried to send an empty message"); logger.warning(this.player.name + " tried to send an empty message");
return false; return;
} }
if (getPlayer().isConversing()) { if (getPlayer().isConversing()) {
getPlayer().acceptConversationInput(s); getPlayer().acceptConversationInput(s);
return true; return;
} }
if (s.startsWith("/")) { if (s.startsWith("/")) {
this.handleCommand(s); this.handleCommand(s);
return true; return;
} else { } else {
Player player = this.getPlayer(); Player player = this.getPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet());
@ -836,6 +836,10 @@ public class NetServerHandler extends NetHandler {
queueEvent.setCancelled(event.isCancelled()); queueEvent.setCancelled(event.isCancelled());
minecraftServer.chatQueue.add(queueEvent); minecraftServer.chatQueue.add(queueEvent);
} else { } else {
if (event.isCancelled()) {
return;
}
s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
minecraftServer.console.sendMessage(s); minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) { if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
@ -856,7 +860,7 @@ public class NetServerHandler extends NetHandler {
} }
} }
return false; return;
} }
// CraftBukkit end // CraftBukkit end