Arcturus-Community/src/main/java/com/eu/habbo/messages/outgoing/guardians/GuardianVotingResultComposer.java

38 lines
1.3 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.outgoing.guardians;
import com.eu.habbo.habbohotel.guides.GuardianTicket;
import com.eu.habbo.habbohotel.guides.GuardianVote;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import java.util.Map;
2019-05-26 20:14:53 +02:00
public class GuardianVotingResultComposer extends MessageComposer {
2018-07-06 15:30:00 +02:00
private final GuardianTicket ticket;
private final GuardianVote vote;
2019-05-26 20:14:53 +02:00
public GuardianVotingResultComposer(GuardianTicket ticket, GuardianVote vote) {
2018-07-06 15:30:00 +02:00
this.ticket = ticket;
this.vote = vote;
}
@Override
2019-05-26 20:14:53 +02:00
public ServerMessage compose() {
2018-07-06 15:30:00 +02:00
this.response.init(Outgoing.GuardianVotingResultComposer);
this.response.appendInt(this.ticket.getVerdict().getType()); //Final Verdict
this.response.appendInt(this.vote.type.getType()); //Your vote
this.response.appendInt(this.ticket.getVotes().size() - 1); //Other votes count.
2019-05-26 20:14:53 +02:00
for (Map.Entry<Habbo, GuardianVote> set : this.ticket.getVotes().entrySet()) {
if (set.getValue().equals(this.vote))
2018-07-06 15:30:00 +02:00
continue;
this.response.appendInt(set.getValue().type.getType());
}
return this.response;
}
}