mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-02 22:23:18 +00:00
Fixed Op's with no default mode set using local chat. It will now try
global, then world, then local in it's search order.
This commit is contained in:
1 parent
3bd256f15a
commit
94fa4859db
2 files changed
+32
-4
No files matched your search
+2
-1
@@ -81,4 +81,5 @@ v0.14:
|
||||
v0.15:
|
||||
- Updated for the new Bukkit Event system.
|
||||
v0.16:
|
||||
- Lowered event priorities to HIGH to allow other plugins the chance to beat us to the event and cancel.
|
||||
- Lowered event priorities to HIGH to allow other plugins the chance to beat us to the event and cancel.
|
||||
- Fixed Op's with no default mode set using local chat. It will now try global, then world, then local in it's search order.
|
||||
@@ -82,17 +82,44 @@ public class ChannelsHolder {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find a channel we are able to talk in, starting with the greatest range.
|
||||
*
|
||||
* @param player
|
||||
* @param type
|
||||
* @return channel or null if none.
|
||||
*/
|
||||
public Channel getChannel(Player player, channelTypes type) {
|
||||
|
||||
Channel local = null;
|
||||
Channel global = null;
|
||||
Channel world = null;
|
||||
|
||||
for (Channel channel: channels.values()) {
|
||||
if (channel.getType().equals(type)) {
|
||||
if (!plugin.getTowny().isPermissions()
|
||||
|| (plugin.getTowny().isPermissions() && ((TownyUniverse.getPermissionSource().hasPermission(player, channel.getPermission()))
|
||||
|| (channel.getPermission().isEmpty()))))
|
||||
return channel;
|
||||
|
||||
|| (channel.getPermission().isEmpty())))) {
|
||||
if (channel.getRange() == -1)
|
||||
global = channel;
|
||||
else if (channel.getRange() == 0)
|
||||
world = channel;
|
||||
else
|
||||
local = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (global != null)
|
||||
return global;
|
||||
|
||||
if (world != null)
|
||||
return world;
|
||||
|
||||
if (local != null)
|
||||
return local;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user