mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-05 06:28:56 +00:00
v0.85:
- Bump minimum Towny version to 0.96.5.5.
This commit is contained in:
1 parent
44978325e5
commit
99d0433b3e
4 files changed
+13
-14
No files matched your search
@@ -356,9 +356,10 @@ v0.84:
|
||||
- Closes https://github.com/TownyAdvanced/Towny/issues/4087.
|
||||
- Implemented PlayerJoinChatChannelEvent, courtesy of Glare with PR #32.
|
||||
- Closes https://github.com/TownyAdvanced/Towny/issues/4575.
|
||||
v0.85:
|
||||
- Add persistant leaving for channels.
|
||||
- Uses Towny resident metadata, you will be able to see ignored channels on your /res status screen.
|
||||
- Normal joining/leaving commands are used just like before.
|
||||
- Closes https://github.com/TownyAdvanced/Towny/issues/3133.
|
||||
- Bump minimum Towny version to 0.96.3.0.
|
||||
v0.85:
|
||||
- Bump minimum Towny version to 0.96.5.5.
|
||||
@@ -45,7 +45,7 @@ public class Chat extends JavaPlugin {
|
||||
private Towny towny = null;
|
||||
private DynmapAPI dynMap = null;
|
||||
|
||||
private static Version requiredTownyVersion = Version.fromString("0.96.3.0");
|
||||
private static Version requiredTownyVersion = Version.fromString("0.96.5.5");
|
||||
public static boolean usingPlaceholderAPI = false;
|
||||
boolean chatConfigError = false;
|
||||
boolean channelsConfigError = false;
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.dynmap.DynmapAPI;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -48,13 +49,14 @@ public class StandardChannel extends Channel {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Set<Player> recipients = null;
|
||||
Resident resident = null;
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
if (resident == null)
|
||||
return;
|
||||
Town town = null;
|
||||
Nation nation = null;
|
||||
String Format = "";
|
||||
|
||||
try {
|
||||
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
town = resident.getTown();
|
||||
nation = resident.getTown().getNation();
|
||||
} catch (NotRegisteredException e1) {
|
||||
@@ -307,6 +309,7 @@ public class StandardChannel extends Channel {
|
||||
recipients.addAll(event.getRecipients());
|
||||
spies = checkSpying(spies);
|
||||
String format = formatSpyMessage(type, event.getPlayer());
|
||||
if (format == null) return;
|
||||
|
||||
// Remove spies who've already seen the message naturally.
|
||||
for (Player spy : spies)
|
||||
@@ -323,12 +326,14 @@ public class StandardChannel extends Channel {
|
||||
* @param player - Player who chatted.
|
||||
* @return format - Message format.
|
||||
*/
|
||||
@Nullable
|
||||
private String formatSpyMessage(channelTypes type, Player player) {
|
||||
Resident resident = null;
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
if (resident == null)
|
||||
return null;
|
||||
Town town = null;
|
||||
Nation nation = null;
|
||||
try {
|
||||
resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
town = resident.getTown();
|
||||
nation = resident.getTown().getNation();
|
||||
} catch (NotRegisteredException e1) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.palmergames.bukkit.TownyChat.config.ChatSettings;
|
||||
import com.palmergames.bukkit.TownyChat.tasks.onPlayerJoinTask;
|
||||
import com.palmergames.bukkit.towny.Towny;
|
||||
import com.palmergames.bukkit.towny.TownyMessaging;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.exceptions.TownyException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import com.palmergames.bukkit.towny.object.Translation;
|
||||
@@ -186,9 +185,8 @@ public class TownyChatPlayerListener implements Listener {
|
||||
* We found no channels available so modify the chat (if enabled) and exit.
|
||||
*/
|
||||
if (ChatSettings.isModify_chat()) {
|
||||
try {
|
||||
event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", ""));
|
||||
Resident resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
|
||||
Resident resident = TownyUniverse.getInstance().getResident(player.getUniqueId());
|
||||
|
||||
LocalTownyChatEvent chatEvent = new LocalTownyChatEvent(event, resident);
|
||||
|
||||
@@ -197,11 +195,6 @@ public class TownyChatPlayerListener implements Listener {
|
||||
} else {
|
||||
event.setFormat(TownyChatFormatter.getChatFormat(chatEvent));
|
||||
}
|
||||
|
||||
} catch (NotRegisteredException e) {
|
||||
// World or resident not registered with Towny
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user