Code Monkey home page Code Monkey logo

Comments (10)

cdelashmutt avatar cdelashmutt commented on June 2, 2024

Not sure I follow the intent of this request.

Are you looking for an event notification system? By this I mean you want to write a plugin, have that plugin register interest in a Denizen, and then be notified of what that Denizen does? There may already be a way to hook into what you want with the basic Bukkit and Citizens APIs.

from denizen.

aufdemrand avatar aufdemrand commented on June 2, 2024

What he wants is a command that would trigger an event. Dan made a trader character that has a few methods to trade, sell, etc. What he envisions is a script that allows the player to interact with a Denizen, but could also initiate a trade.

from denizen.

cdelashmutt avatar cdelashmutt commented on June 2, 2024

Ahh, ok. Now I understand better. I guess we'd just have to check CommandSender to see if it is an instance Player like Denizen does already, and then expose something like /denizen trigger <npc> '<script-name>' that would lookup the NPC, make sure it is a denizen, and then invoke the named script?

Should these types of scripts be a new kind of Trigger or should any script be allowed to be triggered?

from denizen.

aufdemrand avatar aufdemrand commented on June 2, 2024

Hmm... interesting though, but I was thinking the other way around, his trader listening for a Denizen event. Like an EVENT [event] script command. His plugin could listen for the Denizen event . EVENT could initiate a custom bukkit event with the information in brackets.

from denizen.

aufdemrand avatar aufdemrand commented on June 2, 2024

At least I think that can work, haha.

from denizen.

cdelashmutt avatar cdelashmutt commented on June 2, 2024

Ok, let me restate to make sure I've got it. Basically there are two parts here. One part is the script part:

'Name of script':
  Type: Trigger
    ...
  Steps:
    1:
      Click Trigger:
        Script:
        - EVENT This is my custom event data.

And the other is a new custom event we broadcast with Bukkit as so:

// Create the event here with some context, and the event data specified in the script.
DenizenCustomEvent event = new DenizenCustomEvent(thePlayer, theDenizen, eventData);
// Call the event
Bukkit.getServer().getPluginManager().callEvent(event);
// Now you do the event
Bukkit.getServer().broadcastMessage(event.getMessage());

Is that what you were thinking?

from denizen.

aufdemrand avatar aufdemrand commented on June 2, 2024

And yep! Exactly! That'll work, right?

from denizen.

cdelashmutt avatar cdelashmutt commented on June 2, 2024

Good question. Bukkit's wiki mentions custom events, but no word on whether or not other plugins can see them. I'll code up a quick test to validate this.

from denizen.

Dandielo avatar Dandielo commented on June 2, 2024

yeah you can see them like the NPC events build in Citizens2.0 or the Citizens1.2 API where hooking into citizens mainly consisted of event listening, btw would it be of any use to make the events working only for the plugin that made them?

from denizen.

aufdemrand avatar aufdemrand commented on June 2, 2024

This is addressed in 0.7 which will be available really soon. It features a modular command system. Requirements will be soon.

from denizen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.