镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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 @@ -2,10 +2,12 @@

import com.earth2me.essentials.User;
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import com.earth2me.essentials.utils.VersionUtil;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.Permission;
Expand Down Expand Up @@ -55,6 +57,8 @@ protected void run(final Server server, final User user, final String commandLab
final ItemStack head = inv.getHelmet();
if (head == null || head.getType() == Material.AIR) {
user.sendMessage(tl("hatEmpty"));
} else if (VersionUtil.getServerBukkitVersion().isHigherThan(VersionUtil.v1_9_4_R01) && head.getEnchantments().containsKey(Enchantment.BINDING_CURSE) && !user.isAuthorized("essentials.hat.ignore-binding")) {
user.sendMessage(tl("hatCurse"));
} else {
final ItemStack air = new ItemStack(Material.AIR);
inv.setHelmet(air);
Expand All @@ -71,6 +75,10 @@ protected void run(final Server server, final User user, final String commandLab
if (hand.getType().getMaxDurability() == 0) {
final PlayerInventory inv = user.getBase().getInventory();
final ItemStack head = inv.getHelmet();
if (VersionUtil.getServerBukkitVersion().isHigherThan(VersionUtil.v1_9_4_R01) && head != null && head.getEnchantments().containsKey(Enchantment.BINDING_CURSE) && !user.isAuthorized("essentials.hat.ignore-binding")) {
user.sendMessage(tl("hatCurse"));
return;
}
inv.setHelmet(hand);
inv.setItemInHand(head);
user.sendMessage(tl("hatPlaced"));
Expand Down
1 change: 1 addition & 0 deletions Essentials/src/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ godMode=\u00a76God mode\u00a7c {0}\u00a76.
groupDoesNotExist=\u00a74There''s no one online in this group\!
groupNumber=\u00a7c{0}\u00a7f online, for the full list\:\u00a7c /{1} {2}
hatArmor=\u00a74You cannot use this item as a hat\!
hatCurse=\u00a74You cannot remove a hat with the curse of binding\!
hatEmpty=\u00a74You are not wearing a hat.
hatFail=\u00a74You must have something to wear in your hand.
hatPlaced=\u00a76Enjoy your new hat\!
Expand Down