Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2025-06-09 15:56:18 -04:00
5 changed files with 37 additions and 6 deletions

View File

@@ -3437,7 +3437,6 @@ public class Blocks{
hitEffect = Fx.hitLancer; hitEffect = Fx.hitLancer;
despawnEffect = Fx.none; despawnEffect = Fx.none;
status = StatusEffects.shocked; status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false; hittable = false;
lightColor = Color.white; lightColor = Color.white;
collidesAir = false; collidesAir = false;
@@ -3489,7 +3488,6 @@ public class Blocks{
despawnEffect = Fx.blastExplosion; despawnEffect = Fx.blastExplosion;
status = StatusEffects.blasted; status = StatusEffects.blasted;
statusDuration = 60f;
hitColor = backColor = trailColor = Pal.blastAmmoBack; hitColor = backColor = trailColor = Pal.blastAmmoBack;
frontColor = Pal.blastAmmoFront; frontColor = Pal.blastAmmoFront;
@@ -3915,7 +3913,6 @@ public class Blocks{
collidesGround = true; collidesGround = true;
status = StatusEffects.blasted; status = StatusEffects.blasted;
statusDuration = 60f;
backColor = hitColor = trailColor = Pal.blastAmmoBack; backColor = hitColor = trailColor = Pal.blastAmmoBack;
frontColor = Pal.blastAmmoFront; frontColor = Pal.blastAmmoFront;
@@ -5455,7 +5452,6 @@ public class Blocks{
hitEffect = Fx.hitLancer; hitEffect = Fx.hitLancer;
despawnEffect = Fx.none; despawnEffect = Fx.none;
status = StatusEffects.shocked; status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false; hittable = false;
lightColor = Color.white; lightColor = Color.white;
buildingDamageMultiplier = 0.25f; buildingDamageMultiplier = 0.25f;

View File

@@ -91,6 +91,10 @@ public class Administration{
dosBlacklist.add(address); dosBlacklist.add(address);
} }
public synchronized void unBlacklistDos(String address){
dosBlacklist.remove(address);
}
public synchronized boolean isDosBlacklisted(String address){ public synchronized boolean isDosBlacklisted(String address){
return dosBlacklist.contains(address); return dosBlacklist.contains(address);
} }

View File

@@ -113,6 +113,8 @@ public class ArcNetProvider implements NetProvider{
//kill connections above the limit to prevent spam //kill connections above the limit to prevent spam
if((playerLimitCache > 0 && server.getConnections().length > playerLimitCache) || netServer.admins.isDosBlacklisted(ip)){ if((playerLimitCache > 0 && server.getConnections().length > playerLimitCache) || netServer.admins.isDosBlacklisted(ip)){
Log.info("Closing connection @ - IP marked as a potential DOS attack.", ip);
connection.close(DcReason.closed); connection.close(DcReason.closed);
return; return;
} }

View File

@@ -710,7 +710,7 @@ public class StatValues{
if(type.status != StatusEffects.none){ if(type.status != StatusEffects.none){
sep(bt, (type.status.hasEmoji() ? type.status.emoji() : "") + "[stat]" + type.status.localizedName + (type.status.reactive ? "" : "[lightgray] ~ [stat]" + sep(bt, (type.status.hasEmoji() ? type.status.emoji() : "") + "[stat]" + type.status.localizedName + (type.status.reactive ? "" : "[lightgray] ~ [stat]" +
((int)(type.statusDuration / 60f)) + "[lightgray] " + Core.bundle.get("unit.seconds"))).with(c -> withTooltip(c, type.status)); Strings.autoFixed(type.statusDuration / 60f, 1) + "[lightgray] " + Core.bundle.get("unit.seconds"))).with(c -> withTooltip(c, type.status));
} }
if(!type.targetMissiles){ if(!type.targetMissiles){

View File

@@ -666,7 +666,7 @@ public class ServerControl implements ApplicationListener{
if(arg.length == 0){ if(arg.length == 0){
info("Subnets banned: @", netServer.admins.getSubnetBans().isEmpty() ? "<none>" : ""); info("Subnets banned: @", netServer.admins.getSubnetBans().isEmpty() ? "<none>" : "");
for(String subnet : netServer.admins.getSubnetBans()){ for(String subnet : netServer.admins.getSubnetBans()){
info("&lw " + subnet); info("&lw\t" + subnet);
} }
}else if(arg.length == 1){ }else if(arg.length == 1){
err("You must provide a subnet to add or remove."); err("You must provide a subnet to add or remove.");
@@ -1054,6 +1054,35 @@ public class ServerControl implements ApplicationListener{
} }
}); });
handler.register("dos-ban", "[add/remove] [ip]", "Add or remove a DOS ban.", arg -> {
if(arg.length == 0){
info("DOS bans: @", netServer.admins.dosBlacklist.isEmpty() ? "<none>" : "");
netServer.admins.dosBlacklist.forEach(address -> {
info("&lw\t" + address);
});
return;
}else if(arg.length == 1){
err("Expected either zero or two parameters, but only got one parameter.");
return;
}
String action = arg[0].toLowerCase();
String ip = arg[1];
if(action.equals("add")){
netServer.admins.blacklistDos(ip);
info("Dos banned: @", ip);
return;
}else if(action.equals("remove")){
netServer.admins.unBlacklistDos(ip);
info("Removed dos ban: @", ip);
return;
}
err("Unrecognized action: @", action);
});
mods.eachClass(p -> p.registerServerCommands(handler)); mods.eachClass(p -> p.registerServerCommands(handler));
} }