Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8775887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:55:01+00:00 2026-06-13T18:55:01+00:00

I have been using the pico container in java to do DI for a

  • 0

I have been using the pico container in java to do DI for a minecraft plugin framework I designed.

The plugins have event listener methods that are defined in interfaces, one method per interface.

If a particular class wants events when players join and leave the server, it implements the two particular interfaces; in this case IPlayerLoginEvent and IPlayerQuitEvent.

I then have a class in the frameworks which takes each type of event interface as a constructor injected argument.

This container class is tagged with @Listener for the craftbukkit server software to call it.

The wrapper class wraps the data craftbukkit sends in with a framework-specific class, making it possible, at least in theory, to write server-agnostic plugins.

Small example:

The plugin AwesomePlugin has a class PlayerHandler which implements IPlayerLoginEvent and IPlayerQuitEvent. The framework needs then to construct instances of each of the classes “PlayerLogin” and “PlayerQuit”, passing in the PlayerHandler as a constructor argument.
The PlayerLogin and PlayerQuit instances will in turn be registered with CraftBukkit as event listeners.

The way this is currently implemented using pico, can be seen here:

https://github.com/Runsafe/Framework/blob/master/src/no/runsafe/framework/event/EventEngine.java#L32

That code does look terrible and I have not been able to find a more elegant solution for this scenario, so I now beseech your guidance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:55:02+00:00Added an answer on June 13, 2026 at 6:55 pm

    Well, I don’t quite understand you question but I can explain some pico events patterns.

    First of all, events are container-centric, you don’t use pico just to wire things up.
    Every event consumer is added to the container. Each consumer has to implement at least one method to get event obj. You can have single interface with generic Event class passed, or you can have many interfaces for different event types.

    Thus, you have a list of consumers in the container (or several lists for several event types) You can either have the list of consumers injected into some event broadcaster object (obviously done once per container creation, the broadcaster receives the event somehow from somewhere, then just iterates through the list and calls relevant event handler methods) or just make a container custom lifecycle call (can be done anytime and trigger consumers added in runtime, the calling job is done by the container itself)

    Sometimes you may even want to create new event-container for each event, adding the event obj and all the relevant consumers.

    Waffle framework contains the nicest examples of pico containers juggling, events handling etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using Twitter Bootstrap for some time. I heard a session that
I have been using slim, and suddenly noticed that it escapes everything by default.
I have been using the CSLA framework for couple of years now for windows
I have been using the Eclipse platform for Java, javaEE, c++, python and PHP
i have been using a modular structure for my zend framework application. This is
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I
I have been using some Javascript to create a text field once an certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.