Add toRoomString and toCodeString Raid utilities
Add new util methods that will build room and code string from current raid layout. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -134,4 +134,49 @@ public class Raid
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String toRoomString()
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (Room r : getLayout().getRooms())
|
||||
{
|
||||
final int position = r.getPosition();
|
||||
final RaidRoom room = getRoom(position);
|
||||
|
||||
if (room == null || !(room.getType() == RaidRoom.Type.COMBAT || room.getType() == RaidRoom.Type.PUZZLE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (room.getType())
|
||||
{
|
||||
case PUZZLE:
|
||||
final RaidRoom.Puzzle puzzle = room.getPuzzle();
|
||||
sb.append(puzzle.getName());
|
||||
|
||||
if (puzzle == RaidRoom.Puzzle.UNKNOWN)
|
||||
{
|
||||
sb.append(" (puzzle)");
|
||||
}
|
||||
|
||||
sb.append(", ");
|
||||
break;
|
||||
case COMBAT:
|
||||
final RaidRoom.Boss boss = room.getBoss();
|
||||
sb.append(boss.getName());
|
||||
|
||||
if (boss == RaidRoom.Boss.UNKNOWN)
|
||||
{
|
||||
sb.append(" (combat)");
|
||||
}
|
||||
|
||||
sb.append(", ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final String roomsString = sb.toString();
|
||||
return roomsString.substring(0, roomsString.length() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class RaidsOverlay extends Overlay
|
||||
}
|
||||
|
||||
Color color = Color.WHITE;
|
||||
String layout = plugin.getRaid().getLayout().toCode().replaceAll("#", "").replaceAll("¤", "");
|
||||
String layout = plugin.getRaid().getLayout().toCodeString();
|
||||
|
||||
if (config.enableLayoutWhitelist() && !plugin.getLayoutWhitelist().contains(layout.toLowerCase()))
|
||||
{
|
||||
|
||||
@@ -62,4 +62,9 @@ public class Layout
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String toCodeString()
|
||||
{
|
||||
return toCode().replaceAll("#", "").replaceAll("¤", "");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user