packet queue farded it
This commit is contained in:
parent
052493a807
commit
5859c856e2
3 changed files with 36 additions and 49 deletions
|
@ -4,7 +4,7 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="fix error i guess">
|
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="add fart !!!!!!!">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
@ -26,6 +26,19 @@
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
<option name="RESET_MODE" value="HARD" />
|
<option name="RESET_MODE" value="HARD" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="GitHubPullRequestSearchHistory">{
|
||||||
|
"lastFilter": {
|
||||||
|
"state": "OPEN"
|
||||||
|
}
|
||||||
|
}</component>
|
||||||
|
<component name="GithubPullRequestsUISettings">
|
||||||
|
<option name="selectedUrlAndAccountId">
|
||||||
|
<UrlAndAccount>
|
||||||
|
<option name="accountId" value="448850ab-5580-4617-8aca-31a71e900922" />
|
||||||
|
<option name="url" value="https://github.com/chomens/chomens-bot-java" />
|
||||||
|
</UrlAndAccount>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="MarkdownSettingsMigration">
|
<component name="MarkdownSettingsMigration">
|
||||||
<option name="stateVersion" value="1" />
|
<option name="stateVersion" value="1" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -98,20 +111,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680245437032</updated>
|
<updated>1680245437032</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00094" summary="readme i guess">
|
|
||||||
<created>1682133205362</created>
|
|
||||||
<option name="number" value="00094" />
|
|
||||||
<option name="presentableId" value="LOCAL-00094" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1682133205363</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00095" summary="change a bit mabe">
|
|
||||||
<created>1682141185843</created>
|
|
||||||
<option name="number" value="00095" />
|
|
||||||
<option name="presentableId" value="LOCAL-00095" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1682141185843</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00096" summary="improve reconnect i guess">
|
<task id="LOCAL-00096" summary="improve reconnect i guess">
|
||||||
<created>1682141715244</created>
|
<created>1682141715244</created>
|
||||||
<option name="number" value="00096" />
|
<option name="number" value="00096" />
|
||||||
|
@ -441,7 +440,21 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1682828334938</updated>
|
<updated>1682828334938</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="143" />
|
<task id="LOCAL-00143" summary="add packet queue for funni">
|
||||||
|
<created>1682838582771</created>
|
||||||
|
<option name="number" value="00143" />
|
||||||
|
<option name="presentableId" value="LOCAL-00143" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1682838582772</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00144" summary="add fart !!!!!!!">
|
||||||
|
<created>1682842148011</created>
|
||||||
|
<option name="number" value="00144" />
|
||||||
|
<option name="presentableId" value="LOCAL-00144" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1682842148011</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="145" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -456,8 +469,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="i forgor 1 thing lmfao" />
|
|
||||||
<MESSAGE value="gex" />
|
|
||||||
<MESSAGE value="make trusted broadcast log in console" />
|
<MESSAGE value="make trusted broadcast log in console" />
|
||||||
<MESSAGE value="add connecting message" />
|
<MESSAGE value="add connecting message" />
|
||||||
<MESSAGE value="add reconnect delay to each bot option (optional)" />
|
<MESSAGE value="add reconnect delay to each bot option (optional)" />
|
||||||
|
@ -481,7 +492,9 @@
|
||||||
<MESSAGE value="fix core?" />
|
<MESSAGE value="fix core?" />
|
||||||
<MESSAGE value="remove debug line ig" />
|
<MESSAGE value="remove debug line ig" />
|
||||||
<MESSAGE value="fix error i guess" />
|
<MESSAGE value="fix error i guess" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix error i guess" />
|
<MESSAGE value="add packet queue for funni" />
|
||||||
|
<MESSAGE value="add fart !!!!!!!" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="add fart !!!!!!!" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
|
|
@ -84,8 +84,6 @@ public class Bot {
|
||||||
Bot.this.ready();
|
Bot.this.ready();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
executor.scheduleAtFixedRate(this::tick, 0, 10, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ready () {
|
public void ready () {
|
||||||
|
@ -115,18 +113,6 @@ public class Bot {
|
||||||
reconnect();
|
reconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket (Packet packet) {
|
|
||||||
packetQueue.add(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tick () {
|
|
||||||
if (!loggedIn || packetQueue.size() == 0) return;
|
|
||||||
|
|
||||||
session.send(packetQueue.get(0));
|
|
||||||
|
|
||||||
packetQueue.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void reconnect () {
|
private void reconnect () {
|
||||||
for (Listener listener : listeners) {
|
for (Listener listener : listeners) {
|
||||||
listener.connecting();
|
listener.connecting();
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class BossbarManagerPlugin extends Bot.Listener {
|
||||||
private final Bot bot;
|
private final Bot bot;
|
||||||
|
|
||||||
private ScheduledFuture<?> tickTask;
|
private ScheduledFuture<?> tickTask;
|
||||||
private ScheduledFuture<?> updateTask;
|
|
||||||
|
|
||||||
private final Map<String, BossBar> bossBars = new HashMap<>();
|
private final Map<String, BossBar> bossBars = new HashMap<>();
|
||||||
|
|
||||||
|
@ -41,26 +40,11 @@ public class BossbarManagerPlugin extends Bot.Listener {
|
||||||
|
|
||||||
public void ready () {
|
public void ready () {
|
||||||
tickTask = bot.executor().scheduleAtFixedRate(this::tick, 0, 50, TimeUnit.MILLISECONDS);
|
tickTask = bot.executor().scheduleAtFixedRate(this::tick, 0, 50, TimeUnit.MILLISECONDS);
|
||||||
updateTask = bot.executor().scheduleAtFixedRate(this::update, 0, 500, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(DisconnectedEvent event) {
|
public void disconnected(DisconnectedEvent event) {
|
||||||
tickTask.cancel(true);
|
tickTask.cancel(true);
|
||||||
updateTask.cancel(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update() {
|
|
||||||
if (!enabled || actionbar) return;
|
|
||||||
for (Map.Entry<String, BossBar> _bossBar : bossBars.entrySet()) {
|
|
||||||
final String name = _bossBar.getKey();
|
|
||||||
final BossBar bossBar = _bossBar.getValue();
|
|
||||||
createBossBar(name, bossBar.players());
|
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " color " + bossBar.color().color);
|
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " visible " + bossBar.visible());
|
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " style " + bossBar.style().style);
|
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " max " + bossBar.max());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick () {
|
public void tick () {
|
||||||
|
@ -72,6 +56,10 @@ public class BossbarManagerPlugin extends Bot.Listener {
|
||||||
final String stringifiedComponent = GsonComponentSerializer.gson().serialize(bossBar.name());
|
final String stringifiedComponent = GsonComponentSerializer.gson().serialize(bossBar.name());
|
||||||
|
|
||||||
if (!actionbar) {
|
if (!actionbar) {
|
||||||
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " color " + bossBar.color().color);
|
||||||
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " visible " + bossBar.visible());
|
||||||
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " style " + bossBar.style().style);
|
||||||
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " max " + bossBar.max());
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " name " + stringifiedComponent);
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " name " + stringifiedComponent);
|
||||||
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " value " + bossBar.value());
|
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " value " + bossBar.value());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue