mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Fix issues with editors not respecting editing player
This commit is contained in:
parent
0ecd480790
commit
1276365a11
@ -1,16 +1,16 @@
|
||||
package net.citizensnpcs.editor;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
|
||||
public class CopierEditor extends Editor {
|
||||
private final String name;
|
||||
private final NPC npc;
|
||||
@ -34,7 +34,7 @@ public class CopierEditor extends Editor {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockClick(PlayerInteractEvent event) {
|
||||
if (event.getClickedBlock() == null) {
|
||||
if (event.getClickedBlock() == null || !event.getPlayer().equals(player)) {
|
||||
return;
|
||||
}
|
||||
NPC copy = npc.clone();
|
||||
|
@ -45,6 +45,8 @@ public class EquipmentEditor extends Editor {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event) {
|
||||
if (!event.getPlayer().equals(player))
|
||||
return;
|
||||
EquipmentSlot slot = null;
|
||||
if (event.getMessage().contains("helmet")
|
||||
&& event.getPlayer().hasPermission("citizens.npc.edit.equip.any-helmet")) {
|
||||
@ -83,7 +85,7 @@ public class EquipmentEditor extends Editor {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR && Editor.hasEditor(event.getPlayer())) {
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().equals(player)) {
|
||||
event.setUseItemInHand(Result.DENY);
|
||||
}
|
||||
}
|
||||
@ -93,7 +95,6 @@ public class EquipmentEditor extends Editor {
|
||||
if (!npc.isSpawned() || !event.getPlayer().equals(player) || Util.isOffHand(event)
|
||||
|| !npc.equals(CitizensAPI.getNPCRegistry().getNPC(event.getRightClicked())))
|
||||
return;
|
||||
|
||||
Equipper equipper = EQUIPPERS.get(npc.getEntity().getType());
|
||||
if (equipper == null) {
|
||||
equipper = new GenericEquipper();
|
||||
|
Loading…
Reference in New Issue
Block a user