@@ 115-136 (lines=22) @@ | ||
112 | return; |
|
113 | ||
114 | // Listening to the INFO (join) message |
|
115 | if ( messageKey.equals( "INFO" ) && jsonMessage.isJsonObject() ) { |
|
116 | JsonObject jsonObject = jsonMessage.getAsJsonObject(); |
|
117 | String version = jsonObject.has( "version" ) |
|
118 | && jsonObject.get( "version" ).isJsonPrimitive() |
|
119 | && jsonObject.get( "version" ).getAsJsonPrimitive().isString() ? jsonObject.get( "version" ).getAsString() : "Unknown"; |
|
120 | ||
121 | boolean chunkCachingEnabled = false; |
|
122 | int chunkCachingVersion = 0; |
|
123 | ||
124 | if ( jsonObject.has( "ccp" ) && jsonObject.get( "ccp" ).isJsonObject() ) { |
|
125 | JsonObject chunkCachingObject = jsonObject.get( "ccp" ).getAsJsonObject(); |
|
126 | ||
127 | if ( chunkCachingObject.has( "enabled" ) ) |
|
128 | chunkCachingEnabled = chunkCachingObject.get( "enabled" ).getAsBoolean(); |
|
129 | ||
130 | if ( chunkCachingObject.has( "version" ) ) |
|
131 | chunkCachingVersion = chunkCachingObject.get( "version" ).getAsInt(); |
|
132 | } |
|
133 | ||
134 | Bukkit.getPluginManager().callEvent( new LabyModPlayerJoinEvent( player, version, |
|
135 | chunkCachingEnabled, chunkCachingVersion, Addon.getAddons( jsonObject ) ) ); |
|
136 | return; |
|
137 | } |
|
138 | ||
139 | // Calling the MessageReceiveEvent |
@@ 51-72 (lines=22) @@ | ||
48 | JsonElement jsonMessage = JSON_PARSER.parse( messageContents ); |
|
49 | ||
50 | // Listening to the INFO (join) message |
|
51 | if ( messageKey.equals( "INFO" ) && jsonMessage.isJsonObject() ) { |
|
52 | JsonObject jsonObject = jsonMessage.getAsJsonObject(); |
|
53 | String version = jsonObject.has( "version" ) |
|
54 | && jsonObject.get( "version" ).isJsonPrimitive() |
|
55 | && jsonObject.get( "version" ).getAsJsonPrimitive().isString() ? jsonObject.get( "version" ).getAsString() : "Unknown"; |
|
56 | ||
57 | boolean chunkCachingEnabled = false; |
|
58 | int chunkCachingVersion = 0; |
|
59 | ||
60 | if ( jsonObject.has( "ccp" ) && jsonObject.get( "ccp" ).isJsonObject() ) { |
|
61 | JsonObject chunkCachingObject = jsonObject.get( "ccp" ).getAsJsonObject(); |
|
62 | ||
63 | if ( chunkCachingObject.has( "enabled" ) ) |
|
64 | chunkCachingEnabled = chunkCachingObject.get( "enabled" ).getAsBoolean(); |
|
65 | ||
66 | if ( chunkCachingObject.has( "version" ) ) |
|
67 | chunkCachingVersion = chunkCachingObject.get( "version" ).getAsInt(); |
|
68 | } |
|
69 | ||
70 | ProxyServer.getInstance().getPluginManager().callEvent( new LabyModPlayerJoinEvent( player, version, |
|
71 | chunkCachingEnabled, chunkCachingVersion, Addon.getAddons( jsonObject ) ) ); |
|
72 | return; |
|
73 | } |
|
74 | ||
75 | // Calling the LabyModPlayerJoinEvent |