barbarianassault: fix remove wrong attack styles and checkstyle (#772)

* barbarianassault: fix remove wrong attack styles and checkstyle

* travis rebuild
This commit is contained in:
se7enAte9
2019-06-27 15:15:04 -04:00
committed by Ganom
parent a47ba0d531
commit 996774955b
3 changed files with 143 additions and 181 deletions

View File

@@ -130,6 +130,7 @@ class AboveWidgetsOverlay extends Overlay
Rectangle spriteBounds = roleSprite.getBounds(); Rectangle spriteBounds = roleSprite.getBounds();
graphics.drawImage(game.getClockImage(), spriteBounds.x, spriteBounds.y, null); graphics.drawImage(game.getClockImage(), spriteBounds.x, spriteBounds.y, null);
roleSprite.setHidden(true);
} }
private void renderInventoryHighlights(Graphics2D graphics, int itemID, Color color) private void renderInventoryHighlights(Graphics2D graphics, int itemID, Color color)
@@ -152,8 +153,8 @@ class AboveWidgetsOverlay extends Overlay
if (item.getQuantity() > 1) if (item.getQuantity() > 1)
{ {
OverlayUtil.renderTextLocation(graphics, OverlayUtil.renderTextLocation(graphics,
new Point(item.getCanvasLocation().getX() + OFFSET_X_TEXT_QUANTITY, item.getCanvasLocation().getY() + OFFSET_Y_TEXT_QUANTITY), new Point(item.getCanvasLocation().getX() + OFFSET_X_TEXT_QUANTITY, item.getCanvasLocation().getY() + OFFSET_Y_TEXT_QUANTITY),
String.valueOf(item.getQuantity()), Color.YELLOW); String.valueOf(item.getQuantity()), Color.YELLOW);
} }
} }
} }

View File

@@ -90,8 +90,8 @@ public interface BarbarianAssaultConfig extends Config
} }
@Range( @Range(
min = 1, min = 1,
max = 50 max = 50
) )
@ConfigItem( @ConfigItem(
keyName = "prayerMetronomeVolume", keyName = "prayerMetronomeVolume",
@@ -107,10 +107,10 @@ public interface BarbarianAssaultConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "showDeathTimes", keyName = "showDeathTimes",
name = "Show death times", name = "Show death times",
description = "Shows the time all penance monsters of a certain type are killed in the chat box, an info box, or both", description = "Shows the time all penance monsters of a certain type are killed in the chat box, an info box, or both",
position = 6 position = 6
) )
default boolean showDeathTimes() default boolean showDeathTimes()
{ {
@@ -118,12 +118,12 @@ public interface BarbarianAssaultConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "showDeathTimesMode", keyName = "showDeathTimesMode",
name = "Mode", name = "Mode",
description = "", description = "",
position = 7, position = 7,
hidden = true, hidden = true,
unhide = "showDeathTimes" unhide = "showDeathTimes"
) )
default DeathTimesMode showDeathTimesMode() default DeathTimesMode showDeathTimesMode()
{ {
@@ -184,13 +184,13 @@ public interface BarbarianAssaultConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "attackStyles", keyName = "removeIncorrectAttackStyles",
name = "Remove incorrect attack styles", name = "Remove incorrect attack styles",
description = "Hide attack styles depending on weapon.", description = "Hides wrong attack styles for dragon claws and crystal halberd",
position = 2, position = 2,
group = "Attacker" group = "Attacker"
) )
default boolean attackStyles() default boolean removeIncorrectAttackStyles()
{ {
return false; return false;
} }
@@ -306,11 +306,11 @@ public interface BarbarianAssaultConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "highlightNotification", keyName = "highlightNotification",
name = "Highlight incorrect notification", name = "Highlight incorrect notification",
description = "Highlights incorrect poison chat notification", description = "Highlights incorrect poison chat notification",
position = 2, position = 2,
group = "Healer" group = "Healer"
) )
default boolean highlightNotification() default boolean highlightNotification()
{ {
@@ -318,13 +318,13 @@ public interface BarbarianAssaultConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "highlightNotificationColor", keyName = "highlightNotificationColor",
name = "Notification color", name = "Notification color",
description = "Configures the color to highlight the notification text", description = "Configures the color to highlight the notification text",
position = 3, position = 3,
group = "Healer", group = "Healer",
hidden = true, hidden = true,
unhide = "highlightNotification" unhide = "highlightNotification"
) )
default Color highlightNotificationColor() default Color highlightNotificationColor()
{ {

View File

@@ -27,7 +27,7 @@
*/ */
package net.runelite.client.plugins.barbarianassault; package net.runelite.client.plugins.barbarianassault;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableList;
import com.google.inject.Provides; import com.google.inject.Provides;
import java.awt.Font; import java.awt.Font;
@@ -48,6 +48,7 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor; import net.runelite.api.Actor;
import net.runelite.api.ChatMessageType; import net.runelite.api.ChatMessageType;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry; import net.runelite.api.MenuEntry;
import net.runelite.api.MessageNode; import net.runelite.api.MessageNode;
@@ -89,6 +90,8 @@ import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType; import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.attackstyles.AttackStyle;
import net.runelite.client.plugins.attackstyles.WeaponType;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBox;
@@ -101,23 +104,24 @@ import org.apache.commons.lang3.StringUtils;
@Slf4j @Slf4j
@PluginDescriptor( @PluginDescriptor(
name = "Barbarian Assault", name = "Barbarian Assault",
description = "Custom barbarian assault plugin, use along with BA Tools", description = "Custom barbarian assault plugin, use along with BA Tools",
tags = {"minigame", "overlay", "timer"}, tags = {"minigame", "overlay", "timer"},
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
) )
public class BarbarianAssaultPlugin extends Plugin implements KeyListener public class BarbarianAssaultPlugin extends Plugin implements KeyListener
{ {
private static final String ENDGAME_REWARD_NEEDLE_TEXT = "<br>5"; private static final String ENDGAME_REWARD_NEEDLE_TEXT = "<br>5";
private static final String[] STYLES = {"Defensive", "Aggressive", "Controlled", "Accurate"};
private static final int COLOR_CALL_UPDATED = 16316664; private static final int COLOR_CALL_UPDATED = 16316664;
private static final int COLOR_CALL_CALLED = 16291864; private static final int COLOR_CALL_CALLED = 16291864;
private static final int BA_WAVE_NUM_INDEX = 2; private static final int BA_WAVE_NUM_INDEX = 2;
private static final ImmutableList<WidgetInfo> attackStyles = ImmutableList.of(WidgetInfo.COMBAT_STYLE_ONE,
WidgetInfo.COMBAT_STYLE_TWO, WidgetInfo.COMBAT_STYLE_THREE, WidgetInfo.COMBAT_STYLE_FOUR);
@Inject @Inject
private Client client; private Client client;
@@ -230,8 +234,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
private BufferedImage torsoImage, fighterImage, healerImage, rangerImage, runnerImage; private BufferedImage torsoImage, fighterImage, healerImage, rangerImage, runnerImage;
private ImmutableMap<WidgetInfo, Boolean> originalAttackStyles = null;
private ArrayList<TimerBox> deathTimes = new ArrayList<>(); private ArrayList<TimerBox> deathTimes = new ArrayList<>();
private HashMap<Integer, Projectile> projectiles = new HashMap<>(); private HashMap<Integer, Projectile> projectiles = new HashMap<>();
@@ -260,7 +262,10 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
overlayManager.add(widgetsOverlay); overlayManager.add(widgetsOverlay);
overlayManager.add(sceneOverlay); overlayManager.add(sceneOverlay);
keyManager.registerKeyListener(this); keyManager.registerKeyListener(this);
clientThread.invoke(this::validateGame); if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invoke(this::validateGame);
}
} }
@Override @Override
@@ -331,11 +336,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
switch (configChanged.getKey()) switch (configChanged.getKey())
{ {
case "showTimer": case "showTimer":
if (config.showTimer()) if (!config.showTimer())
{
hideRoleSprite();
}
else
{ {
showRoleSprite(); showRoleSprite();
} }
@@ -368,8 +369,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
case "showDeathTimes": case "showDeathTimes":
case "showDeathTimesMode": case "showDeathTimesMode":
if (config.showDeathTimes() if (config.showDeathTimes()
&& (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX && (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX
|| config.showDeathTimesMode() == DeathTimesMode.BOTH)) || config.showDeathTimesMode() == DeathTimesMode.BOTH))
{ {
addAllDeathTimes(); addAllDeathTimes();
} }
@@ -384,6 +385,13 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
case "removeWrongPoison": case "removeWrongPoison":
clientThread.invoke(() -> menu.validateHiddenMenus(getRole())); clientThread.invoke(() -> menu.validateHiddenMenus(getRole()));
break; break;
case "removeIncorrectAttackStyles":
if (!config.removeIncorrectAttackStyles())
{
clientThread.invoke(this::showAllStyles);
}
break;
} }
} }
@@ -525,8 +533,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
if (config.showDeathTimes() && wave != null if (config.showDeathTimes() && wave != null
&& (config.showDeathTimesMode() == DeathTimesMode.CHAT_BOX && (config.showDeathTimesMode() == DeathTimesMode.CHAT_BOX
|| config.showDeathTimesMode() == DeathTimesMode.BOTH)) || config.showDeathTimesMode() == DeathTimesMode.BOTH))
{ {
final MessageNode node = chatMessage.getMessageNode(); final MessageNode node = chatMessage.getMessageNode();
final String nodeValue = Text.removeTags(node.getValue()); final String nodeValue = Text.removeTags(node.getValue());
@@ -594,8 +602,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
if (getRole() == Role.COLLECTOR if (getRole() == Role.COLLECTOR
&& wave != null && wave != null
&& itemDespawned.getTile().getWorldLocation().equals(client.getLocalPlayer().getWorldLocation())) && itemDespawned.getTile().getWorldLocation().equals(client.getLocalPlayer().getWorldLocation()))
{ {
wave.setPositiveEggCount(wave.getPositiveEggCount() + 1); wave.setPositiveEggCount(wave.getPositiveEggCount() + 1);
@@ -631,90 +639,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
tickCounter.setCount(tickNum); tickCounter.setCount(tickNum);
} }
Widget weapon = client.getWidget(WidgetInfo.COMBAT_WEAPON);
if (config.attackStyles()
&& isInGame()
&& getRole() == Role.ATTACKER
&& weapon != null
&& (weapon.getText().contains("Crystal halberd") || weapon.getText().contains("Dragon claws")))
{
if (originalAttackStyles == null)
{
ImmutableMap.Builder<WidgetInfo, Boolean> builder = new ImmutableMap.Builder<>();
builder.put(WidgetInfo.COMBAT_STYLE_ONE, client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).isHidden());
builder.put(WidgetInfo.COMBAT_STYLE_TWO, client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).isHidden());
builder.put(WidgetInfo.COMBAT_STYLE_THREE, client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).isHidden());
builder.put(WidgetInfo.COMBAT_STYLE_FOUR, client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).isHidden());
originalAttackStyles = builder.build();
}
int i;
for (i = 0; i < STYLES.length; i++)
{
if (lastListenText.contains(STYLES[i]))
{
break;
}
}
switch (i)
{
case 0: //Defensive
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
break;
case 1: // Aggressive
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
break;
case 2: // Controlled
if (weapon.getText().contains("Crystal halberd"))
{
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
}
else
{
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
}
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
break;
case 3: // Accurate
if (weapon.getText().contains("Dragon claws"))
{
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
}
else
{
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
}
break;
default:
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
break;
}
}
else if (originalAttackStyles != null)
{
originalAttackStyles.forEach((w, b) -> client.getWidget(w).setHidden(b));
}
if (config.prayerMetronome() && isAnyPrayerActive()) if (config.prayerMetronome() && isAnyPrayerActive())
{ {
for (int i = 0; i < config.prayerMetronomeVolume(); i++) for (int i = 0; i < config.prayerMetronomeVolume(); i++)
@@ -897,6 +821,44 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
menu.setRebuildForced(false); menu.setRebuildForced(false);
menu.validateHiddenMenus(role); menu.validateHiddenMenus(role);
} }
// This doesn't have to be done in BeforeRender. And although it is
// inefficient, it's only being done while in the instance. Will
// likely be changed in the future
if (getRole() == Role.ATTACKER && config.removeIncorrectAttackStyles())
{
Widget weapon = client.getWidget(WidgetInfo.COMBAT_WEAPON);
if (weapon != null)
{
if ((StringUtils.contains(weapon.getText(), "Crystal halberd") || StringUtils.contains(weapon.getText(), "Dragon claws"))
&& newListenText != null && !newListenText.equals("- - -"))
{
int i = 0;
for (AttackStyle style : getAttackStyles())
{
Widget attackStyle = client.getWidget(attackStyles.get(i));
if (attackStyle != null && style != null)
{
if (StringUtils.startsWith(newListenText, style.getName()))
{
attackStyle.setHidden(false);
}
else
{
attackStyle.setHidden(true);
}
}
i++;
}
}
else
{
showAllStyles();
}
}
}
} }
// onMenuEntryAdded is being used for conditional entry changes that are not // onMenuEntryAdded is being used for conditional entry changes that are not
@@ -975,8 +937,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
continue; continue;
} }
else if (config.deprioritizeIncorrectEggs() else if (config.deprioritizeIncorrectEggs()
&& option.equals("take") && option.equals("take")
&& (target.equals("blue egg") || target.equals("green egg") || target.equals("red egg"))) && (target.equals("blue egg") || target.equals("green egg") || target.equals("red egg")))
{ {
prioritizeWalk = true; prioritizeWalk = true;
@@ -991,14 +953,14 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
case DEFENDER: case DEFENDER:
// Take option for logs and hammer should always be the first option // Take option for logs and hammer should always be the first option
if (option.equals("take") if (option.equals("take")
&& (target.equals("logs") || target.equals("hammer"))) && (target.equals("logs") || target.equals("hammer")))
{ {
priority.add(entry); priority.add(entry);
continue; continue;
} }
else if (config.deprioritizeBait() else if (config.deprioritizeBait()
&& option.equals("take") && option.equals("take")
&& (target.equals("tofu") || target.equals("crackers") || target.equals("worms"))) && (target.equals("tofu") || target.equals("crackers") || target.equals("worms")))
{ {
prioritizeWalk = true; prioritizeWalk = true;
} }
@@ -1061,7 +1023,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
Player[] players = client.getCachedPlayers(); Player[] players = client.getCachedPlayers();
if ((!(identifier >= 0 && identifier < players.length && players[identifier] != null)) if ((!(identifier >= 0 && identifier < players.length && players[identifier] != null))
&& !target.endsWith("healer spring")) && !target.endsWith("healer spring"))
{ {
continue; continue;
} }
@@ -1106,8 +1068,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
if (getRole() == Role.HEALER) if (getRole() == Role.HEALER)
{ {
if (target.startsWith("poisoned meat -> penance healer") if (target.startsWith("poisoned meat -> penance healer")
|| target.startsWith("poisoned tofu -> penance healer") || target.startsWith("poisoned tofu -> penance healer")
|| target.startsWith("poisoned worms -> penance healer")) || target.startsWith("poisoned worms -> penance healer"))
{ {
lastHealerPoisoned = event.getIdentifier(); lastHealerPoisoned = event.getIdentifier();
poisonUsed = StringUtils.substringBefore(target.replace("oned", "."), " ->"); poisonUsed = StringUtils.substringBefore(target.replace("oned", "."), " ->");
@@ -1232,6 +1194,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
poisonUsed = null; poisonUsed = null;
lastHealerPoisoned = -1; lastHealerPoisoned = -1;
tickNum = 0; tickNum = 0;
showAllStyles();
usingGloryHorn = false; usingGloryHorn = false;
menu.validateHiddenMenus(null); menu.validateHiddenMenus(null);
} }
@@ -1267,12 +1230,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
role = Role.DEFENDER; role = Role.DEFENDER;
} }
else if (id == ItemID.ATTACKER_HORN || id == ItemID.ATTACKER_HORN_10517 || id == ItemID.ATTACKER_HORN_10518 else if (id == ItemID.ATTACKER_HORN || id == ItemID.ATTACKER_HORN_10517 || id == ItemID.ATTACKER_HORN_10518
|| id == ItemID.ATTACKER_HORN_10519 || id == ItemID.ATTACKER_HORN_10520) || id == ItemID.ATTACKER_HORN_10519 || id == ItemID.ATTACKER_HORN_10520)
{ {
role = Role.ATTACKER; role = Role.ATTACKER;
} }
else if (id == ItemID.HEALER_HORN || id == ItemID.HEALER_HORN_10527 || id == ItemID.HEALER_HORN_10528 else if (id == ItemID.HEALER_HORN || id == ItemID.HEALER_HORN_10527 || id == ItemID.HEALER_HORN_10528
|| id == ItemID.HEALER_HORN_10529 || id == ItemID.HEALER_HORN_10530) || id == ItemID.HEALER_HORN_10529 || id == ItemID.HEALER_HORN_10530)
{ {
role = Role.HEALER; role = Role.HEALER;
} }
@@ -1353,11 +1316,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
private void validateWidgets() private void validateWidgets()
{ {
if (config.showTimer()) if (!config.showTimer())
{
hideRoleSprite();
}
else
{ {
showRoleSprite(); showRoleSprite();
} }
@@ -1372,8 +1331,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
if (config.showDeathTimes() if (config.showDeathTimes()
&& (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX && (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX
|| config.showDeathTimesMode() == DeathTimesMode.BOTH)) || config.showDeathTimesMode() == DeathTimesMode.BOTH))
{ {
addAllDeathTimes(); addAllDeathTimes();
} }
@@ -1383,6 +1342,18 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
private void showAllStyles()
{
for (WidgetInfo info : attackStyles)
{
Widget style = client.getWidget(info);
if (style != null)
{
style.setHidden(false);
}
}
}
private void addTickTimer() private void addTickTimer()
{ {
if (!isInGame() || tickCounter != null) if (!isInGame() || tickCounter != null)
@@ -1460,21 +1431,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
private void hideRoleSprite()
{
if (getRole() == null || !isInGame())
{
return;
}
Widget roleSprite = client.getWidget(role.getRoleSprite());
if (roleSprite != null)
{
roleSprite.setHidden(true);
}
}
private void showRoleSprite() private void showRoleSprite()
{ {
if (getRole() == null || !isInGame()) if (getRole() == null || !isInGame())
@@ -1495,6 +1451,11 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
} }
} }
private AttackStyle[] getAttackStyles()
{
return WeaponType.getWeaponType(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).getAttackStyles();
}
private void announceWaveTime() private void announceWaveTime()
{ {
if (config.waveTimes() && wave != null) if (config.waveTimes() && wave != null)
@@ -1514,24 +1475,24 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
private void announceTime(String preText, String time) private void announceTime(String preText, String time)
{ {
final String chatMessage = new ChatMessageBuilder() final String chatMessage = new ChatMessageBuilder()
.append(ChatColorType.NORMAL) .append(ChatColorType.NORMAL)
.append(preText) .append(preText)
.append(ChatColorType.HIGHLIGHT) .append(ChatColorType.HIGHLIGHT)
.append(time) .append(time)
.build(); .build();
chatMessageManager.queue(QueuedMessage.builder() chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE) .type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(chatMessage) .runeLiteFormattedMessage(chatMessage)
.build()); .build());
} }
private void announce(final ChatMessageBuilder chatMessage) private void announce(final ChatMessageBuilder chatMessage)
{ {
chatMessageManager.queue(QueuedMessage.builder() chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE) .type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(chatMessage.build()) .runeLiteFormattedMessage(chatMessage.build())
.build()); .build());
} }
long getTimeToChange() long getTimeToChange()
@@ -1570,9 +1531,9 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
private boolean isItemEgg(int itemId) private boolean isItemEgg(int itemId)
{ {
return itemId == ItemID.RED_EGG || return itemId == ItemID.RED_EGG ||
itemId == ItemID.GREEN_EGG || itemId == ItemID.GREEN_EGG ||
itemId == ItemID.BLUE_EGG || itemId == ItemID.BLUE_EGG ||
itemId == ItemID.YELLOW_EGG; itemId == ItemID.YELLOW_EGG;
} }
private boolean isAnyPrayerActive() private boolean isAnyPrayerActive()