Added admin wave sending / Admin system fixes / Build fix
This commit is contained in:
@@ -219,6 +219,7 @@ public class NetClient extends Module {
|
||||
new Random().nextBytes(bytes);
|
||||
String result = new String(Base64Coder.encode(bytes));
|
||||
Settings.putString("usid-" + ip, result);
|
||||
Settings.save();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,14 +485,18 @@ public class NetServer extends Module{
|
||||
return;
|
||||
}
|
||||
|
||||
if(other == null || other.isAdmin){
|
||||
if(other == null || (other.isAdmin && other != player)){ //fun fact: this means you can ban yourself
|
||||
Log.err("{0} attempted to perform admin action on nonexistant or admin player.", player.name);
|
||||
return;
|
||||
}
|
||||
|
||||
String ip = player.con.address;
|
||||
|
||||
if(action == AdminAction.ban){
|
||||
if(action == AdminAction.wave) {
|
||||
//no verification is done, so admins can hypothetically spam waves
|
||||
//not a real issue, because server owners may want to do just that
|
||||
state.wavetime = 0f;
|
||||
}else if(action == AdminAction.ban){
|
||||
netServer.admins.banPlayerIP(ip);
|
||||
netServer.kick(other.con.id, KickReason.banned);
|
||||
Log.info("&lc{0} has banned {1}.", player.name, other.name);
|
||||
|
||||
@@ -179,7 +179,7 @@ public class Packets {
|
||||
}
|
||||
|
||||
public enum AdminAction{
|
||||
kick, ban, trace
|
||||
kick, ban, trace, wave
|
||||
}
|
||||
|
||||
/**Marks the beginning of a stream.*/
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Scaling;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.mindustry.ui.IntFormat;
|
||||
import io.anuke.mindustry.ui.Minimap;
|
||||
@@ -331,13 +333,17 @@ public class HudFragment extends Fragment{
|
||||
|
||||
private void playButton(float uheight){
|
||||
new imagebutton("icon-play", 30f, () -> {
|
||||
state.wavetime = 0f;
|
||||
if(Net.client() && players[0].isAdmin){
|
||||
Call.onAdminRequest(players[0], AdminAction.wave);
|
||||
}else {
|
||||
state.wavetime = 0f;
|
||||
}
|
||||
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padLeft(-15).padRight(-10).width(40f).update(l->{
|
||||
boolean vis = state.mode.disableWaveTimer && (Net.server() || !Net.active());
|
||||
boolean vis = state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active());
|
||||
boolean paused = state.is(State.paused) || !vis;
|
||||
|
||||
l.getStyle().imageUp = Core.skin.getDrawable(vis ? "icon-play" : "clear");
|
||||
l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled);
|
||||
}).visible(() -> state.mode.disableWaveTimer && (Net.server() || !Net.active()) && unitGroups[Team.red.ordinal()].size() == 0);
|
||||
}).visible(() -> state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active()) && unitGroups[Team.red.ordinal()].size() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user