Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (c) 2018 Abex
- * Copyright (c) 2018, Zimaya <https://github.com/Zimaya>
- * Copyright (c) 2017, Adam <Adam@sigterm.info>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- package net.runelite.client.plugins.sandfilling;
- import com.google.common.base.Strings;
- import com.google.common.collect.ImmutableList;
- import lombok.Getter;
- import lombok.extern.slf4j.Slf4j;
- import net.runelite.api.*;
- import net.runelite.api.events.GameObjectSpawned;
- import net.runelite.api.events.GameStateChanged;
- import net.runelite.api.events.ItemContainerChanged;
- import net.runelite.client.callback.ClientThread;
- import net.runelite.client.eventbus.Subscribe;
- import net.runelite.client.plugins.Plugin;
- import net.runelite.client.plugins.PluginDescriptor;
- import net.runelite.client.ui.overlay.OverlayManager;
- import javax.inject.Inject;
- @PluginDescriptor(
- name = "Sandfilling"
- )
- @Slf4j
- public class SandFillingPlugin extends Plugin
- {
- @Inject
- private Client client;
- @Inject
- private OverlayManager overlayManager;
- @Inject
- private SandFillingOverlay overlay;
- @Getter
- private int emptyBuckets;
- @Override
- protected void startUp() throws Exception
- {
- System.out.println("Whats up");
- emptyBuckets = 0;
- overlayManager.add(overlay);
- }
- @Subscribe
- public void onGameStateChanged(final GameStateChanged event)
- {
- if ((event.getGameState() != GameState.LOGGED_IN))
- {
- return;
- }
- emptyBuckets = 0;
- for (Item item : client.getItemContainer(InventoryID.INVENTORY).getItems()){
- if(item.getId() == ItemID.BUCKET){
- emptyBuckets++;
- }
- }
- }
- @Override
- protected void shutDown() throws Exception
- {
- overlayManager.remove(overlay);
- }
- @Subscribe
- public void onItemContainerChanged(ItemContainerChanged event)
- {
- if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
- {
- return;
- }
- else if(event.getItemContainer() == client.getItemContainer(InventoryID.BANK)){
- }
- else{
- System.out.println("lool");
- emptyBuckets = 0;
- for (Item item : event.getItemContainer().getItems()){
- if(item.getId() == ItemID.BUCKET){
- emptyBuckets++;
- }
- }
- }
- }
- @Subscribe
- public void onGameObjectSpawned(GameObjectSpawned event)
- {
- final GameObject gameObject = event.getGameObject();
- System.out.println(event.getGameObject().getId());
- if(gameObject.getId() == ObjectID.SANDPIT){
- System.out.println("SANDPIT SPAWNED!!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement