diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index b1b5b0b..3d4fe73 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -133,13 +133,13 @@
org.bukkit
spigot-api
- 1.8
+ 1.8.3
provided
org.bukkit
spigot
- 1.8
+ 1.8.3
provided
@@ -186,12 +186,6 @@
5.6.7
compile
-
- com.cnaude.mineversechat
- MineverseChat
- 2.0
- compile
-
com.cnaude.jobs
Jobs
@@ -362,7 +356,7 @@
SNAPSHOT
UTF-8
- 1.8
+ 1.8.3
diff --git a/src/main/java/com/cnaude/purpleirc/Hooks/JobsHook.java b/src/main/java/com/cnaude/purpleirc/Hooks/JobsHook.java
index ba7d347..945841b 100644
--- a/src/main/java/com/cnaude/purpleirc/Hooks/JobsHook.java
+++ b/src/main/java/com/cnaude/purpleirc/Hooks/JobsHook.java
@@ -18,9 +18,6 @@ package com.cnaude.purpleirc.Hooks;
import com.cnaude.purpleirc.TemplateName;
import com.cnaude.purpleirc.PurpleIRC;
-import com.gamingmesh.jobs.Jobs;
-import com.gamingmesh.jobs.PlayerManager;
-import com.gamingmesh.jobs.container.Job;
import com.google.common.base.Joiner;
import java.util.ArrayList;
import org.bukkit.entity.Player;
@@ -32,7 +29,6 @@ import org.bukkit.entity.Player;
public class JobsHook {
private final PurpleIRC plugin;
- private PlayerManager playerManager = null;
/**
*
@@ -40,32 +36,49 @@ public class JobsHook {
*/
public JobsHook(PurpleIRC plugin) {
this.plugin = plugin;
- try {
- this.playerManager = Jobs.getPlayerManager();
- } catch (Exception ex) {
- plugin.logError("Jobs: " + ex.getMessage());
- }
}
public String getPlayerJob(Player player, boolean shortName) {
- if (playerManager == null) {
- return "";
- }
if (player != null) {
- ArrayList j = new ArrayList<>();
- if (plugin.isPluginEnabled("Jobs")) {
- for (Job job : Jobs.getJobs()) {
- if (playerManager.getJobsPlayer(player).isInJob(job)) {
- if (shortName) {
- j.add(job.getShortName());
- } else {
- j.add(job.getName());
+ try {
+ if (plugin.isPluginEnabled("Jobs")) {
+ ArrayList j = new ArrayList<>();
+ String m = plugin.getServer().getPluginManager().getPlugin("Jobs").getDescription().getMain();
+ if (m.contains("me.zford")) {
+ me.zford.jobs.PlayerManager playerManager = me.zford.jobs.Jobs.getPlayerManager();
+ if (playerManager == null) {
+ return "";
+ }
+ for (me.zford.jobs.container.Job job : me.zford.jobs.Jobs.getJobs()) {
+ if (playerManager.getJobsPlayer(player).isInJob(job)) {
+ if (shortName) {
+ j.add(job.getShortName());
+ } else {
+ j.add(job.getName());
+ }
+ }
+ }
+ } else if (m.contains("com.gamingmesh")) {
+ com.gamingmesh.jobs.PlayerManager playerManager = com.gamingmesh.jobs.Jobs.getPlayerManager();
+ if (playerManager == null) {
+ return "";
+ }
+ for (com.gamingmesh.jobs.container.Job job : com.gamingmesh.jobs.Jobs.getJobs()) {
+ if (playerManager.getJobsPlayer(player).isInJob(job)) {
+ if (shortName) {
+ j.add(job.getShortName());
+ } else {
+ j.add(job.getName());
+ }
+ }
}
}
+ if (!j.isEmpty()) {
+ return Joiner.on(plugin.getMsgTemplate(TemplateName.JOBS_SEPARATOR)).join(j);
+ }
}
- if (!j.isEmpty()) {
- return Joiner.on(plugin.getMsgTemplate(TemplateName.JOBS_SEPARATOR)).join(j);
- }
+ } catch (Exception ex) {
+ plugin.logError("getPlayerJob: " + ex.getMessage());
}
}
return "";
diff --git a/src/main/java/com/cnaude/purpleirc/Hooks/JobsHookOld.java b/src/main/java/com/cnaude/purpleirc/Hooks/JobsHookOld.java
deleted file mode 100644
index 3dc6bb8..0000000
--- a/src/main/java/com/cnaude/purpleirc/Hooks/JobsHookOld.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2014 cnaude
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package com.cnaude.purpleirc.Hooks;
-
-import com.cnaude.purpleirc.TemplateName;
-import com.cnaude.purpleirc.PurpleIRC;
-import com.google.common.base.Joiner;
-import java.util.ArrayList;
-import me.zford.jobs.Jobs;
-import me.zford.jobs.PlayerManager;
-import me.zford.jobs.container.Job;
-import org.bukkit.entity.Player;
-
-/**
- *
- * @author cnaude
- */
-public class JobsHookOld {
-
- private final PurpleIRC plugin;
- private PlayerManager playerManager = null;
-
- /**
- *
- * @param plugin
- */
- public JobsHookOld(PurpleIRC plugin) {
- this.plugin = plugin;
- try {
- this.playerManager = Jobs.getPlayerManager();
- } catch (Exception ex) {
- plugin.logError("Jobs: " + ex.getMessage());
- }
- }
-
- public String getPlayerJob(Player player, boolean shortName) {
- if (playerManager == null) {
- return "";
- }
- if (player != null) {
- ArrayList j = new ArrayList<>();
- if (plugin.isPluginEnabled("Jobs")) {
- for (Job job : Jobs.getJobs()) {
- if (playerManager.getJobsPlayer(player).isInJob(job)) {
- if (shortName) {
- j.add(job.getShortName());
- } else {
- j.add(job.getName());
- }
- }
- }
- if (!j.isEmpty()) {
- return Joiner.on(plugin.getMsgTemplate(TemplateName.JOBS_SEPARATOR)).join(j);
- }
- }
- }
- return "";
- }
-}
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
index 7a8e9c3..ef226bb 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
@@ -44,7 +44,6 @@ import com.cnaude.purpleirc.Hooks.CommandBookHook;
import com.cnaude.purpleirc.Hooks.DynmapHook;
import com.cnaude.purpleirc.Hooks.FactionChatHook;
import com.cnaude.purpleirc.Hooks.JobsHook;
-import com.cnaude.purpleirc.Hooks.JobsHookOld;
import com.cnaude.purpleirc.Hooks.ReportRTSHook;
import com.cnaude.purpleirc.Hooks.ShortifyHook;
import com.cnaude.purpleirc.Hooks.SuperVanishHook;
@@ -169,7 +168,6 @@ public class PurpleIRC extends JavaPlugin {
public TownyChatHook tcHook;
public DynmapHook dynmapHook;
public JobsHook jobsHook;
- public JobsHookOld jobsHookOld;
public AdminPrivateChatHook adminPrivateChatHook;
public ShortifyHook shortifyHook;
public ReportRTSHook reportRTSHook;
@@ -329,17 +327,8 @@ public class PurpleIRC extends JavaPlugin {
logInfo("CommandBook not detected.");
}
if (isPluginEnabled("Jobs")) {
- String m = getServer().getPluginManager().getPlugin("Jobs").getDescription().getMain();
- String jobsVersion = getServer().getPluginManager().getPlugin("Jobs").getDescription().getVersion();
- if (m.contains("me.zford")) {
- logInfo("Enabling legacy Jobs support: " + jobsVersion);
- jobsHookOld = new JobsHookOld(this);
- } else if (m.contains("com.gamingmesh")) {
- logInfo("Enabling new Jobs support: " + jobsVersion);
- jobsHook = new JobsHook(this);
- } else {
- logError("Unable to hook into Jobs: " + m);
- }
+ logInfo("Enabling new Jobs support.");
+ jobsHook = new JobsHook(this);
} else {
logInfo("Jobs not detected.");
}
diff --git a/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java b/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
index 3c6ed57..ecf178f 100644
--- a/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
+++ b/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
@@ -596,10 +596,6 @@ public class ChatTokenizer {
job = plugin.jobsHook.getPlayerJob(player, false);
jobShort = plugin.jobsHook.getPlayerJob(player, true);
}
- if (plugin.jobsHookOld != null) {
- job = plugin.jobsHookOld.getPlayerJob(player, false);
- jobShort = plugin.jobsHookOld.getPlayerJob(player, true);
- }
plugin.logDebug("[P]Raw message: " + message);
return message.replace("%DISPLAYNAME%", displayName)
.replace("%JOBS%", job)
@@ -670,13 +666,6 @@ public class ChatTokenizer {
jobShort = plugin.jobsHook.getPlayerJob(player, true);
}
}
- plugin.logDebug("playerTokenizer: 15 ");
- if (player != null) {
- if (plugin.jobsHookOld != null) {
- job = plugin.jobsHookOld.getPlayerJob(player, false);
- jobShort = plugin.jobsHookOld.getPlayerJob(player, true);
- }
- }
plugin.logDebug("[S]Raw message: " + message);
return message.replace("%DISPLAYNAME%", displayName)
.replace("%JOBS%", job)