Fix Herobrine not allow attack&Use new bukkit api

This commit is contained in:
Ghost_chu 2018-03-10 22:11:43 +08:00
parent 66ffdd62a4
commit cc3ab5d48b
76 changed files with 13890 additions and 13893 deletions

View File

@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="libs/Factions.jar"/>
<classpathentry kind="lib" path="libs/GriefPrevention.jar"/>
<classpathentry kind="lib" path="libs/MassiveCore.jar"/>
<classpathentry kind="lib" path="libs/PreciousStones.jar"/>
<classpathentry kind="lib" path="libs/Towny.jar"/>
<classpathentry kind="lib" path="libs/worldedit-bukkit-6.1.jar"/>
<classpathentry kind="lib" path="libs/worldguard-6.1.jar"/>
<classpathentry kind="lib" path="libs/CustomItems-1.0.0.jar"/>
<classpathentry kind="lib" path="libs/Residence4.6.1.4.jar"/>
<classpathentry kind="lib" path="libs/craftbukkit-1.12.jar"/>
<classpathentry kind="lib" path="libs/RedProtect.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="libs/Factions.jar"/>
<classpathentry kind="lib" path="libs/GriefPrevention.jar"/>
<classpathentry kind="lib" path="libs/MassiveCore.jar"/>
<classpathentry kind="lib" path="libs/PreciousStones.jar"/>
<classpathentry kind="lib" path="libs/Towny.jar"/>
<classpathentry kind="lib" path="libs/worldedit-bukkit-6.1.jar"/>
<classpathentry kind="lib" path="libs/worldguard-6.1.jar"/>
<classpathentry kind="lib" path="libs/CustomItems-1.0.0.jar"/>
<classpathentry kind="lib" path="libs/Residence4.6.1.4.jar"/>
<classpathentry kind="lib" path="libs/RedProtect.jar"/>
<classpathentry kind="lib" path="C:/Users/MACHENIKE/OneDrive/eclipse-workspace/RedstoneTracker/lib/spigot-1.12.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/bin/
/bin/
/libs/craftbukkit-1.12.jar

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Herobrine for Bukkit or Spigot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Herobrine for Bukkit or Spigot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,26 +1,26 @@
-- Herobrine AI, the Bukkit plugin from which Herobrine for Bukkit or Spigot is --
-- derived, is licensed under the MIT license. --
-- Herobrine AI download page - http://dev.bukkit.org/bukkit-plugins/herobrine-ai/ --
-- MIT License - http://dev.bukkit.org/licenses/4-mit-license/ --
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- Herobrine AI, the Bukkit plugin from which Herobrine for Bukkit or Spigot is --
-- derived, is licensed under the MIT license. --
-- Herobrine AI download page - http://dev.bukkit.org/bukkit-plugins/herobrine-ai/ --
-- MIT License - http://dev.bukkit.org/licenses/4-mit-license/ --
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -0,0 +1 @@
Subproject commit 66ffdd62a410a7edcf82c559a9a6fa7b013304c8

View File

@ -1,399 +1,399 @@
# This text file contains the licenses under which each of the plugins that are distributed as part of the Herobrine for Bukkit or Spigot Git
# repository are released under.
===== CustomItems, GriefPrevention, RedProtect, Residence, WorldGuard =====
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/philosophy/why-not-lgpl.html>.
===== Factions =====
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
===== MassiveCore, PreciousStones =====
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===== Towny =====
Attribution-NonCommercial-NoDerivs 3.0 Unported
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
"Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership.
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and,
to Distribute and Publicly Perform the Work including as incorporated in Collections.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d).
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested.
You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works.
If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
For the avoidance of doubt:
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and,
Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b).
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License.
# This text file contains the licenses under which each of the plugins that are distributed as part of the Herobrine for Bukkit or Spigot Git
# repository are released under.
===== CustomItems, GriefPrevention, RedProtect, Residence, WorldGuard =====
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/philosophy/why-not-lgpl.html>.
===== Factions =====
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
===== MassiveCore, PreciousStones =====
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===== Towny =====
Attribution-NonCommercial-NoDerivs 3.0 Unported
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
"Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership.
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and,
to Distribute and Publicly Perform the Work including as incorporated in Collections.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d).
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested.
You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works.
If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
For the avoidance of doubt:
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and,
Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b).
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

View File

@ -1,466 +1,466 @@
package net.theprogrammersworld.herobrine.AI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.Util;
import net.theprogrammersworld.herobrine.AI.cores.Attack;
import net.theprogrammersworld.herobrine.AI.cores.Book;
import net.theprogrammersworld.herobrine.AI.cores.BuildStuff;
import net.theprogrammersworld.herobrine.AI.cores.Burn;
import net.theprogrammersworld.herobrine.AI.cores.BuryPlayer;
import net.theprogrammersworld.herobrine.AI.cores.Curse;
import net.theprogrammersworld.herobrine.AI.cores.DestroyTorches;
import net.theprogrammersworld.herobrine.AI.cores.Graveyard;
import net.theprogrammersworld.herobrine.AI.cores.Haunt;
import net.theprogrammersworld.herobrine.AI.cores.Heads;
import net.theprogrammersworld.herobrine.AI.cores.Pyramid;
import net.theprogrammersworld.herobrine.AI.cores.RandomExplosion;
import net.theprogrammersworld.herobrine.AI.cores.RandomSound;
import net.theprogrammersworld.herobrine.AI.cores.Signs;
import net.theprogrammersworld.herobrine.AI.cores.SoundF;
import net.theprogrammersworld.herobrine.AI.cores.Temple;
import net.theprogrammersworld.herobrine.AI.cores.Totem;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class AICore {
public static final ConsoleLogger log = new ConsoleLogger();
public static Herobrine plugin;
public static Player PlayerTarget;
public static boolean isTarget = false;
public static int ticksToEnd = 0;
public static boolean isDiscCalled = false;
public static boolean isTotemCalled = false;
public static int _ticks = 0;
private ArrayList<Core> allCores = new ArrayList<Core>(Arrays.asList(new Core[] {
new Attack(), new Book(), new BuildStuff(), new BuryPlayer(), new DestroyTorches(), new Graveyard(),
new Haunt(), new Pyramid(), new Signs(), new SoundF(), new Totem(), new Heads(),
new RandomSound(), new RandomExplosion(), new Burn(), new Curse(), new Temple()
}));
private Core.CoreType currentCore = Core.CoreType.ANY;
private ResetLimits resetLimits;
private boolean BuildINT;
private boolean MainINT;
private boolean RandomCoreINT;
private int MAIN_INT;
private int BD_INT;
private int RC_INT;
public Core getCore(final Core.CoreType type) {
for (final Core c : allCores) {
if (c.getCoreType() == type) {
return c;
}
}
return null;
}
public AICore() {
AICore.plugin = Herobrine.getPluginCore();
resetLimits = new ResetLimits();
AICore.log.info("[Herobrine] Herobrine is now running in debug mode.");
findPlayer();
startIntervals();
}
public Graveyard getGraveyard() {
return (Graveyard) getCore(Core.CoreType.GRAVEYARD);
}
public void setCoreTypeNow(final Core.CoreType c) {
currentCore = c;
}
public Core.CoreType getCoreTypeNow() {
return currentCore;
}
public ResetLimits getResetLimits() {
return resetLimits;
}
public void disableAll() {
resetLimits.disable();
}
public void playerBedEnter(final Player player) {
final int chance = new Random().nextInt(100);
if (chance < 25) {
graveyardTeleport(player);
} else if (chance < 50) {
setHauntTarget(player);
} else if ((Herobrine.getPluginCore().getConfigDB().UseNPC_Demon) && (!Herobrine.isNPCDisabled)) {
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
}
}
public void findPlayer() {
if ((!Herobrine.getPluginCore().getConfigDB().OnlyWalkingMode) && !AICore.isTarget) {
final int att_chance = new Random().nextInt(100);
log.info("[Herobrine] Generating find chance...");
if (((att_chance - (Herobrine.getPluginCore().getConfigDB().ShowRate * 4)) < 55) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
log.info("[Herobrine] Finding target...");
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (allOnPlayers[playerRolled].getEntityId() != Herobrine.herobrineEntityID) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName()) && Herobrine.getPluginCore().canAttackPlayerNoMSG(allOnPlayers[playerRolled])) {
cancelTarget(Core.CoreType.ANY, true);
AICore.PlayerTarget = allOnPlayers[playerRolled];
AICore.isTarget = true;
setCoreTypeNow(Core.CoreType.START);
startAI();
} else {
log.info("[Herobrine] Target is in the safe world! (" + allOnPlayers[playerRolled].getLocation().getWorld().getName() + ")");
findPlayer();
}
}
}
}
}
public void cancelTarget(final Core.CoreType coreType, boolean withTask) {
if ((coreType == currentCore) || (coreType == Core.CoreType.ANY)) {
if (AICore.isTarget) {
if (currentCore == Core.CoreType.ATTACK) {
((Attack) getCore(Core.CoreType.ATTACK)).StopHandler();
}
if (currentCore == Core.CoreType.HAUNT) {
((Haunt) getCore(Core.CoreType.HAUNT)).StopHandler();
}
removeHero(PlayerTarget);
AICore._ticks = 0;
AICore.isTarget = false;
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
AICore.log.info("[HerobrineAI] Cancelled teleporting of " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
Herobrine.herobrineNPC.moveTo(nowloc);
currentCore = Core.CoreType.ANY;
if(withTask) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.findPlayer();
}
}, (6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L));
}
}
else {
AICore.this.findPlayer();
}
}
}
public void startAI() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget) {
if (!AICore.PlayerTarget.isDead()){
final Object[] data = { AICore.PlayerTarget };
final int chance = new Random().nextInt(100);
showHero(PlayerTarget);
if (chance <= 10) {
if (Herobrine.getPluginCore().getConfigDB().UseGraveyardWorld) {
AICore.log.info("[Herobrine] Teleporting " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
getCore(Core.CoreType.GRAVEYARD).runCore(data);
}
} else if (chance <= 25) {
getCore(Core.CoreType.ATTACK).runCore(data);
} else {
getCore(Core.CoreType.HAUNT).runCore(data);
}
} else {
cancelTarget(Core.CoreType.START, true);
}
} else {
cancelTarget(Core.CoreType.START, true);
}
}
public CoreResult setAttackTarget(final Player player) {
final Object[] data = { player };
showHero(player);
return getCore(Core.CoreType.ATTACK).runCore(data);
}
public CoreResult setHauntTarget(final Player player) {
final Object[] data = { player };
showHero(player);
return getCore(Core.CoreType.HAUNT).runCore(data);
}
public void graveyardTeleport(final Player player) {
if (player.isOnline()) {
showHero(player);
cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
final Object[] data = { player };
AICore.this.getCore(Core.CoreType.GRAVEYARD).runCore(data);
}
}, 10L);
}
}
private void removeHero(Player p){
// Remove Herobrine from the tab list unless he is configured to always be listed.
if(!Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, Herobrine.herobrineNPC.getNMSEntity()));
}
}
public static void showHero(Player p){
// Show Herobrine in the tab list.
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, Herobrine.herobrineNPC.getNMSEntity()));
}
public void playerCallTotem(final Player player) {
final String playername = player.getName();
final Location loc = player.getLocation();
AICore.isTotemCalled = true;
cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.cancelTarget(Core.CoreType.ANY, true);
final Object[] data = { loc, playername };
AICore.this.getCore(Core.CoreType.TOTEM).runCore(data);
}
}, 40L);
}
private void pyramidInterval() {
if ((Herobrine.getPluginCore().getConfigDB().BuildPyramids) && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
AICore.log.info("[Herobrine] Finding pyramid target...");
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) {
final int chance2 = new Random().nextInt(100);
if (chance2 < 30) {
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids) {
final Object[] data = { allOnPlayers[playerRolled] };
getCore(Core.CoreType.PYRAMID).runCore(data);
}
} else if (chance2 < 70) {
if (Herobrine.getPluginCore().getConfigDB().BuryPlayers) {
final Object[] data = { allOnPlayers[playerRolled] };
getCore(Core.CoreType.BURY_PLAYER).runCore(data);
}
} else if (Herobrine.getPluginCore().getConfigDB().UseHeads) {
final Object[] data = { allOnPlayers[playerRolled].getName() };
getCore(Core.CoreType.HEADS).runCore(data);
}
}
}
}
private void templeInterval() {
if ((Herobrine.getPluginCore().getConfigDB().BuildTemples) && (new Random().nextBoolean()) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
log.info("[HerobrineAI] Finding temple target...");
Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
int player_rolled = Util.getRandomPlayerNum(AllOnPlayers);
if ((Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName()))) {
Object[] data = { AllOnPlayers[player_rolled] };
getCore(Core.CoreType.TEMPLE).runCore(data);
}
}
}
private void buildCave() {
if (Herobrine.getPluginCore().getConfigDB().BuildStuff && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName()) && new Random().nextBoolean()) {
final Object[] data = { allOnPlayers[playerRolled].getLocation() };
getCore(Core.CoreType.BUILD_STUFF).runCore(data);
}
}
}
public void callByDisc(final Player player) {
AICore.isDiscCalled = false;
if (player.isOnline()) {
cancelTarget(Core.CoreType.ANY, true);
setHauntTarget(player);
}
}
public void randomCoreINT() {
if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if ((allOnPlayers[playerRolled].getEntityId() != Herobrine.herobrineEntityID)
&& Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) {
final Object[] data = { allOnPlayers[playerRolled] };
if (Herobrine.getPluginCore().canAttackPlayerNoMSG(allOnPlayers[playerRolled])) {
if (new Random().nextInt(100) < 30) {
getCore(Core.CoreType.RANDOM_SOUND).runCore(data);
} else if (new Random().nextInt(100) < 60) {
if (Herobrine.getPluginCore().getConfigDB().Burn) {
getCore(Core.CoreType.BURN).runCore(data);
}
} else if (new Random().nextInt(100) < 80) {
if (Herobrine.getPluginCore().getConfigDB().Curse) {
getCore(Core.CoreType.CURSE).runCore(data);
}
} else {
getCore(Core.CoreType.RANDOM_EXPLOSION).runCore(data);
}
}
}
}
}
public void disappearEffect() {
final Location ploc = AICore.PlayerTarget.getLocation();
final Location hbloc1 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc1.setY(hbloc1.getY() + 1.0);
final Location hbloc2 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc2.setY(hbloc2.getY() + 0.0);
final Location hbloc3 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc3.setY(hbloc3.getY() + 0.5);
final Location hbloc4 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc4.setY(hbloc4.getY() + 1.5);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.setY(-20.0);
Herobrine.herobrineNPC.moveTo(ploc);
}
private void buildInterval() {
if (new Random().nextInt(100) < 75) {
pyramidInterval();
} else {
templeInterval();
}
if (new Random().nextBoolean()) {
buildCave();
}
}
private void startIntervals() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.startMAIN();
AICore.this.startBD();
AICore.this.startRC();
}
}, 5L);
}
public ItemStack createAncientSword() {
ItemStack item = new ItemStack(Material.GOLD_SWORD);
String name = "Ancient Sword";
ArrayList<String> lore = new ArrayList<String>();
lore.add("AncientSword");
lore.add("Very old and mysterious sword.");
lore.add("This will protect you aganist Herobrine.");
item = ItemName.setNameAndLore(item, name, lore);
return item;
}
public void startBD() {
BuildINT = true;
BD_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.buildInterval();
}
}, 1L * Herobrine.getPluginCore().getConfigDB().BuildInterval, 1L * Herobrine.getPluginCore().getConfigDB().BuildInterval);
}
public void startMAIN() {
MainINT = true;
MAIN_INT = Bukkit
.getServer()
.getScheduler()
.scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.findPlayer();
}
}, (6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L),
(6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L));
}
public void startRC() {
RandomCoreINT = true;
RC_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.randomCoreINT();
}
}, Herobrine.getPluginCore().getConfigDB().ShowInterval / 2L, Herobrine.getPluginCore().getConfigDB().ShowInterval / 2L);
}
public void stopBD() {
if (BuildINT) {
BuildINT = false;
Bukkit.getServer().getScheduler().cancelTask(BD_INT);
}
}
public void stopRC() {
if (RandomCoreINT) {
RandomCoreINT = false;
Bukkit.getServer().getScheduler().cancelTask(RC_INT);
}
}
public void stopMAIN() {
if (MainINT) {
MainINT = false;
Bukkit.getServer().getScheduler().cancelTask(MAIN_INT);
}
}
package net.theprogrammersworld.herobrine.AI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.Util;
import net.theprogrammersworld.herobrine.AI.cores.Attack;
import net.theprogrammersworld.herobrine.AI.cores.Book;
import net.theprogrammersworld.herobrine.AI.cores.BuildStuff;
import net.theprogrammersworld.herobrine.AI.cores.Burn;
import net.theprogrammersworld.herobrine.AI.cores.BuryPlayer;
import net.theprogrammersworld.herobrine.AI.cores.Curse;
import net.theprogrammersworld.herobrine.AI.cores.DestroyTorches;
import net.theprogrammersworld.herobrine.AI.cores.Graveyard;
import net.theprogrammersworld.herobrine.AI.cores.Haunt;
import net.theprogrammersworld.herobrine.AI.cores.Heads;
import net.theprogrammersworld.herobrine.AI.cores.Pyramid;
import net.theprogrammersworld.herobrine.AI.cores.RandomExplosion;
import net.theprogrammersworld.herobrine.AI.cores.RandomSound;
import net.theprogrammersworld.herobrine.AI.cores.Signs;
import net.theprogrammersworld.herobrine.AI.cores.SoundF;
import net.theprogrammersworld.herobrine.AI.cores.Temple;
import net.theprogrammersworld.herobrine.AI.cores.Totem;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class AICore {
public static final ConsoleLogger log = new ConsoleLogger();
public static Herobrine plugin;
public static Player PlayerTarget;
public static boolean isTarget = false;
public static int ticksToEnd = 0;
public static boolean isDiscCalled = false;
public static boolean isTotemCalled = false;
public static int _ticks = 0;
private ArrayList<Core> allCores = new ArrayList<Core>(Arrays.asList(new Core[] {
new Attack(), new Book(), new BuildStuff(), new BuryPlayer(), new DestroyTorches(), new Graveyard(),
new Haunt(), new Pyramid(), new Signs(), new SoundF(), new Totem(), new Heads(),
new RandomSound(), new RandomExplosion(), new Burn(), new Curse(), new Temple()
}));
private Core.CoreType currentCore = Core.CoreType.ANY;
private ResetLimits resetLimits;
private boolean BuildINT;
private boolean MainINT;
private boolean RandomCoreINT;
private int MAIN_INT;
private int BD_INT;
private int RC_INT;
public Core getCore(final Core.CoreType type) {
for (final Core c : allCores) {
if (c.getCoreType() == type) {
return c;
}
}
return null;
}
public AICore() {
AICore.plugin = Herobrine.getPluginCore();
resetLimits = new ResetLimits();
AICore.log.info("[Herobrine] Herobrine is now running in debug mode.");
findPlayer();
startIntervals();
}
public Graveyard getGraveyard() {
return (Graveyard) getCore(Core.CoreType.GRAVEYARD);
}
public void setCoreTypeNow(final Core.CoreType c) {
currentCore = c;
}
public Core.CoreType getCoreTypeNow() {
return currentCore;
}
public ResetLimits getResetLimits() {
return resetLimits;
}
public void disableAll() {
resetLimits.disable();
}
public void playerBedEnter(final Player player) {
final int chance = new Random().nextInt(100);
if (chance < 25) {
graveyardTeleport(player);
} else if (chance < 50) {
setHauntTarget(player);
} else if ((Herobrine.getPluginCore().getConfigDB().UseNPC_Demon) && (!Herobrine.isNPCDisabled)) {
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
}
}
public void findPlayer() {
if ((!Herobrine.getPluginCore().getConfigDB().OnlyWalkingMode) && !AICore.isTarget) {
final int att_chance = new Random().nextInt(100);
log.info("[Herobrine] Generating find chance...");
if (((att_chance - (Herobrine.getPluginCore().getConfigDB().ShowRate * 4)) < 55) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
log.info("[Herobrine] Finding target...");
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (allOnPlayers[playerRolled].getEntityId() != Herobrine.herobrineEntityID) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName()) && Herobrine.getPluginCore().canAttackPlayerNoMSG(allOnPlayers[playerRolled])) {
cancelTarget(Core.CoreType.ANY, true);
AICore.PlayerTarget = allOnPlayers[playerRolled];
AICore.isTarget = true;
setCoreTypeNow(Core.CoreType.START);
startAI();
} else {
log.info("[Herobrine] Target is in the safe world! (" + allOnPlayers[playerRolled].getLocation().getWorld().getName() + ")");
findPlayer();
}
}
}
}
}
public void cancelTarget(final Core.CoreType coreType, boolean withTask) {
if ((coreType == currentCore) || (coreType == Core.CoreType.ANY)) {
if (AICore.isTarget) {
if (currentCore == Core.CoreType.ATTACK) {
((Attack) getCore(Core.CoreType.ATTACK)).StopHandler();
}
if (currentCore == Core.CoreType.HAUNT) {
((Haunt) getCore(Core.CoreType.HAUNT)).StopHandler();
}
removeHero(PlayerTarget);
AICore._ticks = 0;
AICore.isTarget = false;
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
AICore.log.info("[HerobrineAI] Cancelled teleporting of " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
Herobrine.herobrineNPC.moveTo(nowloc);
currentCore = Core.CoreType.ANY;
if(withTask) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.findPlayer();
}
}, (6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L));
}
}
else {
AICore.this.findPlayer();
}
}
}
public void startAI() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget) {
if (!AICore.PlayerTarget.isDead()){
final Object[] data = { AICore.PlayerTarget };
final int chance = new Random().nextInt(100);
showHero(PlayerTarget);
if (chance <= 10) {
if (Herobrine.getPluginCore().getConfigDB().UseGraveyardWorld) {
AICore.log.info("[Herobrine] Teleporting " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
getCore(Core.CoreType.GRAVEYARD).runCore(data);
}
} else if (chance <= 25) {
getCore(Core.CoreType.ATTACK).runCore(data);
} else {
getCore(Core.CoreType.HAUNT).runCore(data);
}
} else {
cancelTarget(Core.CoreType.START, true);
}
} else {
cancelTarget(Core.CoreType.START, true);
}
}
public CoreResult setAttackTarget(final Player player) {
final Object[] data = { player };
showHero(player);
return getCore(Core.CoreType.ATTACK).runCore(data);
}
public CoreResult setHauntTarget(final Player player) {
final Object[] data = { player };
showHero(player);
return getCore(Core.CoreType.HAUNT).runCore(data);
}
public void graveyardTeleport(final Player player) {
if (player.isOnline()) {
showHero(player);
cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
final Object[] data = { player };
AICore.this.getCore(Core.CoreType.GRAVEYARD).runCore(data);
}
}, 10L);
}
}
private void removeHero(Player p){
// Remove Herobrine from the tab list unless he is configured to always be listed.
if(!Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, Herobrine.herobrineNPC.getNMSEntity()));
}
}
public static void showHero(Player p){
// Show Herobrine in the tab list.
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, Herobrine.herobrineNPC.getNMSEntity()));
}
public void playerCallTotem(final Player player) {
final String playername = player.getName();
final Location loc = player.getLocation();
AICore.isTotemCalled = true;
cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.cancelTarget(Core.CoreType.ANY, true);
final Object[] data = { loc, playername };
AICore.this.getCore(Core.CoreType.TOTEM).runCore(data);
}
}, 40L);
}
private void pyramidInterval() {
if ((Herobrine.getPluginCore().getConfigDB().BuildPyramids) && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
AICore.log.info("[Herobrine] Finding pyramid target...");
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) {
final int chance2 = new Random().nextInt(100);
if (chance2 < 30) {
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids) {
final Object[] data = { allOnPlayers[playerRolled] };
getCore(Core.CoreType.PYRAMID).runCore(data);
}
} else if (chance2 < 70) {
if (Herobrine.getPluginCore().getConfigDB().BuryPlayers) {
final Object[] data = { allOnPlayers[playerRolled] };
getCore(Core.CoreType.BURY_PLAYER).runCore(data);
}
} else if (Herobrine.getPluginCore().getConfigDB().UseHeads) {
final Object[] data = { allOnPlayers[playerRolled].getName() };
getCore(Core.CoreType.HEADS).runCore(data);
}
}
}
}
private void templeInterval() {
if ((Herobrine.getPluginCore().getConfigDB().BuildTemples) && (new Random().nextBoolean()) && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
log.info("[HerobrineAI] Finding temple target...");
Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
int player_rolled = Util.getRandomPlayerNum(AllOnPlayers);
if ((Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName()))) {
Object[] data = { AllOnPlayers[player_rolled] };
getCore(Core.CoreType.TEMPLE).runCore(data);
}
}
}
private void buildCave() {
if (Herobrine.getPluginCore().getConfigDB().BuildStuff && new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName()) && new Random().nextBoolean()) {
final Object[] data = { allOnPlayers[playerRolled].getLocation() };
getCore(Core.CoreType.BUILD_STUFF).runCore(data);
}
}
}
public void callByDisc(final Player player) {
AICore.isDiscCalled = false;
if (player.isOnline()) {
cancelTarget(Core.CoreType.ANY, true);
setHauntTarget(player);
}
}
public void randomCoreINT() {
if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if ((allOnPlayers[playerRolled].getEntityId() != Herobrine.herobrineEntityID)
&& Herobrine.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) {
final Object[] data = { allOnPlayers[playerRolled] };
if (Herobrine.getPluginCore().canAttackPlayerNoMSG(allOnPlayers[playerRolled])) {
if (new Random().nextInt(100) < 30) {
getCore(Core.CoreType.RANDOM_SOUND).runCore(data);
} else if (new Random().nextInt(100) < 60) {
if (Herobrine.getPluginCore().getConfigDB().Burn) {
getCore(Core.CoreType.BURN).runCore(data);
}
} else if (new Random().nextInt(100) < 80) {
if (Herobrine.getPluginCore().getConfigDB().Curse) {
getCore(Core.CoreType.CURSE).runCore(data);
}
} else {
getCore(Core.CoreType.RANDOM_EXPLOSION).runCore(data);
}
}
}
}
}
public void disappearEffect() {
final Location ploc = AICore.PlayerTarget.getLocation();
final Location hbloc1 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc1.setY(hbloc1.getY() + 1.0);
final Location hbloc2 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc2.setY(hbloc2.getY() + 0.0);
final Location hbloc3 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc3.setY(hbloc3.getY() + 0.5);
final Location hbloc4 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc4.setY(hbloc4.getY() + 1.5);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.setY(-20.0);
Herobrine.herobrineNPC.moveTo(ploc);
}
private void buildInterval() {
if (new Random().nextInt(100) < 75) {
pyramidInterval();
} else {
templeInterval();
}
if (new Random().nextBoolean()) {
buildCave();
}
}
private void startIntervals() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.startMAIN();
AICore.this.startBD();
AICore.this.startRC();
}
}, 5L);
}
public ItemStack createAncientSword() {
ItemStack item = new ItemStack(Material.GOLD_SWORD);
String name = "Ancient Sword";
ArrayList<String> lore = new ArrayList<String>();
lore.add("AncientSword");
lore.add("Very old and mysterious sword.");
lore.add("This will protect you aganist Herobrine.");
item = ItemName.setNameAndLore(item, name, lore);
return item;
}
public void startBD() {
BuildINT = true;
BD_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.buildInterval();
}
}, 1L * Herobrine.getPluginCore().getConfigDB().BuildInterval, 1L * Herobrine.getPluginCore().getConfigDB().BuildInterval);
}
public void startMAIN() {
MainINT = true;
MAIN_INT = Bukkit
.getServer()
.getScheduler()
.scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.findPlayer();
}
}, (6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L),
(6 / Herobrine.getPluginCore().getConfigDB().ShowRate) * (Herobrine.getPluginCore().getConfigDB().ShowInterval * 1L));
}
public void startRC() {
RandomCoreINT = true;
RC_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
AICore.this.randomCoreINT();
}
}, Herobrine.getPluginCore().getConfigDB().ShowInterval / 2L, Herobrine.getPluginCore().getConfigDB().ShowInterval / 2L);
}
public void stopBD() {
if (BuildINT) {
BuildINT = false;
Bukkit.getServer().getScheduler().cancelTask(BD_INT);
}
}
public void stopRC() {
if (RandomCoreINT) {
RandomCoreINT = false;
Bukkit.getServer().getScheduler().cancelTask(RC_INT);
}
}
public void stopMAIN() {
if (MainINT) {
MainINT = false;
Bukkit.getServer().getScheduler().cancelTask(MAIN_INT);
}
}
}

View File

@ -1,128 +1,128 @@
package net.theprogrammersworld.herobrine.AI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import net.theprogrammersworld.herobrine.ConfigDB;
public class BugReport {
public static String sendBugReport(Player player, String[] messageWords) {
// Collect the necessary information and POST it to the server where bug reports will be
// collected. Based on the result of the submission, return a string.
// (0 = report failed, 1 = unofficial version, 2 = unsupported version, Report ID => success)
String report;
String checksum;
// Collect basic information including the UUID of the player who made the submission, the
// IP address of the server, the port on which the server is running, and the plugin version.
String serverIP = getServerIP();
String playerUUID;
try {
playerUUID = player.getUniqueId().toString();
} catch (Exception e) {
playerUUID = "CONSOLE";
}
try {
// Get the contents of the configuration file.
File configFile = new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml");
FileInputStream configFileInputStream = new FileInputStream(configFile);
byte[] configFileBytes = new byte[(int) configFile.length()];
configFileInputStream.read(configFileBytes);
configFileInputStream.close();
String configFileString = new String(configFileBytes, "UTF-8");
report = "Server IP Address: " + serverIP + "\r\n" +
"Submission UUID: " + playerUUID + "\r\n" +
"Server Port: " + Bukkit.getServer().getPort() + "\r\n" +
"Version: " + ConfigDB.pluginVersionNumber + "\r\n\r\n" +
"Plugin Configuration File:\r\n" + configFileString + " \r\n\r\n";
// Assemble the array of words in to a single message.
for(int x = 1; x < messageWords.length; x++) {
report += messageWords[x] + " ";
}
// Determine the MD5 hash of the plugin.
checksum = computeMD5();
// After all of the necessary information has been acquired, submit the report.
try {
String postData = URLEncoder.encode("report", "UTF-8") + "=" + URLEncoder.encode(report, "UTF-8") +
"&" + URLEncoder.encode("checksum", "UTF-8") + "=" + URLEncoder.encode(checksum, "UTF-8") +
"&" + URLEncoder.encode("ip", "UTF-8") + "=" + URLEncoder.encode(serverIP, "UTF-8") +
"&" + URLEncoder.encode("uuid", "UTF-8") + "=" + URLEncoder.encode(playerUUID, "UTF-8");
URL submitURL = new URL("https://www.theprogrammersworld.net/Herobrine/pluginBugReporter.php");
URLConnection urlConn = submitURL.openConnection();
urlConn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(urlConn.getOutputStream());
wr.write(postData);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
String serverResponse = rd.readLine();
rd.close();
wr.close();
return serverResponse;
} catch (Exception e){}
} catch (Exception e){}
// The report failed because for some reason, the server could not be reached.
return "0";
}
private static String getServerIP() {
// Get the IP address of the server by calling a page on the website that will return the IP.
URL ipFetchURL;
try {
ipFetchURL = new URL("https://www.theprogrammersworld.net/Herobrine/pluginIPFetcher.php");
InputStreamReader ipFetchISR = new InputStreamReader(ipFetchURL.openStream());
BufferedReader ipFetchBR = new BufferedReader(ipFetchISR);
String ipAddress = ipFetchBR.readLine();
ipFetchBR.close();
ipFetchISR.close();
return ipAddress;
} catch (Exception e) {
return "";
}
}
private static String computeMD5() {
// Determine the MD5 hash of the plugin.
File pluginFile = new File(BugReport.class.getProtectionDomain().getCodeSource().getLocation().getPath());
try
{
String filepath = URLDecoder.decode(pluginFile.getAbsolutePath(), StandardCharsets.UTF_8.toString());
StringBuilder hash = new StringBuilder();
MessageDigest md = MessageDigest.getInstance("MD5");
FileInputStream fis = new FileInputStream(filepath);
byte[] dataBytes = new byte[1024];
int nread = 0;
while((nread = fis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread);
byte[] mdbytes = md.digest();
for(int i=0; i<mdbytes.length; i++)
hash.append(Integer.toString((mdbytes[i] & 0xff) + 0x100 , 16).substring(1));
fis.close();
return hash.toString();
}
catch(Exception e)
{
return "";
}
}
}
package net.theprogrammersworld.herobrine.AI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import net.theprogrammersworld.herobrine.ConfigDB;
public class BugReport {
public static String sendBugReport(Player player, String[] messageWords) {
// Collect the necessary information and POST it to the server where bug reports will be
// collected. Based on the result of the submission, return a string.
// (0 = report failed, 1 = unofficial version, 2 = unsupported version, Report ID => success)
String report;
String checksum;
// Collect basic information including the UUID of the player who made the submission, the
// IP address of the server, the port on which the server is running, and the plugin version.
String serverIP = getServerIP();
String playerUUID;
try {
playerUUID = player.getUniqueId().toString();
} catch (Exception e) {
playerUUID = "CONSOLE";
}
try {
// Get the contents of the configuration file.
File configFile = new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml");
FileInputStream configFileInputStream = new FileInputStream(configFile);
byte[] configFileBytes = new byte[(int) configFile.length()];
configFileInputStream.read(configFileBytes);
configFileInputStream.close();
String configFileString = new String(configFileBytes, "UTF-8");
report = "Server IP Address: " + serverIP + "\r\n" +
"Submission UUID: " + playerUUID + "\r\n" +
"Server Port: " + Bukkit.getServer().getPort() + "\r\n" +
"Version: " + ConfigDB.pluginVersionNumber + "\r\n\r\n" +
"Plugin Configuration File:\r\n" + configFileString + " \r\n\r\n";
// Assemble the array of words in to a single message.
for(int x = 1; x < messageWords.length; x++) {
report += messageWords[x] + " ";
}
// Determine the MD5 hash of the plugin.
checksum = computeMD5();
// After all of the necessary information has been acquired, submit the report.
try {
String postData = URLEncoder.encode("report", "UTF-8") + "=" + URLEncoder.encode(report, "UTF-8") +
"&" + URLEncoder.encode("checksum", "UTF-8") + "=" + URLEncoder.encode(checksum, "UTF-8") +
"&" + URLEncoder.encode("ip", "UTF-8") + "=" + URLEncoder.encode(serverIP, "UTF-8") +
"&" + URLEncoder.encode("uuid", "UTF-8") + "=" + URLEncoder.encode(playerUUID, "UTF-8");
URL submitURL = new URL("https://www.theprogrammersworld.net/Herobrine/pluginBugReporter.php");
URLConnection urlConn = submitURL.openConnection();
urlConn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(urlConn.getOutputStream());
wr.write(postData);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
String serverResponse = rd.readLine();
rd.close();
wr.close();
return serverResponse;
} catch (Exception e){}
} catch (Exception e){}
// The report failed because for some reason, the server could not be reached.
return "0";
}
private static String getServerIP() {
// Get the IP address of the server by calling a page on the website that will return the IP.
URL ipFetchURL;
try {
ipFetchURL = new URL("https://www.theprogrammersworld.net/Herobrine/pluginIPFetcher.php");
InputStreamReader ipFetchISR = new InputStreamReader(ipFetchURL.openStream());
BufferedReader ipFetchBR = new BufferedReader(ipFetchISR);
String ipAddress = ipFetchBR.readLine();
ipFetchBR.close();
ipFetchISR.close();
return ipAddress;
} catch (Exception e) {
return "";
}
}
private static String computeMD5() {
// Determine the MD5 hash of the plugin.
File pluginFile = new File(BugReport.class.getProtectionDomain().getCodeSource().getLocation().getPath());
try
{
String filepath = URLDecoder.decode(pluginFile.getAbsolutePath(), StandardCharsets.UTF_8.toString());
StringBuilder hash = new StringBuilder();
MessageDigest md = MessageDigest.getInstance("MD5");
FileInputStream fis = new FileInputStream(filepath);
byte[] dataBytes = new byte[1024];
int nread = 0;
while((nread = fis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread);
byte[] mdbytes = md.digest();
for(int i=0; i<mdbytes.length; i++)
hash.append(Integer.toString((mdbytes[i] & 0xff) + 0x100 , 16).substring(1));
fis.close();
return hash.toString();
}
catch(Exception e)
{
return "";
}
}
}

View File

@ -1,18 +1,18 @@
package net.theprogrammersworld.herobrine.AI;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
public class ConsoleLogger {
static Logger log;
static {
ConsoleLogger.log = Bukkit.getLogger();
}
public void info(final String text) {
}
package net.theprogrammersworld.herobrine.AI;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
public class ConsoleLogger {
static Logger log;
static {
ConsoleLogger.log = Bukkit.getLogger();
}
public void info(final String text) {
}
}

View File

@ -1,46 +1,46 @@
package net.theprogrammersworld.herobrine.AI;
import net.theprogrammersworld.herobrine.Herobrine;
public abstract class Core {
private final AppearType appear;
private final CoreType coreType;
private CoreResult nowData;
public Core(final CoreType cp, final AppearType ap) {
coreType = cp;
appear = ap;
}
public AppearType getAppear() {
return appear;
}
public CoreType getCoreType() {
return coreType;
}
protected abstract CoreResult callCore(final Object[] p0);
public CoreResult runCore(final Object[] data) {
nowData = callCore(data);
if (nowData.getResult() && (appear == AppearType.APPEAR)) {
Herobrine.getPluginCore().getAICore().setCoreTypeNow(coreType);
}
return nowData;
}
public enum AppearType {
APPEAR, NORMAL
}
public enum CoreType {
ATTACK, HAUNT, BOOK, BUILD_STUFF, BURY_PLAYER,
DESTROY_TORCHES, GRAVEYARD, PYRAMID, RANDOM_POSITION,
SIGNS, SOUNDF, TOTEM, ANY, START, TEMPLE, HEADS,
RANDOM_SOUND, RANDOM_EXPLOSION, BURN, CURSE, STARE;
}
package net.theprogrammersworld.herobrine.AI;
import net.theprogrammersworld.herobrine.Herobrine;
public abstract class Core {
private final AppearType appear;
private final CoreType coreType;
private CoreResult nowData;
public Core(final CoreType cp, final AppearType ap) {
coreType = cp;
appear = ap;
}
public AppearType getAppear() {
return appear;
}
public CoreType getCoreType() {
return coreType;
}
protected abstract CoreResult callCore(final Object[] p0);
public CoreResult runCore(final Object[] data) {
nowData = callCore(data);
if (nowData.getResult() && (appear == AppearType.APPEAR)) {
Herobrine.getPluginCore().getAICore().setCoreTypeNow(coreType);
}
return nowData;
}
public enum AppearType {
APPEAR, NORMAL
}
public enum CoreType {
ATTACK, HAUNT, BOOK, BUILD_STUFF, BURY_PLAYER,
DESTROY_TORCHES, GRAVEYARD, PYRAMID, RANDOM_POSITION,
SIGNS, SOUNDF, TOTEM, ANY, START, TEMPLE, HEADS,
RANDOM_SOUND, RANDOM_EXPLOSION, BURN, CURSE, STARE;
}
}

View File

@ -1,22 +1,22 @@
package net.theprogrammersworld.herobrine.AI;
public class CoreResult {
private final boolean bo;
private final String text;
public CoreResult(final boolean b, final String t) {
super();
bo = b;
text = t;
}
public boolean getResult() {
return bo;
}
public String getResultString() {
return text;
}
package net.theprogrammersworld.herobrine.AI;
public class CoreResult {
private final boolean bo;
private final String text;
public CoreResult(final boolean b, final String t) {
super();
bo = b;
text = t;
}
public boolean getResult() {
return bo;
}
public String getResultString() {
return text;
}
}

View File

@ -1,122 +1,122 @@
package net.theprogrammersworld.herobrine.AI;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import net.minecraft.server.v1_12_R1.IChatBaseComponent;
import net.minecraft.server.v1_12_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_12_R1.PacketPlayOutChat;
public class Help {
public static void displayHelp(Player player)
{
// Display the help, listing only the commands that the user has permissions to use.
player.sendMessage(ChatColor.RED
+ "[Herobrine] Command List (hover over for more info)");
IChatBaseComponent help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine help\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aShows this list of Herobrine commands\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
if(player.hasPermission("herobrine.attack")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine attack <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends Herobrine to attack\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.haunt")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine haunt <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends Herobrine to haunt\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.cancel")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine cancel\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aCancels Herobrine's current target\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.reload")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine reload\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aReloads the Herobrine configuration file\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.position")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine position\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aDisplays Herobrine's coordinates\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.pyramid")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine pyramid <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuilds a pyramid\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.bury")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine bury <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuries the specified player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.graveyard")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine graveyard <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aTeleports the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.temple")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine temple <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuilds a temple near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.heads")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine heads <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSpawns heads near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.cave")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine cave <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aCreates a cave near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.burn")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine burn <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBurns the specified player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.curse")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine curse <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aPlaces a curse on the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.speakrandom")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine speakrandom <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends a random Herobrine message to the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.speak")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine speak <message>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends a chat message on Herobrine's behalf\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.allworlds")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine allworlds\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aGrants Herobrine access to all worlds\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
}
package net.theprogrammersworld.herobrine.AI;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import net.minecraft.server.v1_12_R1.IChatBaseComponent;
import net.minecraft.server.v1_12_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_12_R1.PacketPlayOutChat;
public class Help {
public static void displayHelp(Player player)
{
// Display the help, listing only the commands that the user has permissions to use.
player.sendMessage(ChatColor.RED
+ "[Herobrine] Command List (hover over for more info)");
IChatBaseComponent help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine help\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aShows this list of Herobrine commands\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
if(player.hasPermission("herobrine.attack")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine attack <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends Herobrine to attack\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.haunt")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine haunt <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends Herobrine to haunt\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.cancel")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine cancel\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aCancels Herobrine's current target\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.reload")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine reload\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aReloads the Herobrine configuration file\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.position")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine position\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aDisplays Herobrine's coordinates\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.pyramid")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine pyramid <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuilds a pyramid\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.bury")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine bury <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuries the specified player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.graveyard")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine graveyard <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aTeleports the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.temple")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine temple <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBuilds a temple near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.heads")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine heads <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSpawns heads near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.cave")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine cave <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aCreates a cave near the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.burn")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine burn <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aBurns the specified player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.curse")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine curse <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aPlaces a curse on the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.speakrandom")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine speakrandom <player>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends a random Herobrine message to the player\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.speak")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine speak <message>\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aSends a chat message on Herobrine's behalf\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
if(player.hasPermission("herobrine.allworlds")) {
help = ChatSerializer.a("{\"text\":\"\",\"extra\":[{\"text\":\"§a/herobrine allworlds\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\""
+ "§aGrants Herobrine access to all worlds\"}}]}");
packet = new PacketPlayOutChat(help);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
}

View File

@ -1,23 +1,23 @@
package net.theprogrammersworld.herobrine.AI;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.entity.Player;
public class Message {
public static void sendRandomMessage(final Player player) {
if (Herobrine.getPluginCore().getConfigDB().SendMessages) {
int count = Herobrine.getPluginCore().getConfigDB().useMessages.size();
final Random randgen = new Random();
if (count == 0 || count < 0){
count = 0;
}
final int randmsg = randgen.nextInt(count);
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().useMessages.get(randmsg));
}
}
package net.theprogrammersworld.herobrine.AI;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.entity.Player;
public class Message {
public static void sendRandomMessage(final Player player) {
if (Herobrine.getPluginCore().getConfigDB().SendMessages) {
int count = Herobrine.getPluginCore().getConfigDB().useMessages.size();
final Random randgen = new Random();
if (count == 0 || count < 0){
count = 0;
}
final int randmsg = randgen.nextInt(count);
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().useMessages.get(randmsg));
}
}
}

View File

@ -1,73 +1,73 @@
package net.theprogrammersworld.herobrine.AI;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Bukkit;
public class ResetLimits {
private int taskID;
private int books;
private int signs;
private int heads;
public int maxBooks;
public int maxSigns;
public int maxHeads;
public ResetLimits() {
taskID = 0;
books = 0;
signs = 0;
heads = 0;
maxBooks = 1;
maxSigns = 1;
maxHeads = 1;
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
ResetLimits.this.resetAll();
}
}, 72000L, 72000L);
}
public void disable() {
Bukkit.getServer().getScheduler().cancelTask(taskID);
}
public boolean isBook() {
if (books < maxBooks) {
++books;
return true;
}
return false;
}
public boolean isSign() {
if (signs < maxSigns) {
++signs;
return true;
}
return false;
}
public boolean isHead() {
if (heads < maxHeads) {
++heads;
return true;
}
return false;
}
public void resetAll() {
books = 0;
signs = 0;
heads = 0;
}
public void updateFromConfig() {
maxBooks = Herobrine.getPluginCore().getConfigDB().maxBooks;
maxSigns = Herobrine.getPluginCore().getConfigDB().maxSigns;
maxHeads = Herobrine.getPluginCore().getConfigDB().maxHeads;
}
package net.theprogrammersworld.herobrine.AI;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Bukkit;
public class ResetLimits {
private int taskID;
private int books;
private int signs;
private int heads;
public int maxBooks;
public int maxSigns;
public int maxHeads;
public ResetLimits() {
taskID = 0;
books = 0;
signs = 0;
heads = 0;
maxBooks = 1;
maxSigns = 1;
maxHeads = 1;
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
ResetLimits.this.resetAll();
}
}, 72000L, 72000L);
}
public void disable() {
Bukkit.getServer().getScheduler().cancelTask(taskID);
}
public boolean isBook() {
if (books < maxBooks) {
++books;
return true;
}
return false;
}
public boolean isSign() {
if (signs < maxSigns) {
++signs;
return true;
}
return false;
}
public boolean isHead() {
if (heads < maxHeads) {
++heads;
return true;
}
return false;
}
public void resetAll() {
books = 0;
signs = 0;
heads = 0;
}
public void updateFromConfig() {
maxBooks = Herobrine.getPluginCore().getConfigDB().maxBooks;
maxSigns = Herobrine.getPluginCore().getConfigDB().maxSigns;
maxHeads = Herobrine.getPluginCore().getConfigDB().maxHeads;
}
}

View File

@ -1,238 +1,238 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.AI.Message;
import net.theprogrammersworld.herobrine.AI.extensions.Position;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Attack extends Core {
private int ticksToEnd;
private int HandlerINT;
private boolean isHandler;
public Attack() {
super(CoreType.ATTACK, AppearType.APPEAR);
ticksToEnd = 0;
HandlerINT = 0;
isHandler = false;
}
@Override
public CoreResult callCore(final Object[] data) {
return setAttackTarget((Player) data[0]);
}
public CoreResult setAttackTarget(final Player player) {
if (Herobrine.getPluginCore().getSupport().checkAttack(player.getLocation())) {
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
ticksToEnd = 0;
AICore.PlayerTarget = player;
AICore.isTarget = true;
AICore.log.info("[Herobrine] Teleporting Herobrine to " + AICore.PlayerTarget.getName() + ".");
final Location ploc = AICore.PlayerTarget.getLocation();
final Object[] data = { ploc };
Herobrine.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).runCore(data);
if (Herobrine.getPluginCore().getConfigDB().UsePotionEffects) {
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
final Location tploc = Position.getTeleportPosition(ploc);
Herobrine.herobrineNPC.moveTo(tploc);
Message.sendRandomMessage(AICore.PlayerTarget);
StartHandler();
return new CoreResult(true, "Herobrine is currently attacking " + player.getName() + ".");
}
return new CoreResult(false, AICore.PlayerTarget.getName() + " cannot be attacked because they are in a protected area.");
}
public void StopHandler() {
if (isHandler) {
Bukkit.getScheduler().cancelTask(HandlerINT);
isHandler = false;
}
}
public void StartHandler() {
KeepLooking();
FollowHideRepeat();
isHandler = true;
HandlerINT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Attack.this.Handler();
}
}, 5L, 5L);
}
private void Handler() {
KeepLooking();
if ((ticksToEnd == 1) || (ticksToEnd == 16) || (ticksToEnd == 32) || (ticksToEnd == 48) || (ticksToEnd == 64) || (ticksToEnd == 80) || (ticksToEnd == 96)
|| (ticksToEnd == 112) || (ticksToEnd == 128) || (ticksToEnd == 144)) {
FollowHideRepeat();
}
}
public void KeepLooking() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
if (ticksToEnd == 160) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
} else {
++ticksToEnd;
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
if (Herobrine.getPluginCore().getConfigDB().Lightning) {
final int lchance = new Random().nextInt(100);
if (lchance > 75) {
final Location newloc = ploc;
final int randx = new Random().nextInt(50);
final int randz = new Random().nextInt(50);
if (new Random().nextBoolean()) {
newloc.setX(newloc.getX() + randx);
} else {
newloc.setX(newloc.getX() - randx);
}
if (new Random().nextBoolean()) {
newloc.setZ(newloc.getZ() + randz);
} else {
newloc.setZ(newloc.getZ() - randz);
}
newloc.setY(250.0);
newloc.getWorld().strikeLightning(newloc);
}
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void Follow() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())
&& Herobrine.getPluginCore().getSupport().checkAttack(AICore.PlayerTarget.getLocation())) {
Herobrine.herobrineNPC.moveTo(Position.getTeleportPosition(AICore.PlayerTarget.getLocation()));
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_WITHER_HURT, 0.75f, 0.75f);
if (Herobrine.getPluginCore().getConfigDB().HitPlayer) {
final int hitchance = new Random().nextInt(100);
if (hitchance < 55) {
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_GENERIC_HURT, 0.75f, 0.75f);
AICore.PlayerTarget.damage(4.0F);
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void Hide() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(-20.0);
final Location hbloc1 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc1.setY(hbloc1.getY() + 1.0);
final Location hbloc2 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc2.setY(hbloc2.getY() + 0.0);
final Location hbloc3 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc3.setY(hbloc3.getY() + 0.5);
final Location hbloc4 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc4.setY(hbloc4.getY() + 1.5);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
if (Herobrine.getPluginCore().getConfigDB().SpawnBats) {
final int cc = new Random().nextInt(3);
if (cc == 0) {
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
} else if (cc == 1) {
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
}
}
Herobrine.herobrineNPC.moveTo(ploc);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void FollowHideRepeat() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Attack.this.Hide();
}
}, 30L);
Attack.this.Follow();
}
}, 45L);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.AI.Message;
import net.theprogrammersworld.herobrine.AI.extensions.Position;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Attack extends Core {
private int ticksToEnd;
private int HandlerINT;
private boolean isHandler;
public Attack() {
super(CoreType.ATTACK, AppearType.APPEAR);
ticksToEnd = 0;
HandlerINT = 0;
isHandler = false;
}
@Override
public CoreResult callCore(final Object[] data) {
return setAttackTarget((Player) data[0]);
}
public CoreResult setAttackTarget(final Player player) {
if (Herobrine.getPluginCore().getSupport().checkAttack(player.getLocation())) {
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
ticksToEnd = 0;
AICore.PlayerTarget = player;
AICore.isTarget = true;
AICore.log.info("[Herobrine] Teleporting Herobrine to " + AICore.PlayerTarget.getName() + ".");
final Location ploc = AICore.PlayerTarget.getLocation();
final Object[] data = { ploc };
Herobrine.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).runCore(data);
if (Herobrine.getPluginCore().getConfigDB().UsePotionEffects) {
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
final Location tploc = Position.getTeleportPosition(ploc);
Herobrine.herobrineNPC.moveTo(tploc);
Message.sendRandomMessage(AICore.PlayerTarget);
StartHandler();
return new CoreResult(true, "Herobrine is currently attacking " + player.getName() + ".");
}
return new CoreResult(false, AICore.PlayerTarget.getName() + " cannot be attacked because they are in a protected area.");
}
public void StopHandler() {
if (isHandler) {
Bukkit.getScheduler().cancelTask(HandlerINT);
isHandler = false;
}
}
public void StartHandler() {
KeepLooking();
FollowHideRepeat();
isHandler = true;
HandlerINT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Attack.this.Handler();
}
}, 5L, 5L);
}
private void Handler() {
KeepLooking();
if ((ticksToEnd == 1) || (ticksToEnd == 16) || (ticksToEnd == 32) || (ticksToEnd == 48) || (ticksToEnd == 64) || (ticksToEnd == 80) || (ticksToEnd == 96)
|| (ticksToEnd == 112) || (ticksToEnd == 128) || (ticksToEnd == 144)) {
FollowHideRepeat();
}
}
public void KeepLooking() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
if (ticksToEnd == 160) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
} else {
++ticksToEnd;
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
if (Herobrine.getPluginCore().getConfigDB().Lightning) {
final int lchance = new Random().nextInt(100);
if (lchance > 75) {
final Location newloc = ploc;
final int randx = new Random().nextInt(50);
final int randz = new Random().nextInt(50);
if (new Random().nextBoolean()) {
newloc.setX(newloc.getX() + randx);
} else {
newloc.setX(newloc.getX() - randx);
}
if (new Random().nextBoolean()) {
newloc.setZ(newloc.getZ() + randz);
} else {
newloc.setZ(newloc.getZ() - randz);
}
newloc.setY(250.0);
newloc.getWorld().strikeLightning(newloc);
}
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void Follow() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())
&& Herobrine.getPluginCore().getSupport().checkAttack(AICore.PlayerTarget.getLocation())) {
Herobrine.herobrineNPC.moveTo(Position.getTeleportPosition(AICore.PlayerTarget.getLocation()));
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_WITHER_HURT, 0.75f, 0.75f);
if (Herobrine.getPluginCore().getConfigDB().HitPlayer) {
final int hitchance = new Random().nextInt(100);
if (hitchance < 55) {
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_GENERIC_HURT, 0.75f, 0.75f);
AICore.PlayerTarget.damage(4.0F);
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void Hide() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(-20.0);
final Location hbloc1 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc1.setY(hbloc1.getY() + 1.0);
final Location hbloc2 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc2.setY(hbloc2.getY() + 0.0);
final Location hbloc3 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc3.setY(hbloc3.getY() + 0.5);
final Location hbloc4 = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
hbloc4.setY(hbloc4.getY() + 1.5);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
if (Herobrine.getPluginCore().getConfigDB().SpawnBats) {
final int cc = new Random().nextInt(3);
if (cc == 0) {
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
} else if (cc == 1) {
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
}
}
Herobrine.herobrineNPC.moveTo(ploc);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
public void FollowHideRepeat() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.ATTACK)) {
if (!AICore.PlayerTarget.isDead()) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Attack.this.Hide();
}
}, 30L);
Attack.this.Follow();
}
}, 45L);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.ATTACK, true);
}
}
}

View File

@ -1,59 +1,59 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
public class Book extends Core {
public Book() {
super(CoreType.BOOK, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
if (!Herobrine.getPluginCore().getConfigDB().WriteBooks || !Herobrine.getPluginCore().getSupport().checkBooks(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " is in a world that Herobrine cannot haunt.");
}
final int chance = new Random().nextInt(100);
if (chance <= (100 - Herobrine.getPluginCore().getConfigDB().BookChance)) {
return new CoreResult(false, "Herobrine books are prohibited.");
}
final Inventory chest = (Inventory) data[1];
if (chest.firstEmpty() == -1) {
return new CoreResult(false, "Herobrine failed to create a book.");
}
if (Herobrine.getPluginCore().getAICore().getResetLimits().isBook()) {
chest.setItem(chest.firstEmpty(), newBook());
return new CoreResult(true, "Herobrine has created a book.");
}
}
return new CoreResult(false, "Herobrine failed to create a book.");
}
public ItemStack newBook() {
final int count = Herobrine.getPluginCore().getConfigDB().useBookMessages.size();
final int chance = new Random().nextInt(count);
final ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
final BookMeta meta = (BookMeta) book.getItemMeta();
final ArrayList<String> list = new ArrayList<String>();
meta.setTitle("");
meta.setAuthor("");
list.add(0, Herobrine.getPluginCore().getConfigDB().useBookMessages.get(chance));
meta.setPages(list);
book.setItemMeta(meta);
return book;
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
public class Book extends Core {
public Book() {
super(CoreType.BOOK, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
if (!Herobrine.getPluginCore().getConfigDB().WriteBooks || !Herobrine.getPluginCore().getSupport().checkBooks(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " is in a world that Herobrine cannot haunt.");
}
final int chance = new Random().nextInt(100);
if (chance <= (100 - Herobrine.getPluginCore().getConfigDB().BookChance)) {
return new CoreResult(false, "Herobrine books are prohibited.");
}
final Inventory chest = (Inventory) data[1];
if (chest.firstEmpty() == -1) {
return new CoreResult(false, "Herobrine failed to create a book.");
}
if (Herobrine.getPluginCore().getAICore().getResetLimits().isBook()) {
chest.setItem(chest.firstEmpty(), newBook());
return new CoreResult(true, "Herobrine has created a book.");
}
}
return new CoreResult(false, "Herobrine failed to create a book.");
}
public ItemStack newBook() {
final int count = Herobrine.getPluginCore().getConfigDB().useBookMessages.size();
final int chance = new Random().nextInt(count);
final ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
final BookMeta meta = (BookMeta) book.getItemMeta();
final ArrayList<String> list = new ArrayList<String>();
meta.setTitle("");
meta.setAuthor("");
list.add(0, Herobrine.getPluginCore().getConfigDB().useBookMessages.get(chance));
meta.setPages(list);
book.setItemMeta(meta);
return book;
}
}

View File

@ -1,117 +1,117 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
public class BuildStuff extends Core {
public BuildStuff() {
super(CoreType.BUILD_STUFF, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
if (data.length == 2) {
return this.BuildCave((Location) data[0], true);
}
return this.BuildCave((Location) data[0]);
}
public CoreResult BuildCave(final Location loc) {
if (!Herobrine.getPluginCore().getConfigDB().BuildStuff) {
return new CoreResult(false, "A cave cannot be created here because it is a protected area.");
}
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Cannot build stuff.");
}
if (loc.getBlockY() >= 60) {
return new CoreResult(false, "Caves can only be generated in locations where the Y coordinate is less than or equal to 60.");
}
final int chance = new Random().nextInt(100);
if (chance > (100 - Herobrine.getPluginCore().getConfigDB().CaveChance)) {
AICore.log.info("Creating cave...");
GenerateCave(loc);
return new CoreResult(false, "Cave created.");
}
return new CoreResult(false, "Cave generation failed.");
}
public CoreResult BuildCave(final Location loc, final boolean cmd) {
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "A cave cannot be created here because it is a protected area.");
}
if (loc.getBlockY() < 60) {
AICore.log.info("Creating cave...");
GenerateCave(loc);
return new CoreResult(false, "Cave created.");
}
return new CoreResult(false, "Caves can only be generated in locations where the Y coordinate is less than or equal to 60.");
}
public void GenerateCave(final Location loc) {
if (Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
final ArrayList<Location> redstoneTorchList = new ArrayList<Location>();
boolean goByX = new Random().nextBoolean();
boolean goNegative = new Random().nextBoolean();
int baseX = loc.getBlockX();
int baseZ = loc.getBlockZ();
final int baseY = loc.getBlockY();
int finalX = 0;
int finalZ = 0;
final int maxL = new Random().nextInt(10) + 4;
final int iR = new Random().nextInt(3) + 4;
int iNow = 0;
while (iNow != iR) {
++iNow;
goByX = new Random().nextBoolean();
goNegative = new Random().nextBoolean();
int i;
for (i = 0, i = 0; i <= maxL; ++i) {
finalX = 0;
finalZ = 0;
if (goNegative) {
if (goByX) {
finalX = -1;
} else {
finalZ = -1;
}
} else if (goByX) {
finalX = 1;
} else {
finalZ = 1;
}
baseX += finalX;
baseZ += finalZ;
loc.getWorld().getBlockAt(baseX, baseY, baseZ).breakNaturally((ItemStack) null);
loc.getWorld().getBlockAt(baseX, baseY + 1, baseZ).breakNaturally((ItemStack) null);
if (new Random().nextBoolean()) {
redstoneTorchList.add(new Location(loc.getWorld(), baseX, baseY + 1, baseZ));
}
}
}
for (final Location _loc : redstoneTorchList) {
PlaceRedstoneTorch(_loc.getWorld(), _loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ());
}
AICore.log.info("Cave created.");
}
}
public void PlaceRedstoneTorch(final World world, final int x, final int y, final int z) {
final Random randgen = new Random();
final int chance = randgen.nextInt(100);
if (chance > 70) {
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
public class BuildStuff extends Core {
public BuildStuff() {
super(CoreType.BUILD_STUFF, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
if (data.length == 2) {
return this.BuildCave((Location) data[0], true);
}
return this.BuildCave((Location) data[0]);
}
public CoreResult BuildCave(final Location loc) {
if (!Herobrine.getPluginCore().getConfigDB().BuildStuff) {
return new CoreResult(false, "A cave cannot be created here because it is a protected area.");
}
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Cannot build stuff.");
}
if (loc.getBlockY() >= 60) {
return new CoreResult(false, "Caves can only be generated in locations where the Y coordinate is less than or equal to 60.");
}
final int chance = new Random().nextInt(100);
if (chance > (100 - Herobrine.getPluginCore().getConfigDB().CaveChance)) {
AICore.log.info("Creating cave...");
GenerateCave(loc);
return new CoreResult(false, "Cave created.");
}
return new CoreResult(false, "Cave generation failed.");
}
public CoreResult BuildCave(final Location loc, final boolean cmd) {
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "A cave cannot be created here because it is a protected area.");
}
if (loc.getBlockY() < 60) {
AICore.log.info("Creating cave...");
GenerateCave(loc);
return new CoreResult(false, "Cave created.");
}
return new CoreResult(false, "Caves can only be generated in locations where the Y coordinate is less than or equal to 60.");
}
public void GenerateCave(final Location loc) {
if (Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
final ArrayList<Location> redstoneTorchList = new ArrayList<Location>();
boolean goByX = new Random().nextBoolean();
boolean goNegative = new Random().nextBoolean();
int baseX = loc.getBlockX();
int baseZ = loc.getBlockZ();
final int baseY = loc.getBlockY();
int finalX = 0;
int finalZ = 0;
final int maxL = new Random().nextInt(10) + 4;
final int iR = new Random().nextInt(3) + 4;
int iNow = 0;
while (iNow != iR) {
++iNow;
goByX = new Random().nextBoolean();
goNegative = new Random().nextBoolean();
int i;
for (i = 0, i = 0; i <= maxL; ++i) {
finalX = 0;
finalZ = 0;
if (goNegative) {
if (goByX) {
finalX = -1;
} else {
finalZ = -1;
}
} else if (goByX) {
finalX = 1;
} else {
finalZ = 1;
}
baseX += finalX;
baseZ += finalZ;
loc.getWorld().getBlockAt(baseX, baseY, baseZ).breakNaturally((ItemStack) null);
loc.getWorld().getBlockAt(baseX, baseY + 1, baseZ).breakNaturally((ItemStack) null);
if (new Random().nextBoolean()) {
redstoneTorchList.add(new Location(loc.getWorld(), baseX, baseY + 1, baseZ));
}
}
}
for (final Location _loc : redstoneTorchList) {
PlaceRedstoneTorch(_loc.getWorld(), _loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ());
}
AICore.log.info("Cave created.");
}
}
public void PlaceRedstoneTorch(final World world, final int x, final int y, final int z) {
final Random randgen = new Random();
final int chance = randgen.nextInt(100);
if (chance > 70) {
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
}
}
}

View File

@ -1,21 +1,21 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.entity.Player;
public class Burn extends Core {
public Burn() {
super(CoreType.BURN, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
player.setFireTicks(800);
return new CoreResult(true, player.getDisplayName() + " was burned by Herobrine.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.entity.Player;
public class Burn extends Core {
public Burn() {
super(CoreType.BURN, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
player.setFireTicks(800);
return new CoreResult(true, player.getDisplayName() + " was burned by Herobrine.");
}
}

View File

@ -1,75 +1,75 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
public class BuryPlayer extends Core {
public Block savedBlock1;
public Block savedBlock2;
public BuryPlayer() {
super(CoreType.BURY_PLAYER, AppearType.NORMAL);
savedBlock1 = null;
savedBlock2 = null;
}
@Override
public CoreResult callCore(final Object[] data) {
return FindPlace((Player) data[0]);
}
public CoreResult FindPlace(final Player player) {
if (Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
final Location loc = player.getLocation();
if (Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 3, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 3, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2).getType())
&& !Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() - 2).getType())) {
Bury(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), player);
return new CoreResult(true, player.getDisplayName() + " was buried by Herobrine.");
}
}
return new CoreResult(false, player.getDisplayName() + " could not be buried because a good burial location could not be found.");
}
public void Bury(final World world, final int X, final int Y, final int Z, final Player player) {
final Location loc = new Location(world, X, Y, Z);
loc.getWorld().getBlockAt(X, Y - 1, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 2, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 3, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 2, Z - 1).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 3, Z - 1).breakNaturally();
player.teleport(new Location(world, X, Y - 3, Z));
RegenBlocks(world, X, Y, Z, player.getName());
}
@SuppressWarnings("deprecation")
public void RegenBlocks(final World world, final int X, final int Y, final int Z, final String playername) {
final Location loc = new Location(world, X, Y, Z);
final Location signloc = new Location(world, X, Y, Z - 2);
final Block signblock = signloc.add(0.0, 0.0, 0.0).getBlock();
signblock.setType(Material.SIGN_POST);
final Sign sign = (Sign) signblock.getState();
sign.setLine(1, playername);
sign.update();
loc.getWorld().getBlockAt(X, Y - 1, Z).setTypeIdAndData(98, (byte) 2, false);
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).setTypeIdAndData(98, (byte) 2, false);
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
public class BuryPlayer extends Core {
public Block savedBlock1;
public Block savedBlock2;
public BuryPlayer() {
super(CoreType.BURY_PLAYER, AppearType.NORMAL);
savedBlock1 = null;
savedBlock2 = null;
}
@Override
public CoreResult callCore(final Object[] data) {
return FindPlace((Player) data[0]);
}
public CoreResult FindPlace(final Player player) {
if (Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
final Location loc = player.getLocation();
if (Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 3, loc.getBlockZ()).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 3, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 2, loc.getBlockZ() - 1).getType())
&& Herobrine.isSolidBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2).getType())
&& !Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() - 2).getType())) {
Bury(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), player);
return new CoreResult(true, player.getDisplayName() + " was buried by Herobrine.");
}
}
return new CoreResult(false, player.getDisplayName() + " could not be buried because a good burial location could not be found.");
}
public void Bury(final World world, final int X, final int Y, final int Z, final Player player) {
final Location loc = new Location(world, X, Y, Z);
loc.getWorld().getBlockAt(X, Y - 1, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 2, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 3, Z).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 2, Z - 1).breakNaturally();
loc.getWorld().getBlockAt(X, Y - 3, Z - 1).breakNaturally();
player.teleport(new Location(world, X, Y - 3, Z));
RegenBlocks(world, X, Y, Z, player.getName());
}
@SuppressWarnings("deprecation")
public void RegenBlocks(final World world, final int X, final int Y, final int Z, final String playername) {
final Location loc = new Location(world, X, Y, Z);
final Location signloc = new Location(world, X, Y, Z - 2);
final Block signblock = signloc.add(0.0, 0.0, 0.0).getBlock();
signblock.setType(Material.SIGN_POST);
final Sign sign = (Sign) signblock.getState();
sign.setLine(1, playername);
sign.update();
loc.getWorld().getBlockAt(X, Y - 1, Z).setTypeIdAndData(98, (byte) 2, false);
loc.getWorld().getBlockAt(X, Y - 1, Z - 1).setTypeIdAndData(98, (byte) 2, false);
}
}

View File

@ -1,42 +1,42 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Curse extends Core {
public Curse() {
super(CoreType.CURSE, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 1000, 1));
int i = 0;
while (i != 3) {
++i;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
player.getLocation().getWorld()
.strikeLightning(new Location(player.getLocation().getWorld(), player.getLocation().getX(), player.getLocation().getY() + 1.0, player.getLocation().getZ()));
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
}
}, i * 150L);
}
return new CoreResult(true, player.getDisplayName() + " has been cursed by Herobrine.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Curse extends Core {
public Curse() {
super(CoreType.CURSE, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 1000, 1));
int i = 0;
while (i != 3) {
++i;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
player.getLocation().getWorld()
.strikeLightning(new Location(player.getLocation().getWorld(), player.getLocation().getX(), player.getLocation().getY() + 1.0, player.getLocation().getZ()));
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
}
}, i * 150L);
}
return new CoreResult(true, player.getDisplayName() + " has been cursed by Herobrine.");
}
}

View File

@ -1,45 +1,45 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
public class DestroyTorches extends Core {
public DestroyTorches() {
super(CoreType.DESTROY_TORCHES, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return destroyTorches((Location) data[0]);
}
public CoreResult destroyTorches(final Location loc) {
if (Herobrine.getPluginCore().getConfigDB().DestroyTorches) {
final int x = loc.getBlockX();
final int y = loc.getBlockY();
final int z = loc.getBlockZ();
final World world = loc.getWorld();
int i = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
int ii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
int iii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
for (i = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; i <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++i) {
for (ii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ii <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++ii) {
for (iii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; iii <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++iii) {
if (world.getBlockAt(x + ii, y + i, z + iii).getType() == Material.TORCH) {
world.getBlockAt(x + ii, y + i, z + iii).breakNaturally();
return new CoreResult(true, "Torches successfully destroyed by Herobrine.");
}
}
}
}
}
return new CoreResult(false, "Herobrine could not destroy the torches.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
public class DestroyTorches extends Core {
public DestroyTorches() {
super(CoreType.DESTROY_TORCHES, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return destroyTorches((Location) data[0]);
}
public CoreResult destroyTorches(final Location loc) {
if (Herobrine.getPluginCore().getConfigDB().DestroyTorches) {
final int x = loc.getBlockX();
final int y = loc.getBlockY();
final int z = loc.getBlockZ();
final World world = loc.getWorld();
int i = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
int ii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
int iii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius;
for (i = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; i <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++i) {
for (ii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ii <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++ii) {
for (iii = -Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; iii <= Herobrine.getPluginCore().getConfigDB().DestroyTorchesRadius; ++iii) {
if (world.getBlockAt(x + ii, y + i, z + iii).getType() == Material.TORCH) {
world.getBlockAt(x + ii, y + i, z + iii).breakNaturally();
return new CoreResult(true, "Torches successfully destroyed by Herobrine.");
}
}
}
}
}
return new CoreResult(false, "Herobrine could not destroy the torches.");
}
}

View File

@ -1,133 +1,133 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.List;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class Graveyard extends Core {
private List<LivingEntity> LivingEntities;
private int ticks;
private double savedX;
private double savedY;
private double savedZ;
private World savedWorld;
private Player savedPlayer;
public Graveyard() {
super(CoreType.GRAVEYARD, AppearType.APPEAR);
ticks = 0;
savedX = 0.0;
savedY = 0.0;
savedZ = 0.0;
savedWorld = null;
savedPlayer = null;
}
@Override
public CoreResult callCore(final Object[] data) {
return Teleport((Player) data[0]);
}
public CoreResult Teleport(final Player player) {
if (!Herobrine.getPluginCore().getConfigDB().UseGraveyardWorld) {
return new CoreResult(false, "Herobrine's Graveyard is disabled on this server.");
}
LivingEntities = Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).getLivingEntities();
for (int i = 0; i <= (LivingEntities.size() - 1); ++i) {
if (!(LivingEntities.get(i) instanceof Player) && (LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID)) {
LivingEntities.get(i).remove();
}
}
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).setTime(15000L);
Herobrine.getPluginCore().getAICore();
AICore.PlayerTarget = player;
final Location loc = player.getLocation();
savedX = loc.getX();
savedY = loc.getY();
savedZ = loc.getZ();
savedWorld = loc.getWorld();
savedPlayer = player;
loc.setWorld(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName));
loc.setX(-2.49);
loc.setY(4.0);
loc.setZ(10.69);
loc.setYaw(-179.85f);
loc.setPitch(0.44999f);
player.teleport(loc);
Start();
Herobrine.getPluginCore().getAICore();
AICore.isTarget = true;
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).setStorm(false);
return new CoreResult(true, player.getDisplayName() + " has been teleported to Herobrine's Graveyard.");
}
public void Start() {
ticks = 0;
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -4.12));
HandlerInterval();
}
public void HandlerInterval() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Graveyard.this.Handler();
}
}, 5L);
}
public void Handler() {
LivingEntities = Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).getLivingEntities();
for (int i = 0; i <= (LivingEntities.size() - 1); ++i) {
if (!(LivingEntities.get(i) instanceof Player) && (LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID)) {
LivingEntities.get(i).remove();
}
}
if (!savedPlayer.isDead() && savedPlayer.isOnline() && (savedPlayer.getLocation().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) && (ticks != 90)) {
Herobrine.getPluginCore().getAICore();
if (AICore.isTarget) {
final Location ploc = savedPlayer.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
if (ticks == 1) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -4.12));
} else if (ticks == 40) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -0.5));
} else if (ticks == 60) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 5.1));
} else if (ticks == 84) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 7.5));
}
if (new Random().nextInt(4) == 1) {
final Location newloc = new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), new Random().nextInt(400), new Random().nextInt(20) + 20.0,
new Random().nextInt(400));
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).strikeLightning(newloc);
}
++ticks;
HandlerInterval();
return;
}
}
Herobrine.getPluginCore().getAICore();
if (AICore.PlayerTarget == savedPlayer) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.GRAVEYARD, true);
}
savedPlayer.teleport(new Location(savedWorld, savedX, savedY, savedZ));
}
public Location getSavedLocation() {
return new Location(savedWorld, savedX, savedY, savedZ);
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.List;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class Graveyard extends Core {
private List<LivingEntity> LivingEntities;
private int ticks;
private double savedX;
private double savedY;
private double savedZ;
private World savedWorld;
private Player savedPlayer;
public Graveyard() {
super(CoreType.GRAVEYARD, AppearType.APPEAR);
ticks = 0;
savedX = 0.0;
savedY = 0.0;
savedZ = 0.0;
savedWorld = null;
savedPlayer = null;
}
@Override
public CoreResult callCore(final Object[] data) {
return Teleport((Player) data[0]);
}
public CoreResult Teleport(final Player player) {
if (!Herobrine.getPluginCore().getConfigDB().UseGraveyardWorld) {
return new CoreResult(false, "Herobrine's Graveyard is disabled on this server.");
}
LivingEntities = Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).getLivingEntities();
for (int i = 0; i <= (LivingEntities.size() - 1); ++i) {
if (!(LivingEntities.get(i) instanceof Player) && (LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID)) {
LivingEntities.get(i).remove();
}
}
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).setTime(15000L);
Herobrine.getPluginCore().getAICore();
AICore.PlayerTarget = player;
final Location loc = player.getLocation();
savedX = loc.getX();
savedY = loc.getY();
savedZ = loc.getZ();
savedWorld = loc.getWorld();
savedPlayer = player;
loc.setWorld(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName));
loc.setX(-2.49);
loc.setY(4.0);
loc.setZ(10.69);
loc.setYaw(-179.85f);
loc.setPitch(0.44999f);
player.teleport(loc);
Start();
Herobrine.getPluginCore().getAICore();
AICore.isTarget = true;
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).setStorm(false);
return new CoreResult(true, player.getDisplayName() + " has been teleported to Herobrine's Graveyard.");
}
public void Start() {
ticks = 0;
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -4.12));
HandlerInterval();
}
public void HandlerInterval() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Graveyard.this.Handler();
}
}, 5L);
}
public void Handler() {
LivingEntities = Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).getLivingEntities();
for (int i = 0; i <= (LivingEntities.size() - 1); ++i) {
if (!(LivingEntities.get(i) instanceof Player) && (LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID)) {
LivingEntities.get(i).remove();
}
}
if (!savedPlayer.isDead() && savedPlayer.isOnline() && (savedPlayer.getLocation().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) && (ticks != 90)) {
Herobrine.getPluginCore().getAICore();
if (AICore.isTarget) {
final Location ploc = savedPlayer.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
if (ticks == 1) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -4.12));
} else if (ticks == 40) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, -0.5));
} else if (ticks == 60) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 5.1));
} else if (ticks == 84) {
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 7.5));
}
if (new Random().nextInt(4) == 1) {
final Location newloc = new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), new Random().nextInt(400), new Random().nextInt(20) + 20.0,
new Random().nextInt(400));
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).strikeLightning(newloc);
}
++ticks;
HandlerInterval();
return;
}
}
Herobrine.getPluginCore().getAICore();
if (AICore.PlayerTarget == savedPlayer) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.GRAVEYARD, true);
}
savedPlayer.teleport(new Location(savedWorld, savedX, savedY, savedZ));
}
public Location getSavedLocation() {
return new Location(savedWorld, savedX, savedY, savedZ);
}
}

View File

@ -1,335 +1,335 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
public class Haunt extends Core {
private int _ticks;
private int spawnedWolves;
private int spawnedBats;
private int KL_INT;
private int PS_INT;
private boolean isHandler;
private boolean isFirst;
public Haunt() {
super(CoreType.HAUNT, AppearType.APPEAR);
_ticks = 0;
spawnedWolves = 0;
spawnedBats = 0;
KL_INT = 0;
PS_INT = 0;
isHandler = false;
isFirst = true;
}
@Override
public CoreResult callCore(final Object[] data) {
return setHauntTarget((Player) data[0]);
}
public CoreResult setHauntTarget(final Player player) {
if (!Herobrine.getPluginCore().getSupport().checkHaunt(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " cannot be haunted because they are in a protected area.");
}
if (!Herobrine.getPluginCore().canAttackPlayerNoMSG(player)) {
return new CoreResult(false, player.getDisplayName() + " is protected from being haunted by Herobrine.");
}
spawnedWolves = 0;
spawnedBats = 0;
_ticks = 0;
isFirst = true;
AICore.isTarget = true;
AICore.PlayerTarget = player;
AICore.log.info("[HerobrineAI] Herobrine is now haunting " + player.getDisplayName() + ".");
final Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
loc.setY(-20.0);
Herobrine.herobrineNPC.moveTo(loc);
StartHandler();
return new CoreResult(true, "Herobrine is now haunting " + player.getDisplayName() + ".");
}
public void PlaySounds() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
if (_ticks > 290) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
} else {
final Object[] data = { AICore.PlayerTarget };
Herobrine.getPluginCore().getAICore().getCore(CoreType.SOUNDF).runCore(data);
final Location ploc = AICore.PlayerTarget.getLocation();
final Random randxgen = new Random();
final int randx = randxgen.nextInt(100);
if (randx >= 70) {
if ((randx < 80) && (spawnedBats < 2)) {
if (Herobrine.getPluginCore().getConfigDB().SpawnBats) {
ploc.getWorld().spawnEntity(ploc, EntityType.BAT);
++spawnedBats;
}
} else if ((randx < 90) && (spawnedWolves < 1) && Herobrine.getPluginCore().getConfigDB().SpawnWolves) {
final Wolf wolf = (Wolf) ploc.getWorld().spawnEntity(ploc, EntityType.WOLF);
wolf.setAdult();
wolf.setTarget(AICore.PlayerTarget);
wolf.setAngry(true);
wolf.damage(5);
++spawnedWolves;
}
}
if (Herobrine.getPluginCore().getConfigDB().Lightning) {
final int lchance = new Random().nextInt(100);
if (lchance > 75) {
final Location newloc = ploc;
final int randz = new Random().nextInt(50);
final int randxp = new Random().nextInt(1);
final int randzp = new Random().nextInt(1);
if (randxp == 1) {
newloc.setX(newloc.getX() + randx);
} else {
newloc.setX(newloc.getX() - randx);
}
if (randzp == 1) {
newloc.setZ(newloc.getZ() + randz);
} else {
newloc.setZ(newloc.getZ() - randz);
}
newloc.setY(250.0);
newloc.getWorld().strikeLightning(newloc);
}
}
if (isFirst) {
final Object[] data2 = { AICore.PlayerTarget.getLocation() };
Herobrine.getPluginCore().getAICore().getCore(CoreType.BUILD_STUFF).runCore(data2);
}
isFirst = false;
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public void KeepLookingHaunt() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getEntityId() != Herobrine.herobrineEntityID) {
Location ploc = player.getLocation();
if (
(ploc.getWorld().equals(loc.getWorld())) &&
((ploc.getX() + 5.0) > loc.getX()) &&
((ploc.getX() - 5.0) < loc.getX()) &&
((ploc.getZ() + 5.0) > loc.getZ()) &&
((ploc.getZ() - 5.0) < loc.getZ()) &&
((ploc.getY() + 5.0) > loc.getY()) &&
((ploc.getY() - 5.0) < loc.getY())
) {
Herobrine.getPluginCore().getAICore().disappearEffect();
}
}
}
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
loc = AICore.PlayerTarget.getLocation();
loc.setY(loc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(loc);
++_ticks;
final AICore _aicore = Herobrine.getPluginCore().getAICore();
switch (_ticks) {
case 0: {
HauntTP();
break;
}
case 20: {
_aicore.disappearEffect();
break;
}
case 30: {
HauntTP();
break;
}
case 50: {
_aicore.disappearEffect();
break;
}
case 60: {
HauntTP();
break;
}
case 80: {
_aicore.disappearEffect();
break;
}
case 90: {
HauntTP();
break;
}
case 110: {
_aicore.disappearEffect();
break;
}
case 120: {
HauntTP();
break;
}
case 140: {
_aicore.disappearEffect();
break;
}
case 150: {
HauntTP();
break;
}
case 170: {
_aicore.disappearEffect();
break;
}
case 180: {
HauntTP();
break;
}
case 200: {
_aicore.disappearEffect();
break;
}
case 210: {
HauntTP();
break;
}
case 230: {
_aicore.disappearEffect();
break;
}
case 240: {
HauntTP();
break;
}
case 260: {
_aicore.disappearEffect();
break;
}
case 270: {
HauntTP();
break;
}
case 290: {
_aicore.disappearEffect();
break;
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public void HauntTP() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())) {
FindPlace(AICore.PlayerTarget);
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public boolean FindPlace(final Player player) {
final Location loc = player.getLocation();
int x = 0;
int z = 0;
int y = 0;
int xMax = new Random().nextInt(10) + 10;
int zMax = new Random().nextInt(10) + 10;
final int randY = new Random().nextInt(5) + 5;
xMax = (new Random().nextBoolean() ? (-xMax) : xMax);
zMax = (new Random().nextBoolean() ? (-zMax) : zMax);
for (y = -randY; y <= randY; ++y) {
x = -xMax;
while (true) {
if (xMax <= 0) {
if (x < xMax) {
break;
}
} else if (x > xMax) {
break;
}
z = -zMax;
while (true) {
if (zMax <= 0) {
if (z < zMax) {
break;
}
} else if (z > zMax) {
break;
}
if (((x < -4) || (x > 4) || (z < -4) || (z > 4)) && Herobrine.isSolidBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), (y + loc.getBlockY()) - 1, z + loc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), y + loc.getBlockY() + 1, z + loc.getBlockZ()).getType())) {
Teleport(loc.getWorld(), x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ());
}
z += ((zMax <= 0) ? -1 : 1);
}
x += ((xMax <= 0) ? -1 : 1);
}
}
return false;
}
public void Teleport(final World world, final int X, final int Y, final int Z) {
final Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
loc.setWorld(world);
loc.setX(X);
loc.setY(Y);
loc.setZ(Z);
Herobrine.herobrineNPC.moveTo(loc);
}
public void StartHandler() {
isHandler = true;
KL_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Haunt.this.KeepLookingHaunt();
}
}, 5L, 5L);
PS_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Haunt.this.PlaySounds();
}
}, 35L, 35L);
}
public void StopHandler() {
if (isHandler) {
isHandler = false;
Bukkit.getScheduler().cancelTask(KL_INT);
Bukkit.getScheduler().cancelTask(PS_INT);
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
public class Haunt extends Core {
private int _ticks;
private int spawnedWolves;
private int spawnedBats;
private int KL_INT;
private int PS_INT;
private boolean isHandler;
private boolean isFirst;
public Haunt() {
super(CoreType.HAUNT, AppearType.APPEAR);
_ticks = 0;
spawnedWolves = 0;
spawnedBats = 0;
KL_INT = 0;
PS_INT = 0;
isHandler = false;
isFirst = true;
}
@Override
public CoreResult callCore(final Object[] data) {
return setHauntTarget((Player) data[0]);
}
public CoreResult setHauntTarget(final Player player) {
if (!Herobrine.getPluginCore().getSupport().checkHaunt(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " cannot be haunted because they are in a protected area.");
}
if (!Herobrine.getPluginCore().canAttackPlayerNoMSG(player)) {
return new CoreResult(false, player.getDisplayName() + " is protected from being haunted by Herobrine.");
}
spawnedWolves = 0;
spawnedBats = 0;
_ticks = 0;
isFirst = true;
AICore.isTarget = true;
AICore.PlayerTarget = player;
AICore.log.info("[HerobrineAI] Herobrine is now haunting " + player.getDisplayName() + ".");
final Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
loc.setY(-20.0);
Herobrine.herobrineNPC.moveTo(loc);
StartHandler();
return new CoreResult(true, "Herobrine is now haunting " + player.getDisplayName() + ".");
}
public void PlaySounds() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
if (_ticks > 290) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
} else {
final Object[] data = { AICore.PlayerTarget };
Herobrine.getPluginCore().getAICore().getCore(CoreType.SOUNDF).runCore(data);
final Location ploc = AICore.PlayerTarget.getLocation();
final Random randxgen = new Random();
final int randx = randxgen.nextInt(100);
if (randx >= 70) {
if ((randx < 80) && (spawnedBats < 2)) {
if (Herobrine.getPluginCore().getConfigDB().SpawnBats) {
ploc.getWorld().spawnEntity(ploc, EntityType.BAT);
++spawnedBats;
}
} else if ((randx < 90) && (spawnedWolves < 1) && Herobrine.getPluginCore().getConfigDB().SpawnWolves) {
final Wolf wolf = (Wolf) ploc.getWorld().spawnEntity(ploc, EntityType.WOLF);
wolf.setAdult();
wolf.setTarget(AICore.PlayerTarget);
wolf.setAngry(true);
wolf.damage(5);
++spawnedWolves;
}
}
if (Herobrine.getPluginCore().getConfigDB().Lightning) {
final int lchance = new Random().nextInt(100);
if (lchance > 75) {
final Location newloc = ploc;
final int randz = new Random().nextInt(50);
final int randxp = new Random().nextInt(1);
final int randzp = new Random().nextInt(1);
if (randxp == 1) {
newloc.setX(newloc.getX() + randx);
} else {
newloc.setX(newloc.getX() - randx);
}
if (randzp == 1) {
newloc.setZ(newloc.getZ() + randz);
} else {
newloc.setZ(newloc.getZ() - randz);
}
newloc.setY(250.0);
newloc.getWorld().strikeLightning(newloc);
}
}
if (isFirst) {
final Object[] data2 = { AICore.PlayerTarget.getLocation() };
Herobrine.getPluginCore().getAICore().getCore(CoreType.BUILD_STUFF).runCore(data2);
}
isFirst = false;
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public void KeepLookingHaunt() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getEntityId() != Herobrine.herobrineEntityID) {
Location ploc = player.getLocation();
if (
(ploc.getWorld().equals(loc.getWorld())) &&
((ploc.getX() + 5.0) > loc.getX()) &&
((ploc.getX() - 5.0) < loc.getX()) &&
((ploc.getZ() + 5.0) > loc.getZ()) &&
((ploc.getZ() - 5.0) < loc.getZ()) &&
((ploc.getY() + 5.0) > loc.getY()) &&
((ploc.getY() - 5.0) < loc.getY())
) {
Herobrine.getPluginCore().getAICore().disappearEffect();
}
}
}
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
loc = AICore.PlayerTarget.getLocation();
loc.setY(loc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(loc);
++_ticks;
final AICore _aicore = Herobrine.getPluginCore().getAICore();
switch (_ticks) {
case 0: {
HauntTP();
break;
}
case 20: {
_aicore.disappearEffect();
break;
}
case 30: {
HauntTP();
break;
}
case 50: {
_aicore.disappearEffect();
break;
}
case 60: {
HauntTP();
break;
}
case 80: {
_aicore.disappearEffect();
break;
}
case 90: {
HauntTP();
break;
}
case 110: {
_aicore.disappearEffect();
break;
}
case 120: {
HauntTP();
break;
}
case 140: {
_aicore.disappearEffect();
break;
}
case 150: {
HauntTP();
break;
}
case 170: {
_aicore.disappearEffect();
break;
}
case 180: {
HauntTP();
break;
}
case 200: {
_aicore.disappearEffect();
break;
}
case 210: {
HauntTP();
break;
}
case 230: {
_aicore.disappearEffect();
break;
}
case 240: {
HauntTP();
break;
}
case 260: {
_aicore.disappearEffect();
break;
}
case 270: {
HauntTP();
break;
}
case 290: {
_aicore.disappearEffect();
break;
}
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public void HauntTP() {
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == CoreType.HAUNT)) {
if (!AICore.PlayerTarget.isDead()) {
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())) {
FindPlace(AICore.PlayerTarget);
final Location ploc = AICore.PlayerTarget.getLocation();
ploc.setY(ploc.getY() + 1.5);
Herobrine.herobrineNPC.lookAtPoint(ploc);
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
} else {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.HAUNT, true);
}
}
public boolean FindPlace(final Player player) {
final Location loc = player.getLocation();
int x = 0;
int z = 0;
int y = 0;
int xMax = new Random().nextInt(10) + 10;
int zMax = new Random().nextInt(10) + 10;
final int randY = new Random().nextInt(5) + 5;
xMax = (new Random().nextBoolean() ? (-xMax) : xMax);
zMax = (new Random().nextBoolean() ? (-zMax) : zMax);
for (y = -randY; y <= randY; ++y) {
x = -xMax;
while (true) {
if (xMax <= 0) {
if (x < xMax) {
break;
}
} else if (x > xMax) {
break;
}
z = -zMax;
while (true) {
if (zMax <= 0) {
if (z < zMax) {
break;
}
} else if (z > zMax) {
break;
}
if (((x < -4) || (x > 4) || (z < -4) || (z > 4)) && Herobrine.isSolidBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), (y + loc.getBlockY()) - 1, z + loc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(x + loc.getBlockX(), y + loc.getBlockY() + 1, z + loc.getBlockZ()).getType())) {
Teleport(loc.getWorld(), x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ());
}
z += ((zMax <= 0) ? -1 : 1);
}
x += ((xMax <= 0) ? -1 : 1);
}
}
return false;
}
public void Teleport(final World world, final int X, final int Y, final int Z) {
final Location loc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
loc.setWorld(world);
loc.setX(X);
loc.setY(Y);
loc.setZ(Z);
Herobrine.herobrineNPC.moveTo(loc);
}
public void StartHandler() {
isHandler = true;
KL_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Haunt.this.KeepLookingHaunt();
}
}, 5L, 5L);
PS_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Haunt.this.PlaySounds();
}
}, 35L, 35L);
}
public void StopHandler() {
if (isHandler) {
isHandler = false;
Bukkit.getScheduler().cancelTask(KL_INT);
Bukkit.getScheduler().cancelTask(PS_INT);
}
}
}

View File

@ -1,87 +1,87 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.BlockChanger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class Heads extends Core {
private boolean isCalled;
private ArrayList<Block> headList;
public Heads() {
super(CoreType.HEADS, AppearType.NORMAL);
isCalled = false;
headList = new ArrayList<Block>();
}
@SuppressWarnings("deprecation")
@Override
public CoreResult callCore(final Object[] data) {
if (isCalled) {
return new CoreResult(false, "This player is already being haunted by heads. Please wait until they disappear.");
}
if (!Bukkit.getPlayer((String) data[0]).isOnline()) {
return new CoreResult(false, "This player cannot be haunted by heads because they are not online.");
}
final Player player = Bukkit.getServer().getPlayer((String) data[0]);
if (!Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " cannot be haunted by heads because they are in a protected area.");
}
if (Herobrine.getPluginCore().getConfigDB().UseHeads) {
final Location loc = player.getLocation();
final int px = loc.getBlockX();
final int pz = loc.getBlockZ();
int y = 0;
int x = -7;
int z = -7;
for (x = -7; x <= 7; ++x) {
for (z = -7; z <= 7; ++z) {
if (new Random().nextInt(7) == new Random().nextInt(7)) {
if (Herobrine.isAllowedBlock(loc.getWorld().getHighestBlockAt(px + x, pz + z).getType())) {
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z);
} else {
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z) + 1;
}
final Block block = loc.getWorld().getBlockAt(px + x, y, pz + z);
BlockChanger.PlaceSkull(block.getLocation(), "Herobrine");
headList.add(block);
}
}
}
isCalled = true;
Bukkit.getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Heads.this.RemoveHeads();
}
}, 100L);
return new CoreResult(true, player.getName() + " is now being haunted by heads.");
}
return new CoreResult(false, "Head haunting is disabled on this server.");
}
public void RemoveHeads() {
for (final Block h : headList) {
h.setType(Material.AIR);
}
headList.clear();
isCalled = false;
}
public ArrayList<Block> getHeadList() {
return headList;
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.BlockChanger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class Heads extends Core {
private boolean isCalled;
private ArrayList<Block> headList;
public Heads() {
super(CoreType.HEADS, AppearType.NORMAL);
isCalled = false;
headList = new ArrayList<Block>();
}
@SuppressWarnings("deprecation")
@Override
public CoreResult callCore(final Object[] data) {
if (isCalled) {
return new CoreResult(false, "This player is already being haunted by heads. Please wait until they disappear.");
}
if (!Bukkit.getPlayer((String) data[0]).isOnline()) {
return new CoreResult(false, "This player cannot be haunted by heads because they are not online.");
}
final Player player = Bukkit.getServer().getPlayer((String) data[0]);
if (!Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
return new CoreResult(false, player.getDisplayName() + " cannot be haunted by heads because they are in a protected area.");
}
if (Herobrine.getPluginCore().getConfigDB().UseHeads) {
final Location loc = player.getLocation();
final int px = loc.getBlockX();
final int pz = loc.getBlockZ();
int y = 0;
int x = -7;
int z = -7;
for (x = -7; x <= 7; ++x) {
for (z = -7; z <= 7; ++z) {
if (new Random().nextInt(7) == new Random().nextInt(7)) {
if (Herobrine.isAllowedBlock(loc.getWorld().getHighestBlockAt(px + x, pz + z).getType())) {
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z);
} else {
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z) + 1;
}
final Block block = loc.getWorld().getBlockAt(px + x, y, pz + z);
BlockChanger.PlaceSkull(block.getLocation(), "Herobrine");
headList.add(block);
}
}
}
isCalled = true;
Bukkit.getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Heads.this.RemoveHeads();
}
}, 100L);
return new CoreResult(true, player.getName() + " is now being haunted by heads.");
}
return new CoreResult(false, "Head haunting is disabled on this server.");
}
public void RemoveHeads() {
for (final Block h : headList) {
h.setType(Material.AIR);
}
headList.clear();
isCalled = false;
}
public ArrayList<Block> getHeadList() {
return headList;
}
}

View File

@ -1,159 +1,159 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
public class Pyramid extends Core {
public Pyramid() {
super(CoreType.PYRAMID, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
if (data[0] instanceof Player) {
return this.FindPlace((Player) data[0]);
}
return this.FindPlace((Chunk) data[0]);
}
public CoreResult FindPlace(final Chunk chunk) {
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids) {
Location loc = chunk.getBlock(2, 0, 2).getLocation();
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
final int i2 = 5;
final int i3 = 5;
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (i1 = -5; i1 <= 5; ++i1) {
canBuild = true;
for (i4 = -1; i4 <= 3; ++i4) {
for (i5 = -2; i5 <= 2; ++i5) {
for (i6 = -2; i6 <= 2; ++i6) {
if ((loc.getBlockX() == (i2 + i5 + loc.getBlockX())) && (loc.getBlockY() == (i1 + i4 + loc.getBlockY())) && (loc.getBlockZ() == (i3 + i6 + loc.getBlockZ()))) {
canBuild = false;
}
if (i4 == -1) {
if (canBuild) {
canBuild = Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
} else if (canBuild) {
canBuild = Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
}
}
}
if (canBuild) {
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating pyramid...");
}
}
}
return new CoreResult(false, "Pyramid generation failed.");
}
public CoreResult FindPlace(final Player player) {
Location loc = player.getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
final int xMax = new Random().nextInt(15) - 10;
final int zMax = new Random().nextInt(15) - 10;
for (i1 = -5; i1 <= 5; ++i1) {
for (i2 = xMax; i2 <= 15; ++i2) {
for (i3 = zMax; i3 <= 15; ++i3) {
canBuild = true;
for (i4 = -1; i4 <= 3; ++i4) {
for (i5 = -2; i5 <= 2; ++i5) {
for (i6 = -2; i6 <= 2; ++i6) {
if ((player.getLocation().getBlockX() == (i2 + i5 + loc.getBlockX())) && (player.getLocation().getBlockY() == (i1 + i4 + loc.getBlockY()))
&& (player.getLocation().getBlockZ() == (i3 + i6 + loc.getBlockZ()))) {
canBuild = false;
}
if (i4 == -1) {
if (canBuild) {
canBuild = Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
} else if (canBuild) {
canBuild = Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
}
}
}
if (canBuild) {
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating a pyramid...");
}
}
}
}
return new CoreResult(false, "Pyramid generation failed.");
}
public void BuildPyramid(final World world, final int X, final int Y, final int Z) {
if (Herobrine.getPluginCore().getSupport().checkBuild(new Location(world, X, Y, Z))) {
AICore.log.info("Creating pyramid at " + X + "," + Y + "," + Z);
final Material mainMat = Material.SANDSTONE;
world.getBlockAt(X, Y, Z).setType(mainMat);
world.getBlockAt(X - 2, Y, Z).setType(mainMat);
world.getBlockAt(X - 1, Y, Z).setType(mainMat);
world.getBlockAt(X + 1, Y, Z).setType(mainMat);
world.getBlockAt(X + 2, Y, Z).setType(mainMat);
world.getBlockAt(X - 2, Y, Z - 1).setType(mainMat);
world.getBlockAt(X - 2, Y, Z + 1).setType(mainMat);
world.getBlockAt(X - 1, Y, Z - 1).setType(mainMat);
world.getBlockAt(X - 1, Y, Z + 1).setType(mainMat);
world.getBlockAt(X, Y, Z - 1).setType(mainMat);
world.getBlockAt(X, Y, Z + 1).setType(mainMat);
world.getBlockAt(X, Y, Z - 2).setType(mainMat);
world.getBlockAt(X, Y, Z + 2).setType(mainMat);
world.getBlockAt(X - 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X - 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 1).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 1).setType(mainMat);
world.getBlockAt(X + 2, Y, Z - 1).setType(mainMat);
world.getBlockAt(X + 2, Y, Z + 1).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X, Y + 1, Z).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X, Y + 2, Z).setType(mainMat);
world.getBlockAt(X, Y + 3, Z).setType(Material.REDSTONE_TORCH_ON);
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
public class Pyramid extends Core {
public Pyramid() {
super(CoreType.PYRAMID, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
if (data[0] instanceof Player) {
return this.FindPlace((Player) data[0]);
}
return this.FindPlace((Chunk) data[0]);
}
public CoreResult FindPlace(final Chunk chunk) {
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids) {
Location loc = chunk.getBlock(2, 0, 2).getLocation();
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
final int i2 = 5;
final int i3 = 5;
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (i1 = -5; i1 <= 5; ++i1) {
canBuild = true;
for (i4 = -1; i4 <= 3; ++i4) {
for (i5 = -2; i5 <= 2; ++i5) {
for (i6 = -2; i6 <= 2; ++i6) {
if ((loc.getBlockX() == (i2 + i5 + loc.getBlockX())) && (loc.getBlockY() == (i1 + i4 + loc.getBlockY())) && (loc.getBlockZ() == (i3 + i6 + loc.getBlockZ()))) {
canBuild = false;
}
if (i4 == -1) {
if (canBuild) {
canBuild = Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
} else if (canBuild) {
canBuild = Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
}
}
}
if (canBuild) {
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating pyramid...");
}
}
}
return new CoreResult(false, "Pyramid generation failed.");
}
public CoreResult FindPlace(final Player player) {
Location loc = player.getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
final int xMax = new Random().nextInt(15) - 10;
final int zMax = new Random().nextInt(15) - 10;
for (i1 = -5; i1 <= 5; ++i1) {
for (i2 = xMax; i2 <= 15; ++i2) {
for (i3 = zMax; i3 <= 15; ++i3) {
canBuild = true;
for (i4 = -1; i4 <= 3; ++i4) {
for (i5 = -2; i5 <= 2; ++i5) {
for (i6 = -2; i6 <= 2; ++i6) {
if ((player.getLocation().getBlockX() == (i2 + i5 + loc.getBlockX())) && (player.getLocation().getBlockY() == (i1 + i4 + loc.getBlockY()))
&& (player.getLocation().getBlockZ() == (i3 + i6 + loc.getBlockZ()))) {
canBuild = false;
}
if (i4 == -1) {
if (canBuild) {
canBuild = Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
} else if (canBuild) {
canBuild = Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType());
}
}
}
}
if (canBuild) {
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating a pyramid...");
}
}
}
}
return new CoreResult(false, "Pyramid generation failed.");
}
public void BuildPyramid(final World world, final int X, final int Y, final int Z) {
if (Herobrine.getPluginCore().getSupport().checkBuild(new Location(world, X, Y, Z))) {
AICore.log.info("Creating pyramid at " + X + "," + Y + "," + Z);
final Material mainMat = Material.SANDSTONE;
world.getBlockAt(X, Y, Z).setType(mainMat);
world.getBlockAt(X - 2, Y, Z).setType(mainMat);
world.getBlockAt(X - 1, Y, Z).setType(mainMat);
world.getBlockAt(X + 1, Y, Z).setType(mainMat);
world.getBlockAt(X + 2, Y, Z).setType(mainMat);
world.getBlockAt(X - 2, Y, Z - 1).setType(mainMat);
world.getBlockAt(X - 2, Y, Z + 1).setType(mainMat);
world.getBlockAt(X - 1, Y, Z - 1).setType(mainMat);
world.getBlockAt(X - 1, Y, Z + 1).setType(mainMat);
world.getBlockAt(X, Y, Z - 1).setType(mainMat);
world.getBlockAt(X, Y, Z + 1).setType(mainMat);
world.getBlockAt(X, Y, Z - 2).setType(mainMat);
world.getBlockAt(X, Y, Z + 2).setType(mainMat);
world.getBlockAt(X - 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X - 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 1).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 1).setType(mainMat);
world.getBlockAt(X + 2, Y, Z - 1).setType(mainMat);
world.getBlockAt(X + 2, Y, Z + 1).setType(mainMat);
world.getBlockAt(X + 1, Y, Z - 2).setType(mainMat);
world.getBlockAt(X + 1, Y, Z + 2).setType(mainMat);
world.getBlockAt(X, Y + 1, Z).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X - 1, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X + 1, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z + 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X, Y + 1, Z - 1).setType(mainMat);
world.getBlockAt(X, Y + 2, Z).setType(mainMat);
world.getBlockAt(X, Y + 3, Z).setType(Material.REDSTONE_TORCH_ON);
}
}
}

View File

@ -1,36 +1,36 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class RandomExplosion extends Core {
public RandomExplosion() {
super(CoreType.RANDOM_EXPLOSION, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
if (!Herobrine.getPluginCore().getConfigDB().Explosions) {
return new CoreResult(true, "Herobrine-caused explosions are disabled on this server.");
}
if (Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
final Location loc = player.getLocation();
final int x = loc.getBlockX() + (new Random().nextInt(16) - 8);
final int y = loc.getBlockY();
final int z = loc.getBlockZ() + (new Random().nextInt(16) - 8);
loc.getWorld().createExplosion(new Location(loc.getWorld(), x, y, z), 1.0f);
return new CoreResult(true, "A Herobrine-caused explosion was set off near " + player.getDisplayName());
}
return new CoreResult(true, "A Herobrine-caused explosion cannot be set off near " + player.getDisplayName() + " because " +
"they are in a protected area.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class RandomExplosion extends Core {
public RandomExplosion() {
super(CoreType.RANDOM_EXPLOSION, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
final Player player = (Player) data[0];
if (!Herobrine.getPluginCore().getConfigDB().Explosions) {
return new CoreResult(true, "Herobrine-caused explosions are disabled on this server.");
}
if (Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
final Location loc = player.getLocation();
final int x = loc.getBlockX() + (new Random().nextInt(16) - 8);
final int y = loc.getBlockY();
final int z = loc.getBlockZ() + (new Random().nextInt(16) - 8);
loc.getWorld().createExplosion(new Location(loc.getWorld(), x, y, z), 1.0f);
return new CoreResult(true, "A Herobrine-caused explosion was set off near " + player.getDisplayName());
}
return new CoreResult(true, "A Herobrine-caused explosion cannot be set off near " + player.getDisplayName() + " because " +
"they are in a protected area.");
}
}

View File

@ -1,28 +1,28 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
public class RandomSound extends Core {
public RandomSound() {
super(CoreType.RANDOM_SOUND, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
for (int multip = 1; multip != 7; ++multip) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
Herobrine.getPluginCore().getAICore().getCore(CoreType.SOUNDF).runCore(data);
}
}, multip * 30L);
}
return new CoreResult(true, "Herobrine haunted the target with sound.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Bukkit;
public class RandomSound extends Core {
public RandomSound() {
super(CoreType.RANDOM_SOUND, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
for (int multip = 1; multip != 7; ++multip) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
Herobrine.getPluginCore().getAICore().getCore(CoreType.SOUNDF).runCore(data);
}
}, multip * 30L);
}
return new CoreResult(true, "Herobrine haunted the target with sound.");
}
}

View File

@ -1,77 +1,77 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.BlockChanger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
public class Signs extends Core {
public Signs() {
super(CoreType.SIGNS, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return placeSign((Location) data[0], (Location) data[1]);
}
public CoreResult placeSign(final Location loc, final Location ploc) {
boolean status = false;
AICore.log.info("Generating sign...");
if ((loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY() - 1, loc.getBlockZ()).getType() != Material.AIR)) {
loc.setX(loc.getBlockX() + 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY() - 1, loc.getBlockZ()).getType() != Material.AIR)) {
loc.setX(loc.getBlockX() - 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() + 2).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() + 2).getType() != Material.AIR)) {
loc.setZ(loc.getBlockZ() + 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() - 2).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2).getType() != Material.AIR)) {
loc.setZ(loc.getBlockZ() - 2);
createSign(loc, ploc);
status = true;
}
if (status) {
return new CoreResult(true, "Sign generated successfully.");
}
return new CoreResult(false, "Sign generation failed.");
}
@SuppressWarnings("deprecation")
public void createSign(final Location loc, final Location ploc) {
final Random randcgen = new Random();
final int chance = randcgen.nextInt(100);
if (chance > (100 - Herobrine.getPluginCore().getConfigDB().SignChance)) {
final Random randgen = new Random();
final int count = Herobrine.getPluginCore().getConfigDB().useSignMessages.size();
final int randmsg = randgen.nextInt(count);
final Block signblock = loc.add(0.0, 0.0, 0.0).getBlock();
final Block undersignblock = signblock.getLocation().subtract(0.0, 1.0, 0.0).getBlock();
if (Herobrine.isAllowedBlock(signblock.getType()) && !Herobrine.isAllowedBlock(undersignblock.getType())) {
signblock.setType(Material.SIGN_POST);
final Sign sign = (Sign) signblock.getState();
sign.setLine(1, Herobrine.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
sign.setRawData((byte) BlockChanger.getPlayerBlockFace(ploc).ordinal());
sign.update();
}
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.BlockChanger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
public class Signs extends Core {
public Signs() {
super(CoreType.SIGNS, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return placeSign((Location) data[0], (Location) data[1]);
}
public CoreResult placeSign(final Location loc, final Location ploc) {
boolean status = false;
AICore.log.info("Generating sign...");
if ((loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY() - 1, loc.getBlockZ()).getType() != Material.AIR)) {
loc.setX(loc.getBlockX() + 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY() - 1, loc.getBlockZ()).getType() != Material.AIR)) {
loc.setX(loc.getBlockX() - 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() + 2).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() + 2).getType() != Material.AIR)) {
loc.setZ(loc.getBlockZ() + 2);
createSign(loc, ploc);
status = true;
} else if ((loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() - 2).getType() == Material.AIR)
&& (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2).getType() != Material.AIR)) {
loc.setZ(loc.getBlockZ() - 2);
createSign(loc, ploc);
status = true;
}
if (status) {
return new CoreResult(true, "Sign generated successfully.");
}
return new CoreResult(false, "Sign generation failed.");
}
@SuppressWarnings("deprecation")
public void createSign(final Location loc, final Location ploc) {
final Random randcgen = new Random();
final int chance = randcgen.nextInt(100);
if (chance > (100 - Herobrine.getPluginCore().getConfigDB().SignChance)) {
final Random randgen = new Random();
final int count = Herobrine.getPluginCore().getConfigDB().useSignMessages.size();
final int randmsg = randgen.nextInt(count);
final Block signblock = loc.add(0.0, 0.0, 0.0).getBlock();
final Block undersignblock = signblock.getLocation().subtract(0.0, 1.0, 0.0).getBlock();
if (Herobrine.isAllowedBlock(signblock.getType()) && !Herobrine.isAllowedBlock(undersignblock.getType())) {
signblock.setType(Material.SIGN_POST);
final Sign sign = (Sign) signblock.getState();
sign.setLine(1, Herobrine.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
sign.setRawData((byte) BlockChanger.getPlayerBlockFace(ploc).ordinal());
sign.update();
}
}
}
}

View File

@ -1,46 +1,46 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class SoundF extends Core {
public SoundF() {
super(CoreType.SOUNDF, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return playRandom((Player) data[0]);
}
public CoreResult playRandom(final Player player) {
if (!Herobrine.getPluginCore().getConfigDB().UseSound) {
return new CoreResult(false, "Herobrine-caused sound is disabled on this server.");
}
final Sound[] sounds = { Sound.BLOCK_STONE_STEP, Sound.BLOCK_WOOD_STEP, Sound.BLOCK_GRASS_STEP, Sound.BLOCK_SAND_STEP,
Sound.BLOCK_GRAVEL_STEP, Sound.ENTITY_WITHER_HURT, Sound.ENTITY_WITHER_HURT, Sound.ENTITY_WITHER_HURT,
Sound.ENTITY_WITHER_HURT, Sound.BLOCK_WOODEN_DOOR_OPEN, Sound.BLOCK_WOODEN_DOOR_CLOSE, Sound.ENTITY_GHAST_SCREAM,
Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_HURT };
final int chance = new Random().nextInt(14);
int randx = new Random().nextInt(3);
int randz = new Random().nextInt(3);
final int randxp = new Random().nextInt(1);
final int randzp = new Random().nextInt(1);
if ((randxp == 0) && (randx != 0)) {
randx = -randx;
}
if ((randzp == 0) && (randz != 0)) {
randz = -randz;
}
player.playSound(player.getLocation(), sounds[chance], 0.75f, 0.75f);
return new CoreResult(true, "SoundF is starting.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class SoundF extends Core {
public SoundF() {
super(CoreType.SOUNDF, AppearType.NORMAL);
}
@Override
public CoreResult callCore(final Object[] data) {
return playRandom((Player) data[0]);
}
public CoreResult playRandom(final Player player) {
if (!Herobrine.getPluginCore().getConfigDB().UseSound) {
return new CoreResult(false, "Herobrine-caused sound is disabled on this server.");
}
final Sound[] sounds = { Sound.BLOCK_STONE_STEP, Sound.BLOCK_WOOD_STEP, Sound.BLOCK_GRASS_STEP, Sound.BLOCK_SAND_STEP,
Sound.BLOCK_GRAVEL_STEP, Sound.ENTITY_WITHER_HURT, Sound.ENTITY_WITHER_HURT, Sound.ENTITY_WITHER_HURT,
Sound.ENTITY_WITHER_HURT, Sound.BLOCK_WOODEN_DOOR_OPEN, Sound.BLOCK_WOODEN_DOOR_CLOSE, Sound.ENTITY_GHAST_SCREAM,
Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_HURT };
final int chance = new Random().nextInt(14);
int randx = new Random().nextInt(3);
int randz = new Random().nextInt(3);
final int randxp = new Random().nextInt(1);
final int randzp = new Random().nextInt(1);
if ((randxp == 0) && (randx != 0)) {
randx = -randx;
}
if ((randzp == 0) && (randz != 0)) {
randz = -randz;
}
player.playSound(player.getLocation(), sounds[chance], 0.75f, 0.75f);
return new CoreResult(true, "SoundF is starting.");
}
}

View File

@ -1,200 +1,200 @@
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.misc.StructureLoader;
import net.theprogrammersworld.herobrine.nms.NPC.utils.CheckBlock;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Temple extends Core {
public Temple() {
super(Core.CoreType.TEMPLE, Core.AppearType.NORMAL);
}
@Override
protected CoreResult callCore(Object[] data) {
if ((data[0] instanceof Player)) {
return FindPlace((Player)data[0]);
}
return FindPlace((Chunk)data[0]);
}
public CoreResult FindPlace(Player player) {
Location loc = player.getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (i1 = -5; i1 <= 5; i1++) {
for (i2 = -20; i2 <= 20; i2++) {
for (i3 = -20; i3 <= 20; i3++)
{
canBuild = true;
for (i4 = -1; i4 <= 12; i4++) {
for (i5 = 0; i5 <= 11; i5++) {
for (i6 = 0; i6 <= 10; i6++)
{
if ((player.getLocation().getBlockX() == i2 + i5 + loc.getBlockX()) && (player.getLocation().getBlockY() == i1 + i4 + loc.getBlockY()) && (player.getLocation().getBlockZ() == i3 + i6 + loc.getBlockZ())) {
canBuild = false;
}
if (i4 == -1)
{
if (canBuild) {
if (Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
else if (canBuild) {
if (Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
}
}
if (canBuild)
{
BuildTemple(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY() + 2, i3 + loc.getBlockZ());
return new CoreResult(true, "Creating temple near " + player.getName() + "!");
}
}
}
}
return new CoreResult(false, "Cannot find a good place for Temple.");
}
public CoreResult FindPlace(Chunk chunk) {
if (Herobrine.getPluginCore().getConfigDB().BuildTemples) {
Location loc = chunk.getBlock(2, 0, 2).getLocation();
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
i1 = 0;
i2 = 0;
i3 = 0;
i4 = 0;
i5 = 0;
i6 = 0;
for (i1 = -5; i1 <= 5; i1++) {
canBuild = true;
for (i4 = -1; i4 <= 12; i4++) {
for (i5 = 0; i5 <= 11; i5++) {
for (i6 = 0; i6 <= 10; i6++) {
if ((loc.getBlockX() == i2 + i5 + loc.getBlockX()) && (loc.getBlockY() == i1 + i4 + loc.getBlockY()) && (loc.getBlockZ() == i3 + i6 + loc.getBlockZ())) {
canBuild = false;
}
if (canBuild) {
if (Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
}
}
if (canBuild && CheckBlock.checkBlock(i2 + loc.getBlockX(), i1 + loc.getBlockY() - 3, i3 + loc.getBlockZ(), loc.getWorld())) {
BuildTemple(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating temple!");
}
}
}
return new CoreResult(false, "Cannot find a good place for Temple.");
}
public void BuildTemple(World world, int X, int Y, int Z) {
Location loc = new Location(world, X, Y, Z);
if (Herobrine.getPluginCore().getSupport().checkBuild(new Location(world, X, Y, Z))) {
AICore.log.info("Creating temple at " + X + "," + Y + "," + Z);
int MainX = loc.getBlockX();
int MainY = loc.getBlockY();
int MainZ = loc.getBlockZ();
new StructureLoader(Herobrine.getPluginCore().getInputStreamData("/res/temple.yml")).Build(loc.getWorld(), MainX, MainY, MainZ);
if (Herobrine.getPluginCore().getConfigDB().UseNPC_Guardian){
Location mobloc = new Location(loc.getWorld(), MainX + 6, MainY + 0, MainZ + 4);
for (int i = 1; i <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.SpawnCount"); i++) {
Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(mobloc, MobType.ARTIFACT_GUARDIAN);
}
}
Random generator = new Random();
int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if ((chance < 4) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow))
{
item = new ItemStack(Material.BOW);
newLore.add("Herobrine's Artifact");
newLore.add("Bow of Teleporting");
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
}
else if ((chance < 8) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
item = new ItemStack(Material.DIAMOND_SWORD);
newLore.add("Herobrine's Artifact");
newLore.add("Sword of Lightning");
item = ItemName.setNameAndLore(item, "Sword of Lightning", newLore);
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item.addEnchantment(Enchantment.DURABILITY, 3);
}
else if ((chance < 12) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine's Artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
}
else if (Herobrine.getPluginCore().getConfigDB().UseAncientSword)
{
item = Herobrine.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
}
Chest chest = (Chest)loc.getWorld().getBlockAt(MainX + 5, MainY - 2, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
}
}
}
package net.theprogrammersworld.herobrine.AI.cores;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.misc.StructureLoader;
import net.theprogrammersworld.herobrine.nms.NPC.utils.CheckBlock;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class Temple extends Core {
public Temple() {
super(Core.CoreType.TEMPLE, Core.AppearType.NORMAL);
}
@Override
protected CoreResult callCore(Object[] data) {
if ((data[0] instanceof Player)) {
return FindPlace((Player)data[0]);
}
return FindPlace((Chunk)data[0]);
}
public CoreResult FindPlace(Player player) {
Location loc = player.getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
for (i1 = -5; i1 <= 5; i1++) {
for (i2 = -20; i2 <= 20; i2++) {
for (i3 = -20; i3 <= 20; i3++)
{
canBuild = true;
for (i4 = -1; i4 <= 12; i4++) {
for (i5 = 0; i5 <= 11; i5++) {
for (i6 = 0; i6 <= 10; i6++)
{
if ((player.getLocation().getBlockX() == i2 + i5 + loc.getBlockX()) && (player.getLocation().getBlockY() == i1 + i4 + loc.getBlockY()) && (player.getLocation().getBlockZ() == i3 + i6 + loc.getBlockZ())) {
canBuild = false;
}
if (i4 == -1)
{
if (canBuild) {
if (Herobrine.isSolidBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
else if (canBuild) {
if (Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
}
}
if (canBuild)
{
BuildTemple(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY() + 2, i3 + loc.getBlockZ());
return new CoreResult(true, "Creating temple near " + player.getName() + "!");
}
}
}
}
return new CoreResult(false, "Cannot find a good place for Temple.");
}
public CoreResult FindPlace(Chunk chunk) {
if (Herobrine.getPluginCore().getConfigDB().BuildTemples) {
Location loc = chunk.getBlock(2, 0, 2).getLocation();
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
if (!Herobrine.getPluginCore().getSupport().checkBuild(loc)) {
return new CoreResult(false, "Player is in a protected zone!");
}
boolean canBuild = true;
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
int i6 = 0;
i1 = 0;
i2 = 0;
i3 = 0;
i4 = 0;
i5 = 0;
i6 = 0;
for (i1 = -5; i1 <= 5; i1++) {
canBuild = true;
for (i4 = -1; i4 <= 12; i4++) {
for (i5 = 0; i5 <= 11; i5++) {
for (i6 = 0; i6 <= 10; i6++) {
if ((loc.getBlockX() == i2 + i5 + loc.getBlockX()) && (loc.getBlockY() == i1 + i4 + loc.getBlockY()) && (loc.getBlockZ() == i3 + i6 + loc.getBlockZ())) {
canBuild = false;
}
if (canBuild) {
if (Herobrine.isAllowedBlock(loc.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(), i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ()).getType())) {
canBuild = true;
} else {
canBuild = false;
}
}
}
}
}
if (canBuild && CheckBlock.checkBlock(i2 + loc.getBlockX(), i1 + loc.getBlockY() - 3, i3 + loc.getBlockZ(), loc.getWorld())) {
BuildTemple(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating temple!");
}
}
}
return new CoreResult(false, "Cannot find a good place for Temple.");
}
public void BuildTemple(World world, int X, int Y, int Z) {
Location loc = new Location(world, X, Y, Z);
if (Herobrine.getPluginCore().getSupport().checkBuild(new Location(world, X, Y, Z))) {
AICore.log.info("Creating temple at " + X + "," + Y + "," + Z);
int MainX = loc.getBlockX();
int MainY = loc.getBlockY();
int MainZ = loc.getBlockZ();
new StructureLoader(Herobrine.getPluginCore().getInputStreamData("/res/temple.yml")).Build(loc.getWorld(), MainX, MainY, MainZ);
if (Herobrine.getPluginCore().getConfigDB().UseNPC_Guardian){
Location mobloc = new Location(loc.getWorld(), MainX + 6, MainY + 0, MainZ + 4);
for (int i = 1; i <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.SpawnCount"); i++) {
Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(mobloc, MobType.ARTIFACT_GUARDIAN);
}
}
Random generator = new Random();
int chance = generator.nextInt(15);
ItemStack item = null;
ArrayList<String> newLore = new ArrayList<String>();
if ((chance < 4) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow))
{
item = new ItemStack(Material.BOW);
newLore.add("Herobrine's Artifact");
newLore.add("Bow of Teleporting");
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
}
else if ((chance < 8) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
item = new ItemStack(Material.DIAMOND_SWORD);
newLore.add("Herobrine's Artifact");
newLore.add("Sword of Lightning");
item = ItemName.setNameAndLore(item, "Sword of Lightning", newLore);
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
item.addEnchantment(Enchantment.DURABILITY, 3);
}
else if ((chance < 12) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
item = new ItemStack(Material.GOLDEN_APPLE);
newLore.add("Herobrine's Artifact");
newLore.add("Apple of Death");
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
}
else if (Herobrine.getPluginCore().getConfigDB().UseAncientSword)
{
item = Herobrine.getPluginCore().getAICore().createAncientSword();
item.addEnchantment(Enchantment.KNOCKBACK, 2);
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
}
Chest chest = (Chest)loc.getWorld().getBlockAt(MainX + 5, MainY - 2, MainZ + 2).getState();
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), item);
}
}
}

View File

@ -1,116 +1,116 @@
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.AI.Message;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Totem extends Core {
public Totem() {
super(CoreType.TOTEM, AppearType.APPEAR);
}
@Override
public CoreResult callCore(final Object[] data) {
return TotemCall((Location) data[0], (String) data[1]);
}
@SuppressWarnings("deprecation")
public CoreResult TotemCall(final Location loc, final String caller) {
AICore.isTotemCalled = false;
loc.getWorld().strikeLightning(loc);
if (Herobrine.getPluginCore().getConfigDB().TotemExplodes) {
loc.getWorld().createExplosion(loc, 5.0f);
}
if (Bukkit.getServer().getPlayer(caller) != null) {
if (Bukkit.getServer().getPlayer(caller).isOnline()) {
Herobrine.getPluginCore().getAICore().setCoreTypeNow(CoreType.TOTEM);
Herobrine.getPluginCore().getAICore().setAttackTarget(Bukkit.getServer().getPlayer(caller));
final Player player = Bukkit.getServer().getPlayer(caller);
for (Player oplayer : Bukkit.getOnlinePlayers()) {
Location ploc = oplayer.getLocation();
if (
(oplayer.getName() != player.getName()) &&
((ploc.getX() + 10.0) > loc.getX()) &&
((ploc.getX() - 10.0) < loc.getX()) &&
((ploc.getZ() + 10.0) > loc.getZ()) &&
((ploc.getZ() - 10.0) < loc.getZ())
) {
Message.sendRandomMessage(oplayer);
if (Herobrine.getPluginCore().getConfigDB().UsePotionEffects) {
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
} else {
boolean hasTarget = false;
Player target = null;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (!hasTarget) {
Location ploc = oplayer.getLocation();
if (((ploc.getX() + 10.0) > loc.getX()) && ((ploc.getX() - 10.0) < loc.getX()) && ((ploc.getZ() + 10.0) > loc.getZ()) && ((ploc.getZ() - 10.0) < loc.getZ())) {
hasTarget = true;
target = oplayer;
}
}
}
if (hasTarget) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.TOTEM, true);
Herobrine.getPluginCore().getAICore().setAttackTarget(target);
final Player player = target;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
Location ploc = oplayer.getLocation();
if ((oplayer.getName() != player.getName()) && ((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ())
&& ((ploc.getZ() - 20.0) < loc.getZ())) {
Message.sendRandomMessage(oplayer);
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
}
} else {
boolean hasTarget = false;
Player target = null;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (!hasTarget) {
Location ploc = oplayer.getLocation();
if (((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ()) && ((ploc.getZ() - 20.0) < loc.getZ())) {
hasTarget = true;
target = oplayer;
}
}
}
if (hasTarget) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.TOTEM, true);
Herobrine.getPluginCore().getAICore().setAttackTarget(target);
final Player player = target;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (oplayer.getEntityId() != Herobrine.herobrineEntityID) {
Location ploc = oplayer.getLocation();
if ((oplayer.getName() != player.getName()) && ((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ())
&& ((ploc.getZ() - 20.0) < loc.getZ())) {
Message.sendRandomMessage(oplayer);
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
}
}
return new CoreResult(false, "Totem called.");
}
package net.theprogrammersworld.herobrine.AI.cores;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.CoreResult;
import net.theprogrammersworld.herobrine.AI.Message;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Totem extends Core {
public Totem() {
super(CoreType.TOTEM, AppearType.APPEAR);
}
@Override
public CoreResult callCore(final Object[] data) {
return TotemCall((Location) data[0], (String) data[1]);
}
@SuppressWarnings("deprecation")
public CoreResult TotemCall(final Location loc, final String caller) {
AICore.isTotemCalled = false;
loc.getWorld().strikeLightning(loc);
if (Herobrine.getPluginCore().getConfigDB().TotemExplodes) {
loc.getWorld().createExplosion(loc, 5.0f);
}
if (Bukkit.getServer().getPlayer(caller) != null) {
if (Bukkit.getServer().getPlayer(caller).isOnline()) {
Herobrine.getPluginCore().getAICore().setCoreTypeNow(CoreType.TOTEM);
Herobrine.getPluginCore().getAICore().setAttackTarget(Bukkit.getServer().getPlayer(caller));
final Player player = Bukkit.getServer().getPlayer(caller);
for (Player oplayer : Bukkit.getOnlinePlayers()) {
Location ploc = oplayer.getLocation();
if (
(oplayer.getName() != player.getName()) &&
((ploc.getX() + 10.0) > loc.getX()) &&
((ploc.getX() - 10.0) < loc.getX()) &&
((ploc.getZ() + 10.0) > loc.getZ()) &&
((ploc.getZ() - 10.0) < loc.getZ())
) {
Message.sendRandomMessage(oplayer);
if (Herobrine.getPluginCore().getConfigDB().UsePotionEffects) {
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
} else {
boolean hasTarget = false;
Player target = null;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (!hasTarget) {
Location ploc = oplayer.getLocation();
if (((ploc.getX() + 10.0) > loc.getX()) && ((ploc.getX() - 10.0) < loc.getX()) && ((ploc.getZ() + 10.0) > loc.getZ()) && ((ploc.getZ() - 10.0) < loc.getZ())) {
hasTarget = true;
target = oplayer;
}
}
}
if (hasTarget) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.TOTEM, true);
Herobrine.getPluginCore().getAICore().setAttackTarget(target);
final Player player = target;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
Location ploc = oplayer.getLocation();
if ((oplayer.getName() != player.getName()) && ((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ())
&& ((ploc.getZ() - 20.0) < loc.getZ())) {
Message.sendRandomMessage(oplayer);
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
}
} else {
boolean hasTarget = false;
Player target = null;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (!hasTarget) {
Location ploc = oplayer.getLocation();
if (((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ()) && ((ploc.getZ() - 20.0) < loc.getZ())) {
hasTarget = true;
target = oplayer;
}
}
}
if (hasTarget) {
Herobrine.getPluginCore().getAICore().cancelTarget(CoreType.TOTEM, true);
Herobrine.getPluginCore().getAICore().setAttackTarget(target);
final Player player = target;
for (Player oplayer : Bukkit.getOnlinePlayers()) {
if (oplayer.getEntityId() != Herobrine.herobrineEntityID) {
Location ploc = oplayer.getLocation();
if ((oplayer.getName() != player.getName()) && ((ploc.getX() + 20.0) > loc.getX()) && ((ploc.getX() - 20.0) < loc.getX()) && ((ploc.getZ() + 20.0) > loc.getZ())
&& ((ploc.getZ() - 20.0) < loc.getZ())) {
Message.sendRandomMessage(oplayer);
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
oplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
}
}
}
}
}
return new CoreResult(false, "Totem called.");
}
}

View File

@ -1,25 +1,25 @@
package net.theprogrammersworld.herobrine.AI.extensions;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.misc.StructureLoader;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
public class GraveyardWorld {
public static void create() {
final Location loc = new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), 0.0, 3.0, 0.0);
for (int x = -50; x <= 50; ++x) {
for (int z = -50; z <= 50; ++z) {
loc.getWorld().getBlockAt(x, 3, z).setType(Material.MYCEL);
}
}
final int MainX = -10;
final int MainY = 3;
final int MainZ = -10;
new StructureLoader(Herobrine.getPluginCore().getInputStreamData("/res/graveyard_world.yml")).Build(loc.getWorld(), MainX, MainY, MainZ);
}
package net.theprogrammersworld.herobrine.AI.extensions;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.misc.StructureLoader;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
public class GraveyardWorld {
public static void create() {
final Location loc = new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), 0.0, 3.0, 0.0);
for (int x = -50; x <= 50; ++x) {
for (int z = -50; z <= 50; ++z) {
loc.getWorld().getBlockAt(x, 3, z).setType(Material.MYCEL);
}
}
final int MainX = -10;
final int MainY = 3;
final int MainZ = -10;
new StructureLoader(Herobrine.getPluginCore().getInputStreamData("/res/graveyard_world.yml")).Build(loc.getWorld(), MainX, MainY, MainZ);
}
}

View File

@ -1,125 +1,125 @@
package net.theprogrammersworld.herobrine.AI.extensions;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
public class Position {
public static Location getTeleportPosition(final Location ploc) {
final int chance = new Random().nextInt(3);
if (chance == 0) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
} else if (chance == 1) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
} else if (chance == 2) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
}
if (chance == 3) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
}
}
return ploc;
}
package net.theprogrammersworld.herobrine.AI.extensions;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
public class Position {
public static Location getTeleportPosition(final Location ploc) {
final int chance = new Random().nextInt(3);
if (chance == 0) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
} else if (chance == 1) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
} else if (chance == 2) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
}
}
if (chance == 3) {
if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() + 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() + 2).getType())) {
ploc.setZ(ploc.getZ() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() - 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() - 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY(), ploc.getBlockZ()).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX() + 2, ploc.getBlockY() + 1, ploc.getBlockZ()).getType())) {
ploc.setX(ploc.getX() + 2.0);
} else if (Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ() - 2).getType())
&& Herobrine.isAllowedBlock(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY() + 1, ploc.getBlockZ() - 2).getType())) {
ploc.setZ(ploc.getZ() - 2.0);
}
}
return ploc;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,294 +1,294 @@
package net.theprogrammersworld.herobrine;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.extensions.GraveyardWorld;
import net.theprogrammersworld.herobrine.commands.CmdExecutor;
import net.theprogrammersworld.herobrine.listeners.BlockListener;
import net.theprogrammersworld.herobrine.listeners.EntityListener;
import net.theprogrammersworld.herobrine.listeners.InventoryListener;
import net.theprogrammersworld.herobrine.listeners.PlayerListener;
import net.theprogrammersworld.herobrine.listeners.WorldListener;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanNPC;
import net.theprogrammersworld.herobrine.nms.entity.EntityInjector;
import net.theprogrammersworld.herobrine.nms.entity.EntityManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
public class Herobrine extends JavaPlugin implements Listener {
public static final Logger log = Bukkit.getLogger();
private static Herobrine pluginCore;
public static Herobrine getPluginCore() {
return Herobrine.pluginCore;
}
private AICore aicore;
private ConfigDB configdb;
private Support support;
private EntityManager entMng;
private NPCCore NPCCore;
public Map<Player, Long> PlayerApple = new HashMap<Player, Long>();
public static HumanNPC herobrineNPC;
public static long herobrineEntityID;
public static int HerobrineHP = 200;
public static int HerobrineMaxHP = 200;
public static boolean availableWorld = false;
public static boolean isNPCDisabled = false;
public Location hbSpawnData = null;
public boolean removeHBNextTick = false;
@Override
public void onEnable() {
Herobrine.pluginCore = this;
configdb = new ConfigDB(getLogger());
aicore = new AICore();
support = new Support();
entMng = new EntityManager();
NPCCore = new NPCCore();
configdb.Startup();
configdb.Reload();
getCommand("herobrine").setExecutor(new CmdExecutor(this));
getServer().getPluginManager().registerEvents(new EntityListener(), this);
getServer().getPluginManager().registerEvents(new BlockListener(), this);
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
getServer().getPluginManager().registerEvents(new WorldListener(), this);
getServer().getPluginManager().registerEvents(this, this);
initHerobrine();
// If the user has update checking turned on, start the thread responsible for performing
// the check.
if(configdb.CheckForUpdates)
{
new Thread(new UpdateScanner()).start();
}
Bukkit.getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
}
private void initHerobrine() {
if (configdb.UseGraveyardWorld && (Bukkit.getServer().getWorld(configdb.HerobrineWorldName) == null)) {
Herobrine.log.info("[Herobrine] Creating Herobrine Graveyard world");
final WorldCreator wc = new WorldCreator(configdb.HerobrineWorldName);
wc.generateStructures(false);
final WorldType type = WorldType.FLAT;
wc.type(type);
wc.createWorld();
GraveyardWorld.create();
}
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
if (Herobrine.this.removeHBNextTick) {
Herobrine.this.removeHerobrine();
Herobrine.this.spawnHerobrine(Herobrine.this.hbSpawnData);
Herobrine.this.removeHBNextTick = false;
}
}
}, 1L, 1L);
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
spawnHerobrine(nowloc);
Herobrine.herobrineNPC.setItemInHand(configdb.ItemInHand.getItemStack());
EntityInjector.inject();
}
@Override
public void onDisable() {
entMng.killAllMobs();
aicore.stopBD();
aicore.stopMAIN();
aicore.stopRC();
aicore.disableAll();
}
public InputStream getInputStreamData(final String src) {
return Herobrine.class.getResourceAsStream(src);
}
public AICore getAICore() {
return aicore;
}
public EntityManager getEntityManager() {
return entMng;
}
public ConfigDB getConfigDB() {
return configdb;
}
public Support getSupport() {
return support;
}
public NPCCore getNPCCore() {
return NPCCore;
}
public void spawnHerobrine(final Location loc) {
Herobrine.herobrineNPC = NPCCore.spawnHumanNPC(loc);
Herobrine.herobrineNPC.getBukkitEntity().setMetadata("NPC", new FixedMetadataValue(this, true));
Herobrine.herobrineEntityID = Herobrine.herobrineNPC.getBukkitEntity().getEntityId();
}
public void removeHerobrine() {
Herobrine.herobrineEntityID = 0L;
Herobrine.herobrineNPC = null;
NPCCore.removeAll();
}
public boolean canAttackPlayer(final Player player, final Player sender) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
if (opCheck && creativeCheck && ignoreCheck) {
return true;
}
if (!opCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
}
return false;
}
public boolean canAttackPlayerConsole(final Player player) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
if (opCheck && creativeCheck && ignoreCheck) {
return true;
}
if (!opCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
}
return false;
}
public boolean canAttackPlayerNoMSG(final Player player) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
return opCheck && creativeCheck && ignoreCheck;
}
public String getAvailableWorldString() {
if (Herobrine.availableWorld) {
return "Yes";
}
return "No";
}
public static boolean isSolidBlock(final Material mat) {
return mat.isSolid();
}
public static boolean isAllowedBlock(final Material mat) {
if(mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA
|| mat == Material.ICE || mat == Material.PACKED_ICE)
return false;
else
return mat.isSolid();
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
// When a player joins the server, perform several checks.
Player joinedPlayer = event.getPlayer();
// It is possible for a player to become stuck in Herobrine's Graveyard. If the player that
// has just logged in is stuck in Herobrine's Graveyard, teleport them to the server's default
// spawn point and let them know what happened.
if(joinedPlayer.getWorld().getName().equals(configdb.HerobrineWorldName)) {
List<World> worldList = Bukkit.getServer().getWorlds();
joinedPlayer.teleport(worldList.get(0).getSpawnLocation());
joinedPlayer.sendMessage(ChatColor.RED + "It looks like you got stuck in Herobrine's " +
"Graveyard. This usually happens when the server has been shut off after you have been " +
"teleported to it. To fix this, we have teleported you to this server's default spawn point.");
}
// Check if the player that has just joined is an OP. If they are, perform several additional checks.
if(joinedPlayer.isOp()) {
if(configdb.ShowDonateMsgToOp)
// If the server is configured to display the donation promotion to OPs, then display it.
joinedPlayer.sendMessage(ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
// If a newer version of Herobrine is available, display a message to the OP stating so.
if(configdb.newVersionFound)
joinedPlayer.sendMessage(ChatColor.RED + "A new version of Herobrine is available. To " +
"get it, go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
}
}
package net.theprogrammersworld.herobrine;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.extensions.GraveyardWorld;
import net.theprogrammersworld.herobrine.commands.CmdExecutor;
import net.theprogrammersworld.herobrine.listeners.BlockListener;
import net.theprogrammersworld.herobrine.listeners.EntityListener;
import net.theprogrammersworld.herobrine.listeners.InventoryListener;
import net.theprogrammersworld.herobrine.listeners.PlayerListener;
import net.theprogrammersworld.herobrine.listeners.WorldListener;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanNPC;
import net.theprogrammersworld.herobrine.nms.entity.EntityInjector;
import net.theprogrammersworld.herobrine.nms.entity.EntityManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
public class Herobrine extends JavaPlugin implements Listener {
public static final Logger log = Bukkit.getLogger();
private static Herobrine pluginCore;
public static Herobrine getPluginCore() {
return Herobrine.pluginCore;
}
private AICore aicore;
private ConfigDB configdb;
private Support support;
private EntityManager entMng;
private NPCCore NPCCore;
public Map<Player, Long> PlayerApple = new HashMap<Player, Long>();
public static HumanNPC herobrineNPC;
public static long herobrineEntityID;
public static int HerobrineHP = 200;
public static int HerobrineMaxHP = 200;
public static boolean availableWorld = false;
public static boolean isNPCDisabled = false;
public Location hbSpawnData = null;
public boolean removeHBNextTick = false;
@Override
public void onEnable() {
Herobrine.pluginCore = this;
configdb = new ConfigDB(getLogger());
aicore = new AICore();
support = new Support();
entMng = new EntityManager();
NPCCore = new NPCCore();
configdb.Startup();
configdb.Reload();
getCommand("herobrine").setExecutor(new CmdExecutor(this));
getServer().getPluginManager().registerEvents(new EntityListener(), this);
getServer().getPluginManager().registerEvents(new BlockListener(), this);
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
getServer().getPluginManager().registerEvents(new WorldListener(), this);
getServer().getPluginManager().registerEvents(this, this);
initHerobrine();
// If the user has update checking turned on, start the thread responsible for performing
// the check.
if(configdb.CheckForUpdates)
{
new Thread(new UpdateScanner()).start();
}
Bukkit.getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
}
private void initHerobrine() {
if (configdb.UseGraveyardWorld && (Bukkit.getServer().getWorld(configdb.HerobrineWorldName) == null)) {
Herobrine.log.info("[Herobrine] Creating Herobrine Graveyard world");
final WorldCreator wc = new WorldCreator(configdb.HerobrineWorldName);
wc.generateStructures(false);
final WorldType type = WorldType.FLAT;
wc.type(type);
wc.createWorld();
GraveyardWorld.create();
}
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
if (Herobrine.this.removeHBNextTick) {
Herobrine.this.removeHerobrine();
Herobrine.this.spawnHerobrine(Herobrine.this.hbSpawnData);
Herobrine.this.removeHBNextTick = false;
}
}
}, 1L, 1L);
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
spawnHerobrine(nowloc);
Herobrine.herobrineNPC.setItemInHand(configdb.ItemInHand.getItemStack());
EntityInjector.inject();
}
@Override
public void onDisable() {
entMng.killAllMobs();
aicore.stopBD();
aicore.stopMAIN();
aicore.stopRC();
aicore.disableAll();
}
public InputStream getInputStreamData(final String src) {
return Herobrine.class.getResourceAsStream(src);
}
public AICore getAICore() {
return aicore;
}
public EntityManager getEntityManager() {
return entMng;
}
public ConfigDB getConfigDB() {
return configdb;
}
public Support getSupport() {
return support;
}
public NPCCore getNPCCore() {
return NPCCore;
}
public void spawnHerobrine(final Location loc) {
Herobrine.herobrineNPC = NPCCore.spawnHumanNPC(loc);
Herobrine.herobrineNPC.getBukkitEntity().setMetadata("NPC", new FixedMetadataValue(this, true));
Herobrine.herobrineEntityID = Herobrine.herobrineNPC.getBukkitEntity().getEntityId();
}
public void removeHerobrine() {
Herobrine.herobrineEntityID = 0L;
Herobrine.herobrineNPC = null;
NPCCore.removeAll();
}
public boolean canAttackPlayer(final Player player, final Player sender) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
if (opCheck && creativeCheck && ignoreCheck) {
return true;
}
if (!opCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) {
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
}
return false;
}
public boolean canAttackPlayerConsole(final Player player) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
if (opCheck && creativeCheck && ignoreCheck) {
return true;
}
if (!opCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) {
Herobrine.log.info("[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
}
return false;
}
public boolean canAttackPlayerNoMSG(final Player player) {
boolean opCheck = true;
boolean creativeCheck = true;
boolean ignoreCheck = true;
if (!configdb.AttackOP && player.isOp()) {
opCheck = false;
}
if (!configdb.AttackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false;
}
if (configdb.UseIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false;
}
return opCheck && creativeCheck && ignoreCheck;
}
public String getAvailableWorldString() {
if (Herobrine.availableWorld) {
return "Yes";
}
return "No";
}
public static boolean isSolidBlock(final Material mat) {
return mat.isSolid();
}
public static boolean isAllowedBlock(final Material mat) {
if(mat == Material.WATER || mat == Material.STATIONARY_WATER || mat == Material.LAVA || mat == Material.STATIONARY_LAVA
|| mat == Material.ICE || mat == Material.PACKED_ICE)
return false;
else
return mat.isSolid();
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
// When a player joins the server, perform several checks.
Player joinedPlayer = event.getPlayer();
// It is possible for a player to become stuck in Herobrine's Graveyard. If the player that
// has just logged in is stuck in Herobrine's Graveyard, teleport them to the server's default
// spawn point and let them know what happened.
if(joinedPlayer.getWorld().getName().equals(configdb.HerobrineWorldName)) {
List<World> worldList = Bukkit.getServer().getWorlds();
joinedPlayer.teleport(worldList.get(0).getSpawnLocation());
joinedPlayer.sendMessage(ChatColor.RED + "It looks like you got stuck in Herobrine's " +
"Graveyard. This usually happens when the server has been shut off after you have been " +
"teleported to it. To fix this, we have teleported you to this server's default spawn point.");
}
// Check if the player that has just joined is an OP. If they are, perform several additional checks.
if(joinedPlayer.isOp()) {
if(configdb.ShowDonateMsgToOp)
// If the server is configured to display the donation promotion to OPs, then display it.
joinedPlayer.sendMessage(ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
// If a newer version of Herobrine is available, display a message to the OP stating so.
if(configdb.newVersionFound)
joinedPlayer.sendMessage(ChatColor.RED + "A new version of Herobrine is available. To " +
"get it, go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
}
}
}

View File

@ -1,154 +1,154 @@
package net.theprogrammersworld.herobrine;
import net.theprogrammersworld.herobrine.hooks.FactionsHook;
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
import net.theprogrammersworld.herobrine.hooks.RedProtectHook;
import net.theprogrammersworld.herobrine.hooks.ResidenceHook;
import net.theprogrammersworld.herobrine.hooks.TownyHook;
import net.theprogrammersworld.herobrine.hooks.WorldGuardHook;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class Support {
private boolean B_Residence;
private boolean B_GriefPrevention;
private boolean B_Towny;
private boolean B_WorldGuard;
private boolean B_CustomItems = false;
private boolean B_PreciousStones;
private boolean B_Factions;
private boolean B_RedProtect;
private ResidenceHook ResidenceCore;
private GriefPreventionHook GriefPreventionCore;
private TownyHook TownyCore;
private WorldGuardHook WorldGuard;
private PreciousStonesHook PreciousStones;
private FactionsHook Factions;
private RedProtectHook RedProtect;
public Support() {
ResidenceCore = new ResidenceHook();
GriefPreventionCore = new GriefPreventionHook();
TownyCore = new TownyHook();
WorldGuard = new WorldGuardHook();
PreciousStones = new PreciousStonesHook();
Factions = new FactionsHook();
RedProtect = new RedProtectHook();
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
Support.this.CheckForPlugins();
}
}, 2L);
}
public boolean isPreciousStones() {
return B_PreciousStones;
}
public boolean isWorldGuard() {
return B_WorldGuard;
}
public boolean isResidence() {
return B_Residence;
}
public boolean isGriefPrevention() {
return B_GriefPrevention;
}
public boolean isTowny() {
return B_Towny;
}
public boolean isFactions() {
return B_Factions;
}
public boolean isRedProtect() {
return B_RedProtect;
}
public void CheckForPlugins() {
if (ResidenceCore.Check()) {
B_Residence = true;
Herobrine.log.info("[Herobrine] Residence plugin detected on server");
}
if (GriefPreventionCore.Check()) {
B_GriefPrevention = true;
Herobrine.log.info("[Herobrine] GriefPrevention plugin detected on server");
}
if (TownyCore.Check()) {
B_Towny = true;
Herobrine.log.info("[Herobrine] Towny plugin detected on server");
}
if (WorldGuard.Check()) {
B_WorldGuard = true;
Herobrine.log.info("[Herobrine] WorldGuard plugin detected on server");
}
if (PreciousStones.Check()) {
B_PreciousStones = true;
Herobrine.log.info("[Herobrine] PreciousStones plugin detected on server");
}
if (Factions.Check()) {
B_Factions = true;
Herobrine.log.info("[Herobrine] Factions plugin detected on server");
}
if (RedProtect.Check()) {
B_RedProtect = true;
Herobrine.log.info("[Herobrine] RedProtect plugin detected on server");
}
}
public boolean isSecuredArea(final Location loc) {
if (B_Residence && ResidenceCore.isSecuredArea(loc)) {
return true;
}
if (B_GriefPrevention && GriefPreventionCore.isSecuredArea(loc)) {
return true;
}
if (B_Towny && TownyCore.isSecuredArea(loc)) {
return true;
}
if (B_WorldGuard && WorldGuard.isSecuredArea(loc)) {
return true;
}
if (B_PreciousStones && PreciousStones.isSecuredArea(loc)) {
return true;
}
if (B_Factions && Factions.isSecuredArea(loc)) {
return true;
}
if (B_RedProtect && RedProtect.isSecuredArea(loc)) {
return true;
}
return false;
}
public boolean checkBuild(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Build || !isSecuredArea(loc);
}
public boolean checkAttack(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Attack || !isSecuredArea(loc);
}
public boolean checkHaunt(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Haunt || !isSecuredArea(loc);
}
public boolean checkSigns(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Signs || !isSecuredArea(loc);
}
public boolean checkBooks(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Books || !isSecuredArea(loc);
}
public boolean isCustomItems() {
return this.B_CustomItems;
}
package net.theprogrammersworld.herobrine;
import net.theprogrammersworld.herobrine.hooks.FactionsHook;
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
import net.theprogrammersworld.herobrine.hooks.RedProtectHook;
import net.theprogrammersworld.herobrine.hooks.ResidenceHook;
import net.theprogrammersworld.herobrine.hooks.TownyHook;
import net.theprogrammersworld.herobrine.hooks.WorldGuardHook;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class Support {
private boolean B_Residence;
private boolean B_GriefPrevention;
private boolean B_Towny;
private boolean B_WorldGuard;
private boolean B_CustomItems = false;
private boolean B_PreciousStones;
private boolean B_Factions;
private boolean B_RedProtect;
private ResidenceHook ResidenceCore;
private GriefPreventionHook GriefPreventionCore;
private TownyHook TownyCore;
private WorldGuardHook WorldGuard;
private PreciousStonesHook PreciousStones;
private FactionsHook Factions;
private RedProtectHook RedProtect;
public Support() {
ResidenceCore = new ResidenceHook();
GriefPreventionCore = new GriefPreventionHook();
TownyCore = new TownyHook();
WorldGuard = new WorldGuardHook();
PreciousStones = new PreciousStonesHook();
Factions = new FactionsHook();
RedProtect = new RedProtectHook();
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
Support.this.CheckForPlugins();
}
}, 2L);
}
public boolean isPreciousStones() {
return B_PreciousStones;
}
public boolean isWorldGuard() {
return B_WorldGuard;
}
public boolean isResidence() {
return B_Residence;
}
public boolean isGriefPrevention() {
return B_GriefPrevention;
}
public boolean isTowny() {
return B_Towny;
}
public boolean isFactions() {
return B_Factions;
}
public boolean isRedProtect() {
return B_RedProtect;
}
public void CheckForPlugins() {
if (ResidenceCore.Check()) {
B_Residence = true;
Herobrine.log.info("[Herobrine] Residence plugin detected on server");
}
if (GriefPreventionCore.Check()) {
B_GriefPrevention = true;
Herobrine.log.info("[Herobrine] GriefPrevention plugin detected on server");
}
if (TownyCore.Check()) {
B_Towny = true;
Herobrine.log.info("[Herobrine] Towny plugin detected on server");
}
if (WorldGuard.Check()) {
B_WorldGuard = true;
Herobrine.log.info("[Herobrine] WorldGuard plugin detected on server");
}
if (PreciousStones.Check()) {
B_PreciousStones = true;
Herobrine.log.info("[Herobrine] PreciousStones plugin detected on server");
}
if (Factions.Check()) {
B_Factions = true;
Herobrine.log.info("[Herobrine] Factions plugin detected on server");
}
if (RedProtect.Check()) {
B_RedProtect = true;
Herobrine.log.info("[Herobrine] RedProtect plugin detected on server");
}
}
public boolean isSecuredArea(final Location loc) {
if (B_Residence && ResidenceCore.isSecuredArea(loc)) {
return true;
}
if (B_GriefPrevention && GriefPreventionCore.isSecuredArea(loc)) {
return true;
}
if (B_Towny && TownyCore.isSecuredArea(loc)) {
return true;
}
if (B_WorldGuard && WorldGuard.isSecuredArea(loc)) {
return true;
}
if (B_PreciousStones && PreciousStones.isSecuredArea(loc)) {
return true;
}
if (B_Factions && Factions.isSecuredArea(loc)) {
return true;
}
if (B_RedProtect && RedProtect.isSecuredArea(loc)) {
return true;
}
return false;
}
public boolean checkBuild(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Build || !isSecuredArea(loc);
}
public boolean checkAttack(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Attack || !isSecuredArea(loc);
}
public boolean checkHaunt(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Haunt || !isSecuredArea(loc);
}
public boolean checkSigns(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Signs || !isSecuredArea(loc);
}
public boolean checkBooks(final Location loc) {
return Herobrine.getPluginCore().getConfigDB().SecuredArea_Books || !isSecuredArea(loc);
}
public boolean isCustomItems() {
return this.B_CustomItems;
}
}

View File

@ -1,53 +1,53 @@
package net.theprogrammersworld.herobrine;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
public class UpdateScanner implements Runnable {
@Override
public void run() {
// Check for a newer version of the plugin, and put the thread to sleep for 24 hours
// before the check is performed again. If a newer version is found, begin reporting
// the discovery of a newer version once every hour.
final String pluginVersionCount = "22";
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
while(!Herobrine.getPluginCore().getConfigDB().newVersionFound) {
// Check for updates once every 24 hours.
try {
URL versionCheckURL = new URL("https://www.theprogrammersworld.net/Herobrine/latestVersion.html");
BufferedReader remoteNumberReader = new BufferedReader(new InputStreamReader(versionCheckURL.openStream()));
String remoteVersionNumber = remoteNumberReader.readLine();
if(!remoteVersionNumber.equals(pluginVersionCount)) {
// A newer version was found. Change the value of "newVersionFound", and break
// from this loop in to a loop that will display a "new version" report in the
// console once every hour.
Herobrine.getPluginCore().getConfigDB().newVersionFound = true;
break;
}
} catch (Exception e) {
console.sendMessage(ChatColor.RED + "Herobrine was unable to connect to the internet to check\n" +
"for a new version.");
}
try {
Thread.sleep(86400000);
} catch (InterruptedException e) {}
}
while(true) {
// Display a "new version" message in the console once every hour.
console.sendMessage(ChatColor.RED + "A new version of Herobrine is available.\nTo get it, " +
"go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
try {
Thread.sleep(3600000);
} catch (InterruptedException e) {}
}
}
}
package net.theprogrammersworld.herobrine;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
public class UpdateScanner implements Runnable {
@Override
public void run() {
// Check for a newer version of the plugin, and put the thread to sleep for 24 hours
// before the check is performed again. If a newer version is found, begin reporting
// the discovery of a newer version once every hour.
final String pluginVersionCount = "22";
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
while(!Herobrine.getPluginCore().getConfigDB().newVersionFound) {
// Check for updates once every 24 hours.
try {
URL versionCheckURL = new URL("https://www.theprogrammersworld.net/Herobrine/latestVersion.html");
BufferedReader remoteNumberReader = new BufferedReader(new InputStreamReader(versionCheckURL.openStream()));
String remoteVersionNumber = remoteNumberReader.readLine();
if(!remoteVersionNumber.equals(pluginVersionCount)) {
// A newer version was found. Change the value of "newVersionFound", and break
// from this loop in to a loop that will display a "new version" report in the
// console once every hour.
Herobrine.getPluginCore().getConfigDB().newVersionFound = true;
break;
}
} catch (Exception e) {
console.sendMessage(ChatColor.RED + "Herobrine was unable to connect to the internet to check\n" +
"for a new version.");
}
try {
Thread.sleep(86400000);
} catch (InterruptedException e) {}
}
while(true) {
// Display a "new version" message in the console once every hour.
console.sendMessage(ChatColor.RED + "A new version of Herobrine is available.\nTo get it, " +
"go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
try {
Thread.sleep(3600000);
} catch (InterruptedException e) {}
}
}
}

View File

@ -1,25 +1,25 @@
package net.theprogrammersworld.herobrine;
import java.util.Random;
import org.bukkit.entity.Player;
public class Util {
public static Player getRandomPlayer(Player[] players) {
final int playerRolled = new Random().nextInt(players.length);
if (playerRolled <= (players.length - 1)) {
return players[playerRolled];
}
return null;
}
public static int getRandomPlayerNum(Player[] players) {
final int playerRolled = new Random().nextInt(players.length);
if (playerRolled <= (players.length - 1)) {
return playerRolled;
}
return 0;
}
package net.theprogrammersworld.herobrine;
import java.util.Random;
import org.bukkit.entity.Player;
public class Util {
public static Player getRandomPlayer(Player[] players) {
final int playerRolled = new Random().nextInt(players.length);
if (playerRolled <= (players.length - 1)) {
return players[playerRolled];
}
return null;
}
public static int getRandomPlayerNum(Player[] players) {
final int playerRolled = new Random().nextInt(players.length);
if (playerRolled <= (players.length - 1)) {
return playerRolled;
}
return 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.massivecore.ps.PS;
public class FactionsHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Factions") != null;
}
public boolean isSecuredArea(final Location loc) {
return !BoardColl.get().getFactionAt(PS.valueOf(loc)).getComparisonName().equalsIgnoreCase("Wilderness");
}
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.massivecore.ps.PS;
public class FactionsHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Factions") != null;
}
public boolean isSecuredArea(final Location loc) {
return !BoardColl.get().getFactionAt(PS.valueOf(loc)).getComparisonName().equalsIgnoreCase("Wilderness");
}
}

View File

@ -1,19 +1,19 @@
package net.theprogrammersworld.herobrine.hooks;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class GriefPreventionHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention") != null;
}
public boolean isSecuredArea(final Location loc) {
return GriefPrevention.instance.dataStore.getClaimAt(loc, false, (Claim) null) != null;
}
package net.theprogrammersworld.herobrine.hooks;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class GriefPreventionHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention") != null;
}
public boolean isSecuredArea(final Location loc) {
return GriefPrevention.instance.dataStore.getClaimAt(loc, false, (Claim) null) != null;
}
}

View File

@ -1,19 +1,19 @@
package net.theprogrammersworld.herobrine.hooks;
import net.sacredlabyrinth.Phaed.PreciousStones.field.FieldFlag;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class PreciousStonesHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("PreciousStones") != null;
}
public boolean isSecuredArea(final Location loc) {
return PreciousStones.API().isFieldProtectingArea(FieldFlag.ALL, loc);
}
package net.theprogrammersworld.herobrine.hooks;
import net.sacredlabyrinth.Phaed.PreciousStones.field.FieldFlag;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class PreciousStonesHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("PreciousStones") != null;
}
public boolean isSecuredArea(final Location loc) {
return PreciousStones.API().isFieldProtectingArea(FieldFlag.ALL, loc);
}
}

View File

@ -1,18 +1,18 @@
package net.theprogrammersworld.herobrine.hooks;
import com.bekvon.bukkit.residence.api.ResidenceApi;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class ResidenceHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Residence") != null;
}
public boolean isSecuredArea(final Location loc) {
return ResidenceApi.getResidenceManager().getByLoc(loc) != null;
}
package net.theprogrammersworld.herobrine.hooks;
import com.bekvon.bukkit.residence.api.ResidenceApi;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class ResidenceHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Residence") != null;
}
public boolean isSecuredArea(final Location loc) {
return ResidenceApi.getResidenceManager().getByLoc(loc) != null;
}
}

View File

@ -1,18 +1,18 @@
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.palmergames.bukkit.towny.object.TownyUniverse;
public class TownyHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Towny") != null;
}
public boolean isSecuredArea(final Location loc) {
return TownyUniverse.getTownBlock(loc) != null;
}
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.palmergames.bukkit.towny.object.TownyUniverse;
public class TownyHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("Towny") != null;
}
public boolean isSecuredArea(final Location loc) {
return TownyUniverse.getTownBlock(loc) != null;
}
}

View File

@ -1,27 +1,27 @@
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
public class WorldGuardHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null;
}
public boolean isSecuredArea(final Location loc) {
final WorldGuardPlugin worldGuard = (WorldGuardPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
final RegionManager rm = worldGuard.getRegionManager(loc.getWorld());
if (rm != null) {
return rm.getApplicableRegions(loc).size() != 0;
}
else
{
return false;
}
}
package net.theprogrammersworld.herobrine.hooks;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
public class WorldGuardHook {
public boolean Check() {
return Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null;
}
public boolean isSecuredArea(final Location loc) {
final WorldGuardPlugin worldGuard = (WorldGuardPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
final RegionManager rm = worldGuard.getRegionManager(loc.getWorld());
if (rm != null) {
return rm.getApplicableRegions(loc).size() != 0;
}
else
{
return false;
}
}
}

View File

@ -1,73 +1,73 @@
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.cores.Heads;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
public class BlockListener implements Listener {
@EventHandler
public void onBlockIgnite(final BlockIgniteEvent event) {
if (event.getBlock() != null) {
final Block blockt = event.getBlock();
final Location blockloc = blockt.getLocation();
if (event.getPlayer() != null) {
blockloc.setY(blockloc.getY() - 1.0);
final Block block = blockloc.getWorld().getBlockAt(blockloc);
if ((block.getType() == Material.NETHERRACK) && (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.NETHERRACK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() + 1).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() - 1).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
&& Herobrine.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) {
Herobrine.getPluginCore().getAICore().playerCallTotem(event.getPlayer());
}
}
}
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
}
}
@EventHandler
public void onBlockBreak(final BlockBreakEvent event) {
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
return;
}
final Heads h = (Heads) Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.HEADS);
final ArrayList<Block> list = h.getHeadList();
if (list.contains(event.getBlock())) {
event.setCancelled(true);
}
}
@EventHandler
public void onBlockPlace(final BlockPlaceEvent event) {
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
}
}
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.AI.cores.Heads;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
public class BlockListener implements Listener {
@EventHandler
public void onBlockIgnite(final BlockIgniteEvent event) {
if (event.getBlock() != null) {
final Block blockt = event.getBlock();
final Location blockloc = blockt.getLocation();
if (event.getPlayer() != null) {
blockloc.setY(blockloc.getY() - 1.0);
final Block block = blockloc.getWorld().getBlockAt(blockloc);
if ((block.getType() == Material.NETHERRACK) && (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.NETHERRACK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).getType() == Material.GOLD_BLOCK)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() + 1).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() - 1).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
&& Herobrine.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) {
Herobrine.getPluginCore().getAICore().playerCallTotem(event.getPlayer());
}
}
}
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
}
}
@EventHandler
public void onBlockBreak(final BlockBreakEvent event) {
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
return;
}
final Heads h = (Heads) Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.HEADS);
final ArrayList<Block> list = h.getHeadList();
if (list.contains(event.getBlock())) {
event.setCancelled(true);
}
}
@EventHandler
public void onBlockPlace(final BlockPlaceEvent event) {
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName)) {
event.setCancelled(true);
}
}
}

View File

@ -1,257 +1,259 @@
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.inventory.ItemStack;
public class EntityListener implements Listener {
private ItemStack itemInHand;
private ArrayList<String> equalsLore;
private ArrayList<String> equalsLoreS;
private ArrayList<String> getLore;
public EntityListener(){
equalsLore = new ArrayList<String>();
equalsLoreS = new ArrayList<String>();
equalsLore.add("Herobrine's Artifact");
equalsLore.add("Bow of Teleporting");
equalsLoreS.add("Herobrine's Artifact");
equalsLoreS.add("Sword of Lightning");
}
@EventHandler
public void onCreatureSpawn(final CreatureSpawnEvent event) {
if (!Herobrine.isNPCDisabled && Herobrine.getPluginCore().getConfigDB().useWorlds.contains(event.getEntity().getLocation().getWorld().getName())) {
final Entity entity = event.getEntity();
final EntityType creatureType = event.getEntityType();
if (event.isCancelled()) {
return;
}
if (creatureType == EntityType.ZOMBIE) {
if (Herobrine.getPluginCore().getConfigDB().UseNPC_Warrior && (new Random().nextInt(100) < Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance"))
&& !Herobrine.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) {
final LivingEntity ent = (LivingEntity) entity;
ent.setHealth(0);
Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(event.getLocation(), MobType.HEROBRINE_WARRIOR);
}
} else if ((creatureType == EntityType.SKELETON) && Herobrine.getPluginCore().getConfigDB().UseNPC_Demon
&& (new Random().nextInt(100) < Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.SpawnChance"))
&& !Herobrine.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) {
final LivingEntity ent = (LivingEntity) entity;
ent.setHealth(0);
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(event.getLocation(), MobType.DEMON);
}
}
}
@EventHandler
public void onEntityDeathEvent(final EntityDeathEvent event) {
if (Herobrine.getPluginCore().getEntityManager().isCustomMob(event.getEntity().getEntityId())) {
Herobrine.getPluginCore().getEntityManager().removeMob(event.getEntity().getEntityId());
}
}
@EventHandler
public void EntityTargetEvent(final EntityTargetLivingEntityEvent e) {
final LivingEntity lv = e.getTarget();
if (lv != null) {
if (lv.getEntityId() == Herobrine.herobrineEntityID) {
e.setCancelled(true);
}
}
}
@EventHandler
public void onEntityDamageByBlock(final EntityDamageByBlockEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID) {
event.setCancelled(true);
event.setDamage(0);
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void onEntityDamage(final EntityDamageEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID)
{
if ((event instanceof EntityDamageByEntityEvent))
{
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent)event;
if ((Herobrine.getPluginCore().getConfigDB().Killable) && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() != Core.CoreType.GRAVEYARD)) {
if ((dEvent.getDamager() instanceof Player))
{
if (event.getDamage() >= Herobrine.HerobrineHP)
{
int i = 1;
for (i = 1; i <= 2500; i++) {
if (Herobrine.getPluginCore().getConfigDB().config.contains("config.Drops." + Integer.toString(i)))
{
Random randgen = new Random();
int chance = randgen.nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".chance")) {
Herobrine.herobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(Herobrine.herobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".count")));
}
}
}
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
Player player = (Player)dEvent.getDamager();
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().DeathMessage);
}
else
{
Herobrine.HerobrineHP = (int)(Herobrine.HerobrineHP - event.getDamage());
Herobrine.herobrineNPC.hurtAnimation();
AICore.log.info("HIT: " + event.getDamage());
}
}
else if ((dEvent.getDamager() instanceof Projectile))
{
Arrow arrow = (Arrow)dEvent.getDamager();
if ((arrow.getShooter() instanceof Player))
{
if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.getPluginCore().getAICore().setAttackTarget((Player)arrow.getShooter());
}
else if (event.getDamage() >= Herobrine.HerobrineHP)
{
int i = 1;
for (i = 1; i <= 2500; i++) {
if (Herobrine.getPluginCore().getConfigDB().config.contains("config.Drops." + Integer.toString(i)))
{
Random randgen = new Random();
int chance = randgen.nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".chance")) {
Herobrine.herobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(Herobrine.herobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".count")));
}
}
}
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
Player player = (Player)arrow.getShooter();
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().DeathMessage);
}
else
{
Herobrine.HerobrineHP = (int)(Herobrine.HerobrineHP - event.getDamage());
Herobrine.herobrineNPC.hurtAnimation();
AICore.log.info("HIT: " + event.getDamage());
}
}
else if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Location newloc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
newloc.setY(-20.0D);
Herobrine.herobrineNPC.moveTo(newloc);
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
}
}
else if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Location newloc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
newloc.setY(-20.0D);
Herobrine.herobrineNPC.moveTo(newloc);
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
}
}
}
event.setCancelled(true);
event.setDamage(0);
return;
}
if ((event instanceof EntityDamageByEntityEvent))
{
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent)event;
if ((dEvent.getDamager() instanceof Player))
{
Player player = (Player)dEvent.getDamager();
if ((player.getItemInHand() != null) && (player.getItemInHand().getType() == Material.DIAMOND_SWORD) && (ItemName.getLore(player.getItemInHand()) != null))
{
this.itemInHand = player.getItemInHand();
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.equalsLoreS != null) && (this.getLore.containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword) && (new Random().nextBoolean())) {
player.getLocation().getWorld().strikeLightning(event.getEntity().getLocation());
}
}
}
else if ((dEvent.getDamager() instanceof Zombie))
{
Zombie zmb = (Zombie)dEvent.getDamager();
if ((zmb.getCustomName() == "Artifact Guardian") || (zmb.getCustomName() == "Herobrine´s Warrior")) {
dEvent.setDamage(dEvent.getDamage() * 3.0D);
}
}
else if ((dEvent.getDamager() instanceof Skeleton))
{
Skeleton zmb = (Skeleton)dEvent.getDamager();
if (zmb.getCustomName() == "Demon") {
dEvent.setDamage(dEvent.getDamage() * 3.0D);
}
}
}
if ((event.getCause() != null) && (event.getCause() == EntityDamageEvent.DamageCause.LIGHTNING) && ((event.getEntity() instanceof Player)) && (event.getEntity().getEntityId() != Herobrine.herobrineEntityID))
{
Player player = (Player)event.getEntity();
if ((player.getItemInHand() != null) && (player.getItemInHand().getType() == Material.DIAMOND_SWORD) && (ItemName.getLore(player.getItemInHand()) != null))
{
this.itemInHand = player.getItemInHand();
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.getLore.containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
event.setDamage(0);
event.setCancelled(true);
return;
}
}
}
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
if ((event.getEntity() instanceof Arrow)) {
Arrow arrow = (Arrow)event.getEntity();
if ((arrow.getShooter() instanceof Player)) {
Player player = (Player)arrow.getShooter();
if (player.getInventory().getItemInMainHand() != null) {
this.itemInHand = player.getInventory().getItemInMainHand();
if ((this.itemInHand.getType() != null) && (this.itemInHand.getType() == Material.BOW)) {
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.getLore != null) && (this.getLore.containsAll(this.equalsLore)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) {
player.teleport(arrow.getLocation());
}
}
}
}
}
}
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import net.theprogrammersworld.herobrine.nms.entity.MobType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.inventory.ItemStack;
public class EntityListener implements Listener {
private ItemStack itemInHand;
private ArrayList<String> equalsLore;
private ArrayList<String> equalsLoreS;
private ArrayList<String> getLore;
public EntityListener(){
equalsLore = new ArrayList<String>();
equalsLoreS = new ArrayList<String>();
equalsLore.add("Herobrine's Artifact");
equalsLore.add("Bow of Teleporting");
equalsLoreS.add("Herobrine's Artifact");
equalsLoreS.add("Sword of Lightning");
}
@EventHandler
public void onCreatureSpawn(final CreatureSpawnEvent event) {
if (!Herobrine.isNPCDisabled && Herobrine.getPluginCore().getConfigDB().useWorlds.contains(event.getEntity().getLocation().getWorld().getName())) {
final Entity entity = event.getEntity();
final EntityType creatureType = event.getEntityType();
if (event.isCancelled()) {
return;
}
if (creatureType == EntityType.ZOMBIE) {
if (Herobrine.getPluginCore().getConfigDB().UseNPC_Warrior && (new Random().nextInt(100) < Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance"))
&& !Herobrine.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) {
final LivingEntity ent = (LivingEntity) entity;
ent.setHealth(0);
Herobrine.getPluginCore().getEntityManager().spawnCustomZombie(event.getLocation(), MobType.HEROBRINE_WARRIOR);
}
} else if ((creatureType == EntityType.SKELETON) && Herobrine.getPluginCore().getConfigDB().UseNPC_Demon
&& (new Random().nextInt(100) < Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.SpawnChance"))
&& !Herobrine.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId())) {
final LivingEntity ent = (LivingEntity) entity;
ent.setHealth(0);
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(event.getLocation(), MobType.DEMON);
}
}
}
@EventHandler
public void onEntityDeathEvent(final EntityDeathEvent event) {
if (Herobrine.getPluginCore().getEntityManager().isCustomMob(event.getEntity().getEntityId())) {
Herobrine.getPluginCore().getEntityManager().removeMob(event.getEntity().getEntityId());
}
}
@EventHandler
public void EntityTargetEvent(final EntityTargetLivingEntityEvent e) {
final LivingEntity lv = e.getTarget();
if (lv != null) {
if (lv.getEntityId() == Herobrine.herobrineEntityID) {
e.setCancelled(true);
}
}
}
@EventHandler
public void onEntityDamageByBlock(final EntityDamageByBlockEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID) {
event.setCancelled(true);
event.setDamage(0);
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void onEntityDamage(final EntityDamageEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID)
{
if ((event instanceof EntityDamageByEntityEvent))
{
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent)event;
if ((Herobrine.getPluginCore().getConfigDB().Killable) && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() != Core.CoreType.GRAVEYARD)) {
if ((dEvent.getDamager() instanceof Player))
{
if (event.getDamage() >= Herobrine.HerobrineHP)
{
int i = 1;
for (i = 1; i <= 2500; i++) {
if (Herobrine.getPluginCore().getConfigDB().config.contains("config.Drops." + Integer.toString(i)))
{
Random randgen = new Random();
int chance = randgen.nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".chance")) {
Herobrine.herobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(Herobrine.herobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".count")));
}
}
}
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
Player player = (Player)dEvent.getDamager();
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().DeathMessage);
}
else
{
Herobrine.HerobrineHP = (int)(Herobrine.HerobrineHP - event.getDamage());
Herobrine.herobrineNPC.hurtAnimation();
AICore.log.info("HIT: " + event.getDamage());
}
}
else if ((dEvent.getDamager() instanceof Projectile))
{
Arrow arrow = (Arrow)dEvent.getDamager();
if ((arrow.getShooter() instanceof Player))
{
if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.getPluginCore().getAICore().setAttackTarget((Player)arrow.getShooter());
}
else if (event.getDamage() >= Herobrine.HerobrineHP)
{
int i = 1;
for (i = 1; i <= 2500; i++) {
if (Herobrine.getPluginCore().getConfigDB().config.contains("config.Drops." + Integer.toString(i)))
{
Random randgen = new Random();
int chance = randgen.nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".chance")) {
Herobrine.herobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(Herobrine.herobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".count")));
}
}
}
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
Player player = (Player)arrow.getShooter();
player.sendMessage("<Herobrine> " + Herobrine.getPluginCore().getConfigDB().DeathMessage);
}
else
{
Herobrine.HerobrineHP = (int)(Herobrine.HerobrineHP - event.getDamage());
Herobrine.herobrineNPC.hurtAnimation();
AICore.log.info("HIT: " + event.getDamage());
}
}
else if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Location newloc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
newloc.setY(-20.0D);
Herobrine.herobrineNPC.moveTo(newloc);
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
}
}
else if (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION)
{
Location newloc = Herobrine.herobrineNPC.getBukkitEntity().getLocation();
newloc.setY(-20.0D);
Herobrine.herobrineNPC.moveTo(newloc);
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
}
}else {
event.setCancelled(true);
event.setDamage(0);
return;
}
}
}
if ((event instanceof EntityDamageByEntityEvent))
{
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent)event;
if ((dEvent.getDamager() instanceof Player))
{
Player player = (Player)dEvent.getDamager();
if ((player.getInventory().getItemInMainHand()!= null) && (player.getInventory().getItemInMainHand().getType() == Material.DIAMOND_SWORD) && (ItemName.getLore(player.getItemInHand()) != null))
{
this.itemInHand = player.getInventory().getItemInMainHand();
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.equalsLoreS != null) && (this.getLore.containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword) && (new Random().nextBoolean())) {
player.getLocation().getWorld().strikeLightning(event.getEntity().getLocation());
}
}
}
else if ((dEvent.getDamager() instanceof Zombie))
{
Zombie zmb = (Zombie)dEvent.getDamager();
if ((zmb.getCustomName() == "Artifact Guardian") || (zmb.getCustomName() == "Herobrine´s Warrior")) {
dEvent.setDamage(dEvent.getDamage() * 3.0D);
}
}
else if ((dEvent.getDamager() instanceof Skeleton))
{
Skeleton zmb = (Skeleton)dEvent.getDamager();
if (zmb.getCustomName() == "Demon") {
dEvent.setDamage(dEvent.getDamage() * 3.0D);
}
}
}
if ((event.getCause() != null) && (event.getCause() == EntityDamageEvent.DamageCause.LIGHTNING) && ((event.getEntity() instanceof Player)) && (event.getEntity().getEntityId() != Herobrine.herobrineEntityID))
{
Player player = (Player)event.getEntity();
if ((player.getInventory().getItemInMainHand() != null) && (player.getInventory().getItemInMainHand().getType() == Material.DIAMOND_SWORD) && (ItemName.getLore(player.getItemInHand()) != null))
{
this.itemInHand =player.getInventory().getItemInMainHand();;
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.getLore.containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
event.setDamage(0);
event.setCancelled(true);
return;
}
}
}
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
if ((event.getEntity() instanceof Arrow)) {
Arrow arrow = (Arrow)event.getEntity();
if ((arrow.getShooter() instanceof Player)) {
Player player = (Player)arrow.getShooter();
if (player.getInventory().getItemInMainHand() != null) {
this.itemInHand = player.getInventory().getItemInMainHand();
if ((this.itemInHand.getType() != null) && (this.itemInHand.getType() == Material.BOW)) {
this.getLore = ItemName.getLore(this.itemInHand);
if ((this.getLore != null) && (this.getLore.containsAll(this.equalsLore)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) {
player.teleport(arrow.getLocation());
}
}
}
}
}
}
}

View File

@ -1,45 +1,45 @@
package net.theprogrammersworld.herobrine.listeners;
import java.util.Random;
import java.util.logging.Logger;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType;
public class InventoryListener implements Listener {
Logger log;
public InventoryListener() {
super();
log = Logger.getLogger("Minecraft");
}
@EventHandler
public void onInventoryClose(final InventoryCloseEvent event) {
if (event.getInventory().getType() == InventoryType.CHEST) {
final Object[] data = { event.getPlayer(), event.getInventory() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.BOOK).runCore(data);
if ((new Random().nextInt(100) > 97) && Herobrine.getPluginCore().getConfigDB().UseHeads && (event.getInventory().firstEmpty() != -1)
&& Herobrine.getPluginCore().getAICore().getResetLimits().isHead()) {
event.getInventory().setItem(event.getInventory().firstEmpty(), ItemName.CreateSkull(event.getPlayer().getName()));
}
}
}
@EventHandler
public void onInventoryOpen(final InventoryOpenEvent event) {
if (((event.getInventory().getType() == InventoryType.CHEST) || (event.getInventory().getType() == InventoryType.FURNACE) || (event.getInventory().getType() == InventoryType.WORKBENCH))
&& Herobrine.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) && Herobrine.getPluginCore().getConfigDB().PlaceSigns
&& Herobrine.getPluginCore().getSupport().checkSigns(event.getPlayer().getLocation()) && Herobrine.getPluginCore().getAICore().getResetLimits().isSign()) {
final Object[] data = { event.getPlayer().getLocation(), event.getPlayer().getLocation() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.SIGNS).runCore(data);
}
}
}
package net.theprogrammersworld.herobrine.listeners;
import java.util.Random;
import java.util.logging.Logger;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType;
public class InventoryListener implements Listener {
Logger log;
public InventoryListener() {
super();
log = Logger.getLogger("Minecraft");
}
@EventHandler
public void onInventoryClose(final InventoryCloseEvent event) {
if (event.getInventory().getType() == InventoryType.CHEST) {
final Object[] data = { event.getPlayer(), event.getInventory() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.BOOK).runCore(data);
if ((new Random().nextInt(100) > 97) && Herobrine.getPluginCore().getConfigDB().UseHeads && (event.getInventory().firstEmpty() != -1)
&& Herobrine.getPluginCore().getAICore().getResetLimits().isHead()) {
event.getInventory().setItem(event.getInventory().firstEmpty(), ItemName.CreateSkull(event.getPlayer().getName()));
}
}
}
@EventHandler
public void onInventoryOpen(final InventoryOpenEvent event) {
if (((event.getInventory().getType() == InventoryType.CHEST) || (event.getInventory().getType() == InventoryType.FURNACE) || (event.getInventory().getType() == InventoryType.WORKBENCH))
&& Herobrine.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) && Herobrine.getPluginCore().getConfigDB().PlaceSigns
&& Herobrine.getPluginCore().getSupport().checkSigns(event.getPlayer().getLocation()) && Herobrine.getPluginCore().getAICore().getResetLimits().isSign()) {
final Object[] data = { event.getPlayer().getLocation(), event.getPlayer().getLocation() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.SIGNS).runCore(data);
}
}
}

View File

@ -1,219 +1,219 @@
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Jukebox;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
public class PlayerListener implements Listener {
private ArrayList<String> equalsLoreS = new ArrayList<String>();
private ArrayList<String> equalsLoreA = new ArrayList<String>();
private ArrayList<LivingEntity> LivingEntities = new ArrayList<LivingEntity>();
private Location le_loc = null;
private Location p_loc = null;
private long timestamp = 0L;
private boolean canUse = false;
public PlayerListener() {
this.equalsLoreS.add("Herobrine´s artifact");
this.equalsLoreS.add("Sword of Lighting");
this.equalsLoreA.add("Herobrine´s artifact");
this.equalsLoreA.add("Apple of Death");
}
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent event) {
if (((event.getAction() == Action.LEFT_CLICK_BLOCK) || (event.getAction() == Action.RIGHT_CLICK_BLOCK)) &&
(event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null))
{
ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
if ((event.getPlayer().getInventory().getItemInMainHand().getType() != null) &&
((itemInHand.getType() == Material.DIAMOND_SWORD) || (itemInHand.getType() == Material.GOLDEN_APPLE)) &&
(ItemName.getLore(itemInHand) != null)) {
if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
if (new Random().nextBoolean()) {
event.getPlayer().getLocation().getWorld().strikeLightning(event.getClickedBlock().getLocation());
}
}
else if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreA)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
this.timestamp = (System.currentTimeMillis() / 1000L);
this.canUse = false;
if (Herobrine.getPluginCore().PlayerApple.containsKey(event.getPlayer()))
{
if (((Long)Herobrine.getPluginCore().PlayerApple.get(event.getPlayer())).longValue() < this.timestamp)
{
Herobrine.getPluginCore().PlayerApple.remove(event.getPlayer());
this.canUse = true;
}
else
{
this.canUse = false;
}
}
else {
this.canUse = true;
}
if (this.canUse)
{
event.getPlayer().getWorld().createExplosion(event.getPlayer().getLocation(), 0.0F);
this.LivingEntities = ((ArrayList<LivingEntity>)event.getPlayer().getLocation().getWorld().getLivingEntities());
Herobrine.getPluginCore().PlayerApple.put(event.getPlayer(), Long.valueOf(this.timestamp + 60L));
for (int i = 0; i <= this.LivingEntities.size() - 1; i++) {
if ((!(this.LivingEntities.get(i) instanceof Player)) && (this.LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID))
{
this.le_loc = this.LivingEntities.get(i).getLocation();
this.p_loc = event.getPlayer().getLocation();
if ((this.le_loc.getBlockX() < this.p_loc.getBlockX() + 20) && (this.le_loc.getBlockX() > this.p_loc.getBlockX() - 20) &&
(this.le_loc.getBlockY() < this.p_loc.getBlockY() + 10) && (this.le_loc.getBlockY() > this.p_loc.getBlockY() - 10) &&
(this.le_loc.getBlockZ() < this.p_loc.getBlockZ() + 20) && (this.le_loc.getBlockZ() > this.p_loc.getBlockZ() - 20))
{
event.getPlayer().getWorld().createExplosion(this.LivingEntities.get(i).getLocation(), 0.0F);
this.LivingEntities.get(i).damage(10000);
}
}
}
}
else
{
event.getPlayer().sendMessage(ChatColor.RED + "Apple of Death is recharging!");
}
}
}
}
if ((event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) {
final ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
final Jukebox block = (Jukebox) event.getClickedBlock().getState();
if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) {
Herobrine.getPluginCore().getAICore();
if (!AICore.isDiscCalled) {
final Player player = event.getPlayer();
Herobrine.getPluginCore().getAICore();
AICore.isDiscCalled = true;
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Herobrine.getPluginCore().getAICore().callByDisc(player);
}
}, 50L);
}
}
}
}
@EventHandler
public void onPlayerEnterBed(final PlayerBedEnterEvent event) {
if (new Random().nextInt(100) > 75) {
final Player player = event.getPlayer();
event.setCancelled(true);
Herobrine.getPluginCore().getAICore().playerBedEnter(player);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerQuit(final PlayerQuitEvent event) {
if (event.getPlayer().getEntityId() != Herobrine.herobrineEntityID) {
Herobrine.getPluginCore().getAICore();
if ((AICore.PlayerTarget == event.getPlayer()) && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.GRAVEYARD) && (event.getPlayer().getLocation().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName))) {
Herobrine.getPluginCore().getAICore();
if (AICore.isTarget) {
event.getPlayer().teleport(Herobrine.getPluginCore().getAICore().getGraveyard().getSavedLocation());
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerKick(final PlayerKickEvent event) {
if (event.getPlayer().getEntityId() == Herobrine.herobrineEntityID) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
if (event.getPlayer().getEntityId() == Herobrine.herobrineEntityID) {
if (event.getFrom().getWorld() != event.getTo().getWorld()) {
Herobrine.getPluginCore().removeHerobrine();
Herobrine.getPluginCore().spawnHerobrine(event.getTo());
event.setCancelled(true);
return;
}
if ((Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockX() > Herobrine.getPluginCore().getConfigDB().WalkingModeXRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockX() < -Herobrine.getPluginCore().getConfigDB().WalkingModeXRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockZ() > Herobrine.getPluginCore().getConfigDB().WalkingModeZRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockZ() < -Herobrine.getPluginCore().getConfigDB().WalkingModeZRadius)) {
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.RANDOM_POSITION, true);
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorlds().get(0), 0.0D, -20.0D, 0.0D));
}
}
}
@EventHandler
public void onPlayerCommand(final PlayerCommandPreprocessEvent event) {
if (event.getPlayer().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName) && !event.getPlayer().hasPermission("hb-ai.cmdblockbypass")) {
event.setCancelled(true);
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
// If the plugin is configured to show Herobrine in the tab list, add him to the list
// when the user logs on.
if(Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
AICore.showHero(event.getPlayer());
}
}
@EventHandler
public void onPlayerDeathEvent(final PlayerDeathEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID) {
event.setDeathMessage("");
Herobrine.getPluginCore().removeHerobrine();
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
Herobrine.getPluginCore().spawnHerobrine(nowloc);
}
}
@EventHandler
public void onPlayerMoveEvent(final PlayerMoveEvent event) {
if ((event.getPlayer().getEntityId() != Herobrine.herobrineEntityID) && (event.getPlayer().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName))) {
final Player player = event.getPlayer();
player.teleport(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 10.69, -179.85f, 0.44999f));
}
}
package net.theprogrammersworld.herobrine.listeners;
import java.util.ArrayList;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.AICore;
import net.theprogrammersworld.herobrine.AI.Core;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Jukebox;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
public class PlayerListener implements Listener {
private ArrayList<String> equalsLoreS = new ArrayList<String>();
private ArrayList<String> equalsLoreA = new ArrayList<String>();
private ArrayList<LivingEntity> LivingEntities = new ArrayList<LivingEntity>();
private Location le_loc = null;
private Location p_loc = null;
private long timestamp = 0L;
private boolean canUse = false;
public PlayerListener() {
this.equalsLoreS.add("Herobrine´s artifact");
this.equalsLoreS.add("Sword of Lighting");
this.equalsLoreA.add("Herobrine´s artifact");
this.equalsLoreA.add("Apple of Death");
}
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent event) {
if (((event.getAction() == Action.LEFT_CLICK_BLOCK) || (event.getAction() == Action.RIGHT_CLICK_BLOCK)) &&
(event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null))
{
ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
if ((event.getPlayer().getInventory().getItemInMainHand().getType() != null) &&
((itemInHand.getType() == Material.DIAMOND_SWORD) || (itemInHand.getType() == Material.GOLDEN_APPLE)) &&
(ItemName.getLore(itemInHand) != null)) {
if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
{
if (new Random().nextBoolean()) {
event.getPlayer().getLocation().getWorld().strikeLightning(event.getClickedBlock().getLocation());
}
}
else if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreA)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactApple))
{
this.timestamp = (System.currentTimeMillis() / 1000L);
this.canUse = false;
if (Herobrine.getPluginCore().PlayerApple.containsKey(event.getPlayer()))
{
if (((Long)Herobrine.getPluginCore().PlayerApple.get(event.getPlayer())).longValue() < this.timestamp)
{
Herobrine.getPluginCore().PlayerApple.remove(event.getPlayer());
this.canUse = true;
}
else
{
this.canUse = false;
}
}
else {
this.canUse = true;
}
if (this.canUse)
{
event.getPlayer().getWorld().createExplosion(event.getPlayer().getLocation(), 0.0F);
this.LivingEntities = ((ArrayList<LivingEntity>)event.getPlayer().getLocation().getWorld().getLivingEntities());
Herobrine.getPluginCore().PlayerApple.put(event.getPlayer(), Long.valueOf(this.timestamp + 60L));
for (int i = 0; i <= this.LivingEntities.size() - 1; i++) {
if ((!(this.LivingEntities.get(i) instanceof Player)) && (this.LivingEntities.get(i).getEntityId() != Herobrine.herobrineEntityID))
{
this.le_loc = this.LivingEntities.get(i).getLocation();
this.p_loc = event.getPlayer().getLocation();
if ((this.le_loc.getBlockX() < this.p_loc.getBlockX() + 20) && (this.le_loc.getBlockX() > this.p_loc.getBlockX() - 20) &&
(this.le_loc.getBlockY() < this.p_loc.getBlockY() + 10) && (this.le_loc.getBlockY() > this.p_loc.getBlockY() - 10) &&
(this.le_loc.getBlockZ() < this.p_loc.getBlockZ() + 20) && (this.le_loc.getBlockZ() > this.p_loc.getBlockZ() - 20))
{
event.getPlayer().getWorld().createExplosion(this.LivingEntities.get(i).getLocation(), 0.0F);
this.LivingEntities.get(i).damage(10000);
}
}
}
}
else
{
event.getPlayer().sendMessage(ChatColor.RED + "Apple of Death is recharging!");
}
}
}
}
if ((event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) {
final ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
final Jukebox block = (Jukebox) event.getClickedBlock().getState();
if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) {
Herobrine.getPluginCore().getAICore();
if (!AICore.isDiscCalled) {
final Player player = event.getPlayer();
Herobrine.getPluginCore().getAICore();
AICore.isDiscCalled = true;
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.ANY, true);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
@Override
public void run() {
Herobrine.getPluginCore().getAICore().callByDisc(player);
}
}, 50L);
}
}
}
}
@EventHandler
public void onPlayerEnterBed(final PlayerBedEnterEvent event) {
if (new Random().nextInt(100) > 75) {
final Player player = event.getPlayer();
event.setCancelled(true);
Herobrine.getPluginCore().getAICore().playerBedEnter(player);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerQuit(final PlayerQuitEvent event) {
if (event.getPlayer().getEntityId() != Herobrine.herobrineEntityID) {
Herobrine.getPluginCore().getAICore();
if ((AICore.PlayerTarget == event.getPlayer()) && (Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.GRAVEYARD) && (event.getPlayer().getLocation().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName))) {
Herobrine.getPluginCore().getAICore();
if (AICore.isTarget) {
event.getPlayer().teleport(Herobrine.getPluginCore().getAICore().getGraveyard().getSavedLocation());
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerKick(final PlayerKickEvent event) {
if (event.getPlayer().getEntityId() == Herobrine.herobrineEntityID) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
if (event.getPlayer().getEntityId() == Herobrine.herobrineEntityID) {
if (event.getFrom().getWorld() != event.getTo().getWorld()) {
Herobrine.getPluginCore().removeHerobrine();
Herobrine.getPluginCore().spawnHerobrine(event.getTo());
event.setCancelled(true);
return;
}
if ((Herobrine.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockX() > Herobrine.getPluginCore().getConfigDB().WalkingModeXRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockX() < -Herobrine.getPluginCore().getConfigDB().WalkingModeXRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockZ() > Herobrine.getPluginCore().getConfigDB().WalkingModeZRadius) &&
(Herobrine.herobrineNPC.getNMSEntity().getBukkitEntity().getLocation().getBlockZ() < -Herobrine.getPluginCore().getConfigDB().WalkingModeZRadius)) {
Herobrine.getPluginCore().getAICore().cancelTarget(Core.CoreType.RANDOM_POSITION, true);
Herobrine.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorlds().get(0), 0.0D, -20.0D, 0.0D));
}
}
}
@EventHandler
public void onPlayerCommand(final PlayerCommandPreprocessEvent event) {
if (event.getPlayer().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName) && !event.getPlayer().hasPermission("hb-ai.cmdblockbypass")) {
event.setCancelled(true);
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
// If the plugin is configured to show Herobrine in the tab list, add him to the list
// when the user logs on.
if(Herobrine.getPluginCore().getConfigDB().ShowInTabList) {
AICore.showHero(event.getPlayer());
}
}
@EventHandler
public void onPlayerDeathEvent(final PlayerDeathEvent event) {
if (event.getEntity().getEntityId() == Herobrine.herobrineEntityID) {
event.setDeathMessage("");
Herobrine.getPluginCore().removeHerobrine();
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f);
Herobrine.getPluginCore().spawnHerobrine(nowloc);
}
}
@EventHandler
public void onPlayerMoveEvent(final PlayerMoveEvent event) {
if ((event.getPlayer().getEntityId() != Herobrine.herobrineEntityID) && (event.getPlayer().getWorld() == Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName))) {
final Player player = event.getPlayer();
player.teleport(new Location(Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName), -2.49, 4.0, 10.69, -179.85f, 0.44999f));
}
}
}

View File

@ -1,36 +1,36 @@
package net.theprogrammersworld.herobrine.listeners;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
public class WorldListener implements Listener {
@EventHandler
public void onChunkLoad(final ChunkLoadEvent event) {
if (event.isNewChunk()) {
final World world = event.getWorld();
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(world.getName())) {
int pyramidChance = Herobrine.getPluginCore().getConfigDB().BuildPyramidOnChunkPercentage;
int templeChance = Herobrine.getPluginCore().getConfigDB().BuildTempleOnChunkPercentage;
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids && (new Random().nextInt(100) + 1 <= pyramidChance)) {
final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.PYRAMID).runCore(data);
}
if (Herobrine.getPluginCore().getConfigDB().BuildTemples && (new Random().nextInt(100) + 1 <= templeChance)) {
final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.TEMPLE).runCore(data);
}
}
}
}
package net.theprogrammersworld.herobrine.listeners;
import java.util.Random;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.AI.Core;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
public class WorldListener implements Listener {
@EventHandler
public void onChunkLoad(final ChunkLoadEvent event) {
if (event.isNewChunk()) {
final World world = event.getWorld();
if (Herobrine.getPluginCore().getConfigDB().useWorlds.contains(world.getName())) {
int pyramidChance = Herobrine.getPluginCore().getConfigDB().BuildPyramidOnChunkPercentage;
int templeChance = Herobrine.getPluginCore().getConfigDB().BuildTempleOnChunkPercentage;
if (Herobrine.getPluginCore().getConfigDB().BuildPyramids && (new Random().nextInt(100) + 1 <= pyramidChance)) {
final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.PYRAMID).runCore(data);
}
if (Herobrine.getPluginCore().getConfigDB().BuildTemples && (new Random().nextInt(100) + 1 <= templeChance)) {
final Object[] data = { event.getChunk() };
Herobrine.getPluginCore().getAICore().getCore(Core.CoreType.TEMPLE).runCore(data);
}
}
}
}
}

View File

@ -1,117 +1,117 @@
package net.theprogrammersworld.herobrine.misc;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
public class BlockChanger {
public static BlockFace getPlayerBlockFace(final Location loc) {
BlockFace dir = null;
float y = loc.getYaw();
if (y < 0.0f) {
y += 360.0f;
}
y %= 360.0f;
final int i = (int) ((y + 8.0f) / 22.5);
switch (i) {
case 0: {
dir = BlockFace.WEST;
break;
}
case 1: {
dir = BlockFace.WEST_NORTH_WEST;
break;
}
case 2: {
dir = BlockFace.NORTH_WEST;
break;
}
case 3: {
dir = BlockFace.NORTH_NORTH_WEST;
break;
}
case 4: {
dir = BlockFace.NORTH;
break;
}
case 5: {
dir = BlockFace.NORTH_NORTH_EAST;
break;
}
case 6: {
dir = BlockFace.NORTH_EAST;
break;
}
case 7: {
dir = BlockFace.EAST_NORTH_EAST;
break;
}
case 8: {
dir = BlockFace.EAST;
break;
}
case 9: {
dir = BlockFace.EAST_SOUTH_EAST;
break;
}
case 10: {
dir = BlockFace.SOUTH_EAST;
break;
}
case 11: {
dir = BlockFace.SOUTH_SOUTH_EAST;
break;
}
case 12: {
dir = BlockFace.SOUTH;
break;
}
case 13: {
dir = BlockFace.SOUTH_SOUTH_WEST;
break;
}
case 14: {
dir = BlockFace.SOUTH_WEST;
break;
}
case 15: {
dir = BlockFace.WEST_SOUTH_WEST;
break;
}
default: {
dir = BlockFace.WEST;
break;
}
}
return dir;
}
@SuppressWarnings("deprecation")
public static void PlaceSkull(final Location loc, final String name) {
final int chance = new Random().nextInt(7);
final Block b = loc.getBlock();
b.setType(Material.SKULL);
final Skull skull = (Skull) b.getState();
skull.setSkullType(SkullType.PLAYER);
skull.setOwner(name);
BlockFace bface = BlockFace.EAST;
if (chance == 0) {
bface = BlockFace.WEST;
} else if (chance == 1) {
bface = BlockFace.EAST;
} else if (chance == 2) {
bface = BlockFace.SOUTH;
} else if (chance == 3) {
bface = BlockFace.NORTH;
}
skull.setRawData((byte) bface.ordinal());
skull.update(true);
}
}
package net.theprogrammersworld.herobrine.misc;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
public class BlockChanger {
public static BlockFace getPlayerBlockFace(final Location loc) {
BlockFace dir = null;
float y = loc.getYaw();
if (y < 0.0f) {
y += 360.0f;
}
y %= 360.0f;
final int i = (int) ((y + 8.0f) / 22.5);
switch (i) {
case 0: {
dir = BlockFace.WEST;
break;
}
case 1: {
dir = BlockFace.WEST_NORTH_WEST;
break;
}
case 2: {
dir = BlockFace.NORTH_WEST;
break;
}
case 3: {
dir = BlockFace.NORTH_NORTH_WEST;
break;
}
case 4: {
dir = BlockFace.NORTH;
break;
}
case 5: {
dir = BlockFace.NORTH_NORTH_EAST;
break;
}
case 6: {
dir = BlockFace.NORTH_EAST;
break;
}
case 7: {
dir = BlockFace.EAST_NORTH_EAST;
break;
}
case 8: {
dir = BlockFace.EAST;
break;
}
case 9: {
dir = BlockFace.EAST_SOUTH_EAST;
break;
}
case 10: {
dir = BlockFace.SOUTH_EAST;
break;
}
case 11: {
dir = BlockFace.SOUTH_SOUTH_EAST;
break;
}
case 12: {
dir = BlockFace.SOUTH;
break;
}
case 13: {
dir = BlockFace.SOUTH_SOUTH_WEST;
break;
}
case 14: {
dir = BlockFace.SOUTH_WEST;
break;
}
case 15: {
dir = BlockFace.WEST_SOUTH_WEST;
break;
}
default: {
dir = BlockFace.WEST;
break;
}
}
return dir;
}
@SuppressWarnings("deprecation")
public static void PlaceSkull(final Location loc, final String name) {
final int chance = new Random().nextInt(7);
final Block b = loc.getBlock();
b.setType(Material.SKULL);
final Skull skull = (Skull) b.getState();
skull.setSkullType(SkullType.PLAYER);
skull.setOwner(name);
BlockFace bface = BlockFace.EAST;
if (chance == 0) {
bface = BlockFace.WEST;
} else if (chance == 1) {
bface = BlockFace.EAST;
} else if (chance == 2) {
bface = BlockFace.SOUTH;
} else if (chance == 3) {
bface = BlockFace.NORTH;
}
skull.setRawData((byte) bface.ordinal());
skull.update(true);
}
}

View File

@ -1,45 +1,45 @@
package net.theprogrammersworld.herobrine.misc;
import org.bukkit.inventory.ItemStack;
public class CustomID {
private int id = 0;
private int data = 0;
public CustomID(final String _data) {
if (_data != null && !_data.equals("0") && (_data != null) && (_data.length() > 0)) {
final String[] both = _data.split("[:]");
id = Integer.parseInt(both[0]);
if (both.length > 1) {
data = Integer.parseInt(both[1]);
}
}
}
public int getId() {
return id;
}
public int getData() {
return data;
}
public boolean hasData() {
return data > 0;
}
@SuppressWarnings("deprecation")
public ItemStack getItemStack() {
ItemStack item = null;
if (id != 0) {
if (data > 0) {
item = new ItemStack(id, 1, (byte) data);
} else {
item = new ItemStack(id);
}
}
return item;
}
package net.theprogrammersworld.herobrine.misc;
import org.bukkit.inventory.ItemStack;
public class CustomID {
private int id = 0;
private int data = 0;
public CustomID(final String _data) {
if (_data != null && !_data.equals("0") && (_data != null) && (_data.length() > 0)) {
final String[] both = _data.split("[:]");
id = Integer.parseInt(both[0]);
if (both.length > 1) {
data = Integer.parseInt(both[1]);
}
}
}
public int getId() {
return id;
}
public int getData() {
return data;
}
public boolean hasData() {
return data > 0;
}
@SuppressWarnings("deprecation")
public ItemStack getItemStack() {
ItemStack item = null;
if (id != 0) {
if (data > 0) {
item = new ItemStack(id, 1, (byte) data);
} else {
item = new ItemStack(id);
}
}
return item;
}
}

View File

@ -1,67 +1,67 @@
package net.theprogrammersworld.herobrine.misc;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
public class ItemName {
public static ItemMeta meta;
public static SkullMeta skullmeta;
static {
ItemName.meta = null;
ItemName.skullmeta = null;
}
public static ItemStack colorLeatherArmor(final ItemStack i, final Color color) {
final LeatherArmorMeta la_meta = (LeatherArmorMeta) i.getItemMeta();
la_meta.setColor(color);
i.setItemMeta(la_meta);
return i;
}
public static ItemStack setName(final ItemStack item, final String name) {
(ItemName.meta = item.getItemMeta()).setDisplayName(name);
item.setItemMeta(ItemName.meta);
return item;
}
public static ItemStack setLore(final ItemStack item, final ArrayList<String> lore) {
(ItemName.meta = item.getItemMeta()).setLore(lore);
item.setItemMeta(ItemName.meta);
return item;
}
public static ItemStack setNameAndLore(final ItemStack item, final String name, final ArrayList<String> lore) {
(ItemName.meta = item.getItemMeta()).setDisplayName(name);
ItemName.meta.setLore(lore);
item.setItemMeta(ItemName.meta);
return item;
}
public static ArrayList<String> getLore(final ItemStack item) {
return (ArrayList<String>) item.getItemMeta().getLore();
}
public static String getName(final ItemStack item) {
return item.getItemMeta().getDisplayName();
}
public static ItemStack CreateSkull(final String data) {
final ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
final SkullMeta skullmeta = (SkullMeta) skull.getItemMeta();
skullmeta.setOwner(data);
skullmeta.setDisplayName(ChatColor.RESET + data);
skull.setItemMeta(skullmeta);
return skull;
}
package net.theprogrammersworld.herobrine.misc;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.SkullType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
public class ItemName {
public static ItemMeta meta;
public static SkullMeta skullmeta;
static {
ItemName.meta = null;
ItemName.skullmeta = null;
}
public static ItemStack colorLeatherArmor(final ItemStack i, final Color color) {
final LeatherArmorMeta la_meta = (LeatherArmorMeta) i.getItemMeta();
la_meta.setColor(color);
i.setItemMeta(la_meta);
return i;
}
public static ItemStack setName(final ItemStack item, final String name) {
(ItemName.meta = item.getItemMeta()).setDisplayName(name);
item.setItemMeta(ItemName.meta);
return item;
}
public static ItemStack setLore(final ItemStack item, final ArrayList<String> lore) {
(ItemName.meta = item.getItemMeta()).setLore(lore);
item.setItemMeta(ItemName.meta);
return item;
}
public static ItemStack setNameAndLore(final ItemStack item, final String name, final ArrayList<String> lore) {
(ItemName.meta = item.getItemMeta()).setDisplayName(name);
ItemName.meta.setLore(lore);
item.setItemMeta(ItemName.meta);
return item;
}
public static ArrayList<String> getLore(final ItemStack item) {
return (ArrayList<String>) item.getItemMeta().getLore();
}
public static String getName(final ItemStack item) {
return item.getItemMeta().getDisplayName();
}
public static ItemStack CreateSkull(final String data) {
final ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
final SkullMeta skullmeta = (SkullMeta) skull.getItemMeta();
skullmeta.setOwner(data);
skullmeta.setDisplayName(ChatColor.RESET + data);
skull.setItemMeta(skullmeta);
return skull;
}
}

View File

@ -1,53 +1,53 @@
package net.theprogrammersworld.herobrine.misc;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
public class StructureLoader {
private int current;
private int length;
private InputStream inp;
private YamlConfiguration file;
public StructureLoader(final InputStream in) {
super();
current = 0;
length = 0;
inp = in;
file = new YamlConfiguration();
try {
file.load(new InputStreamReader(inp, StandardCharsets.UTF_8));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
} catch (InvalidConfigurationException e3) {
e3.printStackTrace();
}
try {
inp.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void Build(final World world, final int MainX, final int MainY, final int MainZ) {
length = file.getInt("DATA.LENGTH") - 1;
current = 0;
while (current <= length) {
world.getBlockAt(MainX + file.getInt("DATA." + current + ".X"), MainY + file.getInt("DATA." + current + ".Y"), MainZ + file.getInt("DATA." + current + ".Z"))
.setTypeIdAndData(file.getInt("DATA." + current + ".ID"), (byte) file.getInt("DATA." + current + ".DATA"), false);
++current;
}
}
package net.theprogrammersworld.herobrine.misc;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
public class StructureLoader {
private int current;
private int length;
private InputStream inp;
private YamlConfiguration file;
public StructureLoader(final InputStream in) {
super();
current = 0;
length = 0;
inp = in;
file = new YamlConfiguration();
try {
file.load(new InputStreamReader(inp, StandardCharsets.UTF_8));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
} catch (InvalidConfigurationException e3) {
e3.printStackTrace();
}
try {
inp.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void Build(final World world, final int MainX, final int MainY, final int MainZ) {
length = file.getInt("DATA.LENGTH") - 1;
current = 0;
while (current <= length) {
world.getBlockAt(MainX + file.getInt("DATA." + current + ".X"), MainY + file.getInt("DATA." + current + ".Y"), MainZ + file.getInt("DATA." + current + ".Z"))
.setTypeIdAndData(file.getInt("DATA." + current + ".ID"), (byte) file.getInt("DATA." + current + ".DATA"), false);
++current;
}
}
}

View File

@ -1,127 +1,127 @@
package net.theprogrammersworld.herobrine.nms.NPC;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanEntity;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanNPC;
import net.theprogrammersworld.herobrine.nms.NPC.network.NetworkCore;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSServerAccess;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSWorldAccess;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
public class NPCCore {
private static final GameProfile HEROBRINE_GAME_PROFILE = getHerobrineGameProfile();
private static GameProfile getHerobrineGameProfile() {
// Get Herobrine's UUID and Name. We cannot rely on the ConfigDB because this constructor is called before the ConfigDB is initialized.
String herobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2";
String herobrineName = "Herobrine";
YamlConfiguration configAccess = new YamlConfiguration();
try {
configAccess.load(new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml"));
herobrineUUID = configAccess.getString("config.HerobrineUUID");
herobrineName = configAccess.getString("config.Name");
} catch (Exception e) {}
GameProfile profile = new GameProfile(UUID.fromString(herobrineUUID), herobrineName);
Property textures = new Property(
"textures",
"eyJ0aW1lc3RhbXAiOjE0MjE0ODczMzk3MTMsInByb2ZpbGVJZCI6ImY4NGM2YTc5MGE0ZTQ1ZTA4NzliY2Q0OWViZDRjNGUyIiwicHJvZmlsZU5hbWUiOiJIZXJvYnJpbmUiLCJpc1B1YmxpYyI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzk4YjdjYTNjN2QzMTRhNjFhYmVkOGZjMThkNzk3ZmMzMGI2ZWZjODQ0NTQyNWM0ZTI1MDk5N2U1MmU2Y2IifX19",
"Edb1R3vm2NHUGyTPaOdXNQY9p5/Ez4xButUGY3tNKIJAzjJM5nQNrq54qyFhSZFVwIP6aM4Ivqmdb2AamXNeN0KgaaU/C514N+cUZNWdW5iiycPytfh7a6EsWXV4hCC9B2FoLkbXuxs/KAbKORtwNfFhQupAsmn9yP00e2c3ZQmS18LWwFg0vzFqvp4HvzJHqY/cTqUxdlSFDrQe/4rATe6Yx6v4zbZN2sHbSL+8AwlDDuP2Xr4SS6f8nABOxjSTlWMn6bToAYiymD+KUPoO0kQJ0Uw/pVXgWHYjQeM4BYf/FAxe8Bf1cP8S7VKueULkOxqIjXAp85uqKkU7dR/s4M4yHm6fhCOCLSMv6hi5ewTaFNYyhK+NXPftFqHcOxA1LbrjOe6NyphF/2FI79n90hagxJpWwNPz3/8I5rnGbYwBZPTsTnD8PszgQTNuWSuvZwGIXPIp9zb90xuU7g7VNWjzPVoOHfRNExEs7Dn9pG8CIA/m/a8koWW3pkbP/AMMWnwgHCr/peGdvF5fN+hJwVdpbfC9sJfzGwA7AgXG/6yqhl1U7YAp/aCVM9bZ94sav+kQghvN41jqOwy4F4i/swc7R4Fx2w5HFxVY3j7FChG7iuhqjUclm79YNhTG0lBQLiZbN5FmC9QgrNHRKlzgSZrXHWoG3YXFSqfn4J+Om9w="
);
profile.getProperties().put(textures.getName(), textures);
return profile;
}
private final ArrayList<HumanNPC> npcs = new ArrayList<HumanNPC>();
private NMSServerAccess nmsserver = NMSServerAccess.getInstance();
private Map<World, NMSWorldAccess> nmsworlds = new HashMap<World, NMSWorldAccess>();
private NetworkCore networkCore = new NetworkCore();
private int lastID = 0;
public NPCCore() {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
final ArrayList<HumanNPC> toRemove = new ArrayList<HumanNPC>();
for (final HumanNPC humanNPC : npcs) {
final Entity entity = humanNPC.getNMSEntity();
if (entity.dead) {
toRemove.add(humanNPC);
}
}
for (final HumanNPC n : toRemove) {
npcs.remove(n);
}
}
}, 1L, 1L);
}
public void removeAll() {
for (final HumanNPC humannpc : npcs) {
if (humannpc != null) {
humannpc.removeFromWorld();
}
}
npcs.clear();
}
public NMSWorldAccess getNMSWorldAccess(final World world) {
NMSWorldAccess bworld = nmsworlds.get(world);
if (bworld != null) {
return bworld;
}
bworld = new NMSWorldAccess(world);
nmsworlds.put(world, bworld);
return bworld;
}
public HumanNPC spawnHumanNPC(final Location l) {
++lastID;
final int id = lastID;
return this.spawnHumanNPC(l, id);
}
public HumanNPC spawnHumanNPC(final Location l, final int id) {
final NMSWorldAccess world = getNMSWorldAccess(l.getWorld());
final HumanEntity humanEntity = new HumanEntity(this, world, HEROBRINE_GAME_PROFILE, new PlayerInteractManager(world.getWorldServer()));
humanEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
world.getWorldServer().addEntity(humanEntity);
final HumanNPC humannpc = new HumanNPC(humanEntity, id);
npcs.add(humannpc);
return humannpc;
}
public HumanNPC getHumanNPC(final int id) {
for (final HumanNPC n : npcs) {
if (n.getID() == id) {
return n;
}
}
return null;
}
public NMSServerAccess getServer() {
return nmsserver;
}
public NetworkCore getNetworkCore() {
return networkCore;
}
package net.theprogrammersworld.herobrine.nms.NPC;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanEntity;
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanNPC;
import net.theprogrammersworld.herobrine.nms.NPC.network.NetworkCore;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSServerAccess;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSWorldAccess;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
public class NPCCore {
private static final GameProfile HEROBRINE_GAME_PROFILE = getHerobrineGameProfile();
private static GameProfile getHerobrineGameProfile() {
// Get Herobrine's UUID and Name. We cannot rely on the ConfigDB because this constructor is called before the ConfigDB is initialized.
String herobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2";
String herobrineName = "Herobrine";
YamlConfiguration configAccess = new YamlConfiguration();
try {
configAccess.load(new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml"));
herobrineUUID = configAccess.getString("config.HerobrineUUID");
herobrineName = configAccess.getString("config.Name");
} catch (Exception e) {}
GameProfile profile = new GameProfile(UUID.fromString(herobrineUUID), herobrineName);
Property textures = new Property(
"textures",
"eyJ0aW1lc3RhbXAiOjE0MjE0ODczMzk3MTMsInByb2ZpbGVJZCI6ImY4NGM2YTc5MGE0ZTQ1ZTA4NzliY2Q0OWViZDRjNGUyIiwicHJvZmlsZU5hbWUiOiJIZXJvYnJpbmUiLCJpc1B1YmxpYyI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzk4YjdjYTNjN2QzMTRhNjFhYmVkOGZjMThkNzk3ZmMzMGI2ZWZjODQ0NTQyNWM0ZTI1MDk5N2U1MmU2Y2IifX19",
"Edb1R3vm2NHUGyTPaOdXNQY9p5/Ez4xButUGY3tNKIJAzjJM5nQNrq54qyFhSZFVwIP6aM4Ivqmdb2AamXNeN0KgaaU/C514N+cUZNWdW5iiycPytfh7a6EsWXV4hCC9B2FoLkbXuxs/KAbKORtwNfFhQupAsmn9yP00e2c3ZQmS18LWwFg0vzFqvp4HvzJHqY/cTqUxdlSFDrQe/4rATe6Yx6v4zbZN2sHbSL+8AwlDDuP2Xr4SS6f8nABOxjSTlWMn6bToAYiymD+KUPoO0kQJ0Uw/pVXgWHYjQeM4BYf/FAxe8Bf1cP8S7VKueULkOxqIjXAp85uqKkU7dR/s4M4yHm6fhCOCLSMv6hi5ewTaFNYyhK+NXPftFqHcOxA1LbrjOe6NyphF/2FI79n90hagxJpWwNPz3/8I5rnGbYwBZPTsTnD8PszgQTNuWSuvZwGIXPIp9zb90xuU7g7VNWjzPVoOHfRNExEs7Dn9pG8CIA/m/a8koWW3pkbP/AMMWnwgHCr/peGdvF5fN+hJwVdpbfC9sJfzGwA7AgXG/6yqhl1U7YAp/aCVM9bZ94sav+kQghvN41jqOwy4F4i/swc7R4Fx2w5HFxVY3j7FChG7iuhqjUclm79YNhTG0lBQLiZbN5FmC9QgrNHRKlzgSZrXHWoG3YXFSqfn4J+Om9w="
);
profile.getProperties().put(textures.getName(), textures);
return profile;
}
private final ArrayList<HumanNPC> npcs = new ArrayList<HumanNPC>();
private NMSServerAccess nmsserver = NMSServerAccess.getInstance();
private Map<World, NMSWorldAccess> nmsworlds = new HashMap<World, NMSWorldAccess>();
private NetworkCore networkCore = new NetworkCore();
private int lastID = 0;
public NPCCore() {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Herobrine.getPluginCore(), new Runnable() {
@Override
public void run() {
final ArrayList<HumanNPC> toRemove = new ArrayList<HumanNPC>();
for (final HumanNPC humanNPC : npcs) {
final Entity entity = humanNPC.getNMSEntity();
if (entity.dead) {
toRemove.add(humanNPC);
}
}
for (final HumanNPC n : toRemove) {
npcs.remove(n);
}
}
}, 1L, 1L);
}
public void removeAll() {
for (final HumanNPC humannpc : npcs) {
if (humannpc != null) {
humannpc.removeFromWorld();
}
}
npcs.clear();
}
public NMSWorldAccess getNMSWorldAccess(final World world) {
NMSWorldAccess bworld = nmsworlds.get(world);
if (bworld != null) {
return bworld;
}
bworld = new NMSWorldAccess(world);
nmsworlds.put(world, bworld);
return bworld;
}
public HumanNPC spawnHumanNPC(final Location l) {
++lastID;
final int id = lastID;
return this.spawnHumanNPC(l, id);
}
public HumanNPC spawnHumanNPC(final Location l, final int id) {
final NMSWorldAccess world = getNMSWorldAccess(l.getWorld());
final HumanEntity humanEntity = new HumanEntity(this, world, HEROBRINE_GAME_PROFILE, new PlayerInteractManager(world.getWorldServer()));
humanEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
world.getWorldServer().addEntity(humanEntity);
final HumanNPC humannpc = new HumanNPC(humanEntity, id);
npcs.add(humannpc);
return humannpc;
}
public HumanNPC getHumanNPC(final int id) {
for (final HumanNPC n : npcs) {
if (n.getID() == id) {
return n;
}
}
return null;
}
public NMSServerAccess getServer() {
return nmsserver;
}
public NetworkCore getNetworkCore() {
return networkCore;
}
}

View File

@ -1,53 +1,53 @@
package net.theprogrammersworld.herobrine.nms.NPC.entity;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.EntityHuman;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.EnumGamemode;
import net.minecraft.server.v1_12_R1.EnumMoveType;
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
import net.theprogrammersworld.herobrine.nms.NPC.network.NetworkHandler;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSWorldAccess;
import com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
public class HumanEntity extends EntityPlayer {
public HumanEntity(final NPCCore npcCore, final NMSWorldAccess world, final GameProfile s, final PlayerInteractManager playerInteractManager) {
super(npcCore.getServer().getMCServer(), world.getWorldServer(), s, playerInteractManager);
playerInteractManager.b(EnumGamemode.SURVIVAL);
playerConnection = new NetworkHandler(npcCore, this);
fauxSleeping = true;
}
@Override
public void move(EnumMoveType x, final double arg0, final double arg1, final double arg2) {
setPosition(arg0, arg1, arg2);
}
@Override
public boolean a(final EntityHuman entity) {
return super.a(entity);
}
@Override
public void c(Entity entity) {
super.c(entity);
}
private CraftPlayer cplayer;
@Override
public CraftPlayer getBukkitEntity() {
if (cplayer == null) {
cplayer = new CraftPlayer((CraftServer) Bukkit.getServer(), this);
}
return cplayer;
}
package net.theprogrammersworld.herobrine.nms.NPC.entity;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.EntityHuman;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.EnumGamemode;
import net.minecraft.server.v1_12_R1.EnumMoveType;
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
import net.theprogrammersworld.herobrine.nms.NPC.network.NetworkHandler;
import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSWorldAccess;
import com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
public class HumanEntity extends EntityPlayer {
public HumanEntity(final NPCCore npcCore, final NMSWorldAccess world, final GameProfile s, final PlayerInteractManager playerInteractManager) {
super(npcCore.getServer().getMCServer(), world.getWorldServer(), s, playerInteractManager);
playerInteractManager.b(EnumGamemode.SURVIVAL);
playerConnection = new NetworkHandler(npcCore, this);
fauxSleeping = true;
}
@Override
public void move(EnumMoveType x, final double arg0, final double arg1, final double arg2) {
setPosition(arg0, arg1, arg2);
}
@Override
public boolean a(final EntityHuman entity) {
return super.a(entity);
}
@Override
public void c(Entity entity) {
super.c(entity);
}
private CraftPlayer cplayer;
@Override
public CraftPlayer getBukkitEntity() {
if (cplayer == null) {
cplayer = new CraftPlayer((CraftServer) Bukkit.getServer(), this);
}
return cplayer;
}
}

View File

@ -1,106 +1,106 @@
package net.theprogrammersworld.herobrine.nms.NPC.entity;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.PacketPlayInArmAnimation;
import net.minecraft.server.v1_12_R1.WorldServer;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class HumanNPC {
private EntityPlayer entity;
private final int id;
public HumanNPC(final HumanEntity humanEntity, final int id) {
entity = humanEntity;
this.id = id;
}
public int getID() {
return id;
}
public EntityPlayer getNMSEntity() {
return entity;
}
public void armSwingAnimation() {
((WorldServer) getNMSEntity().world).tracker.a(getNMSEntity(), new PacketPlayInArmAnimation());
}
public void hurtAnimation() {
((LivingEntity) entity.getBukkitEntity()).damage(0.5);
((LivingEntity) entity.getBukkitEntity()).setHealth(20);
}
public void setItemInHand(final ItemStack item) {
if (item != null) {
((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).getInventory().setItemInMainHand(item);
}
}
public String getName() {
return ((HumanEntity) getNMSEntity()).getName();
}
public void moveTo(final Location loc) {
teleport(loc);
}
public void teleport(final Location loc) {
if (loc.getWorld().getName().equals(getNMSEntity().world.getWorld().getName())) {
getNMSEntity().locX = loc.getX();
getNMSEntity().locY = loc.getY();
getNMSEntity().locZ = loc.getZ();
} else {
Herobrine.getPluginCore().hbSpawnData = loc;
Herobrine.getPluginCore().removeHBNextTick = true;
}
}
public PlayerInventory getInventory() {
return ((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).getInventory();
}
public void removeFromWorld() {
try {
entity.world.removeEntity(entity);
} catch (Exception e) {
e.printStackTrace();
}
}
public void lookAtPoint(final Location point) {
if (getNMSEntity().getBukkitEntity().getWorld() != point.getWorld()) {
return;
}
final Location npcLoc = ((LivingEntity) getNMSEntity().getBukkitEntity()).getEyeLocation();
final double xDiff = point.getX() - npcLoc.getX();
final double yDiff = point.getY() - npcLoc.getY();
final double zDiff = point.getZ() - npcLoc.getZ();
final double DistanceXZ = Math.sqrt((xDiff * xDiff) + (zDiff * zDiff));
final double DistanceY = Math.sqrt((DistanceXZ * DistanceXZ) + (yDiff * yDiff));
double newYaw = (Math.acos(xDiff / DistanceXZ) * 180.0) / 3.141592653589793;
final double newPitch = ((Math.acos(yDiff / DistanceY) * 180.0) / 3.141592653589793) - 90.0;
if (zDiff < 0.0) {
newYaw += Math.abs(180.0 - newYaw) * 2.0;
}
if (newYaw > 0.0D || newYaw < 180.0D){
((EntityPlayer) getNMSEntity()).yaw = (float) (newYaw - 90.0);
((EntityPlayer) getNMSEntity()).pitch = (float) newPitch;
((EntityPlayer) getNMSEntity()).aQ = (float) (newYaw - 90.0);
((EntityPlayer) getNMSEntity()).aO = (float) (newYaw - 90.0);
}
}
public org.bukkit.entity.Entity getBukkitEntity() {
return entity.getBukkitEntity();
}
package net.theprogrammersworld.herobrine.nms.NPC.entity;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.PacketPlayInArmAnimation;
import net.minecraft.server.v1_12_R1.WorldServer;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class HumanNPC {
private EntityPlayer entity;
private final int id;
public HumanNPC(final HumanEntity humanEntity, final int id) {
entity = humanEntity;
this.id = id;
}
public int getID() {
return id;
}
public EntityPlayer getNMSEntity() {
return entity;
}
public void armSwingAnimation() {
((WorldServer) getNMSEntity().world).tracker.a(getNMSEntity(), new PacketPlayInArmAnimation());
}
public void hurtAnimation() {
((LivingEntity) entity.getBukkitEntity()).damage(0.5);
((LivingEntity) entity.getBukkitEntity()).setHealth(20);
}
public void setItemInHand(final ItemStack item) {
if (item != null) {
((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).getInventory().setItemInMainHand(item);
}
}
public String getName() {
return ((HumanEntity) getNMSEntity()).getName();
}
public void moveTo(final Location loc) {
teleport(loc);
}
public void teleport(final Location loc) {
if (loc.getWorld().getName().equals(getNMSEntity().world.getWorld().getName())) {
getNMSEntity().locX = loc.getX();
getNMSEntity().locY = loc.getY();
getNMSEntity().locZ = loc.getZ();
} else {
Herobrine.getPluginCore().hbSpawnData = loc;
Herobrine.getPluginCore().removeHBNextTick = true;
}
}
public PlayerInventory getInventory() {
return ((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).getInventory();
}
public void removeFromWorld() {
try {
entity.world.removeEntity(entity);
} catch (Exception e) {
e.printStackTrace();
}
}
public void lookAtPoint(final Location point) {
if (getNMSEntity().getBukkitEntity().getWorld() != point.getWorld()) {
return;
}
final Location npcLoc = ((LivingEntity) getNMSEntity().getBukkitEntity()).getEyeLocation();
final double xDiff = point.getX() - npcLoc.getX();
final double yDiff = point.getY() - npcLoc.getY();
final double zDiff = point.getZ() - npcLoc.getZ();
final double DistanceXZ = Math.sqrt((xDiff * xDiff) + (zDiff * zDiff));
final double DistanceY = Math.sqrt((DistanceXZ * DistanceXZ) + (yDiff * yDiff));
double newYaw = (Math.acos(xDiff / DistanceXZ) * 180.0) / 3.141592653589793;
final double newPitch = ((Math.acos(yDiff / DistanceY) * 180.0) / 3.141592653589793) - 90.0;
if (zDiff < 0.0) {
newYaw += Math.abs(180.0 - newYaw) * 2.0;
}
if (newYaw > 0.0D || newYaw < 180.0D){
((EntityPlayer) getNMSEntity()).yaw = (float) (newYaw - 90.0);
((EntityPlayer) getNMSEntity()).pitch = (float) newPitch;
((EntityPlayer) getNMSEntity()).aQ = (float) (newYaw - 90.0);
((EntityPlayer) getNMSEntity()).aO = (float) (newYaw - 90.0);
}
}
public org.bukkit.entity.Entity getBukkitEntity() {
return entity.getBukkitEntity();
}
}

View File

@ -1,16 +1,16 @@
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.EnumProtocolDirection;
import net.minecraft.server.v1_12_R1.NetworkManager;
public class NetworkCore extends NetworkManager {
public NetworkCore() {
super(EnumProtocolDirection.SERVERBOUND);
}
@Override
public void a() {
}
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.EnumProtocolDirection;
import net.minecraft.server.v1_12_R1.NetworkManager;
public class NetworkCore extends NetworkManager {
public NetworkCore() {
super(EnumProtocolDirection.SERVERBOUND);
}
@Override
public void a() {
}
}

View File

@ -1,23 +1,23 @@
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.Packet;
import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
public class NetworkHandler extends PlayerConnection {
public NetworkHandler(final NPCCore npcCore, final EntityPlayer entityPlayer) {
super(npcCore.getServer().getMCServer(), npcCore.getNetworkCore(), entityPlayer);
}
@Override
public void a(final double d0, final double d1, final double d2, final float f, final float f1) {
}
@SuppressWarnings("rawtypes")
@Override
public void sendPacket(final Packet packet) {
}
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_12_R1.Packet;
import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.theprogrammersworld.herobrine.nms.NPC.NPCCore;
public class NetworkHandler extends PlayerConnection {
public NetworkHandler(final NPCCore npcCore, final EntityPlayer entityPlayer) {
super(npcCore.getServer().getMCServer(), npcCore.getNetworkCore(), entityPlayer);
}
@Override
public void a(final double d0, final double d1, final double d2, final float f, final float f1) {
}
@SuppressWarnings("rawtypes")
@Override
public void sendPacket(final Packet packet) {
}
}

View File

@ -1,38 +1,38 @@
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.Packet;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@SuppressWarnings("rawtypes")
public class NetworkUtils {
public static void sendPacketNearby(final Location location, final Packet packet) {
sendPacketNearby(location, packet, 64.0);
}
public static void sendPacketNearby(final Location location, final Packet packet, double radius) {
radius *= radius;
final World world = location.getWorld();
for (Player player : Bukkit.getOnlinePlayers()) {
if (world == player.getWorld()) {
if (location.distanceSquared(player.getLocation()) <= radius) {
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
}
}
public static ItemStack[] combineItemStackArrays(final Object[] a, final Object[] b) {
final ItemStack[] c = new ItemStack[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
package net.theprogrammersworld.herobrine.nms.NPC.network;
import net.minecraft.server.v1_12_R1.Packet;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@SuppressWarnings("rawtypes")
public class NetworkUtils {
public static void sendPacketNearby(final Location location, final Packet packet) {
sendPacketNearby(location, packet, 64.0);
}
public static void sendPacketNearby(final Location location, final Packet packet, double radius) {
radius *= radius;
final World world = location.getWorld();
for (Player player : Bukkit.getOnlinePlayers()) {
if (world == player.getWorld()) {
if (location.distanceSquared(player.getLocation()) <= radius) {
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}
}
}
public static ItemStack[] combineItemStackArrays(final Object[] a, final Object[] b) {
final ItemStack[] c = new ItemStack[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
}
}

View File

@ -1,37 +1,37 @@
package net.theprogrammersworld.herobrine.nms.NPC.network;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class NullSocket extends Socket {
@Override
public InputStream getInputStream() {
return new VoidInputStream();
}
@Override
public OutputStream getOutputStream() {
return new VoidOutputStream();
}
private class VoidInputStream extends InputStream {
@Override
public int read() throws IOException {
return -1;
}
}
private class VoidOutputStream extends OutputStream {
@Override
public void write(int b) throws IOException {
}
}
package net.theprogrammersworld.herobrine.nms.NPC.network;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class NullSocket extends Socket {
@Override
public InputStream getInputStream() {
return new VoidInputStream();
}
@Override
public OutputStream getOutputStream() {
return new VoidOutputStream();
}
private class VoidInputStream extends InputStream {
@Override
public int read() throws IOException {
return -1;
}
}
private class VoidOutputStream extends OutputStream {
@Override
public void write(int b) throws IOException {
}
}
}

View File

@ -1,85 +1,85 @@
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import org.bukkit.Location;
import org.bukkit.World;
public class CheckBlock {
public static boolean checkBlock(int X, int Y, int Z, World w){
int Dist = 5;
int solids = 0;
for (int a = 0; a < Dist; a++){
int X1 = X+a; // Coord +X
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X1, Y, Z+i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X1, Y, Z-i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
int X2 = X-a; // Coord -X
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X2, Y, Z+i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X2, Y, Z-i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
int Z1 = Z+a; // Coord +Z
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X+i1, Y, Z1);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X-i1, Y, Z1);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
int Z2 = Z-a; // Coord -Z
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X+i1, Y, Z2);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X-i1, Y, Z2);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
}
if (solids > 50){
return false;
}
return true;
}
}
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import org.bukkit.Location;
import org.bukkit.World;
public class CheckBlock {
public static boolean checkBlock(int X, int Y, int Z, World w){
int Dist = 5;
int solids = 0;
for (int a = 0; a < Dist; a++){
int X1 = X+a; // Coord +X
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X1, Y, Z+i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X1, Y, Z-i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
int X2 = X-a; // Coord -X
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X2, Y, Z+i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocX = new Location(w, X2, Y, Z-i1);
if (!w.getBlockAt(LocX).getType().isSolid()){
solids++;
}
}
int Z1 = Z+a; // Coord +Z
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X+i1, Y, Z1);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X-i1, Y, Z1);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
int Z2 = Z-a; // Coord -Z
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X+i1, Y, Z2);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
for (int i1 = 0; i1 < Dist; i1++){
Location LocY = new Location(w, X-i1, Y, Z2);
if (!w.getBlockAt(LocY).getType().isSolid()){
solids++;
}
}
}
if (solids > 50){
return false;
}
return true;
}
}

View File

@ -1,45 +1,45 @@
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import java.util.List;
import java.util.logging.Logger;
import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_12_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
public class NMSServerAccess {
private static final NMSServerAccess ins = new NMSServerAccess();
public static NMSServerAccess getInstance() {
return ins;
}
private Server server = Bukkit.getServer();
private CraftServer cServer = (CraftServer) server;
private MinecraftServer mcServer = cServer.getServer();
public void stop() {
mcServer.safeShutdown();
}
public Logger getLogger() {
return cServer.getLogger();
}
public List<WorldServer> getWorldServers() {
return mcServer.worlds;
}
public Server getServer() {
return server;
}
public MinecraftServer getMCServer() {
return mcServer;
}
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import java.util.List;
import java.util.logging.Logger;
import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_12_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
public class NMSServerAccess {
private static final NMSServerAccess ins = new NMSServerAccess();
public static NMSServerAccess getInstance() {
return ins;
}
private Server server = Bukkit.getServer();
private CraftServer cServer = (CraftServer) server;
private MinecraftServer mcServer = cServer.getServer();
public void stop() {
mcServer.safeShutdown();
}
public Logger getLogger() {
return cServer.getLogger();
}
public List<WorldServer> getWorldServers() {
return mcServer.worlds;
}
public Server getServer() {
return server;
}
public MinecraftServer getMCServer() {
return mcServer;
}
}

View File

@ -1,38 +1,38 @@
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.v1_12_R1.PlayerChunkMap;
import net.minecraft.server.v1_12_R1.WorldServer;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
public class NMSWorldAccess {
private CraftWorld cWorld;
private WorldServer wServer;
public NMSWorldAccess(final World world) {
try {
cWorld = (CraftWorld) world;
wServer = cWorld.getHandle();
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
public PlayerChunkMap getPlayerManager() {
return wServer.getPlayerChunkMap();
}
public CraftWorld getCraftWorld() {
return cWorld;
}
public WorldServer getWorldServer() {
return wServer;
}
package net.theprogrammersworld.herobrine.nms.NPC.utils;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.v1_12_R1.PlayerChunkMap;
import net.minecraft.server.v1_12_R1.WorldServer;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
public class NMSWorldAccess {
private CraftWorld cWorld;
private WorldServer wServer;
public NMSWorldAccess(final World world) {
try {
cWorld = (CraftWorld) world;
wServer = cWorld.getHandle();
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
public PlayerChunkMap getPlayerManager() {
return wServer.getPlayerChunkMap();
}
public CraftWorld getCraftWorld() {
return cWorld;
}
public WorldServer getWorldServer() {
return wServer;
}
}

View File

@ -1,9 +1,9 @@
package net.theprogrammersworld.herobrine.nms.entity;
public interface CustomEntity {
void killCustom();
MobType getMobType();
}
package net.theprogrammersworld.herobrine.nms.entity;
public interface CustomEntity {
void killCustom();
MobType getMobType();
}

View File

@ -1,97 +1,97 @@
// This class was originally written by Scyntrus - https://github.com/Scyntrus/misc/blob/master/CustomEntityRegistry.java
package net.theprogrammersworld.herobrine.nms.entity;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.v1_12_R1.RegistryMaterials;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.EntityTypes;
import net.minecraft.server.v1_12_R1.MinecraftKey;
@SuppressWarnings("rawtypes")
public class CustomEntityRegistry extends RegistryMaterials {
private static CustomEntityRegistry instance = null;
private final BiMap<MinecraftKey, Class<? extends Entity>> customEntities = HashBiMap.create();
private final BiMap<Class<? extends Entity>, MinecraftKey> customEntityClasses = this.customEntities.inverse();
private final Map<Class<? extends Entity>, Integer> customEntityIds = new HashMap<>();
private final RegistryMaterials wrapped;
private CustomEntityRegistry(RegistryMaterials original) {
this.wrapped = original;
}
public static CustomEntityRegistry getInstance() {
if (instance != null) {
return instance;
}
instance = new CustomEntityRegistry(EntityTypes.b);
try {
//TODO: Update name on version change (RegistryMaterials)
Field registryMaterialsField = EntityTypes.class.getDeclaredField("b");
registryMaterialsField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(registryMaterialsField, registryMaterialsField.getModifiers() & ~Modifier.FINAL);
registryMaterialsField.set(null, instance);
} catch (Exception e) {
instance = null;
throw new RuntimeException("Unable to override the old entity RegistryMaterials", e);
}
return instance;
}
public static void addCustomEntity(int entityId, String entityName, Class<? extends Entity> entityClass) {
getInstance().putCustomEntity(entityId, entityName, entityClass);
}
public void putCustomEntity(int entityId, String entityName, Class<? extends Entity> entityClass) {
MinecraftKey minecraftKey = new MinecraftKey(entityName);
this.customEntities.put(minecraftKey, entityClass);
this.customEntityIds.put(entityClass, entityId);
}
@SuppressWarnings("unchecked")
@Override
public Class<? extends Entity> get(Object key) {
if (this.customEntities.containsKey(key)) {
return this.customEntities.get(key);
}
return (Class<? extends Entity>) wrapped.get(key);
}
@SuppressWarnings("unchecked")
@Override
public int a(Object key) { //TODO: Update name on version change (getId)
if (this.customEntityIds.containsKey(key)) {
return this.customEntityIds.get(key);
}
return this.wrapped.a(key);
}
@SuppressWarnings("unchecked")
@Override
public MinecraftKey b(Object value) { //TODO: Update name on version change (getKey)
if (this.customEntityClasses.containsKey(value)) {
return this.customEntityClasses.get(value);
}
return (MinecraftKey) wrapped.b(value);
}
// This class was originally written by Scyntrus - https://github.com/Scyntrus/misc/blob/master/CustomEntityRegistry.java
package net.theprogrammersworld.herobrine.nms.entity;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.v1_12_R1.RegistryMaterials;
import net.minecraft.server.v1_12_R1.Entity;
import net.minecraft.server.v1_12_R1.EntityTypes;
import net.minecraft.server.v1_12_R1.MinecraftKey;
@SuppressWarnings("rawtypes")
public class CustomEntityRegistry extends RegistryMaterials {
private static CustomEntityRegistry instance = null;
private final BiMap<MinecraftKey, Class<? extends Entity>> customEntities = HashBiMap.create();
private final BiMap<Class<? extends Entity>, MinecraftKey> customEntityClasses = this.customEntities.inverse();
private final Map<Class<? extends Entity>, Integer> customEntityIds = new HashMap<>();
private final RegistryMaterials wrapped;
private CustomEntityRegistry(RegistryMaterials original) {
this.wrapped = original;
}
public static CustomEntityRegistry getInstance() {
if (instance != null) {
return instance;
}
instance = new CustomEntityRegistry(EntityTypes.b);
try {
//TODO: Update name on version change (RegistryMaterials)
Field registryMaterialsField = EntityTypes.class.getDeclaredField("b");
registryMaterialsField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(registryMaterialsField, registryMaterialsField.getModifiers() & ~Modifier.FINAL);
registryMaterialsField.set(null, instance);
} catch (Exception e) {
instance = null;
throw new RuntimeException("Unable to override the old entity RegistryMaterials", e);
}
return instance;
}
public static void addCustomEntity(int entityId, String entityName, Class<? extends Entity> entityClass) {
getInstance().putCustomEntity(entityId, entityName, entityClass);
}
public void putCustomEntity(int entityId, String entityName, Class<? extends Entity> entityClass) {
MinecraftKey minecraftKey = new MinecraftKey(entityName);
this.customEntities.put(minecraftKey, entityClass);
this.customEntityIds.put(entityClass, entityId);
}
@SuppressWarnings("unchecked")
@Override
public Class<? extends Entity> get(Object key) {
if (this.customEntities.containsKey(key)) {
return this.customEntities.get(key);
}
return (Class<? extends Entity>) wrapped.get(key);
}
@SuppressWarnings("unchecked")
@Override
public int a(Object key) { //TODO: Update name on version change (getId)
if (this.customEntityIds.containsKey(key)) {
return this.customEntityIds.get(key);
}
return this.wrapped.a(key);
}
@SuppressWarnings("unchecked")
@Override
public MinecraftKey b(Object value) { //TODO: Update name on version change (getKey)
if (this.customEntityClasses.containsKey(value)) {
return this.customEntityClasses.get(value);
}
return (MinecraftKey) wrapped.b(value);
}
}

View File

@ -1,68 +1,68 @@
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntitySkeleton;
import net.minecraft.server.v1_12_R1.GenericAttributes;
import net.minecraft.server.v1_12_R1.World;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
public class CustomSkeleton extends EntitySkeleton implements CustomEntity {
private MobType mobType;
public CustomSkeleton(final World world, final Location loc, final MobType mbt) {
super(world);
mobType = null;
mobType = mbt;
if (mbt == MobType.DEMON) {
spawnDemon(loc);
}
}
public void spawnDemon(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
setCustomName("Demon");
((Skeleton) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.GOLDEN_APPLE, 1));
((Skeleton) getBukkitEntity()).getEquipment().setHelmet(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_HELMET, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setChestplate(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_CHESTPLATE, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setLeggings(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_LEGGINGS, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setBoots(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_BOOTS, 1), Color.RED));
getBukkitEntity().teleport(loc);
}
public CustomSkeleton(final World world) {
super(world);
mobType = null;
}
@Override
@SuppressWarnings("deprecation")
public void killCustom() {
for (int i = 1; i <= 2500; ++i) {
if (Herobrine.getPluginCore().getConfigDB().npc.contains("npc.Demon.Drops." + Integer.toString(i))) {
final int chance = new Random().nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Chance")) {
getBukkitEntity().getLocation().getWorld().dropItemNaturally(getBukkitEntity().getLocation(),
new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Count")));
}
}
}
setHealth(0.0f);
}
@Override
public MobType getMobType() {
return mobType;
}
}
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntitySkeleton;
import net.minecraft.server.v1_12_R1.GenericAttributes;
import net.minecraft.server.v1_12_R1.World;
import net.theprogrammersworld.herobrine.Herobrine;
import net.theprogrammersworld.herobrine.misc.ItemName;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
public class CustomSkeleton extends EntitySkeleton implements CustomEntity {
private MobType mobType;
public CustomSkeleton(final World world, final Location loc, final MobType mbt) {
super(world);
mobType = null;
mobType = mbt;
if (mbt == MobType.DEMON) {
spawnDemon(loc);
}
}
public void spawnDemon(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
setCustomName("Demon");
((Skeleton) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.GOLDEN_APPLE, 1));
((Skeleton) getBukkitEntity()).getEquipment().setHelmet(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_HELMET, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setChestplate(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_CHESTPLATE, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setLeggings(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_LEGGINGS, 1), Color.RED));
((Skeleton) getBukkitEntity()).getEquipment().setBoots(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_BOOTS, 1), Color.RED));
getBukkitEntity().teleport(loc);
}
public CustomSkeleton(final World world) {
super(world);
mobType = null;
}
@Override
@SuppressWarnings("deprecation")
public void killCustom() {
for (int i = 1; i <= 2500; ++i) {
if (Herobrine.getPluginCore().getConfigDB().npc.contains("npc.Demon.Drops." + Integer.toString(i))) {
final int chance = new Random().nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Chance")) {
getBukkitEntity().getLocation().getWorld().dropItemNaturally(getBukkitEntity().getLocation(),
new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Count")));
}
}
}
setHealth(0.0f);
}
@Override
public MobType getMobType() {
return mobType;
}
}

View File

@ -1,87 +1,87 @@
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntityZombie;
import net.minecraft.server.v1_12_R1.GenericAttributes;
import net.minecraft.server.v1_12_R1.World;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
public class CustomZombie extends EntityZombie implements CustomEntity {
private MobType mobType;
public CustomZombie(final World world, final Location loc, final MobType mbt) {
super(world);
mobType = null;
mobType = mbt;
if (mbt == MobType.ARTIFACT_GUARDIAN) {
spawnArtifactGuardian(loc);
} else if (mbt == MobType.HEROBRINE_WARRIOR) {
spawnHerobrineWarrior(loc);
}
}
private void spawnArtifactGuardian(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
setCustomName("Artifact Guardian");
((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.GOLD_SWORD, 1));
((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
getBukkitEntity().teleport(loc);
}
private void spawnHerobrineWarrior(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
setCustomName("Herobrine's Warrior");
((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.IRON_SWORD, 1));
((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
getBukkitEntity().teleport(loc);
}
public CustomZombie(final World world) {
super(world);
mobType = null;
}
@Override
@SuppressWarnings("deprecation")
public void killCustom() {
String mobS = "";
if (mobType == MobType.ARTIFACT_GUARDIAN) {
mobS = "Guardian";
} else {
mobS = "Warrior";
}
for (int i = 1; i <= 2500; ++i) {
if (Herobrine.getPluginCore().getConfigDB().npc.contains("npc." + mobS + ".Drops." + Integer.toString(i))) {
final int chance = new Random().nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Chance")) {
getBukkitEntity().getLocation().getWorld().dropItemNaturally(getBukkitEntity().getLocation(),
new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Count")));
}
}
}
setHealth(0.0f);
}
@Override
public MobType getMobType() {
return mobType;
}
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.Random;
import net.minecraft.server.v1_12_R1.EntityZombie;
import net.minecraft.server.v1_12_R1.GenericAttributes;
import net.minecraft.server.v1_12_R1.World;
import net.theprogrammersworld.herobrine.Herobrine;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
public class CustomZombie extends EntityZombie implements CustomEntity {
private MobType mobType;
public CustomZombie(final World world, final Location loc, final MobType mbt) {
super(world);
mobType = null;
mobType = mbt;
if (mbt == MobType.ARTIFACT_GUARDIAN) {
spawnArtifactGuardian(loc);
} else if (mbt == MobType.HEROBRINE_WARRIOR) {
spawnHerobrineWarrior(loc);
}
}
private void spawnArtifactGuardian(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
setCustomName("Artifact Guardian");
((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.GOLD_SWORD, 1));
((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
getBukkitEntity().teleport(loc);
}
private void spawnHerobrineWarrior(final Location loc) {
getAttributeInstance(GenericAttributes.c).setValue(Herobrine.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed"));
getAttributeInstance(GenericAttributes.maxHealth).setValue(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
setHealth(Herobrine.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
setCustomName("Herobrine's Warrior");
((Zombie) getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(Material.IRON_SWORD, 1));
((Zombie) getBukkitEntity()).getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
((Zombie) getBukkitEntity()).getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
((Zombie) getBukkitEntity()).getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
((Zombie) getBukkitEntity()).getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
getBukkitEntity().teleport(loc);
}
public CustomZombie(final World world) {
super(world);
mobType = null;
}
@Override
@SuppressWarnings("deprecation")
public void killCustom() {
String mobS = "";
if (mobType == MobType.ARTIFACT_GUARDIAN) {
mobS = "Guardian";
} else {
mobS = "Warrior";
}
for (int i = 1; i <= 2500; ++i) {
if (Herobrine.getPluginCore().getConfigDB().npc.contains("npc." + mobS + ".Drops." + Integer.toString(i))) {
final int chance = new Random().nextInt(100);
if (chance <= Herobrine.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Chance")) {
getBukkitEntity().getLocation().getWorld().dropItemNaturally(getBukkitEntity().getLocation(),
new ItemStack(Material.getMaterial(i), Herobrine.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Count")));
}
}
}
setHealth(0.0f);
}
@Override
public MobType getMobType() {
return mobType;
}
}

View File

@ -1,18 +1,18 @@
package net.theprogrammersworld.herobrine.nms.entity;
import net.theprogrammersworld.herobrine.Herobrine;
public class EntityInjector {
public static void inject() {
try {
CustomEntityRegistry.addCustomEntity(51, "Skeleton", CustomSkeleton.class);
CustomEntityRegistry.addCustomEntity(54, "Zombie", CustomZombie.class);
} catch (Throwable t) {
t.printStackTrace();
Herobrine.isNPCDisabled = true;
Herobrine.log.warning("[Herobrine] Custom NPCs have been disabled due to a compatibility issue.");
}
}
}
package net.theprogrammersworld.herobrine.nms.entity;
import net.theprogrammersworld.herobrine.Herobrine;
public class EntityInjector {
public static void inject() {
try {
CustomEntityRegistry.addCustomEntity(51, "Skeleton", CustomSkeleton.class);
CustomEntityRegistry.addCustomEntity(54, "Zombie", CustomZombie.class);
} catch (Throwable t) {
t.printStackTrace();
Herobrine.isNPCDisabled = true;
Herobrine.log.warning("[Herobrine] Custom NPCs have been disabled due to a compatibility issue.");
}
}
}

View File

@ -1,53 +1,53 @@
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.v1_12_R1.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
public class EntityManager {
private final HashMap<Integer, CustomEntity> mobList = new HashMap<Integer, CustomEntity>();
public void spawnCustomZombie(final Location loc, final MobType mbt) {
final World mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
final CustomZombie zmb = new CustomZombie(mcWorld, loc, mbt);
mcWorld.addEntity(zmb);
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()), zmb);
}
public void spawnCustomSkeleton(final Location loc, final MobType mbt) {
final World mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
final CustomSkeleton zmb = new CustomSkeleton(mcWorld, loc, mbt);
mcWorld.addEntity(zmb);
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()), zmb);
}
public boolean isCustomMob(final int id) {
return mobList.containsKey(new Integer(id));
}
public CustomEntity getMobType(final int id) {
return mobList.get(new Integer(id));
}
public void removeMob(final int id) {
mobList.get(new Integer(id)).killCustom();
mobList.remove(new Integer(id));
}
public void removeAllMobs() {
mobList.clear();
}
public void killAllMobs() {
for (final Map.Entry<Integer, CustomEntity> s : mobList.entrySet()) {
s.getValue().killCustom();
}
removeAllMobs();
}
package net.theprogrammersworld.herobrine.nms.entity;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.v1_12_R1.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
public class EntityManager {
private final HashMap<Integer, CustomEntity> mobList = new HashMap<Integer, CustomEntity>();
public void spawnCustomZombie(final Location loc, final MobType mbt) {
final World mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
final CustomZombie zmb = new CustomZombie(mcWorld, loc, mbt);
mcWorld.addEntity(zmb);
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()), zmb);
}
public void spawnCustomSkeleton(final Location loc, final MobType mbt) {
final World mcWorld = ((CraftWorld) loc.getWorld()).getHandle();
final CustomSkeleton zmb = new CustomSkeleton(mcWorld, loc, mbt);
mcWorld.addEntity(zmb);
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()), zmb);
}
public boolean isCustomMob(final int id) {
return mobList.containsKey(new Integer(id));
}
public CustomEntity getMobType(final int id) {
return mobList.get(new Integer(id));
}
public void removeMob(final int id) {
mobList.get(new Integer(id)).killCustom();
mobList.remove(new Integer(id));
}
public void removeAllMobs() {
mobList.clear();
}
public void killAllMobs() {
for (final Map.Entry<Integer, CustomEntity> s : mobList.entrySet()) {
s.getValue().killCustom();
}
removeAllMobs();
}
}

View File

@ -1,5 +1,5 @@
package net.theprogrammersworld.herobrine.nms.entity;
public enum MobType {
ARTIFACT_GUARDIAN, HEROBRINE_WARRIOR, DEMON;
package net.theprogrammersworld.herobrine.nms.entity;
public enum MobType {
ARTIFACT_GUARDIAN, HEROBRINE_WARRIOR, DEMON;
}

View File

@ -1,9 +1,9 @@
name: Herobrine
main: net.theprogrammersworld.herobrine.Herobrine
version: 1.7.3
website: https://www.theprogrammersworld.net
commands:
herobrine:
description: Main command.
usage: /herobrine help
name: Herobrine
main: net.theprogrammersworld.herobrine.Herobrine
version: 1.7.3
website: https://www.theprogrammersworld.net
commands:
herobrine:
description: Main command.
usage: /herobrine help
aliases: [hero, hb-ai, hb]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff