Example #1
0
 @Override
 public synchronized void printChatMessageWithOptionalDeletion(IChatComponent ichat, int id) {
   // chat listeners
   ChatRecievedEvent chatevent = new ChatRecievedEvent(ichat, id);
   chatevent.channels.add(ChatChannel.DEFAULT_CHANNEL);
   tc.getEventManager().onChatRecieved(chatevent);
   // chat filters
   ichat = chatevent.chat;
   id = chatevent.id;
   if (ichat != null && !ichat.getUnformattedText().isEmpty()) {
     if (id != 0) {
       // send removable msg to current channel
       chatevent.channels.clear();
       chatevent.channels.add(this.chat.getActiveChannel());
     }
     if (chatevent.channels.contains(ChatChannel.DEFAULT_CHANNEL)
         && chatevent.channels.size() > 1
         && !tc.serverSettings.general.useDefaultTab.getValue()) {
       chatevent.channels.remove(ChatChannel.DEFAULT_CHANNEL);
     }
     boolean msg = !chatevent.channels.contains(this.chat.getActiveChannel());
     for (Channel channel : chatevent.channels) {
       channel.addMessage(ichat, id);
       if (msg) {
         channel.setStatus(ChannelStatus.UNREAD);
       }
     }
     TabbyChat.getLogger().info("[CHAT] " + ichat.getUnformattedText());
     this.chat.getChatBox().updateComponent();
   }
 }
  /** Called when a CommandSender executes this command */
  public void execute(ICommandSender sender, String[] args) throws CommandException {
    if (args.length >= 1 && args[0].length() > 1) {
      IChatComponent ichatcomponent =
          args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
      Matcher matcher = field_147211_a.matcher(args[0]);

      if (matcher.matches()) {
        this.func_147210_a(
            sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
      } else {
        EntityPlayerMP entityplayermp =
            MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

        if (entityplayermp == null) {
          throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
        }

        this.func_147210_a(
            sender,
            entityplayermp.getPlayerIP(),
            ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
      }
    } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
  }
Example #3
0
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 1) {
      Matcher var3 = field_147211_a.matcher(par2ArrayOfStr[0]);
      IChatComponent var4 = null;

      if (par2ArrayOfStr.length >= 2) {
        var4 = func_147178_a(par1ICommandSender, par2ArrayOfStr, 1);
      }

      if (var3.matches()) {
        this.func_147210_a(
            par1ICommandSender, par2ArrayOfStr[0], var4 == null ? null : var4.getUnformattedText());
      } else {
        EntityPlayerMP var5 =
            MinecraftServer.getServer()
                .getConfigurationManager()
                .getPlayerEntity(par2ArrayOfStr[0]);

        if (var5 == null) {
          throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
        }

        this.func_147210_a(
            par1ICommandSender,
            var5.getPlayerIP(),
            var4 == null ? null : var4.getUnformattedText());
      }
    } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
  }
 @SideOnly(Side.CLIENT)
 public InventoryBasic(IChatComponent title, int slotCount) {
   this(title.getUnformattedText(), true, slotCount);
 }
Example #5
0
 /**
  * Notifies this sender of some sort of information. This is for messages intended to display to
  * the user. Used for typical output (like "you asked for whether or not this game rule is set, so
  * here's your answer"), warnings (like "I fetched this block for you by ID, but I'd like you to
  * know that every time you do this, I die a little inside"), and errors (like "it's not called
  * iron_pixacke, silly").
  */
 public void addChatMessage(IChatComponent message) {
   logger.info(message.getUnformattedText());
 }
 /**
  * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for
  * termination
  */
 public void onDisconnect(IChatComponent reason) {
   logger.info(this.func_147317_d() + " lost connection: " + reason.getUnformattedText());
 }
Example #7
0
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length >= 1) {
      String var3 = par2ArrayOfStr[0];
      double var4 = (double) par1ICommandSender.getCommandSenderPosition().posX + 0.5D;
      double var6 = (double) par1ICommandSender.getCommandSenderPosition().posY;
      double var8 = (double) par1ICommandSender.getCommandSenderPosition().posZ + 0.5D;

      if (par2ArrayOfStr.length >= 4) {
        var4 = func_110666_a(par1ICommandSender, var4, par2ArrayOfStr[1]);
        var6 = func_110666_a(par1ICommandSender, var6, par2ArrayOfStr[2]);
        var8 = func_110666_a(par1ICommandSender, var8, par2ArrayOfStr[3]);
      }

      World var10 = par1ICommandSender.getEntityWorld();

      if (!var10.blockExists((int) var4, (int) var6, (int) var8)) {
        notifyAdmins(par1ICommandSender, "commands.summon.outOfWorld", new Object[0]);
      } else {
        NBTTagCompound var11 = new NBTTagCompound();
        boolean var12 = false;

        if (par2ArrayOfStr.length >= 5) {
          IChatComponent var13 = func_147178_a(par1ICommandSender, par2ArrayOfStr, 4);

          try {
            NBTBase var14 = JsonToNBT.func_150315_a(var13.getUnformattedText());

            if (!(var14 instanceof NBTTagCompound)) {
              notifyAdmins(
                  par1ICommandSender, "commands.summon.tagError", new Object[] {"Not a valid tag"});
              return;
            }

            var11 = (NBTTagCompound) var14;
            var12 = true;
          } catch (NBTException var17) {
            notifyAdmins(
                par1ICommandSender, "commands.summon.tagError", new Object[] {var17.getMessage()});
            return;
          }
        }

        var11.setString("id", var3);
        Entity var18 = EntityList.createEntityFromNBT(var11, var10);

        if (var18 != null) {
          var18.setLocationAndAngles(var4, var6, var8, var18.rotationYaw, var18.rotationPitch);

          if (!var12 && var18 instanceof EntityLiving) {
            ((EntityLiving) var18).onSpawnWithEgg((IEntityLivingData) null);
          }

          var10.spawnEntityInWorld(var18);
          Entity var19 = var18;

          for (NBTTagCompound var15 = var11;
              var15.func_150297_b("Riding", 10);
              var15 = var15.getCompoundTag("Riding")) {
            Entity var16 = EntityList.createEntityFromNBT(var15.getCompoundTag("Riding"), var10);

            if (var16 != null) {
              var16.setLocationAndAngles(var4, var6, var8, var16.rotationYaw, var16.rotationPitch);
              var10.spawnEntityInWorld(var16);
              var19.mountEntity(var16);
            }

            var19 = var16;
          }

          notifyAdmins(par1ICommandSender, "commands.summon.success", new Object[0]);
        } else {
          notifyAdmins(par1ICommandSender, "commands.summon.failed", new Object[0]);
        }
      }
    } else {
      throw new WrongUsageException("commands.summon.usage", new Object[0]);
    }
  }
 /**
  * Notifies this sender of some sort of information. This is for messages intended to display to
  * the user. Used for typical output (like "you asked for whether or not this game rule is set, so
  * here's your answer"), warnings (like "I fetched this block for you by ID, but I'd like you to
  * know that every time you do this, I die a little inside"), and errors (like "it's not called
  * iron_pixacke, silly").
  */
 public void addChatMessage(IChatComponent message) {
   this.buffer.append(message.getUnformattedText());
 }
Example #9
0
 public void func_175188_a(IChatComponent p_175188_1_, boolean p_175188_2_) {
   this.setRecordPlaying(p_175188_1_.getUnformattedText(), p_175188_2_);
 }