1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-26 07:54:41 +02:00

Fix /mute to follow same convention as /tjail

Fixed #2056
This commit is contained in:
ementalo
2012-06-18 11:39:27 +01:00
parent 962d49517b
commit ca21b92762
6 changed files with 15 additions and 11 deletions

View File

@@ -84,7 +84,7 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
void addMail(String string);
boolean toggleMuted();
void setMuted(boolean mute);
boolean toggleSocialSpy();

View File

@@ -22,7 +22,7 @@ public class Commandmute extends EssentialsCommand
@Cleanup
final IUser player = getPlayer(args, 0, true);
player.acquireReadLock();
player.acquireReadLock();
if (!player.getData().isMuted() && Permissions.MUTE_EXEMPT.isAuthorized(player))
{
throw new Exception(_("muteExempt"));
@@ -30,11 +30,16 @@ public class Commandmute extends EssentialsCommand
long muteTimestamp = 0;
if (args.length > 1)
{
String time = getFinalArg(args, 1);
final String time = getFinalArg(args, 1);
muteTimestamp = DateUtil.parseDateDiff(time, true);
player.setMuted(true);
}
else
{
player.setMuted(!player.getData().isMuted());
}
player.setTimestamp(TimestampType.MUTE, muteTimestamp);
final boolean muted = player.toggleMuted();
final boolean muted = player.getData().isMuted();
sender.sendMessage(
muted
? (muteTimestamp > 0

View File

@@ -21,7 +21,7 @@ public class EssentialsBlockListener implements Listener
this.ess = ess;
}
@EventHandler(priority = EventPriority.Low, ignoreCancelled = true)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockPlace(final BlockPlaceEvent event)
{
// Do not rely on getItemInHand();

View File

@@ -129,7 +129,7 @@ public class EssentialsPlayerListener implements Listener
settings.acquireReadLock();
if (settings.getData().getCommands().getGod().isRemoveOnDisconnect() && user.isGodModeEnabled())
{
user.toggleGodModeEnabled();
user.setGodModeEnabled(false);
}
if (user.getData().getInventory() != null)
{

View File

@@ -408,6 +408,7 @@ public class User extends UserBase implements IUser
}
//Returns true if status expired during this check
@Override
public boolean checkMuteTimeout(final long currentTime)
{
acquireReadLock();

View File

@@ -285,14 +285,12 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
}
}
public boolean toggleMuted()
public void setMuted(boolean mute)
{
acquireWriteLock();
try
{
boolean ret = !getData().isMuted();
getData().setMuted(ret);
return ret;
{
getData().setMuted(mute);
}
finally
{