Package org.bukkit.event

Examples of org.bukkit.event.Event


   * Reload Permissions plugin by issuing an "/rp" chat command
   *
   * @param server
   */
  public static void reloadPermissions(Server server) {
    Event event = new PlayerChatEvent(Type.PLAYER_COMMAND, new FakePlayer(),
        "/rp");
    server.getPluginManager().callEvent(event);
  }
View Full Code Here


    private final MutableObject store = new MutableObject();

    @Test
    public void testAsyncSameThread() {
        final Event event = new TestEvent(true);
        try {
            pm.callEvent(event);
        } catch (IllegalStateException ex) {
            assertThat(event.getEventName() + " cannot be triggered asynchronously from primary server thread.", is(ex.getMessage()));
            return;
        }
        throw new IllegalStateException("No exception thrown");
    }
View Full Code Here

        throw new IllegalStateException("No exception thrown");
    }

    @Test
    public void testSyncSameThread() {
        final Event event = new TestEvent(false);
        pm.callEvent(event);
    }
View Full Code Here

        pm.callEvent(event);
    }

    @Test
    public void testAsyncLocked() throws InterruptedException {
        final Event event = new TestEvent(true);
        Thread secondThread = new Thread(
            new Runnable() {
                public void run() {
                    try {
                        synchronized (pm) {
                            pm.callEvent(event);
                        }
                    } catch (Throwable ex) {
                        store.value = ex;
                    }
                }
            }
        );
        secondThread.start();
        secondThread.join();
        assertThat(store.value, is(instanceOf(IllegalStateException.class)));
        assertThat(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.", is(((Throwable) store.value).getMessage()));
    }
View Full Code Here

        assertThat(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.", is(((Throwable) store.value).getMessage()));
    }

    @Test
    public void testAsyncUnlocked() throws InterruptedException {
        final Event event = new TestEvent(true);
        Thread secondThread = new Thread(
            new Runnable() {
                public void run() {
                    try {
                        pm.callEvent(event);
View Full Code Here

        }
    }

    @Test
    public void testSyncUnlocked() throws InterruptedException {
        final Event event = new TestEvent(false);
        Thread secondThread = new Thread(
            new Runnable() {
                public void run() {
                    try {
                        pm.callEvent(event);
View Full Code Here

        }
    }

    @Test
    public void testSyncLocked() throws InterruptedException {
        final Event event = new TestEvent(false);
        Thread secondThread = new Thread(
            new Runnable() {
                public void run() {
                    try {
                        synchronized (pm) {
View Full Code Here

        if (!ChestShopSign.isAdminShop(sign)) {
            connectedChest = uBlock.findConnectedChest(sign.getBlock());
        }

        Event event = new ShopDestroyedEvent(player, sign, connectedChest);
        ChestShop.callEvent(event);
    }
View Full Code Here

                msg.srcChannel = channel;
                msg.updateTag();
                this.plugin.sendMessage(msg, null, "joins");
                // PLUGIN INTEROP
                msg.setTarget(EndPoint.PLUGIN);
                Event ie = new IRCEvent(Mode.JOIN, msg);
                this.plugin.getServer().getPluginManager().callEvent(ie);

            }
        }
    }
View Full Code Here

            msg.updateTag();
            this.plugin.sendMessage(msg, null, "parts");

            // PLUGIN INTEROP
            msg.setTarget(EndPoint.PLUGIN);
            Event ie = new IRCEvent(Mode.PART, msg);
            this.plugin.getServer().getPluginManager().callEvent(ie);
        }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.event.Event

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.