Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/src/mindustry/core/NetServer.java
This commit is contained in:
@@ -233,7 +233,7 @@ public class NetClient implements ApplicationListener{
|
||||
//log commands before they are handled
|
||||
if(message.startsWith(netServer.clientCommands.getPrefix())){
|
||||
//log with brackets
|
||||
Log.info("<&fi@: @&fr>", "&lk" + player.name, "&lw" + message);
|
||||
Log.info("<&fi@: @&fr>", "&lk" + player.plainName(), "&lw" + message);
|
||||
}
|
||||
|
||||
//check if it's a command
|
||||
@@ -251,7 +251,7 @@ public class NetClient implements ApplicationListener{
|
||||
}
|
||||
|
||||
//server console logging
|
||||
Log.info("&fi@: @", "&lc" + player.name, "&lw" + message);
|
||||
Log.info("&fi@: @", "&lc" + player.plainName(), "&lw" + message);
|
||||
|
||||
//invoke event for all clients but also locally
|
||||
//this is required so other clients get the correct name even if they don't know who's sending it yet
|
||||
|
||||
@@ -483,7 +483,7 @@ public class NetServer implements ApplicationListener{
|
||||
}
|
||||
|
||||
int sign = switch(arg[0].toLowerCase()){
|
||||
case "y", "yes" -> 1;
|
||||
case "y", "yes" -> 1;
|
||||
case "n", "no" -> -1;
|
||||
default -> 0;
|
||||
};
|
||||
@@ -558,7 +558,7 @@ public class NetServer implements ApplicationListener{
|
||||
Call.playerDisconnect(player.id());
|
||||
}
|
||||
|
||||
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. [&lb@&fi&lk] (@)", player.plainName(), player.uuid(), reason);
|
||||
if(Config.showConnectMessages.bool()) info(message);
|
||||
}
|
||||
|
||||
@@ -771,12 +771,12 @@ public class NetServer implements ApplicationListener{
|
||||
public static void adminRequest(Player player, Player other, AdminAction action){
|
||||
if(!player.admin && !player.isLocal()){
|
||||
warn("ACCESS DENIED: Player @ / @ attempted to perform admin action '@' on '@' without proper security access.",
|
||||
player.name, player.con == null ? "null" : player.con.address, action.name(), other == null ? null : other.name);
|
||||
player.plainName(), player.con == null ? "null" : player.con.address, action.name(), other == null ? null : other.plainName());
|
||||
return;
|
||||
}
|
||||
|
||||
if(other == null || ((other.admin && !player.isLocal()) && other != player)){
|
||||
warn("@ attempted to perform admin action on nonexistant or admin player.", player.name);
|
||||
warn("@ &fi&lk[&lb@&fi&lk]&fb attempted to perform admin action on nonexistant or admin player.", player.plainName(), player.uuid());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -786,15 +786,15 @@ public class NetServer implements ApplicationListener{
|
||||
//no verification is done, so admins can hypothetically spam waves
|
||||
//not a real issue, because server owners may want to do just that
|
||||
logic.skipWave();
|
||||
info("&lc@ has skipped the wave.", player.name);
|
||||
info("&lc@ &fi&lk[&lb@&fi&lk]&fb has skipped the wave.", player.plainName(), player.uuid());
|
||||
}else if(action == AdminAction.ban){
|
||||
netServer.admins.banPlayerID(other.con.uuid);
|
||||
netServer.admins.banPlayerIP(other.con.address);
|
||||
other.kick(KickReason.banned);
|
||||
info("&lc@ has banned @.", player.name, other.name);
|
||||
info("&lc@ &fi&lk[&lb@&fi&lk]&fb has banned @ &fi&lk[&lb@&fi&lk]&fb.", player.plainName(), player.uuid(), other.plainName(), other.uuid());
|
||||
}else if(action == AdminAction.kick){
|
||||
other.kick(KickReason.kick);
|
||||
info("&lc@ has kicked @.", player.name, other.name);
|
||||
info("&lc@ &fi&lk[&lb@&fi&lk]&fb has kicked @ &fi&lk[&lb@&fi&lk]&fb.", player.plainName(), player.uuid(), other.plainName(), other.uuid());
|
||||
}else if(action == AdminAction.trace){
|
||||
PlayerInfo stats = netServer.admins.getInfo(other.uuid());
|
||||
TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile, stats.timesJoined, stats.timesKicked);
|
||||
@@ -803,7 +803,7 @@ public class NetServer implements ApplicationListener{
|
||||
}else{
|
||||
NetClient.traceInfo(other, info);
|
||||
}
|
||||
info("&lc@ has requested trace info of @.", player.name, other.name);
|
||||
info("&lc@ &fi&lk[&lb@&fi&lk]&fb has requested trace info of @ &fi&lk[&lb@&fi&lk]&fb.", player.plainName(), player.uuid(), other.plainName(), other.uuid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
if(Config.showConnectMessages.bool()){
|
||||
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.plainName(), player.uuid());
|
||||
info(message);
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ public class NetServer implements ApplicationListener{
|
||||
short sent = 0;
|
||||
for(Building entity : Groups.build){
|
||||
if(!entity.block.sync) continue;
|
||||
sent ++;
|
||||
sent++;
|
||||
|
||||
dataStream.writeInt(entity.pos());
|
||||
dataStream.writeShort(entity.block.id);
|
||||
@@ -933,7 +933,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
//write basic state data.
|
||||
Call.stateSnapshot(player.con, state.wavetime, state.wave, state.enemies, state.serverPaused, state.gameOver,
|
||||
universe.seconds(), tps, GlobalConstants.rand.seed0, GlobalConstants.rand.seed1, syncStream.toByteArray());
|
||||
universe.seconds(), tps, GlobalConstants.rand.seed0, GlobalConstants.rand.seed1, syncStream.toByteArray());
|
||||
|
||||
syncStream.reset();
|
||||
|
||||
@@ -972,7 +972,7 @@ public class NetServer implements ApplicationListener{
|
||||
Call.hiddenSnapshot(player.con, hiddenIds);
|
||||
}
|
||||
|
||||
player.con.snapshotsSent ++;
|
||||
player.con.snapshotsSent++;
|
||||
}
|
||||
|
||||
String fixName(String name){
|
||||
|
||||
@@ -313,6 +313,10 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
return "[#" + color.toString().toUpperCase() + "]" + name;
|
||||
}
|
||||
|
||||
String plainName(){
|
||||
return Strings.stripColors(name);
|
||||
}
|
||||
|
||||
void sendMessage(String text){
|
||||
if(isLocal()){
|
||||
if(ui != null){
|
||||
|
||||
@@ -419,7 +419,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
public static void tileConfig(@Nullable Player player, Building build, @Nullable Object value){
|
||||
if(build == null) return;
|
||||
if(net.server() && (!Units.canInteract(player, build) ||
|
||||
!netServer.admins.allowAction(player, ActionType.configure, build.tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
|
||||
!netServer.admins.allowAction(player, ActionType.configure, build.tile, action -> action.config = value))){
|
||||
var packet = new TileConfigCallPacket(); //undo the config on the client
|
||||
packet.player = player;
|
||||
packet.build = build;
|
||||
packet.value = build.config();
|
||||
player.con.send(packet, true);
|
||||
throw new ValidateException(player, "Player cannot configure a tile.");
|
||||
}
|
||||
build.configured(player == null || player.dead() ? null : player.unit(), value);
|
||||
Core.app.post(() -> Events.fire(new ConfigEvent(build, player, value)));
|
||||
}
|
||||
|
||||
@@ -569,6 +569,10 @@ public class Administration{
|
||||
|
||||
public PlayerInfo(){
|
||||
}
|
||||
|
||||
public String plainLastName(){
|
||||
return Strings.stripColors(lastName);
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles chat messages from players and changes their contents. */
|
||||
|
||||
@@ -324,7 +324,10 @@ public class ModsDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
private void reload(){
|
||||
ui.showInfoOnHidden("@mods.reloadexit", () -> Core.app.exit());
|
||||
ui.showInfoOnHidden("@mods.reloadexit", () -> {
|
||||
Log.info("Exiting to reload mods.");
|
||||
Core.app.exit();
|
||||
});
|
||||
}
|
||||
|
||||
private void showMod(LoadedMod mod){
|
||||
|
||||
@@ -366,7 +366,7 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public void placed(){
|
||||
if(net.client()) return;
|
||||
if(net.client() || power.links.size > 0) return;
|
||||
|
||||
getPotentialLinks(tile, team, other -> {
|
||||
if(!power.links.contains(other.pos())){
|
||||
@@ -390,15 +390,15 @@ public class PowerNode extends PowerBlock{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(this == other){
|
||||
if(other.power.links.size == 0){
|
||||
if(this == other){ //double tapped
|
||||
if(other.power.links.size == 0 || Core.input.shift()){ //find links
|
||||
int[] total = {0};
|
||||
getPotentialLinks(tile, team, link -> {
|
||||
if(!insulated(this, link) && total[0]++ < maxNodes){
|
||||
configure(link.pos());
|
||||
}
|
||||
});
|
||||
}else{
|
||||
}else{ //clear links
|
||||
while(power.links.size > 0){
|
||||
configure(power.links.get(0));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class StorageBlock extends Block{
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Item item){
|
||||
return itemCapacity;
|
||||
return linkedCore != null ? linkedCore.getMaximumAccepted(item) : itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user