Package com.github.theholywaffle.teamspeak3.commands

Examples of com.github.theholywaffle.teamspeak3.commands.Command


      for (TS3Listener l : listeners) {
        emitter.fire(l, new DefaultArrayResponse(notifyBody).getArray()
            .get(0));
      }
    } else {
      throw new TS3UnknownEventException(notifyName + " " + notifyBody);
    }

  }
View Full Code Here


        serverCon.getChannels().forEach( ( c ) -> {
            System.out.println( c.getName() );
        } );
        System.out.println( ApiUtils.getChannelByName( serverCon.getChannels(), "Games" ) );

        Channel c = ApiUtils.getSubChannel( serverCon.getChannels(), new String[]{ "League of Legends", "#1", } );
        System.out.println( c );
        System.out.println( c.getTotalClients() );
        serverCon.setChannel( c );
        serverCon.setName( "Seplunker" );

        System.out.println( "finish" );
    }
View Full Code Here

     * @param channelId
     * @throws org.tsbs.manager.exceptions.UnknownChannelException if there's no channel with the id ChannelId
     */
    public void activateChannel( int channelId ) throws UnknownChannelException
    {
        Channel c = ApiUtils.getChannelById( getAllServerChannels(), channelId );
        if( c == null )
            throw new UnknownChannelException( "Channel with the id( " + channelId + " ) not found!" );

        activateChannel( c );
    }
View Full Code Here

   public void callAction( String[] params, TS3BotChannelListener source, TextMessageEvent eventSource )
   {
      TS3Api api = source.getTS3Api();
      Random random = new Random();
      List<Channel> channelList = ApiUtils.filterPasswordProtectedChannels( api.getChannels() );
      Channel sourceChannel =  ApiUtils.getChannelById( channelList, source.getChannelId() );
      List<Client>  clientList  = ApiUtils.filterClientsFromOtherChannels( api.getClients(), sourceChannel );
      Channel channel = channelList.get( random.nextInt( channelList.size() ) );
      Client  client  = clientList.get( random.nextInt( clientList.size() ) );

      if( params.length > 1 )
         api.moveClient( eventSource.getInvokerId(), channel.getId() );
      else
         api.moveClient( client.getId(), channel.getId() );
   }
View Full Code Here

        Thread.sleep( 1500L );
    }

    public void testActivateChannel() throws Exception
    {
        Channel c = ApiUtils.getSubChannel( manager.getAllServerChannels(), new String[]{ "Games", "Diablo3", "#1" } );
        Thread.sleep( 1500L );
    }
View Full Code Here

        TS3Api api = source.getTS3Api();

        switch( params[1] )
        {
            case fMOVE_CHANNEL_CLIENTS:
                Channel channelSrc = ApiUtils.getChannelById( api.getChannels(), source.getChannelId() );
                moveChannelClients( api, channelSrc, params[2] );
                break;
            default:
                printUsage( api );
                break;
View Full Code Here

    }

    public void moveChannelClients( TS3Api api, Channel channel, String destChannel )
    {
        List<Client> clientList = ApiUtils.filterClientsFromOtherChannels( api.getClients(), channel );
        Channel dest = api.getChannelByName( destChannel );

        if( dest != null )
        {
            printUsage( api );
            return;
        }

        for( Client c : clientList )
            api.moveClient( c.getId(), dest.getId() );
    }
View Full Code Here

      Random random = new Random();
      List<Channel> channelList = ApiUtils.filterPasswordProtectedChannels( api.getChannels() );
      Channel sourceChannel =  ApiUtils.getChannelById( channelList, source.getChannelId() );
      List<Client>  clientList  = ApiUtils.filterClientsFromOtherChannels( api.getClients(), sourceChannel );
      Channel channel = channelList.get( random.nextInt( channelList.size() ) );
      Client  client  = clientList.get( random.nextInt( clientList.size() ) );

      if( params.length > 1 )
         api.moveClient( eventSource.getInvokerId(), channel.getId() );
      else
         api.moveClient( client.getId(), channel.getId() );
   }
View Full Code Here

    }
  }

  public void run() {
    while (ts3.getSocket()!= null &&ts3.getSocket().isConnected() && ts3.getOut() != null && !stop) {
      Command c = ts3.getCommandList().peek();
      if (c != null && !c.isSent()) {
        String msg = c.toString();
        TS3Query.log.info("> " + msg);
        ts3.getOut().println(msg);
        lastCommand = System.currentTimeMillis();
        c.setSent();
      }
      try {
        Thread.sleep(floodRate);
      } catch (InterruptedException e) {
        e.printStackTrace();
View Full Code Here

    while (ts3.getSocket()!= null && ts3.getSocket().isConnected() && ts3.getIn() != null && !stop) {
      try {
        if (ts3.getIn().ready()) {
          final String line = ts3.getIn().readLine();
          if (!line.isEmpty()) {
            Command c = ts3.getCommandList().peek();
            if (line.startsWith("notify")) {
              TS3Query.log.info("< [event] " + line);
              new Thread(new Runnable() {

                public void run() {
                  String arr[] = line.split(" ", 2);
                  ts3.getEventManager().fireEvent(arr[0],
                      arr[1]);

                }
              }).start();

            } else if (c != null && c.isSent()) {
              TS3Query.log
                  .info("[" + c.getName() + "] < " + line);
              if (line.startsWith("error")) {
                c.feedError(line.substring("error ".length()));
                if (c.getError().getId() != 0) {
                  TS3Query.log.severe("[ERROR] "
                      + c.getError());
                }
                c.setAnswered();
                ts3.getCommandList().remove(c);
              } else if (!line.isEmpty()) {
                c.feed(line);
              }
            } else {
              TS3Query.log.info("< " + line);
            }
          }
View Full Code Here

TOP

Related Classes of com.github.theholywaffle.teamspeak3.commands.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.