本文整理汇总了Java中net.minecraft.network.rcon.RConConsoleSource类的典型用法代码示例。如果您正苦于以下问题:Java RConConsoleSource类的具体用法?Java RConConsoleSource怎么用?Java RConConsoleSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RConConsoleSource类属于net.minecraft.network.rcon包,在下文中一共展示了RConConsoleSource类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireCommand
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public static int fireCommand(ICommandSender sender, String input){
CommandSender wrapped = null;
if(sender instanceof EntityPlayerMP){
wrapped = NailedPlatform.instance().getPlayer(((EntityPlayerMP) sender).getGameProfile().getId());
}else if(sender instanceof CommandBlockLogic){
wrapped = new CommandBlockCommandSender(((CommandBlockLogic) sender)); //TODO: replace this with our own api
}else if(sender instanceof RConConsoleSource){
//wrapped = new RConCommandSender(((RConConsoleSource) sender));
}else if(sender instanceof MinecraftServer){
wrapped = serverCommandSender;
}
if(wrapped == null){
return -1;
}
return NailedCommandManager.fireCommand((wrapped instanceof Player) ? input.substring(1) : input, wrapped, sender);
}
示例2: fireTabCompletion
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public static List<String> fireTabCompletion(ICommandSender sender, String input){
CommandSender wrapped = null;
if(sender instanceof EntityPlayerMP){
wrapped = NailedPlatform.instance().getPlayer(((EntityPlayerMP) sender).getGameProfile().getId());
}else if(sender instanceof CommandBlockLogic){
wrapped = new CommandBlockCommandSender(((CommandBlockLogic) sender)); //TODO: replace this with our own api
}else if(sender instanceof RConConsoleSource){
//wrapped = new RConCommandSender(((RConConsoleSource) sender));
}else if(sender instanceof MinecraftServer){
wrapped = serverCommandSender;
}
if(wrapped == null){
return null;
}
return NailedCommandManager.fireAutocompletion(input, wrapped, sender);
}
示例3: handleRConCommand
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
/**
* Handle a command received by an RCon instance
*/
public String handleRConCommand(String command)
{
RConConsoleSource.getInstance().resetLog();
this.commandManager.executeCommand(RConConsoleSource.getInstance(), command);
return RConConsoleSource.getInstance().getLogContents();
}
示例4: notifyOperators
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
/**
* @author jamierocks - 1st September 2016
* @reason Log command feedback
*/
@Overwrite
public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams) {
final MinecraftServer server = MinecraftServer.getServer();
final IChatComponent feedback =
new ChatComponentTranslation("chat.type.admin", sender.getName(), new ChatComponentTranslation(msgFormat, msgParams));
feedback.getChatStyle().setColor(EnumChatFormatting.GRAY);
feedback.getChatStyle().setItalic(true);
if (sender.sendCommandFeedback()) {
for (final EntityPlayer player : server.getConfigurationManager().getPlayerList()) {
if (player != sender && server.getConfigurationManager().canSendCommands(player.getGameProfile()) && command
.canCommandSenderUseCommand(sender)) {
final boolean broadcastConsoleToOps = sender instanceof MinecraftServer &&
MinecraftServer.getServer().shouldBroadcastConsoleToOps();
final boolean broadcastRconToOps = sender instanceof RConConsoleSource &&
MinecraftServer.getServer().shouldBroadcastRconToOps();
if (broadcastConsoleToOps || broadcastRconToOps || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) {
player.addChatMessage(feedback);
}
}
}
}
// Neptune - Always log command feedback
//if (sender != server && server.worldServers[0].getGameRules().getBoolean("logAdminCommands")) {
server.addChatMessage(feedback);
//}
// Neptune - end
final boolean shouldSendCommandFeedback = sender instanceof CommandBlockLogic ?
((CommandBlockLogic) sender).shouldTrackOutput() :
server.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");
if ((flags & 1) != 1 && shouldSendCommandFeedback || sender instanceof MinecraftServer) {
sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
}
}
示例5: func_152372_a
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public void func_152372_a(ICommandSender p_152372_1_, ICommand p_152372_2_, int p_152372_3_, String p_152372_4_, Object ... p_152372_5_)
{
boolean flag = true;
if (p_152372_1_ instanceof CommandBlockLogic && !MinecraftServer.getServer().worldServers[0].getGameRules().getGameRuleBooleanValue("commandBlockOutput"))
{
flag = false;
}
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.type.admin", new Object[] {p_152372_1_.getCommandSenderName(), new ChatComponentTranslation(p_152372_4_, p_152372_5_)});
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY);
chatcomponenttranslation.getChatStyle().setItalic(Boolean.valueOf(true));
if (flag)
{
Iterator iterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
while (iterator.hasNext())
{
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
if (entityplayer != p_152372_1_ && MinecraftServer.getServer().getConfigurationManager().func_152596_g(entityplayer.getGameProfile()) && p_152372_2_.canCommandSenderUseCommand(entityplayer) && (!(p_152372_1_ instanceof RConConsoleSource) || MinecraftServer.getServer().func_152363_m()))
{
entityplayer.addChatMessage(chatcomponenttranslation);
}
}
}
if (p_152372_1_ != MinecraftServer.getServer())
{
MinecraftServer.getServer().addChatMessage(chatcomponenttranslation);
}
if ((p_152372_3_ & 1) != 1)
{
p_152372_1_.addChatMessage(new ChatComponentTranslation(p_152372_4_, p_152372_5_));
}
}
示例6: handleRConCommand
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
@SideOnly(Side.SERVER)
public String handleRConCommand(String p_71252_1_)
{
RConConsoleSource.instance.resetLog();
this.commandManager.executeCommand(RConConsoleSource.instance, p_71252_1_);
return RConConsoleSource.instance.getLogContents();
}
示例7: sendMessage
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
@Override
public void sendMessage(String message) {
RConConsoleSource.instance.sendMessage(message + "\n"); // Send a newline after each message, to preserve formatting.
}
示例8: notifyOperators
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
/**
* Send an informative message to the server operators
*/
public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams)
{
boolean flag = true;
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (!sender.sendCommandFeedback())
{
flag = false;
}
IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)});
ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY);
ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true));
if (flag)
{
for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v())
{
if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender))
{
boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r();
boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q();
if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
{
entityplayer.addChatMessage(ichatcomponent);
}
}
}
}
if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
{
minecraftserver.addChatMessage(ichatcomponent);
}
boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");
if (sender instanceof CommandBlockLogic)
{
flag3 = ((CommandBlockLogic)sender).shouldTrackOutput();
}
if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
{
sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams));
}
}
示例9: notifyListener
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
/**
* Send an informative message to the server operators
*/
public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs)
{
boolean flag = true;
MinecraftServer minecraftserver = this.server;
if (!sender.sendCommandFeedback())
{
flag = false;
}
ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)});
itextcomponent.getStyle().setColor(TextFormatting.GRAY);
itextcomponent.getStyle().setItalic(Boolean.valueOf(true));
if (flag)
{
for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList())
{
if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender))
{
boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps();
boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps();
if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
{
entityplayer.addChatMessage(itextcomponent);
}
}
}
}
if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
{
minecraftserver.addChatMessage(itextcomponent);
}
boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");
if (sender instanceof CommandBlockBaseLogic)
{
flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput();
}
if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
{
sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs));
}
}
示例10: isCommandSenderOpped
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public static boolean isCommandSenderOpped(ICommandSender player) {
if (player instanceof EntityPlayer) {
return isPlayerOpped((EntityPlayer) player);
}
return player instanceof MinecraftServer || player instanceof RConConsoleSource;
}
示例11: BukkitRemoteCommandSender
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public BukkitRemoteCommandSender(BukkitServer server, RConConsoleSource sender)
{
super(server);
this.sender = Preconditions.checkNotNull(sender);
}
示例12: func_71252_i
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public String func_71252_i(String p_71252_1_) {
RConConsoleSource.field_70010_a.func_70007_b();
this.field_71321_q.func_71556_a(RConConsoleSource.field_70010_a, p_71252_1_);
return RConConsoleSource.field_70010_a.func_70008_c();
}
示例13: executeCommand
import net.minecraft.network.rcon.RConConsoleSource; //导入依赖的package包/类
public String executeCommand(String par1Str)
{
RConConsoleSource.consoleBuffer.resetLog();
this.commandManager.executeCommand(RConConsoleSource.consoleBuffer, par1Str);
return RConConsoleSource.consoleBuffer.getChatBuffer();
}