1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-19 10:22:58 +01:00

Compare commits

..

114 Commits

Author SHA1 Message Date
NuclearW
20fb69fba3 Fix yml for release version 2012-02-03 21:04:46 -05:00
TheYeti
173c2c19c8 Super Secret Anniversary Easter Egg! Also, update build files for RB 2012-02-03 14:23:32 -08:00
TheYeti
66ac83ed9a Update changelog to reflect work that has been done 2012-02-03 12:51:17 -08:00
TheYeti
595d48d1b4 Update gitignore 2012-02-03 12:29:12 -08:00
gmcferrin
ddbb0176e7 Fix for Issue #7. 2012-02-03 14:11:37 -05:00
gmcferrin
68da48e19f Merge branch 'master' of https://gmcferrin@github.com/TheYeti/mcMMO.git 2012-02-03 13:29:02 -05:00
gmcferrin
c001bb8d2c Fixed some abilities not properly handling Unbreaking items. 2012-02-03 13:28:17 -05:00
NuclearW
f3ffbe1ad1 Add bin to gitignore 2012-02-03 05:51:42 -05:00
TheYeti
b80c73e251 Updated changelog, also somehow my git thinks the xpbar images aren't commited 2012-02-03 02:47:27 -08:00
gmcferrin
892f4935ae Added missing import from last commit. 2012-02-03 01:33:01 -05:00
gmcferrin
cb3904246c Fixed errors in last commit 2012-02-03 01:26:12 -05:00
gmcferrin
47ed176191 Updated Giga Breaker to properly handle Mycellium & Unbreaking enchants 2012-02-03 01:20:04 -05:00
gmcferrin
151c9ba1d4 Fixed bug with some skills failing to work once player passes max level
boost for the skill.
2012-02-02 17:04:49 -05:00
gmcferrin
81ab8692ad Fixed bug where it was impossible to get max level of enchants from
fishing.
2012-02-02 11:18:26 -05:00
gmcferrin
123e96e39d Fix for issue #85: Mining procs from odd blocks 2012-02-02 11:04:33 -05:00
gmcferrin
b4a3ddba3c Fixed issues with level caps having a tab character in the config file. 2012-02-02 08:26:02 -05:00
gmcferrin
2b85ed01ea Fixed BlockProcSimulate not having a Player input. 2012-02-02 01:26:52 -05:00
Grant
c99fce9143 Merge remote branch 'origin/master' 2012-02-02 01:12:55 -05:00
gmcferrin
ade31de797 Made Super Breaker & Silk Touch work together properly. 2012-02-02 00:56:56 -05:00
NuclearW
b8f4b6e2da Preliminary level caps implementation
Also with an option to choose name/displayname for a and p commands, as well as enable/disable them
2012-02-02 00:24:07 -05:00
gmcferrin
c95d2a9b84 ACTUALLY fixed missing variable type. 2012-02-01 16:08:00 -05:00
gmcferrin
ceca881cd5 Fixed missing variable type. 2012-02-01 15:57:47 -05:00
gmcferrin
6b668f5ac8 Merge pull request #77 from gmcferrin/pull-me
Optimizations for Excavation.java; Added Mycel & Soul Sand to Giga
2012-02-01 12:41:04 -08:00
gmcferrin
618f075ff2 Optimizations for Excavation.java; Added Mycel & Soul Sand to Giga
Breaker list.
2012-02-01 12:33:59 -05:00
NuclearW
7841fe2434 O(n)wards and upwards to victory.
Still need to do somthing about that thing not being saved on reload.
2012-02-01 12:11:34 -05:00
NuclearW
16577f6f23 Fix NPE 2012-02-01 11:43:57 -05:00
NuclearW
43731bd9f9 Merge pull request #76 from gmcferrin/pull-me
Added Nether Brick, End Stone, Moss Stone, and Stone Brick to Mining.
2012-02-01 07:36:22 -08:00
gmcferrin
0ca57f479b Added Nether Brick, End Stone, Moss Stone, and Stone Brick to Mining. 2012-02-01 10:23:36 -05:00
NuclearW
00d8ed9ec7 Move Spout events to new event system 2012-02-01 06:36:15 -05:00
NuclearW
3fcfde1697 Merge pull request #72 from gmcferrin/pull-me
More Mining optimizations
2012-02-01 01:05:16 -08:00
Grant
e3d04fd940 FIxed variable names in Herbalism.java 2012-02-01 03:50:39 -05:00
Grant
0f41381c98 Herbalism double drop updates 2012-02-01 03:45:46 -05:00
Grant
5b3c176192 Even more Mining optimizations. 2012-02-01 03:28:47 -05:00
Grant
64e6ea86fd Readded redstone ores to BlockWatchList. Added vines to BlockWatchList. 2012-02-01 02:11:01 -05:00
Grant
5404fc8703 More Mining optimizations 2012-02-01 02:00:53 -05:00
NuclearW
7693662cea Merge pull request #71 from gmcferrin/pull-me
Updated to remove unused "smelt" property. Minor optimizations in
2012-01-31 22:54:31 -08:00
Grant
388fd364ac Updated to remove unused "smelt" property. Minor optimizations in
Mining.java
2012-02-01 00:20:01 -05:00
NuclearW
fdb96a2cf8 Updated PayPal info for donations.
Cherry-picked from PR #68
2012-01-31 13:29:03 -05:00
NuclearW
e82d5db4b3 Update to mining
- Make a bit more efficient
 - Some more comments
2012-01-31 12:59:33 -05:00
NuclearW
563baea812 Selectively setExecutor for commands based on config. 2012-01-31 04:10:39 -05:00
TheYeti
3613cbd48b Merge remote branch 'origin/master' 2012-01-31 00:36:38 -08:00
TheYeti
f937e44018 Removal of alias variables and update of all commands 2012-01-31 00:36:07 -08:00
NuclearW
2c7730b478 Temporary fix for redstoneore duplication:
Handle it the same way as a block we cannot use data for.

Closes issue #64
2012-01-31 03:34:49 -05:00
TheYeti
50af20037a We do not need aliasing anymore 2012-01-31 00:22:54 -08:00
NuclearW
b7955ea29e Upate to config
Now has a default config copied over on first run (can and should be commented!)
Currently loads defaults from our in-jar file then what we define in code, could remove what we have in-code?
The power of the auto-formatter compells you
2012-01-31 02:59:46 -05:00
NuclearW
7cefdedea2 Added Nether Wart, Lily Pads, and Vines to Herbalism
Cherry picked from pull #62
2012-01-31 01:25:17 -05:00
NuclearW
647078778d Update gitignore
Remove unused resources.
2012-01-31 01:06:09 -05:00
TheYeti
61c6cd1b55 Change from FileConfiguration to YamlConfiguration 2012-01-30 13:47:47 -08:00
TheYeti
96a395af23 Updating changelog 2012-01-30 12:39:32 -08:00
TheYeti
2297c3e0f6 Merge branch 'refs/heads/master' of git@github.com:TheYeti/mcMMO.git 2012-01-30 12:38:09 -08:00
TheYeti
401af172ae Update LoadProperties to use new FileConfiguration 2012-01-30 12:20:43 -08:00
NuclearW
ddf7920c4d Changes to fishing 2012-01-30 14:20:51 -05:00
TheYeti
c46d900833 Merge remote branch 'origin/master' 2012-01-30 10:50:49 -08:00
The Yeti
bc9b089a53 Merge pull request #60 from gmcferrin/master
Fishing Config Options
2012-01-30 10:50:20 -08:00
TheYeti
e68092cae4 Hard Reset to origin/master due to merge issues 2012-01-30 10:49:15 -08:00
Grant
1aa231c902 Merge remote branch 'org.eclipse.jgit.transport.RemoteConfig@10a3c73/master' 2012-01-30 12:21:00 -05:00
Grant
63d9b30d14 Reverted changes in prior commit to solve compatibility issue. 2012-01-30 12:20:15 -05:00
NuclearW
b695f9ed27 Update for 1.1-R3
Includes fix from R2 as a breakage was introduced, but does not work with R2 because it also does not include the workaround for invalid block type being returned by BlockPlaceEvent.

Closes #57
2012-01-30 10:47:01 -05:00
NuclearW
f3283de8dd Terrible horrible workaround for R2 behavior 2012-01-30 10:09:45 -05:00
Grant
e69c2fd68e Updated pom.xml with new RB & Bukkit API 2012-01-30 07:54:19 -05:00
Grant
d1ce5f0be5 Updates to allow for configuration of items found while fishing. 2012-01-30 02:12:12 -05:00
Grant
5b45ea3739 Merge remote branch 'org.eclipse.jgit.transport.RemoteConfig@10a3c73/master' 2012-01-30 00:13:31 -05:00
gmcferrin
6f95d6b60d Merge pull request #3 from gmcferrin/patch-4
Patch 4
2012-01-29 19:57:10 -08:00
NuclearW
3552b756e0 Update changelog and fix bug 2012-01-29 16:05:46 -05:00
NuclearW
0b5a60e4c6 Update pom for new RB 2012-01-29 15:39:23 -05:00
NuclearW
01bbd9bcac New McMMOItemSpawnEvent
- Changed all of mcMMO to use one drop method to facilitate new event
- Added a missing bit of copyright notice to last event
2012-01-29 02:51:59 -05:00
NuclearW
a61efae527 Fix issues in last commit 2012-01-28 21:19:35 -05:00
NuclearW
3fef87923a Some optimizations
As suggested by @bm01 in issue #19:
- Pass PlayerProfile and current time to monitorSkills
- Pass PlayerProfile and current time to watchCooldowns

Testing with only one player seems to indicate a near-negligible increase in performance, but could be useful with more users online.
2012-01-28 21:13:40 -05:00
gmcferrin
c8869c86be Fix typo. 2012-01-28 19:41:39 -05:00
gmcferrin
42ddf648b1 Possible fix for [Issue #53] 2012-01-28 12:44:49 -05:00
NuclearW
fded7cad96 Fix typo
Stop programming at late night
2012-01-28 02:35:20 -05:00
NuclearW
23354ce049 New custom event McMMOPlayerLevelUpEvent 2012-01-28 02:00:18 -05:00
NuclearW
299f440f63 Change damage to use events system
Should provide a fix for issue #39

Also update pom and removed an unused import.
2012-01-28 01:24:29 -05:00
NuclearW
9bd4a0a707 Fix version 2012-01-27 21:46:24 -05:00
NuclearW
7c60217882 Update version and fix compilation issues 2012-01-27 21:43:56 -05:00
NuclearW
725056d88d Update version and fix compilation issues 2012-01-27 21:37:41 -05:00
The Yeti
f93efe54a5 Merge pull request #52 from gmcferrin/master
Arcane Forging Configuration
2012-01-27 15:35:23 -08:00
The Yeti
59e6d9781f Merge pull request #50 from gmcferrin/patch-3
Fixed cast issue with Repair Mastery - fixes Issue #47
2012-01-27 15:32:59 -08:00
gmcferrin
7d19fe68d9 Made Arcane Forging fully configurable. 2012-01-27 12:26:35 -05:00
gmcferrin
486fb5635d Better variable names for Arcane Forging config 2012-01-27 11:55:06 -05:00
gmcferrin
dfe2d0a585 Made Arcane Forging more configurable - options for keeping enchants & downgrading enchants 2012-01-27 10:51:08 -05:00
gmcferrin
71aac4ea7d Merge pull request #2 from gmcferrin/patch-3
Patch 3
2012-01-26 19:03:03 -08:00
gmcferrin
e1399427f0 Fixed cast issue with Repair Mastery - fixes Issue #47 2012-01-26 21:57:17 -05:00
TheYeti
80cc22efff Stage changes for finalized 1.2.08 2012-01-26 16:09:36 -08:00
NuclearW
5863efbdd8 Events + Alias (not really fix) fix
Changed Bukkit events to new event system
Changed aliasing to send both the mcmmo command and the command used.
2012-01-26 18:42:46 -05:00
TheYeti
85fe839e91 Update changelog and fix for Jenkins build #4 2012-01-26 15:19:07 -08:00
The Yeti
7e7505381b Merge pull request #49 from gmcferrin/patch-2
Fix for [Issue #48] - Combat XP Gain
2012-01-26 15:14:09 -08:00
TheYeti
aadfb22f00 Fixed lack of ; in pull request 2012-01-26 15:11:15 -08:00
gmcferrin
e0b0fd1d80 Merge pull request #1 from gmcferrin/patch-2
Patch 2
2012-01-26 14:16:55 -08:00
gmcferrin
ff9b6fd98a Fix for [Issue #48] - Combat XP Gain 2012-01-26 17:09:38 -05:00
The Yeti
ce3fe8fd21 Merge pull request #46 from gmcferrin/patch-1
Minor bugfixing, add repair for bows & leather armor
2012-01-26 09:50:07 -08:00
The Yeti
93502810e8 Merge pull request #45 from NuclearW/master
Fix missing image
2012-01-26 09:49:15 -08:00
gmcferrin
ac51683161 Commented out obsolete isGold() method 2012-01-26 12:46:03 -05:00
gmcferrin
802be6907d Standardized logic for functions isShovel(), isAxes(), isMiningPick(), isGold(), isSwords(), and isHoe() 2012-01-26 12:31:52 -05:00
gmcferrin
3932036a2c Bugfix for getMaxDurability() checking for Diamond ID values instead of Gold ID values. 2012-01-26 12:17:02 -05:00
gmcferrin
fd1064a9b9 Updates for repairing bows & leather armor. 2012-01-26 11:55:12 -05:00
gmcferrin
f0146d99c2 Typo fixing. 2012-01-26 11:34:10 -05:00
NuclearW
fa98de77b1 Fix missing image 2012-01-26 11:24:07 -05:00
gmcferrin
328c7d4b5f Update src/main/java/com/gmail/nossr50/skills/Repair.java 2012-01-26 10:56:16 -05:00
gmcferrin
984dbd9b7a Allow for repair of bows & leather armor with the anvil. 2012-01-26 10:36:12 -05:00
TheYeti
1cfdfab2b7 Fix typos and type cast mismatch from pull request #31 2012-01-25 14:33:38 -08:00
The Yeti
17d584f911 Merge pull request #31 from gmcferrin/master
Repair & Fishing Fixes
2012-01-25 14:15:04 -08:00
The Yeti
0dddc5a1f7 Merge pull request #36 from NuclearW/master
Changes to pom for getting dependancies from repos + other
2012-01-25 14:14:43 -08:00
NuclearW
b5c11de15c Changes to pom for getting dependancies from repos
Moved resources around to be better organized
Added in fix for commands which got lost ?
gitignore
Increment version to dev-2
2012-01-25 16:52:09 -05:00
gmcferrin
96acb4df97 Implemented ShakeMob functions for all existing mobs 2012-01-19 18:07:46 -05:00
gmcferrin
75cf202987 Fixed issue with Redstone being unable to break with Super Breaker without a diamond pickaxe. 2012-01-19 16:05:09 -05:00
gmcferrin
fd3cee96f0 Fixed typos in conflicting enchantments section. 2012-01-19 15:59:44 -05:00
gmcferrin
aee71789f2 Changed durability calculation to use Bukkit API function. Fixed bug where it was impossible to get the last possible loot item in each tier. Fixed bug where it was possible to get conflicting enchantments. Fixed bug where enchantments couldn't be any higher than level 1. 2012-01-19 14:29:03 -05:00
gmcferrin
da9a4b80e4 Fixed bug with being unable to repair Gold Hoe. Fixed bug with item durability - now uses getMaxDurability from org.bukkit.material 2012-01-19 12:46:54 -05:00
gmcferrin
523db7f0a2 Update src/main/java/com/gmail/nossr50/skills/Repair.java 2012-01-19 12:10:24 -05:00
gmcferrin
b3782eddc3 Update src/main/java/com/gmail/nossr50/skills/Repair.java 2012-01-19 11:37:04 -05:00
TheYeti
1168d363a6 Nightly Build 2012-01-16 20:45:35 -08:00
TheYeti
2854511252 Update version numbers before nightly dev build 2012-01-10 00:48:48 -08:00
TheYeti
6970174503 Fix for issue #212 from upstream repo 2012-01-09 18:33:24 -08:00
361 changed files with 3541 additions and 2139 deletions

36
.gitignore vendored Normal file
View 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

View File

@@ -1,5 +1,37 @@
Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
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

View File

@@ -1,27 +1,27 @@
== 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:
* CraftBukkit
* Spout API
* Permissions
* PermissionsEx
Required to Run:
* Bukkit
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.

59
pom.xml
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.2.07</version>
<version>1.2.09</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>
<directory>${basedir}/src/main/resources/xpbar/</directory>
<includes>
<include>xpbar*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/healthbar/</directory>
<includes>
<include>health*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/skillicon/</directory>
<includes>
<include>*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>true</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,48 @@
</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>
<version>1.1-R4-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.0.1-R2-SNAPSHOT</version>
<version>1.1-R3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.2</version>
<version>3.1.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<groupId>ru.tehkode.permissions</groupId>
<artifactId>bukkit</artifactId>
<version>1.18</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutplugin</artifactId>
<artifactId>spoutpluginapi</artifactId>
<version>dev-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>

View File

@@ -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;
@@ -106,9 +107,9 @@ public class Combat
int hpLeft = defender.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
xpinc = event.getDamage();
else
xpinc = hpLeft;
else
xpinc = event.getDamage();
int xp = (int) (xpinc * 2 * LoadProperties.pvpxprewardmodifier);
@@ -352,17 +353,46 @@ 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);
target.damage(ede.getDamage());
}
public static boolean pvpAllowed(EntityDamageByEntityEvent event, World world)
{
if(!event.getEntity().getWorld().getPVP())
@@ -380,9 +410,9 @@ public class Combat
int hpLeft = le.getHealth(), xpinc = 0;
if(hpLeft < event.getDamage())
xpinc = event.getDamage();
else
xpinc = hpLeft;
else
xpinc = event.getDamage();
if(entity instanceof Animals)
{

View File

@@ -62,7 +62,7 @@ public class AddxpCommand implements CommandExecutor {
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 +78,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;

View File

@@ -36,7 +36,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,7 +45,7 @@ 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;
@@ -59,7 +59,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 +75,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;

View File

@@ -38,7 +38,7 @@ public class WhoisCommand implements CommandExecutor {
}
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

View File

@@ -27,8 +27,8 @@ public class XprateCommand implements CommandExecutor {
if (!(sender instanceof Player)) {
if(args.length <= 0)
{
System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {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"))
@@ -81,8 +81,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"))
{

View File

@@ -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;
}

View File

@@ -6,12 +6,20 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.mcMMO;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!LoadProperties.mcmmoEnable) {
@@ -27,7 +35,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,12 +45,39 @@ 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);
player.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");
}
GregorianCalendar cakedayStart = new GregorianCalendar(2012, Calendar.FEBRUARY, 3);
GregorianCalendar cakedayEnd = new GregorianCalendar(2012, Calendar.FEBRUARY, 6);
GregorianCalendar day = new GregorianCalendar();
int cakeCheck = 0;
for (String cake : mcMMO.gotCake)
{
if (player.getName().equalsIgnoreCase(cake)) {
cakeCheck = 1;
}
}
if (cakeCheck == 0) {
if (getDateRange(day.getTime(), cakedayStart.getTime(), cakedayEnd.getTime()))
{
player.sendMessage(ChatColor.BLUE + "Happy 1 Year Anniversary! In honor of all of");
player.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, have some cake!");
}
mcMMO.gotCake.add(player.getName());
player.getInventory().addItem(new ItemStack(Material.CAKE_BLOCK, 1));
}
return true;
}
private boolean getDateRange(Date date, Date start, Date end)
{
return !(date.before(start) || date.after(end));
}
}

View File

@@ -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;
@@ -59,8 +60,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);

View File

@@ -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;

View File

@@ -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()) {

View File

@@ -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())) {

View File

@@ -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) {

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,7 @@ 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>();

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -29,10 +29,12 @@ import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
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.inventory.ItemStack;
import org.getspout.spoutapi.SpoutManager;
@@ -43,8 +45,9 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
import net.minecraft.server.Enchantment;
public class mcBlockListener extends BlockListener
public class mcBlockListener implements Listener
{
private final mcMMO plugin;
@@ -53,6 +56,7 @@ public class mcBlockListener extends BlockListener
this.plugin = plugin;
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
//Setup some basic vars
@@ -72,10 +76,18 @@ public class mcBlockListener extends BlockListener
//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)
@@ -111,7 +123,8 @@ public class mcBlockListener extends BlockListener
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event)
{
Player player = event.getPlayer();
@@ -150,11 +163,11 @@ public class mcBlockListener extends BlockListener
{
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);
}
}
/*
@@ -222,7 +235,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 +247,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 +258,10 @@ public class mcBlockListener extends BlockListener
}
}
if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
{
if(inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
plugin.misc.treeFeller.clear();
}
}
@@ -274,7 +290,8 @@ public class mcBlockListener extends BlockListener
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDamage(BlockDamageEvent event)
{
if(event.isCancelled())
@@ -284,7 +301,7 @@ public class mcBlockListener extends BlockListener
ItemStack inhand = player.getItemInHand();
Block block = event.getBlock();
Skills.monitorSkills(player);
Skills.monitorSkills(player, PP);
/*
* ABILITY PREPARATION CHECKS
@@ -335,6 +352,8 @@ public class mcBlockListener extends BlockListener
mat = Material.DIRT;
if(block.getType() == Material.CLAY)
mat = Material.CLAY_BALL;
if(block.getType() == Material.MYCEL)
mat = Material.DIRT;
byte type = block.getData();
ItemStack item = new ItemStack(mat, 1, (byte)0, type);
@@ -344,17 +363,20 @@ public class mcBlockListener extends BlockListener
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
{
if(inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
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);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
} else
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
}
//Spout stuff
@@ -377,6 +399,8 @@ public class mcBlockListener extends BlockListener
mat = Material.SNOW_BALL;
if(block.getTypeId() == 82)
mat = Material.CLAY_BALL;
if(block.getTypeId() == 110)
mat = Material.DIRT;
byte type = block.getData();
@@ -387,13 +411,13 @@ public class mcBlockListener extends BlockListener
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);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
} else
{
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
}
if(LoadProperties.spoutEnabled)
@@ -421,12 +445,18 @@ public class mcBlockListener extends BlockListener
* LEAF BLOWER
*/
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(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
if(Math.random() * 10 > 9)
{
ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, block.getData());
block.getLocation().getWorld().dropItemNaturally(block.getLocation(), x);
ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, (byte)(block.getData()-8));
m.mcDropItem(block.getLocation(), x);
}
block.setType(Material.AIR);
player.incrementStatistic(Statistic.MINE_BLOCK, event.getBlock().getType());
@@ -439,6 +469,7 @@ public class mcBlockListener extends BlockListener
}
}
@EventHandler
public void onBlockFromTo(BlockFromToEvent event)
{
Block blockFrom = event.getBlock();

View File

@@ -20,13 +20,15 @@ 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.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.inventory.ItemStack;
import com.gmail.nossr50.Combat;
@@ -42,14 +44,15 @@ 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.MONITOR)
public void onEntityDamage(EntityDamageEvent event)
{
if(event.isCancelled())
@@ -158,7 +161,8 @@ public class mcEntityListener extends EntityListener
}
}
}
@EventHandler
public void onEntityDeath(EntityDeathEvent event)
{
Entity x = event.getEntity();
@@ -180,7 +184,8 @@ public class mcEntityListener extends EntityListener
}
}
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event)
{
SpawnReason reason = event.getSpawnReason();

View File

@@ -32,6 +32,9 @@ 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,7 +42,6 @@ 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;
@@ -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,7 +76,8 @@ public class mcPlayerListener extends PlayerListener
{
plugin = instance;
}
@EventHandler
public void onPlayerFish(PlayerFishEvent event)
{
if(mcPermissions.getInstance().fishing(event.getPlayer()))
@@ -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)
{
@@ -151,12 +158,13 @@ public class mcPlayerListener extends PlayerListener
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 +172,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();
@@ -298,6 +307,7 @@ public class mcPlayerListener extends PlayerListener
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(PlayerChatEvent event)
{
Player player = event.getPlayer();
@@ -305,7 +315,8 @@ 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))
@@ -318,7 +329,8 @@ public class mcPlayerListener extends PlayerListener
}
} 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))
@@ -333,13 +345,17 @@ public class mcPlayerListener extends PlayerListener
}
}
}
// 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)));
}
}

View File

@@ -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)

View File

@@ -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();

View File

@@ -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)

View File

@@ -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 == 42; //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;
@@ -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)

View File

@@ -24,7 +24,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;
@@ -35,6 +35,7 @@ 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;
@@ -86,6 +87,7 @@ public class mcMMO extends JavaPlugin
private Permissions permissions;
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
private Runnable ChangeDataValueTimer = new ChangeDataValueTimer(this); //R2 block place workaround
//private Timer mcMMO_SpellTimer = new Timer(true);
//Alias - Command
@@ -94,10 +96,15 @@ public class mcMMO extends JavaPlugin
public static Database database = null;
public Misc misc = new Misc(this);
public static ArrayList<String> gotCake;
//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()
{
@@ -119,10 +126,39 @@ public class mcMMO extends JavaPlugin
//Catch all for versions not matching and no specific code being needed
else if(!vnum.equalsIgnoreCase(this.getDescription().getVersion())) updateFrom(-1);
}
File cakeFile = new File(getDataFolder().getAbsolutePath() + File.separator + "cake");
if (!cakeFile.exists()) {
try {
cakeFile.createNewFile();
}
catch (IOException ex) {
System.out.println(ex);
}
}
gotCake = new ArrayList<String>();
try {
gotCake.clear();
BufferedReader reader = new BufferedReader(new FileReader(getDataFolder().getAbsolutePath() + File.separator + "players"));
String line = reader.readLine();
while(line != null) {
gotCake.add(line);
line = reader.readLine();
}
reader.close();
}
catch (Exception ex) {
System.out.println(ex);
}
mcPermissions.initialize(getServer());
config.configCheck();
this.config = new LoadProperties(this);
this.config.load();
Party.getInstance().loadParties();
new Party(this);
@@ -139,28 +175,11 @@ public class mcMMO extends JavaPlugin
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());
@@ -176,6 +195,8 @@ public class mcMMO extends JavaPlugin
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20);
//R2+ block place fix
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, ChangeDataValueTimer, 0, 10);
registerCommands();
@@ -264,6 +285,18 @@ public class mcMMO extends JavaPlugin
return permissions;
}
public void onDisable() {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(getDataFolder().getAbsolutePath() + File.separator + "cake"));
for (String player : gotCake) {
writer.write(player);
writer.newLine();
}
writer.close();
}
catch (Exception ex) {
System.out.println(ex);
}
Bukkit.getServer().getScheduler().cancelTasks(this);
System.out.println("mcMMO was disabled.");
}
@@ -284,36 +317,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 +334,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());
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());
}

View File

@@ -246,7 +246,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)))
{

View File

@@ -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);
}
}
}

View File

@@ -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();
}

View File

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

View File

@@ -25,6 +25,7 @@ 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;
@@ -152,7 +153,7 @@ public class Axes {
continue;
if(targets >= 1 && derp.getWorld().getPVP())
{
target.damage(event.getDamage() / 2);
Combat.dealDamage(target, event.getDamage() / 2, attacker);
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
targets--;
continue;
@@ -161,7 +162,7 @@ public class Axes {
else
{
LivingEntity target = (LivingEntity)derp;
target.damage(event.getDamage() / 2);
Combat.dealDamage(target, event.getDamage() / 2, attacker);
targets--;
}
}

View File

@@ -30,7 +30,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
public class Excavation
public class Excavation
{
public static void gigaDrillBreakerActivationCheck(Player player, Block block)
{
@@ -71,7 +71,8 @@ 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)
{
@@ -79,23 +80,23 @@ public class Excavation
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 +105,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 +235,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 +246,11 @@ 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);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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,20 +163,18 @@ 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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
//GREEN THUMB
if(Math.random() * 1500 <= PP.getSkillLevel(SkillType.HERBALISM))
if((Math.random() * 1500 <= herbLevel) || herbLevel > 1500)
{
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
@@ -199,8 +196,31 @@ public class Herbalism
block.setData((byte) 0x4);
}
}
//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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
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 +251,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
loc.getWorld().dropItemNaturally(target.getLocation(), is);
m.mcDropItem(target.getLocation(), is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mcactus, player);
}
@@ -270,9 +290,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
loc.getWorld().dropItemNaturally(target.getLocation(), is);
m.mcDropItem(target.getLocation(), is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.msugar, player);
}
@@ -288,9 +308,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
loc.getWorld().dropItemNaturally(loc, is);
m.mcDropItem(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mpumpkin, player);
@@ -298,12 +318,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
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 +346,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
{
loc.getWorld().dropItemNaturally(loc, is);
m.mcDropItem(loc, is);
}
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mmushroom, player);
@@ -326,12 +358,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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
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((Math.random() * 1000 <= herbLevel) || herbLevel > 1000)
m.mcDropItem(loc, is);
}
PP.addXP(SkillType.HERBALISM, LoadProperties.mvines, player);
}
}
Skills.XpCheckSkill(SkillType.HERBALISM, player);
}

View File

@@ -76,180 +76,194 @@ public class Mining
}
}
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().getEnchantments().containsKey(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((Math.random() * 1000 <= PP.getSkillLevel(SkillType.MINING)) || PP.getSkillLevel(SkillType.MINING) > 1000)
{
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,266 @@ 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().getEnchantments().containsKey(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
//Pre-processing
Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId());
int id = block.getTypeId();
Material mat = Material.getMaterial(id);
int xp = 0;
byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(block.getTypeId() == 1 || block.getTypeId() == 24)
boolean silkTouch = player.getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH);
//STONE
if(id == 1)
{
if(block.getTypeId() == 1)
if(block.getData() != (byte) 5)
{
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);
}
xp += LoadProperties.mstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
item = new ItemStack(mat, 1, (byte)0, damage);
loc.getWorld().dropItemNaturally(loc, item);
if(!silkTouch)
{
mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//SANDSTONE
else if(id == 24)
{
if(block.getData() != (byte) 5)
{
xp += LoadProperties.msandstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//NETHERRACK
if(block.getTypeId() == 87)
else if(id == 87)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//GLOWSTONE
if(block.getTypeId() == 89)
else if(id == 89)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
if(!silkTouch)
{
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);
}
else
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//COAL
if(block.getTypeId() == 16)
else if(id == 16)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
}
if(!silkTouch)
{
mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//GOLD
if(block.getTypeId() == 14 && m.getTier(player) >= 3)
else if(id == 14 && m.getTier(player) >= 3)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//OBSIDIAN
if(block.getTypeId() == 49 && m.getTier(player) >= 4)
else if(id == 49 && m.getTier(player) >= 4)
{
if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//DIAMOND
if(block.getTypeId() == 56 && m.getTier(player) >= 3)
else if(id == 56 && m.getTier(player) >= 3)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
if(!silkTouch)
{
mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//IRON
if(block.getTypeId() == 15 && m.getTier(player) >= 2)
else if(id == 15 && m.getTier(player) >= 2)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
if(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);
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//REDSTONE
if((block.getTypeId() == 73 || block.getTypeId() == 74) && m.getTier(player) >= 4)
else if((id == 73 || id == 74) && m.getTier(player) >= 3)
{
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5)
if(!plugin.misc.blockWatchList.contains(block))
{
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);
}
if(!silkTouch)
{
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);
}
else
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//LAPUS
if(block.getTypeId() == 21 && m.getTier(player) >= 3){
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
//LAPIS
else if(id == 21 && m.getTier(player) >= 3){
if(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);
if(!silkTouch)
{
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);
}
else
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
if(block.getData() != (byte) 5)
//NETHER BRICK
else if(id == 112){
if(block.getData() != (byte) 5){
xp += LoadProperties.mnetherbrick;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//END STONE
else if(id == 121){
if(block.getData() != (byte) 5){
xp += LoadProperties.mendstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//MOSS STONE
else if(id == 48){
if(block.getData() != (byte) 5){
xp += LoadProperties.mmossstone;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//STONE BRICK
else if(id == 98){
if(!plugin.misc.blockWatchList.contains(block)){
xp += LoadProperties.mstonebrick;
blockProcCheck(block, player);
blockProcCheck(block, player);
}
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
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);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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;
@@ -35,6 +36,7 @@ import com.gmail.nossr50.spout.SpoutStuff;
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 +77,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.getGreenTerraDeactivatedTimeStamp()*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.getTreeFellerDeactivatedTimeStamp()*1000) >= (LoadProperties.greenTerraCooldown * 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.getSuperBreakerDeactivatedTimeStamp()*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.getSerratedStrikesDeactivatedTimeStamp()*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.getBerserkDeactivatedTimeStamp()*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.getSkullSplitterDeactivatedTimeStamp()*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.getGigaDrillBreakerDeactivatedTimeStamp()*1000) >= (LoadProperties.gigaDrillBreakerCooldown * 1000)){
PP.setGigaDrillBreakerInformed(true);
player.sendMessage(mcLocale.getString("Skills.YourGigaDrillBreaker"));
}
@@ -124,104 +125,103 @@ 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) {
monitorSkills(player, PP, System.currentTimeMillis());
}
public static void monitorSkills(Player player, PlayerProfile PP, long curTime){
if(PP.getHoePreparationMode() && curTime - (PP.getHoePreparationATS()*1000) >= 4000){
PP.setHoePreparationMode(false);
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.getGreenTerraDeactivatedTimeStamp()*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.getSkullSplitterDeactivatedTimeStamp()*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.getTreeFellerDeactivatedTimeStamp()*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.getSuperBreakerDeactivatedTimeStamp()*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.getGigaDrillBreakerDeactivatedTimeStamp()*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.getSerratedStrikesDeactivatedTimeStamp()*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.getBerserkDeactivatedTimeStamp()*1000) <= curTime){
PP.setBerserkMode(false);
PP.setBerserkInformed(false);
player.sendMessage(mcLocale.getString("Skills.BerserkOff"));
}
}
}
@@ -315,6 +315,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 +328,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 +383,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())

View File

@@ -151,7 +151,7 @@ public class Swords
continue;
if(targets >= 1 && derp.getWorld().getPVP())
{
target.damage(event.getDamage() / 4);
Combat.dealDamage(target, event.getDamage() / 4, attacker);
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
Users.getProfile(target).addBleedTicks(5);
targets--;
@@ -164,7 +164,7 @@ public class Swords
pluginx.misc.addToBleedQue((LivingEntity)derp);
LivingEntity target = (LivingEntity)derp;
target.damage(event.getDamage() / 4);
Combat.dealDamage(target, event.getDamage() / 4, attacker);
targets--;
}
}
@@ -193,7 +193,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 +201,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 +245,7 @@ public class Swords
}
else
{
x.damage(2);
Combat.dealDamage(x, 2);
}
}
}

View File

@@ -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();

View File

@@ -84,7 +84,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 +99,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);
}

View File

@@ -45,10 +45,10 @@ public class WoodCutting
Material mat = Material.getMaterial(block.getTypeId());
if(player != null)
{
if(Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING))
if((Math.random() * 1000 <= PP.getSkillLevel(SkillType.WOODCUTTING)) || PP.getSkillLevel(SkillType.WOODCUTTING) > 1000)
{
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
block.getWorld().dropItemNaturally(block.getLocation(), item);
m.mcDropItem(block.getLocation(), item);
}
}
}

View File

@@ -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)

View File

@@ -0,0 +1,354 @@
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
Images:
URL_DIR: http://mcmmo.rycochet.net/mcmmo/
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
Mining:
Level_Cap: 0
Requires_Pickaxe: true
Repair:
Level_Cap: 0
Leather:
ID: 334
String:
Name: Leather
ID: 287
Stone:
Name: Cobblestone
ID: 4
Wood:
Name: Wood Planks
ID: 5
Gold:
Name: Gold Bars
ID: 266
Anvil_Messages: true
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
lapis: 400
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
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

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

View File

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 273 B

View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 273 B

View File

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 273 B

View File

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 272 B

View File

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 265 B

View File

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -1,8 +1,8 @@
name: mcMMO
main: com.gmail.nossr50.mcMMO
version: 1.2.07
main: com.gmail.nossr50.mcMMO
version: 1.2.09
softdepend: [Spout]
author: nossr50
author: TheYeti
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:

View File

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

View File

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

View File

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 580 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

View File

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 496 B

View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 238 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 498 B

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 365 B

View File

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 399 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View File

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 500 B

View File

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View File

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View File

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

Some files were not shown because too many files have changed in this diff Show More