Zones, a Trigger API

I wrote this as part of a bigger project I’m currently working on where I need to know within what area a player currently is.

Keeping modularity in mind I hope I’ve written this good enough for someone else to be useful.

Server owners can, without writing a plugin create some basic functionality by editing the config, I didn’t get around to make commands for that, but I hope that’s ok :slight_smile:

Primary usage is by adding a listener to the ZoneEvent, for more information and download see the GitHub

Latest Version: 1.1 (2016-07-29)
(Written, compiled and tested for spongevanilla-1.12-7.0.0-BETA-303)

Have a nice day, DosMike

4 Likes

Can it currently run commands when a player enters/leaves a zone? And can zones overlap?
Asking because GriefPrevention has the ability to shoot events (and someone can do stuff with event listeners) when a player enters or leaves a claim and there’s many small server owners who have no idea how to do anything in Java, so they can’t make use of that feature.

Yes, zones can overlap, that’s no problem at all.

As it was not the focus it currently does not have the ability to run commands, It shouldn’t be a problem to add a zone-type supporting this - maybe with a bit more that just commands? I’m thinking about messaging, teleporting and other player manipulation… tell me if you got any more ideas :slight_smile:

Yea, that would be nice, also being able to make certain zones available to people with a certain permission. If they don’t have the permission, teleports them out.

It seems right now you add zones through commands, any plans on making an item be able to add zones?
Claim plugins often use shovels, world edit uses an axe, so something like a hoe would work.

Aside from that, I’m not sure if it’s possible, but be able to block certain events from happening within zones (often done with claim plugins, so not the biggest concern) as well as being able to edit world rules within zones. So that in certain zones, someone could set keep inventory off or in a community garden, they could set the random tick speed higher so that crops grow faster.

An item would be good, but i don’t think a hoe would be good as that usually transforms dirt. How about a lead, I think that’d be kinds fitting.

Blocking events and changing world rules for a zone seems is a bit too complex for now (as I’m working on something else) but if anyone knows how to do it I’d love to see a PR for that :slight_smile:

so how about this in the config (worry about commands later :grin:)

enter = [
  action,
  action
]
leave = [
  action,
  action
]

Where a action is structured like this

{ #this is a object, so don't forget the curly bracket
  permission=[], #list of permissions required to trigger
  teleport=world/x/y/z, #optional key
  message=[], #list of text/string, optional key
  command=[] #list of commands to execute, optional key, @t refers to the player
}

Ahh, forgot that the hoe did that, woops.

Unsure what the config is saying. Guessing you can add multiple actions per area?
Would be of more help if I had more time to test this plugin on, maybe over the weekend I can test it out in a server and tell you what I think and if I have any other suggestions. It looks like a very useful plugin and exited for future updates.

with all the commands mincraft brings out of the box i could remove the messages (/tell command).

I’m also thinking about adding additional parameteres to commands in front of the slash like

  • /playsound entity.enderman.stare player @t
  • delay:0.5s/teleport @t 0 128 0
  • delay:0.6s/playsound entity.enderman.teleport player @t

putting that on a 1x2x1 zone would already make for a cool teleport booth or something

Version 1.2

While adding the command meta I noticed that /playsound needs the player coordinates to properly work, so I also added 3 new values for command arguments
You can now put commands like this:

delay:0.1/playsound minecraft:item.shield.block player @t @t.x @t.y @t.z

This will play the sound 0.1 seconds delayed (no other time units supported).
The player coordinates are represented by @t.x @t.y and @t.z

Hi DosMike,
I have the feeling we met up on every thread.:slightly_smiling_face:
Is this plug-in still supported ? And I see there is an API, how can I implement it in my development ?

oof, this one’s old. If i remember correctly it should work with API7, but someone has a updated fork. If you’re only interested in using the API you might want to look at my toolbox (mike’s toolbox).

Using this plugins API is as simple as including the jar and using the static methods in the Zones class.

I would argue that my toolbox has the cooler zone selection tools tho :slight_smile: