marcelo-mason / PreciousStones

Self-service protection for Minecraft servers
http://dev.bukkit.org/server-mods/preciousstones/
56 stars 66 forks source link

Torches not working #886

Open VinohCorp opened 9 years ago

VinohCorp commented 9 years ago

I'm having a problem with torches, probably that's because some torches were already placed in the world... is there any way to fix it? I'd like to set them as anti-monster-spawn items, actually just to make them send a message in the chat when you reach a point were their effect stops. (that's just to tell the player when he should put another torch to make a completely safe area) I know i could use another item to make an anti-spawn area, but I'd prefer to use torches. Thanking you in advance for your help, I'll wait a reply :) P.S. Your plugin is simply awesome.

Taybosquee commented 9 years ago

This plugin will not effect blocks already placed in the world, only (configured) blocks that are placed by players with the appropriate permissions. I can confirm that torches seemingly can't be used as PS blocks, but this may have been intentional as there's several possible problems if you used them as such.

--Just skip to the end if you don't want to read into the details and just get a possible solution

Torches will of course break if touched by lava/water or the block they are attached to is moved or broken. Picture your database like a treasure map. What is stored in it is the locations of all created PS fields. The entry for any placed field is only removed if broken by a player (or by commands). Imagine you place a torch functioning as a PS field which was then broken by flowing water. The actual block (Torch) would be broken by water but the field would still be active and working as the plugin doesn't check if the actual block was broken by other methods other than the player. There is commands to clean up or recreate these "orphan" fields (And there may be a cleaning sweep on load/unload of the plugin; I've never actually thought to test it) but failing to so would make your database swell like it was stung by a swarm of hornets. Also, torches are essentially 6 different blocks due to the block data that determines the orientation of any placed torch. I'm not sure how PS handles block data for things like torches (as I have not tested it), but I'm going to guess that just stating "torch" or "50" would likely cover all the sub values of torch. If I am wrong though, you would have to make 6 versions of the same field to cover each possible placement orientation.

But, all that aside... What you had in mind is still possible, although maybe not with torches. Here's a field that does what you described but uses packed ice instead of a torch block.

- title: 'Example'
  meta-name: '&bAnti-monster zone'
  meta-lore:
  - '&7It keeps away the things that go bump in the night.'
  block: 174
  radius: 10
  welcome-message: true
  farewell-message: true
  breakable: true
  prevent-mob-spawn: true
Taybosquee commented 9 years ago

I also think there's a pre-made field that comes with the plugin that does something like what you request. I believe it's called something along the lines of "Monster repellent". I don't remember the details of i, but I'm pretty sure it's a cobweb block,