Skip to content
Thomas E Enebo edited this page Jan 20, 2016 · 11 revisions

In Purugin, there are many different symbols referring to many different events which you can check for in your plugin. the common syntax for an event triggered plugin is shown here:

class ExamplePlugin
  include Purugin::Plugin, Purugin::Colors
  description 'Example', 0.1

  def on_enable
    event(:player_join) do |s|
      server.broadcast_message yellow("#{s.player.display_name} has joined the game.")
    end
  end
end

This is only a very simple example which displays a message when someone joins the game, by checking for the :player_join event. However, :player_join is one of many events which one can check for. These are a few you can use:

:block_break
:block_burn
:block_canbuild
:block_damage
:block_fromto
:block_ignite
:block_physics
:block_place
:leaves_decay
:player_animation
:player_bucket_empty
:player_bucket_fill
:player_chat
:player_command_preprocess
:player_drop_item
:player_egg_throw
:player_interact
:player_inventory
:player_item_held
:player_join
:player_kick
:player_login
:player_move
:player_pickup_item
:player_quit
:player_respawn
:player_teleport
:player_toggle_sneak
:redstone_change
:sign_change
:inventory_open
:inventory_close
:inventory_click
:inventory_change
:inventory_transaction
:plugin_enable
:plugin_disable
:server_command
:chunk_load
:chunk_unload
:item_spawn
:spawn_change
:world_save
:world_load
:creature_spawn
:entity_damage
:entity_death
:entity_combust
:entity_explode
:entity_explosion
:entity_target
:entity_interact
:vehicle_create
:vehicle_destroy
:vehicle_damage
:vehicle_collision_entity
:vehicle_collision_block
:vehicle_enter
:vehicle_exit
:vehicle_move
:vehicle_update
:custom_event
:lightning_strike
:weather_change
:thunder_change

Most of it is self explanatory, but there are some things which require further documentation. Asides from that it's easy! Start modding!****__