mirror of
https://github.com/essentials/Essentials.git
synced 2025-10-05 02:21:38 +02:00
Less locks please
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import lombok.Cleanup;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
@@ -17,16 +16,14 @@ public class Commandtpahere extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
@Cleanup
|
||||
|
||||
final IUser player = ess.getUserMap().matchUser(args[0], false, false);
|
||||
player.acquireReadLock();
|
||||
if (!player.getData().isTeleportEnabled())
|
||||
{
|
||||
throw new Exception(_("teleportDisabled", player.getPlayer().getDisplayName()));
|
||||
}
|
||||
@Cleanup
|
||||
|
||||
ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions()
|
||||
&& !Permissions.WORLD.isAuthorized(user, user.getPlayer().getWorld().getName()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user