hopefully fix the broken players plugin

This commit is contained in:
Chayapak 2023-04-22 06:45:35 +07:00
parent bd4ab8fb07
commit 87c35b9af7
2 changed files with 18 additions and 12 deletions

View file

@ -4,7 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="ig fix music filename mabe mabe">
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="probally fix bossbar plugin with actionbar mabe">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -94,13 +94,6 @@
<option name="presentableId" value="Default" />
<updated>1680245437032</updated>
</task>
<task id="LOCAL-00040" summary="make better disconnect message reason">
<created>1681016779914</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1681016779914</updated>
</task>
<task id="LOCAL-00041" summary="actually split the among us">
<created>1681108314320</created>
<option name="number" value="00041" />
@ -437,7 +430,14 @@
<option name="project" value="LOCAL" />
<updated>1682073074935</updated>
</task>
<option name="localTasksCounter" value="89" />
<task id="LOCAL-00089" summary="probally fix bossbar plugin with actionbar mabe">
<created>1682085844904</created>
<option name="number" value="00089" />
<option name="presentableId" value="LOCAL-00089" />
<option name="project" value="LOCAL" />
<updated>1682085844904</updated>
</task>
<option name="localTasksCounter" value="90" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -452,7 +452,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="hopefully fix the core problem?" />
<MESSAGE value="maybe patch the sus" />
<MESSAGE value="fix music list&#10;it took me ages to figure this out that i need to just &#10;CLONE THE LIST" />
<MESSAGE value="actually make creator configurable instead of hardcoding" />
@ -477,7 +476,8 @@
<MESSAGE value="1.19.4 + add stuff (kinda broken ..,,.)" />
<MESSAGE value="add/improve/fix stuff&#10;ig mabe mabe mabe&#10;useCore!1!1!" />
<MESSAGE value="ig fix music filename mabe mabe" />
<option name="LAST_COMMIT_MESSAGE" value="ig fix music filename mabe mabe" />
<MESSAGE value="probally fix bossbar plugin with actionbar mabe" />
<option name="LAST_COMMIT_MESSAGE" value="probally fix bossbar plugin with actionbar mabe" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View file

@ -6,6 +6,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
import com.github.steveice10.packetlib.event.session.SessionAdapter;
import com.github.steveice10.packetlib.packet.Packet;
import land.chipmunk.chayapak.chomens_bot.Bot;
@ -17,7 +18,7 @@ import java.util.*;
public class PlayersPlugin extends SessionAdapter {
private final Bot bot;
@Getter private List<MutablePlayerListEntry> list = new ArrayList<>();
@Getter private final List<MutablePlayerListEntry> list = new ArrayList<>();
private final List<PlayerListener> listeners = new ArrayList<>();
@ -189,6 +190,11 @@ public class PlayersPlugin extends SessionAdapter {
});
}
@Override
public void disconnected(DisconnectedEvent event) {
list.clear();
}
public void addListener (PlayerListener listener) { listeners.add(listener); }
public static class PlayerListener {