当前位置: 首页>>代码示例>>Java>>正文


Java Player.sendPluginMessage方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.sendPluginMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Player.sendPluginMessage方法的具体用法?Java Player.sendPluginMessage怎么用?Java Player.sendPluginMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.sendPluginMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendPlayerToServer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public ListenableFuture<?> sendPlayerToServer(Player player, @Nullable String bungeeName, boolean quiet) {
    if(localServer.bungee_name().equals(bungeeName) || (localServer.role() == ServerDoc.Role.LOBBY && bungeeName == null)) {
        return Futures.immediateFuture(null);
    }

    final ByteArrayOutputStream message = new ByteArrayOutputStream();
    final DataOutputStream out = new DataOutputStream(message);

    try {
        out.writeUTF(quiet ? "ConnectQuiet" : "Connect");
        out.writeUTF(bungeeName == null ? "default" : bungeeName);
    } catch(IOException e) {
        return Futures.immediateFailedFuture(e);
    }

    player.sendPluginMessage(plugin, PLUGIN_CHANNEL, message.toByteArray());
    return quitFuture(player);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:PlayerServerChanger.java

示例2: connect

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void connect(Player p, String server) {
	if (Lobby.connectionTimes.get(p.getName()) != null) {
		if (new Date().getTime() / 1000 - Lobby.getConnectionTimes().get(p.getName()).getTime() / 1000 < 1)
			return;
	}
	Chat.log("Sending " + p.getName() + " to " + server);
	Lobby.connectionTimes.put(p.getName(), new Date());
	ByteArrayOutputStream b = new ByteArrayOutputStream();
	DataOutputStream out = new DataOutputStream(b);
	try {
	    out.writeUTF("Transfer");
	    out.writeUTF(server); // Target Server
	} catch (IOException e) {
	    // Can never happen
	}
	p.sendPluginMessage(Lobby.getInstance(), "BungeeCord", b.toByteArray());
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:18,代码来源:Util.java

示例3: update

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void update() {
    Player player = Bukkit.getPlayer(playerData.getPlayerID());

    try {
        //Update SQL
        gameServiceManager.setPlayerSettings(playerData.getPlayerBean(), this);

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        //Comamnd type
        out.writeUTF("settingsChanges");
        //The player to refresh settings on bungee
        out.writeUTF(player.getUniqueId().toString());
        //Send data on network channel
        player.sendPluginMessage(APIPlugin.getInstance(), "Network", out.toByteArray());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:20,代码来源:ImpPlayerSettings.java

示例4: sendToaRandomServerInGroup

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendToaRandomServerInGroup(Plugin plugin, Player player)
{
    plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "CloudNet");
    ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
    byteArrayDataOutput.writeUTF("Connect");
    byteArrayDataOutput.writeUTF("Lobby"); //Connect to the group Lobby
    player.sendPluginMessage(plugin, "CloudNet", byteArrayDataOutput.toByteArray());
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:9,代码来源:BungeeCordChannelExample.java

示例5: sendToFallback

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendToFallback(Plugin plugin, Player player)
{
    plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "CloudNet");
    ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
    byteArrayDataOutput.writeUTF("Fallback"); //Connect to the fallback server in the iteration
    player.sendPluginMessage(plugin, "CloudNet", byteArrayDataOutput.toByteArray());
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:8,代码来源:BungeeCordChannelExample.java

示例6: sendPluginMessage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);

    for (Player player : getPlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:8,代码来源:CraftWorld.java

示例7: sendPluginMessage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(getMessenger(), source, channel, message);

    for (Player player : getOnlinePlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftServer.java

示例8: sendToChannel

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void sendToChannel(MessageAgent agent, Player player) {
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF(agent.getSubChannel());
    agent.appendPayload(out);

    byte[] data = out.toByteArray();
    player.sendPluginMessage(plugin, CHANNEL, data);

    // register listener
    if (agent instanceof MessageCallback) {
        MessageCallback callback = (MessageCallback) agent;
        registerListener(callback);
    }
}
 
开发者ID:lucko,项目名称:helper,代码行数:15,代码来源:BungeeMessaging.java

示例9: sendGetServers

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendGetServers() {
	Iterator<? extends Player> players = this.plugin.getServer().getOnlinePlayers().iterator();
	if (!players.hasNext()) return;
	
	ByteArrayDataOutput out = ByteStreams.newDataOutput();
	out.writeUTF(GET_SERVERS);
	Player player = players.next();
	player.sendPluginMessage(this.plugin, CHANNEL_BUNGEE, out.toByteArray());
}
 
开发者ID:EverCraft,项目名称:ServerConnect,代码行数:10,代码来源:MessageBungee.java

示例10: connect

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void connect(Player player, String server) {
	ByteArrayDataOutput out = ByteStreams.newDataOutput();
	out.writeUTF(CONNECT);
	out.writeUTF(server);
	
	player.sendPluginMessage(this.plugin, CHANNEL_BUNGEE, out.toByteArray());
}
 
开发者ID:EverCraft,项目名称:ServerConnect,代码行数:8,代码来源:MessageBungee.java

示例11: onClick

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
    if (action.startsWith("Hub_"))
    {
        if (action.split("_")[1].equals(SamaGamesAPI.get().getServerName().split("_")[1]))
        {
            player.sendMessage(ChatColor.RED + "Vous ne pouvez pas aller sur votre hub actuel !");
            return;
        }
        else if (this.hub.getHubRefresher().getHubByID(Integer.parseInt(action.split("_")[1])).getConnectedPlayers() >= 120)
        {
            player.sendMessage(ChatColor.RED + "Le hub sélectionné est plein !");
            return;
        }

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(action);
        player.sendPluginMessage(this.hub, "BungeeCord", out.toByteArray());

        // TODO: Use API
        // SamaGamesAPI.get().getPlayerManager().connectToServer(player.getUniqueId(), action);
    }
    else if (action.equals("page_back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, (this.page - 1)));
    }
    else if (action.equals("page_next"))
    {
        this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, (this.page + 1)));
    }
    else if (action.equals("back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:38,代码来源:GuiSwitchHub.java

示例12: connectToServer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void connectToServer(Player player, String server) {
	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	DataOutputStream out = new DataOutputStream(stream);
	try {
		out.writeUTF("Connect");
		out.writeUTF(server);
	} catch (IOException e) {
		e.printStackTrace();
	}
	player.sendPluginMessage(SkyWarsReloaded.get(), "BungeeCord", stream.toByteArray());
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:12,代码来源:BungeeUtil.java

示例13: ping

import org.bukkit.entity.Player; //导入方法依赖的package包/类
void ping() {
    final Player player = this.getFirstPlayer();
    if (player == null)
        return;
    for (final String s : this.controller.getServers()) {
        final ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("ServerIP");
        out.writeUTF(s);
        player.sendPluginMessage(this.plugin, "BungeeCord", out.toByteArray());
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:12,代码来源:BungeeCordProvider.java

示例14: teleport

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void teleport(Player pl, String input)
{
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(b);
    try {
        out.writeUTF("Connect");
        out.writeUTF(input);
    }
    catch (IOException localIOException) {}
    pl.sendPluginMessage(HCF.getPlugin(), "BungeeCord", b.toByteArray());
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:HubCommand.java

示例15: connectToServer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
void connectToServer(Player player, String serverName) {
    final ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeUTF("Connect");
    out.writeUTF(serverName);
    player.sendPluginMessage(this.plugin, "BungeeCord", out.toByteArray());
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:7,代码来源:BungeeCordProvider.java


注:本文中的org.bukkit.entity.Player.sendPluginMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。