From ecf32200b301890b68bfb6df1ea1ec0ccf5e0aa7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 8 Aug 2016 15:07:08 +0200 Subject: [PATCH 001/114] Fix build --- authmebridge-authme/LICENSE | 674 ++++++++++++++++++ authmebridge-authme/pom.xml | 14 +- .../crylegend/authmebridge/AuthMeBridge.java | 2 +- authmebridge-bungee/LICENSE | 674 ++++++++++++++++++ authmebridge-bungee/pom.xml | 13 +- authmebridge-xauth/LICENSE | 674 ++++++++++++++++++ authmebridge-xauth/pom.xml | 14 +- .../crylegend/xauthbridge/xAuthBridge.java | 2 +- pom.xml | 14 +- 9 files changed, 2034 insertions(+), 47 deletions(-) create mode 100644 authmebridge-authme/LICENSE create mode 100644 authmebridge-bungee/LICENSE create mode 100644 authmebridge-xauth/LICENSE diff --git a/authmebridge-authme/LICENSE b/authmebridge-authme/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/authmebridge-authme/LICENSE @@ -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. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + 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: + + {project} Copyright (C) {year} {fullname} + 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/authmebridge-authme/pom.xml b/authmebridge-authme/pom.xml index 8d4f48e..41e54a1 100644 --- a/authmebridge-authme/pom.xml +++ b/authmebridge-authme/pom.xml @@ -7,34 +7,26 @@ com.crylegend authmebridge-parent - ${project.parent.version} + 1.6.2-SNAPSHOT authmebridge-authme - jar AuthMeBridge ${project.name}-${project.version} - src/main/java - src/test/java - . false - ../ + . LICENSE - . true src/main/resources/ - - * - @@ -60,7 +52,6 @@ bukkit ${bukkitVersion} provided - true junit @@ -95,7 +86,6 @@ authme 5.2-SNAPSHOT provided - true diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java index 99d04c4..17adefb 100644 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java +++ b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java @@ -47,7 +47,7 @@ public void onPluginMessageReceived(String channel, Player p, byte[] message) { String subchannel = in.readUTF(); if (subchannel.equals("AutoLogin")) { - Player player = Bukkit.getPlayer(in.readUTF()); + Player player = Bukkit.getPlayerExact(in.readUTF()); if (player != null) { if (!fr.xephi.authme.api.NewAPI.getInstance().isAuthenticated(player)) { diff --git a/authmebridge-bungee/LICENSE b/authmebridge-bungee/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/authmebridge-bungee/LICENSE @@ -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. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + 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: + + {project} Copyright (C) {year} {fullname} + 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/authmebridge-bungee/pom.xml b/authmebridge-bungee/pom.xml index 53e03ae..efe9eb2 100644 --- a/authmebridge-bungee/pom.xml +++ b/authmebridge-bungee/pom.xml @@ -7,34 +7,26 @@ com.crylegend authmebridge-parent - ${project.parent.version} + 1.6.2-SNAPSHOT authmebridge-bungeecord - jar BungeeAuthMeBridge ${project.name}-${project.version} - src/main/java - src/test/java - . false - ../ + . LICENSE - . true src/main/resources/ - - * - @@ -54,7 +46,6 @@ bungeecord-api ${bungeeVersion} provided - true diff --git a/authmebridge-xauth/LICENSE b/authmebridge-xauth/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/authmebridge-xauth/LICENSE @@ -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. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + 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: + + {project} Copyright (C) {year} {fullname} + 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/authmebridge-xauth/pom.xml b/authmebridge-xauth/pom.xml index 0752731..82356b1 100644 --- a/authmebridge-xauth/pom.xml +++ b/authmebridge-xauth/pom.xml @@ -7,34 +7,26 @@ com.crylegend authmebridge-parent - ${project.parent.version} + 1.6.2-SNAPSHOT authmebridge-xauth - jar xAuthBridge ${project.name}-${project.version} - src/main/java - src/test/java - . false - ../ + . LICENSE - . true src/main/resources/ - - * - @@ -60,7 +52,6 @@ bukkit ${bukkitVersion} provided - true junit @@ -129,7 +120,6 @@ org.apache.logging.log4j - true diff --git a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java b/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java index 29dd52a..c36934a 100644 --- a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java +++ b/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java @@ -52,7 +52,7 @@ public void onPluginMessageReceived(String channel, Player p, byte[] message) { String subchannel = in.readUTF(); if (subchannel.equals("AutoLogin")) { - Player player = Bukkit.getPlayer(in.readUTF()); + Player player = Bukkit.getPlayerExact(in.readUTF()); if (player != null) { if (!xauth.getPlayerManager().getPlayer(player.getName()).isAuthenticated()) { diff --git a/pom.xml b/pom.xml index e44b7b8..8dc6508 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.crylegend authmebridge-parent - 1.6.1 + 1.6.2-SNAPSHOT pom AuthMeBridge @@ -42,19 +42,13 @@ - - 3.3.3 - - - UTF-8 - ${projectEncoding} - ${projectEncoding} + UTF-8 1.7 - 1.9-R0.1-SNAPSHOT - 1.9-SNAPSHOT + 1.10.2-R0.1-SNAPSHOT + 1.10-SNAPSHOT From 2408cb307ef114e4ed7075ee1f957352068b67cb Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 8 Aug 2016 15:41:23 +0200 Subject: [PATCH 002/114] Drop xauth module, codestyle, cleanup --- .../crylegend/authmebridge/AuthMeBridge.java | 117 ++++++----- .../authmebridge/AuthMeBridgeListener.java | 75 +++---- .../authmebridge/PluginMessageTask.java | 23 ++- .../src/main/resources/config.yml | 1 + .../src/main/resources/plugin.yml | 1 - .../bungeeauthmebridge/BridgeAPI.java | 21 +- .../BungeeAuthMeBridge.java | 62 +++--- .../bungeeauthmebridge/Constants.java | 10 +- .../bungeeauthmebridge/PlayersManager.java | 42 ++-- .../bungeeauthmebridge/config/Settings.java | 9 +- .../listeners/PlayerListener.java | 184 +++++++++--------- .../listeners/ServerListener.java | 72 +++---- .../bungeeauthmebridge/types/AuthPlayer.java | 54 ++--- .../utils/PluginMessageTask.java | 18 +- .../src/main/resources/config.yml | 3 +- .../src/main/resources/plugin.yml | 2 +- pom.xml | 2 + 17 files changed, 356 insertions(+), 340 deletions(-) create mode 100644 authmebridge-authme/src/main/resources/config.yml diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java index 17adefb..e39f473 100644 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java +++ b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java @@ -3,60 +3,81 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; +import org.bukkit.Server; import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.Messenger; import org.bukkit.plugin.messaging.PluginMessageListener; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; +import fr.xephi.authme.api.NewAPI; + public class AuthMeBridge extends JavaPlugin implements PluginMessageListener { - Logger log = Logger.getLogger("Minecraft"); - String prefix = "[AuthMeBridge] "; - String incomingChannel = "BAuthMeBridge"; - String outgoingChannel = "AuthMeBridge"; - String autoLoginMessage = ChatColor.GREEN + "Your session has been resumed by the bridge."; - - public void onEnable() { - log.info(prefix + "Hello world"); - - if (!getServer().getPluginManager().isPluginEnabled("AuthMe")) { - log.info(prefix + "AuthMe not found, disabling"); - getServer().getPluginManager().disablePlugin(this); - } - - getServer().getPluginManager().registerEvents(new AuthMeBridgeListener(this), this); - getServer().getMessenger().registerIncomingPluginChannel(this, incomingChannel, this); - getServer().getMessenger().registerOutgoingPluginChannel(this, outgoingChannel); - - autoLoginMessage = getConfig().getString("autoLoginMessage", autoLoginMessage); - getConfig().set("autoLoginMessage", autoLoginMessage); - - saveConfig(); - } - - public void onDisable() { - log.info(prefix + "Goodbye world"); - } - - @Override - public void onPluginMessageReceived(String channel, Player p, byte[] message) { - if (channel.equals(incomingChannel)) { - ByteArrayDataInput in = ByteStreams.newDataInput(message); - String subchannel = in.readUTF(); - - if (subchannel.equals("AutoLogin")) { - Player player = Bukkit.getPlayerExact(in.readUTF()); - - if (player != null) { - if (!fr.xephi.authme.api.NewAPI.getInstance().isAuthenticated(player)) { - fr.xephi.authme.api.NewAPI.getInstance().forceLogin(player); - if (!autoLoginMessage.isEmpty()) - player.sendMessage(autoLoginMessage); - } - } - } - } - } + private final static String incomingChannel = "BAuthMeBridge"; + private final static String outgoingChannel = "AuthMeBridge"; + + private Logger log; + private String autoLoginMessage; + private NewAPI authme; + + protected String getOutgoingChannel() { + return outgoingChannel; + } + + @Override + public void onEnable() { + // Setup logger + log = getLogger(); + + // Get server instances + Server server = getServer(); + PluginManager pm = server.getPluginManager(); + Messenger messenger = server.getMessenger(); + + // Check authme + if (!pm.isPluginEnabled("AuthMe")) { + log.warning("AuthMe not found, disabling"); + setEnabled(false); + return; + } + authme = NewAPI.getInstance(); + + // Config + saveDefaultConfig(); + autoLoginMessage = getConfig().getString("autoLoginMessage", "&2Your session has been resumed by the bridge."); + + pm.registerEvents(new AuthMeBridgeListener(this), this); + messenger.registerIncomingPluginChannel(this, incomingChannel, this); + messenger.registerOutgoingPluginChannel(this, outgoingChannel); + } + + @Override + public void onPluginMessageReceived(String channel, Player p, byte[] message) { + if(!channel.equals(incomingChannel)) { + return; + } + ByteArrayDataInput in = ByteStreams.newDataInput(message); + + String subchannel = in.readUTF(); + if (!subchannel.equals("AutoLogin")) { + return; + } + + String name = in.readUTF(); + Player player = Bukkit.getPlayerExact(name); + if(player == null) { + return; + } + + if (authme.isAuthenticated(player)) { + return; + } + authme.forceLogin(player); + if (!autoLoginMessage.isEmpty()) { + player.sendMessage(autoLoginMessage); + } + } } diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java index 3a3fd0a..99bd8ca 100644 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java +++ b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java @@ -7,45 +7,46 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; import fr.xephi.authme.events.LoginEvent; -public class AuthMeBridgeListener implements Listener{ - AuthMeBridge plugin; - - public AuthMeBridgeListener(AuthMeBridge plugin) { - this.plugin = plugin; - } - - @EventHandler - public void onAuthMeLogin(LoginEvent event) { - if (event.getPlayer() == null) - return; - playerLogin(event.getPlayer()); - } - - @EventHandler - public void onAuthMeSession(PlayerJoinEvent event) { - final Player player = event.getPlayer(); - plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { - public void run() { - if (fr.xephi.authme.api.NewAPI.getInstance().isAuthenticated(player)) - playerLogin(player); - } - }, 10L); - } - - public void playerLogin(Player player) { - ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - try { - out.writeUTF("PlayerLogin"); - out.writeUTF(player.getName()); - new PluginMessageTask(plugin, player, b).runTaskAsynchronously(plugin); - } catch (IOException e) { - e.printStackTrace(); - } - } +public class AuthMeBridgeListener implements Listener { + AuthMeBridge plugin; + public AuthMeBridgeListener(AuthMeBridge plugin) { + this.plugin = plugin; + } + + @EventHandler + public void onAuthMeLogin(LoginEvent event) { + if (event.getPlayer() == null) { + return; + } + handlePlayerLogin(event.getPlayer()); + } + + /* should be already handled by the event! -sgdc3 + @EventHandler + public void onAuthMeSession(PlayerJoinEvent event) { + final Player player = event.getPlayer(); + plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { + public void run() { + if (fr.xephi.authme.api.NewAPI.getInstance().isAuthenticated(player)) + handlePlayerLogin(player); + } + }, 10L); + } + */ + + public void handlePlayerLogin(Player player) { + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + try { + out.writeUTF("PlayerLogin"); + out.writeUTF(player.getName()); + new PluginMessageTask(plugin, player, b).runTaskAsynchronously(plugin); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java index ea42fb3..972b819 100644 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java +++ b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java @@ -6,18 +6,17 @@ import org.bukkit.scheduler.BukkitRunnable; public class PluginMessageTask extends BukkitRunnable { - private final AuthMeBridge plugin; - private final Player player; - private final ByteArrayOutputStream bytes; + private final AuthMeBridge plugin; + private final Player player; + private final ByteArrayOutputStream bytes; - public PluginMessageTask(AuthMeBridge plugin, Player player, ByteArrayOutputStream bytes) - { - this.plugin = plugin; - this.player = player; - this.bytes = bytes; - } + public PluginMessageTask(AuthMeBridge plugin, Player player, ByteArrayOutputStream bytes) { + this.plugin = plugin; + this.player = player; + this.bytes = bytes; + } - public void run() { - player.sendPluginMessage(plugin, plugin.outgoingChannel, bytes.toByteArray()); - } + public void run() { + player.sendPluginMessage(plugin, plugin.getOutgoingChannel(), bytes.toByteArray()); + } } diff --git a/authmebridge-authme/src/main/resources/config.yml b/authmebridge-authme/src/main/resources/config.yml new file mode 100644 index 0000000..f809ed1 --- /dev/null +++ b/authmebridge-authme/src/main/resources/config.yml @@ -0,0 +1 @@ +autoLoginMessage : '&2Your session has been resumed by the bridge.' diff --git a/authmebridge-authme/src/main/resources/plugin.yml b/authmebridge-authme/src/main/resources/plugin.yml index 0437fe1..32c6db0 100644 --- a/authmebridge-authme/src/main/resources/plugin.yml +++ b/authmebridge-authme/src/main/resources/plugin.yml @@ -1,7 +1,6 @@ name: ${project.name} main: com.crylegend.authmebridge.AuthMeBridge version: ${project.version} -website: http://www.craftfriends.fr author: CryLegend description: The first AuthMe bungeecord addon depend: [AuthMe] diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java index 49ccc91..0c193bb 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java @@ -16,14 +16,15 @@ * API class - acts like shortcuts */ public class BridgeAPI { - - private BridgeAPI() { } - - public static BungeeAuthMeBridge getPlugin() { - return BungeeAuthMeBridge.getInstance(); - } - - public static PlayersManager getPlayersManager() { - return BungeeAuthMeBridge.getInstance().getPlayersManager(); - } + + private BridgeAPI() { + } + + public static BungeeAuthMeBridge getPlugin() { + return BungeeAuthMeBridge.getInstance(); + } + + public static PlayersManager getPlayersManager() { + return BungeeAuthMeBridge.getInstance().getPlayersManager(); + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java index c00e289..6bf70a5 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java @@ -21,35 +21,35 @@ * Main class */ public class BungeeAuthMeBridge extends Plugin { - private static BungeeAuthMeBridge instance; - private PlayersManager playersManager; - - public static BungeeAuthMeBridge getInstance() { - return instance; - } - - public PlayersManager getPlayersManager() { - return playersManager; - } - - public void log(String message) { - getLogger().info(message); - } - - public void onLoad() { - instance = this; - } - - public void onEnable() { - // Registering channels to be able to communicate with bukkit-side - getProxy().registerChannel(Constants.incomingChannel); - getProxy().registerChannel(Constants.outgoingChannel); - - // Registering listeners - getProxy().getPluginManager().registerListener(this, new PlayerListener()); - getProxy().getPluginManager().registerListener(this, new ServerListener()); - - playersManager = new PlayersManager(); - new Settings(); - } + private static BungeeAuthMeBridge instance; + private PlayersManager playersManager; + + public static BungeeAuthMeBridge getInstance() { + return instance; + } + + public PlayersManager getPlayersManager() { + return playersManager; + } + + public void log(String message) { + getLogger().info(message); + } + + public void onLoad() { + instance = this; + } + + public void onEnable() { + // Registering channels to be able to communicate with bukkit-side + getProxy().registerChannel(Constants.incomingChannel); + getProxy().registerChannel(Constants.outgoingChannel); + + // Registering listeners + getProxy().getPluginManager().registerListener(this, new PlayerListener()); + getProxy().getPluginManager().registerListener(this, new ServerListener()); + + playersManager = new PlayersManager(); + new Settings(); + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java index 8eff660..8a4896d 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java @@ -19,10 +19,8 @@ * Plugin constants */ public class Constants { - public static String incomingChannel = "AuthMeBridge"; - public static String outgoingChannel = "BAuthMeBridge"; - public static List authMeCommands = Arrays.asList( - "/login", "/register", "/passpartu", "/l", "/reg", "/email", "/captcha"); - - private Constants() { } + public static String incomingChannel = "AuthMeBridge"; + public static String outgoingChannel = "BAuthMeBridge"; + public static List authMeCommands = Arrays.asList("/login", "/register", "/passpartu", "/l", "/reg", + "/email", "/captcha"); } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java index baa4244..fc9092d 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java @@ -22,25 +22,25 @@ * Players manager - store all references to AuthPlayer objects through an HashMap */ public class PlayersManager { - private HashMap players; - - public PlayersManager() { - players = new HashMap(); - } - - public void addPlayer(AuthPlayer player) { - players.put(player.getName(), player); - } - - public void removePlayer(String name) { - players.remove(name); - } - - public AuthPlayer getPlayer(ProxiedPlayer player) { - return getPlayer(player.getName()); - } - - public AuthPlayer getPlayer(String name) { - return players.get(name); - } + private HashMap players; + + public PlayersManager() { + players = new HashMap(); + } + + public void addPlayer(AuthPlayer player) { + players.put(player.getName(), player); + } + + public void removePlayer(String name) { + players.remove(name); + } + + public AuthPlayer getPlayer(ProxiedPlayer player) { + return getPlayer(player.getName()); + } + + public AuthPlayer getPlayer(String name) { + return players.get(name); + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java index 2c6b82f..ab8a346 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java @@ -30,6 +30,7 @@ public final class Settings { public static boolean commandsRequiresAuth = true; public static boolean chatRequiresAuth = true; public static boolean serverSwitchRequiresAuth = false; + public static String requiresAuthKickMessage = "Authentication required."; public static boolean autoLogin = true; private Configuration config; @@ -40,9 +41,8 @@ public Settings() { this.configFile.loadConfig(); this.config = configFile.getConfig(); loadConfigOptions(); - } - catch (Exception ex) { - ex.printStackTrace(); + } catch (Exception ex) { + ex.printStackTrace(); } } @@ -50,12 +50,13 @@ public void loadConfigOptions() { if (configFile == null) { return; } - + commandsWhitelist = config.getStringList("commandsWhitelist"); serversList = config.getStringList("serversList"); commandsRequiresAuth = config.getBoolean("commandsRequiresAuth", true); chatRequiresAuth = config.getBoolean("chatRequiresAuth", true); serverSwitchRequiresAuth = config.getBoolean("serverSwitchRequiresAuth", false); + requiresAuthKickMessage = config.getString("serverSwitchKickMessage", "Authentication required."); autoLogin = config.getBoolean("autoLogin", true); } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java index 3e75737..f4e7698 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java @@ -35,100 +35,92 @@ * Player listener - listen to all actions that are related to players */ public class PlayerListener implements Listener { - - @EventHandler - public void onPlayerJoin(PostLoginEvent event) { - // Register player in our list - AuthPlayer player = new AuthPlayer(event.getPlayer().getName()); - BridgeAPI.getPlayersManager().addPlayer(player); - } - - @EventHandler - public void onPlayerLeave(PlayerDisconnectEvent event) { - // Remove player from out list - BridgeAPI.getPlayersManager().removePlayer(event.getPlayer().getName()); - } - - // Priority is set to lowest to keep compatibility with some chat plugins - @EventHandler(priority=EventPriority.LOWEST) - public void onChat(ChatEvent event) { - if (event.isCancelled()) - return; - - // Check if it's a player - if (!(event.getSender() instanceof ProxiedPlayer)) - return; - - if (event.isCommand()) { - String command = event.getMessage().split(" ")[0]; - - // Check if command is an AuthMe command - if (Constants.authMeCommands.contains(command)) - return; - - // Check if command is a whitelisted command - if (Settings.commandsWhitelist.contains(command)) - return; - } - - ProxiedPlayer proxiedPlayer = (ProxiedPlayer) event.getSender(); - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(proxiedPlayer); - - // If player is not logged in, cancel the event - if (!player.isLoggedIn()) - event.setCancelled(true); - } - - @EventHandler - public void onServerSwitch(ServerSwitchEvent event) { - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(event.getPlayer()); - - // Check if player exists (causing NPE, maybe the event is fired on player disconnect?) - if (player == null) - return; - - // Player is trying to switch server (also called on first server player connection) - if (player.isLoggedIn()) { - // If player is logged in and autoLogin is enabled, send login signal to the bukkit side - if (Settings.autoLogin) { - try { - ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - - out.writeUTF("AutoLogin"); - - out.writeUTF(player.getName()); - - ProxyServer.getInstance().getScheduler().runAsync(BridgeAPI.getPlugin(), - new PluginMessageTask(event.getPlayer().getServer().getInfo(), b)); - } - catch (IOException e) { - e.printStackTrace(); - } - } - } - else { - // If player is not logged in and serverSwitchRequiresAuth is enabled, kick player - if (Settings.serverSwitchRequiresAuth) { - String server = event.getPlayer().getServer().getInfo().getName(); - - if (!Settings.serversList.contains(server)) { - TextComponent kickReason = new TextComponent("Authentication required."); - kickReason.setColor(ChatColor.RED); - event.getPlayer().disconnect(kickReason); - } - } - } - } - - // I don't remember what it stood for, but I put it again "just in case" - @SuppressWarnings("deprecation") - @EventHandler - public void onPlayerKick(ServerKickEvent event) { - if (event.isCancelled()) - return; - - if (event.getKickReason().equals("You logged in from another location")) - event.setCancelled(true); - } + + @EventHandler + public void onPlayerJoin(PostLoginEvent event) { + // Register player in our list + AuthPlayer player = new AuthPlayer(event.getPlayer().getName()); + BridgeAPI.getPlayersManager().addPlayer(player); + } + + @EventHandler + public void onPlayerLeave(PlayerDisconnectEvent event) { + // Remove player from out list + BridgeAPI.getPlayersManager().removePlayer(event.getPlayer().getName()); + } + + // Priority is set to lowest to keep compatibility with some chat plugins + @EventHandler(priority = EventPriority.LOWEST) + public void onChat(ChatEvent event) { + if (event.isCancelled()) + return; + + // Check if it's a player + if (!(event.getSender() instanceof ProxiedPlayer)) + return; + + if (event.isCommand()) { + String command = event.getMessage().split(" ")[0]; + + // Check if command is an AuthMe command + if (Constants.authMeCommands.contains(command)) + return; + + // Check if command is a whitelisted command + if (Settings.commandsWhitelist.contains(command)) + return; + } + + ProxiedPlayer proxiedPlayer = (ProxiedPlayer) event.getSender(); + AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(proxiedPlayer); + + // If player is not logged in, cancel the event + if (!player.isLoggedIn()) { + event.setCancelled(true); + } + } + + @EventHandler + public void onServerSwitch(ServerSwitchEvent event) { + AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(event.getPlayer()); + + // Check if player exists (causing NPE, maybe the event is fired on + // player disconnect?) + if (player == null) + return; + + // Player is trying to switch server (also called on first server player + // connection) + if (player.isLoggedIn()) { + // If player is logged in and autoLogin is enabled, send login + // signal to the bukkit side + if (Settings.autoLogin) { + try { + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + + out.writeUTF("AutoLogin"); + + out.writeUTF(player.getName()); + + ProxyServer.getInstance().getScheduler().runAsync(BridgeAPI.getPlugin(), + new PluginMessageTask(event.getPlayer().getServer().getInfo(), b)); + } catch (IOException e) { + e.printStackTrace(); + } + } + } else { + // If player is not logged in and serverSwitchRequiresAuth is + // enabled, kick player + if (Settings.serverSwitchRequiresAuth) { + String server = event.getPlayer().getServer().getInfo().getName(); + + if (!Settings.serversList.contains(server)) { + TextComponent kickReason = new TextComponent(Settings.requiresAuthKickMessage); + kickReason.setColor(ChatColor.RED); + event.getPlayer().disconnect(kickReason); + } + } + } + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java index 89a5963..e571c56 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java @@ -30,41 +30,41 @@ */ public class ServerListener implements Listener { - @EventHandler - public void onPluginMessage(PluginMessageEvent event) { - if (event.isCancelled()) - return; + @EventHandler + public void onPluginMessage(PluginMessageEvent event) { + if (event.isCancelled()) + return; - // Check if the message is for us - if (!event.getTag().equalsIgnoreCase(Constants.incomingChannel)) - return; - - // Check if a player is not trying to rip us off sending a fake message - if (!(event.getSender() instanceof Server)) - return; - - // Now that's sure, it's for us, so let's go - event.setCancelled(true); - - try { - // Read the plugin message - DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); - - // For now that's the only type of message the server is able to receive - String task = in.readUTF(); - if (!task.equals("PlayerLogin")) - return; - - // Gather informations from the plugin message - String name = in.readUTF(); - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(name); - - // Set the player status to logged in - player.setLoggedIn(); - } - catch (IOException ex) { - // Something nasty happened - ex.printStackTrace(); - } - } + // Check if the message is for us + if (!event.getTag().equalsIgnoreCase(Constants.incomingChannel)) + return; + + // Check if a player is not trying to rip us off sending a fake message + if (!(event.getSender() instanceof Server)) + return; + + // Now that's sure, it's for us, so let's go + event.setCancelled(true); + + try { + // Read the plugin message + DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); + + // For now that's the only type of message the server is able to + // receive + String task = in.readUTF(); + if (!task.equals("PlayerLogin")) + return; + + // Gather informations from the plugin message + String name = in.readUTF(); + AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(name); + + // Set the player status to logged in + player.setLoggedIn(); + } catch (IOException ex) { + // Something nasty happened + ex.printStackTrace(); + } + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java index 37f3ffe..f4d25e9 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java @@ -19,31 +19,31 @@ * Auth player - contains name and login status of a player */ public class AuthPlayer { - private String name; - private boolean isLoggedIn; - - public AuthPlayer(String name) { - this.name = name; - isLoggedIn = false; - } - - public String getName() { - return name; - } - - public boolean isLoggedIn() { - return isLoggedIn; - } - - public void setLoggedIn() { - isLoggedIn = true; - } - - public boolean isOnline() { - return getProxiedPlayer() != null; - } - - public ProxiedPlayer getProxiedPlayer() { - return ProxyServer.getInstance().getPlayer(name); - } + private String name; + private boolean isLoggedIn; + + public AuthPlayer(String name) { + this.name = name; + isLoggedIn = false; + } + + public String getName() { + return name; + } + + public boolean isLoggedIn() { + return isLoggedIn; + } + + public void setLoggedIn() { + isLoggedIn = true; + } + + public boolean isOnline() { + return getProxiedPlayer() != null; + } + + public ProxiedPlayer getProxiedPlayer() { + return ProxyServer.getInstance().getPlayer(name); + } } diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java index 76357e6..23d3402 100644 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java +++ b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java @@ -22,15 +22,15 @@ * Plugin message task - used to send plugin messages to bukkit-side */ public class PluginMessageTask implements Runnable { - private final ByteArrayOutputStream bytes; - private final ServerInfo server; + private final ByteArrayOutputStream bytes; + private final ServerInfo server; - public PluginMessageTask(ServerInfo server, ByteArrayOutputStream bytes) { - this.bytes = bytes; - this.server = server; - } + public PluginMessageTask(ServerInfo server, ByteArrayOutputStream bytes) { + this.bytes = bytes; + this.server = server; + } - public void run() { - server.sendData(Constants.outgoingChannel, bytes.toByteArray()); - } + public void run() { + server.sendData(Constants.outgoingChannel, bytes.toByteArray()); + } } diff --git a/authmebridge-bungee/src/main/resources/config.yml b/authmebridge-bungee/src/main/resources/config.yml index 46ef88f..da0b701 100644 --- a/authmebridge-bungee/src/main/resources/config.yml +++ b/authmebridge-bungee/src/main/resources/config.yml @@ -11,5 +11,6 @@ chatRequiresAuth: true # Kick all players who switch servers without being authenticated (eg. plugin teleport) # Do not set this option to true unless you know what you're doing! serverSwitchRequiresAuth: false +serverSwitchKickMessage: 'Authentication required.' # Enable session resume between servers (eg. autologin if you change server) -autoLogin: true \ No newline at end of file +autoLogin: true diff --git a/authmebridge-bungee/src/main/resources/plugin.yml b/authmebridge-bungee/src/main/resources/plugin.yml index 3b307c5..29397e3 100644 --- a/authmebridge-bungee/src/main/resources/plugin.yml +++ b/authmebridge-bungee/src/main/resources/plugin.yml @@ -1,4 +1,4 @@ name: ${project.name} main: com.crylegend.bungeeauthmebridge.BungeeAuthMeBridge version: ${project.version} -author: CryLegend \ No newline at end of file +author: CryLegend diff --git a/pom.xml b/pom.xml index 8dc6508..b17f861 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,9 @@ authmebridge-bungee authmebridge-authme + From d27e99bc0045dd6a13a7c802aa9e9b694ecf368f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 13 Dec 2016 20:02:33 +0100 Subject: [PATCH 003/114] Bump! First AuthMeBungee commit! --- .travis.yml | 20 - .../crylegend/authmebridge/AuthMeBridge.java | 83 --- .../authmebridge/AuthMeBridgeListener.java | 52 -- .../authmebridge/PluginMessageTask.java | 22 - .../bungeeauthmebridge/BridgeAPI.java | 30 - .../BungeeAuthMeBridge.java | 55 -- .../bungeeauthmebridge/Constants.java | 26 - .../bungeeauthmebridge/PlayersManager.java | 46 -- .../bungeeauthmebridge/config/Settings.java | 62 -- .../bungeeauthmebridge/config/YamlConfig.java | 68 -- .../listeners/PlayerListener.java | 126 ---- .../listeners/ServerListener.java | 70 -- .../bungeeauthmebridge/types/AuthPlayer.java | 49 -- .../utils/PluginMessageTask.java | 36 - .../src/main/resources/config.yml | 16 - .../src/main/resources/plugin.yml | 4 - authmebridge-xauth/LICENSE | 674 ------------------ authmebridge-xauth/pom.xml | 125 ---- .../xauthbridge/PluginMessageTask.java | 23 - .../crylegend/xauthbridge/xAuthBridge.java | 67 -- .../xauthbridge/xAuthBridgeListener.java | 59 -- .../src/main/resources/plugin.yml | 7 - .../LICENSE | 0 .../pom.xml | 10 +- .../authmebungee/bukkit/AuthMeBungee.java | 99 +++ .../src/main/resources/config.yml | 0 .../src/main/resources/plugin.yml | 6 +- .../LICENSE | 0 .../pom.xml | 32 +- .../authmebungee/bungeecord/AuthMeBungee.java | 66 ++ .../bungeecord/annotations/DataFolder.java | 14 + .../annotations/IncomingChannel.java | 14 + .../annotations/OutgoingChannel.java | 14 + .../bungeecord/config/ConfigProperties.java | 42 ++ .../bungeecord/config/Settings.java | 23 + .../bungeecord/config/SettingsDependent.java | 14 + .../bungeecord/config/SettingsProvider.java | 39 + .../bungeecord/data/AuthPlayer.java | 39 + .../bungeecord/listeners/PlayerListener.java | 140 ++++ .../bungeecord/listeners/ServerListener.java | 65 ++ .../services/AuthPlayerManager.java | 42 ++ .../services/PluginMessageSender.java | 53 ++ .../bungeecord/utils/FileUtils.java | 30 + .../src/main/resources/plugin.yml | 4 + circle.yml | 14 - pom.xml | 55 +- 46 files changed, 765 insertions(+), 1770 deletions(-) delete mode 100644 .travis.yml delete mode 100644 authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java delete mode 100644 authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java delete mode 100644 authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/YamlConfig.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java delete mode 100644 authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java delete mode 100644 authmebridge-bungee/src/main/resources/config.yml delete mode 100644 authmebridge-bungee/src/main/resources/plugin.yml delete mode 100644 authmebridge-xauth/LICENSE delete mode 100644 authmebridge-xauth/pom.xml delete mode 100644 authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/PluginMessageTask.java delete mode 100644 authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java delete mode 100644 authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridgeListener.java delete mode 100644 authmebridge-xauth/src/main/resources/plugin.yml rename {authmebridge-authme => authmebungee-bukkit}/LICENSE (100%) rename {authmebridge-authme => authmebungee-bukkit}/pom.xml (92%) create mode 100644 authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java rename {authmebridge-authme => authmebungee-bukkit}/src/main/resources/config.yml (100%) rename {authmebridge-authme => authmebungee-bukkit}/src/main/resources/plugin.yml (58%) rename {authmebridge-bungee => authmebungee-bungeecord}/LICENSE (100%) rename {authmebridge-bungee => authmebungee-bungeecord}/pom.xml (61%) create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java create mode 100644 authmebungee-bungeecord/src/main/resources/plugin.yml delete mode 100644 circle.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1645036..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: false - -language: java -jdk: oraclejdk7 - -cache: - directories: - - '$HOME/.m2/repository' - -script: - - mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false - - mvn clean install -B -U - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/952357dbd9d3cea70fd5 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java deleted file mode 100644 index e39f473..0000000 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridge.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.crylegend.authmebridge; - -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.messaging.Messenger; -import org.bukkit.plugin.messaging.PluginMessageListener; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; - -import fr.xephi.authme.api.NewAPI; - -public class AuthMeBridge extends JavaPlugin implements PluginMessageListener { - private final static String incomingChannel = "BAuthMeBridge"; - private final static String outgoingChannel = "AuthMeBridge"; - - private Logger log; - private String autoLoginMessage; - private NewAPI authme; - - protected String getOutgoingChannel() { - return outgoingChannel; - } - - @Override - public void onEnable() { - // Setup logger - log = getLogger(); - - // Get server instances - Server server = getServer(); - PluginManager pm = server.getPluginManager(); - Messenger messenger = server.getMessenger(); - - // Check authme - if (!pm.isPluginEnabled("AuthMe")) { - log.warning("AuthMe not found, disabling"); - setEnabled(false); - return; - } - authme = NewAPI.getInstance(); - - // Config - saveDefaultConfig(); - autoLoginMessage = getConfig().getString("autoLoginMessage", "&2Your session has been resumed by the bridge."); - - pm.registerEvents(new AuthMeBridgeListener(this), this); - messenger.registerIncomingPluginChannel(this, incomingChannel, this); - messenger.registerOutgoingPluginChannel(this, outgoingChannel); - } - - @Override - public void onPluginMessageReceived(String channel, Player p, byte[] message) { - if(!channel.equals(incomingChannel)) { - return; - } - ByteArrayDataInput in = ByteStreams.newDataInput(message); - - String subchannel = in.readUTF(); - if (!subchannel.equals("AutoLogin")) { - return; - } - - String name = in.readUTF(); - Player player = Bukkit.getPlayerExact(name); - if(player == null) { - return; - } - - if (authme.isAuthenticated(player)) { - return; - } - authme.forceLogin(player); - if (!autoLoginMessage.isEmpty()) { - player.sendMessage(autoLoginMessage); - } - } -} diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java deleted file mode 100644 index 99bd8ca..0000000 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/AuthMeBridgeListener.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.crylegend.authmebridge; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import fr.xephi.authme.events.LoginEvent; - -public class AuthMeBridgeListener implements Listener { - AuthMeBridge plugin; - - public AuthMeBridgeListener(AuthMeBridge plugin) { - this.plugin = plugin; - } - - @EventHandler - public void onAuthMeLogin(LoginEvent event) { - if (event.getPlayer() == null) { - return; - } - handlePlayerLogin(event.getPlayer()); - } - - /* should be already handled by the event! -sgdc3 - @EventHandler - public void onAuthMeSession(PlayerJoinEvent event) { - final Player player = event.getPlayer(); - plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { - public void run() { - if (fr.xephi.authme.api.NewAPI.getInstance().isAuthenticated(player)) - handlePlayerLogin(player); - } - }, 10L); - } - */ - - public void handlePlayerLogin(Player player) { - ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - try { - out.writeUTF("PlayerLogin"); - out.writeUTF(player.getName()); - new PluginMessageTask(plugin, player, b).runTaskAsynchronously(plugin); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java b/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java deleted file mode 100644 index 972b819..0000000 --- a/authmebridge-authme/src/main/java/com/crylegend/authmebridge/PluginMessageTask.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.crylegend.authmebridge; - -import java.io.ByteArrayOutputStream; - -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -public class PluginMessageTask extends BukkitRunnable { - private final AuthMeBridge plugin; - private final Player player; - private final ByteArrayOutputStream bytes; - - public PluginMessageTask(AuthMeBridge plugin, Player player, ByteArrayOutputStream bytes) { - this.plugin = plugin; - this.player = player; - this.bytes = bytes; - } - - public void run() { - player.sendPluginMessage(plugin, plugin.getOutgoingChannel(), bytes.toByteArray()); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java deleted file mode 100644 index 0c193bb..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BridgeAPI.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* BridgeAPI.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:30:37 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:30:40 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge; - -/* - * API class - acts like shortcuts - */ -public class BridgeAPI { - - private BridgeAPI() { - } - - public static BungeeAuthMeBridge getPlugin() { - return BungeeAuthMeBridge.getInstance(); - } - - public static PlayersManager getPlayersManager() { - return BungeeAuthMeBridge.getInstance().getPlayersManager(); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java deleted file mode 100644 index 6bf70a5..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/BungeeAuthMeBridge.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* BungeeAuthMeBridge.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:30:49 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:30:50 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge; - -import com.crylegend.bungeeauthmebridge.config.Settings; -import com.crylegend.bungeeauthmebridge.listeners.*; - -import net.md_5.bungee.api.plugin.Plugin; - -/* - * Main class - */ -public class BungeeAuthMeBridge extends Plugin { - private static BungeeAuthMeBridge instance; - private PlayersManager playersManager; - - public static BungeeAuthMeBridge getInstance() { - return instance; - } - - public PlayersManager getPlayersManager() { - return playersManager; - } - - public void log(String message) { - getLogger().info(message); - } - - public void onLoad() { - instance = this; - } - - public void onEnable() { - // Registering channels to be able to communicate with bukkit-side - getProxy().registerChannel(Constants.incomingChannel); - getProxy().registerChannel(Constants.outgoingChannel); - - // Registering listeners - getProxy().getPluginManager().registerListener(this, new PlayerListener()); - getProxy().getPluginManager().registerListener(this, new ServerListener()); - - playersManager = new PlayersManager(); - new Settings(); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java deleted file mode 100644 index 8a4896d..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/Constants.java +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* Constants.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:30:53 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:30:54 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge; - -import java.util.Arrays; -import java.util.List; - -/* - * Plugin constants - */ -public class Constants { - public static String incomingChannel = "AuthMeBridge"; - public static String outgoingChannel = "BAuthMeBridge"; - public static List authMeCommands = Arrays.asList("/login", "/register", "/passpartu", "/l", "/reg", - "/email", "/captcha"); -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java deleted file mode 100644 index fc9092d..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/PlayersManager.java +++ /dev/null @@ -1,46 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* PlayersManager.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:30:58 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:30:59 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge; - -import java.util.HashMap; - -import net.md_5.bungee.api.connection.ProxiedPlayer; - -import com.crylegend.bungeeauthmebridge.types.AuthPlayer; - -/* - * Players manager - store all references to AuthPlayer objects through an HashMap - */ -public class PlayersManager { - private HashMap players; - - public PlayersManager() { - players = new HashMap(); - } - - public void addPlayer(AuthPlayer player) { - players.put(player.getName(), player); - } - - public void removePlayer(String name) { - players.remove(name); - } - - public AuthPlayer getPlayer(ProxiedPlayer player) { - return getPlayer(player.getName()); - } - - public AuthPlayer getPlayer(String name) { - return players.get(name); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java deleted file mode 100644 index ab8a346..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/Settings.java +++ /dev/null @@ -1,62 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* Settings.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:11 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:31:13 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.config; - -import net.md_5.bungee.config.Configuration; - -import java.util.ArrayList; -import java.util.List; - -import com.crylegend.bungeeauthmebridge.BridgeAPI; - -/* - * Settings class - from AuthMeBungee - * @authors Xephi, CryLegend - */ -public final class Settings { - protected YamlConfig configFile = null; - public static List commandsWhitelist = new ArrayList<>(); - public static List serversList = new ArrayList<>(); - public static boolean commandsRequiresAuth = true; - public static boolean chatRequiresAuth = true; - public static boolean serverSwitchRequiresAuth = false; - public static String requiresAuthKickMessage = "Authentication required."; - public static boolean autoLogin = true; - private Configuration config; - - public Settings() { - try { - this.configFile = new YamlConfig("config.yml", BridgeAPI.getPlugin()); - this.configFile.saveDefaultConfig(); - this.configFile.loadConfig(); - this.config = configFile.getConfig(); - loadConfigOptions(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - public void loadConfigOptions() { - if (configFile == null) { - return; - } - - commandsWhitelist = config.getStringList("commandsWhitelist"); - serversList = config.getStringList("serversList"); - commandsRequiresAuth = config.getBoolean("commandsRequiresAuth", true); - chatRequiresAuth = config.getBoolean("chatRequiresAuth", true); - serverSwitchRequiresAuth = config.getBoolean("serverSwitchRequiresAuth", false); - requiresAuthKickMessage = config.getString("serverSwitchKickMessage", "Authentication required."); - autoLogin = config.getBoolean("autoLogin", true); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/YamlConfig.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/YamlConfig.java deleted file mode 100644 index cd82cf4..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/config/YamlConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* YamlConfig.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:17 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:31:18 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.config; - -import java.io.File; -import java.io.IOException; -import java.nio.file.CopyOption; -import java.nio.file.Files; -import net.md_5.bungee.api.plugin.Plugin; -import net.md_5.bungee.config.Configuration; -import net.md_5.bungee.config.ConfigurationProvider; -import net.md_5.bungee.config.YamlConfiguration; - -/* - * YamlConfig class - from AuthMeBungee - * @author Xephi - */ -public class YamlConfig { - - private final File configFile; - private final String fileName; - private final Plugin plugin; - private final File folder; - private static Configuration config; - - public YamlConfig(String fileName, Plugin plugin) { - this.plugin = plugin; - this.fileName = fileName; - this.folder = plugin.getDataFolder(); - this.configFile = new File(this.folder, fileName); - } - - public void saveDefaultConfig() { - if (!this.folder.exists()) { - this.folder.mkdirs(); - } - try { - if (!this.configFile.exists()) { - Files.copy(this.plugin.getResourceAsStream(this.fileName), this.configFile.toPath(), new CopyOption[0]); - } - loadConfig(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - public void loadConfig() throws IOException { - config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(this.configFile); - } - - public void saveConfig() throws IOException { - ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, this.configFile); - } - - public Configuration getConfig() { - return config; - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java deleted file mode 100644 index f4e7698..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/PlayerListener.java +++ /dev/null @@ -1,126 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* PlayerListener.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:32 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:31:34 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.listeners; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -import com.crylegend.bungeeauthmebridge.BridgeAPI; -import com.crylegend.bungeeauthmebridge.Constants; -import com.crylegend.bungeeauthmebridge.config.Settings; -import com.crylegend.bungeeauthmebridge.types.AuthPlayer; -import com.crylegend.bungeeauthmebridge.utils.PluginMessageTask; - -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.*; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.event.EventHandler; -import net.md_5.bungee.event.EventPriority; - -/* - * Player listener - listen to all actions that are related to players - */ -public class PlayerListener implements Listener { - - @EventHandler - public void onPlayerJoin(PostLoginEvent event) { - // Register player in our list - AuthPlayer player = new AuthPlayer(event.getPlayer().getName()); - BridgeAPI.getPlayersManager().addPlayer(player); - } - - @EventHandler - public void onPlayerLeave(PlayerDisconnectEvent event) { - // Remove player from out list - BridgeAPI.getPlayersManager().removePlayer(event.getPlayer().getName()); - } - - // Priority is set to lowest to keep compatibility with some chat plugins - @EventHandler(priority = EventPriority.LOWEST) - public void onChat(ChatEvent event) { - if (event.isCancelled()) - return; - - // Check if it's a player - if (!(event.getSender() instanceof ProxiedPlayer)) - return; - - if (event.isCommand()) { - String command = event.getMessage().split(" ")[0]; - - // Check if command is an AuthMe command - if (Constants.authMeCommands.contains(command)) - return; - - // Check if command is a whitelisted command - if (Settings.commandsWhitelist.contains(command)) - return; - } - - ProxiedPlayer proxiedPlayer = (ProxiedPlayer) event.getSender(); - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(proxiedPlayer); - - // If player is not logged in, cancel the event - if (!player.isLoggedIn()) { - event.setCancelled(true); - } - } - - @EventHandler - public void onServerSwitch(ServerSwitchEvent event) { - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(event.getPlayer()); - - // Check if player exists (causing NPE, maybe the event is fired on - // player disconnect?) - if (player == null) - return; - - // Player is trying to switch server (also called on first server player - // connection) - if (player.isLoggedIn()) { - // If player is logged in and autoLogin is enabled, send login - // signal to the bukkit side - if (Settings.autoLogin) { - try { - ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - - out.writeUTF("AutoLogin"); - - out.writeUTF(player.getName()); - - ProxyServer.getInstance().getScheduler().runAsync(BridgeAPI.getPlugin(), - new PluginMessageTask(event.getPlayer().getServer().getInfo(), b)); - } catch (IOException e) { - e.printStackTrace(); - } - } - } else { - // If player is not logged in and serverSwitchRequiresAuth is - // enabled, kick player - if (Settings.serverSwitchRequiresAuth) { - String server = event.getPlayer().getServer().getInfo().getName(); - - if (!Settings.serversList.contains(server)) { - TextComponent kickReason = new TextComponent(Settings.requiresAuthKickMessage); - kickReason.setColor(ChatColor.RED); - event.getPlayer().disconnect(kickReason); - } - } - } - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java deleted file mode 100644 index e571c56..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/listeners/ServerListener.java +++ /dev/null @@ -1,70 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ServerListener.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:36 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:31:37 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.listeners; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; - -import com.crylegend.bungeeauthmebridge.BridgeAPI; -import com.crylegend.bungeeauthmebridge.Constants; -import com.crylegend.bungeeauthmebridge.types.AuthPlayer; - -import net.md_5.bungee.api.connection.Server; -import net.md_5.bungee.api.event.PluginMessageEvent; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.event.EventHandler; - -/* - * Server listener - listen to all actions that are related to server, especially plugin messages - */ -public class ServerListener implements Listener { - - @EventHandler - public void onPluginMessage(PluginMessageEvent event) { - if (event.isCancelled()) - return; - - // Check if the message is for us - if (!event.getTag().equalsIgnoreCase(Constants.incomingChannel)) - return; - - // Check if a player is not trying to rip us off sending a fake message - if (!(event.getSender() instanceof Server)) - return; - - // Now that's sure, it's for us, so let's go - event.setCancelled(true); - - try { - // Read the plugin message - DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); - - // For now that's the only type of message the server is able to - // receive - String task = in.readUTF(); - if (!task.equals("PlayerLogin")) - return; - - // Gather informations from the plugin message - String name = in.readUTF(); - AuthPlayer player = BridgeAPI.getPlayersManager().getPlayer(name); - - // Set the player status to logged in - player.setLoggedIn(); - } catch (IOException ex) { - // Something nasty happened - ex.printStackTrace(); - } - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java deleted file mode 100644 index f4d25e9..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/types/AuthPlayer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* AuthPlayer.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:50 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:31:52 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.types; - -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; - -/* - * Auth player - contains name and login status of a player - */ -public class AuthPlayer { - private String name; - private boolean isLoggedIn; - - public AuthPlayer(String name) { - this.name = name; - isLoggedIn = false; - } - - public String getName() { - return name; - } - - public boolean isLoggedIn() { - return isLoggedIn; - } - - public void setLoggedIn() { - isLoggedIn = true; - } - - public boolean isOnline() { - return getProxiedPlayer() != null; - } - - public ProxiedPlayer getProxiedPlayer() { - return ProxyServer.getInstance().getPlayer(name); - } -} diff --git a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java b/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java deleted file mode 100644 index 23d3402..0000000 --- a/authmebridge-bungee/src/main/java/com/crylegend/bungeeauthmebridge/utils/PluginMessageTask.java +++ /dev/null @@ -1,36 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* PluginMessageTask.java :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: CryLegend +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2016/03/25 18:31:59 by CryLegend #+# #+# */ -/* Updated: 2016/03/25 18:32:00 by CryLegend ### ########.fr */ -/* */ -/* ************************************************************************** */ - -package com.crylegend.bungeeauthmebridge.utils; - -import java.io.ByteArrayOutputStream; - -import com.crylegend.bungeeauthmebridge.Constants; - -import net.md_5.bungee.api.config.ServerInfo; - -/* - * Plugin message task - used to send plugin messages to bukkit-side - */ -public class PluginMessageTask implements Runnable { - private final ByteArrayOutputStream bytes; - private final ServerInfo server; - - public PluginMessageTask(ServerInfo server, ByteArrayOutputStream bytes) { - this.bytes = bytes; - this.server = server; - } - - public void run() { - server.sendData(Constants.outgoingChannel, bytes.toByteArray()); - } -} diff --git a/authmebridge-bungee/src/main/resources/config.yml b/authmebridge-bungee/src/main/resources/config.yml deleted file mode 100644 index da0b701..0000000 --- a/authmebridge-bungee/src/main/resources/config.yml +++ /dev/null @@ -1,16 +0,0 @@ -# List of servers which required to be authenticated -serversList: - - lobby -# Allows or not commands to be performed if user is not logged in -commandsRequiresAuth: true -# List of commands allowed to be perform without being authenticated -commandsWhitelist: - - /glist -# Allows or not user to talk in chat if he is not logged in -chatRequiresAuth: true -# Kick all players who switch servers without being authenticated (eg. plugin teleport) -# Do not set this option to true unless you know what you're doing! -serverSwitchRequiresAuth: false -serverSwitchKickMessage: 'Authentication required.' -# Enable session resume between servers (eg. autologin if you change server) -autoLogin: true diff --git a/authmebridge-bungee/src/main/resources/plugin.yml b/authmebridge-bungee/src/main/resources/plugin.yml deleted file mode 100644 index 29397e3..0000000 --- a/authmebridge-bungee/src/main/resources/plugin.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: ${project.name} -main: com.crylegend.bungeeauthmebridge.BungeeAuthMeBridge -version: ${project.version} -author: CryLegend diff --git a/authmebridge-xauth/LICENSE b/authmebridge-xauth/LICENSE deleted file mode 100644 index 9cecc1d..0000000 --- a/authmebridge-xauth/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - 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. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - 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: - - {project} Copyright (C) {year} {fullname} - 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/authmebridge-xauth/pom.xml b/authmebridge-xauth/pom.xml deleted file mode 100644 index 82356b1..0000000 --- a/authmebridge-xauth/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - 4.0.0 - - - com.crylegend - authmebridge-parent - 1.6.2-SNAPSHOT - - - authmebridge-xauth - xAuthBridge - - - ${project.name}-${project.version} - - - - false - . - - LICENSE - - - - true - src/main/resources/ - - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots - - - - - luricos-releases - http://repo.luricos.de/content/repositories/releases - - - - - - - org.bukkit - bukkit - ${bukkitVersion} - provided - - - junit - junit - - - json-simple - com.googlecode.json-simple - - - gson - com.google.code.gson - - - persistence-api - javax.persistence - - - commons-lang - commons-lang - - - snakeyaml - org.yaml - - - - - - - de.luricos.bukkit - xAuth - 2.6 - provided - - - org.bukkit - bukkit - - - org.bukkit - craftbukkit - - - updater - net.gravitydevelopment.updater - - - lombok - org.projectlombok - - - EssentialsGroupManager - net.ess3 - - - PermissionsEx - ru.tehkode - - - AccountsClient - com.mojang - - - log4j-core - org.apache.logging.log4j - - - - - diff --git a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/PluginMessageTask.java b/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/PluginMessageTask.java deleted file mode 100644 index 55347f4..0000000 --- a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/PluginMessageTask.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.crylegend.xauthbridge; - -import java.io.ByteArrayOutputStream; - -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -public class PluginMessageTask extends BukkitRunnable { - private final xAuthBridge plugin; - private final Player player; - private final ByteArrayOutputStream bytes; - - public PluginMessageTask(xAuthBridge plugin, Player player, ByteArrayOutputStream bytes) - { - this.plugin = plugin; - this.player = player; - this.bytes = bytes; - } - - public void run() { - player.sendPluginMessage(plugin, plugin.outgoingChannel, bytes.toByteArray()); - } -} diff --git a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java b/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java deleted file mode 100644 index c36934a..0000000 --- a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridge.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.crylegend.xauthbridge; - -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.messaging.PluginMessageListener; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; - -import de.luricos.bukkit.xAuth.xAuth; - -public class xAuthBridge extends JavaPlugin implements PluginMessageListener { - Logger log = Logger.getLogger("Minecraft"); - String prefix = "[xAuthBridge] "; - String incomingChannel = "BAuthMeBridge"; - String outgoingChannel = "AuthMeBridge"; - String autoLoginMessage = ChatColor.GREEN + "Your session has been resumed by the bridge."; - xAuth xauth; - - public void onEnable() { - log.info(prefix + "Hello world"); - - if (!getServer().getPluginManager().isPluginEnabled("xAuth")) { - log.info(prefix + "xAuth not found, disabling"); - getServer().getPluginManager().disablePlugin(this); - } - - xauth = (xAuth) getServer().getPluginManager().getPlugin("xAuth"); - - getServer().getPluginManager().registerEvents(new xAuthBridgeListener(this), this); - getServer().getMessenger().registerIncomingPluginChannel(this, incomingChannel, this); - getServer().getMessenger().registerOutgoingPluginChannel(this, outgoingChannel); - - autoLoginMessage = getConfig().getString("autoLoginMessage", autoLoginMessage); - getConfig().set("autoLoginMessage", autoLoginMessage); - - saveConfig(); - } - - public void onDisable() { - log.info(prefix + "Goodbye world"); - } - - @Override - public void onPluginMessageReceived(String channel, Player p, byte[] message) { - if (channel.equals(incomingChannel)) { - ByteArrayDataInput in = ByteStreams.newDataInput(message); - String subchannel = in.readUTF(); - - if (subchannel.equals("AutoLogin")) { - Player player = Bukkit.getPlayerExact(in.readUTF()); - - if (player != null) { - if (!xauth.getPlayerManager().getPlayer(player.getName()).isAuthenticated()) { - xauth.getPlayerManager().doLogin(xauth.getPlayerManager().getPlayer(player)); - if (!autoLoginMessage.isEmpty()) - player.sendMessage(autoLoginMessage); - } - } - } - } - } -} diff --git a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridgeListener.java b/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridgeListener.java deleted file mode 100644 index 4afaaad..0000000 --- a/authmebridge-xauth/src/main/java/com/crylegend/xauthbridge/xAuthBridgeListener.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.crylegend.xauthbridge; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; - -public class xAuthBridgeListener implements Listener{ - xAuthBridge plugin; - - public xAuthBridgeListener(xAuthBridge plugin) { - this.plugin = plugin; - } - - @EventHandler - public void onxAuthSession(PlayerJoinEvent event) { - final Player player = event.getPlayer(); - plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { - public void run() { - playerLogin(player); - } - }, 10L); - } - - @EventHandler - public void onxAuthLogin(PlayerCommandPreprocessEvent event) { - if (event.isCancelled()) - return; - String cmd = event.getMessage().split(" ")[0]; - if (!cmd.equalsIgnoreCase("/register") && !cmd.equalsIgnoreCase("/login")) - return; - final Player player = event.getPlayer(); - plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() { - public void run() { - playerLogin(player); - } - }, 10L); - } - - public void playerLogin(Player player) { - if (!plugin.xauth.getPlayerManager().getPlayer(player.getName()).isAuthenticated()) - return; - ByteArrayOutputStream b = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(b); - try { - out.writeUTF("PlayerLogin"); - out.writeUTF(player.getName()); - new PluginMessageTask(plugin, player, b).runTaskAsynchronously(plugin); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/authmebridge-xauth/src/main/resources/plugin.yml b/authmebridge-xauth/src/main/resources/plugin.yml deleted file mode 100644 index 3348e22..0000000 --- a/authmebridge-xauth/src/main/resources/plugin.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: ${project.name} -main: com.crylegend.xauthbridge.xAuthBridge -version: ${project.version} -website: http://www.craftfriends.fr -author: CryLegend -description: The first xAuth bungeecord addon -depend: [xAuth] \ No newline at end of file diff --git a/authmebridge-authme/LICENSE b/authmebungee-bukkit/LICENSE similarity index 100% rename from authmebridge-authme/LICENSE rename to authmebungee-bukkit/LICENSE diff --git a/authmebridge-authme/pom.xml b/authmebungee-bukkit/pom.xml similarity index 92% rename from authmebridge-authme/pom.xml rename to authmebungee-bukkit/pom.xml index 41e54a1..ce23ac2 100644 --- a/authmebridge-authme/pom.xml +++ b/authmebungee-bukkit/pom.xml @@ -5,17 +5,15 @@ 4.0.0 - com.crylegend - authmebridge-parent + fr.xephi + authmebungee-parent 1.6.2-SNAPSHOT - authmebridge-authme - AuthMeBridge + authmebungee-bukkit + AuthMeBungee-Bukkit - ${project.name}-${project.version} - false diff --git a/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java b/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java new file mode 100644 index 0000000..a484c2a --- /dev/null +++ b/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java @@ -0,0 +1,99 @@ +package fr.xephi.authmebungee.bukkit; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import fr.xephi.authme.api.NewAPI; +import fr.xephi.authme.events.LoginEvent; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.messaging.Messenger; +import org.bukkit.plugin.messaging.PluginMessageListener; +import org.bukkit.scheduler.BukkitRunnable; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class AuthMeBungee extends JavaPlugin implements Listener, PluginMessageListener { + private final static String INCOMING_CHANNEL = "AuthMeBungeeProxy"; + private final static String OUTGOING_CHANNEL = "AuthMeBungee"; + + private static AuthMeBungee instance; + private NewAPI authme; + + // Settings + private String autoLoginMessage; + + @Override + public void onEnable() { + instance = this; + authme = NewAPI.getInstance(); + + // Config + saveDefaultConfig(); + autoLoginMessage = getConfig().getString("autoLoginMessage", "&2Your session has been resumed by the bridge."); + + // Register event listener + getServer().getPluginManager().registerEvents(instance, instance); + + // Register message listener + Messenger messenger = getServer().getMessenger(); + messenger.registerIncomingPluginChannel(instance, INCOMING_CHANNEL, instance); + messenger.registerOutgoingPluginChannel(instance, OUTGOING_CHANNEL); + } + + @EventHandler + public void onAuthMeLogin(LoginEvent event) { + final Player player = event.getPlayer(); + if (event.getPlayer() == null) { + return; + } + + final ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(bout); + + try { + out.writeUTF("LOGIN:"); + out.writeUTF(player.getName()); + new BukkitRunnable() { + @Override + public void run() { + player.sendPluginMessage(instance, OUTGOING_CHANNEL, bout.toByteArray()); + } + }.runTaskAsynchronously(instance); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void onPluginMessageReceived(String channel, Player ignored, byte[] message) { + if (!channel.equals(INCOMING_CHANNEL)) { + return; + } + ByteArrayDataInput in = ByteStreams.newDataInput(message); + + String type = in.readUTF(); + if (!type.equals("AUTOLOGIN:")) { + return; + } + + String name = in.readUTF(); + Player player = Bukkit.getPlayerExact(name); + if (player == null) { + return; + } + + if (authme.isAuthenticated(player)) { + return; + } + + authme.forceLogin(player); + if (!autoLoginMessage.isEmpty()) { + player.sendMessage(autoLoginMessage); + } + } +} diff --git a/authmebridge-authme/src/main/resources/config.yml b/authmebungee-bukkit/src/main/resources/config.yml similarity index 100% rename from authmebridge-authme/src/main/resources/config.yml rename to authmebungee-bukkit/src/main/resources/config.yml diff --git a/authmebridge-authme/src/main/resources/plugin.yml b/authmebungee-bukkit/src/main/resources/plugin.yml similarity index 58% rename from authmebridge-authme/src/main/resources/plugin.yml rename to authmebungee-bukkit/src/main/resources/plugin.yml index 32c6db0..deae148 100644 --- a/authmebridge-authme/src/main/resources/plugin.yml +++ b/authmebungee-bukkit/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: ${project.name} -main: com.crylegend.authmebridge.AuthMeBridge -version: ${project.version} -author: CryLegend description: The first AuthMe bungeecord addon +version: ${project.version} +main: fr.xephi.authmebungee.bukkit.AuthMeBungee +authors: [CryLegend, AuthMeTeam] depend: [AuthMe] diff --git a/authmebridge-bungee/LICENSE b/authmebungee-bungeecord/LICENSE similarity index 100% rename from authmebridge-bungee/LICENSE rename to authmebungee-bungeecord/LICENSE diff --git a/authmebridge-bungee/pom.xml b/authmebungee-bungeecord/pom.xml similarity index 61% rename from authmebridge-bungee/pom.xml rename to authmebungee-bungeecord/pom.xml index efe9eb2..70ce120 100644 --- a/authmebridge-bungee/pom.xml +++ b/authmebungee-bungeecord/pom.xml @@ -5,17 +5,15 @@ 4.0.0 - com.crylegend - authmebridge-parent + fr.xephi + authmebungee-parent 1.6.2-SNAPSHOT - authmebridge-bungeecord - BungeeAuthMeBridge + authmebungee-bungeecord + AuthMeBungee-Bungeecord - ${project.name}-${project.version} - false @@ -37,9 +35,31 @@ oss-repo http://oss.sonatype.org/content/groups/public + + + + xephi-repo + http://ci.xephi.fr/plugin/repository/everything/ + + + + ch.jalu + injector + 0.3 + compile + + + + + com.github.authme + configme + 0.2.1 + compile + + net.md-5 diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java new file mode 100644 index 0000000..9365e78 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -0,0 +1,66 @@ +package fr.xephi.authmebungee.bungeecord; + +import ch.jalu.injector.Injector; +import ch.jalu.injector.InjectorBuilder; +import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; +import fr.xephi.authmebungee.bungeecord.annotations.IncomingChannel; +import fr.xephi.authmebungee.bungeecord.annotations.OutgoingChannel; +import fr.xephi.authmebungee.bungeecord.config.Settings; +import fr.xephi.authmebungee.bungeecord.config.SettingsProvider; +import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; +import fr.xephi.authmebungee.bungeecord.listeners.PlayerListener; +import fr.xephi.authmebungee.bungeecord.listeners.ServerListener; +import fr.xephi.authmebungee.bungeecord.services.PluginMessageSender; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.api.plugin.PluginManager; +import net.md_5.bungee.api.scheduler.TaskScheduler; + +public class AuthMeBungee extends Plugin { + + // Constants + private final static String INCOMING_CHANNEL = "AuthMeBungee"; + private final static String OUTGOING_CHANNEL = "AuthMeBungeeProxy"; + + // Instances + private Injector injector; + private Settings settings; + private AuthPlayerManager authPlayerManager; + private PluginMessageSender pluginMessageSender; + + public AuthMeBungee() { + } + + @Override + public void onEnable() { + + // Prepare the injector and register stuff + setupInjector(); + + // Get singletons from the injector + settings = injector.getSingleton(Settings.class); + authPlayerManager = injector.getSingleton(AuthPlayerManager.class); + pluginMessageSender = injector.getSingleton(PluginMessageSender.class); + + // Register plugin channels + getProxy().registerChannel(INCOMING_CHANNEL); + getProxy().registerChannel(OUTGOING_CHANNEL); + + // Registering event listeners + getProxy().getPluginManager().registerListener(this, injector.getSingleton(ServerListener.class)); + getProxy().getPluginManager().registerListener(this, injector.getSingleton(PlayerListener.class)); + } + + private void setupInjector() { + // Setup injector + injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee").create(); + injector.register(AuthMeBungee.class, this); + injector.register(ProxyServer.class, getProxy()); + injector.register(PluginManager.class, getProxy().getPluginManager()); + injector.register(TaskScheduler.class, getProxy().getScheduler()); + injector.provide(IncomingChannel.class, INCOMING_CHANNEL); + injector.provide(OutgoingChannel.class, OUTGOING_CHANNEL); + injector.provide(DataFolder.class, getDataFolder()); + injector.registerProvider(Settings.class, SettingsProvider.class); + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java new file mode 100644 index 0000000..dcc0174 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java @@ -0,0 +1,14 @@ +package fr.xephi.authmebungee.bungeecord.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for specifying the plugin's data folder. + */ +@Target({ElementType.PARAMETER, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface DataFolder { +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java new file mode 100644 index 0000000..8ce9fe8 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java @@ -0,0 +1,14 @@ +package fr.xephi.authmebungee.bungeecord.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for specifying the plugin's incoming plugin channel name. + */ +@Target({ElementType.PARAMETER, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface IncomingChannel { +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java new file mode 100644 index 0000000..3f2f403 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java @@ -0,0 +1,14 @@ +package fr.xephi.authmebungee.bungeecord.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for specifying the plugin's outgoing plugin channel name. + */ +@Target({ElementType.PARAMETER, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface OutgoingChannel { +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java new file mode 100644 index 0000000..5596ac7 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java @@ -0,0 +1,42 @@ +package fr.xephi.authmebungee.bungeecord.config; + +import com.github.authme.configme.Comment; +import com.github.authme.configme.SettingsHolder; +import com.github.authme.configme.properties.Property; + +import java.util.List; + +import static com.github.authme.configme.properties.PropertyInitializer.newListProperty; +import static com.github.authme.configme.properties.PropertyInitializer.newProperty; + +public class ConfigProperties implements SettingsHolder { + + @Comment("List of servers which required to be authenticated") + public static final Property> AUTH_SERVERS = + newListProperty("authServers", "lobby"); + + @Comment("Allows or not commands to be performed if user is not logged in") + public static final Property COMMANDS_REQUIRE_AUTH = + newProperty("commands.requireAuth", true); + + @Comment("List of commands allowed to be perform without being authenticated") + public static final Property> COMMANDS_WHITELIST = + newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha"); + + @Comment("Allows or not user to talk in chat if he is not logged in") + public static final Property CHAT_REQUIRES_AUTH = + newProperty("chatRequiresAuth", true); + + @Comment("Kick all players who switch servers without being authenticated (eg. plugin teleport)") + public static final Property SERVER_SWITCH_REQUIRES_AUTH = + newProperty("serverSwitch.requiresAuth", true); + public static final Property SERVER_SWITCH_KICK_MESSAGE = + newProperty("serverSwitch.kickMessage", "Authentication required."); + + @Comment("Enable auto-login between servers") + public static final Property AUTOLOGIN = + newProperty("autoLogin", false); + + private ConfigProperties() { + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java new file mode 100644 index 0000000..0ded205 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java @@ -0,0 +1,23 @@ +package fr.xephi.authmebungee.bungeecord.config; + +import com.github.authme.configme.SettingsManager; +import com.github.authme.configme.migration.MigrationService; +import com.github.authme.configme.resource.PropertyResource; + +/** + * The AuthMeBungee settings manager. + */ +public class Settings extends SettingsManager { + + /** + * Constructor. + * + * @param resource the property resource to read and write properties to + * @param migrationService migration service to check the settings file with + * @param configurationData configuration data (properties and comments) + */ + public Settings(PropertyResource resource, MigrationService migrationService, + Class configurationData) { + super(resource, migrationService, configurationData); + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java new file mode 100644 index 0000000..4b127ce --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java @@ -0,0 +1,14 @@ +package fr.xephi.authmebungee.bungeecord.config; + +/** + * Interface for classes that keep a local copy of certain settings. + */ +public interface SettingsDependent { + + /** + * Performs a reload with the provided settings instance. + * + * @param settings the settings instance + */ + void reload(Settings settings); +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java new file mode 100644 index 0000000..acfefbd --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java @@ -0,0 +1,39 @@ +package fr.xephi.authmebungee.bungeecord.config; + +import com.github.authme.configme.migration.PlainMigrationService; +import com.github.authme.configme.resource.PropertyResource; +import com.github.authme.configme.resource.YamlFileResource; +import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; +import fr.xephi.authmebungee.bungeecord.utils.FileUtils; + +import javax.inject.Inject; +import javax.inject.Provider; +import java.io.File; + +/** + * Initializes the settings. + */ +public class SettingsProvider implements Provider { + + @Inject + @DataFolder + private File dataFolder; + + SettingsProvider() { + } + + /** + * Loads the plugin's settings. + * + * @return the settings instance, or null if it could not be constructed + */ + @Override + public Settings get() { + File configFile = new File(dataFolder, "config.yml"); + if (!configFile.exists()) { + FileUtils.create(configFile); + } + PropertyResource resource = new YamlFileResource(configFile); + return new Settings(resource, new PlainMigrationService(), ConfigProperties.class); + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java new file mode 100644 index 0000000..cc50a0f --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java @@ -0,0 +1,39 @@ +package fr.xephi.authmebungee.bungeecord.data; + +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; + +public class AuthPlayer { + + private String name; + private boolean isLogged; + + public AuthPlayer(String name, boolean isLogged) { + this.name = name; + this.isLogged = isLogged; + } + + public AuthPlayer(String name) { + this(name, false); + } + + public String getName() { + return name; + } + + public boolean isLogged() { + return isLogged; + } + + public void setLogged(boolean isLogged) { + this.isLogged = isLogged; + } + + public ProxiedPlayer getProxiedPlayer() { + return ProxyServer.getInstance().getPlayer(name); + } + + public boolean isOnline() { + return getProxiedPlayer() != null; + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java new file mode 100644 index 0000000..22f39ba --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java @@ -0,0 +1,140 @@ +package fr.xephi.authmebungee.bungeecord.listeners; + +import fr.xephi.authmebungee.bungeecord.services.PluginMessageSender; +import fr.xephi.authmebungee.bungeecord.config.ConfigProperties; +import fr.xephi.authmebungee.bungeecord.config.Settings; +import fr.xephi.authmebungee.bungeecord.config.SettingsDependent; +import fr.xephi.authmebungee.bungeecord.data.AuthPlayer; +import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.TextComponent; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.ChatEvent; +import net.md_5.bungee.api.event.PlayerDisconnectEvent; +import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; +import net.md_5.bungee.event.EventPriority; + +import javax.inject.Inject; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.List; + +public class PlayerListener implements Listener, SettingsDependent { + + // Services + private AuthPlayerManager authPlayerManager; + private PluginMessageSender pluginMessageSender; + + // Settings + private boolean isAutoLogin; + private boolean isServerSwitchRequiresAuth; + private String requiresAuthKickMessage; + private List authServers; + private boolean isCommandsRequireAuth; + private List commandWhitelist; + private boolean chatRequiresAuth; + + @Inject + PlayerListener(Settings settings, AuthPlayerManager authPlayerManager, PluginMessageSender pluginMessageSender) { + this.authPlayerManager = authPlayerManager; + this.pluginMessageSender = pluginMessageSender; + reload(settings); + } + + @Override + public void reload(Settings settings) { + isAutoLogin = settings.getProperty(ConfigProperties.AUTOLOGIN); + isServerSwitchRequiresAuth = settings.getProperty(ConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); + requiresAuthKickMessage = settings.getProperty(ConfigProperties.SERVER_SWITCH_KICK_MESSAGE); + authServers = settings.getProperty(ConfigProperties.AUTH_SERVERS); + isCommandsRequireAuth = settings.getProperty(ConfigProperties.COMMANDS_REQUIRE_AUTH); + commandWhitelist = settings.getProperty(ConfigProperties.COMMANDS_WHITELIST); + chatRequiresAuth = settings.getProperty(ConfigProperties.CHAT_REQUIRES_AUTH); + } + + @EventHandler + public void onPlayerJoin(PostLoginEvent event) { + // Register player in our list + authPlayerManager.addAuthPlayer(event.getPlayer()); + } + + @EventHandler + public void onPlayerLeave(PlayerDisconnectEvent event) { + // Remove player from out list + authPlayerManager.removeAuthPlayer(event.getPlayer()); + } + + // Priority is set to lowest to keep compatibility with some chat plugins + @EventHandler(priority = EventPriority.LOWEST) + public void onChat(ChatEvent event) { + if (event.isCancelled()) { + return; + } + + // Check if it's a player + if (!(event.getSender() instanceof ProxiedPlayer)) { + return; + } + + if (event.isCommand()) { + if (!isCommandsRequireAuth) { + return; + } + + // Check if command is a whitelisted command + String label = event.getMessage().split(" ")[0]; + if (commandWhitelist.contains(label)) { + return; + } + } else if (!chatRequiresAuth) { + return; + } + + // If player is not logged in, cancel the event + if (authPlayerManager.getAuthPlayer((ProxiedPlayer) event.getSender()).isLogged()) { + return; + } + event.setCancelled(true); + } + + @EventHandler + public void onServerSwitch(ServerSwitchEvent event) { + ProxiedPlayer player = event.getPlayer(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + + // Player is trying to switch server (also called on first server player connection) + if (authPlayer.isLogged()) { + // If player is logged in and autoLogin is enabled, send login signal to the bukkit side + if (isAutoLogin) { + try { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(bout); + + out.writeUTF("AUTOLOGIN:"); + out.writeUTF(authPlayer.getName()); + + // Not using async as bungeecord already use multiple threads for player connections + pluginMessageSender.sendData(event.getPlayer().getServer(), bout.toByteArray(), false); + } catch (IOException e) { + e.printStackTrace(); + } + } + } else { + // If player is not logged in and serverSwitchRequiresAuth is enabled, kick player + if (!isServerSwitchRequiresAuth) { + return; + } + + String server = event.getPlayer().getServer().getInfo().getName(); + if (!authServers.contains(server)) { + TextComponent kickReason = new TextComponent(requiresAuthKickMessage); + kickReason.setColor(ChatColor.RED); + event.getPlayer().disconnect(kickReason); + } + } + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java new file mode 100644 index 0000000..165b658 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java @@ -0,0 +1,65 @@ +package fr.xephi.authmebungee.bungeecord.listeners; + +import fr.xephi.authmebungee.bungeecord.annotations.IncomingChannel; +import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; +import net.md_5.bungee.api.connection.Server; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; + +import javax.inject.Inject; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; + +public class ServerListener implements Listener { + + @Inject + @IncomingChannel + private String incomingChannel; + + @Inject + private AuthPlayerManager authPlayerManager; + + public ServerListener() { + } + + @EventHandler + public void onPluginMessage(PluginMessageEvent event) { + if (event.isCancelled()) { + return; + } + + // Check if the message is for us + if (!event.getTag().equals(incomingChannel)) { + return; + } + + // Check if a player is not trying to rip us off sending a fake message + if (!(event.getSender() instanceof Server)) { + return; + } + + // Now that's sure, it's for us, so let's go + event.setCancelled(true); + + try { + // Read the plugin message + DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); + + // For now that's the only type of message the server is able to receive + String task = in.readUTF(); + if (!task.equals("LOGIN:")) { + return; + } + + // Gather informations from the plugin message + String name = in.readUTF(); + // Set the player status to logged in + authPlayerManager.getAuthPlayer(name).setLogged(true); + } catch (IOException ex) { + // Something nasty happened + ex.printStackTrace(); + } + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java new file mode 100644 index 0000000..752b86b --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java @@ -0,0 +1,42 @@ +package fr.xephi.authmebungee.bungeecord.services; + +import fr.xephi.authmebungee.bungeecord.data.AuthPlayer; +import net.md_5.bungee.api.connection.ProxiedPlayer; + +import java.util.HashMap; + +/* + * Players manager - store all references to AuthPlayer objects through an HashMap + */ +public class AuthPlayerManager { + + private HashMap players; + + public AuthPlayerManager() { + players = new HashMap<>(); + } + + public void addAuthPlayer(AuthPlayer player) { + players.put(player.getName(), player); + } + + public void addAuthPlayer(ProxiedPlayer player) { + addAuthPlayer(new AuthPlayer(player.getName())); + } + + public void removeAuthPlayer(String name) { + players.remove(name); + } + + public void removeAuthPlayer(ProxiedPlayer player) { + removeAuthPlayer(player.getName()); + } + + public AuthPlayer getAuthPlayer(String name) { + return players.get(name); + } + + public AuthPlayer getAuthPlayer(ProxiedPlayer player) { + return getAuthPlayer(player.getName()); + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java new file mode 100644 index 0000000..5c3bedb --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java @@ -0,0 +1,53 @@ +package fr.xephi.authmebungee.bungeecord.services; + +import fr.xephi.authmebungee.bungeecord.AuthMeBungee; +import fr.xephi.authmebungee.bungeecord.annotations.OutgoingChannel; +import net.md_5.bungee.api.config.ServerInfo; +import net.md_5.bungee.api.connection.Server; +import net.md_5.bungee.api.scheduler.TaskScheduler; + +import javax.inject.Inject; + +public class PluginMessageSender { + + @Inject + @OutgoingChannel + private String outgoingChannel; + + @Inject + private TaskScheduler scheduler; + @Inject + private AuthMeBungee plugin; + + public PluginMessageSender() { + } + + public void sendData(ServerInfo server, byte[] bytes, boolean async) { + SendMessage sendMessage = new SendMessage(server, bytes); + if (async) { + scheduler.runAsync(plugin, sendMessage); + } else { + sendMessage.run(); + } + } + + public void sendData(Server server, byte[] bytes, boolean async) { + sendData(server.getInfo(), bytes, async); + } + + private class SendMessage implements Runnable { + + private ServerInfo server; + private byte[] bytes; + + public SendMessage(ServerInfo server, byte[] bytes) { + this.server = server; + this.bytes = bytes; + } + + @Override + public void run() { + server.sendData(outgoingChannel, bytes); + } + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java new file mode 100644 index 0000000..f1023fd --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java @@ -0,0 +1,30 @@ +package fr.xephi.authmebungee.bungeecord.utils; + +import java.io.File; +import java.io.IOException; + +/** + * File utilities. + */ +public final class FileUtils { + + // Utility class + private FileUtils() { + } + + /** + * Creates the given file or throws an exception. + * + * @param file the file to create + */ + public static void create(File file) { + try { + boolean result = file.createNewFile(); + if (!result) { + throw new IllegalStateException("Could not create file '" + file + "'"); + } + } catch (IOException e) { + throw new IllegalStateException("Error while creating file '" + file + "'", e); + } + } +} diff --git a/authmebungee-bungeecord/src/main/resources/plugin.yml b/authmebungee-bungeecord/src/main/resources/plugin.yml new file mode 100644 index 0000000..2b1c507 --- /dev/null +++ b/authmebungee-bungeecord/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: ${project.name} +main: fr.xephi.authmebungee.bungeecord.AuthMeBungee +version: ${project.version} +authors: [CryLegend, AuthMeTeam] diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 021dcae..0000000 --- a/circle.yml +++ /dev/null @@ -1,14 +0,0 @@ -machine: - java: - version: oraclejdk7 -general: - artifacts: - - "target/AuthMeBridge*.jar" -test: - override: - - mvn clean install -B - post: - - cp ./target/AuthMeBridge*.jar $CIRCLE_ARTIFACTS -notify: - webhooks: - - url: https://webhooks.gitter.im/e/7b92ac1a1741748b26bf diff --git a/pom.xml b/pom.xml index b17f861..6a7c750 100644 --- a/pom.xml +++ b/pom.xml @@ -4,15 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.crylegend - authmebridge-parent + fr.xephi + authmebungee-parent 1.6.2-SNAPSHOT pom - AuthMeBridge - Bungeecord addon for AuthMe and xAuth! + AuthMeBungee + Bungeecord addon for AuthMe! 2014 - https://www.spigotmc.org/resources/authmebridge-for-bungeecord.574/ AuthMe-Team @@ -20,19 +19,19 @@ - scm:git:https://github.com/AuthMe-Team/AuthMeBridge.git - scm:git:git@github.com:Xephi/AuthMe-Team/AuthMeBridge.git - https://github.com/AuthMe-Team/AuthMeBridge.git + scm:git:https://github.com/AuthMe-Team/AuthMeBungee.git + scm:git:git@github.com:Xephi/AuthMe-Team/AuthMeBungee.git + https://github.com/AuthMe-Team/AuthMeBungee.git jenkins - http://ci.xephi.fr/job/AuthMeBridge/ + http://ci.xephi.fr/job/AuthMeBungee/ GitHub - https://github.com/CryLegend/AuthMeBridge/issues + https://github.com/CryLegend/AuthMeBungee/issues @@ -45,18 +44,14 @@ UTF-8 - 1.7 - 1.10.2-R0.1-SNAPSHOT - 1.10-SNAPSHOT + 1.11-R0.1-SNAPSHOT + 1.11-SNAPSHOT - authmebridge-bungee - authmebridge-authme - + authmebungee-bungeecord + authmebungee-bukkit @@ -65,12 +60,30 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + 3.6.0 - ${jdkVersion} - ${jdkVersion} + 1.8 + 1.8 + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.3 + + false + + + + shade + package + + shade + + + + From d03360b35f276da41cc264cecc536c01bbcf92bd Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 13 Dec 2016 20:08:06 +0100 Subject: [PATCH 004/114] Bump version number --- authmebungee-bukkit/pom.xml | 2 +- authmebungee-bungeecord/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/authmebungee-bukkit/pom.xml b/authmebungee-bukkit/pom.xml index ce23ac2..cfd886d 100644 --- a/authmebungee-bukkit/pom.xml +++ b/authmebungee-bukkit/pom.xml @@ -7,7 +7,7 @@ fr.xephi authmebungee-parent - 1.6.2-SNAPSHOT + 1.6.3-SNAPSHOT authmebungee-bukkit diff --git a/authmebungee-bungeecord/pom.xml b/authmebungee-bungeecord/pom.xml index 70ce120..f2656b0 100644 --- a/authmebungee-bungeecord/pom.xml +++ b/authmebungee-bungeecord/pom.xml @@ -7,7 +7,7 @@ fr.xephi authmebungee-parent - 1.6.2-SNAPSHOT + 1.6.3-SNAPSHOT authmebungee-bungeecord diff --git a/pom.xml b/pom.xml index 6a7c750..92f695a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee-parent - 1.6.2-SNAPSHOT + 1.6.3-SNAPSHOT pom AuthMeBungee From 5b4485a295583a5df431f303f441e44573d43972 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 13 Dec 2016 20:23:10 +0100 Subject: [PATCH 005/114] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6d04cc2..d8b625e 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -# AuthMeBridge - -![AuthMeBridge](http://www.craftfriends.fr/images/AuthMeBridge.png "AuthMeBridge") +# AuthMeBungee This plugin acts like a bridge between your bukkit servers and your BungeeCord instance. To explain simple how it works, bukkit-side plugins send a message to bungee-side on user authentication. If bungee-side doesn't receive this message, the player won't be able to talk in chat and to perform commands, including BungeeCord commands. -Session resume: If you have AuthMe on multiple servers, you can enable autoLogin option that allow you to switch between your servers without having to perform login command again. +AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin option that allow you to switch between your servers without having to perform login command again. ## Requirements -None +- Java 1.8+ +- BungeeCord/Waterfall 1.7+ +- CraftBukkit/Spigot/Paper/Tacospigot 1.7.10+ ## Installation -1. Download AuthMeBridge package -2. Place BungeeAuthMeBridge.jar into your BungeeCord's plugin folder -3. Place AuthMeBridge.jar (or xAuthBridge.jar if you're using xAuth) into your servers' plugin folders +1. Download AuthMeBungee package +2. Place AuthMeBungee-Bungeecord.jar into your BungeeCord's plugin folder +3. Place AuthMeBungee-Bukkit.jar into your Bukkit servers plugin folders 4. Restart everything -5. Configure the bungee-side plugin (don't forget to config serversList) +5. Configure the bungee-side plugin (don't forget to config authServers) 6. Enjoy! **Please follow these steps and configure the plugin before saying it doesn't work!** From 4794a0fcbf78ad875cf97ae5e7aba9bfffffedfa Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 13 Dec 2016 20:24:52 +0100 Subject: [PATCH 006/114] Fix github links in pom --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 92f695a..f290241 100644 --- a/pom.xml +++ b/pom.xml @@ -15,13 +15,13 @@ AuthMe-Team - https://github.com/AuthMe-Team + https://github.com/AuthMe - scm:git:https://github.com/AuthMe-Team/AuthMeBungee.git - scm:git:git@github.com:Xephi/AuthMe-Team/AuthMeBungee.git - https://github.com/AuthMe-Team/AuthMeBungee.git + scm:git:https://github.com/AuthMe/AuthMeBungee.git + scm:git:git@github.com:AuthMe/AuthMeBungee.git + https://github.com/AuthMe/AuthMeBungee.git @@ -31,7 +31,7 @@ GitHub - https://github.com/CryLegend/AuthMeBungee/issues + https://github.com/AuthMe/AuthMeBungee/issues From 2bb724f6670c07ab42b0a139a9e7560d89c1bc5c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 14 Dec 2016 00:04:58 +0100 Subject: [PATCH 007/114] Add reload command, handle logout event --- .../authmebungee/bukkit/AuthMeBungee.java | 25 +++++++++++++++++ .../authmebungee/bungeecord/AuthMeBungee.java | 6 ++++- .../bungeecord/commands/ReloadCommand.java | 27 +++++++++++++++++++ .../bungeecord/listeners/ServerListener.java | 15 ++++++----- 4 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java diff --git a/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java b/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java index a484c2a..3e92e58 100644 --- a/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java +++ b/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java @@ -4,6 +4,7 @@ import com.google.common.io.ByteStreams; import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.events.LoginEvent; +import fr.xephi.authme.events.LogoutEvent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -69,6 +70,30 @@ public void run() { } } + @EventHandler + public void onAuthMeLogout(LogoutEvent event) { + final Player player = event.getPlayer(); + if (event.getPlayer() == null) { + return; + } + + final ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(bout); + + try { + out.writeUTF("LOGOUT:"); + out.writeUTF(player.getName()); + new BukkitRunnable() { + @Override + public void run() { + player.sendPluginMessage(instance, OUTGOING_CHANNEL, bout.toByteArray()); + } + }.runTaskAsynchronously(instance); + } catch (IOException e) { + e.printStackTrace(); + } + } + @Override public void onPluginMessageReceived(String channel, Player ignored, byte[] message) { if (!channel.equals(INCOMING_CHANNEL)) { diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index 9365e78..420c624 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -5,6 +5,7 @@ import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; import fr.xephi.authmebungee.bungeecord.annotations.IncomingChannel; import fr.xephi.authmebungee.bungeecord.annotations.OutgoingChannel; +import fr.xephi.authmebungee.bungeecord.commands.ReloadCommand; import fr.xephi.authmebungee.bungeecord.config.Settings; import fr.xephi.authmebungee.bungeecord.config.SettingsProvider; import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; @@ -42,6 +43,9 @@ public void onEnable() { authPlayerManager = injector.getSingleton(AuthPlayerManager.class); pluginMessageSender = injector.getSingleton(PluginMessageSender.class); + // Register commands + getProxy().getPluginManager().registerCommand(this, new ReloadCommand()); + // Register plugin channels getProxy().registerChannel(INCOMING_CHANNEL); getProxy().registerChannel(OUTGOING_CHANNEL); @@ -53,7 +57,7 @@ public void onEnable() { private void setupInjector() { // Setup injector - injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee").create(); + injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee.bungee").create(); injector.register(AuthMeBungee.class, this); injector.register(ProxyServer.class, getProxy()); injector.register(PluginManager.class, getProxy().getPluginManager()); diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java new file mode 100644 index 0000000..f1488d8 --- /dev/null +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java @@ -0,0 +1,27 @@ +package fr.xephi.authmebungee.bungeecord.commands; + +import fr.xephi.authmebungee.bungeecord.config.Settings; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.plugin.Command; + +import javax.inject.Inject; + +public class ReloadCommand extends Command { + + @Inject + private Settings settings; + + public ReloadCommand() { + super("abreload", "authmebungee.reload"); + } + + @Override + public void execute(CommandSender commandSender, String[] strings) { + settings.reload(); + commandSender.sendMessage( + new ComponentBuilder("AuthMeBungee configuration reloaded!").color(ChatColor.GREEN).create() + ); + } +} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java index 165b658..2eb6dad 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java +++ b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java @@ -49,14 +49,15 @@ public void onPluginMessage(PluginMessageEvent event) { // For now that's the only type of message the server is able to receive String task = in.readUTF(); - if (!task.equals("LOGIN:")) { - return; - } - // Gather informations from the plugin message - String name = in.readUTF(); - // Set the player status to logged in - authPlayerManager.getAuthPlayer(name).setLogged(true); + switch (task) { + case "LOGIN:": + authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); + break; + case "LOGOUT:": + authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); + break; + } } catch (IOException ex) { // Something nasty happened ex.printStackTrace(); From 1dbcbef03b95960d3ef779801c74e6fd899a7e12 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 5 Jan 2017 02:22:16 +0100 Subject: [PATCH 008/114] Update, remove the bukkit module (now implemented into AuthMe) --- authmebungee-bukkit/LICENSE | 674 ------------------ authmebungee-bukkit/pom.xml | 89 --- .../authmebungee/bukkit/AuthMeBungee.java | 124 ---- .../src/main/resources/config.yml | 1 - .../src/main/resources/plugin.yml | 6 - authmebungee-bungeecord/LICENSE | 674 ------------------ authmebungee-bungeecord/pom.xml | 71 -- .../annotations/IncomingChannel.java | 14 - .../annotations/OutgoingChannel.java | 14 - pom.xml | 60 +- .../authmebungee/bungeecord/AuthMeBungee.java | 12 - .../bungeecord/annotations/DataFolder.java | 0 .../bungeecord/commands/ReloadCommand.java | 0 .../bungeecord/config/ConfigProperties.java | 10 +- .../bungeecord/config/Settings.java | 6 +- .../bungeecord/config/SettingsDependent.java | 0 .../bungeecord/config/SettingsProvider.java | 6 +- .../bungeecord/data/AuthPlayer.java | 0 .../bungeecord/listeners/PlayerListener.java | 3 +- .../bungeecord/listeners/ServerListener.java | 11 +- .../services/AuthPlayerManager.java | 0 .../services/PluginMessageSender.java | 7 +- .../bungeecord/utils/FileUtils.java | 0 .../src => src}/main/resources/plugin.yml | 0 24 files changed, 69 insertions(+), 1713 deletions(-) delete mode 100644 authmebungee-bukkit/LICENSE delete mode 100644 authmebungee-bukkit/pom.xml delete mode 100644 authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java delete mode 100644 authmebungee-bukkit/src/main/resources/config.yml delete mode 100644 authmebungee-bukkit/src/main/resources/plugin.yml delete mode 100644 authmebungee-bungeecord/LICENSE delete mode 100644 authmebungee-bungeecord/pom.xml delete mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java delete mode 100644 authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java (80%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java (100%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java (100%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java (82%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java (78%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java (100%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java (83%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java (100%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java (98%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java (90%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java (100%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java (86%) rename {authmebungee-bungeecord/src => src}/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java (100%) rename {authmebungee-bungeecord/src => src}/main/resources/plugin.yml (100%) diff --git a/authmebungee-bukkit/LICENSE b/authmebungee-bukkit/LICENSE deleted file mode 100644 index 9cecc1d..0000000 --- a/authmebungee-bukkit/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - 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. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - 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: - - {project} Copyright (C) {year} {fullname} - 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/authmebungee-bukkit/pom.xml b/authmebungee-bukkit/pom.xml deleted file mode 100644 index cfd886d..0000000 --- a/authmebungee-bukkit/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - 4.0.0 - - - fr.xephi - authmebungee-parent - 1.6.3-SNAPSHOT - - - authmebungee-bukkit - AuthMeBungee-Bukkit - - - - - false - . - - LICENSE - - - - true - src/main/resources/ - - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots - - - - - xephi-repo - http://ci.xephi.fr/plugin/repository/everything/ - - - - - - - org.bukkit - bukkit - ${bukkitVersion} - provided - - - junit - junit - - - json-simple - com.googlecode.json-simple - - - gson - com.google.code.gson - - - persistence-api - javax.persistence - - - commons-lang - commons-lang - - - snakeyaml - org.yaml - - - - - - - fr.xephi - authme - 5.2-SNAPSHOT - provided - - - diff --git a/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java b/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java deleted file mode 100644 index 3e92e58..0000000 --- a/authmebungee-bukkit/src/main/java/fr/xephi/authmebungee/bukkit/AuthMeBungee.java +++ /dev/null @@ -1,124 +0,0 @@ -package fr.xephi.authmebungee.bukkit; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; -import fr.xephi.authme.api.NewAPI; -import fr.xephi.authme.events.LoginEvent; -import fr.xephi.authme.events.LogoutEvent; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.messaging.Messenger; -import org.bukkit.plugin.messaging.PluginMessageListener; -import org.bukkit.scheduler.BukkitRunnable; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class AuthMeBungee extends JavaPlugin implements Listener, PluginMessageListener { - private final static String INCOMING_CHANNEL = "AuthMeBungeeProxy"; - private final static String OUTGOING_CHANNEL = "AuthMeBungee"; - - private static AuthMeBungee instance; - private NewAPI authme; - - // Settings - private String autoLoginMessage; - - @Override - public void onEnable() { - instance = this; - authme = NewAPI.getInstance(); - - // Config - saveDefaultConfig(); - autoLoginMessage = getConfig().getString("autoLoginMessage", "&2Your session has been resumed by the bridge."); - - // Register event listener - getServer().getPluginManager().registerEvents(instance, instance); - - // Register message listener - Messenger messenger = getServer().getMessenger(); - messenger.registerIncomingPluginChannel(instance, INCOMING_CHANNEL, instance); - messenger.registerOutgoingPluginChannel(instance, OUTGOING_CHANNEL); - } - - @EventHandler - public void onAuthMeLogin(LoginEvent event) { - final Player player = event.getPlayer(); - if (event.getPlayer() == null) { - return; - } - - final ByteArrayOutputStream bout = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(bout); - - try { - out.writeUTF("LOGIN:"); - out.writeUTF(player.getName()); - new BukkitRunnable() { - @Override - public void run() { - player.sendPluginMessage(instance, OUTGOING_CHANNEL, bout.toByteArray()); - } - }.runTaskAsynchronously(instance); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @EventHandler - public void onAuthMeLogout(LogoutEvent event) { - final Player player = event.getPlayer(); - if (event.getPlayer() == null) { - return; - } - - final ByteArrayOutputStream bout = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(bout); - - try { - out.writeUTF("LOGOUT:"); - out.writeUTF(player.getName()); - new BukkitRunnable() { - @Override - public void run() { - player.sendPluginMessage(instance, OUTGOING_CHANNEL, bout.toByteArray()); - } - }.runTaskAsynchronously(instance); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void onPluginMessageReceived(String channel, Player ignored, byte[] message) { - if (!channel.equals(INCOMING_CHANNEL)) { - return; - } - ByteArrayDataInput in = ByteStreams.newDataInput(message); - - String type = in.readUTF(); - if (!type.equals("AUTOLOGIN:")) { - return; - } - - String name = in.readUTF(); - Player player = Bukkit.getPlayerExact(name); - if (player == null) { - return; - } - - if (authme.isAuthenticated(player)) { - return; - } - - authme.forceLogin(player); - if (!autoLoginMessage.isEmpty()) { - player.sendMessage(autoLoginMessage); - } - } -} diff --git a/authmebungee-bukkit/src/main/resources/config.yml b/authmebungee-bukkit/src/main/resources/config.yml deleted file mode 100644 index f809ed1..0000000 --- a/authmebungee-bukkit/src/main/resources/config.yml +++ /dev/null @@ -1 +0,0 @@ -autoLoginMessage : '&2Your session has been resumed by the bridge.' diff --git a/authmebungee-bukkit/src/main/resources/plugin.yml b/authmebungee-bukkit/src/main/resources/plugin.yml deleted file mode 100644 index deae148..0000000 --- a/authmebungee-bukkit/src/main/resources/plugin.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: ${project.name} -description: The first AuthMe bungeecord addon -version: ${project.version} -main: fr.xephi.authmebungee.bukkit.AuthMeBungee -authors: [CryLegend, AuthMeTeam] -depend: [AuthMe] diff --git a/authmebungee-bungeecord/LICENSE b/authmebungee-bungeecord/LICENSE deleted file mode 100644 index 9cecc1d..0000000 --- a/authmebungee-bungeecord/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - 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. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - 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: - - {project} Copyright (C) {year} {fullname} - 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/authmebungee-bungeecord/pom.xml b/authmebungee-bungeecord/pom.xml deleted file mode 100644 index f2656b0..0000000 --- a/authmebungee-bungeecord/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - - fr.xephi - authmebungee-parent - 1.6.3-SNAPSHOT - - - authmebungee-bungeecord - AuthMeBungee-Bungeecord - - - - - false - . - - LICENSE - - - - true - src/main/resources/ - - - - - - - - oss-repo - http://oss.sonatype.org/content/groups/public - - - - - xephi-repo - http://ci.xephi.fr/plugin/repository/everything/ - - - - - - - ch.jalu - injector - 0.3 - compile - - - - - com.github.authme - configme - 0.2.1 - compile - - - - - net.md-5 - bungeecord-api - ${bungeeVersion} - provided - - - diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java deleted file mode 100644 index 8ce9fe8..0000000 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/IncomingChannel.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.xephi.authmebungee.bungeecord.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for specifying the plugin's incoming plugin channel name. - */ -@Target({ElementType.PARAMETER, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface IncomingChannel { -} diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java b/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java deleted file mode 100644 index 3f2f403..0000000 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/OutgoingChannel.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.xephi.authmebungee.bungeecord.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for specifying the plugin's outgoing plugin channel name. - */ -@Target({ElementType.PARAMETER, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface OutgoingChannel { -} diff --git a/pom.xml b/pom.xml index f290241..9ce95f5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 fr.xephi - authmebungee-parent - 1.6.3-SNAPSHOT - pom + authmebungee + 1.6.4-SNAPSHOT + jar AuthMeBungee Bungeecord addon for AuthMe! @@ -44,17 +44,23 @@ UTF-8 - - 1.11-R0.1-SNAPSHOT 1.11-SNAPSHOT - - authmebungee-bungeecord - authmebungee-bukkit - - + + + false + . + + LICENSE + + + + true + ../src/main/resources/ + + @@ -86,4 +92,38 @@ + + + + + oss-repo + http://oss.sonatype.org/content/groups/public + + + + + + + ch.jalu + injector + 0.3 + compile + + + + + ch.jalu + configme + 0.3 + compile + + + + + net.md-5 + bungeecord-api + ${bungeeVersion} + provided + + diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java similarity index 80% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index 420c624..f99b3dd 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -3,8 +3,6 @@ import ch.jalu.injector.Injector; import ch.jalu.injector.InjectorBuilder; import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; -import fr.xephi.authmebungee.bungeecord.annotations.IncomingChannel; -import fr.xephi.authmebungee.bungeecord.annotations.OutgoingChannel; import fr.xephi.authmebungee.bungeecord.commands.ReloadCommand; import fr.xephi.authmebungee.bungeecord.config.Settings; import fr.xephi.authmebungee.bungeecord.config.SettingsProvider; @@ -19,10 +17,6 @@ public class AuthMeBungee extends Plugin { - // Constants - private final static String INCOMING_CHANNEL = "AuthMeBungee"; - private final static String OUTGOING_CHANNEL = "AuthMeBungeeProxy"; - // Instances private Injector injector; private Settings settings; @@ -46,10 +40,6 @@ public void onEnable() { // Register commands getProxy().getPluginManager().registerCommand(this, new ReloadCommand()); - // Register plugin channels - getProxy().registerChannel(INCOMING_CHANNEL); - getProxy().registerChannel(OUTGOING_CHANNEL); - // Registering event listeners getProxy().getPluginManager().registerListener(this, injector.getSingleton(ServerListener.class)); getProxy().getPluginManager().registerListener(this, injector.getSingleton(PlayerListener.class)); @@ -62,8 +52,6 @@ private void setupInjector() { injector.register(ProxyServer.class, getProxy()); injector.register(PluginManager.class, getProxy().getPluginManager()); injector.register(TaskScheduler.class, getProxy().getScheduler()); - injector.provide(IncomingChannel.class, INCOMING_CHANNEL); - injector.provide(OutgoingChannel.class, OUTGOING_CHANNEL); injector.provide(DataFolder.class, getDataFolder()); injector.registerProvider(Settings.class, SettingsProvider.class); } diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java b/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java b/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java similarity index 82% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java index 5596ac7..378745c 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java @@ -1,13 +1,13 @@ package fr.xephi.authmebungee.bungeecord.config; -import com.github.authme.configme.Comment; -import com.github.authme.configme.SettingsHolder; -import com.github.authme.configme.properties.Property; +import ch.jalu.configme.Comment; +import ch.jalu.configme.SettingsHolder; +import ch.jalu.configme.properties.Property; import java.util.List; -import static com.github.authme.configme.properties.PropertyInitializer.newListProperty; -import static com.github.authme.configme.properties.PropertyInitializer.newProperty; +import static ch.jalu.configme.properties.PropertyInitializer.newListProperty; +import static ch.jalu.configme.properties.PropertyInitializer.newProperty; public class ConfigProperties implements SettingsHolder { diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java similarity index 78% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java index 0ded205..e31d102 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java @@ -1,8 +1,8 @@ package fr.xephi.authmebungee.bungeecord.config; -import com.github.authme.configme.SettingsManager; -import com.github.authme.configme.migration.MigrationService; -import com.github.authme.configme.resource.PropertyResource; +import ch.jalu.configme.SettingsManager; +import ch.jalu.configme.migration.MigrationService; +import ch.jalu.configme.resource.PropertyResource; /** * The AuthMeBungee settings manager. diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java similarity index 83% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java index acfefbd..46024b3 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java @@ -1,8 +1,8 @@ package fr.xephi.authmebungee.bungeecord.config; -import com.github.authme.configme.migration.PlainMigrationService; -import com.github.authme.configme.resource.PropertyResource; -import com.github.authme.configme.resource.YamlFileResource; +import ch.jalu.configme.migration.PlainMigrationService; +import ch.jalu.configme.resource.PropertyResource; +import ch.jalu.configme.resource.YamlFileResource; import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; import fr.xephi.authmebungee.bungeecord.utils.FileUtils; diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java similarity index 98% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java index 22f39ba..fccca00 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java @@ -114,7 +114,8 @@ public void onServerSwitch(ServerSwitchEvent event) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout); - out.writeUTF("AUTOLOGIN:"); + out.writeUTF("AuthMeBungee"); + out.writeUTF("AutoLogin"); out.writeUTF(authPlayer.getName()); // Not using async as bungeecord already use multiple threads for player connections diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java similarity index 90% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java index 2eb6dad..dff515a 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java @@ -1,6 +1,5 @@ package fr.xephi.authmebungee.bungeecord.listeners; -import fr.xephi.authmebungee.bungeecord.annotations.IncomingChannel; import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -14,10 +13,6 @@ public class ServerListener implements Listener { - @Inject - @IncomingChannel - private String incomingChannel; - @Inject private AuthPlayerManager authPlayerManager; @@ -31,7 +26,7 @@ public void onPluginMessage(PluginMessageEvent event) { } // Check if the message is for us - if (!event.getTag().equals(incomingChannel)) { + if (!event.getTag().equals("BungeeCord")) { return; } @@ -47,6 +42,10 @@ public void onPluginMessage(PluginMessageEvent event) { // Read the plugin message DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); + if(!in.readUTF().equals("AuthMeBungee")) { + return; + } + // For now that's the only type of message the server is able to receive String task = in.readUTF(); diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java b/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java b/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java similarity index 86% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java index 5c3bedb..8205151 100644 --- a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java @@ -1,7 +1,6 @@ package fr.xephi.authmebungee.bungeecord.services; import fr.xephi.authmebungee.bungeecord.AuthMeBungee; -import fr.xephi.authmebungee.bungeecord.annotations.OutgoingChannel; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.scheduler.TaskScheduler; @@ -10,10 +9,6 @@ public class PluginMessageSender { - @Inject - @OutgoingChannel - private String outgoingChannel; - @Inject private TaskScheduler scheduler; @Inject @@ -47,7 +42,7 @@ public SendMessage(ServerInfo server, byte[] bytes) { @Override public void run() { - server.sendData(outgoingChannel, bytes); + server.sendData("BungeeCord", bytes); } } } diff --git a/authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java b/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java similarity index 100% rename from authmebungee-bungeecord/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java diff --git a/authmebungee-bungeecord/src/main/resources/plugin.yml b/src/main/resources/plugin.yml similarity index 100% rename from authmebungee-bungeecord/src/main/resources/plugin.yml rename to src/main/resources/plugin.yml From 5635db8945415fc714056a2f64dc4e971fb4a2fb Mon Sep 17 00:00:00 2001 From: Bogdan Shkliarenko Date: Sun, 5 Mar 2017 04:29:23 +0200 Subject: [PATCH 009/114] Simple fixes Fixed config file cannot be created, because plugin folder does not exist Fixed maven compiler not including resources (plugin.yml) into target jars --- pom.xml | 6 +++--- .../fr/xephi/authmebungee/bungeecord/utils/FileUtils.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9ce95f5..e150592 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ fr.xephi authmebungee - 1.6.4-SNAPSHOT + 1.6.5-SNAPSHOT jar AuthMeBungee Bungeecord addon for AuthMe! - 2014 + 2017 AuthMe-Team @@ -58,7 +58,7 @@ true - ../src/main/resources/ + src/main/resources diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java b/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java index f1023fd..c7e4063 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java @@ -19,6 +19,7 @@ private FileUtils() { */ public static void create(File file) { try { + file.getParentFile().mkdirs(); boolean result = file.createNewFile(); if (!result) { throw new IllegalStateException("Could not create file '" + file + "'"); From 996372676f09869a9b739b639be43762323eab95 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 28 Jul 2017 01:01:05 +0200 Subject: [PATCH 010/114] Add spigot module, cleanup TODO: split it into more maven modules --- pom.xml | 38 ++++++++++-- .../authmebungee/bungeecord/AuthMeBungee.java | 30 ++++----- ...dCommand.java => BungeeReloadCommand.java} | 8 +-- ...rties.java => BungeeConfigProperties.java} | 8 +-- .../config/BungeeSettingsProvider.java | 10 +++ .../bungeecord/config/Settings.java | 23 ------- .../bungeecord/data/AuthPlayer.java | 11 +++- ...stener.java => BungeeMessageListener.java} | 8 ++- ...istener.java => BungeePlayerListener.java} | 32 +++++----- ...geSender.java => BungeeMessageSender.java} | 11 ++-- .../annotations/DataFolder.java | 2 +- .../config/SettingsDependent.java | 6 +- .../config/SettingsProvider.java | 19 +++--- .../utils/FileUtils.java | 4 +- .../spigot/AuthMeBungeeSpigot.java | 56 +++++++++++++++++ .../spigot/commands/SpigotReloadCommand.java | 26 ++++++++ .../spigot/config/SpigotConfigProperties.java | 20 ++++++ .../spigot/config/SpigotSettingsProvider.java | 10 +++ .../listeners/SpigotAuthMeListener.java | 48 ++++++++++++++ .../listeners/SpigotMessageListener.java | 62 +++++++++++++++++++ .../spigot/services/SpigotMessageSender.java | 42 +++++++++++++ src/main/resources/bungee.yml | 4 ++ src/main/resources/plugin.yml | 11 +++- 23 files changed, 398 insertions(+), 91 deletions(-) rename src/main/java/fr/xephi/authmebungee/bungeecord/commands/{ReloadCommand.java => BungeeReloadCommand.java} (78%) rename src/main/java/fr/xephi/authmebungee/bungeecord/config/{ConfigProperties.java => BungeeConfigProperties.java} (94%) create mode 100644 src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java delete mode 100644 src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java rename src/main/java/fr/xephi/authmebungee/bungeecord/listeners/{ServerListener.java => BungeeMessageListener.java} (88%) rename src/main/java/fr/xephi/authmebungee/bungeecord/listeners/{PlayerListener.java => BungeePlayerListener.java} (77%) rename src/main/java/fr/xephi/authmebungee/bungeecord/services/{PluginMessageSender.java => BungeeMessageSender.java} (86%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => common}/annotations/DataFolder.java (86%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => common}/config/SettingsDependent.java (65%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => common}/config/SettingsProvider.java (54%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => common}/utils/FileUtils.java (88%) create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java create mode 100644 src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java create mode 100644 src/main/resources/bungee.yml diff --git a/pom.xml b/pom.xml index e150592..5723615 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 1.6.5-SNAPSHOT + 2.0.0-SNAPSHOT jar AuthMeBungee @@ -44,7 +44,9 @@ UTF-8 - 1.11-SNAPSHOT + 1.12-SNAPSHOT + 1.12-R0.1-SNAPSHOT + 5.3.3-SNAPSHOT @@ -66,7 +68,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.0 + 3.6.1 1.8 1.8 @@ -76,7 +78,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.4.3 + 3.0.0 false @@ -99,6 +101,16 @@ oss-repo http://oss.sonatype.org/content/groups/public + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + xephi-repo + http://ci.xephi.fr/plugin/repository/everything/ + @@ -118,12 +130,28 @@ compile - + net.md-5 bungeecord-api ${bungeeVersion} provided + + + + org.spigotmc + spigot-api + ${spigotVersion} + provided + + + + + fr.xephi + authme + ${authMeVersion} + provided + diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index f99b3dd..0cb578e 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -1,15 +1,15 @@ package fr.xephi.authmebungee.bungeecord; +import ch.jalu.configme.SettingsManager; import ch.jalu.injector.Injector; import ch.jalu.injector.InjectorBuilder; -import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; -import fr.xephi.authmebungee.bungeecord.commands.ReloadCommand; -import fr.xephi.authmebungee.bungeecord.config.Settings; -import fr.xephi.authmebungee.bungeecord.config.SettingsProvider; +import fr.xephi.authmebungee.bungeecord.commands.BungeeReloadCommand; +import fr.xephi.authmebungee.bungeecord.config.BungeeSettingsProvider; +import fr.xephi.authmebungee.bungeecord.listeners.BungeePlayerListener; +import fr.xephi.authmebungee.bungeecord.listeners.BungeeMessageListener; import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; -import fr.xephi.authmebungee.bungeecord.listeners.PlayerListener; -import fr.xephi.authmebungee.bungeecord.listeners.ServerListener; -import fr.xephi.authmebungee.bungeecord.services.PluginMessageSender; +import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; +import fr.xephi.authmebungee.common.annotations.DataFolder; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.PluginManager; @@ -19,9 +19,9 @@ public class AuthMeBungee extends Plugin { // Instances private Injector injector; - private Settings settings; + private SettingsManager settings; private AuthPlayerManager authPlayerManager; - private PluginMessageSender pluginMessageSender; + private BungeeMessageSender pluginMessageSender; public AuthMeBungee() { } @@ -33,16 +33,16 @@ public void onEnable() { setupInjector(); // Get singletons from the injector - settings = injector.getSingleton(Settings.class); + settings = injector.getSingleton(SettingsManager.class); authPlayerManager = injector.getSingleton(AuthPlayerManager.class); - pluginMessageSender = injector.getSingleton(PluginMessageSender.class); + pluginMessageSender = injector.getSingleton(BungeeMessageSender.class); // Register commands - getProxy().getPluginManager().registerCommand(this, new ReloadCommand()); + getProxy().getPluginManager().registerCommand(this, new BungeeReloadCommand()); // Registering event listeners - getProxy().getPluginManager().registerListener(this, injector.getSingleton(ServerListener.class)); - getProxy().getPluginManager().registerListener(this, injector.getSingleton(PlayerListener.class)); + getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeeMessageListener.class)); + getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeePlayerListener.class)); } private void setupInjector() { @@ -53,6 +53,6 @@ private void setupInjector() { injector.register(PluginManager.class, getProxy().getPluginManager()); injector.register(TaskScheduler.class, getProxy().getScheduler()); injector.provide(DataFolder.class, getDataFolder()); - injector.registerProvider(Settings.class, SettingsProvider.class); + injector.registerProvider(SettingsManager.class, BungeeSettingsProvider.class); } } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java b/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java similarity index 78% rename from src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java index f1488d8..b7918bd 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/ReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java @@ -1,6 +1,6 @@ package fr.xephi.authmebungee.bungeecord.commands; -import fr.xephi.authmebungee.bungeecord.config.Settings; +import ch.jalu.configme.SettingsManager; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -8,12 +8,12 @@ import javax.inject.Inject; -public class ReloadCommand extends Command { +public class BungeeReloadCommand extends Command { @Inject - private Settings settings; + private SettingsManager settings; - public ReloadCommand() { + public BungeeReloadCommand() { super("abreload", "authmebungee.reload"); } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java similarity index 94% rename from src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java index 378745c..a4fefa2 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/ConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java @@ -9,7 +9,10 @@ import static ch.jalu.configme.properties.PropertyInitializer.newListProperty; import static ch.jalu.configme.properties.PropertyInitializer.newProperty; -public class ConfigProperties implements SettingsHolder { +public class BungeeConfigProperties implements SettingsHolder { + + private BungeeConfigProperties() { + } @Comment("List of servers which required to be authenticated") public static final Property> AUTH_SERVERS = @@ -36,7 +39,4 @@ public class ConfigProperties implements SettingsHolder { @Comment("Enable auto-login between servers") public static final Property AUTOLOGIN = newProperty("autoLogin", false); - - private ConfigProperties() { - } } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java new file mode 100644 index 0000000..38e08a5 --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java @@ -0,0 +1,10 @@ +package fr.xephi.authmebungee.bungeecord.config; + +import fr.xephi.authmebungee.common.config.SettingsProvider; + +public class BungeeSettingsProvider extends SettingsProvider { + + BungeeSettingsProvider() { + super(BungeeConfigProperties.class); + } +} diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java deleted file mode 100644 index e31d102..0000000 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/Settings.java +++ /dev/null @@ -1,23 +0,0 @@ -package fr.xephi.authmebungee.bungeecord.config; - -import ch.jalu.configme.SettingsManager; -import ch.jalu.configme.migration.MigrationService; -import ch.jalu.configme.resource.PropertyResource; - -/** - * The AuthMeBungee settings manager. - */ -public class Settings extends SettingsManager { - - /** - * Constructor. - * - * @param resource the property resource to read and write properties to - * @param migrationService migration service to check the settings file with - * @param configurationData configuration data (properties and comments) - */ - public Settings(PropertyResource resource, MigrationService migrationService, - Class configurationData) { - super(resource, migrationService, configurationData); - } -} diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java index cc50a0f..faaed74 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java @@ -3,8 +3,13 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; +import javax.inject.Inject; + public class AuthPlayer { + @Inject + private ProxyServer proxy; + private String name; private boolean isLogged; @@ -29,11 +34,11 @@ public void setLogged(boolean isLogged) { this.isLogged = isLogged; } - public ProxiedPlayer getProxiedPlayer() { - return ProxyServer.getInstance().getPlayer(name); + public ProxiedPlayer getPlayer() { + return proxy.getPlayer(getName()); } public boolean isOnline() { - return getProxiedPlayer() != null; + return getPlayer() != null; } } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java similarity index 88% rename from src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java index dff515a..b5e1340 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/ServerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java @@ -11,12 +11,14 @@ import java.io.DataInputStream; import java.io.IOException; -public class ServerListener implements Listener { +public class BungeeMessageListener implements Listener { @Inject private AuthPlayerManager authPlayerManager; - public ServerListener() { + @Inject + BungeeMessageListener(AuthPlayerManager authPlayerManager) { + this.authPlayerManager = authPlayerManager; } @EventHandler @@ -42,7 +44,7 @@ public void onPluginMessage(PluginMessageEvent event) { // Read the plugin message DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); - if(!in.readUTF().equals("AuthMeBungee")) { + if (!in.readUTF().equals("AuthMeBungee")) { return; } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java similarity index 77% rename from src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java index fccca00..aba998e 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/PlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java @@ -1,11 +1,11 @@ package fr.xephi.authmebungee.bungeecord.listeners; -import fr.xephi.authmebungee.bungeecord.services.PluginMessageSender; -import fr.xephi.authmebungee.bungeecord.config.ConfigProperties; -import fr.xephi.authmebungee.bungeecord.config.Settings; -import fr.xephi.authmebungee.bungeecord.config.SettingsDependent; +import ch.jalu.configme.SettingsManager; +import fr.xephi.authmebungee.bungeecord.config.BungeeConfigProperties; import fr.xephi.authmebungee.bungeecord.data.AuthPlayer; import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; +import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; +import fr.xephi.authmebungee.common.config.SettingsDependent; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -23,11 +23,11 @@ import java.io.IOException; import java.util.List; -public class PlayerListener implements Listener, SettingsDependent { +public class BungeePlayerListener implements Listener, SettingsDependent { // Services private AuthPlayerManager authPlayerManager; - private PluginMessageSender pluginMessageSender; + private BungeeMessageSender pluginMessageSender; // Settings private boolean isAutoLogin; @@ -39,21 +39,21 @@ public class PlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - PlayerListener(Settings settings, AuthPlayerManager authPlayerManager, PluginMessageSender pluginMessageSender) { + BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager, BungeeMessageSender pluginMessageSender) { this.authPlayerManager = authPlayerManager; this.pluginMessageSender = pluginMessageSender; reload(settings); } @Override - public void reload(Settings settings) { - isAutoLogin = settings.getProperty(ConfigProperties.AUTOLOGIN); - isServerSwitchRequiresAuth = settings.getProperty(ConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); - requiresAuthKickMessage = settings.getProperty(ConfigProperties.SERVER_SWITCH_KICK_MESSAGE); - authServers = settings.getProperty(ConfigProperties.AUTH_SERVERS); - isCommandsRequireAuth = settings.getProperty(ConfigProperties.COMMANDS_REQUIRE_AUTH); - commandWhitelist = settings.getProperty(ConfigProperties.COMMANDS_WHITELIST); - chatRequiresAuth = settings.getProperty(ConfigProperties.CHAT_REQUIRES_AUTH); + public void reload(SettingsManager settings) { + isAutoLogin = settings.getProperty(BungeeConfigProperties.AUTOLOGIN); + isServerSwitchRequiresAuth = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); + requiresAuthKickMessage = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_KICK_MESSAGE); + authServers = settings.getProperty(BungeeConfigProperties.AUTH_SERVERS); + isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH); + commandWhitelist = settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST); + chatRequiresAuth = settings.getProperty(BungeeConfigProperties.CHAT_REQUIRES_AUTH); } @EventHandler @@ -108,7 +108,7 @@ public void onServerSwitch(ServerSwitchEvent event) { // Player is trying to switch server (also called on first server player connection) if (authPlayer.isLogged()) { - // If player is logged in and autoLogin is enabled, send login signal to the bukkit side + // If player is logged in and autoLogin is enabled, send login signal to the spigot side if (isAutoLogin) { try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java b/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java similarity index 86% rename from src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java rename to src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java index 8205151..c9d6755 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/services/PluginMessageSender.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java @@ -7,14 +7,15 @@ import javax.inject.Inject; -public class PluginMessageSender { +public class BungeeMessageSender { - @Inject - private TaskScheduler scheduler; - @Inject private AuthMeBungee plugin; + private TaskScheduler scheduler; - public PluginMessageSender() { + @Inject + BungeeMessageSender(AuthMeBungee plugin, TaskScheduler scheduler) { + this.plugin = plugin; + this.scheduler = scheduler; } public void sendData(ServerInfo server, byte[] bytes, boolean async) { diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java b/src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java similarity index 86% rename from src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java rename to src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java index dcc0174..64fff55 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/annotations/DataFolder.java +++ b/src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.bungeecord.annotations; +package fr.xephi.authmebungee.common.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java b/src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java similarity index 65% rename from src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java rename to src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java index 4b127ce..adc63d5 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsDependent.java +++ b/src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java @@ -1,4 +1,6 @@ -package fr.xephi.authmebungee.bungeecord.config; +package fr.xephi.authmebungee.common.config; + +import ch.jalu.configme.SettingsManager; /** * Interface for classes that keep a local copy of certain settings. @@ -10,5 +12,5 @@ public interface SettingsDependent { * * @param settings the settings instance */ - void reload(Settings settings); + void reload(SettingsManager settings); } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java similarity index 54% rename from src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java rename to src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java index 46024b3..ee98762 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java @@ -1,10 +1,12 @@ -package fr.xephi.authmebungee.bungeecord.config; +package fr.xephi.authmebungee.common.config; +import ch.jalu.configme.SettingsHolder; +import ch.jalu.configme.SettingsManager; import ch.jalu.configme.migration.PlainMigrationService; import ch.jalu.configme.resource.PropertyResource; import ch.jalu.configme.resource.YamlFileResource; -import fr.xephi.authmebungee.bungeecord.annotations.DataFolder; -import fr.xephi.authmebungee.bungeecord.utils.FileUtils; +import fr.xephi.authmebungee.common.annotations.DataFolder; +import fr.xephi.authmebungee.common.utils.FileUtils; import javax.inject.Inject; import javax.inject.Provider; @@ -13,13 +15,16 @@ /** * Initializes the settings. */ -public class SettingsProvider implements Provider { +public abstract class SettingsProvider implements Provider { @Inject @DataFolder private File dataFolder; - SettingsProvider() { + private Class properties; + + protected SettingsProvider(Class properties) { + this.properties = properties; } /** @@ -28,12 +33,12 @@ public class SettingsProvider implements Provider { * @return the settings instance, or null if it could not be constructed */ @Override - public Settings get() { + public SettingsManager get() { File configFile = new File(dataFolder, "config.yml"); if (!configFile.exists()) { FileUtils.create(configFile); } PropertyResource resource = new YamlFileResource(configFile); - return new Settings(resource, new PlainMigrationService(), ConfigProperties.class); + return new SettingsManager(resource, new PlainMigrationService(), properties); } } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java b/src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java similarity index 88% rename from src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java rename to src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java index c7e4063..988769b 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/utils/FileUtils.java +++ b/src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.bungeecord.utils; +package fr.xephi.authmebungee.common.utils; import java.io.File; import java.io.IOException; @@ -19,7 +19,7 @@ private FileUtils() { */ public static void create(File file) { try { - file.getParentFile().mkdirs(); + file.getParentFile().mkdirs(); boolean result = file.createNewFile(); if (!result) { throw new IllegalStateException("Could not create file '" + file + "'"); diff --git a/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java b/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java new file mode 100644 index 0000000..a742c55 --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java @@ -0,0 +1,56 @@ +package fr.xephi.authmebungee.spigot; + +import ch.jalu.configme.SettingsManager; +import ch.jalu.injector.Injector; +import ch.jalu.injector.InjectorBuilder; +import fr.xephi.authme.api.v3.AuthMeApi; +import fr.xephi.authmebungee.common.annotations.DataFolder; +import fr.xephi.authmebungee.spigot.commands.SpigotReloadCommand; +import fr.xephi.authmebungee.spigot.config.SpigotSettingsProvider; +import fr.xephi.authmebungee.spigot.listeners.SpigotAuthMeListener; +import fr.xephi.authmebungee.spigot.listeners.SpigotMessageListener; +import fr.xephi.authmebungee.spigot.services.SpigotMessageSender; +import org.bukkit.Server; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +public class AuthMeBungeeSpigot extends JavaPlugin { + + // Instances + private Injector injector; + private SettingsManager settings; + private SpigotMessageSender pluginMessageSender; + + public AuthMeBungeeSpigot() { + } + + @Override + public void onEnable() { + + // Prepare the injector and register stuff + setupInjector(); + + // Get singletons from the injector + settings = injector.getSingleton(SettingsManager.class); + pluginMessageSender = injector.getSingleton(SpigotMessageSender.class); + + // Register commands + getCommand("abreload").setExecutor(injector.getSingleton(SpigotReloadCommand.class)); + + // Registering event listeners + getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); + getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", injector.getSingleton(SpigotMessageListener.class)); + getServer().getPluginManager().registerEvents(injector.getSingleton(SpigotAuthMeListener.class), this); + } + + private void setupInjector() { + // Setup injector + injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee.spigot").create(); + injector.register(AuthMeBungeeSpigot.class, this); + injector.register(Server.class, getServer()); + injector.register(PluginManager.class, getServer().getPluginManager()); + injector.provide(DataFolder.class, getDataFolder()); + injector.registerProvider(SettingsManager.class, SpigotSettingsProvider.class); + injector.register(AuthMeApi.class, AuthMeApi.getInstance()); + } +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java b/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java new file mode 100644 index 0000000..ddb49dd --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java @@ -0,0 +1,26 @@ +package fr.xephi.authmebungee.spigot.commands; + +import ch.jalu.configme.SettingsManager; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import javax.inject.Inject; + +public class SpigotReloadCommand implements CommandExecutor { + + private SettingsManager settings; + + @Inject + SpigotReloadCommand(SettingsManager settings) { + this.settings = settings; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + settings.reload(); + sender.sendMessage(ChatColor.GREEN + "AuthMeBungee configuration reloaded!"); + return true; + } +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java new file mode 100644 index 0000000..9ada668 --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java @@ -0,0 +1,20 @@ +package fr.xephi.authmebungee.spigot.config; + +import ch.jalu.configme.Comment; +import ch.jalu.configme.SettingsHolder; +import ch.jalu.configme.properties.Property; + +import java.util.List; + +import static ch.jalu.configme.properties.PropertyInitializer.newListProperty; +import static ch.jalu.configme.properties.PropertyInitializer.newProperty; + +public class SpigotConfigProperties implements SettingsHolder { + + private SpigotConfigProperties() { + } + + @Comment("The message that is sent to the player after a successful auto-login") + public static final Property AUTOLOGIN_MESSAGE = + newProperty("autologin.message", "&2Your session has been resumed by the bridge."); +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java new file mode 100644 index 0000000..e41312f --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java @@ -0,0 +1,10 @@ +package fr.xephi.authmebungee.spigot.config; + +import fr.xephi.authmebungee.common.config.SettingsProvider; + +public class SpigotSettingsProvider extends SettingsProvider { + + SpigotSettingsProvider() { + super(SpigotConfigProperties.class); + } +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java new file mode 100644 index 0000000..e969308 --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java @@ -0,0 +1,48 @@ +package fr.xephi.authmebungee.spigot.listeners; + +import fr.xephi.authme.events.LoginEvent; +import fr.xephi.authme.events.LogoutEvent; +import fr.xephi.authmebungee.spigot.services.SpigotMessageSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +import javax.inject.Inject; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class SpigotAuthMeListener implements Listener { + + private SpigotMessageSender messageSender; + + @Inject + public SpigotAuthMeListener(SpigotMessageSender messageSender) { + this.messageSender = messageSender; + } + + @EventHandler(priority = EventPriority.HIGH) + public void onAuthMeLogin(LoginEvent event) { + final Player player = event.getPlayer(); + try(ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { + out.writeUTF("LOGIN:"); + out.writeUTF(player.getName()); + messageSender.sendData(bout.toByteArray(), true); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void onAuthMeLogout(LogoutEvent event) { + final Player player = event.getPlayer(); + try(ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { + out.writeUTF("LOGOUT:"); + out.writeUTF(player.getName()); + messageSender.sendData(bout.toByteArray(), true); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java new file mode 100644 index 0000000..491e9eb --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java @@ -0,0 +1,62 @@ +package fr.xephi.authmebungee.spigot.listeners; + +import ch.jalu.configme.SettingsManager; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import fr.xephi.authme.api.v3.AuthMeApi; +import fr.xephi.authmebungee.common.config.SettingsDependent; +import fr.xephi.authmebungee.spigot.config.SpigotConfigProperties; +import org.bukkit.ChatColor; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.messaging.PluginMessageListener; + +import javax.inject.Inject; + +public class SpigotMessageListener implements PluginMessageListener, SettingsDependent { + + private Server server; + private AuthMeApi authMeApi; + + private String autoLoginMessage; + + @Inject + SpigotMessageListener(Server server, SettingsManager settings, AuthMeApi authMeApi) { + this.server = server; + this.authMeApi = authMeApi; + reload(settings); + } + + @Override + public void reload(SettingsManager settings) { + autoLoginMessage = ChatColor.translateAlternateColorCodes('&', settings.getProperty(SpigotConfigProperties.AUTOLOGIN_MESSAGE)); + } + + @Override + public void onPluginMessageReceived(String channel, Player connection, byte[] message) { + if (!channel.equals("BungeeCord")) { + return; + } + ByteArrayDataInput in = ByteStreams.newDataInput(message); + + String type = in.readUTF(); + if (!type.equals("AUTOLOGIN:")) { + return; + } + + String name = in.readUTF(); + Player player = server.getPlayerExact(name); + if (player == null) { + return; + } + + if (authMeApi.isAuthenticated(player)) { + return; + } + + authMeApi.forceLogin(player); + if (!autoLoginMessage.isEmpty()) { + player.sendMessage(autoLoginMessage); + } + } +} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java b/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java new file mode 100644 index 0000000..9766ac3 --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java @@ -0,0 +1,42 @@ +package fr.xephi.authmebungee.spigot.services; + +import fr.xephi.authmebungee.spigot.AuthMeBungeeSpigot; +import org.bukkit.Server; +import org.bukkit.scheduler.BukkitRunnable; + +import javax.inject.Inject; + +public class SpigotMessageSender { + + private AuthMeBungeeSpigot plugin; + private Server server; + + @Inject + SpigotMessageSender(AuthMeBungeeSpigot plugin, Server server) { + this.plugin = plugin; + this.server = server; + } + + public void sendData(byte[] bytes, boolean async) { + SendMessage sendMessage = new SendMessage(bytes); + if (async) { + sendMessage.runTaskAsynchronously(plugin); + } else { + sendMessage.run(); + } + } + + private class SendMessage extends BukkitRunnable { + + private byte[] bytes; + + public SendMessage(byte[] bytes) { + this.bytes = bytes; + } + + @Override + public void run() { + server.sendPluginMessage(plugin, "BungeeCord", bytes); + } + } +} diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml new file mode 100644 index 0000000..2b1c507 --- /dev/null +++ b/src/main/resources/bungee.yml @@ -0,0 +1,4 @@ +name: ${project.name} +main: fr.xephi.authmebungee.bungeecord.AuthMeBungee +version: ${project.version} +authors: [CryLegend, AuthMeTeam] diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2b1c507..f172a4b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,4 +1,13 @@ name: ${project.name} -main: fr.xephi.authmebungee.bungeecord.AuthMeBungee +main: fr.xephi.authmebungee.spigot.AuthMeBungee version: ${project.version} authors: [CryLegend, AuthMeTeam] +depend: [AuthMe] +commands: + abreload: + description: Reloads the AuthMeBungee config file + permission: authmebungee.reload +permissions: + authmebungee.reload: + description: Allows to reload the config file + default: op From c06d498e17369ecce4f44c8ec821eb72623ae1de Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 28 Jul 2017 01:04:13 +0200 Subject: [PATCH 011/114] Cleanup --- .../xephi/authmebungee/bungeecord/AuthMeBungee.java | 2 +- .../bungeecord/config/BungeeConfigProperties.java | 11 +++-------- .../spigot/config/SpigotConfigProperties.java | 9 +++------ .../spigot/listeners/SpigotAuthMeListener.java | 4 ++-- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index 0cb578e..f68a206 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -5,8 +5,8 @@ import ch.jalu.injector.InjectorBuilder; import fr.xephi.authmebungee.bungeecord.commands.BungeeReloadCommand; import fr.xephi.authmebungee.bungeecord.config.BungeeSettingsProvider; -import fr.xephi.authmebungee.bungeecord.listeners.BungeePlayerListener; import fr.xephi.authmebungee.bungeecord.listeners.BungeeMessageListener; +import fr.xephi.authmebungee.bungeecord.listeners.BungeePlayerListener; import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; import fr.xephi.authmebungee.common.annotations.DataFolder; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java index a4fefa2..beaff2b 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java @@ -11,32 +11,27 @@ public class BungeeConfigProperties implements SettingsHolder { - private BungeeConfigProperties() { - } - @Comment("List of servers which required to be authenticated") public static final Property> AUTH_SERVERS = newListProperty("authServers", "lobby"); - @Comment("Allows or not commands to be performed if user is not logged in") public static final Property COMMANDS_REQUIRE_AUTH = newProperty("commands.requireAuth", true); - @Comment("List of commands allowed to be perform without being authenticated") public static final Property> COMMANDS_WHITELIST = newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha"); - @Comment("Allows or not user to talk in chat if he is not logged in") public static final Property CHAT_REQUIRES_AUTH = newProperty("chatRequiresAuth", true); - @Comment("Kick all players who switch servers without being authenticated (eg. plugin teleport)") public static final Property SERVER_SWITCH_REQUIRES_AUTH = newProperty("serverSwitch.requiresAuth", true); public static final Property SERVER_SWITCH_KICK_MESSAGE = newProperty("serverSwitch.kickMessage", "Authentication required."); - @Comment("Enable auto-login between servers") public static final Property AUTOLOGIN = newProperty("autoLogin", false); + + private BungeeConfigProperties() { + } } diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java index 9ada668..fcf73ba 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java @@ -4,17 +4,14 @@ import ch.jalu.configme.SettingsHolder; import ch.jalu.configme.properties.Property; -import java.util.List; - -import static ch.jalu.configme.properties.PropertyInitializer.newListProperty; import static ch.jalu.configme.properties.PropertyInitializer.newProperty; public class SpigotConfigProperties implements SettingsHolder { - private SpigotConfigProperties() { - } - @Comment("The message that is sent to the player after a successful auto-login") public static final Property AUTOLOGIN_MESSAGE = newProperty("autologin.message", "&2Your session has been resumed by the bridge."); + + private SpigotConfigProperties() { + } } diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java index e969308..92d2fea 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java @@ -25,7 +25,7 @@ public SpigotAuthMeListener(SpigotMessageSender messageSender) { @EventHandler(priority = EventPriority.HIGH) public void onAuthMeLogin(LoginEvent event) { final Player player = event.getPlayer(); - try(ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { + try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { out.writeUTF("LOGIN:"); out.writeUTF(player.getName()); messageSender.sendData(bout.toByteArray(), true); @@ -37,7 +37,7 @@ public void onAuthMeLogin(LoginEvent event) { @EventHandler(priority = EventPriority.HIGH) public void onAuthMeLogout(LogoutEvent event) { final Player player = event.getPlayer(); - try(ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { + try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { out.writeUTF("LOGOUT:"); out.writeUTF(player.getName()); messageSender.sendData(bout.toByteArray(), true); From 4514cac330cc552d2cfb359c7a903d160a3243f1 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 28 Jul 2017 01:15:46 +0200 Subject: [PATCH 012/114] Add support for plugin hotswap (just in case) --- .../java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index f68a206..483b851 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -11,6 +11,7 @@ import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; import fr.xephi.authmebungee.common.annotations.DataFolder; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.PluginManager; import net.md_5.bungee.api.scheduler.TaskScheduler; @@ -37,6 +38,10 @@ public void onEnable() { authPlayerManager = injector.getSingleton(AuthPlayerManager.class); pluginMessageSender = injector.getSingleton(BungeeMessageSender.class); + for(ProxiedPlayer player : getProxy().getPlayers()) { + authPlayerManager.addAuthPlayer(player); + } + // Register commands getProxy().getPluginManager().registerCommand(this, new BungeeReloadCommand()); From f982365bcec410b47af9f8770ecdd53b2c2d5ab3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 28 Jul 2017 01:18:02 +0200 Subject: [PATCH 013/114] Prevent plugin unload --- .../java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index 483b851..4d8b0ea 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -50,6 +50,12 @@ public void onEnable() { getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeePlayerListener.class)); } + @Override + public void onDisable() { + // Prevent plugin unload + getProxy().stop(); + } + private void setupInjector() { // Setup injector injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee.bungee").create(); From 28c37e3ac6d14241decd175e5e1c51fccf6086cb Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 28 Jul 2017 01:27:26 +0200 Subject: [PATCH 014/114] Listen to better events should be safer --- .../listeners/BungeePlayerListener.java | 69 +++++++++++-------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java index aba998e..a44fe8e 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java @@ -9,10 +9,7 @@ import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.ChatEvent; -import net.md_5.bungee.api.event.PlayerDisconnectEvent; -import net.md_5.bungee.api.event.PostLoginEvent; -import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.event.*; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; @@ -101,40 +98,52 @@ public void onChat(ChatEvent event) { event.setCancelled(true); } + @EventHandler(priority = EventPriority.HIGHEST) + public void onServerConnect(ServerConnectEvent event) { + if (!isServerSwitchRequiresAuth || event.isCancelled()) { + return; + } + + ProxiedPlayer player = event.getPlayer(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (authPlayer.isLogged()) { + return; + } + + // If player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection + String server = event.getTarget().getName(); + if (!authServers.contains(server)) { + event.setCancelled(true); + TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); + reasonMessage.setColor(ChatColor.RED); + player.sendMessage(reasonMessage); + } + } + @EventHandler public void onServerSwitch(ServerSwitchEvent event) { + if(!isAutoLogin) { + return; + } + ProxiedPlayer player = event.getPlayer(); AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); // Player is trying to switch server (also called on first server player connection) if (authPlayer.isLogged()) { // If player is logged in and autoLogin is enabled, send login signal to the spigot side - if (isAutoLogin) { - try { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(bout); - - out.writeUTF("AuthMeBungee"); - out.writeUTF("AutoLogin"); - out.writeUTF(authPlayer.getName()); - - // Not using async as bungeecord already use multiple threads for player connections - pluginMessageSender.sendData(event.getPlayer().getServer(), bout.toByteArray(), false); - } catch (IOException e) { - e.printStackTrace(); - } - } - } else { - // If player is not logged in and serverSwitchRequiresAuth is enabled, kick player - if (!isServerSwitchRequiresAuth) { - return; - } - - String server = event.getPlayer().getServer().getInfo().getName(); - if (!authServers.contains(server)) { - TextComponent kickReason = new TextComponent(requiresAuthKickMessage); - kickReason.setColor(ChatColor.RED); - event.getPlayer().disconnect(kickReason); + try { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(bout); + + out.writeUTF("AuthMeBungee"); + out.writeUTF("AutoLogin"); + out.writeUTF(authPlayer.getName()); + + // Not using async as bungeecord already use multiple threads for player connections + pluginMessageSender.sendData(event.getPlayer().getServer(), bout.toByteArray(), false); + } catch (IOException e) { + e.printStackTrace(); } } } From 3597d1cf0d39449d86dd07048297e1e6b5a84ccf Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 21 Aug 2017 23:34:00 +0200 Subject: [PATCH 015/114] Bugfixes --- .../xephi/authmebungee/bungeecord/AuthMeBungee.java | 2 +- .../bungeecord/commands/BungeeReloadCommand.java | 2 +- .../bungeecord/config/BungeeSettingsProvider.java | 8 ++++++-- .../bungeecord/listeners/BungeeMessageListener.java | 13 ++++++------- .../bungeecord/listeners/BungeePlayerListener.java | 2 +- .../bungeecord/services/BungeeMessageSender.java | 2 +- .../common/config/SettingsProvider.java | 7 ++----- .../authmebungee/spigot/AuthMeBungeeSpigot.java | 2 +- .../spigot/config/SpigotSettingsProvider.java | 8 ++++++-- .../spigot/listeners/SpigotAuthMeListener.java | 6 ++++-- .../spigot/listeners/SpigotMessageListener.java | 5 ++--- .../spigot/services/SpigotMessageSender.java | 2 +- src/main/resources/plugin.yml | 2 +- 13 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java index 4d8b0ea..d523135 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java @@ -58,7 +58,7 @@ public void onDisable() { private void setupInjector() { // Setup injector - injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee.bungee").create(); + injector = new InjectorBuilder().addDefaultHandlers("").create(); injector.register(AuthMeBungee.class, this); injector.register(ProxyServer.class, getProxy()); injector.register(PluginManager.class, getProxy().getPluginManager()); diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java b/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java index b7918bd..1b6255b 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java @@ -14,7 +14,7 @@ public class BungeeReloadCommand extends Command { private SettingsManager settings; public BungeeReloadCommand() { - super("abreload", "authmebungee.reload"); + super("abreloadproxy", "authmebungee.reload"); } @Override diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java index 38e08a5..832f623 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java @@ -1,10 +1,14 @@ package fr.xephi.authmebungee.bungeecord.config; +import fr.xephi.authmebungee.common.annotations.DataFolder; import fr.xephi.authmebungee.common.config.SettingsProvider; +import java.io.File; +import javax.inject.Inject; public class BungeeSettingsProvider extends SettingsProvider { - BungeeSettingsProvider() { - super(BungeeConfigProperties.class); + @Inject + public BungeeSettingsProvider(@DataFolder File dataFolder) { + super(dataFolder, BungeeConfigProperties.class); } } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java index b5e1340..470238a 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java @@ -13,11 +13,10 @@ public class BungeeMessageListener implements Listener { - @Inject private AuthPlayerManager authPlayerManager; @Inject - BungeeMessageListener(AuthPlayerManager authPlayerManager) { + public BungeeMessageListener(AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; } @@ -37,9 +36,6 @@ public void onPluginMessage(PluginMessageEvent event) { return; } - // Now that's sure, it's for us, so let's go - event.setCancelled(true); - try { // Read the plugin message DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); @@ -48,14 +44,17 @@ public void onPluginMessage(PluginMessageEvent event) { return; } + // Now that's sure, it's for us, so let's go + event.setCancelled(true); + // For now that's the only type of message the server is able to receive String task = in.readUTF(); switch (task) { - case "LOGIN:": + case "Login": authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); break; - case "LOGOUT:": + case "Logout": authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); break; } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java index a44fe8e..62412c5 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java @@ -36,7 +36,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager, BungeeMessageSender pluginMessageSender) { + public BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager, BungeeMessageSender pluginMessageSender) { this.authPlayerManager = authPlayerManager; this.pluginMessageSender = pluginMessageSender; reload(settings); diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java b/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java index c9d6755..efa387c 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java +++ b/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java @@ -13,7 +13,7 @@ public class BungeeMessageSender { private TaskScheduler scheduler; @Inject - BungeeMessageSender(AuthMeBungee plugin, TaskScheduler scheduler) { + public BungeeMessageSender(AuthMeBungee plugin, TaskScheduler scheduler) { this.plugin = plugin; this.scheduler = scheduler; } diff --git a/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java index ee98762..f95f285 100644 --- a/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java @@ -5,10 +5,8 @@ import ch.jalu.configme.migration.PlainMigrationService; import ch.jalu.configme.resource.PropertyResource; import ch.jalu.configme.resource.YamlFileResource; -import fr.xephi.authmebungee.common.annotations.DataFolder; import fr.xephi.authmebungee.common.utils.FileUtils; -import javax.inject.Inject; import javax.inject.Provider; import java.io.File; @@ -17,13 +15,12 @@ */ public abstract class SettingsProvider implements Provider { - @Inject - @DataFolder private File dataFolder; private Class properties; - protected SettingsProvider(Class properties) { + protected SettingsProvider(File dataFolder, Class properties) { + this.dataFolder = dataFolder; this.properties = properties; } diff --git a/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java b/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java index a742c55..40284e2 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java @@ -45,7 +45,7 @@ public void onEnable() { private void setupInjector() { // Setup injector - injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authmebungee.spigot").create(); + injector = new InjectorBuilder().addDefaultHandlers("").create(); injector.register(AuthMeBungeeSpigot.class, this); injector.register(Server.class, getServer()); injector.register(PluginManager.class, getServer().getPluginManager()); diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java index e41312f..f113d62 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java @@ -1,10 +1,14 @@ package fr.xephi.authmebungee.spigot.config; +import fr.xephi.authmebungee.common.annotations.DataFolder; import fr.xephi.authmebungee.common.config.SettingsProvider; +import java.io.File; +import javax.inject.Inject; public class SpigotSettingsProvider extends SettingsProvider { - SpigotSettingsProvider() { - super(SpigotConfigProperties.class); + @Inject + SpigotSettingsProvider(@DataFolder File dataFolder) { + super(dataFolder, SpigotConfigProperties.class); } } diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java index 92d2fea..96dd320 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java @@ -26,7 +26,8 @@ public SpigotAuthMeListener(SpigotMessageSender messageSender) { public void onAuthMeLogin(LoginEvent event) { final Player player = event.getPlayer(); try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { - out.writeUTF("LOGIN:"); + out.writeUTF("AuthMeBungee"); + out.writeUTF("Login"); out.writeUTF(player.getName()); messageSender.sendData(bout.toByteArray(), true); } catch (IOException e) { @@ -38,7 +39,8 @@ public void onAuthMeLogin(LoginEvent event) { public void onAuthMeLogout(LogoutEvent event) { final Player player = event.getPlayer(); try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { - out.writeUTF("LOGOUT:"); + out.writeUTF("AuthMeBungee"); + out.writeUTF("Logout"); out.writeUTF(player.getName()); messageSender.sendData(bout.toByteArray(), true); } catch (IOException e) { diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java index 491e9eb..29d9994 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java @@ -21,7 +21,7 @@ public class SpigotMessageListener implements PluginMessageListener, SettingsDep private String autoLoginMessage; @Inject - SpigotMessageListener(Server server, SettingsManager settings, AuthMeApi authMeApi) { + public SpigotMessageListener(Server server, SettingsManager settings, AuthMeApi authMeApi) { this.server = server; this.authMeApi = authMeApi; reload(settings); @@ -39,8 +39,7 @@ public void onPluginMessageReceived(String channel, Player connection, byte[] me } ByteArrayDataInput in = ByteStreams.newDataInput(message); - String type = in.readUTF(); - if (!type.equals("AUTOLOGIN:")) { + if (!(in.readUTF().equals("AuthMeBungee") && in.readUTF().equals("AutoLogin"))) { return; } diff --git a/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java b/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java index 9766ac3..9e1e893 100644 --- a/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java +++ b/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java @@ -12,7 +12,7 @@ public class SpigotMessageSender { private Server server; @Inject - SpigotMessageSender(AuthMeBungeeSpigot plugin, Server server) { + public SpigotMessageSender(AuthMeBungeeSpigot plugin, Server server) { this.plugin = plugin; this.server = server; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f172a4b..d602f7e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ${project.name} -main: fr.xephi.authmebungee.spigot.AuthMeBungee +main: fr.xephi.authmebungee.spigot.AuthMeBungeeSpigot version: ${project.version} authors: [CryLegend, AuthMeTeam] depend: [AuthMe] From a30befaf60c3c67d449f7b37574b4812a538dcf2 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 6 Nov 2017 00:52:24 +0100 Subject: [PATCH 016/114] Cleanup, prepare for authme 5.4 --- pom.xml | 31 +++------- .../{bungeecord => }/AuthMeBungee.java | 19 +++--- .../{common => }/annotations/DataFolder.java | 2 +- .../services/BungeeMessageSender.java | 49 --------------- .../commands/BungeeReloadCommand.java | 2 +- .../config/BungeeConfigProperties.java | 2 +- .../config/BungeeSettingsProvider.java | 8 +-- .../config/SettingsDependent.java | 2 +- .../{common => }/config/SettingsProvider.java | 4 +- .../{bungeecord => }/data/AuthPlayer.java | 11 +++- .../listeners/BungeeMessageListener.java | 10 +-- .../listeners/BungeePlayerListener.java | 22 +++---- .../services/AuthPlayerManager.java | 10 +-- .../spigot/AuthMeBungeeSpigot.java | 56 ----------------- .../spigot/commands/SpigotReloadCommand.java | 26 -------- .../spigot/config/SpigotConfigProperties.java | 17 ------ .../spigot/config/SpigotSettingsProvider.java | 14 ----- .../listeners/SpigotAuthMeListener.java | 50 --------------- .../listeners/SpigotMessageListener.java | 61 ------------------- .../spigot/services/SpigotMessageSender.java | 42 ------------- .../{common => }/utils/FileUtils.java | 2 +- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 13 ---- 23 files changed, 55 insertions(+), 400 deletions(-) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/AuthMeBungee.java (73%) rename src/main/java/fr/xephi/authmebungee/{common => }/annotations/DataFolder.java (87%) delete mode 100644 src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/commands/BungeeReloadCommand.java (93%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/config/BungeeConfigProperties.java (97%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/config/BungeeSettingsProvider.java (60%) rename src/main/java/fr/xephi/authmebungee/{common => }/config/SettingsDependent.java (88%) rename src/main/java/fr/xephi/authmebungee/{common => }/config/SettingsProvider.java (92%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/data/AuthPlayer.java (73%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/listeners/BungeeMessageListener.java (88%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/listeners/BungeePlayerListener.java (85%) rename src/main/java/fr/xephi/authmebungee/{bungeecord => }/services/AuthPlayerManager.java (77%) delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java delete mode 100644 src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java rename src/main/java/fr/xephi/authmebungee/{common => }/utils/FileUtils.java (94%) delete mode 100644 src/main/resources/plugin.yml diff --git a/pom.xml b/pom.xml index 5723615..0c7771c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT jar AuthMeBungee @@ -44,9 +44,7 @@ UTF-8 - 1.12-SNAPSHOT - 1.12-R0.1-SNAPSHOT - 5.3.3-SNAPSHOT + 5.4.0-SNAPSHOT @@ -68,7 +66,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.6.1 + 3.7.0 1.8 1.8 @@ -78,7 +76,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.0.0 + 3.1.0 false @@ -101,11 +99,6 @@ oss-repo http://oss.sonatype.org/content/groups/public - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - xephi-repo @@ -118,7 +111,7 @@ ch.jalu injector - 0.3 + 0.4.1 compile @@ -126,7 +119,7 @@ ch.jalu configme - 0.3 + 0.4 compile @@ -134,15 +127,7 @@ net.md-5 bungeecord-api - ${bungeeVersion} - provided - - - - - org.spigotmc - spigot-api - ${spigotVersion} + 1.12-SNAPSHOT provided @@ -150,7 +135,7 @@ fr.xephi authme - ${authMeVersion} + 5.4-SNAPSHOT provided diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java similarity index 73% rename from src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java rename to src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index d523135..5ca838f 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -1,15 +1,14 @@ -package fr.xephi.authmebungee.bungeecord; +package fr.xephi.authmebungee; import ch.jalu.configme.SettingsManager; import ch.jalu.injector.Injector; import ch.jalu.injector.InjectorBuilder; -import fr.xephi.authmebungee.bungeecord.commands.BungeeReloadCommand; -import fr.xephi.authmebungee.bungeecord.config.BungeeSettingsProvider; -import fr.xephi.authmebungee.bungeecord.listeners.BungeeMessageListener; -import fr.xephi.authmebungee.bungeecord.listeners.BungeePlayerListener; -import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; -import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; -import fr.xephi.authmebungee.common.annotations.DataFolder; +import fr.xephi.authmebungee.annotations.DataFolder; +import fr.xephi.authmebungee.commands.BungeeReloadCommand; +import fr.xephi.authmebungee.config.BungeeSettingsProvider; +import fr.xephi.authmebungee.listeners.BungeeMessageListener; +import fr.xephi.authmebungee.listeners.BungeePlayerListener; +import fr.xephi.authmebungee.services.AuthPlayerManager; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; @@ -22,7 +21,6 @@ public class AuthMeBungee extends Plugin { private Injector injector; private SettingsManager settings; private AuthPlayerManager authPlayerManager; - private BungeeMessageSender pluginMessageSender; public AuthMeBungee() { } @@ -36,9 +34,8 @@ public void onEnable() { // Get singletons from the injector settings = injector.getSingleton(SettingsManager.class); authPlayerManager = injector.getSingleton(AuthPlayerManager.class); - pluginMessageSender = injector.getSingleton(BungeeMessageSender.class); - for(ProxiedPlayer player : getProxy().getPlayers()) { + for (ProxiedPlayer player : getProxy().getPlayers()) { authPlayerManager.addAuthPlayer(player); } diff --git a/src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java b/src/main/java/fr/xephi/authmebungee/annotations/DataFolder.java similarity index 87% rename from src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java rename to src/main/java/fr/xephi/authmebungee/annotations/DataFolder.java index 64fff55..69fb6b2 100644 --- a/src/main/java/fr/xephi/authmebungee/common/annotations/DataFolder.java +++ b/src/main/java/fr/xephi/authmebungee/annotations/DataFolder.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.common.annotations; +package fr.xephi.authmebungee.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java b/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java deleted file mode 100644 index efa387c..0000000 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/services/BungeeMessageSender.java +++ /dev/null @@ -1,49 +0,0 @@ -package fr.xephi.authmebungee.bungeecord.services; - -import fr.xephi.authmebungee.bungeecord.AuthMeBungee; -import net.md_5.bungee.api.config.ServerInfo; -import net.md_5.bungee.api.connection.Server; -import net.md_5.bungee.api.scheduler.TaskScheduler; - -import javax.inject.Inject; - -public class BungeeMessageSender { - - private AuthMeBungee plugin; - private TaskScheduler scheduler; - - @Inject - public BungeeMessageSender(AuthMeBungee plugin, TaskScheduler scheduler) { - this.plugin = plugin; - this.scheduler = scheduler; - } - - public void sendData(ServerInfo server, byte[] bytes, boolean async) { - SendMessage sendMessage = new SendMessage(server, bytes); - if (async) { - scheduler.runAsync(plugin, sendMessage); - } else { - sendMessage.run(); - } - } - - public void sendData(Server server, byte[] bytes, boolean async) { - sendData(server.getInfo(), bytes, async); - } - - private class SendMessage implements Runnable { - - private ServerInfo server; - private byte[] bytes; - - public SendMessage(ServerInfo server, byte[] bytes) { - this.server = server; - this.bytes = bytes; - } - - @Override - public void run() { - server.sendData("BungeeCord", bytes); - } - } -} diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java similarity index 93% rename from src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java rename to src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java index 1b6255b..cb9df6b 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/commands/BungeeReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.bungeecord.commands; +package fr.xephi.authmebungee.commands; import ch.jalu.configme.SettingsManager; import net.md_5.bungee.api.ChatColor; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java similarity index 97% rename from src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java rename to src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index beaff2b..e73e669 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.bungeecord.config; +package fr.xephi.authmebungee.config; import ch.jalu.configme.Comment; import ch.jalu.configme.SettingsHolder; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java similarity index 60% rename from src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java rename to src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java index 832f623..51fc018 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/config/BungeeSettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java @@ -1,9 +1,9 @@ -package fr.xephi.authmebungee.bungeecord.config; +package fr.xephi.authmebungee.config; + +import fr.xephi.authmebungee.annotations.DataFolder; -import fr.xephi.authmebungee.common.annotations.DataFolder; -import fr.xephi.authmebungee.common.config.SettingsProvider; -import java.io.File; import javax.inject.Inject; +import java.io.File; public class BungeeSettingsProvider extends SettingsProvider { diff --git a/src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java b/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java similarity index 88% rename from src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java rename to src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java index adc63d5..5414024 100644 --- a/src/main/java/fr/xephi/authmebungee/common/config/SettingsDependent.java +++ b/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.common.config; +package fr.xephi.authmebungee.config; import ch.jalu.configme.SettingsManager; diff --git a/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java similarity index 92% rename from src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java rename to src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java index f95f285..4ec2675 100644 --- a/src/main/java/fr/xephi/authmebungee/common/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java @@ -1,11 +1,11 @@ -package fr.xephi.authmebungee.common.config; +package fr.xephi.authmebungee.config; import ch.jalu.configme.SettingsHolder; import ch.jalu.configme.SettingsManager; import ch.jalu.configme.migration.PlainMigrationService; import ch.jalu.configme.resource.PropertyResource; import ch.jalu.configme.resource.YamlFileResource; -import fr.xephi.authmebungee.common.utils.FileUtils; +import fr.xephi.authmebungee.utils.FileUtils; import javax.inject.Provider; import java.io.File; diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java similarity index 73% rename from src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java rename to src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java index faaed74..fd33900 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/data/AuthPlayer.java +++ b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.bungeecord.data; +package fr.xephi.authmebungee.data; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -14,7 +14,7 @@ public class AuthPlayer { private boolean isLogged; public AuthPlayer(String name, boolean isLogged) { - this.name = name; + this.name = name.toLowerCase(); this.isLogged = isLogged; } @@ -35,7 +35,12 @@ public void setLogged(boolean isLogged) { } public ProxiedPlayer getPlayer() { - return proxy.getPlayer(getName()); + for (ProxiedPlayer current : proxy.getPlayers()) { + if (current.getName().equalsIgnoreCase(name)) { + return current; + } + } + return null; } public boolean isOnline() { diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java similarity index 88% rename from src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java rename to src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 470238a..bab72c1 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -1,6 +1,6 @@ -package fr.xephi.authmebungee.bungeecord.listeners; +package fr.xephi.authmebungee.listeners; -import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; +import fr.xephi.authmebungee.services.AuthPlayerManager; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.plugin.Listener; @@ -40,7 +40,7 @@ public void onPluginMessage(PluginMessageEvent event) { // Read the plugin message DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); - if (!in.readUTF().equals("AuthMeBungee")) { + if (!in.readUTF().equals("AuthMe")) { return; } @@ -51,10 +51,10 @@ public void onPluginMessage(PluginMessageEvent event) { String task = in.readUTF(); switch (task) { - case "Login": + case "login": authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); break; - case "Logout": + case "logout": authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); break; } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java similarity index 85% rename from src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java rename to src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 62412c5..934872a 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -1,11 +1,10 @@ -package fr.xephi.authmebungee.bungeecord.listeners; +package fr.xephi.authmebungee.listeners; import ch.jalu.configme.SettingsManager; -import fr.xephi.authmebungee.bungeecord.config.BungeeConfigProperties; -import fr.xephi.authmebungee.bungeecord.data.AuthPlayer; -import fr.xephi.authmebungee.bungeecord.services.AuthPlayerManager; -import fr.xephi.authmebungee.bungeecord.services.BungeeMessageSender; -import fr.xephi.authmebungee.common.config.SettingsDependent; +import fr.xephi.authmebungee.config.BungeeConfigProperties; +import fr.xephi.authmebungee.config.SettingsDependent; +import fr.xephi.authmebungee.data.AuthPlayer; +import fr.xephi.authmebungee.services.AuthPlayerManager; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -24,7 +23,6 @@ public class BungeePlayerListener implements Listener, SettingsDependent { // Services private AuthPlayerManager authPlayerManager; - private BungeeMessageSender pluginMessageSender; // Settings private boolean isAutoLogin; @@ -36,9 +34,8 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - public BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager, BungeeMessageSender pluginMessageSender) { + public BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; - this.pluginMessageSender = pluginMessageSender; reload(settings); } @@ -122,7 +119,7 @@ public void onServerConnect(ServerConnectEvent event) { @EventHandler public void onServerSwitch(ServerSwitchEvent event) { - if(!isAutoLogin) { + if (!isAutoLogin) { return; } @@ -136,12 +133,11 @@ public void onServerSwitch(ServerSwitchEvent event) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout); - out.writeUTF("AuthMeBungee"); + out.writeUTF("AuthMe"); out.writeUTF("AutoLogin"); out.writeUTF(authPlayer.getName()); - // Not using async as bungeecord already use multiple threads for player connections - pluginMessageSender.sendData(event.getPlayer().getServer(), bout.toByteArray(), false); + event.getPlayer().getServer().sendData("BungeeCord", bout.toByteArray()); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java b/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java similarity index 77% rename from src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java rename to src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java index 752b86b..e1499f6 100644 --- a/src/main/java/fr/xephi/authmebungee/bungeecord/services/AuthPlayerManager.java +++ b/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java @@ -1,6 +1,6 @@ -package fr.xephi.authmebungee.bungeecord.services; +package fr.xephi.authmebungee.services; -import fr.xephi.authmebungee.bungeecord.data.AuthPlayer; +import fr.xephi.authmebungee.data.AuthPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.HashMap; @@ -21,11 +21,11 @@ public void addAuthPlayer(AuthPlayer player) { } public void addAuthPlayer(ProxiedPlayer player) { - addAuthPlayer(new AuthPlayer(player.getName())); + addAuthPlayer(new AuthPlayer(player.getName().toLowerCase())); } public void removeAuthPlayer(String name) { - players.remove(name); + players.remove(name.toLowerCase()); } public void removeAuthPlayer(ProxiedPlayer player) { @@ -33,7 +33,7 @@ public void removeAuthPlayer(ProxiedPlayer player) { } public AuthPlayer getAuthPlayer(String name) { - return players.get(name); + return players.get(name.toLowerCase()); } public AuthPlayer getAuthPlayer(ProxiedPlayer player) { diff --git a/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java b/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java deleted file mode 100644 index 40284e2..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/AuthMeBungeeSpigot.java +++ /dev/null @@ -1,56 +0,0 @@ -package fr.xephi.authmebungee.spigot; - -import ch.jalu.configme.SettingsManager; -import ch.jalu.injector.Injector; -import ch.jalu.injector.InjectorBuilder; -import fr.xephi.authme.api.v3.AuthMeApi; -import fr.xephi.authmebungee.common.annotations.DataFolder; -import fr.xephi.authmebungee.spigot.commands.SpigotReloadCommand; -import fr.xephi.authmebungee.spigot.config.SpigotSettingsProvider; -import fr.xephi.authmebungee.spigot.listeners.SpigotAuthMeListener; -import fr.xephi.authmebungee.spigot.listeners.SpigotMessageListener; -import fr.xephi.authmebungee.spigot.services.SpigotMessageSender; -import org.bukkit.Server; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; - -public class AuthMeBungeeSpigot extends JavaPlugin { - - // Instances - private Injector injector; - private SettingsManager settings; - private SpigotMessageSender pluginMessageSender; - - public AuthMeBungeeSpigot() { - } - - @Override - public void onEnable() { - - // Prepare the injector and register stuff - setupInjector(); - - // Get singletons from the injector - settings = injector.getSingleton(SettingsManager.class); - pluginMessageSender = injector.getSingleton(SpigotMessageSender.class); - - // Register commands - getCommand("abreload").setExecutor(injector.getSingleton(SpigotReloadCommand.class)); - - // Registering event listeners - getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); - getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", injector.getSingleton(SpigotMessageListener.class)); - getServer().getPluginManager().registerEvents(injector.getSingleton(SpigotAuthMeListener.class), this); - } - - private void setupInjector() { - // Setup injector - injector = new InjectorBuilder().addDefaultHandlers("").create(); - injector.register(AuthMeBungeeSpigot.class, this); - injector.register(Server.class, getServer()); - injector.register(PluginManager.class, getServer().getPluginManager()); - injector.provide(DataFolder.class, getDataFolder()); - injector.registerProvider(SettingsManager.class, SpigotSettingsProvider.class); - injector.register(AuthMeApi.class, AuthMeApi.getInstance()); - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java b/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java deleted file mode 100644 index ddb49dd..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/commands/SpigotReloadCommand.java +++ /dev/null @@ -1,26 +0,0 @@ -package fr.xephi.authmebungee.spigot.commands; - -import ch.jalu.configme.SettingsManager; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -import javax.inject.Inject; - -public class SpigotReloadCommand implements CommandExecutor { - - private SettingsManager settings; - - @Inject - SpigotReloadCommand(SettingsManager settings) { - this.settings = settings; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - settings.reload(); - sender.sendMessage(ChatColor.GREEN + "AuthMeBungee configuration reloaded!"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java deleted file mode 100644 index fcf73ba..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotConfigProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.xephi.authmebungee.spigot.config; - -import ch.jalu.configme.Comment; -import ch.jalu.configme.SettingsHolder; -import ch.jalu.configme.properties.Property; - -import static ch.jalu.configme.properties.PropertyInitializer.newProperty; - -public class SpigotConfigProperties implements SettingsHolder { - - @Comment("The message that is sent to the player after a successful auto-login") - public static final Property AUTOLOGIN_MESSAGE = - newProperty("autologin.message", "&2Your session has been resumed by the bridge."); - - private SpigotConfigProperties() { - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java deleted file mode 100644 index f113d62..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/config/SpigotSettingsProvider.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.xephi.authmebungee.spigot.config; - -import fr.xephi.authmebungee.common.annotations.DataFolder; -import fr.xephi.authmebungee.common.config.SettingsProvider; -import java.io.File; -import javax.inject.Inject; - -public class SpigotSettingsProvider extends SettingsProvider { - - @Inject - SpigotSettingsProvider(@DataFolder File dataFolder) { - super(dataFolder, SpigotConfigProperties.class); - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java deleted file mode 100644 index 96dd320..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotAuthMeListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package fr.xephi.authmebungee.spigot.listeners; - -import fr.xephi.authme.events.LoginEvent; -import fr.xephi.authme.events.LogoutEvent; -import fr.xephi.authmebungee.spigot.services.SpigotMessageSender; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; - -import javax.inject.Inject; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class SpigotAuthMeListener implements Listener { - - private SpigotMessageSender messageSender; - - @Inject - public SpigotAuthMeListener(SpigotMessageSender messageSender) { - this.messageSender = messageSender; - } - - @EventHandler(priority = EventPriority.HIGH) - public void onAuthMeLogin(LoginEvent event) { - final Player player = event.getPlayer(); - try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { - out.writeUTF("AuthMeBungee"); - out.writeUTF("Login"); - out.writeUTF(player.getName()); - messageSender.sendData(bout.toByteArray(), true); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void onAuthMeLogout(LogoutEvent event) { - final Player player = event.getPlayer(); - try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bout)) { - out.writeUTF("AuthMeBungee"); - out.writeUTF("Logout"); - out.writeUTF(player.getName()); - messageSender.sendData(bout.toByteArray(), true); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java b/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java deleted file mode 100644 index 29d9994..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/listeners/SpigotMessageListener.java +++ /dev/null @@ -1,61 +0,0 @@ -package fr.xephi.authmebungee.spigot.listeners; - -import ch.jalu.configme.SettingsManager; -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; -import fr.xephi.authme.api.v3.AuthMeApi; -import fr.xephi.authmebungee.common.config.SettingsDependent; -import fr.xephi.authmebungee.spigot.config.SpigotConfigProperties; -import org.bukkit.ChatColor; -import org.bukkit.Server; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageListener; - -import javax.inject.Inject; - -public class SpigotMessageListener implements PluginMessageListener, SettingsDependent { - - private Server server; - private AuthMeApi authMeApi; - - private String autoLoginMessage; - - @Inject - public SpigotMessageListener(Server server, SettingsManager settings, AuthMeApi authMeApi) { - this.server = server; - this.authMeApi = authMeApi; - reload(settings); - } - - @Override - public void reload(SettingsManager settings) { - autoLoginMessage = ChatColor.translateAlternateColorCodes('&', settings.getProperty(SpigotConfigProperties.AUTOLOGIN_MESSAGE)); - } - - @Override - public void onPluginMessageReceived(String channel, Player connection, byte[] message) { - if (!channel.equals("BungeeCord")) { - return; - } - ByteArrayDataInput in = ByteStreams.newDataInput(message); - - if (!(in.readUTF().equals("AuthMeBungee") && in.readUTF().equals("AutoLogin"))) { - return; - } - - String name = in.readUTF(); - Player player = server.getPlayerExact(name); - if (player == null) { - return; - } - - if (authMeApi.isAuthenticated(player)) { - return; - } - - authMeApi.forceLogin(player); - if (!autoLoginMessage.isEmpty()) { - player.sendMessage(autoLoginMessage); - } - } -} diff --git a/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java b/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java deleted file mode 100644 index 9e1e893..0000000 --- a/src/main/java/fr/xephi/authmebungee/spigot/services/SpigotMessageSender.java +++ /dev/null @@ -1,42 +0,0 @@ -package fr.xephi.authmebungee.spigot.services; - -import fr.xephi.authmebungee.spigot.AuthMeBungeeSpigot; -import org.bukkit.Server; -import org.bukkit.scheduler.BukkitRunnable; - -import javax.inject.Inject; - -public class SpigotMessageSender { - - private AuthMeBungeeSpigot plugin; - private Server server; - - @Inject - public SpigotMessageSender(AuthMeBungeeSpigot plugin, Server server) { - this.plugin = plugin; - this.server = server; - } - - public void sendData(byte[] bytes, boolean async) { - SendMessage sendMessage = new SendMessage(bytes); - if (async) { - sendMessage.runTaskAsynchronously(plugin); - } else { - sendMessage.run(); - } - } - - private class SendMessage extends BukkitRunnable { - - private byte[] bytes; - - public SendMessage(byte[] bytes) { - this.bytes = bytes; - } - - @Override - public void run() { - server.sendPluginMessage(plugin, "BungeeCord", bytes); - } - } -} diff --git a/src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java b/src/main/java/fr/xephi/authmebungee/utils/FileUtils.java similarity index 94% rename from src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java rename to src/main/java/fr/xephi/authmebungee/utils/FileUtils.java index 988769b..51f31c3 100644 --- a/src/main/java/fr/xephi/authmebungee/common/utils/FileUtils.java +++ b/src/main/java/fr/xephi/authmebungee/utils/FileUtils.java @@ -1,4 +1,4 @@ -package fr.xephi.authmebungee.common.utils; +package fr.xephi.authmebungee.utils; import java.io.File; import java.io.IOException; diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 2b1c507..97c059f 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ name: ${project.name} -main: fr.xephi.authmebungee.bungeecord.AuthMeBungee +main: AuthMeBungee version: ${project.version} authors: [CryLegend, AuthMeTeam] diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index d602f7e..0000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: ${project.name} -main: fr.xephi.authmebungee.spigot.AuthMeBungeeSpigot -version: ${project.version} -authors: [CryLegend, AuthMeTeam] -depend: [AuthMe] -commands: - abreload: - description: Reloads the AuthMeBungee config file - permission: authmebungee.reload -permissions: - authmebungee.reload: - description: Allows to reload the config file - default: op From b2ea844a9b8e83d9c901fdbdc809e8b11b9af3de Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 6 Nov 2017 00:54:42 +0100 Subject: [PATCH 017/114] Minor change in the messaging protocol --- .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 934872a..d71f7e8 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -134,7 +134,7 @@ public void onServerSwitch(ServerSwitchEvent event) { DataOutputStream out = new DataOutputStream(bout); out.writeUTF("AuthMe"); - out.writeUTF("AutoLogin"); + out.writeUTF("bungeelogin"); out.writeUTF(authPlayer.getName()); event.getPlayer().getServer().sendData("BungeeCord", bout.toByteArray()); From 15bcba6fddc849a89b3a58a90aa441e7fa60c2a0 Mon Sep 17 00:00:00 2001 From: DoNotSpamPls Date: Sat, 11 Nov 2017 12:16:46 +0200 Subject: [PATCH 018/114] The plugin doesn't require Spigot anymore, does it? --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d8b625e..bd7913c 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,9 @@ AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin opti ## Installation 1. Download AuthMeBungee package -2. Place AuthMeBungee-Bungeecord.jar into your BungeeCord's plugin folder -3. Place AuthMeBungee-Bukkit.jar into your Bukkit servers plugin folders +2. Place AuthMeBungee.jar into your BungeeCord's plugin folder 4. Restart everything -5. Configure the bungee-side plugin (don't forget to config authServers) +5. Configure the plugin (don't forget to config authServers) 6. Enjoy! **Please follow these steps and configure the plugin before saying it doesn't work!** From fc40438de1b59d6a7f94587264787151ac652c0a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 11 Nov 2017 16:56:59 +0100 Subject: [PATCH 019/114] Fix package in plugin description file Fixes #7 --- src/main/resources/bungee.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 97c059f..1939f12 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ name: ${project.name} -main: AuthMeBungee +main: fr.xephi.authmebungee.AuthMeBungee version: ${project.version} authors: [CryLegend, AuthMeTeam] From 6617c1aa396015130005a842b81c402a81316e18 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 1 Dec 2017 16:58:22 +0100 Subject: [PATCH 020/114] Add support links --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index bd7913c..a2a8f5e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ This plugin acts like a bridge between your bukkit servers and your BungeeCord i AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin option that allow you to switch between your servers without having to perform login command again. +## Support +- [GitHub issue tracker](https://github.com/AuthMe/AuthMeBungee/issues) +- [Spigot page](https://www.spigotmc.org/resources/authmebungee.50219/) +- [Discord](https://discord.gg/Vn9eCyE) + ## Requirements - Java 1.8+ From 003c7f97bfe8aa53748b8becf403911c7838c1bc Mon Sep 17 00:00:00 2001 From: sgdc3 Date: Fri, 1 Dec 2017 18:10:04 +0100 Subject: [PATCH 021/114] Add metrics, pom enhancements --- pom.xml | 49 ++++++++++++++----- .../fr/xephi/authmebungee/AuthMeBungee.java | 5 +- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 0c7771c..8b56863 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,6 @@ UTF-8 - 5.4.0-SNAPSHOT @@ -79,6 +78,32 @@ 3.1.0 false + + + javax.annotation + fr.xephi.authmebungee.libs.javax.annotation + + + javax.inject + fr.xephi.authmebungee.libs.javax.inject + + + ch.jalu.injector + fr.xephi.authmebungee.libs.jalu.injector + + + org.yaml.snakeyaml + fr.xephi.authmebungee.libs.yaml.snakeyaml + + + ch.jalu.configme + fr.xephi.authmebungee.libs.jalu.configme + + + org.bstats + fr.xephi.authmebungee + + @@ -94,24 +119,24 @@ - + oss-repo http://oss.sonatype.org/content/groups/public - + - xephi-repo - http://ci.xephi.fr/plugin/repository/everything/ + bstats-repo + http://repo.bstats.org/content/repositories/releases/ - + ch.jalu injector - 0.4.1 + 1.0 compile @@ -131,12 +156,12 @@ provided - + - fr.xephi - authme - 5.4-SNAPSHOT - provided + org.bstats + bstats-bungeecord + 1.2 + compile diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index 5ca838f..3cab864 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -14,6 +14,7 @@ import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.PluginManager; import net.md_5.bungee.api.scheduler.TaskScheduler; +import org.bstats.bungeecord.Metrics; public class AuthMeBungee extends Plugin { @@ -27,7 +28,6 @@ public AuthMeBungee() { @Override public void onEnable() { - // Prepare the injector and register stuff setupInjector(); @@ -45,6 +45,9 @@ public void onEnable() { // Registering event listeners getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeeMessageListener.class)); getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeePlayerListener.class)); + + // Send metrics data + new Metrics(this); } @Override From 5823981f3514ea6ffa3cdbf999e8cf5b777d4a47 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 3 Dec 2017 20:56:00 +0100 Subject: [PATCH 022/114] Fix ProxyServer usage in AuthPlayer --- src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java index fd33900..8e0f26c 100644 --- a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java +++ b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java @@ -3,13 +3,8 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; -import javax.inject.Inject; - public class AuthPlayer { - @Inject - private ProxyServer proxy; - private String name; private boolean isLogged; @@ -35,7 +30,7 @@ public void setLogged(boolean isLogged) { } public ProxiedPlayer getPlayer() { - for (ProxiedPlayer current : proxy.getPlayers()) { + for (ProxiedPlayer current : ProxyServer.getInstance().getPlayers()) { if (current.getName().equalsIgnoreCase(name)) { return current; } From 0b9323706038dd61c5a4d4b1e848539f0031e045 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 3 Dec 2017 21:02:57 +0100 Subject: [PATCH 023/114] #10 Remove ServerConnectEvent listener we should only check the ServerSwitchEvent --- .../listeners/BungeePlayerListener.java | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index d71f7e8..ed48ecb 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -5,10 +5,11 @@ import fr.xephi.authmebungee.config.SettingsDependent; import fr.xephi.authmebungee.data.AuthPlayer; import fr.xephi.authmebungee.services.AuthPlayerManager; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.*; +import net.md_5.bungee.api.event.ChatEvent; +import net.md_5.bungee.api.event.PlayerDisconnectEvent; +import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.event.ServerSwitchEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; @@ -95,28 +96,6 @@ public void onChat(ChatEvent event) { event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) - public void onServerConnect(ServerConnectEvent event) { - if (!isServerSwitchRequiresAuth || event.isCancelled()) { - return; - } - - ProxiedPlayer player = event.getPlayer(); - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (authPlayer.isLogged()) { - return; - } - - // If player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection - String server = event.getTarget().getName(); - if (!authServers.contains(server)) { - event.setCancelled(true); - TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); - reasonMessage.setColor(ChatColor.RED); - player.sendMessage(reasonMessage); - } - } - @EventHandler public void onServerSwitch(ServerSwitchEvent event) { if (!isAutoLogin) { From 261fbce4f3226ef4dc9c5bebfe8e553b046f626e Mon Sep 17 00:00:00 2001 From: Mat't Date: Sun, 3 Dec 2017 23:20:03 +0100 Subject: [PATCH 024/114] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2a8f5e..28e9906 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin opti ## Requirements - Java 1.8+ -- BungeeCord/Waterfall 1.7+ +- BungeeCord/Waterfall/Travertine 1.7+ - CraftBukkit/Spigot/Paper/Tacospigot 1.7.10+ ## Installation From 34852a0188b9af053efb0ffdab70fce71ce72129 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 4 Dec 2017 12:46:13 +0100 Subject: [PATCH 025/114] Revert "#10 Remove ServerConnectEvent listener" This reverts commit 0b9323706038dd61c5a4d4b1e848539f0031e045. --- .../listeners/BungeePlayerListener.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index ed48ecb..d71f7e8 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -5,11 +5,10 @@ import fr.xephi.authmebungee.config.SettingsDependent; import fr.xephi.authmebungee.data.AuthPlayer; import fr.xephi.authmebungee.services.AuthPlayerManager; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.ChatEvent; -import net.md_5.bungee.api.event.PlayerDisconnectEvent; -import net.md_5.bungee.api.event.PostLoginEvent; -import net.md_5.bungee.api.event.ServerSwitchEvent; +import net.md_5.bungee.api.event.*; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; @@ -96,6 +95,28 @@ public void onChat(ChatEvent event) { event.setCancelled(true); } + @EventHandler(priority = EventPriority.HIGHEST) + public void onServerConnect(ServerConnectEvent event) { + if (!isServerSwitchRequiresAuth || event.isCancelled()) { + return; + } + + ProxiedPlayer player = event.getPlayer(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (authPlayer.isLogged()) { + return; + } + + // If player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection + String server = event.getTarget().getName(); + if (!authServers.contains(server)) { + event.setCancelled(true); + TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); + reasonMessage.setColor(ChatColor.RED); + player.sendMessage(reasonMessage); + } + } + @EventHandler public void onServerSwitch(ServerSwitchEvent event) { if (!isAutoLogin) { From 6183f4dbfd89220f6fe764ff2e1531361fc3008d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 4 Dec 2017 23:58:26 +0100 Subject: [PATCH 026/114] Fixes and cleanup --- .../fr/xephi/authmebungee/AuthMeBungee.java | 12 ++++ .../commands/BungeeReloadCommand.java | 1 + .../config/BungeeConfigProperties.java | 1 + .../config/BungeeSettingsProvider.java | 1 + .../config/SettingsDependent.java | 1 + .../authmebungee/config/SettingsProvider.java | 1 + .../xephi/authmebungee/data/AuthPlayer.java | 15 ---- .../listeners/BungeeMessageListener.java | 51 ++++++-------- .../listeners/BungeePlayerListener.java | 68 +++++++++++++------ .../services/AuthPlayerManager.java | 3 +- 10 files changed, 87 insertions(+), 67 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index 3cab864..e6395b2 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -5,6 +5,7 @@ import ch.jalu.injector.InjectorBuilder; import fr.xephi.authmebungee.annotations.DataFolder; import fr.xephi.authmebungee.commands.BungeeReloadCommand; +import fr.xephi.authmebungee.config.BungeeConfigProperties; import fr.xephi.authmebungee.config.BungeeSettingsProvider; import fr.xephi.authmebungee.listeners.BungeeMessageListener; import fr.xephi.authmebungee.listeners.BungeePlayerListener; @@ -16,6 +17,8 @@ import net.md_5.bungee.api.scheduler.TaskScheduler; import org.bstats.bungeecord.Metrics; +import java.util.logging.Logger; + public class AuthMeBungee extends Plugin { // Instances @@ -35,6 +38,13 @@ public void onEnable() { settings = injector.getSingleton(SettingsManager.class); authPlayerManager = injector.getSingleton(AuthPlayerManager.class); + // Print some config information + getLogger().info("Current auth servers:"); + for (String authServer : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { + getLogger().info("> " + authServer); + } + + // Add online players (plugin hotswap, just in case) for (ProxiedPlayer player : getProxy().getPlayers()) { authPlayerManager.addAuthPlayer(player); } @@ -59,6 +69,7 @@ public void onDisable() { private void setupInjector() { // Setup injector injector = new InjectorBuilder().addDefaultHandlers("").create(); + injector.register(Logger.class, getLogger()); injector.register(AuthMeBungee.class, this); injector.register(ProxyServer.class, getProxy()); injector.register(PluginManager.class, getProxy().getPluginManager()); @@ -66,4 +77,5 @@ private void setupInjector() { injector.provide(DataFolder.class, getDataFolder()); injector.registerProvider(SettingsManager.class, BungeeSettingsProvider.class); } + } diff --git a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java index cb9df6b..54f33c5 100644 --- a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java @@ -24,4 +24,5 @@ public void execute(CommandSender commandSender, String[] strings) { new ComponentBuilder("AuthMeBungee configuration reloaded!").color(ChatColor.GREEN).create() ); } + } diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index e73e669..a612be0 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -34,4 +34,5 @@ public class BungeeConfigProperties implements SettingsHolder { private BungeeConfigProperties() { } + } diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java b/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java index 51fc018..03d5931 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeSettingsProvider.java @@ -11,4 +11,5 @@ public class BungeeSettingsProvider extends SettingsProvider { public BungeeSettingsProvider(@DataFolder File dataFolder) { super(dataFolder, BungeeConfigProperties.class); } + } diff --git a/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java b/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java index 5414024..a038f7a 100644 --- a/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java +++ b/src/main/java/fr/xephi/authmebungee/config/SettingsDependent.java @@ -13,4 +13,5 @@ public interface SettingsDependent { * @param settings the settings instance */ void reload(SettingsManager settings); + } diff --git a/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java index 4ec2675..5d83c71 100644 --- a/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java @@ -38,4 +38,5 @@ public SettingsManager get() { PropertyResource resource = new YamlFileResource(configFile); return new SettingsManager(resource, new PlainMigrationService(), properties); } + } diff --git a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java index 8e0f26c..403ee78 100644 --- a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java +++ b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java @@ -1,8 +1,5 @@ package fr.xephi.authmebungee.data; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; - public class AuthPlayer { private String name; @@ -29,16 +26,4 @@ public void setLogged(boolean isLogged) { this.isLogged = isLogged; } - public ProxiedPlayer getPlayer() { - for (ProxiedPlayer current : ProxyServer.getInstance().getPlayers()) { - if (current.getName().equalsIgnoreCase(name)) { - return current; - } - } - return null; - } - - public boolean isOnline() { - return getPlayer() != null; - } } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index bab72c1..bcd136f 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -1,5 +1,7 @@ package fr.xephi.authmebungee.listeners; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; import fr.xephi.authmebungee.services.AuthPlayerManager; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -7,9 +9,6 @@ import net.md_5.bungee.event.EventHandler; import javax.inject.Inject; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; public class BungeeMessageListener implements Listener { @@ -26,41 +25,35 @@ public void onPluginMessage(PluginMessageEvent event) { return; } - // Check if the message is for us + // Check if the message is for a server (ignore client messages) if (!event.getTag().equals("BungeeCord")) { return; } - // Check if a player is not trying to rip us off sending a fake message + // Check if a player is not trying to send us a fake message if (!(event.getSender() instanceof Server)) { return; } - try { - // Read the plugin message - DataInputStream in = new DataInputStream(new ByteArrayInputStream(event.getData())); + // Read the plugin message + ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); - if (!in.readUTF().equals("AuthMe")) { - return; - } - - // Now that's sure, it's for us, so let's go - event.setCancelled(true); - - // For now that's the only type of message the server is able to receive - String task = in.readUTF(); - - switch (task) { - case "login": - authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); - break; - case "logout": - authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); - break; - } - } catch (IOException ex) { - // Something nasty happened - ex.printStackTrace(); + if (!in.readUTF().equals("AuthMe")) { + return; + } + // Now that's sure, it's for us, so let's go + event.setCancelled(true); + + // For now that's the only type of message the server is able to receive + String type = in.readUTF(); + switch (type) { + case "login": + authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); + break; + case "logout": + authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); + break; } } + } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index d71f7e8..fa25720 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -25,7 +25,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private AuthPlayerManager authPlayerManager; // Settings - private boolean isAutoLogin; + private boolean isAutoLoginEnabled; private boolean isServerSwitchRequiresAuth; private String requiresAuthKickMessage; private List authServers; @@ -41,7 +41,7 @@ public BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlay @Override public void reload(SettingsManager settings) { - isAutoLogin = settings.getProperty(BungeeConfigProperties.AUTOLOGIN); + isAutoLoginEnabled = settings.getProperty(BungeeConfigProperties.AUTOLOGIN); isServerSwitchRequiresAuth = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); requiresAuthKickMessage = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_KICK_MESSAGE); authServers = settings.getProperty(BungeeConfigProperties.AUTH_SERVERS); @@ -62,6 +62,10 @@ public void onPlayerLeave(PlayerDisconnectEvent event) { authPlayerManager.removeAuthPlayer(event.getPlayer()); } + private boolean isInAuthServer(ProxiedPlayer player) { + return authServers.contains(player.getServer().getInfo().getName()); + } + // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) public void onChat(ChatEvent event) { @@ -73,6 +77,12 @@ public void onChat(ChatEvent event) { if (!(event.getSender() instanceof ProxiedPlayer)) { return; } + ProxiedPlayer player = (ProxiedPlayer) event.getSender(); + + // Filter only auth servers + if(!isInAuthServer(player)) { + return; + } if (event.isCommand()) { if (!isCommandsRequireAuth) { @@ -89,7 +99,7 @@ public void onChat(ChatEvent event) { } // If player is not logged in, cancel the event - if (authPlayerManager.getAuthPlayer((ProxiedPlayer) event.getSender()).isLogged()) { + if (authPlayerManager.getAuthPlayer(player).isLogged()) { return; } event.setCancelled(true); @@ -100,47 +110,61 @@ public void onServerConnect(ServerConnectEvent event) { if (!isServerSwitchRequiresAuth || event.isCancelled()) { return; } - ProxiedPlayer player = event.getPlayer(); + + // Only check non auth servers + if(authServers.contains(event.getTarget().getName())) { + return; + } + + // Skip logged users AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); if (authPlayer.isLogged()) { return; } - // If player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection + // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection String server = event.getTarget().getName(); if (!authServers.contains(server)) { event.setCancelled(true); + TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); reasonMessage.setColor(ChatColor.RED); - player.sendMessage(reasonMessage); + + // Handle race condition on player join on a misconfigured network + if(player.getServer() == null) { + player.disconnect(reasonMessage); + } else { + player.sendMessage(reasonMessage); + } } } @EventHandler public void onServerSwitch(ServerSwitchEvent event) { - if (!isAutoLogin) { + if (!isAutoLoginEnabled) { return; } ProxiedPlayer player = event.getPlayer(); AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (!authPlayer.isLogged()) { + return; + } - // Player is trying to switch server (also called on first server player connection) - if (authPlayer.isLogged()) { - // If player is logged in and autoLogin is enabled, send login signal to the spigot side - try { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(bout); - - out.writeUTF("AuthMe"); - out.writeUTF("bungeelogin"); - out.writeUTF(authPlayer.getName()); - - event.getPlayer().getServer().sendData("BungeeCord", bout.toByteArray()); - } catch (IOException e) { - e.printStackTrace(); - } + // If player is logged in and autoLogin is enabled, send login signal to the spigot side + try { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(bout); + + out.writeUTF("AuthMe"); + out.writeUTF("bungeelogin"); + out.writeUTF(authPlayer.getName()); + + event.getPlayer().getServer().sendData("BungeeCord", bout.toByteArray()); + } catch (IOException e) { + e.printStackTrace(); } } + } diff --git a/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java b/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java index e1499f6..9988a33 100644 --- a/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java +++ b/src/main/java/fr/xephi/authmebungee/services/AuthPlayerManager.java @@ -4,13 +4,14 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.HashMap; +import java.util.Map; /* * Players manager - store all references to AuthPlayer objects through an HashMap */ public class AuthPlayerManager { - private HashMap players; + private Map players; public AuthPlayerManager() { players = new HashMap<>(); From d0bbd1ef92ef5d64585751b258a1294308fcee0b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 5 Dec 2017 00:14:52 +0100 Subject: [PATCH 027/114] Implement #8 --- .../config/BungeeConfigProperties.java | 6 +++ .../xephi/authmebungee/data/AuthPlayer.java | 16 +++++++ .../listeners/BungeeMessageListener.java | 44 +++++++++++++++++-- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index a612be0..e6e44a9 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -31,6 +31,12 @@ public class BungeeConfigProperties implements SettingsHolder { @Comment("Enable auto-login between servers") public static final Property AUTOLOGIN = newProperty("autoLogin", false); + @Comment("If enabled, unlogged users will be sent to the unloggedUserServer server!") + public static final Property ENABLE_SEND_ON_LOGOUT = + newProperty("sendOnLogout", false); + @Comment("If sendOnLogout is enabled, unlogged users will be sent to this server!") + public static final Property SEND_ON_LOGOUT_TARGET = + newProperty("unloggedUserServer", ""); private BungeeConfigProperties() { } diff --git a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java index 403ee78..1eb6680 100644 --- a/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java +++ b/src/main/java/fr/xephi/authmebungee/data/AuthPlayer.java @@ -1,5 +1,8 @@ package fr.xephi.authmebungee.data; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; + public class AuthPlayer { private String name; @@ -26,4 +29,17 @@ public void setLogged(boolean isLogged) { this.isLogged = isLogged; } + public ProxiedPlayer getPlayer() { + for (ProxiedPlayer current : ProxyServer.getInstance().getPlayers()) { + if (current.getName().equalsIgnoreCase(name)) { + return current; + } + } + return null; + } + + public boolean isOnline() { + return getPlayer() != null; + } + } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index bcd136f..d5a6e89 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -1,8 +1,14 @@ package fr.xephi.authmebungee.listeners; +import ch.jalu.configme.SettingsManager; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; +import fr.xephi.authmebungee.config.BungeeConfigProperties; +import fr.xephi.authmebungee.config.SettingsDependent; +import fr.xephi.authmebungee.data.AuthPlayer; import fr.xephi.authmebungee.services.AuthPlayerManager; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.plugin.Listener; @@ -10,13 +16,25 @@ import javax.inject.Inject; -public class BungeeMessageListener implements Listener { +public class BungeeMessageListener implements Listener, SettingsDependent { + // Services private AuthPlayerManager authPlayerManager; + // Settings + private boolean isSendOnLogoutEnabled; + private String sendOnLogoutTarget; + @Inject - public BungeeMessageListener(AuthPlayerManager authPlayerManager) { + public BungeeMessageListener(SettingsManager settings, AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; + reload(settings); + } + + @Override + public void reload(SettingsManager settings) { + isSendOnLogoutEnabled = settings.getProperty(BungeeConfigProperties.ENABLE_SEND_ON_LOGOUT); + sendOnLogoutTarget = settings.getProperty(BungeeConfigProperties.SEND_ON_LOGOUT_TARGET); } @EventHandler @@ -48,12 +66,30 @@ public void onPluginMessage(PluginMessageEvent event) { String type = in.readUTF(); switch (type) { case "login": - authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(true); + handleOnLogin(in); break; case "logout": - authPlayerManager.getAuthPlayer(in.readUTF()).setLogged(false); + handleOnLogout(in); break; } } + private void handleOnLogin(ByteArrayDataInput in) { + String name = in.readUTF(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); + authPlayer.setLogged(true); + } + + private void handleOnLogout(ByteArrayDataInput in) { + String name = in.readUTF(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); + authPlayer.setLogged(false); + if(isSendOnLogoutEnabled) { + ProxiedPlayer player = authPlayer.getPlayer(); + if(player != null) { + player.connect(ProxyServer.getInstance().getServerInfo(sendOnLogoutTarget)); + } + } + } + } From 8e870ca9e279805879b1007a611f0bc63b02de6d Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 7 Dec 2017 23:51:21 +0100 Subject: [PATCH 028/114] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 28e9906..2db0ac1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin opti 2. Place AuthMeBungee.jar into your BungeeCord's plugin folder 4. Restart everything 5. Configure the plugin (don't forget to config authServers) -6. Enjoy! +6. Enable the **Hooks.bungeecord** option in your **AuthMeReloaded config file** +7. Enjoy! **Please follow these steps and configure the plugin before saying it doesn't work!** From b1c7a19c8f2e0bf2703ab252a563e141f801cabd Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 14 Dec 2017 00:15:39 +0100 Subject: [PATCH 029/114] Fix bungeecord shutdown whoops xD --- src/main/java/fr/xephi/authmebungee/AuthMeBungee.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index e6395b2..7b4fe4d 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -60,12 +60,6 @@ public void onEnable() { new Metrics(this); } - @Override - public void onDisable() { - // Prevent plugin unload - getProxy().stop(); - } - private void setupInjector() { // Setup injector injector = new InjectorBuilder().addDefaultHandlers("").create(); From d32af61ce07aaa56dcb864cfc8990b1dedf1ab47 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 3 Jan 2018 23:09:45 +0100 Subject: [PATCH 030/114] Make authServers case insensitive --- src/main/java/fr/xephi/authmebungee/AuthMeBungee.java | 2 +- .../authmebungee/listeners/BungeePlayerListener.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index 7b4fe4d..6f8cbae 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -41,7 +41,7 @@ public void onEnable() { // Print some config information getLogger().info("Current auth servers:"); for (String authServer : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { - getLogger().info("> " + authServer); + getLogger().info("> " + authServer.toLowerCase()); } // Add online players (plugin hotswap, just in case) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index fa25720..86848ae 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -17,6 +17,7 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.List; public class BungeePlayerListener implements Listener, SettingsDependent { @@ -44,7 +45,10 @@ public void reload(SettingsManager settings) { isAutoLoginEnabled = settings.getProperty(BungeeConfigProperties.AUTOLOGIN); isServerSwitchRequiresAuth = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); requiresAuthKickMessage = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_KICK_MESSAGE); - authServers = settings.getProperty(BungeeConfigProperties.AUTH_SERVERS); + authServers = new ArrayList<>(); + for(String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { + authServers.add(server.toLowerCase()); + } isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH); commandWhitelist = settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST); chatRequiresAuth = settings.getProperty(BungeeConfigProperties.CHAT_REQUIRES_AUTH); @@ -63,7 +67,7 @@ public void onPlayerLeave(PlayerDisconnectEvent event) { } private boolean isInAuthServer(ProxiedPlayer player) { - return authServers.contains(player.getServer().getInfo().getName()); + return authServers.contains(player.getServer().getInfo().getName().toLowerCase()); } // Priority is set to lowest to keep compatibility with some chat plugins @@ -125,7 +129,7 @@ public void onServerConnect(ServerConnectEvent event) { // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection String server = event.getTarget().getName(); - if (!authServers.contains(server)) { + if (!authServers.contains(server.toLowerCase())) { event.setCancelled(true); TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); From 96117d0e848d12f73c4c88ec0e265863e7981e76 Mon Sep 17 00:00:00 2001 From: sgdc3 Date: Sun, 14 Jan 2018 20:43:39 +0100 Subject: [PATCH 031/114] Fix reload command #19 --- pom.xml | 8 ++++++++ .../xephi/authmebungee/commands/BungeeReloadCommand.java | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8b56863..c59d134 100644 --- a/pom.xml +++ b/pom.xml @@ -153,6 +153,14 @@ net.md-5 bungeecord-api 1.12-SNAPSHOT + jar + provided + + + net.md-5 + bungeecord-api + 1.12-SNAPSHOT + javadoc provided diff --git a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java index 54f33c5..ad211a1 100644 --- a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java @@ -10,11 +10,12 @@ public class BungeeReloadCommand extends Command { - @Inject private SettingsManager settings; - public BungeeReloadCommand() { + @Inject + public BungeeReloadCommand(SettingsManager settings) { super("abreloadproxy", "authmebungee.reload"); + this.settings = settings; } @Override From 024a61bb5aed579051d97174ce8392271ec176f7 Mon Sep 17 00:00:00 2001 From: sgdc3 Date: Fri, 19 Jan 2018 02:10:06 +0100 Subject: [PATCH 032/114] Whoops --- src/main/java/fr/xephi/authmebungee/AuthMeBungee.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index 6f8cbae..dfd4b4d 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -50,7 +50,7 @@ public void onEnable() { } // Register commands - getProxy().getPluginManager().registerCommand(this, new BungeeReloadCommand()); + getProxy().getPluginManager().registerCommand(this, injector.getSingleton(BungeeReloadCommand.class)); // Registering event listeners getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeeMessageListener.class)); From 36cb28f1b98487db6a0eecb6967603e255d93596 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 6 Feb 2018 21:59:01 +0100 Subject: [PATCH 033/114] Fix author description property --- src/main/resources/bungee.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 1939f12..3ad3771 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ name: ${project.name} main: fr.xephi.authmebungee.AuthMeBungee version: ${project.version} -authors: [CryLegend, AuthMeTeam] +author: AuthMeTeam From 95dc1898b9b49286e7e82fa8b7dcd2d0455c3b89 Mon Sep 17 00:00:00 2001 From: sgdc3 Date: Tue, 27 Feb 2018 01:05:56 +0100 Subject: [PATCH 034/114] Update pom --- pom.xml | 99 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index c59d134..e97a900 100644 --- a/pom.xml +++ b/pom.xml @@ -7,11 +7,11 @@ fr.xephi authmebungee 2.0.1-SNAPSHOT - jar AuthMeBungee Bungeecord addon for AuthMe! 2017 + https://www.spigotmc.org/resources/authmebungee.50219/ AuthMe-Team @@ -26,7 +26,7 @@ jenkins - http://ci.xephi.fr/job/AuthMeBungee/ + http://ci.codemc.org/job/AuthMeBungee/ @@ -34,6 +34,17 @@ https://github.com/AuthMe/AuthMeBungee/issues + + + codemc-snapshots + https://repo.codemc.org/repository/maven-snapshots/ + + + codemc-releases + https://repo.codemc.org/repository/maven-releases/ + + + The GNU General Public Licence version 3 (GPLv3) @@ -44,6 +55,7 @@ UTF-8 + UTF-8 @@ -61,7 +73,16 @@ - + + org.apache.maven.plugins + maven-clean-plugin + 3.0.0 + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.2 + org.apache.maven.plugins maven-compiler-plugin @@ -71,13 +92,62 @@ 1.8 - + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.0 + + + attach-javadocs + + aggregate + jar + + + + + ${project.name}-${project.version} + public + false + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + + jar + + + + + ${project.name}-${project.version} + + org.apache.maven.plugins maven-shade-plugin 3.1.0 + + + package + + shade + + + false + true + ${project.name}-${project.version} javax.annotation @@ -105,15 +175,16 @@ - - - shade - package - - shade - - - + + + org.apache.maven.plugins + maven-install-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 @@ -144,7 +215,7 @@ ch.jalu configme - 0.4 + 0.4.1 compile From 93572d541b14ab17bc965282d0fc5fce02708ff2 Mon Sep 17 00:00:00 2001 From: sgdc3 Date: Tue, 27 Feb 2018 01:10:12 +0100 Subject: [PATCH 035/114] Whoops --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index e97a900..540b3a6 100644 --- a/pom.xml +++ b/pom.xml @@ -59,6 +59,8 @@ + clean install + ${project.name}-${project.version}-noshade false From 90e27db40a7cf7bd4c4f42d27c3531231cceb140 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 8 Mar 2018 14:18:57 +0100 Subject: [PATCH 036/114] Bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 540b3a6..128429f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT AuthMeBungee Bungeecord addon for AuthMe! From e796b4164a2ed12bdbe525d4d58c82b495277717 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 12 Mar 2018 00:30:57 +0100 Subject: [PATCH 037/114] Test Jenkins integration --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2db0ac1..2635fe8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This plugin acts like a bridge between your bukkit servers and your BungeeCord instance. To explain simple how it works, bukkit-side plugins send a message to bungee-side on user authentication. If bungee-side doesn't receive this message, the player won't be able to talk in chat and to perform commands, including BungeeCord commands. -AutoLogin: If you have AuthMe on multiple servers, you can enable autoLogin option that allow you to switch between your servers without having to perform login command again. +**AutoLogin:** If you have AuthMe on multiple servers, you can enable autoLogin option that allow you to switch between your servers without having to perform login command again. ## Support - [GitHub issue tracker](https://github.com/AuthMe/AuthMeBungee/issues) From d3deef7757bbbbfb6e90083e50d6894c73adbc1c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 12 Mar 2018 00:33:39 +0100 Subject: [PATCH 038/114] Testing again... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2635fe8..4ea4152 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This plugin acts like a bridge between your bukkit servers and your BungeeCord i 1. Download AuthMeBungee package 2. Place AuthMeBungee.jar into your BungeeCord's plugin folder 4. Restart everything -5. Configure the plugin (don't forget to config authServers) +5. Configure the plugin **(don't forget to config authServers)** 6. Enable the **Hooks.bungeecord** option in your **AuthMeReloaded config file** 7. Enjoy! From 6b2581ad997a05322f6bb6daeb7c30af94bb068e Mon Sep 17 00:00:00 2001 From: "D No.5" Date: Thu, 5 Jul 2018 21:25:22 +0700 Subject: [PATCH 039/114] make sure AuthPlayer is exist. fixes #26 --- .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 86848ae..8dbb59c 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -123,7 +123,7 @@ public void onServerConnect(ServerConnectEvent event) { // Skip logged users AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (authPlayer.isLogged()) { + if (authPlayer != null && authPlayer.isLogged()) { return; } From 98c187695092a3813e02f605bccb59062c1115af Mon Sep 17 00:00:00 2001 From: DNx Date: Thu, 5 Jul 2018 22:43:11 +0700 Subject: [PATCH 040/114] command whitelist should be case-insensitive --- .../authmebungee/listeners/BungeePlayerListener.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 8dbb59c..65f10be 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -46,11 +46,14 @@ public void reload(SettingsManager settings) { isServerSwitchRequiresAuth = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); requiresAuthKickMessage = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_KICK_MESSAGE); authServers = new ArrayList<>(); - for(String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { + for (String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { authServers.add(server.toLowerCase()); } isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH); - commandWhitelist = settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST); + commandWhitelist = new ArrayList<>(); + for (String command : settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST)) { + commandWhitelist.add(command.toLowerCase()); + } chatRequiresAuth = settings.getProperty(BungeeConfigProperties.CHAT_REQUIRES_AUTH); } @@ -94,7 +97,7 @@ public void onChat(ChatEvent event) { } // Check if command is a whitelisted command - String label = event.getMessage().split(" ")[0]; + String label = event.getMessage().split(" ")[0].toLowerCase(); if (commandWhitelist.contains(label)) { return; } @@ -136,7 +139,7 @@ public void onServerConnect(ServerConnectEvent event) { reasonMessage.setColor(ChatColor.RED); // Handle race condition on player join on a misconfigured network - if(player.getServer() == null) { + if (player.getServer() == null) { player.disconnect(reasonMessage); } else { player.sendMessage(reasonMessage); From d617e044e7e86ae1656a7cfb0a178d5177a7ec33 Mon Sep 17 00:00:00 2001 From: DNx Date: Thu, 5 Jul 2018 22:57:05 +0700 Subject: [PATCH 041/114] more null safety check --- .../authmebungee/listeners/BungeePlayerListener.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 65f10be..178e2f0 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -76,7 +76,7 @@ private boolean isInAuthServer(ProxiedPlayer player) { // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) public void onChat(ChatEvent event) { - if (event.isCancelled()) { + if (event.isCancelled() || !isCommandsRequireAuth) { return; } @@ -92,10 +92,6 @@ public void onChat(ChatEvent event) { } if (event.isCommand()) { - if (!isCommandsRequireAuth) { - return; - } - // Check if command is a whitelisted command String label = event.getMessage().split(" ")[0].toLowerCase(); if (commandWhitelist.contains(label)) { @@ -106,7 +102,8 @@ public void onChat(ChatEvent event) { } // If player is not logged in, cancel the event - if (authPlayerManager.getAuthPlayer(player).isLogged()) { + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (authPlayer != null && authPlayer.isLogged()) { return; } event.setCancelled(true); @@ -155,7 +152,7 @@ public void onServerSwitch(ServerSwitchEvent event) { ProxiedPlayer player = event.getPlayer(); AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (!authPlayer.isLogged()) { + if (authPlayer == null || !authPlayer.isLogged()) { return; } From 9e4b8daf35f619021c6f107400e1b4d005735862 Mon Sep 17 00:00:00 2001 From: DNx Date: Fri, 6 Jul 2018 00:18:37 +0700 Subject: [PATCH 042/114] another null check --- .../listeners/BungeeMessageListener.java | 16 +++++++----- .../listeners/BungeePlayerListener.java | 26 ++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index d5a6e89..0a91a3d 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -77,17 +77,21 @@ public void onPluginMessage(PluginMessageEvent event) { private void handleOnLogin(ByteArrayDataInput in) { String name = in.readUTF(); AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); - authPlayer.setLogged(true); + if (authPlayer != null) { + authPlayer.setLogged(true); + } } private void handleOnLogout(ByteArrayDataInput in) { String name = in.readUTF(); AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); - authPlayer.setLogged(false); - if(isSendOnLogoutEnabled) { - ProxiedPlayer player = authPlayer.getPlayer(); - if(player != null) { - player.connect(ProxyServer.getInstance().getServerInfo(sendOnLogoutTarget)); + if (authPlayer != null) { + authPlayer.setLogged(false); + if (isSendOnLogoutEnabled) { + ProxiedPlayer player = authPlayer.getPlayer(); + if (player != null) { + player.connect(ProxyServer.getInstance().getServerInfo(sendOnLogoutTarget)); + } } } } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 178e2f0..7c73644 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -76,7 +76,7 @@ private boolean isInAuthServer(ProxiedPlayer player) { // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) public void onChat(ChatEvent event) { - if (event.isCancelled() || !isCommandsRequireAuth) { + if (event.isCancelled()) { return; } @@ -86,26 +86,28 @@ public void onChat(ChatEvent event) { } ProxiedPlayer player = (ProxiedPlayer) event.getSender(); - // Filter only auth servers - if(!isInAuthServer(player)) { + // filter only unauthenticated players + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (authPlayer != null && authPlayer.isLogged()) { + return; + } + // in auth servers + if (!isInAuthServer(player)) { return; } if (event.isCommand()) { - // Check if command is a whitelisted command - String label = event.getMessage().split(" ")[0].toLowerCase(); - if (commandWhitelist.contains(label)) { + if (!isCommandsRequireAuth) { + return; + } + // Check if command is whitelisted command + if (commandWhitelist.contains(event.getMessage().split(" ")[0].toLowerCase())) { return; } } else if (!chatRequiresAuth) { return; } - - // If player is not logged in, cancel the event - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (authPlayer != null && authPlayer.isLogged()) { - return; - } + // Cancel the event if it doesn't meet any of requirements above event.setCancelled(true); } From 47f9e647aadc25481917a1be9e0f050d6b0a57bb Mon Sep 17 00:00:00 2001 From: DNx Date: Fri, 6 Jul 2018 01:17:55 +0700 Subject: [PATCH 043/114] separate chat & command listener --- .../listeners/BungeePlayerListener.java | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 7c73644..0474fe8 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -69,8 +69,36 @@ public void onPlayerLeave(PlayerDisconnectEvent event) { authPlayerManager.removeAuthPlayer(event.getPlayer()); } - private boolean isInAuthServer(ProxiedPlayer player) { - return authServers.contains(player.getServer().getInfo().getName().toLowerCase()); + private boolean notInAuthServer(ProxiedPlayer player) { + return !authServers.contains(player.getServer().getInfo().getName().toLowerCase()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onCommand(ChatEvent event) { + if (event.isCancelled() || !event.isCommand() || !isCommandsRequireAuth) { + return; + } + + // Check if it's a player + if (!(event.getSender() instanceof ProxiedPlayer)) { + return; + } + ProxiedPlayer player = (ProxiedPlayer) event.getSender(); + + // filter only unauthenticated players + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + if (authPlayer != null && authPlayer.isLogged()) { + return; + } + // in auth servers + if (notInAuthServer(player)) { + return; + } + // Check if command is whitelisted command + if (commandWhitelist.contains(event.getMessage().split(" ")[0].toLowerCase())) { + return; + } + event.setCancelled(true); } // Priority is set to lowest to keep compatibility with some chat plugins @@ -92,22 +120,13 @@ public void onChat(ChatEvent event) { return; } // in auth servers - if (!isInAuthServer(player)) { + if (notInAuthServer(player)) { return; } - if (event.isCommand()) { - if (!isCommandsRequireAuth) { - return; - } - // Check if command is whitelisted command - if (commandWhitelist.contains(event.getMessage().split(" ")[0].toLowerCase())) { - return; - } - } else if (!chatRequiresAuth) { + if (!chatRequiresAuth) { return; } - // Cancel the event if it doesn't meet any of requirements above event.setCancelled(true); } From ce8747cd3c55bf3f984002502cae2cdf2c312852 Mon Sep 17 00:00:00 2001 From: DNx Date: Fri, 6 Jul 2018 16:31:04 +0700 Subject: [PATCH 044/114] don't process chat listener if it's a command --- .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 0474fe8..91ae7ac 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -104,7 +104,7 @@ public void onCommand(ChatEvent event) { // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) public void onChat(ChatEvent event) { - if (event.isCancelled()) { + if (event.isCancelled() || event.isCommand()) { return; } From 486d0b356619a53cd734106a1a63fc44be6533d7 Mon Sep 17 00:00:00 2001 From: DNx Date: Fri, 17 Aug 2018 13:35:43 +0700 Subject: [PATCH 045/114] make player only auto-login on auth servers --- .../listeners/BungeePlayerListener.java | 65 +++++++------------ 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 91ae7ac..9db7d23 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -1,6 +1,8 @@ package fr.xephi.authmebungee.listeners; import ch.jalu.configme.SettingsManager; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; import fr.xephi.authmebungee.config.BungeeConfigProperties; import fr.xephi.authmebungee.config.SettingsDependent; import fr.xephi.authmebungee.data.AuthPlayer; @@ -64,7 +66,7 @@ public void onPlayerJoin(PostLoginEvent event) { } @EventHandler - public void onPlayerLeave(PlayerDisconnectEvent event) { + public void onPlayerDisconnect(PlayerDisconnectEvent event) { // Remove player from out list authPlayerManager.removeAuthPlayer(event.getPlayer()); } @@ -103,7 +105,7 @@ public void onCommand(ChatEvent event) { // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) - public void onChat(ChatEvent event) { + public void onPlayerChat(ChatEvent event) { if (event.isCancelled() || event.isCommand()) { return; } @@ -131,26 +133,32 @@ public void onChat(ChatEvent event) { } @EventHandler(priority = EventPriority.HIGHEST) - public void onServerConnect(ServerConnectEvent event) { + public void onPlayerConnectToServer(ServerConnectEvent event) { if (!isServerSwitchRequiresAuth || event.isCancelled()) { return; } + ProxiedPlayer player = event.getPlayer(); + AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); // Only check non auth servers - if(authServers.contains(event.getTarget().getName())) { - return; - } - - // Skip logged users - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (authPlayer != null && authPlayer.isLogged()) { - return; - } + if (authServers.contains(event.getTarget().getName())) { + // If AutoLogin enabled, notify the server if this player is authenticated + if (isAutoLoginEnabled && isAuthenticated) { + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("AuthMe"); + out.writeUTF("bungeelogin"); + out.writeUTF(authPlayer.getName()); + event.getTarget().sendData("BungeeCord", out.toByteArray()); + } + } else { + // Skip logged users + if (isAuthenticated) { + return; + } - // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection - String server = event.getTarget().getName(); - if (!authServers.contains(server.toLowerCase())) { + // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection event.setCancelled(true); TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); @@ -165,31 +173,4 @@ public void onServerConnect(ServerConnectEvent event) { } } - @EventHandler - public void onServerSwitch(ServerSwitchEvent event) { - if (!isAutoLoginEnabled) { - return; - } - - ProxiedPlayer player = event.getPlayer(); - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - if (authPlayer == null || !authPlayer.isLogged()) { - return; - } - - // If player is logged in and autoLogin is enabled, send login signal to the spigot side - try { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - DataOutputStream out = new DataOutputStream(bout); - - out.writeUTF("AuthMe"); - out.writeUTF("bungeelogin"); - out.writeUTF(authPlayer.getName()); - - event.getPlayer().getServer().sendData("BungeeCord", bout.toByteArray()); - } catch (IOException e) { - e.printStackTrace(); - } - } - } From 1cd9da276393761f599eedafaa4862712521db81 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 26 Aug 2018 14:22:18 +0200 Subject: [PATCH 046/114] Adapt to the new AuthMe messaging format, update to 1.13 --- pom.xml | 26 +++++++++++-------- .../listeners/BungeeMessageListener.java | 1 + .../listeners/BungeePlayerListener.java | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 128429f..4cbb4dc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.0.2-SNAPSHOT + 2.1.0-SNAPSHOT AuthMeBungee Bungeecord addon for AuthMe! @@ -78,36 +78,40 @@ org.apache.maven.plugins maven-clean-plugin - 3.0.0 + 3.1.0 org.apache.maven.plugins maven-resources-plugin - 3.0.2 + 3.1.0 org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.8.0 1.8 1.8 + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.1.0 org.apache.maven.plugins maven-javadoc-plugin - 3.0.0 + 3.0.1 - attach-javadocs + attach-javadoc - aggregate jar @@ -137,7 +141,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.0 + 3.1.1 package @@ -225,14 +229,14 @@ net.md-5 bungeecord-api - 1.12-SNAPSHOT + 1.13-SNAPSHOT jar provided net.md-5 bungeecord-api - 1.12-SNAPSHOT + 1.13-SNAPSHOT javadoc provided diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 0a91a3d..ed87906 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -56,6 +56,7 @@ public void onPluginMessage(PluginMessageEvent event) { // Read the plugin message ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); + // TODO: should we read "FOWARD ALL"? if (!in.readUTF().equals("AuthMe")) { return; } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 9db7d23..00d49a1 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -148,7 +148,7 @@ public void onPlayerConnectToServer(ServerConnectEvent event) { if (isAutoLoginEnabled && isAuthenticated) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("AuthMe"); - out.writeUTF("bungeelogin"); + out.writeUTF("perform.login"); out.writeUTF(authPlayer.getName()); event.getTarget().sendData("BungeeCord", out.toByteArray()); } From 144a3d7eeb26368eb57b1888bf461a90d29129a5 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 02:36:34 +0200 Subject: [PATCH 047/114] Try to fix messaging --- .../authmebungee/listeners/BungeeMessageListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index ed87906..9840b93 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -56,7 +56,14 @@ public void onPluginMessage(PluginMessageEvent event) { // Read the plugin message ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); - // TODO: should we read "FOWARD ALL"? + // We expect only broadcast messages + if (!in.readUTF().equals("FORWARD") { + return; + } + if (!in.readUTF().equals("ALL") { + return; + } + // Let's check the subchannel if (!in.readUTF().equals("AuthMe")) { return; } From a8d25af47c893a9a23a3c2268d624fd5fc93ba2a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 02:40:13 +0200 Subject: [PATCH 048/114] That moment when you are editing a file from mobile using the github web interface and it's 3 AM --- .../xephi/authmebungee/listeners/BungeeMessageListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 9840b93..485ff3f 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -57,10 +57,10 @@ public void onPluginMessage(PluginMessageEvent event) { ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); // We expect only broadcast messages - if (!in.readUTF().equals("FORWARD") { + if (!in.readUTF().equals("FORWARD")) { return; } - if (!in.readUTF().equals("ALL") { + if (!in.readUTF().equals("ALL")) { return; } // Let's check the subchannel From eb690be4be9e3f140f434bf4713d4594b2e12cac Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 11:54:52 +0200 Subject: [PATCH 049/114] Update the messaging system --- .../listeners/BungeeMessageListener.java | 47 +++++++++---------- .../listeners/BungeePlayerListener.java | 42 ++++++++--------- 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 485ff3f..90fa4b9 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -19,26 +19,26 @@ public class BungeeMessageListener implements Listener, SettingsDependent { // Services - private AuthPlayerManager authPlayerManager; + private final AuthPlayerManager authPlayerManager; // Settings private boolean isSendOnLogoutEnabled; private String sendOnLogoutTarget; @Inject - public BungeeMessageListener(SettingsManager settings, AuthPlayerManager authPlayerManager) { + public BungeeMessageListener(final SettingsManager settings, final AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; reload(settings); } @Override - public void reload(SettingsManager settings) { + public void reload(final SettingsManager settings) { isSendOnLogoutEnabled = settings.getProperty(BungeeConfigProperties.ENABLE_SEND_ON_LOGOUT); sendOnLogoutTarget = settings.getProperty(BungeeConfigProperties.SEND_ON_LOGOUT_TARGET); } @EventHandler - public void onPluginMessage(PluginMessageEvent event) { + public void onPluginMessage(final PluginMessageEvent event) { if (event.isCancelled()) { return; } @@ -54,49 +54,46 @@ public void onPluginMessage(PluginMessageEvent event) { } // Read the plugin message - ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); + final ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); - // We expect only broadcast messages - if (!in.readUTF().equals("FORWARD")) { - return; - } - if (!in.readUTF().equals("ALL")) { - return; - } // Let's check the subchannel - if (!in.readUTF().equals("AuthMe")) { + if (!in.readUTF().equals("AuthMe.v2.Broadcast")) { return; } - // Now that's sure, it's for us, so let's go - event.setCancelled(true); + + // Read data byte array + final short dataLength = in.readShort(); + final byte[] dataBytes = new byte[dataLength]; + in.readFully(dataBytes); + final ByteArrayDataInput dataIn = ByteStreams.newDataInput(dataBytes); // For now that's the only type of message the server is able to receive - String type = in.readUTF(); + final String type = dataIn.readUTF(); switch (type) { case "login": - handleOnLogin(in); + handleOnLogin(dataIn); break; case "logout": - handleOnLogout(in); + handleOnLogout(dataIn); break; } } - private void handleOnLogin(ByteArrayDataInput in) { - String name = in.readUTF(); - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); + private void handleOnLogin(final ByteArrayDataInput in) { + final String name = in.readUTF(); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); if (authPlayer != null) { authPlayer.setLogged(true); } } - private void handleOnLogout(ByteArrayDataInput in) { - String name = in.readUTF(); - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); + private void handleOnLogout(final ByteArrayDataInput in) { + final String name = in.readUTF(); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(name); if (authPlayer != null) { authPlayer.setLogged(false); if (isSendOnLogoutEnabled) { - ProxiedPlayer player = authPlayer.getPlayer(); + final ProxiedPlayer player = authPlayer.getPlayer(); if (player != null) { player.connect(ProxyServer.getInstance().getServerInfo(sendOnLogoutTarget)); } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 00d49a1..dd0ff1b 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -25,7 +25,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent { // Services - private AuthPlayerManager authPlayerManager; + private final AuthPlayerManager authPlayerManager; // Settings private boolean isAutoLoginEnabled; @@ -37,46 +37,46 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - public BungeePlayerListener(SettingsManager settings, AuthPlayerManager authPlayerManager) { + public BungeePlayerListener(final SettingsManager settings, final AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; reload(settings); } @Override - public void reload(SettingsManager settings) { + public void reload(final SettingsManager settings) { isAutoLoginEnabled = settings.getProperty(BungeeConfigProperties.AUTOLOGIN); isServerSwitchRequiresAuth = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_REQUIRES_AUTH); requiresAuthKickMessage = settings.getProperty(BungeeConfigProperties.SERVER_SWITCH_KICK_MESSAGE); authServers = new ArrayList<>(); - for (String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { + for (final String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { authServers.add(server.toLowerCase()); } isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH); commandWhitelist = new ArrayList<>(); - for (String command : settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST)) { + for (final String command : settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST)) { commandWhitelist.add(command.toLowerCase()); } chatRequiresAuth = settings.getProperty(BungeeConfigProperties.CHAT_REQUIRES_AUTH); } @EventHandler - public void onPlayerJoin(PostLoginEvent event) { + public void onPlayerJoin(final PostLoginEvent event) { // Register player in our list authPlayerManager.addAuthPlayer(event.getPlayer()); } @EventHandler - public void onPlayerDisconnect(PlayerDisconnectEvent event) { + public void onPlayerDisconnect(final PlayerDisconnectEvent event) { // Remove player from out list authPlayerManager.removeAuthPlayer(event.getPlayer()); } - private boolean notInAuthServer(ProxiedPlayer player) { + private boolean notInAuthServer(final ProxiedPlayer player) { return !authServers.contains(player.getServer().getInfo().getName().toLowerCase()); } @EventHandler(priority = EventPriority.HIGHEST) - public void onCommand(ChatEvent event) { + public void onCommand(final ChatEvent event) { if (event.isCancelled() || !event.isCommand() || !isCommandsRequireAuth) { return; } @@ -85,10 +85,10 @@ public void onCommand(ChatEvent event) { if (!(event.getSender() instanceof ProxiedPlayer)) { return; } - ProxiedPlayer player = (ProxiedPlayer) event.getSender(); + final ProxiedPlayer player = (ProxiedPlayer) event.getSender(); // filter only unauthenticated players - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); if (authPlayer != null && authPlayer.isLogged()) { return; } @@ -105,7 +105,7 @@ public void onCommand(ChatEvent event) { // Priority is set to lowest to keep compatibility with some chat plugins @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerChat(ChatEvent event) { + public void onPlayerChat(final ChatEvent event) { if (event.isCancelled() || event.isCommand()) { return; } @@ -114,10 +114,10 @@ public void onPlayerChat(ChatEvent event) { if (!(event.getSender() instanceof ProxiedPlayer)) { return; } - ProxiedPlayer player = (ProxiedPlayer) event.getSender(); + final ProxiedPlayer player = (ProxiedPlayer) event.getSender(); // filter only unauthenticated players - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); if (authPlayer != null && authPlayer.isLogged()) { return; } @@ -133,21 +133,21 @@ public void onPlayerChat(ChatEvent event) { } @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerConnectToServer(ServerConnectEvent event) { + public void onPlayerConnectToServer(final ServerConnectEvent event) { if (!isServerSwitchRequiresAuth || event.isCancelled()) { return; } - ProxiedPlayer player = event.getPlayer(); - AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); - boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); + final ProxiedPlayer player = event.getPlayer(); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + final boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); // Only check non auth servers if (authServers.contains(event.getTarget().getName())) { // If AutoLogin enabled, notify the server if this player is authenticated if (isAutoLoginEnabled && isAuthenticated) { - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("AuthMe"); + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("AuthMe.v2"); out.writeUTF("perform.login"); out.writeUTF(authPlayer.getName()); event.getTarget().sendData("BungeeCord", out.toByteArray()); @@ -161,7 +161,7 @@ public void onPlayerConnectToServer(ServerConnectEvent event) { // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection event.setCancelled(true); - TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); + final TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); reasonMessage.setColor(ChatColor.RED); // Handle race condition on player join on a misconfigured network From a6f9ce359bc7ae64f0c03adeaf41bf6610fcbafc Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 12:14:09 +0200 Subject: [PATCH 050/114] Add some debug messages --- .../xephi/authmebungee/listeners/BungeeMessageListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 90fa4b9..7082e0f 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -71,9 +71,15 @@ public void onPluginMessage(final PluginMessageEvent event) { final String type = dataIn.readUTF(); switch (type) { case "login": + System.err.println("Received a login plugin message!"); handleOnLogin(dataIn); break; case "logout": + System.err.println("Received a logout plugin message!"); + handleOnLogout(dataIn); + break; + case "unregister": + System.err.println("Received an unregister plugin message!"); handleOnLogout(dataIn); break; } From 3c3edb5781f261c7ec307b5befcfad88e9143e3e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 12:46:05 +0200 Subject: [PATCH 051/114] The event is called before bungee removes the forward command from the message --- .../xephi/authmebungee/listeners/BungeeMessageListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 7082e0f..d48f439 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -56,6 +56,12 @@ public void onPluginMessage(final PluginMessageEvent event) { // Read the plugin message final ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); + // Accept only broadcasts + if(!in.readUTF().equals("Forward")) { + return; + } + in.readUTF(); // Skip ONLINE/ALL parameter + // Let's check the subchannel if (!in.readUTF().equals("AuthMe.v2.Broadcast")) { return; From 38165e204ca026b372358683007a28996b655145 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 30 Aug 2018 13:05:15 +0200 Subject: [PATCH 052/114] Remove debug message --- .../xephi/authmebungee/listeners/BungeeMessageListener.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index d48f439..1b0052e 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -77,15 +77,10 @@ public void onPluginMessage(final PluginMessageEvent event) { final String type = dataIn.readUTF(); switch (type) { case "login": - System.err.println("Received a login plugin message!"); handleOnLogin(dataIn); break; case "logout": - System.err.println("Received a logout plugin message!"); - handleOnLogout(dataIn); - break; case "unregister": - System.err.println("Received an unregister plugin message!"); handleOnLogout(dataIn); break; } From 6003390fde33951091ab2e252cd28da40d8adf3c Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Tue, 18 Sep 2018 16:35:09 +0200 Subject: [PATCH 053/114] Fix issue with authServer casing --- .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index dd0ff1b..4d4a149 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -143,7 +143,7 @@ public void onPlayerConnectToServer(final ServerConnectEvent event) { final boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); // Only check non auth servers - if (authServers.contains(event.getTarget().getName())) { + if (authServers.contains(event.getTarget().getName().toLowerCase())) { // If AutoLogin enabled, notify the server if this player is authenticated if (isAutoLoginEnabled && isAuthenticated) { final ByteArrayDataOutput out = ByteStreams.newDataOutput(); From 84630c73344e08171bb476c9e85c786fa2d028fa Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 8 Feb 2019 20:42:55 +0100 Subject: [PATCH 054/114] Fix command listener priority --- .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 4d4a149..f7c99c8 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -75,7 +75,7 @@ private boolean notInAuthServer(final ProxiedPlayer player) { return !authServers.contains(player.getServer().getInfo().getName().toLowerCase()); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.LOWEST) public void onCommand(final ChatEvent event) { if (event.isCancelled() || !event.isCommand() || !isCommandsRequireAuth) { return; From ca28b5c56567683a772285ad568976b0a5f43eed Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 4 Apr 2019 21:19:36 +0200 Subject: [PATCH 055/114] Fixes, update dependencies and bump version --- pom.xml | 21 +++--- .../authmebungee/config/SettingsProvider.java | 15 ++-- .../listeners/BungeePlayerListener.java | 73 +++++++++++-------- 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/pom.xml b/pom.xml index 4cbb4dc..3fef21a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT AuthMeBungee Bungeecord addon for AuthMe! @@ -98,16 +98,19 @@ org.apache.maven.plugins maven-surefire-plugin 2.22.0 + + false + org.apache.maven.plugins maven-jar-plugin - 3.1.0 + 3.1.1 org.apache.maven.plugins maven-javadoc-plugin - 3.0.1 + 3.1.0 attach-javadoc @@ -141,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.1 + 3.2.1 package @@ -201,10 +204,10 @@ oss-repo http://oss.sonatype.org/content/groups/public - + - bstats-repo - http://repo.bstats.org/content/repositories/releases/ + codemc-repo + https://repo.codemc.org/repository/maven-public/ @@ -221,7 +224,7 @@ ch.jalu configme - 0.4.1 + 1.1.0 compile @@ -245,7 +248,7 @@ org.bstats bstats-bungeecord - 1.2 + 1.4 compile diff --git a/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java index 5d83c71..f9b5dee 100644 --- a/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java +++ b/src/main/java/fr/xephi/authmebungee/config/SettingsProvider.java @@ -2,10 +2,7 @@ import ch.jalu.configme.SettingsHolder; import ch.jalu.configme.SettingsManager; -import ch.jalu.configme.migration.PlainMigrationService; -import ch.jalu.configme.resource.PropertyResource; -import ch.jalu.configme.resource.YamlFileResource; -import fr.xephi.authmebungee.utils.FileUtils; +import ch.jalu.configme.SettingsManagerBuilder; import javax.inject.Provider; import java.io.File; @@ -32,11 +29,9 @@ protected SettingsProvider(File dataFolder, Class prop @Override public SettingsManager get() { File configFile = new File(dataFolder, "config.yml"); - if (!configFile.exists()) { - FileUtils.create(configFile); - } - PropertyResource resource = new YamlFileResource(configFile); - return new SettingsManager(resource, new PlainMigrationService(), properties); + return SettingsManagerBuilder.withYamlFile(configFile) + .useDefaultMigrationService() + .configurationData(properties) + .create(); } - } diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index f7c99c8..8904d67 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -9,6 +9,7 @@ import fr.xephi.authmebungee.services.AuthPlayerManager; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; +import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.*; import net.md_5.bungee.api.plugin.Listener; @@ -16,9 +17,6 @@ import net.md_5.bungee.event.EventPriority; import javax.inject.Inject; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -71,10 +69,6 @@ public void onPlayerDisconnect(final PlayerDisconnectEvent event) { authPlayerManager.removeAuthPlayer(event.getPlayer()); } - private boolean notInAuthServer(final ProxiedPlayer player) { - return !authServers.contains(player.getServer().getInfo().getName().toLowerCase()); - } - @EventHandler(priority = EventPriority.LOWEST) public void onCommand(final ChatEvent event) { if (event.isCancelled() || !event.isCommand() || !isCommandsRequireAuth) { @@ -87,13 +81,13 @@ public void onCommand(final ChatEvent event) { } final ProxiedPlayer player = (ProxiedPlayer) event.getSender(); - // filter only unauthenticated players + // Filter only unauthenticated players final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); if (authPlayer != null && authPlayer.isLogged()) { return; } - // in auth servers - if (notInAuthServer(player)) { + // Only in auth servers + if (!isAuthServer(player.getServer().getInfo())) { return; } // Check if command is whitelisted command @@ -116,13 +110,13 @@ public void onPlayerChat(final ChatEvent event) { } final ProxiedPlayer player = (ProxiedPlayer) event.getSender(); - // filter only unauthenticated players + // Filter only unauthenticated players final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); if (authPlayer != null && authPlayer.isLogged()) { return; } - // in auth servers - if (notInAuthServer(player)) { + // Only in auth servers + if (!isAuthServer(player.getServer().getInfo())) { return; } @@ -132,33 +126,51 @@ public void onPlayerChat(final ChatEvent event) { event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerConnectToServer(final ServerConnectEvent event) { - if (!isServerSwitchRequiresAuth || event.isCancelled()) { - return; - } + private boolean isAuthServer(ServerInfo serverInfo) { + return authServers.contains(serverInfo.getName().toLowerCase()); + } + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerConnectedToServer(final ServerConnectedEvent event) { final ProxiedPlayer player = event.getPlayer(); final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); final boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); - // Only check non auth servers - if (authServers.contains(event.getTarget().getName().toLowerCase())) { - // If AutoLogin enabled, notify the server if this player is authenticated - if (isAutoLoginEnabled && isAuthenticated) { + if (isAuthenticated && isAuthServer(event.getServer().getInfo())) { + // If AutoLogin enabled, notify the server + if (isAutoLoginEnabled) { final ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("AuthMe.v2"); out.writeUTF("perform.login"); - out.writeUTF(authPlayer.getName()); - event.getTarget().sendData("BungeeCord", out.toByteArray()); - } - } else { - // Skip logged users - if (isAuthenticated) { - return; + out.writeUTF(event.getPlayer().getName()); + // Don't queue the message + event.getServer().getInfo().sendData("BungeeCord", out.toByteArray(), false); } + } + } - // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerConnectingToServer(final ServerConnectEvent event) { + if (event.isCancelled()) { + return; + } + + final ProxiedPlayer player = event.getPlayer(); + final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); + final boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); + + // Skip logged users + if (isAuthenticated) { + return; + } + + // Only check non auth servers + if (isAuthServer(event.getTarget())) { + return; + } + + // If the player is not logged in and serverSwitchRequiresAuth is enabled, cancel the connection + if (isServerSwitchRequiresAuth) { event.setCancelled(true); final TextComponent reasonMessage = new TextComponent(requiresAuthKickMessage); @@ -172,5 +184,4 @@ public void onPlayerConnectToServer(final ServerConnectEvent event) { } } } - } From 635fdfeff4785285826ddc1b7392b00a3fb070ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 8 Apr 2019 06:58:48 +0000 Subject: [PATCH 056/114] Bump maven-surefire-plugin from 2.22.0 to 2.22.1 Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.22.0 to 2.22.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-2.22.0...surefire-2.22.1) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3fef21a..2b39e6f 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 2.22.1 false From 59129583365ad32126c2aeae25c8b1a5de2f1fb3 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 8 Apr 2019 15:02:02 +0200 Subject: [PATCH 057/114] Attempt to fix autologin --- .../fr/xephi/authmebungee/AuthMeBungee.java | 3 +++ .../listeners/BungeePlayerListener.java | 19 +++++++++------ .../authmebungee/services/ProxyService.java | 24 +++++++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/main/java/fr/xephi/authmebungee/services/ProxyService.java diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index dfd4b4d..10f1ee0 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -10,6 +10,7 @@ import fr.xephi.authmebungee.listeners.BungeeMessageListener; import fr.xephi.authmebungee.listeners.BungeePlayerListener; import fr.xephi.authmebungee.services.AuthPlayerManager; +import fr.xephi.authmebungee.services.ProxyService; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; @@ -24,6 +25,7 @@ public class AuthMeBungee extends Plugin { // Instances private Injector injector; private SettingsManager settings; + private ProxyService proxyService; private AuthPlayerManager authPlayerManager; public AuthMeBungee() { @@ -36,6 +38,7 @@ public void onEnable() { // Get singletons from the injector settings = injector.getSingleton(SettingsManager.class); + proxyService = injector.getSingleton(ProxyService.class); authPlayerManager = injector.getSingleton(AuthPlayerManager.class); // Print some config information diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 8904d67..a2d8e52 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -7,6 +7,7 @@ import fr.xephi.authmebungee.config.SettingsDependent; import fr.xephi.authmebungee.data.AuthPlayer; import fr.xephi.authmebungee.services.AuthPlayerManager; +import fr.xephi.authmebungee.services.ProxyService; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.config.ServerInfo; @@ -19,10 +20,12 @@ import javax.inject.Inject; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; public class BungeePlayerListener implements Listener, SettingsDependent { // Services + private final ProxyService proxyService; private final AuthPlayerManager authPlayerManager; // Settings @@ -35,7 +38,8 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - public BungeePlayerListener(final SettingsManager settings, final AuthPlayerManager authPlayerManager) { + public BungeePlayerListener(final SettingsManager settings, final ProxyService proxyService, final AuthPlayerManager authPlayerManager) { + this.proxyService = proxyService; this.authPlayerManager = authPlayerManager; reload(settings); } @@ -139,12 +143,13 @@ public void onPlayerConnectedToServer(final ServerConnectedEvent event) { if (isAuthenticated && isAuthServer(event.getServer().getInfo())) { // If AutoLogin enabled, notify the server if (isAutoLoginEnabled) { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("AuthMe.v2"); - out.writeUTF("perform.login"); - out.writeUTF(event.getPlayer().getName()); - // Don't queue the message - event.getServer().getInfo().sendData("BungeeCord", out.toByteArray(), false); + proxyService.schedule(() -> { + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("AuthMe.v2"); + out.writeUTF("perform.login"); + out.writeUTF(event.getPlayer().getName()); + event.getServer().getInfo().sendData("BungeeCord", out.toByteArray()); + }, 250, TimeUnit.MICROSECONDS); } } } diff --git a/src/main/java/fr/xephi/authmebungee/services/ProxyService.java b/src/main/java/fr/xephi/authmebungee/services/ProxyService.java new file mode 100644 index 0000000..9b8c76a --- /dev/null +++ b/src/main/java/fr/xephi/authmebungee/services/ProxyService.java @@ -0,0 +1,24 @@ +package fr.xephi.authmebungee.services; + +import fr.xephi.authmebungee.AuthMeBungee; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.scheduler.ScheduledTask; + +import javax.inject.Inject; +import java.util.concurrent.TimeUnit; + +public class ProxyService { + + private final ProxyServer proxy; + private final AuthMeBungee plugin; + + @Inject + ProxyService(ProxyServer proxy, AuthMeBungee plugin) { + this.proxy = proxy; + this.plugin = plugin; + } + + public ScheduledTask schedule(Runnable runnable, long time, TimeUnit timeUnit) { + return proxy.getScheduler().schedule(plugin, runnable, time, timeUnit); + } +} From 865319a5f5d41d4c86e310f948bb82621312984b Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 8 Apr 2019 17:14:00 +0200 Subject: [PATCH 058/114] Remove unneeded autologin delay --- .../fr/xephi/authmebungee/AuthMeBungee.java | 3 --- .../listeners/BungeePlayerListener.java | 18 +++++--------- .../authmebungee/services/ProxyService.java | 24 ------------------- 3 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 src/main/java/fr/xephi/authmebungee/services/ProxyService.java diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index 10f1ee0..dfd4b4d 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -10,7 +10,6 @@ import fr.xephi.authmebungee.listeners.BungeeMessageListener; import fr.xephi.authmebungee.listeners.BungeePlayerListener; import fr.xephi.authmebungee.services.AuthPlayerManager; -import fr.xephi.authmebungee.services.ProxyService; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; @@ -25,7 +24,6 @@ public class AuthMeBungee extends Plugin { // Instances private Injector injector; private SettingsManager settings; - private ProxyService proxyService; private AuthPlayerManager authPlayerManager; public AuthMeBungee() { @@ -38,7 +36,6 @@ public void onEnable() { // Get singletons from the injector settings = injector.getSingleton(SettingsManager.class); - proxyService = injector.getSingleton(ProxyService.class); authPlayerManager = injector.getSingleton(AuthPlayerManager.class); // Print some config information diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index a2d8e52..8134988 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -7,7 +7,6 @@ import fr.xephi.authmebungee.config.SettingsDependent; import fr.xephi.authmebungee.data.AuthPlayer; import fr.xephi.authmebungee.services.AuthPlayerManager; -import fr.xephi.authmebungee.services.ProxyService; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.config.ServerInfo; @@ -20,12 +19,10 @@ import javax.inject.Inject; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeUnit; public class BungeePlayerListener implements Listener, SettingsDependent { // Services - private final ProxyService proxyService; private final AuthPlayerManager authPlayerManager; // Settings @@ -38,8 +35,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean chatRequiresAuth; @Inject - public BungeePlayerListener(final SettingsManager settings, final ProxyService proxyService, final AuthPlayerManager authPlayerManager) { - this.proxyService = proxyService; + public BungeePlayerListener(final SettingsManager settings, final AuthPlayerManager authPlayerManager) { this.authPlayerManager = authPlayerManager; reload(settings); } @@ -143,13 +139,11 @@ public void onPlayerConnectedToServer(final ServerConnectedEvent event) { if (isAuthenticated && isAuthServer(event.getServer().getInfo())) { // If AutoLogin enabled, notify the server if (isAutoLoginEnabled) { - proxyService.schedule(() -> { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("AuthMe.v2"); - out.writeUTF("perform.login"); - out.writeUTF(event.getPlayer().getName()); - event.getServer().getInfo().sendData("BungeeCord", out.toByteArray()); - }, 250, TimeUnit.MICROSECONDS); + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF("AuthMe.v2"); + out.writeUTF("perform.login"); + out.writeUTF(event.getPlayer().getName()); + event.getServer().getInfo().sendData("BungeeCord", out.toByteArray()); } } } diff --git a/src/main/java/fr/xephi/authmebungee/services/ProxyService.java b/src/main/java/fr/xephi/authmebungee/services/ProxyService.java deleted file mode 100644 index 9b8c76a..0000000 --- a/src/main/java/fr/xephi/authmebungee/services/ProxyService.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.xephi.authmebungee.services; - -import fr.xephi.authmebungee.AuthMeBungee; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.scheduler.ScheduledTask; - -import javax.inject.Inject; -import java.util.concurrent.TimeUnit; - -public class ProxyService { - - private final ProxyServer proxy; - private final AuthMeBungee plugin; - - @Inject - ProxyService(ProxyServer proxy, AuthMeBungee plugin) { - this.proxy = proxy; - this.plugin = plugin; - } - - public ScheduledTask schedule(Runnable runnable, long time, TimeUnit timeUnit) { - return proxy.getScheduler().schedule(plugin, runnable, time, timeUnit); - } -} From a0d869293ad679d75805cc30d94451210d7da518 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 19 Apr 2019 01:35:10 +0200 Subject: [PATCH 059/114] Fix #40 --- .../fr/xephi/authmebungee/config/BungeeConfigProperties.java | 3 +++ .../fr/xephi/authmebungee/listeners/BungeePlayerListener.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index e6e44a9..ed1e52d 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -14,6 +14,9 @@ public class BungeeConfigProperties implements SettingsHolder { @Comment("List of servers which required to be authenticated") public static final Property> AUTH_SERVERS = newListProperty("authServers", "lobby"); + @Comment("Consider every server as an auth server") + public static final Property ALL_SERVERS_ARE_AUTH_SERVERS = + newProperty("allServersAreAuthServers", false); @Comment("Allows or not commands to be performed if user is not logged in") public static final Property COMMANDS_REQUIRE_AUTH = newProperty("commands.requireAuth", true); diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index 8134988..e4de9ca 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -30,6 +30,7 @@ public class BungeePlayerListener implements Listener, SettingsDependent { private boolean isServerSwitchRequiresAuth; private String requiresAuthKickMessage; private List authServers; + private boolean allServersAreAuthServers; private boolean isCommandsRequireAuth; private List commandWhitelist; private boolean chatRequiresAuth; @@ -49,6 +50,7 @@ public void reload(final SettingsManager settings) { for (final String server : settings.getProperty(BungeeConfigProperties.AUTH_SERVERS)) { authServers.add(server.toLowerCase()); } + allServersAreAuthServers = settings.getProperty(BungeeConfigProperties.ALL_SERVERS_ARE_AUTH_SERVERS); isCommandsRequireAuth = settings.getProperty(BungeeConfigProperties.COMMANDS_REQUIRE_AUTH); commandWhitelist = new ArrayList<>(); for (final String command : settings.getProperty(BungeeConfigProperties.COMMANDS_WHITELIST)) { @@ -127,7 +129,7 @@ public void onPlayerChat(final ChatEvent event) { } private boolean isAuthServer(ServerInfo serverInfo) { - return authServers.contains(serverInfo.getName().toLowerCase()); + return allServersAreAuthServers || authServers.contains(serverInfo.getName().toLowerCase()); } @EventHandler(priority = EventPriority.LOWEST) From 9d447f208abbc46bf8df7b13c460fedb8d32e026 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 19 Apr 2019 17:40:27 +0200 Subject: [PATCH 060/114] 2.2.0-beta1 release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2b39e6f..926ff57 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.1.1-SNAPSHOT + 2.2.0-beta1 AuthMeBungee Bungeecord addon for AuthMe! From 33c6f1ad5202a6f62e5f55da2e7d5f902766ed6f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 19 Apr 2019 17:42:40 +0200 Subject: [PATCH 061/114] Next development cycle --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 926ff57..54941dd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.xephi authmebungee - 2.2.0-beta1 + 2.2.0-SNAPSHOT AuthMeBungee Bungeecord addon for AuthMe! From 8611b37a5f25797e93a8d09dc64a6f0c6dde5961 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 3 May 2019 06:57:14 +0000 Subject: [PATCH 062/114] Bump maven-compiler-plugin from 3.8.0 to 3.8.1 Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.8.0 to 3.8.1. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.8.0...maven-compiler-plugin-3.8.1) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 54941dd..07b6129 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.8.1 1.8 1.8 From 4a1f96ad1fa94fa114bdd6f9b4fa6f2e26778b18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 3 May 2019 06:57:39 +0000 Subject: [PATCH 063/114] Bump maven-surefire-plugin from 2.22.1 to 2.22.2 Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.22.1 to 2.22.2. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-2.22.1...surefire-2.22.2) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 54941dd..ddb4a59 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.1 + 2.22.2 false From 0da82390c8c0599ec7de1d58f804f179b5936f01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 13 May 2019 07:04:13 +0000 Subject: [PATCH 064/114] Bump maven-jar-plugin from 3.1.1 to 3.1.2 Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.1.1...maven-jar-plugin-3.1.2) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index eb7cadc..c9829ed 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.1.1 + 3.1.2 org.apache.maven.plugins From 6ebe638310ae7d2b8478fb6051c7038879cf8df8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 20 May 2019 07:15:43 +0000 Subject: [PATCH 065/114] Bump maven-source-plugin from 3.0.1 to 3.1.0 Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.0.1 to 3.1.0. - [Release notes](https://github.com/apache/maven-source-plugin/releases) - [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.0.1...maven-source-plugin-3.1.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index eb7cadc..7ec4010 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.1.0 attach-sources From 610e873f630edfd00c649d5168a028a7ed1ca958 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2019 05:38:32 +0000 Subject: [PATCH 066/114] Bump maven-javadoc-plugin from 3.1.0 to 3.1.1 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.1.0...maven-javadoc-plugin-3.1.1) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ad07e8f..dea94d7 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.0 + 3.1.1 attach-javadoc From 4adcc62db0b2dfc769d9d447b561b86410322416 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 11:10:17 +0000 Subject: [PATCH 067/114] Bump maven-source-plugin from 3.1.0 to 3.2.0 Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/apache/maven-source-plugin/releases) - [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.1.0...maven-source-plugin-3.2.0) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dea94d7..3e4e3b9 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ org.apache.maven.plugins maven-source-plugin - 3.1.0 + 3.2.0 attach-sources From 0400e45b0a2473efbbf83af47141de90f368191a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 11:12:15 +0000 Subject: [PATCH 068/114] Bump maven-jar-plugin from 3.1.2 to 3.2.0 Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.1.2 to 3.2.0. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.1.2...maven-jar-plugin-3.2.0) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dea94d7..64f84db 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.1.2 + 3.2.0 org.apache.maven.plugins From 1d9ef2c9c0fbc6e0fa341ea8ea3b3abcfe348ec1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2019 05:25:27 +0000 Subject: [PATCH 069/114] Bump bstats-bungeecord from 1.4 to 1.5 Bumps [bstats-bungeecord](https://github.com/Bastian/bStats-Metrics) from 1.4 to 1.5. - [Release notes](https://github.com/Bastian/bStats-Metrics/releases) - [Commits](https://github.com/Bastian/bStats-Metrics/compare/1.4...1.5) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c43fbd..e7c159c 100644 --- a/pom.xml +++ b/pom.xml @@ -248,7 +248,7 @@ org.bstats bstats-bungeecord - 1.4 + 1.5 compile From 3c64434fbcd270b8fad633a03d001ce2c04a6694 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2019 05:32:45 +0000 Subject: [PATCH 070/114] Bump maven-source-plugin from 3.2.0 to 3.2.1 Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.2.0 to 3.2.1. - [Release notes](https://github.com/apache/maven-source-plugin/releases) - [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.2.0...maven-source-plugin-3.2.1) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e7c159c..cf1affe 100644 --- a/pom.xml +++ b/pom.xml @@ -128,7 +128,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.0 + 3.2.1 attach-sources From 267ca39594d8736bd99a9990e8e1e167d63141fb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2020 05:40:35 +0000 Subject: [PATCH 071/114] Bump bstats-bungeecord from 1.5 to 1.6 Bumps [bstats-bungeecord](https://github.com/Bastian/bStats-Metrics) from 1.5 to 1.6. - [Release notes](https://github.com/Bastian/bStats-Metrics/releases) - [Commits](https://github.com/Bastian/bStats-Metrics/commits) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cf1affe..a25072a 100644 --- a/pom.xml +++ b/pom.xml @@ -248,7 +248,7 @@ org.bstats bstats-bungeecord - 1.5 + 1.6 compile From 97ca978219d787752db68c910947477409b05ae4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2020 05:28:22 +0000 Subject: [PATCH 072/114] Bump bstats-bungeecord from 1.6 to 1.7 Bumps [bstats-bungeecord](https://github.com/Bastian/bStats-Metrics) from 1.6 to 1.7. - [Release notes](https://github.com/Bastian/bStats-Metrics/releases) - [Commits](https://github.com/Bastian/bStats-Metrics/commits) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a25072a..d88849a 100644 --- a/pom.xml +++ b/pom.xml @@ -248,7 +248,7 @@ org.bstats bstats-bungeecord - 1.6 + 1.7 compile From 2c4c0a0df7bb3a29e484c3120a3e08ec51f5f160 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 22 Jan 2020 11:21:04 +0100 Subject: [PATCH 073/114] Add bStats pluginId --- src/main/java/fr/xephi/authmebungee/AuthMeBungee.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java index dfd4b4d..9b7ed47 100644 --- a/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java +++ b/src/main/java/fr/xephi/authmebungee/AuthMeBungee.java @@ -57,7 +57,7 @@ public void onEnable() { getProxy().getPluginManager().registerListener(this, injector.getSingleton(BungeePlayerListener.class)); // Send metrics data - new Metrics(this); + new Metrics(this, 1880); } private void setupInjector() { From dd1baa4bc24935f71cdbca5c025ea553b10ddd63 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2020 05:29:02 +0000 Subject: [PATCH 074/114] Bump maven-shade-plugin from 3.2.1 to 3.2.2 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.1...maven-shade-plugin-3.2.2) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d88849a..27a11b9 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.2.2 package From 8291734063cfb3f24a8b702020a4b39ede0e3f39 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2020 05:39:24 +0000 Subject: [PATCH 075/114] Bump maven-javadoc-plugin from 3.1.1 to 3.2.0 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.1.1...maven-javadoc-plugin-3.2.0) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 27a11b9..ddd0356 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.2.0 attach-javadoc From 0460569aa7289b829e02d1e725992f7c7cda34ed Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2020 05:32:35 +0000 Subject: [PATCH 076/114] Bump maven-shade-plugin from 3.2.2 to 3.2.3 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.2 to 3.2.3. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.2...maven-shade-plugin-3.2.3) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 27a11b9..6ba276f 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.2 + 3.2.3 package From 8966841cc2ca9e47ca5901a4b371cd9c9c07b215 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 22 Apr 2020 11:30:45 +0200 Subject: [PATCH 077/114] Reload SettingsDependent services on settings reload --- .../xephi/authmebungee/commands/BungeeReloadCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java index ad211a1..bfd42a7 100644 --- a/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java +++ b/src/main/java/fr/xephi/authmebungee/commands/BungeeReloadCommand.java @@ -1,6 +1,8 @@ package fr.xephi.authmebungee.commands; import ch.jalu.configme.SettingsManager; +import ch.jalu.injector.factory.SingletonStore; +import fr.xephi.authmebungee.config.SettingsDependent; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -11,19 +13,21 @@ public class BungeeReloadCommand extends Command { private SettingsManager settings; + private SingletonStore settingsDependentStore; @Inject - public BungeeReloadCommand(SettingsManager settings) { + public BungeeReloadCommand(SettingsManager settings, SingletonStore settingsDependentStore) { super("abreloadproxy", "authmebungee.reload"); this.settings = settings; + this.settingsDependentStore = settingsDependentStore; } @Override public void execute(CommandSender commandSender, String[] strings) { settings.reload(); + settingsDependentStore.retrieveAllOfType().forEach(settingsDependent -> settingsDependent.reload(settings)); commandSender.sendMessage( new ComponentBuilder("AuthMeBungee configuration reloaded!").color(ChatColor.GREEN).create() ); } - } From dfb3d84c64c4bfee8b5f6dd026683e426cfaa83f Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Wed, 22 Apr 2020 12:16:14 +0200 Subject: [PATCH 078/114] Fix metrics package --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f13b538..50a2051 100644 --- a/pom.xml +++ b/pom.xml @@ -180,7 +180,7 @@ org.bstats - fr.xephi.authmebungee + fr.xephi.authmebungee.libs.org.bstats From 72b23ace2a6706f94d77ddf2f467fd2e698d1661 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 3 Jun 2020 05:50:44 +0000 Subject: [PATCH 079/114] Bump maven-shade-plugin from 3.2.3 to 3.2.4 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.3 to 3.2.4. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.3...maven-shade-plugin-3.2.4) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 50a2051..b0886f1 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.3 + 3.2.4 package From f82de204d16cf8f7c5dbe4f2b206642b067fb5c6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2020 05:40:35 +0000 Subject: [PATCH 080/114] Bump bungeecord-api from 1.13-SNAPSHOT to 1.16-R0.1 Bumps [bungeecord-api](https://github.com/SpigotMC/BungeeCord) from 1.13-SNAPSHOT to 1.16-R0.1. - [Release notes](https://github.com/SpigotMC/BungeeCord/releases) - [Commits](https://github.com/SpigotMC/BungeeCord/commits) Signed-off-by: dependabot-preview[bot] --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 50a2051..fec1692 100644 --- a/pom.xml +++ b/pom.xml @@ -232,14 +232,14 @@ net.md-5 bungeecord-api - 1.13-SNAPSHOT + 1.16-R0.1 jar provided net.md-5 bungeecord-api - 1.13-SNAPSHOT + 1.16-R0.1 javadoc provided From 17727702fa1ca79dad172356c3ce0ec6836e8973 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 25 Jun 2020 20:09:45 +0200 Subject: [PATCH 081/114] Fix autoLogin feature, bump bungee api to 1.16 --- pom.xml | 4 ++-- .../xephi/authmebungee/listeners/BungeePlayerListener.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 0e3fc2e..7d18bc9 100644 --- a/pom.xml +++ b/pom.xml @@ -232,14 +232,14 @@ net.md-5 bungeecord-api - 1.16-R0.1 + 1.16-R0.2-SNAPSHOT jar provided net.md-5 bungeecord-api - 1.16-R0.1 + 1.16-R0.2-SNAPSHOT javadoc provided diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java index e4de9ca..b2aae2e 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeePlayerListener.java @@ -133,19 +133,20 @@ private boolean isAuthServer(ServerInfo serverInfo) { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerConnectedToServer(final ServerConnectedEvent event) { + public void onPlayerConnectedToServer(final ServerSwitchEvent event) { final ProxiedPlayer player = event.getPlayer(); + final ServerInfo server = player.getServer().getInfo(); final AuthPlayer authPlayer = authPlayerManager.getAuthPlayer(player); final boolean isAuthenticated = authPlayer != null && authPlayer.isLogged(); - if (isAuthenticated && isAuthServer(event.getServer().getInfo())) { + if (isAuthenticated && isAuthServer(server)) { // If AutoLogin enabled, notify the server if (isAutoLoginEnabled) { final ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("AuthMe.v2"); out.writeUTF("perform.login"); out.writeUTF(event.getPlayer().getName()); - event.getServer().getInfo().sendData("BungeeCord", out.toByteArray()); + server.sendData("BungeeCord", out.toByteArray(), false); } } } From 94f8f7cd21a31d630efd521228e48e818a1964fe Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2020 09:06:55 +0000 Subject: [PATCH 082/114] Create Dependabot config file --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a217b34 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: maven + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 From c162b548245cc40d7fab999aa2e718cf584dfb26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2020 05:24:57 +0000 Subject: [PATCH 083/114] Bump maven-resources-plugin from 3.1.0 to 3.2.0 Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/apache/maven-resources-plugin/releases) - [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.1.0...maven-resources-plugin-3.2.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7d18bc9..b9393a6 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.2.0 org.apache.maven.plugins From f35f0aa38bc78e1da64bd3cb422385ec5822558b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2020 05:16:50 +0000 Subject: [PATCH 084/114] Bump configme from 1.1.0 to 1.2.0 Bumps [configme](https://github.com/AuthMe/ConfigMe) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/AuthMe/ConfigMe/releases) - [Changelog](https://github.com/AuthMe/ConfigMe/blob/master/CHANGELOG.md) - [Commits](https://github.com/AuthMe/ConfigMe/compare/configme-1.1.0...configme-1.2.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7d18bc9..9eda174 100644 --- a/pom.xml +++ b/pom.xml @@ -224,7 +224,7 @@ ch.jalu configme - 1.1.0 + 1.2.0 compile From eb50f6544250aae6d80a741b6a409a754632d12f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Jan 2021 05:36:54 +0000 Subject: [PATCH 085/114] Bump bungeecord-api from 1.16-R0.2-SNAPSHOT to 1.16-R0.4 Bumps [bungeecord-api](https://github.com/SpigotMC/BungeeCord) from 1.16-R0.2-SNAPSHOT to 1.16-R0.4. - [Release notes](https://github.com/SpigotMC/BungeeCord/releases) - [Commits](https://github.com/SpigotMC/BungeeCord/commits) Signed-off-by: dependabot[bot] --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 87c1c86..e0838ca 100644 --- a/pom.xml +++ b/pom.xml @@ -232,14 +232,14 @@ net.md-5 bungeecord-api - 1.16-R0.2-SNAPSHOT + 1.16-R0.4 jar provided net.md-5 bungeecord-api - 1.16-R0.2-SNAPSHOT + 1.16-R0.4 javadoc provided From 81a18dfcb4bf39f71040a1177bbc535a5468775a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 05:43:47 +0000 Subject: [PATCH 086/114] Bump bstats-bungeecord from 1.7 to 2.2.1 Bumps [bstats-bungeecord](https://github.com/Bastian/bStats-Metrics) from 1.7 to 2.2.1. - [Release notes](https://github.com/Bastian/bStats-Metrics/releases) - [Commits](https://github.com/Bastian/bStats-Metrics/commits/v2.2.1) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 87c1c86..c26851f 100644 --- a/pom.xml +++ b/pom.xml @@ -248,7 +248,7 @@ org.bstats bstats-bungeecord - 1.7 + 2.2.1 compile From 46be8ce79c95810cfc675daf858f5bbbba896e4e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 1 Apr 2021 20:31:36 +0200 Subject: [PATCH 087/114] Make 'authServers' description more understandable --- .../fr/xephi/authmebungee/config/BungeeConfigProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index ed1e52d..9e4057c 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -11,7 +11,7 @@ public class BungeeConfigProperties implements SettingsHolder { - @Comment("List of servers which required to be authenticated") + @Comment("List of servers in the network where authme is installed") public static final Property> AUTH_SERVERS = newListProperty("authServers", "lobby"); @Comment("Consider every server as an auth server") From c3c705148ddc235533dc0507deb5557ec920fcbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 05:39:05 +0000 Subject: [PATCH 088/114] Bump maven-javadoc-plugin from 3.2.0 to 3.3.0 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.2.0...maven-javadoc-plugin-3.3.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2bae553..1e1711e 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.3.0 attach-javadoc From a5dcdc0b4ce00fc5cd9989e08840fe021c66d1cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Sep 2021 10:01:30 +0000 Subject: [PATCH 089/114] Bump maven-javadoc-plugin from 3.3.0 to 3.3.1 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.0...maven-javadoc-plugin-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1e1711e..1aea6d0 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.0 + 3.3.1 attach-javadoc From 3243b0efa5bdf1b4842a45aed331400ef857cf2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 10:02:04 +0000 Subject: [PATCH 090/114] Bump maven-jar-plugin from 3.2.0 to 3.2.2 Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.0 to 3.2.2. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.0...maven-jar-plugin-3.2.2) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-jar-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1aea6d0..69768d8 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 org.apache.maven.plugins From 0000e8c35d8ee213470519ac8c766b54002d7251 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:02:26 +0000 Subject: [PATCH 091/114] Bump maven-javadoc-plugin from 3.3.1 to 3.3.2 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.1 to 3.3.2. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.1...maven-javadoc-plugin-3.3.2) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1aea6d0..031eedb 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.3.2 attach-javadoc From b1e9572bc89994f7f149ba357b75ccb361772768 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Mar 2022 10:01:39 +0000 Subject: [PATCH 092/114] Bump maven-compiler-plugin from 3.8.1 to 3.10.1 Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.8.1 to 3.10.1. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.8.1...maven-compiler-plugin-3.10.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1aea6d0..255294c 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 1.8 1.8 From daba685e251bc019c293b3db5e3983f0a0e467c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 10:02:40 +0000 Subject: [PATCH 093/114] Bump maven-shade-plugin from 3.2.4 to 3.3.0 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.4 to 3.3.0. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.4...maven-shade-plugin-3.3.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-shade-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1aea6d0..7688a7b 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.3.0 package From 11acb4b73938a73db5ee2a8e9e3c3fa4d7d998bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 10:01:52 +0000 Subject: [PATCH 094/114] Bump maven-clean-plugin from 3.1.0 to 3.2.0 Bumps [maven-clean-plugin](https://github.com/apache/maven-clean-plugin) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/apache/maven-clean-plugin/releases) - [Commits](https://github.com/apache/maven-clean-plugin/compare/maven-clean-plugin-3.1.0...maven-clean-plugin-3.2.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-clean-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1aea6d0..0356dae 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ org.apache.maven.plugins maven-clean-plugin - 3.1.0 + 3.2.0 org.apache.maven.plugins From 1aebd5ef5bfb9824f44287203ab5b56feedf4485 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sun, 10 Apr 2022 21:05:23 +0200 Subject: [PATCH 095/114] Add Github pipeline --- .github/workflows/maven.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..407749a --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,19 @@ +name: Java CI + +on: [push] + +jobs: + build_and_test: + strategy: + matrix: + jdkversion: [8, 11, 17] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdkversion }} + cache: 'maven' + - name: Build with Maven + run: mvn -V -B clean package --file pom.xml From 9e88adf84504874ea00102542c39b3267aed2604 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 10:02:29 +0000 Subject: [PATCH 096/114] Bump maven-javadoc-plugin from 3.3.2 to 3.4.0 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.2 to 3.4.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.2...maven-javadoc-plugin-3.4.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4d4c1f..0a3e36e 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.4.0 attach-javadoc From 875e6b62fe85687f5f6e9cfb001e6af8a4018282 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Jul 2022 10:03:22 +0000 Subject: [PATCH 097/114] Bump maven-deploy-plugin from 2.8.2 to 3.0.0 Bumps [maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 2.8.2 to 3.0.0. - [Release notes](https://github.com/apache/maven-deploy-plugin/releases) - [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-2.8.2...maven-deploy-plugin-3.0.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-deploy-plugin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4d4c1f..62d45f0 100644 --- a/pom.xml +++ b/pom.xml @@ -193,7 +193,7 @@ org.apache.maven.plugins maven-deploy-plugin - 2.8.2 + 3.0.0 From 836b73a3ac1f8c11ff20dfd0b357e74861e1d585 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Jul 2022 10:03:52 +0000 Subject: [PATCH 098/114] Bump maven-install-plugin from 2.5.2 to 3.0.1 Bumps [maven-install-plugin](https://github.com/apache/maven-install-plugin) from 2.5.2 to 3.0.1. - [Release notes](https://github.com/apache/maven-install-plugin/releases) - [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-2.5.2...maven-install-plugin-3.0.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-install-plugin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4d4c1f..31c8b7a 100644 --- a/pom.xml +++ b/pom.xml @@ -188,7 +188,7 @@ org.apache.maven.plugins maven-install-plugin - 2.5.2 + 3.0.1 org.apache.maven.plugins From 563afa0b88a492e2a5f6bfbd4f071cab3a8d71fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Jul 2022 10:01:56 +0000 Subject: [PATCH 099/114] Bump maven-resources-plugin from 3.2.0 to 3.3.0 Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/apache/maven-resources-plugin/releases) - [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.2.0...maven-resources-plugin-3.3.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-resources-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4d4c1f..b755c56 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.2.0 + 3.3.0 org.apache.maven.plugins From 42aef4738ba350cda10609480a1053f65dd2be4a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 30 Jul 2022 22:07:23 +0200 Subject: [PATCH 100/114] Bump dependencies --- pom.xml | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index fb527f5..c731f80 100644 --- a/pom.xml +++ b/pom.xml @@ -92,6 +92,7 @@ 1.8 1.8 + 8 @@ -183,6 +184,31 @@ fr.xephi.authmebungee.libs.org.bstats + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/*.RSA + META-INF/*.MF + META-INF/DEPENDENCIES + META-INF/**/module-info.class + + + + + + + + false + + + @@ -202,7 +228,7 @@ oss-repo - http://oss.sonatype.org/content/groups/public + https://oss.sonatype.org/content/groups/public @@ -224,7 +250,7 @@ ch.jalu configme - 1.2.0 + 1.3.0 compile @@ -232,14 +258,14 @@ net.md-5 bungeecord-api - 1.16-R0.4 + 1.19-R0.1-SNAPSHOT jar provided net.md-5 bungeecord-api - 1.16-R0.4 + 1.19-R0.1-SNAPSHOT javadoc provided @@ -248,7 +274,7 @@ org.bstats bstats-bungeecord - 2.2.1 + 3.0.0 compile From 58eeba077341f0632384250e2b0304a604f30d9a Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 30 Jul 2022 22:25:42 +0200 Subject: [PATCH 101/114] Fix JDK8 compatibility --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index c731f80..5c9d12f 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,6 @@ 1.8 1.8 - 8 From f49c294a1ec8af482bb4d73e6b530a12ce412a8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Aug 2022 10:01:36 +0000 Subject: [PATCH 102/114] Bump maven-javadoc-plugin from 3.4.0 to 3.4.1 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.4.0 to 3.4.1. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.4.0...maven-javadoc-plugin-3.4.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c9d12f..c66561e 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.0 + 3.4.1 attach-javadoc From 776e155df80c98cdf1ccec9958a48de54a9999e6 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 18 Aug 2022 01:57:41 +0200 Subject: [PATCH 103/114] Remove "unregister" message handler --- .../fr/xephi/authmebungee/listeners/BungeeMessageListener.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java index 1b0052e..a0322cf 100644 --- a/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java +++ b/src/main/java/fr/xephi/authmebungee/listeners/BungeeMessageListener.java @@ -80,7 +80,6 @@ public void onPluginMessage(final PluginMessageEvent event) { handleOnLogin(dataIn); break; case "logout": - case "unregister": handleOnLogout(dataIn); break; } From b701633e35d275f3763ba09c3389d0fa633a3b05 Mon Sep 17 00:00:00 2001 From: Troughy Date: Mon, 29 Aug 2022 14:07:58 +0200 Subject: [PATCH 104/114] Whitelist 2FA commands by default --- .../fr/xephi/authmebungee/config/BungeeConfigProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index 9e4057c..538ca21 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -22,7 +22,7 @@ public class BungeeConfigProperties implements SettingsHolder { newProperty("commands.requireAuth", true); @Comment("List of commands allowed to be perform without being authenticated") public static final Property> COMMANDS_WHITELIST = - newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha"); + newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha", "/2fa", "/totp"); @Comment("Allows or not user to talk in chat if he is not logged in") public static final Property CHAT_REQUIRES_AUTH = newProperty("chatRequiresAuth", true); From 094d0c77865b41b8a369d68afe3c03123c55cfa7 Mon Sep 17 00:00:00 2001 From: Troughy Date: Mon, 29 Aug 2022 14:12:28 +0200 Subject: [PATCH 105/114] whitelist /log command --- .../fr/xephi/authmebungee/config/BungeeConfigProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java index 538ca21..600d447 100644 --- a/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java +++ b/src/main/java/fr/xephi/authmebungee/config/BungeeConfigProperties.java @@ -22,7 +22,7 @@ public class BungeeConfigProperties implements SettingsHolder { newProperty("commands.requireAuth", true); @Comment("List of commands allowed to be perform without being authenticated") public static final Property> COMMANDS_WHITELIST = - newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha", "/2fa", "/totp"); + newListProperty("commands.whitelist", "/login", "/register", "/l", "/reg", "/email", "/captcha", "/2fa", "/totp", "/log"); @Comment("Allows or not user to talk in chat if he is not logged in") public static final Property CHAT_REQUIRES_AUTH = newProperty("chatRequiresAuth", true); From 434845460159d90d14cf343c9cb33c0d3a6bfa00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:03:28 +0000 Subject: [PATCH 106/114] Bump maven-jar-plugin from 3.2.2 to 3.3.0 Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.2 to 3.3.0. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.2...maven-jar-plugin-3.3.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-jar-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..5c6f8fa 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.2 + 3.3.0 org.apache.maven.plugins From 3d962c9e261eb45fbb51f3cbf296153e1c320005 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Oct 2022 10:04:29 +0000 Subject: [PATCH 107/114] Bump maven-shade-plugin from 3.3.0 to 3.4.1 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.3.0 to 3.4.1. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.3.0...maven-shade-plugin-3.4.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-shade-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..8530f20 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.3.0 + 3.4.1 package From f3ab44eaaa7b8ac541383791e6cf1f3998a80383 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 10:56:51 +0000 Subject: [PATCH 108/114] Bump maven-javadoc-plugin from 3.4.1 to 3.5.0 Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.4.1 to 3.5.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.4.1...maven-javadoc-plugin-3.5.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..a0e4b69 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.5.0 attach-javadoc From 4d2304db181f446244ee4bcba66ad2c15c008a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 10:56:53 +0000 Subject: [PATCH 109/114] Bump maven-compiler-plugin from 3.10.1 to 3.11.0 Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.10.1 to 3.11.0. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.10.1...maven-compiler-plugin-3.11.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..129982a 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.11.0 1.8 1.8 From a91b0321e216de4f86a25e9a71f2c1815d6dbe53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:56:39 +0000 Subject: [PATCH 110/114] Bump maven-resources-plugin from 3.3.0 to 3.3.1 Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-resources-plugin/releases) - [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.3.0...maven-resources-plugin-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-resources-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..40a86b0 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.3.0 + 3.3.1 org.apache.maven.plugins From a7b301d12ef9f90bafa0fca2f7430afdf999e43f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:56:45 +0000 Subject: [PATCH 111/114] Bump maven-deploy-plugin from 3.0.0 to 3.1.1 Bumps [maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.0.0 to 3.1.1. - [Release notes](https://github.com/apache/maven-deploy-plugin/releases) - [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.0.0...maven-deploy-plugin-3.1.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-deploy-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..7e24aa2 100644 --- a/pom.xml +++ b/pom.xml @@ -218,7 +218,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.0.0 + 3.1.1 From 79fafd60311c0ffd0f4e407bdeb8bf793a6f1827 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:56:49 +0000 Subject: [PATCH 112/114] Bump maven-install-plugin from 3.0.1 to 3.1.1 Bumps [maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.0.1 to 3.1.1. - [Release notes](https://github.com/apache/maven-install-plugin/releases) - [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-3.0.1...maven-install-plugin-3.1.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-install-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..20e173f 100644 --- a/pom.xml +++ b/pom.xml @@ -213,7 +213,7 @@ org.apache.maven.plugins maven-install-plugin - 3.0.1 + 3.1.1 org.apache.maven.plugins From 766aa4877c4165b619a3e765ce5ebdb91dc9bd42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 10:56:43 +0000 Subject: [PATCH 113/114] Bump bstats-bungeecord from 3.0.0 to 3.0.2 Bumps [bstats-bungeecord](https://github.com/Bastian/bStats-Metrics) from 3.0.0 to 3.0.2. - [Release notes](https://github.com/Bastian/bStats-Metrics/releases) - [Commits](https://github.com/Bastian/bStats-Metrics/compare/v3.0.0...v3.0.2) --- updated-dependencies: - dependency-name: org.bstats:bstats-bungeecord dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..e0a8572 100644 --- a/pom.xml +++ b/pom.xml @@ -273,7 +273,7 @@ org.bstats bstats-bungeecord - 3.0.0 + 3.0.2 compile From afdc212f17dac88902e341d9b6504871604388ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 10:15:53 +0000 Subject: [PATCH 114/114] Bump maven-surefire-plugin from 2.22.2 to 3.1.0 Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.22.2 to 3.1.0. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-2.22.2...surefire-3.1.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66561e..b9a6821 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.2 + 3.1.0 false