Add the ability for commandblocks to be sent messages via the API.

This commit is contained in:
Cory Redmond 2015-04-13 02:15:16 +02:00 committed by md_5
parent ba325926d5
commit 7722428895

View File

@ -2,9 +2,11 @@ package org.bukkit.craftbukkit.command;
import net.minecraft.server.ICommandListener; import net.minecraft.server.ICommandListener;
import net.minecraft.server.CommandBlockListenerAbstract; import net.minecraft.server.CommandBlockListenerAbstract;
import net.minecraft.server.IChatBaseComponent;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender; import org.bukkit.command.BlockCommandSender;
import org.bukkit.craftbukkit.util.CraftChatMessage;
/** /**
* Represents input from a command block * Represents input from a command block
@ -22,9 +24,15 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
} }
public void sendMessage(String message) { public void sendMessage(String message) {
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
commandBlock.sendMessage(component);
}
} }
public void sendMessage(String[] messages) { public void sendMessage(String[] messages) {
for (String message : messages) {
sendMessage(message);
}
} }
public String getName() { public String getName() {