Facebook
From Round Treeshrew, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 275
  1. package pl.blazingpack.blazingpackauthenticator.events;
  2.  
  3. import net.md_5.bungee.api.plugin.*;
  4. import net.md_5.bungee.api.connection.*;
  5. import java.util.*;
  6. import net.md_5.bungee.api.chat.*;
  7. import net.md_5.bungee.api.*;
  8.  
  9. public final class BlazingPackAuthorizationEvent extends Event
  10. {
  11.     private final ProxiedPlayer player;
  12.     private boolean isAuthorized;
  13.     private boolean isUpToDate;
  14.     private String username;
  15.     private final byte[][] interfaces;
  16.     private final byte[] computerUUID;
  17.     private String uuid;
  18.     private BaseComponent[] kickMessage;
  19.     public static final BaseComponent[] NOT_AUTH;
  20.     public static final BaseComponent[] NOT_UP_TO_DATE;
  21.    
  22.     public BlazingPackAuthorizationEvent(final ProxiedPlayer player) {
  23.         this.isUpToDate = true;
  24.         this.interfaces = null;
  25.         this.computerUUID = null;
  26.         this.kickMessage = null;
  27.         this.player = player;
  28.     }
  29.    
  30.     public final ProxiedPlayer getPlayer() {
  31.         return this.player;
  32.     }
  33.    
  34.     public final boolean isAuthorized() {
  35.         return this.isAuthorized;
  36.     }
  37.    
  38.     public final void setAuthorized(final boolean isAuthorized) {
  39.         this.isAuthorized = isAuthorized;
  40.     }
  41.    
  42.     public final boolean isUpToDate() {
  43.         return this.isUpToDate;
  44.     }
  45.    
  46.     public final void setUpToDate(final boolean isUpToDate) {
  47.         this.isUpToDate = isUpToDate;
  48.     }
  49.    
  50.     public final String getUsername() {
  51.         return this.username;
  52.     }
  53.    
  54.     public final byte[][] getInterfaces() {
  55.         return this.interfaces;
  56.     }
  57.    
  58.     public final byte[] getComputerUUID() {
  59.         return this.computerUUID;
  60.     }
  61.    
  62.     public final String getUuid() {
  63.         return this.uuid;
  64.     }
  65.    
  66.     public final void setUuid(final String uuid) {
  67.         this.uuid = uuid;
  68.     }
  69.    
  70.     public final BaseComponent[] getKickMessage() {
  71.         if (this.kickMessage != null) {
  72.             return this.kickMessage;
  73.         }
  74.         if (this.isAuthorized && !this.isUpToDate) {
  75.             return BlazingPackAuthorizationEvent.NOT_UP_TO_DATE;
  76.         }
  77.         return BlazingPackAuthorizationEvent.NOT_AUTH;
  78.     }
  79.    
  80.     public final void setKickMessage(final BaseComponent... kickMessage) {
  81.         this.kickMessage = kickMessage;
  82.     }
  83.    
  84.     public final int hashCode() {
  85.         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());
  86.     }
  87.    
  88.     public final boolean equals(final Object o) {
  89.         if (this == o) {
  90.             return true;
  91.         }
  92.         if (o == null) {
  93.             return false;
  94.         }
  95.         if (this.getClass() != o.getClass()) {
  96.             return false;
  97.         }
  98.         final BlazingPackAuthorizationEvent blazingPackAuthorizationEvent = (BlazingPackAuthorizationEvent)o;
  99.         if (!Arrays.equals(this.computerUUID, blazingPackAuthorizationEvent.computerUUID)) {
  100.             return false;
  101.         }
  102.         if (!Arrays.deepEquals(this.interfaces, blazingPackAuthorizationEvent.interfaces)) {
  103.             return false;
  104.         }
  105.         if (this.isAuthorized != blazingPackAuthorizationEvent.isAuthorized) {
  106.             return false;
  107.         }
  108.         if (this.isUpToDate != blazingPackAuthorizationEvent.isUpToDate) {
  109.             return false;
  110.         }
  111.         if (!Arrays.equals(this.kickMessage, blazingPackAuthorizationEvent.kickMessage)) {
  112.             return false;
  113.         }
  114.         if (this.player == null) {
  115.             if (blazingPackAuthorizationEvent.player != null) {
  116.                 return false;
  117.             }
  118.         }
  119.         else if (!this.player.equals(blazingPackAuthorizationEvent.player)) {
  120.             return false;
  121.         }
  122.         if (this.username == null) {
  123.             if (blazingPackAuthorizationEvent.username != null) {
  124.                 return false;
  125.             }
  126.         }
  127.         else if (!this.username.equals(blazingPackAuthorizationEvent.username)) {
  128.             return false;
  129.         }
  130.         if (this.uuid == null) {
  131.             if (blazingPackAuthorizationEvent.uuid != null) {
  132.                 return false;
  133.             }
  134.         }
  135.         else if (!this.uuid.equals(blazingPackAuthorizationEvent.uuid)) {
  136.             return false;
  137.         }
  138.         return true;
  139.     }
  140.    
  141.     public final String toString() {
  142.         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));
  143.     }
  144.    
  145.     static {
  146.         NOT_AUTH = new ComponentBuilder("Blad autoryzacji! Pobierz paczke ze strony: ").color(ChatColor.AQUA).bold(true).append("BlazingPack.pl").color(ChatColor.GOLD).bold(true).create();
  147.         NOT_UP_TO_DATE = new ComponentBuilder("Wylacz i wlacz paczke!").color(ChatColor.AQUA).bold(true).create();
  148.     }
  149. }
  150.  
  151.  
  152.  
  153. --------------------------------------------------------------------------------
  154.  
  155.  
  156. package pl.blazingpack.blazingpackauthenticator.events;
  157.  
  158. import net.md_5.bungee.api.plugin.*;
  159. import net.md_5.bungee.connection.*;
  160.  
  161. public class BlazingPackPreAuthorizationEvent extends Event implements Cancellable
  162. {
  163.     private boolean cancelled;
  164.     private String cancelReason;
  165.     private InitialHandler initialHandler;
  166.     private boolean usingBlazingPack;
  167.    
  168.     public BlazingPackPreAuthorizationEvent(final InitialHandler initialHandler) {
  169.         this.cancelReason = "Blad autoryzacji! Pobierz paczke ze strony: http://blazingpack.pl";
  170.         this.initialHandler = initialHandler;
  171.     }
  172.    
  173.     public boolean isUsingBlazingPack() {
  174.         return this.usingBlazingPack;
  175.     }
  176.    
  177.     @Deprecated
  178.     public void setUsingBlazingPack(final boolean usingBlazingPack) {
  179.         this.usingBlazingPack = usingBlazingPack;
  180.     }
  181.    
  182.     public boolean isCancelled() {
  183.         return this.cancelled;
  184.     }
  185.    
  186.     public void setCancelled(final boolean cancelled) {
  187.         this.cancelled = cancelled;
  188.     }
  189.    
  190.     public String getCancelReason() {
  191.         return this.cancelReason;
  192.     }
  193.    
  194.     public void setCancelReason(final String cancelReason) {
  195.         this.cancelReason = cancelReason;
  196.     }
  197.    
  198.     public InitialHandler getInitialHandler() {
  199.         return this.initialHandler;
  200.     }
  201. }
  202.