Search in sources :

Example 1 with PlayerChangesSignScriptEvent

use of com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent in project Denizen-For-Bukkit by DenizenScript.

the class DenizenPacketListenerImpl method a.

@Override
public void a(PacketPlayInUpdateSign packet) {
    if (fakeSignExpected != null && packet.b().equals(fakeSignExpected)) {
        fakeSignExpected = null;
        PlayerChangesSignScriptEvent evt = (PlayerChangesSignScriptEvent) PlayerChangesSignScriptEvent.instance.clone();
        evt.cancelled = false;
        evt.material = new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN);
        evt.location = new LocationTag(getPlayer().getLocation());
        LocationTag loc = evt.location.clone();
        loc.setY(0);
        evt.event = new SignChangeEvent(loc.getBlock(), getPlayer(), packet.c());
        evt.fire(evt.event);
    }
    super.a(packet);
}
Also used : MaterialTag(com.denizenscript.denizen.objects.MaterialTag) LocationTag(com.denizenscript.denizen.objects.LocationTag) PlayerChangesSignScriptEvent(com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent) SignChangeEvent(org.bukkit.event.block.SignChangeEvent)

Example 2 with PlayerChangesSignScriptEvent

use of com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent in project Denizen-For-Bukkit by DenizenScript.

the class DenizenPacketListenerImpl method handleSignUpdate.

@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
    if (fakeSignExpected != null && packet.getPos().equals(fakeSignExpected)) {
        fakeSignExpected = null;
        PlayerChangesSignScriptEvent evt = (PlayerChangesSignScriptEvent) PlayerChangesSignScriptEvent.instance.clone();
        evt.cancelled = false;
        evt.material = new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN);
        evt.location = new LocationTag(player.getBukkitEntity().getLocation());
        LocationTag loc = evt.location.clone();
        loc.setY(0);
        evt.event = new SignChangeEvent(loc.getBlock(), player.getBukkitEntity(), packet.getLines());
        evt.fire(evt.event);
    }
    super.handleSignUpdate(packet);
}
Also used : MaterialTag(com.denizenscript.denizen.objects.MaterialTag) LocationTag(com.denizenscript.denizen.objects.LocationTag) PlayerChangesSignScriptEvent(com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent) SignChangeEvent(org.bukkit.event.block.SignChangeEvent)

Example 3 with PlayerChangesSignScriptEvent

use of com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent in project Denizen-For-Bukkit by DenizenScript.

the class DenizenPacketListenerImpl method handleSignUpdate.

@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
    if (fakeSignExpected != null && packet.getPos().equals(fakeSignExpected)) {
        fakeSignExpected = null;
        PlayerChangesSignScriptEvent evt = (PlayerChangesSignScriptEvent) PlayerChangesSignScriptEvent.instance.clone();
        evt.cancelled = false;
        evt.material = new MaterialTag(org.bukkit.Material.OAK_WALL_SIGN);
        evt.location = new LocationTag(player.getBukkitEntity().getLocation());
        LocationTag loc = evt.location.clone();
        loc.setY(0);
        evt.event = new SignChangeEvent(loc.getBlock(), player.getBukkitEntity(), packet.getLines());
        evt.fire(evt.event);
    }
    super.handleSignUpdate(packet);
}
Also used : MaterialTag(com.denizenscript.denizen.objects.MaterialTag) LocationTag(com.denizenscript.denizen.objects.LocationTag) PlayerChangesSignScriptEvent(com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent) SignChangeEvent(org.bukkit.event.block.SignChangeEvent)

Aggregations

PlayerChangesSignScriptEvent (com.denizenscript.denizen.events.player.PlayerChangesSignScriptEvent)3 LocationTag (com.denizenscript.denizen.objects.LocationTag)3 MaterialTag (com.denizenscript.denizen.objects.MaterialTag)3 SignChangeEvent (org.bukkit.event.block.SignChangeEvent)3