diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar
index 9d6b2c3..3306943 100644
Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ
diff --git a/TheButtonAutoFlair/.classpath b/TheButtonAutoFlair/.classpath
index 7eabf54..f29f3d4 100644
--- a/TheButtonAutoFlair/.classpath
+++ b/TheButtonAutoFlair/.classpath
@@ -24,5 +24,7 @@
+
+
diff --git a/TheButtonAutoFlair/plugin.yml b/TheButtonAutoFlair/plugin.yml
index 4bd34de..cf2a83c 100644
--- a/TheButtonAutoFlair/plugin.yml
+++ b/TheButtonAutoFlair/plugin.yml
@@ -16,4 +16,4 @@ commands:
unlaugh:
description: Unlaugh the last laugh.
author: NorbiPeti
-depend: [Essentials, Towny, Minigames]
+depend: [Essentials, Towny, Minigames, Votifier]
diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java
index d973abd..daf8133 100644
--- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java
+++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java
@@ -29,6 +29,8 @@ import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.palmergames.bukkit.towny.object.WorldCoord;
+import com.vexsoftware.votifier.model.Vote;
+import com.vexsoftware.votifier.model.VotifierEvent;
import au.com.mineauz.minigames.MinigamePlayer;
import au.com.mineauz.minigames.Minigames;
@@ -149,6 +151,8 @@ public class PlayerListener implements Listener { // 2015.07.16.
if (essentials == null)
essentials = ((Essentials) Bukkit.getPluginManager().getPlugin(
"Essentials"));
+ if (event.isCancelled()) // TODO: Change FactionChat to /tellraw
+ return;
if (event.getMessage().equalsIgnoreCase("F")) {
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(event
.getPlayer().getUniqueId());
@@ -181,6 +185,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
.getPlayer().getUniqueId());
String message = event.getMessage();
message = message.replace("\"", "\\\"");
+ message = message.replace("\\", "\\\\");
// URLs
String[] parts = message.split("\\s+");
@@ -665,7 +670,7 @@ public class PlayerListener implements Listener { // 2015.07.16.
if (town.hasNation()) {
Resident res = tu.getResidentMap().get(
event.getPlayer().getName());
- if (res != null && res.hasTown()) {
+ if (res != null && res.hasTown()) { // TODO: Fix
Town town2 = res.getTown();
if (town2.hasNation()) {
if (town.getNation().getEnemies()
@@ -805,4 +810,17 @@ public class PlayerListener implements Listener { // 2015.07.16.
e.setCancelled(true);
// System.out.println("H");
}
+
+ @SuppressWarnings("deprecation")
+ @EventHandler
+ public void onVotifierEvent(VotifierEvent event) {
+ Vote vote = event.getVote();
+ System.out.println("Vote: " + vote);
+ org.bukkit.OfflinePlayer op = Bukkit.getOfflinePlayer(vote
+ .getUsername());
+ if (op != null) {
+ PluginMain.economy.depositPlayer(op, 50.0);
+ }
+
+ }
}
diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java
index ac6c190..3e30f6f 100644
--- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java
+++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java
@@ -1,11 +1,16 @@
package tk.sznp.thebuttonautoflair;
+import net.milkbowl.vault.chat.Chat;
+import net.milkbowl.vault.economy.Economy;
+import net.milkbowl.vault.permission.Permission;
+
import org.apache.commons.io.IOUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
+import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Scoreboard;
import org.htmlcleaner.HtmlCleaner;
@@ -102,6 +107,10 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
Towns = new ArrayList(TU.getTownsMap().values());
Nations = new ArrayList(TU.getNationsMap().values());
+ setupChat();
+ setupEconomy();
+ setupPermissions();
+
Runnable r = new Runnable() {
public void run() {
ThreadMethod();
@@ -382,4 +391,40 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
+ " to system classloader");
}
}
+
+ public static Permission permission = null;
+ public static Economy economy = null;
+ public static Chat chat = null;
+
+ private boolean setupPermissions() {
+ RegisteredServiceProvider permissionProvider = getServer()
+ .getServicesManager().getRegistration(
+ net.milkbowl.vault.permission.Permission.class);
+ if (permissionProvider != null) {
+ permission = permissionProvider.getProvider();
+ }
+ return (permission != null);
+ }
+
+ private boolean setupChat() {
+ RegisteredServiceProvider chatProvider = getServer()
+ .getServicesManager().getRegistration(
+ net.milkbowl.vault.chat.Chat.class);
+ if (chatProvider != null) {
+ chat = chatProvider.getProvider();
+ }
+
+ return (chat != null);
+ }
+
+ private boolean setupEconomy() {
+ RegisteredServiceProvider economyProvider = getServer()
+ .getServicesManager().getRegistration(
+ net.milkbowl.vault.economy.Economy.class);
+ if (economyProvider != null) {
+ economy = economyProvider.getProvider();
+ }
+
+ return (economy != null);
+ }
}
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class
index 4237eb3..b9cc49b 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$1.class differ
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class
index 33c61b8..98952a2 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$2.class differ
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class
index 4a97d76..da9e42c 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class
index 5d9c002..91a955b 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class differ
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class
index 96c364d..661065f 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class differ
diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class
index 2fdfb55..c02ae22 100644
Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class differ