From af25281ef22045c17e86837da1ccbe04e21a7cbc Mon Sep 17 00:00:00 2001 From: Ken B Date: Thu, 9 Aug 2018 00:38:56 -0400 Subject: [PATCH] Fix job editor chat event --- pom.xml | 8 ++++---- .../com/gamingmesh/jobs/listeners/JobsListener.java | 13 +++++++++---- src/main/resources/plugin.yml | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 134ac2c2..8fe1b8a5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Jobs jobs - 4.5.1 + 4.6.3 Jobs http://maven.apache.org @@ -16,7 +16,7 @@ org.spigotmc spigot-api - 1.12-R0.1-SNAPSHOT + 1.13-R0.1-SNAPSHOT provided @@ -125,14 +125,14 @@ 1.7 - + diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index aa509f4b..9e96a52e 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -95,23 +95,28 @@ public class JobsListener implements Listener { } @EventHandler(priority = EventPriority.NORMAL) - public void AsyncPlayerChatEvent(AsyncPlayerChatEvent event) { + public void AsyncPlayerChatEvent(final AsyncPlayerChatEvent event) { if (event.isCancelled()) return; if (Util.getJobsEditorMap().isEmpty()) return; - Player player = event.getPlayer(); + final Player player = event.getPlayer(); if (!Util.getJobsEditorMap().containsKey(player.getUniqueId())) return; - String msg = Util.getJobsEditorMap().remove(player.getUniqueId()); + final String msg = Util.getJobsEditorMap().remove(player.getUniqueId()); if (msg == null) return; - player.performCommand(msg + event.getMessage()); + Bukkit.getServer().getScheduler().runTask(plugin, new Runnable() { + @Override + public void run() { + player.performCommand(msg + event.getMessage()); + } + }); event.setCancelled(true); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index fea6214b..15d4ac84 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Jobs description: Jobs Plugin for the BukkitAPI main: com.gamingmesh.jobs.Jobs -version: 4.6.1 +version: 4.6.3 api-version: 1.13 website: https://www.spigotmc.org/resources/jobs-reborn.4216/ author: phrstbrn