mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 09:43:00 +01:00
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b700a99c52 | ||
|
|
7294175d9c | ||
|
|
1b17b90f32 | ||
|
|
d27f668a2e | ||
|
|
69dd5769e4 | ||
|
|
7c9d09a878 | ||
|
|
17c64251db | ||
|
|
d728eba5c4 | ||
|
|
429055bae2 | ||
|
|
3f22a8f479 | ||
|
|
aeae60f968 | ||
|
|
a97b889af5 | ||
|
|
0e9953c25b | ||
|
|
869b30fcaa | ||
|
|
44188396b4 | ||
|
|
a7f146a835 | ||
|
|
3a7d88db4f | ||
|
|
9eba2c683b | ||
|
|
8059636b62 | ||
|
|
d78a1efbf6 | ||
|
|
c0b4a33346 | ||
|
|
2cef6700c7 | ||
|
|
df67bd6720 | ||
|
|
655dcb1c9b | ||
|
|
ce32792668 | ||
|
|
4b384abc51 | ||
|
|
82bccd357b | ||
|
|
12709bcd7f | ||
|
|
0b53f8266a | ||
|
|
a07f14e326 | ||
|
|
3349e9cb05 | ||
|
|
0e2746622d | ||
|
|
d9bd0ace9a | ||
|
|
e31b7d5c48 | ||
|
|
4bddbbf56e | ||
|
|
0654f27599 | ||
|
|
3f71dab0b1 | ||
|
|
bd45fff1b4 | ||
|
|
9618e45a11 | ||
|
|
3839373f5a | ||
|
|
1633617006 | ||
|
|
57e33bbf39 | ||
|
|
cddcf36016 | ||
|
|
dff03109a3 | ||
|
|
c0986a1f89 | ||
|
|
cd4c328320 | ||
|
|
03d0ecd450 | ||
|
|
3a809dab32 | ||
|
|
ade9e20cdd | ||
|
|
29520dc95c | ||
|
|
d40d89f29a | ||
|
|
9377de930f | ||
|
|
3219674678 | ||
|
|
a9438ed52b | ||
|
|
09169bd019 | ||
|
|
c30fdef615 | ||
|
|
109e9725a9 | ||
|
|
44ede5c3f8 | ||
|
|
c1161da6de | ||
|
|
80927417f2 | ||
|
|
91d8cd5da8 | ||
|
|
869d731b81 | ||
|
|
f6a18ef777 | ||
|
|
3e084b3b5d | ||
|
|
2c7f931c4d | ||
|
|
6b18cec7fb | ||
|
|
08960a2dbc | ||
|
|
5f4e269efa | ||
|
|
e5f6da01ec | ||
|
|
ae741a1b99 | ||
|
|
78a3ea4765 | ||
|
|
1a66ff7659 | ||
|
|
df53e2fd4f | ||
|
|
4210920c5f | ||
|
|
3440833af8 | ||
|
|
1e738263bc | ||
|
|
9cf322ca0b | ||
|
|
0c027ca697 | ||
|
|
27ed5f7c38 | ||
|
|
2f83e559a4 | ||
|
|
8b55744447 | ||
|
|
2f491b24e2 | ||
|
|
d2cb55befa | ||
|
|
e3e4cf9884 | ||
|
|
1b461ac96a | ||
|
|
1fc3c8fab2 | ||
|
|
7c28be5e62 | ||
|
|
cbe9cae4ea | ||
|
|
c0b7f8a323 | ||
|
|
f8b4412049 | ||
|
|
10e227a5ac | ||
|
|
077431630a | ||
|
|
37395a70e6 | ||
|
|
b779258d69 | ||
|
|
d3ec976f44 | ||
|
|
79a5732c4d | ||
|
|
12c6bfc2e8 | ||
|
|
31fff0623d | ||
|
|
0d2b87834c | ||
|
|
2feba8f64c | ||
|
|
cf82ae4c66 | ||
|
|
0d7c402c01 | ||
|
|
ae8b70be0f | ||
|
|
a87336b7ee | ||
|
|
7814fa8d46 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,4 +1,4 @@
|
||||
* text
|
||||
* text=auto
|
||||
|
||||
*.png binary
|
||||
*.wav binary
|
||||
|
||||
82
.gitignore
vendored
82
.gitignore
vendored
@@ -1,42 +1,42 @@
|
||||
# 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
|
||||
|
||||
# Other Libraries
|
||||
*.jar
|
||||
|
||||
# Atlassian Stuff
|
||||
# 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
|
||||
|
||||
# Other Libraries
|
||||
*.jar
|
||||
|
||||
# Atlassian Stuff
|
||||
/atlassian-ide-plugin.xml
|
||||
|
||||
@@ -7,6 +7,55 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 1.4.03-dev
|
||||
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
||||
+ Improved stats display for child skills
|
||||
+ Added cooldown between using Chimaera Wings
|
||||
= Fixed bug with Repair not decreasing enchanting levels properly
|
||||
= Fixed bug with Smelting not properly tracking furnaces
|
||||
= Fixed bug with Blast Mining not dropping blocks correctly
|
||||
= Fixed bug with custom blocks not working
|
||||
= Fixed bug with Blast Mining increasing TNT damage.
|
||||
= Fixed bug where Blast Mining was awarding too much XP
|
||||
= Fixed bug where triple drops would award twice the amount of experience in Herbalism and Mining
|
||||
= Fixed bug where Green Thumb would consume wheat instead of seeds
|
||||
= Fixed bug where Green Terra would consume twice the amount of seed when used on crops
|
||||
= Fixed bug where experience would be awarded in Herbalism for some player-placed blocks
|
||||
= Fixed bug where players were unable to salvage leather armor
|
||||
= Fixed bug with repairing using materials with byte metadata
|
||||
= Fixed bug where Fishing was becoming less successful at higher levels
|
||||
= Fixed bug with using Salvage on stacked items.
|
||||
= Fixed bug where the 'mcmmo.commands.ptp.world.all' was registered twice
|
||||
= Fixed bug where Beast Lore wouldn't work on friendly pets
|
||||
= Fixed bug where Deflect was calculated based on the attacker, not the defender. (We really did this time!)
|
||||
! Moved the Salvage unlock level from config.yml to advanced.yml
|
||||
! Changed how Chimaera Wings are acquired, you need to craft them now. (By default, use 5 feathers in a shapeless recipe)
|
||||
! Queue mctop and mcrank commands when using mySQL
|
||||
- Removed option to disable Salvage via the config file. This should be handled via permissions instead.
|
||||
- Removed the option to use Woodcutting without an axe from the config file.
|
||||
|
||||
Version 1.4.02
|
||||
+ Added API to get the skill and power level caps.
|
||||
= Fixed bug where Deflect was calculated based on the attacker, not the defender
|
||||
= Fixed bug where some skills weren't registering as unlocked until one level later
|
||||
= Fixed bug where the PTP cooldown was being read improperly
|
||||
= Fixed bug where /ptp <accept|toggle|acceptall> where broken
|
||||
= Fixed ClassCastException relating to counter-attack with Swords
|
||||
= Fixed issue with some skill activations not activating enough or activating too much
|
||||
|
||||
Version 1.4.01
|
||||
= Fixed bug where trying to use /mctop or /xplock with the Smelting child skill caused NPEs
|
||||
= Fixed bug where /mctop and /mcrank wouldn't show overall power levels for servers using Flatfile
|
||||
= Fixed bug where Smelting would throw consistent errors due to offline players
|
||||
= Fixed bug where repairing an mcMMO ability-buffed item with mcMMO repair could take the enchant but leave the lore tag
|
||||
= Fixed bug where using '/party chat message...' would result in the first word of the message being printed repeatedly
|
||||
= Fixed bug where the wrong flag was being set when taking damage
|
||||
= Fixed bug where the PTP cooldown was set improperly
|
||||
= Fixed bug where ptp permissions weren't being handled properly
|
||||
= Fixed bug where Beast Lore wouldn't work
|
||||
= Fixed bug where Chimaera Wing would always teleport to spawn, even when the player had a valid bed spawn location
|
||||
= Updated locale files
|
||||
|
||||
Version 1.4.00
|
||||
+ Added new Child Skill - Smelting!
|
||||
+ Added a version check, admins will get notified when a new version is available!
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.4.00</version>
|
||||
<version>1.4.03-dev1</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<issueManagement>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>bin</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/${artifactId}.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<destName>mcMMO.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>bin</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/${artifactId}.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<destName>mcMMO.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@@ -10,38 +10,38 @@ public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK);
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return UserManager.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
|
||||
return UserManager.getPlayer(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
if (profile.getAbilityMode(ability)) {
|
||||
if (mcMMOPlayer.getAbilityMode(ability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +237,29 @@ public final class ExperienceAPI {
|
||||
return UserManager.getPlayer(player).getPowerLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the level cap of a specific skill.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param skillType The skill to get the level cap for
|
||||
* @return the level cap of a given skill
|
||||
*/
|
||||
public static int getLevelCap(String skillType) {
|
||||
return Config.getInstance().getLevelCap(SkillType.getSkill(skillType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the power level cap.
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @return the power level cap of a given skill
|
||||
*/
|
||||
public static int getPowerLevelCap() {
|
||||
return Config.getInstance().getPowerLevelCap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the level of a player in a specific skill type.
|
||||
* </br>
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
@@ -23,16 +23,16 @@ public class McabilityCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = UserManager.getPlayer((Player) sender).getProfile();
|
||||
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
if (mcMMOPlayer.getAbilityUse()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
mcMMOPlayer.toggleAbilityUse();
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
@@ -41,12 +41,12 @@ public class McabilityCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
if (!playerProfile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
@@ -56,21 +56,20 @@ public class McabilityCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getAbilityUse()) {
|
||||
if (mcMMOPlayer.getAbilityUse()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Ability.On"));
|
||||
}
|
||||
|
||||
profile.toggleAbilityUse();
|
||||
mcMMOPlayer.toggleAbilityUse();
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
@@ -27,21 +27,21 @@ public class McgodCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
profile = UserManager.getPlayer((Player) sender).getProfile();
|
||||
mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
|
||||
if (profile == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getGodMode()) {
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||
}
|
||||
|
||||
profile.toggleGodMode();
|
||||
mcMMOPlayer.toggleGodMode();
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
@@ -50,12 +50,12 @@ public class McgodCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
if (!playerProfile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
@@ -64,7 +64,6 @@ public class McgodCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
@@ -72,14 +71,14 @@ public class McgodCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (profile.getGodMode()) {
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Disabled"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Enabled"));
|
||||
}
|
||||
|
||||
profile.toggleGodMode();
|
||||
mcMMOPlayer.toggleGodMode();
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
@@ -14,16 +14,16 @@ public class McnotifyCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
PlayerProfile profile = UserManager.getPlayer((Player) sender).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
|
||||
if (profile.useChatNotifications()) {
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
|
||||
}
|
||||
|
||||
profile.toggleChatNotifications();
|
||||
mcMMOPlayer.toggleChatNotifications();
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
public class McrefreshCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PlayerProfile profile;
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
@@ -27,12 +27,12 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
profile = UserManager.getPlayer(sender.getName()).getProfile();
|
||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
|
||||
profile.setRecentlyHurt(0);
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
mcMMOPlayer.setRecentlyHurt(0);
|
||||
mcMMOPlayer.getProfile().resetCooldowns();
|
||||
mcMMOPlayer.resetToolPrepMode();
|
||||
mcMMOPlayer.resetAbilityMode();
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
return true;
|
||||
@@ -43,12 +43,12 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
mcMMOPlayer = UserManager.getPlayer(args[0]);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
profile = new PlayerProfile(args[0], false);
|
||||
PlayerProfile playerProfile = new PlayerProfile(args[0], false);
|
||||
|
||||
if (!profile.isLoaded()) {
|
||||
if (!playerProfile.isLoaded()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return true;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
profile = mcMMOPlayer.getProfile();
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (!player.isOnline()) {
|
||||
@@ -64,10 +64,10 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
profile.setRecentlyHurt(0);
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
mcMMOPlayer.setRecentlyHurt(0);
|
||||
mcMMOPlayer.getProfile().resetCooldowns();
|
||||
mcMMOPlayer.resetToolPrepMode();
|
||||
mcMMOPlayer.resetAbilityMode();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
||||
|
||||
@@ -104,7 +104,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
// Party leader commands
|
||||
if (!mcMMOPlayer.getParty().getLeader().equals(player.getName())) {
|
||||
if (!mcMMOPlayer.getParty().getLeader().equalsIgnoreCase(player.getName())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
return true;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
String[] newArgs = new String[args.length - 1];
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
newArgs[i - 1] = args[1];
|
||||
newArgs[i - 1] = args[i];
|
||||
}
|
||||
|
||||
return newArgs;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
StringBuilder memberList = new StringBuilder();
|
||||
|
||||
for (OfflinePlayer member : playerParty.getMembers()) {
|
||||
if (playerParty.getLeader().equals(member.getName())) {
|
||||
if (playerParty.getLeader().equalsIgnoreCase(member.getName())) {
|
||||
memberList.append(ChatColor.GOLD).append(member.getName()).append(" ");
|
||||
}
|
||||
else if (member.isOnline()) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!member.getName().equals(leaderName)) {
|
||||
if (!member.getName().equalsIgnoreCase(leaderName)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
@@ -21,7 +20,6 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
public class PtpCommand implements CommandExecutor {
|
||||
private Player player;
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private PlayerProfile playerProfile;
|
||||
|
||||
private Player target;
|
||||
private McMMOPlayer mcMMOTarget;
|
||||
@@ -36,7 +34,6 @@ public class PtpCommand implements CommandExecutor {
|
||||
case 1:
|
||||
player = (Player) sender;
|
||||
mcMMOPlayer = UserManager.getPlayer(player);
|
||||
playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
if (!Permissions.partyTeleportToggle(sender)) {
|
||||
@@ -57,8 +54,9 @@ public class PtpCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
||||
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt();
|
||||
|
||||
if (playerProfile.getRecentlyHurt() + (ptpCooldown * Misc.TIME_CONVERSION_FACTOR) > System.currentTimeMillis()) {
|
||||
if ((recentlyHurt * Misc.TIME_CONVERSION_FACTOR + ptpCooldown * Misc.TIME_CONVERSION_FACTOR) > System.currentTimeMillis()) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Hurt", ptpCooldown));
|
||||
return true;
|
||||
}
|
||||
@@ -93,6 +91,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
|
||||
int ptpRequestExpire = Config.getInstance().getPTPCommandTimeout();
|
||||
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", ptpRequestExpire));
|
||||
return true;
|
||||
@@ -113,9 +112,9 @@ public class PtpCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
target = mcMMOPlayer.getPtpRequest();
|
||||
mcMMOPlayer.removePtpRequest();
|
||||
|
||||
if (!canTeleport(target.getName())) {
|
||||
mcMMOPlayer.removePtpRequest();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -202,8 +201,8 @@ public class PtpCommand implements CommandExecutor {
|
||||
|
||||
private boolean handlePartyTeleportEvent(Player player, Player target) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());
|
||||
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@@ -213,7 +212,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
player.teleport(target);
|
||||
player.sendMessage(LocaleLoader.getString("Party.Teleport.Player", target.getName()));
|
||||
target.sendMessage(LocaleLoader.getString("Party.Teleport.Target", player.getName()));
|
||||
mcMMOPlayer.getProfile().setRecentlyHurt(System.currentTimeMillis());
|
||||
mcMMOPlayer.actualizeRecentlyHurt();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -9,11 +9,11 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.LeaderboardManager;
|
||||
import com.gmail.nossr50.database.queuemanager.McRankAsync;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -99,6 +99,10 @@ public class McrankCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((sender instanceof Player) && !Permissions.skillEnabled((Player) sender, skillType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rankInts[1] == 0) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillUtils.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
|
||||
}
|
||||
@@ -119,6 +123,16 @@ public class McrankCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void sqlDisplay(CommandSender sender, String playerName) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new McrankCommandAsyncTask(playerName, sender));
|
||||
//TODO: Localize messages
|
||||
if (mcMMO.queueManager.contains(sender.getName())) {
|
||||
sender.sendMessage(ChatColor.RED + "Please wait for your previous command to process");
|
||||
}
|
||||
|
||||
if (!mcMMO.queueManager.queue(new McRankAsync(playerName, sender))) {
|
||||
// This will only run if for some reason it is unable to add to the queue
|
||||
sender.sendMessage(ChatColor.RED + "Unable to add to queue.");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + "Calculating mcMMO rankings...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -9,9 +8,9 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.LeaderboardManager;
|
||||
import com.gmail.nossr50.database.queuemanager.McTopAsync;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
@@ -31,7 +30,14 @@ public class MctopCommand implements CommandExecutor {
|
||||
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
|
||||
}
|
||||
else if (SkillUtils.isSkill(args[0])) {
|
||||
display(1, SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
|
||||
return true;
|
||||
}
|
||||
|
||||
display(1, skill.toString(), sender, useMySQL, command);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
@@ -45,7 +51,14 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (SkillUtils.isSkill(args[0])) {
|
||||
display(Integer.parseInt(args[1]), SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
|
||||
return true;
|
||||
}
|
||||
|
||||
display(Integer.parseInt(args[1]), skill.toString(), sender, useMySQL, command);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
@@ -59,12 +72,17 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sql) {
|
||||
if (skill.equalsIgnoreCase("all")) {
|
||||
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender, command);
|
||||
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender);
|
||||
}
|
||||
else {
|
||||
sqlDisplay(page, skill, sender, command);
|
||||
sqlDisplay(page, skill, sender);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -73,11 +91,6 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
LeaderboardManager.updateLeaderboards(); // Make sure we have the latest information
|
||||
|
||||
String[] info = LeaderboardManager.retrieveInfo(skill, page);
|
||||
@@ -109,7 +122,18 @@ public class MctopCommand implements CommandExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
}
|
||||
|
||||
private void sqlDisplay(int page, String query, CommandSender sender, Command command) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new MctopCommandAsyncTask(page, query, sender, command));
|
||||
private void sqlDisplay(int page, String query, CommandSender sender) {
|
||||
//TODO: Localize messages
|
||||
if (mcMMO.queueManager.contains(sender.getName())) {
|
||||
sender.sendMessage(ChatColor.RED + "Please wait for your previous command to process");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mcMMO.queueManager.queue(new McTopAsync(page, query, sender))) {
|
||||
// This will only run if for some reason it is unable to add to the queue
|
||||
sender.sendMessage(ChatColor.RED + "Unable to add to queue.");
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + "Calculating mcMMO rankings...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.gmail.nossr50.commands.skills;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class FishingCommand extends SkillCommand {
|
||||
private int lootTier;
|
||||
@@ -27,7 +27,7 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
lootTier = SkillManagerStore.getInstance().getFishingManager(player.getName()).getLootTier();
|
||||
lootTier = UserManager.getPlayer(player).getFishingManager().getLootTier();
|
||||
|
||||
// TREASURE HUNTER
|
||||
double enchantChance = lootTier * AdvancedConfig.getInstance().getFishingMagicMultiplier();
|
||||
@@ -42,7 +42,7 @@ public class FishingCommand extends SkillCommand {
|
||||
magicChanceLucky = treasureHunterStrings[1];
|
||||
|
||||
// SHAKE
|
||||
String[] shakeStrings = calculateAbilityDisplayValues(SkillManagerStore.getInstance().getFishingManager(player.getName()).getShakeProbability());
|
||||
String[] shakeStrings = calculateAbilityDisplayValues(UserManager.getPlayer(player).getFishingManager().getShakeProbability());
|
||||
shakeChance = shakeStrings[0];
|
||||
shakeChanceLucky = shakeStrings[1];
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.gmail.nossr50.commands.skills;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.mining.Mining;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class MiningCommand extends SkillCommand {
|
||||
private String doubleDropChance;
|
||||
@@ -45,7 +45,7 @@ public class MiningCommand extends SkillCommand {
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
|
||||
// BLAST MINING
|
||||
MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName());
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
blastMiningRank = miningManager.getBlastMiningTier();
|
||||
bonusTNTDrops = miningManager.getDropMultiplier();
|
||||
oreBonus = percent.format(miningManager.getOreBonus() / 30.0D); // Base received in TNT is 30%
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.Salvage;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class RepairCommand extends SkillCommand {
|
||||
private int arcaneForgingRank;
|
||||
@@ -41,10 +41,10 @@ public class RepairCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.repairManager.getRepairable(Material.DIAMOND_PICKAXE.getId());
|
||||
Repairable goldRepairable = mcMMO.repairManager.getRepairable(Material.GOLD_PICKAXE.getId());
|
||||
Repairable ironRepairable = mcMMO.repairManager.getRepairable(Material.IRON_PICKAXE.getId());
|
||||
Repairable stoneRepairable = mcMMO.repairManager.getRepairable(Material.STONE_PICKAXE.getId());
|
||||
Repairable diamondRepairable = mcMMO.repairableManager.getRepairable(Material.DIAMOND_PICKAXE.getId());
|
||||
Repairable goldRepairable = mcMMO.repairableManager.getRepairable(Material.GOLD_PICKAXE.getId());
|
||||
Repairable ironRepairable = mcMMO.repairableManager.getRepairable(Material.IRON_PICKAXE.getId());
|
||||
Repairable stoneRepairable = mcMMO.repairableManager.getRepairable(Material.STONE_PICKAXE.getId());
|
||||
|
||||
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||
@@ -66,7 +66,7 @@ public class RepairCommand extends SkillCommand {
|
||||
superRepairChanceLucky = superRepairStrings[1];
|
||||
|
||||
// ARCANE FORGING
|
||||
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
|
||||
arcaneForgingRank = UserManager.getPlayer(player).getRepairManager().getArcaneForgingRank();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,8 +122,8 @@ public class RepairCommand extends SkillCommand {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
|
||||
}
|
||||
|
||||
if (canSalvage && Salvage.salvageUnlockLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Salvage.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
|
||||
if (canSalvage && Repair.salvageUnlockLevel > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Repair.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
|
||||
}
|
||||
|
||||
if (canArcaneForge) {
|
||||
@@ -155,11 +155,11 @@ public class RepairCommand extends SkillCommand {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Rank", arcaneForgingRank));
|
||||
|
||||
if (Repair.arcaneForgingEnchantLoss) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", (arcaneBypass ? 100 : Repair.getEnchantChance(arcaneForgingRank))));
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Success", (arcaneBypass ? 100 : UserManager.getPlayer(player).getRepairManager().getKeepEnchantChance())));
|
||||
}
|
||||
|
||||
if (Repair.arcaneForgingDowngrades) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", (arcaneBypass ? 0 : Repair.getDowngradeChance(arcaneForgingRank))));
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Chance.Downgrade", (arcaneBypass ? 0 : UserManager.getPlayer(player).getRepairManager().getDowngradeEnchantChance())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -11,6 +12,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
@@ -57,12 +59,23 @@ public abstract class SkillCommand implements CommandExecutor {
|
||||
dataCalculations();
|
||||
permissionsCheck();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString(skillString + ".SkillName")));
|
||||
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", SkillUtils.getSkillName(skill)));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + skillString)));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill)));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", SkillUtils.getSkillName(skill) + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", profile.getSkillLevel(skill)));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<SkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (SkillType parent : parents) {
|
||||
player.sendMessage(SkillUtils.getSkillName(parent) + " - " + LocaleLoader.getString("Effects.Level", profile.getSkillLevel(parent), profile.getSkillXpLevel(parent), profile.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
|
||||
if (effectsHeaderPermissions()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.gmail.nossr50.commands.skills;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class SmeltingCommand extends SkillCommand {
|
||||
private String burnTimeModifier;
|
||||
@@ -41,7 +41,7 @@ public class SmeltingCommand extends SkillCommand {
|
||||
fluxMiningChanceLucky = fluxMiningStrings[1];
|
||||
|
||||
// VANILLA XP BOOST
|
||||
vanillaXPModifier = SkillManagerStore.getInstance().getSmeltingManager(player.getName()).getVanillaXpMultiplier();
|
||||
vanillaXPModifier = UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,11 @@ public class XplockCommand extends SpoutCommand {
|
||||
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Permissions.xplock(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
|
||||
@@ -20,6 +20,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/* GENERAL */
|
||||
public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); }
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability_EnchantBuff", 5); }
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); }
|
||||
@@ -178,6 +179,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery_MaxBonusLevel", 1000); }
|
||||
public double getSuperRepairChanceMax() { return config.getDouble("Skills.Repair.SuperRepair_ChanceMax", 100.0D); }
|
||||
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); }
|
||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage_UnlockLevel", 600); }
|
||||
|
||||
/* Arcane Forging */
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.Arcane_Forging.Downgrades.Enabled", true); }
|
||||
|
||||
@@ -101,9 +101,12 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
|
||||
|
||||
/* Items */
|
||||
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
|
||||
public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
|
||||
public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
|
||||
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
|
||||
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
||||
public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
|
||||
public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
|
||||
|
||||
/* Particles */
|
||||
public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
|
||||
@@ -183,9 +186,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
/* Repair */
|
||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
|
||||
public boolean getSalvageEnabled() { return config.getBoolean("Skills.Repair.Salvage_enabled", true); }
|
||||
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }
|
||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage_UnlockLevel", 600); }
|
||||
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
||||
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
||||
|
||||
@@ -199,8 +200,6 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
||||
|
||||
/* Woodcutting */
|
||||
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
|
||||
|
||||
public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
|
||||
public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
|
||||
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
|
||||
|
||||
@@ -52,6 +52,11 @@ public class TreasureConfig extends ConfigLoader {
|
||||
protected void loadKeys() {
|
||||
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
||||
|
||||
if (treasureSection == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<String> treasureConfigSet = treasureSection.getKeys(false);
|
||||
|
||||
for (String treasureName : treasureConfigSet) {
|
||||
@@ -211,14 +216,14 @@ public class TreasureConfig extends ConfigLoader {
|
||||
Treasure treasure = nextEntry.getValue();
|
||||
|
||||
if (treasure instanceof FishingTreasure) {
|
||||
if (!fishingTreasures.contains(treasureKey)) {
|
||||
if (fishingTreasures == null || !fishingTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
fishingRewards.add((FishingTreasure) treasure);
|
||||
}
|
||||
else if (treasure instanceof HylianTreasure) {
|
||||
if (!hylianTreasures.contains(treasureKey)) {
|
||||
if (hylianTreasures == null || !hylianTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -237,7 +242,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
else if (treasure instanceof ExcavationTreasure) {
|
||||
if (!excavationTreasures.contains(treasureKey)) {
|
||||
if (excavationTreasures == null || !excavationTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public final class LeaderboardManager {
|
||||
}
|
||||
|
||||
lastUpdate = System.currentTimeMillis(); // Log when the last update was run
|
||||
powerLevels.clear(); // Clear old values from the power levels
|
||||
|
||||
// Initialize lists
|
||||
List<PlayerStat> mining = new ArrayList<PlayerStat>();
|
||||
@@ -50,7 +51,6 @@ public final class LeaderboardManager {
|
||||
List<PlayerStat> unarmed = new ArrayList<PlayerStat>();
|
||||
List<PlayerStat> taming = new ArrayList<PlayerStat>();
|
||||
List<PlayerStat> fishing = new ArrayList<PlayerStat>();
|
||||
List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
||||
|
||||
// Read from the FlatFile database and fill our arrays with information
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class AsyncQueueManager implements Runnable {
|
||||
private LinkedBlockingQueue<Queueable> queue;
|
||||
private boolean running;
|
||||
|
||||
public AsyncQueueManager() {
|
||||
this.queue = new LinkedBlockingQueue<Queueable>();
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(running) {
|
||||
try {
|
||||
queue.take().run();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean queue(Queueable task) {
|
||||
return queue.offer(task);
|
||||
}
|
||||
|
||||
public boolean contains(String player) {
|
||||
return queue.contains(new EqualString(player));
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
running = false;
|
||||
// Throw one more Queueable into queue to unblock take()
|
||||
queue.add(new EndThread());
|
||||
}
|
||||
|
||||
private class EqualString {
|
||||
private String player;
|
||||
|
||||
public EqualString(String player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Queueable) {
|
||||
return ((Queueable)obj).getPlayer().equalsIgnoreCase(player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class EndThread implements Queueable {
|
||||
@Override
|
||||
public void run() { }
|
||||
|
||||
@Override
|
||||
public String getPlayer() { return null; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,31 @@
|
||||
package com.gmail.nossr50.runnables.commands;
|
||||
package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public class McrankCommandAsyncTask implements Runnable {
|
||||
public class McRankAsync implements Queueable {
|
||||
private final String playerName;
|
||||
private final CommandSender sender;
|
||||
private String player;
|
||||
|
||||
public McrankCommandAsyncTask(String playerName, CommandSender sender) {
|
||||
public McRankAsync(String playerName, CommandSender sender) {
|
||||
this.playerName = playerName;
|
||||
this.sender = sender;
|
||||
this.player = sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Map<String, Integer> skills = DatabaseManager.readSQLRank(playerName);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));
|
||||
@@ -53,4 +54,9 @@ public class McrankCommandAsyncTask implements Runnable {
|
||||
|
||||
}, 1L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayer() {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,39 @@
|
||||
package com.gmail.nossr50.runnables.commands;
|
||||
package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class MctopCommandAsyncTask implements Runnable {
|
||||
public class McTopAsync implements Queueable {
|
||||
|
||||
private CommandSender sender;
|
||||
private String query;
|
||||
private int page;
|
||||
private Command command;
|
||||
private String player;
|
||||
|
||||
public MctopCommandAsyncTask(int page, String query, CommandSender sender, Command command) {
|
||||
public McTopAsync(int page, String query, CommandSender sender) {
|
||||
this.page = page;
|
||||
this.query = query;
|
||||
this.sender = sender;
|
||||
this.command = command;
|
||||
this.player = sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
if (!Permissions.mctop(sender, SkillType.getSkill(query))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||
final HashMap<Integer, ArrayList<String>> userslist = DatabaseManager.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT " + ((page * 10) - 10) + ",10");
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (query.equals("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
if (query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||
}
|
||||
else {
|
||||
@@ -66,4 +56,9 @@ public class MctopCommandAsyncTask implements Runnable {
|
||||
}, 1L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.gmail.nossr50.database.queuemanager;
|
||||
|
||||
public interface Queueable {
|
||||
public void run();
|
||||
public String getPlayer();
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.datatypes.player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
@@ -10,12 +12,29 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
import com.gmail.nossr50.skills.axes.AxesManager;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -26,8 +45,18 @@ public class McMMOPlayer {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
/*
|
||||
* Since SkillManager isn't a "polymorphic type" we may prefer to have one field for each of our
|
||||
* class inheriting from SkillManager. This would also prevent the need for casting.
|
||||
* However, by using the map and the loop in the constructor
|
||||
* we make sure that all class inheriting from SkillManager are instanced.
|
||||
* Which solution is better, I let you decide. - bm01
|
||||
*/
|
||||
private Map<SkillType, SkillManager> skillManagers = new HashMap<SkillType, SkillManager>();
|
||||
|
||||
private Party party;
|
||||
private Party invite;
|
||||
private int itemShareModifier;
|
||||
|
||||
private Player ptpRequest;
|
||||
private boolean ptpEnabled = true;
|
||||
@@ -36,15 +65,317 @@ public class McMMOPlayer {
|
||||
|
||||
private boolean partyChatMode;
|
||||
private boolean adminChatMode;
|
||||
private boolean displaySkillNotifications = true;
|
||||
|
||||
private int itemShareModifier;
|
||||
private boolean abilityUse = true;
|
||||
private boolean placedRepairAnvil;
|
||||
private boolean placedSalvageAnvil;
|
||||
private boolean godMode;
|
||||
|
||||
private Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
||||
private Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||
|
||||
private Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
|
||||
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||
|
||||
private int recentlyHurt;
|
||||
private int chimaeraWing;
|
||||
private int respawnATS;
|
||||
|
||||
public McMMOPlayer(Player player) {
|
||||
String playerName = player.getName();
|
||||
|
||||
this.player = player;
|
||||
this.profile = new PlayerProfile(playerName, true);
|
||||
this.party = PartyManager.getPlayerParty(playerName);
|
||||
profile = new PlayerProfile(playerName, true);
|
||||
party = PartyManager.getPlayerParty(playerName);
|
||||
|
||||
/*
|
||||
* I'm using this method because it makes code shorter and safer (we don't have to add all SkillTypes manually),
|
||||
* but I actually have no idea about the performance impact, if there is any.
|
||||
* If in the future someone wants to remove this, don't forget to also remove what is in the SkillType enum. - bm01
|
||||
*/
|
||||
try {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
skillManagers.put(skillType, skillType.getManagerClass().getConstructor(McMMOPlayer.class).newInstance(this));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mcMMO.p.getPluginLoader().disablePlugin(mcMMO.p);
|
||||
}
|
||||
|
||||
for (AbilityType abilityType : AbilityType.values()) {
|
||||
abilityMode.put(abilityType, false);
|
||||
abilityInformed.put(abilityType, true); // This is intended
|
||||
}
|
||||
|
||||
for (ToolType toolType : ToolType.values()) {
|
||||
toolMode.put(toolType, false);
|
||||
toolATS.put(toolType, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public AcrobaticsManager getAcrobaticsManager() {
|
||||
return (AcrobaticsManager) skillManagers.get(SkillType.ACROBATICS);
|
||||
}
|
||||
|
||||
public ArcheryManager getArcheryManager() {
|
||||
return (ArcheryManager) skillManagers.get(SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
public AxesManager getAxesManager() {
|
||||
return (AxesManager) skillManagers.get(SkillType.AXES);
|
||||
}
|
||||
|
||||
public ExcavationManager getExcavationManager() {
|
||||
return (ExcavationManager) skillManagers.get(SkillType.EXCAVATION);
|
||||
}
|
||||
|
||||
public FishingManager getFishingManager() {
|
||||
return (FishingManager) skillManagers.get(SkillType.FISHING);
|
||||
}
|
||||
|
||||
public HerbalismManager getHerbalismManager() {
|
||||
return (HerbalismManager) skillManagers.get(SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
public MiningManager getMiningManager() {
|
||||
return (MiningManager) skillManagers.get(SkillType.MINING);
|
||||
}
|
||||
|
||||
public RepairManager getRepairManager() {
|
||||
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
||||
}
|
||||
|
||||
public SmeltingManager getSmeltingManager() {
|
||||
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
||||
}
|
||||
|
||||
public SwordsManager getSwordsManager() {
|
||||
return (SwordsManager) skillManagers.get(SkillType.SWORDS);
|
||||
}
|
||||
|
||||
public TamingManager getTamingManager() {
|
||||
return (TamingManager) skillManagers.get(SkillType.TAMING);
|
||||
}
|
||||
|
||||
public UnarmedManager getUnarmedManager() {
|
||||
return (UnarmedManager) skillManagers.get(SkillType.UNARMED);
|
||||
}
|
||||
|
||||
public WoodcuttingManager getWoodcuttingManager() {
|
||||
return (WoodcuttingManager) skillManagers.get(SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
/*
|
||||
* Abilities
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reset the mode of all abilities.
|
||||
*/
|
||||
public void resetAbilityMode() {
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
setAbilityMode(ability, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getAbilityMode(AbilityType ability) {
|
||||
return abilityMode.get(ability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param bool True if the ability is active, false otherwise
|
||||
*/
|
||||
public void setAbilityMode(AbilityType ability, boolean bool) {
|
||||
abilityMode.put(ability, bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the informed state of an ability
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getAbilityInformed(AbilityType ability) {
|
||||
return abilityInformed.get(ability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the informed state of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param bool True if the ability is informed, false otherwise
|
||||
*/
|
||||
public void setAbilityInformed(AbilityType ability, boolean bool) {
|
||||
abilityInformed.put(ability, bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to get the mode for
|
||||
* @return true if the tool is prepped, false otherwise
|
||||
*/
|
||||
public boolean getToolPreparationMode(ToolType tool) {
|
||||
return toolMode.get(tool);
|
||||
}
|
||||
|
||||
public boolean getAbilityUse() {
|
||||
return abilityUse;
|
||||
}
|
||||
|
||||
public void toggleAbilityUse() {
|
||||
abilityUse = !abilityUse;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tools
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reset the prep modes of all tools.
|
||||
*/
|
||||
public void resetToolPrepMode() {
|
||||
for (ToolType tool : ToolType.values()) {
|
||||
setToolPreparationMode(tool, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to set the mode for
|
||||
* @param bool true if the tool should be prepped, false otherwise
|
||||
*/
|
||||
public void setToolPreparationMode(ToolType tool, boolean bool) {
|
||||
toolMode.put(tool, bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to get the ATS for
|
||||
* @return the ATS for the tool
|
||||
*/
|
||||
public long getToolPreparationATS(ToolType tool) {
|
||||
return toolATS.get(tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to set the ATS for
|
||||
* @param ATS the ATS of the tool
|
||||
*/
|
||||
public void setToolPreparationATS(ToolType tool, long ATS) {
|
||||
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
||||
|
||||
toolATS.put(tool, startTime);
|
||||
}
|
||||
|
||||
/*
|
||||
* Recently Hurt
|
||||
*/
|
||||
|
||||
public int getRecentlyHurt() {
|
||||
return recentlyHurt;
|
||||
}
|
||||
|
||||
public void setRecentlyHurt(int value) {
|
||||
recentlyHurt = value;
|
||||
}
|
||||
|
||||
public void actualizeRecentlyHurt() {
|
||||
recentlyHurt = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Chimaera Wing
|
||||
*/
|
||||
|
||||
public int getLastChimaeraTeleport() {
|
||||
return chimaeraWing;
|
||||
}
|
||||
|
||||
public void setLastChimaeraTeleport(int value) {
|
||||
chimaeraWing = value;
|
||||
}
|
||||
|
||||
public void actualizeLastChimaeraTeleport() {
|
||||
chimaeraWing = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Exploit Prevention
|
||||
*/
|
||||
|
||||
public int getRespawnATS() {
|
||||
return respawnATS;
|
||||
}
|
||||
|
||||
public void actualizeRespawnATS() {
|
||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Repair Anvil Placement
|
||||
*/
|
||||
|
||||
public boolean getPlacedAnvil(int anvilId) {
|
||||
if (anvilId == Repair.repairAnvilId) {
|
||||
return placedRepairAnvil;
|
||||
}
|
||||
|
||||
if (anvilId == Repair.salvageAnvilId) {
|
||||
return placedSalvageAnvil;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void togglePlacedAnvil(int anvilId) {
|
||||
if (anvilId == Repair.repairAnvilId) {
|
||||
placedRepairAnvil = !placedRepairAnvil;
|
||||
}
|
||||
|
||||
if (anvilId == Repair.salvageAnvilId) {
|
||||
placedSalvageAnvil = !placedSalvageAnvil;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* God Mode
|
||||
*/
|
||||
|
||||
public boolean getGodMode() {
|
||||
return godMode;
|
||||
}
|
||||
|
||||
public void toggleGodMode() {
|
||||
godMode = !godMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skill notifications
|
||||
*/
|
||||
|
||||
public boolean useChatNotifications() {
|
||||
return displaySkillNotifications;
|
||||
}
|
||||
|
||||
public void toggleChatNotifications() {
|
||||
displaySkillNotifications = !displaySkillNotifications;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +467,9 @@ public class McMMOPlayer {
|
||||
SkillUtils.xpCheckSkill(skillType, player, profile);
|
||||
}
|
||||
|
||||
// Players & Profiles
|
||||
/*
|
||||
* Players & Profiles
|
||||
*/
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
@@ -150,7 +483,9 @@ public class McMMOPlayer {
|
||||
return profile;
|
||||
}
|
||||
|
||||
// Party Stuff
|
||||
/*
|
||||
* Party Stuff
|
||||
*/
|
||||
|
||||
public void setPartyInvite(Party invite) {
|
||||
this.invite = invite;
|
||||
@@ -252,6 +587,10 @@ public class McMMOPlayer {
|
||||
itemShareModifier = modifier;
|
||||
}
|
||||
|
||||
/*
|
||||
* Chat modes
|
||||
*/
|
||||
|
||||
public boolean getAdminChatMode() {
|
||||
return adminChatMode;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -14,7 +15,6 @@ import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.spout.huds.HudType;
|
||||
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
@@ -28,51 +28,14 @@ public class PlayerProfile {
|
||||
private McMMOHud spoutHud;
|
||||
private HudType hudType;
|
||||
|
||||
// Toggles
|
||||
private boolean loaded;
|
||||
private boolean godMode;
|
||||
|
||||
private boolean placedAnvil;
|
||||
private boolean placedSalvageAnvil;
|
||||
|
||||
private boolean hoePreparationMode;
|
||||
private boolean shovelPreparationMode;
|
||||
private boolean swordsPreparationMode;
|
||||
private boolean fistsPreparationMode;
|
||||
private boolean pickaxePreparationMode;
|
||||
private boolean axePreparationMode;
|
||||
|
||||
private boolean greenTerraMode;
|
||||
private boolean treeFellerMode;
|
||||
private boolean superBreakerMode;
|
||||
private boolean gigaDrillBreakerMode;
|
||||
private boolean serratedStrikesMode;
|
||||
private boolean skullSplitterMode;
|
||||
private boolean berserkMode;
|
||||
|
||||
private boolean greenTerraInformed = true;
|
||||
private boolean berserkInformed = true;
|
||||
private boolean skullSplitterInformed = true;
|
||||
private boolean gigaDrillBreakerInformed = true;
|
||||
private boolean superBreakerInformed = true;
|
||||
private boolean blastMiningInformed = true;
|
||||
private boolean serratedStrikesInformed = true;
|
||||
private boolean treeFellerInformed = true;
|
||||
|
||||
private boolean abilityUse = true;
|
||||
private boolean displaySkillNotifications = true;
|
||||
|
||||
// Timestamps
|
||||
private long recentlyHurt;
|
||||
private int respawnATS;
|
||||
|
||||
// mySQL Stuff
|
||||
private int userId;
|
||||
|
||||
private HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skills and Levels
|
||||
private HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); // Skills and Xp
|
||||
private HashMap<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>();
|
||||
private HashMap<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||
private boolean loaded;
|
||||
|
||||
private Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skills and Levels
|
||||
private Map<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); // Skills and Xp
|
||||
private Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>();
|
||||
|
||||
private final static String location = mcMMO.getUsersFilePath();
|
||||
|
||||
@@ -129,7 +92,7 @@ public class PlayerProfile {
|
||||
}
|
||||
else {
|
||||
for (HudType type : HudType.values()) {
|
||||
if (type.toString().equals(huds.get(1).get(0))) {
|
||||
if (type.toString().equalsIgnoreCase(huds.get(1).get(0))) {
|
||||
hudType = type;
|
||||
}
|
||||
}
|
||||
@@ -223,7 +186,7 @@ public class PlayerProfile {
|
||||
// Find if the line contains the player we want.
|
||||
String[] character = line.split(":");
|
||||
|
||||
if (!character[0].equals(playerName)) {
|
||||
if (!character[0].equalsIgnoreCase(playerName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -437,7 +400,7 @@ public class PlayerProfile {
|
||||
// While not at the end of the file
|
||||
while ((line = in.readLine()) != null) {
|
||||
// Read the line in and copy it to the output it's not the player we want to edit
|
||||
if (!line.split(":")[0].equals(playerName)) {
|
||||
if (!line.split(":")[0].equalsIgnoreCase(playerName)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
else {
|
||||
@@ -565,42 +528,6 @@ public class PlayerProfile {
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/*
|
||||
* God Mode
|
||||
*/
|
||||
|
||||
public boolean getGodMode() {
|
||||
return godMode;
|
||||
}
|
||||
|
||||
public void toggleGodMode() {
|
||||
godMode = !godMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Repair Anvil Placement
|
||||
*/
|
||||
|
||||
public void togglePlacedAnvil() {
|
||||
placedAnvil = !placedAnvil;
|
||||
}
|
||||
|
||||
public Boolean getPlacedAnvil() {
|
||||
return placedAnvil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Salvage Anvil Placement
|
||||
*/
|
||||
|
||||
public void togglePlacedSalvageAnvil() {
|
||||
placedSalvageAnvil = !placedSalvageAnvil;
|
||||
}
|
||||
|
||||
public Boolean getPlacedSalvageAnvil() {
|
||||
return placedSalvageAnvil;
|
||||
}
|
||||
|
||||
/*
|
||||
* HUD Stuff
|
||||
*/
|
||||
@@ -621,315 +548,6 @@ public class PlayerProfile {
|
||||
this.hudType = hudType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tools
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reset the prep modes of all tools.
|
||||
*/
|
||||
public void resetToolPrepMode() {
|
||||
for (ToolType tool : ToolType.values()) {
|
||||
setToolPreparationMode(tool, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to get the mode for
|
||||
* @return true if the tool is prepped, false otherwise
|
||||
*/
|
||||
public boolean getToolPreparationMode(ToolType tool) {
|
||||
switch (tool) {
|
||||
case AXE:
|
||||
return axePreparationMode;
|
||||
|
||||
case FISTS:
|
||||
return fistsPreparationMode;
|
||||
|
||||
case HOE:
|
||||
return hoePreparationMode;
|
||||
|
||||
case PICKAXE:
|
||||
return pickaxePreparationMode;
|
||||
|
||||
case SHOVEL:
|
||||
return shovelPreparationMode;
|
||||
|
||||
case SWORD:
|
||||
return swordsPreparationMode;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current prep mode of a tool.
|
||||
*
|
||||
* @param tool Tool to set the mode for
|
||||
* @param bool true if the tool should be prepped, false otherwise
|
||||
*/
|
||||
public void setToolPreparationMode(ToolType tool, boolean bool) {
|
||||
switch (tool) {
|
||||
case AXE:
|
||||
axePreparationMode = bool;
|
||||
break;
|
||||
|
||||
case FISTS:
|
||||
fistsPreparationMode = bool;
|
||||
break;
|
||||
|
||||
case HOE:
|
||||
hoePreparationMode = bool;
|
||||
break;
|
||||
|
||||
case PICKAXE:
|
||||
pickaxePreparationMode = bool;
|
||||
break;
|
||||
|
||||
case SHOVEL:
|
||||
shovelPreparationMode = bool;
|
||||
break;
|
||||
|
||||
case SWORD:
|
||||
swordsPreparationMode = bool;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to get the ATS for
|
||||
* @return the ATS for the tool
|
||||
*/
|
||||
public long getToolPreparationATS(ToolType tool) {
|
||||
return toolATS.get(tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current prep ATS of a tool.
|
||||
*
|
||||
* @param tool Tool to set the ATS for
|
||||
* @param ATS the ATS of the tool
|
||||
*/
|
||||
public void setToolPreparationATS(ToolType tool, long ATS) {
|
||||
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
|
||||
|
||||
toolATS.put(tool, startTime);
|
||||
}
|
||||
|
||||
/*
|
||||
* Abilities
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reset the prep modes of all tools.
|
||||
*/
|
||||
public void resetAbilityMode() {
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
setAbilityMode(ability, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is enabled, false otherwise
|
||||
*/
|
||||
public boolean getAbilityMode(AbilityType ability) {
|
||||
switch (ability) {
|
||||
case BERSERK:
|
||||
return berserkMode;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return superBreakerMode;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return gigaDrillBreakerMode;
|
||||
|
||||
case GREEN_TERRA:
|
||||
return greenTerraMode;
|
||||
|
||||
case SKULL_SPLITTER:
|
||||
return skullSplitterMode;
|
||||
|
||||
case TREE_FELLER:
|
||||
return treeFellerMode;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return serratedStrikesMode;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param bool True if the ability is active, false otherwise
|
||||
*/
|
||||
public void setAbilityMode(AbilityType ability, boolean bool) {
|
||||
switch (ability) {
|
||||
case BERSERK:
|
||||
berserkMode = bool;
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
superBreakerMode = bool;
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
gigaDrillBreakerMode = bool;
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
greenTerraMode = bool;
|
||||
break;
|
||||
|
||||
case SKULL_SPLITTER:
|
||||
skullSplitterMode = bool;
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
treeFellerMode = bool;
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
serratedStrikesMode = bool;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the informed state of an ability
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @return true if the ability is informed, false otherwise
|
||||
*/
|
||||
public boolean getAbilityInformed(AbilityType ability) {
|
||||
switch (ability) {
|
||||
case BERSERK:
|
||||
return berserkInformed;
|
||||
|
||||
case BLAST_MINING:
|
||||
return blastMiningInformed;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return superBreakerInformed;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return gigaDrillBreakerInformed;
|
||||
|
||||
case GREEN_TERRA:
|
||||
return greenTerraInformed;
|
||||
|
||||
case SKULL_SPLITTER:
|
||||
return skullSplitterInformed;
|
||||
|
||||
case TREE_FELLER:
|
||||
return treeFellerInformed;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
return serratedStrikesInformed;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the informed state of an ability.
|
||||
*
|
||||
* @param ability The ability to check
|
||||
* @param bool True if the ability is informed, false otherwise
|
||||
*/
|
||||
public void setAbilityInformed(AbilityType ability, boolean bool) {
|
||||
switch (ability) {
|
||||
case BERSERK:
|
||||
berserkInformed = bool;
|
||||
break;
|
||||
|
||||
case BLAST_MINING:
|
||||
blastMiningInformed = bool;
|
||||
break;
|
||||
|
||||
case SUPER_BREAKER:
|
||||
superBreakerInformed = bool;
|
||||
break;
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
gigaDrillBreakerInformed = bool;
|
||||
break;
|
||||
|
||||
case GREEN_TERRA:
|
||||
greenTerraInformed = bool;
|
||||
break;
|
||||
|
||||
case SKULL_SPLITTER:
|
||||
skullSplitterInformed = bool;
|
||||
break;
|
||||
|
||||
case TREE_FELLER:
|
||||
treeFellerInformed = bool;
|
||||
break;
|
||||
|
||||
case SERRATED_STRIKES:
|
||||
serratedStrikesInformed = bool;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getAbilityUse() {
|
||||
return abilityUse;
|
||||
}
|
||||
|
||||
public void toggleAbilityUse() {
|
||||
abilityUse = !abilityUse;
|
||||
}
|
||||
|
||||
/*
|
||||
* Recently Hurt
|
||||
*/
|
||||
|
||||
public long getRecentlyHurt() {
|
||||
return recentlyHurt;
|
||||
}
|
||||
|
||||
public void setRecentlyHurt(long value) {
|
||||
recentlyHurt = value;
|
||||
}
|
||||
|
||||
public void actualizeRecentlyHurt() {
|
||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ability Notifications
|
||||
*/
|
||||
|
||||
public boolean useChatNotifications() {
|
||||
return displaySkillNotifications;
|
||||
}
|
||||
|
||||
public void toggleChatNotifications() {
|
||||
displaySkillNotifications = !displaySkillNotifications;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cooldowns
|
||||
*/
|
||||
@@ -965,18 +583,6 @@ public class PlayerProfile {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Exploit Prevention
|
||||
*/
|
||||
|
||||
public int getRespawnATS() {
|
||||
return respawnATS;
|
||||
}
|
||||
|
||||
public void actualizeRespawnATS() {
|
||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Xp Functions
|
||||
*/
|
||||
|
||||
@@ -3,36 +3,57 @@ package com.gmail.nossr50.datatypes.skills;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
import com.gmail.nossr50.skills.axes.AxesManager;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public enum SkillType {
|
||||
ACROBATICS,
|
||||
ARCHERY,
|
||||
AXES(AbilityType.SKULL_SPLITTER, ToolType.AXE),
|
||||
EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL),
|
||||
FISHING,
|
||||
HERBALISM(AbilityType.GREEN_TERRA, ToolType.HOE),
|
||||
MINING(AbilityType.SUPER_BREAKER, ToolType.PICKAXE),
|
||||
REPAIR,
|
||||
SMELTING,
|
||||
SWORDS(AbilityType.SERRATED_STRIKES, ToolType.SWORD),
|
||||
TAMING,
|
||||
UNARMED(AbilityType.BERSERK, ToolType.FISTS),
|
||||
WOODCUTTING(AbilityType.TREE_FELLER, ToolType.AXE);
|
||||
ACROBATICS(AcrobaticsManager.class),
|
||||
ARCHERY(ArcheryManager.class),
|
||||
AXES(AxesManager.class, AbilityType.SKULL_SPLITTER, ToolType.AXE),
|
||||
EXCAVATION(ExcavationManager.class, AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL),
|
||||
FISHING(FishingManager.class),
|
||||
HERBALISM(HerbalismManager.class, AbilityType.GREEN_TERRA, ToolType.HOE),
|
||||
MINING(MiningManager.class, AbilityType.SUPER_BREAKER, ToolType.PICKAXE),
|
||||
REPAIR(RepairManager.class),
|
||||
SMELTING(SmeltingManager.class),
|
||||
SWORDS(SwordsManager.class, AbilityType.SERRATED_STRIKES, ToolType.SWORD),
|
||||
TAMING(TamingManager.class),
|
||||
UNARMED(UnarmedManager.class, AbilityType.BERSERK, ToolType.FISTS),
|
||||
WOODCUTTING(WoodcuttingManager.class, AbilityType.TREE_FELLER, ToolType.AXE);
|
||||
|
||||
private Class<? extends SkillManager> managerClass;
|
||||
private AbilityType ability;
|
||||
private ToolType tool;
|
||||
|
||||
private SkillType() {
|
||||
this.ability = null;
|
||||
this.tool = null;
|
||||
private SkillType(Class<? extends SkillManager> managerClass) {
|
||||
this.managerClass = managerClass;
|
||||
ability = null;
|
||||
tool = null;
|
||||
}
|
||||
|
||||
private SkillType(AbilityType ability, ToolType tool) {
|
||||
private SkillType(Class<? extends SkillManager> managerClass, AbilityType ability, ToolType tool) {
|
||||
this.managerClass = managerClass;
|
||||
this.ability = ability;
|
||||
this.tool = tool;
|
||||
}
|
||||
|
||||
public Class<? extends SkillManager> getManagerClass() {
|
||||
return managerClass;
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -19,11 +20,8 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
@@ -31,14 +29,13 @@ import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Salvage;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
@@ -109,21 +106,15 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
int blockId = blockState.getTypeId();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
mcMMO.placeStore.setTrue(blockState);
|
||||
}
|
||||
|
||||
if (Repair.anvilMessagesEnabled) {
|
||||
int blockID = blockState.getTypeId();
|
||||
|
||||
if (blockID == Repair.anvilID) {
|
||||
Repair.placedAnvilCheck(player, blockID);
|
||||
}
|
||||
else if (blockID == Salvage.anvilID) {
|
||||
Salvage.placedAnvilCheck(player, blockID);
|
||||
}
|
||||
if (Repair.anvilMessagesEnabled && (blockId == Repair.repairAnvilId || blockId == Repair.salvageAnvilId)) {
|
||||
UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,18 +136,16 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
/* HERBALISM */
|
||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||
HerbalismManager herbalismManager = SkillManagerStore.getInstance().getHerbalismManager(player.getName());
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
/* Green Terra */
|
||||
if (herbalismManager.canActivateAbility()) {
|
||||
SkillUtils.abilityCheck(player, SkillType.HERBALISM);
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -164,50 +153,34 @@ public class BlockListener implements Listener {
|
||||
* Instead, we check it inside the drops handler.
|
||||
*/
|
||||
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
|
||||
|
||||
// Double drops
|
||||
herbalismManager.herbalismBlockCheck(blockState);
|
||||
|
||||
// Triple drops
|
||||
if (herbalismManager.canGreenTerraPlant()) {
|
||||
herbalismManager.herbalismBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||
MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName());
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemUtils.isAxe(heldItem)) {
|
||||
Woodcutting.beginTreeFeller(blockState, player);
|
||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||
|
||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||
woodcuttingManager.processTreeFeller(blockState);
|
||||
}
|
||||
else {
|
||||
if (Config.getInstance().getWoodcuttingRequiresTool()) {
|
||||
if (ItemUtils.isAxe(heldItem)) {
|
||||
Woodcutting.beginWoodcutting(player, blockState);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Woodcutting.beginWoodcutting(player, blockState);
|
||||
}
|
||||
woodcuttingManager.woodcuttingBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.placeStore.isTrue(blockState)) {
|
||||
ExcavationManager excavationManager = SkillManagerStore.getInstance().getExcavationManager(player.getName());
|
||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
excavationManager.gigaDrillBreaker(blockState);
|
||||
}
|
||||
}
|
||||
@@ -235,19 +208,27 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = player.getName();
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (SkillManagerStore.getInstance().getHerbalismManager(playerName).canUseHylianLuck()) {
|
||||
if (SkillManagerStore.getInstance().getHerbalismManager(playerName).processHylianLuck(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
HerbalismManager herbalismManager = UserManager.getPlayer(player).getHerbalismManager();
|
||||
|
||||
if (herbalismManager.canUseHylianLuck()) {
|
||||
if (herbalismManager.processHylianLuck(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SkillManagerStore.getInstance().getSmeltingManager(playerName).canUseFluxMining(blockState)) {
|
||||
if (SkillManagerStore.getInstance().getSmeltingManager(playerName).processFluxMining(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
else if (ItemUtils.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
|
||||
|
||||
if (smeltingManager.canUseFluxMining(blockState)) {
|
||||
if (smeltingManager.processFluxMining(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +250,7 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/*
|
||||
@@ -281,30 +262,30 @@ public class BlockListener implements Listener {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !profile.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
||||
SkillUtils.removeAbilityBuff(heldItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((profile.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
if ((mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
SkillUtils.abilityCheck(player, SkillType.HERBALISM);
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.HERBALISM);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
SkillUtils.abilityCheck(player, SkillType.WOODCUTTING);
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.WOODCUTTING);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
SkillUtils.abilityCheck(player, SkillType.MINING);
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.MINING);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
SkillUtils.abilityCheck(player, SkillType.EXCAVATION);
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.EXCAVATION);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
SkillUtils.abilityCheck(player, SkillType.UNARMED);
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +294,7 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState)) {
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && BlockUtils.isLog(blockState)) {
|
||||
player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.FIZZ_PITCH);
|
||||
}
|
||||
}
|
||||
@@ -335,24 +316,23 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = player.getName();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
Block block = event.getBlock();
|
||||
BlockState blockState = block.getState();
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
/*
|
||||
* ABILITY TRIGGER CHECKS
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (SkillManagerStore.getInstance().getHerbalismManager(playerName).canGreenTerraBlock(blockState)) {
|
||||
if (SkillManagerStore.getInstance().getHerbalismManager(playerName).processGreenTerra(blockState)) {
|
||||
if (herbalismManager.canGreenTerraBlock(blockState)) {
|
||||
if (herbalismManager.processGreenTerra(blockState)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
else if (profile.getAbilityMode(AbilityType.BERSERK)) {
|
||||
else if (mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) {
|
||||
if (SkillUtils.triggerCheck(player, block, AbilityType.BERSERK)) {
|
||||
if (heldItem.getType() == Material.AIR) {
|
||||
plugin.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(player));
|
||||
@@ -362,24 +342,18 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
// Another perm check for the cracked blocks activation
|
||||
else if (BlockUtils.affectedByBlockCracker(blockState) && Permissions.blockCracker(player)) {
|
||||
if (Unarmed.blockCracker(player, blockState)) {
|
||||
else if (BlockUtils.affectedByBlockCracker(blockState)) {
|
||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||
|
||||
if (unarmedManager.canUseBlockCracker() && SkillUtils.blockBreakSimulate(block, player, false) && unarmedManager.blockCrackerCheck(blockState)) {
|
||||
blockState.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((profile.getSkillLevel(SkillType.WOODCUTTING) >= AdvancedConfig.getInstance().getLeafBlowUnlockLevel()) && BlockUtils.isLeaves(blockState)) {
|
||||
if (SkillUtils.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) {
|
||||
if (Config.getInstance().getWoodcuttingRequiresTool()) {
|
||||
if (ItemUtils.isAxe(heldItem)) {
|
||||
event.setInstaBreak(true);
|
||||
Woodcutting.beginLeafBlower(player, blockState);
|
||||
}
|
||||
}
|
||||
else if (!(heldItem.getType() == Material.SHEARS)) {
|
||||
event.setInstaBreak(true);
|
||||
Woodcutting.beginLeafBlower(player, blockState);
|
||||
}
|
||||
else if (BlockUtils.isLeaves(blockState)) {
|
||||
if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && SkillUtils.blockBreakSimulate(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
player.playSound(blockState.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -60,16 +60,19 @@ public class EntityListener implements Listener {
|
||||
public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof FallingBlock) {
|
||||
Block block = event.getBlock();
|
||||
if (!(entity instanceof FallingBlock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.placeStore.isTrue(block) && !entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
mcMMO.placeStore.setFalse(block);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
else if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
mcMMO.placeStore.setTrue(block);
|
||||
}
|
||||
Block block = event.getBlock();
|
||||
boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey);
|
||||
|
||||
if (mcMMO.placeStore.isTrue(block) && !isTracked) {
|
||||
mcMMO.placeStore.setFalse(block);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
else if (isTracked) {
|
||||
mcMMO.placeStore.setTrue(block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +89,16 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (Misc.isNPCEntity(defender) || defender.isDead()) {
|
||||
if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity attacker = event.getDamager();
|
||||
LivingEntity target = (LivingEntity) defender;
|
||||
|
||||
if (CombatUtils.isInvincible(target, event.getDamage())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker instanceof Projectile) {
|
||||
attacker = ((Projectile) attacker).getShooter();
|
||||
@@ -103,37 +111,22 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (defender instanceof Player) {
|
||||
if (defender instanceof Player && attacker instanceof Player) {
|
||||
Player defendingPlayer = (Player) defender;
|
||||
Player attackingPlayer = (Player) attacker;
|
||||
|
||||
// TODO: Is this even possible?
|
||||
if (!defendingPlayer.isOnline()) {
|
||||
// We want to make sure we're not gaining XP or applying abilities when we hit ourselves
|
||||
if (defendingPlayer.equals(attackingPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker instanceof Player) {
|
||||
Player attackingPlayer = (Player) attacker;
|
||||
|
||||
if (defendingPlayer == attackingPlayer) {
|
||||
return;
|
||||
}
|
||||
else if (PartyManager.inSameParty(defendingPlayer, attackingPlayer)) {
|
||||
if (!(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (PartyManager.inSameParty(defendingPlayer, attackingPlayer) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for invincibility */
|
||||
if (defender instanceof LivingEntity) {
|
||||
LivingEntity livingDefender = (LivingEntity) defender;
|
||||
|
||||
if (!CombatUtils.isInvincible(livingDefender, event.getDamage())) {
|
||||
CombatUtils.combatChecks(event, attacker, livingDefender);
|
||||
}
|
||||
}
|
||||
CombatUtils.combatChecks(event, attacker, target);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,24 +156,24 @@ public class EntityListener implements Listener {
|
||||
if (livingEntity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
|
||||
// TODO: Is it even possible for the player to be off-line here?
|
||||
if (!player.isOnline() || Misc.isNPCEntity(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
/* Check for invincibility */
|
||||
if (profile.getGodMode()) {
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cause) {
|
||||
case FALL:
|
||||
if (SkillManagerStore.getInstance().getAcrobaticsManager(player.getName()).canRoll()) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getAcrobaticsManager(player.getName()).rollCheck(event.getDamage()));
|
||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||
|
||||
if (acrobaticsManager.canRoll()) {
|
||||
event.setDamage(acrobaticsManager.rollCheck(event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
event.setCancelled(true);
|
||||
@@ -190,7 +183,7 @@ public class EntityListener implements Listener {
|
||||
break;
|
||||
|
||||
case BLOCK_EXPLOSION:
|
||||
MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(player.getName());
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
|
||||
if (miningManager.canUseDemolitionsExpertise()) {
|
||||
event.setDamage(miningManager.processDemolitionsExpertise(event.getDamage()));
|
||||
@@ -207,7 +200,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
if (event.getDamage() >= 1) {
|
||||
profile.actualizeRecentlyHurt();
|
||||
mcMMOPlayer.actualizeRecentlyHurt();
|
||||
}
|
||||
}
|
||||
else if (livingEntity instanceof Tameable) {
|
||||
@@ -218,24 +211,26 @@ public class EntityListener implements Listener {
|
||||
Player player = (Player) owner;
|
||||
Wolf wolf = (Wolf) pet;
|
||||
|
||||
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
|
||||
|
||||
switch (cause) {
|
||||
case CONTACT:
|
||||
case FIRE:
|
||||
case LAVA:
|
||||
if (Taming.canUseEnvironmentallyAware(player)) {
|
||||
Taming.processEnvironmentallyAware(player, wolf, event.getDamage());
|
||||
if (tamingManager.canUseEnvironmentallyAware()) {
|
||||
tamingManager.processEnvironmentallyAware(wolf, event.getDamage());
|
||||
}
|
||||
return;
|
||||
|
||||
case FALL:
|
||||
if (Taming.canUseEnvironmentallyAware(player)) {
|
||||
if (tamingManager.canUseEnvironmentallyAware()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
|
||||
case ENTITY_ATTACK:
|
||||
case PROJECTILE:
|
||||
if (Taming.canUseThickFur(player)) {
|
||||
if (tamingManager.canUseThickFur()) {
|
||||
event.setDamage(Taming.processThickFur(wolf, event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
@@ -245,7 +240,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
|
||||
case FIRE_TICK:
|
||||
if (Taming.canUseThickFur(player)) {
|
||||
if (tamingManager.canUseThickFur()) {
|
||||
Taming.processThickFurFire(wolf);
|
||||
}
|
||||
return;
|
||||
@@ -253,7 +248,7 @@ public class EntityListener implements Listener {
|
||||
case MAGIC:
|
||||
case POISON:
|
||||
case WITHER:
|
||||
if (Taming.canUseHolyHound(player)) {
|
||||
if (tamingManager.canUseHolyHound()) {
|
||||
Taming.processHolyHound(wolf, event.getDamage());
|
||||
}
|
||||
return;
|
||||
@@ -261,7 +256,7 @@ public class EntityListener implements Listener {
|
||||
case BLOCK_EXPLOSION:
|
||||
case ENTITY_EXPLOSION:
|
||||
case LIGHTNING:
|
||||
if (Taming.canUseShockProof(player)) {
|
||||
if (tamingManager.canUseShockProof()) {
|
||||
event.setDamage(Taming.processShockProof(wolf, event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
@@ -302,7 +297,7 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
if (Misc.isSpawnerXPEnabled || event.getEntity() == null) {
|
||||
if (Misc.isSpawnerXPEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,12 +320,14 @@ public class EntityListener implements Listener {
|
||||
if (entity instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
|
||||
if (plugin.tntIsTracked(id)) {
|
||||
MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(plugin.getTNTPlayer(id).getName());
|
||||
if (!plugin.tntIsTracked(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (miningManager.canUseBiggerBombs()) {
|
||||
event.setRadius(miningManager.biggerBombs(event.getRadius()));
|
||||
}
|
||||
MiningManager miningManager = UserManager.getPlayer(plugin.getTNTPlayer(id)).getMiningManager();
|
||||
|
||||
if (miningManager.canUseBiggerBombs()) {
|
||||
event.setRadius(miningManager.biggerBombs(event.getRadius()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,16 +344,18 @@ public class EntityListener implements Listener {
|
||||
if (entity instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
|
||||
if (plugin.tntIsTracked(id)) {
|
||||
MiningManager miningManager = SkillManagerStore.getInstance().getMiningManager(plugin.getTNTPlayer(id).getName());
|
||||
|
||||
if (miningManager.canUseBlastMining()) {
|
||||
miningManager.blastMiningDropProcessing(event.getYield(), event.blockList());
|
||||
event.setYield(0);
|
||||
}
|
||||
|
||||
plugin.removeFromTNTTracker(id);
|
||||
if (!plugin.tntIsTracked(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(plugin.getTNTPlayer(id)).getMiningManager();
|
||||
|
||||
if (miningManager.canUseBlastMining()) {
|
||||
miningManager.blastMiningDropProcessing(event.getYield(), event.blockList());
|
||||
event.setYield(0);
|
||||
}
|
||||
|
||||
plugin.removeFromTNTTracker(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,49 +379,51 @@ public class EntityListener implements Listener {
|
||||
int newFoodLevel = event.getFoodLevel();
|
||||
int foodChange = newFoodLevel - currentFoodLevel;
|
||||
|
||||
if (foodChange <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some foods have 3 ranks
|
||||
* Some foods have 5 ranks
|
||||
* The number of ranks is based on how 'common' the item is
|
||||
* We can adjust this quite easily if we find something is giving too much of a bonus
|
||||
*/
|
||||
if (foodChange > 0) {
|
||||
switch (player.getItemInHand().getType()) {
|
||||
case BAKED_POTATO: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
case CARROT_ITEM: /* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ 1000 */
|
||||
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.farmersDiet(player)) {
|
||||
event.setFoodLevel(SkillManagerStore.getInstance().getHerbalismManager(player.getName()).farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
switch (player.getItemInHand().getType()) {
|
||||
case BAKED_POTATO: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
case CARROT_ITEM: /* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ 1000 */
|
||||
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.farmersDiet(player)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.farmersDiet(player)) {
|
||||
event.setFoodLevel(SkillManagerStore.getInstance().getHerbalismManager(player.getName()).farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.farmersDiet(player)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
if (Permissions.fishermansDiet(player)) {
|
||||
event.setFoodLevel(SkillManagerStore.getInstance().getFishingManager(player.getName()).handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
if (Permissions.fishermansDiet(player)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.fishermansDiet(player)) {
|
||||
event.setFoodLevel(SkillManagerStore.getInstance().getFishingManager(player.getName()).handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.fishermansDiet(player)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,32 +436,38 @@ public class EntityListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityTame(EntityTameEvent event) {
|
||||
Player player = (Player) event.getOwner();
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (entity != null && !entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
SkillManagerStore.getInstance().getTamingManager(player.getName()).awardTamingXP(entity);
|
||||
}
|
||||
UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle EntityTarget events.
|
||||
*
|
||||
* @param event The event to process
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
if (event.getEntity() instanceof Tameable && event.getTarget() instanceof Player) {
|
||||
Player player = (Player) event.getTarget();
|
||||
Tameable tameable = (Tameable) event.getEntity();
|
||||
Entity entity = event.getEntity();
|
||||
Entity target = event.getTarget();
|
||||
|
||||
if (CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
|
||||
// So we can make some assumptions here, about our casting and our check
|
||||
Player owner = (Player) tameable.getOwner();
|
||||
if (!(Permissions.friendlyFire(player) && Permissions.friendlyFire(owner))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Tameable && target instanceof Player) {
|
||||
Player player = (Player) target;
|
||||
Tameable tameable = (Tameable) entity;
|
||||
|
||||
if (!CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
|
||||
// So we can make some assumptions here, about our casting and our check
|
||||
if (!(Permissions.friendlyFire(player) && Permissions.friendlyFire((Player) tameable.getOwner()))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@@ -16,11 +17,11 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -50,11 +51,12 @@ public class InventoryListener implements Listener {
|
||||
if (furnace == null) {
|
||||
return;
|
||||
}
|
||||
if (furnace.getBurnTime() == 0) {
|
||||
Block furnaceBlock = furnace.getBlock();
|
||||
|
||||
BlockState furnaceBlock = furnace.getBlock().getState();
|
||||
|
||||
if (furnace.getBurnTime() == 0 && !plugin.furnaceIsTracked(furnaceBlock)) {
|
||||
plugin.addToOpenFurnaceTracker(furnaceBlock, player.getName());
|
||||
if (!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, new FixedMetadataValue(plugin, player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,68 +78,74 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState furnaceBlock = furnace.getBlock().getState();
|
||||
if (furnace.getBurnTime() == 0) {
|
||||
Block furnaceBlock = furnace.getBlock();
|
||||
|
||||
if (furnace.getBurnTime() == 0 && plugin.furnaceIsTracked(furnaceBlock)) {
|
||||
plugin.removeFromFurnaceTracker(furnaceBlock);
|
||||
if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
||||
BlockState furnaceBlock = event.getBlock().getState();
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
|
||||
if (furnaceBlock instanceof Furnace) {
|
||||
ItemStack smelting = ((Furnace) furnaceBlock).getInventory().getSmelting();
|
||||
if (furnaceState instanceof Furnace) {
|
||||
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
||||
|
||||
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemUtils.isSmeltable(smelting)) {
|
||||
Player player = plugin.getFurnacePlayer(furnaceBlock);
|
||||
if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && smelting != null && ItemUtils.isSmeltable(smelting)) {
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString());
|
||||
|
||||
if (!Misc.isNPCEntity(player)) {
|
||||
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.fuelEfficiency(player)) {
|
||||
event.setBurnTime(SkillManagerStore.getInstance().getSmeltingManager(player.getName()).fuelEfficiency(event.getBurnTime()));
|
||||
}
|
||||
event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
||||
BlockState furnaceBlock = event.getBlock().getState();
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
|
||||
if (furnaceBlock instanceof Furnace) {
|
||||
ItemStack smelting = ((Furnace) furnaceBlock).getInventory().getSmelting();
|
||||
if (furnaceState instanceof Furnace) {
|
||||
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
|
||||
|
||||
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemUtils.isSmeltable(smelting)) {
|
||||
Player player = plugin.getFurnacePlayer(furnaceBlock);
|
||||
if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && smelting != null && ItemUtils.isSmeltable(smelting)) {
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString());
|
||||
|
||||
if (!Misc.isNPCEntity(player)) {
|
||||
if (Misc.isNPCEntity(player) || !Permissions.skillEnabled(player, SkillType.SMELTING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, SkillType.SMELTING)) {
|
||||
event.setResult(SkillManagerStore.getInstance().getSmeltingManager(player.getName()).smeltProcessing(event.getSource().getType(), event.getResult()));
|
||||
}
|
||||
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(event.getSource().getType(), event.getResult()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||
BlockState furnaceBlock = event.getBlock().getState();
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
|
||||
if (furnaceBlock instanceof Furnace) {
|
||||
ItemStack result = ((Furnace) furnaceBlock).getInventory().getResult();
|
||||
if (furnaceState instanceof Furnace) {
|
||||
ItemStack result = ((Furnace) furnaceState).getInventory().getResult();
|
||||
|
||||
if (plugin.furnaceIsTracked(furnaceBlock) && result != null && ItemUtils.isSmelted(result)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(event.getPlayer());
|
||||
if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && result != null && ItemUtils.isSmelted(result)) {
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString());
|
||||
|
||||
if (mcMMOPlayer.getPlayer().equals(plugin.getFurnacePlayer(furnaceBlock))) {
|
||||
event.setExpToDrop(SkillManagerStore.getInstance().getSmeltingManager(event.getPlayer().getName()).vanillaXPBoost(event.getExpToDrop()));
|
||||
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
|
||||
|
||||
if (smeltingManager.canUseVanillaXpBoost()) {
|
||||
event.setExpToDrop(smeltingManager.vanillaXPBoost(event.getExpToDrop()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,17 +30,16 @@ import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Salvage;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.HardcoreManager;
|
||||
@@ -100,10 +99,9 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (profile.getGodMode() && !Permissions.mcgod(player)) {
|
||||
profile.toggleGodMode();
|
||||
if (mcMMOPlayer.getGodMode() && !Permissions.mcgod(player)) {
|
||||
mcMMOPlayer.toggleGodMode();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.GodMode.Forbidden"));
|
||||
}
|
||||
|
||||
@@ -127,7 +125,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
UserManager.addUser(player).getProfile().actualizeRespawnATS();
|
||||
UserManager.addUser(player).actualizeRespawnATS();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +137,9 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@@ -162,7 +160,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
FishingManager fishingManager = SkillManagerStore.getInstance().getFishingManager(player.getName());
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
switch (event.getState()) {
|
||||
case CAUGHT_FISH:
|
||||
@@ -260,7 +258,7 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
UserManager.getPlayer(player).getProfile().actualizeRespawnATS();
|
||||
UserManager.getPlayer(player).actualizeRespawnATS();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,30 +276,32 @@ public class PlayerListener implements Listener {
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
int blockID = block.getTypeId();
|
||||
|
||||
/* REPAIR CHECKS */
|
||||
if (blockID == Repair.anvilID && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairManager.isRepairable(heldItem)) {
|
||||
mcMMO.repairManager.handleRepair(UserManager.getPlayer(player), heldItem);
|
||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairableManager.isRepairable(heldItem)) {
|
||||
UserManager.getPlayer(player).getRepairManager().handleRepair(heldItem);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
/* SALVAGE CHECKS */
|
||||
else if (blockID == Salvage.anvilID && Permissions.salvage(player) && Salvage.isSalvageable(heldItem)) {
|
||||
Salvage.handleSalvage(player, block.getLocation(), heldItem);
|
||||
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
||||
UserManager.getPlayer(player).getRepairManager().handleSalvage(block.getLocation(), heldItem);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
}
|
||||
/* BLAST MINING CHECK */
|
||||
else if (SkillManagerStore.getInstance().getMiningManager(player.getName()).canDetonate()) {
|
||||
else if (miningManager.canDetonate()) {
|
||||
if (blockID == Material.TNT.getId()) {
|
||||
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
||||
}
|
||||
else {
|
||||
SkillManagerStore.getInstance().getMiningManager(player.getName()).remoteDetonation();
|
||||
miningManager.remoteDetonation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,8 +309,8 @@ public class PlayerListener implements Listener {
|
||||
|
||||
case RIGHT_CLICK_AIR:
|
||||
/* BLAST MINING CHECK */
|
||||
if (SkillManagerStore.getInstance().getMiningManager(player.getName()).canDetonate()) {
|
||||
SkillManagerStore.getInstance().getMiningManager(player.getName()).remoteDetonation();
|
||||
if (miningManager.canDetonate()) {
|
||||
miningManager.remoteDetonation();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -334,6 +334,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
@@ -359,7 +360,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
/* GREEN THUMB CHECK */
|
||||
HerbalismManager herbalismManager = SkillManagerStore.getInstance().getHerbalismManager(player.getName());
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, heldItem.getAmount() - 1));
|
||||
@@ -399,14 +400,15 @@ public class PlayerListener implements Listener {
|
||||
case LEFT_CLICK_BLOCK:
|
||||
|
||||
/* CALL OF THE WILD CHECKS */
|
||||
if (player.isSneaking()) {
|
||||
if (player.isSneaking() && Permissions.callOfTheWild(player)) {
|
||||
Material type = heldItem.getType();
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
|
||||
if (type == Material.RAW_FISH) {
|
||||
SkillManagerStore.getInstance().getTamingManager(player.getName()).summonOcelot();
|
||||
tamingManager.summonOcelot();
|
||||
}
|
||||
else if (type == Material.BONE) {
|
||||
SkillManagerStore.getInstance().getTamingManager(player.getName()).summonWolf();
|
||||
tamingManager.summonWolf();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ import java.util.List;
|
||||
|
||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@@ -29,6 +27,7 @@ import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.database.LeaderboardManager;
|
||||
import com.gmail.nossr50.database.queuemanager.AsyncQueueManager;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.listeners.BlockListener;
|
||||
import com.gmail.nossr50.listeners.EntityListener;
|
||||
@@ -45,10 +44,11 @@ import com.gmail.nossr50.runnables.party.PartyLoaderTask;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.runnables.skills.SkillMonitorTask;
|
||||
import com.gmail.nossr50.skills.child.ChildConfig;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairManagerFactory;
|
||||
import com.gmail.nossr50.skills.repair.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.RepairableManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairableManagerFactory;
|
||||
import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.UpdateChecker;
|
||||
@@ -66,12 +66,12 @@ public class mcMMO extends JavaPlugin {
|
||||
private final WorldListener worldListener = new WorldListener();
|
||||
|
||||
private HashMap<Integer, String> tntTracker = new HashMap<Integer, String>();
|
||||
private HashMap<BlockState, String> furnaceTracker = new HashMap<BlockState, String>();
|
||||
|
||||
public static mcMMO p;
|
||||
|
||||
public static ChunkManager placeStore;
|
||||
public static RepairManager repairManager;
|
||||
public static RepairableManager repairableManager;
|
||||
public static AsyncQueueManager queueManager;
|
||||
|
||||
// Jar Stuff
|
||||
public static File mcmmo;
|
||||
@@ -95,6 +95,7 @@ public class mcMMO extends JavaPlugin {
|
||||
public static FixedMetadataValue metadataValue;
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
||||
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
|
||||
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
@@ -115,6 +116,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
registerEvents();
|
||||
registerCustomRecipes();
|
||||
|
||||
// Setup the leader boards
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
@@ -155,7 +157,7 @@ public class mcMMO extends JavaPlugin {
|
||||
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +175,12 @@ public class mcMMO extends JavaPlugin {
|
||||
catch (NullPointerException e) {}
|
||||
|
||||
getServer().getScheduler().cancelTasks(this); // This removes our tasks
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
queueManager.disable(); // Disable and stop queue thread
|
||||
queueManager = null; // null static variable
|
||||
}
|
||||
|
||||
HandlerList.unregisterAll(this); // Cancel event registrations
|
||||
|
||||
if (Config.getInstance().getBackupsEnabled()) {
|
||||
@@ -273,22 +281,6 @@ public class mcMMO extends JavaPlugin {
|
||||
tntTracker.remove(tntID);
|
||||
}
|
||||
|
||||
public void addToOpenFurnaceTracker(BlockState furnace, String playerName) {
|
||||
furnaceTracker.put(furnace, playerName);
|
||||
}
|
||||
|
||||
public boolean furnaceIsTracked(BlockState furnace) {
|
||||
return furnaceTracker.containsKey(furnace);
|
||||
}
|
||||
|
||||
public void removeFromFurnaceTracker(BlockState furnace) {
|
||||
furnaceTracker.remove(furnace);
|
||||
}
|
||||
|
||||
public Player getFurnacePlayer(BlockState furnace) {
|
||||
return getServer().getPlayer(furnaceTracker.get(furnace));
|
||||
}
|
||||
|
||||
public static String getMainDirectory() {
|
||||
return mainDirectory;
|
||||
}
|
||||
@@ -377,8 +369,8 @@ public class mcMMO extends JavaPlugin {
|
||||
// Load repair configs, make manager, and register them at this time
|
||||
RepairConfigManager rManager = new RepairConfigManager(this);
|
||||
repairables.addAll(rManager.getLoadedRepairables());
|
||||
repairManager = RepairManagerFactory.getRepairManager(repairables.size());
|
||||
repairManager.registerRepairables(repairables);
|
||||
repairableManager = RepairableManagerFactory.getRepairManager(repairables.size());
|
||||
repairableManager.registerRepairables(repairables);
|
||||
|
||||
// Check if Repair Anvil and Salvage Anvil have different itemID's
|
||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
|
||||
@@ -450,6 +442,12 @@ public class mcMMO extends JavaPlugin {
|
||||
CommandRegistrationManager.registerMchudCommand();
|
||||
}
|
||||
|
||||
private void registerCustomRecipes() {
|
||||
if (Config.getInstance().getChimaeraEnabled()) {
|
||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleTasks() {
|
||||
BukkitScheduler scheduler = getServer().getScheduler();
|
||||
|
||||
@@ -465,6 +463,11 @@ public class mcMMO extends JavaPlugin {
|
||||
// Bleed timer (Runs every two seconds)
|
||||
scheduler.scheduleSyncRepeatingTask(this, new BleedTimerTask(), 40, 40);
|
||||
|
||||
if (Config.getInstance().getUseMySQL()) {
|
||||
queueManager = new AsyncQueueManager();
|
||||
scheduler.runTaskAsynchronously(this, queueManager);
|
||||
}
|
||||
|
||||
// Old & Powerless User remover
|
||||
int purgeInterval = Config.getInstance().getPurgeInterval();
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class PartyManager {
|
||||
List<Player> nearMembers = new ArrayList<Player>();
|
||||
if (party != null) {
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
if (!player.getName().equals(member.getName()) && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||
if (!player.getName().equalsIgnoreCase(member.getName()) && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||
nearMembers.add(member);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public final class PartyManager {
|
||||
public static Party getPlayerParty(String playerName) {
|
||||
for (Party party : parties) {
|
||||
for (OfflinePlayer member : party.getMembers()) {
|
||||
if (member.getName().equals(playerName)) {
|
||||
if (member.getName().equalsIgnoreCase(playerName)) {
|
||||
return party;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public final class PartyManager {
|
||||
}
|
||||
else {
|
||||
// If the leaving player was the party leader, appoint a new leader from the party members
|
||||
if (party.getLeader().equals(player.getName())) {
|
||||
if (party.getLeader().equalsIgnoreCase(player.getName())) {
|
||||
String newLeader = members.get(0).getName();
|
||||
party.setLeader(newLeader);
|
||||
}
|
||||
@@ -374,10 +374,10 @@ public final class PartyManager {
|
||||
String leaderName = party.getLeader();
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
if (member.getName().equals(playerName)) {
|
||||
if (member.getName().equalsIgnoreCase(playerName)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.Player"));
|
||||
}
|
||||
else if (member.getName().equals(leaderName)) {
|
||||
else if (member.getName().equalsIgnoreCase(leaderName)) {
|
||||
member.sendMessage(LocaleLoader.getString("Party.Owner.NotLeader"));
|
||||
}
|
||||
else {
|
||||
@@ -396,7 +396,7 @@ public final class PartyManager {
|
||||
* @return true if the player can invite
|
||||
*/
|
||||
public static boolean canInvite(Player player, Party party) {
|
||||
if (party.isLocked() && !party.getLeader().equals(player.getName())) {
|
||||
if (party.isLocked() && !party.getLeader().equalsIgnoreCase(player.getName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -488,13 +488,13 @@ public final class PartyManager {
|
||||
}
|
||||
|
||||
partiesFile.set(partyName + ".Members", memberNames);
|
||||
}
|
||||
|
||||
try {
|
||||
partiesFile.save(new File(partiesFilePath));
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
partiesFile.save(new File(partiesFilePath));
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SQLConversionTask implements Runnable {
|
||||
playerName = character[0];
|
||||
|
||||
// Check for things we don't want put in the DB
|
||||
if (playerName == null || playerName.equals("null") || playerName.equals("#Storage place for user information")) {
|
||||
if (playerName == null || playerName.equalsIgnoreCase("null") || playerName.equalsIgnoreCase("#Storage place for user information")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
public class HerbalismBlockUpdaterTask implements Runnable {
|
||||
private BlockState blockState;
|
||||
|
||||
public HerbalismBlockUpdaterTask(BlockState blockState) {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
@@ -15,19 +11,13 @@ public class SkillMonitorTask implements Runnable {
|
||||
public void run() {
|
||||
long curTime = System.currentTimeMillis();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers().values()) {
|
||||
/*
|
||||
* MONITOR SKILLS
|
||||
*/
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (skill.getTool() != null && skill.getAbility() != null) {
|
||||
SkillUtils.monitorSkill(player, profile, curTime, skill);
|
||||
SkillUtils.monitorSkill(mcMMOPlayer, curTime, skill);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +26,7 @@ public class SkillMonitorTask implements Runnable {
|
||||
*/
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
if (ability.getCooldown() > 0) {
|
||||
SkillUtils.watchCooldown(player, profile, ability);
|
||||
SkillUtils.watchCooldown(mcMMOPlayer, ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.gmail.nossr50.runnables.skills.herbalism;
|
||||
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.material.CocoaPlant;
|
||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
||||
|
||||
public class GreenTerraTimerTask implements Runnable {
|
||||
private BlockState blockState;
|
||||
|
||||
/**
|
||||
* Convert plants affected by the Green Terra ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*/
|
||||
public GreenTerraTimerTask(BlockState blockState) {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
switch (blockState.getType()) {
|
||||
case CROPS:
|
||||
case CARROT:
|
||||
case POTATO:
|
||||
blockState.setRawData(CropState.MEDIUM.getData());
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
case NETHER_WARTS:
|
||||
blockState.setRawData((byte) 0x2);
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
case COCOA:
|
||||
CocoaPlant plant = (CocoaPlant) blockState.getData();
|
||||
plant.setSize(CocoaPlantSize.MEDIUM);
|
||||
blockState.setData(plant);
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.gmail.nossr50.runnables.skills.herbalism;
|
||||
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.material.CocoaPlant;
|
||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
||||
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
|
||||
public class GreenThumbTimerTask implements Runnable {
|
||||
private BlockState blockState;
|
||||
private int skillLevel;
|
||||
|
||||
/**
|
||||
* Convert plants affected by the Green Thumb ability.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @param skillLevel The player's Herbalism skill level
|
||||
*/
|
||||
public GreenThumbTimerTask(BlockState blockState, int skillLevel) {
|
||||
this.blockState = blockState;
|
||||
this.skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int greenThumbStage = Math.min(Math.min(skillLevel, Herbalism.greenThumbStageMaxLevel) / Herbalism.greenThumbStageChangeLevel, 4);
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case CROPS:
|
||||
case CARROT:
|
||||
case POTATO:
|
||||
blockState.setRawData((byte) greenThumbStage);
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
case NETHER_WARTS:
|
||||
if (greenThumbStage > 2) {
|
||||
blockState.setRawData((byte) 0x2);
|
||||
}
|
||||
else if (greenThumbStage == 2) {
|
||||
blockState.setRawData((byte) 0x1);
|
||||
}
|
||||
else {
|
||||
blockState.setRawData((byte) 0x0);
|
||||
}
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
case COCOA:
|
||||
CocoaPlant plant = (CocoaPlant) blockState.getData();
|
||||
|
||||
if (greenThumbStage > 1) {
|
||||
plant.setSize(CocoaPlantSize.MEDIUM);
|
||||
}
|
||||
else {
|
||||
plant.setSize(CocoaPlantSize.SMALL);
|
||||
}
|
||||
blockState.setData(plant);
|
||||
blockState.update(true);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
import com.gmail.nossr50.skills.axes.AxeManager;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class SkillManagerStore {
|
||||
private static SkillManagerStore instance;
|
||||
|
||||
private HashMap<String, AcrobaticsManager> acrobaticsManagers = new HashMap<String, AcrobaticsManager>();
|
||||
private HashMap<String, ArcheryManager> archeryManagers = new HashMap<String, ArcheryManager>();
|
||||
private HashMap<String, AxeManager> axeManagers = new HashMap<String, AxeManager>();
|
||||
private HashMap<String, ExcavationManager> excavationManagers = new HashMap<String, ExcavationManager>();
|
||||
private HashMap<String, FishingManager> fishingManagers = new HashMap<String, FishingManager>();
|
||||
private HashMap<String, HerbalismManager> herbalismManagers = new HashMap<String, HerbalismManager>();
|
||||
private HashMap<String, MiningManager> miningManagers = new HashMap<String, MiningManager>();
|
||||
private HashMap<String, SmeltingManager> smeltingManagers = new HashMap<String, SmeltingManager>();
|
||||
private HashMap<String, SwordsManager> swordsManagers = new HashMap<String, SwordsManager>();
|
||||
private HashMap<String, TamingManager> tamingManagers = new HashMap<String, TamingManager>();
|
||||
private HashMap<String, UnarmedManager> unarmedManagers = new HashMap<String, UnarmedManager>();
|
||||
|
||||
public static SkillManagerStore getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SkillManagerStore();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public AcrobaticsManager getAcrobaticsManager(String playerName) {
|
||||
if (!acrobaticsManagers.containsKey(playerName)) {
|
||||
acrobaticsManagers.put(playerName, new AcrobaticsManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return acrobaticsManagers.get(playerName);
|
||||
}
|
||||
|
||||
public ArcheryManager getArcheryManager(String playerName) {
|
||||
if (!archeryManagers.containsKey(playerName)) {
|
||||
archeryManagers.put(playerName, new ArcheryManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return archeryManagers.get(playerName);
|
||||
}
|
||||
|
||||
public AxeManager getAxeManager(String playerName) {
|
||||
if (!axeManagers.containsKey(playerName)) {
|
||||
axeManagers.put(playerName, new AxeManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return axeManagers.get(playerName);
|
||||
}
|
||||
|
||||
public ExcavationManager getExcavationManager(String playerName) {
|
||||
if (!excavationManagers.containsKey(playerName)) {
|
||||
excavationManagers.put(playerName, new ExcavationManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return excavationManagers.get(playerName);
|
||||
}
|
||||
|
||||
public FishingManager getFishingManager(String playerName) {
|
||||
if (!fishingManagers.containsKey(playerName)) {
|
||||
fishingManagers.put(playerName, new FishingManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return fishingManagers.get(playerName);
|
||||
}
|
||||
|
||||
public HerbalismManager getHerbalismManager(String playerName) {
|
||||
if (!herbalismManagers.containsKey(playerName)) {
|
||||
herbalismManagers.put(playerName, new HerbalismManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return herbalismManagers.get(playerName);
|
||||
}
|
||||
|
||||
public MiningManager getMiningManager(String playerName) {
|
||||
if (!miningManagers.containsKey(playerName)) {
|
||||
miningManagers.put(playerName, new MiningManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return miningManagers.get(playerName);
|
||||
}
|
||||
|
||||
public SmeltingManager getSmeltingManager(String playerName) {
|
||||
if (!smeltingManagers.containsKey(playerName)) {
|
||||
smeltingManagers.put(playerName, new SmeltingManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return smeltingManagers.get(playerName);
|
||||
}
|
||||
|
||||
public SwordsManager getSwordsManager(String playerName) {
|
||||
if (!swordsManagers.containsKey(playerName)) {
|
||||
swordsManagers.put(playerName, new SwordsManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return swordsManagers.get(playerName);
|
||||
}
|
||||
|
||||
public TamingManager getTamingManager(String playerName) {
|
||||
if (!tamingManagers.containsKey(playerName)) {
|
||||
tamingManagers.put(playerName, new TamingManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return tamingManagers.get(playerName);
|
||||
}
|
||||
|
||||
public UnarmedManager getUnarmedManager(String playerName) {
|
||||
if (!unarmedManagers.containsKey(playerName)) {
|
||||
unarmedManagers.put(playerName, new UnarmedManager(UserManager.getPlayer(playerName)));
|
||||
}
|
||||
|
||||
return unarmedManagers.get(playerName);
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
@@ -28,12 +28,11 @@ public class AcrobaticsManager extends SkillManager {
|
||||
|
||||
public boolean canDodge(Entity damager) {
|
||||
if (Permissions.dodge(getPlayer())) {
|
||||
if (damager instanceof Player && SkillType.ACROBATICS.getPVPEnabled()) {
|
||||
return true;
|
||||
}
|
||||
else if (!(damager instanceof Player) && SkillType.ACROBATICS.getPVEEnabled() && !(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled)) {
|
||||
return true;
|
||||
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CombatUtils.shouldProcessSkill(damager, skill);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -49,17 +48,15 @@ public class AcrobaticsManager extends SkillManager {
|
||||
int modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(player, skill, Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) {
|
||||
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) {
|
||||
ParticleEffectUtils.playDodgeEffect(player);
|
||||
|
||||
PlayerProfile playerProfile = getProfile();
|
||||
|
||||
if (playerProfile.useChatNotifications()) {
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||
}
|
||||
|
||||
// Why do we check respawn cooldown here?
|
||||
if (System.currentTimeMillis() >= playerProfile.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) {
|
||||
if (System.currentTimeMillis() >= mcMMOPlayer.getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) {
|
||||
applyXpGain(damage * Acrobatics.dodgeXpModifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@ public class ArcheryManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canSkillShot() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return SkillUtils.unlockLevelReached(player, skill, Archery.skillShotIncreaseLevel) && Permissions.bonusDamage(player, skill);
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(getPlayer(), skill);
|
||||
}
|
||||
|
||||
public boolean canTrackArrows() {
|
||||
@@ -47,7 +45,7 @@ public class ArcheryManager extends SkillManager {
|
||||
Location shooterLocation = player.getLocation();
|
||||
Location targetLocation = target.getLocation();
|
||||
|
||||
if (!shooterLocation.getWorld().equals(targetLocation.getWorld())) {
|
||||
if (shooterLocation.getWorld() != targetLocation.getWorld()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +62,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param target The {@link LivingEntity} damaged by the arrow
|
||||
*/
|
||||
public void trackArrows(LivingEntity target) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel)) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel)) {
|
||||
Archery.incrementTrackerValue(target);
|
||||
}
|
||||
}
|
||||
@@ -72,26 +70,24 @@ public class ArcheryManager extends SkillManager {
|
||||
/**
|
||||
* Handle the effects of the Daze ability
|
||||
*
|
||||
* @param defender The player being affected by the ability
|
||||
* @param defender The {@link Player} being affected by the ability
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public int dazeCheck(Player defender, int damage) {
|
||||
Player attacker = getPlayer();
|
||||
|
||||
if (SkillUtils.activationSuccessful(attacker, skill, Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
|
||||
Location dazedLocation = defender.getLocation();
|
||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||
|
||||
defender.teleport(dazedLocation);
|
||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||
|
||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
}
|
||||
|
||||
if (getProfile().useChatNotifications()) {
|
||||
attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
}
|
||||
|
||||
return damage + Archery.dazeModifier;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -19,8 +20,8 @@ import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class AxeManager extends SkillManager {
|
||||
public AxeManager(McMMOPlayer mcMMOPlayer) {
|
||||
public class AxesManager extends SkillManager {
|
||||
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.AXES);
|
||||
}
|
||||
|
||||
@@ -41,11 +42,11 @@ public class AxeManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||
return target.isValid() && getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
return target.isValid() && mcMMOPlayer.getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return getProfile().getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,10 +69,8 @@ public class AxeManager extends SkillManager {
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public int criticalHitCheck(LivingEntity target, int damage) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (SkillUtils.activationSuccessful(player, skill, Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
@@ -94,10 +93,11 @@ public class AxeManager extends SkillManager {
|
||||
int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
|
||||
|
||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||
if (ItemUtils.isArmor(armor) && SkillUtils.activationSuccessful(getPlayer(), skill, Axes.impactChance)) {
|
||||
if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
|
||||
double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
|
||||
double maxDurabilityDamage = (ModUtils.isCustomArmor(armor) ? ModUtils.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability()) * Axes.impactMaxDurabilityModifier;
|
||||
short maxDurability = ModUtils.isCustomArmor(armor) ? ModUtils.getArmorFromItemStack(armor).getDurability() : armor.getType().getMaxDurability();
|
||||
double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier;
|
||||
|
||||
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));
|
||||
}
|
||||
@@ -112,20 +112,20 @@ public class AxeManager extends SkillManager {
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public int greaterImpactCheck(LivingEntity target, int damage) {
|
||||
Player player = getPlayer();
|
||||
if (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (SkillUtils.activationSuccessful(player, skill, Axes.greaterImpactChance)) {
|
||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||
|
||||
if (getProfile().useChatNotifications()) {
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||
}
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canShake(Entity target) {
|
||||
Player player = getPlayer();
|
||||
|
||||
return target instanceof LivingEntity && SkillUtils.unlockLevelReached(player, skill, AdvancedConfig.getInstance().getShakeUnlockLevel()) && Permissions.shake(player);
|
||||
return target instanceof LivingEntity && getSkillLevel() >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shake(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +134,7 @@ public class FishingManager extends SkillManager {
|
||||
* @param mob The {@link LivingEntity} affected by the ability
|
||||
*/
|
||||
public void shakeCheck(LivingEntity target) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, getShakeProbability())) {
|
||||
if (getShakeProbability() > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
Map<ItemStack, Integer> possibleDrops = new HashMap<ItemStack, Integer>();
|
||||
|
||||
Fishing.findPossibleDrops(target, possibleDrops);
|
||||
@@ -219,7 +217,7 @@ public class FishingManager extends SkillManager {
|
||||
FishingTreasure treasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
|
||||
ItemStack treasureDrop = treasure.getDrop();
|
||||
|
||||
if (!SkillUtils.treasureDropSuccessful(treasure.getDropChance(), skillLevel)) {
|
||||
if (!SkillUtils.treasureDropSuccessful(treasure.getDropChance(), activationChance)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,24 +63,20 @@ public class Herbalism {
|
||||
protected static int calculateCatciAndSugarDrops(BlockState blockState) {
|
||||
Block block = blockState.getBlock();
|
||||
Material blockType = blockState.getType();
|
||||
int dropAmount = 0;
|
||||
|
||||
// Handle the original block
|
||||
if (!mcMMO.placeStore.isTrue(blockState)) {
|
||||
dropAmount++;
|
||||
}
|
||||
int dropAmount = mcMMO.placeStore.isTrue(block) ? 0 : 1;
|
||||
|
||||
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
|
||||
for (int y = 1; y < 3; y++) {
|
||||
Block relativeBlock = block.getRelative(BlockFace.UP, y);
|
||||
Material relativeBlockType = relativeBlock.getType();
|
||||
|
||||
// If the first one is air, so is the next one
|
||||
if (relativeBlockType == Material.AIR) {
|
||||
if (relativeBlock.getType() != blockType) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (relativeBlockType == blockType && !mcMMO.placeStore.isTrue(relativeBlock)) {
|
||||
if (mcMMO.placeStore.isTrue(relativeBlock)) {
|
||||
mcMMO.placeStore.setFalse(relativeBlock);
|
||||
}
|
||||
else {
|
||||
dropAmount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,34 +3,32 @@ package com.gmail.nossr50.skills.herbalism;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.material.CocoaPlant;
|
||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.herbalism.GreenTerraTimerTask;
|
||||
import com.gmail.nossr50.runnables.skills.herbalism.GreenThumbTimerTask;
|
||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class HerbalismManager extends SkillManager {
|
||||
@@ -56,21 +54,19 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseHylianLuck() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return ItemUtils.isSword(player.getItemInHand()) && Permissions.hylianLuck(player);
|
||||
return Permissions.hylianLuck(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||
return getProfile().getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return getProfile().getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(getPlayer());
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canGreenTerraPlant() {
|
||||
return getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +77,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return the modified change in hunger for the event
|
||||
*/
|
||||
public int farmersDiet(int rankChange, int eventFoodLevel) {
|
||||
return SkillUtils.handleFoodSkills(getPlayer(), SkillType.HERBALISM, eventFoodLevel, Herbalism.farmersDietRankLevel1, Herbalism.farmersDietMaxLevel, rankChange);
|
||||
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Herbalism.farmersDietRankLevel1, Herbalism.farmersDietMaxLevel, rankChange);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,65 +108,63 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process double drops & XP gain for Herbalism.
|
||||
*
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public void herbalismBlockCheck(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
Material blockType = blockState.getType();
|
||||
Material material = blockState.getType();
|
||||
boolean oneBlockPlant = (material == Material.CACTUS || material == Material.SUGAR_CANE_BLOCK) ? false : true;
|
||||
|
||||
HerbalismBlock herbalismBlock = HerbalismBlock.getHerbalismBlock(blockType);
|
||||
CustomBlock customBlock = null;
|
||||
if (oneBlockPlant && mcMMO.placeStore.isTrue(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
HerbalismBlock herbalismBlock = HerbalismBlock.getHerbalismBlock(material);
|
||||
ItemStack drop = null;
|
||||
int amount = 1;
|
||||
int xp = 0;
|
||||
int dropAmount = 1;
|
||||
ItemStack dropItem = null;
|
||||
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
|
||||
|
||||
if (herbalismBlock != null) {
|
||||
if (blockType == Material.CACTUS || blockType == Material.SUGAR_CANE_BLOCK) {
|
||||
dropItem = herbalismBlock.getDropItem();
|
||||
dropAmount = Herbalism.calculateCatciAndSugarDrops(blockState);
|
||||
xp = herbalismBlock.getXpGain() * dropAmount;
|
||||
if (herbalismBlock.hasGreenThumbPermission(getPlayer())) {
|
||||
processGreenThumbPlants(blockState, greenTerra);
|
||||
}
|
||||
else if (herbalismBlock.hasGreenThumbPermission(player)) {
|
||||
dropItem = herbalismBlock.getDropItem();
|
||||
xp = herbalismBlock.getXpGain();
|
||||
processGreenThumbPlants(blockState);
|
||||
|
||||
xp = herbalismBlock.getXpGain();
|
||||
|
||||
if (herbalismBlock.canDoubleDrop() && Permissions.doubleDrops(getPlayer(), skill)) {
|
||||
drop = herbalismBlock.getDropItem();
|
||||
}
|
||||
else {
|
||||
if (!mcMMO.placeStore.isTrue(blockState)) {
|
||||
dropItem = herbalismBlock.getDropItem();
|
||||
xp = herbalismBlock.getXpGain();
|
||||
}
|
||||
|
||||
if (!oneBlockPlant) {
|
||||
amount = Herbalism.calculateCatciAndSugarDrops(blockState);
|
||||
xp *= amount;
|
||||
}
|
||||
}
|
||||
else {
|
||||
customBlock = ModUtils.getCustomBlock(blockState);
|
||||
dropItem = customBlock.getItemDrop();
|
||||
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
}
|
||||
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(player, skill, Herbalism.doubleDropsMaxChance, Herbalism.doubleDropsMaxLevel)) {
|
||||
Location location = blockState.getLocation();
|
||||
|
||||
if (dropItem != null && herbalismBlock != null && herbalismBlock.canDoubleDrop()) {
|
||||
Misc.dropItems(location, dropItem, dropAmount);
|
||||
}
|
||||
else if (customBlock != null) {
|
||||
if (Permissions.doubleDrops(getPlayer(), skill)) {
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
|
||||
if (minimumDropAmount != maximumDropAmount) {
|
||||
Misc.randomDropItems(location, dropItem, maximumDropAmount - minimumDropAmount);
|
||||
}
|
||||
|
||||
Misc.dropItems(location, dropItem, minimumDropAmount);
|
||||
drop = customBlock.getItemDrop();
|
||||
amount = Misc.getRandom().nextInt(maximumDropAmount - minimumDropAmount + 1) + minimumDropAmount;
|
||||
}
|
||||
}
|
||||
|
||||
applyXpGain(xp);
|
||||
|
||||
if (drop == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.doubleDropsMaxChance, Herbalism.doubleDropsMaxLevel)) {
|
||||
Misc.dropItems(blockState.getLocation(), drop, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,10 +174,8 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processGreenThumbBlocks(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!SkillUtils.activationSuccessful(player, skill, Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -197,9 +189,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
public boolean processHylianLuck(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!SkillUtils.activationSuccessful(player, skill, Herbalism.hylianLuckMaxChance, Herbalism.hylianLuckMaxLevel)) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.hylianLuckMaxChance, Herbalism.hylianLuckMaxLevel)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -238,7 +228,7 @@ public class HerbalismManager extends SkillManager {
|
||||
blockState.setType(Material.AIR);
|
||||
|
||||
Misc.dropItem(blockState.getLocation(), treasures.get(Misc.getRandom().nextInt(treasures.size())).getDrop());
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.HylianLuck"));
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.HylianLuck"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -266,7 +256,7 @@ public class HerbalismManager extends SkillManager {
|
||||
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
|
||||
player.updateInventory();
|
||||
|
||||
if (!SkillUtils.activationSuccessful(player, skill, Herbalism.shroomThumbMaxChance, Herbalism.shroomThumbMaxLevel)) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.shroomThumbMaxChance, Herbalism.shroomThumbMaxLevel)) {
|
||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
|
||||
return false;
|
||||
}
|
||||
@@ -278,31 +268,82 @@ public class HerbalismManager extends SkillManager {
|
||||
* Process the Green Thumb ability for plants.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @param greenTerra
|
||||
*/
|
||||
private void processGreenThumbPlants(BlockState blockState) {
|
||||
private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) {
|
||||
Player player = getPlayer();
|
||||
PlayerInventory playerInventory = player.getInventory();
|
||||
ItemStack seed = HerbalismBlock.getHerbalismBlock(blockState.getType()).getDropItem();
|
||||
ItemStack seed = (blockState.getType() == Material.CROPS) ? new ItemStack(Material.SEEDS) : HerbalismBlock.getHerbalismBlock(blockState.getType()).getDropItem();
|
||||
|
||||
if (!playerInventory.containsAtLeast(seed, 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
if (playerProfile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
playerInventory.removeItem(seed);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new GreenTerraTimerTask(blockState), 0);
|
||||
if (!greenTerra && !SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
|
||||
return;
|
||||
}
|
||||
else if (SkillUtils.activationSuccessful(player, skill, Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
|
||||
playerInventory.removeItem(seed);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new GreenThumbTimerTask(blockState, getSkillLevel()), 0);
|
||||
if (!handleBlockState(blockState, greenTerra)) {
|
||||
return;
|
||||
}
|
||||
|
||||
playerInventory.removeItem(seed);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new HerbalismBlockUpdaterTask(blockState), 0);
|
||||
}
|
||||
|
||||
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
|
||||
switch (blockState.getType()) {
|
||||
case CROPS:
|
||||
case CARROT:
|
||||
case POTATO:
|
||||
if (greenTerra) {
|
||||
blockState.setRawData(CropState.MEDIUM.getData()); // 2
|
||||
}
|
||||
else {
|
||||
blockState.setRawData(getGreenThumbStage());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case NETHER_WARTS:
|
||||
if (greenTerra) {
|
||||
blockState.setRawData((byte) 2);
|
||||
}
|
||||
else {
|
||||
int greenThumbStage = getGreenThumbStage();
|
||||
|
||||
if (greenThumbStage > 2) {
|
||||
blockState.setRawData((byte) 2);
|
||||
}
|
||||
else if (greenThumbStage == 2) {
|
||||
blockState.setRawData((byte) 1);
|
||||
}
|
||||
else {
|
||||
blockState.setRawData((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case COCOA:
|
||||
CocoaPlant plant = (CocoaPlant) blockState.getData();
|
||||
|
||||
if (greenTerra || getGreenThumbStage() > 1) {
|
||||
plant.setSize(CocoaPlantSize.MEDIUM);
|
||||
}
|
||||
else {
|
||||
plant.setSize(CocoaPlantSize.SMALL);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private byte getGreenThumbStage() {
|
||||
return (byte) Math.min(Math.min(getProfile().getSkillLevel(skill), Herbalism.greenThumbStageMaxLevel) / Herbalism.greenThumbStageChangeLevel, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,6 @@ public class Mining {
|
||||
protected static void handleSilkTouchDrops(BlockState blockState) {
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, blockType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (blockType) {
|
||||
case ENDER_STONE:
|
||||
case GOLD_ORE:
|
||||
@@ -76,7 +72,7 @@ public class Mining {
|
||||
|
||||
default:
|
||||
if (ModUtils.isCustomMiningBlock(blockState)) {
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack());
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -89,13 +85,7 @@ public class Mining {
|
||||
*/
|
||||
protected static void handleMiningDrops(BlockState blockState) {
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, blockType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = blockState.getLocation();
|
||||
ItemStack dropItem;
|
||||
|
||||
switch (blockType) {
|
||||
case COAL_ORE:
|
||||
@@ -130,7 +120,7 @@ public class Mining {
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
|
||||
dropItem = customBlock.getItemDrop();
|
||||
ItemStack dropItem = customBlock.getItemDrop();
|
||||
|
||||
if (minimumDropAmount != maximumDropAmount) {
|
||||
Misc.dropItems(location, dropItem, minimumDropAmount);
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
@@ -30,47 +31,55 @@ public class MiningManager extends SkillManager{
|
||||
}
|
||||
|
||||
public boolean canUseDemolitionsExpertise() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return SkillUtils.unlockLevelReached(player, skill, BlastMining.Tier.FOUR.getLevel()) && Permissions.demolitionsExpertise(player);
|
||||
return getSkillLevel() >= BlastMining.Tier.FOUR.getLevel() && Permissions.demolitionsExpertise(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDetonate() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return player.isSneaking() && player.getItemInHand().getTypeId() == BlastMining.detonatorID && Permissions.remoteDetonation(player) && SkillUtils.unlockLevelReached(player, skill, BlastMining.Tier.ONE.getLevel());
|
||||
return canUseBlastMining() && player.isSneaking() && player.getItemInHand().getTypeId() == BlastMining.detonatorID && Permissions.remoteDetonation(player);
|
||||
}
|
||||
|
||||
public boolean canUseBlastMining() {
|
||||
return SkillUtils.unlockLevelReached(getPlayer(), skill, BlastMining.Tier.ONE.getLevel());
|
||||
return getSkillLevel() >= BlastMining.Tier.ONE.getLevel();
|
||||
}
|
||||
|
||||
public boolean canUseBiggerBombs() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return Permissions.biggerBombs(player) && SkillUtils.unlockLevelReached(getPlayer(), skill, BlastMining.Tier.TWO.getLevel());
|
||||
return getSkillLevel() >= BlastMining.Tier.TWO.getLevel() && Permissions.biggerBombs(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process double drops & XP gain for Mining.
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @param player The {@link Player} using this ability
|
||||
*/
|
||||
public void miningBlockCheck(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
int xp = Mining.getBlockXp(blockState);
|
||||
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(player, skill, Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
Mining.handleSilkTouchDrops(blockState);
|
||||
}
|
||||
else {
|
||||
Mining.handleMiningDrops(blockState);
|
||||
}
|
||||
applyXpGain(Mining.getBlockXp(blockState));
|
||||
|
||||
if (Permissions.doubleDrops(player, skill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
applyXpGain(xp);
|
||||
Material material = blockState.getType();
|
||||
|
||||
if (material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean silkTouch = player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
||||
|
||||
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
if (silkTouch) {
|
||||
Mining.handleSilkTouchDrops(blockState);
|
||||
}
|
||||
else {
|
||||
Mining.handleMiningDrops(blockState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +95,6 @@ public class MiningManager extends SkillManager{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = getProfile();
|
||||
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
|
||||
|
||||
SkillUtils.sendSkillMessage(player, AbilityType.BLAST_MINING.getAbilityPlayer(player));
|
||||
@@ -97,8 +105,8 @@ public class MiningManager extends SkillManager{
|
||||
targetBlock.setData((byte) 0x0);
|
||||
targetBlock.setType(Material.AIR);
|
||||
|
||||
profile.setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||
profile.setAbilityInformed(AbilityType.BLAST_MINING, false);
|
||||
getProfile().setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||
mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,11 +142,10 @@ public class MiningManager extends SkillManager{
|
||||
xp += Mining.getBlockXp(blockState);
|
||||
}
|
||||
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack()); // Initial block that would have been dropped
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1)); // Initial block that would have been dropped
|
||||
|
||||
if (!mcMMO.placeStore.isTrue(blockState)) {
|
||||
for (int i = 1; i < dropMultiplier; i++) {
|
||||
xp += Mining.getBlockXp(blockState);
|
||||
Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items
|
||||
}
|
||||
}
|
||||
@@ -148,7 +155,7 @@ public class MiningManager extends SkillManager{
|
||||
if (debrisYield > 0) {
|
||||
for (BlockState blockState : debris) {
|
||||
if (Misc.getRandom().nextFloat() < debrisYield) {
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack());
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +173,7 @@ public class MiningManager extends SkillManager{
|
||||
}
|
||||
|
||||
public int processDemolitionsExpertise(int damage) {
|
||||
return (int) (damage * (100.0 - getBlastDamageModifier()));
|
||||
return (int) (damage * ((100.0D - getBlastDamageModifier()) / 100.0D));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,29 +1,49 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
|
||||
public class Repair {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
protected enum Tier {
|
||||
FOUR(4) {
|
||||
@Override public int getLevel() { return AdvancedConfig.getInstance().getArcaneForgingRankLevels4(); }
|
||||
@Override public int getKeepEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank4(); }
|
||||
@Override public int getDowngradeEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank4(); }},
|
||||
THREE(3) {
|
||||
@Override public int getLevel() { return AdvancedConfig.getInstance().getArcaneForgingRankLevels3(); }
|
||||
@Override public int getKeepEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank3(); }
|
||||
@Override public int getDowngradeEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank3(); }},
|
||||
TWO(2) {
|
||||
@Override public int getLevel() { return AdvancedConfig.getInstance().getArcaneForgingRankLevels2(); }
|
||||
@Override public int getKeepEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank2(); }
|
||||
@Override public int getDowngradeEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank2(); }},
|
||||
ONE(1) {
|
||||
@Override public int getLevel() { return AdvancedConfig.getInstance().getArcaneForgingRankLevels1(); }
|
||||
@Override public int getKeepEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank1(); }
|
||||
@Override public int getDowngradeEnchantChance() { return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank1(); }};
|
||||
|
||||
int numerical;
|
||||
|
||||
private Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
abstract protected int getLevel();
|
||||
abstract protected int getKeepEnchantChance();
|
||||
abstract protected int getDowngradeEnchantChance();
|
||||
}
|
||||
|
||||
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
||||
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
||||
|
||||
@@ -33,248 +53,164 @@ public class Repair {
|
||||
public static boolean arcaneForgingDowngrades = AdvancedConfig.getInstance().getArcaneForgingDowngradeEnabled();
|
||||
public static boolean arcaneForgingEnchantLoss = AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled();
|
||||
|
||||
public static int anvilID = Config.getInstance().getRepairAnvilId();
|
||||
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
||||
|
||||
public static int salvageAnvilId = Config.getInstance().getSalvageAnvilId();
|
||||
public static int repairAnvilId = Config.getInstance().getRepairAnvilId();
|
||||
public static boolean anvilMessagesEnabled = Config.getInstance().getRepairAnvilMessagesEnabled();
|
||||
|
||||
/**
|
||||
* Get current Arcane Forging rank.
|
||||
* Checks if the item is salvageable.
|
||||
*
|
||||
* @param profile The PlayerProfile of the player to get the rank for
|
||||
* @return The player's current Arcane Forging rank
|
||||
* @param item Item to check
|
||||
* @return true if the item is salvageable, false otherwise
|
||||
*/
|
||||
public static int getArcaneForgingRank(PlayerProfile profile) {
|
||||
int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
if (skillLevel >= AdvancedConfig.getInstance().getArcaneForgingRankLevels4()) {
|
||||
return 4;
|
||||
public static boolean isSalvageable(ItemStack item) {
|
||||
if (Config.getInstance().getSalvageTools() && (ItemUtils.isMinecraftTool(item) || ItemUtils.isStringTool(item) || item.getType() == Material.BUCKET)) {
|
||||
return true;
|
||||
}
|
||||
else if (skillLevel >= AdvancedConfig.getInstance().getArcaneForgingRankLevels3()) {
|
||||
|
||||
if (Config.getInstance().getSalvageArmor() && ItemUtils.isMinecraftArmor(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the inventory for an item and return the index.
|
||||
*
|
||||
* @param inventory PlayerInventory to scan
|
||||
* @param itemId Item id to look for
|
||||
* @return index location where the item was found, or -1 if not found
|
||||
*/
|
||||
protected static int findInInventory(PlayerInventory inventory, int itemId) {
|
||||
int location = inventory.first(itemId);
|
||||
|
||||
// VALIDATE
|
||||
if (inventory.getItem(location).getTypeId() == itemId) {
|
||||
return location;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the inventory for an item and return the index.
|
||||
*
|
||||
* @param inventory PlayerInventory to scan
|
||||
* @param itemId Item id to look for
|
||||
* @param metadata Metadata to look for
|
||||
* @return index location where the item was found, or -1 if not found
|
||||
*/
|
||||
protected static int findInInventory(PlayerInventory inventory, int itemId, byte metadata) {
|
||||
int location = -1;
|
||||
|
||||
ItemStack[] contents = inventory.getContents();
|
||||
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
ItemStack item = contents[i];
|
||||
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getTypeId() == itemId && item.getData().getData() == metadata) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease the amount of items in this slot by one
|
||||
*
|
||||
* @param inventory PlayerInventory to work in
|
||||
* @param index Item index to decrement
|
||||
*/
|
||||
protected static void removeOneFrom(PlayerInventory inventory, int index) {
|
||||
ItemStack item = inventory.getItem(index).clone();
|
||||
item.setAmount(1);
|
||||
|
||||
inventory.removeItem(item);
|
||||
}
|
||||
|
||||
protected static String[] getSpoutAnvilMessages(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return new String[] {LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return new String[] {"[mcMMO] Anvil Placed", "Right click to salvage!"};
|
||||
}
|
||||
|
||||
return new String[] {"", ""};
|
||||
}
|
||||
|
||||
protected static String getAnvilMessage(int blockId) {
|
||||
if (blockId == repairAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil");
|
||||
}
|
||||
|
||||
if (blockId == salvageAnvilId) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
protected static Material getSalvagedItem(ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
}
|
||||
else if (ItemUtils.isWoodTool(inHand)) {
|
||||
return Material.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static int getSalvagedAmount(ItemStack inHand) {
|
||||
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) {
|
||||
return 3;
|
||||
}
|
||||
else if (skillLevel >= AdvancedConfig.getInstance().getArcaneForgingRankLevels2()) {
|
||||
else if (ItemUtils.isShovel(inHand) || inHand.getType() == Material.FLINT_AND_STEEL) {
|
||||
return 1;
|
||||
}
|
||||
else if (ItemUtils.isSword(inHand) || ItemUtils.isHoe(inHand) || inHand.getType() == Material.CARROT_STICK || inHand.getType() == Material.FISHING_ROD || inHand.getType() == Material.SHEARS) {
|
||||
return 2;
|
||||
}
|
||||
else if (skillLevel >= AdvancedConfig.getInstance().getArcaneForgingRankLevels1()) {
|
||||
return 1;
|
||||
else if (ItemUtils.isHelmet(inHand)) {
|
||||
return 5;
|
||||
}
|
||||
else if (ItemUtils.isChestplate(inHand)) {
|
||||
return 8;
|
||||
}
|
||||
else if (ItemUtils.isLeggings(inHand)) {
|
||||
return 7;
|
||||
}
|
||||
else if (ItemUtils.isBoots(inHand)) {
|
||||
return 4;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles removing & downgrading enchants.
|
||||
*
|
||||
* @param player Player repairing the item
|
||||
* @param is Item being repaired
|
||||
*/
|
||||
protected static void addEnchants(Player player, ItemStack is) {
|
||||
if (Permissions.arcaneBypass(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
return;
|
||||
}
|
||||
Map<Enchantment, Integer> enchants = is.getEnchantments();
|
||||
|
||||
if (enchants.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int rank = getArcaneForgingRank(UserManager.getPlayer(player).getProfile());
|
||||
|
||||
if (rank == 0 || !Permissions.arcaneForging(player)) {
|
||||
for (Enchantment x : enchants.keySet()) {
|
||||
is.removeEnchantment(x);
|
||||
}
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Lost"));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean downgraded = false;
|
||||
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
Enchantment enchantment = enchant.getKey();
|
||||
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.REPAIR);
|
||||
|
||||
if (Misc.getRandom().nextInt(activationChance) <= getEnchantChance(rank)) {
|
||||
int enchantLevel = enchant.getValue();
|
||||
|
||||
if (arcaneForgingDowngrades && enchantLevel > 1) {
|
||||
if (Misc.getRandom().nextInt(activationChance) < getDowngradeChance(rank)) {
|
||||
is.addEnchantment(enchantment, --enchantLevel);
|
||||
downgraded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
is.removeEnchantment(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> newEnchants = is.getEnchantments();
|
||||
|
||||
if (newEnchants.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Fail"));
|
||||
}
|
||||
else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Downgrade"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of keeping enchantment during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
public static int getEnchantChance(int rank) {
|
||||
switch (rank) {
|
||||
case 4:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank4();
|
||||
|
||||
case 3:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank3();
|
||||
|
||||
case 2:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank2();
|
||||
|
||||
case 1:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChanceRank1();
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @param rank Arcane Forging rank
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public static int getDowngradeChance(int rank) {
|
||||
switch (rank) {
|
||||
case 4:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank4();
|
||||
|
||||
case 3:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank3();
|
||||
|
||||
case 2:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank2();
|
||||
|
||||
case 1:
|
||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChanceRank1();
|
||||
|
||||
default:
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for Super Repair bonus.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
public static boolean checkPlayerProcRepair(Player player) {
|
||||
int skillLevel = UserManager.getPlayer(player).getProfile().getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
int chance = (int) ((superRepairMaxChance / superRepairMaxBonusLevel) * skillLevel);
|
||||
if (skillLevel >= superRepairMaxBonusLevel) {
|
||||
chance = (int) superRepairMaxChance;
|
||||
}
|
||||
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.REPAIR);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance) && Permissions.superRepair(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles notifications for placing an anvil.
|
||||
*
|
||||
* @param player The player placing the anvil
|
||||
* @param anvilID The item ID of the anvil block
|
||||
*/
|
||||
public static void placedAnvilCheck(Player player, int anvilID) {
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
if (!profile.getPlacedAnvil()) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||
spoutPlayer.sendNotification(LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2"), Material.getMaterial(anvilID));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil"));
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
profile.togglePlacedAnvil();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Xp gain for repair events.
|
||||
*
|
||||
* @param mcMMOPlayer Player repairing the item
|
||||
* @param durabilityBefore Durability of the item before repair
|
||||
* @param modify Amount to modify the durability by
|
||||
*/
|
||||
protected static void xpHandler(McMMOPlayer mcMMOPlayer, short durabilityBefore, short durabilityAfter, double modify) {
|
||||
short dif = (short) ((durabilityBefore - durabilityAfter) * modify);
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
mcMMOPlayer.beginXpGain(SkillType.REPAIR, dif * 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param player The player repairing an item
|
||||
* @param skillLevel the skillLevel of the player in Repair
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param repairAmount The base amount of durability repaired to the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
|
||||
float bonus;
|
||||
if (skillLevel >= repairMasteryMaxBonusLevel) {
|
||||
bonus = (float) (repairMasteryMaxBonus / 100F);
|
||||
}
|
||||
else {
|
||||
bonus = (((float) skillLevel) / ((float) repairMasteryMaxBonusLevel)) * (float) ((repairMasteryMaxBonus) / 100F);
|
||||
}
|
||||
|
||||
if (Permissions.repairMastery(player)) {
|
||||
bonus = repairAmount * bonus;
|
||||
repairAmount += (int) bonus;
|
||||
}
|
||||
|
||||
if (checkPlayerProcRepair(player)) {
|
||||
repairAmount = (int) (repairAmount * 2D);
|
||||
}
|
||||
|
||||
if (repairAmount <= 0 || repairAmount > 32767) {
|
||||
repairAmount = 32767;
|
||||
}
|
||||
|
||||
durability -= repairAmount;
|
||||
|
||||
if (durability < 0) {
|
||||
durability = 0;
|
||||
}
|
||||
|
||||
return durability;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,350 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair.Tier;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public interface RepairManager {
|
||||
/**
|
||||
* Register a repairable with the RepairManager
|
||||
*
|
||||
* @param repairable Repairable to register
|
||||
*/
|
||||
public void registerRepairable(Repairable repairable);
|
||||
public class RepairManager extends SkillManager {
|
||||
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.REPAIR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a list of repairables with the RepairManager
|
||||
* Handles notifications for placing an anvil.
|
||||
*
|
||||
* @param repairables List<Repairable> to register
|
||||
* @param anvilID The item ID of the anvil block
|
||||
*/
|
||||
public void registerRepairables(List<Repairable> repairables);
|
||||
public void placedAnvilCheck(int anvilId) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (mcMMOPlayer.getPlacedAnvil(anvilId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.spoutEnabled) {
|
||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||
String[] spoutMessages = Repair.getSpoutAnvilMessages(anvilId);
|
||||
spoutPlayer.sendNotification(spoutMessages[0], spoutMessages[1], Material.getMaterial(anvilId));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
mcMMOPlayer.togglePlacedAnvil(anvilId);
|
||||
}
|
||||
|
||||
public void handleRepair(ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
int itemId = item.getTypeId();
|
||||
|
||||
Repairable repairable = mcMMO.repairableManager.getRepairable(itemId);
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!repairable.getRepairItemType().getPermissions(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!repairable.getRepairMaterialType().getPermissions(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
int skillLevel = getSkillLevel();
|
||||
int minimumRepairableLevel = repairable.getMinimumLevel();
|
||||
|
||||
// Level check
|
||||
if (skillLevel < minimumRepairableLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.Adept", minimumRepairableLevel, StringUtils.getPrettyItemString(itemId)));
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
int repairMaterialId = repairable.getRepairMaterialId();
|
||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
if (!inventory.contains(repairMaterialId)) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterialId));
|
||||
|
||||
if (repairMaterialMetadata != (byte) -1) {
|
||||
// TODO: Do something nicer than append the metadata as a :# ?
|
||||
if (Repair.findInInventory(inventory, repairMaterialId, repairMaterialMetadata) == -1) {
|
||||
message += ":" + repairMaterialMetadata;
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
// Do not repair if at full durability
|
||||
if (startDurability <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not repair stacked items
|
||||
if (item.getAmount() != 1) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear ability buffs before trying to repair.
|
||||
SkillUtils.removeAbilityBuff(item);
|
||||
|
||||
// Lets get down to business,
|
||||
// To defeat, the huns.
|
||||
int baseRepairAmount = repairable.getBaseRepairDurability(); // Did they send me daughters?
|
||||
short newDurability = repairCalculate(startDurability, baseRepairAmount); // When I asked for sons?
|
||||
|
||||
// We're going to hold onto our repair item location
|
||||
int repairItemLocation;
|
||||
if (repairable.getRepairMaterialMetadata() == (byte) -1) {
|
||||
repairItemLocation = Repair.findInInventory(inventory, repairMaterialId);
|
||||
}
|
||||
else {
|
||||
// Special case for when the repairable has metadata that must be addressed
|
||||
repairItemLocation = Repair.findInInventory(inventory, repairMaterialId, repairMaterialMetadata);
|
||||
}
|
||||
|
||||
// This should never happen, but if it does we need to complain loudly about it.
|
||||
if (repairItemLocation == -1) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Error"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Call event
|
||||
McMMOPlayerRepairCheckEvent event = new McMMOPlayerRepairCheckEvent(player, (short) (startDurability - newDurability), inventory.getItem(repairItemLocation), item);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the enchants
|
||||
if (Repair.arcaneForgingEnchantLoss) {
|
||||
addEnchants(item);
|
||||
}
|
||||
|
||||
// Remove the item
|
||||
Repair.removeOneFrom(inventory, repairItemLocation);
|
||||
|
||||
// Give out XP like candy
|
||||
applyXpGain((int) ((startDurability - newDurability) * repairable.getXpMultiplier()) * 10);
|
||||
|
||||
// BWONG BWONG BWONG
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
|
||||
// Repair the item!
|
||||
item.setDurability(newDurability);
|
||||
}
|
||||
|
||||
public void handleSalvage(Location location, ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (player.getGameMode() != GameMode.SURVIVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getSkillLevel() < Repair.salvageUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getDurability() == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
location.setY(location.getY() + 1);
|
||||
|
||||
Misc.dropItems(location, new ItemStack(Repair.getSalvagedItem(item)), Repair.getSalvagedAmount(item) * item.getAmount());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
* Gets the Arcane Forging rank
|
||||
*
|
||||
* @param itemId id to check if repairable
|
||||
* @return true if repairable, false if not
|
||||
* @return the current Arcane Forging rank
|
||||
*/
|
||||
public boolean isRepairable(int itemId);
|
||||
public int getArcaneForgingRank() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
* Gets chance of keeping enchantment during repair.
|
||||
*
|
||||
* @param itemStack Item to check if repairable
|
||||
* @return true if repairable, false if not
|
||||
* @return The chance of keeping the enchantment
|
||||
*/
|
||||
public boolean isRepairable(ItemStack itemStack);
|
||||
public int getKeepEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getKeepEnchantChance();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the repairable with this id
|
||||
* Gets chance of enchantment being downgraded during repair.
|
||||
*
|
||||
* @param id Id of the repairable to look for
|
||||
* @return the repairable, can be null
|
||||
* @return The chance of the enchantment being downgraded
|
||||
*/
|
||||
public Repairable getRepairable(int id);
|
||||
public int getDowngradeEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getDowngradeEnchantChance();
|
||||
}
|
||||
}
|
||||
|
||||
return 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the repairing of this object
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param mcMMOPlayer Player that is repairing an item
|
||||
* @param item ItemStack that is being repaired
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param repairAmount The base amount of durability repaired to the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
public void handleRepair(McMMOPlayer mcMMOPlayer, ItemStack item);
|
||||
private short repairCalculate(short durability, int repairAmount) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (Permissions.repairMastery(player)) {
|
||||
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
|
||||
repairAmount += bonus;
|
||||
}
|
||||
|
||||
if (Permissions.superRepair(player) && checkPlayerProcRepair()) {
|
||||
repairAmount *= 2.0D;
|
||||
}
|
||||
|
||||
if (repairAmount <= 0 || repairAmount > Short.MAX_VALUE) {
|
||||
repairAmount = Short.MAX_VALUE;
|
||||
}
|
||||
|
||||
return (short) Math.max(durability - repairAmount, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for Super Repair bonus.
|
||||
*
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
private boolean checkPlayerProcRepair() {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Repair.superRepairMaxChance, Repair.superRepairMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles removing & downgrading enchants.
|
||||
*
|
||||
* @param item Item being repaired
|
||||
*/
|
||||
private void addEnchants(ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
|
||||
Map<Enchantment, Integer> enchants = item.getEnchantments();
|
||||
|
||||
if (enchants.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.arcaneBypass(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (getArcaneForgingRank() == 0 || !Permissions.arcaneForging(player)) {
|
||||
for (Enchantment enchant : enchants.keySet()) {
|
||||
item.removeEnchantment(enchant);
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Lost"));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean downgraded = false;
|
||||
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
Enchantment enchantment = enchant.getKey();
|
||||
|
||||
if (getKeepEnchantChance() > Misc.getRandom().nextInt(activationChance)) {
|
||||
int enchantLevel = enchant.getValue();
|
||||
|
||||
if (Repair.arcaneForgingDowngrades && enchantLevel > 1 && getDowngradeEnchantChance() > Misc.getRandom().nextInt(activationChance)) {
|
||||
item.addEnchantment(enchantment, enchantLevel - 1);
|
||||
downgraded = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
item.removeEnchantment(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> newEnchants = item.getEnchantments();
|
||||
|
||||
if (newEnchants.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Fail"));
|
||||
}
|
||||
else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Downgrade"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
public class RepairManagerFactory {
|
||||
public static RepairManager getRepairManager() {
|
||||
// TODO: Add in loading from config what type of manager we want.
|
||||
return new SimpleRepairManager();
|
||||
}
|
||||
|
||||
public static RepairManager getRepairManager(int repairablesSize) {
|
||||
// TODO: Add in loading from config what type of manager we want.
|
||||
return new SimpleRepairManager(repairablesSize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface RepairableManager {
|
||||
/**
|
||||
* Register a repairable with the RepairManager
|
||||
*
|
||||
* @param repairable Repairable to register
|
||||
*/
|
||||
public void registerRepairable(Repairable repairable);
|
||||
|
||||
/**
|
||||
* Register a list of repairables with the RepairManager
|
||||
*
|
||||
* @param repairables List<Repairable> to register
|
||||
*/
|
||||
public void registerRepairables(List<Repairable> repairables);
|
||||
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
*
|
||||
* @param itemId id to check if repairable
|
||||
* @return true if repairable, false if not
|
||||
*/
|
||||
public boolean isRepairable(int itemId);
|
||||
|
||||
/**
|
||||
* Checks if an item is repairable
|
||||
*
|
||||
* @param itemStack Item to check if repairable
|
||||
* @return true if repairable, false if not
|
||||
*/
|
||||
public boolean isRepairable(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Gets the repairable with this id
|
||||
*
|
||||
* @param id Id of the repairable to look for
|
||||
* @return the repairable, can be null
|
||||
*/
|
||||
public Repairable getRepairable(int id);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
public class RepairableManagerFactory {
|
||||
public static RepairableManager getRepairManager() {
|
||||
// TODO: Add in loading from config what type of manager we want.
|
||||
return new SimpleRepairableManager();
|
||||
}
|
||||
|
||||
public static RepairableManager getRepairManager(int repairablesSize) {
|
||||
// TODO: Add in loading from config what type of manager we want.
|
||||
return new SimpleRepairableManager(repairablesSize);
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class Salvage {
|
||||
public static int salvageUnlockLevel = Config.getInstance().getSalvageUnlockLevel();
|
||||
public static int anvilID = Config.getInstance().getSalvageAnvilId();
|
||||
|
||||
public static void handleSalvage(final Player player, final Location location, final ItemStack item) {
|
||||
if (!Config.getInstance().getSalvageEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getGameMode() == GameMode.SURVIVAL) {
|
||||
final int skillLevel = UserManager.getPlayer(player).getProfile().getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
if (skillLevel < salvageUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||
return;
|
||||
}
|
||||
|
||||
final float currentDurability = item.getDurability();
|
||||
|
||||
if (currentDurability == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
location.setY(location.getY() + 1);
|
||||
|
||||
Misc.dropItems(location, new ItemStack(getSalvagedItem(item)), getSalvagedAmount(item));
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles notifications for placing an anvil.
|
||||
*
|
||||
* @param player The player placing the anvil
|
||||
* @param anvilID The item ID of the anvil block
|
||||
*/
|
||||
public static void placedAnvilCheck(final Player player, final int anvilID) {
|
||||
final PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
if (!profile.getPlacedSalvageAnvil()) {
|
||||
if (mcMMO.spoutEnabled) {
|
||||
final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||
|
||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||
spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID));
|
||||
}
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2"));
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
profile.togglePlacedSalvageAnvil();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is salvageable.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return true if the item is salvageable, false otherwise
|
||||
*/
|
||||
public static boolean isSalvageable(final ItemStack is) {
|
||||
if (Config.getInstance().getSalvageTools() && (ItemUtils.isMinecraftTool(is) || ItemUtils.isStringTool(is) || is.getType() == Material.BUCKET)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getSalvageArmor() && ItemUtils.isMinecraftArmor(is)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Material getSalvagedItem(final ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
}
|
||||
else if (ItemUtils.isWoodTool(inHand)) {
|
||||
return Material.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static int getSalvagedAmount(final ItemStack inHand) {
|
||||
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) {
|
||||
return 3;
|
||||
}
|
||||
else if (ItemUtils.isShovel(inHand) || inHand.getType() == Material.FLINT_AND_STEEL) {
|
||||
return 1;
|
||||
}
|
||||
else if (ItemUtils.isSword(inHand) || ItemUtils.isHoe(inHand) || inHand.getType() == Material.CARROT_STICK || inHand.getType() == Material.FISHING_ROD || inHand.getType() == Material.SHEARS) {
|
||||
return 2;
|
||||
}
|
||||
else if (ItemUtils.isHelmet(inHand)) {
|
||||
return 5;
|
||||
}
|
||||
else if (ItemUtils.isChestplate(inHand)) {
|
||||
return 8;
|
||||
}
|
||||
else if (ItemUtils.isLeggings(inHand)) {
|
||||
return 7;
|
||||
}
|
||||
else if (ItemUtils.isBoots(inHand)) {
|
||||
return 4;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class SimpleRepairManager implements RepairManager {
|
||||
private HashMap<Integer, Repairable> repairables;
|
||||
|
||||
protected SimpleRepairManager() {
|
||||
this(55);
|
||||
}
|
||||
|
||||
protected SimpleRepairManager(int repairablesSize) {
|
||||
this.repairables = new HashMap<Integer, Repairable>(repairablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepairable(Repairable repairable) {
|
||||
Integer itemId = repairable.getItemId();
|
||||
repairables.put(itemId, repairable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepairables(List<Repairable> repairables) {
|
||||
for (Repairable repairable : repairables) {
|
||||
registerRepairable(repairable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(int itemId) {
|
||||
return repairables.containsKey(itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(ItemStack itemStack) {
|
||||
return isRepairable(itemStack.getTypeId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Repairable getRepairable(int id) {
|
||||
return repairables.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRepair(McMMOPlayer mcMMOPlayer, ItemStack item) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
Repairable repairable = repairables.get(item.getTypeId());
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!repairable.getRepairItemType().getPermissions(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!repairable.getRepairMaterialType().getPermissions(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
int skillLevel = mcMMOPlayer.getProfile().getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
// Level check
|
||||
if (skillLevel < repairable.getMinimumLevel()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.Adept", repairable.getMinimumLevel(), StringUtils.getPrettyItemString(item.getTypeId())));
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
if (!inventory.contains(repairable.getRepairMaterialId())) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairable.getRepairMaterialId()));
|
||||
if (repairable.getRepairMaterialMetadata() != (byte) -1) {
|
||||
// TODO: Do something nicer than append the metadata as a :# ?
|
||||
if (findInInventory(inventory, repairable.getRepairMaterialId(), repairable.getRepairMaterialMetadata()) == -1) {
|
||||
message += ":" + repairable.getRepairMaterialMetadata();
|
||||
}
|
||||
}
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
// Do not repair if at full durability
|
||||
if (startDurability <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not repair stacked items
|
||||
if (item.getAmount() != 1) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets get down to business,
|
||||
// To defeat, the huns.
|
||||
int baseRepairAmount = repairable.getBaseRepairDurability(); // Did they send me daughters?
|
||||
short newDurability = Repair.repairCalculate(player, skillLevel, startDurability, baseRepairAmount); // When I asked for sons?
|
||||
|
||||
// We're going to hold onto our repair item location
|
||||
int repairItemLocation;
|
||||
if (repairable.getRepairMaterialMetadata() == (byte) -1) {
|
||||
repairItemLocation = findInInventory(inventory, repairable.getRepairMaterialId());
|
||||
}
|
||||
else {
|
||||
// Special case for when the repairable has metadata that must be addressed
|
||||
repairItemLocation = findInInventory(inventory, repairable.getRepairMaterialId(), repairable.getRepairMaterialMetadata());
|
||||
}
|
||||
|
||||
// This should never happen, but if it does we need to complain loudly about it.
|
||||
if (repairItemLocation == -1) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Error"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Call event
|
||||
McMMOPlayerRepairCheckEvent event = new McMMOPlayerRepairCheckEvent(player, (short) (startDurability - newDurability), inventory.getItem(repairItemLocation), item);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the enchants
|
||||
if (AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled() && !Permissions.arcaneBypass(player)) {
|
||||
// Generalize away enchantment work
|
||||
Repair.addEnchants(player, item);
|
||||
}
|
||||
|
||||
// Remove the item
|
||||
removeOneFrom(inventory, repairItemLocation);
|
||||
|
||||
// Give out XP like candy
|
||||
Repair.xpHandler(mcMMOPlayer, startDurability, newDurability, repairable.getXpMultiplier());
|
||||
|
||||
// Repair the item!
|
||||
item.setDurability(newDurability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease the amount of items in this slot by one
|
||||
*
|
||||
* @param inventory PlayerInventory to work in
|
||||
* @param index Item index to decrement
|
||||
*/
|
||||
private void removeOneFrom(PlayerInventory inventory, int index) {
|
||||
ItemStack item = inventory.getItem(index).clone();
|
||||
item.setAmount(1);
|
||||
|
||||
inventory.removeItem(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the inventory for an item and return the index.
|
||||
*
|
||||
* @param inventory PlayerInventory to scan
|
||||
* @param itemId Item id to look for
|
||||
* @return index location where the item was found, or -1 if not found
|
||||
*/
|
||||
private int findInInventory(PlayerInventory inventory, int itemId) {
|
||||
int location = inventory.first(itemId);
|
||||
|
||||
// VALIDATE
|
||||
if (inventory.getItem(location).getTypeId() == itemId) {
|
||||
return location;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the inventory for an item and return the index.
|
||||
*
|
||||
* @param inventory PlayerInventory to scan
|
||||
* @param itemId Item id to look for
|
||||
* @param metadata Metadata to look for
|
||||
* @return index location where the item was found, or -1 if not found
|
||||
*/
|
||||
private int findInInventory(PlayerInventory inventory, int itemId, byte metadata) {
|
||||
int location = -1;
|
||||
|
||||
for (ItemStack item : inventory.getContents()) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getTypeId() == itemId && item.getData().getData() == metadata) {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SimpleRepairableManager implements RepairableManager {
|
||||
private HashMap<Integer, Repairable> repairables;
|
||||
|
||||
protected SimpleRepairableManager() {
|
||||
this(55);
|
||||
}
|
||||
|
||||
protected SimpleRepairableManager(int repairablesSize) {
|
||||
this.repairables = new HashMap<Integer, Repairable>(repairablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepairable(Repairable repairable) {
|
||||
Integer itemId = repairable.getItemId();
|
||||
repairables.put(itemId, repairable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRepairables(List<Repairable> repairables) {
|
||||
for (Repairable repairable : repairables) {
|
||||
registerRepairable(repairable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(int itemId) {
|
||||
return repairables.containsKey(itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable(ItemStack itemStack) {
|
||||
return isRepairable(itemStack.getTypeId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Repairable getRepairable(int id) {
|
||||
return repairables.get(id);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.smelting;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -16,7 +15,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.mining.Mining;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
@@ -27,16 +25,11 @@ public class SmeltingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseFluxMining(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
return BlockUtils.affectedByFluxMining(blockState) && ItemUtils.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH) && Permissions.fluxMining(player) && !mcMMO.placeStore.isTrue(blockState);
|
||||
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.fluxMining(getPlayer()) && !mcMMO.placeStore.isTrue(blockState);
|
||||
}
|
||||
|
||||
public boolean canUseVanillaXpBoost() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return SkillUtils.unlockLevelReached(player, skill, Smelting.Tier.ONE.getLevel()) && Permissions.vanillaXpBoost(player, skill);
|
||||
return getSkillLevel() >= Smelting.Tier.ONE.getLevel() && Permissions.vanillaXpBoost(getPlayer(), skill);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +41,7 @@ public class SmeltingManager extends SkillManager {
|
||||
public boolean processFluxMining(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (SkillUtils.unlockLevelReached(player, skill, Smelting.fluxMiningUnlockLevel) && SkillUtils.activationSuccessful(player, skill, Smelting.fluxMiningChance)) {
|
||||
if (Smelting.fluxMiningChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
ItemStack item = null;
|
||||
|
||||
switch (blockState.getType()) {
|
||||
@@ -72,7 +65,7 @@ public class SmeltingManager extends SkillManager {
|
||||
|
||||
Misc.dropItem(location, item);
|
||||
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(player, skill, Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
|
||||
@@ -101,7 +94,7 @@ public class SmeltingManager extends SkillManager {
|
||||
|
||||
applyXpGain(Smelting.getResourceXp(resourceType));
|
||||
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(player, skill, Smelting.secondSmeltMaxChance, Smelting.secondSmeltMaxLevel)) {
|
||||
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Smelting.secondSmeltMaxChance, Smelting.secondSmeltMaxLevel)) {
|
||||
ItemStack newResult = new ItemStack(result.getType(), result.getAmount() + 1);
|
||||
return newResult;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package com.gmail.nossr50.skills.swords;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
@@ -17,15 +21,29 @@ public class SwordsManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.SWORDS);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.SWORD) && Permissions.serratedStrikes(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseBleed() {
|
||||
return Permissions.bleed(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseCounterAttack(Entity target) {
|
||||
return target instanceof LivingEntity && Permissions.counterAttack(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseSerratedStrike() {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.SERRATED_STRIKES) && Permissions.serratedStrikes(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for Bleed effect.
|
||||
*
|
||||
* @param target The defending entity
|
||||
*/
|
||||
public void bleedCheck(LivingEntity target) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (SkillUtils.activationSuccessful(player, skill, Swords.bleedMaxChance, Swords.bleedMaxBonusLevel)) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.bleedMaxChance, Swords.bleedMaxBonusLevel)) {
|
||||
|
||||
if (getSkillLevel() >= Swords.bleedMaxBonusLevel) {
|
||||
BleedTimerTask.add(target, Swords.bleedMaxTicks);
|
||||
@@ -34,14 +52,14 @@ public class SwordsManager extends SkillManager {
|
||||
BleedTimerTask.add(target, Swords.bleedBaseTicks);
|
||||
}
|
||||
|
||||
if (getProfile().useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||
}
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
|
||||
}
|
||||
}
|
||||
@@ -49,7 +67,7 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public void counterAttackChecks(LivingEntity attacker, int damage) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
|
||||
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier);
|
||||
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class BeastLoreEventHandler {
|
||||
private Player player;
|
||||
private LivingEntity livingEntity;
|
||||
private Tameable beast;
|
||||
|
||||
protected BeastLoreEventHandler(Player player, LivingEntity livingEntity) {
|
||||
this.player = player;
|
||||
this.livingEntity = livingEntity;
|
||||
this.beast = (Tameable) livingEntity;
|
||||
}
|
||||
|
||||
protected void sendInspectMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
||||
if (beast.isTamed()) {
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", getOwnerName()) + " ");
|
||||
}
|
||||
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", livingEntity.getHealth(), livingEntity.getMaxHealth()));
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a tameable animal's owner.
|
||||
*
|
||||
* @return the name of the animal's owner
|
||||
*/
|
||||
private String getOwnerName() {
|
||||
AnimalTamer tamer = beast.getOwner();
|
||||
|
||||
if (tamer instanceof Player) {
|
||||
return ((Player) tamer).getName();
|
||||
}
|
||||
else if (tamer instanceof OfflinePlayer) {
|
||||
return ((OfflinePlayer) tamer).getName();
|
||||
}
|
||||
|
||||
return "Unknown Master";
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class CallOfTheWildEventHandler {
|
||||
protected Player player;
|
||||
protected ItemStack inHand;
|
||||
protected EntityType type;
|
||||
protected int summonAmount;
|
||||
|
||||
protected CallOfTheWildEventHandler(Player player, EntityType type, int summonAmount) {
|
||||
this.player = player;
|
||||
this.inHand = player.getItemInHand();
|
||||
this.type = type;
|
||||
this.summonAmount = summonAmount;
|
||||
}
|
||||
|
||||
protected void sendInsufficientAmountMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(inHand.getTypeId())));
|
||||
}
|
||||
|
||||
protected boolean nearbyEntityExists() {
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean entityExists = false;
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
||||
if (entity.getType() == type) {
|
||||
entityExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entityExists;
|
||||
}
|
||||
|
||||
protected void sendFailureMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Ocelot"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.Wolf"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnCreature() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
|
||||
}
|
||||
else {
|
||||
entity.setHealth(entity.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
protected void processResourceCost() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int newAmount = inHand.getAmount() - summonAmount;
|
||||
|
||||
if (newAmount == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
else {
|
||||
player.getItemInHand().setAmount(inHand.getAmount() - summonAmount);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendSuccessMessage() {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Wolf;
|
||||
|
||||
public class FastFoodServiceEventHandler {
|
||||
private Wolf wolf;
|
||||
|
||||
public FastFoodServiceEventHandler(Wolf wolf) {
|
||||
this.wolf = wolf;
|
||||
}
|
||||
|
||||
protected void modifyHealth(int damage) {
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
|
||||
if (health < maxHealth) {
|
||||
int newHealth = health + damage;
|
||||
|
||||
if (newHealth <= maxHealth) {
|
||||
wolf.setHealth(newHealth);
|
||||
}
|
||||
else {
|
||||
wolf.setHealth(maxHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class GoreEventHandler {
|
||||
private TamingManager manager;
|
||||
private EntityDamageEvent event;
|
||||
private Entity entity;
|
||||
protected int skillModifier;
|
||||
|
||||
protected GoreEventHandler(TamingManager manager, EntityDamageEvent event) {
|
||||
this.manager = manager;
|
||||
this.event = event;
|
||||
this.entity = event.getEntity();
|
||||
calculateSkillModifier();
|
||||
}
|
||||
|
||||
protected void calculateSkillModifier() {
|
||||
this.skillModifier = SkillUtils.skillCheck(manager.getSkillLevel(), Taming.goreMaxBonusLevel);
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() * Taming.goreModifier);
|
||||
}
|
||||
|
||||
protected void sendAbilityMessage() {
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
}
|
||||
|
||||
protected void applyBleed() {
|
||||
BleedTimerTask.add((LivingEntity) entity, Taming.goreBleedTicks);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class SharpenedClawsEventHandler {
|
||||
private EntityDamageEvent event;
|
||||
|
||||
public SharpenedClawsEventHandler(EntityDamageEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
protected void modifyEventDamage() {
|
||||
event.setDamage(event.getDamage() + Taming.sharpenedClawsBonusDamage);
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,26 @@ package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class Taming {
|
||||
public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock();
|
||||
public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock();
|
||||
|
||||
public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
|
||||
public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock();
|
||||
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
||||
|
||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
|
||||
public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
|
||||
public static int goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||
public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
|
||||
public static int goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
||||
public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
|
||||
|
||||
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
|
||||
public static int sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
||||
@@ -41,22 +39,6 @@ public class Taming {
|
||||
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
|
||||
}
|
||||
|
||||
public static boolean canUseThickFur(Player player) {
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, thickFurUnlockLevel) && Permissions.thickFur(player);
|
||||
}
|
||||
|
||||
public static boolean canUseEnvironmentallyAware(Player player) {
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, environmentallyAwareUnlockLevel) && Permissions.environmentallyAware(player);
|
||||
}
|
||||
|
||||
public static boolean canUseShockProof(Player player) {
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, shockProofUnlockLevel) && Permissions.shockProof(player);
|
||||
}
|
||||
|
||||
public static boolean canUseHolyHound(Player player) {
|
||||
return SkillUtils.unlockLevelReached(player, SkillType.TAMING, holyHoundUnlockLevel) && Permissions.holyHound(player);
|
||||
}
|
||||
|
||||
public static int processThickFur(Wolf wolf, int damage) {
|
||||
wolf.playEffect(EntityEffect.WOLF_SHAKE);
|
||||
return damage / thickFurModifier;
|
||||
@@ -67,24 +49,37 @@ public class Taming {
|
||||
wolf.setFireTicks(0);
|
||||
}
|
||||
|
||||
public static void processEnvironmentallyAware(Player player, Wolf wolf, int damage) {
|
||||
if (damage > wolf.getHealth()) {
|
||||
return;
|
||||
}
|
||||
|
||||
wolf.teleport(player);
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
||||
}
|
||||
|
||||
public static int processShockProof(Wolf wolf, int damage) {
|
||||
wolf.playEffect(EntityEffect.WOLF_SHAKE);
|
||||
return damage / shockProofModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Sharpened Claws ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static int sharpenedClaws(int damage) {
|
||||
return damage + Taming.sharpenedClawsBonusDamage;
|
||||
}
|
||||
|
||||
public static void processHolyHound(Wolf wolf, int damage) {
|
||||
int modifiedHealth = Math.min(wolf.getHealth() + damage, wolf.getMaxHealth());
|
||||
|
||||
wolf.setHealth(modifiedHealth);
|
||||
wolf.playEffect(EntityEffect.WOLF_HEARTS);
|
||||
}
|
||||
|
||||
protected static String getCallOfTheWildFailureMessage(EntityType type) {
|
||||
switch (type) {
|
||||
case OCELOT:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Ocelot");
|
||||
|
||||
case WOLF:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Wolf");
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class TamingManager extends SkillManager {
|
||||
@@ -19,6 +26,38 @@ public class TamingManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.TAMING);
|
||||
}
|
||||
|
||||
public boolean canUseThickFur() {
|
||||
return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.thickFur(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseEnvironmentallyAware() {
|
||||
return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.environmentallyAware(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseShockProof() {
|
||||
return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.shockProof(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseHolyHound() {
|
||||
return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.holyHound(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseFastFoodService() {
|
||||
return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.fastFoodService(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseSharpenedClaws() {
|
||||
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.sharpenedClaws(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseGore() {
|
||||
return Permissions.gore(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseBeastLore() {
|
||||
return Permissions.beastLore(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Award XP for taming.
|
||||
*
|
||||
@@ -46,7 +85,7 @@ public class TamingManager extends SkillManager {
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, int damage) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, Taming.fastFoodServiceActivationChance)) {
|
||||
if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
|
||||
int health = wolf.getHealth();
|
||||
int maxHealth = wolf.getMaxHealth();
|
||||
@@ -58,34 +97,24 @@ public class TamingManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Sharpened Claws ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void sharpenedClaws(EntityDamageEvent event) {
|
||||
SharpenedClawsEventHandler eventHandler = new SharpenedClawsEventHandler(event);
|
||||
eventHandler.modifyEventDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Gore ability.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void gore(EntityDamageEvent event) {
|
||||
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
|
||||
public int gore(LivingEntity target, int damage) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
|
||||
BleedTimerTask.add(target, Taming.goreBleedTicks);
|
||||
|
||||
float chance = (float) ((Taming.goreMaxChance / Taming.goreMaxBonusLevel) * getSkillLevel());
|
||||
if (chance > Taming.goreMaxChance) {
|
||||
chance = (float) Taming.goreMaxChance;
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
return damage * Taming.goreModifier;
|
||||
}
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.applyBleed();
|
||||
eventHandler.sendAbilityMessage();
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,11 +134,31 @@ public class TamingManager extends SkillManager {
|
||||
/**
|
||||
* Handle the Beast Lore ability.
|
||||
*
|
||||
* @param livingEntity The entity to examine
|
||||
* @param target The entity to examine
|
||||
*/
|
||||
public void beastLore(LivingEntity livingEntity) {
|
||||
BeastLoreEventHandler eventHandler = new BeastLoreEventHandler(mcMMOPlayer.getPlayer(), livingEntity);
|
||||
eventHandler.sendInspectMessage();
|
||||
public void beastLore(LivingEntity target) {
|
||||
Player player = getPlayer();
|
||||
Tameable beast = (Tameable) target;
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
||||
if (beast.isTamed()) {
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", beast.getOwner().getName()) + " ");
|
||||
}
|
||||
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
||||
public void processEnvironmentallyAware(Wolf wolf, int damage) {
|
||||
if (damage > wolf.getHealth()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player owner = getPlayer();
|
||||
|
||||
wolf.teleport(owner);
|
||||
owner.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,27 +168,36 @@ public class TamingManager extends SkillManager {
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
if (!Permissions.callOfTheWild(mcMMOPlayer.getPlayer())) {
|
||||
Player player = getPlayer();
|
||||
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
int heldItemAmount = heldItem.getAmount();
|
||||
|
||||
if (heldItemAmount < summonAmount) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(heldItem.getTypeId())));
|
||||
return;
|
||||
}
|
||||
|
||||
CallOfTheWildEventHandler eventHandler = new CallOfTheWildEventHandler(mcMMOPlayer.getPlayer(), type, summonAmount);
|
||||
|
||||
ItemStack inHand = eventHandler.inHand;
|
||||
int inHandAmount = inHand.getAmount();
|
||||
|
||||
if (inHandAmount < summonAmount) {
|
||||
eventHandler.sendInsufficientAmountMessage();
|
||||
return;
|
||||
for (Entity entity : player.getNearbyEntities(40, 40, 40)) {
|
||||
if (entity.getType() == type) {
|
||||
player.sendMessage(Taming.getCallOfTheWildFailureMessage(type));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (eventHandler.nearbyEntityExists()) {
|
||||
eventHandler.sendFailureMessage();
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
|
||||
}
|
||||
else {
|
||||
eventHandler.spawnCreature();
|
||||
eventHandler.processResourceCost();
|
||||
eventHandler.sendSuccessMessage();
|
||||
entity.setHealth(entity.getMaxHealth());
|
||||
}
|
||||
|
||||
player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.gmail.nossr50.skills.unarmed;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class Unarmed {
|
||||
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
||||
@@ -24,23 +19,4 @@ public class Unarmed {
|
||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||
|
||||
public static double berserkDamageModifier = 1.5;
|
||||
|
||||
public static boolean blockCracker(Player player, BlockState blockState) {
|
||||
if (SkillUtils.blockBreakSimulate(blockState.getBlock(), player, false)) {
|
||||
Material type = blockState.getType();
|
||||
|
||||
switch (type) {
|
||||
case SMOOTH_BRICK:
|
||||
if (blockCrackerSmoothBrick && blockState.getRawData() == (byte) 0x0) {
|
||||
blockState.setRawData((byte) 0x2);
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.gmail.nossr50.skills.unarmed;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
@@ -19,13 +23,54 @@ public class UnarmedManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.UNARMED);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && Permissions.berserk(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseIronArm() {
|
||||
return Permissions.bonusDamage(getPlayer(), skill);
|
||||
}
|
||||
|
||||
public boolean canUseBerserk() {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && Permissions.berserk(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDisarm(LivingEntity target) {
|
||||
return target instanceof Player && ((Player) target).getItemInHand().getType() != Material.AIR && Permissions.disarm(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDeflect() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player);
|
||||
}
|
||||
|
||||
public boolean canUseBlockCracker() {
|
||||
return Permissions.blockCracker(getPlayer());
|
||||
}
|
||||
|
||||
public boolean blockCrackerCheck(BlockState blockState) {
|
||||
Material type = blockState.getType();
|
||||
|
||||
switch (type) {
|
||||
case SMOOTH_BRICK:
|
||||
if (Unarmed.blockCrackerSmoothBrick && blockState.getRawData() == (byte) 0x0) {
|
||||
blockState.setRawData((byte) 0x2);
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for disarm.
|
||||
*
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public void disarmCheck(Player defender) {
|
||||
if (SkillUtils.activationSuccessful(getPlayer(), skill, Unarmed.disarmMaxChance, Unarmed.disarmMaxBonusLevel) && !hasIronGrip(defender)) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.disarmMaxChance, Unarmed.disarmMaxBonusLevel) && !hasIronGrip(defender)) {
|
||||
McMMOPlayerDisarmEvent disarmEvent = new McMMOPlayerDisarmEvent(defender);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(disarmEvent);
|
||||
|
||||
@@ -42,10 +87,8 @@ public class UnarmedManager extends SkillManager {
|
||||
* Check for arrow deflection.
|
||||
*/
|
||||
public boolean deflectCheck() {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (SkillUtils.activationSuccessful(player, skill, Unarmed.deflectMaxChance, Unarmed.deflectMaxBonusLevel)) {
|
||||
player.sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.deflectMaxChance, Unarmed.deflectMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
package com.gmail.nossr50.skills.woodcutting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Tree;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public final class TreeFeller {
|
||||
private static boolean treeFellerReachedThreshold = false;
|
||||
|
||||
private TreeFeller() {}
|
||||
|
||||
/**
|
||||
* Begins Tree Feller
|
||||
*
|
||||
* @param mcMMOPlayer Player using Tree Feller
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
protected static void processTreeFeller(BlockState blockState, Player player) {
|
||||
List<BlockState> treeFellerBlocks = new ArrayList<BlockState>();
|
||||
|
||||
if (blockState.getTypeId() == 17 || blockState.getTypeId() == 99) {
|
||||
processRegularTrees(blockState, treeFellerBlocks);
|
||||
}
|
||||
else {
|
||||
processRedMushroomTrees(blockState, treeFellerBlocks);
|
||||
}
|
||||
|
||||
// If the player is trying to break too many blocks
|
||||
if (treeFellerReachedThreshold) {
|
||||
treeFellerReachedThreshold = false;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFellerThreshold"));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the tool can't sustain the durability loss
|
||||
if (!handleDurabilityLoss(treeFellerBlocks, player.getItemInHand())) {
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter"));
|
||||
|
||||
int health = player.getHealth();
|
||||
|
||||
if (health > 1) {
|
||||
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(health - 1));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dropBlocks(treeFellerBlocks, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes Tree Feller for generic Trees
|
||||
*
|
||||
* @param blockState Block being checked
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
private static void processRegularTrees(BlockState blockState, List<BlockState> treeFellerBlocks) {
|
||||
if (!BlockUtils.isLog(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
||||
World world = blockState.getWorld();
|
||||
|
||||
// Handle the blocks around 'block'
|
||||
for (int y = 0; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
BlockState nextBlock = world.getBlockAt(blockState.getLocation().add(x, y, z)).getState();
|
||||
|
||||
handleBlock(nextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
|
||||
if (treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive call for each log found
|
||||
for (BlockState futureCenterBlock : futureCenterBlocks) {
|
||||
if (treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
|
||||
processRegularTrees(futureCenterBlock, treeFellerBlocks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes Tree Feller for Red Mushrooms (Dome Shaped)
|
||||
*
|
||||
* @param blockState Block being checked
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
private static void processRedMushroomTrees(BlockState blockState, List<BlockState> treeFellerBlocks) {
|
||||
if (!BlockUtils.isLog(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
||||
World world = blockState.getWorld();
|
||||
|
||||
// Handle the blocks around 'block'
|
||||
for (int y = 0; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
BlockState nextBlock = world.getBlockAt(blockState.getLocation().add(x, y, z)).getState();
|
||||
BlockState otherNextBlock = world.getBlockAt(blockState.getLocation().add(x, y - (y * 2), z)).getState();
|
||||
|
||||
handleBlock(nextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
handleBlock(otherNextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
|
||||
if (treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive call for each log found
|
||||
for (BlockState futureCenterBlock : futureCenterBlocks) {
|
||||
if (treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
|
||||
processRedMushroomTrees(futureCenterBlock, treeFellerBlocks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a block addition to the list of blocks to be removed and to the list of blocks used for future recursive calls of 'processRecursively()'
|
||||
*
|
||||
* @param blockState Block to be added
|
||||
* @param futureCenterBlocks List of blocks that will be used to call 'processRecursively()'
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
private static void handleBlock(BlockState blockState, List<BlockState> futureCenterBlocks, List<BlockState> treeFellerBlocks) {
|
||||
if (!BlockUtils.affectedByTreeFeller(blockState) || mcMMO.placeStore.isTrue(blockState) || treeFellerBlocks.contains(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
treeFellerBlocks.add(blockState);
|
||||
|
||||
if (treeFellerBlocks.size() > Config.getInstance().getTreeFellerThreshold()) {
|
||||
treeFellerReachedThreshold = true;
|
||||
return;
|
||||
}
|
||||
|
||||
futureCenterBlocks.add(blockState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the durability loss
|
||||
*
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
* @param inHand tool being used
|
||||
* @return True if the tool can sustain the durability loss
|
||||
*/
|
||||
private static boolean handleDurabilityLoss(List<BlockState> treeFellerBlocks, ItemStack inHand) {
|
||||
Material inHandMaterial = inHand.getType();
|
||||
|
||||
if (inHandMaterial != Material.AIR) {
|
||||
short durabilityLoss = 0;
|
||||
int unbreakingLevel = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
if (BlockUtils.isLog(blockState) && Misc.getRandom().nextInt(unbreakingLevel + 1) == 0) {
|
||||
durabilityLoss += Config.getInstance().getAbilityToolDamage();
|
||||
}
|
||||
}
|
||||
|
||||
short finalDurability = (short) (inHand.getDurability() + durabilityLoss);
|
||||
short maxDurability = ModUtils.isCustomTool(inHand) ? ModUtils.getToolFromItemStack(inHand).getDurability() : inHandMaterial.getMaxDurability();
|
||||
|
||||
if (finalDurability >= maxDurability) {
|
||||
inHand.setDurability(maxDurability);
|
||||
return false;
|
||||
}
|
||||
|
||||
inHand.setDurability(finalDurability);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the dropping of blocks
|
||||
*
|
||||
* @param treeFellerBlocks List of blocks to be dropped
|
||||
* @param player Player using the ability
|
||||
*/
|
||||
private static void dropBlocks(List<BlockState> treeFellerBlocks, Player player) {
|
||||
int xp = 0;
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
if (!SkillUtils.blockBreakSimulate(blockState.getBlock(), player, true)) {
|
||||
break; // TODO: Shouldn't we use continue instead?
|
||||
}
|
||||
|
||||
Material material = blockState.getType();
|
||||
|
||||
if (material == Material.HUGE_MUSHROOM_1 || material == Material.HUGE_MUSHROOM_2) {
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
|
||||
for (ItemStack drop : blockState.getBlock().getDrops()) {
|
||||
Misc.dropItem(blockState.getLocation(), drop);
|
||||
}
|
||||
}
|
||||
else if (ModUtils.isCustomLogBlock(blockState)) {
|
||||
Woodcutting.checkForDoubleDrop(player, blockState);
|
||||
|
||||
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
Location location = blockState.getLocation();
|
||||
ItemStack item = customBlock.getItemDrop();;
|
||||
|
||||
Misc.dropItems(location, item, minimumDropAmount);
|
||||
|
||||
if (minimumDropAmount < maximumDropAmount) {
|
||||
Misc.randomDropItems(location, item, maximumDropAmount - minimumDropAmount);
|
||||
}
|
||||
}
|
||||
else if (ModUtils.isCustomLeafBlock(blockState)) {
|
||||
Misc.randomDropItem(blockState.getLocation(), ModUtils.getCustomBlock(blockState).getItemDrop(), 10);
|
||||
}
|
||||
else {
|
||||
Tree tree = (Tree) blockState.getData();
|
||||
switch (material) {
|
||||
case LOG:
|
||||
Woodcutting.checkForDoubleDrop(player, blockState);
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
Misc.dropItem(blockState.getLocation(), new ItemStack(Material.LOG, 1, tree.getSpecies().getData()));
|
||||
break;
|
||||
|
||||
case LEAVES:
|
||||
Misc.randomDropItem(blockState.getLocation(), new ItemStack(Material.SAPLING, 1, tree.getSpecies().getData()), 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
blockState.setRawData((byte) 0x0);
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
}
|
||||
|
||||
UserManager.getPlayer(player).beginXpGain(SkillType.WOODCUTTING, xp);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.gmail.nossr50.skills.woodcutting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Tree;
|
||||
|
||||
@@ -12,18 +14,17 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public final class Woodcutting {
|
||||
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getWoodcuttingDoubleDropMaxLevel();
|
||||
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getWoodcuttingDoubleDropChance();
|
||||
|
||||
public static int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
|
||||
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
||||
|
||||
protected enum ExperienceGainMethod {
|
||||
DEFAULT,
|
||||
TREE_FELLER,
|
||||
@@ -31,47 +32,6 @@ public final class Woodcutting {
|
||||
|
||||
private Woodcutting() {}
|
||||
|
||||
/**
|
||||
* Begins the Tree Feller ability
|
||||
*
|
||||
* @param mcMMOPlayer Player using the ability
|
||||
* @param block Block being broken
|
||||
*/
|
||||
public static void beginTreeFeller(BlockState blockState, Player player) {
|
||||
TreeFeller.processTreeFeller(blockState, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins the Leaf Blower ability
|
||||
*
|
||||
* @param player Player using the ability
|
||||
* @param block Block being broken
|
||||
*/
|
||||
public static void beginLeafBlower(Player player, BlockState blockState) {
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(player));
|
||||
player.playSound(blockState.getLocation(), Sound.ITEM_PICKUP, Misc.POP_VOLUME, Misc.POP_PITCH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins Woodcutting
|
||||
*
|
||||
* @param mcMMOPlayer Player breaking the block
|
||||
* @param block Block being broken
|
||||
*/
|
||||
public static void beginWoodcutting(Player player, BlockState blockState) {
|
||||
int xp = getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||
|
||||
if (Permissions.doubleDrops(player, SkillType.WOODCUTTING)) {
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.HUGE_MUSHROOM_1 && blockType != Material.HUGE_MUSHROOM_2) {
|
||||
checkForDoubleDrop(player, blockState);
|
||||
}
|
||||
}
|
||||
|
||||
UserManager.getPlayer(player).beginXpGain(SkillType.WOODCUTTING, xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from a log
|
||||
*
|
||||
@@ -126,11 +86,7 @@ public final class Woodcutting {
|
||||
* @param mcMMOPlayer Player breaking the block
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
protected static void checkForDoubleDrop(Player player, BlockState blockState) {
|
||||
if (!SkillUtils.activationSuccessful(player, SkillType.WOODCUTTING, doubleDropsMaxChance, doubleDropsMaxLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected static void checkForDoubleDrop(BlockState blockState) {
|
||||
if (ModUtils.isCustomLogBlock(blockState)) {
|
||||
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
@@ -179,4 +135,129 @@ public final class Woodcutting {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes Tree Feller for generic Trees
|
||||
*
|
||||
* @param blockState Block being checked
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
protected static void processRegularTrees(BlockState blockState, List<BlockState> treeFellerBlocks) {
|
||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
||||
|
||||
// Handle the blocks around 'block'
|
||||
for (int y = 0; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
BlockState nextBlock = blockState.getBlock().getRelative(x, y, z).getState();
|
||||
handleBlock(nextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
|
||||
if (WoodcuttingManager.treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive call for each log found
|
||||
for (BlockState futureCenterBlock : futureCenterBlocks) {
|
||||
if (WoodcuttingManager.treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
|
||||
processRegularTrees(futureCenterBlock, treeFellerBlocks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes Tree Feller for Red Mushrooms (Dome Shaped)
|
||||
*
|
||||
* @param blockState Block being checked
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
protected static void processRedMushroomTrees(BlockState blockState, List<BlockState> treeFellerBlocks) {
|
||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
||||
|
||||
// Handle the blocks around 'block'
|
||||
for (int y = 0; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
BlockState nextBlock = blockState.getBlock().getRelative(x, y, z).getState();
|
||||
BlockState otherNextBlock = blockState.getBlock().getRelative(x, y - (y * 2), z).getState();
|
||||
|
||||
handleBlock(nextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
handleBlock(otherNextBlock, futureCenterBlocks, treeFellerBlocks);
|
||||
|
||||
if (WoodcuttingManager.treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive call for each log found
|
||||
for (BlockState futureCenterBlock : futureCenterBlocks) {
|
||||
if (WoodcuttingManager.treeFellerReachedThreshold) {
|
||||
return;
|
||||
}
|
||||
|
||||
processRedMushroomTrees(futureCenterBlock, treeFellerBlocks);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the durability loss
|
||||
*
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
* @param inHand tool being used
|
||||
* @return True if the tool can sustain the durability loss
|
||||
*/
|
||||
protected static boolean handleDurabilityLoss(List<BlockState> treeFellerBlocks, ItemStack inHand) {
|
||||
Material inHandMaterial = inHand.getType();
|
||||
|
||||
if (inHandMaterial == Material.AIR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
short durabilityLoss = 0;
|
||||
int unbreakingLevel = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
if (BlockUtils.isLog(blockState) && Misc.getRandom().nextInt(unbreakingLevel + 1) == 0) {
|
||||
durabilityLoss += Config.getInstance().getAbilityToolDamage();
|
||||
}
|
||||
}
|
||||
|
||||
short finalDurability = (short) (inHand.getDurability() + durabilityLoss);
|
||||
short maxDurability = ModUtils.isCustomTool(inHand) ? ModUtils.getToolFromItemStack(inHand).getDurability() : inHandMaterial.getMaxDurability();
|
||||
|
||||
if (finalDurability >= maxDurability) {
|
||||
return false;
|
||||
}
|
||||
|
||||
inHand.setDurability(finalDurability);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a block addition to the list of blocks to be removed and to the list of blocks used for future recursive calls of 'processRecursively()'
|
||||
*
|
||||
* @param blockState Block to be added
|
||||
* @param futureCenterBlocks List of blocks that will be used to call 'processRecursively()'
|
||||
* @param treeFellerBlocks List of blocks to be removed
|
||||
*/
|
||||
private static void handleBlock(BlockState blockState, List<BlockState> futureCenterBlocks, List<BlockState> treeFellerBlocks) {
|
||||
if (!BlockUtils.affectedByTreeFeller(blockState) || mcMMO.placeStore.isTrue(blockState) || treeFellerBlocks.contains(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
treeFellerBlocks.add(blockState);
|
||||
|
||||
if (treeFellerBlocks.size() > treeFellerThreshold) {
|
||||
WoodcuttingManager.treeFellerReachedThreshold = true;
|
||||
return;
|
||||
}
|
||||
|
||||
futureCenterBlocks.add(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
package com.gmail.nossr50.skills.woodcutting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Tree;
|
||||
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class WoodcuttingManager extends SkillManager {
|
||||
protected static boolean treeFellerReachedThreshold = false;
|
||||
|
||||
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
public boolean canUseLeafBlower(ItemStack heldItem) {
|
||||
return getSkillLevel() >= Woodcutting.leafBlowerUnlockLevel && ItemUtils.isAxe(heldItem);
|
||||
}
|
||||
|
||||
public boolean canUseTreeFeller(ItemStack heldItem) {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(getPlayer()) && ItemUtils.isAxe(heldItem);
|
||||
}
|
||||
|
||||
protected boolean canGetDoubleDrops() {
|
||||
return Permissions.doubleDrops(getPlayer(), skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Woodcutting.doubleDropsMaxChance, Woodcutting.doubleDropsMaxLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins Woodcutting
|
||||
*
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
public void woodcuttingBlockCheck(BlockState blockState) {
|
||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case HUGE_MUSHROOM_1:
|
||||
case HUGE_MUSHROOM_2:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
applyXpGain(xp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins Tree Feller
|
||||
*
|
||||
* @param blockState Block being broken
|
||||
*/
|
||||
public void processTreeFeller(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
List<BlockState> treeFellerBlocks = new ArrayList<BlockState>();
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case LOG:
|
||||
case HUGE_MUSHROOM_1:
|
||||
Woodcutting.processRegularTrees(blockState, treeFellerBlocks);
|
||||
break;
|
||||
|
||||
case HUGE_MUSHROOM_2:
|
||||
Woodcutting.processRedMushroomTrees(blockState, treeFellerBlocks);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ModUtils.isCustomLogBlock(blockState)) {
|
||||
Woodcutting.processRegularTrees(blockState, treeFellerBlocks);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If the player is trying to break too many blocks
|
||||
if (treeFellerReachedThreshold) {
|
||||
treeFellerReachedThreshold = false;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFellerThreshold"));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the tool can't sustain the durability loss
|
||||
if (!Woodcutting.handleDurabilityLoss(treeFellerBlocks, player.getItemInHand())) {
|
||||
player.sendMessage(LocaleLoader.getString("Woodcutting.Skills.TreeFeller.Splinter"));
|
||||
|
||||
int health = player.getHealth();
|
||||
|
||||
if (health > 1) {
|
||||
CombatUtils.dealDamage(player, Misc.getRandom().nextInt(health - 1));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dropBlocks(treeFellerBlocks);
|
||||
treeFellerReachedThreshold = false; // Reset the value after we're done with Tree Feller each time.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the dropping of blocks
|
||||
*
|
||||
* @param treeFellerBlocks List of blocks to be dropped
|
||||
* @param player Player using the ability
|
||||
*/
|
||||
private void dropBlocks(List<BlockState> treeFellerBlocks) {
|
||||
Player player = getPlayer();
|
||||
int xp = 0;
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
if (!SkillUtils.blockBreakSimulate(blockState.getBlock(), player, true)) {
|
||||
break; // TODO: Shouldn't we use continue instead?
|
||||
}
|
||||
|
||||
Material material = blockState.getType();
|
||||
|
||||
if (material == Material.HUGE_MUSHROOM_1 || material == Material.HUGE_MUSHROOM_2) {
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
|
||||
for (ItemStack drop : blockState.getBlock().getDrops()) {
|
||||
Misc.dropItem(blockState.getLocation(), drop);
|
||||
}
|
||||
}
|
||||
else if (ModUtils.isCustomLogBlock(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
|
||||
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
int minimumDropAmount = customBlock.getMinimumDropAmount();
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
Location location = blockState.getLocation();
|
||||
ItemStack item = customBlock.getItemDrop();;
|
||||
|
||||
Misc.dropItems(location, item, minimumDropAmount);
|
||||
|
||||
if (minimumDropAmount < maximumDropAmount) {
|
||||
Misc.randomDropItems(location, item, maximumDropAmount - minimumDropAmount);
|
||||
}
|
||||
}
|
||||
else if (ModUtils.isCustomLeafBlock(blockState)) {
|
||||
Misc.randomDropItem(blockState.getLocation(), ModUtils.getCustomBlock(blockState).getItemDrop(), 10);
|
||||
}
|
||||
else {
|
||||
Tree tree = (Tree) blockState.getData();
|
||||
switch (material) {
|
||||
case LOG:
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
Misc.dropItem(blockState.getLocation(), new ItemStack(Material.LOG, 1, tree.getSpecies().getData()));
|
||||
break;
|
||||
|
||||
case LEAVES:
|
||||
Misc.randomDropItem(blockState.getLocation(), new ItemStack(Material.SAPLING, 1, tree.getSpecies().getData()), 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
blockState.setRawData((byte) 0x0);
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
}
|
||||
|
||||
applyXpGain(xp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.metrics.MetricsManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -23,43 +28,75 @@ public final class ChimaeraWing {
|
||||
public static void activationCheck(Player player) {
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
|
||||
if (!Config.getInstance().getChimaeraEnabled() || inHand.getTypeId() != Config.getInstance().getChimaeraItemId()) {
|
||||
if (!Config.getInstance().getChimaeraEnabled() || !ItemUtils.isChimaeraWing(inHand)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
Block block = player.getLocation().getBlock();
|
||||
int amount = inHand.getAmount();
|
||||
long recentlyHurt = profile.getRecentlyHurt();
|
||||
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt();
|
||||
long lastChimaeraWing = (UserManager.getPlayer(player).getLastChimaeraTeleport());
|
||||
|
||||
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
||||
if (SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
|
||||
if (Permissions.chimaeraWing(player) && ItemUtils.isChimaeraWing(inHand)) {
|
||||
if (!SkillUtils.cooldownOver(lastChimaeraWing * Misc.TIME_CONVERSION_FACTOR, Config.getInstance().getChimaeraCooldown(), player)) {
|
||||
player.sendMessage(ChatColor.RED + "You need to wait before you can use this again! " + ChatColor.YELLOW + "(" + SkillUtils.calculateTimeLeft(lastChimaeraWing * Misc.TIME_CONVERSION_FACTOR, Config.getInstance().getChimaeraCooldown(), player) + ")"); //TODO Locale!
|
||||
return;
|
||||
}
|
||||
|
||||
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
||||
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
|
||||
return;
|
||||
if (SkillUtils.cooldownOver(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player) && amount >= Config.getInstance().getChimaeraUseCost()) {
|
||||
player.setItemInHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost())));
|
||||
|
||||
if (Config.getInstance().getChimaeraPreventUseUnderground()) {
|
||||
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
||||
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType() == Material.BED_BLOCK) {
|
||||
if (player.getBedSpawnLocation() != null) {
|
||||
player.teleport(player.getBedSpawnLocation());
|
||||
}
|
||||
else {
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
}
|
||||
|
||||
UserManager.getPlayer(player).actualizeLastChimaeraTeleport();
|
||||
MetricsManager.chimeraWingUsed();
|
||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
|
||||
}
|
||||
else if (!SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
else if (!SkillUtils.cooldownOver(recentlyHurt, 60 * Misc.TIME_CONVERSION_FACTOR, player) && amount >= Config.getInstance().getChimaeraUseCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt, 60, player)));
|
||||
}
|
||||
else if (amount <= Config.getInstance().getChimaeraCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Config.getInstance().getChimaeraItemId())));
|
||||
else if (amount <= Config.getInstance().getChimaeraUseCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", "Chimaera Wings")); //TODO Locale!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getChimaeraWing(int amount) {
|
||||
ItemStack itemStack = new ItemStack(Material.FEATHER, amount);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.GOLD + "Chimaera Wing"); //TODO Locale!
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
itemLore.add("mcMMO Item");
|
||||
itemLore.add(ChatColor.GRAY + "Teleports you to your bed."); //TODO Locale!
|
||||
itemMeta.setLore(itemLore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static ShapelessRecipe getChimaeraWingRecipe() {
|
||||
Material ingredient = Material.getMaterial(Config.getInstance().getChimaeraItemId());
|
||||
int amount = Config.getInstance().getChimaeraRecipeCost();
|
||||
if (amount > 9) {
|
||||
amount = 9;
|
||||
}
|
||||
|
||||
ShapelessRecipe ChimaeraWing = new ShapelessRecipe(getChimaeraWing(1));
|
||||
ChimaeraWing.addIngredient(amount, ingredient);
|
||||
return ChimaeraWing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
@@ -98,7 +97,7 @@ public final class HolidayManager {
|
||||
final int firework_amount = 10;
|
||||
for (int i = 0; i < firework_amount; i++) {
|
||||
int delay = (int) (Math.random() * 3) + 4;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
spawnFireworks((Player) sender);
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.api.SpoutToolsAPI;
|
||||
@@ -264,7 +268,7 @@ public class ItemUtils {
|
||||
* @return true if the item is armor, false otherwise
|
||||
*/
|
||||
public static boolean isMinecraftArmor(ItemStack is) {
|
||||
return isDiamondArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
|
||||
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,4 +648,32 @@ public class ItemUtils {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMcMMOItem(ItemStack is) {
|
||||
if (!is.hasItemMeta()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemMeta itemMeta = is.getItemMeta();
|
||||
if (itemMeta.hasLore()) {
|
||||
List<String> itemLore = itemMeta.getLore();
|
||||
if (itemLore.contains("mcMMO Item")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChimaeraWing(ItemStack is) {
|
||||
if (!isMcMMOItem(is)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemMeta itemMeta = is.getItemMeta();
|
||||
if (itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + "Chimaera Wing")) { //TODO Get localized name
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class Misc {
|
||||
* @return true if the distance between <code>first</code> and <code>second</code> is less than <code>maxDistance</code>, false otherwise
|
||||
*/
|
||||
public static boolean isNear(Location first, Location second, double maxDistance) {
|
||||
if (!first.getWorld().equals(second.getWorld())) {
|
||||
if (first.getWorld() != second.getWorld()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static CustomBlock getCustomBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customItems.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -88,7 +88,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -110,7 +110,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomAbilityBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -132,7 +132,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomMiningBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -154,7 +154,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomExcavationBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -176,7 +176,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomHerbalismBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -198,7 +198,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomLeafBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customLeaves.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -220,7 +220,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomLogBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customLogs.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
@@ -242,7 +242,7 @@ public final class ModUtils {
|
||||
*/
|
||||
public static boolean isCustomOreBlock(BlockState blockState) {
|
||||
if (customBlocksEnabled) {
|
||||
ItemStack item = blockState.getData().toItemStack();
|
||||
ItemStack item = blockState.getData().toItemStack(1);
|
||||
|
||||
if (CustomBlockConfig.getInstance().customOres.contains(item)) {
|
||||
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
|
||||
|
||||
@@ -231,8 +231,6 @@ public final class Permissions {
|
||||
for (World world : server.getWorlds()) {
|
||||
addDynamicPermission("mcmmo.commands.ptp.world." + world.getName(), PermissionDefault.OP, pluginManager);
|
||||
}
|
||||
|
||||
addDynamicPermission("mcmmo.commands.ptp.world.all", PermissionDefault.OP, pluginManager);
|
||||
}
|
||||
|
||||
private static void addDynamicPermission(String permissionName, PermissionDefault permissionDefault, PluginManager pluginManager) {
|
||||
|
||||
@@ -43,12 +43,18 @@ public class UpdateChecker {
|
||||
jo = (JSONObject) jo.get("versions");
|
||||
newVersion = (String) jo.get("version");
|
||||
|
||||
String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]");
|
||||
String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]");
|
||||
String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b");
|
||||
String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b");
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Integer newVer = Integer.parseInt(newTokens[i]);
|
||||
Integer oldVer = Integer.parseInt(oldTokens[i]);
|
||||
Integer oldVer;
|
||||
try {
|
||||
oldVer = Integer.parseInt(oldTokens[i]);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
oldVer = 0;
|
||||
}
|
||||
if (oldVer < newVer) {
|
||||
isr.close();
|
||||
return true;
|
||||
|
||||
@@ -11,10 +11,11 @@ import java.io.StreamCorruptedException;
|
||||
import java.io.UTFDataFormatException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class HashChunkletManager implements ChunkletManager {
|
||||
public HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
|
||||
|
||||
@@ -168,7 +169,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
|
||||
@Override
|
||||
public void saveAll() {
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (World world : mcMMO.p.getServer().getWorlds()) {
|
||||
saveWorld(world);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +177,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
@Override
|
||||
public void unloadAll() {
|
||||
saveAll();
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (World world : mcMMO.p.getServer().getWorlds()) {
|
||||
unloadWorld(world);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +277,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
for (String key : store.keySet()) {
|
||||
if (store.get(key).isEmpty()) {
|
||||
String[] info = key.split(",");
|
||||
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
|
||||
File dataDir = new File(mcMMO.p.getServer().getWorld(info[0]).getWorldFolder(), "mcmmo_data");
|
||||
|
||||
File cxDir = new File(dataDir, "" + info[1]);
|
||||
if (!cxDir.exists()) {
|
||||
|
||||
@@ -11,12 +11,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
|
||||
|
||||
public class HashChunkManager implements ChunkManager {
|
||||
@@ -283,7 +283,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
public synchronized void saveAll() {
|
||||
closeAll();
|
||||
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (World world : mcMMO.p.getServer().getWorlds()) {
|
||||
saveWorld(world);
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
public synchronized void unloadAll() {
|
||||
closeAll();
|
||||
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (World world : mcMMO.p.getServer().getWorlds()) {
|
||||
unloadWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public final class CommandRegistrationManager {
|
||||
public static void registerPtpCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("ptp");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
|
||||
command.setPermission("mcmmo.commands.ptp;mcmmo.commands.ptp.accept;mcmmo.commands.ptp.acceptall;mcmmo.commands.ptp.toggle");
|
||||
command.setPermission("mcmmo.commands.ptp"); // Only need the main one, not the individual ones for toggle/accept/acceptall
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "ptp", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
|
||||
|
||||
@@ -21,20 +21,21 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManagerStore;
|
||||
import com.gmail.nossr50.skills.axes.AxeManager;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||
import com.gmail.nossr50.skills.axes.AxesManager;
|
||||
import com.gmail.nossr50.skills.swords.Swords;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ModUtils;
|
||||
@@ -50,8 +51,6 @@ public final class CombatUtils {
|
||||
* @param event The event to run the combat checks on.
|
||||
*/
|
||||
public static void combatChecks(EntityDamageByEntityEvent event, Entity attacker, LivingEntity target) {
|
||||
boolean targetIsPlayer = (target.getType() == EntityType.PLAYER);
|
||||
boolean targetIsTamedPet = (target instanceof Tameable) ? ((Tameable) target).isTamed() : false;
|
||||
Entity damager = event.getDamager();
|
||||
|
||||
if (attacker instanceof Player && damager.getType() == EntityType.PLAYER) {
|
||||
@@ -61,121 +60,109 @@ public final class CombatUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target instanceof Tameable && isFriendlyPet(player, (Tameable) target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
Material heldItemType = heldItem.getType();
|
||||
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!SkillType.SWORDS.getPVPEnabled()) {
|
||||
if (target instanceof Tameable) {
|
||||
if (heldItem.getType() == Material.BONE) {
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
|
||||
if (tamingManager.canUseBeastLore()) {
|
||||
tamingManager.beastLore(target);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!SkillType.SWORDS.getPVEEnabled()) {
|
||||
|
||||
if (isFriendlyPet(player, (Tameable) target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
String playerName = player.getName();
|
||||
boolean canSerratedStrike = Permissions.serratedStrikes(player); // So we don't have to check the same permission twice
|
||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||
|
||||
if (profile.getToolPreparationMode(ToolType.SWORD) && canSerratedStrike) {
|
||||
SkillUtils.abilityCheck(player, SkillType.SWORDS);
|
||||
if (swordsManager.canActivateAbility()) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
|
||||
}
|
||||
|
||||
if (Permissions.bleed(player)) {
|
||||
SkillManagerStore.getInstance().getSwordsManager(playerName).bleedCheck(target);
|
||||
if (swordsManager.canUseBleed()) {
|
||||
swordsManager.bleedCheck(target);
|
||||
}
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.SERRATED_STRIKES) && canSerratedStrike) {
|
||||
SkillManagerStore.getInstance().getSwordsManager(playerName).serratedStrikes(target, event.getDamage());
|
||||
if (swordsManager.canUseSerratedStrike()) {
|
||||
swordsManager.serratedStrikes(target, event.getDamage());
|
||||
}
|
||||
|
||||
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
|
||||
}
|
||||
}
|
||||
else if (ItemUtils.isAxe(heldItem)) {
|
||||
if (((targetIsPlayer || targetIsTamedPet) && !SkillType.AXES.getPVPEnabled()) || (!targetIsPlayer && !targetIsTamedPet && !SkillType.AXES.getPVEEnabled())) {
|
||||
if (!shouldProcessSkill(target, SkillType.AXES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, SkillType.AXES)) {
|
||||
AxeManager axeManager = SkillManagerStore.getInstance().getAxeManager(player.getName());
|
||||
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
||||
|
||||
if (axeManager.canActivateAbility()) {
|
||||
SkillUtils.abilityCheck(player, SkillType.AXES);
|
||||
if (axesManager.canActivateAbility()) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
|
||||
}
|
||||
|
||||
if (axeManager.canUseAxeMastery()) {
|
||||
event.setDamage(axeManager.axeMasteryCheck(event.getDamage()));
|
||||
if (axesManager.canUseAxeMastery()) {
|
||||
event.setDamage(axesManager.axeMasteryCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (axeManager.canCriticalHit(target)) {
|
||||
event.setDamage(axeManager.criticalHitCheck(target, event.getDamage()));
|
||||
if (axesManager.canCriticalHit(target)) {
|
||||
event.setDamage(axesManager.criticalHitCheck(target, event.getDamage()));
|
||||
}
|
||||
|
||||
if (axeManager.canImpact(target)) {
|
||||
axeManager.impactCheck(target);
|
||||
if (axesManager.canImpact(target)) {
|
||||
axesManager.impactCheck(target);
|
||||
}
|
||||
else if (axeManager.canGreaterImpact(target)) {
|
||||
event.setDamage(axeManager.greaterImpactCheck(target, event.getDamage()));
|
||||
else if (axesManager.canGreaterImpact(target)) {
|
||||
event.setDamage(axesManager.greaterImpactCheck(target, event.getDamage()));
|
||||
}
|
||||
|
||||
if (axeManager.canUseSkullSplitter(target)) {
|
||||
axeManager.skullSplitterCheck(target, event.getDamage());
|
||||
if (axesManager.canUseSkullSplitter(target)) {
|
||||
axesManager.skullSplitterCheck(target, event.getDamage());
|
||||
}
|
||||
|
||||
startGainXp(axeManager.getMcMMOPlayer(), target, SkillType.AXES);
|
||||
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
||||
}
|
||||
}
|
||||
else if (heldItemType == Material.AIR) {
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!SkillType.UNARMED.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!SkillType.UNARMED.getPVEEnabled()) {
|
||||
else if (heldItem.getType() == Material.AIR) {
|
||||
if (!shouldProcessSkill(target, SkillType.UNARMED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
||||
String playerName = player.getName();
|
||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||
|
||||
boolean canBerserk = Permissions.berserk(player); // So we don't have to check the same permission twice
|
||||
|
||||
if (profile.getToolPreparationMode(ToolType.FISTS) && canBerserk) {
|
||||
SkillUtils.abilityCheck(player, SkillType.UNARMED);
|
||||
if (unarmedManager.canActivateAbility()) {
|
||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
||||
}
|
||||
|
||||
if (Permissions.bonusDamage(player, SkillType.UNARMED)) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getUnarmedManager(playerName).ironArmCheck(event.getDamage()));
|
||||
if (unarmedManager.canUseIronArm()) {
|
||||
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.BERSERK) && canBerserk) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getUnarmedManager(playerName).berserkDamage(event.getDamage()));
|
||||
if (unarmedManager.canUseBerserk()) {
|
||||
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
|
||||
}
|
||||
|
||||
if (target instanceof Player && Permissions.disarm(player)) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (defender.getItemInHand().getType() != Material.AIR) {
|
||||
SkillManagerStore.getInstance().getUnarmedManager(playerName).disarmCheck((Player) target);
|
||||
}
|
||||
if (unarmedManager.canDisarm(target)) {
|
||||
unarmedManager.disarmCheck((Player) target);
|
||||
}
|
||||
|
||||
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
else if (heldItemType == Material.BONE && target instanceof Tameable && Permissions.beastLore(player)) {
|
||||
SkillManagerStore.getInstance().getTamingManager(player.getName()).beastLore(target);
|
||||
}
|
||||
}
|
||||
|
||||
switch (damager.getType()) {
|
||||
@@ -189,29 +176,24 @@ public final class CombatUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!SkillType.TAMING.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!SkillType.TAMING.getPVEEnabled()) {
|
||||
if (!shouldProcessSkill(target, SkillType.TAMING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(master, SkillType.TAMING)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
||||
int skillLevel = SkillManagerStore.getInstance().getTamingManager(master.getName()).getSkillLevel();
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
|
||||
if (skillLevel >= Taming.fastFoodServiceUnlockLevel && Permissions.fastFoodService(master)) {
|
||||
SkillManagerStore.getInstance().getTamingManager(master.getName()).fastFoodService(wolf, event.getDamage());
|
||||
if (tamingManager.canUseFastFoodService()) {
|
||||
tamingManager.fastFoodService(wolf, event.getDamage());
|
||||
}
|
||||
|
||||
if (skillLevel >= Taming.sharpenedClawsUnlockLevel && Permissions.sharpenedClaws(master)) {
|
||||
SkillManagerStore.getInstance().getTamingManager(master.getName()).sharpenedClaws(event);
|
||||
if (tamingManager.canUseSharpenedClaws()) {
|
||||
event.setDamage(Taming.sharpenedClaws(event.getDamage()));
|
||||
}
|
||||
|
||||
if (Permissions.gore(master)) {
|
||||
SkillManagerStore.getInstance().getTamingManager(master.getName()).gore(event);
|
||||
if (tamingManager.canUseGore()) {
|
||||
event.setDamage(tamingManager.gore(target, event.getDamage()));
|
||||
}
|
||||
|
||||
startGainXp(mcMMOPlayer, target, SkillType.TAMING);
|
||||
@@ -228,85 +210,79 @@ public final class CombatUtils {
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
if (!SkillType.ARCHERY.getPVPEnabled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!SkillType.ARCHERY.getPVEEnabled()) {
|
||||
return;
|
||||
if (!shouldProcessSkill(target, SkillType.ARCHERY)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Player player = (Player) shooter;
|
||||
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(player, SkillType.ARCHERY)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||
|
||||
if (archeryManager.canSkillShot()) {
|
||||
event.setDamage(archeryManager.skillShotCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled()) {
|
||||
UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager();
|
||||
|
||||
if (unarmedManager.canDeflect()) {
|
||||
event.setCancelled(unarmedManager.deflectCheck());
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (archeryManager.canDaze(target)) {
|
||||
event.setDamage(archeryManager.dazeCheck((Player) target, event.getDamage()));
|
||||
}
|
||||
|
||||
if (archeryManager.canTrackArrows()) {
|
||||
archeryManager.trackArrows(target);
|
||||
}
|
||||
|
||||
archeryManager.distanceXpBonus(target);
|
||||
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
archeryCheck((Player) shooter, target, event);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetIsPlayer) {
|
||||
if (target instanceof Player) {
|
||||
Player player = (Player) target;
|
||||
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||
|
||||
if (SkillManagerStore.getInstance().getAcrobaticsManager(player.getName()).canDodge(damager)) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getAcrobaticsManager(player.getName()).dodgeCheck(event.getDamage()));
|
||||
if (acrobaticsManager.canDodge(damager)) {
|
||||
event.setDamage(acrobaticsManager.dodgeCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (damager instanceof Player) {
|
||||
if (SkillType.SWORDS.getPVPEnabled() && ItemUtils.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
SkillManagerStore.getInstance().getSwordsManager(player.getName()).counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (SkillType.SWORDS.getPVEEnabled() && damager instanceof LivingEntity && ItemUtils.isSword(heldItem) && Permissions.counterAttack(player)) {
|
||||
SkillManagerStore.getInstance().getSwordsManager(player.getName()).counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process archery abilities.
|
||||
*
|
||||
* @param shooter The player shooting
|
||||
* @param target The defending entity
|
||||
* @param event The event to run the archery checks on.
|
||||
*/
|
||||
private static void archeryCheck(Player shooter, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if (Misc.isNPCEntity(shooter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Permissions.skillEnabled(shooter, SkillType.ARCHERY)) {
|
||||
String playerName = shooter.getName();
|
||||
|
||||
if (SkillManagerStore.getInstance().getArcheryManager(playerName).canSkillShot()) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getArcheryManager(playerName).skillShotCheck(event.getDamage()));
|
||||
}
|
||||
|
||||
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled() && ((Player) target).getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect((Player) target)) {
|
||||
event.setCancelled(SkillManagerStore.getInstance().getUnarmedManager(((Player) target).getName()).deflectCheck());
|
||||
|
||||
if (event.isCancelled()) {
|
||||
if (ItemUtils.isSword(player.getItemInHand())) {
|
||||
if (!shouldProcessSkill(target, SkillType.SWORDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SkillManagerStore.getInstance().getArcheryManager(playerName).canDaze(target)) {
|
||||
event.setDamage(SkillManagerStore.getInstance().getArcheryManager(playerName).dazeCheck((Player) target, event.getDamage()));
|
||||
}
|
||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||
|
||||
if (SkillManagerStore.getInstance().getArcheryManager(playerName).canTrackArrows()) {
|
||||
SkillManagerStore.getInstance().getArcheryManager(playerName).trackArrows(target);
|
||||
if (swordsManager.canUseCounterAttack(damager)) {
|
||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
}
|
||||
|
||||
SkillManagerStore.getInstance().getArcheryManager(playerName).distanceXpBonus(target);
|
||||
startGainXp(UserManager.getPlayer(shooter), target, SkillType.ARCHERY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +413,7 @@ public final class CombatUtils {
|
||||
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (System.currentTimeMillis() >= UserManager.getPlayer(defender).getProfile().getRespawnATS() + 5) {
|
||||
if (System.currentTimeMillis() >= UserManager.getPlayer(defender).getRespawnATS() + 5) {
|
||||
baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP();
|
||||
}
|
||||
}
|
||||
@@ -525,7 +501,7 @@ public final class CombatUtils {
|
||||
if (entity instanceof Player) {
|
||||
Player defender = (Player) entity;
|
||||
|
||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getProfile().getGodMode()) {
|
||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -597,4 +573,17 @@ public final class CombatUtils {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean shouldProcessSkill(Entity target, SkillType skill) {
|
||||
boolean process;
|
||||
|
||||
if (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) {
|
||||
process = skill.getPVPEnabled();
|
||||
}
|
||||
else {
|
||||
process = skill.getPVEEnabled();
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
@@ -39,6 +40,8 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.spout.SpoutUtils;
|
||||
|
||||
public class SkillUtils {
|
||||
private static int enchantBuff = AdvancedConfig.getInstance().getEnchantBuff();
|
||||
|
||||
public static int handleFoodSkills(Player player, SkillType skill, int eventFoodLevel, int baseLevel, int maxLevel, int rankChange) {
|
||||
int skillLevel = UserManager.getPlayer(player).getProfile().getSkillLevel(skill);
|
||||
|
||||
@@ -87,17 +90,14 @@ public class SkillUtils {
|
||||
/**
|
||||
* Sends a message to the player when the cooldown expires.
|
||||
*
|
||||
* @param player The player to send a message to
|
||||
* @param profile The profile of the player
|
||||
* @param mcMMOPlayer The player to send a message to
|
||||
* @param ability The ability to watch cooldowns for
|
||||
*/
|
||||
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) {
|
||||
if (player == null || profile == null || ability == null) {
|
||||
return;
|
||||
}
|
||||
public static void watchCooldown(McMMOPlayer mcMMOPlayer, AbilityType ability) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
profile.setAbilityInformed(ability, true);
|
||||
if (!mcMMOPlayer.getAbilityInformed(ability) && cooldownOver(mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
mcMMOPlayer.setAbilityInformed(ability, true);
|
||||
player.sendMessage(ability.getAbilityRefresh());
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class SkillUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
AbilityType ability = skill.getAbility();
|
||||
ToolType tool = skill.getTool();
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
@@ -122,29 +122,26 @@ public class SkillUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if any abilities are active */
|
||||
if (profile == null) {
|
||||
if (!mcMMOPlayer.getAbilityUse()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!profile.getAbilityUse()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbilityType x : AbilityType.values()) {
|
||||
if (profile.getAbilityMode(x)) {
|
||||
for (AbilityType abilityType : AbilityType.values()) {
|
||||
if (mcMMOPlayer.getAbilityMode(abilityType)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
/*
|
||||
* Woodcutting & Axes need to be treated differently.
|
||||
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
|
||||
*/
|
||||
if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) {
|
||||
if (ability.getPermissions(player) && tool.inHand(inHand) && !mcMMOPlayer.getToolPreparationMode(tool)) {
|
||||
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
|
||||
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
if (!mcMMOPlayer.getAbilityMode(ability) && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -153,39 +150,36 @@ public class SkillUtils {
|
||||
player.sendMessage(tool.getRaiseTool());
|
||||
}
|
||||
|
||||
profile.setToolPreparationATS(tool, System.currentTimeMillis());
|
||||
profile.setToolPreparationMode(tool, true);
|
||||
mcMMOPlayer.setToolPreparationATS(tool, System.currentTimeMillis());
|
||||
mcMMOPlayer.setToolPreparationMode(tool, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitors various things relating to skill abilities.
|
||||
*
|
||||
* @param player The player using the skill
|
||||
* @param mcMMOPlayer The player using the skill
|
||||
* @param profile The profile of the player
|
||||
* @param curTime The current system time
|
||||
* @param skill The skill being monitored
|
||||
*/
|
||||
public static void monitorSkill(Player player, PlayerProfile profile, long curTime, SkillType skill) {
|
||||
public static void monitorSkill(McMMOPlayer mcMMOPlayer, long curTime, SkillType skill) {
|
||||
final int FOUR_SECONDS = 4000;
|
||||
|
||||
ToolType tool = skill.getTool();
|
||||
AbilityType ability = skill.getAbility();
|
||||
|
||||
if (profile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile.getToolPreparationMode(tool) && curTime - (profile.getToolPreparationATS(tool) * Misc.TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
|
||||
profile.setToolPreparationMode(tool, false);
|
||||
if (mcMMOPlayer.getToolPreparationMode(tool) && curTime - (mcMMOPlayer.getToolPreparationATS(tool) * Misc.TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
|
||||
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||
|
||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
||||
player.sendMessage(tool.getLowerTool());
|
||||
mcMMOPlayer.getPlayer().sendMessage(tool.getLowerTool());
|
||||
}
|
||||
}
|
||||
|
||||
AbilityType ability = skill.getAbility();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (ability.getPermissions(player)) {
|
||||
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||
if (mcMMOPlayer.getAbilityMode(ability) && (mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) {
|
||||
if (ability == AbilityType.BERSERK) {
|
||||
player.setCanPickupItems(true);
|
||||
}
|
||||
@@ -193,12 +187,12 @@ public class SkillUtils {
|
||||
handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
|
||||
profile.setAbilityMode(ability, false);
|
||||
profile.setAbilityInformed(ability, false);
|
||||
mcMMOPlayer.setAbilityMode(ability, false);
|
||||
mcMMOPlayer.setAbilityInformed(ability, false);
|
||||
|
||||
ParticleEffectUtils.playAbilityDisabledEffect(player);
|
||||
|
||||
if (profile.useChatNotifications()) {
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOff());
|
||||
}
|
||||
|
||||
@@ -219,9 +213,10 @@ public class SkillUtils {
|
||||
int xpRemoved = 0;
|
||||
|
||||
if (profile.getSkillXpLevel(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
while (profile.getSkillXpLevel(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
if ((skillType.getMaxLevel() >= profile.getSkillLevel(skillType) + 1) && (Config.getInstance().getPowerLevelCap() >= UserManager.getPlayer(player).getPowerLevel() + 1)) {
|
||||
if ((skillType.getMaxLevel() >= profile.getSkillLevel(skillType) + 1) && (Config.getInstance().getPowerLevelCap() >= mcMMOPlayer.getPowerLevel() + 1)) {
|
||||
int xp = profile.getXpToLevel(skillType);
|
||||
xpRemoved += xp;
|
||||
|
||||
@@ -368,40 +363,42 @@ public class SkillUtils {
|
||||
/**
|
||||
* Check to see if an ability can be activated.
|
||||
*
|
||||
* @param player The player activating the ability
|
||||
* @param mcMMOPlayer The player activating the ability
|
||||
* @param type The skill the ability is based on
|
||||
*/
|
||||
public static void abilityCheck(Player player, SkillType type) {
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
public static void abilityCheck(McMMOPlayer mcMMOPlayer, SkillType type) {
|
||||
ToolType tool = type.getTool();
|
||||
AbilityType ability = type.getAbility();
|
||||
|
||||
profile.setToolPreparationMode(tool, false);
|
||||
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
PlayerProfile playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
/*
|
||||
* Axes and Woodcutting are odd because they share the same tool.
|
||||
* We show them the too tired message when they take action.
|
||||
*/
|
||||
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
|
||||
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
if (!mcMMOPlayer.getAbilityMode(ability) && !cooldownOver(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.TooTired", calculateTimeLeft(playerProfile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
|
||||
if (!mcMMOPlayer.getAbilityMode(ability) && cooldownOver(playerProfile.getSkillDATS(ability), ability.getCooldown(), player)) {
|
||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (playerProfile.getSkillLevel(type) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
|
||||
|
||||
ParticleEffectUtils.playAbilityEnabledEffect(player);
|
||||
|
||||
if (profile.useChatNotifications()) {
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
}
|
||||
|
||||
SkillUtils.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
||||
|
||||
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
profile.setAbilityMode(ability, true);
|
||||
playerProfile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||
mcMMOPlayer.setAbilityMode(ability, true);
|
||||
|
||||
if (ability == AbilityType.BERSERK) {
|
||||
player.setCanPickupItems(false);
|
||||
@@ -462,22 +459,6 @@ public class SkillUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a skill level is higher than the max bonus level of the ability.
|
||||
*
|
||||
* @param skillLevel Skill level to check
|
||||
* @param maxLevel Max level of the ability
|
||||
* @return whichever value is lower
|
||||
*/
|
||||
public static int skillCheck(int skillLevel, int maxLevel) {
|
||||
// TODO: Could we just use Math.min(skillLevel, maxLevel) here?
|
||||
if (skillLevel > maxLevel) {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
return skillLevel;
|
||||
}
|
||||
|
||||
public static void handleAbilitySpeedIncrease(Player player) {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
@@ -495,7 +476,7 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
itemLore.add("mcMMO Ability Tool");
|
||||
itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel + 5, true);
|
||||
itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel + enchantBuff, true);
|
||||
|
||||
itemMeta.setLore(itemLore);
|
||||
heldItem.setItemMeta(itemMeta);
|
||||
@@ -514,14 +495,14 @@ public class SkillUtils {
|
||||
}
|
||||
}
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
int ticks = 0;
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
ticks = ((int) (profile.getSkillDATS(AbilityType.SUPER_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
if (mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.SUPER_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
}
|
||||
else if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
ticks = ((int) (profile.getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
else if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
ticks = ((int) (mcMMOPlayer.getProfile().getSkillDATS(AbilityType.GIGA_DRILL_BREAKER) - System.currentTimeMillis())) / Misc.TIME_CONVERSION_FACTOR;
|
||||
}
|
||||
|
||||
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
|
||||
@@ -561,11 +542,11 @@ public class SkillUtils {
|
||||
if (itemLore.remove("mcMMO Ability Tool")) {
|
||||
int efficiencyLevel = item.getEnchantmentLevel(Enchantment.DIG_SPEED);
|
||||
|
||||
if (efficiencyLevel <= 5) {
|
||||
if (efficiencyLevel <= enchantBuff) {
|
||||
itemMeta.removeEnchant(Enchantment.DIG_SPEED);
|
||||
}
|
||||
else {
|
||||
itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - 5, true);
|
||||
itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - enchantBuff, true);
|
||||
}
|
||||
|
||||
itemMeta.setLore(itemLore);
|
||||
@@ -614,12 +595,8 @@ public class SkillUtils {
|
||||
return chance > Misc.getRandom().nextInt(activationChance);
|
||||
}
|
||||
|
||||
public static boolean activationSuccessful(Player player, SkillType skill, double chance) {
|
||||
return chance > Misc.getRandom().nextInt(PerksUtils.handleLuckyPerks(player, skill));
|
||||
}
|
||||
|
||||
public static boolean unlockLevelReached(Player player, SkillType skill, int unlockLevel) {
|
||||
return UserManager.getPlayer(player).getProfile().getSkillLevel(skill) > unlockLevel;
|
||||
public static boolean activationSuccessful(int skillLevel, int activationChance, double maxChance, int maxLevel) {
|
||||
return ((maxChance / maxLevel) * Math.min(skillLevel, maxLevel)) > Misc.getRandom().nextInt(activationChance);
|
||||
}
|
||||
|
||||
public static boolean treasureDropSuccessful(double dropChance, int activationChance) {
|
||||
|
||||
@@ -16,6 +16,8 @@ Skills:
|
||||
General:
|
||||
# This setting will determine when the length of every ability gets longer with 1 second
|
||||
Ability_IncreaseLevel: 50
|
||||
# This setting determines how many enchant levels to use when buffing Super Breaker & Giga Drill Breaker
|
||||
Ability_EnchantBuff: 5
|
||||
#
|
||||
# Settings for Acrobatics
|
||||
###
|
||||
@@ -247,6 +249,9 @@ Skills:
|
||||
SuperRepair_ChanceMax: 100.0
|
||||
SuperRepair_MaxBonusLevel: 1000
|
||||
|
||||
# Salvage_UnlockLevel: Level when Salvage become available
|
||||
Salvage_UnlockLevel: 600
|
||||
|
||||
Arcane_Forging:
|
||||
May_Lose_Enchants: true
|
||||
Rank_Levels:
|
||||
|
||||
@@ -72,7 +72,10 @@ Mods:
|
||||
Items:
|
||||
Chimaera_Wing:
|
||||
Enabled: true
|
||||
Feather_Cost: 10
|
||||
Cooldown: 240
|
||||
Prevent_Use_Underground: true
|
||||
Use_Cost: 1
|
||||
Recipe_Cost: 5
|
||||
Item_ID: 288
|
||||
|
||||
#
|
||||
@@ -160,9 +163,7 @@ Skills:
|
||||
Level_Cap: 0
|
||||
Anvil_Messages: true
|
||||
Anvil_ID: 42
|
||||
Salvage_enabled: true
|
||||
Salvage_Anvil_ID: 41
|
||||
Salvage_UnlockLevel: 600
|
||||
Salvage_tools: true
|
||||
Salvage_armor: true
|
||||
Smelting:
|
||||
@@ -186,7 +187,6 @@ Skills:
|
||||
SmoothBrick_To_CrackedBrick: true
|
||||
Woodcutting:
|
||||
Level_Cap: 0
|
||||
Requires_Axe: true
|
||||
|
||||
#
|
||||
# Settings for Double Drops
|
||||
@@ -336,7 +336,7 @@ Experience:
|
||||
Wither: 7.0
|
||||
Witch: 4.0
|
||||
Iron_Golem: 2.0
|
||||
Wither_Skeleton: 4.0;
|
||||
Wither_Skeleton: 4.0
|
||||
#
|
||||
# Settings for commands
|
||||
###
|
||||
@@ -360,8 +360,11 @@ Commands:
|
||||
# Settings for particles
|
||||
###
|
||||
Particles:
|
||||
# These settings determine if fireworks should get launched when a player activates/deactivates an ability
|
||||
Ability_Activation: true
|
||||
Ability_Deactivation: true
|
||||
|
||||
# Use particle effect when these abilities trigger
|
||||
Dodge: true
|
||||
Bleed: true
|
||||
Greater_Impact: true
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#
|
||||
# Item Weights configuration
|
||||
#
|
||||
# This file is used to determine the value of an item. This will only
|
||||
# happen when users are sharing items in a party using the EQUAL item share mode.
|
||||
#
|
||||
# Rare items should have a higher value than common items. If an item is not listed
|
||||
# here, the value from "Default" will be used instead.
|
||||
#
|
||||
#####
|
||||
Item_Weights:
|
||||
Default: 5
|
||||
Emerald: 150
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=Vyssi ucinek
|
||||
Axes.Ability.Bonus.5=Zpusobi bonusove zraneni o velkosi {0} vsem neozbrojenym nepratelum
|
||||
Axes.Ability.Lower=[[GRAY]]**ODLOZIL JSI SVOU SEKERU**
|
||||
Axes.Ability.Ready=[[GREEN]]**P\u0158IPRAVUJE\u0160 SI SVOJ\u00cd SEKERU!**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]Zas\u00e1hnut ROZ\u0160T\u00cdPNUT\u00cdM!
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]Byl jsi KRITICKY zasazen!
|
||||
Axes.Combat.CritChance=[[RED]]Sance na kriticky uder: [[YELLOW]]{0}%
|
||||
Axes.Combat.CriticalHit=[[RED]]KRITICK\u00dd Z\u00c1SAH!
|
||||
@@ -73,13 +72,16 @@ Excavation.Skills.GigaDrillBreaker.Other.Off=[[RED]]Ni\u010ditel hl\u00edny[[GRE
|
||||
Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] pou\u017eil [[RED]]Giga Vrta\u010dku!
|
||||
Excavation.Skillup=[[YELLOW]]Dovednost v kopani byla navysena o {0}. Celkem ({1})
|
||||
Fishing.Ability.Info=[[RED]]Magick\u00fd lovec: [[GRAY]] **Zvy\u0161uje se s dovednost\u00ed Lovec poklad\u016f**
|
||||
Fishing.Ability.Locked.0=Uzam\u010deno do {0}+ schopnosti (Prot\u0159ep\u00e1n\u00ed)
|
||||
Fishing.Ability.Rank=[[RED]]Lovec Poklad\u016f Level: [[YELLOW]]{0}/5
|
||||
Fishing.Ability.FD=[[RED]]Ryb\u00e1\u0159\u016fv apetit: [[YELLOW]]Rank {0}
|
||||
Fishing.Effect.0=Lovec pokladu (pasivni)
|
||||
Fishing.Effect.1=Fish up misc. objects
|
||||
Fishing.Effect.2=Magicky Lovec
|
||||
Fishing.Effect.3=Na\u0161el si o\u010darovanou v\u011bc
|
||||
Fishing.Effect.4=Shake (vs. Entities)
|
||||
Fishing.Effect.5=Vyklepni p\u0159edm\u011bty z p\u0159\u00ed\u0161er s prutem
|
||||
Fishing.Effect.6=Ryb\u00e1\u0159\u016fv apetit
|
||||
Fishing.Enchant.Chance=[[RED]]\u0160ance na magick\u00e9ho lovce: [[YELLOW]]{0}
|
||||
Fishing.ItemFound=[[GRAY]]Nasel si poklad!
|
||||
Fishing.Listener=Rybareni:
|
||||
@@ -96,6 +98,7 @@ Herbalism.Ability.Ready=[[GREEN]]**PRIPRAVIL JSI SVOU MOTYKU**
|
||||
Herbalism.Effect.0=Green Terra (SCHOPNOST)
|
||||
Herbalism.Effect.1=\u0160\u00ed\u0159en\u00ed planety, 3x v\u00edce drop\u016f
|
||||
Herbalism.Effect.2=Zahradnik (Wheat)
|
||||
Herbalism.Effect.3=Automaticky sazi plodiny pri sklizeni
|
||||
Herbalism.Effect.4=Zahradn\u00edk (Cobble/Stone Brick/Dirt)
|
||||
Herbalism.Effect.5=Zar\u016fst cihly mechem, nebo nebo nechat vyr\u016fst tr\u00e1vu
|
||||
Herbalism.Effect.6=Farm\u00e1\u0159\u016fv apetit
|
||||
@@ -115,7 +118,7 @@ Mining.Ability.Lower=[[GRAY]]**SLOZIL SI SVUJ KRUMPAC**
|
||||
Mining.Ability.Ready=[[GREEN]]**KRUMPAC PRIPRAVEN**
|
||||
Mining.Effect.0=Super Breaker (SCHOPNOST)
|
||||
Mining.Effect.1=Rychlost+, sance na trojnasobny zisk
|
||||
Mining.Effect.2=Dvojnasobne zisky
|
||||
Mining.Effect.2=Dvojn\u00e1sobn\u00fd zisk
|
||||
Mining.Effect.3=Zdvojnasobi normalni zisk
|
||||
Mining.Effect.4=Tezeni vybuchem
|
||||
Mining.Effect.5=Bonusy za tezeni s TNT
|
||||
@@ -134,14 +137,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]M
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Schopnost [[YELLOW]]Super Breaker [[GREEN]]obnovena!
|
||||
Mining.Skillup=[[YELLOW]]Dovednost v dolovani byla navysena o {0}. Celkem ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**VYBUCH**
|
||||
Mining.Blast.Effect.0=+35% rud
|
||||
Mining.Blast.Effect.1=+40% rud
|
||||
Mining.Blast.Effect.2=+45% rud, bez suti
|
||||
Mining.Blast.Effect.3=+50% rud, bez suti
|
||||
Mining.Blast.Effect.4=+55% rud, bez suti, dvojit\u00e9 dropy
|
||||
Mining.Blast.Effect.5=+60% rud, bez suti, dvojit\u00e9 dropy
|
||||
Mining.Blast.Effect.6=+65% rud, bez suti, trojit\u00e9 dropy
|
||||
Mining.Blast.Effect.7=+70% rud, bez suti, trojit\u00e9 dropy
|
||||
Mining.Blast.Radius.Increase=[[RED]]Navyseni radiusu vybuchu: [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]V\u00fdbu\u0161n\u00e9 t\u011b\u017een\u00ed [[YELLOW]] Rank {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] pou\u017eil [[RED]]V\u00fdbu\u0161n\u00e9 T\u011b\u017een\u00ed!
|
||||
@@ -179,7 +174,7 @@ Repair.Skills.StackedItems=[[DARK_RED]]Nem\u016f\u017ee\u0161 opravovat nestacko
|
||||
Repair.Skills.Super.Chance=[[RED]]\u0160ance na superopravov\u00e1n\u00ed: [[YELLOW]]{0}
|
||||
Repair.Skillup=[[YELLOW]]Dovednost v opravovani byla navysena o {0}. Celkem ({1})
|
||||
Repair.Arcane.Chance.Downgrade=[[GRAY]]Sance na degradovani magicke sily predmetu: [[YELLOW]]{0}%
|
||||
Repair.Arcane.Chance.Success=[[GRAY]]Mira uspesnosti AF: [[YELLOW]]{0}%
|
||||
Repair.Arcane.Chance.Success=[[GRAY]]Pravd\u011bpodobnost \u00fasp\u011bchu AF: [[YELLOW]]{0}%
|
||||
Repair.Arcane.Downgrade=[[RED]]Magick\u00e1 s\u00edla tohoto p\u0159edm\u011btu zesl\u00e1bla.
|
||||
Repair.Arcane.Fail=[[RED]]Predmet ztratil navzdy svou magickou silu.
|
||||
Repair.Arcane.Lost=[[RED]]Nemel jsi dostatocnou dovednost pro zachovani ocarovani predmetu.
|
||||
@@ -217,6 +212,7 @@ Taming.Ability.Bonus.2=Husta srst
|
||||
Taming.Ability.Bonus.4=Otresuvzdorny
|
||||
Taming.Ability.Bonus.6=Nabrousene drapy
|
||||
Taming.Ability.Bonus.8=Rychl\u00e9 Ob\u010derstven\u00ed
|
||||
Taming.Ability.Bonus.9={0} \u0161ance na vyl\u00e9\u010den\u00ed p\u0159i \u00fatoku
|
||||
Taming.Combat.Chance.Gore=[[RED]]\u0160ance na nabodnut\u00ed: [[YELLOW]]{0}
|
||||
Taming.Effect.0=Tradice \u0161elem
|
||||
Taming.Effect.1=Na\u0159\u00edznut\u00ed kost\u00ed kontroluje vlky & oceloty
|
||||
@@ -293,9 +289,7 @@ Combat.ArrowDeflect=[[WHITE]]**SIP VYCHYLEN**
|
||||
Combat.BeastLore=[[GREEN]]**TRADICE SELEM**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Zivoty ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Vlastn\u00edk ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Byl jsi zasazen horicim sipem!
|
||||
Combat.Gore=[[GREEN]]**PRUNIK**
|
||||
Combat.Ignition=[[RED]]**VZPLANUTI**
|
||||
Combat.StruckByGore=[[RED]]**BYL JSI PROBODNUT**
|
||||
Combat.TargetDazed=C\u00edl byl [[DARK_RED]]Omr\u00e1\u010den
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Nejasne dotcen. Mas zavrat.
|
||||
@@ -314,6 +308,9 @@ Commands.Invite.Accepted=[[GREEN]]Pozvanka prijata. Pridal jsi se k party {0}
|
||||
Commands.Invite.Success=[[GREEN]]Pozv\u00e1nka \u00faspesne odesl\u00e1na.
|
||||
Commands.Leaderboards=<skill> <page> [[RED]]- Tabulka nejlep\u0161\u00edch
|
||||
Commands.mcgod=[[RED]]- Prepnout GodMod
|
||||
Commands.mchud.Invalid=Nespr\u00e1vn\u00fd typ HUD.
|
||||
Commands.mcrank.Heading=[[GOLD]]-=OSOBN\u00cd HODNOCEN\u00cd=-
|
||||
Commands.mctop.Tip=[[GOLD]]Tip: Pro osobn\u00ed statistiky pou\u017eij [[RED]]/mcrank[[GOLD]]!
|
||||
Commands.mmoedit=[player] <skill> <newvalue> [[RED]] - Modify target
|
||||
Commands.ModDescription=[[RED]]- Precti si strucny popis pluginu
|
||||
Commands.NoConsole=Tento prikaz nepodporuje pouziti z konzole.
|
||||
@@ -321,8 +318,10 @@ Commands.Other=[[GREEN]]--OSTATNI PRIKAZY--
|
||||
Commands.Party.Accept=[[RED]]- Potvrdit pozvanku do party
|
||||
Commands.Party.Chat.Off=Chat jenom pro partu [[RED]]Vypnuty
|
||||
Commands.Party.Chat.On=Party chat [[RED]]Off
|
||||
Commands.Party.Chat.Prefix=[[GREEN]]([[WHITE]]{0}[[GREEN]])
|
||||
Commands.Party.Commands=[[GREEN]]--P\u0158\u00cdKAZY PARTY--
|
||||
Commands.Party.Invite.0=[[RED]]VAROVANI: [[GREEN]]Obdrzel jsi pozvanku do party {0} od {1}
|
||||
Commands.Party.Rename=[[GRAY]]Jm\u00e9no party zm\u011bn\u011bno na: [[WHITE]]{0}
|
||||
Commands.Party.Kick=[[RED]]Byl jsi vyhozen z party {0}!
|
||||
Commands.Party.Leave=[[RED]]Opustil jsi party
|
||||
Commands.Party.None=[RED]]Nejsi v zadne party.
|
||||
@@ -332,12 +331,17 @@ Commands.Party.Toggle=[[RED]]- Zapnout party chat
|
||||
Commands.PowerLevel.Leaderboard=[[YELLOW]]--mcMMO[[BLUE]] Rebricek [[YELLOW]]Celkovych levelu--
|
||||
Commands.PowerLevel=[[DARK_RED]]CELKOVY LEVEL: [[GREEN]]{0}
|
||||
Commands.Reset.All=[[GREEN]] Vsechny vase dovednosti byli byli uspesne resetov\u00e1ny.
|
||||
Commands.Reset.Single=[[GREEN]] Vsechny vase dovednosti byly uspesne resetov\u00e1ny.
|
||||
Commands.Skill.Invalid=[[RED]]Neplatny nazev dovednosti!
|
||||
Commands.Skill.Leaderboard=[[YELLOW]]--mcMMO [[BLUE]]{0}[[YELLOW]] Tabulka nejlepsich--
|
||||
Commands.SkillInfo=/<skill> [[RED]]- Zjist\u00ed\u0161 bliz\u0161\u00ed informace o skillu
|
||||
Commands.Stats.Self=Tvoje statistiky
|
||||
Commands.Stats=[[RED]]- Shl\u00e9dnout svoje mcMMO statistiky
|
||||
Commands.ToggleAbility=[[RED]]- Aktivace schopnosti prav\u00fdm tla\u010d\u00edtkem.
|
||||
Commands.Usage.Message=zprava
|
||||
Commands.Usage.Page=stranka
|
||||
Commands.Usage.Password=heslo
|
||||
Commands.Usage.Player=hrac
|
||||
mcMMO.NoInvites=[[RED]]Momentalne nemas zadne pozvanky
|
||||
mcMMO.NoPermission=[[DARK_RED]]Nedostatecna prava
|
||||
mcMMO.NoSkillNote=[[DARK_GRAY]]Pokud nemas pristup k schopnosti, nebude zobrazena.
|
||||
@@ -349,9 +353,12 @@ Party.Locked=[[RED]]Parta je zamnuta, pouze velitel party t\u011b m\u016f\u017ee
|
||||
Party.NotInYourParty=[[DARK_RED]]{0} nen\u00ed ve tv\u00e9 part\u011b.
|
||||
Party.Password.Set=[[GREEN]]Heslo do party nastaveno na {0}
|
||||
Party.Player.Invalid=[[RED]]Tohle neni platny hrac.
|
||||
Party.NotOnline=[[DARK_RED]]{0} nen\u00ed online!
|
||||
Party.Player.InSameParty=[[RED]]{0} u\u017e je na va\u0161\u00ed party!
|
||||
Party.PlayerNotInParty=[[DARK_RED]]{0} nen\u00ed na party
|
||||
Party.Teleport.Dead=[[RED]]Nemuzes se teleportovat k mrtvemu hraci.
|
||||
Party.Teleport.Hurt=[[RED]]Byl jsi zasa\u017een p\u0159ed {0} sekundami a nem\u016f\u017ee\u0161 se teleportovat.
|
||||
Party.Teleport.Player=[[GREEN]]Byl jsi teleportovan k {0}.
|
||||
Party.Teleport.Self=[[RED]]Nem\u016f\u017ee\u0161 se teleportovat s\u00e1m na sebe!
|
||||
Party.Teleport.Target=[[GREEN]]{0} se k tobe teleportoval.
|
||||
Party.Unlocked=[[GRAY]]Party je odemknuta
|
||||
Commands.XPGain.Acrobatics=Padani
|
||||
@@ -380,8 +387,10 @@ Effects.Level=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{
|
||||
Effects.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1}
|
||||
Guides.Acrobatics=[[DARK_AQUA]]O akrobacii:\n[[YELLOW]]Akrobacie je um \u00fa\u017easn\u00e9ho pohybu v mcMMO.\n[[YELLOW]]D\u00e1v\u00e1 ti bonusy v boji a bonusy po\u0161kozen\u00ed v prost\u0159ed\u00ed.\n[[DARK_AQUA]]Zisk XP:\n[[YELLOW]]K z\u00edsk\u00e1n\u00ed XP v t\u00e9to dovednosti mus\u00ed\u0161 uhybat\n[[YELLOW]]p\u0159ed ranami nep\u0159\u00edtele, nebo p\u0159e\u017e\u00edvat p\u00e1dy.\n[[DARK_AQUA]]Jak fungujou kotrmelce?\n[[YELLOW]]M\u00e1\u0161 \u0161anci kdy\u017e pad\u00e1\u0161 zmen\u0161it \u0161kody, kter\u00e9\n[[YELLOW]]by ti zp\u016fsobily p\u00e1dy. Dr\u017e kl\u00e1vesu na skr\u010den\u00ed\n[[YELLOW]]p\u0159i p\u00e1du k v\u00fd\u0161en\u00ed \u0161ance na kotrmelec.\n[[YELLOW]]T\u00edm vznik\u00e1 P\u016fvabn\u00fd kotrmelec m\u00edsto standartn\u00edho.\n[[YELLOW]]P\u016fvabn\u00e9 kotrmelce jsou jako norm\u00e1ln\u00ed, ale m\u00e1\u0161 2x v\u011bt\u0161\u00ed \u0161anci\n[[YELLOW]]p\u0159e\u017e\u00edt p\u00e1d a jsou bezpe\u010dn\u011bj\u0161\u00ed ne\u017e norm\u00e1ln\u00ed\n[[YELLOW]]\u0160ance na kotrmelec jsou ovlivn\u011bny tv\u00fdmi dovednostmi\n[[DARK_AQUA]]Jak funguje \u00faskok?\n[[YELLOW]]\u00daskok je \u0161ance na rozp\u016flen\u00ed \u0161kod\n[[YELLOW]]kter\u00e9 by jsi z\u00edskal v boji.\n[[YELLOW]]Je ovlivn\u011bn tv\u00fdmi dovednostmi
|
||||
Guides.Axes=Pruvodce jiz brzy...
|
||||
Guides.Available=[[DARK_AQUA]]N\u00e1vod k {0} - napi\u0161te /{1} ? [page]
|
||||
Guides.Excavation=[[DARK_AQUA]]O kopani:\n[[YELLOW]]Kopani je cinnost vykonavana nicenim bloku hliny lopatou a nachazenim pokladu.\n[[YELLOW]]Nicenim bloku lopatou ziskavate sanci, ze naleznete poklady.\n[[YELLOW]]Cim dele tuhle cinnost provozujete, tim vic zvysujete svou sanci k naleznuti.\n[[DARK_AQUA]]Zisk dovednosti:\n[[YELLOW]]Pro zisk dovednosti v kopani musite nicit hlinene bloky lopatou.\n[[YELLOW]]Pro naleznuti pokladu muzou byt niceni jen nektere bloky.\n[[DARK_AQUA]]Seznam bloku se sanci pro nalezeni pokladu:\n[[YELLOW]]Trava, Hlina, Pisek, Jil, Sterk, Podhubi, Zvetrany pisek\n[[DARK_AQUA]]Jak pouzivat Giga Drill Breaker:\n[[YELLOW]]S lopatou v ruce a klikem pravym tlacidlem aktivujete svuj nastroj.\n[[YELLOW]]Once in this state you have about 4 seconds to make\n[[YELLOW]]contact with Excavation compatible materials this will\n[[YELLOW]]activate Giga Drill Breaker.\n[[DARK_AQUA]]What is Giga Drill Breaker?\n[[YELLOW]]Giga Drill Breaker is an ability with a cooldown\n[[YELLOW]]tied to Excavation skill. It triples your chance\n[[YELLOW]]of finding treasures and enables instant break\n[[YELLOW]]on Excavation materials.\n[[DARK_AQUA]]How does Treasure Hunter work?\n[[YELLOW]]Every possible treasure for Excavation has its own\n[[YELLOW]]skill level requirement for it to drop, as a result it\'s\n[[YELLOW]]difficult to say how much it is helping you.\n[[YELLOW]]Just keep in mind that the higher your Excavation skill\n[[YELLOW]]is, the more treasures that can be found.\n[[YELLOW]]And also keep in mind that each type of Excavation\n[[YELLOW]]compatible material has its own unique list of treasures.\n[[YELLOW]]In other words you will find different treasures in Dirt\n[[YELLOW]]than you would in Gravel.\n[[DARK_AQUA]]Notes about Excavation:\n[[YELLOW]]Excavation drops are completely customizeable\n[[YELLOW]]So results vary server to server.
|
||||
Guides.Mining=[[DARK_AQUA]]O Miningu:\n[[YELLOW]]Mining spo\u010d\u00edv\u00e1 v t\u011b\u017een\u00ed kamenu a rud. Poskytuje bonusy\n[[YELLOW]]v po\u010dtu materi\u00e1lu, kter\u00fd vyt\u011b\u017e\u00edte.\n\n[[DARK_AQUA]]Z\u00edskan\u00ed XP:\n[[YELLOW]]Aby jste dostali XP, mus\u00edte m\u00edt v ruce krump\u00e1\u010d.\n[[YELLOW]]XP v\u00e1m d\u00e1vaj\u00ed jenom jist\u00e9 bloky.\n\n[[DARK_AQUA]]Kompatibiln\u00ed materi\u00e1ly:\n[[YELLOW]]Stone, Coal Ore, Iron Ore, Gold Ore, Diamond Ore, Redstone Ore,\n[[YELLOW]]Lapis Ore, Obsidian, Mossy Cobblestone, Ender Stone,\n[[YELLOW]]Glowstone, a Netherrack.\n\n\n[[DARK_AQUA]]Jak pou\u017e\u00edt Super Breaker:\n[[YELLOW]]Dr\u017ete v ruce krump\u00e1\u010d a stisknete prav\u00e9 tla\u010ditko na my\u0161i.\n[[YELLOW]]Vr\u00e1mci \u010dty\u0159 sekund m\u00fa\u017eete buchnout do bloku, kter\u00fd je naps\u00e1n\n[[YELLOW]]v kompatibiln\u00edch materi\u00e1lech, kter\u00e9 aktivujou\n[[YELLOW]]Super Breaker.\n\n[[DARK_AQUA]]Co je to Super Breaker?\n[[YELLOW]]Super Breaker je schopnost, kter\u00e1 trv\u00e1 podle toho,\n[[YELLOW]]jak\u00fd m\u00e1te skill. Ztrojn\u00e1sobuje va\u0161i \u0161anci na z\u00edskan\u00ed extra v\u011bc\u00ed\n[[YELLOW]]a t\u011b\u017e\u00edte bloky na jednu r\u00e1nu.\n\n[[DARK_AQUA]]Jak pou\u017e\u00edt Blast Mining:\n[[YELLOW]]Kdy\u017e m\u00e1te v ruce odpalova\u010d, kter\u00fdm je flint and steel ve vychoz\u00edm nastaven\u00ed,\n[[YELLOW]]klikn\u011bte prav\u00fdm tla\u010ditkem na my\u0161i na TNT, a to zp\u016fsob\u00ed,\n[[YELLOW]]\u017ee hned bouchne.\n\n[[DARK_AQUA]]Jak funguje Blast Mining?\n[[YELLOW]]Blast Mining je schopnost, kter\u00e1 trv\u00e1 podle toho, jak\u00fd m\u00e1te\n[[YELLOW]]skill. D\u00e1va bonusy kdy\u017e t\u011b\u017e\u00edte pou\u017eit\u00edm TNT a umo\u017e\u0148uje v\u00e1m\n[[YELLOW]]d\u00e1lkov\u011b odp\u00e1lit TNT. Blast mining m\u00e1 3 \u010d\u00e1sti.\n[[YELLOW]]Prvn\u00ed \u010d\u00e1st je Bigger Bombs, kter\u00e1 zv\u011bt\u0161uje oblast v\u00fdbuchu.\n[[YELLOW]]Druh\u00e1 \u010d\u00e1st je Demolitions Expert, kter\u00e1 zvy\u0161uje po\u0161kozen\u00ed\n[[YELLOW]]v\u00fdbuchem TNT. T\u0159et\u00ed \u010d\u00e1st prost\u011b zvy\u0161uje mno\u017estvi rud, kter\u00e9\n[[YELLOW]]z\u00edsk\u00e1te z TNT a zni\u017euje su\u0165,\n[[YELLOW]]kter\u00e1 padne.
|
||||
Guides.Page.Invalid=Nespr\u00e1vn\u00e9 \u010d\u00edslo str\u00e1nky!
|
||||
Inspect.Offline=[[RED]]Nem\u00e1\u0161 pr\u00e1va kontrolovat hr\u00e1\u010de co nejsou online!
|
||||
Inspect.OfflineStats=mcMMO Statistiky pro offline hrace [[YELLOW]]{0}
|
||||
Inspect.Stats=[[GREEN]]mcMMO Statistiky pro [[YELLOW]]{0}
|
||||
@@ -401,3 +410,13 @@ Stats.Own.Stats=[[GREEN]][mcMMO] Statistiky
|
||||
Perks.xp.name=Zku\u0161enost
|
||||
Perks.xp.desc=Obdrzene {0}x Zkusenosti
|
||||
Perks.lucky.name=\u0160test\u00ed
|
||||
Perks.cooldowns.name=Rychle zotaveni
|
||||
Perks.activationtime.name=Vytrvalost
|
||||
Perks.activationtime.desc=Prodlu\u017euje pou\u017eit\u00ed schopnosti na {0} sekund.
|
||||
Vampirism.Killer.Success=[[GOLD]][mcMMO] [[DARK_AQUA]]Z\u00edskal jsi [[BLUE]]{0}[[DARK_AQUA]] level\u016f od [[YELLOW]]{1}.
|
||||
Spout.Donate=[[YELLOW]][mcMMO] P\u0159isp\u011bjte!
|
||||
Spout.Menu.HudButton.1=Typ HUD: {0}
|
||||
Spout.Menu.HudButton.2=Zm\u011b\u0148te si styl HUD!
|
||||
MOTD.Version=[[GOLD]][mcMMO] - verze [[DARK_AQUA]]{0}
|
||||
MOTD.Website=[[GOLD]][mcMMO] [[GREEN]]{0}[[YELLOW]] - Web mcMMO
|
||||
Commands.Description.mcremove=Odstranit u\u017eivatele z datab\u00e1ze mcMMO
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=Greater Impact
|
||||
Axes.Ability.Bonus.5=Deal {0} Bonus DMG to unarmored foes
|
||||
Axes.Ability.Lower=[[GRAY]]**YOU LOWER YOUR AXE**
|
||||
Axes.Ability.Ready=[[GREEN]]**YOU READY YOUR AXE**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]Struck by CLEAVE!
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]You were CRITICALLY hit!
|
||||
Axes.Combat.CritChance=[[RED]]Chance to critically strike: [[YELLOW]]{0}
|
||||
Axes.Combat.CriticalHit=[[RED]]CRITICAL HIT!
|
||||
@@ -146,14 +145,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]S
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]] Eich [[YELLOW]] Super Torri\'r [[GREEN]] gallu ei hadnewyddu!
|
||||
Mining.Skillup=[[YELLOW]] sgiliau Mwyngloddio cynyddu {0}. Cyfanswm ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**BOOM**
|
||||
Mining.Blast.Effect.0=+35% ore yield
|
||||
Mining.Blast.Effect.1=+40% ore yield
|
||||
Mining.Blast.Effect.2=+45% ore yield, no debris
|
||||
Mining.Blast.Effect.3=+50% ore yield, no debris
|
||||
Mining.Blast.Effect.4=+55% ore yield, no debris, double drops
|
||||
Mining.Blast.Effect.5=+60% ore yield, no debris, double drops
|
||||
Mining.Blast.Effect.6=+65% ore yield, no debris, triple drops
|
||||
Mining.Blast.Effect.7=+70% ore yield, no debris, triple drops
|
||||
Mining.Blast.Radius.Increase=[[RED]] Chwyth Cynnydd Radiws [[YELLOW]] {0}
|
||||
Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Blast Mining!
|
||||
@@ -321,9 +312,7 @@ Combat.ArrowDeflect=[[WHITE]]**ARROW DEFLECT**
|
||||
Combat.BeastLore=[[GREEN]] ** bwystfil ll\u00ean **
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]] Iechyd ([[GREEN]] {0} [[DARK_AQUA]] / {1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]You were struck by a burning arrow!
|
||||
Combat.Gore=[[GREEN]]**GORED**
|
||||
Combat.Ignition=[[RED]]**IGNITION**
|
||||
Combat.StruckByGore=[[RED]]**YOU HAVE BEEN GORED**
|
||||
Combat.TargetDazed=Target was [[DARK_RED]]Dazed
|
||||
Combat.TouchedFuzzy=[[DARK_RED]] cyffwrdd Fuzzy. Teimlo benysgafn.
|
||||
@@ -416,7 +405,6 @@ Party.Password.Incorrect=[[RED]]Party password is incorrect.
|
||||
Party.Password.Set=[[GREEN]] Blaid cyfrinair wedi ei osod i {0}
|
||||
Party.Player.Invalid=[[RED]] Nid yw hynny\'n chwaraewr ddilys.
|
||||
Party.Teleport.Dead=[[RED]] Ni allwch teleport y chwaraewr yn farw.
|
||||
Party.Teleport.Hurt=[[RED]]You\'ve been hurt in the last {0} seconds and cannnot teleport.
|
||||
Party.Teleport.Player=[[GREEN]]You have teleported to {0}.
|
||||
Party.Teleport.Self=[[RED]]You can\'t teleport to yourself!
|
||||
Party.Teleport.Target=[[GREEN]] {0} wedi teleported i chi.
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=St\u00f8rre Slag
|
||||
Axes.Ability.Bonus.5=P\u00e5f\u00f8r {0} Bonus Skade til ubev\u00e6bnede fjender
|
||||
Axes.Ability.Lower=[[GRAY]]**DU S\u00c6NKER DIN \u00d8KSE**
|
||||
Axes.Ability.Ready=[[GREEN]]**DU G\u00d8R DIN \u00d8KSE KLAR**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]Du bliver hugget midt over!
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]Du er blevet KRITISK ramt!
|
||||
Axes.Combat.CritChance=[[RED]]Chance for at ramme kritisk: [[YELLOW]]{0}
|
||||
Axes.Combat.CriticalHit=[[RED]]KRITISK SLAG!
|
||||
@@ -146,14 +145,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] har brugt [[RED]]
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Din [[YELLOW]]Super Smadrer [[GREEN]]evne er genindl\u00e6st!
|
||||
Mining.Skillup=[[YELLOW]]Minedriftsevne for\u00f8get med {0}. Total ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**BOOM**
|
||||
Mining.Blast.Effect.0=35% malm udbytte
|
||||
Mining.Blast.Effect.1=40% malm udbytte
|
||||
Mining.Blast.Effect.2=45% malm udbytte, ingen byggeaffald
|
||||
Mining.Blast.Effect.3=50% malm udbytte, ingen byggeaffald
|
||||
Mining.Blast.Effect.4=+55% malm udbytte, ingen byggeaffald, 2x udbytte
|
||||
Mining.Blast.Effect.5=+60% malm udbytte, ingen byggeaffald, 2x udbytte
|
||||
Mining.Blast.Effect.6=+65% malm udbytte, ingen byggeaffald, 3x udbytte
|
||||
Mining.Blast.Effect.7=+70% malm udbytte, ingen byggeaffald, 3x udbytte
|
||||
Mining.Blast.Radius.Increase=[[RED]]Eksplosions Radius For\u00f8gelse: [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]Blast Mining: [[YELLOW]] Rank {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] her brugt [[RED]]Blast Mining!
|
||||
@@ -320,9 +311,7 @@ Combat.ArrowDeflect=[[WHITE]]**UNDVIGER PIL**
|
||||
Combat.BeastLore=[[GREEN]]**TIGGENDE MONSTER**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Liv ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Ejer ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Du er blevet ramt af en brandene pil!
|
||||
Combat.Gore=[[GREEN]]**SPIDDET**
|
||||
Combat.Ignition=[[RED]]**ANT\u00c6NDING**
|
||||
Combat.StruckByGore=[[RED]]**DU ER BLEVET SPIDDET**
|
||||
Combat.TargetDazed=M\u00e5let er nu [[DARK_RED]]Bed\u00f8vet
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]R\u00f8rte Plysse. F\u00f8lte mig svimmel.
|
||||
@@ -417,7 +406,6 @@ Party.Password.Incorrect=[[RED]]Gruppe kodeord er forkert.
|
||||
Party.Password.Set=[[GREEN]]Gruppe adgangskode sat til {0}
|
||||
Party.Player.Invalid=[[RED]]Dette er ikke en rigtig spiller.
|
||||
Party.Teleport.Dead=[[RED]]Du kan ikke teleportere til en d\u00f8d spiller.
|
||||
Party.Teleport.Hurt=[[RED]]Du er blevet skadet infenfor de sidste {0} sekunder og kan ikke teleportere.
|
||||
Party.Teleport.Player=[[GREEN]]Du har teleporteret til {0}.
|
||||
Party.Teleport.Self=[[RED]]Du kan ikke teleportere dig selv!
|
||||
Party.Teleport.Target=[[GREEN]]{0} har teleporteret til dig.
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=Wucht-Schlag
|
||||
Axes.Ability.Bonus.5=Veraursacht {0} Zusatz-Schaden gegen ungepanzerte Feinde
|
||||
Axes.Ability.Lower=[[GRAY]]**Du senkst deine Axt**
|
||||
Axes.Ability.Ready=[[GREEN]]**Deine Axt ist bereit**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]AUSGESCHALTET durch SCHLITZER!
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]Du wurdest KRITISCH getroffen!
|
||||
Axes.Combat.CritChance=[[RED]]Chance auf kritischen Treffer: [[YELLOW]]{0}
|
||||
Axes.Combat.CriticalHit=[[RED]]KRITISCHER TREFFER!
|
||||
@@ -151,14 +150,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] benutzte [[RED]]S
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Dein [[YELLOW]]Super-Brecher [[GREEN]]ist wieder bereit!
|
||||
Mining.Skillup=[[YELLOW]]Bergbau Fertigkeit ist um {0} gestiegen. Gesamt ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**BOOM**
|
||||
Mining.Blast.Effect.0=+35% Erz-Ausbeute
|
||||
Mining.Blast.Effect.1=+40% Erz-Ausbeute
|
||||
Mining.Blast.Effect.2=+45% Erz-Ausbeute, kein Schutt
|
||||
Mining.Blast.Effect.3=+50% Erz-Ausbeute, kein Schutt
|
||||
Mining.Blast.Effect.4=+55% Erz-Ausbeute, kein Schutt, Doppel-Drops
|
||||
Mining.Blast.Effect.5=+60% Erz-Ausbeute, kein Schutt, Doppel-Drops
|
||||
Mining.Blast.Effect.6=+65% Erz-Ausbeute, kein Schutt, Dreifach-Drops
|
||||
Mining.Blast.Effect.7=+70% Erz-Ausbeute, kein Schutt, Dreifach-Drops
|
||||
Mining.Blast.Radius.Increase=[[RED]]Z\u00fcndstoff Radius Erh\u00f6hung: [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]Z\u00fcndstoff Rang:[[YELLOW]] {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] benutzte [[RED]]Z\u00fcndstoff!
|
||||
@@ -329,9 +320,7 @@ Combat.ArrowDeflect=[[WHITE]]**Pfeil ABGELENKT**
|
||||
Combat.BeastLore=[[GREEN]]**BESTIENKUNDE**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Gesundheit ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Besitzer ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Du wurdest von einem BRENNENDEM PFEIL getroffen!
|
||||
Combat.Gore=[[GREEN]]**AUFGESCHLITZT**
|
||||
Combat.Ignition=[[RED]]**ENTZ\u00dcNDUNG**
|
||||
Combat.StruckByGore=[[RED]]**du wurdest AUFGESCHLITZT**
|
||||
Combat.TargetDazed=Ziel wurde [[DARK_RED]]BET\u00c4UBT
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Ungl\u00fccklich ber\u00fchrt. Schwindelgef\u00fchl.
|
||||
@@ -426,7 +415,6 @@ Party.Password.Incorrect=[[RED]]Party password is incorrect.
|
||||
Party.Password.Set=[[GREEN]]Gruppen-Password ge\u00e4ndert zu: {0}
|
||||
Party.Player.Invalid=[[RED]]Dies ist kein g\u00fcltiger Spieler.
|
||||
Party.Teleport.Dead=[[RED]]Du kannst dich nicht zu toten Spielern teleportieren
|
||||
Party.Teleport.Hurt=[[RED]]Du wurdest in den letzten {0} Sekunden verletzt und kannst dich nicht teleportieren.
|
||||
Party.Teleport.Player=[[GREEN]]Du wurdest zu {0} teleportiert.
|
||||
Party.Teleport.Self=[[RED]]You can\'t teleport to yourself!
|
||||
Party.Teleport.Target=[[GREEN]]{0} hat sich zu dir teleportiert.
|
||||
|
||||
@@ -543,7 +543,7 @@ Party.Player.InSameParty=[[RED]]{0} already is in your party!
|
||||
Party.PlayerNotInParty=[[DARK_RED]]{0} is not in a party
|
||||
Party.Specify=[[RED]]You must specify a party.
|
||||
Party.Teleport.Dead=[[RED]]You can't teleport to a dead player.
|
||||
Party.Teleport.Hurt=[[RED]]You've been hurt in the last {0} seconds and cannnot teleport.
|
||||
Party.Teleport.Hurt=[[RED]]You have been hurt in the last {0} seconds and cannot teleport.
|
||||
Party.Teleport.Player=[[GREEN]]You have teleported to {0}.
|
||||
Party.Teleport.Self=[[RED]]You can't teleport to yourself!
|
||||
Party.Teleport.Target=[[GREEN]]{0} has teleported to you.
|
||||
@@ -566,6 +566,7 @@ Party.ItemShare.Disabled=[[RED]]Party item sharing is disabled.
|
||||
Commands.XPGain.Acrobatics=Falling
|
||||
Commands.XPGain.Archery=Attacking Monsters
|
||||
Commands.XPGain.Axes=Attacking Monsters
|
||||
Commands.XPGain.Child=Gains levels from Parent Skills
|
||||
Commands.XPGain.Excavation=Digging and finding treasures
|
||||
Commands.XPGain.Fishing=Fishing (Go figure!)
|
||||
Commands.XPGain.Herbalism=Harvesting Herbs
|
||||
@@ -590,7 +591,9 @@ XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!
|
||||
#EFFECTS
|
||||
##generic
|
||||
Effects.Effects=EFFECTS
|
||||
Effects.Child=[[DARK_GRAY]]LVL: [[GREEN]]{0}
|
||||
Effects.Level=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]])
|
||||
Effects.Parent = [[GOLD]]{0} -
|
||||
Effects.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1}
|
||||
|
||||
#GUIDES
|
||||
@@ -625,9 +628,11 @@ Item.ChimaeraWing.Pass=**CHIMAERA WING**
|
||||
Item.Injured.Wait=You were injured recently and must wait to use this. [[YELLOW]]({0}s)
|
||||
|
||||
#SKILLS
|
||||
Skills.Child=[[GOLD]](CHILD SKILL)
|
||||
Skills.Disarmed=[[DARK_RED]]You have been disarmed!
|
||||
Skills.Header=[[RED]]-----[][[GREEN]]{0}[[RED]][]-----
|
||||
Skills.NeedMore=[[DARK_RED]]You need more [[GRAY]]{0}
|
||||
Skills.Parents = PARENTS
|
||||
Skills.Stats=[[YELLOW]]{0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
|
||||
Skills.TooTired=[[RED]]You are too tired to use that ability again. [[YELLOW]]({0}s)
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=Gran Impacto
|
||||
Axes.Ability.Bonus.5=Hacer {0} de da\u00f1o bonus a los enemigos sin armadura
|
||||
Axes.Ability.Lower=[[GRAY]]**BAJAS TU HACHA**
|
||||
Axes.Ability.Ready=[[GREEN]]**PREPARAS TU HACHA**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]\u00a1Golpeado por PARTIR!
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]\u00a1Fuiste golpeado CR\u00cdTICAMENTE!
|
||||
Axes.Combat.CritChance=[[RED]]Probabilidad de golpe cr\u00edtico: [[YELLOW]]{0}%
|
||||
Axes.Combat.CriticalHit=[[RED]]\u00a1GOLPE CR\u00cdTICO!
|
||||
@@ -134,14 +133,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]\u00a1{0}[[DARK_GREEN]] us\u00f3 [[
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]\u00a1Tu habilidad de [[YELLOW]]S\u00faper Destructor [[GREEN]]est\u00e1 refrescada!
|
||||
Mining.Skillup=[[YELLOW]]Habilidad de Miner\u00eda incrementada en {0}. Total ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**BOOM**
|
||||
Mining.Blast.Effect.0=+35% de producci\u00f3n minera
|
||||
Mining.Blast.Effect.1=+40% de producci\u00f3n minera
|
||||
Mining.Blast.Effect.2=+45% de producci\u00f3n minera, sin residuos
|
||||
Mining.Blast.Effect.3=+50% de producci\u00f3n minera, sin residuos
|
||||
Mining.Blast.Effect.4=+55% de producci\u00f3n minera, sin residuos, doble drops
|
||||
Mining.Blast.Effect.5=+60% de producci\u00f3n minera, sin residuos, doble drops
|
||||
Mining.Blast.Effect.6=+65% de producci\u00f3n minera, sin residuos y triple drops
|
||||
Mining.Blast.Effect.7=+70% de producci\u00f3n minera, sin residuos, triple drops
|
||||
Mining.Blast.Radius.Increase=[[RED]]Incrementado Radio de Explosi\u00f3n: [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]Miner\u00eda Explosiva: [[YELLOW]] Rango {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]\u00a1{0}[[DARK_GREEN]] us\u00f3 [[RED]]Miner\u00eda Explosiva!
|
||||
@@ -290,9 +281,7 @@ Combat.ArrowDeflect=[[WHITE]]**FLECHA DESVIADA**
|
||||
Combat.BeastLore=[[GREEN]]**CONOCIMIENTO DE LA BESTIA**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Salud ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Due\u00f1o ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Has sido golpeado por una flecha ardiendo\\!
|
||||
Combat.Gore=[[GREEN]]**MORDISCO**
|
||||
Combat.Ignition=[[RED]]**IGNICION**
|
||||
Combat.StruckByGore=[[RED]]**FUISTE MORDISQUEADO**
|
||||
Combat.TargetDazed=El objetivo fue [[DARK_RED]]aturdido
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Est\u00e1s confuso. Te sientes mareado.
|
||||
@@ -346,7 +335,6 @@ Party.NotInYourParty=[[DARK_RED]]{0} no esta en tu fiesta
|
||||
Party.Password.Set=[[GREEN]]Contrase\u00f1a del grupo establecida: [[RED]]{0}
|
||||
Party.Player.Invalid=[[RED]]Ese no es un jugador v\u00e1lido.
|
||||
Party.Teleport.Dead=[[RED]]No te puedes teletransportar a un jugador muerto.
|
||||
Party.Teleport.Hurt=[[RED]]Fuiste herido en los \u00faltimos {0} segundos y no te puedes teletransportar.
|
||||
Party.Teleport.Player=[[GREEN]]Te teletransportaste a {0}.
|
||||
Party.Teleport.Target=[[GREEN]]{0} se teletransport\u00f3 a ti.
|
||||
Party.Unlocked=[[GRAY]]El grupo est\u00e1 desbloqueado
|
||||
|
||||
@@ -13,9 +13,7 @@ Combat.ArrowDeflect=[[WHITE]]**NUOLI TORJUTTU**
|
||||
Combat.BeastLore=[[GREEN]]**BEAST LORE**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Health ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Owner ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Palava nuoli osui sinuun\\!
|
||||
Combat.Gore=[[GREEN]]**PISTO**
|
||||
Combat.Ignition=[[RED]]**SYTYTYS**
|
||||
Combat.StruckByGore=[[RED]]**SINUA ON PISTETTY**
|
||||
Combat.TargetDazed=Kohde [[DARK_RED]]tyrm\u00e4tty
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]T\u00f6kk\u00e4sit P\u00f6rr\u00f6\u00e4. Tunsit huimauksen.
|
||||
|
||||
@@ -32,7 +32,6 @@ Axes.Ability.Bonus.4=Impact puissant
|
||||
Axes.Ability.Bonus.5=Inflige {0} de d\u00e9g\u00e2ts en plus aux ennemis sans armure
|
||||
Axes.Ability.Lower=[[GRAY]]**VOUS ABAISSEZ VOTRE HACHE**
|
||||
Axes.Ability.Ready=[[GREEN]]**VOUS LEVEZ VOTRE HACHE**
|
||||
Axes.Combat.Cleave.Proc=[[DARK_RED]]Frapp\u00e9 par Tranche-cr\u00e2ne !
|
||||
Axes.Combat.CritStruck=[[DARK_RED]]Vous avez re\u00e7u un coup critique !
|
||||
Axes.Combat.CritChance=[[RED]]Chance d\'infliger un coup critique : [[YELLOW]]{0}%
|
||||
Axes.Combat.CriticalHit=[[RED]]COUP CRITIQUE !
|
||||
@@ -133,14 +132,6 @@ Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] a utilis\u00e9 [[
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Votre comp\u00e9tence [[YELLOW]]Broyeur [[GREEN]]est pr\u00eate !
|
||||
Mining.Skillup=[[YELLOW]]Le talent Minage augmente de {0}. Total ({1})
|
||||
Mining.Blast.Boom=[[GRAY]]**BOUM**
|
||||
Mining.Blast.Effect.0=+35% de rendement
|
||||
Mining.Blast.Effect.1=+40% de rendement
|
||||
Mining.Blast.Effect.2=+45% de rendement, pas de d\u00e9bris
|
||||
Mining.Blast.Effect.3=+50% de rendement, pas de d\u00e9bris
|
||||
Mining.Blast.Effect.4=+55% de rendement, pas de d\u00e9bris, double drops
|
||||
Mining.Blast.Effect.5=+60% de rendement, pas de d\u00e9bris, double drops
|
||||
Mining.Blast.Effect.6=+65% de rendement, pas de d\u00e9bris, triple drops
|
||||
Mining.Blast.Effect.7=+70% de rendement, pas de d\u00e9bris, triple drops
|
||||
Mining.Blast.Radius.Increase=[[RED]]Rayon d\'explosion : [[YELLOW]]+{0}
|
||||
Mining.Blast.Rank=[[RED]]Minage explosif : [[YELLOW]]Rang {0}/8 [[GRAY]]({1})
|
||||
Mining.Blast.Other.On=[[GREEN]]{0}[[DARK_GREEN]] a utilis\u00e9 [[RED]]Minage explosif !
|
||||
@@ -282,9 +273,7 @@ Combat.ArrowDeflect=[[WHITE]]**FL\u00c8CHE DEVI\u00c9E**
|
||||
Combat.BeastLore=[[GREEN]]**CONNAISSANCE DES B\u00caTES**
|
||||
Combat.BeastLoreHealth=[[DARK_AQUA]]Vie ([[GREEN]]{0}[[DARK_AQUA]]/{1})
|
||||
Combat.BeastLoreOwner=[[DARK_AQUA]]Propri\u00e9taire ([[RED]]{0}[[DARK_AQUA]])
|
||||
Combat.BurningArrowHit=[[DARK_RED]]Vous avez \u00e9t\u00e9 frapp\u00e9 par une fl\u00e8che br\u00fblante\\!
|
||||
Combat.Gore=[[GREEN]]**SANG**
|
||||
Combat.Ignition=[[RED]]**ALLUMAGE**
|
||||
Combat.StruckByGore=[[RED]]**FRAPP\u00c9 JUSQU\'AU SANG**
|
||||
Combat.TargetDazed=La cible a \u00e9t\u00e9 [[DARK_RED]]\u00c9tourdi
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Vous \u00eates \u00e9tourdi.
|
||||
@@ -338,7 +327,6 @@ Party.NotInYourParty=[[DARK_RED]]{0} is not in your party
|
||||
Party.Password.Set=[[GREEN]]Mot de passe d\u00e9fini : {0}
|
||||
Party.Player.Invalid=[[RED]]Ce joueur n\'existe pas.
|
||||
Party.Teleport.Dead=[[RED]]Vous ne pouvez pas vous t\u00e9l\u00e9porter sur un joueur mort.
|
||||
Party.Teleport.Hurt=[[RED]]Vous avez \u00e9t\u00e9 bless\u00e9 durant les {0} derni\u00e8res secondes et ne pouvez pas vous t\u00e9l\u00e9porter.
|
||||
Party.Teleport.Player=[[GREEN]]Vous vous \u00eates t\u00e9l\u00e9port\u00e9 sur {0}.
|
||||
Party.Teleport.Target=[[GREEN]]{0} s\'est t\u00e9l\u00e9port\u00e9 sur vous.
|
||||
Party.Unlocked=[[GRAY]]Le groupe est d\u00e9verrouill\u00e9.
|
||||
|
||||
@@ -1,19 +1,39 @@
|
||||
Acrobatics.Combat.Proc=[[GREEN]]**Elker\u00fclve**
|
||||
Acrobatics.SkillName=AKROBATIKA
|
||||
Acrobatics.Skillup=[[YELLOW]]Akrobatika fejl\u0151d\u00f6tt {0} szinttel. \u00d6sszesen: ({1})
|
||||
Archery.Skillup=[[YELLOW]]\u00cdj\u00e1szat fejl\u0151d\u00f6tt {0} szinttel. \u00d6sszesen: ({1})
|
||||
Axes.Combat.GI.Struck=[[RED]]**HATALMAS EREJ\u0170 \u00dcT\u00c9S**
|
||||
Axes.Skills.SS.Other.On=[[GREEN]]{0}[[DARK_GREEN]] haszn\u00e1lta a [[RED]]Koponya T\u00f6r\u0151t!
|
||||
Excavation.SkillName=\u00c1S\u00c1S
|
||||
Herbalism.Listener=Gy\u00f3gyn\u00f6v\u00e9nytan:
|
||||
Mining.Ability.Ready=[[GREEN]]**CS\u00c1K\u00c1NYOD K\u00c9SZEN \u00c1LL**
|
||||
Mining.Skills.SuperBreaker.Refresh=[[GREEN]]A [[YELLOW]] Szuper Z\u00faz\u00f3 [[GREEN]]k\u00e9pess\u00e9ged \u00fajra haszn\u00e1lhat\u00f3!
|
||||
Mining.Skillup=[[YELLOW]]B\u00e1ny\u00e1szat fejl\u0151d\u00f6tt {0} szinttel. \u00d6sszesen: ({1})
|
||||
Mining.Blast.Refresh=[[GREEN]]A [[YELLOW]]Robban\u00f3 B\u00e1ny\u00e1szat [[GREEN]]k\u00e9pess\u00e9ged \u00fajra el\u00e9rhet\u0151!
|
||||
Repair.Skills.AdeptGold=[[DARK_RED]]Nem vagy el\u00e9g k\u00e9pzett ahhoz, hogy arany t\u00e1rgyakat jav\u00edts.
|
||||
Repair.Arcane.Fail=[[RED]]A t\u00e1rgyon l\u00e9v\u0151 var\u00e1zslat szertefoszlott.
|
||||
Swords.Combat.Bleeding.Stopped=[[GRAY]]A v\u00e9rz\u00e9s [[GREEN]]elm\u00falt[[GRAY]]!
|
||||
Swords.Combat.Bleeding=[[GREEN]]**ELLENS\u00c9G V\u00c9RZIK**
|
||||
Swords.Skills.SS.On=[[GREEN]]**F\u0170R\u00c9SZES CSAP\u00c1S AKTIV\u00c1LVA**
|
||||
Unarmed.Skills.Berserk.Off=[[RED]]**Tombol\u00e1sod befejez\u0151d\u00f6tt**
|
||||
Unarmed.Skills.Berserk.Other.On=[[GREEN]]{0}[[DARK_GREEN]] haszn\u00e1lta a [[RED]]Tombol\u00e1st!
|
||||
Woodcutting.Ability.0=Lev\u00e9l F\u00faj\u00f3
|
||||
Woodcutting.Ability.1=Elf\u00fajja a leveleket.
|
||||
Woodcutting.SkillName=FAV\u00c1G\u00c1S
|
||||
Ability.Generic.Template=[[RED]]{0}: [[YELLOW]]{1}
|
||||
Combat.TouchedFuzzy=[[DARK_RED]]Bolyhosat \u00e9rintettem. Elsz\u00e9d\u00fcltem.
|
||||
Commands.AdminChat.Off=Admin Chat [[RED]]kikapcsolva
|
||||
Commands.mmoedit=[player] <skill> <newvalue> [[RED]] - M\u00f3dos\u00edtva
|
||||
Commands.Party.Kick=[[RED]]Kidobtak a csoportb\u00f3l {0}!
|
||||
Commands.PowerLevel=[[DARK_RED]]POWER LEVEL: [[GREEN]]{0}
|
||||
Party.Unlocked=[[GRAY]]Csoport nyitva
|
||||
Commands.XPGain.Excavation=\u00c1sni \u00e9s kincset tal\u00e1lni.
|
||||
Commands.XPGain.Herbalism=N\u00f6v\u00e9nyek betakar\u00edt\u00e1sa
|
||||
Commands.XPGain.Mining=K\u0151 \u00e9s \u00e9rcek kib\u00e1ny\u00e1sz\u00e1sa
|
||||
Commands.XPGain.Taming=\u00c1llatok idom\u00edt\u00e1sa vagy harc a farkasoddal
|
||||
Commands.XPGain=[[DARK_GRAY]]KAPOTT TP: [[WHITE]]{0}
|
||||
Guides.Excavation=[[DARK_AQUA]]\u00c1s\u00e1sr\u00f3l:\n[[YELLOW]]\u00c1s\u00e1s a kincskeres\u00e9s egyik fajt\u00e1ja..\n[[YELLOW]]\u00c1s\u00e1s sor\u00e1n ez\u00e9rt kincseket kaphatsz.\n[[YELLOW]]Min\u00e9l t\u00f6bbet \u00e1sol, ann\u00e1l t\u00f6bb kincset tal\u00e1lhatsz.\n\n[[DARK_AQUA]]Tapasztalat Pont (TP) szerz\u00e9s:\n[[YELLOW]]Ahhoz, hogy TP-t szerezhess, \u00e1s\u00f3val a kezedben kell \u00e1snod.\n[[YELLOW]]Csak meghat\u00e1rozott t\u00edpus\u00fa blokkokban tal\u00e1lhatsz kincseket.\n[[DARK_AQUA]]Meghat\u00e1rozott blokkok:\n[[YELLOW]]F\u0171, f\u00f6ld, homok, agyag, s\u00f3der, gomb\u00e1s f\u00f6ld, l\u00e9lekhomok\n\n[[DARK_AQUA]]Hogyan haszn\u00e1ld a Hatalmas F\u00far\u00f3t:\n[[YELLOW]]Kezedben az \u00e1s\u00f3val kattonts a jobb eg\u00e9r gombbak.\n[[YELLOW]]Ezut\u00e1n 4 m\u00e1sodperced van, hogy\n[[YELLOW]]elkezdj \u00e1sni egy megfelel\u0151 anyagon. Ez \n[[YELLOW]]aktiv\u00e1lni fogja a Hatalmas F\u00far\u00f3t.\n[[DARK_AQUA]]Mi az a Hatalmas F\u00far\u00f3?\n[[YELLOW]]Hatalmas f\u00far\u00f3 egy k\u00e9pess\u00e9g, amely az \u00c1s\u00e1s\n[[YELLOW]]j\u00e1rtass\u00e1godhoz k\u00f6t\u0151dik. Megh\u00e1romszorozza\n[[YELLOW]]a kincs es\u00e9s\u00e9nek es\u00e9ly\u00e9t \u00e9s azonnal sz\u00e9tt\u00f6ri\n[[YELLOW]]az \u00e1s\u00e1shoz kapcsol\u00f3d\u00f3 blokkokat.\n\n[[DARK_AQUA]]HHogyan m\u0171k\u00f6dik a kincskeres\u00e9s?\n[[YELLOW]]Every possible treasure for Excavation has its own\n[[YELLOW]]skill level requirement for it to drop, as a result it\'s\n[[YELLOW]]difficult to say how much it is helping you.\n[[YELLOW]]Just keep in mind that the higher your Excavation skill\n[[YELLOW]]is, the more treasures that can be found.\n[[YELLOW]]And also keep in mind that each type of Excavation\n[[YELLOW]]compatible material has its own unique list of treasures.\n[[YELLOW]]In other words you will find different treasures in Dirt\n[[YELLOW]]than you would in Gravel.\n[[DARK_AQUA]]Notes about Excavation:\n[[YELLOW]]Excavation drops are completely customizeable\n[[YELLOW]]So results vary server to server.
|
||||
XPRate.Event=[[GOLD]]mcMMO-ban most TP r\u00e1ta n\u00f6vel\u0151 esem\u00e9ny van! TP r\u00e1ta {0}x!
|
||||
Guides.Excavation=[[DARK_AQUA]]\u00c1s\u00e1sr\u00f3l:\n\n[[YELLOW]]\u00c1s\u00e1s a kincskeres\u00e9s egyik fajt\u00e1ja..\n\n[[YELLOW]]\u00c1s\u00e1s sor\u00e1n ez\u00e9rt kincseket kaphatsz.\n\n[[YELLOW]]Min\u00e9l t\u00f6bbet \u00e1sol, ann\u00e1l t\u00f6bb kincset tal\u00e1lhatsz.\n\n\n\n[[DARK_AQUA]]Tapasztalat Pont (TP) szerz\u00e9s:\n\n[[YELLOW]]Ahhoz, hogy TP-t szerezhess, \u00e1s\u00f3val a kezedben kell \u00e1snod.\n\n[[YELLOW]]Csak meghat\u00e1rozott t\u00edpus\u00fa blokkokban tal\u00e1lhatsz kincseket.\n\n[[DARK_AQUA]]Meghat\u00e1rozott blokkok:\n\n[[YELLOW]]F\u0171, f\u00f6ld, homok, agyag, s\u00f3der, gomb\u00e1s f\u00f6ld, l\u00e9lekhomok\n\n\n\n[[DARK_AQUA]]Hogyan haszn\u00e1ld a Hatalmas F\u00far\u00f3t:\n\n[[YELLOW]]Kezedben az \u00e1s\u00f3val kattints a jobb eg\u00e9r gombbak.\n\n[[YELLOW]]Ezut\u00e1n 4 m\u00e1sodperced van, hogy\n\n[[YELLOW]]elkezdj \u00e1sni egy megfelel\u0151 anyagon. Ez \n\n[[YELLOW]]aktiv\u00e1lni fogja a Hatalmas F\u00far\u00f3t.\n\n[[DARK_AQUA]]Mi az a Hatalmas F\u00far\u00f3?\n\n[[YELLOW]]Hatalmas f\u00far\u00f3 egy k\u00e9pess\u00e9g, amely az \u00c1s\u00e1s\n\n[[YELLOW]]j\u00e1rtass\u00e1godhoz k\u00f6t\u0151dik. Megh\u00e1romszorozza\n\n[[YELLOW]]a kincs es\u00e9s\u00e9nek es\u00e9ly\u00e9t \u00e9s azonnal sz\u00e9tt\u00f6ri\n\n[[YELLOW]]az \u00e1s\u00e1shoz kapcsol\u00f3d\u00f3 blokkokat.\n\n\n\n[[DARK_AQUA]]Hogyan m\u0171k\u00f6dik a kincskeres\u00e9s?\n\n[[YELLOW]]Minden kincsnek megvan a maga \n\n[[YELLOW]]szintbeli k\u00f6vetelm\u00e9nye, amely ut\u00e1n eshet, ennek k\u00f6vetkezt\u00e9ben \n\n[[YELLOW]]neh\u00e9z megmondani, hogy mennyire hasznos.\n\n[[YELLOW]]Csak tartsd \u00e9szben, hogy min\u00e9l nagyobb az \u00c1s\u00e1sbeli j\u00e1rtass\u00e1god,\n\n[[YELLOW]]ann\u00e1l t\u00f6bb kincset kaphatsz.\n\n[[YELLOW]]Ezen fel\u00fcl azt se felejtsd el, hogy minden \u00c1sat\u00e1shoz k\u00f6t\u0151d\u0151\n\n[[YELLOW]]anyagnak megvan a saj\u00e1t list\u00e1ja, arra, hogy milyen kincset tartalmazhat.\n\n[[YELLOW]]M\u00e1s szavakkal, m\u00e1s kincset tal\u00e1lhatsz egy f\u00f6ld blokkban\n\n[[YELLOW]]mint egy homok blokkban.\n\n[[DARK_AQUA]]Megjegyz\u00e9s az \u00c1s\u00e1shoz:\n\n[[YELLOW]]A kincsek teljesen szem\u00e9lyre szabhat\u00f3ak.\n\n[[YELLOW]]\u00cdgy szerverenk\u00e9nt elt\u00e9rhetnek egym\u00e1st\u00f3l.
|
||||
Skills.Disarmed=[[DARK_RED]]Lefegyvereztek!
|
||||
Stats.Header.Combat=[[GOLD]]-=HARCI K\u00c9PZETTS\u00c9GEK=-
|
||||
Stats.Header.Gathering=[[GOLD]]-= GY\u0170JT\u00d6GET\u0150 K\u00c9PESS\u00c9GEK=-
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user