Simplify RuneLite API world

- Use Lombok for World object

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-03-05 17:49:24 +01:00
parent c0e9a502eb
commit 78728c471e
2 changed files with 12 additions and 74 deletions

View File

@@ -25,7 +25,11 @@
package net.runelite.http.api.worlds;
import java.util.EnumSet;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class World
{
private int id;
@@ -34,70 +38,4 @@ public class World
private String activity;
private int location;
private int players;
@Override
public String toString()
{
return "World{" + "id=" + id + ", types=" + types + ", address=" + address + ", activity=" + activity + ", location=" + location + ", players=" + players + '}';
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public EnumSet<WorldType> getTypes()
{
return types;
}
public void setTypes(EnumSet<WorldType> types)
{
this.types = types;
}
public String getAddress()
{
return address;
}
public void setAddress(String address)
{
this.address = address;
}
public String getActivity()
{
return activity;
}
public void setActivity(String activity)
{
this.activity = activity;
}
public int getLocation()
{
return location;
}
public void setLocation(int location)
{
this.location = location;
}
public int getPlayers()
{
return players;
}
public void setPlayers(int players)
{
this.players = players;
}
}

View File

@@ -71,15 +71,15 @@ public class WorldsService
for (int i = 0; i < num; ++i)
{
World world = new World();
world.setId(buf.getShort() & 0xFFFF);
world.setTypes(getTypes(buf.getInt()));
world.setAddress(readString(buf));
world.setActivity(readString(buf));
world.setLocation(buf.get() & 0xFF);
world.setPlayers(buf.getShort() & 0xFFFF);
final World.WorldBuilder worldBuilder = World.builder()
.id(buf.getShort() & 0xFFFF)
.types(getTypes(buf.getInt()))
.address(readString(buf))
.activity(readString(buf))
.location(buf.get() & 0xFF)
.players(buf.getShort() & 0xFFFF);
worlds.add(world);
worlds.add(worldBuilder.build());
}
WorldResult result = new WorldResult();