From dda3afe9fa993e6aad82f571a27eb977958456d3 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 30 Aug 2018 21:39:27 -0400 Subject: [PATCH] now with waifus --- build.gradle | 1 + core/src/io/anuke/mindustry/core/Control.java | 2 +- .../io/anuke/mindustry/input/DefaultKeybinds.java | 3 +-- kryonet/src/io/anuke/kryonet/KryoServer.java | 11 +++++++++++ .../io/anuke/mindustry/server/ServerControl.java | 13 ------------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 14ff10a9dd..f27f7358c2 100644 --- a/build.gradle +++ b/build.gradle @@ -229,6 +229,7 @@ project(":kryonet") { dependencies { compile project(":core") compile 'com.github.crykn:kryonet:2.22.1' + compile 'com.github.Anuken:WaifUPnP:05eb46bc577fd7674596946ba288c96c0cedd893' } } diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index fac84a7ef6..2f122dfbae 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -351,7 +351,7 @@ public class Control extends Module{ throw new RuntimeException(error); } - if(debug && Inputs.keyTap("console")){ + if(debug && Inputs.keyTap(io.anuke.ucore.input.Input.GRAVE)){ console = !console; } diff --git a/core/src/io/anuke/mindustry/input/DefaultKeybinds.java b/core/src/io/anuke/mindustry/input/DefaultKeybinds.java index 4c8ef908ea..8747389332 100644 --- a/core/src/io/anuke/mindustry/input/DefaultKeybinds.java +++ b/core/src/io/anuke/mindustry/input/DefaultKeybinds.java @@ -38,8 +38,7 @@ public class DefaultKeybinds{ "chat", Input.ENTER, "chat_history_prev", Input.UP, "chat_history_next", Input.DOWN, - "chat_scroll", new Axis(Input.SCROLL), - "console", Input.GRAVE + "chat_scroll", new Axis(Input.SCROLL) ); KeyBinds.defaultSection(section, DeviceType.controller, diff --git a/kryonet/src/io/anuke/kryonet/KryoServer.java b/kryonet/src/io/anuke/kryonet/KryoServer.java index 364478efd8..314ce52b75 100644 --- a/kryonet/src/io/anuke/kryonet/KryoServer.java +++ b/kryonet/src/io/anuke/kryonet/KryoServer.java @@ -2,12 +2,14 @@ package io.anuke.kryonet; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Array; +import com.dosse.upnp.UPnP; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.FrameworkMessage; import com.esotericsoftware.kryonet.Listener; import com.esotericsoftware.kryonet.Listener.LagListener; import com.esotericsoftware.kryonet.Server; import com.esotericsoftware.kryonet.util.InputStreamSender; +import io.anuke.mindustry.Vars; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net.SendMode; import io.anuke.mindustry.net.Net.ServerProvider; @@ -129,6 +131,15 @@ public class KryoServer implements ServerProvider { @Override public void host(int port) throws IOException { + //attempt to open default ports if they're not already open + //this only opens the default port due to security concerns (?) + if(port == Vars.port){ + async(() -> { + if(!UPnP.isMappedTCP(port)) UPnP.openPortTCP(port); + if(!UPnP.isMappedUDP(port)) UPnP.openPortUDP(port); + }); + } + lastconnection = 0; connections.clear(); missing.clear(); diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index a8d0a2ab7f..aaf2adf2a5 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -326,19 +326,6 @@ public class ServerControl extends Module{ info("Core filled."); }); - handler.register("friendlyfire", "", "Enable or disable friendly fire.", arg -> { - String s = arg[0]; - if(s.equalsIgnoreCase("on")){ - state.friendlyFire = true; - info("Friendly fire enabled."); - }else if(s.equalsIgnoreCase("off")){ - state.friendlyFire = false; - info("Friendly fire disabled."); - }else{ - err("Incorrect command usage."); - } - }); - handler.register("crashreport", "", "Disables or enables automatic crash reporting", arg -> { boolean value = arg[0].equalsIgnoreCase("on"); Settings.putBool("crashreport", value);