Compare commits
189 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70756c2a2e | ||
|
|
3d60c057ea | ||
|
|
105b8b5a91 | ||
|
|
9278ca4d27 | ||
|
|
d97e97ae5f | ||
|
|
5cbee8a4ab | ||
|
|
fe9db6c9ad | ||
|
|
a4845abc45 | ||
|
|
470b29eeca | ||
|
|
f87f7f6feb | ||
|
|
5e8a8aac53 | ||
|
|
2672e218f4 | ||
|
|
02a728bdea | ||
|
|
3a812612de | ||
|
|
4fdbce24d7 | ||
|
|
52458041f0 | ||
|
|
4a1e5a0dcc | ||
|
|
f6c7ac6d98 | ||
|
|
76675422ea | ||
|
|
7dee6db362 | ||
|
|
e8030c59f1 | ||
|
|
4b642d4953 | ||
|
|
346b7862af | ||
|
|
3ec661cc02 | ||
|
|
d7f066b07e | ||
|
|
e54500fa90 | ||
|
|
a2c83425f2 | ||
|
|
41ce19b835 | ||
|
|
9c11a6ffb0 | ||
|
|
e36cd8109d | ||
|
|
ee83e93269 | ||
|
|
0b4692e303 | ||
|
|
e99b5a4abf | ||
|
|
a419c4d4fe | ||
|
|
ca80a7d463 | ||
|
|
716e6296e5 | ||
|
|
6382bec05a | ||
|
|
20248212ae | ||
|
|
86e373b493 | ||
|
|
b4b0bbd081 | ||
|
|
17bacbf9d6 | ||
|
|
b869fb0ca5 | ||
|
|
c70a23dd5c | ||
|
|
f9e7ae22f2 | ||
|
|
30fb2770a6 | ||
|
|
11e1dc7ec8 | ||
|
|
5645c29dd8 | ||
|
|
44e954efeb | ||
|
|
4ffb20f3bb | ||
|
|
716dd02b3f | ||
|
|
5e93a4c9d3 | ||
|
|
cbeb994b69 | ||
|
|
43e3dd7977 | ||
|
|
598c507849 | ||
|
|
0b30920edd | ||
|
|
6cfd81faf9 | ||
|
|
cc9a6aa9b9 | ||
|
|
c8ff58bb6c | ||
|
|
dc77d9f434 | ||
|
|
7c87fc8316 | ||
|
|
0068a3f07a | ||
|
|
bb70289cb3 | ||
|
|
80abd0db91 | ||
|
|
bbef731be5 | ||
|
|
897f4d3694 | ||
|
|
2c380f609e | ||
|
|
aa9fe544a2 | ||
|
|
230435c29d | ||
|
|
4a2325f244 | ||
|
|
d920702389 | ||
|
|
16d56a45f2 | ||
|
|
3e62697567 | ||
|
|
219372212e | ||
|
|
3d401ac4cb | ||
|
|
20adf4674a | ||
|
|
20fb69fba3 | ||
|
|
173c2c19c8 | ||
|
|
66ac83ed9a | ||
|
|
595d48d1b4 | ||
|
|
ddbb0176e7 | ||
|
|
68da48e19f | ||
|
|
c001bb8d2c | ||
|
|
f3ffbe1ad1 | ||
|
|
b80c73e251 | ||
|
|
892f4935ae | ||
|
|
cb3904246c | ||
|
|
47ed176191 | ||
|
|
151c9ba1d4 | ||
|
|
81ab8692ad | ||
|
|
123e96e39d | ||
|
|
b4a3ddba3c | ||
|
|
2b85ed01ea | ||
|
|
c99fce9143 | ||
|
|
ade31de797 | ||
|
|
b8f4b6e2da | ||
|
|
c95d2a9b84 | ||
|
|
ceca881cd5 | ||
|
|
6b668f5ac8 | ||
|
|
618f075ff2 | ||
|
|
7841fe2434 | ||
|
|
16577f6f23 | ||
|
|
43731bd9f9 | ||
|
|
0ca57f479b | ||
|
|
00d8ed9ec7 | ||
|
|
3fcfde1697 | ||
|
|
e3d04fd940 | ||
|
|
0f41381c98 | ||
|
|
5b3c176192 | ||
|
|
64e6ea86fd | ||
|
|
5404fc8703 | ||
|
|
7693662cea | ||
|
|
388fd364ac | ||
|
|
fdb96a2cf8 | ||
|
|
e82d5db4b3 | ||
|
|
563baea812 | ||
|
|
3613cbd48b | ||
|
|
f937e44018 | ||
|
|
2c7730b478 | ||
|
|
50af20037a | ||
|
|
b7955ea29e | ||
|
|
7cefdedea2 | ||
|
|
647078778d | ||
|
|
61c6cd1b55 | ||
|
|
96a395af23 | ||
|
|
2297c3e0f6 | ||
|
|
401af172ae | ||
|
|
ddf7920c4d | ||
|
|
c46d900833 | ||
|
|
bc9b089a53 | ||
|
|
e68092cae4 | ||
|
|
1aa231c902 | ||
|
|
63d9b30d14 | ||
|
|
b695f9ed27 | ||
|
|
f3283de8dd | ||
|
|
e69c2fd68e | ||
|
|
d1ce5f0be5 | ||
|
|
5b45ea3739 | ||
|
|
6f95d6b60d | ||
|
|
3552b756e0 | ||
|
|
0b5a60e4c6 | ||
|
|
01bbd9bcac | ||
|
|
a61efae527 | ||
|
|
3fef87923a | ||
|
|
c8869c86be | ||
|
|
42ddf648b1 | ||
|
|
fded7cad96 | ||
|
|
23354ce049 | ||
|
|
299f440f63 | ||
|
|
9bd4a0a707 | ||
|
|
7c60217882 | ||
|
|
725056d88d | ||
|
|
f93efe54a5 | ||
|
|
59e6d9781f | ||
|
|
7d19fe68d9 | ||
|
|
486fb5635d | ||
|
|
dfe2d0a585 | ||
|
|
71aac4ea7d | ||
|
|
e1399427f0 | ||
|
|
80cc22efff | ||
|
|
5863efbdd8 | ||
|
|
85fe839e91 | ||
|
|
7e7505381b | ||
|
|
aadfb22f00 | ||
|
|
e0b0fd1d80 | ||
|
|
ff9b6fd98a | ||
|
|
ce3fe8fd21 | ||
|
|
93502810e8 | ||
|
|
ac51683161 | ||
|
|
802be6907d | ||
|
|
3932036a2c | ||
|
|
fd1064a9b9 | ||
|
|
f0146d99c2 | ||
|
|
fa98de77b1 | ||
|
|
328c7d4b5f | ||
|
|
984dbd9b7a | ||
|
|
1cfdfab2b7 | ||
|
|
17d584f911 | ||
|
|
0dddc5a1f7 | ||
|
|
b5c11de15c | ||
|
|
96acb4df97 | ||
|
|
75cf202987 | ||
|
|
fd3cee96f0 | ||
|
|
aee71789f2 | ||
|
|
da9a4b80e4 | ||
|
|
523db7f0a2 | ||
|
|
b3782eddc3 | ||
|
|
1168d363a6 | ||
|
|
2854511252 | ||
|
|
6970174503 |
36
.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
|
||||
# we use maven!
|
||||
/build.xml
|
||||
|
||||
# maven
|
||||
/target
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
||||
# various other potential build files
|
||||
/build
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
|
||||
/world
|
||||
|
||||
# Mac filesystem dust
|
||||
/.DS_Store
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Project Stuff
|
||||
/src/main/resources/mcMMO
|
||||
@@ -1,5 +1,60 @@
|
||||
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)
|
||||
- Fixed typo with repairing Leather Armor & Bows
|
||||
- Fixed issue with Silk Touch & Double/Triple drops not working properly
|
||||
- Fixed conflict with NoCheat plugin & Super Breaker/Giga Drill Breaker/Berserk/Leaf Blower (Issue #104)
|
||||
- Fixed counter-attacking non-LivingEntity (Issue #100 & Issue #107)
|
||||
- Fixed various bugs with Leaf Blower
|
||||
- Added Monitor & ignoreCancelledEvents to onBlockPlace
|
||||
- Made Anvil ID configurable
|
||||
|
||||
Version 1.2.09
|
||||
- Fixed issue with Repair Mastery (Issue #47)
|
||||
- Made Arcane Forging fully configurable (Pull Request #52)
|
||||
- Made Fishing configurable (Pull Request #60)
|
||||
- Changed timer to be a bit more efficient (Issue #19)
|
||||
- Changed to fire EntityDamageEvents for all damage done by mcMMO
|
||||
- New custom event for developers McMMOPlayerLevelUpEvent
|
||||
- New custom event for developers McMMOItemSpawnEvent
|
||||
- Changed LoadProperties from the old Configuration to FileConfiguration
|
||||
- Removed aliasing from config.yml
|
||||
- Fixed mining procs from Super Break & Silk Touch
|
||||
- Unused smelt property removed
|
||||
- Minor optimizations
|
||||
- Fix for setting properly block damage values
|
||||
- Initial skill level capping added
|
||||
- Initial command alias framework added
|
||||
- Fixed abilities not handling Unbreaking items
|
||||
- Fix for treefeller glitch
|
||||
- Super secret anniversary easter egg!
|
||||
|
||||
Version 1.2.08
|
||||
- Changed Bukkit events to new event system
|
||||
- Changed aliasing to send both the mcmmo command and the command used.
|
||||
- Changes in combat exp (Pull Request #49)
|
||||
- Repair for bows & leather armor (Pull Request #46)
|
||||
- Fixed missing images (Pull Request #45)
|
||||
- POM Changes for dependencies (Pull Request #36)
|
||||
- Fishing & Repair fixes (Pull Request #31)
|
||||
- Fixed CraftOfflinePlayer issue (Issue #212) errors for offline wolf owners
|
||||
- Pull in commit from @NuclearW for issue from previous commit
|
||||
|
||||
Version 1.2.07
|
||||
Fixed mctop not working at all (whoops!)
|
||||
Fixed problem with multithreading in mcMMO causing errors
|
||||
|
||||
346
LICENSE
Normal 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.
|
||||
@@ -1,27 +1,24 @@
|
||||
== mcMMO
|
||||
**The RPG lovers mod**
|
||||
|
||||
=== Brief Description
|
||||
mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
|
||||
|
||||
If you want an original RPG experience like no other mod out there, mcMMO is for you.
|
||||
|
||||
=== About the Developer
|
||||
I've always wanted to make games and in the last year I decided to take a swing at developing Minecraft mods as a platform to teach myself programming, the biggest project I have made to date is mcMMO. I went from knowing nothing about Java to what I know now purely from modding Minecraft, and I plan to move onto game development in the not so distant future.
|
||||
|
||||
I take design very seriously, I am not the kind of person who can be satisfied giving a project anything less than my all. As you will see reflected in the quality of the mods I make, I take great care in my work.
|
||||
|
||||
Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod has become a joy, I really can't believe how popular my mod has gotten!
|
||||
|
||||
=== Compiling
|
||||
|
||||
Required Libraries:
|
||||
* CraftBukkit
|
||||
* Spout API
|
||||
* Permissions
|
||||
* PermissionsEx
|
||||
|
||||
Required to Run:
|
||||
* Bukkit
|
||||
|
||||
== mcMMO
|
||||
**The RPG lovers mod**
|
||||
|
||||
=== Brief Description
|
||||
mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
|
||||
|
||||
If you want an original RPG experience like no other mod out there, mcMMO is for you.
|
||||
|
||||
=== About the Developer
|
||||
I've always wanted to make games and in the last year I decided to take a swing at developing Minecraft mods as a platform to teach myself programming, the biggest project I have made to date is mcMMO. I went from knowing nothing about Java to what I know now purely from modding Minecraft, and I plan to move onto game development in the not so distant future.
|
||||
|
||||
I take design very seriously, I am not the kind of person who can be satisfied giving a project anything less than my all. As you will see reflected in the quality of the mods I make, I take great care in my work.
|
||||
|
||||
Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod has become a joy, I really can't believe how popular my mod has gotten!
|
||||
|
||||
=== Compiling
|
||||
|
||||
Required Libraries:
|
||||
* Spout API
|
||||
|
||||
Required to Run:
|
||||
* Bukkit
|
||||
|
||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||
74
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.2.07</version>
|
||||
<version>1.2.11</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/TheYeti/mcMMO</url>
|
||||
<issueManagement>
|
||||
@@ -18,18 +18,49 @@
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>resources</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/xpbar/</directory>
|
||||
<includes>
|
||||
<include>xpbar*.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>resources</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/healthbar/</directory>
|
||||
<includes>
|
||||
<include>health*.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>resources</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/skillicon/</directory>
|
||||
<includes>
|
||||
<include>*.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>resources</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources/sound/</directory>
|
||||
<includes>
|
||||
<include>*.wav</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>com/gmail/nossr50/locale</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/locale/</directory>
|
||||
<includes>
|
||||
<include>locale*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -62,38 +93,27 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.getspout.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.0.1-R2-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.0.1-R2-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nijikokun.bukkit</groupId>
|
||||
<artifactId>Permissions</artifactId>
|
||||
<version>3.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.tehkode</groupId>
|
||||
<artifactId>PermissionsEx</artifactId>
|
||||
<version>1.18</version>
|
||||
<version>1.1-R4-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.getspout</groupId>
|
||||
<artifactId>spoutplugin</artifactId>
|
||||
<artifactId>spoutpluginapi</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@@ -59,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);
|
||||
@@ -68,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);
|
||||
@@ -79,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));
|
||||
@@ -106,9 +108,13 @@ public class Combat
|
||||
int hpLeft = defender.getHealth(), xpinc = 0;
|
||||
|
||||
if(hpLeft < event.getDamage())
|
||||
{
|
||||
if(hpLeft > 0)
|
||||
xpinc = hpLeft;
|
||||
else
|
||||
xpinc = 0;
|
||||
} else
|
||||
xpinc = event.getDamage();
|
||||
else
|
||||
xpinc = hpLeft;
|
||||
|
||||
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
|
||||
|
||||
@@ -352,17 +358,47 @@ public class Combat
|
||||
Skills.XpCheckSkill(SkillType.ARCHERY, attacker);
|
||||
}
|
||||
}
|
||||
public static void dealDamage(Entity target, int dmg){
|
||||
if(target instanceof Player){
|
||||
((Player) target).damage(dmg);
|
||||
}
|
||||
if(target instanceof Animals){
|
||||
((Animals) target).damage(dmg);
|
||||
}
|
||||
if(target instanceof Monster){
|
||||
((Monster) target).damage(dmg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason CUSTOM
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg){
|
||||
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason cause
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param cause DamageCause to pass to damage event
|
||||
*/
|
||||
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
|
||||
EntityDamageEvent ede = new EntityDamageEvent(target, cause, dmg);
|
||||
Bukkit.getPluginManager().callEvent(ede);
|
||||
if(ede.isCancelled()) return;
|
||||
|
||||
target.damage(ede.getDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
|
||||
*
|
||||
* @param target LivingEntity which to attempt to damage
|
||||
* @param dmg Amount of damage to attempt to do
|
||||
* @param attacker Player to pass to event as damager
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
public static boolean pvpAllowed(EntityDamageByEntityEvent event, World world)
|
||||
{
|
||||
if(!event.getEntity().getWorld().getPVP())
|
||||
@@ -377,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 = event.getDamage();
|
||||
else
|
||||
xpinc = hpLeft;
|
||||
if(hpLeft < event.getDamage())
|
||||
{
|
||||
if(hpLeft > 0)
|
||||
xpinc = hpLeft;
|
||||
else
|
||||
xpinc = 0;
|
||||
}
|
||||
else
|
||||
xpinc = event.getDamage();
|
||||
|
||||
if(entity instanceof Animals)
|
||||
{
|
||||
@@ -413,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;
|
||||
|
||||
@@ -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,14 +60,12 @@ 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;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3) {
|
||||
@@ -78,7 +81,7 @@ public class AddxpCommand implements CommandExecutor {
|
||||
Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player);
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -36,7 +41,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 2) {
|
||||
System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue");
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
} else if (args.length == 3) {
|
||||
if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) {
|
||||
@@ -45,13 +50,12 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + ".");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue");
|
||||
System.out.println("Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||
@@ -59,7 +63,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 3) {
|
||||
@@ -75,7 +79,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
player.sendMessage(ChatColor.RED + args[0] + " has been modified.");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -30,15 +30,23 @@ 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 /" + LoadProperties.whois + " <playername>");
|
||||
player.sendMessage(ChatColor.RED + "Proper usage is /whois <playername>");
|
||||
return true;
|
||||
}
|
||||
// if split[1] is a player
|
||||
|
||||
@@ -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[] {LoadProperties.xprate}));
|
||||
System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.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[] {LoadProperties.xprate}));
|
||||
player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.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"))
|
||||
{
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -29,44 +29,44 @@ public class MccCommand implements CommandExecutor {
|
||||
|
||||
if (mcPermissions.getInstance().party(player)) {
|
||||
player.sendMessage(mcLocale.getString("m.mccPartyCommands"));
|
||||
player.sendMessage(LoadProperties.party + " " + mcLocale.getString("m.mccParty"));
|
||||
player.sendMessage(LoadProperties.party + " q " + mcLocale.getString("m.mccPartyQ"));
|
||||
player.sendMessage("/party " + mcLocale.getString("m.mccParty"));
|
||||
player.sendMessage("/party q " + mcLocale.getString("m.mccPartyQ"));
|
||||
|
||||
if (mcPermissions.getInstance().partyChat(player))
|
||||
player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle"));
|
||||
|
||||
player.sendMessage(LoadProperties.invite + " " + mcLocale.getString("m.mccPartyInvite"));
|
||||
player.sendMessage(LoadProperties.accept + " " + mcLocale.getString("m.mccPartyAccept"));
|
||||
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite"));
|
||||
player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept"));
|
||||
|
||||
if (mcPermissions.getInstance().partyTeleport(player))
|
||||
player.sendMessage(LoadProperties.ptp + " " + mcLocale.getString("m.mccPartyTeleport"));
|
||||
player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport"));
|
||||
}
|
||||
player.sendMessage(mcLocale.getString("m.mccOtherCommands"));
|
||||
player.sendMessage(LoadProperties.stats + ChatColor.RED + " " + mcLocale.getString("m.mccStats"));
|
||||
player.sendMessage("/stats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats"));
|
||||
player.sendMessage("/mctop <skillname> <page> " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards"));
|
||||
|
||||
if (mcPermissions.getInstance().mySpawn(player)) {
|
||||
player.sendMessage(LoadProperties.myspawn + " " + ChatColor.RED + mcLocale.getString("m.mccMySpawn"));
|
||||
player.sendMessage(LoadProperties.clearmyspawn + " " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn"));
|
||||
player.sendMessage("/myspawn " + ChatColor.RED + mcLocale.getString("m.mccMySpawn"));
|
||||
player.sendMessage("/clearmyspawn " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn"));
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().mcAbility(player))
|
||||
player.sendMessage(LoadProperties.mcability + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));
|
||||
player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility"));
|
||||
|
||||
if (mcPermissions.getInstance().adminChat(player))
|
||||
player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle"));
|
||||
|
||||
if (mcPermissions.getInstance().whois(player))
|
||||
player.sendMessage(LoadProperties.whois + " " + mcLocale.getString("m.mccWhois"));
|
||||
player.sendMessage("/whois " + mcLocale.getString("m.mccWhois"));
|
||||
|
||||
if (mcPermissions.getInstance().mmoedit(player))
|
||||
player.sendMessage(LoadProperties.mmoedit + mcLocale.getString("m.mccMmoedit"));
|
||||
player.sendMessage("/mmoedit" + mcLocale.getString("m.mccMmoedit"));
|
||||
|
||||
if (mcPermissions.getInstance().mcgod(player))
|
||||
player.sendMessage(LoadProperties.mcgod + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod"));
|
||||
player.sendMessage("/mcgod" + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod"));
|
||||
|
||||
player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
|
||||
player.sendMessage(LoadProperties.mcmmo + " " + mcLocale.getString("m.mccModDescription"));
|
||||
player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
@@ -12,6 +11,7 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!LoadProperties.mcmmoEnable) {
|
||||
@@ -27,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[] { LoadProperties.mcc });
|
||||
String description = mcLocale.getString("mcMMO.Description", new Object[] { "mcc" });
|
||||
String[] mcSplit = description.split(",");
|
||||
|
||||
for (String x : mcSplit) {
|
||||
@@ -37,10 +37,10 @@ public class McmmoCommand implements CommandExecutor {
|
||||
if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) {
|
||||
SpoutPlayer sPlayer = (SpoutPlayer) player;
|
||||
if (LoadProperties.donateMessage)
|
||||
sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
|
||||
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: nossr50@gmail.com");
|
||||
player.sendMessage(ChatColor.GREEN + "If you like my work you can donate via Paypal: theno1yeti@gmail.com");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ 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;
|
||||
|
||||
@@ -43,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;
|
||||
}
|
||||
@@ -59,8 +62,9 @@ public class ACommand implements CommandExecutor {
|
||||
aMessage = aMessage + " " + args[i];
|
||||
}
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + player.getDisplayName() + "> " + aMessage);
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
|
||||
log.log(Level.INFO, "[A]<" + name + "> " + aMessage);
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (mcPermissions.getInstance().adminChat(herp) || herp.isOp())
|
||||
herp.sendMessage(aPrefix + aMessage);
|
||||
@@ -68,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class InviteCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.invite + " <playername>");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /invite <playername>");
|
||||
return true;
|
||||
}
|
||||
if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) {
|
||||
@@ -61,7 +61,7 @@ public class InviteCommand implements CommandExecutor {
|
||||
// target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName());
|
||||
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() }));
|
||||
// target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite");
|
||||
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { LoadProperties.accept }));
|
||||
target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "/accept" }));
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("Party.Locked"));
|
||||
return true;
|
||||
|
||||
@@ -69,9 +69,10 @@ public class PCommand implements CommandExecutor {
|
||||
for (int i = 1; i <= args.length - 1; i++) {
|
||||
pMessage = pMessage + " " + args[i];
|
||||
}
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") ";
|
||||
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + player.getDisplayName() + "> " + pMessage);
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") ";
|
||||
log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + name + "> " + pMessage);
|
||||
|
||||
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (Users.getProfile(herp).inParty()) {
|
||||
|
||||
@@ -42,9 +42,9 @@ public class PartyCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args.length == 0 && !PP.inParty()) {
|
||||
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "/party "}));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party "}));
|
||||
player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "/party " }));
|
||||
return true;
|
||||
} else if (args.length == 0 && PP.inParty()) {
|
||||
String tempList = "";
|
||||
@@ -81,13 +81,13 @@ public class PartyCommand implements CommandExecutor {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("?")) {
|
||||
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { LoadProperties.party }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "/party " }));
|
||||
player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "/party " }));
|
||||
} else if (args[0].equalsIgnoreCase("lock")) {
|
||||
if (PP.inParty()) {
|
||||
if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.ptp + " <playername>");
|
||||
player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
|
||||
return true;
|
||||
}
|
||||
if (plugin.getServer().getPlayer(args[0]) == null) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -31,10 +32,11 @@ public class Misc
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public ArrayList<Entity> mobSpawnerList = new ArrayList<Entity>();
|
||||
public ArrayList<Block> blockWatchList = new ArrayList<Block>();
|
||||
public HashSet<Block> blockWatchList = new HashSet<Block>();
|
||||
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
|
||||
|
||||
11
src/main/java/com/gmail/nossr50/datatypes/AbilityType.java
Normal 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;
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
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.Location;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Called when mcMMO is preparing to drop an item
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
private Location location;
|
||||
private ItemStack itemStack;
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOItemSpawnEvent(Location location, ItemStack itemStack) {
|
||||
this.location = location;
|
||||
this.itemStack = itemStack;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Location where the item will be dropped
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location Location where to drop the item
|
||||
*/
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ItemStack that will be dropped
|
||||
*/
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemStack ItemStack to drop
|
||||
*/
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
/**
|
||||
* Called when a user levels up in a skill
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class McMMOPlayerLevelUpEvent extends Event {
|
||||
private Player player;
|
||||
private SkillType skill;
|
||||
private int levelsGained;
|
||||
|
||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill) {
|
||||
this.player = player;
|
||||
this.skill = skill;
|
||||
this.levelsGained = 1; // Always 1 for now as we call in the loop where the levelups are calculated, could change later!
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Player leveling up
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SkillType that is being leveled up
|
||||
*/
|
||||
public SkillType getSkill() {
|
||||
return skill;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of levels gained in this event
|
||||
*/
|
||||
public int getLevelsGained() {
|
||||
return levelsGained;
|
||||
}
|
||||
|
||||
/** 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -25,16 +25,22 @@ import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
|
||||
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;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
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;
|
||||
@@ -43,8 +49,7 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.skills.*;
|
||||
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||
|
||||
|
||||
public class mcBlockListener extends BlockListener
|
||||
public class mcBlockListener implements Listener
|
||||
{
|
||||
private final mcMMO plugin;
|
||||
|
||||
@@ -53,12 +58,16 @@ public class mcBlockListener extends BlockListener
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
{
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
//Setup some basic vars
|
||||
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)
|
||||
{
|
||||
@@ -69,16 +78,32 @@ public class mcBlockListener extends BlockListener
|
||||
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))
|
||||
{
|
||||
if(block.getTypeId() != 17 && block.getTypeId() != 39 && block.getTypeId() != 40 && block.getTypeId() != 91 && block.getTypeId() != 86)
|
||||
block.setData((byte) 5); //Change the byte
|
||||
else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86)
|
||||
int id = block.getTypeId();
|
||||
|
||||
//Only needed for blocks that use their block data (wood, pumpkins, etc.)
|
||||
if (id == 17 || id == 73 || id == 74 || id == 81 || id == 83 || id == 86 || id == 91 || id == 106 || id == 98)
|
||||
plugin.misc.blockWatchList.add(block);
|
||||
else {
|
||||
//block.setData((byte) 5); //Change the byte
|
||||
//The following is a method to get around a breakage in 1.1-R2 and onward
|
||||
//it should be removed as soon as functionality to change a block
|
||||
//in this event returns.
|
||||
plugin.changeQueue.push(block);
|
||||
}
|
||||
}
|
||||
|
||||
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)
|
||||
if(block.getTypeId() == LoadProperties.anvilID && LoadProperties.anvilmessages)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(LoadProperties.spoutEnabled)
|
||||
@@ -111,7 +136,8 @@ public class mcBlockListener extends BlockListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
@@ -127,6 +153,12 @@ public class mcBlockListener extends BlockListener
|
||||
* 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)
|
||||
{
|
||||
@@ -144,60 +176,38 @@ public class mcBlockListener extends BlockListener
|
||||
/*
|
||||
* MINING
|
||||
*/
|
||||
|
||||
if(mcPermissions.getInstance().mining(player))
|
||||
{
|
||||
if(LoadProperties.miningrequirespickaxe)
|
||||
{
|
||||
if(m.isMiningPick(inhand))
|
||||
{
|
||||
Mining.miningBlockCheck(false, player, block, plugin);
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
}
|
||||
} else
|
||||
{
|
||||
Mining.miningBlockCheck(false, player, block, plugin);
|
||||
Mining.miningBlockCheck(player, block, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WOOD CUTTING
|
||||
*/
|
||||
|
||||
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player))
|
||||
if(mcPermissions.getInstance().woodcutting(player))
|
||||
{
|
||||
if(LoadProperties.woodcuttingrequiresaxe)
|
||||
{
|
||||
if(m.isAxes(inhand))
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
WoodCutting.woodCuttingProcCheck(player, block);
|
||||
//Default
|
||||
if(block.getData() == (byte)0)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player);
|
||||
//Spruce
|
||||
if(block.getData() == (byte)1)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player);
|
||||
//Birch
|
||||
if(block.getData() == (byte)2)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player);
|
||||
}
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
WoodCutting.woodCuttingProcCheck(player, block);
|
||||
//Default
|
||||
if(block.getData() == (byte)0)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player);
|
||||
//Spruce
|
||||
if(block.getData() == (byte)1)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player);
|
||||
//Birch
|
||||
if(block.getData() == (byte)2)
|
||||
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player);
|
||||
}
|
||||
WoodCutting.woodcuttingBlockCheck(player, block, plugin);
|
||||
}
|
||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||
|
||||
/*
|
||||
* IF PLAYER IS USING TREEFELLER
|
||||
@@ -222,7 +232,7 @@ public class mcBlockListener extends BlockListener
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||
if(blockx.getTypeId() == 17)
|
||||
{
|
||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||
m.mcDropItem(blockx.getLocation(), item);
|
||||
//XP WOODCUTTING
|
||||
if(!plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
@@ -234,10 +244,10 @@ public class mcBlockListener extends BlockListener
|
||||
{
|
||||
mat = Material.SAPLING;
|
||||
|
||||
item = new ItemStack(mat, 1, (short)0, blockx.getData());
|
||||
item = new ItemStack(mat, 1, (short)0, (byte)(blockx.getData()-8));
|
||||
|
||||
if(Math.random() * 10 > 9)
|
||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||
m.mcDropItem(blockx.getLocation(), item);
|
||||
}
|
||||
if(blockx.getType() != Material.AIR)
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||
@@ -245,7 +255,10 @@ public class mcBlockListener extends BlockListener
|
||||
}
|
||||
}
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
}
|
||||
plugin.misc.treeFeller.clear();
|
||||
}
|
||||
}
|
||||
@@ -253,7 +266,7 @@ public class mcBlockListener extends BlockListener
|
||||
* EXCAVATION
|
||||
*/
|
||||
if(Excavation.canBeGigaDrillBroken(block) && mcPermissions.getInstance().excavation(player) && block.getData() != (byte) 5)
|
||||
Excavation.excavationProcCheck(block.getData(), block.getType(), block.getLocation(), player);
|
||||
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||
/*
|
||||
* HERBALISM
|
||||
*/
|
||||
@@ -274,7 +287,8 @@ public class mcBlockListener extends BlockListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBlockDamage(BlockDamageEvent event)
|
||||
{
|
||||
if(event.isCancelled())
|
||||
@@ -283,8 +297,6 @@ public class mcBlockListener extends BlockListener
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
ItemStack inhand = player.getItemInHand();
|
||||
Block block = event.getBlock();
|
||||
|
||||
Skills.monitorSkills(player);
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
@@ -317,49 +329,21 @@ public class mcBlockListener extends BlockListener
|
||||
/*
|
||||
* GIGA DRILL BREAKER CHECKS
|
||||
*/
|
||||
if(PP.getGigaDrillBreakerMode() && m.blockBreakSimulate(block, player)
|
||||
&& Excavation.canBeGigaDrillBroken(block) && m.isShovel(inhand))
|
||||
{
|
||||
int x = 0;
|
||||
|
||||
while(x < 3)
|
||||
if(PP.getGigaDrillBreakerMode()
|
||||
&& Excavation.canBeGigaDrillBroken(block)
|
||||
&& m.blockBreakSimulate(block, player)
|
||||
&& mcPermissions.getInstance().excavationAbility(player))
|
||||
{
|
||||
if(LoadProperties.excavationRequiresShovel)
|
||||
{
|
||||
if(block.getData() != (byte)5)
|
||||
Excavation.excavationProcCheck(block.getData(), block.getType(), block.getLocation(), player);
|
||||
x++;
|
||||
if(m.isShovel(inhand)){
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
} else {
|
||||
event.setInstaBreak(true);
|
||||
Excavation.gigaDrillBreaker(player, block);
|
||||
}
|
||||
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
|
||||
if(block.getType() == Material.GRASS)
|
||||
mat = Material.DIRT;
|
||||
if(block.getType() == Material.CLAY)
|
||||
mat = Material.CLAY_BALL;
|
||||
|
||||
byte type = block.getData();
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||
|
||||
block.setType(Material.AIR);
|
||||
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
|
||||
if(item.getType() == Material.CLAY_BALL)
|
||||
{
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
} else
|
||||
{
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
}
|
||||
|
||||
//Spout stuff
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
/*
|
||||
* BERSERK MODE CHECKS
|
||||
@@ -367,78 +351,66 @@ public class mcBlockListener extends BlockListener
|
||||
if(PP.getBerserkMode()
|
||||
&& m.blockBreakSimulate(block, player)
|
||||
&& player.getItemInHand().getTypeId() == 0
|
||||
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
|
||||
&& (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)
|
||||
&& mcPermissions.getInstance().unarmedAbility(player))
|
||||
{
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
|
||||
if(block.getTypeId() == 2)
|
||||
mat = Material.DIRT;
|
||||
if(block.getTypeId() == 78)
|
||||
mat = Material.SNOW_BALL;
|
||||
if(block.getTypeId() == 82)
|
||||
mat = Material.CLAY_BALL;
|
||||
|
||||
byte type = block.getData();
|
||||
event.setInstaBreak(true);
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||
|
||||
block.setType(Material.AIR);
|
||||
|
||||
if(item.getType() == Material.CLAY_BALL)
|
||||
{
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
} else
|
||||
{
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
|
||||
/*
|
||||
* SUPER BREAKER CHECKS
|
||||
*/
|
||||
if(PP.getSuperBreakerMode()
|
||||
&& Mining.canBeSuperBroken(block)
|
||||
&& m.blockBreakSimulate(block, player))
|
||||
&& Mining.canBeSuperBroken(block)
|
||||
&& m.blockBreakSimulate(block, player)
|
||||
&& mcPermissions.getInstance().miningAbility(player))
|
||||
{
|
||||
|
||||
if(LoadProperties.miningrequirespickaxe)
|
||||
{
|
||||
if(m.isMiningPick(inhand))
|
||||
if(m.isMiningPick(inhand)){
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
}
|
||||
} else {
|
||||
event.setInstaBreak(true);
|
||||
Mining.SuperBreakerBlockCheck(player, block, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* LEAF BLOWER
|
||||
* LEAF BLOWER CHECKS
|
||||
*/
|
||||
if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player))
|
||||
{
|
||||
m.damageTool(player, (short)1);
|
||||
if(Math.random() * 10 > 9)
|
||||
if(block.getTypeId() == 18
|
||||
&& mcPermissions.getInstance().woodCuttingAbility(player)
|
||||
&& PP.getSkillLevel(SkillType.WOODCUTTING) >= 100
|
||||
&& m.blockBreakSimulate(block, player))
|
||||
{
|
||||
if(LoadProperties.woodcuttingrequiresaxe)
|
||||
{
|
||||
ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, block.getData());
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), x);
|
||||
if(m.isAxes(inhand)){
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
}
|
||||
block.setType(Material.AIR);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
else{
|
||||
event.setInstaBreak(true);
|
||||
WoodCutting.leafBlower(player, block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(block.getType() == Material.AIR && plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
plugin.misc.blockWatchList.remove(block);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent event)
|
||||
{
|
||||
Block blockFrom = event.getBlock();
|
||||
|
||||
@@ -16,17 +16,23 @@
|
||||
*/
|
||||
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;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
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.EntityListener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
@@ -38,18 +44,20 @@ 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;
|
||||
|
||||
|
||||
public class mcEntityListener extends EntityListener
|
||||
public class mcEntityListener implements Listener
|
||||
{
|
||||
private final mcMMO plugin;
|
||||
|
||||
public mcEntityListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
if(event.isCancelled())
|
||||
@@ -74,6 +82,19 @@ public class mcEntityListener extends EntityListener
|
||||
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();
|
||||
@@ -134,7 +155,7 @@ public class mcEntityListener extends EntityListener
|
||||
/*
|
||||
* 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;
|
||||
@@ -158,7 +179,8 @@ public class mcEntityListener extends EntityListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
Entity x = event.getEntity();
|
||||
@@ -180,7 +202,8 @@ public class mcEntityListener extends EntityListener
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
SpawnReason reason = event.getSpawnReason();
|
||||
@@ -191,6 +214,39 @@ public class mcEntityListener extends EntityListener
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@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;
|
||||
|
||||
@@ -25,13 +25,14 @@ 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;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@@ -39,12 +40,13 @@ import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
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;
|
||||
@@ -64,7 +66,7 @@ import com.gmail.nossr50.skills.Repair;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
|
||||
|
||||
public class mcPlayerListener extends PlayerListener
|
||||
public class mcPlayerListener implements Listener
|
||||
{
|
||||
protected static final Logger log = Logger.getLogger("Minecraft"); //$NON-NLS-1$
|
||||
public Location spawn = null;
|
||||
@@ -74,14 +76,15 @@ public class mcPlayerListener extends PlayerListener
|
||||
{
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerFish(PlayerFishEvent event)
|
||||
{
|
||||
if(mcPermissions.getInstance().fishing(event.getPlayer()))
|
||||
{
|
||||
if(event.getState() == State.CAUGHT_FISH)
|
||||
{
|
||||
if(event.getCaught() instanceof CraftItem)
|
||||
if(event.getCaught() instanceof Item)
|
||||
{
|
||||
Fishing.processResults(event);
|
||||
}
|
||||
@@ -94,15 +97,17 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
if(Users.getProfile(event.getPlayer()).getBerserkMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
if(Users.getProfile(event.getPlayer()).getBerserkMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event)
|
||||
{
|
||||
|
||||
@@ -126,11 +131,13 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
Users.addUser(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
|
||||
@@ -148,15 +155,23 @@ public class mcPlayerListener extends PlayerListener
|
||||
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());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd)
|
||||
{
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.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
|
||||
@@ -164,6 +179,7 @@ public class mcPlayerListener extends PlayerListener
|
||||
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
@@ -190,7 +206,7 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
|
||||
if(block != null && player != null && mcPermissions.getInstance().repair(player)
|
||||
&& event.getClickedBlock().getTypeId() == 42 && (Repair.isTools(player.getItemInHand()) || Repair.isArmor(player.getItemInHand())))
|
||||
&& event.getClickedBlock().getTypeId() == LoadProperties.anvilID && (Repair.isTools(player.getItemInHand()) || Repair.isArmor(player.getItemInHand())))
|
||||
{
|
||||
Repair.repairCheck(player, is, event.getClickedBlock());
|
||||
event.setCancelled(true);
|
||||
@@ -220,19 +236,22 @@ public class mcPlayerListener extends PlayerListener
|
||||
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)
|
||||
@@ -298,6 +317,7 @@ public class mcPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
@@ -305,41 +325,37 @@ public class mcPlayerListener extends PlayerListener
|
||||
if(PP.getPartyChatMode())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
String format = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") "+event.getMessage();
|
||||
String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
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 format = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} "+event.getMessage();
|
||||
String name = (LoadProperties.aDisplayNames) ? player.getDisplayName() : player.getName();
|
||||
String format = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} "+event.getMessage();
|
||||
for(Player x : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Dynamically aliasing commands need to be re-done.
|
||||
// For now, using a command with an alias will send both the original command, and the mcMMO command
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String message = event.getMessage();
|
||||
if(!message.startsWith("/")) return;
|
||||
String command = message.substring(1).split(" ")[0];
|
||||
if(plugin.aliasMap.containsKey(command)) {
|
||||
event.setCancelled(true);
|
||||
if(command.equalsIgnoreCase(plugin.aliasMap.get(command))) return;
|
||||
//event.setCancelled(true);
|
||||
event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.getspout.spoutapi.event.input.InputListener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.getspout.spoutapi.event.input.KeyPressedEvent;
|
||||
import org.getspout.spoutapi.gui.ScreenType;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
@@ -26,7 +27,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutInputListener extends InputListener
|
||||
public class mcSpoutInputListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
|
||||
@@ -35,6 +36,7 @@ public class mcSpoutInputListener extends InputListener
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKeyPressedEvent(KeyPressedEvent event)
|
||||
{
|
||||
if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null)
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
|
||||
import org.getspout.spoutapi.event.spout.SpoutListener;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
@@ -25,7 +26,7 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutListener extends SpoutListener
|
||||
public class mcSpoutListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
|
||||
@@ -34,6 +35,7 @@ public class mcSpoutListener extends SpoutListener
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpoutCraftEnable(SpoutCraftEnableEvent event)
|
||||
{
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
*/
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
|
||||
import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
|
||||
import org.getspout.spoutapi.event.screen.ScreenListener;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
@@ -32,13 +33,15 @@ import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutScreenListener extends ScreenListener
|
||||
public class mcSpoutScreenListener implements Listener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
public mcSpoutScreenListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onButtonClick(ButtonClickEvent event)
|
||||
{
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
@@ -83,6 +86,7 @@ public class mcSpoutScreenListener extends ScreenListener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onScreenClose(ScreenCloseEvent event)
|
||||
{
|
||||
if(event.getScreen() instanceof PopupMMO)
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.events.McMMOItemSpawnEvent;
|
||||
|
||||
public class m
|
||||
{
|
||||
@@ -88,7 +89,13 @@ public class m
|
||||
public static boolean shouldBeWatched(Block block)
|
||||
{
|
||||
int id = block.getTypeId();
|
||||
return id == 103 || id == 82 || id == 16 || id == 73 || id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24;
|
||||
return shouldBeWatched(id);
|
||||
}
|
||||
public static boolean shouldBeWatched(int id) {
|
||||
return id == 2 || id == 3 || id == 12 || id == 13 || id == 82 || //Excavation
|
||||
id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98 || //Mining
|
||||
id == 17 || id == 37 || id == 38 || id == 39 || id == 40 || id == 81 || id == 83 || id == 86 || id == 91 || id == 103 || id == 106 || id == 111 || //Woodcutting & Herbalism
|
||||
id == LoadProperties.anvilID; //Anvil
|
||||
}
|
||||
|
||||
public static int getPowerLevel(Player player)
|
||||
@@ -178,10 +185,10 @@ public class m
|
||||
{
|
||||
int id = item.getTypeId();
|
||||
if(tier == 1){
|
||||
if((id == 276 || id == 277 || id == 278 || id == 279 || id == 293)){
|
||||
return 33;
|
||||
if((id == 283 || id == 284 || id == 285 || id == 286 || id == 294)){
|
||||
return 33; //GOLD
|
||||
} else {
|
||||
return 60;
|
||||
return 60; //WOOD
|
||||
}
|
||||
} else if (tier == 2){
|
||||
return 132;
|
||||
@@ -203,7 +210,7 @@ public class m
|
||||
public static boolean abilityBlockCheck(Block block)
|
||||
{
|
||||
int i = block.getTypeId();
|
||||
if(i == 107 ||i == 117 || i == 116 || i == 96 || i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){
|
||||
if(i == 107 ||i == 117 || i == 116 || i == 96 || i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == LoadProperties.anvilID || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -255,20 +262,27 @@ public class m
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static void mcDropItem(Location loc, int id)
|
||||
public static void mcDropItem(Location location, int id)
|
||||
{
|
||||
if(loc != null)
|
||||
{
|
||||
Material mat = Material.getMaterial(id);
|
||||
byte damage = 0;
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
if(location == null) return;
|
||||
|
||||
Material mat = Material.getMaterial(id);
|
||||
ItemStack item = new ItemStack(mat, 1, (byte) 0, (byte) 0);
|
||||
mcDropItem(location, item);
|
||||
}
|
||||
public static void mcDropItem(Location location, ItemStack itemStack) {
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
location.getWorld().dropItemNaturally(location, itemStack);
|
||||
}
|
||||
|
||||
public static boolean isSwords(ItemStack is)
|
||||
{
|
||||
return is.getTypeId() == 268 || is.getTypeId() == 267 || is.getTypeId() == 272 || is.getTypeId() == 283 || is.getTypeId() == 276;
|
||||
int id = is.getTypeId();
|
||||
return id == 268 || id == 267 || id == 272 || id == 283 || id == 276;
|
||||
}
|
||||
|
||||
public static boolean isHoe(ItemStack is)
|
||||
@@ -277,35 +291,28 @@ public class m
|
||||
return id == 290 || id == 291 || id == 292 || id == 293 || id == 294;
|
||||
}
|
||||
|
||||
public static boolean isShovel(ItemStack is){
|
||||
return is.getTypeId() == 269 || is.getTypeId() == 273 || is.getTypeId() == 277 || is.getTypeId() == 284 || is.getTypeId() == 256;
|
||||
public static boolean isShovel(ItemStack is)
|
||||
{
|
||||
int id = is.getTypeId();
|
||||
return id == 269 || id == 273 || id == 277 || id == 284 || id == 256;
|
||||
}
|
||||
|
||||
public static boolean isAxes(ItemStack is){
|
||||
if(is.getTypeId() == 271 || is.getTypeId() == 258 || is.getTypeId() == 286 || is.getTypeId() == 279 || is.getTypeId() == 275){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public static boolean isAxes(ItemStack is)
|
||||
{
|
||||
int id = is.getTypeId();
|
||||
return id == 271 || id == 258 || id == 286 || id == 279 || id == 275;
|
||||
}
|
||||
|
||||
public static boolean isMiningPick(ItemStack is)
|
||||
{
|
||||
if(is.getTypeId() == 270 || is.getTypeId() == 274 || is.getTypeId() == 285 || is.getTypeId() == 257 || is.getTypeId() == 278)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isGold(ItemStack is)
|
||||
{
|
||||
int i = is.getTypeId();
|
||||
if(i == 283 || i == 284 || i == 285 || i == 286 || i == 294 || i == 314 || i == 315 || i == 316 || i == 317){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
int id = is.getTypeId();
|
||||
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
|
||||
}
|
||||
// public boolean isGold(ItemStack is)
|
||||
// {
|
||||
// int id = is.getTypeId();
|
||||
// return id == 283 || id == 284 || id == 285 || id == 286 || id == 294 || id == 314 || id == 315 || id == 316 || id == 317;
|
||||
// }
|
||||
public static void convertToMySQL()
|
||||
{
|
||||
if(!LoadProperties.useMySQL)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,7 +25,7 @@ import com.gmail.nossr50.commands.mc.*;
|
||||
import com.gmail.nossr50.commands.party.*;
|
||||
import com.gmail.nossr50.commands.general.*;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.runnables.mcTimer;
|
||||
import com.gmail.nossr50.runnables.*;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||
@@ -32,9 +33,9 @@ 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;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
@@ -44,16 +45,16 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.FileManager;
|
||||
@@ -61,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");
|
||||
@@ -81,11 +71,10 @@ 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);
|
||||
|
||||
//Alias - Command
|
||||
@@ -95,9 +84,12 @@ public class mcMMO extends JavaPlugin
|
||||
public Misc misc = new Misc(this);
|
||||
|
||||
//Config file stuff
|
||||
LoadProperties config = new LoadProperties();
|
||||
LoadProperties config;
|
||||
//Jar stuff
|
||||
public static File mcmmo;
|
||||
|
||||
//Queue for block data change for R2+ fix
|
||||
public ArrayDeque<Block> changeQueue = new ArrayDeque<Block>();
|
||||
|
||||
public void onEnable()
|
||||
{
|
||||
@@ -120,9 +112,8 @@ public class mcMMO extends JavaPlugin
|
||||
else if(!vnum.equalsIgnoreCase(this.getDescription().getVersion())) updateFrom(-1);
|
||||
}
|
||||
|
||||
mcPermissions.initialize(getServer());
|
||||
|
||||
config.configCheck();
|
||||
this.config = new LoadProperties(this);
|
||||
this.config.load();
|
||||
|
||||
Party.getInstance().loadParties();
|
||||
new Party(this);
|
||||
@@ -134,36 +125,18 @@ public class mcMMO extends JavaPlugin
|
||||
*/
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
|
||||
if(pm.getPlugin("Spout") != null)
|
||||
LoadProperties.spoutEnabled = true;
|
||||
else
|
||||
LoadProperties.spoutEnabled = false;
|
||||
|
||||
//Player Stuff
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_FISH, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this);
|
||||
|
||||
//Block Stuff
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
|
||||
|
||||
//Entity Stuff
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Monitor, this);
|
||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
||||
|
||||
//Register events
|
||||
pm.registerEvents(playerListener, this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
pm.registerEvents(entityListener, this);
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
mcPermissions.initialize(getServer());
|
||||
|
||||
if(LoadProperties.useMySQL)
|
||||
{
|
||||
@@ -175,7 +148,12 @@ 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);
|
||||
|
||||
registerCommands();
|
||||
|
||||
@@ -188,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);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,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() {
|
||||
@@ -284,36 +257,6 @@ public class mcMMO extends JavaPlugin
|
||||
aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed");
|
||||
aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting");
|
||||
|
||||
//Mc* commands
|
||||
aliasMap.put(LoadProperties.mcability, "mcability");
|
||||
aliasMap.put(LoadProperties.mcc, "mcc");
|
||||
aliasMap.put(LoadProperties.mcgod, "mcgod");
|
||||
aliasMap.put(LoadProperties.mcmmo, "mcmmo");
|
||||
aliasMap.put(LoadProperties.mcrefresh, "mcrefresh");
|
||||
aliasMap.put(LoadProperties.mctop, "mctop");
|
||||
|
||||
//Party commands
|
||||
aliasMap.put(LoadProperties.accept, "accept");
|
||||
//aliasMap.put(null, "a");
|
||||
aliasMap.put(LoadProperties.invite, "invite");
|
||||
aliasMap.put(LoadProperties.party, "party");
|
||||
//aliasMap.put(null, "p");
|
||||
aliasMap.put(LoadProperties.ptp, "ptp");
|
||||
|
||||
//Other commands
|
||||
aliasMap.put(LoadProperties.addxp, "addxp");
|
||||
aliasMap.put(LoadProperties.clearmyspawn, "clearmyspawn");
|
||||
aliasMap.put(LoadProperties.mmoedit, "mmoedit");
|
||||
//aliasMap.put(key, "mmoupdate");
|
||||
aliasMap.put(LoadProperties.myspawn, "myspawn");
|
||||
aliasMap.put(LoadProperties.stats, "stats");
|
||||
aliasMap.put(LoadProperties.whois, "whois");
|
||||
aliasMap.put(LoadProperties.xprate, "xprate");
|
||||
|
||||
//Spout commands
|
||||
//aliasMap.put(null, "mchud");
|
||||
aliasMap.put(LoadProperties.xplock, "xplock");
|
||||
|
||||
|
||||
//Register commands
|
||||
//Skills commands
|
||||
@@ -331,34 +274,34 @@ public class mcMMO extends JavaPlugin
|
||||
getCommand("woodcutting").setExecutor(new WoodcuttingCommand());
|
||||
|
||||
//Mc* commands
|
||||
getCommand("mcability").setExecutor(new McabilityCommand());
|
||||
getCommand("mcc").setExecutor(new MccCommand());
|
||||
getCommand("mcgod").setExecutor(new McgodCommand());
|
||||
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||
getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
||||
getCommand("mctop").setExecutor(new MctopCommand());
|
||||
if(LoadProperties.mcabilityEnable) getCommand("mcability").setExecutor(new McabilityCommand());
|
||||
if(LoadProperties.mccEnable) getCommand("mcc").setExecutor(new MccCommand());
|
||||
if(LoadProperties.mcgodEnable) getCommand("mcgod").setExecutor(new McgodCommand());
|
||||
if(LoadProperties.mcmmoEnable) getCommand("mcmmo").setExecutor(new McmmoCommand());
|
||||
if(LoadProperties.mcrefreshEnable) getCommand("mcrefresh").setExecutor(new McrefreshCommand(this));
|
||||
if(LoadProperties.mctopEnable) getCommand("mctop").setExecutor(new MctopCommand());
|
||||
|
||||
//Party commands
|
||||
getCommand("accept").setExecutor(new AcceptCommand());
|
||||
getCommand("a").setExecutor(new ACommand());
|
||||
getCommand("invite").setExecutor(new InviteCommand(this));
|
||||
getCommand("party").setExecutor(new PartyCommand());
|
||||
getCommand("p").setExecutor(new PCommand());
|
||||
getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
if(LoadProperties.acceptEnable) getCommand("accept").setExecutor(new AcceptCommand());
|
||||
if(LoadProperties.aEnable) getCommand("a").setExecutor(new ACommand());
|
||||
if(LoadProperties.inviteEnable) getCommand("invite").setExecutor(new InviteCommand(this));
|
||||
if(LoadProperties.partyEnable) getCommand("party").setExecutor(new PartyCommand());
|
||||
if(LoadProperties.pEnable) getCommand("p").setExecutor(new PCommand());
|
||||
if(LoadProperties.ptpEnable) getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
|
||||
//Other commands
|
||||
getCommand("addxp").setExecutor(new AddxpCommand(this));
|
||||
getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand());
|
||||
getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
|
||||
if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this));
|
||||
if(LoadProperties.clearmyspawnEnable) getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand());
|
||||
if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this));
|
||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
||||
getCommand("myspawn").setExecutor(new MyspawnCommand());
|
||||
getCommand("stats").setExecutor(new StatsCommand());
|
||||
getCommand("whois").setExecutor(new WhoisCommand(this));
|
||||
getCommand("xprate").setExecutor(new XprateCommand());
|
||||
if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand());
|
||||
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());
|
||||
|
||||
//Spout commands
|
||||
getCommand("mchud").setExecutor(new MchudCommand());
|
||||
getCommand("xplock").setExecutor(new XplockCommand());
|
||||
if(LoadProperties.xplockEnable) getCommand("xplock").setExecutor(new XplockCommand());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,7 +239,7 @@ public class Party
|
||||
if(password == null)
|
||||
{
|
||||
//TODO: Needs more locale.
|
||||
player.sendMessage("This party requires a password. Use "+LoadProperties.party+" <party> <password> to join it.");
|
||||
player.sendMessage("This party requires a password. Use /party <party> <password> to join it.");
|
||||
return;
|
||||
} else if(!password.equalsIgnoreCase(getPartyPassword(newParty)))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
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.block.Block;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
/*
|
||||
* This file was created for a breakage introduced in 1.1-R2
|
||||
* It should be removed afterwards if the breakage is removed.
|
||||
*/
|
||||
public class ChangeDataValueTimer implements Runnable {
|
||||
private mcMMO plugin;
|
||||
|
||||
public ChangeDataValueTimer(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
int size = plugin.changeQueue.size();
|
||||
if(size == 0) return;
|
||||
if(size > 25) {
|
||||
size = (int) Math.floor(size / 10);
|
||||
}
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
Block change = plugin.changeQueue.poll();
|
||||
if(change == null) continue;
|
||||
change.setData((byte) 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/main/java/com/gmail/nossr50/runnables/mcSaveTimer.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
@@ -36,6 +37,7 @@ public class mcTimer implements Runnable
|
||||
|
||||
public void run()
|
||||
{
|
||||
long curTime = System.currentTimeMillis();
|
||||
for(Player player : plugin.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player == null)
|
||||
@@ -48,19 +50,19 @@ public class mcTimer implements Runnable
|
||||
/*
|
||||
* MONITOR SKILLS
|
||||
*/
|
||||
Skills.monitorSkills(player);
|
||||
Skills.monitorSkills(player, PP, curTime);
|
||||
|
||||
/*
|
||||
* COOLDOWN MONITORING
|
||||
*/
|
||||
Skills.watchCooldowns(player);
|
||||
Skills.watchCooldowns(player, PP, curTime);
|
||||
|
||||
/*
|
||||
* PLAYER BLEED MONITORING
|
||||
*/
|
||||
if(thecount % 2 == 0 && PP.getBleedTicks() >= 1)
|
||||
{
|
||||
player.damage(2);
|
||||
Combat.dealDamage(player, 2);
|
||||
PP.decreaseBleedTicks();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Archery
|
||||
pluginx.misc.arrowTracker.put(x, 0);
|
||||
if(attacker != null)
|
||||
{
|
||||
if(Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY))
|
||||
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))
|
||||
if(PPa.getSkillLevel(SkillType.ARCHERY) > 1000 || (Math.random() * 1000 <= PPa.getSkillLevel(SkillType.ARCHERY)))
|
||||
{
|
||||
pluginx.misc.arrowTracker.put(x, 1);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,12 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.Combat;
|
||||
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;
|
||||
@@ -51,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)
|
||||
@@ -84,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!");
|
||||
}
|
||||
@@ -120,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())
|
||||
{
|
||||
target.damage(event.getDamage() / 2);
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
target.damage(event.getDamage() / 2);
|
||||
targets--;
|
||||
}
|
||||
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);
|
||||
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
|
||||
targets--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LivingEntity target = (LivingEntity)derp;
|
||||
Combat.dealDamage(target, event.getDamage() / 2, attacker);
|
||||
targets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
385
src/main/java/com/gmail/nossr50/skills/BlastMining.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,20 +17,27 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.enchantments.Enchantment;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
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;
|
||||
|
||||
|
||||
public class Excavation
|
||||
public class Excavation
|
||||
{
|
||||
public static void gigaDrillBreakerActivationCheck(Player player, Block block)
|
||||
{
|
||||
@@ -54,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())
|
||||
@@ -62,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);
|
||||
}
|
||||
|
||||
@@ -71,31 +77,32 @@ public class Excavation
|
||||
}
|
||||
public static boolean canBeGigaDrillBroken(Block block)
|
||||
{
|
||||
return block.getType() == Material.DIRT || block.getType() == Material.GRASS || block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.CLAY;
|
||||
Material t = block.getType();
|
||||
return t == Material.DIRT || t == Material.GRASS || t == Material.SAND || t == Material.GRAVEL || t == Material.CLAY || t == Material.MYCEL || t == Material.SOUL_SAND;
|
||||
}
|
||||
public static void excavationProcCheck(byte data, Material type, Location loc, Player player)
|
||||
public static void excavationProcCheck(Material type, Location loc, Player player)
|
||||
{
|
||||
if(LoadProperties.excavationRequiresShovel && !m.isShovel(player.getItemInHand()))
|
||||
return;
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int skillLevel = PP.getSkillLevel(SkillType.EXCAVATION);
|
||||
ArrayList<ItemStack> is = new ArrayList<ItemStack>();
|
||||
|
||||
int xp = 0;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case GRASS:
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
||||
if(skillLevel >= 250)
|
||||
{
|
||||
//CHANCE TO GET EGGS
|
||||
if(LoadProperties.eggs == true && Math.random() * 100 > 99)
|
||||
if(LoadProperties.eggs && Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.meggs;
|
||||
is.add(new ItemStack(Material.EGG, 1, (byte)0, (byte)0));
|
||||
}
|
||||
//CHANCE TO GET APPLES
|
||||
if(LoadProperties.apples == true && Math.random() * 100 > 99)
|
||||
if(LoadProperties.apples && Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.mapple;
|
||||
is.add(new ItemStack(Material.APPLE, 1, (byte)0, (byte)0));
|
||||
@@ -104,149 +111,125 @@ public class Excavation
|
||||
break;
|
||||
case GRAVEL:
|
||||
//CHANCE TO GET NETHERRACK
|
||||
if(LoadProperties.netherrack == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 850 && Math.random() * 200 > 199)
|
||||
if(LoadProperties.netherrack && skillLevel >= 850 && Math.random() * 200 > 199)
|
||||
{
|
||||
xp+= LoadProperties.mnetherrack;
|
||||
is.add(new ItemStack(Material.NETHERRACK, 1, (byte)0, (byte)0));
|
||||
|
||||
}
|
||||
//CHANCE TO GET SULPHUR
|
||||
if(LoadProperties.sulphur == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 75)
|
||||
if(LoadProperties.sulphur && skillLevel >= 75 && Math.random() * 10 > 9)
|
||||
{
|
||||
if(Math.random() * 10 > 9)
|
||||
{
|
||||
xp+= LoadProperties.msulphur;
|
||||
is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0));
|
||||
}
|
||||
xp+= LoadProperties.msulphur;
|
||||
is.add(new ItemStack(Material.SULPHUR, 1, (byte)0, (byte)0));
|
||||
}
|
||||
//CHANCE TO GET BONES
|
||||
if(LoadProperties.bones == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 175)
|
||||
if(LoadProperties.bones && skillLevel >= 175 && Math.random() * 10 > 9)
|
||||
{
|
||||
if(Math.random() * 10 > 9)
|
||||
{
|
||||
xp+= LoadProperties.mbones;
|
||||
is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0));
|
||||
}
|
||||
xp+= LoadProperties.mbones;
|
||||
is.add(new ItemStack(Material.BONE, 1, (byte)0, (byte)0));
|
||||
}
|
||||
break;
|
||||
case SAND:
|
||||
//CHANCE TO GET GLOWSTONE
|
||||
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 50 && Math.random() * 100 > 95)
|
||||
if(LoadProperties.glowstone && skillLevel >= 50 && Math.random() * 100 > 95)
|
||||
{
|
||||
xp+= LoadProperties.mglowstone2;
|
||||
is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
|
||||
|
||||
}
|
||||
//CHANCE TO GET SOUL SAND
|
||||
if(LoadProperties.slowsand == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 650 && Math.random() * 200 > 199)
|
||||
if(LoadProperties.slowsand && skillLevel >= 650 && Math.random() * 200 > 199)
|
||||
{
|
||||
xp+= LoadProperties.mslowsand;
|
||||
is.add(new ItemStack(Material.SOUL_SAND, 1, (byte)0, (byte)0));
|
||||
}
|
||||
break;
|
||||
case CLAY:
|
||||
if(LoadProperties.slimeballs && PP.getSkillLevel(SkillType.EXCAVATION) >= 50)
|
||||
//CHANCE TO GET SLIMEBALLS
|
||||
if(LoadProperties.slimeballs && skillLevel >= 50 && Math.random() * 20 > 19)
|
||||
{
|
||||
if(Math.random() * 20 > 19)
|
||||
{
|
||||
xp+= LoadProperties.mslimeballs;
|
||||
is.add(new ItemStack(Material.SLIME_BALL, 1, (byte)0, (byte)0));
|
||||
}
|
||||
xp+= LoadProperties.mslimeballs;
|
||||
is.add(new ItemStack(Material.SLIME_BALL, 1, (byte)0, (byte)0));
|
||||
}
|
||||
//CHANCE TO GET STRING
|
||||
if(LoadProperties.string && skillLevel >= 250 && Math.random() * 20 > 19)
|
||||
{
|
||||
xp+= LoadProperties.mstring;
|
||||
is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0));
|
||||
}
|
||||
if(LoadProperties.string && PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
||||
if(skillLevel >= 500)
|
||||
{
|
||||
if(Math.random() * 20 > 19)
|
||||
{
|
||||
xp+= LoadProperties.mstring;
|
||||
is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0));
|
||||
}
|
||||
//CHANCE TO GET CLOCK
|
||||
if(LoadProperties.watch && Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.mwatch;
|
||||
is.add(new ItemStack(Material.WATCH, 1, (byte)0));
|
||||
|
||||
}
|
||||
//CHANCE TO GET BUCKET
|
||||
if(LoadProperties.bucket && Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.mbucket;
|
||||
is.add(new ItemStack(Material.BUCKET, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(LoadProperties.watch && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)
|
||||
//CHANCE TO GET COBWEB
|
||||
if(LoadProperties.web && skillLevel >= 750 && Math.random() * 20 > 19)
|
||||
{
|
||||
if(Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.mwatch;
|
||||
is.add(new ItemStack(Material.WATCH, 1, (byte)0));
|
||||
}
|
||||
}
|
||||
if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)
|
||||
{
|
||||
if(Math.random() * 100 > 99)
|
||||
{
|
||||
xp+= LoadProperties.mbucket;
|
||||
is.add(new ItemStack(Material.BUCKET, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(LoadProperties.web && PP.getSkillLevel(SkillType.EXCAVATION) >= 750)
|
||||
{
|
||||
if(Math.random() * 20 > 19)
|
||||
{
|
||||
xp+= LoadProperties.mweb;
|
||||
is.add(new ItemStack(Material.WEB, 1, (byte)0, (byte)0));
|
||||
}
|
||||
xp+= LoadProperties.mweb;
|
||||
is.add(new ItemStack(Material.WEB, 1, (byte)0, (byte)0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//DIRT SAND OR GRAVEL
|
||||
if(type == Material.GRASS || type == Material.DIRT || type == Material.GRAVEL || type == Material.SAND || type == Material.CLAY)
|
||||
//ALL MATERIALS
|
||||
if(type == Material.GRASS || type == Material.DIRT || type == Material.GRAVEL || type == Material.SAND || type == Material.CLAY || type == Material.MYCEL || type == Material.SOUL_SAND)
|
||||
{
|
||||
xp+= LoadProperties.mbase;
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 750)
|
||||
{
|
||||
//CHANCE TO GET CAKE
|
||||
if(LoadProperties.cake == true && Math.random() * 2000 > 1999)
|
||||
{
|
||||
xp+= LoadProperties.mcake;
|
||||
is.add(new ItemStack(Material.CAKE, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
||||
//CHANCE TO GET CAKE
|
||||
if(LoadProperties.cake && skillLevel >= 750 && Math.random() * 2000 > 1999)
|
||||
{
|
||||
xp+= LoadProperties.mcake;
|
||||
is.add(new ItemStack(Material.CAKE, 1, (byte)0, (byte)0));
|
||||
}
|
||||
if(skillLevel >= 350)
|
||||
{
|
||||
//CHANCE TO GET DIAMOND
|
||||
if(LoadProperties.diamond == true && Math.random() * 750 > 749)
|
||||
if(LoadProperties.diamond && Math.random() * 750 > 749)
|
||||
{
|
||||
xp+= LoadProperties.mdiamond2;
|
||||
is.add(new ItemStack(Material.DIAMOND, 1, (byte)0, (byte)0));
|
||||
xp+= LoadProperties.mdiamond2;
|
||||
is.add(new ItemStack(Material.DIAMOND, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 250)
|
||||
{
|
||||
//CHANCE TO GET YELLOW MUSIC
|
||||
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
||||
{
|
||||
xp+= LoadProperties.mmusic;
|
||||
is.add(new ItemStack(Material.GOLD_RECORD, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 350)
|
||||
{
|
||||
//CHANCE TO GET GREEN MUSIC
|
||||
if(LoadProperties.music == true && Math.random() * 2000 > 1999)
|
||||
if(LoadProperties.music && Math.random() * 2000 > 1999)
|
||||
{
|
||||
xp+= LoadProperties.mmusic;
|
||||
is.add(new ItemStack(Material.GREEN_RECORD, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
//CHANCE TO GET YELLOW MUSIC
|
||||
if(LoadProperties.music && skillLevel >= 250 && Math.random() * 2000 > 1999)
|
||||
{
|
||||
xp+= LoadProperties.mmusic;
|
||||
is.add(new ItemStack(Material.GOLD_RECORD, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
|
||||
//GRASS OR DIRT
|
||||
if(type == Material.DIRT || type == Material.GRASS)
|
||||
//GRASS OR DIRT OR MYCEL
|
||||
if(type == Material.DIRT || type == Material.GRASS || type == Material.MYCEL)
|
||||
{
|
||||
if(PP.getSkillLevel(SkillType.EXCAVATION) >= 50)
|
||||
//CHANCE FOR COCOA BEANS
|
||||
if(LoadProperties.cocoabeans && skillLevel >= 50 && Math.random() * 75 > 74)
|
||||
{
|
||||
//CHANCE FOR COCOA BEANS
|
||||
if(LoadProperties.cocoabeans == true && Math.random() * 75 > 74)
|
||||
{
|
||||
xp+= LoadProperties.mcocoa;
|
||||
is.add(new ItemStack(Material.getMaterial(351), 1, (byte)0, (byte)3));
|
||||
}
|
||||
xp+= LoadProperties.mcocoa;
|
||||
is.add(new ItemStack(Material.getMaterial(351), 1, (byte)0, (byte)3));
|
||||
}
|
||||
//CHANCE FOR SHROOMS
|
||||
if(LoadProperties.mushrooms == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 500 && Math.random() * 200 > 199)
|
||||
if(LoadProperties.mushrooms && skillLevel >= 500 && Math.random() * 200 > 199)
|
||||
{
|
||||
xp+= LoadProperties.mmushroom2;
|
||||
switch((int) Math.random() * 1)
|
||||
switch((int)(Math.random() * 2))
|
||||
{
|
||||
case 0:
|
||||
is.add(new ItemStack(Material.BROWN_MUSHROOM, 1, (byte)0, (byte)0));
|
||||
@@ -258,7 +241,7 @@ public class Excavation
|
||||
|
||||
}
|
||||
//CHANCE TO GET GLOWSTONE
|
||||
if(LoadProperties.glowstone == true && PP.getSkillLevel(SkillType.EXCAVATION) >= 25 && Math.random() * 100 > 95)
|
||||
if(LoadProperties.glowstone && skillLevel >= 25 && Math.random() * 100 > 95)
|
||||
{
|
||||
xp+= LoadProperties.mglowstone2;
|
||||
is.add(new ItemStack(Material.GLOWSTONE_DUST, 1, (byte)0, (byte)0));
|
||||
@@ -269,11 +252,32 @@ public class Excavation
|
||||
for(ItemStack x : is)
|
||||
{
|
||||
if(x != null)
|
||||
loc.getWorld().dropItemNaturally(loc, x);
|
||||
m.mcDropItem(loc, x);
|
||||
}
|
||||
|
||||
//Handle XP related tasks
|
||||
PP.addXP(SkillType.EXCAVATION, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.EXCAVATION, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void gigaDrillBreaker(Player player, Block block)
|
||||
{
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
}
|
||||
|
||||
if(block.getData() != (byte)5)
|
||||
{
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||
Excavation.excavationProcCheck(block.getType(), block.getLocation(), player);
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ public class Herbalism
|
||||
Location loc = block.getLocation();
|
||||
ItemStack is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
|
||||
//DROP SOME SEEDS
|
||||
mat = Material.SEEDS;
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
|
||||
herbalismProcCheck(block, player, event, plugin);
|
||||
herbalismProcCheck(block, player, event, plugin);
|
||||
@@ -114,11 +114,7 @@ public class Herbalism
|
||||
|
||||
public static Boolean canBeGreenTerra(Block block){
|
||||
int t = block.getTypeId();
|
||||
if(t == 103 || t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return t == 103 || t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38;
|
||||
}
|
||||
public static boolean hasSeeds(Player player){
|
||||
ItemStack[] inventory = player.getInventory().getContents();
|
||||
@@ -148,6 +144,7 @@ public class Herbalism
|
||||
public static void herbalismProcCheck(Block block, Player player, BlockBreakEvent event, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
int type = block.getTypeId();
|
||||
Location loc = block.getLocation();
|
||||
ItemStack is = null;
|
||||
@@ -157,6 +154,8 @@ public class Herbalism
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Wheat
|
||||
if(type == 59 && block.getData() == (byte) 0x7)
|
||||
{
|
||||
mat = Material.getMaterial(296);
|
||||
@@ -164,43 +163,55 @@ public class Herbalism
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
|
||||
if(player != null)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
}
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
//GREEN THUMB
|
||||
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(herbLevel > 1500 || (Math.random() * 1500 <= herbLevel))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
//DROP SOME SEEDS
|
||||
mat = Material.SEEDS;
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//Nether Wart
|
||||
if(type == 115 && block.getData() == (byte) 0x3)
|
||||
{
|
||||
mat = Material.getMaterial(372);
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
|
||||
if(player != null)
|
||||
{
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to check not-wheat stuff for if it was placed by the player or not
|
||||
* We need to check not-wheat and not-netherwart stuff for if it was placed by the player or not
|
||||
*/
|
||||
if(block.getData() != (byte) 5)
|
||||
{
|
||||
@@ -231,9 +242,9 @@ public class Herbalism
|
||||
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
|
||||
if(byteArray[x] != (byte) 5)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(target.getLocation(), is);
|
||||
m.mcDropItem(target.getLocation(), is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus, player);
|
||||
}
|
||||
@@ -270,9 +281,9 @@ public class Herbalism
|
||||
//Check for being placed by the player
|
||||
if(byteArray[x] != (byte) 5)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(target.getLocation(), is);
|
||||
m.mcDropItem(target.getLocation(), is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.msugar, player);
|
||||
}
|
||||
@@ -288,9 +299,9 @@ public class Herbalism
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
if(player != null)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin, player);
|
||||
@@ -298,12 +309,24 @@ public class Herbalism
|
||||
//Melon
|
||||
if(type == 103)
|
||||
{
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
mat = Material.getMaterial(360);
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(player != null)
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
m.mcDropItem(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
if(Math.random() * 10 > 5)
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mmelon, player);
|
||||
}
|
||||
@@ -314,9 +337,9 @@ public class Herbalism
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
if(player != null)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM))
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom, player);
|
||||
@@ -326,12 +349,32 @@ public class Herbalism
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
if(player != null){
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.HERBALISM)){
|
||||
loc.getWorld().dropItemNaturally(loc, is);
|
||||
}
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mflower, player);
|
||||
}
|
||||
//Lily Pads
|
||||
if(type == 111)
|
||||
{
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
if(player != null){
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mlilypad, player);
|
||||
}
|
||||
//Vines
|
||||
if(type == 106){
|
||||
mat = Material.getMaterial(block.getTypeId());
|
||||
is = new ItemStack(mat, 1, (byte)0, (byte)0);
|
||||
if(player != null){
|
||||
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
|
||||
m.mcDropItem(loc, is);
|
||||
}
|
||||
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
|
||||
}
|
||||
}
|
||||
Skills.XpCheckSkill(SkillType.HERBALISM, player);
|
||||
}
|
||||
|
||||
@@ -16,21 +16,22 @@
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import net.minecraft.server.Enchantment;
|
||||
|
||||
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;
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
|
||||
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.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;
|
||||
@@ -62,194 +63,207 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public static void blockProcSimulate(Block block)
|
||||
public static void blockProcSimulate(Block block, Player player)
|
||||
{
|
||||
Location loc = block.getLocation();
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
int id = block.getTypeId();
|
||||
Material mat = Material.getMaterial(id);
|
||||
byte damage = 0;
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
if(block.getTypeId() != 89 && block.getTypeId() != 73 && block.getTypeId() != 74 && block.getTypeId() != 56
|
||||
&& block.getTypeId() != 21 && block.getTypeId() != 1 && block.getTypeId() != 16)
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
if(block.getTypeId() == 89)
|
||||
{
|
||||
mat = Material.getMaterial(348);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
|
||||
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;
|
||||
}
|
||||
if(block.getTypeId() == 73 || block.getTypeId() == 74)
|
||||
{
|
||||
mat = Material.getMaterial(331);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
if(Math.random() * 10 > 5){
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
|
||||
//Drop natural block with Silk Touch
|
||||
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
|
||||
m.mcDropItem(loc, item);
|
||||
return;
|
||||
}
|
||||
if(block.getTypeId() == 21)
|
||||
{
|
||||
mat = Material.getMaterial(351);
|
||||
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
if(block.getTypeId() == 56)
|
||||
{
|
||||
mat = Material.getMaterial(264);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
if(block.getTypeId() == 1)
|
||||
{
|
||||
mat = Material.getMaterial(4);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
if(block.getTypeId() == 16)
|
||||
{
|
||||
mat = Material.getMaterial(263);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public static void blockProcCheck(Block block, Player player)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING))
|
||||
if(PP.getSkillLevel(SkillType.MINING) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)))
|
||||
{
|
||||
blockProcSimulate(block);
|
||||
blockProcSimulate(block, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void miningBlockCheck(Boolean smelt, Player player, Block block, mcMMO plugin)
|
||||
public static void miningBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
|
||||
return;
|
||||
int xp = 0;
|
||||
if(block.getTypeId() == 1 || block.getTypeId() == 24)
|
||||
{
|
||||
xp += LoadProperties.mstone;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//OBSIDIAN
|
||||
if(block.getTypeId() == 49)
|
||||
{
|
||||
xp += LoadProperties.mobsidian;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//NETHERRACK
|
||||
if(block.getTypeId() == 87)
|
||||
{
|
||||
xp += LoadProperties.mnetherrack;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GLOWSTONE
|
||||
if(block.getTypeId() == 89)
|
||||
{
|
||||
xp += LoadProperties.mglowstone;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//COAL
|
||||
if(block.getTypeId() == 16)
|
||||
{
|
||||
xp += LoadProperties.mcoal;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GOLD
|
||||
if(block.getTypeId() == 14)
|
||||
{
|
||||
xp += LoadProperties.mgold;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//DIAMOND
|
||||
if(block.getTypeId() == 56){
|
||||
xp += LoadProperties.mdiamond;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//IRON
|
||||
if(block.getTypeId() == 15)
|
||||
{
|
||||
xp += LoadProperties.miron;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//REDSTONE
|
||||
if(block.getTypeId() == 73 || block.getTypeId() == 74)
|
||||
{
|
||||
xp += LoadProperties.mredstone;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//LAPUS
|
||||
if(block.getTypeId() == 21)
|
||||
{
|
||||
xp += LoadProperties.mlapis;
|
||||
if(smelt = false)
|
||||
blockProcCheck(block, player);
|
||||
else
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
int id = block.getTypeId();
|
||||
|
||||
switch (id) {
|
||||
//STONE
|
||||
case 1:
|
||||
xp += LoadProperties.mstone;
|
||||
break;
|
||||
//SANDSTONE
|
||||
case 24:
|
||||
xp += LoadProperties.msandstone;
|
||||
break;
|
||||
//OBSIDIAN
|
||||
case 49:
|
||||
xp += LoadProperties.mobsidian;
|
||||
break;
|
||||
//NETHERRACK
|
||||
case 87:
|
||||
xp += LoadProperties.mnetherrack;
|
||||
break;
|
||||
//GLOWSTONE
|
||||
case 89:
|
||||
xp += LoadProperties.mglowstone;
|
||||
break;
|
||||
//COAL
|
||||
case 16:
|
||||
xp += LoadProperties.mcoal;
|
||||
break;
|
||||
//GOLD
|
||||
case 14:
|
||||
xp += LoadProperties.mgold;
|
||||
break;
|
||||
//DIAMOND
|
||||
case 56:
|
||||
xp += LoadProperties.mdiamond;
|
||||
break;
|
||||
//IRON
|
||||
case 15:
|
||||
xp += LoadProperties.miron;
|
||||
break;
|
||||
//REDSTONE
|
||||
case 73:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
case 74:
|
||||
xp += LoadProperties.mredstone;
|
||||
break;
|
||||
//LAPIS
|
||||
case 21:
|
||||
xp += LoadProperties.mlapis;
|
||||
break;
|
||||
//NETHER BRICK
|
||||
case 112:
|
||||
xp += LoadProperties.mnetherbrick;
|
||||
break;
|
||||
//END STONE
|
||||
case 121:
|
||||
xp += LoadProperties.mendstone;
|
||||
break;
|
||||
//MOSS STONE
|
||||
case 48:
|
||||
xp += LoadProperties.mmossstone;
|
||||
break;
|
||||
//STONE BRICK
|
||||
case 98:
|
||||
xp += LoadProperties.mstonebrick;
|
||||
break;
|
||||
}
|
||||
|
||||
if(canBeSuperBroken(block))
|
||||
blockProcCheck(block, player);
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handling SuperBreaker stuff
|
||||
*/
|
||||
public static Boolean canBeSuperBroken(Block block)
|
||||
{
|
||||
int t = block.getTypeId();
|
||||
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
int id = block.getTypeId();
|
||||
return id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98;
|
||||
}
|
||||
|
||||
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
@@ -257,184 +271,140 @@ public class Mining
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY))
|
||||
{
|
||||
|
||||
}
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
}
|
||||
|
||||
Location loc = block.getLocation();
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
//Pre-processing
|
||||
int id = block.getTypeId();
|
||||
int xp = 0;
|
||||
byte damage = 0;
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
if(block.getTypeId() == 1 || block.getTypeId() == 24)
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
|
||||
//STONE
|
||||
if(id == 1 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(block.getTypeId() == 1)
|
||||
{
|
||||
mat = Material.COBBLESTONE;
|
||||
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
|
||||
{
|
||||
xp += LoadProperties.mstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
} else
|
||||
{
|
||||
mat = Material.SANDSTONE;
|
||||
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
|
||||
{
|
||||
xp += LoadProperties.msandstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
}
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//SANDSTONE
|
||||
else if(id == 24 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.msandstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//NETHERRACK
|
||||
if(block.getTypeId() == 87)
|
||||
else if(id == 87 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mnetherrack;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(87);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mnetherrack;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GLOWSTONE
|
||||
if(block.getTypeId() == 89)
|
||||
else if(id == 89 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mglowstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(348);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mglowstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//COAL
|
||||
if(block.getTypeId() == 16)
|
||||
else if(id == 16 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mcoal;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(263);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mcoal;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//GOLD
|
||||
if(block.getTypeId() == 14 && m.getTier(player) >= 3)
|
||||
else if(id == 14 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mgold;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mgold;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//OBSIDIAN
|
||||
if(block.getTypeId() == 49 && m.getTier(player) >= 4)
|
||||
else if(id == 49 && m.getTier(player) >= 4 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mobsidian;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(49);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mobsidian;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//DIAMOND
|
||||
if(block.getTypeId() == 56 && m.getTier(player) >= 3)
|
||||
else if(id == 56 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mdiamond;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(264);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mdiamond;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//IRON
|
||||
if(block.getTypeId() == 15 && m.getTier(player) >= 2)
|
||||
else if(id == 15 && m.getTier(player) >= 2 && block.getData() != (byte) 5)
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.miron;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.miron;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//REDSTONE
|
||||
if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 4)
|
||||
else if((id == 73 || id == 74) && m.getTier(player) >= 3 && !plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5)
|
||||
{
|
||||
xp += LoadProperties.mredstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(331);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
if(Math.random() * 10 > 5)
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
}
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mredstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//LAPUS
|
||||
if(block.getTypeId() == 21 && m.getTier(player) >= 3){
|
||||
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
|
||||
xp += LoadProperties.mlapis;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
mat = Material.getMaterial(351);
|
||||
item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
|
||||
block.setType(Material.AIR);
|
||||
//LAPIS
|
||||
else if(id == 21 && m.getTier(player) >= 3 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mlapis;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
if(block.getData() != (byte) 5)
|
||||
//NETHER BRICK
|
||||
else if(id == 112 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mnetherbrick;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//END STONE
|
||||
else if(id == 121 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mendstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//MOSS STONE
|
||||
else if(id == 48 && block.getData() != (byte) 5)
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mmossstone;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
//STONE BRICK
|
||||
else if(id == 98 && !plugin.misc.blockWatchList.contains(block))
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
xp += LoadProperties.mstonebrick;
|
||||
blockProcCheck(block, player);
|
||||
blockProcCheck(block, player);
|
||||
}
|
||||
|
||||
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
|
||||
PP.addXP(SkillType.MINING, xp, player);
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
|
||||
Skills.XpCheckSkill(SkillType.MINING, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -32,9 +33,11 @@ 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;
|
||||
import com.gmail.nossr50.events.McMMOPlayerLevelUpEvent;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
|
||||
@@ -75,33 +78,32 @@ public class Skills
|
||||
return (int) (((deactivatedTimeStamp + (cooldown * 1000)) - System.currentTimeMillis())/1000);
|
||||
}
|
||||
|
||||
public static void watchCooldowns(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(!PP.getGreenTerraInformed() && System.currentTimeMillis() - (PP.getGreenTerraDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 1000)){
|
||||
public static void watchCooldowns(Player player, PlayerProfile PP, long curTime){
|
||||
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() && System.currentTimeMillis() - (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() && System.currentTimeMillis() - (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() && System.currentTimeMillis() - (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() && System.currentTimeMillis() - (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() && System.currentTimeMillis() - (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() && System.currentTimeMillis() - (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"));
|
||||
}
|
||||
@@ -113,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)
|
||||
@@ -124,104 +126,101 @@ public class Skills
|
||||
PP.setHoePreparationMode(true);
|
||||
}
|
||||
}
|
||||
public static void monitorSkills(Player player){
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if(PP != null)
|
||||
{
|
||||
if(PP.getHoePreparationMode() && System.currentTimeMillis() - (PP.getHoePreparationATS()*1000) >= 4000){
|
||||
PP.setHoePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerHoe"));
|
||||
|
||||
public static void monitorSkills(Player player, PlayerProfile PP, long curTime){
|
||||
if(PP.getHoePreparationMode() && curTime - (PP.getHoePreparationATS()*1000) >= 4000){
|
||||
PP.setHoePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerHoe"));
|
||||
}
|
||||
if(PP.getAxePreparationMode() && curTime - (PP.getAxePreparationATS()*1000) >= 4000){
|
||||
PP.setAxePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerAxe"));
|
||||
}
|
||||
if(PP.getPickaxePreparationMode() && curTime - (PP.getPickaxePreparationATS()*1000) >= 4000){
|
||||
PP.setPickaxePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerPickAxe"));
|
||||
}
|
||||
if(PP.getSwordsPreparationMode() && curTime - (PP.getSwordsPreparationATS()*1000) >= 4000){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerSword"));
|
||||
}
|
||||
if(PP.getFistsPreparationMode() && curTime - (PP.getFistsPreparationATS()*1000) >= 4000){
|
||||
PP.setFistsPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerFists"));
|
||||
}
|
||||
if(PP.getShovelPreparationMode() && curTime - (PP.getShovelPreparationATS()*1000) >= 4000){
|
||||
PP.setShovelPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerShovel"));
|
||||
}
|
||||
|
||||
/*
|
||||
* HERBALISM ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().herbalismAbility(player)){
|
||||
if(PP.getGreenTerraMode() && (PP.getSkillDATS(AbilityType.GREEN_TERRA)*1000) <= curTime){
|
||||
PP.setGreenTerraMode(false);
|
||||
PP.setGreenTerraInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.GreenTerraOff"));
|
||||
}
|
||||
if(PP.getAxePreparationMode() && System.currentTimeMillis() - (PP.getAxePreparationATS()*1000) >= 4000){
|
||||
PP.setAxePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerAxe"));
|
||||
}
|
||||
/*
|
||||
* AXES ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().axesAbility(player)){
|
||||
if(PP.getSkullSplitterMode() && (PP.getSkillDATS(AbilityType.SKULL_SPLIITER)*1000) <= curTime){
|
||||
PP.setSkullSplitterMode(false);
|
||||
PP.setSkullSplitterInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOff"));
|
||||
}
|
||||
if(PP.getPickaxePreparationMode() && System.currentTimeMillis() - (PP.getPickaxePreparationATS()*1000) >= 4000){
|
||||
PP.setPickaxePreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerPickAxe"));
|
||||
}
|
||||
/*
|
||||
* WOODCUTTING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().woodCuttingAbility(player)){
|
||||
if(PP.getTreeFellerMode() && (PP.getSkillDATS(AbilityType.TREE_FELLER)*1000) <= curTime){
|
||||
PP.setTreeFellerMode(false);
|
||||
PP.setTreeFellerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.TreeFellerOff"));
|
||||
}
|
||||
if(PP.getSwordsPreparationMode() && System.currentTimeMillis() - (PP.getSwordsPreparationATS()*1000) >= 4000){
|
||||
PP.setSwordsPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerSword"));
|
||||
}
|
||||
/*
|
||||
* MINING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().miningAbility(player)){
|
||||
if(PP.getSuperBreakerMode() && (PP.getSkillDATS(AbilityType.SUPER_BREAKER)*1000) <= curTime){
|
||||
PP.setSuperBreakerMode(false);
|
||||
PP.setSuperBreakerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOff"));
|
||||
}
|
||||
if(PP.getFistsPreparationMode() && System.currentTimeMillis() - (PP.getFistsPreparationATS()*1000) >= 4000){
|
||||
PP.setFistsPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerFists"));
|
||||
}
|
||||
/*
|
||||
* EXCAVATION ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavationAbility(player)){
|
||||
if(PP.getGigaDrillBreakerMode() && (PP.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER)*1000) <= curTime){
|
||||
PP.setGigaDrillBreakerMode(false);
|
||||
PP.setGigaDrillBreakerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOff"));
|
||||
}
|
||||
if(PP.getShovelPreparationMode() && System.currentTimeMillis() - (PP.getShovelPreparationATS()*1000) >= 4000){
|
||||
PP.setShovelPreparationMode(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.LowerShovel"));
|
||||
}
|
||||
/*
|
||||
* SWORDS ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().swordsAbility(player)){
|
||||
if(PP.getSerratedStrikesMode() && (PP.getSkillDATS(AbilityType.SERRATED_STRIKES)*1000) <= curTime){
|
||||
PP.setSerratedStrikesMode(false);
|
||||
PP.setSerratedStrikesInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOff"));
|
||||
}
|
||||
|
||||
/*
|
||||
* HERBALISM ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().herbalismAbility(player)){
|
||||
if(PP.getGreenTerraMode() && (PP.getGreenTerraDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setGreenTerraMode(false);
|
||||
PP.setGreenTerraInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.GreenTerraOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* AXES ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().axesAbility(player)){
|
||||
if(PP.getSkullSplitterMode() && (PP.getSkullSplitterDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setSkullSplitterMode(false);
|
||||
PP.setSkullSplitterInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SkullSplitterOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* WOODCUTTING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().woodCuttingAbility(player)){
|
||||
if(PP.getTreeFellerMode() && (PP.getTreeFellerDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setTreeFellerMode(false);
|
||||
PP.setTreeFellerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.TreeFellerOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* MINING ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().miningAbility(player)){
|
||||
if(PP.getSuperBreakerMode() && (PP.getSuperBreakerDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setSuperBreakerMode(false);
|
||||
PP.setSuperBreakerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SuperBreakerOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* EXCAVATION ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().excavationAbility(player)){
|
||||
if(PP.getGigaDrillBreakerMode() && (PP.getGigaDrillBreakerDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setGigaDrillBreakerMode(false);
|
||||
PP.setGigaDrillBreakerInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.GigaDrillBreakerOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* SWORDS ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().swordsAbility(player)){
|
||||
if(PP.getSerratedStrikesMode() && (PP.getSerratedStrikesDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setSerratedStrikesMode(false);
|
||||
PP.setSerratedStrikesInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.SerratedStrikesOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UNARMED ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().unarmedAbility(player)){
|
||||
if(PP.getBerserkMode() && (PP.getBerserkDeactivatedTimeStamp()*1000) <= System.currentTimeMillis()){
|
||||
PP.setBerserkMode(false);
|
||||
PP.setBerserkInformed(false);
|
||||
player.sendMessage(mcLocale.getString("Skills.BerserkOff"));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* UNARMED ABILITY
|
||||
*/
|
||||
if(mcPermissions.getInstance().unarmedAbility(player)){
|
||||
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)
|
||||
@@ -315,6 +314,11 @@ public class Skills
|
||||
|
||||
public static void XpCheckSkill(SkillType skillType, Player player)
|
||||
{
|
||||
if(skillType == SkillType.ALL) {
|
||||
XpCheckAll(player);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
@@ -323,9 +327,14 @@ public class Skills
|
||||
|
||||
while(PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType))
|
||||
{
|
||||
skillups++;
|
||||
if(getSkillMaxLevel(skillType) >= PP.getSkillLevel(skillType) + 1) {
|
||||
skillups++;
|
||||
PP.skillUp(skillType, 1);
|
||||
|
||||
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
|
||||
Bukkit.getPluginManager().callEvent(eventToFire);
|
||||
}
|
||||
PP.removeXP(skillType, PP.getXpToLevel(skillType));
|
||||
PP.skillUp(skillType, 1);
|
||||
}
|
||||
|
||||
if(!LoadProperties.useMySQL)
|
||||
@@ -373,6 +382,36 @@ public class Skills
|
||||
XpCheckSkill(x, player);
|
||||
}
|
||||
}
|
||||
public static int getSkillMaxLevel(SkillType skillType) {
|
||||
switch(skillType) {
|
||||
case ACROBATICS:
|
||||
return (LoadProperties.levelCapAcrobatics > 0) ? LoadProperties.levelCapAcrobatics : Integer.MAX_VALUE;
|
||||
case ARCHERY:
|
||||
return (LoadProperties.levelCapArchery > 0) ? LoadProperties.levelCapArchery : Integer.MAX_VALUE;
|
||||
case AXES:
|
||||
return (LoadProperties.levelCapAxes > 0) ? LoadProperties.levelCapAxes : Integer.MAX_VALUE;
|
||||
case EXCAVATION:
|
||||
return (LoadProperties.levelCapExcavation > 0) ? LoadProperties.levelCapExcavation : Integer.MAX_VALUE;
|
||||
case FISHING:
|
||||
return (LoadProperties.levelCapFishing > 0) ? LoadProperties.levelCapFishing : Integer.MAX_VALUE;
|
||||
case HERBALISM:
|
||||
return (LoadProperties.levelCapHerbalism > 0) ? LoadProperties.levelCapHerbalism : Integer.MAX_VALUE;
|
||||
case MINING:
|
||||
return (LoadProperties.levelCapMining > 0) ? LoadProperties.levelCapMining : Integer.MAX_VALUE;
|
||||
case REPAIR:
|
||||
return (LoadProperties.levelCapRepair > 0) ? LoadProperties.levelCapRepair : Integer.MAX_VALUE;
|
||||
case SWORDS:
|
||||
return (LoadProperties.levelCapSwords > 0) ? LoadProperties.levelCapSwords : Integer.MAX_VALUE;
|
||||
case TAMING:
|
||||
return (LoadProperties.levelCapTaming > 0) ? LoadProperties.levelCapTaming : Integer.MAX_VALUE;
|
||||
case UNARMED:
|
||||
return (LoadProperties.levelCapUnarmed > 0) ? LoadProperties.levelCapUnarmed : Integer.MAX_VALUE;
|
||||
case WOODCUTTING:
|
||||
return (LoadProperties.levelCapWoodcutting > 0) ? LoadProperties.levelCapWoodcutting : Integer.MAX_VALUE;
|
||||
default:
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
public static SkillType getSkillType(String skillName)
|
||||
{
|
||||
for(SkillType x : SkillType.values())
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -28,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;
|
||||
@@ -51,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())
|
||||
@@ -59,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);
|
||||
}
|
||||
|
||||
@@ -85,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);
|
||||
@@ -119,67 +118,62 @@ 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)
|
||||
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(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())
|
||||
{
|
||||
target.damage(event.getDamage() / 4);
|
||||
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;
|
||||
target.damage(event.getDamage() / 4);
|
||||
targets--;
|
||||
}
|
||||
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)
|
||||
{
|
||||
//Don't want to counter attack arrows
|
||||
//Don't want to counter attack stuff not alive
|
||||
|
||||
if(event.getDamager() instanceof Arrow)
|
||||
if(!(event.getDamager() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
|
||||
if(event instanceof EntityDamageByEntityEvent)
|
||||
{
|
||||
Entity f = ((EntityDamageByEntityEvent) event).getDamager();
|
||||
@@ -193,7 +187,7 @@ public class Swords
|
||||
{
|
||||
if(Math.random() * 2000 <= 600)
|
||||
{
|
||||
Combat.dealDamage(f, event.getDamage() / 2);
|
||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||
if(f instanceof Player)
|
||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||
@@ -201,7 +195,7 @@ public class Swords
|
||||
}
|
||||
else if (Math.random() * 2000 <= PPd.getSkillLevel(SkillType.SWORDS))
|
||||
{
|
||||
Combat.dealDamage(f, event.getDamage() / 2);
|
||||
Combat.dealDamage((LivingEntity) f, event.getDamage() / 2);
|
||||
defender.sendMessage(ChatColor.GREEN+"**COUNTER-ATTACKED**");
|
||||
if(f instanceof Player)
|
||||
((Player) f).sendMessage(ChatColor.DARK_RED+"Hit with counterattack!");
|
||||
@@ -245,7 +239,7 @@ public class Swords
|
||||
}
|
||||
else
|
||||
{
|
||||
x.damage(2);
|
||||
Combat.dealDamage(x, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,13 @@ public class Taming
|
||||
|
||||
public static String getOwnerName(Wolf theWolf)
|
||||
{
|
||||
Player owner = (Player)theWolf.getOwner();
|
||||
Player owner = null;
|
||||
|
||||
if (theWolf.getOwner() instanceof Player)
|
||||
{
|
||||
owner = (Player)theWolf.getOwner();
|
||||
}
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
return owner.getName();
|
||||
|
||||
@@ -23,6 +23,7 @@ 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;
|
||||
@@ -37,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())
|
||||
@@ -52,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);
|
||||
}
|
||||
}
|
||||
@@ -84,7 +88,7 @@ public class Unarmed {
|
||||
ItemStack item = defender.getItemInHand();
|
||||
if(item != null)
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
m.mcDropItem(loc, item);
|
||||
ItemStack itemx = null;
|
||||
defender.setItemInHand(itemx);
|
||||
}
|
||||
@@ -99,7 +103,7 @@ public class Unarmed {
|
||||
ItemStack item = defender.getItemInHand();
|
||||
if(item != null)
|
||||
{
|
||||
loc.getWorld().dropItemNaturally(loc, item);
|
||||
m.mcDropItem(loc, item);
|
||||
ItemStack itemx = null;
|
||||
defender.setItemInHand(itemx);
|
||||
}
|
||||
|
||||
@@ -17,20 +17,25 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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.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;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import org.getspout.spoutapi.sound.SoundEffect;
|
||||
|
||||
|
||||
public class WoodCutting
|
||||
@@ -45,10 +50,10 @@ public class WoodCutting
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
if(player != null)
|
||||
{
|
||||
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING))
|
||||
if(PP.getSkillLevel(SkillType.WOODCUTTING) > 1000 || (Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)))
|
||||
{
|
||||
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
|
||||
block.getWorld().dropItemNaturally(block.getLocation(), item);
|
||||
m.mcDropItem(block.getLocation(), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,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())
|
||||
@@ -85,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)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,4 +170,49 @@ public class WoodCutting
|
||||
isdone = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void woodcuttingBlockCheck(Player player, Block block, mcMMO plugin)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int xp = 0;
|
||||
byte data = block.getData();
|
||||
|
||||
if(plugin.misc.blockWatchList.contains(block))
|
||||
return;
|
||||
|
||||
switch(data)
|
||||
{
|
||||
case 0:
|
||||
xp += LoadProperties.mpine;
|
||||
break;
|
||||
case 1:
|
||||
xp += LoadProperties.mspruce;
|
||||
break;
|
||||
case 2:
|
||||
xp += LoadProperties.mbirch;
|
||||
break;
|
||||
}
|
||||
|
||||
if(block.getTypeId() == 17)
|
||||
{
|
||||
WoodCutting.woodCuttingProcCheck(player, block);
|
||||
PP.addXP(SkillType.WOODCUTTING, xp, player);
|
||||
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void leafBlower(Player player, Block block){
|
||||
|
||||
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(armswing);
|
||||
|
||||
if(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||
{
|
||||
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||
}
|
||||
|
||||
if(LoadProperties.spoutEnabled)
|
||||
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
import org.getspout.spoutapi.keyboard.Keyboard;
|
||||
@@ -209,9 +207,9 @@ public class SpoutStuff
|
||||
}
|
||||
public static void registerCustomEvent()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutInputListener, Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutScreenListener, Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(spoutListener, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(spoutInputListener, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(spoutScreenListener, plugin);
|
||||
}
|
||||
|
||||
public static Color getRetroColor(SkillType type)
|
||||
|
||||
357
src/main/resources/config.yml
Normal file
@@ -0,0 +1,357 @@
|
||||
Items:
|
||||
Chimaera_Wing:
|
||||
Enabled: true
|
||||
Feather_Cost: 10
|
||||
Item_ID: 288
|
||||
Spout:
|
||||
Menu:
|
||||
Key: KEY_M
|
||||
XP:
|
||||
Bar:
|
||||
Enabled: true
|
||||
X_POS: 95
|
||||
Y_POS: 6
|
||||
Icon:
|
||||
Enabled: true
|
||||
X_POS: 78
|
||||
Y_POS: 2
|
||||
Party:
|
||||
HUD:
|
||||
Show_Faces: true
|
||||
Enabled: true
|
||||
Show_Display_Name: false
|
||||
HUD:
|
||||
Default: STANDARD
|
||||
Retro:
|
||||
Colors:
|
||||
Swords:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Taming:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Acrobatics:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Border:
|
||||
BLUE: 0.0
|
||||
GREEN: 0.0
|
||||
RED: 0.0
|
||||
Background:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.75
|
||||
RED: 0.75
|
||||
Woodcutting:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Archery:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Axes:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Repair:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Fishing:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Excavation:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Herbalism:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Unarmed:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Mining:
|
||||
BLUE: 0.75
|
||||
GREEN: 0.3
|
||||
RED: 0.3
|
||||
Fishing:
|
||||
Drops:
|
||||
Gold_Tools: true
|
||||
Diamond_Armor: true
|
||||
Stone_Tools: true
|
||||
Diamonds: true
|
||||
Iron_Armor: true
|
||||
Iron_Tools: true
|
||||
Diamond_Tools: true
|
||||
Item_Drops_Enabled: true
|
||||
Records: true
|
||||
Blaze_Rod: true
|
||||
Leather_Armor: true
|
||||
Drop_Chance:
|
||||
Tier_1: 20
|
||||
Tier_2: 25
|
||||
Tier_3: 30
|
||||
Tier_4: 35
|
||||
Tier_5: 40
|
||||
Gold_Armor: true
|
||||
Glowstone_Dust: true
|
||||
Ender_Pearl: true
|
||||
Wooden_Tools: true
|
||||
Skills:
|
||||
Acrobatics:
|
||||
Level_Cap: 0 #Level cap of 0 for no limit
|
||||
Archery:
|
||||
Level_Cap: 0
|
||||
Axes:
|
||||
Level_Cap: 0
|
||||
Excavation:
|
||||
Level_Cap: 0
|
||||
Requires_Shovel: true
|
||||
Fishing:
|
||||
Level_Cap: 0
|
||||
Herbalism:
|
||||
Level_Cap: 0
|
||||
Green_Thumb:
|
||||
Cobble_To_Mossy: true
|
||||
SmoothBrick_To_MossyBrick: true
|
||||
Dirt_To_Grass: true
|
||||
Mining:
|
||||
Level_Cap: 0
|
||||
Requires_Pickaxe: true
|
||||
Repair:
|
||||
Level_Cap: 0
|
||||
Leather:
|
||||
Name: Leather
|
||||
ID: 334
|
||||
String:
|
||||
Name: String
|
||||
ID: 287
|
||||
Stone:
|
||||
Name: Cobblestone
|
||||
ID: 4
|
||||
Wood:
|
||||
Name: Wood Planks
|
||||
ID: 5
|
||||
Gold:
|
||||
Name: Gold Bars
|
||||
ID: 266
|
||||
Anvil_Messages: true
|
||||
Anvil_ID: 42
|
||||
Diamond:
|
||||
Name: Diamond
|
||||
Level_Required: 50
|
||||
ID: 264
|
||||
Iron:
|
||||
Name: Iron Bars
|
||||
ID: 265
|
||||
Swords:
|
||||
Level_Cap: 0
|
||||
Taming:
|
||||
Level_Cap: 0
|
||||
Call_Of_The_Wild:
|
||||
Bones_Required: 10
|
||||
Unarmed:
|
||||
Level_Cap: 0
|
||||
Woodcutting:
|
||||
Level_Cap: 0
|
||||
Requires_Axe: true
|
||||
Experience:
|
||||
Fishing:
|
||||
Base: 800
|
||||
Formula:
|
||||
Multiplier:
|
||||
Swords: 1.0
|
||||
Taming: 1.0
|
||||
Acrobatics: 1.0
|
||||
Sorcery: 1.0
|
||||
Excavation: 1.0
|
||||
Herbalism: 1.0
|
||||
Unarmed: 1.0
|
||||
Woodcutting: 1.0
|
||||
Mining: 1.0
|
||||
Archery: 1.0
|
||||
Axes: 1.0
|
||||
Repair: 1.0
|
||||
Gains:
|
||||
Mobspawners:
|
||||
Enabled: false
|
||||
Multiplier:
|
||||
PVP: 1
|
||||
Global: 1.0
|
||||
PVP:
|
||||
Rewards: true
|
||||
Excavation:
|
||||
Base: 40
|
||||
Cake: 3000
|
||||
Sulphur: 30
|
||||
Bones: 30
|
||||
Map: 200
|
||||
Slimeballs: 100
|
||||
Bucket: 100
|
||||
Apple: 100
|
||||
Mushroom: 80
|
||||
Eggs: 100
|
||||
Slowsand: 80
|
||||
Watch: 200
|
||||
Web: 150
|
||||
String: 200
|
||||
Glowstone: 80
|
||||
Music: 3000
|
||||
Diamond: 1000
|
||||
Cocoa_Beans: 100
|
||||
Woodcutting:
|
||||
Birch: 70
|
||||
Spruce: 80
|
||||
Pine: 90
|
||||
Herbalism:
|
||||
Sugar_Cane: 30
|
||||
Cactus: 30
|
||||
Flowers: 100
|
||||
Pumpkin: 20
|
||||
Mushrooms: 150
|
||||
Wheat: 50
|
||||
Melon: 20
|
||||
Nether_Wart: 50
|
||||
Lily_Pads: 100
|
||||
Vines: 10
|
||||
Mining:
|
||||
Sandstone: 30
|
||||
Glowstone: 30
|
||||
Lapis: 400
|
||||
Obsidian: 150
|
||||
Stone: 30
|
||||
Netherrack: 30
|
||||
Gold: 350
|
||||
Redstone: 150
|
||||
Coal: 100
|
||||
Diamond: 750
|
||||
Iron: 250
|
||||
MySQL:
|
||||
Enabled: false
|
||||
Database:
|
||||
User:
|
||||
Name: UserName
|
||||
Password: UserPassword
|
||||
Name: DataBaseName
|
||||
TablePrefix: mcmmo_
|
||||
Server:
|
||||
Port: 3306
|
||||
Address: localhost
|
||||
XP:
|
||||
Gains:
|
||||
Mobspawners:
|
||||
Enabled: false
|
||||
PVP:
|
||||
Rewards: true
|
||||
General:
|
||||
HP_Regeneration:
|
||||
Enabled: true
|
||||
Locale: en_us
|
||||
MySpawn:
|
||||
Enabled: true
|
||||
MOTD:
|
||||
Enabled: true
|
||||
#Amount of time (in minutes) to wait between saves of player information
|
||||
Save_Interval: 10
|
||||
Excavation:
|
||||
Drops:
|
||||
Cake: true
|
||||
Sulphur: true
|
||||
Bones: true
|
||||
Apples: true
|
||||
Map: true
|
||||
Slimeballs: true
|
||||
Bucket: true
|
||||
Netherrack: true
|
||||
Mushrooms: true
|
||||
Eggs: true
|
||||
Slowsand: true
|
||||
Watch: true
|
||||
Web: true
|
||||
String: true
|
||||
Glowstone: true
|
||||
Music: true
|
||||
Diamond: true
|
||||
Cocoa_Beans: true
|
||||
Arcane_Forging:
|
||||
Keep_Enchants:
|
||||
Chance:
|
||||
Rank_4: 40
|
||||
Rank_3: 30
|
||||
Rank_2: 20
|
||||
Rank_1: 10
|
||||
May_Lose_Enchants:
|
||||
Enabled: true
|
||||
Downgrades:
|
||||
Enabled: true
|
||||
Chance:
|
||||
Rank_4: 15
|
||||
Rank_3: 25
|
||||
Rank_2: 50
|
||||
Rank_1: 75
|
||||
Abilities:
|
||||
Activation:
|
||||
Only_Activate_When_Sneaking: false
|
||||
Enabled: true
|
||||
Messages: true
|
||||
Cooldowns:
|
||||
Giga_Drill_Breaker: 240
|
||||
Berserk: 240
|
||||
Green_Terra: 240
|
||||
Skull_Splitter: 240
|
||||
Serrated_Strikes: 240
|
||||
Tree_Feller: 240
|
||||
Super_Breaker: 240
|
||||
Tools:
|
||||
Durability_Loss: 2
|
||||
Durability_Loss_Enabled: true
|
||||
Commands:
|
||||
invite:
|
||||
Enabled: true
|
||||
mctop:
|
||||
Enabled: true
|
||||
xplock:
|
||||
Enabled: true
|
||||
whois:
|
||||
Enabled: true
|
||||
mcc:
|
||||
Enabled: true
|
||||
mmoedit:
|
||||
Enabled: true
|
||||
accept:
|
||||
Enabled: true
|
||||
stats:
|
||||
Enabled: true
|
||||
mcability:
|
||||
Enabled: true
|
||||
party:
|
||||
Enabled: true
|
||||
xprate:
|
||||
Enabled: true
|
||||
mcgod:
|
||||
Enabled: true
|
||||
mcmmo:
|
||||
Enabled: true
|
||||
Donate_Message: true
|
||||
mcrefresh:
|
||||
Enabled: true
|
||||
myspawn:
|
||||
Enabled: true
|
||||
addxp:
|
||||
Enabled: true
|
||||
clearmyspawn:
|
||||
Enabled: true
|
||||
ptp:
|
||||
Enabled: true
|
||||
p:
|
||||
Enabled: true
|
||||
Display_Names: true
|
||||
a:
|
||||
Enabled: true
|
||||
Display_Names: true
|
||||
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
@@ -1,8 +1,11 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 1.2.07
|
||||
version: ${project.version}-b${BUILD_NUMBER}
|
||||
softdepend: [Spout]
|
||||
author: nossr50
|
||||
authors:
|
||||
- TheYeti
|
||||
- NuclearW
|
||||
- gmcferrin
|
||||
description: mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience.
|
||||
commands:
|
||||
mchud:
|
||||
|
||||
|
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 506 B |
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 496 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |