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


Java ISendTo类代码示例

本文整理汇总了Java中org.minecraftnauja.p2p.provider.packet.task.ISendTo的典型用法代码示例。如果您正苦于以下问题:Java ISendTo类的具体用法?Java ISendTo怎么用?Java ISendTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onCompleted

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onCompleted(final ISendTo task) {
	synchronized (VoiceChat.class) {
		// Sent, Connect to the other player.
		final String player = task.getPlayer();
		accepted.put(player, null);
		modChat("The request from " + player + " has been accepted");
		modChat("Waiting for " + player + " to be ready");
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-VoiceChat,代码行数:14,代码来源:VoiceChat.java

示例2: onException

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onException(final ISendTo task) {
	synchronized (VoiceChat.class) {
		// Could not send the packet.
		final String player = task.getPlayer();
		accepted.remove(player);
		modChat("Can't accept the request from " + player);
		FMLLog.log(MOD_ID, Level.SEVERE, task.getError(),
				"Could not send the accepted packet");
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-VoiceChat,代码行数:15,代码来源:VoiceChat.java

示例3: fireSendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Notifies listeners that a {@code sendTo} started.
 * 
 * @param task
 *            the task.
 */
public void fireSendTo(final ISendTo task) {
	for (final PacketListener l : listeners
			.getListeners(PacketListener.class)) {
		l.onSendTo(task);
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:13,代码来源:PacketProviderBase.java

示例4: fireSentTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Notifies listeners that a {@code sendTo} has been completed.
 * 
 * @param task
 *            the task.
 */
public void fireSentTo(final ISendTo task) {
	for (final PacketListener l : listeners
			.getListeners(PacketListener.class)) {
		l.onSentTo(task);
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:13,代码来源:PacketProviderBase.java

示例5: fireSendToCancelled

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Notifies listeners that a {@code sendTo} has been cancelled.
 * 
 * @param task
 *            the task.
 */
public void fireSendToCancelled(final ISendTo task) {
	for (final PacketListener l : listeners
			.getListeners(PacketListener.class)) {
		l.onSendToCancelled(task);
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:13,代码来源:PacketProviderBase.java

示例6: fireSendToException

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Notifies listeners that a {@code sendTo} caused an exception.
 * 
 * @param task
 *            the task.
 */
public void fireSendToException(final ISendTo task) {
	for (final PacketListener l : listeners
			.getListeners(PacketListener.class)) {
		l.onSendToException(task);
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:13,代码来源:PacketProviderBase.java

示例7: sendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ISendTo sendTo(String channel, IPacket packet, String player,
		ICallback<ISendTo> callback) {
	try {
		packet.setChannel(channel);
		packet.setSender(peer.getId());
		SendTo task = new SendTo(channel, packet, player);
		task.start(callback);
		return task;
	} catch (AlreadyRunningException e) {
		return null;
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-TomP2P,代码行数:17,代码来源:PacketProvider.java

示例8: sendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ISendTo sendTo(final String channel, final IPacket packet,
		final String player) {
	return sendTo(channel, packet, player, null);
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:9,代码来源:PacketProviderBase.java

示例9: onSendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onSendTo(final ISendTo task) {
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:7,代码来源:PacketAdapter.java

示例10: onSentTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onSentTo(final ISendTo task) {
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:7,代码来源:PacketAdapter.java

示例11: onSendToCancelled

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onSendToCancelled(final ISendTo task) {
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:7,代码来源:PacketAdapter.java

示例12: onSendToException

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onSendToException(final ISendTo task) {
}
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:7,代码来源:PacketAdapter.java

示例13: start

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public synchronized void start(final ICallback<ISendTo> callback)
		throws AlreadyRunningException {
	if (running) {
		throw new AlreadyRunningException(this);
	}
	try {
		error = null;
		if (callback != null) {
			callback.onStarted(this);
		}
		fireSendTo(SendTo.this);
		// Puts the file.
		PeerAddress pa = peer.getPeerAddress(player);
		task = peer.sendDirect(pa, packet);
		task.addCancellation(new Cancellable() {
			public void cancel() {
				// Cancelled the file upload.
				task = null;
				running = false;
				if (callback != null) {
					callback.onCancelled(SendTo.this);
				}
				fireSendToCancelled(SendTo.this);
			}
		});
		task.addListener(new BaseFutureListener<FutureResponse>() {
			public void operationComplete(FutureResponse future)
					throws Exception {
				// File uploaded.
				task = null;
				running = false;
				if (callback != null) {
					callback.onCompleted(SendTo.this);
				}
				fireSentTo(SendTo.this);
			}

			public void exceptionCaught(Throwable t) throws Exception {
				// Could not upload the file.
				task = null;
				running = false;
				error = t;
				if (callback != null) {
					callback.onException(SendTo.this);
				}
				fireSendToException(SendTo.this);
			}
		});
	} catch (Exception e) {
		// Could not read the file or put it.
		task = null;
		running = false;
		error = e;
		if (callback != null) {
			callback.onException(this);
		}
		fireSendToException(this);
	}
}
 
开发者ID:Nauja,项目名称:Minecraft-TomP2P,代码行数:64,代码来源:PacketProvider.java

示例14: sendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Sends a packet to given player.
 * 
 * @param channel
 *            channel to use.
 * @param packet
 *            packet to send.
 * @param player
 *            name of the player.
 * @return the task.
 */
public ISendTo sendTo(String channel, IPacket packet, String player);
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:13,代码来源:IPacketProvider.java

示例15: onSendTo

import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
 * Called when a {@code sendTo} started.
 * 
 * @param task
 *            the task.
 */
public void onSendTo(ISendTo task);
 
开发者ID:Nauja,项目名称:Minecraft-P2P,代码行数:8,代码来源:PacketListener.java


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