Simplify RuneLite API world
- Use Lombok for World object Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user