Search in sources :

Example 1 with BukkitMCPlayer

use of com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer in project CommandHelper by EngineHub.

the class CommandHelperInterpreterListener method onPlayerChat.

@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final AsyncPlayerChatEvent event) {
    if (interpreterMode.contains(event.getPlayer().getName())) {
        final MCPlayer p = new BukkitMCPlayer(event.getPlayer());
        event.setCancelled(true);
        StaticLayer.SetFutureRunnable(null, 0, new Runnable() {

            @Override
            public void run() {
                textLine(p, event.getMessage());
            }
        });
    }
}
Also used : MCPlayer(com.laytonsmith.abstraction.MCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 2 with BukkitMCPlayer

use of com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer in project CommandHelper by EngineHub.

the class BukkitMCPluginMeta method sendIncomingMessage0.

@Override
protected void sendIncomingMessage0(MCPlayer player, String channel, byte[] message) {
    Player p = ((BukkitMCPlayer) player)._Player();
    Bukkit.getMessenger().dispatchIncomingMessage(p, channel, message);
}
Also used : MCPlayer(com.laytonsmith.abstraction.MCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) Player(org.bukkit.entity.Player) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer)

Example 3 with BukkitMCPlayer

use of com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer in project CommandHelper by EngineHub.

the class BukkitMCServer method getOnlinePlayers.

@Override
public Collection<MCPlayer> getOnlinePlayers() {
    Collection<? extends Player> players = s.getOnlinePlayers();
    Set<MCPlayer> mcpa = new HashSet<>();
    for (Player p : players) {
        mcpa.add(new BukkitMCPlayer(p));
    }
    return mcpa;
}
Also used : Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) MCPlayer(com.laytonsmith.abstraction.MCPlayer) MCOfflinePlayer(com.laytonsmith.abstraction.MCOfflinePlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) MCPlayer(com.laytonsmith.abstraction.MCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) HashSet(java.util.HashSet)

Example 4 with BukkitMCPlayer

use of com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer in project CommandHelper by EngineHub.

the class RandomTests method testCastFromBukkitMCPlayerToBukkitMCCommandSender.

@Test
public void testCastFromBukkitMCPlayerToBukkitMCCommandSender() throws Exception {
    Player p = mock(Player.class);
    BukkitMCCommandSender c = new BukkitMCCommandSender(new BukkitMCPlayer(p));
}
Also used : Player(org.bukkit.entity.Player) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) MCPlayer(com.laytonsmith.abstraction.MCPlayer) BukkitMCCommandSender(com.laytonsmith.abstraction.bukkit.BukkitMCCommandSender) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) Test(org.junit.Test)

Example 5 with BukkitMCPlayer

use of com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer in project CommandHelper by EngineHub.

the class CommandHelperInterpreterListener method onPlayerCommandPreprocess.

@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
    if (event.isCancelled()) {
        return;
    }
    if (interpreterMode.contains(event.getPlayer().getName())) {
        MCPlayer p = new BukkitMCPlayer(event.getPlayer());
        textLine(p, event.getMessage());
        event.setCancelled(true);
    }
}
Also used : MCPlayer(com.laytonsmith.abstraction.MCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) BukkitMCPlayer(com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer) EventHandler(org.bukkit.event.EventHandler)

Aggregations

MCPlayer (com.laytonsmith.abstraction.MCPlayer)7 BukkitMCPlayer (com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer)7 Player (org.bukkit.entity.Player)4 EventHandler (org.bukkit.event.EventHandler)3 MCCommand (com.laytonsmith.abstraction.MCCommand)1 MCCommandSender (com.laytonsmith.abstraction.MCCommandSender)1 MCOfflinePlayer (com.laytonsmith.abstraction.MCOfflinePlayer)1 BukkitMCCommand (com.laytonsmith.abstraction.bukkit.BukkitMCCommand)1 BukkitMCCommandSender (com.laytonsmith.abstraction.bukkit.BukkitMCCommandSender)1 MCPlayerCommandEvent (com.laytonsmith.abstraction.events.MCPlayerCommandEvent)1 InternalException (com.laytonsmith.core.InternalException)1 ConfigRuntimeException (com.laytonsmith.core.exceptions.ConfigRuntimeException)1 HashSet (java.util.HashSet)1 OfflinePlayer (org.bukkit.OfflinePlayer)1 BlockCommandSender (org.bukkit.command.BlockCommandSender)1 ConsoleCommandSender (org.bukkit.command.ConsoleCommandSender)1 CommandMinecart (org.bukkit.entity.minecart.CommandMinecart)1 PlayerCommandPreprocessEvent (org.bukkit.event.player.PlayerCommandPreprocessEvent)1 ServerCommandEvent (org.bukkit.event.server.ServerCommandEvent)1 Test (org.junit.Test)1