Skip to content

Commit

Permalink
- Dynmap added to softdepends list, courtesy of ZombiMigz with PR #31.
Browse files Browse the repository at this point in the history
  - Allow for colouring the alone message.
  - Adapt to change in Towny 0.96.2.17 Version code.
  - Build against 0.96.2.17, minimum required Towny version now
0.96.2.17.
  • Loading branch information
LlmDl committed Sep 10, 2020
1 parent aab307d commit b6f81d9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<version>0.96.2.12</version>
<version>0.96.2.17</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -106,7 +106,12 @@
<artifactId>placeholderapi</artifactId>
<version>2.10.4</version>
<scope>provided</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>16.0.2</version>
</dependency>
</dependencies>

<build>
Expand Down
5 changes: 4 additions & 1 deletion resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,7 @@ v0.76:
v0.77:
- Build against 0.96.2.12, minimum required Towny version now 0.96.2.12.
v0.78:
- Dynmap added to softdepends list, courtesy of ZombiMigz with PR #31.
- Dynmap added to softdepends list, courtesy of ZombiMigz with PR #31.
- Allow for colouring the alone message.
- Adapt to change in Towny 0.96.2.17 Version code.
- Build against 0.96.2.17, minimum required Towny version now 0.96.2.17.
11 changes: 5 additions & 6 deletions src/com/palmergames/bukkit/TownyChat/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Chat extends JavaPlugin {
private Towny towny = null;
private DynmapAPI dynMap = null;

private static String requiredTownyVersion = "0.96.2.12";
private static Version requiredTownyVersion = Version.fromString("0.96.2.17");
public static boolean usingPlaceholderAPI = false;
boolean chatConfigError = false;
boolean channelsConfigError = false;
Expand All @@ -62,7 +62,7 @@ public void onEnable() {
loadConfigs();

if (!townyVersionCheck(towny.getDescription().getVersion())) {
getLogger().severe("Towny version does not meet required version: " + requiredTownyVersion);
getLogger().severe("Towny version does not meet required version: " + requiredTownyVersion.toString());
this.getServer().getPluginManager().disablePlugin(this);
return;
} else {
Expand Down Expand Up @@ -91,10 +91,9 @@ public void onEnable() {
}

private boolean townyVersionCheck(String version) {
Version ver = new Version(version);
Version required = new Version(requiredTownyVersion);

return ver.compareTo(required) >= 0;
Version ver = Version.fromString(version);

return ver.compareTo(requiredTownyVersion) >= 0;
}

private void loadConfigs() {
Expand Down
17 changes: 15 additions & 2 deletions src/com/palmergames/bukkit/TownyChat/channels/StandardChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.earth2me.essentials.User;
import com.palmergames.bukkit.TownyChat.Chat;
import com.palmergames.bukkit.TownyChat.HexFormatter;
import com.palmergames.bukkit.TownyChat.TownyChatFormatter;
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
import com.palmergames.bukkit.TownyChat.events.AsyncChatHookEvent;
import com.palmergames.bukkit.TownyChat.listener.LocalTownyChatEvent;
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.TownyMessaging;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
Expand Down Expand Up @@ -278,8 +280,19 @@ private Set<Player> findRecipients(Player sender, List<Player> list) {
}
}

if ((recipients.size() <= 1) && (ChatSettings.isUsingAloneMessage()))
sender.sendMessage(ChatSettings.getUsingAloneMessageString());
if ((recipients.size() <= 1) && (ChatSettings.isUsingAloneMessage())) {

String aloneMsg;

if (Towny.is116Plus()) {
aloneMsg = HexFormatter.translateHexColors(ChatSettings.getUsingAloneMessageString());
} else {
aloneMsg = ChatColor.translateAlternateColorCodes('&', ChatSettings.getUsingAloneMessageString());
}

sender.sendMessage(aloneMsg);
}


return recipients;
}
Expand Down

0 comments on commit b6f81d9

Please sign in to comment.