EmilHernvall / tregmine

The tregmine plugins
http://tregmine.info/
BSD 4-Clause "Original" or "Old" License
8 stars 10 forks source link

Compass fix, New Permission Node, Tidied TP command #266

Closed lDiverse closed 10 years ago

lDiverse commented 10 years ago

Added a new permission node similar to hasBlockPermission but canBeHere.

The only parameter is the location; example:

player.canBeHere(location);

Returns boolean

Made compass use this to stop people getting into places they shouldn't be (Only for normal compass, not enhanced compass)

Also changed my TP code to use this.

lDiverse commented 10 years ago

Done a huge overhaul of code in ZonePlayerListener to use the new return type and new permission node.

I would like to take the time now to justify my decision with the new return type.

I wanted a good way of being able to have a universal error message but dependant to individual occurrences. Previously it would only return true or false which was not helpful for knowing if it was because of banned, blocked, new flags or what. So I went through two phases, I could've either just returned a string and checked if it was null. If it wasn't null then display the string as error message but I thought this was generally to simple and kind of messy. So I decided to make a new return type. Think it is pretty easy to use, understand and implement.

Using this new system I took down all the repetitive and duplicate code and replaced it with a universal and neat code. I think its a very good idea to use universal methods for checking things like permission for locations.

EmilHernvall commented 10 years ago

Very much needed. Good work, James!