-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from LielAmar/spawn-locations
Spawn locations
- Loading branch information
Showing
11 changed files
with
158 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 28 additions & 2 deletions
30
src/main/java/com/lielamar/auth/bukkit/listeners/OnAuthStateChange.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
package com.lielamar.auth.bukkit.listeners; | ||
|
||
import com.lielamar.auth.bukkit.TwoFactorAuthentication; | ||
import com.lielamar.auth.bukkit.events.PlayerStateChangeEvent; | ||
import com.lielamar.auth.shared.handlers.AuthHandler; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
public class OnAuthStateChange implements Listener { | ||
|
||
private final TwoFactorAuthentication main; | ||
|
||
public OnAuthStateChange(TwoFactorAuthentication main) { | ||
this.main = main; | ||
} | ||
|
||
@EventHandler | ||
public void onAuthState(PlayerStateChangeEvent event) { | ||
if(event.getAuthState().equals(AuthHandler.AuthState.AUTHENTICATED)) { | ||
public void onStateChange(PlayerStateChangeEvent event) { | ||
if(event.getNewAuthState().equals(AuthHandler.AuthState.AUTHENTICATED)) { | ||
event.getPlayer().setFlySpeed((float) 0.1); | ||
event.getPlayer().setWalkSpeed((float) 0.2); | ||
} | ||
} | ||
|
||
@EventHandler | ||
public void onPreAuthPostAuth(PlayerStateChangeEvent event) { | ||
Player player = event.getPlayer(); | ||
|
||
if(player == null || !player.isOnline()) | ||
return; | ||
|
||
if(event.getNewAuthState() == AuthHandler.AuthState.PENDING_LOGIN) { | ||
if(main.getConfigHandler().shouldTeleportBeforeAuth() && main.getConfigHandler().teleportBeforeAuthLocation() != null) | ||
player.teleport(main.getConfigHandler().teleportBeforeAuthLocation()); | ||
} | ||
|
||
if(event.getNewAuthState() == AuthHandler.AuthState.AUTHENTICATED || event.getNewAuthState() == AuthHandler.AuthState.DISABLED) { | ||
if(main.getConfigHandler().shouldTeleportAfterAuth() && main.getConfigHandler().teleportAfterAuthLocation() != null) | ||
player.teleport(main.getConfigHandler().teleportAfterAuthLocation()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: 2FA | ||
version: "1.5.3" | ||
version: "1.5.4" | ||
author: "LielAmar" | ||
main: com.lielamar.auth.bungee.TwoFactorAuthentication | ||
description: Add another layer of protection to your server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters