03-15-2016, 07:46 PM
Believe me, it would be much better to use some kind of storage for the gardens, rather than inspecting chunk contents.
Problems with your approach:
- gardens across chunk borders - if only one half of the garden is present in a chunk currently being loaded, your plugin won't be able to trace the fences around it
- placement - if two gardens are placed next to each other, sharing a fence, your plugin will have trouble deciding what to trace
- placement - if a sign is placed in between two fence gates, your plugin will have trouble deciding which of the fence gates are the garden.
- reload - there's currently no way to enumerate all loaded chunks, so there's no way to enumerate sign entities in those; therefore no protection.
- performance - tracing the fences might produce TPS drops if not implemented carefully, especially when larger gardens are allowed.
Problems with your approach:
- gardens across chunk borders - if only one half of the garden is present in a chunk currently being loaded, your plugin won't be able to trace the fences around it
- placement - if two gardens are placed next to each other, sharing a fence, your plugin will have trouble deciding what to trace
- placement - if a sign is placed in between two fence gates, your plugin will have trouble deciding which of the fence gates are the garden.
- reload - there's currently no way to enumerate all loaded chunks, so there's no way to enumerate sign entities in those; therefore no protection.
- performance - tracing the fences might produce TPS drops if not implemented carefully, especially when larger gardens are allowed.