示例#1
0
 /** {@inheritDoc} */
 @Override
 public void onUploaded(IUpload task) {
   if (task.getChannel().equals(MOD_ID)) {
     FMLLog.log(MOD_ID, Level.INFO, "Klaxon has been uploaded, notifying players");
     try {
       ByteArrayOutputStream bos = new ByteArrayOutputStream();
       DataOutputStream dos = new DataOutputStream(bos);
       dos.writeInt(PacketType.UploadedKlaxon.ordinal());
       dos.writeUTF(task.getName());
       Packet250CustomPayload packet = new Packet250CustomPayload();
       packet.channel = MOD_ID;
       packet.data = bos.toByteArray();
       packet.length = bos.size();
       PacketDispatcher.sendPacketToServer(packet);
     } catch (IOException e) {
       FMLLog.log(MOD_ID, Level.SEVERE, e, "Could not notify the players");
     }
   }
 }
示例#2
0
 /** {@inheritDoc} */
 @Override
 public void onUploadException(IUpload task) {
   if (task.getChannel().equals(MOD_ID)) {
     FMLLog.log(MOD_ID, Level.SEVERE, task.getError(), "Failed to upload the klaxon");
   }
 }