本文整理汇总了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");
}
}
示例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");
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
示例9: onSendTo
import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onSendTo(final ISendTo task) {
}
示例10: onSentTo
import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onSentTo(final ISendTo task) {
}
示例11: onSendToCancelled
import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onSendToCancelled(final ISendTo task) {
}
示例12: onSendToException
import org.minecraftnauja.p2p.provider.packet.task.ISendTo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onSendToException(final ISendTo task) {
}
示例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);
}
}
示例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);
示例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);