本文整理匯總了Java中org.bukkit.plugin.messaging.Messenger類的典型用法代碼示例。如果您正苦於以下問題:Java Messenger類的具體用法?Java Messenger怎麽用?Java Messenger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Messenger類屬於org.bukkit.plugin.messaging包,在下文中一共展示了Messenger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerHooks
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
protected void registerHooks()
{
this.playerListener = new PlayerListener(this);
if (VersionHelper.hasRequiredVersion("1.4.7"))
this.dynamicPlayerListener = new DynamicPlayerListener_1_5(this, playerListener);
else
this.dynamicPlayerListener = new DynamicPlayerListener_1_4_2(this, playerListener);
this.dynamicVehicleListener = new DynamicVehicleListener(this);
final CrazyListener crazylistener = new CrazyListener(this, playerListener);
final PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(playerListener, this);
pm.registerEvents(crazylistener, this);
pm.registerEvents(new WorldListener(this), this);
registerDynamicHooks();
messageListener = new MessageListener(this);
final Messenger ms = getServer().getMessenger();
ms.registerIncomingPluginChannel(this, "CrazyLogin", messageListener);
ms.registerOutgoingPluginChannel(this, "CrazyLogin");
}
示例2: getOutput
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Nullable
public static String getOutput(@Nullable Object object) {
if (object == null) {
return null;
}
if (object instanceof String) {
return (String) object;
} else if (object instanceof Collection) {
return handleCollection((Collection) object);
} else if (object instanceof Map) {
return handleMap((Map) object);
} else if (object.getClass().isArray()) {
return handleArray(object);
} else if (object instanceof OfflinePlayer) {
return handleOfflinePlayer((OfflinePlayer) object);
} else if (object instanceof BlockState) {
return handleBlockState((BlockState) object);
} else if (object instanceof Inventory) {
return handleInventory((Inventory) object);
} else if (object instanceof WorldBorder) {
return handleWorldBorder((WorldBorder) object);
} else if (object instanceof CommandSender) {
return handleCommandSender((CommandSender) object);
} else if (object instanceof Messenger) {
return handleMessenger((Messenger) object);
} else if (object instanceof HelpMap) {
return handleHelpMap((HelpMap) object);
} else {
return String.valueOf(object);
}
}
示例3: handleMessenger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Nonnull
private static String handleMessenger(Messenger messenger) {
String incomingBanner = "-- Incoming Channels --\n";
String incomingChannels = handleCollection(messenger.getIncomingChannels());
String outgoingBanner = "\n-- Outgoing Channels --\n";
String outgoingChannels = handleCollection(messenger.getOutgoingChannels());
return incomingBanner + incomingChannels + outgoingBanner + outgoingChannels;
}
示例4: testMessenger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Test
public void testMessenger() {
String debuggeryIn = "Debuggery In";
String debuggeryOut = "Debuggery Out";
String tacoInOut = "Taco Listener";
String stuffIn = "Other stuff";
String stuffOut = "Something here";
Set<String> messengersIn = new HashSet<>();
Set<String> messengersOut = new HashSet<>();
messengersIn.add(debuggeryIn);
messengersIn.add(tacoInOut);
messengersIn.add(stuffIn);
messengersOut.add(debuggeryOut);
messengersOut.add(tacoInOut);
messengersOut.add(stuffOut);
Messenger messenger = new TestMessenger(messengersIn, messengersOut);
String out = OutputFormatter.getOutput(messenger);
assertNotNull(out);
String[] sections = out.split("}\\n");
String incoming = sections[0];
String outgoing = sections[1];
assertTrue(incoming.contains(debuggeryIn));
assertTrue(incoming.contains(tacoInOut));
assertTrue(incoming.contains(stuffIn));
assertTrue(outgoing.contains(debuggeryOut));
assertTrue(outgoing.contains(tacoInOut));
assertTrue(outgoing.contains(stuffOut));
}
示例5: setTexturePack
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public void setTexturePack(String url) {
Validate.notNull(url, "Texture pack URL cannot be null");
byte[] message = (url + "\0" + "16").getBytes();
Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");
getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message));
}
示例6: init
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
private void init() {
Messenger m = Bukkit.getServer().getMessenger();
if ( !m.isOutgoingChannelRegistered(ParchmentPluginLite.instance(), channel) )
m.registerOutgoingPluginChannel(ParchmentPluginLite.instance(), channel);
if ( !m.isIncomingChannelRegistered(ParchmentPluginLite.instance(), channel) ) {
m.registerIncomingPluginChannel(ParchmentPluginLite.instance(), channel, this);
}
}
示例7: BukkitPacketManager
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public BukkitPacketManager(JavaPlugin bukkitPlugin, String channel){
super(channel);
this.bukkitPlugin = bukkitPlugin;
Messenger messenger = Bukkit.getMessenger();
messenger.registerOutgoingPluginChannel(bukkitPlugin, channel);
messenger.registerIncomingPluginChannel(bukkitPlugin, channel, this);
messenger.registerIncomingPluginChannel(bukkitPlugin, "BungeeCord", this);
messenger.registerOutgoingPluginChannel(bukkitPlugin, "BungeeCord");
Bukkit.getPluginManager().registerEvents(this, bukkitPlugin);
}
示例8: register
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void register() {
Messenger messenger = Bukkit.getMessenger();
messenger.registerOutgoingPluginChannel(plugin, BUNGEE_CHANNEL);
messenger.registerIncomingPluginChannel(plugin, BUNGEE_CHANNEL, this);
Bukkit.getScheduler().runTaskTimer(plugin, this, UPDATE_INTERVAL, UPDATE_INTERVAL);
register("bungee-online").scoreSupply(() -> onlinePlayers);
}
示例9: reload
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void reload(Settings settings) {
this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
this.destinationServerOnLogin = settings.getProperty(HooksSettings.BUNGEECORD_SERVER);
if (this.isEnabled) {
Messenger messenger = plugin.getServer().getMessenger();
if (!messenger.isOutgoingChannelRegistered(plugin, "BungeeCord")) {
messenger.registerOutgoingPluginChannel(plugin, "BungeeCord");
}
}
}
示例10: reload
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public void reload(Settings settings) {
this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD);
if (this.isEnabled) {
Messenger messenger = plugin.getServer().getMessenger();
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
}
}
}
示例11: setTexturePack
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
public void setTexturePack(String url) {
Validate.notNull(url, "Texture pack URL cannot be null");
byte[] message = (url + "\0" + "16").getBytes();
Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long");
getHandle().field_71135_a.func_72567_b(new net.minecraft.network.packet.Packet250CustomPayload("MC|TPack", message));
}
示例12: getMessenger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger() {
return messenger;
}
示例13: PlayerServerChanger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Inject PlayerServerChanger(Plugin plugin, Messenger messenger, Server localServer) {
this.plugin = plugin;
this.messenger = messenger;
this.localServer = localServer;
}
示例14: getMessenger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
示例15: getMessenger
import org.bukkit.plugin.messaging.Messenger; //導入依賴的package包/類
@Override
public Messenger getMessenger() {
throw new UnsupportedOperationException();
}