Skip to content

Commit

Permalink
- fixed a bug with the waste of air underwater during authorization
Browse files Browse the repository at this point in the history
- small optimizations
  • Loading branch information
DenisIndenbom committed Feb 28, 2022
1 parent f7fa567 commit a93f01f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
return true;
}

// adding a user to the list of registered
this.plugin.getAuthManager().addUser(user);
// send message
this.messageSender.sendMessage(sender, this.messages.getString("login.logged_in"));
this.messageSender.sendMessage(sender, this.messages.getString("welcome"), "{%username%}", user.getName());

// log the user's login to the console
this.plugin.getLogger().info(player.getName() + " logged in!");

// we return the lost air during login
player.setRemainingAir(player.getMaximumAir());

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void onPlayerQuit(@NotNull PlayerQuitEvent event)
}

@EventHandler
public void onPlayerChat(@NotNull PlayerChatEvent event)
public void onPlayerChat(@NotNull AsyncPlayerChatEvent event)
{
// check that player is authorized
if (!userIsAuth(event.getPlayer())) event.setCancelled(true);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CyberAuth
version: 1.0.4
version: 1.0.5
main: com.denisindenbom.cyberauth.CyberAuth

prefix: CyberAuth
Expand Down

0 comments on commit a93f01f

Please sign in to comment.