Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan-Vann committed Mar 20, 2023
2 parents 072dbb2 + 79d07d9 commit ac24814
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/example/EthanApiPlugin/ItemQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public ItemQuery filter(Predicate<? super Widget> predicate)
return this;
}

public ItemQuery hasAction(String action)
public ItemQuery withAction(String action)
{
items = items.stream().filter(item -> Arrays.asList(item.getActions()).contains(action)).collect(Collectors.toList());
return this;
}

public ItemQuery hasId(int id)
public ItemQuery withId(int id)
{
items = items.stream().filter(item -> item.getItemId() == id).collect(Collectors.toList());
return this;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/example/EthanApiPlugin/NPCQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public NPCQuery filter(Predicate<? super NPC> predicate){
return this;
}

public NPCQuery hasAction(String action){
public NPCQuery withAction(String action){
npcs = npcs.stream().filter(npc -> Arrays.asList(npc.getComposition().getActions()).contains(action)).collect(Collectors.toList());
return this;
}
public NPCQuery hasId(int id){
public NPCQuery withId(int id){
npcs = npcs.stream().filter(npc -> npc.getId() == id).collect(Collectors.toList());
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/example/EthanApiPlugin/TileObjectQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public Optional<TileObject> first()
return tileObjects.stream().findFirst();
}

public Optional<TileObject> closestToPlayer()
public Optional<TileObject> nearestToPlayer()
{
return tileObjects.stream().min(Comparator.comparingInt(o -> client.getLocalPlayer().getWorldLocation().distanceTo(o.getWorldLocation())));
}

public Optional<TileObject> closestToPoint(WorldPoint point)
public Optional<TileObject> nearestToPoint(WorldPoint point)
{
return tileObjects.stream().min(Comparator.comparingInt(o -> point.distanceTo(o.getWorldLocation())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static boolean useItem(String name,String... actions){
}).orElse(false);
}
public static boolean useItem(int id,String... actions){
return Bank.search().hasId(id).first().flatMap(item -> {
return Bank.search().withId(id).first().flatMap(item -> {
MousePackets.queueClickPacket();
WidgetPackets.queueWidgetAction(item,actions);
return Optional.of(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static boolean useItem(String name,String... actions){
}).orElse(false);
}
public static boolean useItem(int id,String... actions){
return BankInventory.search().hasId(id).first().flatMap(item -> {
return BankInventory.search().withId(id).first().flatMap(item -> {
MousePackets.queueClickPacket();
WidgetPackets.queueWidgetAction(item,actions);
return Optional.of(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static boolean useItem(String name,String... actions){
}).orElse(false);
}
public static boolean useItem(int id,String... actions){
return Inventory.search().hasId(id).first().flatMap(item -> {
return Inventory.search().withId(id).first().flatMap(item -> {
MousePackets.queueClickPacket();
WidgetPackets.queueWidgetAction(item,actions);
return Optional.of(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static boolean interact(String name, String... actions)

public static boolean interact(int id, String... actions)
{
return NPCs.search().hasId(id).first().flatMap(npc ->
return NPCs.search().withId(id).first().flatMap(npc ->
{
MousePackets.queueClickPacket();
NPCPackets.queueNPCAction(npc, actions);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/UpkeepPlugin/UpkeepPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void handleAction(String actionParam){
for (String item : items)
{
Optional<Widget> itemBeingUsed = StringUtils.isNumeric(item)?
Inventory.search().hasId(Integer.parseInt(item)).first():
Inventory.search().withId(Integer.parseInt(item)).first():
Inventory.search().matchesWildCardNoCase(item).first();
if(itemBeingUsed.isPresent()){
InventoryInteraction.useItem(itemBeingUsed.get(),action);
Expand Down

0 comments on commit ac24814

Please # to comment.