1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 17:53:00 +01:00

Compare commits

...

49 Commits

Author SHA1 Message Date
nossr50
70756c2a2e Preparing for a bugfix release. Also made sure mcMMO saves info on
shutdown.
2012-02-11 10:21:36 -08:00
nossr50
3d60c057ea Made xprate give more feedback when used via console 2012-02-11 06:17:57 -08:00
GJ
105b8b5a91 Fixes to several commands & console usage. Fixes Issue #150 2012-02-11 09:01:46 -05:00
NuclearW
9278ca4d27 Watch ourselves for negative xp gain.
Hopefully we'll get more info on the bug if we can't solve it by next release from anyone running a dev build.

Will help on the hunt of issue #98
2012-02-11 00:11:08 -05:00
NuclearW
d97e97ae5f Add McMMOPlayerXpGainEvent
Rename playername to playerName
2012-02-11 00:02:48 -05:00
NuclearW
5cbee8a4ab Make players logging out take damage from bleeding.
Done as per suggestion by nossr50
Closes #131
2012-02-10 23:29:19 -05:00
Grant
fe9db6c9ad Merge pull request #149 from nossr50/master
Possible fix for negative XP bug.
2012-02-10 16:32:24 -08:00
nossr50
a4845abc45 Possible fix for negative XP bug. 2012-02-10 11:58:58 -08:00
Grant
470b29eeca Merge pull request #148 from nossr50/master
Fixed the instant refresh bug. Fixed blockListener monitoring skills.
2012-02-10 09:59:11 -08:00
nossr50
f87f7f6feb Fixed the instant refresh bug. Fixed blockListener checking skills. 2012-02-10 09:44:17 -08:00
TheYeti
5e8a8aac53 Fix adding in to much copypasta 2012-02-10 03:07:43 -08:00
TheYeti
2672e218f4 Just updating the licensing documentation 2012-02-10 03:05:09 -08:00
Grant
02a728bdea Merge pull request #144 from nossr50/master
Fixed a major problem with my changes to PlayerProfile, however the refresh bug still exists.
2012-02-09 18:14:24 -08:00
nossr50
3a812612de Fixed a major problem where the hashmap wasn't initialized on
PlayerProfile creation. However there is still a big bug with abilities
instantly wearing off and refreshing.
2012-02-09 15:28:05 -08:00
Grant
4fdbce24d7 Merge pull request #143 from nossr50/master
Shrinking PlayerProfile, fixed a small bug as well.
2012-02-09 11:16:14 -08:00
GJ
52458041f0 Removed ColoredConsoleSender. No more CB Dependency! 2012-02-09 14:12:36 -05:00
nossr50
4a1e5a0dcc Silly commits 2012-02-09 11:12:16 -08:00
nossr50
f6c7ac6d98 Merge branch 'master' of github.com:TheYeti/mcMMO 2012-02-09 11:11:35 -08:00
nossr50
76675422ea Shrinking PlayerProfile one step at a time, also fixed a bug. 2012-02-09 11:10:39 -08:00
GJ
7dee6db362 Changed CraftItem to Item in Fishing, one step closer to being free of
CB dependency.
2012-02-09 14:04:48 -05:00
Grant
e8030c59f1 Merge pull request #142 from nossr50/master
Updated README, removed unused code.
2012-02-09 10:11:38 -08:00
nossr50
4b642d4953 Removed some old Sorcery code that won't ever be used 2012-02-09 10:08:04 -08:00
nossr50
346b7862af Changed the README to be up to date 2012-02-09 10:03:41 -08:00
NuclearW
3ec661cc02 Merge pull request #141 from nossr50/master
Added LGPL to Fishing.java
2012-02-09 10:01:58 -08:00
nossr50
d7f066b07e Added LGPL to Fishing.java 2012-02-09 10:00:01 -08:00
Grant
e54500fa90 Merge pull request #140 from nossr50/master 2012-02-09 09:49:12 -08:00
nossr50
a2c83425f2 Fixed even more of GJ's mistakes :P 2012-02-09 09:47:17 -08:00
NuclearW
41ce19b835 Merge pull request #139 from nossr50/master
Fixed some problems with Herbalism code, also optimized GT checks.
2012-02-09 09:36:59 -08:00
nossr50
9c11a6ffb0 Fixed some problems with Herbalism code, also optimized GT checks. 2012-02-09 09:33:20 -08:00
NuclearW
e36cd8109d Configure all the save timer 2012-02-09 11:26:57 -05:00
Grant
ee83e93269 Merge pull request #138 from nossr50/master
Optimizing how mcMMO saves player information
2012-02-09 07:06:37 -08:00
nossr50
0b4692e303 Hopefully the remaining tabs are now spaces... eclipse is being odd. 2012-02-09 03:42:08 -08:00
nossr50
e99b5a4abf Changed tab to 4 spaces. 2012-02-09 03:31:44 -08:00
nossr50
a419c4d4fe Forgot to commit this file. 2012-02-09 03:16:55 -08:00
nossr50
ca80a7d463 Optimized how mcMMO saves player information. 2012-02-09 03:11:18 -08:00
GJ
716e6296e5 Updates to Swords & Axes skills, optimizations. 2012-02-09 00:58:05 -05:00
NuclearW
6382bec05a Allow lookup of player's stats from console
Quick change to test new Jenkins+GitPOST
2012-02-08 23:17:01 -05:00
GJ
20248212ae Added MagmaCube to Combat XP table. 2012-02-08 10:11:55 -05:00
GJ
86e373b493 Various fixes for Blast Mining. 2012-02-07 15:28:41 -05:00
NuclearW
b4b0bbd081 Make Smooth Brick to Mossy Brick and Dirt to Grass for green thumb configurable
Closes issue #120
2012-02-07 11:43:07 -05:00
GJ
17bacbf9d6 Fixed BlastMining not checking if blocks had been placed. 2012-02-07 02:41:11 -05:00
GJ
b869fb0ca5 Helps to include the new file... 2012-02-07 01:37:41 -05:00
GJ
c70a23dd5c Framework for Blast Mining 2012-02-07 01:36:57 -05:00
GJ
f9e7ae22f2 Removed unused variables & imports. 2012-02-06 16:30:50 -05:00
TheYeti
30fb2770a6 Pants 2012-02-06 11:26:41 -08:00
TheYeti
11e1dc7ec8 Okay, lets fix everything that depended on Permissions 2012-02-06 11:24:33 -08:00
TheYeti
5645c29dd8 Removal of legacy permission system support. SuperPerms only now. 2012-02-06 10:48:02 -08:00
GJ
44e954efeb Fixed typos in MOTD & /mcmmo
There was an extra slash in there...
2012-02-06 11:53:55 -05:00
gmcferrin
4ffb20f3bb Back to new development! 2012-02-06 00:50:22 -05:00
42 changed files with 1460 additions and 801 deletions

View File

@@ -1,6 +1,18 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.2.11
- Removed legacy Permission & PEX support. SuperPerms support only now.
- Made Smooth Brick to Mossy Brick and Dirt to Grass for green thumb configurable (Issue #120)
- Added MagmaCube to XP tables
- Made optimizations to Skull Splitter/Serrated Strikes
- Made it so players take damage if they try to log out with Serrated Strikes stacked onto them (Issue #131)
- Changed mcMMO to save data periodically to optimize performance with FlatFile & MySQL (Issue #138)
- Added a configurable save interval for the new save system
- Fixed a bug with the odds calculations for Serrated Strikes
- Fixed several commands not working from console (mmoedit, etc..) (Issue #150)
- Added a success message when executing xprate from console
Version 1.2.10
- Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103)
- Fixed issue with Spout images & sounds not working (Issue #93)

346
LICENSE Normal file
View File

@@ -0,0 +1,346 @@
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.

View File

@@ -16,10 +16,7 @@ Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod
=== Compiling
Required Libraries:
* CraftBukkit
* Spout API
* Permissions
* PermissionsEx
Required to Run:
* Bukkit

23
pom.xml
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.2.10</version>
<version>1.2.11</version>
<name>mcMMO</name>
<url>https://github.com/TheYeti/mcMMO</url>
<issueManagement>
@@ -111,27 +111,6 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.1-R3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.1.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.tehkode.permissions</groupId>
<artifactId>bukkit</artifactId>
<version>1.18</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutpluginapi</artifactId>

View File

@@ -60,7 +60,10 @@ public class Combat
if(mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0) //Unarmed
Unarmed.unarmedBonus(attacker, eventb);
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker) && Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
event.setDamage(event.getDamage()+4);
{
int damage = event.getDamage()+4;
event.setDamage(damage);
}
//If there are any abilities to activate
combatAbilityChecks(attacker, PPa, pluginx);
@@ -69,7 +72,7 @@ public class Combat
if(!(((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow))
{
if(mcPermissions.getInstance().axes(attacker))
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Criticals
Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Critical Checks
if(!pluginx.misc.bleedTracker.contains((LivingEntity) event.getEntity())) //Swords Bleed
Swords.bleedCheck(attacker, (LivingEntity)event.getEntity(), pluginx);
@@ -80,8 +83,6 @@ public class Combat
Unarmed.disarmProcCheck(attacker, defender);
}
//Modify the event damage if Attacker is Berserk
if(PPa.getBerserkMode())
event.setDamage(event.getDamage() + (event.getDamage() / 2));
@@ -107,8 +108,12 @@ public class Combat
int hpLeft = defender.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
xpinc = hpLeft;
else
{
if(hpLeft > 0)
xpinc = hpLeft;
else
xpinc = 0;
} else
xpinc = event.getDamage();
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
@@ -389,6 +394,7 @@ public class Combat
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
EntityDamageEvent ede = new EntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg);
Bukkit.getPluginManager().callEvent(ede);
if(ede.isCancelled()) return;
target.damage(ede.getDamage());
}
@@ -407,12 +413,17 @@ public class Combat
{
LivingEntity le = (LivingEntity)entity;
//Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity
int hpLeft = le.getHealth(), xpinc = 0;
int hpLeft = le.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
xpinc = hpLeft;
else
xpinc = event.getDamage();
if(hpLeft < event.getDamage())
{
if(hpLeft > 0)
xpinc = hpLeft;
else
xpinc = 0;
}
else
xpinc = event.getDamage();
if(entity instanceof Animals)
{
@@ -443,6 +454,8 @@ public class Combat
xp = (xpinc * 3);
else if(entity instanceof EnderDragon)
xp = (xpinc * 8);
else if(entity instanceof MagmaCube)
xp = (xpinc * 2);
}
}
return xp;

View File

@@ -23,7 +23,12 @@ public class AddxpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!mcPermissions.permissionsEnabled) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
sender.sendMessage("This command requires permissions.");
return true;
}
@@ -55,8 +60,6 @@ public class AddxpCommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
if (!mcPermissions.getInstance().mmoedit(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;

View File

@@ -24,7 +24,12 @@ public class MmoeditCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!mcPermissions.permissionsEnabled) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
sender.sendMessage("This command requires permissions.");
return true;
}
@@ -51,7 +56,6 @@ public class MmoeditCommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (!mcPermissions.getInstance().mmoedit(player)) {

View File

@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
@@ -16,6 +17,12 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.Skills;
public class StatsCommand implements CommandExecutor {
private final mcMMO plugin;
public StatsCommand(mcMMO instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.statsEnable) {
@@ -23,18 +30,31 @@ public class StatsCommand implements CommandExecutor {
return true;
}
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
if(args.length != 1) {
sender.sendMessage("Usage: stats <username>");
return true;
} else {
Player temp = plugin.getServer().getPlayer(args[0]);
if(temp == null) {
sender.sendMessage("Could not find player: " + args[0]);
return true;
} else {
player = temp;
}
}
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
if (mcPermissions.getEnabled())
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
ChatColor header = ChatColor.GOLD;

View File

@@ -30,13 +30,21 @@ public class WhoisCommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (!mcPermissions.getInstance().whois(player)) {
if (player != null && !mcPermissions.getInstance().whois(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage("This command does not support console useage.");
return true;
}
if (args.length < 1) {
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
return true;

View File

@@ -27,8 +27,8 @@ public class XprateCommand implements CommandExecutor {
if (!(sender instanceof Player)) {
if(args.length <= 0)
{
System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {"/xprate"}));
System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {"/xprate"}));
System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
}
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
@@ -67,6 +67,8 @@ public class XprateCommand implements CommandExecutor {
x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
}
System.out.println("The XP RATE was modified to "+LoadProperties.xpGainMultiplier);
}
return true;
@@ -81,8 +83,8 @@ public class XprateCommand implements CommandExecutor {
}
if(args.length <= 0)
{
player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {"/xprate"}));
player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {"/xprate"}));
player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {"xprate"}));
player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {"xprate"}));
}
if(args.length == 1 && args[0].equalsIgnoreCase("reset"))
{

View File

@@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
@@ -14,7 +13,12 @@ import com.gmail.nossr50.locale.mcLocale;
public class McabilityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!mcPermissions.permissionsEnabled) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (player != null && player.hasPermission("mcmmo.commands.ability")) {
sender.sendMessage("This command requires permissions.");
return true;
}
@@ -29,7 +33,6 @@ public class McabilityCommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (PP.getAbilityUse()) {

View File

@@ -28,12 +28,12 @@ public class McgodCommand implements CommandExecutor {
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (mcPermissions.permissionsEnabled) {
if (!mcPermissions.getInstance().mcgod(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (!mcPermissions.getInstance().mcgod(player)) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
if (mcPermissions.getInstance().mcgod(player)) {
if (PP.getGodMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
PP.toggleGodMode();

View File

@@ -1,22 +1,14 @@
package com.gmail.nossr50.commands.mc;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.mcMMO;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class McmmoCommand implements CommandExecutor {
@@ -35,7 +27,7 @@ public class McmmoCommand implements CommandExecutor {
Player player = (Player) sender;
player.sendMessage(ChatColor.RED + "-----[]" + ChatColor.GREEN + "mcMMO" + ChatColor.RED + "[]-----");
String description = mcLocale.getString("mcMMO.Description", new Object[] { "/mcc" });
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
String[] mcSplit = description.split(",");
for (String x : mcSplit) {
@@ -45,7 +37,7 @@ public class McmmoCommand implements CommandExecutor {
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
SpoutPlayer sPlayer = (SpoutPlayer) player;
if (LoadProperties.donateMessage)
player.sendMessage(ChatColor.GREEN + "[mcMMO] Donate! Paypal theno1yeti@gmail.com");
sPlayer.sendMessage(ChatColor.GREEN + "[mcMMO] Donate! Paypal theno1yeti@gmail.com");
} else {
if (LoadProperties.donateMessage)
player.sendMessage(ChatColor.GREEN + "If you like my work you can donate via Paypal: theno1yeti@gmail.com");

View File

@@ -54,37 +54,16 @@ public class McrefreshCommand implements CommandExecutor {
PP.setFistsPreparationMode(false);
PP.setSwordsPreparationMode(false);
PP.setPickaxePreparationMode(false);
/*
* GREEN TERRA
*/
PP.setGreenTerraMode(false);
PP.setGreenTerraDeactivatedTimeStamp((long) 0);
/*
* GIGA DRILL BREAKER
*/
//RESET COOLDOWNS
PP.resetCooldowns();
PP.setGreenTerraMode(false);
PP.setGigaDrillBreakerMode(false);
PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0);
/*
* SERRATED STRIKE
*/
PP.setSerratedStrikesMode(false);
PP.setSerratedStrikesDeactivatedTimeStamp((long) 0);
/*
* SUPER BREAKER
*/
PP.setSuperBreakerMode(false);
PP.setSuperBreakerDeactivatedTimeStamp((long) 0);
/*
* TREE FELLER
*/
PP.setTreeFellerMode(false);
PP.setTreeFellerDeactivatedTimeStamp((long) 0);
/*
* BERSERK
*/
PP.setBerserkMode(false);
PP.setBerserkDeactivatedTimeStamp((long) 0);
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));

View File

@@ -44,10 +44,12 @@ public class ACommand implements CommandExecutor {
return true;
}
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (!mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
if (player != null && !mcPermissions.getInstance().adminChat(player) && !player.isOp()) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}
@@ -70,19 +72,23 @@ public class ACommand implements CommandExecutor {
return true;
}
if (PP.getPartyChatMode())
PP.togglePartyChat();
PP.toggleAdminChat();
if (PP.getAdminChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
if(player != null)
{
PlayerProfile PP = Users.getProfile(player);
if (PP.getPartyChatMode())
PP.togglePartyChat();
PP.toggleAdminChat();
if (PP.getAdminChatMode()) {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On");
} else {
player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff"));
// player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off");
}
}
return true;
}
}

View File

@@ -31,7 +31,7 @@ public class XplockCommand implements CommandExecutor {
Player player = (Player) sender;
PlayerProfile PP = Users.getProfile(player);
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
if (PP.getXpBarLocked()) {
PP.setSkillLock(Skills.getSkillType(args[0]));
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
@@ -52,7 +52,7 @@ public class XplockCommand implements CommandExecutor {
}
} else if (args.length >= 1 && !Skills.isSkill(args[0])) {
player.sendMessage("Commands.xplock.invalid");
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
return true;
}

View File

@@ -42,7 +42,8 @@ public class LoadProperties {
mayLoseEnchants, fishingDrops, leatherArmor, ironArmor, goldArmor,
diamondArmor, woodenTools, stoneTools, ironTools, goldTools,
diamondTools, enderPearl, blazeRod, records, glowstoneDust,
fishingDiamonds, aDisplayNames, pDisplayNames;
fishingDiamonds, aDisplayNames, pDisplayNames, enableSmoothToMossy,
enableDirtToGrass;
public static String MySQLtablePrefix, MySQLuserName,
MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
@@ -70,7 +71,7 @@ public class LoadProperties {
levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
anvilID;
anvilID, saveInterval;
public static double xpbackground_r, xpbackground_g, xpbackground_b,
xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
@@ -296,8 +297,11 @@ public class LoadProperties {
enableMotd = readBoolean("General.MOTD.Enabled", true);
enableMySpawn = readBoolean("General.MySpawn.Enabled", true);
enableRegen = readBoolean("General.HP_Regeneration.Enabled", true);
saveInterval = readInteger("General.Save_Interval", 10);
enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
enableSmoothToMossy = readBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
enableDirtToGrass = readBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1);
toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true);

View File

@@ -18,6 +18,7 @@ package com.gmail.nossr50.config;
import java.util.*;
import java.util.logging.Logger;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -35,6 +36,7 @@ public class Misc
public ArrayList<Block> treeFeller = new ArrayList<Block>();
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
public HashMap<Block, Integer> tntTracker = new HashMap<Block, Integer>();
mcMMO plugin = null;
//BLEED QUE STUFF

View File

@@ -0,0 +1,11 @@
package com.gmail.nossr50.datatypes;
public enum AbilityType {
BERSERK,
SUPER_BREAKER,
GIGA_DRILL_BREAKER,
GREEN_TERRA,
SKULL_SPLIITER,
TREE_FELLER,
SERRATED_STRIKES;
}

View File

@@ -32,6 +32,7 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
@@ -57,31 +58,31 @@ public class PlayerProfile
//TIMESTAMPS
//ATS = (Time of) Activation Time Stamp
//DATS = (Time of) Deactivation Time Stamp
private int xpGainATS = 0, recentlyHurt = 0, berserkATS = 0, berserkDATS = 0, gigaDrillBreakerATS = 0, gigaDrillBreakerDATS = 0,
respawnATS = 0, mySpawnATS = 0, greenTerraATS = 0, greenTerraDATS = 0, superBreakerATS = 0, superBreakerDATS = 0, serratedStrikesATS = 0, serratedStrikesDATS = 0, treeFellerATS = 0, treeFellerDATS = 0,
skullSplitterATS = 0, skullSplitterDATS = 0, hoePreparationATS = 0, axePreparationATS = 0, pickaxePreparationATS = 0, fistsPreparationATS = 0, shovelPreparationATS = 0, swordsPreparationATS = 0;
private int xpGainATS = 0, recentlyHurt = 0, mySpawnATS, respawnATS, hoePreparationATS, shovelPreparationATS, swordsPreparationATS, fistsPreparationATS, axePreparationATS, pickaxePreparationATS;
private SkillType lastgained = null, skillLock = null;
//MySQL STUFF
private int xpbarinc=0, lastlogin=0, userid = 0, bleedticks = 0;
//MAGIC STUFF
private int mana = 0;
private int greenDyeCycleSel = 0, greenDyeCycle = 0, blueDyeCycle = 0, blueDyeCycleSel = 0;
public boolean dyeChanged = false;
private String playername;
private String playerName;
//Time to HashMap this shiz
HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); //Skills and XP
HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); //Skill ATS
String location = "plugins/mcMMO/FlatFileStuff/mcmmo.users";
public PlayerProfile(Player player)
{
hud = LoadProperties.defaulthud;
//Setup the HashMap for ability DATS
for(AbilityType abilityType : AbilityType.values())
{
skillsDATS.put(abilityType, 0);
}
//Setup the HashMap for the skills
for(SkillType skillType : SkillType.values())
{
@@ -92,7 +93,7 @@ public class PlayerProfile
}
}
playername = player.getName();
playerName = player.getName();
if (LoadProperties.useMySQL)
{
if(!loadMySQL(player)) {
@@ -156,13 +157,13 @@ public class PlayerProfile
}
else
{
superBreakerDATS = Integer.valueOf(cooldowns.get(1).get(0));
treeFellerDATS = Integer.valueOf(cooldowns.get(1).get(1));
berserkDATS = Integer.valueOf(cooldowns.get(1).get(2));
greenTerraDATS = Integer.valueOf(cooldowns.get(1).get(3));
gigaDrillBreakerDATS = Integer.valueOf(cooldowns.get(1).get(4));
serratedStrikesDATS = Integer.valueOf(cooldowns.get(1).get(5));
skullSplitterDATS = Integer.valueOf(cooldowns.get(1).get(6));
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldowns.get(1).get(0)));
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldowns.get(1).get(1)));
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldowns.get(1).get(2)));
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldowns.get(1).get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldowns.get(1).get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldowns.get(1).get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldowns.get(1).get(6)));
}
HashMap<Integer, ArrayList<String>> stats = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id);
skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0)));
@@ -219,7 +220,7 @@ public class PlayerProfile
//Find if the line contains the player we want.
String[] character = line.split(":");
if(!character[0].equals(playername)){continue;}
if(!character[0].equals(playerName)){continue;}
//Get Mining
if(character.length > 1 && m.isInt(character[1]))
@@ -276,19 +277,19 @@ public class PlayerProfile
if(character.length > 25 && m.isInt(character[25]))
skillsXp.put(SkillType.TAMING, Integer.valueOf(character[25]));
if(character.length > 26)
berserkDATS = Integer.valueOf(character[26]);
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(character[26]));
if(character.length > 27)
gigaDrillBreakerDATS = Integer.valueOf(character[27]);
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(character[27]));
if(character.length > 28)
treeFellerDATS = Integer.valueOf(character[28]);
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(character[28]));
if(character.length > 29)
greenTerraDATS = Integer.valueOf(character[29]);
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(character[29]));
if(character.length > 30)
serratedStrikesDATS = Integer.valueOf(character[30]);
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[30]));
if(character.length > 31)
skullSplitterDATS = Integer.valueOf(character[31]);
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(character[31]));
if(character.length > 32)
superBreakerDATS = Integer.valueOf(character[32]);
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32]));
if(character.length > 33)
{
for(HUDType x : HUDType.values())
@@ -326,13 +327,13 @@ public class PlayerProfile
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET "
+" mining = "+(superBreakerDATS)
+", woodcutting = "+(treeFellerDATS)
+", unarmed = "+(berserkDATS)
+", herbalism = "+(greenTerraDATS)
+", excavation = "+(gigaDrillBreakerDATS)
+", swords = " +(serratedStrikesDATS)
+", axes = "+(skullSplitterDATS)
+" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER)
+", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER)
+", unarmed = " + skillsDATS.get(AbilityType.BERSERK)
+", herbalism = " + skillsDATS.get(AbilityType.GREEN_TERRA)
+", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER)
+", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES)
+", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER)
+" WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET "
+" taming = "+skills.get(SkillType.TAMING)
@@ -377,13 +378,13 @@ public class PlayerProfile
{
//Read the line in and copy it to the output it's not the player
//we want to edit
if(!line.split(":")[0].equalsIgnoreCase(playername))
if(!line.split(":")[0].equalsIgnoreCase(playerName))
{
writer.append(line).append("\r\n");
//Otherwise write the new player information
} else {
writer.append(playername + ":");
writer.append(playerName + ":");
writer.append(skills.get(SkillType.MINING) + ":");
writer.append(myspawn + ":");
writer.append(party+":");
@@ -411,13 +412,13 @@ public class PlayerProfile
writer.append(skillsXp.get(SkillType.TAMING) + ":");
//Need to store the DATS of abilities nao
//Berserk, Gigadrillbreaker, Tree Feller, Green Terra, Serrated Strikes, Skull Splitter, Super Breaker
writer.append(String.valueOf(berserkDATS)+":");
writer.append(String.valueOf(gigaDrillBreakerDATS)+":");
writer.append(String.valueOf(treeFellerDATS)+":");
writer.append(String.valueOf(greenTerraDATS)+":");
writer.append(String.valueOf(serratedStrikesDATS)+":");
writer.append(String.valueOf(skullSplitterDATS)+":");
writer.append(String.valueOf(superBreakerDATS)+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.BERSERK))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.TREE_FELLER))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.GREEN_TERRA))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.SERRATED_STRIKES))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.SKULL_SPLIITER))+":");
writer.append(String.valueOf(skillsDATS.get(AbilityType.SUPER_BREAKER))+":");
writer.append(hud.toString()+":");
writer.append(skills.get(SkillType.FISHING) + ":");
writer.append(skillsXp.get(SkillType.FISHING) + ":");
@@ -442,7 +443,7 @@ public class PlayerProfile
BufferedWriter out = new BufferedWriter(file);
//Add the player to the end
out.append(playername + ":");
out.append(playerName + ":");
out.append(0 + ":"); //mining
out.append(myspawn+":");
out.append(party+":");
@@ -577,60 +578,10 @@ public class PlayerProfile
{
partyChatMode = !partyChatMode;
}
public void setMana(int newvalue)
{
mana = newvalue;
}
public int getCurrentMana()
{
return mana;
}
public void setDyeChanged(Boolean bool)
{
dyeChanged = bool;
}
public boolean getDyeChanged()
{
return dyeChanged;
}
public void setBlueDyeCycle(int newvalue)
{
blueDyeCycle = newvalue;
}
public int getBlueDyeCycle()
{
return blueDyeCycle;
}
public void setBlueDyeCycleSel(int newvalue)
{
blueDyeCycleSel = newvalue;
}
public int getBlueDyeCycleSel()
{
return blueDyeCycleSel;
}
public void setGreenDyeCycle(int newvalue)
{
greenDyeCycle = newvalue;
}
public int getGreenDyeCycle()
{
return greenDyeCycle;
}
public void setGreenDyeCycleSel(int newvalue)
{
greenDyeCycleSel = newvalue;
}
public int getGreenDyeCycleSel()
{
return greenDyeCycleSel;
}
public boolean isPlayer(String player)
{
return player.equals(playername);
return player.equals(Bukkit.getPlayer(playerName));
}
public boolean getPartyChatOnlyToggle(){return partyChatOnly;}
public void togglePartyChatOnly(){partyChatOnly = !partyChatOnly;}
@@ -753,10 +704,10 @@ public class PlayerProfile
pickaxePreparationMode = bool;
}
public long getPickaxePreparationATS(){
return pickaxePreparationATS;
return pickaxePreparationATS;
}
public void setPickaxePreparationATS(long newvalue){
pickaxePreparationATS = (int) (newvalue/1000);
pickaxePreparationATS = (int) (newvalue/1000);
}
/*
* GREEN TERRA MODE
@@ -771,15 +722,7 @@ public class PlayerProfile
public void setGreenTerraMode(Boolean bool){
greenTerraMode = bool;
}
public long getGreenTerraActivatedTimeStamp() {return greenTerraATS;}
public void setGreenTerraActivatedTimeStamp(Long newvalue){
greenTerraATS = (int) (newvalue/1000);
}
public long getGreenTerraDeactivatedTimeStamp() {return greenTerraDATS;}
public void setGreenTerraDeactivatedTimeStamp(Long newvalue){
greenTerraDATS = (int) (newvalue/1000);
save();
}
/*
* BERSERK MODE
*/
@@ -793,15 +736,6 @@ public class PlayerProfile
public void setBerserkMode(Boolean bool){
berserkMode = bool;
}
public long getBerserkActivatedTimeStamp() {return berserkATS;}
public void setBerserkActivatedTimeStamp(Long newvalue){
berserkATS = (int) (newvalue/1000);
}
public long getBerserkDeactivatedTimeStamp() {return berserkDATS;}
public void setBerserkDeactivatedTimeStamp(Long newvalue){
berserkDATS = (int) (newvalue/1000);
save();
}
/*
* SKULL SPLITTER
*/
@@ -815,15 +749,6 @@ public class PlayerProfile
public void setSkullSplitterMode(Boolean bool){
skullSplitterMode = bool;
}
public long getSkullSplitterActivatedTimeStamp() {return skullSplitterATS;}
public void setSkullSplitterActivatedTimeStamp(Long newvalue){
skullSplitterATS = (int) (newvalue/1000);
}
public long getSkullSplitterDeactivatedTimeStamp() {return skullSplitterDATS;}
public void setSkullSplitterDeactivatedTimeStamp(Long newvalue){
skullSplitterDATS = (int) (newvalue/1000);
save();
}
/*
* SERRATED STRIKES
*/
@@ -837,15 +762,6 @@ public class PlayerProfile
public void setSerratedStrikesMode(Boolean bool){
serratedStrikesMode = bool;
}
public long getSerratedStrikesActivatedTimeStamp() {return serratedStrikesATS;}
public void setSerratedStrikesActivatedTimeStamp(Long newvalue){
serratedStrikesATS = (int) (newvalue/1000);
}
public long getSerratedStrikesDeactivatedTimeStamp() {return serratedStrikesDATS;}
public void setSerratedStrikesDeactivatedTimeStamp(Long newvalue){
serratedStrikesDATS = (int) (newvalue/1000);
save();
}
/*
* GIGA DRILL BREAKER
*/
@@ -859,15 +775,6 @@ public class PlayerProfile
public void setGigaDrillBreakerMode(Boolean bool){
gigaDrillBreakerMode = bool;
}
public long getGigaDrillBreakerActivatedTimeStamp() {return gigaDrillBreakerATS;}
public void setGigaDrillBreakerActivatedTimeStamp(Long newvalue){
gigaDrillBreakerATS = (int) (newvalue/1000);
}
public long getGigaDrillBreakerDeactivatedTimeStamp() {return gigaDrillBreakerDATS;}
public void setGigaDrillBreakerDeactivatedTimeStamp(Long newvalue){
gigaDrillBreakerDATS = (int) (newvalue/1000);
save();
}
/*
* TREE FELLER STUFF
*/
@@ -881,15 +788,6 @@ public class PlayerProfile
public void setTreeFellerMode(Boolean bool){
treeFellerMode = bool;
}
public long getTreeFellerActivatedTimeStamp() {return treeFellerATS;}
public void setTreeFellerActivatedTimeStamp(Long newvalue){
treeFellerATS = (int) (newvalue/1000);
}
public long getTreeFellerDeactivatedTimeStamp() {return treeFellerDATS;}
public void setTreeFellerDeactivatedTimeStamp(Long newvalue){
treeFellerDATS = (int) (newvalue/1000);
save();
}
/*
* MINING
*/
@@ -903,15 +801,6 @@ public class PlayerProfile
public void setSuperBreakerMode(Boolean bool){
superBreakerMode = bool;
}
public long getSuperBreakerActivatedTimeStamp() {return superBreakerATS;}
public void setSuperBreakerActivatedTimeStamp(Long newvalue){
superBreakerATS = (int) (newvalue/1000);
}
public long getSuperBreakerDeactivatedTimeStamp() {return superBreakerDATS;}
public void setSuperBreakerDeactivatedTimeStamp(Long newvalue){
superBreakerDATS = (int) (newvalue/1000);
save();
}
public long getRecentlyHurt(){
return recentlyHurt;
}
@@ -921,7 +810,6 @@ public class PlayerProfile
public void skillUp(SkillType skillType, int newvalue)
{
skills.put(skillType, skills.get(skillType)+newvalue);
save();
}
public Integer getSkillLevel(SkillType skillType)
{
@@ -935,7 +823,23 @@ public class PlayerProfile
{
skills.put(skillType, 0);
}
public long getSkillDATS(AbilityType abilityType)
{
long convertedBack = skillsDATS.get(abilityType) * 1000;
return skillsDATS.get(abilityType);
}
public void setSkillDATS(AbilityType abilityType, long value)
{
int wearsOff = (int) (value * .001D);
skillsDATS.put(abilityType, wearsOff);
}
public void resetCooldowns()
{
for(AbilityType x : skillsDATS.keySet())
{
skillsDATS.put(x, 0);
}
}
/**
* Adds XP to the player, this ignores skill modifiers
* @param skillType The skill to add XP to
@@ -949,12 +853,14 @@ public class PlayerProfile
{
if(x == SkillType.ALL)
continue;
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), x, newvalue));
skillsXp.put(x, skillsXp.get(x)+newvalue);
}
} else {
int xp = newvalue;
xp=xp*LoadProperties.xpGainMultiplier;
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), skillType, xp));
skillsXp.put(skillType, skillsXp.get(skillType)+xp);
lastgained = skillType;
}
@@ -1001,6 +907,7 @@ public class PlayerProfile
{
if(x == SkillType.ALL)
continue;
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), x, newvalue));
skillsXp.put(x, skillsXp.get(x)+newvalue);
}
} else {
@@ -1055,10 +962,10 @@ public class PlayerProfile
double percent = (trueBonus/oldxp)*100;
thisplayer.sendMessage(ChatColor.GREEN+"XP: "+oldxp+" Bonus XP: "+trueBonus+" Total: "+xp+ChatColor.GOLD+" [Master: "+leaderName+" " +" +"+(int)percent+"%]");
}
Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), skillType, xp));
skillsXp.put(skillType, skillsXp.get(skillType)+xp);
lastgained = skillType;
}
//save();
}
public void removeXP(SkillType skillType, int newvalue)
@@ -1080,7 +987,6 @@ public class PlayerProfile
} else {
skillsXp.put(skillType, skillsXp.get(skillType)-newvalue);
}
//save();
}
public void acceptInvite()
{
@@ -1126,7 +1032,6 @@ public class PlayerProfile
skills.put(skillType, newvalue);
skillsXp.put(skillType, newvalue);
}
save();
}
public Integer getXpToLevel(SkillType skillType)
{
@@ -1137,14 +1042,12 @@ public class PlayerProfile
public void setParty(String newParty)
{
party = newParty;
save();
}
//Retrieve the player's party
public String getParty() {return party;}
//Remove party
public void removeParty() {
party = null;
save();
}
//Retrieve whether or not the player is in a party
public boolean inParty()
@@ -1176,7 +1079,6 @@ public class PlayerProfile
public void setMySpawn(double x, double y, double z, String myspawnworldlocation){
myspawn = x+","+y+","+z;
myspawnworld = myspawnworldlocation;
save();
}
public String getX(){
if(myspawn != null)

View File

@@ -0,0 +1,68 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.gmail.nossr50.datatypes.SkillType;
@SuppressWarnings("serial")
public class McMMOPlayerXpGainEvent extends Event {
private Player player;
private SkillType skill;
private int xpGained;
public McMMOPlayerXpGainEvent(Player player, SkillType skill, int xpGained) {
this.player = player;
this.skill = skill;
this.xpGained = xpGained;
}
/**
* @return Player gaining experience (can be null)
*/
public Player getPlayer() {
return player;
}
/**
* @return SkillType that is gaining experience
*/
public SkillType getSkill() {
return skill;
}
/**
* @return The number experience gained in this event
*/
public int getXpGained() {
return xpGained;
}
/** Rest of file is required boilerplate for custom events **/
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -29,6 +29,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -39,6 +40,7 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
@@ -47,8 +49,6 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
import net.minecraft.server.Enchantment;
public class mcBlockListener implements Listener
{
private final mcMMO plugin;
@@ -67,6 +67,7 @@ public class mcBlockListener implements Listener
Block block;
Player player = event.getPlayer();
//When blocks are placed on snow this event reports the wrong block.
if (event.getBlockReplacedState() != null && event.getBlockReplacedState().getTypeId() == 78)
{
@@ -77,6 +78,14 @@ public class mcBlockListener implements Listener
block = event.getBlock();
}
//TNT placement checks - needed for Blast Mining
if(block.getTypeId() == 46)
{
PlayerProfile PP = Users.getProfile(player);
int skill = PP.getSkillLevel(SkillType.MINING);
plugin.misc.tntTracker.put(block, skill);
}
//Check if the blocks placed should be monitored so they do not give out XP in the future
if(m.shouldBeWatched(block))
{
@@ -144,6 +153,12 @@ public class mcBlockListener implements Listener
* HERBALISM
*/
//TNT removal checks - needed for Blast Mining
if(block.getTypeId() == 46)
{
plugin.misc.tntTracker.remove(block);
}
//Green Terra
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07)
{
@@ -241,7 +256,7 @@ public class mcBlockListener implements Listener
}
if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(!inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
plugin.misc.treeFeller.clear();
@@ -282,8 +297,6 @@ public class mcBlockListener implements Listener
PlayerProfile PP = Users.getProfile(player);
ItemStack inhand = player.getItemInHand();
Block block = event.getBlock();
Skills.monitorSkills(player, PP);
/*
* ABILITY PREPARATION CHECKS

View File

@@ -16,10 +16,12 @@
*/
package com.gmail.nossr50.listeners;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@@ -29,6 +31,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Combat;
@@ -40,6 +44,7 @@ import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.Acrobatics;
import com.gmail.nossr50.skills.BlastMining;
import com.gmail.nossr50.skills.Skills;
import com.gmail.nossr50.skills.Taming;
@@ -52,7 +57,7 @@ public class mcEntityListener implements Listener
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.LOW)
public void onEntityDamage(EntityDamageEvent event)
{
if(event.isCancelled())
@@ -77,6 +82,19 @@ public class mcEntityListener implements Listener
Users.addUser(defender);
}
/*
* Demolitions Expert
if(event.getCause() == DamageCause.BLOCK_EXPLOSION)
{
if(event.getEntity() instanceof Player)
{
Player player = (Player)event.getEntity();
BlastMining.demolitionsExpertise(player, event);
}
}
*/
if(event.getEntity() instanceof LivingEntity)
{
//CraftEntity cEntity = (CraftEntity)event.getEntity();
@@ -137,7 +155,7 @@ public class mcEntityListener implements Listener
/*
* PARTY CHECKS
*/
if(event.getEntity() instanceof Player && f instanceof Player)
if(e instanceof Player && f instanceof Player)
{
Player defender = (Player)e;
Player attacker = (Player)f;
@@ -196,6 +214,39 @@ public class mcEntityListener implements Listener
}
}
/*
@EventHandler (priority = EventPriority.LOW)
public void onExplosionPrime(ExplosionPrimeEvent event)
{
if(event.getEntity() instanceof TNTPrimed)
{
Block block = event.getEntity().getLocation().getBlock();
if(plugin.misc.tntTracker.get(block) != null)
{
int skillLevel = plugin.misc.tntTracker.get(block);
BlastMining.biggerBombs(skillLevel, event);
}
}
}
@EventHandler (priority = EventPriority.LOW)
public void onEnitityExplode(EntityExplodeEvent event)
{
if(event.getEntity() instanceof TNTPrimed)
{
Block block = event.getLocation().getBlock();
if(plugin.misc.tntTracker.get(block) != null)
{
int skillLevel = plugin.misc.tntTracker.get(block);
BlastMining.dropProcessing(skillLevel, event, plugin);
}
}
}
*/
public boolean isBow(ItemStack is){
if (is.getTypeId() == 261){
return true;

View File

@@ -25,8 +25,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -47,6 +45,8 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Item;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
@@ -84,7 +84,7 @@ public class mcPlayerListener implements Listener
{
if(event.getState() == State.CAUGHT_FISH)
{
if(event.getCaught() instanceof CraftItem)
if(event.getCaught() instanceof Item)
{
Fishing.processResults(event);
}
@@ -155,6 +155,13 @@ public class mcPlayerListener implements Listener
mmoHelper.containers.remove(player);
}
//Bleed it out
if(Users.getProfile(player).getBleedTicks() > 0) Combat.dealDamage(player, Users.getProfile(player).getBleedTicks()*2);
//Save PlayerData to MySQL/FlatFile on player quit
Users.getProfile(player).save();
//Remove PlayerProfile
Users.removeUser(event.getPlayer());
}
@@ -164,7 +171,7 @@ public class mcPlayerListener implements Listener
Player player = event.getPlayer();
if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd)
{
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "/mcmmo"}));
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "mcmmo"}));
player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI"));
}
//THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY
@@ -229,19 +236,22 @@ public class mcPlayerListener implements Listener
switch(block.getType())
{
case COBBLESTONE:
if(LoadProperties.enableCobbleToMossy)
{
if(LoadProperties.enableCobbleToMossy) {
block.setType(Material.MOSSY_COBBLESTONE);
pass = true;
}
break;
case DIRT:
pass = true;
block.setType(Material.GRASS);
if(LoadProperties.enableDirtToGrass) {
pass = true;
block.setType(Material.GRASS);
}
break;
case SMOOTH_BRICK:
pass = true;
block.setData((byte)1);
if(LoadProperties.enableSmoothToMossy) {
pass = true;
block.setData((byte)1);
}
break;
}
if(pass == false)
@@ -322,11 +332,7 @@ public class mcPlayerListener implements Listener
if(Party.getInstance().inSameParty(player, x))
x.sendMessage(format);
}
if(Bukkit.getServer() instanceof ColouredConsoleSender)
{
ColouredConsoleSender ccs = (ColouredConsoleSender) Bukkit.getServer();
ccs.sendMessage(ChatColor.GREEN+"[P]"+format); //Colors, woot!
}
log.log(Level.INFO, "[P]"+format);
} else if (PP.getAdminChatMode()) {
event.setCancelled(true);
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
@@ -336,13 +342,7 @@ public class mcPlayerListener implements Listener
if(x.isOp() || mcPermissions.getInstance().adminChat(x))
x.sendMessage(format);
}
if(Bukkit.getServer() instanceof ColouredConsoleSender)
{
ColouredConsoleSender ccs = (ColouredConsoleSender) Bukkit.getServer();
ccs.sendMessage(ChatColor.AQUA+"[A]"+format); //Colors, woot!
} else {
log.log(Level.INFO, "[A]"+format);
}
log.log(Level.INFO, "[A]"+format);
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
/**
* Listener for listening to our own events, only really useful for catching errors
*/
public class mcSelfListener implements Listener {
@EventHandler
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
int xp = event.getXpGained();
if(xp < 0) {
try {
throw new Exception("Gained negative XP!");
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
}

View File

@@ -1,18 +1,19 @@
/*
This file is part of mcMMO.
Copyright (C) 2012 Matt 'The Yeti' Burnett & mcMMO Development
Copyright (C) 2010-2011 'nossr50'
mcMMO is free software: you can redistribute it and/or modify
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.
mcMMO is distributed in the hope that it will be useful,
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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50;
@@ -32,7 +33,6 @@ import com.gmail.nossr50.listeners.mcPlayerListener;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.skills.*;
import com.nijikokun.bukkit.Permissions.Permissions;
import org.bukkit.Bukkit;
@@ -62,17 +62,6 @@ import org.getspout.spoutapi.player.FileManager;
public class mcMMO extends JavaPlugin
{
/*
* I never expected mcMMO to get so popular!
* Thanks for all the support for the mod
* Thanks to the people who have worked on the code
* Thanks to the donators who helped me out financially
* Thanks to the server admins who use my mod :)
*
* This mod is open source, and its going to stay that way >:3
*
* Donate via paypal to nossr50@gmail.com (A million thanks to anyone that does!)
*/
public static String maindirectory = "plugins" + File.separator + "mcMMO";
File file = new File(maindirectory + File.separator + "config.yml");
@@ -82,11 +71,9 @@ public class mcMMO extends JavaPlugin
private final mcPlayerListener playerListener = new mcPlayerListener(this);
private final mcBlockListener blockListener = new mcBlockListener(this);
private final mcEntityListener entityListener = new mcEntityListener(this);
public static mcPermissions permissionHandler = new mcPermissions();
private Permissions permissions;
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
private Runnable mcMMO_SaveTimer = new mcSaveTimer(this); //Periodic saving of Player Data
private Runnable ChangeDataValueTimer = new ChangeDataValueTimer(this); //R2 block place workaround
//private Timer mcMMO_SpellTimer = new Timer(true);
@@ -150,7 +137,6 @@ public class mcMMO extends JavaPlugin
pm.registerEvents(entityListener, this);
PluginDescriptionFile pdfFile = this.getDescription();
mcPermissions.initialize(getServer());
if(LoadProperties.useMySQL)
{
@@ -162,6 +148,9 @@ public class mcMMO extends JavaPlugin
for(Player player : getServer().getOnlinePlayers()){Users.addUser(player);} //In case of reload add all users back into PlayerProfile
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
//Periodic save timer (Saves every 10 minutes)
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_SaveTimer, 0, LoadProperties.saveInterval * 1200);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20);
//R2+ block place fix
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, ChangeDataValueTimer, 0, 10);
@@ -177,17 +166,6 @@ public class mcMMO extends JavaPlugin
FileManager FM = SpoutManager.getFileManager();
FM.addToPreLoginCache(this, SpoutStuff.getFiles());
/*
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,
new Runnable() {
@Override
public void run() {
mmoHelper.updateAll();
}
}, 20, 20);
*/
}
}
@@ -249,12 +227,18 @@ public class mcMMO extends JavaPlugin
PlayerProfile PP = Users.getProfile(player);
return PP.inParty();
}
public Permissions getPermissions() {
return permissions;
}
public void onDisable() {
Bukkit.getServer().getScheduler().cancelTasks(this);
System.out.println("mcMMO was disabled.");
public void onDisable()
{
//Make sure to save player information if the server shuts down
for(Player x : Bukkit.getServer().getOnlinePlayers())
{
Users.getProfile(x).save();
}
Bukkit.getServer().getScheduler().cancelTasks(this); //This removes our tasks
System.out.println("mcMMO was disabled."); //How informative!
}
private void registerCommands() {
@@ -311,7 +295,7 @@ public class mcMMO extends JavaPlugin
if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand());
if(LoadProperties.statsEnable) getCommand("stats").setExecutor(new StatsCommand());
if(LoadProperties.statsEnable) getCommand("stats").setExecutor(new StatsCommand(this));
if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this));
if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand());

View File

@@ -16,337 +16,133 @@
*/
package com.gmail.nossr50;
import java.util.logging.Logger;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
public class mcPermissions
{
private static volatile mcPermissions instance;
private enum PermissionType {
PEX, PERMISSIONS, BUKKIT
}
private static PermissionType permissionType;
private static Object PHandle;
public static boolean permissionsEnabled = false;
public boolean permission(Player player, String perm) {
return player.hasPermission(perm);
}
public static void initialize(Server server)
{
Logger log = Logger.getLogger("Minecraft");
if(permissionsEnabled && permissionType != PermissionType.PERMISSIONS) return;
Plugin PEXtest = server.getPluginManager().getPlugin("PermissionsEx");
Plugin test = server.getPluginManager().getPlugin("Permissions");
if(PEXtest != null) {
PHandle = (PermissionManager) PermissionsEx.getPermissionManager();
permissionType = PermissionType.PEX;
permissionsEnabled = true;
log.info("[mcMMO] PermissionsEx found, using PermissionsEx.");
} else if(test != null) {
PHandle = (PermissionHandler) ((Permissions) test).getHandler();
permissionType = PermissionType.PERMISSIONS;
permissionsEnabled = true;
log.info("[mcMMO] Permissions version "+test.getDescription().getVersion()+" found, using Permissions.");
} else {
permissionType = PermissionType.BUKKIT;
permissionsEnabled = true;
log.info("[mcMMO] Using Bukkit Permissions.");
}
}
public static boolean getEnabled()
{
return permissionsEnabled;
}
public static boolean permission(Player player, String permission)
{
if(!permissionsEnabled) return player.isOp();
switch(permissionType) {
case PEX:
return ((PermissionManager) PHandle).has(player, permission);
case PERMISSIONS:
return ((PermissionHandler) PHandle).has(player, permission);
case BUKKIT:
return player.hasPermission(permission);
default:
return true;
}
}
public boolean admin(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.admin");
} else {
return true;
}
return player.hasPermission("mcmmo.admin");
}
public boolean mcrefresh(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mcrefresh");
} else {
return true;
}
return player.hasPermission("mcmmo.tools.mcrefresh");
}
public boolean mmoedit(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mmoedit");
} else {
return true;
}
return player.hasPermission("mcmmo.tools.mmoedit");
}
public boolean herbalismAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.herbalism");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.herbalism");
}
public boolean excavationAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.excavation");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.excavation");
}
public boolean unarmedAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.unarmed");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.unarmed");
}
public boolean chimaeraWing(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.item.chimaerawing");
} else {
return true;
}
return player.hasPermission("mcmmo.item.chimaerawing");
}
public boolean miningAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.mining");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.mining");
}
public boolean axesAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.axes");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.axes");
}
public boolean swordsAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.swords");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.swords");
}
public boolean woodCuttingAbility(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.woodcutting");
} else {
return true;
}
return player.hasPermission("mcmmo.ability.woodcutting");
}
public boolean mcgod(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.tools.mcgod");
} else {
return true;
}
return player.hasPermission("mcmmo.tools.mcgod");
}
public boolean regeneration(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.regeneration");
} else {
return true;
}
return player.hasPermission("mcmmo.regeneration");
}
public boolean motd(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.motd");
} else {
return true;
}
return player.hasPermission("mcmmo.motd");
}
public boolean mcAbility(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.ability");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.ability");
}
public boolean mySpawn(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.myspawn");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.myspawn");
}
public boolean setMySpawn(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.setmyspawn");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.setmyspawn");
}
public boolean partyChat(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.chat.partychat");
} else {
return true;
}
return player.hasPermission("mcmmo.chat.partychat");
}
public boolean partyLock(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.chat.partylock");
} else {
return true;
}
return player.hasPermission("mcmmo.chat.partylock");
}
public boolean partyTeleport(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.ptp");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.ptp");
}
public boolean whois(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.whois");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.whois");
}
public boolean party(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.commands.party");
} else {
return true;
}
return player.hasPermission("mcmmo.commands.party");
}
public boolean adminChat(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.chat.adminchat");
} else {
return true;
}
return player.hasPermission("mcmmo.chat.adminchat");
}
public static mcPermissions getInstance() {
if (instance == null) {
instance = new mcPermissions();
instance = new mcPermissions();
}
return instance;
}
}
public boolean taming(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.taming");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.taming");
}
public boolean mining(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.mining");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.mining");
}
public boolean fishing(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.fishing");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.fishing");
}
public boolean alchemy(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.alchemy");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.alchemy");
}
public boolean enchanting(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.enchanting");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.enchanting");
}
public boolean woodcutting(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.woodcutting");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.woodcutting");
}
public boolean repair(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.repair");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.repair");
}
public boolean unarmed(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.unarmed");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.unarmed");
}
public boolean archery(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.archery");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.archery");
}
public boolean herbalism(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.herbalism");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.herbalism");
}
public boolean excavation(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.excavation");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.excavation");
}
public boolean swords(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.swords");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.swords");
}
public boolean axes(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.axes");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.axes");
}
public boolean acrobatics(Player player) {
if (permissionsEnabled) {
return permission(player, "mcmmo.skills.acrobatics");
} else {
return true;
}
return player.hasPermission("mcmmo.skills.acrobatics");
}
}

View File

@@ -32,7 +32,6 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.spout.util.ArrayListString;
@@ -118,7 +117,6 @@ public class Party
public void informPartyMembers(Player player, Player[] players)
{
int x = 0;
for(Player p : players)
{
if(player != null && p != null)
@@ -126,7 +124,6 @@ public class Party
if(inSameParty(player, p) && !p.getName().equals(player.getName()))
{
p.sendMessage(mcLocale.getString("Party.InformedOnJoin", new Object[] {player.getName()}));
x++;
}
}
}
@@ -171,14 +168,12 @@ public class Party
}
public void informPartyMembersOwnerChange(Player newOwner, Player[] players) {
int x = 0;
for(Player p : players){
if(newOwner != null && p != null){
if(inSameParty(newOwner, p))
{
//TODO: Needs more locale.
p.sendMessage(newOwner.getName()+" is the new party owner.");
x++;
}
}
}
@@ -191,13 +186,11 @@ public class Party
public void informPartyMembersQuit(Player player, Player[] players)
{
int x = 0;
for(Player p : players){
if(player != null && p != null){
if(inSameParty(player, p) && !p.getName().equals(player.getName()))
{
p.sendMessage(mcLocale.getString("Party.InformedOnQuit", new Object[] {player.getName()}));
x++;
}
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.runnables;
import org.bukkit.entity.Player;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO;
public class mcSaveTimer implements Runnable {
private final mcMMO plugin;
public mcSaveTimer(final mcMMO plugin)
{
this.plugin = plugin;
}
public void run()
{
//All player data will be saved periodically through this
for(Player player : plugin.getServer().getOnlinePlayers())
{
Users.getProfile(player).save();
}
}
}

View File

@@ -37,7 +37,7 @@ public class Archery
pluginx.misc.arrowTracker.put(x, 0);
if(attacker != null)
{
if( (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) || PPa.getSkillLevel(SkillType.ARCHERY) > 1000)
if(PPa.getSkillLevel(SkillType.ARCHERY) > 1000 || (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)))
{
pluginx.misc.arrowTracker.put(x, 1);
}
@@ -48,7 +48,7 @@ public class Archery
{
if(attacker != null)
{
if( (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)) || PPa.getSkillLevel(SkillType.ARCHERY) > 1000)
if(PPa.getSkillLevel(SkillType.ARCHERY) > 1000 || (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)))
{
pluginx.misc.arrowTracker.put(x, 1);
}

View File

@@ -30,6 +30,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.party.Party;
@@ -52,26 +53,26 @@ public class Axes {
ticks++;
}
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown))
if(!PP.getSkullSplitterMode() && Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown))
{
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOn"));
for(Player y : player.getWorld().getPlayers()){
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SkullSplitterPlayer", new Object[] {player.getName()}));
}
PP.setSkullSplitterActivatedTimeStamp(System.currentTimeMillis());
PP.setSkullSplitterDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.SKULL_SPLIITER, System.currentTimeMillis()+(ticks*1000));
PP.setSkullSplitterMode(true);
}
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)){
if(!PP.getSkullSplitterMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)){
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkullSplitterDeactivatedTimeStamp()*1000), LoadProperties.skullSplitterCooldown)+"s)");
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000), LoadProperties.skullSplitterCooldown)+"s)");
}
}
}
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
{
Entity x = event.getEntity();
if(x instanceof Wolf){
Wolf wolf = (Wolf)x;
if(Taming.getOwner(wolf, pluginx) != null)
@@ -85,27 +86,29 @@ public class Axes {
PlayerProfile PPa = Users.getProfile(attacker);
if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(PPa.getSkillLevel(SkillType.AXES) >= 750){
if(Math.random() * 1000 <= 750){
if(Math.random() * 1000 <= 750 && !x.isDead()){
if(x instanceof Player){
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
event.setDamage(damage);
Player player = (Player)x;
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
if(x instanceof Player){
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
} else {
event.setDamage(event.getDamage() * 2);
else {
int damage = event.getDamage() * 2;
event.setDamage(damage);
}
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
} else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES)){
} else if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.AXES) && !x.isDead()){
if(x instanceof Player){
int damage = (event.getDamage() * 2) - (event.getDamage() / 2);
event.setDamage(damage);
Player player = (Player)x;
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
}
if(x instanceof Player){
event.setDamage(event.getDamage() * 2 - event.getDamage() / 2);
} else {
event.setDamage(event.getDamage() * 2);
else {
int damage = event.getDamage() * 2;
event.setDamage(damage);
}
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
}
@@ -121,53 +124,52 @@ public class Axes {
LivingEntity x = (LivingEntity) event.getEntity();
targets = m.getTier(attacker);
for(Entity derp : x.getWorld().getEntities())
{
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5)
{
//Make sure the Wolf is not friendly
if(derp instanceof Wolf)
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
{
//Make sure the Wolf is not friendly
if(derp instanceof Wolf)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
//Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1)
{
if(derp instanceof Player)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
//Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1)
{
if(derp instanceof Player)
{
Player target = (Player)derp;
if(Users.getProfile(target).getGodMode())
continue;
Player target = (Player)derp;
if(Users.getProfile(target).getGodMode())
continue;
if(target.getName().equals(attacker.getName()))
continue;
if(Party.getInstance().inSameParty(attacker, target))
continue;
if(targets >= 1 && derp.getWorld().getPVP())
{
Combat.dealDamage(target, event.getDamage() / 2, attacker);
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
targets--;
continue;
}
}
else
{
LivingEntity target = (LivingEntity)derp;
if(target.getName().equals(attacker.getName()))
continue;
if(Party.getInstance().inSameParty(attacker, target))
continue;
if(target.isDead())
continue;
if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead())
{
Combat.dealDamage(target, event.getDamage() / 2, attacker);
targets--;
}
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
targets--;
continue;
}
}
else
{
LivingEntity target = (LivingEntity)derp;
Combat.dealDamage(target, event.getDamage() / 2, attacker);
targets--;
}
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,385 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.skills;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
public class BlastMining{
public static void explosionBlockDrops(Block block, Location loc)
{
int id = block.getTypeId();
Material mat = Material.getMaterial(id);
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16 && id != 112 && id != 121 && id != 48)
{
m.mcDropItem(loc, item);
return;
}
switch (id)
{
//GLOWSTONE
case 89:
mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//REDSTONE
case 73:
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
case 74:
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//LAPIS
case 21:
mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//DIAMOND
case 56:
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
//STONE
case 1:
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
//COAL
case 16:
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
break;
}
}
/*
* Process the drops from the explosion
*/
public static void dropProcessing(int skillLevel, EntityExplodeEvent event, mcMMO plugin)
{
float yield = event.getYield();
List<Block> blocks = event.blockList();
Iterator<Block> iterator = blocks.iterator();
List<Block> ores = new ArrayList<Block>();
List<Block> debris = new ArrayList<Block>();
while(iterator.hasNext())
{
Block temp = iterator.next();
int id = temp.getTypeId();
if(id == 14 || id == 15 || id == 16 || id == 21 || id == 56 || id == 73 || id == 74)
{
ores.add(temp);
}
else
{
debris.add(temp);
}
}
//Normal explosion
if(skillLevel < 125)
return;
//+5% ores
if(skillLevel >= 125 && skillLevel < 250)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
Iterator<Block> iterator3 = debris.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .05))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
while(iterator3.hasNext())
{
Block temp = iterator3.next();
if(Math.random() < yield)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
//+10% ores
if(skillLevel >= 250 && skillLevel < 375)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
Iterator<Block> iterator3 = debris.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .10))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
while(iterator3.hasNext())
{
Block temp = iterator3.next();
if(Math.random() < yield)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
//No debris, +15% ores
if(skillLevel >= 375 && skillLevel < 500)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .15))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
//No debris, +20% ores
if(skillLevel >= 500 && skillLevel < 625)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .20))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
//Double Drops, No Debris, +25% ores
if(skillLevel >= 625 && skillLevel < 750)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .25))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
//Double Drops, No Debris, +30% ores
if(skillLevel >= 750 && skillLevel < 875)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .30))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
//Triple Drops, No debris, +35% ores
if(skillLevel >= 875 && skillLevel < 1000)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() * 100 < (yield + .35))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
//Triple Drops, No debris, +40% ores
if(skillLevel >= 1000)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() * 100 < (yield + .40))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
}
/*
* Bigger Bombs (Unlocked at Mining 250)
*
* Increases radius of explosion by 1 at 250.
* Increases radius of explosion by 2 at 500.
* Increases radius of explosion by 3 at 750.
* Increases radius of explosion by 4 at 1000.
*/
public static void biggerBombs(int skillLevel, ExplosionPrimeEvent event)
{
float radius = event.getRadius();
if(skillLevel < 250)
return;
if(skillLevel >= 250)
radius++;
if(skillLevel >= 500)
radius++;
if(skillLevel >= 750)
radius++;
if(skillLevel >= 1000)
radius++;
event.setRadius(radius);
}
/*
* Demolitions Expertise (Unlocked at Mining 500)
*
* Reduces explosion damage to 1/4 of normal at 500.
* Reduces explosion damage to 1/2 of normal at 1000.
*/
public static void demolitionsExpertise(Player player, EntityDamageEvent event)
{
PlayerProfile PP = Users.getProfile(player);
int skill = PP.getSkillLevel(SkillType.MINING);
int damage = event.getDamage();
if(skill < 500)
return;
if(skill >= 500 && skill < 1000)
damage = damage/4;
if(skill >= 1000)
damage = damage/2;
event.setDamage(damage);
}
}

View File

@@ -32,6 +32,7 @@ import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import org.getspout.spoutapi.sound.SoundEffect;
@@ -60,7 +61,7 @@ public class Excavation
ticks++;
}
if(!PP.getGigaDrillBreakerMode() && PP.getGigaDrillBreakerDeactivatedTimeStamp() < System.currentTimeMillis())
if(!PP.getGigaDrillBreakerMode() && PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) < System.currentTimeMillis())
{
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOn"));
for(Player y : player.getWorld().getPlayers())
@@ -68,8 +69,7 @@ public class Excavation
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerPlayer", new Object[] {player.getName()}));
}
PP.setGigaDrillBreakerActivatedTimeStamp(System.currentTimeMillis());
PP.setGigaDrillBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.GIGA_DRILL_BREAKER, System.currentTimeMillis()+(ticks*1000));
PP.setGigaDrillBreakerMode(true);
}

View File

@@ -1,8 +1,23 @@
/*
This file is part of mcMMO.
mcMMO 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.
mcMMO 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 mcMMO. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gmail.nossr50.skills;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*;
import org.bukkit.event.player.PlayerFishEvent;
@@ -70,8 +85,7 @@ public class Fishing {
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 15);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1)
{
switch(randomNum)
@@ -173,7 +187,7 @@ public class Fishing {
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 20);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2)
{
@@ -306,7 +320,7 @@ public class Fishing {
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 24);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3)
{
@@ -463,7 +477,7 @@ public class Fishing {
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 41);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4)
{
@@ -721,7 +735,7 @@ public class Fishing {
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 50);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5)
{
@@ -1033,7 +1047,7 @@ public class Fishing {
PlayerProfile PP = Users.getProfile(player);
Fishing.getFishingResults(player, event);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
{

View File

@@ -27,6 +27,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@@ -57,7 +58,7 @@ public class Herbalism
ticks++;
}
if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getGreenTerraDeactivatedTimeStamp(), LoadProperties.greenTerraCooldown))
if(!PP.getGreenTerraMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.GREEN_TERRA), LoadProperties.greenTerraCooldown))
{
player.sendMessage(mcLocale.getString("Skills.GreenTerraOn"));
for(Player y : player.getWorld().getPlayers())
@@ -65,8 +66,7 @@ public class Herbalism
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.GreenTerraPlayer", new Object[] {player.getName()}));
}
PP.setGreenTerraActivatedTimeStamp(System.currentTimeMillis());
PP.setGreenTerraDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.GREEN_TERRA, System.currentTimeMillis()+(ticks*1000));
PP.setGreenTerraMode(true);
}
@@ -163,11 +163,11 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
//GREEN THUMB
if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
if(herbLevel > 1500 || (Math.random() * 1500 <= herbLevel))
{
event.setCancelled(true);
m.mcDropItem(loc, is);
@@ -176,24 +176,15 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
m.mcDropItem(loc, is);
block.setData((byte) 0x1); //Change it to first stage
//Setup the bonuses
int bonus = 0;
if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
bonus++;
if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
bonus++;
//This replants the wheat at a certain stage in development based on Herbalism Skill
if(PP.getSkillLevel(SkillType.HERBALISM) >= 600)
bonus++;
//Change wheat to be whatever stage based on the bonus
if(bonus == 1)
block.setData((byte) 0x2);
if(bonus == 2)
block.setData((byte) 0x4);
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
block.setData((byte) 0x3);
if(bonus == 3)
block.setData((byte) 0x4);
else if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
block.setData((byte) 0x2);
else
block.setData((byte) 0x1);
}
}
@@ -205,7 +196,7 @@ public class Herbalism
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
m.mcDropItem(loc, is);
@@ -251,7 +242,7 @@ public class Herbalism
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
if(byteArray[x] != (byte) 5)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(target.getLocation(), is);
}
@@ -290,7 +281,7 @@ public class Herbalism
//Check for being placed by the player
if(byteArray[x] != (byte) 5)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(target.getLocation(), is);
}
@@ -308,7 +299,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
}
@@ -322,7 +313,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
m.mcDropItem(loc, is);
@@ -346,7 +337,7 @@ public class Herbalism
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null)
{
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
{
m.mcDropItem(loc, is);
}
@@ -358,7 +349,7 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
@@ -369,7 +360,7 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
@@ -379,7 +370,7 @@ public class Herbalism
mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){
if((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);

View File

@@ -19,7 +19,6 @@ package com.gmail.nossr50.skills;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -32,6 +31,7 @@ import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@@ -63,15 +63,14 @@ public class Mining
ticks++;
}
if(!PP.getSuperBreakerMode() && Skills.cooldownOver(player, PP.getSuperBreakerDeactivatedTimeStamp(), LoadProperties.superBreakerCooldown)){
if(!PP.getSuperBreakerMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.SUPER_BREAKER), LoadProperties.superBreakerCooldown)){
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOn"));
for(Player y : player.getWorld().getPlayers())
{
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SuperBreakerPlayer", new Object[] {player.getName()}));
}
PP.setSuperBreakerActivatedTimeStamp(System.currentTimeMillis());
PP.setSuperBreakerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.SUPER_BREAKER, System.currentTimeMillis()+(ticks*1000));
PP.setSuperBreakerMode(true);
}
@@ -171,7 +170,7 @@ public class Mining
{
PlayerProfile PP = Users.getProfile(player);
if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) || PP.getSkillLevel(SkillType.MINING) > 1000)
if(PP.getSkillLevel(SkillType.MINING) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)))
{
blockProcSimulate(block, player);
return;

View File

@@ -742,7 +742,7 @@ public class Repair {
PlayerProfile PP = Users.getProfile(player);
if(player != null)
{
if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR)) || PP.getSkillLevel(SkillType.REPAIR) > 1000)
if(PP.getSkillLevel(SkillType.REPAIR) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.REPAIR)))
{
player.sendMessage(mcLocale.getString("Skills.FeltEasy"));
return true;

View File

@@ -33,6 +33,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.PlayerStat;
import com.gmail.nossr50.datatypes.SkillType;
@@ -78,31 +79,31 @@ public class Skills
}
public static void watchCooldowns(Player player, PlayerProfile PP, long curTime){
if(!PP.getGreenTerraInformed() && curTime - (PP.getGreenTerraDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 1000)){
if(!PP.getGreenTerraInformed() && curTime - (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000) >= (LoadProperties.greenTerraCooldown * 1000)){
PP.setGreenTerraInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourGreenTerra"));
}
if(!PP.getTreeFellerInformed() && curTime - (PP.getTreeFellerDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 1000)){
if(!PP.getTreeFellerInformed() && curTime - (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000) >= (LoadProperties.treeFellerCooldown * 1000)){
PP.setTreeFellerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourTreeFeller"));
}
if(!PP.getSuperBreakerInformed() && curTime - (PP.getSuperBreakerDeactivatedTimeStamp()*1000) >= (LoadProperties.superBreakerCooldown * 1000)){
if(!PP.getSuperBreakerInformed() && curTime - (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000) >= (LoadProperties.superBreakerCooldown * 1000)){
PP.setSuperBreakerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSuperBreaker"));
}
if(!PP.getSerratedStrikesInformed() && curTime - (PP.getSerratedStrikesDeactivatedTimeStamp()*1000) >= (LoadProperties.serratedStrikeCooldown * 1000)){
if(!PP.getSerratedStrikesInformed() && curTime - (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000) >= (LoadProperties.serratedStrikeCooldown * 1000)){
PP.setSerratedStrikesInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSerratedStrikes"));
}
if(!PP.getBerserkInformed() && curTime - (PP.getBerserkDeactivatedTimeStamp()*1000) >= (LoadProperties.berserkCooldown * 1000)){
if(!PP.getBerserkInformed() && (curTime - (PP.getSkillDATS(AbilityType.BERSERK)*1000)) >= (LoadProperties.berserkCooldown * 1000)){
PP.setBerserkInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourBerserk"));
}
if(!PP.getSkullSplitterInformed() && curTime - (PP.getSkullSplitterDeactivatedTimeStamp()*1000) >= (LoadProperties.skullSplitterCooldown * 1000)){
if(!PP.getSkullSplitterInformed() && curTime - (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000) >= (LoadProperties.skullSplitterCooldown * 1000)){
PP.setSkullSplitterInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourSkullSplitter"));
}
if(!PP.getGigaDrillBreakerInformed() && curTime - (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000) >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){
if(!PP.getGigaDrillBreakerInformed() && curTime - (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000) >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){
PP.setGigaDrillBreakerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourGigaDrillBreaker"));
}
@@ -114,9 +115,9 @@ public class Skills
PlayerProfile PP = Users.getProfile(player);
if(mcPermissions.getInstance().herbalismAbility(player) && m.isHoe(player.getItemInHand()) && !PP.getHoePreparationMode()){
if(!PP.getGreenTerraMode() && !cooldownOver(player, (PP.getGreenTerraDeactivatedTimeStamp()*1000), LoadProperties.greenTerraCooldown)){
if(!PP.getGreenTerraMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000), LoadProperties.greenTerraCooldown)){
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getGreenTerraDeactivatedTimeStamp()*1000), LoadProperties.greenTerraCooldown)+"s)");
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000), LoadProperties.greenTerraCooldown)+"s)");
return;
}
if(LoadProperties.enableAbilityMessages)
@@ -125,9 +126,7 @@ public class Skills
PP.setHoePreparationMode(true);
}
}
public static void monitorSkills(Player player, PlayerProfile PP) {
monitorSkills(player, PP, System.currentTimeMillis());
}
public static void monitorSkills(Player player, PlayerProfile PP, long curTime){
if(PP.getHoePreparationMode() && curTime - (PP.getHoePreparationATS()*1000) >= 4000){
PP.setHoePreparationMode(false);
@@ -158,7 +157,7 @@ public class Skills
* HERBALISM ABILITY
*/
if(mcPermissions.getInstance().herbalismAbility(player)){
if(PP.getGreenTerraMode() && (PP.getGreenTerraDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getGreenTerraMode() && (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000) <= curTime){
PP.setGreenTerraMode(false);
PP.setGreenTerraInformed(false);
player.sendMessage(mcLocale.getString("Skills.GreenTerraOff"));
@@ -168,7 +167,7 @@ public class Skills
* AXES ABILITY
*/
if(mcPermissions.getInstance().axesAbility(player)){
if(PP.getSkullSplitterMode() && (PP.getSkullSplitterDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getSkullSplitterMode() && (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000) <= curTime){
PP.setSkullSplitterMode(false);
PP.setSkullSplitterInformed(false);
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOff"));
@@ -178,7 +177,7 @@ public class Skills
* WOODCUTTING ABILITY
*/
if(mcPermissions.getInstance().woodCuttingAbility(player)){
if(PP.getTreeFellerMode() && (PP.getTreeFellerDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getTreeFellerMode() && (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000) <= curTime){
PP.setTreeFellerMode(false);
PP.setTreeFellerInformed(false);
player.sendMessage(mcLocale.getString("Skills.TreeFellerOff"));
@@ -188,7 +187,7 @@ public class Skills
* MINING ABILITY
*/
if(mcPermissions.getInstance().miningAbility(player)){
if(PP.getSuperBreakerMode() && (PP.getSuperBreakerDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getSuperBreakerMode() && (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000) <= curTime){
PP.setSuperBreakerMode(false);
PP.setSuperBreakerInformed(false);
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOff"));
@@ -198,7 +197,7 @@ public class Skills
* EXCAVATION ABILITY
*/
if(mcPermissions.getInstance().excavationAbility(player)){
if(PP.getGigaDrillBreakerMode() && (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getGigaDrillBreakerMode() && (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000) <= curTime){
PP.setGigaDrillBreakerMode(false);
PP.setGigaDrillBreakerInformed(false);
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOff"));
@@ -208,7 +207,7 @@ public class Skills
* SWORDS ABILITY
*/
if(mcPermissions.getInstance().swordsAbility(player)){
if(PP.getSerratedStrikesMode() && (PP.getSerratedStrikesDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getSerratedStrikesMode() && (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000) <= curTime){
PP.setSerratedStrikesMode(false);
PP.setSerratedStrikesInformed(false);
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOff"));
@@ -218,7 +217,7 @@ public class Skills
* UNARMED ABILITY
*/
if(mcPermissions.getInstance().unarmedAbility(player)){
if(PP.getBerserkMode() && (PP.getBerserkDeactivatedTimeStamp()*1000) <= curTime){
if(PP.getBerserkMode() && (PP.getSkillDATS(AbilityType.BERSERK)*1000) <= curTime){
PP.setBerserkMode(false);
PP.setBerserkInformed(false);
player.sendMessage(mcLocale.getString("Skills.BerserkOff"));
@@ -237,10 +236,10 @@ public class Skills
return;
if(mcPermissions.getInstance().miningAbility(player) && m.isMiningPick(player.getItemInHand()) && !PP.getPickaxePreparationMode())
{
if(!PP.getSuperBreakerMode() && !cooldownOver(player, (PP.getSuperBreakerDeactivatedTimeStamp()*1000), LoadProperties.superBreakerCooldown))
if(!PP.getSuperBreakerMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000), LoadProperties.superBreakerCooldown))
{
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSuperBreakerDeactivatedTimeStamp()*1000), LoadProperties.superBreakerCooldown)+"s)");
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000), LoadProperties.superBreakerCooldown)+"s)");
return;
}
if(LoadProperties.enableAbilityMessages)
@@ -250,10 +249,10 @@ public class Skills
}
if(mcPermissions.getInstance().excavationAbility(player) && m.isShovel(player.getItemInHand()) && !PP.getShovelPreparationMode())
{
if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000), LoadProperties.gigaDrillBreakerCooldown))
if(!PP.getGigaDrillBreakerMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000), LoadProperties.gigaDrillBreakerCooldown))
{
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000), LoadProperties.gigaDrillBreakerCooldown)+"s)");
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000), LoadProperties.gigaDrillBreakerCooldown)+"s)");
return;
}
if(LoadProperties.enableAbilityMessages)
@@ -263,10 +262,10 @@ public class Skills
}
if(mcPermissions.getInstance().swordsAbility(player) && m.isSwords(player.getItemInHand()) && !PP.getSwordsPreparationMode())
{
if(!PP.getSerratedStrikesMode() && !cooldownOver(player, (PP.getSerratedStrikesDeactivatedTimeStamp()*1000), LoadProperties.serratedStrikeCooldown))
if(!PP.getSerratedStrikesMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000), LoadProperties.serratedStrikeCooldown))
{
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSerratedStrikesDeactivatedTimeStamp()*1000), LoadProperties.serratedStrikeCooldown)+"s)");
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000), LoadProperties.serratedStrikeCooldown)+"s)");
return;
}
if(LoadProperties.enableAbilityMessages)
@@ -276,10 +275,10 @@ public class Skills
}
if(mcPermissions.getInstance().unarmedAbility(player) && player.getItemInHand().getTypeId() == 0 && !PP.getFistsPreparationMode())
{
if(!PP.getBerserkMode() && !cooldownOver(player, (PP.getBerserkDeactivatedTimeStamp()*1000), LoadProperties.berserkCooldown))
if(!PP.getBerserkMode() && !cooldownOver(player, (PP.getSkillDATS(AbilityType.BERSERK)*1000), LoadProperties.berserkCooldown))
{
player.sendMessage(mcLocale.getString("Skills.TooTired")
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getBerserkDeactivatedTimeStamp()*1000), LoadProperties.berserkCooldown)+"s)");
+ChatColor.YELLOW+" ("+calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.BERSERK)*1000), LoadProperties.berserkCooldown)+"s)");
return;
}
if(LoadProperties.enableAbilityMessages)

View File

@@ -27,6 +27,7 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@@ -50,7 +51,7 @@ public class Swords
ticks++;
}
if(!PP.getSerratedStrikesMode() && PP.getSerratedStrikesDeactivatedTimeStamp() < System.currentTimeMillis())
if(!PP.getSerratedStrikesMode() && PP.getSkillDATS(AbilityType.SERRATED_STRIKES) < System.currentTimeMillis())
{
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOn"));
for(Player y : player.getWorld().getPlayers())
@@ -58,8 +59,7 @@ public class Swords
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.SerratedStrikesPlayer", new Object[] {player.getName()}));
}
PP.setSerratedStrikesActivatedTimeStamp(System.currentTimeMillis());
PP.setSerratedStrikesDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.SERRATED_STRIKES, System.currentTimeMillis()+(ticks*1000));
PP.setSerratedStrikesMode(true);
}
@@ -84,7 +84,7 @@ public class Swords
if(mcPermissions.getInstance().swords(attacker) && m.isSwords(attacker.getItemInHand())){
if(PPa.getSkillLevel(SkillType.SWORDS) >= 750)
{
if(Math.random() * 1000 >= 750)
if(Math.random() * 1000 <= 750)
{
if(!(x instanceof Player))
pluginx.misc.addToBleedQue(x);
@@ -118,59 +118,54 @@ public class Swords
LivingEntity x = (LivingEntity) event.getEntity();
targets = m.getTier(attacker);
for(Entity derp : x.getWorld().getEntities())
for(Entity derp : x.getNearbyEntities(2.5, 2.5, 2.5))
{
if(m.getDistance(x.getLocation(), derp.getLocation()) < 5)
{
//Make sure the Wolf is not friendly
if(derp instanceof Wolf)
//Make sure the Wolf is not friendly
if(derp instanceof Wolf)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
//Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1)
{
if(derp instanceof Player)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
}
//Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1)
{
if(derp instanceof Player)
{
Player target = (Player)derp;
if(target.getName().equals(attacker.getName()))
continue;
if(Users.getProfile(target).getGodMode())
continue;
if(Party.getInstance().inSameParty(attacker, target))
continue;
if(targets >= 1 && derp.getWorld().getPVP())
{
Combat.dealDamage(target, event.getDamage() / 4, attacker);
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
Users.getProfile(target).addBleedTicks(5);
targets--;
continue;
}
}
else
{
if(!pluginx.misc.bleedTracker.contains(derp))
pluginx.misc.addToBleedQue((LivingEntity)derp);
LivingEntity target = (LivingEntity)derp;
Player target = (Player)derp;
if(target.getName().equals(attacker.getName()))
continue;
if(Users.getProfile(target).getGodMode())
continue;
if(Party.getInstance().inSameParty(attacker, target))
continue;
if(targets >= 1 && derp.getWorld().getPVP())
{
Combat.dealDamage(target, event.getDamage() / 4, attacker);
targets--;
}
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
Users.getProfile(target).addBleedTicks(5);
targets--;
continue;
}
}
else
{
if(!pluginx.misc.bleedTracker.contains(derp))
pluginx.misc.addToBleedQue((LivingEntity)derp);
LivingEntity target = (LivingEntity)derp;
Combat.dealDamage(target, event.getDamage() / 4, attacker);
targets--;
}
}
}
}
}
}
}
}
public static void counterAttackChecks(EntityDamageByEntityEvent event)
{

View File

@@ -18,12 +18,12 @@ package com.gmail.nossr50.skills;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.block.Block;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@@ -38,14 +38,17 @@ public class Unarmed {
{
PP.setFistsPreparationMode(false);
}
int ticks = 2;
int x = PP.getSkillLevel(SkillType.UNARMED);
while(x >= 50){
while(x >= 50)
{
x-=50;
ticks++;
}
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getBerserkDeactivatedTimeStamp(), LoadProperties.berserkCooldown))
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.BERSERK), LoadProperties.berserkCooldown))
{
player.sendMessage(mcLocale.getString("Skills.BerserkOn"));
for(Player y : player.getWorld().getPlayers())
@@ -53,8 +56,8 @@ public class Unarmed {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
}
PP.setBerserkActivatedTimeStamp(System.currentTimeMillis());
PP.setBerserkDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.BERSERK, System.currentTimeMillis()+(ticks*1000));
System.out.println("getSkillDATS(): "+PP.getSkillDATS(AbilityType.BERSERK));
PP.setBerserkMode(true);
}
}

View File

@@ -23,13 +23,13 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Statistic;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.Bukkit;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
@@ -50,7 +50,7 @@ public class WoodCutting
Material mat = Material.getMaterial(block.getTypeId());
if(player != null)
{
if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)) || PP.getSkillLevel(SkillType.WOODCUTTING) > 1000)
if(PP.getSkillLevel(SkillType.WOODCUTTING) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)))
{
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
m.mcDropItem(block.getLocation(), item);
@@ -82,7 +82,7 @@ public class WoodCutting
ticks++;
}
if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown))
if(!PP.getTreeFellerMode() && Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown))
{
player.sendMessage(mcLocale.getString("Skills.TreeFellerOn"));
for(Player y : player.getWorld().getPlayers())
@@ -90,13 +90,12 @@ public class WoodCutting
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
}
PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
PP.setSkillDATS(AbilityType.TREE_FELLER, System.currentTimeMillis()+(ticks*1000));
PP.setTreeFellerMode(true);
}
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)){
if(!PP.getTreeFellerMode() && !Skills.cooldownOver(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown)){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again."
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getTreeFellerDeactivatedTimeStamp()*1000), LoadProperties.treeFellerCooldown)+"s)");
+ChatColor.YELLOW+" ("+Skills.calculateTimeLeft(player, (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000), LoadProperties.treeFellerCooldown)+"s)");
}
}
}

View File

@@ -119,6 +119,8 @@ Skills:
Level_Cap: 0
Green_Thumb:
Cobble_To_Mossy: true
SmoothBrick_To_MossyBrick: true
Dirt_To_Grass: true
Mining:
Level_Cap: 0
Requires_Pickaxe: true
@@ -255,6 +257,8 @@ General:
Enabled: true
MOTD:
Enabled: true
#Amount of time (in minutes) to wait between saves of player information
Save_Interval: 10
Excavation:
Drops:
Cake: true