@@ -107,7 +107,8 @@ public void run() {
107107
108108 });
109109 }
110- if (!Settings .noTeleport )
110+
111+ if (!Settings .noTeleport ) {
111112 if (Settings .isTeleportToSpawnEnabled || (Settings .isForceSpawnLocOnJoinEnabled && Settings .getForcedWorlds .contains (player .getWorld ().getName ()))) {
112113 sched .scheduleSyncDelayedTask (plugin , new Runnable () {
113114
@@ -117,26 +118,32 @@ public void run() {
117118 plugin .getServer ().getPluginManager ().callEvent (tpEvent );
118119 if (!tpEvent .isCancelled ()) {
119120 if (player .isOnline () && tpEvent .getTo () != null ) {
120- if (tpEvent .getTo ().getWorld () != null )
121+ if (tpEvent .getTo ().getWorld () != null ) {
121122 player .teleport (tpEvent .getTo ());
123+ }
122124 }
123125 }
124126 }
125127
126128 });
127129 }
130+ }
131+
128132 placePlayerSafely (player , spawnLoc );
129133 LimboCache .getInstance ().updateLimboPlayer (player );
134+
130135 // protect inventory
131136 if (Settings .protectInventoryBeforeLogInEnabled && plugin .inventoryProtector != null ) {
132137 ProtectInventoryEvent ev = new ProtectInventoryEvent (player );
133138 plugin .getServer ().getPluginManager ().callEvent (ev );
134139 if (ev .isCancelled ()) {
135140 plugin .inventoryProtector .sendInventoryPacket (player );
136- if (!Settings .noConsoleSpam )
141+ if (!Settings .noConsoleSpam ) {
137142 ConsoleLogger .info ("ProtectInventoryEvent has been cancelled for " + player .getName () + " ..." );
143+ }
138144 }
139145 }
146+
140147 } else {
141148 if (Settings .isForceSurvivalModeEnabled && !Settings .forceOnlyAfterLogin ) {
142149 sched .scheduleSyncDelayedTask (plugin , new Runnable () {
@@ -155,7 +162,8 @@ public void run() {
155162 if (!Settings .isForcedRegistrationEnabled ) {
156163 return ;
157164 }
158- if (!Settings .noTeleport )
165+
166+ if (!Settings .noTeleport ) {
159167 if (!needFirstSpawn () && Settings .isTeleportToSpawnEnabled || (Settings .isForceSpawnLocOnJoinEnabled && Settings .getForcedWorlds .contains (player .getWorld ().getName ()))) {
160168 sched .scheduleSyncDelayedTask (plugin , new Runnable () {
161169
@@ -165,29 +173,26 @@ public void run() {
165173 plugin .getServer ().getPluginManager ().callEvent (tpEvent );
166174 if (!tpEvent .isCancelled ()) {
167175 if (player .isOnline () && tpEvent .getTo () != null ) {
168- if (tpEvent .getTo ().getWorld () != null )
176+ if (tpEvent .getTo ().getWorld () != null ) {
169177 player .teleport (tpEvent .getTo ());
178+ }
170179 }
171180 }
172181 }
173182
174183 });
175184 }
185+ }
176186
177187 }
178188
179189 if (!LimboCache .getInstance ().hasLimboPlayer (name )) {
180190 LimboCache .getInstance ().addLimboPlayer (player );
181191 }
192+ Utils .setGroup (player , isAuthAvailable ? GroupType .NOTLOGGEDIN : GroupType .UNREGISTERED );
182193
183194 final int timeOut = Settings .getRegistrationTimeout * 20 ;
184- int msgInterval = Settings .getWarnMessageInterval ;
185- if (timeOut > 0 ) {
186- BukkitTask id = sched .runTaskLaterAsynchronously (plugin , new TimeoutTask (plugin , name , player ), timeOut );
187- LimboCache .getInstance ().getLimboPlayer (name ).setTimeoutTaskId (id );
188- }
189195
190- Utils .setGroup (player , isAuthAvailable ? GroupType .NOTLOGGEDIN : GroupType .UNREGISTERED );
191196 sched .scheduleSyncDelayedTask (plugin , new Runnable () {
192197 @ Override
193198 public void run () {
@@ -205,11 +210,24 @@ public void run() {
205210 player .performCommand ("motd" );
206211 }
207212 if (Settings .applyBlindEffect ) {
208- player .addPotionEffect (new PotionEffect (PotionEffectType .BLINDNESS , timeOut , 2 ));
213+ int blindTimeOut ;
214+ // Allow infinite blindness effect
215+ if (timeOut < 0 ) {
216+ blindTimeOut = 99999 ;
217+ } else {
218+ blindTimeOut = timeOut ;
219+ }
220+ player .addPotionEffect (new PotionEffect (PotionEffectType .BLINDNESS , blindTimeOut , 2 ));
209221 }
210222 }
211223
212224 });
225+
226+ int msgInterval = Settings .getWarnMessageInterval ;
227+ if (timeOut > 0 ) {
228+ BukkitTask id = sched .runTaskLaterAsynchronously (plugin , new TimeoutTask (plugin , name , player ), timeOut );
229+ LimboCache .getInstance ().getLimboPlayer (name ).setTimeoutTaskId (id );
230+ }
213231
214232 if (Settings .isSessionsEnabled && isAuthAvailable && (PlayerCache .getInstance ().isAuthenticated (name ) || database .isLogged (name ))) {
215233 if (plugin .sessions .containsKey (name )) {
0 commit comments