Supporting clean installs
And other fixes Also moved the Votifier reward to the core Checking if Towny is present (only a soft-depend now)
This commit is contained in:
parent
f7c1106d1c
commit
4744f2edf9
9 changed files with 43 additions and 88 deletions
|
@ -11,8 +11,6 @@
|
|||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
|
@ -28,36 +26,6 @@
|
|||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap-Towny:master-0.60-g924051d-7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap:v2.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nijikokun.bukkit:Permissions:3.1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: ru.tehkode:PermissionsEx:1.19.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: de.bananaco:bPermissions:2.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.platymuus.bukkit.permissions:PermissionsBukkit:1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.anjocaido:EssentialsGroupManager:2.10.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sourceforge.htmlcleaner:htmlcleaner:2.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jdom:jdom2:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.19.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
||||
|
|
9
pom.xml
9
pom.xml
|
@ -155,10 +155,6 @@
|
|||
<id>Essentials</id>
|
||||
<url>http://repo.ess3.net/content/repositories/essrel/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Votifier</id>
|
||||
<url>https://dl.bintray.com/nuvotifier/maven/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Minigames</id>
|
||||
<url>http://maven.addstar.com.au/artifactory/release</url>
|
||||
|
@ -207,11 +203,6 @@
|
|||
<artifactId>Towny</artifactId>
|
||||
<version>8d3b6b6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vexsoftware</groupId>
|
||||
<artifactId>nuvotifier-universal</artifactId>
|
||||
<version>2.3.4</version>
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>au.com.mineauz</groupId> <artifactId>Minigames</artifactId>
|
||||
<version>1.8.0</version> </dependency> -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package buttondevteam.chat;
|
||||
|
||||
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
||||
import buttondevteam.chat.components.chatonly.ChatOnlyComponent;
|
||||
import buttondevteam.chat.components.fun.FunComponent;
|
||||
import buttondevteam.chat.components.fun.UnlolCommand;
|
||||
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
||||
import buttondevteam.chat.components.towny.TownyComponent;
|
||||
import buttondevteam.chat.formatting.ChatFormatter;
|
||||
import buttondevteam.chat.formatting.TellrawEvent;
|
||||
import buttondevteam.chat.formatting.TellrawPart;
|
||||
|
@ -178,16 +178,11 @@ public class ChatProcessing {
|
|||
if (score < 0) // Never send messages to score below 0
|
||||
sender.sendMessage("§cYou don't have permission to send this message or something went wrong");
|
||||
else {
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||
String.format("tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID,
|
||||
score, jsonstr));
|
||||
if (e.getChannel().ID.equals(PluginMain.TownChat.ID)
|
||||
|| e.getChannel().ID.equals(PluginMain.NationChat.ID)) {
|
||||
((List<TellrawPart>) json.getExtra()).add(0, new TellrawPart("[SPY]"));
|
||||
jsonstr = toJson(json);
|
||||
Bukkit.getServer().dispatchCommand(PluginMain.Console, String.format(
|
||||
"tellraw @a[score_%s=1000,score_%s_min=1000] %s", channel.ID, channel.ID, jsonstr));
|
||||
}
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||
String.format("tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID,
|
||||
score, jsonstr));
|
||||
val tc = ComponentManager.getIfEnabled(TownyComponent.class);
|
||||
if (tc != null) tc.handleSpies(channel, json, ChatProcessing::toJson);
|
||||
}
|
||||
} else
|
||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||
|
|
|
@ -5,7 +5,6 @@ import buttondevteam.chat.components.announce.AnnouncerComponent;
|
|||
import buttondevteam.chat.components.flair.FlairComponent;
|
||||
import buttondevteam.chat.components.fun.FunComponent;
|
||||
import buttondevteam.chat.components.towncolors.TownColorComponent;
|
||||
import buttondevteam.chat.components.towncolors.TownyListener;
|
||||
import buttondevteam.chat.components.towny.TownyComponent;
|
||||
import buttondevteam.chat.listener.PlayerJoinLeaveListener;
|
||||
import buttondevteam.chat.listener.PlayerListener;
|
||||
|
@ -33,9 +32,6 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
|||
|
||||
public static Scoreboard SB;
|
||||
|
||||
public static Channel TownChat;
|
||||
public static Channel NationChat;
|
||||
|
||||
public ConfigData<String> notificationSound() {
|
||||
return getIConfig().getData("notificationSound", "");
|
||||
}
|
||||
|
@ -52,20 +48,21 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
|||
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new TownyListener(), this);
|
||||
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
||||
Console = this.getServer().getConsoleSender();
|
||||
|
||||
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||
|
||||
Component.registerComponent(this, new TownyComponent());
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Towny"))
|
||||
Component.registerComponent(this, new TownyComponent());
|
||||
|
||||
TBMCChatAPI.RegisterChatChannel(new Channel("§7RP§f", Color.Gray, "rp", null)); //Since it's null, it's recognised as global
|
||||
|
||||
if (!setupEconomy() || !setupPermissions())
|
||||
TBMCCoreAPI.SendException("We're in trouble", new Exception("Failed to set up economy or permissions!"));
|
||||
|
||||
Component.registerComponent(this, new TownColorComponent());
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Towny"))
|
||||
Component.registerComponent(this, new TownColorComponent());
|
||||
Component.registerComponent(this, new FlairComponent()); //The original purpose of this plugin
|
||||
Component.registerComponent(this, new AnnouncerComponent());
|
||||
Component.registerComponent(this, new FunComponent());
|
||||
|
|
|
@ -97,6 +97,7 @@ public class TownColorComponent extends Component {
|
|||
registerCommand(new buttondevteam.chat.components.towncolors.admin.TownColorCommand());
|
||||
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
|
||||
registerCommand(new TCCount());
|
||||
registerListener(new TownyListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package buttondevteam.chat.components.towny;
|
||||
|
||||
import buttondevteam.chat.ChatProcessing;
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.core.component.channel.Channel;
|
||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
|
@ -23,12 +22,14 @@ public class TownyAnnouncer {
|
|||
String groupID = m.group(2); //The group ID is correctly cased
|
||||
switch (String.valueOf(m.group(1))) { //valueOf: Handles null
|
||||
case "Town":
|
||||
TBMCChatAPI.SendSystemMessage(PluginMain.TownChat,
|
||||
if (townChannel == null) return;
|
||||
TBMCChatAPI.SendSystemMessage(townChannel,
|
||||
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, false), groupID),
|
||||
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
||||
break;
|
||||
case "Nation":
|
||||
TBMCChatAPI.SendSystemMessage(PluginMain.NationChat,
|
||||
if (nationChannel == null) return;
|
||||
TBMCChatAPI.SendSystemMessage(nationChannel,
|
||||
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, true), groupID),
|
||||
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
||||
break;
|
||||
|
@ -52,15 +53,21 @@ public class TownyAnnouncer {
|
|||
};
|
||||
|
||||
private static TBMCSystemChatEvent.BroadcastTarget target;
|
||||
private static Channel townChannel;
|
||||
private static Channel nationChannel;
|
||||
|
||||
public static void setup() {
|
||||
public static void setup(Channel townChannel, Channel nationChannel) {
|
||||
target = TBMCSystemChatEvent.BroadcastTarget.add("towny");
|
||||
TownyAnnouncer.townChannel = townChannel;
|
||||
TownyAnnouncer.nationChannel = nationChannel;
|
||||
TownyLogger.log.addHandler(HANDLER);
|
||||
}
|
||||
|
||||
public static void setdown() {
|
||||
TBMCSystemChatEvent.BroadcastTarget.remove(target);
|
||||
target = null;
|
||||
TownyAnnouncer.townChannel = null;
|
||||
TownyAnnouncer.nationChannel = null;
|
||||
TownyLogger.log.removeHandler(HANDLER);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package buttondevteam.chat.components.towny;
|
||||
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.chat.formatting.TellrawPart;
|
||||
import buttondevteam.core.component.channel.Channel;
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.chat.Color;
|
||||
|
@ -17,6 +18,8 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TownyComponent extends Component {
|
||||
|
@ -24,16 +27,19 @@ public class TownyComponent extends Component {
|
|||
private static ArrayList<String> Towns;
|
||||
private static ArrayList<String> Nations;
|
||||
|
||||
private Channel TownChat;
|
||||
private Channel NationChat;
|
||||
|
||||
@Override
|
||||
protected void enable() {
|
||||
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
||||
Towns = TU.getTownsMap().values().stream().map(Town::getName).collect(Collectors.toCollection(ArrayList::new)); // Creates a snapshot of towns, new towns will be added when needed
|
||||
Nations = TU.getNationsMap().values().stream().map(Nation::getName).collect(Collectors.toCollection(ArrayList::new)); // Same here but with nations
|
||||
TBMCChatAPI.RegisterChatChannel(
|
||||
PluginMain.TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
|
||||
TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
|
||||
TBMCChatAPI.RegisterChatChannel(
|
||||
PluginMain.NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
|
||||
TownyAnnouncer.setup();
|
||||
NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
|
||||
TownyAnnouncer.setup(TownChat, NationChat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +47,14 @@ public class TownyComponent extends Component {
|
|||
TownyAnnouncer.setdown();
|
||||
}
|
||||
|
||||
public void handleSpies(Channel channel, TellrawPart json, Function<TellrawPart, String> toJson) {
|
||||
if (channel.ID.equals(TownChat.ID) || channel.ID.equals(NationChat.ID)) {
|
||||
((List<TellrawPart>) json.getExtra()).add(0, new TellrawPart("[SPY]"));
|
||||
String jsonstr = toJson.apply(json);
|
||||
Bukkit.getServer().dispatchCommand(PluginMain.Console, String.format(
|
||||
"tellraw @a[score_%s=1000,score_%s_min=1000] %s", channel.ID, channel.ID, jsonstr));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error message for the message sender if they can't send it and the score
|
||||
|
@ -49,13 +63,13 @@ public class TownyComponent extends Component {
|
|||
if (!(sender instanceof Player))
|
||||
return new Channel.RecipientTestResult("§cYou are not a player!");
|
||||
Resident resident = TU.getResidentMap().get(sender.getName().toLowerCase());
|
||||
Channel.RecipientTestResult result = checkTownNationChatInternal(sender, nationchat, resident);
|
||||
Channel.RecipientTestResult result = checkTownNationChatInternal(nationchat, resident);
|
||||
if (result.errormessage != null && resident != null && resident.getModes().contains("spy")) // Only use spy if they wouldn't see it
|
||||
result = new Channel.RecipientTestResult(1000, "allspies"); // There won't be more than a thousand towns/nations probably
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Channel.RecipientTestResult checkTownNationChatInternal(CommandSender sender, boolean nationchat,
|
||||
private static Channel.RecipientTestResult checkTownNationChatInternal(boolean nationchat,
|
||||
Resident resident) {
|
||||
try {
|
||||
/*
|
||||
|
|
|
@ -22,8 +22,6 @@ import buttondevteam.lib.player.TBMCPlayer;
|
|||
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
import lombok.val;
|
||||
import net.ess3.api.events.NickChangeEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -139,21 +137,6 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@SuppressWarnings("deprecation")
|
||||
public void onVotifierEvent(VotifierEvent event) { //TODO: Move to teh Core eh
|
||||
Vote vote = event.getVote();
|
||||
PluginMain.Instance.getLogger().info("Vote: " + vote);
|
||||
org.bukkit.OfflinePlayer op = Bukkit.getOfflinePlayer(vote.getUsername());
|
||||
Player p = Bukkit.getPlayer(vote.getUsername());
|
||||
if (op != null) {
|
||||
PluginMain.economy.depositPlayer(op, 50.0);
|
||||
}
|
||||
if (p != null) {
|
||||
p.sendMessage("§bThanks for voting! $50 was added to your account.");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onConsoleCommand(ServerCommandEvent event) {
|
||||
if (onCommandPreprocess(event.getSender(), event.getCommand()))
|
||||
|
|
|
@ -33,13 +33,12 @@ commands:
|
|||
author: NorbiPeti
|
||||
depend:
|
||||
- Essentials
|
||||
- Towny
|
||||
- Votifier
|
||||
- Vault
|
||||
- ThorpeCore
|
||||
soft-depend:
|
||||
- Minigames
|
||||
- Dynmap-Towny
|
||||
- Towny
|
||||
permissions:
|
||||
tbmc.admin:
|
||||
description: Gives access to /un- commands and /u admin commands
|
||||
|
|
Loading…
Reference in a new issue