package pl.blazingpack.blazingpackauthenticator.events; import net.md_5.bungee.api.plugin.*; import net.md_5.bungee.api.connection.*; import java.util.*; import net.md_5.bungee.api.chat.*; import net.md_5.bungee.api.*; public final class BlazingPackAuthorizationEvent extends Event { private final ProxiedPlayer player; private boolean isAuthorized; private boolean isUpToDate; private String username; private final byte[][] interfaces; private final byte[] computerUUID; private String uuid; private BaseComponent[] kickMessage; public static final BaseComponent[] NOT_AUTH; public static final BaseComponent[] NOT_UP_TO_DATE; public BlazingPackAuthorizationEvent(final ProxiedPlayer player) { this.isUpToDate = true; this.interfaces = null; this.computerUUID = null; this.kickMessage = null; this.player = player; } public final ProxiedPlayer getPlayer() { return this.player; } public final boolean isAuthorized() { return this.isAuthorized; } public final void setAuthorized(final boolean isAuthorized) { this.isAuthorized = isAuthorized; } public final boolean isUpToDate() { return this.isUpToDate; } public final void setUpToDate(final boolean isUpToDate) { this.isUpToDate = isUpToDate; } public final String getUsername() { return this.username; } public final byte[][] getInterfaces() { return this.interfaces; } public final byte[] getComputerUUID() { return this.computerUUID; } public final String getUuid() { return this.uuid; } public final void setUuid(final String uuid) { this.uuid = uuid; } public final BaseComponent[] getKickMessage() { if (this.kickMessage != null) { return this.kickMessage; } if (this.isAuthorized && !this.isUpToDate) { return BlazingPackAuthorizationEvent.NOT_UP_TO_DATE; } return BlazingPackAuthorizationEvent.NOT_AUTH; } public final void setKickMessage(final BaseComponent... kickMessage) { this.kickMessage = kickMessage; } public final int hashCode() { return (((((((31 + Arrays.hashCode(this.computerUUID)) * 31 + Arrays.deepHashCode(this.interfaces)) * 31 + (this.isAuthorized ? 1231 : 1237)) * 31 + (this.isUpToDate ? 1231 : 1237)) * 31 + Arrays.hashCode(this.kickMessage)) * 31 + ((this.player == null) ? 0 : this.player.hashCode())) * 31 + ((this.username == null) ? 0 : this.username.hashCode())) * 31 + ((this.uuid == null) ? 0 : this.uuid.hashCode()); } public final boolean equals(final Object o) { if (this == o) { return true; } if (o == null) { return false; } if (this.getClass() != o.getClass()) { return false; } final BlazingPackAuthorizationEvent blazingPackAuthorizationEvent = (BlazingPackAuthorizationEvent)o; if (!Arrays.equals(this.computerUUID, blazingPackAuthorizationEvent.computerUUID)) { return false; } if (!Arrays.deepEquals(this.interfaces, blazingPackAuthorizationEvent.interfaces)) { return false; } if (this.isAuthorized != blazingPackAuthorizationEvent.isAuthorized) { return false; } if (this.isUpToDate != blazingPackAuthorizationEvent.isUpToDate) { return false; } if (!Arrays.equals(this.kickMessage, blazingPackAuthorizationEvent.kickMessage)) { return false; } if (this.player == null) { if (blazingPackAuthorizationEvent.player != null) { return false; } } else if (!this.player.equals(blazingPackAuthorizationEvent.player)) { return false; } if (this.username == null) { if (blazingPackAuthorizationEvent.username != null) { return false; } } else if (!this.username.equals(blazingPackAuthorizationEvent.username)) { return false; } if (this.uuid == null) { if (blazingPackAuthorizationEvent.uuid != null) { return false; } } else if (!this.uuid.equals(blazingPackAuthorizationEvent.uuid)) { return false; } return true; } public final String toString() { return String.format("BlazingPackAuthorizationEvent [player=%s, isAuthorized=%s, isUpToDate=%s, username=%s, interfaces=%s, computerUUID=%s, uuid=%s, kickMessage=%s]", this.player, this.isAuthorized, this.isUpToDate, this.username, Arrays.toString(this.interfaces), Arrays.toString(this.computerUUID), this.uuid, Arrays.toString(this.kickMessage)); } static { NOT_AUTH = new ComponentBuilder("Blad autoryzacji! Pobierz paczke ze strony: ").color(ChatColor.AQUA).bold(true).append("BlazingPack.pl").color(ChatColor.GOLD).bold(true).create(); NOT_UP_TO_DATE = new ComponentBuilder("Wylacz i wlacz paczke!").color(ChatColor.AQUA).bold(true).create(); } } -------------------------------------------------------------------------------- package pl.blazingpack.blazingpackauthenticator.events; import net.md_5.bungee.api.plugin.*; import net.md_5.bungee.connection.*; public class BlazingPackPreAuthorizationEvent extends Event implements Cancellable { private boolean cancelled; private String cancelReason; private InitialHandler initialHandler; private boolean usingBlazingPack; public BlazingPackPreAuthorizationEvent(final InitialHandler initialHandler) { this.cancelReason = "Blad autoryzacji! Pobierz paczke ze strony: http://blazingpack.pl"; this.initialHandler = initialHandler; } public boolean isUsingBlazingPack() { return this.usingBlazingPack; } @Deprecated public void setUsingBlazingPack(final boolean usingBlazingPack) { this.usingBlazingPack = usingBlazingPack; } public boolean isCancelled() { return this.cancelled; } public void setCancelled(final boolean cancelled) { this.cancelled = cancelled; } public String getCancelReason() { return this.cancelReason; } public void setCancelReason(final String cancelReason) { this.cancelReason = cancelReason; } public InitialHandler getInitialHandler() { return this.initialHandler; } }