mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9
This commit is contained in:
commit
92bdd51cd4
20 changed files with 59 additions and 18 deletions
|
@ -42,4 +42,6 @@ public interface IUser extends Player
|
||||||
Teleport getTeleport();
|
Teleport getTeleport();
|
||||||
|
|
||||||
void setJail(String jail);
|
void setJail(String jail);
|
||||||
|
|
||||||
|
boolean isIgnoreExempt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class Kit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws NoChargeException
|
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws Exception
|
||||||
{
|
{
|
||||||
if (user.isAuthorized("essentials.kit.exemptdelay")) {
|
if (user.isAuthorized("essentials.kit.exemptdelay")) {
|
||||||
return;
|
return;
|
||||||
|
@ -46,7 +46,7 @@ public class Kit
|
||||||
final Calendar time = new GregorianCalendar();
|
final Calendar time = new GregorianCalendar();
|
||||||
|
|
||||||
// Take the current time, and remove the delay from it.
|
// Take the current time, and remove the delay from it.
|
||||||
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0L;
|
final double delay = els.containsKey("delay") ? ((Number)els.get("delay")).doubleValue() : 0.0d;
|
||||||
final Calendar earliestTime = new GregorianCalendar();
|
final Calendar earliestTime = new GregorianCalendar();
|
||||||
earliestTime.add(Calendar.SECOND, -(int)delay);
|
earliestTime.add(Calendar.SECOND, -(int)delay);
|
||||||
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
|
earliestTime.add(Calendar.MILLISECOND, -(int)((delay * 1000.0) % 1000.0));
|
||||||
|
@ -56,7 +56,7 @@ public class Kit
|
||||||
// When was the last kit used?
|
// When was the last kit used?
|
||||||
final long lastTime = user.getKitTimestamp(kitName);
|
final long lastTime = user.getKitTimestamp(kitName);
|
||||||
|
|
||||||
if (lastTime < earliestLong)
|
if (lastTime < earliestLong || lastTime == 0L)
|
||||||
{
|
{
|
||||||
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,11 @@ public class Kit
|
||||||
// If this happens, let's give the user the benifit of the doubt.
|
// If this happens, let's give the user the benifit of the doubt.
|
||||||
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
user.setKitTimestamp(kitName, time.getTimeInMillis());
|
||||||
}
|
}
|
||||||
|
else if (earliestLong < 0L)
|
||||||
|
{
|
||||||
|
user.sendMessage(_("kitOnce"));
|
||||||
|
throw new NoChargeException();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time.setTimeInMillis(lastTime);
|
time.setTimeInMillis(lastTime);
|
||||||
|
|
|
@ -737,4 +737,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
{
|
{
|
||||||
this.rightClickJump = rightClickJump;
|
this.rightClickJump = rightClickJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIgnoreExempt()
|
||||||
|
{
|
||||||
|
return this.isAuthorized("essentials.chat.ignoreexempt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,23 +49,23 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
lastHealTimestamp = _getLastHealTimestamp();
|
lastHealTimestamp = _getLastHealTimestamp();
|
||||||
jail = _getJail();
|
jail = _getJail();
|
||||||
mails = _getMails();
|
mails = _getMails();
|
||||||
teleportEnabled = getTeleportEnabled();
|
teleportEnabled = _getTeleportEnabled();
|
||||||
ignoredPlayers = getIgnoredPlayers();
|
|
||||||
godmode = _getGodModeEnabled();
|
godmode = _getGodModeEnabled();
|
||||||
muted = getMuted();
|
muted = _getMuted();
|
||||||
muteTimeout = _getMuteTimeout();
|
muteTimeout = _getMuteTimeout();
|
||||||
jailed = getJailed();
|
jailed = _getJailed();
|
||||||
jailTimeout = _getJailTimeout();
|
jailTimeout = _getJailTimeout();
|
||||||
lastLogin = _getLastLogin();
|
lastLogin = _getLastLogin();
|
||||||
lastLogout = _getLastLogout();
|
lastLogout = _getLastLogout();
|
||||||
lastLoginAddress = _getLastLoginAddress();
|
lastLoginAddress = _getLastLoginAddress();
|
||||||
afk = getAfk();
|
afk = _getAfk();
|
||||||
geolocation = _getGeoLocation();
|
geolocation = _getGeoLocation();
|
||||||
isSocialSpyEnabled = _isSocialSpyEnabled();
|
isSocialSpyEnabled = _isSocialSpyEnabled();
|
||||||
isNPC = _isNPC();
|
isNPC = _isNPC();
|
||||||
arePowerToolsEnabled = _arePowerToolsEnabled();
|
arePowerToolsEnabled = _arePowerToolsEnabled();
|
||||||
kitTimestamps = _getKitTimestamps();
|
kitTimestamps = _getKitTimestamps();
|
||||||
nickname = _getNickname();
|
nickname = _getNickname();
|
||||||
|
setIgnoredPlayers(_getIgnoredPlayers());
|
||||||
}
|
}
|
||||||
private double money;
|
private double money;
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
private boolean teleportEnabled;
|
private boolean teleportEnabled;
|
||||||
|
|
||||||
private boolean getTeleportEnabled()
|
private boolean _getTeleportEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("teleportenabled", true);
|
return config.getBoolean("teleportenabled", true);
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
private List<String> ignoredPlayers;
|
private List<String> ignoredPlayers;
|
||||||
|
|
||||||
public List<String> getIgnoredPlayers()
|
public List<String> _getIgnoredPlayers()
|
||||||
{
|
{
|
||||||
return Collections.synchronizedList(config.getStringList("ignore"));
|
return Collections.synchronizedList(config.getStringList("ignore"));
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
|
|
||||||
public boolean isIgnoredPlayer(IUser user)
|
public boolean isIgnoredPlayer(IUser user)
|
||||||
{
|
{
|
||||||
return (ignoredPlayers.contains(user.getName().toLowerCase(Locale.ENGLISH)) && !user.isAuthorized("essentials.chat.ignoreexempt"));
|
return (ignoredPlayers.contains(user.getName().toLowerCase(Locale.ENGLISH)) && !user.isIgnoreExempt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIgnoredPlayer(IUser user, boolean set)
|
public void setIgnoredPlayer(IUser user, boolean set)
|
||||||
|
@ -515,11 +515,16 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
private boolean muted;
|
private boolean muted;
|
||||||
|
|
||||||
public boolean getMuted()
|
public boolean _getMuted()
|
||||||
{
|
{
|
||||||
return config.getBoolean("muted", false);
|
return config.getBoolean("muted", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getMuted()
|
||||||
|
{
|
||||||
|
return muted;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isMuted()
|
public boolean isMuted()
|
||||||
{
|
{
|
||||||
return muted;
|
return muted;
|
||||||
|
@ -551,7 +556,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
private boolean jailed;
|
private boolean jailed;
|
||||||
|
|
||||||
private boolean getJailed()
|
private boolean _getJailed()
|
||||||
{
|
{
|
||||||
return config.getBoolean("jailed", false);
|
return config.getBoolean("jailed", false);
|
||||||
}
|
}
|
||||||
|
@ -678,7 +683,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
private boolean afk;
|
private boolean afk;
|
||||||
|
|
||||||
private boolean getAfk()
|
private boolean _getAfk()
|
||||||
{
|
{
|
||||||
return config.getBoolean("afk", false);
|
return config.getBoolean("afk", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,6 +605,7 @@ public class Util
|
||||||
}
|
}
|
||||||
private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
|
private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)");
|
||||||
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]");
|
private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]");
|
||||||
|
private static transient final Pattern LOGCOLOR_PATTERN = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
|
||||||
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
|
private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])");
|
||||||
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]");
|
private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]");
|
||||||
private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]");
|
private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]");
|
||||||
|
@ -622,6 +623,15 @@ public class Util
|
||||||
return VANILLA_PATTERN.matcher(input).replaceAll("");
|
return VANILLA_PATTERN.matcher(input).replaceAll("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String stripLogColorFormat(final String input)
|
||||||
|
{
|
||||||
|
if (input == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return LOGCOLOR_PATTERN.matcher(input).replaceAll("");
|
||||||
|
}
|
||||||
|
|
||||||
public static String replaceFormat(final String input)
|
public static String replaceFormat(final String input)
|
||||||
{
|
{
|
||||||
if (input == null)
|
if (input == null)
|
||||||
|
|
|
@ -92,8 +92,8 @@ disabled-commands:
|
||||||
# - nick
|
# - nick
|
||||||
|
|
||||||
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
|
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
|
||||||
# This list has no effect if your using a supported permissions system.
|
# This list has no effect if you are using a supported permissions system.
|
||||||
# If your using an unsupported permissions system simply delete this section.
|
# If you are using an unsupported permissions system simply delete this section.
|
||||||
# Whitelist the commands and permissions you wish to give players by default (everything else is op only).
|
# Whitelist the commands and permissions you wish to give players by default (everything else is op only).
|
||||||
# These are the permissions without the "essentials." part.
|
# These are the permissions without the "essentials." part.
|
||||||
player-commands:
|
player-commands:
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -465,3 +465,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Nombre de warp invalido
|
||||||
userUnknown=\u00a74Peligro: El jugador '\u00a7c{0}\u00a74' Nunca a ingresado a este servidor.
|
userUnknown=\u00a74Peligro: El jugador '\u00a7c{0}\u00a74' Nunca a ingresado a este servidor.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Nom de warp invalide
|
||||||
userUnknown=\u00a74Attention : Le joueur '\u00a7c{0}\u00a74' n'est jamais venu sur ce serveur.
|
userUnknown=\u00a74Attention : Le joueur '\u00a7c{0}\u00a74' n'est jamais venu sur ce serveur.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -462,3 +462,4 @@ invalidWarpName=\u00a74Invalid warp name
|
||||||
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
|
||||||
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
teleportationEnabledFor=\u00a76Teleportation enabled for {0}
|
||||||
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
teleportationDisabledFor=\u00a76Teleportation disabled for {0}
|
||||||
|
kitOnce=\u00a74You can't use that kit again.
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jivesoftware.smack.Roster.SubscriptionMode;
|
|
||||||
import org.jivesoftware.smack.*;
|
import org.jivesoftware.smack.*;
|
||||||
|
import org.jivesoftware.smack.Roster.SubscriptionMode;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -263,7 +263,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
for (LogRecord logRecord : copy)
|
for (LogRecord logRecord : copy)
|
||||||
{
|
{
|
||||||
final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters());
|
final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters());
|
||||||
if (!XMPPManager.this.sendMessage(user, message))
|
if (!XMPPManager.this.sendMessage(user, Util.stripLogColorFormat(message)))
|
||||||
{
|
{
|
||||||
failedUsers.add(user);
|
failedUsers.add(user);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue