Fixed empty admin menu
This commit is contained in:
@@ -75,6 +75,8 @@ public class PlayerListFragment{
|
||||
}
|
||||
|
||||
public void rebuild(){
|
||||
boolean allowTeamSwitch = !state.isCampaign() && (state.rules.pvp || state.rules.infiniteResources);
|
||||
|
||||
content.clear();
|
||||
|
||||
float h = 50f;
|
||||
@@ -141,15 +143,6 @@ public class PlayerListFragment{
|
||||
|
||||
button.image(Icon.admin).visible(() -> user.admin && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
|
||||
var style = new ImageButtonStyle(){{
|
||||
down = Styles.none;
|
||||
up = Styles.none;
|
||||
imageCheckedColor = Pal.accent;
|
||||
imageDownColor = Pal.accent;
|
||||
imageUpColor = Color.white;
|
||||
imageOverColor = Color.lightGray;
|
||||
}};
|
||||
|
||||
var ustyle = new ImageButtonStyle(){{
|
||||
down = Styles.none;
|
||||
up = Styles.none;
|
||||
@@ -161,6 +154,7 @@ public class PlayerListFragment{
|
||||
if(net.server() || (player.admin && (!user.admin || user == player))){
|
||||
button.add().growY();
|
||||
|
||||
if(allowTeamSwitch || user != player){
|
||||
button.button(Icon.menu, ustyle, () -> {
|
||||
var dialog = new BaseDialog(user.coloredName());
|
||||
|
||||
@@ -195,7 +189,7 @@ public class PlayerListFragment{
|
||||
}
|
||||
|
||||
//there's generally no reason to team switch outside PvP or sandbox, and it's basically an easy way to cheat
|
||||
if(!state.isCampaign() && (state.rules.pvp || state.rules.infiniteResources)){
|
||||
if(allowTeamSwitch){
|
||||
t.button("@player.team", Icon.redo, bstyle, () -> {
|
||||
var teamSelect = new BaseDialog(Core.bundle.get("player.team") + ": " + user.name);
|
||||
teamSelect.setFillParent(false);
|
||||
@@ -251,6 +245,7 @@ public class PlayerListFragment{
|
||||
|
||||
|
||||
}).size(h);
|
||||
}
|
||||
}else if(!user.isLocal() && !user.admin && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick
|
||||
button.add().growY();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user