• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TS3Query类的典型用法和代码示例

java 5次浏览

本文整理汇总了Java中com.github.theholywaffle.teamspeak3.TS3Query的典型用法代码示例。如果您正苦于以下问题:Java TS3Query类的具体用法?Java TS3Query怎么用?Java TS3Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TS3Query类属于com.github.theholywaffle.teamspeak3包,在下文中一共展示了TS3Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onConnect

点赞 3

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onConnect(TS3Query ts3Query) {
    Sprummlbot sprummlbot = Sprummlbot.getSprummlbot();
    if (sprummlbot.getSprummlbotState() == State.STOPPING) {
        ts3Query.exit();
        return;
    }
    System.out.println("[Core] Connected to TeamSpeak 3 Server!");
    System.out.println("[Core] Initializing Sprummlbot...");
    sprummlbot.setSprummlbotState(State.CONNECTING);
    query = ts3Query;
    try {
        connect(ts3Query);
    } catch (Exception ex) {
        Exceptions.handle(ex, "There was an error while initializing the Sprummlbot.");
    }
    sprummlbot.setSprummlbotState(State.RUNNING);
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:19,
代码来源:TS3Connection.java

示例2: connect

点赞 3

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
/**
 * Connects to query server, selects virtual server and creates instance of {@link VirtualServer} that can be
 * accessed using getter {@link #getVirtualServer()}.
 */
public void connect() {
    this.query = new TS3Query(this.config);
    this.log.info("Connecting to ServerQuery...");
    // Connect query to server.
    this.query.connect();
    // Make reference to API.
    this.api = this.query.getApi();
    this.log.info("Selecting virtual server...");
    // Select default virtual server.
    this.query.getApi().selectVirtualServerById(1);
    // Apply nickname.
    this.query.getApi().setNickname(this.nickname);
    // Create VirtualServer object.
    this.virtualServer = new VirtualServer(this, 1, -1, this.autoSubscribe); // TODO: Port unknown at this time.
    this.log.info("Registering events...");
    // Register all events and set up EventProxy.
    this.eventProxy = new EventProxy(this.virtualServer);
    this.api.registerEvent(TS3EventType.SERVER);
    this.api.registerEvent(TS3EventType.TEXT_SERVER);
    this.api.registerEvent(TS3EventType.TEXT_PRIVATE);
    this.api.addTS3Listeners(this.eventProxy);
    this.log.info("Connected!");
}
 

开发者ID:dobrakmato,
项目名称:Sergius,
代码行数:28,
代码来源:QueryConnection.java

示例3: onConnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onConnect(TS3Query ts3Query) {
	timeout = startTimeout;
	if (userConnectionHandler != null) {
		userConnectionHandler.onConnect(ts3Query);
	}
}
 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:8,
代码来源:ReconnectingConnectionHandler.java

示例4: onDisconnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onDisconnect(TS3Query ts3Query) {
	if (timeout < 0) {
		// Special case: We never connected
		// --> Something is probably not set up correctly
		// Do not attempt to reconnect
		return;
	} else if (timeout == startTimeout) {
		// First run, announce disconnect
		TS3Query.log.info("[Connection] Disconnected from TS3 server");

		if (userConnectionHandler != null) {
			userConnectionHandler.onDisconnect(ts3Query);
		}
	}

	timeout = (int) Math.ceil(timeout * multiplier) + addend;
	if (timeoutCap > 0) timeout = Math.min(timeout, timeoutCap);

	try {
		Thread.sleep(timeout);
	} catch (InterruptedException e) {
		return;
	}

	try {
		ts3Query.connect();
	} catch (TS3ConnectionFailedException conFailed) {
		// Ignore exception, announce reconnect failure
		TS3Query.log.fine("[Connection] Failed to reconnect - waiting " + timeout + "ms until next attempt");
	}
}
 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:33,
代码来源:ReconnectingConnectionHandler.java

示例5: onDisconnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onDisconnect(TS3Query ts3Query) {
	TS3Query.log.severe("[Connection] Disconnected from TS3 server");
	ts3Query.exit();

	if (userConnectionHandler != null) {
		userConnectionHandler.onDisconnect(ts3Query);
	}
}
 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:10,
代码来源:DisconnectingConnectionHandler.java

示例6: initialize

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
void initialize() {
    this.config.setConnectionHandler(new SprummlbotConnectionHandler());
    this.config.setReconnectStrategy(ReconnectStrategy.exponentialBackoff());

    // Pre-connect initialization
    switch (Vars.DEBUG) {
        case 1:
            config.setDebugLevel(Level.WARNING);
            break;

        case 2:
            config.setDebugLevel(Level.ALL);
            break;

        default:
            config.setDebugLevel(Level.OFF);
            break;
    }

    if (Vars.DYNBANNER_ENABLED) {
        try {
            System.out.println("[Dynamic Banner] Initializing Dynamic Banner...");
            if (!Vars.DYNBANNER_FILE.exists())
                Exceptions.handle(new FileNotFoundException("Banner file doesnt exist"),
                        "Banner File doesn't exist", true);
            Vars.DYNBANNER = new DynamicBanner(Vars.DYNBANNER_FILE, Vars.DYNBANNER_COLOR,
                    Vars.DYNBANNER_FONT);
        } catch (IOException e) {
            Exceptions.handle(e, "Error while initializing Dynamic Banner");
        }
    }

    query = new TS3Query(config);
    query.connect();

    //Post connect initialization
    Events.start();
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:39,
代码来源:TS3Connection.java

示例7: onDisconnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onDisconnect(TS3Query ts3Query) {
    Sprummlbot sprummlbot = Sprummlbot.getSprummlbot();
    sprummlbot.setSprummlbotState(State.DISCONNECTED);
    System.out.println("[Core] Lost connection to server!");
    cleanup();
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:8,
代码来源:TS3Connection.java

示例8: main

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
public static void main(String[] args) {
	final TS3Config config = new TS3Config();
	config.setHost("77.77.77.77");
	config.setEnableCommunicationsLogging(true);

	final TS3Query query = new TS3Query(config);
	query.connect();

	final TS3Api api = query.getApi();
	api.login("serveradmin", "serveradminpassword");
	api.selectVirtualServerById(1);
	api.setNickname("PutPutBot");
	api.sendChannelMessage("PutPutBot is online!");

	// Let's customize our channel
	final Map<ChannelProperty, String> properties = new HashMap<>();
	// Make it a permanent channel
	properties.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "1");
	// Make it a subchannel of the default channel
	int defaultChannelId = api.whoAmI().getChannelId();
	properties.put(ChannelProperty.CPID, String.valueOf(defaultChannelId));
	// Let's also set a channel topic
	properties.put(ChannelProperty.CHANNEL_TOPIC, "PutPut discussion");

	// Done customizing, let's create the channel with our properties
	api.createChannel("PutPut Channel", properties);

	// We're done, disconnect
	query.exit();
}
 

开发者ID:TheHolyWaffle,
项目名称:TeamSpeak-3-Java-API,
代码行数:31,
代码来源:CreateChannelExample.java

示例9: onDisconnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onDisconnect(TS3Query ts3Query) {
	// Announce disconnect and run user connection handler
	log.info("[Connection] Disconnected from TS3 server - reconnecting in {}ms", startTimeout);
	if (userConnectionHandler != null) {
		userConnectionHandler.onDisconnect(ts3Query);
	}

	int timeout = startTimeout;

	while (true) {
		try {
			Thread.sleep(timeout);
		} catch (InterruptedException e) {
			return;
		}

		timeout = (int) Math.ceil(timeout * multiplier) + addend;
		if (timeoutCap > 0) timeout = Math.min(timeout, timeoutCap);

		try {
			ts3Query.connect();
			return; // Successfully reconnected, return
		} catch (TS3ConnectionFailedException conFailed) {
			// Ignore exception, announce reconnect failure
			log.debug("[Connection] Failed to reconnect - waiting {}ms until next attempt", timeout);
		}
	}
}
 

开发者ID:TheHolyWaffle,
项目名称:TeamSpeak-3-Java-API,
代码行数:30,
代码来源:ReconnectingConnectionHandler.java

示例10: onDisconnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onDisconnect(TS3Query ts3Query) {
	log.error("[Connection] Disconnected from TS3 server");

	if (userConnectionHandler != null) {
		userConnectionHandler.onDisconnect(ts3Query);
	}
}
 

开发者ID:TheHolyWaffle,
项目名称:TeamSpeak-3-Java-API,
代码行数:9,
代码来源:DisconnectingConnectionHandler.java

示例11: onConnect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
@Override
public void onConnect(TS3Query ts3Query) {
	if (userConnectionHandler != null) {
		userConnectionHandler.onConnect(ts3Query);
	}
}
 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:7,
代码来源:DisconnectingConnectionHandler.java

示例12: connect

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
private void connect(TS3Query query) throws SprummlbotInitializationException, ModuleLoadException {
    final Sprummlbot sprummlbot = Sprummlbot.getSprummlbot();

    sprummlbot.setTS3Api(query.getApi());
    sprummlbot.setTS3ApiAsync(query.getAsyncApi());

    final TS3Api api = sprummlbot.getSyncAPI();

    if (!api.login(username, password))
        throw new SprummlbotInitializationException("Authentication failed! Username or password wrong.");

    System.out.println("[Core] Selecting virtual server with ID " + serverId + "...");
    if (!api.selectVirtualServerById(serverId))
        throw new SprummlbotInitializationException("Unable to select server with ID " + serverId + "!");

    api.setNickname(nickname);
    api.registerAllEvents();

    sprummlbot.setClientManager(new Clients());
    sprummlbot.setMainEventManager(new EventManager(null));

    if (Vars.VPNCHECKER_ENABLED) {
        System.out.println("[VPN Checker] Enabling VPN Checker...");
        Tasks.startVPNChecker();
    }
    Tasks.startInternalRunner();


    if (Vars.DYNBANNER_ENABLED) {
        Map<VirtualServerProperty, String> settings = new HashMap<>();
        settings.put(VirtualServerProperty.VIRTUALSERVER_HOSTBANNER_GFX_URL,
                "http://" + Vars.IP + ":9911/f/banner.png");
        settings.put(VirtualServerProperty.VIRTUALSERVER_HOSTBANNER_GFX_INTERVAL, "60");
        api.editServer(settings);
        Tasks.startDynamicBanner();
    }

    sprummlbot.getDefaultAPI().getClients().onSuccess(result -> {
        for (Client c : result) {
            if (PermissionGroup.getPermissionGroupForField("notify").isPermitted(c.getUniqueIdentifier()) == PermissionGroup.Permission.PERMITTED)
                sprummlbot.getDefaultAPI().sendPrivateMessage(c.getId(), "Sprummlbot connected!" + (Vars.UPDATE_AVAILABLE ? " An update is available! Please update!" : ""));
        }
    });

    sprummlbot.getModuleManager().startAllModules();

    sprummlbot.setSprummlbotState(State.RUNNING);
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:49,
代码来源:TS3Connection.java

示例13: getQuery

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
TS3Query getQuery() {
    return query;
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:4,
代码来源:TS3Connection.java

示例14: load

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
public static void load(File f, boolean silent) throws Exception {
    Config conf = new Config(f).setDefaultConfig(getDefaultIni()).compare();
    if (conf.wasChanged() && !silent)
        System.out.println("[Config] " + f.getName() + " was updated.");
    final Ini ini = conf.getIni();

    Section connection = ini.get("Connection");
    Vars.SERVER = connection.get("ip");
    Vars.PORT_SQ = connection.get("port", int.class);
    Vars.CHANGE_FLOOD_SETTINGS = connection.get("optimize-flood-settings", boolean.class);

    Section login = ini.get("Login");
    Vars.LOGIN[0] = login.get("username");
    Vars.LOGIN[1] = login.get("password");
    Vars.SERVER_ID = login.get("server-id", int.class);

    Section webinterface = ini.get("Webinterface");
    Vars.WEBINTERFACE_PORT = webinterface.get("port", int.class);
    if (Vars.WEBINTERFACE_PORT <= 0) {
        throw new Exception("Web Interface port cannot be 0 or negative!");
    }
    PermissionGroup.setPermissionGroupField("command_login", webinterface.get("group"));

    Section appearance = ini.get("Appearance");
    Vars.NICK = appearance.get("nickname");
    PermissionGroup.setPermissionGroupField("notify", appearance.get("notify-group"));

    Section vpnChecker = ini.get("VPN Checker");
    Vars.VPNCHECKER_ENABLED = vpnChecker.get("enabled", boolean.class);
    Vars.VPNCHECKER_SAVE = vpnChecker.get("save-ips", boolean.class);
    Vars.VPNCHECKER_INTERVAL = vpnChecker.get("interval", int.class);
    PermissionGroup.setPermissionGroupField("vpn", vpnChecker.get("whitelist-group"));

    Section logger = ini.get("Server Logger");
    Vars.LOGGER_ENABLED = logger.get("enabled", boolean.class);

    Section banner = ini.get("Dynamic Banner");
    Vars.DYNBANNER_ENABLED = banner.get("enabled", boolean.class);
    Vars.DYNBANNER_FILE = new File(banner.get("file"));
    GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
    ArrayList<String> fonts = new ArrayList<>(Arrays.asList(g.getAvailableFontFamilyNames()));

    if (fonts.contains(banner.get("font")))
        Vars.DYNBANNER_FONT = new Font(banner.get("font"), Font.PLAIN, banner.get("font-size", int.class));
    else {
        Font font = Font.createFont(Font.TRUETYPE_FONT, new File(banner.get("font")));
        g.registerFont(font);
        Vars.DYNBANNER_FONT = new Font(font.getFontName(), Font.PLAIN, banner.get("font-size", int.class));
    }
    Vars.DYNBANNER_COLOR = new Color(banner.get("color", int.class));
    Vars.DYNBANNER_TIME_POS[0] = banner.get("position-of-time-x", int.class);
    Vars.DYNBANNER_TIME_POS[1] = banner.get("position-of-time-y", int.class);
    Vars.DYNBANNER_TIME_F = banner.get("time-format");
    Vars.DYNBANNER_DATE_POS[0] = banner.get("position-of-date-x", int.class);
    Vars.DYNBANNER_DATE_POS[1] = banner.get("position-of-date-y", int.class);
    Vars.DYNBANNER_DATE_F = banner.get("date-format");
    Vars.DYNBANNER_USERS_POS[0] = banner.get("position-of-users-x", int.class);
    Vars.DYNBANNER_USERS_POS[1] = banner.get("position-of-users-y", int.class);
    Vars.DYNBANNER_USERS_F = banner.get("users-text");

    Section misc = ini.get("Misc");

    Vars.UPDATE_ENABLED = misc.get("update-notification", boolean.class);
    Vars.TIMER_TICK = misc.get("check-tick", int.class);
    Vars.FLOODRATE = (misc.get("can-flood", boolean.class)) ? TS3Query.FloodRate.UNLIMITED : TS3Query.FloodRate.DEFAULT;
    Vars.DEBUG = misc.get("debug", int.class);
    Vars.IP = misc.get("ip");


    Section commands = ini.get("Commands");

    PermissionGroup.setPermissionGroupField("command_sendmsg", commands.get("sendmsg-command-group"));

    Messages.setupLanguage(misc.get("language"), silent);
    Permissions.load(new File("permissions.ini"), silent);
    System.out.println("[Config] Config loaded!");
}
 

开发者ID:Scrumplex,
项目名称:Sprummlbot,
代码行数:78,
代码来源:Configuration.java

示例15: main

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
public static void main(String[] args) throws Exception {	
	Logger.getLogger("").setLevel(Level.OFF);
	Configuration config = new Configuration.Builder().setVersion(VERSION).setName("Geffy").setRealName("Geforce's assistant, at your service!").setServerHostname("irc.esper.net").addAutoJoinChannel("#Geforce").setNickservPassword(SuperSecretSecrets.nickservPassword).addListener(new EventListener()).buildConfiguration();
	bot = new Bot(config);
	
	MessageHandler.messagesToRespondTo.put("new commit to", MessageHandler.newCommitToMessages);
	
	//Get the newest SecurityCraft version from GitHub.
	Gson gson = new GsonBuilder().create();
	URL updateURL = new URL("https://www.github.com/Geforce132/SecurityCraft/raw/master/Updates/Geffy.json");
	BufferedReader in = new BufferedReader(new InputStreamReader(updateURL.openStream()));

	SecurityCraftUpdate update = gson.fromJson(in, SecurityCraftUpdate.class);

	Reference.scVersion = update.getVersion();
	Reference.scBetaVersion = update.getBetaVersion();
	Reference.scBetaVersionOf = update.getBetaVersionOf();
	Reference.scBetaDownloadLink = update.getBetaDownloadLink();

	//-----

	//Start the TS3 functionality of Geffy.
	TS3Config tsConfig = new TS3Config();
	tsConfig.setHost("geforcemods.net");

	Reference.ts3Query = new TS3Query(tsConfig);
	Reference.ts3Query.connect();

	TS3Api api = Reference.ts3Query.getApi();
	api.selectVirtualServerById(1);
	api.setNickname("GeffyBot");

	api.registerAllEvents();

	Reference.ts3EventListener = new TS3ActionListener();
	api.addTS3Listeners(Reference.ts3EventListener);

	//-----
	
	bot.startBot();
}
 

开发者ID:Geforce132,
项目名称:Geffy,
代码行数:42,
代码来源:Geffy.java

示例16: getQuery

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
protected TS3Query getQuery() {
    return this.query;
}
 

开发者ID:dobrakmato,
项目名称:Sergius,
代码行数:4,
代码来源:QueryConnection.java

示例17: main

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
public static void main(String[] args) {
	final TS3Config config = new TS3Config();
	config.setHost("77.77.77.77");
	config.setEnableCommunicationsLogging(true);

	final TS3Query query = new TS3Query(config);
	query.connect();

	final TS3Api api = query.getApi();
	api.login("serveradmin", "serveradminpassword");
	api.selectVirtualServerById(1);
	api.setNickname("PutPutBot");
	api.sendChannelMessage("PutPutBot is online!");

	// Set up properties for our test channels
	final Map<ChannelProperty, String> properties = new HashMap<>();
	properties.put(ChannelProperty.CHANNEL_FLAG_SEMI_PERMANENT, "1"); // Stay until restart
	int defaultChannelId = api.whoAmI().getChannelId();
	properties.put(ChannelProperty.CPID, String.valueOf(defaultChannelId));
	properties.put(ChannelProperty.CHANNEL_TOPIC, "File transfer tests");

	// --------------------- //
	// Direct file transfers //
	// --------------------- //

	// Create a new channel
	int directChannel = api.createChannel("Direct file transfers", properties);
	// Upload and set an icon
	long blackIconId = api.uploadIconDirect(RED_EXAMPLE_ICON);
	api.editChannel(directChannel, mapOf(ChannelProperty.CHANNEL_ICON_ID, blackIconId));
	// Create a new directory on the file repository
	api.createFileDirectory(EXAMPLE_DIRECTORY, directChannel);
	// And upload a file to it
	api.uploadFileDirect(EXAMPLE_FILE_CONTENT, EXAMPLE_FILE_NAME, false, directChannel);
	// Download it again and print it to System.out
	byte[] directDownload = api.downloadFileDirect(EXAMPLE_FILE_NAME, directChannel);
	System.out.println(new String(directDownload, StandardCharsets.UTF_8));

	// --------------------- //
	// Stream file transfers //
	// --------------------- //

	// Create a new channel
	int streamChannel = api.createChannel("Stream file transfers", properties);
	// Upload and set an icon
	InputStream iconIn = new ByteArrayInputStream(BLUE_EXAMPLE_ICON); // Usually a FileInputStream
	long whiteIconId = api.uploadIcon(iconIn, BLUE_EXAMPLE_ICON.length);
	api.editChannel(streamChannel, mapOf(ChannelProperty.CHANNEL_ICON_ID, whiteIconId));
	// Create a new directory on the file repository
	api.createFileDirectory(EXAMPLE_DIRECTORY, streamChannel);
	// And upload a file to it
	InputStream dataIn = new ByteArrayInputStream(EXAMPLE_FILE_CONTENT); // Usually a FileInputStream
	api.uploadFile(dataIn, EXAMPLE_FILE_CONTENT.length, EXAMPLE_FILE_NAME, false, streamChannel);
	// Download it again and print it to System.out
	ByteArrayOutputStream dataOut = new ByteArrayOutputStream(128); // Usually a FileOutputStream
	api.downloadFile(dataOut, EXAMPLE_FILE_NAME, streamChannel);
	System.out.println(new String(dataOut.toByteArray(), StandardCharsets.UTF_8));

	// We're done, disconnect
	query.exit();
}
 

开发者ID:TheHolyWaffle,
项目名称:TeamSpeak-3-Java-API,
代码行数:62,
代码来源:FileTransferExample.java

示例18: main

点赞 2

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
public static void main(String[] args) {
	final TS3Config config = new TS3Config();
	config.setHost("77.77.77.77");
	config.setEnableCommunicationsLogging(true);

	final TS3Query query = new TS3Query(config);
	query.connect();

	final TS3Api api = query.getApi();
	api.login("serveradmin", "serveradminpassword");
	api.selectVirtualServerById(1);
	api.setNickname("PutPutBot");
	api.sendChannelMessage("PutPutBot is online!");

	// Get our own client ID by running the "whoami" command
	final int clientId = api.whoAmI().getId();

	// Listen to chat in the channel the query is currently in
	// As we never changed the channel, this will be the default channel of the server
	api.registerEvent(TS3EventType.TEXT_CHANNEL, 0);

	// Register the event listener
	api.addTS3Listeners(new TS3EventAdapter() {

		@Override
		public void onTextMessage(TextMessageEvent e) {
			// Only react to channel messages not sent by the query itself
			if (e.getTargetMode() == TextMessageTargetMode.CHANNEL && e.getInvokerId() != clientId) {
				String message = e.getMessage().toLowerCase();

				if (message.equals("!ping")) {
					// Answer "!ping" with "pong"
					api.sendChannelMessage("pong");
				} else if (message.startsWith("hello")) {
					// Greet whoever said hello
					// Message: "Hello <client name>!"
					api.sendChannelMessage("Hello " + e.getInvokerName() + "!");
				}
			}
		}
	});
}
 

开发者ID:TheHolyWaffle,
项目名称:TeamSpeak-3-Java-API,
代码行数:43,
代码来源:ChatBotExample.java

示例19: onConnect

点赞 1

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
void onConnect(TS3Query ts3Query); 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:2,
代码来源:ConnectionHandler.java

示例20: onDisconnect

点赞 1

import com.github.theholywaffle.teamspeak3.TS3Query; //导入依赖的package包/类
void onDisconnect(TS3Query ts3Query); 

开发者ID:DiscowZombie,
项目名称:UltimateTs,
代码行数:2,
代码来源:ConnectionHandler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)