Votekick after being offline / Votekick button

This commit is contained in:
Anuken
2019-09-22 11:28:32 -04:00
parent e5cf2161d4
commit 2dceb8927c
3 changed files with 9 additions and 4 deletions

View File

@ -125,6 +125,7 @@ server.version = [gray]v{0} {1}
server.custombuild = [accent]Custom Build
confirmban = Are you sure you want to ban this player?
confirmkick = Are you sure you want to kick this player?
confirmvotekick = Are you sure you want to vote-kick this player?
confirmunban = Are you sure you want to unban this player?
confirmadmin = Are you sure you want to make this player an admin?
confirmunadmin = Are you sure you want to remove admin status from this player?

View File

@ -254,14 +254,13 @@ public class NetServer implements ApplicationListener{
Call.sendMessage(Strings.format("[orange]{0}[lightgray] has voted to kick[orange] {1}[].[accent] ({2}/{3})\n[lightgray]Type[orange] /vote <y/n>[] to agree.",
player.name, target.name, votes, votesRequired()));
//checkPass();
}
boolean checkPass(){
if(votes >= votesRequired() && target.isAdded() && target.con.isConnected()){
Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] {0}[orange] will be kicked from the server.", target.name));
admins.getInfo(target.uuid).lastKicked = Time.millis() + kickDuration*1000;
target.con.kick(KickReason.vote);
Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] {0}[orange] will be banned from the server for {1} minutes.", target.name, (int)(kickDuration/60)));
target.getInfo().lastKicked = Time.millis() + kickDuration*1000;
playerGroup.all().each(p -> p.uuid != null && p.uuid.equals(target.uuid), p -> p.con.kick(KickReason.vote));
map[0] = null;
task.cancel();
return true;

View File

@ -129,6 +129,11 @@ public class PlayerListFragment extends Fragment{
t.addImageButton(Icon.zoomSmall, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
}).padRight(12).size(bs + 10f, bs);
}else if((!user.isLocal && !user.isAdmin) && net.client() && playerGroup.size() >= 3){ //votekick
button.add().growY();
button.addImageButton(Icon.banSmall, Styles.clearPartiali,
() -> ui.showConfirm("$confirm", "$confirmvotekick", () -> Call.sendChatMessage("/votekick " + user.name))).size(h);
}
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);