Merge pull request #3284 from skykatik/cleanup-2

Cleanup
This commit is contained in:
Anuken
2020-11-09 12:38:02 -05:00
committed by GitHub
41 changed files with 126 additions and 181 deletions

View File

@@ -445,13 +445,12 @@ public class Pathfinder implements Runnable{
public void getPositions(IntSeq out){ public void getPositions(IntSeq out){
out.add(Point2.pack(World.toTile(position.getX()), World.toTile(position.getY()))); out.add(Point2.pack(World.toTile(position.getX()), World.toTile(position.getY())));
} }
} }
/** /**
* Data for a flow field to some set of destinations. * Data for a flow field to some set of destinations.
* Concrete subclasses must specify a way to fetch costs and destinations. * Concrete subclasses must specify a way to fetch costs and destinations.
* */ */
public static abstract class Flowfield{ public static abstract class Flowfield{
/** Refresh rate in milliseconds. Return any number <= 0 to disable. */ /** Refresh rate in milliseconds. Return any number <= 0 to disable. */
protected int refreshRate; protected int refreshRate;

View File

@@ -17,10 +17,8 @@ import arc.struct.*;
* @author davebaol * @author davebaol
*/ */
public class Formation{ public class Formation{
/** A list of slots assignments. */ /** A list of slots assignments. */
public Seq<SlotAssignment> slotAssignments; public Seq<SlotAssignment> slotAssignments;
/** The anchor point of this formation. */ /** The anchor point of this formation. */
public Vec3 anchor; public Vec3 anchor;
/** The formation pattern */ /** The formation pattern */
@@ -138,7 +136,6 @@ public class Formation{
* @return {@code false} if no more slots are available; {@code true} otherwise. * @return {@code false} if no more slots are available; {@code true} otherwise.
*/ */
public boolean addMember(FormationMember member){ public boolean addMember(FormationMember member){
// Check if the pattern supports one more slot // Check if the pattern supports one more slot
if(pattern.supportsSlots(slotAssignments.size + 1)){ if(pattern.supportsSlots(slotAssignments.size + 1)){
// Add a new slot assignment // Add a new slot assignment

View File

@@ -16,8 +16,9 @@ public class FreeSlotAssignmentStrategy implements SlotAssignmentStrategy{
public void updateSlotAssignments(Seq<SlotAssignment> assignments){ public void updateSlotAssignments(Seq<SlotAssignment> assignments){
// A very simple assignment algorithm: we simply go through // A very simple assignment algorithm: we simply go through
// each assignment in the list and assign sequential slot numbers // each assignment in the list and assign sequential slot numbers
for(int i = 0; i < assignments.size; i++) for(int i = 0; i < assignments.size; i++){
assignments.get(i).slotNumber = i; assignments.get(i).slotNumber = i;
}
} }
@Override @Override

View File

@@ -51,7 +51,6 @@ public class SoftRoleSlotAssignmentStrategy extends BoundedSlotAssignmentStrateg
@Override @Override
public void updateSlotAssignments(Seq<SlotAssignment> assignments){ public void updateSlotAssignments(Seq<SlotAssignment> assignments){
// Holds a list of member and slot data for each member. // Holds a list of member and slot data for each member.
Seq<MemberAndSlots> memberData = new Seq<>(); Seq<MemberAndSlots> memberData = new Seq<>();
@@ -125,7 +124,6 @@ public class SoftRoleSlotAssignmentStrategy extends BoundedSlotAssignmentStrateg
// Some sensible action should be taken, such as reporting to the player. // Some sensible action should be taken, such as reporting to the player.
throw new ArcRuntimeException("SoftRoleSlotAssignmentStrategy cannot find valid slot assignment for member " + memberDatum.member); throw new ArcRuntimeException("SoftRoleSlotAssignmentStrategy cannot find valid slot assignment for member " + memberDatum.member);
} }
} }
static class CostAndSlot implements Comparable<CostAndSlot>{ static class CostAndSlot implements Comparable<CostAndSlot>{

View File

@@ -71,7 +71,7 @@ public class BuilderAI extends AIController{
Units.nearby(unit.team, unit.x, unit.y, buildRadius, u -> { Units.nearby(unit.team, unit.x, unit.y, buildRadius, u -> {
if(found) return; if(found) return;
if(u instanceof Builderc b && u != unit && ((Builderc)u).activelyBuilding()){ if(u instanceof Builderc b && u != unit && b.activelyBuilding()){
BuildPlan plan = b.buildPlan(); BuildPlan plan = b.buildPlan();
Building build = world.build(plan.x, plan.y); Building build = world.build(plan.x, plan.y);
@@ -119,7 +119,7 @@ public class BuilderAI extends AIController{
public boolean useFallback(){ public boolean useFallback(){
return state.rules.waves && unit.team == state.rules.waveTeam && !unit.team.rules().ai; return state.rules.waves && unit.team == state.rules.waveTeam && !unit.team.rules().ai;
} }
@Override @Override
public boolean shouldShoot(){ public boolean shouldShoot(){
return !((Builderc)unit).isBuilding(); return !((Builderc)unit).isBuilding();

View File

@@ -79,5 +79,4 @@ public class MinerAI extends AIController{
@Override @Override
protected void updateTargeting(){ protected void updateTargeting(){
} }
} }

View File

@@ -36,12 +36,11 @@ public class RepairAI extends AIController{
Building target = Units.findDamagedTile(unit.team, unit.x, unit.y); Building target = Units.findDamagedTile(unit.team, unit.x, unit.y);
if(target instanceof ConstructBuild) target = null; if(target instanceof ConstructBuild) target = null;
if(target == null){ if(target == null){
super.updateTargeting(); super.updateTargeting();
}else{ }else{
this.target = target; this.target = target;
} }
} }
} }

View File

@@ -31,7 +31,7 @@ public class SuicideAI extends GroundAI{
if(!Units.invalidateTarget(target, unit, unit.range()) && unit.hasWeapons()){ if(!Units.invalidateTarget(target, unit, unit.range()) && unit.hasWeapons()){
rotate = true; rotate = true;
shoot = unit.within(target, unit.type.weapons.first().bullet.range() + shoot = unit.within(target, unit.type.weapons.first().bullet.range() +
(target instanceof Building ? ((Building)target).block.size * Vars.tilesize / 2f : ((Hitboxc)target).hitSize() / 2f)); (target instanceof Building b ? b.block.size * Vars.tilesize / 2f : ((Hitboxc)target).hitSize() / 2f));
if(unit.type.hasWeapons()){ if(unit.type.hasWeapons()){
unit.aimLook(Predict.intercept(unit, target, unit.type.weapons.first().bullet.speed)); unit.aimLook(Predict.intercept(unit, target, unit.type.weapons.first().bullet.speed));
@@ -68,7 +68,6 @@ public class SuicideAI extends GroundAI{
unit.moveAt(vec.set(target).sub(unit).limit(unit.speed())); unit.moveAt(vec.set(target).sub(unit).limit(unit.speed()));
} }
} }
} }
if(!moveToTarget){ if(!moveToTarget){

View File

@@ -389,7 +389,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
}); });
}), }),
hitBulletBig = new Effect(13, e -> { hitBulletBig = new Effect(13, e -> {
@@ -400,7 +399,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1.5f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1.5f);
}); });
}), }),
hitFlameSmall = new Effect(14, e -> { hitFlameSmall = new Effect(14, e -> {
@@ -411,7 +409,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
}); });
}), }),
hitLiquid = new Effect(16, e -> { hitLiquid = new Effect(16, e -> {
@@ -420,7 +417,6 @@ public class Fx{
randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 60f, (x, y) -> { randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 60f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f); Fill.circle(e.x + x, e.y + y, e.fout() * 2f);
}); });
}), }),
hitLancer = new Effect(12, e -> { hitLancer = new Effect(12, e -> {
@@ -431,7 +427,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
}); });
}), }),
hitMeltdown = new Effect(12, e -> { hitMeltdown = new Effect(12, e -> {
@@ -442,7 +437,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
}); });
}), }),
hitMeltHeal = new Effect(12, e -> { hitMeltHeal = new Effect(12, e -> {
@@ -453,7 +447,6 @@ public class Fx{
float ang = Mathf.angle(x, y); float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f); lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
}); });
}), }),
instBomb = new Effect(15f, 100f, e -> { instBomb = new Effect(15f, 100f, e -> {
@@ -553,8 +546,8 @@ public class Fx{
}), }),
flakExplosion = new Effect(20, e -> { flakExplosion = new Effect(20, e -> {
color(Pal.bulletYellow); color(Pal.bulletYellow);
e.scaled(6, i -> { e.scaled(6, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 10f); Lines.circle(e.x, e.y, 3f + i.fin() * 10f);
@@ -572,12 +565,11 @@ public class Fx{
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
plasticExplosion = new Effect(24, e -> { plasticExplosion = new Effect(24, e -> {
color(Pal.plastaniumFront); color(Pal.plastaniumFront);
e.scaled(7, i -> { e.scaled(7, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 24f); Lines.circle(e.x, e.y, 3f + i.fin() * 24f);
@@ -595,12 +587,11 @@ public class Fx{
randLenVectors(e.id + 1, 4, 1f + 25f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 4, 1f + 25f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
plasticExplosionFlak = new Effect(28, e -> { plasticExplosionFlak = new Effect(28, e -> {
color(Pal.plastaniumFront); color(Pal.plastaniumFront);
e.scaled(7, i -> { e.scaled(7, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 34f); Lines.circle(e.x, e.y, 3f + i.fin() * 34f);
@@ -618,12 +609,11 @@ public class Fx{
randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
blastExplosion = new Effect(22, e -> { blastExplosion = new Effect(22, e -> {
color(Pal.missileYellow); color(Pal.missileYellow);
e.scaled(6, i -> { e.scaled(6, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 15f); Lines.circle(e.x, e.y, 3f + i.fin() * 15f);
@@ -641,12 +631,11 @@ public class Fx{
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
sapExplosion = new Effect(25, e -> { sapExplosion = new Effect(25, e -> {
color(Pal.sapBullet); color(Pal.sapBullet);
e.scaled(6, i -> { e.scaled(6, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 80f); Lines.circle(e.x, e.y, 3f + i.fin() * 80f);
@@ -664,12 +653,11 @@ public class Fx{
randLenVectors(e.id + 1, 8, 1f + 60f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 8, 1f + 60f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
massiveExplosion = new Effect(30, e -> { massiveExplosion = new Effect(30, e -> {
color(Pal.missileYellow); color(Pal.missileYellow);
e.scaled(7, i -> { e.scaled(7, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 4f + i.fin() * 30f); Lines.circle(e.x, e.y, 4f + i.fin() * 30f);
@@ -687,7 +675,6 @@ public class Fx{
randLenVectors(e.id + 1, 6, 1f + 29f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 6, 1f + 29f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 4f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 4f);
}); });
}), }),
artilleryTrail = new Effect(50, e -> { artilleryTrail = new Effect(50, e -> {
@@ -712,8 +699,8 @@ public class Fx{
}), }),
flakExplosionBig = new Effect(30, e -> { flakExplosionBig = new Effect(30, e -> {
color(Pal.bulletYellowBack); color(Pal.bulletYellowBack);
e.scaled(6, i -> { e.scaled(6, i -> {
stroke(3f * i.fout()); stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 25f); Lines.circle(e.x, e.y, 3f + i.fin() * 25f);
@@ -731,7 +718,6 @@ public class Fx{
randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
burning = new Effect(35f, e -> { burning = new Effect(35f, e -> {
@@ -740,7 +726,6 @@ public class Fx{
randLenVectors(e.id, 3, 2f + e.fin() * 7f, (x, y) -> { randLenVectors(e.id, 3, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.1f + e.fout() * 1.4f); Fill.circle(e.x + x, e.y + y, 0.1f + e.fout() * 1.4f);
}); });
}), }),
fire = new Effect(50f, e -> { fire = new Effect(50f, e -> {
@@ -761,7 +746,6 @@ public class Fx{
randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> { randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f); Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f);
}); });
}), }),
steam = new Effect(35f, e -> { steam = new Effect(35f, e -> {
@@ -770,7 +754,6 @@ public class Fx{
randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> { randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f); Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f);
}); });
}), }),
fireballsmoke = new Effect(25f, e -> { fireballsmoke = new Effect(25f, e -> {
@@ -779,7 +762,6 @@ public class Fx{
randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> { randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f); Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f);
}); });
}), }),
ballfire = new Effect(25f, e -> { ballfire = new Effect(25f, e -> {
@@ -788,7 +770,6 @@ public class Fx{
randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> { randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f); Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f);
}); });
}), }),
freezing = new Effect(40f, e -> { freezing = new Effect(40f, e -> {
@@ -797,7 +778,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> { randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.2f); Fill.circle(e.x + x, e.y + y, e.fout() * 1.2f);
}); });
}), }),
melting = new Effect(40f, e -> { melting = new Effect(40f, e -> {
@@ -806,7 +786,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + e.fin() * 3f, (x, y) -> { randLenVectors(e.id, 2, 1f + e.fin() * 3f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, .2f + e.fout() * 1.2f); Fill.circle(e.x + x, e.y + y, .2f + e.fout() * 1.2f);
}); });
}), }),
wet = new Effect(80f, e -> { wet = new Effect(80f, e -> {
@@ -815,7 +794,7 @@ public class Fx{
Fill.circle(e.x, e.y, e.fout() * 1f); Fill.circle(e.x, e.y, e.fout() * 1f);
}), }),
muddy = new Effect(80f, e -> { muddy = new Effect(80f, e -> {
color(Color.valueOf("432722")); color(Color.valueOf("432722"));
alpha(Mathf.clamp(e.fin() * 2f)); alpha(Mathf.clamp(e.fin() * 2f));
@@ -829,7 +808,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> { randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.square(e.x + x, e.y + y, e.fslope() * 1.1f, 45f); Fill.square(e.x + x, e.y + y, e.fslope() * 1.1f, 45f);
}); });
}), }),
sporeSlowed = new Effect(40f, e -> { sporeSlowed = new Effect(40f, e -> {
@@ -844,7 +822,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> { randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f); Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
}); });
}), }),
overdriven = new Effect(20f, e -> { overdriven = new Effect(20f, e -> {
@@ -853,7 +830,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> { randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.square(e.x + x, e.y + y, e.fout() * 2.3f + 0.5f); Fill.square(e.x + x, e.y + y, e.fout() * 2.3f + 0.5f);
}); });
}), }),
overclocked = new Effect(50f, e -> { overclocked = new Effect(50f, e -> {
@@ -962,7 +938,6 @@ public class Fx{
randLenVectors(e.id + 1, 9, 1f + 23f * e.finpow(), (x, y) -> { randLenVectors(e.id + 1, 9, 1f + 23f * e.finpow(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
}); });
}), }),
blockExplosionSmoke = new Effect(30, e -> { blockExplosionSmoke = new Effect(30, e -> {
@@ -972,7 +947,6 @@ public class Fx{
Fill.circle(e.x + x, e.y + y, e.fout() * 3f); Fill.circle(e.x + x, e.y + y, e.fout() * 3f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f); Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
}); });
}), }),
shootSmall = new Effect(8, e -> { shootSmall = new Effect(8, e -> {
@@ -1002,7 +976,6 @@ public class Fx{
randLenVectors(e.id, 5, e.finpow() * 6f, e.rotation, 20f, (x, y) -> { randLenVectors(e.id, 5, e.finpow() * 6f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.5f); Fill.circle(e.x + x, e.y + y, e.fout() * 1.5f);
}); });
}), }),
shootBig = new Effect(9, e -> { shootBig = new Effect(9, e -> {
@@ -1025,7 +998,6 @@ public class Fx{
randLenVectors(e.id, 8, e.finpow() * 19f, e.rotation, 10f, (x, y) -> { randLenVectors(e.id, 8, e.finpow() * 19f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f + 0.2f); Fill.circle(e.x + x, e.y + y, e.fout() * 2f + 0.2f);
}); });
}), }),
shootBigSmoke2 = new Effect(18f, e -> { shootBigSmoke2 = new Effect(18f, e -> {
@@ -1034,7 +1006,6 @@ public class Fx{
randLenVectors(e.id, 9, e.finpow() * 23f, e.rotation, 20f, (x, y) -> { randLenVectors(e.id, 9, e.finpow() * 23f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2.4f + 0.2f); Fill.circle(e.x + x, e.y + y, e.fout() * 2.4f + 0.2f);
}); });
}), }),
shootSmallFlame = new Effect(32f, 80f, e -> { shootSmallFlame = new Effect(32f, 80f, e -> {
@@ -1043,7 +1014,6 @@ public class Fx{
randLenVectors(e.id, 8, e.finpow() * 60f, e.rotation, 10f, (x, y) -> { randLenVectors(e.id, 8, e.finpow() * 60f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.65f + e.fout() * 1.5f); Fill.circle(e.x + x, e.y + y, 0.65f + e.fout() * 1.5f);
}); });
}), }),
shootPyraFlame = new Effect(33f, 80f, e -> { shootPyraFlame = new Effect(33f, 80f, e -> {
@@ -1052,7 +1022,6 @@ public class Fx{
randLenVectors(e.id, 10, e.finpow() * 70f, e.rotation, 10f, (x, y) -> { randLenVectors(e.id, 10, e.finpow() * 70f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.65f + e.fout() * 1.6f); Fill.circle(e.x + x, e.y + y, 0.65f + e.fout() * 1.6f);
}); });
}), }),
shootLiquid = new Effect(40f, 80f, e -> { shootLiquid = new Effect(40f, 80f, e -> {
@@ -1061,7 +1030,6 @@ public class Fx{
randLenVectors(e.id, 6, e.finpow() * 60f, e.rotation, 11f, (x, y) -> { randLenVectors(e.id, 6, e.finpow() * 60f, e.rotation, 11f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.5f + e.fout() * 2.5f); Fill.circle(e.x + x, e.y + y, 0.5f + e.fout() * 2.5f);
}); });
}), }),
casing1 = new Effect(30f, e -> { casing1 = new Effect(30f, e -> {
@@ -1197,7 +1165,6 @@ public class Fx{
for(int i : Mathf.signs){ for(int i : Mathf.signs){
Drawf.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f * i); Drawf.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f * i);
} }
}), }),
lancerLaserShootSmoke = new Effect(26f, e -> { lancerLaserShootSmoke = new Effect(26f, e -> {
@@ -1207,7 +1174,6 @@ public class Fx{
randLenVectors(e.id, 7, length, e.rotation, 0f, (x, y) -> { randLenVectors(e.id, 7, length, e.rotation, 0f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f);
}); });
}), }),
lancerLaserCharge = new Effect(38f, e -> { lancerLaserCharge = new Effect(38f, e -> {
@@ -1216,7 +1182,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> { randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 3f + 1f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 3f + 1f);
}); });
}), }),
lancerLaserChargeBegin = new Effect(60f, e -> { lancerLaserChargeBegin = new Effect(60f, e -> {
@@ -1233,7 +1198,6 @@ public class Fx{
randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> { randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
Drawf.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y)); Drawf.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
}); });
}), }),
sparkShoot = new Effect(12f, e -> { sparkShoot = new Effect(12f, e -> {
@@ -1243,7 +1207,6 @@ public class Fx{
randLenVectors(e.id, 7, 25f * e.finpow(), e.rotation, 3f, (x, y) -> { randLenVectors(e.id, 7, 25f * e.finpow(), e.rotation, 3f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 5f + 0.5f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 5f + 0.5f);
}); });
}), }),
lightningShoot = new Effect(12f, e -> { lightningShoot = new Effect(12f, e -> {
@@ -1372,21 +1335,21 @@ public class Fx{
Fill.square(e.x + x, e.y + y, e.fout() * 2.5f + 0.5f, 45); Fill.square(e.x + x, e.y + y, e.fout() * 2.5f + 0.5f, 45);
}); });
}), }),
pulverizeSmall = new Effect(30, e -> { pulverizeSmall = new Effect(30, e -> {
randLenVectors(e.id, 3, e.fin() * 5f, (x, y) -> { randLenVectors(e.id, 3, e.fin() * 5f, (x, y) -> {
color(Pal.stoneGray); color(Pal.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45); Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
}); });
}), }),
pulverizeMedium = new Effect(30, e -> { pulverizeMedium = new Effect(30, e -> {
randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> { randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
color(Pal.stoneGray); color(Pal.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45); Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
}); });
}), }),
producesmoke = new Effect(12, e -> { producesmoke = new Effect(12, e -> {
randLenVectors(e.id, 8, 4f + e.fin() * 18f, (x, y) -> { randLenVectors(e.id, 8, 4f + e.fin() * 18f, (x, y) -> {
color(Color.white, Pal.accent, e.fin()); color(Color.white, Pal.accent, e.fin());
@@ -1401,21 +1364,21 @@ public class Fx{
Fill.circle(e.x + x, e.y + y, 0.5f + fout * 4f); Fill.circle(e.x + x, e.y + y, 0.5f + fout * 4f);
}); });
}), }),
smeltsmoke = new Effect(15, e -> { smeltsmoke = new Effect(15, e -> {
randLenVectors(e.id, 6, 4f + e.fin() * 5f, (x, y) -> { randLenVectors(e.id, 6, 4f + e.fin() * 5f, (x, y) -> {
color(Color.white, e.color, e.fin()); color(Color.white, e.color, e.fin());
Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45); Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45);
}); });
}), }),
formsmoke = new Effect(40, e -> { formsmoke = new Effect(40, e -> {
randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> { randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> {
color(Pal.plasticSmoke, Color.lightGray, e.fin()); color(Pal.plasticSmoke, Color.lightGray, e.fin());
Fill.square(e.x + x, e.y + y, 0.2f + e.fout() * 2f, 45); Fill.square(e.x + x, e.y + y, 0.2f + e.fout() * 2f, 45);
}); });
}), }),
blastsmoke = new Effect(26, e -> { blastsmoke = new Effect(26, e -> {
randLenVectors(e.id, 12, 1f + e.fin() * 23f, (x, y) -> { randLenVectors(e.id, 12, 1f + e.fin() * 23f, (x, y) -> {
float size = 2f + e.fout() * 6f; float size = 2f + e.fout() * 6f;
@@ -1423,7 +1386,7 @@ public class Fx{
Fill.circle(e.x + x, e.y + y, size/2f); Fill.circle(e.x + x, e.y + y, size/2f);
}); });
}), }),
lava = new Effect(18, e -> { lava = new Effect(18, e -> {
randLenVectors(e.id, 3, 1f + e.fin() * 10f, (x, y) -> { randLenVectors(e.id, 3, 1f + e.fin() * 10f, (x, y) -> {
float size = e.fslope() * 4f; float size = e.fslope() * 4f;
@@ -1431,50 +1394,58 @@ public class Fx{
Fill.circle(e.x + x, e.y + y, size/2f); Fill.circle(e.x + x, e.y + y, size/2f);
}); });
}), }),
dooropen = new Effect(10, e -> { dooropen = new Effect(10, e -> {
stroke(e.fout() * 1.6f); stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 2f); Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 2f);
}), }),
doorclose = new Effect(10, e -> { doorclose = new Effect(10, e -> {
stroke(e.fout() * 1.6f); stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fout() * 2f); Lines.square(e.x, e.y, tilesize / 2f + e.fout() * 2f);
}), }),
dooropenlarge = new Effect(10, e -> { dooropenlarge = new Effect(10, e -> {
stroke(e.fout() * 1.6f); stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fin() * 2f); Lines.square(e.x, e.y, tilesize + e.fin() * 2f);
}), }),
doorcloselarge = new Effect(10, e -> { doorcloselarge = new Effect(10, e -> {
stroke(e.fout() * 1.6f); stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fout() * 2f); Lines.square(e.x, e.y, tilesize + e.fout() * 2f);
}), }),
purify = new Effect(10, e -> { purify = new Effect(10, e -> {
color(Color.royal, Color.gray, e.fin()); color(Color.royal, Color.gray, e.fin());
stroke(2f); stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
}), }),
purifyoil = new Effect(10, e -> { purifyoil = new Effect(10, e -> {
color(Color.black, Color.gray, e.fin()); color(Color.black, Color.gray, e.fin());
stroke(2f); stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
}), }),
purifystone = new Effect(10, e -> { purifystone = new Effect(10, e -> {
color(Color.orange, Color.gray, e.fin()); color(Color.orange, Color.gray, e.fin());
stroke(2f); stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
}), }),
generate = new Effect(11, e -> { generate = new Effect(11, e -> {
color(Color.orange, Color.yellow, e.fin()); color(Color.orange, Color.yellow, e.fin());
stroke(1f); stroke(1f);
Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8); Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8);
}), }),
mine = new Effect(20, e -> { mine = new Effect(20, e -> {
randLenVectors(e.id, 6, 3f + e.fin() * 6f, (x, y) -> { randLenVectors(e.id, 6, 3f + e.fin() * 6f, (x, y) -> {
color(e.color, Color.lightGray, e.fin()); color(e.color, Color.lightGray, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2f, 45); Fill.square(e.x + x, e.y + y, e.fout() * 2f, 45);
}); });
}), }),
mineBig = new Effect(30, e -> { mineBig = new Effect(30, e -> {
randLenVectors(e.id, 6, 4f + e.fin() * 8f, (x, y) -> { randLenVectors(e.id, 6, 4f + e.fin() * 8f, (x, y) -> {
color(e.color, Color.lightGray, e.fin()); color(e.color, Color.lightGray, e.fin());
@@ -1488,12 +1459,14 @@ public class Fx{
Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.5f, 45); Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.5f, 45);
}); });
}), }),
smelt = new Effect(20, e -> { smelt = new Effect(20, e -> {
randLenVectors(e.id, 6, 2f + e.fin() * 5f, (x, y) -> { randLenVectors(e.id, 6, 2f + e.fin() * 5f, (x, y) -> {
color(Color.white, e.color, e.fin()); color(Color.white, e.color, e.fin());
Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45); Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45);
}); });
}), }),
teleportActivate = new Effect(50, e -> { teleportActivate = new Effect(50, e -> {
color(e.color); color(e.color);
@@ -1507,8 +1480,8 @@ public class Fx{
randLenVectors(e.id, 30, 4f + 40f * e.fin(), (x, y) -> { randLenVectors(e.id, 30, 4f + 40f * e.fin(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
}); });
}), }),
teleport = new Effect(60, e -> { teleport = new Effect(60, e -> {
color(e.color); color(e.color);
stroke(e.fin() * 2f); stroke(e.fin() * 2f);
@@ -1517,8 +1490,8 @@ public class Fx{
randLenVectors(e.id, 20, 6f + 20f * e.fout(), (x, y) -> { randLenVectors(e.id, 20, 6f + 20f * e.fout(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
}); });
}), }),
teleportOut = new Effect(20, e -> { teleportOut = new Effect(20, e -> {
color(e.color); color(e.color);
stroke(e.fout() * 2f); stroke(e.fout() * 2f);
@@ -1527,7 +1500,6 @@ public class Fx{
randLenVectors(e.id, 20, 4f + 20f * e.fin(), (x, y) -> { randLenVectors(e.id, 20, 4f + 20f * e.fin(), (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 4f + 1f); lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 4f + 1f);
}); });
}), }),
ripple = new Effect(30, e -> { ripple = new Effect(30, e -> {
@@ -1611,7 +1583,6 @@ public class Fx{
float radius = unit.hitSize() * 1.3f; float radius = unit.hitSize() * 1.3f;
e.scaled(16f, c -> { e.scaled(16f, c -> {
color(Pal.shield); color(Pal.shield);
stroke(c.fout() * 2f + 0.1f); stroke(c.fout() * 2f + 0.1f);

View File

@@ -160,8 +160,8 @@ public class ContentLoader{
public void removeLast(){ public void removeLast(){
if(lastAdded != null && contentMap[lastAdded.getContentType().ordinal()].peek() == lastAdded){ if(lastAdded != null && contentMap[lastAdded.getContentType().ordinal()].peek() == lastAdded){
contentMap[lastAdded.getContentType().ordinal()].pop(); contentMap[lastAdded.getContentType().ordinal()].pop();
if(lastAdded instanceof MappableContent){ if(lastAdded instanceof MappableContent c){
contentNameMap[lastAdded.getContentType().ordinal()].remove(((MappableContent)lastAdded).name); contentNameMap[lastAdded.getContentType().ordinal()].remove(c.name);
} }
} }
} }

View File

@@ -12,6 +12,7 @@ import arc.util.*;
import mindustry.audio.*; import mindustry.audio.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.core.GameState.*; import mindustry.core.GameState.*;
import mindustry.ctype.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
@@ -290,7 +291,7 @@ public class Control implements ApplicationListener, Loadable{
//reset win wave?? //reset win wave??
state.rules.winWave = state.rules.attackMode ? -1 : sector.preset != null ? sector.preset.captureWave : 40; state.rules.winWave = state.rules.attackMode ? -1 : sector.preset != null ? sector.preset.captureWave : 40;
//kill all units, since they should be dead anwyay //kill all units, since they should be dead anyway
Groups.unit.clear(); Groups.unit.clear();
Groups.fire.clear(); Groups.fire.clear();
@@ -400,8 +401,8 @@ public class Control implements ApplicationListener, Loadable{
try{ try{
SaveIO.save(control.saves.getCurrent().file); SaveIO.save(control.saves.getCurrent().file);
Log.info("Saved on exit."); Log.info("Saved on exit.");
}catch(Throwable e){ }catch(Throwable t){
e.printStackTrace(); Log.err(t);
} }
} }

View File

@@ -326,5 +326,4 @@ public class Logic implements ApplicationListener{
public boolean isWaitingWave(){ public boolean isWaitingWave(){
return (state.rules.waitEnemies || (state.wave >= state.rules.winWave && state.rules.winWave > 0)) && state.enemies > 0; return (state.rules.waitEnemies || (state.wave >= state.rules.winWave && state.rules.winWave > 0)) && state.enemies > 0;
} }
} }

View File

@@ -32,7 +32,7 @@ import static mindustry.Vars.*;
public class NetClient implements ApplicationListener{ public class NetClient implements ApplicationListener{
private static final float dataTimeout = 60 * 18; private static final float dataTimeout = 60 * 18;
private static final float playerSyncTime = 2; private static final float playerSyncTime = 2;
public final static float viewScale = 2f; public static final float viewScale = 2f;
private long ping; private long ping;
private Interval timer = new Interval(5); private Interval timer = new Interval(5);
@@ -234,7 +234,7 @@ public class NetClient implements ApplicationListener{
ui.join.connect(ip, port); ui.join.connect(ip, port);
} }
@Remote(targets = Loc.client) @Remote(targets = Loc.client)
public static void ping(Player player, long time){ public static void ping(Player player, long time){
Call.pingResponse(player.con, time); Call.pingResponse(player.con, time);
@@ -439,7 +439,7 @@ public class NetClient implements ApplicationListener{
tile.build.readAll(Reads.get(input), tile.build.version()); tile.build.readAll(Reads.get(input), tile.build.version());
} }
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); Log.err(e);
} }
} }
@@ -577,8 +577,8 @@ public class NetClient implements ApplicationListener{
//prevent buffer overflow by checking config length //prevent buffer overflow by checking config length
for(int i = 0; i < usedRequests; i++){ for(int i = 0; i < usedRequests; i++){
BuildPlan plan = player.builder().plans().get(i); BuildPlan plan = player.builder().plans().get(i);
if(plan.config instanceof byte[]){ if(plan.config instanceof byte[] b){
int length = ((byte[])plan.config).length; int length = b.length;
totalLength += length; totalLength += length;
} }
@@ -604,7 +604,7 @@ public class NetClient implements ApplicationListener{
unit.x, unit.y, unit.x, unit.y,
player.unit().aimX(), player.unit().aimY(), player.unit().aimX(), player.unit().aimY(),
unit.rotation, unit.rotation,
unit instanceof Mechc ? ((Mechc)unit).baseRotation() : 0, unit instanceof Mechc m ? m.baseRotation() : 0,
unit.vel.x, unit.vel.y, unit.vel.x, unit.vel.y,
player.miner().mineTile(), player.miner().mineTile(),
player.boosting, player.shooting, ui.chatfrag.shown(), control.input.isBuilding, player.boosting, player.shooting, ui.chatfrag.shown(), control.input.isBuilding,

View File

@@ -164,7 +164,7 @@ public class NetServer implements ApplicationListener{
info.id = packet.uuid; info.id = packet.uuid;
admins.save(); admins.save();
Call.infoMessage(con, "You are not whitelisted here."); Call.infoMessage(con, "You are not whitelisted here.");
Log.info("&lcDo &lywhitelist-add @&lc to whitelist the player &lb'@'", packet.uuid, packet.name); info("&lcDo &lywhitelist-add @&lc to whitelist the player &lb'@'", packet.uuid, packet.name);
con.kick(KickReason.whitelist); con.kick(KickReason.whitelist);
return; return;
} }
@@ -226,8 +226,8 @@ public class NetServer implements ApplicationListener{
writeBuffer.reset(); writeBuffer.reset();
player.write(outputBuffer); player.write(outputBuffer);
}catch(Throwable t){ }catch(Throwable t){
t.printStackTrace();
con.kick(KickReason.nameEmpty); con.kick(KickReason.nameEmpty);
err(t);
return; return;
} }
@@ -248,10 +248,10 @@ public class NetServer implements ApplicationListener{
try{ try{
RemoteReadServer.readPacket(packet.reader(), packet.type, con.player); RemoteReadServer.readPacket(packet.reader(), packet.type, con.player);
}catch(ValidateException e){ }catch(ValidateException e){
Log.debug("Validation failed for '@': @", e.player, e.getMessage()); debug("Validation failed for '@': @", e.player, e.getMessage());
}catch(RuntimeException e){ }catch(RuntimeException e){
if(e.getCause() instanceof ValidateException v){ if(e.getCause() instanceof ValidateException v){
Log.debug("Validation failed for '@': @", v.player, v.getMessage()); debug("Validation failed for '@': @", v.player, v.getMessage());
}else{ }else{
throw e; throw e;
} }
@@ -305,7 +305,7 @@ public class NetServer implements ApplicationListener{
player.sendMessage("[scarlet]You must be admin to use this command."); player.sendMessage("[scarlet]You must be admin to use this command.");
return; return;
} }
Groups.player.each(Player::admin, a -> a.sendMessage(args[0], player, "[#" + Pal.adminChat.toString() + "]<A>" + NetClient.colorizeName(player.id, player.name))); Groups.player.each(Player::admin, a -> a.sendMessage(args[0], player, "[#" + Pal.adminChat.toString() + "]<A>" + NetClient.colorizeName(player.id, player.name)));
}); });
@@ -418,7 +418,7 @@ public class NetServer implements ApplicationListener{
VoteSession session = new VoteSession(currentlyKicking, found); VoteSession session = new VoteSession(currentlyKicking, found);
session.vote(player, 1); session.vote(player, 1);
vtime.reset(); vtime.reset();
currentlyKicking[0] = session; currentlyKicking[0] = session;
} }
}else{ }else{
@@ -493,7 +493,7 @@ public class NetServer implements ApplicationListener{
data.stream = new ByteArrayInputStream(stream.toByteArray()); data.stream = new ByteArrayInputStream(stream.toByteArray());
player.con.sendStream(data); player.con.sendStream(data);
Log.debug("Packed @ bytes of world data.", stream.size()); debug("Packed @ bytes of world data.", stream.size());
} }
public void addPacketHandler(String type, Cons2<Player, String> handler){ public void addPacketHandler(String type, Cons2<Player, String> handler){
@@ -505,7 +505,7 @@ public class NetServer implements ApplicationListener{
} }
public static void onDisconnect(Player player, String reason){ public static void onDisconnect(Player player, String reason){
//singleplayer multiplayer wierdness //singleplayer multiplayer weirdness
if(player.con == null){ if(player.con == null){
player.remove(); player.remove();
return; return;
@@ -519,7 +519,7 @@ public class NetServer implements ApplicationListener{
} }
String message = Strings.format("&lb@&fi&lk has disconnected. &fi&lk[&lb@&fi&lk] (@)", player.name, player.uuid(), reason); String message = Strings.format("&lb@&fi&lk has disconnected. &fi&lk[&lb@&fi&lk] (@)", player.name, player.uuid(), reason);
if(Config.showConnectMessages.bool()) Log.info(message); if(Config.showConnectMessages.bool()) info(message);
} }
player.remove(); player.remove();
@@ -539,7 +539,7 @@ public class NetServer implements ApplicationListener{
public static void serverPacketUnreliable(Player player, String type, String contents){ public static void serverPacketUnreliable(Player player, String type, String contents){
serverPacketReliable(player, type, contents); serverPacketReliable(player, type, contents);
} }
private static boolean invalid(float f){ private static boolean invalid(float f){
return Float.isInfinite(f) || Float.isNaN(f); return Float.isInfinite(f) || Float.isNaN(f);
} }
@@ -702,15 +702,14 @@ public class NetServer implements ApplicationListener{
@Remote(targets = Loc.client, called = Loc.server) @Remote(targets = Loc.client, called = Loc.server)
public static void adminRequest(Player player, Player other, AdminAction action){ public static void adminRequest(Player player, Player other, AdminAction action){
if(!player.admin){ if(!player.admin){
Log.warn("ACCESS DENIED: Player @ / @ attempted to perform admin action '@' on '@' without proper security access.", warn("ACCESS DENIED: Player @ / @ attempted to perform admin action '@' on '@' without proper security access.",
player.name, player.con.address, action.name(), other == null ? null : other.name); player.name, player.con.address, action.name(), other == null ? null : other.name);
return; return;
} }
if(other == null || ((other.admin && !player.isLocal()) && other != player)){ if(other == null || ((other.admin && !player.isLocal()) && other != player)){
Log.warn("@ attempted to perform admin action on nonexistant or admin player.", player.name); warn("@ attempted to perform admin action on nonexistant or admin player.", player.name);
return; return;
} }
@@ -722,10 +721,10 @@ public class NetServer implements ApplicationListener{
netServer.admins.banPlayerIP(other.con.address); netServer.admins.banPlayerIP(other.con.address);
netServer.admins.banPlayerID(other.con.uuid); netServer.admins.banPlayerID(other.con.uuid);
other.kick(KickReason.banned); other.kick(KickReason.banned);
Log.info("&lc@ has banned @.", player.name, other.name); info("&lc@ has banned @.", player.name, other.name);
}else if(action == AdminAction.kick){ }else if(action == AdminAction.kick){
other.kick(KickReason.kick); other.kick(KickReason.kick);
Log.info("&lc@ has kicked @.", player.name, other.name); info("&lc@ has kicked @.", player.name, other.name);
}else if(action == AdminAction.trace){ }else if(action == AdminAction.trace){
TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile); TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile);
if(player.con != null){ if(player.con != null){
@@ -733,7 +732,7 @@ public class NetServer implements ApplicationListener{
}else{ }else{
NetClient.traceInfo(other, info); NetClient.traceInfo(other, info);
} }
Log.info("&lc@ has requested trace info of @.", player.name, other.name); info("&lc@ has requested trace info of @.", player.name, other.name);
} }
} }
@@ -748,7 +747,7 @@ public class NetServer implements ApplicationListener{
if(Config.showConnectMessages.bool()){ if(Config.showConnectMessages.bool()){
Call.sendMessage("[accent]" + player.name + "[accent] has connected."); Call.sendMessage("[accent]" + player.name + "[accent] has connected.");
String message = Strings.format("&lb@&fi&lk has connected. &fi&lk[&lb@&fi&lk]", player.name, player.uuid()); String message = Strings.format("&lb@&fi&lk has connected. &fi&lk[&lb@&fi&lk]", player.name, player.uuid());
Log.info(message); info(message);
} }
if(!Config.motd.string().equalsIgnoreCase("off")){ if(!Config.motd.string().equalsIgnoreCase("off")){
@@ -773,7 +772,6 @@ public class NetServer implements ApplicationListener{
@Override @Override
public void update(){ public void update(){
if(!headless && !closing && net.server() && state.isMenu()){ if(!headless && !closing && net.server() && state.isMenu()){
closing = true; closing = true;
ui.loadfrag.show("@server.closing"); ui.loadfrag.show("@server.closing");
@@ -799,7 +797,7 @@ public class NetServer implements ApplicationListener{
net.host(Config.port.num()); net.host(Config.port.num());
info("Opened a server on port @.", Config.port.num()); info("Opened a server on port @.", Config.port.num());
}catch(BindException e){ }catch(BindException e){
Log.err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network."); err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network.");
state.set(State.menu); state.set(State.menu);
}catch(IOException e){ }catch(IOException e){
err(e); err(e);
@@ -915,7 +913,6 @@ public class NetServer implements ApplicationListener{
} }
String checkColor(String str){ String checkColor(String str){
for(int i = 1; i < str.length(); i++){ for(int i = 1; i < str.length(); i++){
if(str.charAt(i) == ']'){ if(str.charAt(i) == ']'){
String color = str.substring(1, i); String color = str.substring(1, i);
@@ -941,7 +938,6 @@ public class NetServer implements ApplicationListener{
} }
void sync(){ void sync(){
try{ try{
Groups.player.each(p -> !p.isLocal(), player -> { Groups.player.each(p -> !p.isLocal(), player -> {
if(player.con == null || !player.con.isConnected()){ if(player.con == null || !player.con.isConnected()){
@@ -965,7 +961,7 @@ public class NetServer implements ApplicationListener{
} }
}catch(IOException e){ }catch(IOException e){
e.printStackTrace(); Log.err(e);
} }
} }

View File

@@ -139,9 +139,9 @@ public class Renderer implements ApplicationListener{
} }
bloom = new Bloom(true); bloom = new Bloom(true);
}catch(Throwable e){ }catch(Throwable e){
e.printStackTrace();
settings.put("bloom", false); settings.put("bloom", false);
ui.showErrorMessage("@error.bloom"); ui.showErrorMessage("@error.bloom");
Log.err(e);
} }
} }
@@ -364,5 +364,4 @@ public class Renderer implements ApplicationListener{
buffer.dispose(); buffer.dispose();
} }
} }

View File

@@ -104,7 +104,7 @@ public class UI implements ApplicationListener, Loadable{
Tooltips.getInstance().textProvider = text -> new Tooltip(t -> t.background(Styles.black5).margin(4f).add(text)); Tooltips.getInstance().textProvider = text -> new Tooltip(t -> t.background(Styles.black5).margin(4f).add(text));
Core.settings.setErrorHandler(e -> { Core.settings.setErrorHandler(e -> {
e.printStackTrace(); Log.err(e);
Core.app.post(() -> showErrorMessage("Failed to access local storage.\nSettings will not be saved.")); Core.app.post(() -> showErrorMessage("Failed to access local storage.\nSettings will not be saved."));
}); });

View File

@@ -445,7 +445,6 @@ public class World{
int err = dx - dy; int err = dx - dy;
int e2; int e2;
while(true){ while(true){
if(cons.accept(x0, y0)) return true; if(cons.accept(x0, y0)) return true;
if(x0 == x1 && y0 == y1) return false; if(x0 == x1 && y0 == y1) return false;

View File

@@ -404,7 +404,7 @@ public class MapGenerateDialog extends BaseDialog{
}); });
}catch(Exception e){ }catch(Exception e){
generating = false; generating = false;
e.printStackTrace(); Log.err(e);
} }
world.setGenerating(false); world.setGenerating(false);
}); });

View File

@@ -408,8 +408,7 @@ public class Damage{
} }
@Struct @Struct
static static class PropCellStruct{
class PropCellStruct{
byte x; byte x;
byte y; byte y;
short damage; short damage;

View File

@@ -115,7 +115,6 @@ public class EntityCollisions{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Hitboxc> void updatePhysics(EntityGroup<T> group){ public <T extends Hitboxc> void updatePhysics(EntityGroup<T> group){
QuadTree tree = group.tree(); QuadTree tree = group.tree();
tree.clear(); tree.clear();
@@ -141,7 +140,6 @@ public class EntityCollisions{
} }
private void checkCollide(Hitboxc a, Hitboxc b){ private void checkCollide(Hitboxc a, Hitboxc b){
a.hitbox(this.r1); a.hitbox(this.r1);
b.hitbox(this.r2); b.hitbox(this.r2);
@@ -218,7 +216,6 @@ public class EntityCollisions{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Hitboxc> void collide(EntityGroup<T> groupa){ public <T extends Hitboxc> void collide(EntityGroup<T> groupa){
groupa.each(solid -> { groupa.each(solid -> {
solid.hitbox(r1); solid.hitbox(r1);
r1.x += (solid.lastX() - solid.getX()); r1.x += (solid.lastX() - solid.getX());

View File

@@ -183,8 +183,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
array.each(Entityc::remove); array.each(Entityc::remove);
array.clear(); array.clear();
if(map != null) if(map != null) map.clear();
map.clear();
clearing = false; clearing = false;
} }

View File

@@ -28,7 +28,6 @@ public class StatusFieldAbility extends Ability{
timer += Time.delta; timer += Time.delta;
if(timer >= reload){ if(timer >= reload){
Units.nearby(unit.team, unit.x, unit.y, range, other -> { Units.nearby(unit.team, unit.x, unit.y, range, other -> {
other.apply(effect, duration); other.apply(effect, duration);
}); });

View File

@@ -34,7 +34,6 @@ public class UnitSpawnAbility extends Ability{
timer += Time.delta; timer += Time.delta;
if(timer >= spawnTime && Units.canCreate(unit.team, type)){ if(timer >= spawnTime && Units.canCreate(unit.team, type)){
float x = unit.x + Angles.trnsx(unit.rotation, spawnY, spawnX), y = unit.y + Angles.trnsy(unit.rotation, spawnY, spawnX); float x = unit.x + Angles.trnsx(unit.rotation, spawnY, spawnX), y = unit.y + Angles.trnsy(unit.rotation, spawnY, spawnX);
spawnEffect.at(x, y); spawnEffect.at(x, y);
Unit u = type.create(unit.team); Unit u = type.create(unit.team);

View File

@@ -165,7 +165,7 @@ public abstract class BulletType extends Content{
if(makeFire && tile.team != b.team){ if(makeFire && tile.team != b.team){
Fires.create(tile.tile); Fires.create(tile.tile);
} }
if(healPercent > 0f && tile.team == b.team && !(tile.block instanceof ConstructBlock)){ if(healPercent > 0f && tile.team == b.team && !(tile.block instanceof ConstructBlock)){
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal); Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
tile.heal(healPercent / 100f * tile.maxHealth()); tile.heal(healPercent / 100f * tile.maxHealth());
@@ -213,9 +213,9 @@ public abstract class BulletType extends Content{
if(status != StatusEffects.none){ if(status != StatusEffects.none){
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround); Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
} }
if(healPercent > 0f){ if(healPercent > 0f){
indexer.eachBlock(b.team, x, y, splashDamageRadius, other -> other.damaged(), other -> { indexer.eachBlock(b.team, x, y, splashDamageRadius, Building::damaged, other -> {
Fx.healBlockFull.at(other.x, other.y, other.block.size, Pal.heal); Fx.healBlockFull.at(other.x, other.y, other.block.size, Pal.heal);
other.heal(healPercent / 100f * other.maxHealth()); other.heal(healPercent / 100f * other.maxHealth());
}); });
@@ -253,8 +253,8 @@ public abstract class BulletType extends Content{
public void init(Bullet b){ public void init(Bullet b){
if(killShooter && b.owner() instanceof Healthc){ if(killShooter && b.owner() instanceof Healthc h){
((Healthc)b.owner()).kill(); h.kill();
} }
if(instantDisappear){ if(instantDisappear){

View File

@@ -62,17 +62,15 @@ public class SapBulletType extends BulletType{
if(target != null){ if(target != null){
float result = Math.min(target.health(), damage); float result = Math.min(target.health(), damage);
if(b.owner instanceof Healthc){ if(b.owner instanceof Healthc h){
((Healthc)b.owner).heal(result * sapStrength); h.heal(result * sapStrength);
} }
} }
if(target instanceof Hitboxc hit){ if(target instanceof Hitboxc hit){
hit.collision(b, hit.x(), hit.y()); hit.collision(b, hit.x(), hit.y());
b.collision(hit, hit.x(), hit.y()); b.collision(hit, hit.x(), hit.y());
}else if(target instanceof Building tile){ }else if(target instanceof Building tile){
if(tile.collide(b)){ if(tile.collide(b)){
tile.collision(b); tile.collision(b);
hit(b, tile.x, tile.y); hit(b, tile.x, tile.y);

View File

@@ -61,7 +61,6 @@ public class AIController implements UnitController{
} }
protected void updateVisuals(){ protected void updateVisuals(){
if(unit.isFlying()){ if(unit.isFlying()){
unit.wobble(); unit.wobble();

View File

@@ -77,7 +77,6 @@ public class Saves{
} }
public void update(){ public void update(){
if(current != null && state.isGame() if(current != null && state.isGame()
&& !(state.isPaused() && Core.scene.hasDialog())){ && !(state.isPaused() && Core.scene.hasDialog())){
if(lastTimestamp != 0){ if(lastTimestamp != 0){
@@ -93,8 +92,8 @@ public class Saves{
try{ try{
current.save(); current.save();
}catch(Throwable e){ }catch(Throwable t){
e.printStackTrace(); Log.err(t);
} }
Time.runTask(3f, () -> saving = false); Time.runTask(3f, () -> saving = false);
@@ -218,7 +217,7 @@ public class Saves{
previewFile().writePNG(renderer.minimap.getPixmap()); previewFile().writePNG(renderer.minimap.getPixmap());
requestedPreview = false; requestedPreview = false;
}catch(Throwable t){ }catch(Throwable t){
t.printStackTrace(); Log.err(t);
} }
}); });
} }

View File

@@ -133,10 +133,10 @@ public class Teams{
private void count(Unit unit){ private void count(Unit unit){
unit.team.data().updateCount(unit.type, 1); unit.team.data().updateCount(unit.type, 1);
if(unit instanceof Payloadc){ if(unit instanceof Payloadc payloadc){
((Payloadc)unit).payloads().each(p -> { payloadc.payloads().each(p -> {
if(p instanceof UnitPayload){ if(p instanceof UnitPayload payload){
count(((UnitPayload)p).unit); count(payload.unit);
} }
}); });
} }

View File

@@ -188,23 +188,23 @@ public class PlanetGrid{
} }
static int pos(Ptile t, Ptile n){ static int pos(Ptile t, Ptile n){
for(int i = 0; i < t.edgeCount; i++) for(int i = 0; i < t.edgeCount; i++){
if(t.tiles[i] == n) if(t.tiles[i] == n) return i;
return i; }
return -1; return -1;
} }
static int pos(Ptile t, Corner c){ static int pos(Ptile t, Corner c){
for(int i = 0; i < t.edgeCount; i++) for(int i = 0; i < t.edgeCount; i++){
if(t.corners[i] == c) if(t.corners[i] == c) return i;
return i; }
return -1; return -1;
} }
static int pos(Corner c, Corner n){ static int pos(Corner c, Corner n){
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++){
if(c.corners[i] == n) if(c.corners[i] == n) return i;
return i; }
return -1; return -1;
} }

View File

@@ -18,10 +18,10 @@ import mindustry.type.*;
public class PlanetRenderer implements Disposable{ public class PlanetRenderer implements Disposable{
public static final float outlineRad = 1.17f, camLength = 4f; public static final float outlineRad = 1.17f, camLength = 4f;
public static final Color public static final Color
outlineColor = Pal.accent.cpy().a(1f), outlineColor = Pal.accent.cpy().a(1f),
hoverColor = Pal.accent.cpy().a(0.5f), hoverColor = Pal.accent.cpy().a(0.5f),
borderColor = Pal.accent.cpy().a(0.3f), borderColor = Pal.accent.cpy().a(0.3f),
shadowColor = new Color(0, 0, 0, 0.7f); shadowColor = new Color(0, 0, 0, 0.7f);
private static final Seq<Vec3> points = new Seq<>(); private static final Seq<Vec3> points = new Seq<>();
@@ -119,7 +119,7 @@ public class PlanetRenderer implements Disposable{
public void renderPlanet(Planet planet){ public void renderPlanet(Planet planet){
if(!planet.visible()) return; if(!planet.visible()) return;
//render planet at offsetted position in the world //render planet at offsetted position in the world
planet.draw(cam.combined, planet.getTransform(mat)); planet.draw(cam.combined, planet.getTransform(mat));

View File

@@ -47,7 +47,6 @@ public class DesktopInput extends InputHandler{
@Override @Override
public void buildUI(Group group){ public void buildUI(Group group){
group.fill(t -> { group.fill(t -> {
t.visible(() -> Core.settings.getBool("hints") && ui.hudfrag.shown && !player.dead() && !player.unit().spawnedByCore() && !(Core.settings.getBool("hints") && lastSchematic != null && !selectRequests.isEmpty())); t.visible(() -> Core.settings.getBool("hints") && ui.hudfrag.shown && !player.dead() && !player.unit().spawnedByCore() && !(Core.settings.getBool("hints") && lastSchematic != null && !selectRequests.isEmpty()));
t.bottom(); t.bottom();
@@ -642,7 +641,6 @@ public class DesktopInput extends InputHandler{
//update payload input //update payload input
if(unit instanceof Payloadc){ if(unit instanceof Payloadc){
if(Core.input.keyTap(Binding.pickupCargo)){ if(Core.input.keyTap(Binding.pickupCargo)){
tryPickupPayload(); tryPickupPayload();
} }

View File

@@ -128,7 +128,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile.tile(), action -> { !netServer.admins.allowAction(player, ActionType.withdrawItem, tile.tile(), action -> {
action.item = item; action.item = item;
action.itemAmount = amount; action.itemAmount = amount;
}))) throw new ValidateException(player, "Player cannot request items."); }))){
throw new ValidateException(player, "Player cannot request items.");
}
//remove item for every controlling unit //remove item for every controlling unit
player.unit().eachGroup(unit -> { player.unit().eachGroup(unit -> {
@@ -984,7 +986,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
public @Nullable Unit selectedUnit(){ public @Nullable Unit selectedUnit(){
Unit unit = Units.closest(player.team(), Core.input.mouseWorld().x, Core.input.mouseWorld().y, 40f, u -> u.isAI()); Unit unit = Units.closest(player.team(), Core.input.mouseWorld().x, Core.input.mouseWorld().y, 40f, Unitc::isAI);
if(unit != null){ if(unit != null){
unit.hitbox(Tmp.r1); unit.hitbox(Tmp.r1);
Tmp.r1.grow(6f); Tmp.r1.grow(6f);
@@ -1160,7 +1162,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(block instanceof PowerNode){ if(block instanceof PowerNode){
Seq<Point2> skip = new Seq<>(); Seq<Point2> skip = new Seq<>();
for(int i = 1; i < points.size; i++){ for(int i = 1; i < points.size; i++){
int overlaps = 0; int overlaps = 0;
Point2 point = points.get(i); Point2 point = points.get(i);

View File

@@ -327,7 +327,6 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public void drawTop(){ public void drawTop(){
//draw schematic selection //draw schematic selection
if(mode == schematicSelect){ if(mode == schematicSelect){
drawSelection(lineStartX, lineStartY, lastLineX, lastLineY, Vars.maxSchematicSize); drawSelection(lineStartX, lineStartY, lastLineX, lastLineY, Vars.maxSchematicSize);

View File

@@ -188,7 +188,6 @@ public class Placement{
* @param maxLength maximum length of area * @param maxLength maximum length of area
*/ */
public static NormalizeResult normalizeArea(int tilex, int tiley, int endx, int endy, int rotation, boolean snap, int maxLength){ public static NormalizeResult normalizeArea(int tilex, int tiley, int endx, int endy, int rotation, boolean snap, int maxLength){
if(snap){ if(snap){
if(Math.abs(tilex - endx) > Math.abs(tiley - endy)){ if(Math.abs(tilex - endx) > Math.abs(tiley - endy)){
endy = tiley; endy = tiley;

View File

@@ -2,6 +2,7 @@ package mindustry.io.legacy;
import arc.*; import arc.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*;
import mindustry.*; import mindustry.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.ui.dialogs.JoinDialog.*; import mindustry.ui.dialogs.JoinDialog.*;
@@ -77,8 +78,7 @@ public class LegacyIO{
} }
} }
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); Log.err(e);
} }
} }
} }

View File

@@ -26,7 +26,6 @@ public abstract class LegacySaveVersion extends SaveVersion{
if(!generating) context.begin(); if(!generating) context.begin();
try{ try{
context.resize(width, height); context.resize(width, height);
//read floor and create tiles first //read floor and create tiles first

View File

@@ -283,7 +283,7 @@ public class LCanvas extends Table{
t.add().growX(); t.add().growX();
t.button(Icon.copy, Styles.logici, () -> { t.button(Icon.copy, Styles.logici, () -> {
}).padRight(6).get().tapped(() -> copy()); }).padRight(6).get().tapped(this::copy);
t.button(Icon.cancel, Styles.logici, () -> { t.button(Icon.cancel, Styles.logici, () -> {
remove(); remove();

View File

@@ -32,15 +32,15 @@ public class LExecutor{
//special variables //special variables
public static final int public static final int
varCounter = 0, varCounter = 0,
varTime = 1, varTime = 1,
varUnit = 2, varUnit = 2,
varThis = 3; varThis = 3;
public static final int public static final int
maxGraphicsBuffer = 256, maxGraphicsBuffer = 256,
maxDisplayBuffer = 1024, maxDisplayBuffer = 1024,
maxTextBuffer = 256; maxTextBuffer = 256;
public LInstruction[] instructions = {}; public LInstruction[] instructions = {};
public Var[] vars = {}; public Var[] vars = {};
@@ -61,8 +61,9 @@ public class LExecutor{
vars[varTime].numval = Time.millis(); vars[varTime].numval = Time.millis();
//reset to start //reset to start
if(vars[varCounter].numval >= instructions.length if(vars[varCounter].numval >= instructions.length || vars[varCounter].numval < 0){
|| vars[varCounter].numval < 0) vars[varCounter].numval = 0; vars[varCounter].numval = 0;
}
if(vars[varCounter].numval < instructions.length){ if(vars[varCounter].numval < instructions.length){
instructions[(int)(vars[varCounter].numval++)].run(this); instructions[(int)(vars[varCounter].numval++)].run(this);
@@ -84,9 +85,9 @@ public class LExecutor{
dest.constant = var.constant; dest.constant = var.constant;
if(var.value instanceof Number){ if(var.value instanceof Number number){
dest.isobj = false; dest.isobj = false;
dest.numval = ((Number)var.value).doubleValue(); dest.numval = number.doubleValue();
}else{ }else{
dest.isobj = true; dest.isobj = true;
dest.objval = var.value; dest.objval = var.value;
@@ -98,7 +99,7 @@ public class LExecutor{
public @Nullable Building building(int index){ public @Nullable Building building(int index){
Object o = vars[index].objval; Object o = vars[index].objval;
return vars[index].isobj && o instanceof Building ? (Building)o : null; return vars[index].isobj && o instanceof Building building ? building : null;
} }
public @Nullable Object obj(int index){ public @Nullable Object obj(int index){

View File

@@ -134,7 +134,7 @@ public class Mods implements Loadable{
}catch(IOException e){ }catch(IOException e){
Core.app.post(() -> { Core.app.post(() -> {
Log.err("Error packing images for mod: @", mod.meta.name); Log.err("Error packing images for mod: @", mod.meta.name);
e.printStackTrace(); Log.err(e);
if(!headless) ui.showException(e); if(!headless) ui.showException(e);
}); });
break; break;

View File

@@ -254,8 +254,7 @@ public class Administration{
public boolean unbanPlayerID(String id){ public boolean unbanPlayerID(String id){
PlayerInfo info = getCreateInfo(id); PlayerInfo info = getCreateInfo(id);
if(!info.banned) if(!info.banned) return false;
return false;
info.banned = false; info.banned = false;
bannedIPs.removeAll(info.ips, false); bannedIPs.removeAll(info.ips, false);

View File

@@ -254,8 +254,9 @@ public class Net{
}else if(clientListeners.get(object.getClass()) != null){ }else if(clientListeners.get(object.getClass()) != null){
if(clientLoaded || ((object instanceof Packet) && ((Packet)object).isImportant())){ if(clientLoaded || ((object instanceof Packet) && ((Packet)object).isImportant())){
if(clientListeners.get(object.getClass()) != null) if(clientListeners.get(object.getClass()) != null){
clientListeners.get(object.getClass()).get(object); clientListeners.get(object.getClass()).get(object);
}
Pools.free(object); Pools.free(object);
}else if(!((object instanceof Packet) && ((Packet)object).isUnimportant())){ }else if(!((object instanceof Packet) && ((Packet)object).isUnimportant())){
packetQueue.add(object); packetQueue.add(object);
@@ -273,8 +274,9 @@ public class Net{
public void handleServerReceived(NetConnection connection, Object object){ public void handleServerReceived(NetConnection connection, Object object){
if(serverListeners.get(object.getClass()) != null){ if(serverListeners.get(object.getClass()) != null){
if(serverListeners.get(object.getClass()) != null) if(serverListeners.get(object.getClass()) != null){
serverListeners.get(object.getClass()).get(connection, object); serverListeners.get(object.getClass()).get(connection, object);
}
Pools.free(object); Pools.free(object);
}else{ }else{
Log.err("Unhandled packet type: '@'!", object.getClass()); Log.err("Unhandled packet type: '@'!", object.getClass());