1010import org .bukkit .plugin .messaging .PluginMessageListener ;
1111
1212import java .util .Iterator ;
13+ import java .util .Objects ;
1314import java .util .UUID ;
1415import java .util .function .Consumer ;
1516
@@ -201,7 +202,7 @@ public boolean setStatusOverride(String server, boolean status) {
201202 return true ;
202203 }
203204
204- private final class MessageContext {
205+ private static final class MessageContext {
205206 private final String channel ;
206207 private final String subchannel ;
207208 private final UUID player ;
@@ -216,20 +217,15 @@ public MessageContext(String channel, String subchannel, UUID player) {
216217 public boolean equals (Object o ) {
217218 if (this == o ) return true ;
218219 if (o == null || getClass () != o .getClass ()) return false ;
219-
220220 MessageContext that = (MessageContext ) o ;
221-
222- if (channel != null ? !channel .equals (that .channel ) : that .channel != null ) return false ;
223- if (subchannel != null ? !subchannel .equals (that .subchannel ) : that .subchannel != null ) return false ;
224- return player != null ? player .equals (that .player ) : that .player == null ;
221+ return Objects .equals (channel , that .channel ) &&
222+ Objects .equals (subchannel , that .subchannel ) &&
223+ Objects .equals (player , that .player );
225224 }
226225
227226 @ Override
228227 public int hashCode () {
229- int result = channel != null ? channel .hashCode () : 0 ;
230- result = 31 * result + (subchannel != null ? subchannel .hashCode () : 0 );
231- result = 31 * result + (player != null ? player .hashCode () : 0 );
232- return result ;
228+ return Objects .hash (channel , subchannel , player );
233229 }
234230
235231 @ Override
0 commit comments