Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+32 -36
View File
@@ -7,9 +7,6 @@
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
@@ -19,7 +16,6 @@
// www.magicbane.com
package engine.net;
import engine.objects.PlayerCharacter;
@@ -35,40 +31,40 @@ import static engine.net.MessageDispatcher.itemPoolSize;
public class Dispatch {
private static final ConcurrentLinkedQueue<Dispatch> dispatchPool = new ConcurrentLinkedQueue<>();
public PlayerCharacter player;
public AbstractNetMsg msg;
public Dispatch(PlayerCharacter player, AbstractNetMsg msg) {
public PlayerCharacter player;
public AbstractNetMsg msg;
public Dispatch(PlayerCharacter player, AbstractNetMsg msg) {
this.player = player;
this.msg = msg;
}
public void reset() {
this.player = null;
this.msg = null;
}
public static Dispatch borrow(PlayerCharacter player, AbstractNetMsg msg) {
this.msg = msg;
}
Dispatch dispatch;
dispatch = dispatchPool.poll();
public static Dispatch borrow(PlayerCharacter player, AbstractNetMsg msg) {
if (dispatch == null) {
dispatch = new Dispatch(player, msg);
} else {
dispatch.player = player;
dispatch.msg = msg;
itemPoolSize.decrement();
}
return dispatch;
}
public void release() {
this.reset();
dispatchPool.add(this);
itemPoolSize.increment();
Dispatch dispatch;
dispatch = dispatchPool.poll();
if (dispatch == null) {
dispatch = new Dispatch(player, msg);
} else {
dispatch.player = player;
dispatch.msg = msg;
itemPoolSize.decrement();
}
return dispatch;
}
public void reset() {
this.player = null;
this.msg = null;
}
public void release() {
this.reset();
dispatchPool.add(this);
itemPoolSize.increment();
}
}