diff --git a/README.md b/README.md
index f009fb1..4177439 100644
--- a/README.md
+++ b/README.md
@@ -32,4 +32,4 @@ To use the command **sctrack**, you need at least one tracker addon. You can fin
* [PlayerTracker](https://github.com/arboriginal/SCT-PlayerTracker): Allows to track players positions.
* [PositionTracker](https://github.com/arboriginal/SCT-PositionTracker): Allows to track static positions.
-Have a look at the [Spigot plugin thread](https://www.spigotmc.org/threads/simplecompass.351093/), maybe other addon (made by other developers) will be listed.
+Have a look at the [Spigot plugin thread](https://www.spigotmc.org/threads/simplecompass.351093/), maybe other addons (made by other developers) will be listed.
diff --git a/pom.xml b/pom.xml
index 771ddcd..84f2090 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
me.arboriginal
SimpleCompass
- 1.1
+ 1.2
diff --git a/src/main/java/me/arboriginal/SimpleCompass/commands/InterfaceCommand.java b/src/main/java/me/arboriginal/SimpleCompass/commands/InterfaceCommand.java
index 6b88dc7..9ee0557 100644
--- a/src/main/java/me/arboriginal/SimpleCompass/commands/InterfaceCommand.java
+++ b/src/main/java/me/arboriginal/SimpleCompass/commands/InterfaceCommand.java
@@ -141,7 +141,7 @@ private void buildInterfaceTracking(Player player, BookMeta meta) {
"commands." + mainCommand + ".track.buttons").getKeys(false);
for (String trackerID : sc.targets.trackersPriority)
- if (player.hasPermission("scompass.track." + trackerID)) trackers.add(trackerID);
+ if (sc.targets.canUseTracker(player, trackerID)) trackers.add(trackerID);
for (String[] part : chunk(trackers.toArray(new String[trackers.size()]),
sc.locale.getInt("commands." + mainCommand + ".track.per_page"))) {
@@ -158,15 +158,17 @@ private void buildInterfaceTracking(Player player, BookMeta meta) {
for (String actionName : ordered) {
TrackingActions action; // @formatter:off
try { action = TrackingActions.valueOf(actionName); } catch (Exception e) { continue; }
- String text = sc.prepareMessage("commands." + mainCommand + ".track.buttons." + action + ".text");
// @formatter:on
if (!actions.contains(action)) {
- commands.put("{" + action + "}", ImmutableMap.of("text", inactiveCommandText(text)));
+ commands.put("{" + action + "}", ImmutableMap.of("text", sc.prepareMessage(
+ "commands." + mainCommand + ".track.buttons." + action + ".text_inactive")));
continue;
}
- commands.put("{" + action + "}", ImmutableMap.of("text", text, "hover",
- sc.prepareMessage("commands." + mainCommand + ".track.buttons." + action + ".hover"),
+ commands.put("{" + action + "}", ImmutableMap.of("text",
+ sc.prepareMessage("commands." + mainCommand + ".track.buttons." + action + ".text"),
+ "hover", sc.prepareMessage(
+ "commands." + mainCommand + ".track.buttons." + action + ".hover"),
"click", "/" + mainCommand
+ " " + (tracker.requireTarget(action) != TargetSelector.NONE
? SELECT_TARGET
@@ -184,16 +186,6 @@ private void buildInterfaceTracking(Player player, BookMeta meta) {
}
}
- private String inactiveCommandText(String text) {
- String[] inactiveText = text.replace("&", "§").split("§");
-
- String out = "§7";
- for (int i = 0; i < inactiveText.length; i++) if (inactiveText[i].length() > 1)
- out += (inactiveText[i].charAt(0) == 'l') ? "§" + inactiveText[i] + "§7" : inactiveText[i].substring(1);
-
- return out;
- }
-
private BaseComponent[] buildPage(Player player, CompassTypes type, List optionsList) {
CompassModes typeMode = sc.datas.compassModeGet(player, type);
CompassOptions selected = sc.datas.compassOptionGet(player, type);
diff --git a/src/main/java/me/arboriginal/SimpleCompass/plugin/Listeners.java b/src/main/java/me/arboriginal/SimpleCompass/plugin/Listeners.java
index e7b75b3..dd7c40c 100644
--- a/src/main/java/me/arboriginal/SimpleCompass/plugin/Listeners.java
+++ b/src/main/java/me/arboriginal/SimpleCompass/plugin/Listeners.java
@@ -105,6 +105,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
UUID uid = player.getUniqueId();
+ sc.compasses.removeCompass(player);
locks.remove(uid);
sc.tasks.clear(player);
sc.targets.unloadTargets(player);
diff --git a/src/main/java/me/arboriginal/SimpleCompass/plugin/SimpleCompass.java b/src/main/java/me/arboriginal/SimpleCompass/plugin/SimpleCompass.java
index ad19ae0..39d2f8d 100644
--- a/src/main/java/me/arboriginal/SimpleCompass/plugin/SimpleCompass.java
+++ b/src/main/java/me/arboriginal/SimpleCompass/plugin/SimpleCompass.java
@@ -12,6 +12,7 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.apache.commons.lang.time.DurationFormatUtils;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -68,7 +69,7 @@ public void onEnable() {
getServer().spigot();
}
catch (Exception e) {
- getServer().getPluginManager().disablePlugin(this);
+ Bukkit.getPluginManager().disablePlugin(this);
getLogger().severe("This plugin only works on Spigot servers!");
// No need to go on, it will not work
return;
@@ -84,7 +85,7 @@ public void onEnable() {
getCommand("scompass").setExecutor(new InterfaceCommand(this));
listeners = new Listeners(this);
- getServer().getPluginManager().registerEvents(listeners, this);
+ Bukkit.getPluginManager().registerEvents(listeners, this);
}
@Override
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 4047d6b..df126a0 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -4,6 +4,8 @@
# You will find an explanation of all parameters here:
# https://github.com/arboriginal/${project.artifactId}/blob/master/src/main/resources/config.yml
# .
+# Optional trackers list: https://github.com/arboriginal/SimpleCompass#trackers-addons ("Trackers addons" section)
+# .
# Personal message: I'd love to have videos showing and explaining the plugin in use, but I'm not good at making vids...
# If you are able to make one, send me the link (preferred on Youtube) and I will include it (with credit and link)
# on the plugin page. English language is IMHO the most important, because it will be understandable by the most,
diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml
index 5a1f855..c8d46e9 100644
--- a/src/main/resources/lang/en.yml
+++ b/src/main/resources/lang/en.yml
@@ -152,21 +152,27 @@ commands:
buttons: # (You can order options of this list.)
ASK:
text: "&8[&3&l♪&8]"
+ text_inactive: "&7[&l♪&7]"
hover: "&6Click to ask for a tracking"
START:
text: "&8[&2&l⚑&8]"
+ text_inactive: "&7[&l⚑&7]"
hover: "&6Click to start a tracking"
STOP:
text: "&8[&4&l⚑&8]"
+ text_inactive: "&7[&l⚑&7]"
hover: "&6Click to stop a tracking"
ADD:
text: "&8[&2&l+&8]"
+ text_inactive: "&7[&l+&7]"
hover: "&6Click to add a tracking"
DEL:
text: "&8[&4&l-&8]"
+ text_inactive: "&7[&l-&7]"
hover: "&6Click to remove a tracking"
HELP:
text: "&8[&6&l?&8]"
+ text_inactive: ""
hover: "&6Click to display help"
books:
options:
diff --git a/src/main/resources/lang/fr.yml b/src/main/resources/lang/fr.yml
index 9f37457..0f120dd 100644
--- a/src/main/resources/lang/fr.yml
+++ b/src/main/resources/lang/fr.yml
@@ -152,21 +152,27 @@ commands:
buttons: # (Tu peux ordonner les options de cette liste.)
ASK:
text: "&8[&3&l♪&8]"
+ text_inactive: "&7[&l♪&7]"
hover: "&6Clique pour demander un pistage"
START:
text: "&8[&2&l⚑&8]"
+ text_inactive: "&7[&l⚑&7]"
hover: "&6Clique pour commencer un pistage"
STOP:
text: "&8[&4&l⚑&8]"
+ text_inactive: "&7[&l⚑&7]"
hover: "&6Clique pour arrêter un pistage"
ADD:
text: "&8[&2&l+&8]"
+ text_inactive: "&7[&l+&7]"
hover: "&6Clique pour ajouter un pistage"
DEL:
text: "&8[&4&l-&8]"
+ text_inactive: "&7[&l-&7]"
hover: "&6Clique pour supprimer un pistage"
HELP:
text: "&8[&6&l?&8]"
+ text_inactive: ""
hover: "&6Clique pour afficher l'aide"
books:
options: