Made the chat event respect cancellation, fixed \ escaping, added Votifier event
This commit is contained in:
parent
4fe8085de8
commit
668c02a1e8
11 changed files with 67 additions and 2 deletions
Binary file not shown.
|
@ -24,5 +24,7 @@
|
|||
</classpathentry>
|
||||
<classpathentry kind="lib" path="D:/Downloads/htmlcleaner-2.16/htmlcleaner-2.16.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/PermissionsEx-1.23.3.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/votifier-1.9.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/Vault.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -16,4 +16,4 @@ commands:
|
|||
unlaugh:
|
||||
description: Unlaugh the last laugh.
|
||||
author: NorbiPeti
|
||||
depend: [Essentials, Towny, Minigames]
|
||||
depend: [Essentials, Towny, Minigames, Votifier]
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Town>(TU.getTownsMap().values());
|
||||
Nations = new ArrayList<Nation>(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<Permission> permissionProvider = getServer()
|
||||
.getServicesManager().getRegistration(
|
||||
net.milkbowl.vault.permission.Permission.class);
|
||||
if (permissionProvider != null) {
|
||||
permission = permissionProvider.getProvider();
|
||||
}
|
||||
return (permission != null);
|
||||
}
|
||||
|
||||
private boolean setupChat() {
|
||||
RegisteredServiceProvider<Chat> chatProvider = getServer()
|
||||
.getServicesManager().getRegistration(
|
||||
net.milkbowl.vault.chat.Chat.class);
|
||||
if (chatProvider != null) {
|
||||
chat = chatProvider.getProvider();
|
||||
}
|
||||
|
||||
return (chat != null);
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer()
|
||||
.getServicesManager().getRegistration(
|
||||
net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
|
||||
return (economy != null);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue