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; package net.runelite.http.api.worlds;
import java.util.EnumSet; import java.util.EnumSet;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class World public class World
{ {
private int id; private int id;
@@ -34,70 +38,4 @@ public class World
private String activity; private String activity;
private int location; private int location;
private int players; 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) for (int i = 0; i < num; ++i)
{ {
World world = new World(); final World.WorldBuilder worldBuilder = World.builder()
world.setId(buf.getShort() & 0xFFFF); .id(buf.getShort() & 0xFFFF)
world.setTypes(getTypes(buf.getInt())); .types(getTypes(buf.getInt()))
world.setAddress(readString(buf)); .address(readString(buf))
world.setActivity(readString(buf)); .activity(readString(buf))
world.setLocation(buf.get() & 0xFF); .location(buf.get() & 0xFF)
world.setPlayers(buf.getShort() & 0xFFFF); .players(buf.getShort() & 0xFFFF);
worlds.add(world); worlds.add(worldBuilder.build());
} }
WorldResult result = new WorldResult(); WorldResult result = new WorldResult();