mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 06:05:17 +01:00
Allow chat messages for any equipment slot
This commit is contained in:
parent
8ebfc31fce
commit
b640788033
@ -47,18 +47,15 @@ public class EquipmentEditor extends Editor {
|
|||||||
public void onPlayerChat(final AsyncPlayerChatEvent event) {
|
public void onPlayerChat(final AsyncPlayerChatEvent event) {
|
||||||
if (!event.getPlayer().equals(player))
|
if (!event.getPlayer().equals(player))
|
||||||
return;
|
return;
|
||||||
EquipmentSlot slot = null;
|
EquipmentSlot slot = Util.matchEnum(EquipmentSlot.values(), event.getMessage());
|
||||||
if (event.getMessage().contains("helmet")
|
|
||||||
&& event.getPlayer().hasPermission("citizens.npc.edit.equip.any-helmet")) {
|
|
||||||
slot = EquipmentSlot.HELMET;
|
|
||||||
}
|
|
||||||
if (event.getMessage().contains("offhand")
|
|
||||||
&& event.getPlayer().hasPermission("citizens.npc.edit.equip.offhand")) {
|
|
||||||
slot = EquipmentSlot.OFF_HAND;
|
|
||||||
}
|
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!event.getPlayer().hasPermission("citizens.npc.edit.equip." + slot.name().toLowerCase().replace(" ", ""))
|
||||||
|
&& (slot != EquipmentSlot.HELMET
|
||||||
|
|| !event.getPlayer().hasPermission("citizens.npc.edit.equip.any-helmet"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final EquipmentSlot finalSlot = slot;
|
final EquipmentSlot finalSlot = slot;
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user