mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +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
+31
-3
No files matched your search
@@ -82,3 +82,4 @@ v0.15:
|
|||||||
- Updated for the new Bukkit Event system.
|
- Updated for the new Bukkit Event system.
|
||||||
v0.16:
|
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;
|
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) {
|
public Channel getChannel(Player player, channelTypes type) {
|
||||||
|
|
||||||
|
Channel local = null;
|
||||||
|
Channel global = null;
|
||||||
|
Channel world = null;
|
||||||
|
|
||||||
for (Channel channel: channels.values()) {
|
for (Channel channel: channels.values()) {
|
||||||
if (channel.getType().equals(type)) {
|
if (channel.getType().equals(type)) {
|
||||||
if (!plugin.getTowny().isPermissions()
|
if (!plugin.getTowny().isPermissions()
|
||||||
|| (plugin.getTowny().isPermissions() && ((TownyUniverse.getPermissionSource().hasPermission(player, channel.getPermission()))
|
|| (plugin.getTowny().isPermissions() && ((TownyUniverse.getPermissionSource().hasPermission(player, channel.getPermission()))
|
||||||
|| (channel.getPermission().isEmpty()))))
|
|| (channel.getPermission().isEmpty())))) {
|
||||||
return channel;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user