Advertisement
Guest User

My bot.

a guest
Jan 15th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. /*
  2. * Copyright (c) 2018 Abex
  3. * Copyright (c) 2018, Zimaya <https://github.com/Zimaya>
  4. * Copyright (c) 2017, Adam <Adam@sigterm.info>
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright notice, this
  11. * list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright notice,
  13. * this list of conditions and the following disclaimer in the documentation
  14. * and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  20. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. package net.runelite.client.plugins.sandfilling;
  28.  
  29. import com.google.common.base.Strings;
  30. import com.google.common.collect.ImmutableList;
  31. import lombok.Getter;
  32. import lombok.extern.slf4j.Slf4j;
  33. import net.runelite.api.*;
  34. import net.runelite.api.events.GameObjectSpawned;
  35. import net.runelite.api.events.GameStateChanged;
  36. import net.runelite.api.events.ItemContainerChanged;
  37. import net.runelite.client.callback.ClientThread;
  38. import net.runelite.client.eventbus.Subscribe;
  39. import net.runelite.client.plugins.Plugin;
  40. import net.runelite.client.plugins.PluginDescriptor;
  41. import net.runelite.client.ui.overlay.OverlayManager;
  42.  
  43. import javax.inject.Inject;
  44.  
  45.  
  46. @PluginDescriptor(
  47. name = "Sandfilling"
  48. )
  49. @Slf4j
  50. public class SandFillingPlugin extends Plugin
  51. {
  52.  
  53. @Inject
  54. private Client client;
  55.  
  56. @Inject
  57. private OverlayManager overlayManager;
  58.  
  59. @Inject
  60. private SandFillingOverlay overlay;
  61.  
  62.  
  63. @Getter
  64. private int emptyBuckets;
  65.  
  66.  
  67. @Override
  68. protected void startUp() throws Exception
  69. {
  70. System.out.println("Whats up");
  71.  
  72. emptyBuckets = 0;
  73. overlayManager.add(overlay);
  74. }
  75.  
  76. @Subscribe
  77. public void onGameStateChanged(final GameStateChanged event)
  78. {
  79.  
  80. if ((event.getGameState() != GameState.LOGGED_IN))
  81. {
  82. return;
  83. }
  84.  
  85. emptyBuckets = 0;
  86.  
  87. for (Item item : client.getItemContainer(InventoryID.INVENTORY).getItems()){
  88. if(item.getId() == ItemID.BUCKET){
  89. emptyBuckets++;
  90. }
  91. }
  92.  
  93. }
  94.  
  95. @Override
  96. protected void shutDown() throws Exception
  97. {
  98. overlayManager.remove(overlay);
  99. }
  100.  
  101. @Subscribe
  102. public void onItemContainerChanged(ItemContainerChanged event)
  103. {
  104.  
  105. if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
  106. {
  107. return;
  108. }
  109.  
  110. else if(event.getItemContainer() == client.getItemContainer(InventoryID.BANK)){
  111.  
  112. }
  113.  
  114. else{
  115. System.out.println("lool");
  116. emptyBuckets = 0;
  117. for (Item item : event.getItemContainer().getItems()){
  118. if(item.getId() == ItemID.BUCKET){
  119. emptyBuckets++;
  120. }
  121. }
  122. }
  123.  
  124.  
  125.  
  126. }
  127.  
  128. @Subscribe
  129. public void onGameObjectSpawned(GameObjectSpawned event)
  130. {
  131.  
  132. final GameObject gameObject = event.getGameObject();
  133. System.out.println(event.getGameObject().getId());
  134. if(gameObject.getId() == ObjectID.SANDPIT){
  135. System.out.println("SANDPIT SPAWNED!!");
  136. }
  137. }
  138.  
  139.  
  140.  
  141.  
  142.  
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement