1
0
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:
snowleo
2012-10-06 16:49:40 +02:00
parent 463c4ff62d
commit fabd88dc25
75 changed files with 805 additions and 1618 deletions

View File

@@ -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()))
{