mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Added option to limit amount of lore lines (#4773)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
409af5d2aa
commit
eb76cf0fbb
@ -406,6 +406,8 @@ public interface ISettings extends IConf {
|
||||
|
||||
boolean showZeroBaltop();
|
||||
|
||||
int getMaxItemLore();
|
||||
|
||||
enum KeepInvPolicy {
|
||||
KEEP,
|
||||
DELETE,
|
||||
|
@ -1943,4 +1943,9 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
public boolean showZeroBaltop() {
|
||||
return config.getBoolean("show-zero-baltop", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemLore() {
|
||||
return config.getInt("max-itemlore-lines", 10);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,12 @@ public class Commanditemlore extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final ItemMeta im = item.getItemMeta();
|
||||
final int loreSize = im.hasLore() ? im.getLore().size() : 0;
|
||||
if (args[0].equalsIgnoreCase("add") && args.length > 1) {
|
||||
if (loreSize >= ess.getSettings().getMaxItemLore() && !user.isAuthorized("essentials.itemlore.bypass")) {
|
||||
throw new Exception(tl("itemloreMaxLore"));
|
||||
}
|
||||
|
||||
final String line = FormatUtil.formatString(user, "essentials.itemlore", getFinalArg(args, 1)).trim();
|
||||
final List<String> lore = im.hasLore() ? im.getLore() : new ArrayList<>();
|
||||
lore.add(line);
|
||||
|
@ -732,6 +732,10 @@ log-command-block-commands: true
|
||||
# Set the maximum speed for projectiles spawned with /fireball.
|
||||
max-projectile-speed: 8
|
||||
|
||||
# Set the maximum amount of lore lines a user can set with the /itemlore command.
|
||||
# Users with the essentials.itemlore.bypass permission will be able to bypass this limit.
|
||||
max-itemlore-lines: 10
|
||||
|
||||
# Should EssentialsX check for updates?
|
||||
# If set to true, EssentialsX will show notifications when a new version is available.
|
||||
# This uses the public GitHub API and no identifying information is sent or stored.
|
||||
|
@ -586,6 +586,7 @@ itemloreCommandUsage2Description=Sets the specified line of the held item's lore
|
||||
itemloreCommandUsage3=/<command> clear
|
||||
itemloreCommandUsage3Description=Clears the held item's lore
|
||||
itemloreInvalidItem=\u00a74You need to hold an item to edit its lore.
|
||||
itemloreMaxLore=\u00a74You cannot add any more lore lines to this item.
|
||||
itemloreNoLine=\u00a74Your held item does not have lore text on line \u00a7c{0}\u00a74.
|
||||
itemloreNoLore=\u00a74Your held item does not have any lore text.
|
||||
itemloreSuccess=\u00a76You have added "\u00a7c{0}\u00a76" to your held item''s lore.
|
||||
|
Loading…
Reference in New Issue
Block a user