Zoe 7 Share Posted May 20, 2018 Play Time Plugin v1.1 I'm not sure if anyone uses plugins, but I quickly wrote this while looking at the API. About This Plugin: Adds a simple paint above the chat box to show how long you have been logged into the game for (useful for seeing log in time after breaks, world hopping etc as most scripts just show total run time). Changelog: 1.1 World hopping support added (Thank you Koschei) 1.0 Initial release. Download Link: https://www.dropbox.com/s/tzy223wyu36o3vi/PlayTime.jar?dl=0 Source: PlayTime.java package zoe.dreambot.plugin; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.time.Duration; import java.time.Instant; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import org.dreambot.api.Client; import org.dreambot.api.data.GameState; import org.dreambot.api.plugin.Plugin; import org.dreambot.api.plugin.PluginManifest; @PluginManifest(author = "Zoe", name = "Playtime Plugin", version = 1.1) public class PlayTime extends Plugin { private Instant loginTime; private Font font; private Client c; public void onStart() { font = new Font("Courier New", 1, 10); c = getClient(); } public void onPaint(Graphics g) { if (!c.isLoggedIn() || c.getGameState().equals(GameState.HOPPING)) { loginTime = null; return; } if (loginTime == null) { loginTime = Instant.now(); } g.setFont(font); g.setColor(Color.cyan); g.drawString(getLoginTime(), 10, 330); } private String getLoginTime() { Duration duration = Duration.between(loginTime, Instant.now()); LocalTime time = LocalTime.ofSecondOfDay(duration.getSeconds()); return time.format(DateTimeFormatter.ofPattern("HH:mm:ss")); } } Link to comment Share on other sites More sharing options...
Koschei 147 Share Posted May 20, 2018 Haven't heard of plugins for a long while now You can also check if they're hopping by using if (getClient().getGameState().equals(GameState.HOPPING)) Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted May 21, 2018 thanks : ) Link to comment Share on other sites More sharing options...
Zoe 7 Author Share Posted May 22, 2018 On 5/21/2018 at 9:41 AM, Koschei said: Haven't heard of plugins for a long while now You can also check if they're hopping by using if (getClient().getGameState().equals(GameState.HOPPING)) Thanks, I've quickly added it and also changed it to just text above the chat box. I don't see any way to edit widget texts or anything through the plugins though 😕 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.