fix checkstyle and npe

Signed-off-by: PKLite <stonewall@pklite.xyz>
This commit is contained in:
PKLite
2019-09-12 09:16:41 -04:00
parent 08b7d75e5c
commit 4423c421c7
2 changed files with 8 additions and 7 deletions

View File

@@ -127,6 +127,7 @@ public class PlayerIndicatorsOverlay extends Overlay
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
ImageUtil.resizeImage(Objects.requireNonNull(clanManager
.getClanImage(clanManager.getRank(actor.getName()))), y, y), 0, ACTOR_HORIZONTAL_TEXT_MARGIN);
return;
}
}

View File

@@ -286,14 +286,14 @@ public class OverlayUtil
public static void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, BufferedImage image, int yOffset, int xOffset)
{
Point textLocation = new Point(actor.getConvexHull().getBounds().x + xOffset,
actor.getConvexHull().getBounds().y + yOffset);
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight() + yOffset);
renderImageLocation(graphics, textLocation, image);
xOffset = image.getWidth() + 1;
yOffset = (image.getHeight() - (int) graphics.getFontMetrics().getStringBounds(text, graphics).getHeight());
textLocation = new Point(textLocation.getX() + xOffset, textLocation.getY() + image.getHeight() - yOffset);
renderTextLocation(graphics, textLocation, text, color);
if (textLocation != null)
{
renderImageLocation(graphics, textLocation, image);
textLocation = new Point(textLocation.getX() + xOffset , textLocation.getY());
renderTextLocation(graphics, textLocation, text, color);
}
}
public static void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint, boolean shadows, int yOffset)