This commit is contained in:
Anuken
2023-06-03 11:47:19 -04:00
parent 37daf0a871
commit 038994a95f
5 changed files with 17 additions and 6 deletions

View File

@@ -138,7 +138,7 @@ public class NetServer implements ApplicationListener{
String uuid = packet.uuid;
if(admins.isIPBanned(con.address) || admins.isSubnetBanned(con.address) || con.kicked) return;
if(admins.isIPBanned(con.address) || admins.isSubnetBanned(con.address) || con.kicked || !con.isConnected()) return;
if(con.hasBegunConnecting){
con.kick(KickReason.idInUse);

View File

@@ -56,7 +56,9 @@ public class DrawOperation{
void setTile(Tile tile, byte type, short to){
editor.load(() -> {
if(type == OpType.floor.ordinal()){
tile.setFloor((Floor)content.block(to));
if(content.block(to) instanceof Floor floor){
tile.setFloor(floor);
}
}else if(type == OpType.block.ordinal()){
tile.getLinkedTiles(t -> editor.renderer.updatePoint(t.x, t.y));

View File

@@ -104,6 +104,8 @@ public enum EditorTool{
if(!Structs.inBounds(x, y, editor.width(), editor.height())) return;
Tile tile = editor.tile(x, y);
if(tile == null) return;
if(editor.drawBlock.isMultiblock()){
//don't fill multiblocks, thanks
pencil.touched(x, y);

View File

@@ -195,10 +195,12 @@ public class Mods implements Loadable{
float textureScale = mod.meta.texturescale;
for(Fi file : sprites){
String name = file.nameWithoutExtension();
String
baseName = file.nameWithoutExtension(),
regionName = baseName.contains(".") ? baseName.substring(0, baseName.indexOf(".")) : baseName;
if(!prefix && !Core.atlas.has(name)){
Log.warn("Sprite '@' in mod '@' attempts to override a non-existent sprite. Ignoring.", name, mod.name);
if(!prefix && !Core.atlas.has(regionName)){
Log.warn("Sprite '@' in mod '@' attempts to override a non-existent sprite. Ignoring.", regionName, mod.name);
continue;
//(horrible code below)
@@ -215,7 +217,7 @@ public class Mods implements Loadable{
}
//this returns a *runnable* which actually packs the resulting pixmap; this has to be done synchronously outside the method
return () -> {
String fullName = (prefix ? mod.name + "-" : "") + name;
String fullName = (prefix ? mod.name + "-" : "") + baseName;
packer.add(getPage(file), fullName, new PixmapRegion(pix));
if(textureScale != 1.0f){
textureResize.put(fullName, textureScale);

View File

@@ -41,6 +41,11 @@ public abstract class NetConnection{
this.address = address;
}
/** Kick with the standard kick reason. */
public void kick(){
kick(KickReason.kick);
}
/** Kick with a special, localized reason. Use this if possible. */
public void kick(KickReason reason){
kick(reason, (reason == KickReason.kick || reason == KickReason.banned || reason == KickReason.vote) ? 30 * 1000 : 0);