commit b7aa648e0350380ab085b57035e38f814688735a Author: Olof Larsson Date: Wed Apr 6 21:43:57 2011 +0200 first commit diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..e040f58 --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e706a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# Eclipse stuff +/.classpath +/.project +/.settings + +# netbeans +/nbproject + +# vim +.*.sw[a-p] + +# various other potential build files +/build +/bin +/dist +/localexport.jardesc + +# Mac filesystem dust +.DS_Store \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..e0d9b68 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + AncientGates + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..a4b9403 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Wed Apr 06 16:59:25 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/LGPL.txt b/LGPL.txt new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/LGPL.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LICENCE.txt b/LICENCE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENCE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..712fee3 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +AncientGates - Minimalistic and Powerfull Portal-Gates +==================== +With this plugin the server administrators can create gates that will teleport anyone who enter to a location specific to that gate. +You may design the gates any way you like! Build your gate of dirt if you feel like it :) + +Try the ingame command /gate +for more info. + +Usage +--------- +Read the full userguide here: [http://mcteam.org/ancientgates](http://mcteam.org/ancientgates) + +Installing +---------- +1. Download the latest release: [https://github.com/oloflarsson/AncientGates/downloads](https://github.com/oloflarsson/AncientGates/downloads)
+1. Put AncientGates.jar in the plugins folder. + +License +---------- +This project has a LGPL license just like the Bukkit project.
+This project uses [GSON](http://code.google.com/p/google-gson/) which has a [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0 ). \ No newline at end of file diff --git a/bin/org/mcteam/ancientgates/Conf.class b/bin/org/mcteam/ancientgates/Conf.class new file mode 100644 index 0000000..c91ea4e Binary files /dev/null and b/bin/org/mcteam/ancientgates/Conf.class differ diff --git a/bin/org/mcteam/ancientgates/Gate$1.class b/bin/org/mcteam/ancientgates/Gate$1.class new file mode 100644 index 0000000..8eba156 Binary files /dev/null and b/bin/org/mcteam/ancientgates/Gate$1.class differ diff --git a/bin/org/mcteam/ancientgates/Gate.class b/bin/org/mcteam/ancientgates/Gate.class new file mode 100644 index 0000000..9e3909e Binary files /dev/null and b/bin/org/mcteam/ancientgates/Gate.class differ diff --git a/bin/org/mcteam/ancientgates/MyLocationTypeAdapter.class b/bin/org/mcteam/ancientgates/MyLocationTypeAdapter.class new file mode 100644 index 0000000..8923ce1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/MyLocationTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/Plugin.class b/bin/org/mcteam/ancientgates/Plugin.class new file mode 100644 index 0000000..f2f830f Binary files /dev/null and b/bin/org/mcteam/ancientgates/Plugin.class differ diff --git a/bin/org/mcteam/ancientgates/commands/BaseCommand.class b/bin/org/mcteam/ancientgates/commands/BaseCommand.class new file mode 100644 index 0000000..cfed904 Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/BaseCommand.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandClose.class b/bin/org/mcteam/ancientgates/commands/CommandClose.class new file mode 100644 index 0000000..cd7d60c Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandClose.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandCreate.class b/bin/org/mcteam/ancientgates/commands/CommandCreate.class new file mode 100644 index 0000000..938289b Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandCreate.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandDelete.class b/bin/org/mcteam/ancientgates/commands/CommandDelete.class new file mode 100644 index 0000000..e6f866a Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandDelete.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandHelp.class b/bin/org/mcteam/ancientgates/commands/CommandHelp.class new file mode 100644 index 0000000..f8ed79c Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandHelp.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandList.class b/bin/org/mcteam/ancientgates/commands/CommandList.class new file mode 100644 index 0000000..bc13f9b Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandList.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandOpen.class b/bin/org/mcteam/ancientgates/commands/CommandOpen.class new file mode 100644 index 0000000..09558ec Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandOpen.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandSetFrom.class b/bin/org/mcteam/ancientgates/commands/CommandSetFrom.class new file mode 100644 index 0000000..1740b90 Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandSetFrom.class differ diff --git a/bin/org/mcteam/ancientgates/commands/CommandSetTo.class b/bin/org/mcteam/ancientgates/commands/CommandSetTo.class new file mode 100644 index 0000000..729c777 Binary files /dev/null and b/bin/org/mcteam/ancientgates/commands/CommandSetTo.class differ diff --git a/bin/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.class new file mode 100644 index 0000000..ebe9b04 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Cache.class b/bin/org/mcteam/ancientgates/gson/Cache.class new file mode 100644 index 0000000..b0a97cd Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Cache.class differ diff --git a/bin/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.class new file mode 100644 index 0000000..6d5d0d8 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/CircularReferenceException.class b/bin/org/mcteam/ancientgates/gson/CircularReferenceException.class new file mode 100644 index 0000000..06a2cc9 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/CircularReferenceException.class differ diff --git a/bin/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.class new file mode 100644 index 0000000..3e20707 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigDecimalTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigDecimalTypeAdapter.class new file mode 100644 index 0000000..0f7b803 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigDecimalTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigIntegerTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigIntegerTypeAdapter.class new file mode 100644 index 0000000..db6e994 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BigIntegerTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BooleanTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BooleanTypeAdapter.class new file mode 100644 index 0000000..eb217f4 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$BooleanTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ByteTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ByteTypeAdapter.class new file mode 100644 index 0000000..38f18b8 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ByteTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CharacterTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CharacterTypeAdapter.class new file mode 100644 index 0000000..4710322 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CharacterTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CollectionTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CollectionTypeAdapter.class new file mode 100644 index 0000000..6baab76 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$CollectionTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultDateTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultDateTypeAdapter.class new file mode 100644 index 0000000..e8622f5 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultDateTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter.class new file mode 100644 index 0000000..666d71d Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultJavaSqlDateTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimeTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimeTypeAdapter.class new file mode 100644 index 0000000..f00d062 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimeTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimestampDeserializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimestampDeserializer.class new file mode 100644 index 0000000..a87cbd2 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DefaultTimestampDeserializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleDeserializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleDeserializer.class new file mode 100644 index 0000000..1c6c9b6 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleDeserializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleSerializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleSerializer.class new file mode 100644 index 0000000..c2c0e5b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$DoubleSerializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$EnumTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$EnumTypeAdapter.class new file mode 100644 index 0000000..fc891c1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$EnumTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatDeserializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatDeserializer.class new file mode 100644 index 0000000..513af6d Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatDeserializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatSerializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatSerializer.class new file mode 100644 index 0000000..9014ddc Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$FloatSerializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$GregorianCalendarTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$GregorianCalendarTypeAdapter.class new file mode 100644 index 0000000..116b114 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$GregorianCalendarTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$HashSetCreator.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$HashSetCreator.class new file mode 100644 index 0000000..9d52f65 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$HashSetCreator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$IntegerTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$IntegerTypeAdapter.class new file mode 100644 index 0000000..93b96fb Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$IntegerTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LocaleTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LocaleTypeAdapter.class new file mode 100644 index 0000000..250a6dc Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LocaleTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongDeserializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongDeserializer.class new file mode 100644 index 0000000..1d025ad Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongDeserializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongSerializer.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongSerializer.class new file mode 100644 index 0000000..6123ae2 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$LongSerializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$MapTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$MapTypeAdapter.class new file mode 100644 index 0000000..fcf1133 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$MapTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$NumberTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$NumberTypeAdapter.class new file mode 100644 index 0000000..539213c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$NumberTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$PropertiesCreator.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$PropertiesCreator.class new file mode 100644 index 0000000..097cf77 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$PropertiesCreator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ShortTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ShortTypeAdapter.class new file mode 100644 index 0000000..81fad79 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$ShortTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$StringTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$StringTypeAdapter.class new file mode 100644 index 0000000..a2cec86 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$StringTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$TreeSetCreator.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$TreeSetCreator.class new file mode 100644 index 0000000..b1ec5e9 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$TreeSetCreator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UriTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UriTypeAdapter.class new file mode 100644 index 0000000..2cc8d3e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UriTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UrlTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UrlTypeAdapter.class new file mode 100644 index 0000000..6af5bb6 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UrlTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UuidTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UuidTypeAdapter.class new file mode 100644 index 0000000..ea395b8 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters$UuidTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters.class b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters.class new file mode 100644 index 0000000..e0736f2 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DefaultTypeAdapters.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DelegatingJsonElementVisitor.class b/bin/org/mcteam/ancientgates/gson/DelegatingJsonElementVisitor.class new file mode 100644 index 0000000..ea4f393 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DelegatingJsonElementVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/DisjunctionExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/DisjunctionExclusionStrategy.class new file mode 100644 index 0000000..a4478be Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/DisjunctionExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Escaper.class b/bin/org/mcteam/ancientgates/gson/Escaper.class new file mode 100644 index 0000000..bfe683b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Escaper.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/ExclusionStrategy.class new file mode 100644 index 0000000..851c34e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ExposeAnnotationDeserializationExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/ExposeAnnotationDeserializationExclusionStrategy.class new file mode 100644 index 0000000..cf6ac61 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ExposeAnnotationDeserializationExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ExposeAnnotationSerializationExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/ExposeAnnotationSerializationExclusionStrategy.class new file mode 100644 index 0000000..6b8ab65 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ExposeAnnotationSerializationExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/FieldAttributes.class b/bin/org/mcteam/ancientgates/gson/FieldAttributes.class new file mode 100644 index 0000000..378238b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/FieldAttributes.class differ diff --git a/bin/org/mcteam/ancientgates/gson/FieldNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/FieldNamingPolicy.class new file mode 100644 index 0000000..d3127c3 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/FieldNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy.class b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy.class new file mode 100644 index 0000000..4998ee4 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2.class b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2.class new file mode 100644 index 0000000..7aab950 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2.class differ diff --git a/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2Adapter.class b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2Adapter.class new file mode 100644 index 0000000..d97d564 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/FieldNamingStrategy2Adapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/GenericArrayTypeImpl.class b/bin/org/mcteam/ancientgates/gson/GenericArrayTypeImpl.class new file mode 100644 index 0000000..07e9435 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/GenericArrayTypeImpl.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Gson.class b/bin/org/mcteam/ancientgates/gson/Gson.class new file mode 100644 index 0000000..a44d9ad Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Gson.class differ diff --git a/bin/org/mcteam/ancientgates/gson/GsonBuilder.class b/bin/org/mcteam/ancientgates/gson/GsonBuilder.class new file mode 100644 index 0000000..c4c3302 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/GsonBuilder.class differ diff --git a/bin/org/mcteam/ancientgates/gson/InnerClassExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/InnerClassExclusionStrategy.class new file mode 100644 index 0000000..d2cb98e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/InnerClassExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/InstanceCreator.class b/bin/org/mcteam/ancientgates/gson/InstanceCreator.class new file mode 100644 index 0000000..ca0da37 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/InstanceCreator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JavaFieldNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/JavaFieldNamingPolicy.class new file mode 100644 index 0000000..5a3c19a Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JavaFieldNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonArray.class b/bin/org/mcteam/ancientgates/gson/JsonArray.class new file mode 100644 index 0000000..7b0db8a Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonArray.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonArrayDeserializationVisitor.class b/bin/org/mcteam/ancientgates/gson/JsonArrayDeserializationVisitor.class new file mode 100644 index 0000000..08978ef Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonArrayDeserializationVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonDeserializationContext.class b/bin/org/mcteam/ancientgates/gson/JsonDeserializationContext.class new file mode 100644 index 0000000..b87df80 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonDeserializationContext.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonDeserializationContextDefault.class b/bin/org/mcteam/ancientgates/gson/JsonDeserializationContextDefault.class new file mode 100644 index 0000000..75a3ef9 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonDeserializationContextDefault.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonDeserializationVisitor.class b/bin/org/mcteam/ancientgates/gson/JsonDeserializationVisitor.class new file mode 100644 index 0000000..34e663a Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonDeserializationVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonDeserializer.class b/bin/org/mcteam/ancientgates/gson/JsonDeserializer.class new file mode 100644 index 0000000..9c22966 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonDeserializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonDeserializerExceptionWrapper.class b/bin/org/mcteam/ancientgates/gson/JsonDeserializerExceptionWrapper.class new file mode 100644 index 0000000..cd789d9 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonDeserializerExceptionWrapper.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonElement.class b/bin/org/mcteam/ancientgates/gson/JsonElement.class new file mode 100644 index 0000000..9c177b8 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonElement.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonElementVisitor.class b/bin/org/mcteam/ancientgates/gson/JsonElementVisitor.class new file mode 100644 index 0000000..173e304 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonElementVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonFieldNameValidator.class b/bin/org/mcteam/ancientgates/gson/JsonFieldNameValidator.class new file mode 100644 index 0000000..fcc862b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonFieldNameValidator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonIOException.class b/bin/org/mcteam/ancientgates/gson/JsonIOException.class new file mode 100644 index 0000000..b417721 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonIOException.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonNull.class b/bin/org/mcteam/ancientgates/gson/JsonNull.class new file mode 100644 index 0000000..e6834d1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonNull.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonObject.class b/bin/org/mcteam/ancientgates/gson/JsonObject.class new file mode 100644 index 0000000..cb1f876 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonObject.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonObjectDeserializationVisitor.class b/bin/org/mcteam/ancientgates/gson/JsonObjectDeserializationVisitor.class new file mode 100644 index 0000000..7cfd97d Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonObjectDeserializationVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonParseException.class b/bin/org/mcteam/ancientgates/gson/JsonParseException.class new file mode 100644 index 0000000..a78a7d7 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonParseException.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonParser.class b/bin/org/mcteam/ancientgates/gson/JsonParser.class new file mode 100644 index 0000000..ff1ab07 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonParser.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonPrimitive.class b/bin/org/mcteam/ancientgates/gson/JsonPrimitive.class new file mode 100644 index 0000000..555de25 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonPrimitive.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonSerializationContext.class b/bin/org/mcteam/ancientgates/gson/JsonSerializationContext.class new file mode 100644 index 0000000..d29d442 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonSerializationContext.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonSerializationContextDefault.class b/bin/org/mcteam/ancientgates/gson/JsonSerializationContextDefault.class new file mode 100644 index 0000000..68f70cb Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonSerializationContextDefault.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonSerializationVisitor.class b/bin/org/mcteam/ancientgates/gson/JsonSerializationVisitor.class new file mode 100644 index 0000000..b7f9922 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonSerializationVisitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonSerializer.class b/bin/org/mcteam/ancientgates/gson/JsonSerializer.class new file mode 100644 index 0000000..b111a31 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonSerializer.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonStreamParser.class b/bin/org/mcteam/ancientgates/gson/JsonStreamParser.class new file mode 100644 index 0000000..81ee818 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonStreamParser.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonSyntaxException.class b/bin/org/mcteam/ancientgates/gson/JsonSyntaxException.class new file mode 100644 index 0000000..770437f Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonSyntaxException.class differ diff --git a/bin/org/mcteam/ancientgates/gson/JsonTreeNavigator.class b/bin/org/mcteam/ancientgates/gson/JsonTreeNavigator.class new file mode 100644 index 0000000..ea151c0 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/JsonTreeNavigator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$DefaultStrategy.class b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$DefaultStrategy.class new file mode 100644 index 0000000..94eff22 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$DefaultStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$Strategy.class b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$Strategy.class new file mode 100644 index 0000000..929d4b4 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$Strategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$StringStrategy.class b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$StringStrategy.class new file mode 100644 index 0000000..cad844d Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy$StringStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy.class b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy.class new file mode 100644 index 0000000..453a9f3 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LongSerializationPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LowerCamelCaseSeparatorNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/LowerCamelCaseSeparatorNamingPolicy.class new file mode 100644 index 0000000..654e706 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LowerCamelCaseSeparatorNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LowerCaseNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/LowerCaseNamingPolicy.class new file mode 100644 index 0000000..eb7b0b1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LowerCaseNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/LruCache.class b/bin/org/mcteam/ancientgates/gson/LruCache.class new file mode 100644 index 0000000..1ce4ca3 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/LruCache.class differ diff --git a/bin/org/mcteam/ancientgates/gson/MapAsArrayTypeAdapter.class b/bin/org/mcteam/ancientgates/gson/MapAsArrayTypeAdapter.class new file mode 100644 index 0000000..61298d5 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/MapAsArrayTypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/MappedObjectConstructor.class b/bin/org/mcteam/ancientgates/gson/MappedObjectConstructor.class new file mode 100644 index 0000000..71dab39 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/MappedObjectConstructor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/MemoryRefStack.class b/bin/org/mcteam/ancientgates/gson/MemoryRefStack.class new file mode 100644 index 0000000..57df97c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/MemoryRefStack.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ModifierBasedExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/ModifierBasedExclusionStrategy.class new file mode 100644 index 0000000..bd1fd1e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ModifierBasedExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy$LetterModifier.class b/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy$LetterModifier.class new file mode 100644 index 0000000..af9ea08 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy$LetterModifier.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy.class new file mode 100644 index 0000000..d467acb Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ModifyFirstLetterNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/NullExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/NullExclusionStrategy.class new file mode 100644 index 0000000..09f8586 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/NullExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ObjectConstructor.class b/bin/org/mcteam/ancientgates/gson/ObjectConstructor.class new file mode 100644 index 0000000..7d1d21d Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ObjectConstructor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ObjectNavigator$Visitor.class b/bin/org/mcteam/ancientgates/gson/ObjectNavigator$Visitor.class new file mode 100644 index 0000000..aab202e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ObjectNavigator$Visitor.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ObjectNavigator.class b/bin/org/mcteam/ancientgates/gson/ObjectNavigator.class new file mode 100644 index 0000000..aa4ebff Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ObjectNavigator.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ObjectNavigatorFactory.class b/bin/org/mcteam/ancientgates/gson/ObjectNavigatorFactory.class new file mode 100644 index 0000000..47c3f71 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ObjectNavigatorFactory.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ObjectTypePair.class b/bin/org/mcteam/ancientgates/gson/ObjectTypePair.class new file mode 100644 index 0000000..63ee576 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ObjectTypePair.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Pair.class b/bin/org/mcteam/ancientgates/gson/Pair.class new file mode 100644 index 0000000..860badf Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Pair.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ParameterizedTypeHandlerMap.class b/bin/org/mcteam/ancientgates/gson/ParameterizedTypeHandlerMap.class new file mode 100644 index 0000000..7edc1b1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ParameterizedTypeHandlerMap.class differ diff --git a/bin/org/mcteam/ancientgates/gson/ParameterizedTypeImpl.class b/bin/org/mcteam/ancientgates/gson/ParameterizedTypeImpl.class new file mode 100644 index 0000000..7bfb327 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/ParameterizedTypeImpl.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Preconditions.class b/bin/org/mcteam/ancientgates/gson/Preconditions.class new file mode 100644 index 0000000..ba6266e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Preconditions.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Primitives.class b/bin/org/mcteam/ancientgates/gson/Primitives.class new file mode 100644 index 0000000..b94d0d5 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Primitives.class differ diff --git a/bin/org/mcteam/ancientgates/gson/RecursiveFieldNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/RecursiveFieldNamingPolicy.class new file mode 100644 index 0000000..ec6159c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/RecursiveFieldNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/SerializedNameAnnotationInterceptingNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/SerializedNameAnnotationInterceptingNamingPolicy.class new file mode 100644 index 0000000..8816169 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/SerializedNameAnnotationInterceptingNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter$CurrentWrite.class b/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter$CurrentWrite.class new file mode 100644 index 0000000..a89a446 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter$CurrentWrite.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter.class b/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter.class new file mode 100644 index 0000000..ba96916 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Streams$AppendableWriter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/Streams.class b/bin/org/mcteam/ancientgates/gson/Streams.class new file mode 100644 index 0000000..9716575 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/Streams.class differ diff --git a/bin/org/mcteam/ancientgates/gson/SyntheticFieldExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/SyntheticFieldExclusionStrategy.class new file mode 100644 index 0000000..1e02a5b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/SyntheticFieldExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeAdapter.class b/bin/org/mcteam/ancientgates/gson/TypeAdapter.class new file mode 100644 index 0000000..abae9dd Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeAdapter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeInfo.class b/bin/org/mcteam/ancientgates/gson/TypeInfo.class new file mode 100644 index 0000000..952cf61 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeInfo.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeInfoArray.class b/bin/org/mcteam/ancientgates/gson/TypeInfoArray.class new file mode 100644 index 0000000..892e905 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeInfoArray.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeInfoCollection.class b/bin/org/mcteam/ancientgates/gson/TypeInfoCollection.class new file mode 100644 index 0000000..aece322 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeInfoCollection.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeInfoFactory.class b/bin/org/mcteam/ancientgates/gson/TypeInfoFactory.class new file mode 100644 index 0000000..76605f1 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeInfoFactory.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeInfoMap.class b/bin/org/mcteam/ancientgates/gson/TypeInfoMap.class new file mode 100644 index 0000000..bbef67c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeInfoMap.class differ diff --git a/bin/org/mcteam/ancientgates/gson/TypeUtils.class b/bin/org/mcteam/ancientgates/gson/TypeUtils.class new file mode 100644 index 0000000..55672e6 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/TypeUtils.class differ diff --git a/bin/org/mcteam/ancientgates/gson/UpperCamelCaseSeparatorNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/UpperCamelCaseSeparatorNamingPolicy.class new file mode 100644 index 0000000..dd1858f Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/UpperCamelCaseSeparatorNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/UpperCaseNamingPolicy.class b/bin/org/mcteam/ancientgates/gson/UpperCaseNamingPolicy.class new file mode 100644 index 0000000..5a5215c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/UpperCaseNamingPolicy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/VersionConstants.class b/bin/org/mcteam/ancientgates/gson/VersionConstants.class new file mode 100644 index 0000000..9f6ae54 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/VersionConstants.class differ diff --git a/bin/org/mcteam/ancientgates/gson/VersionExclusionStrategy.class b/bin/org/mcteam/ancientgates/gson/VersionExclusionStrategy.class new file mode 100644 index 0000000..1b03002 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/VersionExclusionStrategy.class differ diff --git a/bin/org/mcteam/ancientgates/gson/annotations/Expose.class b/bin/org/mcteam/ancientgates/gson/annotations/Expose.class new file mode 100644 index 0000000..da9fdc2 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/annotations/Expose.class differ diff --git a/bin/org/mcteam/ancientgates/gson/annotations/SerializedName.class b/bin/org/mcteam/ancientgates/gson/annotations/SerializedName.class new file mode 100644 index 0000000..2f541cf Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/annotations/SerializedName.class differ diff --git a/bin/org/mcteam/ancientgates/gson/annotations/Since.class b/bin/org/mcteam/ancientgates/gson/annotations/Since.class new file mode 100644 index 0000000..6adf25f Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/annotations/Since.class differ diff --git a/bin/org/mcteam/ancientgates/gson/annotations/Until.class b/bin/org/mcteam/ancientgates/gson/annotations/Until.class new file mode 100644 index 0000000..cfadb8e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/annotations/Until.class differ diff --git a/bin/org/mcteam/ancientgates/gson/annotations/package-info.class b/bin/org/mcteam/ancientgates/gson/annotations/package-info.class new file mode 100644 index 0000000..15bc87b Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/annotations/package-info.class differ diff --git a/bin/org/mcteam/ancientgates/gson/package-info.class b/bin/org/mcteam/ancientgates/gson/package-info.class new file mode 100644 index 0000000..482cfb5 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/package-info.class differ diff --git a/bin/org/mcteam/ancientgates/gson/reflect/TypeToken$SimpleTypeToken.class b/bin/org/mcteam/ancientgates/gson/reflect/TypeToken$SimpleTypeToken.class new file mode 100644 index 0000000..63a1e7a Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/reflect/TypeToken$SimpleTypeToken.class differ diff --git a/bin/org/mcteam/ancientgates/gson/reflect/TypeToken.class b/bin/org/mcteam/ancientgates/gson/reflect/TypeToken.class new file mode 100644 index 0000000..d259b83 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/reflect/TypeToken.class differ diff --git a/bin/org/mcteam/ancientgates/gson/reflect/package-info.class b/bin/org/mcteam/ancientgates/gson/reflect/package-info.class new file mode 100644 index 0000000..466e71c Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/reflect/package-info.class differ diff --git a/bin/org/mcteam/ancientgates/gson/stream/JsonReader.class b/bin/org/mcteam/ancientgates/gson/stream/JsonReader.class new file mode 100644 index 0000000..0007a7f Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/stream/JsonReader.class differ diff --git a/bin/org/mcteam/ancientgates/gson/stream/JsonScope.class b/bin/org/mcteam/ancientgates/gson/stream/JsonScope.class new file mode 100644 index 0000000..66a59e2 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/stream/JsonScope.class differ diff --git a/bin/org/mcteam/ancientgates/gson/stream/JsonToken.class b/bin/org/mcteam/ancientgates/gson/stream/JsonToken.class new file mode 100644 index 0000000..89411dd Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/stream/JsonToken.class differ diff --git a/bin/org/mcteam/ancientgates/gson/stream/JsonWriter.class b/bin/org/mcteam/ancientgates/gson/stream/JsonWriter.class new file mode 100644 index 0000000..f6c5a4e Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/stream/JsonWriter.class differ diff --git a/bin/org/mcteam/ancientgates/gson/stream/MalformedJsonException.class b/bin/org/mcteam/ancientgates/gson/stream/MalformedJsonException.class new file mode 100644 index 0000000..081db47 Binary files /dev/null and b/bin/org/mcteam/ancientgates/gson/stream/MalformedJsonException.class differ diff --git a/bin/org/mcteam/ancientgates/listeners/PluginBlockListener.class b/bin/org/mcteam/ancientgates/listeners/PluginBlockListener.class new file mode 100644 index 0000000..f164afb Binary files /dev/null and b/bin/org/mcteam/ancientgates/listeners/PluginBlockListener.class differ diff --git a/bin/org/mcteam/ancientgates/listeners/PluginPlayerListener.class b/bin/org/mcteam/ancientgates/listeners/PluginPlayerListener.class new file mode 100644 index 0000000..e7a611f Binary files /dev/null and b/bin/org/mcteam/ancientgates/listeners/PluginPlayerListener.class differ diff --git a/bin/org/mcteam/ancientgates/util/DiscUtil.class b/bin/org/mcteam/ancientgates/util/DiscUtil.class new file mode 100644 index 0000000..c1a5073 Binary files /dev/null and b/bin/org/mcteam/ancientgates/util/DiscUtil.class differ diff --git a/bin/org/mcteam/ancientgates/util/FloodUtil.class b/bin/org/mcteam/ancientgates/util/FloodUtil.class new file mode 100644 index 0000000..3c7451e Binary files /dev/null and b/bin/org/mcteam/ancientgates/util/FloodUtil.class differ diff --git a/bin/org/mcteam/ancientgates/util/GeometryUtil.class b/bin/org/mcteam/ancientgates/util/GeometryUtil.class new file mode 100644 index 0000000..6f0e929 Binary files /dev/null and b/bin/org/mcteam/ancientgates/util/GeometryUtil.class differ diff --git a/bin/org/mcteam/ancientgates/util/TextUtil.class b/bin/org/mcteam/ancientgates/util/TextUtil.class new file mode 100644 index 0000000..718a702 Binary files /dev/null and b/bin/org/mcteam/ancientgates/util/TextUtil.class differ diff --git a/gson-license.txt b/gson-license.txt new file mode 100644 index 0000000..634d1aa --- /dev/null +++ b/gson-license.txt @@ -0,0 +1,13 @@ +Copyright (c) 2008-2009 Google Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/localexport.jardesc b/localexport.jardesc new file mode 100644 index 0000000..30829fc --- /dev/null +++ b/localexport.jardesc @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..2226b78 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,7 @@ +name: AncientGates +version: 1.0.0 +main: org.mcteam.ancientgates.Plugin +commands: + gate: + description: All of the AncientGates commands + usage: See documentation. \ No newline at end of file diff --git a/src/org/mcteam/ancientgates/Conf.java b/src/org/mcteam/ancientgates/Conf.java new file mode 100644 index 0000000..b64edc3 --- /dev/null +++ b/src/org/mcteam/ancientgates/Conf.java @@ -0,0 +1,75 @@ +package org.mcteam.ancientgates; + +import java.io.File; +import java.io.IOException; + +import org.bukkit.ChatColor; +import org.mcteam.ancientgates.util.DiscUtil; + + +public class Conf { + public static transient File file = new File(Plugin.instance.getDataFolder(), "conf.json"); + + // Colors + public static ChatColor colorMember = ChatColor.GREEN; + public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE; + public static ChatColor colorNeutral = ChatColor.WHITE; + public static ChatColor colorEnemy = ChatColor.RED; + + public static ChatColor colorSystem = ChatColor.YELLOW; + public static ChatColor colorChrome = ChatColor.GOLD; + public static ChatColor colorCommand = ChatColor.AQUA; + public static ChatColor colorParameter = ChatColor.DARK_AQUA; + + private static double gateSearchRadius = 7.0; + + static { + + } + + public static double getGateSearchRadius() { + return gateSearchRadius; + } + + public static int getGateMaxArea() { + return (int)gateSearchRadius*10; + } + + // -------------------------------------------- // + // Persistance + // -------------------------------------------- // + + public static boolean save() { + //Factions.log("Saving config to disk."); + + try { + DiscUtil.write(file, Plugin.gson.toJson(new Conf())); + } catch (IOException e) { + e.printStackTrace(); + Plugin.log("Failed to save the config to disk."); + return false; + } + return true; + } + + public static boolean load() { + Plugin.log("Loading conf from disk"); + + if ( ! file.exists()) { + Plugin.log("No conf to load from disk. Creating new file."); + save(); + return true; + } + + try { + Plugin.gson.fromJson(DiscUtil.read(file), Conf.class); + } catch (IOException e) { + e.printStackTrace(); + Plugin.log("Failed to load the config from disk."); + return false; + } + + return true; + } +} + diff --git a/src/org/mcteam/ancientgates/Gate.java b/src/org/mcteam/ancientgates/Gate.java new file mode 100644 index 0000000..0093390 --- /dev/null +++ b/src/org/mcteam/ancientgates/Gate.java @@ -0,0 +1,166 @@ +package org.mcteam.ancientgates; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Map.Entry; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.mcteam.ancientgates.gson.reflect.TypeToken; +import org.mcteam.ancientgates.util.DiscUtil; +import org.mcteam.ancientgates.util.FloodUtil; + + +public class Gate { + private static transient TreeMap instances = new TreeMap(String.CASE_INSENSITIVE_ORDER); + private static transient File file = new File(Plugin.instance.getDataFolder(), "gates.json"); + + private transient String id; + private Location from; + private Location to; + + public Gate() { + + } + + // -------------------------------------------- // + // Getters And Setters + // -------------------------------------------- // + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public void setFrom(Location from) { + this.from = from; + } + + public Location getFrom() { + return from; + } + + public void setTo(Location to) { + this.to = to; + } + + public Location getTo() { + return to; + } + + //----------------------------------------------// + // The Open And Close Methods + //----------------------------------------------// + + public boolean open() { + Set blocks = FloodUtil.getGateFrameBlocks(from.getBlock()); + + if (blocks == null) { + return false; + } + + // This is not to do an effect + // It is to stop portalblocks from destroyingthemself as they cant rely on non created blocks :P + for (Block block : blocks) { + block.setType(Material.GLOWSTONE); + } + + for (Block block : blocks) { + block.setType(Material.PORTAL); + } + + return true; + } + + public void close() { + Set blocks = FloodUtil.getGateFrameBlocks(from.getBlock()); + + for (Block block : blocks) { + block.setType(Material.AIR); + } + } + + //----------------------------------------------// + // Persistance and entity management + //----------------------------------------------// + + public static Gate get(String id) { + return instances.get(id); + } + + public static boolean exists(String id) { + return instances.containsKey(id); + } + + public static Gate create(String id) { + Gate gate = new Gate(); + gate.id = id; + instances.put(gate.id, gate); + Plugin.log("created new gate "+gate.id); + //faction.save(); + return gate; + } + + public static void delete(String id) { + // Remove the faction + instances.remove(id); + } + + public static boolean save() { + try { + DiscUtil.write(file, Plugin.gson.toJson(instances)); + } catch (IOException e) { + Plugin.log("Failed to save the gates to disk due to I/O exception."); + e.printStackTrace(); + return false; + } catch (NullPointerException e) { + Plugin.log("Failed to save the gates to disk due to NPE."); + e.printStackTrace(); + return false; + } + + return true; + } + + public static boolean load() { + Plugin.log("Loading gates from disk"); + if ( ! file.exists()) { + Plugin.log("No gates to load from disk. Creating new file."); + save(); + return true; + } + + try { + Type type = new TypeToken>(){}.getType(); + Map instancesFromFile = Plugin.gson.fromJson(DiscUtil.read(file), type); + instances.clear(); + instances.putAll(instancesFromFile); + } catch (IOException e) { + e.printStackTrace(); + return false; + } + + fillIds(); + + return true; + } + + public static Collection getAll() { + return instances.values(); + } + + public static void fillIds() { + for(Entry entry : instances.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + } +} diff --git a/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java b/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java new file mode 100644 index 0000000..84f7322 --- /dev/null +++ b/src/org/mcteam/ancientgates/MyLocationTypeAdapter.java @@ -0,0 +1,70 @@ +package org.mcteam.ancientgates; + +import java.lang.reflect.Type; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.mcteam.ancientgates.gson.JsonDeserializationContext; +import org.mcteam.ancientgates.gson.JsonDeserializer; +import org.mcteam.ancientgates.gson.JsonElement; +import org.mcteam.ancientgates.gson.JsonObject; +import org.mcteam.ancientgates.gson.JsonParseException; +import org.mcteam.ancientgates.gson.JsonSerializationContext; +import org.mcteam.ancientgates.gson.JsonSerializer; + +public class MyLocationTypeAdapter implements JsonDeserializer, JsonSerializer { + private static final String WORLD = "world"; + private static final String X = "x"; + private static final String Y = "y"; + private static final String Z = "z"; + private static final String YAW = "yaw"; + private static final String PITCH = "pitch"; + + @Override + public Location deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + JsonObject obj = json.getAsJsonObject(); + + World world = this.getWorld(obj.get(WORLD).getAsString()); + double x = obj.get(X).getAsDouble(); + double y = obj.get(Y).getAsDouble(); + double z = obj.get(Z).getAsDouble(); + float yaw = obj.get(YAW).getAsFloat(); + float pitch = obj.get(PITCH).getAsFloat(); + + return new Location(world, x, y, z, yaw, pitch); + } + + @Override + public JsonElement serialize(Location src, Type typeOfSrc, JsonSerializationContext context) { + JsonObject obj = new JsonObject(); + + if (src == null) + { + Plugin.log("Passed location is null in MyLocationTypeAdapter."); + return obj; + } + else if (src.getWorld() == null) + { + Plugin.log("Passed location's world is null in MyLocationTypeAdapter."); + return obj; + } + + obj.addProperty(WORLD, src.getWorld().getName()); + obj.addProperty(X, src.getX()); + obj.addProperty(Y, src.getY()); + obj.addProperty(Z, src.getZ()); + obj.addProperty(YAW, src.getYaw()); + obj.addProperty(PITCH, src.getPitch()); + + return obj; + } + + private World getWorld(String name) { + World world = Plugin.instance.getServer().getWorld(name); + if (world == null) { + world = Plugin.instance.getServer().createWorld(name, Environment.NORMAL); + } + return world; + } +} diff --git a/src/org/mcteam/ancientgates/Plugin.java b/src/org/mcteam/ancientgates/Plugin.java new file mode 100644 index 0000000..31c05c1 --- /dev/null +++ b/src/org/mcteam/ancientgates/Plugin.java @@ -0,0 +1,144 @@ +package org.mcteam.ancientgates; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.event.Event; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; +import org.mcteam.ancientgates.commands.BaseCommand; +import org.mcteam.ancientgates.commands.CommandClose; +import org.mcteam.ancientgates.commands.CommandCreate; +import org.mcteam.ancientgates.commands.CommandDelete; +import org.mcteam.ancientgates.commands.CommandHelp; +import org.mcteam.ancientgates.commands.CommandList; +import org.mcteam.ancientgates.commands.CommandOpen; +import org.mcteam.ancientgates.commands.CommandSetFrom; +import org.mcteam.ancientgates.commands.CommandSetTo; +import org.mcteam.ancientgates.gson.Gson; +import org.mcteam.ancientgates.gson.GsonBuilder; +import org.mcteam.ancientgates.listeners.PluginBlockListener; +import org.mcteam.ancientgates.listeners.PluginPlayerListener; + +public class Plugin extends JavaPlugin { + public static Plugin instance; + + public PluginPlayerListener playerListener = new PluginPlayerListener(); + public PluginBlockListener blockListener = new PluginBlockListener(); + + private String baseCommand; + + public final static Gson gson = new GsonBuilder() + .setPrettyPrinting() + .excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE) + .registerTypeAdapter(Location.class, new MyLocationTypeAdapter()) + .create(); + + // Commands + public List commands = new ArrayList(); + + public Plugin() { + instance = this; + } + + @Override + public void onDisable() { + log("Disabled"); + } + + @Override + public void onEnable() { + // Add the commands + commands.add(new CommandHelp()); + commands.add(new CommandCreate()); + commands.add(new CommandDelete()); + commands.add(new CommandSetFrom()); + commands.add(new CommandSetTo()); + commands.add(new CommandOpen()); + commands.add(new CommandClose()); + commands.add(new CommandList()); + + // Ensure basefolder exists! + this.getDataFolder().mkdirs(); + + // Load from disc + Conf.load(); + Gate.load(); + + // Register events + PluginManager pm = this.getServer().getPluginManager(); + pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal, this); + pm.registerEvent(Event.Type.BLOCK_PHYSICS, this.blockListener, Event.Priority.Normal, this); + + log("Enabled"); + } + + // -------------------------------------------- // + // Test rights + // -------------------------------------------- // + + public static boolean hasPermManage(CommandSender sender) { + return sender.isOp(); + } + + // -------------------------------------------- // + // Commands + // -------------------------------------------- // + + @SuppressWarnings("unchecked") + public String getBaseCommand() { + if (this.baseCommand != null) { + return this.baseCommand; + } + + Map Commands = (Map)this.getDescription().getCommands(); + this.baseCommand = Commands.keySet().iterator().next(); + return this.baseCommand; + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + List parameters = new ArrayList(Arrays.asList(args)); + this.handleCommand(sender, parameters); + return true; + } + + public void handleCommand(CommandSender sender, List parameters) { + if (parameters.size() == 0) { + this.commands.get(0).execute(sender, parameters); + return; + } + + String commandName = parameters.get(0).toLowerCase(); + parameters.remove(0); + + for (BaseCommand fcommand : this.commands) { + if (fcommand.getAliases().contains(commandName)) { + fcommand.execute(sender, parameters); + return; + } + } + + sender.sendMessage(Conf.colorSystem+"Unknown gate-command \""+commandName+"\". Try "+Conf.colorCommand+"/"+getBaseCommand()+" help"); + } + + // -------------------------------------------- // + // Logging + // -------------------------------------------- // + public static void log(String msg) { + log(Level.INFO, msg); + } + + public static void log(Level level, String msg) { + Logger.getLogger("Minecraft").log(level, "["+instance.getDescription().getFullName()+"] "+msg); + } + +} diff --git a/src/org/mcteam/ancientgates/commands/BaseCommand.java b/src/org/mcteam/ancientgates/commands/BaseCommand.java new file mode 100644 index 0000000..2f783d8 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/BaseCommand.java @@ -0,0 +1,146 @@ +package org.mcteam.ancientgates.commands; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.mcteam.ancientgates.Gate; +import org.mcteam.ancientgates.Plugin; +import org.mcteam.ancientgates.Conf; +import org.mcteam.ancientgates.util.TextUtil; + +public class BaseCommand { + public List aliases; + public List requiredParameters; + public List optionalParameters; + + public String helpDescription; + + public CommandSender sender; + public boolean senderMustBePlayer; + public boolean hasGateParam; + public Player player; + public Gate gate; + + public List parameters; + + + public BaseCommand() { + aliases = new ArrayList(); + requiredParameters = new ArrayList(); + optionalParameters = new ArrayList(); + + senderMustBePlayer = true; + hasGateParam = true; + + helpDescription = "no description"; + } + + public List getAliases() { + return aliases; + } + + public void execute(CommandSender sender, List parameters) { + this.sender = sender; + this.parameters = parameters; + + if ( ! validateCall()) { + return; + } + + if (this.senderMustBePlayer) { + this.player = (Player)sender; + } + + perform(); + } + + public void perform() { + + } + + public void sendMessage(String message) { + sender.sendMessage(Conf.colorSystem+message); + } + + public void sendMessage(List messages) { + for(String message : messages) { + this.sendMessage(message); + } + } + + public boolean validateCall() { + if ( this.senderMustBePlayer && ! (sender instanceof Player)) { + sendMessage("This command can only be used by ingame players."); + return false; + } + + if( ! hasPermission(sender)) { + sendMessage("You lack the permissions to "+this.helpDescription.toLowerCase()+"."); + return false; + } + + if (parameters.size() < requiredParameters.size()) { + sendMessage("Usage: "+this.getUseageTemplate(true)); + return false; + } + + if (this.hasGateParam) { + String id = parameters.get(0); + if ( ! Gate.exists(id)) { + sendMessage("There exists no gate with id "+id); + return false; + } + gate = Gate.get(id); + } + + return true; + } + + public boolean hasPermission(CommandSender sender) { + return Plugin.hasPermManage(sender); + } + + // -------------------------------------------- // + // Help and usage description + // -------------------------------------------- // + public String getUseageTemplate(boolean withColor, boolean withDescription) { + String ret = ""; + + if (withColor) { + ret += Conf.colorCommand; + } + + ret += "/" + Plugin.instance.getBaseCommand()+ " " +TextUtil.implode(this.getAliases(), ",")+" "; + + List parts = new ArrayList(); + + for (String requiredParameter : this.requiredParameters) { + parts.add("["+requiredParameter+"]"); + } + + for (String optionalParameter : this.optionalParameters) { + parts.add("*["+optionalParameter+"]"); + } + + if (withColor) { + ret += Conf.colorParameter; + } + + ret += TextUtil.implode(parts, " "); + + if (withDescription) { + ret += " "+Conf.colorSystem + this.helpDescription; + } + return ret; + } + + public String getUseageTemplate(boolean withColor) { + return getUseageTemplate(withColor, false); + } + + public String getUseageTemplate() { + return getUseageTemplate(true); + } +} diff --git a/src/org/mcteam/ancientgates/commands/CommandClose.java b/src/org/mcteam/ancientgates/commands/CommandClose.java new file mode 100644 index 0000000..5ae67d7 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandClose.java @@ -0,0 +1,18 @@ +package org.mcteam.ancientgates.commands; + +public class CommandClose extends BaseCommand { + + public CommandClose() { + aliases.add("close"); + + requiredParameters.add("id"); + + helpDescription = "Close that gate"; + } + + public void perform() { + gate.close(); + sendMessage("The gate was closed."); + } +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandCreate.java b/src/org/mcteam/ancientgates/commands/CommandCreate.java new file mode 100644 index 0000000..a674f2e --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandCreate.java @@ -0,0 +1,32 @@ +package org.mcteam.ancientgates.commands; + +import org.mcteam.ancientgates.Gate; + +public class CommandCreate extends BaseCommand { + public CommandCreate() { + aliases.add("create"); + aliases.add("new"); + + requiredParameters.add("id"); + + senderMustBePlayer = false; + hasGateParam = false; + + helpDescription = "Create a gate"; + } + + public void perform() { + String id = parameters.get(0); + if (Gate.exists(id)) { + sendMessage("There gate \"" + id + "\" already exists."); + return; + } + + Gate.create(id); + sendMessage("Gate with id \"" + id + "\" was created. Now you should:"); + sendMessage(new CommandSetFrom().getUseageTemplate(true, true)); + + Gate.save(); + } +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandDelete.java b/src/org/mcteam/ancientgates/commands/CommandDelete.java new file mode 100644 index 0000000..4fae93b --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandDelete.java @@ -0,0 +1,24 @@ +package org.mcteam.ancientgates.commands; + +import org.mcteam.ancientgates.Gate; + +public class CommandDelete extends BaseCommand { + public CommandDelete() { + aliases.add("delete"); + aliases.add("del"); + aliases.add("remove"); + + requiredParameters.add("id"); + + senderMustBePlayer = false; + helpDescription = "Delete a gate"; + } + + public void perform() { + gate.close(); + sendMessage("Gate with id \"" + gate.getId() + "\" was deleted."); + Gate.delete(gate.getId()); + Gate.save(); + } +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandHelp.java b/src/org/mcteam/ancientgates/commands/CommandHelp.java new file mode 100644 index 0000000..8725847 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandHelp.java @@ -0,0 +1,67 @@ +package org.mcteam.ancientgates.commands; + +import java.util.ArrayList; + +import org.bukkit.command.CommandSender; +import org.mcteam.ancientgates.util.TextUtil; + +public class CommandHelp extends BaseCommand { + + public CommandHelp() { + aliases.add("help"); + aliases.add("h"); + aliases.add("?"); + + optionalParameters.add("page"); + hasGateParam = false; + + helpDescription = "Display a help page"; + } + + @Override + public boolean hasPermission(CommandSender sender) { + return true; + } + + public void perform() { + int page = 1; + if (parameters.size() > 0) { + try { + page = Integer.parseInt(parameters.get(0)); + } catch (NumberFormatException e) { + // wasn't an integer + } + } + sendMessage(TextUtil.titleize("AncientGates Help ("+page+"/"+helpPages.size()+")")); + page -= 1; + if (page < 0 || page >= helpPages.size()) { + sendMessage("This page does not exist"); + return; + } + sendMessage(helpPages.get(page)); + } + + //----------------------------------------------// + // Build the help pages + //----------------------------------------------// + + public static ArrayList> helpPages; + + static { + helpPages = new ArrayList>(); + ArrayList pageLines; + + pageLines = new ArrayList(); + pageLines.add( new CommandHelp().getUseageTemplate(true, true) ); + pageLines.add( new CommandCreate().getUseageTemplate(true, true) ); + pageLines.add( new CommandDelete().getUseageTemplate(true, true) ); + pageLines.add( new CommandSetFrom().getUseageTemplate(true, true) ); + pageLines.add( new CommandSetTo().getUseageTemplate(true, true) ); + pageLines.add( new CommandOpen().getUseageTemplate(true, true) ); + pageLines.add( new CommandClose().getUseageTemplate(true, true) ); + pageLines.add( new CommandList().getUseageTemplate(true, true) ); + helpPages.add(pageLines); + } + +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandList.java b/src/org/mcteam/ancientgates/commands/CommandList.java new file mode 100644 index 0000000..c2415d5 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandList.java @@ -0,0 +1,37 @@ +package org.mcteam.ancientgates.commands; + +import java.util.ArrayList; +import java.util.List; + +import org.mcteam.ancientgates.Conf; +import org.mcteam.ancientgates.Gate; +import org.mcteam.ancientgates.util.TextUtil; + +public class CommandList extends BaseCommand { + + public CommandList() { + aliases.add("list"); + aliases.add("ls"); + + hasGateParam = false; + + helpDescription = "Display a list of the gates"; + } + + public void perform() { + List ids = new ArrayList(); + + for (Gate gate : Gate.getAll()) { + ids.add(Conf.colorAlly + gate.getId()); + } + + if (ids.size() == 0) { + sendMessage("There are no gates yet."); + return; + } + + sendMessage(TextUtil.implode(ids, Conf.colorSystem+", ")); + } + +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandOpen.java b/src/org/mcteam/ancientgates/commands/CommandOpen.java new file mode 100644 index 0000000..7d06704 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandOpen.java @@ -0,0 +1,33 @@ +package org.mcteam.ancientgates.commands; + +public class CommandOpen extends BaseCommand { + + public CommandOpen() { + aliases.add("open"); + + requiredParameters.add("id"); + + helpDescription = "Open that gate"; + } + + public void perform() { + if (gate.getFrom() == null) { + sendMessage("You must set the from location first. To fix that:"); + sendMessage(new CommandSetFrom().getUseageTemplate(true, true)); + return; + } + + if (gate.getTo() == null) { + sendMessage("Sure, but note that this gate does not point anywhere :P"); + sendMessage("To fix that: " + new CommandSetTo().getUseageTemplate(true, true)); + } + + if (gate.open()) { + sendMessage("The gate was opened."); + } else { + sendMessage("Failed to open the gate. Have you built a frame?"); + sendMessage("More info here: " + new CommandHelp().getUseageTemplate(true, true)); + } + } +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java new file mode 100644 index 0000000..b50221e --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java @@ -0,0 +1,25 @@ +package org.mcteam.ancientgates.commands; + +import org.mcteam.ancientgates.Gate; + +public class CommandSetFrom extends BaseCommand { + + public CommandSetFrom() { + aliases.add("setfrom"); + + requiredParameters.add("id"); + + helpDescription = "Set \"from\" to your location."; + } + + public void perform() { + gate.setFrom(player.getLocation()); + sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand."); + sendMessage("Build a frame around that block and:"); + sendMessage(new CommandOpen().getUseageTemplate(true, true)); + + Gate.save(); + } + +} + diff --git a/src/org/mcteam/ancientgates/commands/CommandSetTo.java b/src/org/mcteam/ancientgates/commands/CommandSetTo.java new file mode 100644 index 0000000..4206e00 --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandSetTo.java @@ -0,0 +1,23 @@ +package org.mcteam.ancientgates.commands; + +import org.mcteam.ancientgates.Gate; + +public class CommandSetTo extends BaseCommand { + + public CommandSetTo() { + aliases.add("setto"); + + requiredParameters.add("id"); + + helpDescription = "Set \"to\" to your location."; + } + + public void perform() { + gate.setTo(player.getLocation()); + sendMessage("To location for gate \""+gate.getId()+"\" is now where you stand."); + + Gate.save(); + } + +} + diff --git a/src/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.java b/src/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.java new file mode 100644 index 0000000..78da276 --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/AnonymousAndLocalClassExclusionStrategy.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + + +/** + * Strategy for excluding anonymous and local classes. + * + * @author Joel Leitch + */ +final class AnonymousAndLocalClassExclusionStrategy implements ExclusionStrategy { + + public boolean shouldSkipField(FieldAttributes f) { + return isAnonymousOrLocal(f.getDeclaredClass()); + } + + public boolean shouldSkipClass(Class clazz) { + return isAnonymousOrLocal(clazz); + } + + private boolean isAnonymousOrLocal(Class clazz) { + return !Enum.class.isAssignableFrom(clazz) + && (clazz.isAnonymousClass() || clazz.isLocalClass()); + } +} diff --git a/src/org/mcteam/ancientgates/gson/Cache.java b/src/org/mcteam/ancientgates/gson/Cache.java new file mode 100644 index 0000000..7383b3f --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/Cache.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + +/** + * Defines generic cache interface. + * + * @author Inderjeet Singh + * @author Joel Leitch + */ +interface Cache { + + /** + * Adds the new value object into the cache for the given key. If the key already + * exists, then this method will override the value for the key. + * + * @param key the key identifier for the {@code value} object + * @param value the value object to store in the cache + */ + void addElement(K key, V value); + + /** + * Retrieve the cached value for the given {@code key}. + * + * @param key the key identifying the value + * @return the cached value for the given {@code key} + */ + V getElement(K key); + + /** + * Removes the value from the cache for the given key. + * + * @param key the key identifying the value to remove + * @return the value for the given {@code key} + */ + V removeElement(K key); + + /** + * Removes everything from this cache. + */ + void clear(); + + /** + * @return the number of objects in this cache + */ + int size(); +} diff --git a/src/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.java b/src/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.java new file mode 100644 index 0000000..941c27c --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/CamelCaseSeparatorNamingPolicy.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.Collection; + +/** + * Converts the field name that uses camel-case define word separation into separate words that + * are separated by the provided {@code separatorString}. + * + *

The following is an example:

+ *
+ * class IntWrapper {
+ *   public int integerField = 0;
+ * }
+ *
+ * CamelCaseSeparatorNamingPolicy policy = new CamelCaseSeparatorNamingPolicy("_");
+ * String translatedFieldName =
+ *     policy.translateName(IntWrapper.class.getField("integerField"));
+ *
+ * assert("integer_Field".equals(translatedFieldName));
+ * 
+ * + * @author Joel Leitch + */ +final class CamelCaseSeparatorNamingPolicy extends RecursiveFieldNamingPolicy { + private final String separatorString; + + /** + * Constructs a new CamelCaseSeparatorNamingPolicy object that will add the + * {@code separatorString} between each of the words separated by camel case. + * + * @param separatorString the string value to place between words + * @throws IllegalArgumentException thrown if the {@code separatorString} parameter + * is null or empty. + */ + public CamelCaseSeparatorNamingPolicy(String separatorString) { + Preconditions.checkNotNull(separatorString); + Preconditions.checkArgument(!"".equals(separatorString)); + this.separatorString = separatorString; + } + + @Override + protected String translateName(String target, Type fieldType, + Collection annnotations) { + StringBuilder translation = new StringBuilder(); + for (int i = 0; i < target.length(); i++) { + char character = target.charAt(i); + if (Character.isUpperCase(character) && translation.length() != 0) { + translation.append(separatorString); + } + translation.append(character); + } + + return translation.toString(); + } +} diff --git a/src/org/mcteam/ancientgates/gson/CircularReferenceException.java b/src/org/mcteam/ancientgates/gson/CircularReferenceException.java new file mode 100644 index 0000000..6ffe870 --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/CircularReferenceException.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + +/** + * Exception class to indicate a circular reference error. + * This class is not part of the public API and hence is not public. + * + * @author Inderjeet Singh + * @author Joel Leitch + */ +final class CircularReferenceException extends RuntimeException { + private static final long serialVersionUID = 7444343294106513081L; + private final Object offendingNode; + + CircularReferenceException(Object offendingNode) { + super("circular reference error"); + this.offendingNode = offendingNode; + } + + public IllegalStateException createDetailedException(FieldAttributes offendingField) { + StringBuilder msg = new StringBuilder(getMessage()); + if (offendingField != null) { + msg.append("\n ").append("Offending field: ").append(offendingField.getName() + "\n"); + } + if (offendingNode != null) { + msg.append("\n ").append("Offending object: ").append(offendingNode); + } + return new IllegalStateException(msg.toString(), this); + } +} diff --git a/src/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.java b/src/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.java new file mode 100644 index 0000000..a491f60 --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/CompositionFieldNamingPolicy.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.Collection; + +/** + * Performs numerous field naming translations wrapped up as one object. + * + * @author Joel Leitch + */ +abstract class CompositionFieldNamingPolicy extends RecursiveFieldNamingPolicy { + + private final RecursiveFieldNamingPolicy[] fieldPolicies; + + public CompositionFieldNamingPolicy(RecursiveFieldNamingPolicy... fieldNamingPolicies) { + if (fieldNamingPolicies == null) { + throw new NullPointerException("naming policies can not be null."); + } + this.fieldPolicies = fieldNamingPolicies; + } + + @Override + protected String translateName(String target, Type fieldType, Collection annotations) { + for (RecursiveFieldNamingPolicy policy : fieldPolicies) { + target = policy.translateName(target, fieldType, annotations); + } + return target; + } +} diff --git a/src/org/mcteam/ancientgates/gson/DefaultTypeAdapters.java b/src/org/mcteam/ancientgates/gson/DefaultTypeAdapters.java new file mode 100644 index 0000000..b1fc606 --- /dev/null +++ b/src/org/mcteam/ancientgates/gson/DefaultTypeAdapters.java @@ -0,0 +1,893 @@ +/* + * Copyright (C) 2008 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.mcteam.ancientgates.gson; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.SortedSet; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.UUID; + +/** + * List of all the default type adapters ({@link JsonSerializer}s, {@link JsonDeserializer}s, + * and {@link InstanceCreator}s. + * + * @author Inderjeet Singh + * @author Joel Leitch + */ +final class DefaultTypeAdapters { + + private static final DefaultDateTypeAdapter DATE_TYPE_ADAPTER = new DefaultDateTypeAdapter(); + private static final DefaultJavaSqlDateTypeAdapter JAVA_SQL_DATE_TYPE_ADAPTER = + new DefaultJavaSqlDateTypeAdapter(); + private static final DefaultTimeTypeAdapter TIME_TYPE_ADAPTER = + new DefaultTimeTypeAdapter(); + private static final DefaultTimestampDeserializer TIMESTAMP_DESERIALIZER = + new DefaultTimestampDeserializer(); + + @SuppressWarnings("rawtypes") + private static final EnumTypeAdapter ENUM_TYPE_ADAPTER = new EnumTypeAdapter(); + private static final UrlTypeAdapter URL_TYPE_ADAPTER = new UrlTypeAdapter(); + private static final UriTypeAdapter URI_TYPE_ADAPTER = new UriTypeAdapter(); + private static final UuidTypeAdapter UUUID_TYPE_ADAPTER = new UuidTypeAdapter(); + private static final LocaleTypeAdapter LOCALE_TYPE_ADAPTER = new LocaleTypeAdapter(); + private static final CollectionTypeAdapter COLLECTION_TYPE_ADAPTER = new CollectionTypeAdapter(); + private static final MapTypeAdapter MAP_TYPE_ADAPTER = new MapTypeAdapter(); + private static final BigDecimalTypeAdapter BIG_DECIMAL_TYPE_ADAPTER = new BigDecimalTypeAdapter(); + private static final BigIntegerTypeAdapter BIG_INTEGER_TYPE_ADAPTER = new BigIntegerTypeAdapter(); + + private static final BooleanTypeAdapter BOOLEAN_TYPE_ADAPTER = new BooleanTypeAdapter(); + private static final ByteTypeAdapter BYTE_TYPE_ADAPTER = new ByteTypeAdapter(); + private static final CharacterTypeAdapter CHARACTER_TYPE_ADAPTER = new CharacterTypeAdapter(); + private static final DoubleDeserializer DOUBLE_TYPE_ADAPTER = new DoubleDeserializer(); + private static final FloatDeserializer FLOAT_TYPE_ADAPTER = new FloatDeserializer(); + private static final IntegerTypeAdapter INTEGER_TYPE_ADAPTER = new IntegerTypeAdapter(); + private static final LongDeserializer LONG_DESERIALIZER = new LongDeserializer(); + private static final NumberTypeAdapter NUMBER_TYPE_ADAPTER = new NumberTypeAdapter(); + private static final ShortTypeAdapter SHORT_TYPE_ADAPTER = new ShortTypeAdapter(); + private static final StringTypeAdapter STRING_TYPE_ADAPTER = new StringTypeAdapter(); + + private static final PropertiesCreator PROPERTIES_CREATOR = new PropertiesCreator(); + private static final TreeSetCreator TREE_SET_CREATOR = new TreeSetCreator(); + private static final HashSetCreator HASH_SET_CREATOR = new HashSetCreator(); + private static final GregorianCalendarTypeAdapter GREGORIAN_CALENDAR_TYPE_ADAPTER = + new GregorianCalendarTypeAdapter(); + + // The constants DEFAULT_SERIALIZERS, DEFAULT_DESERIALIZERS, and DEFAULT_INSTANCE_CREATORS + // must be defined after the constants for the type adapters. Otherwise, the type adapter + // constants will appear as nulls. + private static final ParameterizedTypeHandlerMap> DEFAULT_SERIALIZERS = + createDefaultSerializers(); + private static final ParameterizedTypeHandlerMap> DEFAULT_DESERIALIZERS = + createDefaultDeserializers(); + private static final ParameterizedTypeHandlerMap> DEFAULT_INSTANCE_CREATORS = + createDefaultInstanceCreators(); + + private static ParameterizedTypeHandlerMap> createDefaultSerializers() { + ParameterizedTypeHandlerMap> map = + new ParameterizedTypeHandlerMap>(); + + map.registerForTypeHierarchy(Enum.class, ENUM_TYPE_ADAPTER); + map.register(URL.class, URL_TYPE_ADAPTER); + map.register(URI.class, URI_TYPE_ADAPTER); + map.register(UUID.class, UUUID_TYPE_ADAPTER); + map.register(Locale.class, LOCALE_TYPE_ADAPTER); + map.registerForTypeHierarchy(Collection.class, COLLECTION_TYPE_ADAPTER); + map.registerForTypeHierarchy(Map.class, MAP_TYPE_ADAPTER); + map.register(Date.class, DATE_TYPE_ADAPTER); + map.register(java.sql.Date.class, JAVA_SQL_DATE_TYPE_ADAPTER); + map.register(Timestamp.class, DATE_TYPE_ADAPTER); + map.register(Time.class, TIME_TYPE_ADAPTER); + map.register(Calendar.class, GREGORIAN_CALENDAR_TYPE_ADAPTER); + map.register(GregorianCalendar.class, GREGORIAN_CALENDAR_TYPE_ADAPTER); + map.register(BigDecimal.class, BIG_DECIMAL_TYPE_ADAPTER); + map.register(BigInteger.class, BIG_INTEGER_TYPE_ADAPTER); + + // Add primitive serializers + map.register(Boolean.class, BOOLEAN_TYPE_ADAPTER); + map.register(boolean.class, BOOLEAN_TYPE_ADAPTER); + map.register(Byte.class, BYTE_TYPE_ADAPTER); + map.register(byte.class, BYTE_TYPE_ADAPTER); + map.register(Character.class, CHARACTER_TYPE_ADAPTER); + map.register(char.class, CHARACTER_TYPE_ADAPTER); + map.register(Integer.class, INTEGER_TYPE_ADAPTER); + map.register(int.class, INTEGER_TYPE_ADAPTER); + map.register(Number.class, NUMBER_TYPE_ADAPTER); + map.register(Short.class, SHORT_TYPE_ADAPTER); + map.register(short.class, SHORT_TYPE_ADAPTER); + map.register(String.class, STRING_TYPE_ADAPTER); + + map.makeUnmodifiable(); + return map; + } + + private static ParameterizedTypeHandlerMap> createDefaultDeserializers() { + ParameterizedTypeHandlerMap> map = + new ParameterizedTypeHandlerMap>(); + map.registerForTypeHierarchy(Enum.class, wrapDeserializer(ENUM_TYPE_ADAPTER)); + map.register(URL.class, wrapDeserializer(URL_TYPE_ADAPTER)); + map.register(URI.class, wrapDeserializer(URI_TYPE_ADAPTER)); + map.register(UUID.class, wrapDeserializer(UUUID_TYPE_ADAPTER)); + map.register(Locale.class, wrapDeserializer(LOCALE_TYPE_ADAPTER)); + map.registerForTypeHierarchy(Collection.class, wrapDeserializer(COLLECTION_TYPE_ADAPTER)); + map.registerForTypeHierarchy(Map.class, wrapDeserializer(MAP_TYPE_ADAPTER)); + map.register(Date.class, wrapDeserializer(DATE_TYPE_ADAPTER)); + map.register(java.sql.Date.class, wrapDeserializer(JAVA_SQL_DATE_TYPE_ADAPTER)); + map.register(Timestamp.class, wrapDeserializer(TIMESTAMP_DESERIALIZER)); + map.register(Time.class, wrapDeserializer(TIME_TYPE_ADAPTER)); + map.register(Calendar.class, GREGORIAN_CALENDAR_TYPE_ADAPTER); + map.register(GregorianCalendar.class, GREGORIAN_CALENDAR_TYPE_ADAPTER); + map.register(BigDecimal.class, wrapDeserializer(BIG_DECIMAL_TYPE_ADAPTER)); + map.register(BigInteger.class, wrapDeserializer(BIG_INTEGER_TYPE_ADAPTER)); + + // Add primitive deserializers + map.register(Boolean.class, wrapDeserializer(BOOLEAN_TYPE_ADAPTER)); + map.register(boolean.class, wrapDeserializer(BOOLEAN_TYPE_ADAPTER)); + map.register(Byte.class, wrapDeserializer(BYTE_TYPE_ADAPTER)); + map.register(byte.class, wrapDeserializer(BYTE_TYPE_ADAPTER)); + map.register(Character.class, wrapDeserializer(CHARACTER_TYPE_ADAPTER)); + map.register(char.class, wrapDeserializer(CHARACTER_TYPE_ADAPTER)); + map.register(Double.class, wrapDeserializer(DOUBLE_TYPE_ADAPTER)); + map.register(double.class, wrapDeserializer(DOUBLE_TYPE_ADAPTER)); + map.register(Float.class, wrapDeserializer(FLOAT_TYPE_ADAPTER)); + map.register(float.class, wrapDeserializer(FLOAT_TYPE_ADAPTER)); + map.register(Integer.class, wrapDeserializer(INTEGER_TYPE_ADAPTER)); + map.register(int.class, wrapDeserializer(INTEGER_TYPE_ADAPTER)); + map.register(Long.class, wrapDeserializer(LONG_DESERIALIZER)); + map.register(long.class, wrapDeserializer(LONG_DESERIALIZER)); + map.register(Number.class, wrapDeserializer(NUMBER_TYPE_ADAPTER)); + map.register(Short.class, wrapDeserializer(SHORT_TYPE_ADAPTER)); + map.register(short.class, wrapDeserializer(SHORT_TYPE_ADAPTER)); + map.register(String.class, wrapDeserializer(STRING_TYPE_ADAPTER)); + + map.makeUnmodifiable(); + return map; + } + + private static ParameterizedTypeHandlerMap> createDefaultInstanceCreators() { + ParameterizedTypeHandlerMap> map = + new ParameterizedTypeHandlerMap>(); + map.registerForTypeHierarchy(Map.class, MAP_TYPE_ADAPTER); + + // Add Collection type instance creators + map.registerForTypeHierarchy(Collection.class, COLLECTION_TYPE_ADAPTER); + + map.registerForTypeHierarchy(Set.class, HASH_SET_CREATOR); + map.registerForTypeHierarchy(SortedSet.class, TREE_SET_CREATOR); + map.register(Properties.class, PROPERTIES_CREATOR); + map.makeUnmodifiable(); + return map; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static JsonDeserializer wrapDeserializer(JsonDeserializer deserializer) { + return new JsonDeserializerExceptionWrapper(deserializer); + } + + static ParameterizedTypeHandlerMap> getDefaultSerializers() { + return getDefaultSerializers(false, LongSerializationPolicy.DEFAULT); + } + + static ParameterizedTypeHandlerMap> getDefaultSerializers( + boolean serializeSpecialFloatingPointValues, LongSerializationPolicy longSerializationPolicy) { + ParameterizedTypeHandlerMap> serializers = + new ParameterizedTypeHandlerMap>(); + + // Double primitive + DefaultTypeAdapters.DoubleSerializer doubleSerializer = + new DefaultTypeAdapters.DoubleSerializer(serializeSpecialFloatingPointValues); + serializers.registerIfAbsent(Double.class, doubleSerializer); + serializers.registerIfAbsent(double.class, doubleSerializer); + + // Float primitive + DefaultTypeAdapters.FloatSerializer floatSerializer = + new DefaultTypeAdapters.FloatSerializer(serializeSpecialFloatingPointValues); + serializers.registerIfAbsent(Float.class, floatSerializer); + serializers.registerIfAbsent(float.class, floatSerializer); + + // Long primitive + DefaultTypeAdapters.LongSerializer longSerializer = + new DefaultTypeAdapters.LongSerializer(longSerializationPolicy); + serializers.registerIfAbsent(Long.class, longSerializer); + serializers.registerIfAbsent(long.class, longSerializer); + + serializers.registerIfAbsent(DEFAULT_SERIALIZERS); + return serializers; + } + + static ParameterizedTypeHandlerMap> getDefaultDeserializers() { + return DEFAULT_DESERIALIZERS; + } + + static ParameterizedTypeHandlerMap> getDefaultInstanceCreators() { + return DEFAULT_INSTANCE_CREATORS; + } + + static class DefaultDateTypeAdapter implements JsonSerializer, JsonDeserializer { + private final DateFormat format; + + DefaultDateTypeAdapter() { + this.format = DateFormat.getDateTimeInstance(); + } + + DefaultDateTypeAdapter(final String datePattern) { + this.format = new SimpleDateFormat(datePattern); + } + + DefaultDateTypeAdapter(final int style) { + this.format = DateFormat.getDateInstance(style); + } + + public DefaultDateTypeAdapter(final int dateStyle, final int timeStyle) { + this.format = DateFormat.getDateTimeInstance(dateStyle, timeStyle); + } + + // These methods need to be synchronized since JDK DateFormat classes are not thread-safe + // See issue 162 + public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { + synchronized (format) { + String dateFormatAsString = format.format(src); + return new JsonPrimitive(dateFormatAsString); + } + } + + public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { + if (!(json instanceof JsonPrimitive)) { + throw new JsonParseException("The date should be a string value"); + } + try { + synchronized (format) { + return format.parse(json.getAsString()); + } + } catch (ParseException e) { + throw new JsonSyntaxException(e); + } + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(DefaultDateTypeAdapter.class.getSimpleName()); + sb.append('(').append(format.getClass().getSimpleName()).append(')'); + return sb.toString(); + } + } + + static class DefaultJavaSqlDateTypeAdapter implements JsonSerializer, + JsonDeserializer { + private final DateFormat format; + DefaultJavaSqlDateTypeAdapter() { + this.format = new SimpleDateFormat("MMM d, yyyy"); + } + + public JsonElement serialize(java.sql.Date src, Type typeOfSrc, + JsonSerializationContext context) { + synchronized (format) { + String dateFormatAsString = format.format(src); + return new JsonPrimitive(dateFormatAsString); + } + } + + public java.sql.Date deserialize(JsonElement json, Type typeOfT, + JsonDeserializationContext context) throws JsonParseException { + if (!(json instanceof JsonPrimitive)) { + throw new JsonParseException("The date should be a string value"); + } + try { + synchronized (format) { + Date date = format.parse(json.getAsString()); + return new java.sql.Date(date.getTime()); + } + } catch (ParseException e) { + throw new JsonSyntaxException(e); + } + } + } + + static class DefaultTimestampDeserializer implements JsonDeserializer { + public Timestamp deserialize(JsonElement json, Type typeOfT, + JsonDeserializationContext context) throws JsonParseException { + Date date = context.deserialize(json, Date.class); + return new Timestamp(date.getTime()); + } + } + + static class DefaultTimeTypeAdapter implements JsonSerializer