Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event) {
}

final TickCountProvider tickCountProvider = ess.provider(TickCountProvider.class);
if (tickCountProvider != null && user.getFlightTick() == tickCountProvider.getTickCount()) {
if (tickCountProvider != null && user.getFlightTick() == tickCountProvider.getTickCount() && user.isAuthorized("essentials.fly")) {
user.getBase().setAllowFlight(true);
user.getBase().setFlying(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.earth2me.essentials.textreader.BookInput;
import com.earth2me.essentials.textreader.BookPager;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.utils.EnumUtil;
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.MaterialUtil;
import com.earth2me.essentials.utils.NumberUtil;
Expand Down Expand Up @@ -217,8 +216,6 @@ public void addStringMeta(final CommandSource sender, final boolean allowUnsafe,
return;
}

final Material WRITTEN_BOOK = EnumUtil.getMaterial("WRITTEN_BOOK");

if (split.length > 1 && split[0].equalsIgnoreCase("name") && hasMetaPermission(sender, "name", false, true, ess)) {
final String displayName = FormatUtil.replaceFormat(split[1].replaceAll("(?<!\\\\)_", " ").replace("\\_", "_"));
final ItemMeta meta = stack.getItemMeta();
Expand Down Expand Up @@ -254,7 +251,7 @@ public void addStringMeta(final CommandSource sender, final boolean allowUnsafe,
final IText input = new BookInput("book", true, ess);
final BookPager pager = new BookPager(input);
// This fix only applies to written books - which require an author and a title. https://bugs.mojang.com/browse/MC-59153
if (stack.getType() == WRITTEN_BOOK) {
if (stack.getType() == Material.WRITTEN_BOOK) {
if (!meta.hasAuthor()) {
// The sender can be null when this method is called from {@link com.earth2me.essentials.signs.EssentialsSign#getItemMeta(ItemStack, String, IEssentials)}
meta.setAuthor(sender == null ? Console.getInstance().getDisplayName() : sender.getPlayer().getName());
Expand All @@ -267,12 +264,12 @@ public void addStringMeta(final CommandSource sender, final boolean allowUnsafe,
final List<String> pages = pager.getPages(split[1]);
meta.setPages(pages);
stack.setItemMeta(meta);
} else if (split.length > 1 && split[0].equalsIgnoreCase("author") && stack.getType() == WRITTEN_BOOK && hasMetaPermission(sender, "author", false, true, ess)) {
} else if (split.length > 1 && split[0].equalsIgnoreCase("author") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "author", false, true, ess)) {
final String author = FormatUtil.replaceFormat(split[1]);
final BookMeta meta = (BookMeta) stack.getItemMeta();
meta.setAuthor(author);
stack.setItemMeta(meta);
} else if (split.length > 1 && split[0].equalsIgnoreCase("title") && stack.getType() == WRITTEN_BOOK && hasMetaPermission(sender, "title", false, true, ess)) {
} else if (split.length > 1 && split[0].equalsIgnoreCase("title") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "title", false, true, ess)) {
final String title = FormatUtil.replaceFormat(split[1].replaceAll("(?<!\\\\)_", " ").replace("\\_", "_"));
final BookMeta meta = (BookMeta) stack.getItemMeta();
meta.setTitle(title);
Expand Down
14 changes: 12 additions & 2 deletions Essentials/src/main/java/com/earth2me/essentials/UserData.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,17 @@ public void setMails(List<String> mails) {
}

public int getMailAmount() {
return holder.mail() == null ? 0 : holder.mail().size();
if (holder.mail() == null) {
return 0;
}

int amount = 0;
for (MailMessage element : holder.mail()) {
if (!element.isExpired()) {
amount++;
}
}
return amount;
}

public int getUnreadMailAmount() {
Expand All @@ -358,7 +368,7 @@ public int getUnreadMailAmount() {

int unread = 0;
for (MailMessage element : holder.mail()) {
if (!element.isRead()) {
if (!element.isRead() && !element.isExpired()) {
unread++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import com.earth2me.essentials.craftbukkit.Inventories;
import com.earth2me.essentials.utils.EnumUtil;
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.VersionUtil;
import com.google.common.collect.Lists;
import net.ess3.api.TranslatableException;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.WritableBookMeta;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -50,7 +52,14 @@ public void run(final Server server, final User user, final String commandLabel,
} else {
if (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")) {
final ItemStack newItem = new ItemStack(WRITABLE_BOOK, item.getAmount());
newItem.setItemMeta(bmeta);
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_20_6_R01)) {
final WritableBookMeta wbmeta = (WritableBookMeta) newItem.getItemMeta();
//noinspection DataFlowIssue
wbmeta.setPages(bmeta.getPages());
newItem.setItemMeta(wbmeta);
} else {
newItem.setItemMeta(bmeta);
}
Inventories.setItemInMainHand(user.getBase(), newItem);
user.sendTl("editBookContents");
} else {
Expand All @@ -63,7 +72,15 @@ public void run(final Server server, final User user, final String commandLabel,
bmeta.setAuthor(player);
}
final ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount());
newItem.setItemMeta(bmeta);
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_20_6_R01)) {
final BookMeta real = (BookMeta) newItem.getItemMeta();
real.setAuthor(bmeta.getAuthor());
real.setTitle(bmeta.getTitle());
real.setPages(bmeta.getPages());
newItem.setItemMeta(real);
} else {
newItem.setItemMeta(bmeta);
}
Inventories.setItemInMainHand(user.getBase(), newItem);
user.sendTl("bookLocked");
} else {
Expand Down
1 change: 1 addition & 0 deletions Essentials/src/main/resources/messages_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ clearinventoryCommandUsage3=/<command> <hráč> <předmět> [počet]
clearinventoryCommandUsage3Description=Vymaže všechny zadané předměty (nebo určitý počet) z inventáře zadaného hráče.
clearinventoryconfirmtoggleCommandDescription=Přepíná, zda je třeba potvrzovat vyprázdnění inventáře.
clearinventoryconfirmtoggleCommandUsage=/<command>
commandArgumentOptional=<gray>
commandCooldown=<secondary>Tento příkaz můžete použít až za {0}.
commandDisabled=<secondary>Příkaz<primary> {0}<secondary>je vypnut.
commandFailed=Příkaz {0} selhal\:
Expand Down
2 changes: 2 additions & 0 deletions Essentials/src/main/resources/messages_es.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Sat Feb 03 17:34:46 GMT 2024
action=<dark_purple>* {0} <dark_purple>{1}
addedToAccount=<yellow>{0}<green> ha sido añadido a tu cuenta.
addedToOthersAccount=<yellow>{0}<green> han sido añadidos a la cuenta de<yellow> {1}<green>. Nuevo saldo\:<yellow> {2}
adventure=aventura
Expand Down Expand Up @@ -829,6 +830,7 @@ onlyDayNight=<primary>/time <dark_red>únicamente funciona con los valores <prim
onlyPlayers=<dark_red>Solo jugadores dentro del juego pueden usar <secondary>{0}<dark_red>.
onlyPlayerSkulls=<dark_red>Solo puedes indicar el propietario de las calaveras de jugadores (<secondary>397\:3<dark_red>).
onlySunStorm=<secondary>/weather <dark_red>solo acepta los valores <secondary>sun <dark_red>o <secondary>storm <dark_red>(<primary>sol<dark_red>/<primary>tormenta<dark_red>).
openingDisposal=<primary>Abriendo el basurero...
orderBalances=Creando un ranking de {0} usuarios segun su saldo, espera...
oversizedMute=<dark_red>No puedes silenciar a un jugador por este periodo de tiempo.
oversizedTempban=<dark_red>No puedes banear por ese periodo de tiempo.
Expand Down
1 change: 1 addition & 0 deletions Essentials/src/main/resources/messages_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ month=mese
months=mesi
moreCommandDescription=Ti dà l''ammontare specificato per questo oggetto, o uno stack se non specificato.
moreCommandUsage=/<command> [quantità]
moreCommandUsage1=/<command> [quantità]
moreCommandUsage1Description=Ti dà l''ammontare specificato per questo oggetto, o uno stack se non specificato.
moreThanZero=La quantità deve essere maggiore di 0.
motdCommandDescription=Mostra il MOTD.
Expand Down
1 change: 0 additions & 1 deletion Essentials/src/main/resources/messages_nl.properties

Large diffs are not rendered by default.

Loading
Loading