Simplified the visibility mixin for now.
This commit is contained in:
parent
746ce7fb55
commit
226fcfe32f
@ -92,7 +92,7 @@ public class InternalListener implements Listener
|
|||||||
{
|
{
|
||||||
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
||||||
if (current.contains(senderId)) continue;
|
if (current.contains(senderId)) continue;
|
||||||
if (!Mixin.isVisible(watcher, senderId)) continue;
|
if (!Mixin.canSee(watcher, senderId)) continue;
|
||||||
|
|
||||||
event.getTabCompletions().add(senderId);
|
event.getTabCompletions().add(senderId);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class BukkitGlueCommand extends Command
|
|||||||
for (String senderId : Mixin.getOnlineSenderIds())
|
for (String senderId : Mixin.getOnlineSenderIds())
|
||||||
{
|
{
|
||||||
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
if (!senderId.toLowerCase().startsWith(tokenlc)) continue;
|
||||||
if (!Mixin.isVisible(sender, senderId)) continue;
|
if (!Mixin.canSee(sender, senderId)) continue;
|
||||||
ret.add(senderId);
|
ret.add(senderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,38 +210,21 @@ public class Mixin
|
|||||||
// STATIC EXPOSE: VISIBILITY
|
// STATIC EXPOSE: VISIBILITY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static boolean isVisible(String watcherId, String watcheeId)
|
public static boolean canSee(String watcherId, String watcheeId)
|
||||||
{
|
{
|
||||||
return getVisibilityMixin().isVisible(watcherId, watcheeId);
|
return getVisibilityMixin().canSee(watcherId, watcheeId);
|
||||||
}
|
}
|
||||||
public static boolean isVisible(CommandSender watcher, String watcheeId)
|
public static boolean canSee(CommandSender watcher, String watcheeId)
|
||||||
{
|
{
|
||||||
return getVisibilityMixin().isVisible(watcher, watcheeId);
|
return getVisibilityMixin().canSee(watcher, watcheeId);
|
||||||
}
|
}
|
||||||
public static boolean isVisible(String watcherId, CommandSender watchee)
|
public static boolean canSee(String watcherId, CommandSender watchee)
|
||||||
{
|
{
|
||||||
return getVisibilityMixin().isVisible(watcherId, watchee);
|
return getVisibilityMixin().canSee(watcherId, watchee);
|
||||||
}
|
}
|
||||||
public static boolean isVisible(CommandSender watcher, CommandSender watchee)
|
public static boolean canSee(CommandSender watcher, CommandSender watchee)
|
||||||
{
|
{
|
||||||
return getVisibilityMixin().isVisible(watcher, watchee);
|
return getVisibilityMixin().canSee(watcher, watchee);
|
||||||
}
|
|
||||||
|
|
||||||
public static void setVisible(String watcherId, String watcheeId, boolean visible)
|
|
||||||
{
|
|
||||||
getVisibilityMixin().setVisible(watcherId, watcheeId, visible);
|
|
||||||
}
|
|
||||||
public static void setVisible(CommandSender watcher, String watcheeId, boolean visible)
|
|
||||||
{
|
|
||||||
getVisibilityMixin().setVisible(watcher, watcheeId, visible);
|
|
||||||
}
|
|
||||||
public static void setVisible(String watcherId, CommandSender watchee, boolean visible)
|
|
||||||
{
|
|
||||||
getVisibilityMixin().setVisible(watcherId, watchee, visible);
|
|
||||||
}
|
|
||||||
public static void setVisible(CommandSender watcher, CommandSender watchee, boolean visible)
|
|
||||||
{
|
|
||||||
getVisibilityMixin().setVisible(watcher, watchee, visible);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -4,13 +4,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
public interface VisibilityMixin
|
public interface VisibilityMixin
|
||||||
{
|
{
|
||||||
public boolean isVisible(String watcherId, String watcheeId);
|
public boolean canSee(String watcherId, String watcheeId);
|
||||||
public boolean isVisible(CommandSender watcher, String watcheeId);
|
public boolean canSee(CommandSender watcher, String watcheeId);
|
||||||
public boolean isVisible(String watcherId, CommandSender watchee);
|
public boolean canSee(String watcherId, CommandSender watchee);
|
||||||
public boolean isVisible(CommandSender watcher, CommandSender watchee);
|
public boolean canSee(CommandSender watcher, CommandSender watchee);
|
||||||
|
|
||||||
public void setVisible(String watcherId, String watcheeId, boolean visible);
|
|
||||||
public void setVisible(CommandSender watcher, String watcheeId, boolean visible);
|
|
||||||
public void setVisible(String watcherId, CommandSender watchee, boolean visible);
|
|
||||||
public void setVisible(CommandSender watcher, CommandSender watchee, boolean visible);
|
|
||||||
}
|
}
|
||||||
|
@ -19,25 +19,25 @@ public class VisibilityMixinDefault extends VisibilityMixinAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(String watcherId, String watcheeId)
|
public boolean canSee(String watcherId, String watcheeId)
|
||||||
{
|
{
|
||||||
return this.isVisible(SenderUtil.getSender(watcherId), SenderUtil.getSender(watcheeId));
|
return this.canSee(SenderUtil.getSender(watcherId), SenderUtil.getSender(watcheeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(CommandSender watcher, String watcheeId)
|
public boolean canSee(CommandSender watcher, String watcheeId)
|
||||||
{
|
{
|
||||||
return this.isVisible(watcher, SenderUtil.getSender(watcheeId));
|
return this.canSee(watcher, SenderUtil.getSender(watcheeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(String watcherId, CommandSender watchee)
|
public boolean canSee(String watcherId, CommandSender watchee)
|
||||||
{
|
{
|
||||||
return this.isVisible(SenderUtil.getSender(watcherId), watchee);
|
return this.canSee(SenderUtil.getSender(watcherId), watchee);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(CommandSender watcher, CommandSender watchee)
|
public boolean canSee(CommandSender watcher, CommandSender watchee)
|
||||||
{
|
{
|
||||||
Player pwatcher = SenderUtil.getAsPlayer(watcher);
|
Player pwatcher = SenderUtil.getAsPlayer(watcher);
|
||||||
Player pwatchee = SenderUtil.getAsPlayer(watchee);
|
Player pwatchee = SenderUtil.getAsPlayer(watchee);
|
||||||
@ -48,40 +48,4 @@ public class VisibilityMixinDefault extends VisibilityMixinAbstract
|
|||||||
return pwatcher.canSee(pwatchee);
|
return pwatcher.canSee(pwatchee);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVisible(String watcherId, String watcheeId, boolean visible)
|
|
||||||
{
|
|
||||||
this.setVisible(SenderUtil.getSender(watcherId), SenderUtil.getSender(watcheeId), visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVisible(CommandSender watcher, String watcheeId, boolean visible)
|
|
||||||
{
|
|
||||||
this.setVisible(watcher, SenderUtil.getSender(watcheeId), visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVisible(String watcherId, CommandSender watchee, boolean visible)
|
|
||||||
{
|
|
||||||
this.setVisible(SenderUtil.getSender(watcherId), watchee, visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVisible(CommandSender watcher, CommandSender watchee, boolean visible)
|
|
||||||
{
|
|
||||||
Player pwatcher = SenderUtil.getAsPlayer(watcher);
|
|
||||||
Player pwatchee = SenderUtil.getAsPlayer(watchee);
|
|
||||||
|
|
||||||
if (pwatcher == null) return;
|
|
||||||
if (pwatchee == null) return;
|
|
||||||
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
pwatcher.showPlayer(pwatchee);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pwatcher.hidePlayer(pwatchee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user