mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Merge branch 'master' of https://github.com/essentials/Essentials
This commit is contained in:
commit
6e8031f477
11 changed files with 70 additions and 11 deletions
|
@ -179,4 +179,6 @@ public interface ISettings extends IConf
|
||||||
boolean isTeleportInvulnerability();
|
boolean isTeleportInvulnerability();
|
||||||
|
|
||||||
long getLoginAttackDelay();
|
long getLoginAttackDelay();
|
||||||
|
|
||||||
|
int getSignUsePerSecond();
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,8 @@ public class Settings implements ISettings
|
||||||
cancelAfkOnMove = _cancelAfkOnMove();
|
cancelAfkOnMove = _cancelAfkOnMove();
|
||||||
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
||||||
itemSpawnBl = _getItemSpawnBlacklist();
|
itemSpawnBl = _getItemSpawnBlacklist();
|
||||||
loginAttackDelay = _loginAttackDelay();
|
loginAttackDelay = _getLoginAttackDelay();
|
||||||
|
signUsePerSecond = _getSignUsePerSecond();
|
||||||
kits = _getKits();
|
kits = _getKits();
|
||||||
chatFormats.clear();
|
chatFormats.clear();
|
||||||
}
|
}
|
||||||
|
@ -808,7 +809,7 @@ public class Settings implements ISettings
|
||||||
|
|
||||||
private long loginAttackDelay;
|
private long loginAttackDelay;
|
||||||
|
|
||||||
private long _loginAttackDelay()
|
private long _getLoginAttackDelay()
|
||||||
{
|
{
|
||||||
return config.getLong("login-attack-delay", 0) * 1000;
|
return config.getLong("login-attack-delay", 0) * 1000;
|
||||||
}
|
}
|
||||||
|
@ -819,4 +820,18 @@ public class Settings implements ISettings
|
||||||
return loginAttackDelay;
|
return loginAttackDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int signUsePerSecond;
|
||||||
|
|
||||||
|
private int _getSignUsePerSecond()
|
||||||
|
{
|
||||||
|
final int perSec = config.getInt("sign-use-per-second", 4);
|
||||||
|
return perSec > 0 ? perSec : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSignUsePerSecond()
|
||||||
|
{
|
||||||
|
return signUsePerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
private transient final Teleport teleport;
|
private transient final Teleport teleport;
|
||||||
private transient long teleportRequestTime;
|
private transient long teleportRequestTime;
|
||||||
private transient long lastOnlineActivity;
|
private transient long lastOnlineActivity;
|
||||||
|
private transient long lastThrottledAction;
|
||||||
private transient long lastActivity = System.currentTimeMillis();
|
private transient long lastActivity = System.currentTimeMillis();
|
||||||
private boolean hidden = false;
|
private boolean hidden = false;
|
||||||
private transient Location afkPosition = null;
|
private transient Location afkPosition = null;
|
||||||
|
@ -669,4 +670,23 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
{
|
{
|
||||||
final boolean set = !vanished;
|
final boolean set = !vanished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkSignThrottle() {
|
||||||
|
if (isSignThrottled()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
updateThrottle();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSignThrottled()
|
||||||
|
{
|
||||||
|
final long minTime = lastThrottledAction + (1000 / ess.getSettings().getSignUsePerSecond());
|
||||||
|
return (System.currentTimeMillis() < minTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateThrottle()
|
||||||
|
{
|
||||||
|
lastThrottledAction = System.currentTimeMillis();;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,17 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean isIgnoredPlayer(final String userName)
|
||||||
|
{
|
||||||
|
final IUser user = ess.getUser(userName);
|
||||||
|
if (user == null || !user.isOnline())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (ignoredPlayers.contains(user.getName().toLowerCase(Locale.ENGLISH)) && !user.isAuthorized("essentials.chat.ignoreexempt"));
|
||||||
|
}
|
||||||
|
|
||||||
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.isAuthorized("essentials.chat.ignoreexempt"));
|
||||||
|
|
|
@ -41,20 +41,20 @@ public class Commandban extends EssentialsCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||||
String banReason;
|
String banReason;
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
banReason = _("banFormat", getFinalArg(args, 1), sender.getName());
|
banReason = _("banFormat", getFinalArg(args, 1), senderName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
banReason = _("banFormat", _("defaultBanReason"), sender.getName());
|
banReason = _("banFormat", _("defaultBanReason"), senderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setBanReason(banReason);
|
user.setBanReason(banReason);
|
||||||
user.setBanned(true);
|
user.setBanned(true);
|
||||||
user.kickPlayer(banReason);
|
user.kickPlayer(banReason);
|
||||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
|
||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Commanditemdb extends EssentialsCommand
|
||||||
if (itemStack.getType() != Material.AIR)
|
if (itemStack.getType() != Material.AIR)
|
||||||
{
|
{
|
||||||
int maxuses = itemStack.getType().getMaxDurability();
|
int maxuses = itemStack.getType().getMaxDurability();
|
||||||
int durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
|
int durability = ((maxuses + 1) - itemStack.getDurability());
|
||||||
if (maxuses != 0)
|
if (maxuses != 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("durability", Integer.toString(durability)));
|
sender.sendMessage(_("durability", Integer.toString(durability)));
|
||||||
|
|
|
@ -44,12 +44,12 @@ public class Commandtempban extends EssentialsCommand
|
||||||
final String time = getFinalArg(args, 1);
|
final String time = getFinalArg(args, 1);
|
||||||
final long banTimestamp = Util.parseDateDiff(time, true);
|
final long banTimestamp = Util.parseDateDiff(time, true);
|
||||||
|
|
||||||
final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp));
|
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||||
|
final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp), senderName);
|
||||||
user.setBanReason(banReason);
|
user.setBanReason(banReason);
|
||||||
user.setBanTimeout(banTimestamp);
|
user.setBanTimeout(banTimestamp);
|
||||||
user.setBanned(true);
|
user.setBanned(true);
|
||||||
user.kickPlayer(banReason);
|
user.kickPlayer(banReason);
|
||||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
|
||||||
|
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.earth2me.essentials.commands;
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandvanish extends EssentialsCommand
|
public class Commandvanish extends EssentialsCommand
|
||||||
|
@ -30,7 +29,7 @@ public class Commandvanish extends EssentialsCommand
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
|
if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1"))
|
||||||
{
|
{
|
||||||
user.setVanished(true);
|
user.setVanished(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,10 @@ public class EssentialsSign
|
||||||
{
|
{
|
||||||
final ISign sign = new BlockSign(block);
|
final ISign sign = new BlockSign(block);
|
||||||
final User user = ess.getUser(player);
|
final User user = ess.getUser(player);
|
||||||
|
if (user.checkSignThrottle())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".use")
|
return (user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".use")
|
||||||
|
|
|
@ -223,6 +223,12 @@ enabledSigns:
|
||||||
#- weather
|
#- weather
|
||||||
#- protection
|
#- protection
|
||||||
|
|
||||||
|
|
||||||
|
# How many times per second can Essentials signs be interacted with.
|
||||||
|
# Values should be between 1-20, 20 being virtually no lag protection.s
|
||||||
|
# Lower numbers will reduce the possiblity of lag, but may annoy players.
|
||||||
|
sign-use-per-second: 4
|
||||||
|
|
||||||
# Backup runs a command while saving is disabled
|
# Backup runs a command while saving is disabled
|
||||||
backup:
|
backup:
|
||||||
# Interval in minutes
|
# Interval in minutes
|
||||||
|
|
|
@ -2586,6 +2586,8 @@ uncookedbeef,363,0
|
||||||
uncookedsteak,363,0
|
uncookedsteak,363,0
|
||||||
cowmeat,363,0
|
cowmeat,363,0
|
||||||
plainbeef,363,0
|
plainbeef,363,0
|
||||||
|
beef,364,0
|
||||||
|
steak,364,0
|
||||||
cookedbeef,364,0
|
cookedbeef,364,0
|
||||||
grilledbeef,364,0
|
grilledbeef,364,0
|
||||||
cookedsteak,364,0
|
cookedsteak,364,0
|
||||||
|
|
|
Loading…
Reference in a new issue