After a quick review:
- Code is a complete mess
- Evidently code has been copied and pasted since the style doesn't fit - Using someone else's code is fine. The most important thing is that you understand the code before you use it. ( And rewrite it to fit into your plugin ).
- There's several other things such as hardcoded values, unnecessary checks, and simply inefficient methods ( such as in your switch statements ).
You need to expand your knowledge a lot more before you post plugins. Please take some time to
have a read of the rules for this section of the forum.
Unapproved.