/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.common.network.message;

import io.netty.buffer.ByteBuf;
import org.spongepowered.api.network.ChannelBuf;
import org.spongepowered.api.network.Message;

import javax.annotation.Nullable;

public final class MessageTrackerDataResponse implements Message {

    @Nullable public String owner;
    @Nullable public String notifier;

    public MessageTrackerDataResponse() {
    }

    public MessageTrackerDataResponse(String owner, String notifier) {
        this.owner = owner;
        this.notifier = notifier;
    }

    @Override
    public void readFrom(ChannelBuf buf) {
        ByteBuf buffer = (ByteBuf) buf;
        int ownerLength = buffer.readInt();
        this.owner = new String(buffer.readBytes(ownerLength).array());
        int notifierLength = buffer.readInt();
        this.notifier = new String(buffer.readBytes(notifierLength).array());
    }

    @Override
    public void writeTo(ChannelBuf buf) {
        ByteBuf buffer = (ByteBuf) buf;
        buffer.writeInt(this.owner.length());
        buffer.writeBytes(this.owner.getBytes());
        buffer.writeInt(this.notifier.length());
        buffer.writeBytes(this.notifier.getBytes());
    }

    @Override
    public String toString() {
        return String.format("SpongeMessageTrackerData - owner:%s, notifier:%s", this.owner, this.notifier);
    }
}

@@ -1296,40 +1296,8 @@
 e;%0A%0A
-import io.netty.buffer.ByteBuf;%0A
 impo
@@ -1392,43 +1392,8 @@
 e;%0A%0A
-import javax.annotation.Nullable;%0A%0A
 publ
@@ -1456,34 +1456,24 @@
 sage %7B%0A%0A    
-@Nullable 
 public Strin
@@ -1489,18 +1489,8 @@
     
-@Nullable 
 publ
@@ -1768,477 +1768,178 @@
     
-ByteBuf buffer = (ByteBuf) buf;%0A        int ownerLength = buffer.readInt();%0A        this.owner = new String(buffer.readBytes(ownerLength).array());%0A        int notifierLength = buffer.readInt();%0A        this.notifier = new String(buffer.readBytes(notifierLength).array());%0A    %7D%0A%0A    @Override%0A    public void writeTo(ChannelBuf buf) %7B%0A        ByteBuf buffer = (ByteBuf) buf;%0A        buffer.writeInt(this.owner.length());%0A        buffer.writeBytes(this.owner.getBytes()
+this.owner = buf.readString();%0A        this.notifier = buf.readString();%0A    %7D%0A%0A    @Override%0A    public void writeTo(ChannelBuf buf) %7B%0A        buf.writeString(this.owner
 );%0A 
@@ -1952,71 +1952,20 @@
  buf
-fer
 .write
-Int(this.notifier.length());%0A        buffer.writeBytes
+String
 (thi
@@ -1978,19 +1978,8 @@
 fier
-.getBytes()
 );%0A 

Fix read/write of owner/notifier in tracker data response packet