mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 09:43:00 +01:00
Compare commits
76 Commits
1.4.00-bet
...
1.4.00-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84dce845a5 | ||
|
|
0a68b82078 | ||
|
|
3dc1afde7e | ||
|
|
e50eb1963f | ||
|
|
fdd6c0a0d8 | ||
|
|
c589c5556b | ||
|
|
17a85c94c6 | ||
|
|
4284fe1029 | ||
|
|
dec3c10ec1 | ||
|
|
c805a48a87 | ||
|
|
918d81198f | ||
|
|
1d87de0a3e | ||
|
|
fdeadde7f0 | ||
|
|
760432fb41 | ||
|
|
240589e9ea | ||
|
|
400c93fb7d | ||
|
|
1bcf43db63 | ||
|
|
79bcd76aa0 | ||
|
|
8833ceb3b5 | ||
|
|
ccc265edf9 | ||
|
|
b18a4da0d9 | ||
|
|
e956988c60 | ||
|
|
1b6d66d4b0 | ||
|
|
fd47d77800 | ||
|
|
5c76ef312f | ||
|
|
f189907ff8 | ||
|
|
6e32843fb4 | ||
|
|
a99d6eb9f8 | ||
|
|
bb37a5982e | ||
|
|
a43a5a0861 | ||
|
|
4ff1e79cc0 | ||
|
|
d28794a587 | ||
|
|
19292c8007 | ||
|
|
a67dd1d9d7 | ||
|
|
9c0f763949 | ||
|
|
6571864b16 | ||
|
|
701822c69f | ||
|
|
2eab93292e | ||
|
|
29fb8b83c2 | ||
|
|
ad68f50b14 | ||
|
|
519485f155 | ||
|
|
45fbb47ccf | ||
|
|
cf0f075acb | ||
|
|
d9aad67ca5 | ||
|
|
083a89c1a3 | ||
|
|
671be42472 | ||
|
|
add4bc24df | ||
|
|
1da1bb7218 | ||
|
|
d0d9527d39 | ||
|
|
c39827ed59 | ||
|
|
5d6a35d4ef | ||
|
|
0d62688343 | ||
|
|
80b7cc717f | ||
|
|
05a9c8b7e5 | ||
|
|
e78cbcfcc8 | ||
|
|
f7b1aea7e0 | ||
|
|
2744fb122c | ||
|
|
77638bf56a | ||
|
|
57e6e5400b | ||
|
|
f2b03896e2 | ||
|
|
8a795e6091 | ||
|
|
946513cb66 | ||
|
|
1fe182babe | ||
|
|
f61aed9f6c | ||
|
|
08882e58b6 | ||
|
|
4c6f2da78a | ||
|
|
3550310e5c | ||
|
|
cedd8da9ba | ||
|
|
3cb269de4b | ||
|
|
91010f2958 | ||
|
|
f3e823997b | ||
|
|
4ae276d1d7 | ||
|
|
f6b38ab32a | ||
|
|
6f96a5026b | ||
|
|
4071f259ad | ||
|
|
a9ed1a1850 |
@@ -9,6 +9,7 @@ Key:
|
||||
|
||||
Version 1.4.00-dev
|
||||
+ Added new Child Skill - Smelting!
|
||||
+ Added a version check, admins will get notified when a new version is available!
|
||||
+ Added new cancellable McMMOPlayerDisarmEvent for Citizens compatibility - fires whenever a player is disarmed.
|
||||
+ Added config options for Hylian Luck skill
|
||||
+ Added display values to Unarmed command for Iron Grip
|
||||
@@ -33,6 +34,8 @@ Version 1.4.00-dev
|
||||
+ Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
|
||||
+ Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
|
||||
+ Added config option to disable automatic zip backups.
|
||||
+ Added particle effects for many abilities.
|
||||
+ Added '/mcnotify' command to toggle ability notifications on/off
|
||||
= Fixed Green Thumb on wheat not working properly at rank 4
|
||||
= Fixed Green Thumb and Green Terra consuming twice the amount of seed needed
|
||||
= Fixed Green Terra not also checking Green Thumb permissions
|
||||
@@ -67,6 +70,7 @@ Version 1.4.00-dev
|
||||
= Fixed a bug where a new party leader wasn't appointed, after the previous party leader left
|
||||
= Fixed a bug where Disarm and Deflect had wrong values
|
||||
= Fixed Magic Hunter (Fishing ability) favoring certain enchants
|
||||
! Changed Green Terra blocks to be determined via permissions instead of the config file
|
||||
! Config files are now backed up even when running in SQL mode
|
||||
! Changed /p and /a to use /partychat and /adminchat as the default command name. The use of /p, /pc, /a, and /ac is still supported.
|
||||
! We're now using Bukkit sounds instead of Spout sounds.
|
||||
@@ -85,12 +89,13 @@ Version 1.4.00-dev
|
||||
! Changed BeastLore: Now also displays offline player names
|
||||
! Changed backup task to include ALL config files
|
||||
! Deprecated most functions in ExperienceAPI, replaced them with identical versions that use a String for the SkillName rather than the SkillType enum values
|
||||
! Changed Super Breaker & Giga Drill Breaker to be an enchantment-based boost, rather than an instabreak.
|
||||
! Changed Super Breaker & Giga Drill Breaker to be an enchantment-based boost, rather than an instabreak. Option exists in hidden.yml to change this to an potion-based buff.
|
||||
! Changed locales to fall back on English when translated strings cannot be found.
|
||||
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
|
||||
- Removed unused "healthbar" files from the resources
|
||||
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
|
||||
- Removed /mcc command. Replaced with /mcmmo [?|help|commands]
|
||||
- Removed /mcc command. Replaced with /mcmmo [?|help|commands]
|
||||
- Removed options to allow Mining & Excavation without a tool due to the changes to their abilities
|
||||
|
||||
Version 1.3.14
|
||||
+ Added new Hylian Luck skill to Herbalism.
|
||||
|
||||
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-beta3</version>
|
||||
<version>1.4.00-beta4</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<issueManagement>
|
||||
|
||||
@@ -26,7 +26,7 @@ public final class AbilityAPI {
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLIITER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLITTER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
|
||||
@@ -30,7 +30,6 @@ public final class ChatManager {
|
||||
String adminMessage = chatEvent.getMessage();
|
||||
|
||||
mcMMO.p.getServer().broadcast(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage, "mcmmo.chat.adminchat");
|
||||
mcMMO.p.getLogger().info("[A]<" + ChatColor.stripColor(displayName) + "> " + adminMessage);
|
||||
}
|
||||
|
||||
public static void handleAdminChat(Plugin plugin, String senderName, String message) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public final class CommandHelper {
|
||||
private CommandHelper() {}
|
||||
@@ -31,23 +32,23 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasGatheringSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.excavation")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.EXCAVATION)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.fishing")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.FISHING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.fishing")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.HERBALISM)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.mining")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.MINING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.woodcutting")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.WOODCUTTING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
}
|
||||
}
|
||||
@@ -68,23 +69,23 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasCombatSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.axes")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.AXES)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.archery")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ARCHERY)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.swords")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.SWORDS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.taming")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.TAMING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.unarmed")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.UNARMED)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
|
||||
}
|
||||
}
|
||||
@@ -105,11 +106,11 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasMiscSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.acrobatics")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ACROBATICS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.repair")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.REPAIR)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.gmail.nossr50.commands.admin.XprateCommand;
|
||||
import com.gmail.nossr50.commands.player.InspectCommand;
|
||||
import com.gmail.nossr50.commands.player.McabilityCommand;
|
||||
import com.gmail.nossr50.commands.player.McmmoCommand;
|
||||
import com.gmail.nossr50.commands.player.McnotifyCommand;
|
||||
import com.gmail.nossr50.commands.player.McrankCommand;
|
||||
import com.gmail.nossr50.commands.player.McstatsCommand;
|
||||
import com.gmail.nossr50.commands.player.MctopCommand;
|
||||
@@ -215,7 +216,7 @@ public final class CommandRegistrationHelper {
|
||||
public static void registerMcmmoCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcmmo");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
|
||||
command.setPermission("mcmmo.commands.mcmmo;mcmmo.commands.mcmmo.help");
|
||||
command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "help"));
|
||||
@@ -358,4 +359,13 @@ public final class CommandRegistrationHelper {
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
|
||||
command.setExecutor(new VampirismCommand());
|
||||
}
|
||||
|
||||
public static void registerMcnotifyCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcnotify");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
|
||||
command.setPermission("mcmmo.commands.mcnotify");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcnotify"));
|
||||
command.setExecutor(new McnotifyCommand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.addlevels")) {
|
||||
if (!Permissions.addlevels(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -71,7 +72,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.addlevels.others")) {
|
||||
if (!Permissions.addlevelsOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class AddxpCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.addxp")) {
|
||||
if (!Permissions.addxp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class AddxpCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.addxp.others")) {
|
||||
if (!Permissions.addxpOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class HardcoreCommand implements CommandExecutor{
|
||||
@@ -17,7 +18,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -33,7 +34,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -43,7 +44,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -56,7 +57,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.modify")) {
|
||||
if (!Permissions.hardcoreModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
@@ -17,7 +18,7 @@ public class McgodCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcgod")) {
|
||||
if (!Permissions.mcgod(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -44,7 +45,7 @@ public class McgodCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcgod.others")) {
|
||||
if (!Permissions.mcgodOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrefreshCommand implements CommandExecutor {
|
||||
@@ -18,7 +18,7 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrefresh")) {
|
||||
if (!Permissions.mcrefresh(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -33,13 +33,12 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
SkillTools.handleAbilitySpeedDecrease((Player) sender); //Remove enchants left over
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrefresh.others")) {
|
||||
if (!Permissions.mcrefreshOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -69,7 +68,6 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
profile.resetCooldowns();
|
||||
profile.resetToolPrepMode();
|
||||
profile.resetAbilityMode();
|
||||
SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrefresh.Success", args[0]));
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.mmoedit")) {
|
||||
if (!Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -67,7 +68,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.mmoedit.others")) {
|
||||
if (!Permissions.mmoeditOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillresetCommand implements CommandExecutor {
|
||||
@@ -22,7 +23,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset")) {
|
||||
if (!Permissions.skillreset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -47,7 +48,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillreset(sender, skillType)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase())) {
|
||||
if (!Permissions.skillreset(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others")) {
|
||||
if (!Permissions.skillresetOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -90,7 +91,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -113,7 +114,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
@@ -136,7 +137,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class VampirismCommand implements CommandExecutor {
|
||||
@@ -22,7 +23,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -48,7 +49,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.modify")) {
|
||||
if (!Permissions.vampirismModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
@@ -20,7 +21,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.xprate.reset")) {
|
||||
if (!Permissions.xprateReset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.xprate.set")) {
|
||||
if (!Permissions.xprateSet(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
@@ -20,11 +21,6 @@ public class InspectCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.inspect")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
@@ -36,7 +32,8 @@ public class InspectCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !sender.hasPermission("mcmmo.commands.inspect.offline")) {
|
||||
// TODO: Why do we care if this is a player?
|
||||
if (sender instanceof Player && !Permissions.inspectOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
@@ -67,7 +64,7 @@ public class InspectCommand implements CommandExecutor {
|
||||
if (sender instanceof Player) {
|
||||
Player inspector = (Player) sender;
|
||||
|
||||
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !inspector.hasPermission("mcmmo.commands.inspect.far")) {
|
||||
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar(inspector)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@@ -17,7 +18,7 @@ public class McabilityCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcability")) {
|
||||
if (!Permissions.mcability(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public class McabilityCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcability.others")) {
|
||||
if (!Permissions.mcabilityOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.commands.PartySubcommandType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
@Override
|
||||
@@ -17,6 +19,11 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcmmoDescription(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
String description = LocaleLoader.getString("mcMMO.Description");
|
||||
String[] mcSplit = description.split(",");
|
||||
sender.sendMessage(mcSplit);
|
||||
@@ -36,7 +43,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("commands")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.mcmmo.help")) {
|
||||
if (!Permissions.mcmmoHelp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -54,20 +61,20 @@ public class McmmoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void displayPartyCommands(CommandSender sender) {
|
||||
if (sender.hasPermission("mcmmo.commands.party")) {
|
||||
if (Permissions.party(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
||||
sender.sendMessage("/party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
|
||||
sender.sendMessage("/party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
|
||||
sender.sendMessage("/party quit " + LocaleLoader.getString("Commands.Party.Quit"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.chat.party")) {
|
||||
if (Permissions.partyChat(sender)) {
|
||||
sender.sendMessage("/party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
|
||||
}
|
||||
|
||||
sender.sendMessage("/party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
sender.sendMessage("/party accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.ptp")) {
|
||||
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
|
||||
sender.sendMessage("/party teleport " + LocaleLoader.getString("Commands.Party.Teleport"));
|
||||
}
|
||||
}
|
||||
@@ -78,27 +85,27 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
|
||||
sender.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.skillreset")) {
|
||||
if (Permissions.skillreset(sender)) {
|
||||
sender.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mcability")) {
|
||||
if (Permissions.mcability(sender)) {
|
||||
sender.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.chat.admin")) {
|
||||
if (Permissions.adminChat(sender)) {
|
||||
sender.sendMessage("/adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.inspect")) {
|
||||
if (Permissions.inspect(sender)) {
|
||||
sender.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mmoedit")) {
|
||||
if (Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mcgod")) {
|
||||
if (Permissions.mcgod(sender)) {
|
||||
sender.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McnotifyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
PlayerProfile profile = Users.getPlayer((Player) sender).getProfile();
|
||||
|
||||
if (profile.useChatNotifications()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
|
||||
}
|
||||
|
||||
profile.toggleChatNotifications();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.gmail.nossr50.runnables.McRankAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrankCommand implements CommandExecutor {
|
||||
@@ -23,7 +24,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrank")) {
|
||||
if (!Permissions.mcrank(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -43,7 +44,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrank.others")) {
|
||||
if (!Permissions.mcrankOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -58,7 +59,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !!sender.hasPermission("mcmmo.commands.mcrank.others.offline")) {
|
||||
if (sender instanceof Player && !Permissions.mcrankOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
@@ -66,7 +67,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !sender.hasPermission("mcmmo.commands.mcrank.others.far")) {
|
||||
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.mcrankFar(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.McTopAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
@@ -72,7 +73,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
|
||||
if (!skill.equalsIgnoreCase("all") && !sender.hasPermission("mcmmo.commands.mctop." + skill.toLowerCase())) {
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class AdvancedConfig extends ConfigLoader {
|
||||
public int getHerbalismDoubleDropsMaxLevel() { return config.getInt("Skills.Herbalism.DoubleDrops_MaxBonusLevel", 1000); }
|
||||
|
||||
public double getHylianLuckChanceMax() { return config.getDouble("Skills.Herbalism.HylianLuck_ChanceMax", 10.0D); }
|
||||
public int getHylianLucksMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck_MaxBonusLevel", 1000); }
|
||||
public int getHylianLuckMaxLevel() { return config.getInt("Skills.Herbalism.HylianLuck_MaxBonusLevel", 1000); }
|
||||
|
||||
/* MINING */
|
||||
public double getMiningDoubleDropChance() { return config.getDouble("Skills.Mining.DoubleDrops_ChanceMax", 100.0D); }
|
||||
|
||||
@@ -2,9 +2,13 @@ package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class Config extends ConfigLoader {
|
||||
private static Config instance;
|
||||
@@ -35,8 +39,11 @@ public class Config extends ConfigLoader {
|
||||
public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
|
||||
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
|
||||
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
|
||||
public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
|
||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
|
||||
public boolean getBackupsEnabled() { return config.getBoolean("General.Generate_Backups", true); }
|
||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.p.Use_Display_Names", true); }
|
||||
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.a.Use_Display_Names", true); }
|
||||
|
||||
@@ -62,10 +69,14 @@ public class Config extends ConfigLoader {
|
||||
|
||||
private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
|
||||
String str = cfg.getString(key);
|
||||
if (str == null)
|
||||
|
||||
if (str == null) {
|
||||
str = String.valueOf(cfg.getInt(key));
|
||||
if (str == null)
|
||||
}
|
||||
|
||||
if (str == "0") {
|
||||
str = "No value set for '" + key + "'";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -118,30 +129,13 @@ public class Config extends ConfigLoader {
|
||||
public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
|
||||
public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
|
||||
|
||||
public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
|
||||
public int getMaxTicks(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
|
||||
|
||||
/* Durability Settings */
|
||||
public boolean getAbilitiesDamageTools() { return config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); }
|
||||
public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 2); }
|
||||
|
||||
/* Cooldowns */
|
||||
public int getAbilityCooldownGreenTerra() { return config.getInt("Abilities.Cooldowns.Green_Terra", 240); }
|
||||
public int getAbilityCooldownSuperBreaker() { return config.getInt("Abilities.Cooldowns.Super_Breaker", 240); }
|
||||
public int getAbilityCooldownGigaDrillBreaker() { return config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); }
|
||||
public int getAbilityCooldownTreeFeller() { return config.getInt("Abilities.Cooldowns.Tree_Feller", 240); }
|
||||
public int getAbilityCooldownBerserk() { return config.getInt("Abilities.Cooldowns.Berserk", 240); }
|
||||
public int getAbilityCooldownSerratedStrikes() { return config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); }
|
||||
public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); }
|
||||
public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); }
|
||||
|
||||
/* Max ticks */
|
||||
public int getAbilityMaxTicksGreenTerra() { return config.getInt("Abilities.Max_Seconds.Green_Terra", 0); }
|
||||
public int getAbilityMaxTicksSuperBreaker() { return config.getInt("Abilities.Max_Seconds.Super_Breaker", 0); }
|
||||
public int getAbilityMaxTicksGigaDrillBreaker() { return config.getInt("Abilities.Max_Seconds.Giga_Drill_Breaker", 0); }
|
||||
public int getAbilityMaxTicksTreeFeller() { return config.getInt("Abilities.Max_Seconds.Tree_Feller", 0); }
|
||||
public int getAbilityMaxTicksBerserk() { return config.getInt("Abilities.Max_Seconds.Berserk", 0); }
|
||||
public int getAbilityMaxTicksSerratedStrikes() { return config.getInt("Abilities.Max_Seconds.Serrated_Strikes", 0); }
|
||||
public int getAbilityMaxTicksSkullSplitter() { return config.getInt("Abilities.Max_Seconds.Skull_Splitter", 0); }
|
||||
public int getAbilityMaxTicksBlastMining() { return config.getInt("Abilities.Max_Seconds.Blast_Mining", 0); }
|
||||
|
||||
/* Thresholds */
|
||||
public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
|
||||
|
||||
@@ -149,281 +143,13 @@ public class Config extends ConfigLoader {
|
||||
* SKILL SETTINGS
|
||||
*/
|
||||
|
||||
/* Tool Requirements */
|
||||
public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); }
|
||||
public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); }
|
||||
public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); }
|
||||
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
|
||||
|
||||
/* Excavation */
|
||||
public int getExcavationClayXP() { return config.getInt("Experience.Excavation.Clay", 40); }
|
||||
public int getExcavationDirtXP() { return config.getInt("Experience.Excavation.Dirt", 40); }
|
||||
public int getExcavationGrassXP() { return config.getInt("Experience.Excavation.Grass", 40); }
|
||||
public int getExcavationGravelXP() { return config.getInt("Experience.Excavation.Gravel", 40); }
|
||||
public int getExcavationMycelXP() { return config.getInt("Experience.Excavation.Mycel", 40); }
|
||||
public int getExcavationSandXP() { return config.getInt("Experience.Excavation.Sand", 40); }
|
||||
public int getExcavationSoulSandXP() { return config.getInt("Experience.Excavation.SoulSand", 40); }
|
||||
|
||||
/* Fishing */
|
||||
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
|
||||
/* Herbalism */
|
||||
public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); }
|
||||
public int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); }
|
||||
public int getHerbalismXPCactus() { return config.getInt("Experience.Herbalism.Cactus", 30); }
|
||||
public int getHerbalismXPPumpkin() { return config.getInt("Experience.Herbalism.Pumpkin", 20); }
|
||||
public int getHerbalismXPFlowers() { return config.getInt("Experience.Herbalism.Flowers", 100); }
|
||||
public int getHerbalismXPMushrooms() { return config.getInt("Experience.Herbalism.Mushrooms", 150); }
|
||||
public int getHerbalismXPMelon() { return config.getInt("Experience.Herbalism.Melon", 20); }
|
||||
public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); }
|
||||
public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); }
|
||||
public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); }
|
||||
public int getHerbalismXPCocoa() { return config.getInt("Experience.Herbalism.Cocoa", 30); }
|
||||
public int getHerbalismXPCarrot() { return config.getInt("Experience.Herbalism.Carrot", 50); }
|
||||
public int getHerbalismXPPotato() { return config.getInt("Experience.Herbalism.Potato", 50); }
|
||||
|
||||
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
|
||||
public boolean getHerbalismGreenThumbCobbleWallToMossyWall() { return config.getBoolean("Skills.Herbalism.Green_Thumb.CobbleWall_To_MossyWall", true); }
|
||||
public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); }
|
||||
public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); }
|
||||
|
||||
public boolean getBrownMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Brown_Mushrooms", true); }
|
||||
public boolean getCactiDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cacti", true); }
|
||||
public boolean getWheatDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Wheat", true); }
|
||||
public boolean getMelonsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Melons", true); }
|
||||
public boolean getNetherWartsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Nether_Warts", true); }
|
||||
public boolean getPumpkinsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Pumpkins", true); }
|
||||
public boolean getRedMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Mushrooms", true); }
|
||||
public boolean getRedRosesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Roses", true); }
|
||||
public boolean getSugarCaneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Sugar_Cane", true); }
|
||||
public boolean getVinesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Vines", true); }
|
||||
public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); }
|
||||
public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); }
|
||||
public boolean getCocoaDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cocoa", true); }
|
||||
public boolean getCarrotDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Carrot", true); }
|
||||
public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); }
|
||||
|
||||
public boolean herbalismDoubleDropsDisabled() {
|
||||
return doubleDropsDisabled("Herbalism");
|
||||
}
|
||||
|
||||
/* Mining */
|
||||
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
|
||||
public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); }
|
||||
public int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); }
|
||||
public int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); }
|
||||
public int getMiningXPLapisOre() { return config.getInt("Experience.Mining.Lapis", 400); }
|
||||
public int getMiningXPObsidian() { return config.getInt("Experience.Mining.Obsidian", 150); }
|
||||
public int getMiningXPNetherrack() { return config.getInt("Experience.Mining.Netherrack", 30); }
|
||||
public int getMiningXPGlowstone() { return config.getInt("Experience.Mining.Glowstone", 30); }
|
||||
public int getMiningXPCoalOre() { return config.getInt("Experience.Mining.Coal", 100); }
|
||||
public int getMiningXPStone() { return config.getInt("Experience.Mining.Stone", 30); }
|
||||
public int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); }
|
||||
public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
|
||||
public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
|
||||
public int getMiningXPEmeraldOre() { return config.getInt("Experience.Mining.Emerald", 1000); }
|
||||
|
||||
public boolean getCoalDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Coal", true); }
|
||||
public boolean getDiamondDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Diamond", true); }
|
||||
public boolean getEndStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.End_Stone", true); }
|
||||
public boolean getGlowstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Glowstone", true); }
|
||||
public boolean getGoldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Gold", true); }
|
||||
public boolean getIronDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Iron", true); }
|
||||
public boolean getLapisDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Lapis", true); }
|
||||
public boolean getMossyCobblestoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Moss_Stone", true); }
|
||||
public boolean getNetherrackDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Netherrack", true); }
|
||||
public boolean getObsidianDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Obsidian", true); }
|
||||
public boolean getRedstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Redstone", true); }
|
||||
public boolean getSandstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Sandstone", true); }
|
||||
public boolean getStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Stone", true); }
|
||||
public boolean getEmeraldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Emerald", true); }
|
||||
|
||||
public boolean miningDoubleDropsDisabled() {
|
||||
return doubleDropsDisabled("Mining");
|
||||
}
|
||||
|
||||
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* Smelting */
|
||||
public int getSmeltingXPCoal() { return config.getInt("Experience.Smelting.Coal", 10); }
|
||||
public int getSmeltingXPRedstone() { return config.getInt("Experience.Smelting.Redstone", 15); }
|
||||
public int getSmeltingXPIron() { return config.getInt("Experience.Smelting.Iron", 25); }
|
||||
public int getSmeltingXPGold() { return config.getInt("Experience.Smelting.Gold", 35); }
|
||||
public int getSmeltingXPDiamond() { return config.getInt("Experience.Smelting.Diamond", 75); }
|
||||
public int getSmeltingXPLapis() { return config.getInt("Experience.Smelting.Lapis", 40); }
|
||||
public int getSmeltingXPEmerald() { return config.getInt("Experience.Smelting.Emerald", 100); }
|
||||
|
||||
/* Unarmed */
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
||||
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
|
||||
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
||||
|
||||
/* Woodcutting */
|
||||
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); }
|
||||
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
|
||||
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
|
||||
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
|
||||
|
||||
|
||||
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
|
||||
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
|
||||
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
|
||||
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
|
||||
|
||||
public boolean woodcuttingDoubleDropsDisabled() {
|
||||
return doubleDropsDisabled("Woodcutting");
|
||||
}
|
||||
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsAFKDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
public boolean getHerbalismAFKDisabled() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
|
||||
|
||||
/* Dogde Lightning */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
|
||||
/* Level Caps */
|
||||
public int getLevelCapAcrobatics() {
|
||||
return getLevelCap("Skills.Acrobatics.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapArchery() {
|
||||
return getLevelCap("Skills.Archery.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapAxes() {
|
||||
return getLevelCap("Skills.Axes.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapExcavation() {
|
||||
return getLevelCap("Skills.Excavation.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapFishing() {
|
||||
return getLevelCap("Skills.Fishing.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapHerbalism() {
|
||||
return getLevelCap("Skills.Herbalism.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapMining() {
|
||||
return getLevelCap("Skills.Mining.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapRepair() {
|
||||
return getLevelCap("Skills.Repair.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapSmelting() {
|
||||
return getLevelCap("Skills.Smelting.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapSwords() {
|
||||
return getLevelCap("Skills.Swords.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapTaming() {
|
||||
return getLevelCap("Skills.Taming.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapUnarmed() {
|
||||
return getLevelCap("Skills.Unarmed.Level_Cap");
|
||||
}
|
||||
|
||||
public int getLevelCapWoodcutting() {
|
||||
return getLevelCap("Skills.Woodcutting.Level_Cap");
|
||||
}
|
||||
|
||||
public int getPowerLevelCap() {
|
||||
return getLevelCap("General.Power_Level_Cap");
|
||||
}
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
public boolean getAcrobaticsPVP() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVP", true); }
|
||||
public boolean getAcrobaticsPVE() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVE", true); }
|
||||
public boolean getArcheryPVP() { return config.getBoolean("Skills.Archery.Enabled_For_PVP", true); }
|
||||
public boolean getArcheryPVE() { return config.getBoolean("Skills.Archery.Enabled_For_PVE", true); }
|
||||
public boolean getAxesPVP() { return config.getBoolean("Skills.Axes.Enabled_For_PVP", true); }
|
||||
public boolean getAxesPVE() { return config.getBoolean("Skills.Axes.Enabled_For_PVE", true); }
|
||||
public boolean getSwordsPVP() { return config.getBoolean("Skills.Swords.Enabled_For_PVP", true); }
|
||||
public boolean getSwordsPVE() { return config.getBoolean("Skills.Swords.Enabled_For_PVE", true); }
|
||||
public boolean getTamingPVP() { return config.getBoolean("Skills.Taming.Enabled_For_PVP", true); }
|
||||
public boolean getTamingPVE() { return config.getBoolean("Skills.Taming.Enabled_For_PVE", true); }
|
||||
public boolean getUnarmedPVP() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVP", true); }
|
||||
public boolean getUnarmedPVE() { return config.getBoolean("Skills.Unarmed.Enabled_For_PVE", true); }
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience.Gains.Multiplier.Global", value); }
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
|
||||
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
|
||||
public double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); }
|
||||
public double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); }
|
||||
public double getSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); }
|
||||
public double getGhastXP() { return config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); }
|
||||
public double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); }
|
||||
public double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); }
|
||||
public double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); }
|
||||
public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 1.0); }
|
||||
public double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); }
|
||||
public double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); }
|
||||
public double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); }
|
||||
public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); }
|
||||
public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); }
|
||||
public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); }
|
||||
public double getGiantXP() { return config.getDouble("Experience.Combat.Multiplier.Giant", 4.0); }
|
||||
public double getWitherXP() { return config.getDouble("Experience.Combat.Multiplier.Wither", 7.0); }
|
||||
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
|
||||
public double getWitchXP() { return config.getDouble("Experience.Combat.Multiplier.Witch", 4.0); }
|
||||
|
||||
/* XP Formula Multiplier */
|
||||
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
|
||||
public double getFormulaMultiplierTaming() { return config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); }
|
||||
public double getFormulaMultiplierMining() { return config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); }
|
||||
public double getFormulaMultiplierRepair() { return config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); }
|
||||
public double getFormulaMultiplierWoodcutting() { return config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); }
|
||||
public double getFormulaMultiplierUnarmed() { return config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); }
|
||||
public double getFormulaMultiplierHerbalism() { return config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); }
|
||||
public double getFormulaMultiplierExcavation() { return config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); }
|
||||
public double getFormulaMultiplierArchery() { return config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); }
|
||||
public double getFormulaMultiplierSwords() { return config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); }
|
||||
public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); }
|
||||
public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); }
|
||||
public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); }
|
||||
|
||||
private boolean doubleDropsDisabled(String skillName) {
|
||||
public boolean getDoubleDropsDisabled(SkillType skill) {
|
||||
String skillName = StringUtils.getCapitalized(skill.toString());
|
||||
ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
|
||||
|
||||
if (section == null) {
|
||||
mcMMO.p.getLogger().warning("The configuration files are outdated!"); //TODO Locale and more descriptive message!
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<String> keys = section.getKeys(false);
|
||||
|
||||
boolean disabled = true;
|
||||
|
||||
for (String key : keys) {
|
||||
@@ -436,8 +162,88 @@ public class Config extends ConfigLoader {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
private int getLevelCap(String configString) {
|
||||
int cap = config.getInt(configString, 0);
|
||||
return ((cap <= 0) ? Integer.MAX_VALUE : cap);
|
||||
/* Acrobatics */
|
||||
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
|
||||
|
||||
/* Fishing */
|
||||
public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); }
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
|
||||
/* Mining */
|
||||
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* Unarmed */
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
|
||||
public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
|
||||
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
||||
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); }
|
||||
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
|
||||
public int getWoodcuttingXPHugeBrownMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Brown", 70); }
|
||||
public int getWoodcuttingXPHugeRedMushroom() { return config.getInt("Experience.Woodcutting.Huge_Mushroom_Red", 70); }
|
||||
|
||||
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
|
||||
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
|
||||
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
|
||||
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
|
||||
|
||||
/* AFK Leveling */
|
||||
public boolean getAcrobaticsAFKDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
|
||||
public boolean getHerbalismAFKDisabled() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
|
||||
|
||||
/* Level Caps */
|
||||
public int getPowerLevelCap() {
|
||||
int cap = config.getInt("General.Power_Level_Cap", 0);
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
public int getLevelCap(SkillType skill) {
|
||||
int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
|
||||
return (cap <= 0) ? Integer.MAX_VALUE : cap;
|
||||
}
|
||||
|
||||
/* PVP & PVE Settings */
|
||||
public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
|
||||
public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); }
|
||||
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience.Gains.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience.Gains.Multiplier.Global", value); }
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); }
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
|
||||
public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); }
|
||||
public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); }
|
||||
|
||||
|
||||
/* XP Formula Multiplier */
|
||||
public int getFormulaMultiplierCurve() { return config.getInt("Experience.Formula.Curve_Modifier", 20); }
|
||||
public double getForumulaMultiplier(SkillType skill) { return config.getDouble("Experience.Formula.Multiplier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.metrics.MetricsManager;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
protected static final mcMMO plugin = mcMMO.p;
|
||||
@@ -38,6 +46,98 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
Set<String> oldKeys = new HashSet<String>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
Set<String> newKeys = new HashSet<String>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
// Don't need a re-save if we have old keys sticking around?
|
||||
// Would be less saving, but less... correct?
|
||||
if (!newKeys.isEmpty() || !oldKeys.isEmpty()) {
|
||||
needSave = true;
|
||||
}
|
||||
|
||||
for (String key : oldKeys) {
|
||||
plugin.debug("Removing unused key: " + key);
|
||||
config.set(key, null);
|
||||
}
|
||||
|
||||
for (String key : newKeys) {
|
||||
plugin.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
config.set(key, internalConfig.get(key));
|
||||
}
|
||||
|
||||
if (needSave) {
|
||||
// Get Bukkit's version of an acceptable config with new keys, and no old keys
|
||||
String output = config.saveToString();
|
||||
|
||||
// Convert to the superior 4 space indentation
|
||||
output = output.replace(" ", " ");
|
||||
|
||||
// Rip out Bukkit's attempt to save comments at the top of the file
|
||||
while (output.indexOf('#') != -1) {
|
||||
output = output.substring(output.indexOf('\n', output.indexOf('#'))+1);
|
||||
}
|
||||
|
||||
// Read the internal config to get comments, then put them in the new one
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
|
||||
HashMap<String, String> comments = new HashMap<String, String>();
|
||||
String temp = "";
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp += line + "\n";
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if(!temp.isEmpty()) {
|
||||
comments.put(line, temp);
|
||||
temp = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
for (String key : comments.keySet()) {
|
||||
if (output.indexOf(key) != -1) {
|
||||
output = output.substring(0, output.indexOf(key)) + comments.get(key) + output.substring(output.indexOf(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Save it
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(plugin.getDataFolder(), fileName)));
|
||||
writer.write(output);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (String key : configKeys) {
|
||||
if (!config.isConfigurationSection(key) && !config.get(key).equals(internalConfig.get(key))) {
|
||||
MetricsManager.customConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void loadKeys();
|
||||
|
||||
@@ -10,6 +10,7 @@ public class HiddenConfig {
|
||||
private static YamlConfiguration config;
|
||||
private static boolean chunkletsEnabled;
|
||||
private static int conversionRate;
|
||||
private static boolean useEnchantmentBuffs;
|
||||
|
||||
public HiddenConfig(String fileName) {
|
||||
HiddenConfig.fileName = fileName;
|
||||
@@ -29,6 +30,7 @@ public class HiddenConfig {
|
||||
config = YamlConfiguration.loadConfiguration(mcMMO.p.getResource(fileName));
|
||||
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
||||
conversionRate = config.getInt("Options.ConversionRate", 1);
|
||||
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +41,8 @@ public class HiddenConfig {
|
||||
public int getConversionRate() {
|
||||
return conversionRate;
|
||||
}
|
||||
|
||||
public boolean useEnchantmentBuffs() {
|
||||
return useEnchantmentBuffs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,4 @@ public class MmoupdateCommand implements CommandExecutor {
|
||||
|
||||
mcMMO.p.getServer().getScheduler().runTaskLaterAsynchronously(mcMMO.p, new SQLConversionTask(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class SQLConversionTask implements Runnable {
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
String playerName = null;
|
||||
String party = null;
|
||||
//String party = null;
|
||||
String mining = null;
|
||||
String woodcutting = null;
|
||||
String repair = null;
|
||||
@@ -63,10 +63,13 @@ public class SQLConversionTask implements Runnable {
|
||||
if (character.length > 1) {
|
||||
mining = character[1];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Looks like we still have party as the 4th string in the array but we don't use it anymore
|
||||
if (character.length > 3) {
|
||||
party = character[3];
|
||||
}
|
||||
*/
|
||||
|
||||
if (character.length > 4) {
|
||||
miningXP = character[4];
|
||||
@@ -231,10 +234,12 @@ public class SQLConversionTask implements Runnable {
|
||||
+ tablePrefix
|
||||
+ "users SET lastlogin = " + 0
|
||||
+ " WHERE id = " + id);
|
||||
/*
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "users SET party = '" + party
|
||||
+ "' WHERE id = " + id);
|
||||
*/
|
||||
Database.write("UPDATE "
|
||||
+ tablePrefix
|
||||
+ "skills SET "
|
||||
|
||||
@@ -12,10 +12,12 @@ import com.gmail.nossr50.mods.datatypes.CustomTool;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.spout.huds.SpoutHud;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McMMOPlayer {
|
||||
private Player player;
|
||||
@@ -49,7 +51,7 @@ public class McMMOPlayer {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.hasPermission("mcmmo.skills." + type.toString().toLowerCase())) {
|
||||
if (Permissions.skillEnabled(player, type)) {
|
||||
powerLevel += profile.getSkillLevel(type);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +66,10 @@ public class McMMOPlayer {
|
||||
* @param xp Experience amount to process
|
||||
*/
|
||||
public void beginXpGain(SkillType skillType, int xp) {
|
||||
if (xp == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Return if the experience has been shared
|
||||
if (party != null && ShareHandler.handleXpShare(xp, this, skillType)) {
|
||||
return;
|
||||
@@ -81,10 +87,6 @@ public class McMMOPlayer {
|
||||
public void beginUnsharedXpGain(SkillType skillType, int xp) {
|
||||
xp = modifyXpGain(skillType, xp);
|
||||
|
||||
if (xp == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
applyXpGain(skillType, xp);
|
||||
}
|
||||
|
||||
@@ -125,7 +127,7 @@ public class McMMOPlayer {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Misc.getPowerLevelCap() < getPowerLevel() + 1)) {
|
||||
if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -140,23 +142,7 @@ public class McMMOPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Too many permission checks here, is there no way to avoid that?
|
||||
if (player.hasPermission("mcmmo.perks.xp.quadruple")) {
|
||||
xp *= 4;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.triple")) {
|
||||
xp *= 3;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
|
||||
xp *= 2.5;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
|
||||
xp *= 2;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) {
|
||||
xp *= 1.5;
|
||||
}
|
||||
|
||||
xp = PerksUtils.handleXpPerks(player, xp);
|
||||
return xp;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public class PlayerProfile {
|
||||
private boolean hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode,
|
||||
pickaxePreparationMode, axePreparationMode;
|
||||
private boolean abilityUse = true;
|
||||
private boolean displaySkillNotifications = true;
|
||||
|
||||
// Timestamps
|
||||
private long recentlyHurt;
|
||||
@@ -129,7 +130,7 @@ public class PlayerProfile {
|
||||
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
|
||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
|
||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
|
||||
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6)));
|
||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(cooldownValues.get(6)));
|
||||
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@ public class PlayerProfile {
|
||||
if (character.length > 30)
|
||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(character[30]));
|
||||
if (character.length > 31)
|
||||
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(character[31]));
|
||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(character[31]));
|
||||
if (character.length > 32)
|
||||
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(character[32]));
|
||||
if (character.length > 33) {
|
||||
@@ -307,7 +308,7 @@ public class PlayerProfile {
|
||||
+ ", herbalism = " + skillsDATS.get(AbilityType.GREEN_TERRA)
|
||||
+ ", excavation = " + skillsDATS.get(AbilityType.GIGA_DRILL_BREAKER)
|
||||
+ ", swords = " + skillsDATS.get(AbilityType.SERRATED_STRIKES)
|
||||
+ ", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER)
|
||||
+ ", axes = " + skillsDATS.get(AbilityType.SKULL_SPLITTER)
|
||||
+ ", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING)
|
||||
+ " WHERE user_id = " + userId);
|
||||
Database.write("UPDATE " + tablePrefix + "skills SET "
|
||||
@@ -390,7 +391,7 @@ public class PlayerProfile {
|
||||
writer.append(skillsDATS.get(AbilityType.TREE_FELLER)).append(":");
|
||||
writer.append(skillsDATS.get(AbilityType.GREEN_TERRA)).append(":");
|
||||
writer.append(skillsDATS.get(AbilityType.SERRATED_STRIKES)).append(":");
|
||||
writer.append(skillsDATS.get(AbilityType.SKULL_SPLIITER)).append(":");
|
||||
writer.append(skillsDATS.get(AbilityType.SKULL_SPLITTER)).append(":");
|
||||
writer.append(skillsDATS.get(AbilityType.SUPER_BREAKER)).append(":");
|
||||
writer.append(hudType.toString()).append(":");
|
||||
writer.append(skills.get(SkillType.FISHING)).append(":");
|
||||
@@ -669,7 +670,7 @@ public class PlayerProfile {
|
||||
case GREEN_TERRA:
|
||||
return greenTerraMode;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
case SKULL_SPLITTER:
|
||||
return skullSplitterMode;
|
||||
|
||||
case TREE_FELLER:
|
||||
@@ -707,7 +708,7 @@ public class PlayerProfile {
|
||||
greenTerraMode = bool;
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
case SKULL_SPLITTER:
|
||||
skullSplitterMode = bool;
|
||||
break;
|
||||
|
||||
@@ -747,7 +748,7 @@ public class PlayerProfile {
|
||||
case GREEN_TERRA:
|
||||
return greenTerraInformed;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
case SKULL_SPLITTER:
|
||||
return skullSplitterInformed;
|
||||
|
||||
case TREE_FELLER:
|
||||
@@ -789,7 +790,7 @@ public class PlayerProfile {
|
||||
greenTerraInformed = bool;
|
||||
break;
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
case SKULL_SPLITTER:
|
||||
skullSplitterInformed = bool;
|
||||
break;
|
||||
|
||||
@@ -830,6 +831,18 @@ public class PlayerProfile {
|
||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ability Notifications
|
||||
*/
|
||||
|
||||
public boolean useChatNotifications() {
|
||||
return displaySkillNotifications;
|
||||
}
|
||||
|
||||
public void toggleChatNotifications() {
|
||||
displaySkillNotifications = !displaySkillNotifications;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cooldowns
|
||||
*/
|
||||
|
||||
@@ -26,11 +26,4 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerExperienceEvent {
|
||||
public int getLevelsGained() {
|
||||
return levelsGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param levelsGained int number of levels gained in this event
|
||||
*/
|
||||
public void setLevelsGained(int levelsGained) {
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
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.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
@@ -30,7 +31,6 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.runnables.StickyPistonTracker;
|
||||
import com.gmail.nossr50.skills.excavation.Excavation;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.mining.Mining;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.Salvage;
|
||||
@@ -44,6 +44,7 @@ import com.gmail.nossr50.skills.woodcutting.Woodcutting;
|
||||
import com.gmail.nossr50.util.BlockChecks;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
@@ -103,7 +104,7 @@ public class BlockListener implements Listener {
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ public class BlockListener implements Listener {
|
||||
/* HERBALISM */
|
||||
if (BlockChecks.canBeGreenTerra(block)) {
|
||||
/* Green Terra */
|
||||
if (profile.getToolPreparationMode(ToolType.HOE) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) {
|
||||
if (profile.getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ public class BlockListener implements Listener {
|
||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||
* Instead, we check it inside the drops handler.
|
||||
*/
|
||||
if (player.hasPermission("mcmmo.skills.herbalism")) {
|
||||
if (Permissions.skillEnabled(player, SkillType.HERBALISM)) {
|
||||
Herbalism.herbalismProcCheck(block, mcMMOPlayer, plugin); //Double drops
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
|
||||
@@ -169,30 +170,18 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.skills.mining") && !mcMMO.placeStore.isTrue(block)) {
|
||||
if (Mining.requiresTool) {
|
||||
if (ItemChecks.isPickaxe(heldItem)) {
|
||||
MiningManager miningManager = new MiningManager(mcMMOPlayer);
|
||||
miningManager.miningBlockCheck(block);
|
||||
else if (BlockChecks.canBeSuperBroken(block) && ItemChecks.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.placeStore.isTrue(block)) {
|
||||
MiningManager miningManager = new MiningManager(mcMMOPlayer);
|
||||
miningManager.miningBlockCheck(block);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
miningManager.miningBlockCheck(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
MiningManager miningManager = new MiningManager(mcMMOPlayer);
|
||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
miningManager.miningBlockCheck(block);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
miningManager.miningBlockCheck(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockChecks.isLog(block) && player.hasPermission("mcmmo.skills.woodcutting") && !mcMMO.placeStore.isTrue(block)) {
|
||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && player.hasPermission("mcmmo.ability.woodcutting.treefeller") && ItemChecks.isAxe(heldItem)) {
|
||||
else if (BlockChecks.isLog(block) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(block)) {
|
||||
if (profile.getAbilityMode(AbilityType.TREE_FELLER) && Permissions.treeFeller(player) && ItemChecks.isAxe(heldItem)) {
|
||||
Woodcutting.beginTreeFeller(mcMMOPlayer, block);
|
||||
}
|
||||
else {
|
||||
@@ -208,22 +197,11 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.skills.excavation") && !mcMMO.placeStore.isTrue(block)) {
|
||||
if (Excavation.requiresTool) {
|
||||
if (ItemChecks.isShovel(heldItem)) {
|
||||
Excavation.excavationProcCheck(block, mcMMOPlayer);
|
||||
else if (BlockChecks.canBeGigaDrillBroken(block) && ItemChecks.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.placeStore.isTrue(block)) {
|
||||
Excavation.excavationProcCheck(block, mcMMOPlayer);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
Excavation.gigaDrillBreaker(mcMMOPlayer, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Excavation.excavationProcCheck(block, mcMMOPlayer);
|
||||
|
||||
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
Excavation.gigaDrillBreaker(mcMMOPlayer, block);
|
||||
}
|
||||
if (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER)) {
|
||||
Excavation.gigaDrillBreaker(mcMMOPlayer, block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,17 +224,17 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getBlock();
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (player.hasPermission("mcmmo.ability.herbalism.hylianluck") && ItemChecks.isSword(heldItem)) {
|
||||
if (Permissions.hylianLuck(player) && ItemChecks.isSword(heldItem)) {
|
||||
Herbalism.hylianLuck(block, player, event);
|
||||
}
|
||||
else if (BlockChecks.canBeFluxMined(block) && ItemChecks.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH) && player.hasPermission("mcmmo.ability.smelting.fluxmining") && !mcMMO.placeStore.isTrue(block)) {
|
||||
else if (BlockChecks.canBeFluxMined(block) && ItemChecks.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH) && Permissions.fluxMining(player) && !mcMMO.placeStore.isTrue(block)) {
|
||||
SmeltingManager smeltingManager = new SmeltingManager(Users.getPlayer(player));
|
||||
smeltingManager.fluxMining(event);
|
||||
}
|
||||
@@ -275,7 +253,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -290,19 +268,30 @@ public class BlockListener implements Listener {
|
||||
if (BlockChecks.canActivateAbilities(block)) {
|
||||
ItemStack heldItem = player.getItemInHand();
|
||||
|
||||
if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && player.hasPermission("mcmmo.ability.herbalism.greenterra")) {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemChecks.isPickaxe(heldItem) && !profile.getAbilityMode(AbilityType.SUPER_BREAKER)) || (ItemChecks.isShovel(heldItem) && !profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER))) {
|
||||
SkillTools.removeAbilityBuff(heldItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((profile.getAbilityMode(AbilityType.SUPER_BREAKER) && !BlockChecks.canBeSuperBroken(block)) || (profile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && !BlockChecks.canBeGigaDrillBroken(block))) {
|
||||
SkillTools.handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.getToolPreparationMode(ToolType.HOE) && ItemChecks.isHoe(heldItem) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.canMakeMossy(block)) && Permissions.greenTerra(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.HERBALISM);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.AXE) && ItemChecks.isAxe(heldItem) && BlockChecks.isLog(block) && player.hasPermission("mcmmo.ability.woodcutting.treefeller")) {
|
||||
else if (profile.getToolPreparationMode(ToolType.AXE) && ItemChecks.isAxe(heldItem) && BlockChecks.isLog(block) && Permissions.treeFeller(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.WOODCUTTING);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemChecks.isPickaxe(heldItem) && BlockChecks.canBeSuperBroken(block) && player.hasPermission("mcmmo.ability.mining.superbreaker")) {
|
||||
else if (profile.getToolPreparationMode(ToolType.PICKAXE) && ItemChecks.isPickaxe(heldItem) && BlockChecks.canBeSuperBroken(block) && Permissions.superBreaker(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.MINING);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker")) {
|
||||
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && Permissions.gigaDrillBreaker(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.EXCAVATION);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW || (block.getType() == Material.SMOOTH_BRICK && block.getData() == 0x0)) && player.hasPermission("mcmmo.ability.unarmed.berserk")) {
|
||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW || (block.getType() == Material.SMOOTH_BRICK && block.getData() == 0x0)) && Permissions.berserk(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
@@ -330,7 +319,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,8 +333,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.
|
||||
*/
|
||||
// Except right here, which is for the Green Thumb activation, not the normal effect of Green Terra
|
||||
if (profile.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canMakeMossy(block) && player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks")) {
|
||||
if (profile.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canMakeMossy(block)) {
|
||||
Herbalism.greenTerra(player, block);
|
||||
}
|
||||
else if (profile.getAbilityMode(AbilityType.BERSERK)) {
|
||||
@@ -359,7 +347,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
// Another perm check for the cracked blocks activation
|
||||
else if (BlockChecks.canBeCracked(block) && player.hasPermission("mcmmo.ability.unarmed.blockcracker")) {
|
||||
else if (BlockChecks.canBeCracked(block) && Permissions.blockCracker(player)) {
|
||||
Unarmed.blockCracker(player, block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,12 @@ public class EntityListener implements Listener {
|
||||
if (entity instanceof FallingBlock) {
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (mcMMO.placeStore.isTrue(block) && !mcMMO.placeStore.isSpawnedMob(entity)) {
|
||||
if (mcMMO.placeStore.isTrue(block) && !entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
mcMMO.placeStore.setFalse(block);
|
||||
mcMMO.placeStore.addSpawnedMob(entity);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata);
|
||||
}
|
||||
else if (mcMMO.placeStore.isSpawnedMob(entity)) {
|
||||
else if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
mcMMO.placeStore.setTrue(block);
|
||||
mcMMO.placeStore.removeSpawnedMob(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,15 +107,23 @@ public class EntityListener implements Listener {
|
||||
if (defender instanceof Player) {
|
||||
Player defendingPlayer = (Player) defender;
|
||||
|
||||
// TODO: Is this even possible?
|
||||
if (!defendingPlayer.isOnline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker instanceof Player && PartyManager.inSameParty(defendingPlayer, (Player) attacker)) {
|
||||
if (!(Permissions.friendlyFire((Player) attacker) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +131,7 @@ public class EntityListener implements Listener {
|
||||
if (defender instanceof LivingEntity) {
|
||||
LivingEntity livingDefender = (LivingEntity) defender;
|
||||
|
||||
if (!Misc.isInvincible(livingDefender, event)) {
|
||||
if (!CombatTools.isInvincible(livingDefender, event)) {
|
||||
CombatTools.combatChecks(event, attacker, livingDefender);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +160,7 @@ public class EntityListener implements Listener {
|
||||
if (livingEntity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
|
||||
if (!player.isOnline() || Misc.isNPCPlayer(player)) {
|
||||
if (!player.isOnline() || Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +173,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Misc.isInvincible(player, event)) {
|
||||
if (!CombatTools.isInvincible(player, event)) {
|
||||
if (cause == DamageCause.FALL && player.getItemInHand().getType() != Material.ENDER_PEARL && !(Acrobatics.afkLevelingDisabled && player.isInsideVehicle()) && Permissions.roll(player)) {
|
||||
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(mcMMOPlayer);
|
||||
acrobaticsManager.rollCheck(event);
|
||||
@@ -185,7 +192,7 @@ public class EntityListener implements Listener {
|
||||
Tameable pet = (Tameable) livingEntity;
|
||||
AnimalTamer owner = pet.getOwner();
|
||||
|
||||
if ((!Misc.isInvincible(livingEntity, event)) && pet.isTamed() && owner instanceof Player && pet instanceof Wolf) {
|
||||
if ((!CombatTools.isInvincible(livingEntity, event)) && pet.isTamed() && owner instanceof Player && pet instanceof Wolf) {
|
||||
TamingManager tamingManager = new TamingManager(Users.getPlayer((Player) owner));
|
||||
tamingManager.preventDamage(event);
|
||||
}
|
||||
@@ -208,7 +215,6 @@ public class EntityListener implements Listener {
|
||||
entity.setFireTicks(0);
|
||||
BleedTimer.remove(entity);
|
||||
Archery.arrowRetrievalCheck(entity);
|
||||
mcMMO.placeStore.removeSpawnedMob(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,11 +227,14 @@ public class EntityListener implements Listener {
|
||||
if (Misc.isSpawnerXPEnabled) {
|
||||
return;
|
||||
}
|
||||
else if (event.getEntity() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnReason reason = event.getSpawnReason();
|
||||
|
||||
if (reason == SpawnReason.SPAWNER || reason == SpawnReason.SPAWNER_EGG) {
|
||||
mcMMO.placeStore.addSpawnedMob(event.getEntity());
|
||||
event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +296,7 @@ public class EntityListener implements Listener {
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,7 +352,7 @@ public class EntityListener implements Listener {
|
||||
public void onEntityTame(EntityTameEvent event) {
|
||||
Player player = (Player) event.getOwner();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,13 +360,13 @@ public class EntityListener implements Listener {
|
||||
tamingManager.awardTamingXP(event);
|
||||
}
|
||||
|
||||
@EventHandler (ignoreCancelled = true)
|
||||
@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();
|
||||
|
||||
if (Misc.isFriendlyPet(player, tameable)) {
|
||||
if (CombatTools.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();
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
@@ -20,7 +19,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@@ -130,10 +128,4 @@ public class InventoryListener implements Listener{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||
ItemStack item = event.getCurrentItem();
|
||||
SkillTools.removeAbilityBuff(item); //Remove enchants if they try to move them in an inventory
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
@@ -58,28 +60,6 @@ public class PlayerListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle PlayerDeath events where the event is modified.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerDeathHigher(PlayerDeathEvent event) {
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
|
||||
|
||||
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
|
||||
for (ItemStack item : event.getDrops()) {
|
||||
SkillTools.removeAbilityBuff(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerDeath events.
|
||||
*
|
||||
@@ -93,11 +73,11 @@ public class PlayerListener implements Listener {
|
||||
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.hardcoremodeBypass(player)) {
|
||||
if (!Permissions.hardcoreBypass(player)) {
|
||||
Player killer = player.getKiller();
|
||||
|
||||
if (killer != null && Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||
@@ -117,7 +97,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,6 +115,24 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor PlayerLogin events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLoginEvent(PlayerLoginEvent event) {
|
||||
if (event.getResult() == Result.ALLOWED) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Users.addUser(player).getProfile().actualizeRespawnATS();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle PlayerDropItem events that involve modifying the event.
|
||||
*
|
||||
@@ -159,7 +157,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerFish(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player) || !Permissions.fishing(player)) {
|
||||
if (Misc.isNPCEntity(player) || !Permissions.skillEnabled(player, SkillType.FISHING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,7 +172,7 @@ public class PlayerListener implements Listener {
|
||||
case CAUGHT_ENTITY:
|
||||
Entity entity = event.getCaught();
|
||||
|
||||
if (entity instanceof LivingEntity && skillLevel >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shakeMob(player)) {
|
||||
if (entity instanceof LivingEntity && skillLevel >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shake(player)) {
|
||||
Fishing.beginShakeMob(player, (LivingEntity) entity, skillLevel);
|
||||
}
|
||||
|
||||
@@ -194,7 +192,7 @@ public class PlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
Item item = event.getItem();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,7 +212,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,13 +229,6 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
/* We can't use the other check here because a profile hasn't been created yet.*/
|
||||
if (player == null || player.hasMetadata("NPC")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Users.addUser(player).getProfile().actualizeRespawnATS();
|
||||
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
Motd.displayAll(player);
|
||||
}
|
||||
@@ -246,7 +237,10 @@ public class PlayerListener implements Listener {
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||
}
|
||||
|
||||
SkillTools.handleAbilitySpeedDecrease(player); //Remove enchants left over in case of disconnect or server crash
|
||||
if (Permissions.updateNotifications(player) && mcMMO.p.updateAvailable) {
|
||||
player.sendMessage(LocaleLoader.getString("UpdateChecker.outdated"));
|
||||
player.sendMessage(LocaleLoader.getString("UpdateChecker.newavailable"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,7 +251,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -273,7 +267,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -285,7 +279,7 @@ public class PlayerListener implements Listener {
|
||||
int blockID = block.getTypeId();
|
||||
|
||||
/* REPAIR CHECKS */
|
||||
if (blockID == Repair.anvilID && Permissions.repair(player) && mcMMO.repairManager.isRepairable(heldItem)) {
|
||||
if (blockID == Repair.anvilID && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairManager.isRepairable(heldItem)) {
|
||||
mcMMO.repairManager.handleRepair(Users.getPlayer(player), heldItem);
|
||||
event.setCancelled(true);
|
||||
player.updateInventory();
|
||||
@@ -297,7 +291,7 @@ public class PlayerListener implements Listener {
|
||||
player.updateInventory();
|
||||
}
|
||||
/* BLAST MINING CHECK */
|
||||
else if (player.isSneaking() && Permissions.blastMining(player) && heldItem.getTypeId() == BlastMining.detonatorID) {
|
||||
else if (player.isSneaking() && Permissions.remoteDetonation(player) && heldItem.getTypeId() == BlastMining.detonatorID) {
|
||||
MiningManager miningManager = new MiningManager(Users.getPlayer(player));
|
||||
miningManager.detonate(event);
|
||||
}
|
||||
@@ -306,7 +300,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
case RIGHT_CLICK_AIR:
|
||||
/* BLAST MINING CHECK */
|
||||
if (player.isSneaking() && Permissions.blastMining(player) && heldItem.getTypeId() == BlastMining.detonatorID) {
|
||||
if (player.isSneaking() && Permissions.remoteDetonation(player) && heldItem.getTypeId() == BlastMining.detonatorID) {
|
||||
MiningManager miningManager = new MiningManager(Users.getPlayer(player));
|
||||
miningManager.detonate(event);
|
||||
}
|
||||
@@ -327,7 +321,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +350,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
/* GREEN THUMB CHECK */
|
||||
if (heldItem.getType() == Material.SEEDS && BlockChecks.canMakeMossy(block) && Permissions.greenThumbBlocks(player)) {
|
||||
if (heldItem.getType() == Material.SEEDS && BlockChecks.canMakeMossy(block)) {
|
||||
Herbalism.greenThumbBlocks(heldItem, player, block);
|
||||
}
|
||||
|
||||
@@ -413,7 +407,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,9 @@ import org.bukkit.Chunk;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
@@ -87,22 +83,4 @@ public class WorldListener implements Listener {
|
||||
|
||||
mcMMO.placeStore.chunkUnloaded(chunk.getX(), chunk.getZ(), event.getWorld());
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor ChunkLoad events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
Chunk chunk = event.getChunk();
|
||||
Entity[] entities = chunk.getEntities();
|
||||
|
||||
for (Entity entity : entities) {
|
||||
if (entity instanceof LivingEntity || entity instanceof FallingBlock) {
|
||||
mcMMO.placeStore.loadChunk(chunk.getX(), chunk.getZ(), event.getWorld(), entities);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
@@ -32,6 +33,7 @@ import com.gmail.nossr50.listeners.EntityListener;
|
||||
import com.gmail.nossr50.listeners.InventoryListener;
|
||||
import com.gmail.nossr50.listeners.PlayerListener;
|
||||
import com.gmail.nossr50.listeners.WorldListener;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mods.config.CustomArmorConfig;
|
||||
import com.gmail.nossr50.mods.config.CustomBlocksConfig;
|
||||
import com.gmail.nossr50.mods.config.CustomEntityConfig;
|
||||
@@ -39,7 +41,6 @@ import com.gmail.nossr50.mods.config.CustomToolsConfig;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.runnables.PartiesLoader;
|
||||
import com.gmail.nossr50.party.runnables.PartyAutoKick;
|
||||
import com.gmail.nossr50.runnables.MobStoreCleaner;
|
||||
import com.gmail.nossr50.runnables.SaveTimer;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairManagerFactory;
|
||||
@@ -49,6 +50,9 @@ import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||
import com.gmail.nossr50.skills.runnables.SkillMonitor;
|
||||
import com.gmail.nossr50.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.spout.SpoutTools;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
import com.gmail.nossr50.util.UpdateCheck;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
@@ -75,18 +79,27 @@ public class mcMMO extends JavaPlugin {
|
||||
private static String usersFile;
|
||||
private static String modDirectory;
|
||||
|
||||
// Update Check
|
||||
public boolean updateAvailable;
|
||||
|
||||
// Spout Check
|
||||
public static boolean spoutEnabled = false;
|
||||
|
||||
// XP Event Check
|
||||
private boolean xpEventEnabled = false;
|
||||
|
||||
// Entity Metadata Values
|
||||
public static FixedMetadataValue entityMetadata;
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
|
||||
/**
|
||||
* Things to be run when the plugin is enabled.
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
p = this;
|
||||
getLogger().setFilter(new LogFilter(this));
|
||||
entityMetadata = new FixedMetadataValue(mcMMO.p, true);
|
||||
setupFilePaths();
|
||||
setupSpout();
|
||||
loadConfigFiles();
|
||||
@@ -120,7 +133,11 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||
|
||||
new MobStoreCleaner(); // Automatically starts and stores itself
|
||||
checkForUpdates();
|
||||
|
||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
||||
Permissions.generateWorldTeleportPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,6 +151,22 @@ public class mcMMO extends JavaPlugin {
|
||||
modDirectory = mainDirectory + "ModConfigs" + File.separator;
|
||||
}
|
||||
|
||||
private void checkForUpdates() {
|
||||
if (Config.getInstance().getUpdateCheckEnabled()) {
|
||||
try {
|
||||
updateAvailable = UpdateCheck.updateAvailable();
|
||||
}
|
||||
catch (Exception e) {
|
||||
updateAvailable = false;
|
||||
}
|
||||
|
||||
if (updateAvailable) {
|
||||
getLogger().info(LocaleLoader.getString("UpdateChecker.outdated"));
|
||||
getLogger().info(LocaleLoader.getString("UpdateChecker.newavailable"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get profile of the player by name.
|
||||
* </br>
|
||||
@@ -291,6 +324,7 @@ public class mcMMO extends JavaPlugin {
|
||||
CommandRegistrationHelper.registerSkillresetCommand();
|
||||
CommandRegistrationHelper.registerHardcoreCommand();
|
||||
CommandRegistrationHelper.registerVampirismCommand();
|
||||
CommandRegistrationHelper.registerMcnotifyCommand();
|
||||
|
||||
// Spout commands
|
||||
CommandRegistrationHelper.registerXplockCommand();
|
||||
@@ -419,4 +453,8 @@ public class mcMMO extends JavaPlugin {
|
||||
public void toggleXpEventEnabled() {
|
||||
xpEventEnabled = !xpEventEnabled;
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
getLogger().info("[Debug] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,10 @@ public final class ModChecks {
|
||||
* @return the block if it exists, null otherwise
|
||||
*/
|
||||
public static CustomBlock getCustomBlock(Block block) {
|
||||
if (!Config.getInstance().getBlockModsEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (!CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
||||
@@ -79,8 +83,9 @@ public final class ModChecks {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom block is a custom block.
|
||||
* Check if a custom block is a mining block.
|
||||
*
|
||||
* @param block The block to check
|
||||
* @return true if the block is custom, false otherwise
|
||||
@@ -99,6 +104,26 @@ public final class ModChecks {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom block is a mining block.
|
||||
*
|
||||
* @param block The block to check
|
||||
* @return true if the block is custom, false otherwise
|
||||
*/
|
||||
public static boolean isCustomExcavationBlock(Block block) {
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
for (CustomBlock b : CustomBlocksConfig.getInstance().customBlocks) {
|
||||
if ((b.getItemID() == block.getTypeId()) && (b.getDataValue() == block.getData())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom block is a leaf block.
|
||||
*
|
||||
|
||||
@@ -16,11 +16,6 @@ public class PartyAcceptCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.accept")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
player = (Player) sender;
|
||||
|
||||
@@ -14,11 +14,6 @@ import com.gmail.nossr50.util.Users;
|
||||
public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.owner")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
Party playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
@@ -13,12 +13,8 @@ public class PartyChangePasswordCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.password")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
unprotectParty(sender, playerParty);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.gmail.nossr50.chat.commands.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PartyCommand implements CommandExecutor {
|
||||
@@ -39,7 +40,7 @@ public class PartyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.party")) {
|
||||
if (!Permissions.party(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -62,6 +63,12 @@ public class PartyCommand implements CommandExecutor {
|
||||
return printUsage();
|
||||
}
|
||||
|
||||
// Can't use this for lock/unlock since they're handled by the same command
|
||||
if (subcommand != PartySubcommandType.LOCK && subcommand != PartySubcommandType.UNLOCK && !Permissions.partySubcommand(sender, subcommand)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (subcommand) {
|
||||
case JOIN:
|
||||
return partyJoinCommand.onCommand(sender, command, label, args);
|
||||
|
||||
@@ -17,11 +17,6 @@ public class PartyCreateCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.create")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
case 3:
|
||||
|
||||
@@ -14,11 +14,6 @@ import com.gmail.nossr50.util.Users;
|
||||
public class PartyDisbandCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.disband")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
Party playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
@@ -23,11 +23,6 @@ public class PartyExpShareCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.party.expshare")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
@@ -21,11 +21,6 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.invite")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!mcMMO.p.getServer().getOfflinePlayer(args[1]).isOnline()) {
|
||||
|
||||
@@ -23,11 +23,6 @@ public class PartyItemShareCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.party.itemshare")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
@@ -23,11 +23,6 @@ public class PartyJoinCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.join")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
case 3:
|
||||
|
||||
@@ -16,11 +16,6 @@ import com.gmail.nossr50.util.Users;
|
||||
public class PartyKickCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.kick")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
Party playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PartyLockCommand implements CommandExecutor {
|
||||
@@ -55,7 +56,7 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
* Handle locking a party.
|
||||
*/
|
||||
private void lockParty(CommandSender sender, Command command) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.lock")) {
|
||||
if (!Permissions.partySubcommand(sender, PartySubcommandType.LOCK)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
* @return true if party is successfully unlocked, false otherwise.
|
||||
*/
|
||||
private void unlockParty(CommandSender sender, Command command) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.unlock")) {
|
||||
if (!Permissions.partySubcommand(sender, PartySubcommandType.UNLOCK)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,6 @@ public class PartyQuitCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.quit")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
player = (Player) sender;
|
||||
|
||||
@@ -15,11 +15,6 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("mcmmo.commands.party.rename")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = Users.getPlayer((Player) sender).getParty();
|
||||
String leaderName = playerParty.getLeader();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.party.commands;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -38,7 +39,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
playerProfile = mcMMOPlayer.getProfile();
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.ptp.toggle")) {
|
||||
if (!Permissions.partyTeleportToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -47,7 +48,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.ptp.acceptall")) {
|
||||
if (!Permissions.partyTeleportAcceptAll(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -63,7 +64,7 @@ public class PtpCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("accept")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.ptp.accept")) {
|
||||
if (!Permissions.partyTeleportAccept(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@@ -118,15 +119,17 @@ public class PtpCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO: Someone want to clarify what's going on with these dynamic permissions?
|
||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
||||
String perm = "mcmmo.commands.ptp.world.";
|
||||
World targetWorld = target.getWorld();
|
||||
World playerWorld = player.getWorld();
|
||||
|
||||
if (!Permissions.hasDynamicPermission(target, perm + "all", "op")) {
|
||||
if (!Permissions.hasDynamicPermission(target, perm + target.getWorld().getName(), "op")) {
|
||||
if (!Permissions.partyTeleportAllWorlds(target)) {
|
||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||
return true;
|
||||
}
|
||||
else if (target.getWorld() != player.getWorld() && !Permissions.hasDynamicPermission(target, perm + player.getWorld().getName(), "op")) {
|
||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.Database;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class McTopAsync implements Runnable {
|
||||
@@ -31,7 +33,7 @@ public class McTopAsync implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.mctop." + query.toLowerCase())) {
|
||||
if (!Permissions.mctop(sender, SkillType.getSkill(query))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class MobStoreCleaner implements Runnable {
|
||||
private int taskID;
|
||||
|
||||
public MobStoreCleaner() {
|
||||
taskID = -1;
|
||||
start();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (taskID >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
||||
taskID = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (taskID < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
||||
taskID = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
mcMMO.placeStore.cleanMobLists();
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,15 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public abstract class SkillCommand implements CommandExecutor {
|
||||
private SkillType skill;
|
||||
protected SkillType skill;
|
||||
private String skillString;
|
||||
|
||||
protected Player player;
|
||||
@@ -49,8 +50,8 @@ public abstract class SkillCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
skillValue = profile.getSkillLevel(skill);
|
||||
isLucky = player.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase());
|
||||
hasEndurance = (player.hasPermission("mcmmo.perks.activationtime.twelveseconds") || player.hasPermission("mcmmo.perks.activationtime.eightseconds") || player.hasPermission("mcmmo.perks.activationtime.fourseconds"));
|
||||
isLucky = Permissions.lucky(sender, skill);
|
||||
hasEndurance = (Permissions.twelveSecondActivationBoost(sender) || Permissions.eightSecondActivationBoost(sender) || Permissions.fourSecondActivationBoost(sender));
|
||||
|
||||
dataCalculations();
|
||||
permissionsCheck();
|
||||
@@ -124,27 +125,13 @@ public abstract class SkillCommand implements CommandExecutor {
|
||||
|
||||
protected String[] calculateLengthDisplayValues() {
|
||||
int maxLength = skill.getAbility().getMaxTicks();
|
||||
int length = 2 + (int) (skillValue / Misc.abilityLengthIncreaseLevel);
|
||||
int enduranceLength = 0;
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.activationtime.twelveseconds")) {
|
||||
enduranceLength = length + 12;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.activationtime.eightseconds")) {
|
||||
enduranceLength = length + 8;
|
||||
}
|
||||
else if (player.hasPermission("mcmmo.perks.activationtime.fourseconds")) {
|
||||
enduranceLength = length + 4;
|
||||
}
|
||||
int length = 2 + (int) (skillValue / SkillTools.abilityLengthIncreaseLevel);
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
|
||||
|
||||
if (maxLength != 0) {
|
||||
if (length > maxLength) {
|
||||
length = maxLength;
|
||||
}
|
||||
|
||||
if (enduranceLength > maxLength) {
|
||||
enduranceLength = maxLength;
|
||||
}
|
||||
}
|
||||
|
||||
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public abstract class SkillManager {
|
||||
protected McMMOPlayer mcMMOPlayer;
|
||||
protected int skillLevel;
|
||||
protected int activationChance;
|
||||
protected SkillType skill;
|
||||
|
||||
public SkillManager(McMMOPlayer mcMMOPlayer, SkillType skill) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.skillLevel = mcMMOPlayer.getProfile().getSkillLevel(skill);
|
||||
this.activationChance = SkillTools.calculateActivationChance(Permissions.lucky(mcMMOPlayer.getPlayer(), skill));
|
||||
this.activationChance = PerksUtils.handleLuckyPerks(mcMMOPlayer.getPlayer(), skill);
|
||||
this.skill = skill;
|
||||
}
|
||||
|
||||
public McMMOPlayer getMcMMOPlayer() {
|
||||
@@ -27,4 +28,8 @@ public abstract class SkillManager {
|
||||
public int getActivationChance() {
|
||||
return activationChance;
|
||||
}
|
||||
|
||||
public SkillType getSkill() {
|
||||
return skill;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@ public class Acrobatics {
|
||||
public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier();
|
||||
public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getAcrobaticsPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getAcrobaticsPVE();
|
||||
|
||||
public static boolean afkLevelingDisabled = Config.getInstance().getAcrobaticsAFKDisabled();
|
||||
public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public abstract class AcrobaticsEventHandler {
|
||||
protected boolean isFatal(int damage) {
|
||||
Player player = manager.getMcMMOPlayer().getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player) || player.getHealth() - damage < 1) {
|
||||
if (Misc.isNPCEntity(player) || player.getHealth() - damage < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.skills.acrobatics;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
@@ -7,6 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||
|
||||
public class DodgeEventHandler extends AcrobaticsEventHandler {
|
||||
protected DodgeEventHandler(AcrobaticsManager manager, EntityDamageEvent event) {
|
||||
@@ -39,7 +41,14 @@ public class DodgeEventHandler extends AcrobaticsEventHandler {
|
||||
|
||||
@Override
|
||||
protected void sendAbilityMessage() {
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
Player dodgingPlayer = mcMMOPlayer.getPlayer();
|
||||
|
||||
ParticleEffectUtils.playDodgeEffect(dodgingPlayer);
|
||||
|
||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||
dodgingPlayer.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class Archery {
|
||||
@@ -26,9 +25,6 @@ public class Archery {
|
||||
public static double dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax();
|
||||
public static int dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getArcheryPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getArcheryPVE();
|
||||
|
||||
public static double distanceXpModifer = 0.025;
|
||||
|
||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||
|
||||
@@ -45,9 +45,9 @@ public class ArcheryCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSkillShot = Permissions.archeryBonus(player);
|
||||
canSkillShot = Permissions.bonusDamage(player, skill);
|
||||
canDaze = Permissions.daze(player);
|
||||
canRetrieve = Permissions.trackArrows(player);
|
||||
canRetrieve = Permissions.arrowRetrieval(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param event The event to modify.
|
||||
*/
|
||||
public void skillShot(EntityDamageEvent event) {
|
||||
if (skillLevel >= Archery.skillShotIncreaseLevel && Permissions.archeryBonus(mcMMOPlayer.getPlayer())) {
|
||||
if (skillLevel >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(mcMMOPlayer.getPlayer(), skill)) {
|
||||
SkillShotEventHandler eventHandler = new SkillShotEventHandler(this, event);
|
||||
|
||||
eventHandler.calculateDamageBonus();
|
||||
|
||||
@@ -3,22 +3,26 @@ package com.gmail.nossr50.skills.archery;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class DazeEventHandler {
|
||||
private ArcheryManager manager;
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private EntityDamageEvent event;
|
||||
private Player defender;
|
||||
|
||||
private final static int DAZE_CHANCE = 50;
|
||||
|
||||
protected int skillModifier;
|
||||
|
||||
protected DazeEventHandler (ArcheryManager manager, EntityDamageEvent event, Player defender) {
|
||||
this.manager = manager;
|
||||
this.mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
this.event = event;
|
||||
this.defender = defender;
|
||||
|
||||
@@ -31,20 +35,21 @@ public class DazeEventHandler {
|
||||
|
||||
protected void handleDazeEffect() {
|
||||
Location location = defender.getLocation();
|
||||
|
||||
if (Misc.getRandom().nextInt(100) > DAZE_CHANCE) {
|
||||
location.setPitch(90);
|
||||
}
|
||||
else {
|
||||
location.setPitch(-90);
|
||||
}
|
||||
location.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||
|
||||
defender.teleport(location);
|
||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||
|
||||
event.setDamage(event.getDamage() + Archery.dazeModifier);
|
||||
}
|
||||
|
||||
protected void sendAbilityMessages() {
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
if (Users.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.skills.axes;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
|
||||
public class Axes {
|
||||
public static int bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax();
|
||||
@@ -20,7 +19,4 @@ public class Axes {
|
||||
public static int greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage();
|
||||
|
||||
public static int skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getAxesPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getAxesPVE();
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public class AxesCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSkullSplitter = Permissions.skullSplitter(player);
|
||||
canCritical = Permissions.criticalHit(player);
|
||||
canBonusDamage = Permissions.axeBonus(player);
|
||||
canImpact = Permissions.impact(player);
|
||||
canCritical = Permissions.criticalStrikes(player);
|
||||
canBonusDamage = Permissions.bonusDamage(player, skill);
|
||||
canImpact = Permissions.armorImpact(player);
|
||||
canGreaterImpact = Permissions.greaterImpact(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.gmail.nossr50.skills.axes;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class CriticalHitEventHandler {
|
||||
private AxeManager manager;
|
||||
@@ -34,10 +37,21 @@ public class CriticalHitEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessages() {
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
Player attacker = mcMMOPlayer.getPlayer();
|
||||
|
||||
attacker.playEffect(defender.getEyeLocation(), Effect.MOBSPAWNER_FLAMES, 0);
|
||||
|
||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||
attacker.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
}
|
||||
|
||||
if (defender instanceof Player) {
|
||||
((Player) defender).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
Player defendingPlayer = (Player) defender;
|
||||
|
||||
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
|
||||
defendingPlayer.sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mods.ModChecks;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ImpactEventHandler {
|
||||
private AxeManager manager;
|
||||
@@ -81,14 +83,22 @@ public class ImpactEventHandler {
|
||||
|
||||
private void handleGreaterImpactEffect() {
|
||||
event.setDamage(event.getDamage() + Axes.greaterImpactBonusDamage);
|
||||
|
||||
ParticleEffectUtils.playGreaterImpactEffect(defender);
|
||||
defender.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||
}
|
||||
|
||||
private void sendAbilityMessge() {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||
if (manager.getMcMMOPlayer().getProfile().useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||
}
|
||||
|
||||
if (defender instanceof Player) {
|
||||
((Player) defender).sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||
Player defendingPlayer = (Player) defender;
|
||||
|
||||
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
|
||||
defendingPlayer.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,12 @@ import com.gmail.nossr50.config.TreasuresConfig;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.mods.ModChecks;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class Excavation {
|
||||
public static boolean requiresTool = Config.getInstance().getExcavationRequiresTool();
|
||||
|
||||
/**
|
||||
* Check to see if treasures were found.
|
||||
@@ -29,46 +28,16 @@ public class Excavation {
|
||||
*/
|
||||
public static void excavationProcCheck(Block block, McMMOPlayer mcMMOPlayer) {
|
||||
Material material = block.getType();
|
||||
int xp;
|
||||
int xp = Config.getInstance().getXp(SkillType.EXCAVATION, material);
|
||||
|
||||
switch (material) {
|
||||
case CLAY:
|
||||
xp = Config.getInstance().getExcavationClayXP();
|
||||
break;
|
||||
|
||||
case DIRT:
|
||||
xp = Config.getInstance().getExcavationDirtXP();
|
||||
break;
|
||||
|
||||
case GRASS:
|
||||
xp = Config.getInstance().getExcavationGrassXP();
|
||||
break;
|
||||
|
||||
case GRAVEL:
|
||||
xp = Config.getInstance().getExcavationGravelXP();
|
||||
break;
|
||||
|
||||
case MYCEL:
|
||||
xp = Config.getInstance().getExcavationMycelXP();
|
||||
break;
|
||||
|
||||
case SAND:
|
||||
xp = Config.getInstance().getExcavationSandXP();
|
||||
break;
|
||||
|
||||
case SOUL_SAND:
|
||||
xp = Config.getInstance().getExcavationSoulSandXP();
|
||||
break;
|
||||
|
||||
default:
|
||||
xp = ModChecks.getCustomBlock(block).getXpGain();;
|
||||
break;
|
||||
if (xp == 0 && ModChecks.isCustomExcavationBlock(block)) {
|
||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
||||
}
|
||||
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
List<ExcavationTreasure> treasures = new ArrayList<ExcavationTreasure>();
|
||||
|
||||
if (Permissions.excavationTreasures(player)) {
|
||||
if (Permissions.excavationTreasureHunter(player)) {
|
||||
switch (material) {
|
||||
case DIRT:
|
||||
treasures = TreasuresConfig.getInstance().excavationFromDirt;
|
||||
@@ -106,7 +75,7 @@ public class Excavation {
|
||||
|
||||
for (ExcavationTreasure treasure : treasures) {
|
||||
if (mcMMOPlayer.getProfile().getSkillLevel(SkillType.EXCAVATION) >= treasure.getDropLevel()) {
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyExcavation(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.EXCAVATION);
|
||||
|
||||
if (Misc.getRandom().nextDouble() * activationChance <= treasure.getDropChance()) {
|
||||
xp += treasure.getXp();
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player);
|
||||
canTreasureHunt = Permissions.excavationTreasures(player);
|
||||
canTreasureHunt = Permissions.excavationTreasureHunter(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.gmail.nossr50.config.TreasuresConfig;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
@@ -118,7 +119,7 @@ public final class Fishing {
|
||||
treasureXp = treasure.getXp();
|
||||
ItemStack treasureDrop = treasure.getDrop();
|
||||
|
||||
if (Permissions.fishingMagic(player) && beginMagicHunter(player, skillLevel, treasureDrop, player.getWorld().hasStorm())) {
|
||||
if (Permissions.magicHunter(player) && beginMagicHunter(player, skillLevel, treasureDrop, player.getWorld().hasStorm())) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.MagicFound"));
|
||||
}
|
||||
|
||||
@@ -129,7 +130,9 @@ public final class Fishing {
|
||||
}
|
||||
|
||||
mcMMOPlayer.beginXpGain(SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp);
|
||||
event.setExpToDrop(event.getExpToDrop() * getVanillaXpMultiplier(skillLevel));
|
||||
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
|
||||
event.setExpToDrop(event.getExpToDrop() * getVanillaXpMultiplier(skillLevel));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,7 +143,7 @@ public final class Fishing {
|
||||
* @return Chosen treasure
|
||||
*/
|
||||
private static FishingTreasure checkForTreasure(Player player, int skillLevel) {
|
||||
if (!Config.getInstance().getFishingDropsEnabled() || !Permissions.fishingTreasures(player)) {
|
||||
if (!Config.getInstance().getFishingDropsEnabled() || !Permissions.fishingTreasureHunter(player)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -160,7 +163,7 @@ public final class Fishing {
|
||||
|
||||
FishingTreasure treasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
|
||||
ItemStack treasureDrop = treasure.getDrop();
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyFishing(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.FISHING);
|
||||
|
||||
if (Misc.getRandom().nextDouble() * activationChance > treasure.getDropChance()) {
|
||||
return null;
|
||||
@@ -189,7 +192,7 @@ public final class Fishing {
|
||||
return false;
|
||||
}
|
||||
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyFishing(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.FISHING);
|
||||
|
||||
if (storm) {
|
||||
activationChance = (int) (activationChance * 0.909);
|
||||
|
||||
@@ -51,9 +51,9 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canTreasureHunt = Permissions.fishingTreasures(player);
|
||||
canMagicHunt = Permissions.fishingMagic(player);
|
||||
canShake = Permissions.shakeMob(player);
|
||||
canTreasureHunt = Permissions.fishingTreasureHunter(player);
|
||||
canMagicHunt = Permissions.magicHunter(player);
|
||||
canShake = Permissions.shake(player);
|
||||
canFishermansDiet = Permissions.fishermansDiet(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.gmail.nossr50.skills.fishing.Fishing.Tier;
|
||||
import com.gmail.nossr50.skills.utilities.CombatTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public final class ShakeMob {
|
||||
private ShakeMob() {}
|
||||
@@ -33,7 +33,7 @@ public final class ShakeMob {
|
||||
* @param skillLevel Fishing level of the player
|
||||
*/
|
||||
public static void process(Player player, LivingEntity mob, int skillLevel) {
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyFishing(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.FISHING);
|
||||
|
||||
if (getShakeProbability(skillLevel) <= Misc.getRandom().nextInt(activationChance)) {
|
||||
return;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mods.ModChecks;
|
||||
import com.gmail.nossr50.mods.datatypes.CustomBlock;
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
@@ -44,15 +45,9 @@ public class Herbalism {
|
||||
|
||||
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
|
||||
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
|
||||
public static boolean doubleDropsDisabled = Config.getInstance().herbalismDoubleDropsDisabled();
|
||||
|
||||
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
|
||||
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();
|
||||
|
||||
public static boolean greenTerraWalls = Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall();
|
||||
public static boolean greenTerraSmoothBrick = Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy();
|
||||
public static boolean greenTerraDirt = Config.getInstance().getHerbalismGreenThumbDirtToGrass();
|
||||
public static boolean greenTerraCobble = Config.getInstance().getHerbalismGreenThumbCobbleToMossy();
|
||||
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLuckMaxLevel();
|
||||
|
||||
/**
|
||||
* Handle the farmers diet skill.
|
||||
@@ -90,32 +85,28 @@ public class Herbalism {
|
||||
}
|
||||
|
||||
public static void greenTerraConvert(Player player, Block block) {
|
||||
if (Misc.blockBreakSimulate(block, player, false)) {
|
||||
if (SkillTools.blockBreakSimulate(block, player, false)) {
|
||||
Material type = block.getType();
|
||||
|
||||
if (!Permissions.greenThumbBlock(player, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SMOOTH_BRICK:
|
||||
if (greenTerraSmoothBrick && block.getData() == 0x0) {
|
||||
block.setData((byte) 0x1);
|
||||
}
|
||||
block.setData((byte) 0x1);
|
||||
return;
|
||||
|
||||
case DIRT:
|
||||
if (greenTerraDirt) {
|
||||
block.setType(Material.GRASS);
|
||||
}
|
||||
block.setType(Material.GRASS);
|
||||
return;
|
||||
|
||||
case COBBLESTONE:
|
||||
if (greenTerraCobble) {
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
}
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
return;
|
||||
|
||||
case COBBLE_WALL:
|
||||
if (greenTerraWalls && block.getData() == 0x0) {
|
||||
block.setData((byte) 0x1);
|
||||
}
|
||||
block.setData((byte) 0x1);
|
||||
return;
|
||||
|
||||
default:
|
||||
@@ -189,8 +180,8 @@ public class Herbalism {
|
||||
xp = customBlock.getXpGain();
|
||||
}
|
||||
|
||||
if (Permissions.herbalismDoubleDrops(player)) {
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||
if (Permissions.doubleDrops(player, SkillType.HERBALISM)) {
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
double chance = (doubleDropsMaxChance / doubleDropsMaxLevel) * SkillTools.skillCheck(herbLevel, doubleDropsMaxLevel);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
@@ -204,7 +195,7 @@ public class Herbalism {
|
||||
int maximumDropAmount = customBlock.getMaximumDropAmount();
|
||||
|
||||
if (minimumDropAmount != maximumDropAmount) {
|
||||
Misc.randomDropItems(location, dropItem, 50, maximumDropAmount - minimumDropAmount);
|
||||
Misc.randomDropItems(location, dropItem, maximumDropAmount - minimumDropAmount);
|
||||
}
|
||||
|
||||
Misc.dropItems(location, dropItem, minimumDropAmount);
|
||||
@@ -254,7 +245,7 @@ public class Herbalism {
|
||||
return;
|
||||
}
|
||||
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
float chance = (float) (greenThumbMaxChance / greenThumbMaxLevel * herbLevel);
|
||||
|
||||
if (chance > greenThumbMaxChance) {
|
||||
@@ -301,7 +292,7 @@ public class Herbalism {
|
||||
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
|
||||
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
|
||||
float chance = (float) ((greenThumbMaxChance / greenThumbMaxLevel) * skillLevel);
|
||||
if (chance > greenThumbMaxChance) chance = (float) greenThumbMaxChance;
|
||||
@@ -318,7 +309,7 @@ public class Herbalism {
|
||||
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.HERBALISM);
|
||||
|
||||
double chance = (hylianLuckMaxChance / hylianLuckMaxLevel) * SkillTools.skillCheck(skillLevel, hylianLuckMaxLevel);
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
List<HylianTreasure> treasures = new ArrayList<HylianTreasure>();
|
||||
|
||||
@@ -8,46 +8,43 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public enum HerbalismBlock {
|
||||
BROWN_MUSHROOM(Material.BROWN_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getBrownMushroomsDoubleDropsEnabled()),
|
||||
CACTUS(Material.CACTUS, Config.getInstance().getHerbalismXPCactus(), Config.getInstance().getCactiDoubleDropsEnabled()),
|
||||
CARROT(Material.CARROT, Material.CARROT_ITEM, Config.getInstance().getHerbalismXPCarrot(), Config.getInstance().getCarrotDoubleDropsEnabled()),
|
||||
COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), Config.getInstance().getHerbalismXPCocoa(), Config.getInstance().getCocoaDoubleDropsEnabled()),
|
||||
CROPS(Material.CROPS, Material.WHEAT, Config.getInstance().getHerbalismXPWheat(), Config.getInstance().getWheatDoubleDropsEnabled()),
|
||||
MELON_BLOCK(Material.MELON_BLOCK, Material.MELON, Config.getInstance().getHerbalismXPMelon(), Config.getInstance().getMelonsDoubleDropsEnabled()),
|
||||
NETHER_WARTS(Material.NETHER_WARTS, Material.NETHER_STALK, Config.getInstance().getHerbalismXPNetherWart(), Config.getInstance().getNetherWartsDoubleDropsEnabled()),
|
||||
POTATO(Material.POTATO, Material.POTATO_ITEM, Config.getInstance().getHerbalismXPPotato(), Config.getInstance().getPotatoDoubleDropsEnabled()),
|
||||
PUMPKIN(Material.PUMPKIN, Config.getInstance().getHerbalismXPPumpkin(), Config.getInstance().getPumpkinsDoubleDropsEnabled()),
|
||||
RED_MUSHROOM(Material.RED_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getRedMushroomsDoubleDropsEnabled()),
|
||||
RED_ROSE(Material.RED_ROSE, Config.getInstance().getHerbalismXPFlowers(), Config.getInstance().getRedRosesDoubleDropsEnabled()),
|
||||
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, Material.SUGAR_CANE, Config.getInstance().getHerbalismXPSugarCane(), Config.getInstance().getSugarCaneDoubleDropsEnabled()),
|
||||
VINE(Material.VINE, Config.getInstance().getHerbalismXPVines(), Config.getInstance().getVinesDoubleDropsEnabled()),
|
||||
WATER_LILY(Material.WATER_LILY, Config.getInstance().getHerbalismXPLilyPads(), Config.getInstance().getWaterLiliesDoubleDropsEnabled()),
|
||||
YELLOW_FLOWER(Material.YELLOW_FLOWER, Config.getInstance().getHerbalismXPFlowers(), Config.getInstance().getYellowFlowersDoubleDropsEnabled());
|
||||
BROWN_MUSHROOM(Material.BROWN_MUSHROOM),
|
||||
CACTUS(Material.CACTUS),
|
||||
CARROT(Material.CARROT, Material.CARROT_ITEM),
|
||||
COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData())),
|
||||
CROPS(Material.CROPS, Material.WHEAT),
|
||||
MELON_BLOCK(Material.MELON_BLOCK, Material.MELON),
|
||||
NETHER_WARTS(Material.NETHER_WARTS, Material.NETHER_STALK),
|
||||
POTATO(Material.POTATO, Material.POTATO_ITEM),
|
||||
PUMPKIN(Material.PUMPKIN),
|
||||
RED_MUSHROOM(Material.RED_MUSHROOM),
|
||||
RED_ROSE(Material.RED_ROSE),
|
||||
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, Material.SUGAR_CANE),
|
||||
VINE(Material.VINE),
|
||||
WATER_LILY(Material.WATER_LILY),
|
||||
YELLOW_FLOWER(Material.YELLOW_FLOWER);
|
||||
|
||||
private Material blockType;
|
||||
private ItemStack dropItem;
|
||||
private int xpGain;
|
||||
private boolean doubleDropsEnabled;
|
||||
private final static Map<Material, HerbalismBlock> BY_MATERIAL = Maps.newHashMap();
|
||||
|
||||
private HerbalismBlock(Material blockType, int xpGain, boolean doubleDropsEnabled) {
|
||||
this(blockType, new ItemStack(blockType), xpGain, doubleDropsEnabled);
|
||||
private HerbalismBlock(Material blockType) {
|
||||
this(blockType, new ItemStack(blockType));
|
||||
}
|
||||
|
||||
private HerbalismBlock(Material blockType, Material dropType, int xpGain, boolean doubleDropsEnabled) {
|
||||
this(blockType, new ItemStack(dropType), xpGain, doubleDropsEnabled);
|
||||
private HerbalismBlock(Material blockType, Material dropType) {
|
||||
this(blockType, new ItemStack(dropType));
|
||||
}
|
||||
|
||||
private HerbalismBlock(Material blockType, ItemStack dropItem, int xpGain, boolean doubleDropsEnabled) {
|
||||
private HerbalismBlock(Material blockType, ItemStack dropItem) {
|
||||
this.blockType = blockType;
|
||||
this.dropItem = dropItem;
|
||||
this.xpGain = xpGain;
|
||||
this.doubleDropsEnabled = doubleDropsEnabled;
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -61,28 +58,15 @@ public enum HerbalismBlock {
|
||||
}
|
||||
|
||||
public int getXpGain() {
|
||||
return xpGain;
|
||||
return Config.getInstance().getXp(SkillType.HERBALISM, blockType);
|
||||
}
|
||||
|
||||
public boolean canDoubleDrop() {
|
||||
return doubleDropsEnabled;
|
||||
return Config.getInstance().getDoubleDropsEnabled(SkillType.HERBALISM, blockType);
|
||||
}
|
||||
|
||||
public boolean hasGreenThumbPermission(Player player) {
|
||||
switch (this) {
|
||||
case CARROT:
|
||||
return Permissions.greenThumbCarrots(player);
|
||||
case COCOA:
|
||||
return Permissions.greenThumbCocoa(player);
|
||||
case CROPS:
|
||||
return Permissions.greenThumbWheat(player);
|
||||
case POTATO:
|
||||
return Permissions.greenThumbPotatoes(player);
|
||||
case NETHER_WARTS:
|
||||
return Permissions.greenThumbNetherwart(player);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return Permissions.greenThumbPlant(player, blockType);
|
||||
}
|
||||
|
||||
public static HerbalismBlock getHerbalismBlock(Material blockType) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.skills.herbalism;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillCommand;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
@@ -61,11 +63,11 @@ public class HerbalismCommand extends SkillCommand {
|
||||
protected void permissionsCheck() {
|
||||
hasHylianLuck = Permissions.hylianLuck(player);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbWheat = Permissions.greenThumbWheat(player);
|
||||
canGreenThumbBlocks = Permissions.greenThumbBlocks(player);
|
||||
canGreenThumbWheat = Permissions.greenThumbPlant(player, Material.CROPS); //TODO: This isn't really accurate - they could have perms for other crops but not wheat.
|
||||
canGreenThumbBlocks = (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK));
|
||||
canFarmersDiet = Permissions.farmersDiet(player);
|
||||
canDoubleDrop = Permissions.herbalismDoubleDrops(player);
|
||||
doubleDropsDisabled = Herbalism.doubleDropsDisabled;
|
||||
canDoubleDrop = Permissions.doubleDrops(player, skill);
|
||||
doubleDropsDisabled = skill.getDoubleDropsDisabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@@ -18,13 +17,9 @@ import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class Mining {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private static Config config = Config.getInstance();
|
||||
|
||||
public static int doubleDropsMaxLevel = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
public static double doubleDropsMaxChance = advancedConfig.getMiningDoubleDropChance();
|
||||
public static boolean doubleDropsDisabled = config.miningDoubleDropsDisabled();
|
||||
|
||||
public static boolean requiresTool = Config.getInstance().getMiningRequiresTool();
|
||||
|
||||
public static final int DIAMOND_TOOL_TIER = 4;
|
||||
public static final int IRON_TOOL_TIER = 3;
|
||||
@@ -37,71 +32,13 @@ public class Mining {
|
||||
* @param block The block to award XP for
|
||||
*/
|
||||
protected static void miningXP(McMMOPlayer mcMMOPlayer, Block block, Material type) {
|
||||
int xp = 0;
|
||||
int xp = Config.getInstance().getXp(SkillType.MINING, type);
|
||||
|
||||
switch (type) {
|
||||
case COAL_ORE:
|
||||
xp += config.getMiningXPCoalOre();
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
xp += config.getMiningXPDiamondOre();
|
||||
break;
|
||||
|
||||
case ENDER_STONE:
|
||||
xp += config.getMiningXPEndStone();
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
xp += config.getMiningXPRedstoneOre();
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
xp += config.getMiningXPGlowstone();
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
xp += config.getMiningXPGoldOre();
|
||||
break;
|
||||
|
||||
case IRON_ORE:
|
||||
xp += config.getMiningXPIronOre();
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
xp += config.getMiningXPLapisOre();
|
||||
break;
|
||||
|
||||
case MOSSY_COBBLESTONE:
|
||||
xp += config.getMiningXPMossyStone();
|
||||
break;
|
||||
|
||||
case NETHERRACK:
|
||||
xp += config.getMiningXPNetherrack();
|
||||
break;
|
||||
|
||||
case OBSIDIAN:
|
||||
xp += config.getMiningXPObsidian();
|
||||
break;
|
||||
|
||||
case SANDSTONE:
|
||||
xp += config.getMiningXPSandstone();
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
xp += config.getMiningXPStone();
|
||||
break;
|
||||
|
||||
case EMERALD_ORE:
|
||||
xp += config.getMiningXPEmeraldOre();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
xp += ModChecks.getCustomBlock(block).getXpGain();
|
||||
}
|
||||
break;
|
||||
if (type == Material.GLOWING_REDSTONE_ORE) {
|
||||
xp = Config.getInstance().getXp(SkillType.MINING, Material.REDSTONE_ORE);
|
||||
}
|
||||
else if (xp == 0 && ModChecks.isCustomMiningBlock(block)) {
|
||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
||||
}
|
||||
|
||||
mcMMOPlayer.beginXpGain(SkillType.MINING, xp);
|
||||
@@ -117,6 +54,10 @@ public class Mining {
|
||||
protected static void silkTouchDrops(Block block, Location location, Material type) {
|
||||
ItemStack item = new ItemStack(type);
|
||||
|
||||
if (type != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case ENDER_STONE:
|
||||
case GOLD_ORE:
|
||||
@@ -128,52 +69,25 @@ public class Mining {
|
||||
miningDrops(block, location, type);
|
||||
break;
|
||||
|
||||
case COAL_ORE:
|
||||
if (config.getCoalDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
if (config.getDiamondDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
case REDSTONE_ORE:
|
||||
if (config.getRedstoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
if (config.getGlowstoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
if (config.getLapisDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
if (config.getStoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case EMERALD_ORE:
|
||||
if (config.getEmeraldDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ModChecks.isCustomMiningBlock(block)) {
|
||||
ItemStack dropItem = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
ItemStack dropItem = new ItemStack(block.getTypeId(), 1, block.getData());
|
||||
|
||||
Misc.dropItem(location, dropItem);
|
||||
}
|
||||
@@ -189,33 +103,31 @@ public class Mining {
|
||||
* @param type The material type of the block
|
||||
*/
|
||||
protected static void miningDrops(Block block, Location location, Material type) {
|
||||
if (type != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item = new ItemStack(type);
|
||||
|
||||
switch (type) {
|
||||
case COAL_ORE:
|
||||
if (config.getCoalDoubleDropsEnabled()) {
|
||||
item = (new MaterialData(Material.COAL, CoalType.COAL.getData())).toItemStack(1);
|
||||
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
item = new ItemStack(Material.COAL, 1, CoalType.COAL.getData());
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
if (config.getDiamondDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.DIAMOND);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
item = new ItemStack(Material.DIAMOND);
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
case ENDER_STONE:
|
||||
if (config.getEndStoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
case EMERALD_ORE:
|
||||
item = new ItemStack(Material.EMERALD);
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
if (config.getRedstoneDoubleDropsEnabled()) {
|
||||
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
|
||||
item = new ItemStack(Material.REDSTONE);
|
||||
Misc.dropItems(location, item, 4);
|
||||
Misc.randomDropItem(location, item, 50);
|
||||
@@ -223,69 +135,30 @@ public class Mining {
|
||||
break;
|
||||
|
||||
case GLOWSTONE:
|
||||
if (config.getGlowstoneDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.GLOWSTONE_DUST);
|
||||
Misc.dropItems(location, item, 2);
|
||||
Misc.randomDropItems(location, item, 50, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
if (config.getGoldDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case IRON_ORE:
|
||||
if (config.getIronDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
item = new ItemStack(Material.GLOWSTONE_DUST);
|
||||
Misc.dropItems(location, item, 2);
|
||||
Misc.randomDropItems(location, item, 2);
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
if (config.getLapisDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.INK_SACK, 1, DyeColor.BLUE.getDyeData());
|
||||
Misc.dropItems(location, item, 4);
|
||||
Misc.randomDropItems(location, item, 50, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case MOSSY_COBBLESTONE:
|
||||
if (config.getMossyCobblestoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case NETHERRACK:
|
||||
if (config.getNetherrackDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case OBSIDIAN:
|
||||
if (config.getObsidianDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case SANDSTONE:
|
||||
if (config.getSandstoneDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
item = new ItemStack(Material.INK_SACK, 1, DyeColor.BLUE.getDyeData());
|
||||
Misc.dropItems(location, item, 4);
|
||||
Misc.randomDropItems(location, item, 4);
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
if (config.getStoneDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.COBBLESTONE);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
item = new ItemStack(Material.COBBLESTONE);
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
case EMERALD_ORE:
|
||||
if (config.getEmeraldDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.EMERALD);
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
case ENDER_STONE:
|
||||
case GOLD_ORE:
|
||||
case IRON_ORE:
|
||||
case MOSSY_COBBLESTONE:
|
||||
case NETHERRACK:
|
||||
case OBSIDIAN:
|
||||
case SANDSTONE:
|
||||
Misc.dropItem(location, item);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -298,7 +171,7 @@ public class Mining {
|
||||
|
||||
if (minimumDropAmount != maximumDropAmount) {
|
||||
Misc.dropItems(location, item, minimumDropAmount);
|
||||
Misc.randomDropItems(location, item, 50, maximumDropAmount - minimumDropAmount);
|
||||
Misc.randomDropItems(location, item, maximumDropAmount - minimumDropAmount);
|
||||
}
|
||||
else {
|
||||
Misc.dropItems(location, item, minimumDropAmount);
|
||||
|
||||
@@ -88,11 +88,11 @@ public class MiningCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBiggerBombs = Permissions.biggerBombs(player);
|
||||
canBlast = Permissions.blastMining(player);
|
||||
canBlast = Permissions.remoteDetonation(player);
|
||||
canDemoExpert = Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = Permissions.miningDoubleDrops(player);
|
||||
canDoubleDrop = Permissions.doubleDrops(player, skill);
|
||||
canSuperBreaker = Permissions.superBreaker(player);
|
||||
doubleDropsDisabled = Mining.doubleDropsDisabled;
|
||||
doubleDropsDisabled = skill.getDoubleDropsDisabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -36,7 +37,7 @@ public class MiningManager extends SkillManager{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Misc.blockBreakSimulate(eventHandler.getBlock(), mcMMOPlayer.getPlayer(), true)) {
|
||||
if (!SkillTools.blockBreakSimulate(eventHandler.getBlock(), mcMMOPlayer.getPlayer(), true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ public class MiningManager extends SkillManager{
|
||||
* @param event Event whose explosion is being processed
|
||||
*/
|
||||
public void blastMiningDropProcessing(EntityExplodeEvent event) {
|
||||
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
|
||||
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public class MiningManager extends SkillManager{
|
||||
* @param event Event whose explosion radius is being changed
|
||||
*/
|
||||
public void biggerBombs(ExplosionPrimeEvent event) {
|
||||
if (Misc.isNPCPlayer(mcMMOPlayer.getPlayer())) {
|
||||
if (Misc.isNPCEntity(mcMMOPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class MiningManager extends SkillManager{
|
||||
MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
|
||||
eventHandler.processXPGain();
|
||||
|
||||
if (!Permissions.miningDoubleDrops(mcMMOPlayer.getPlayer())) {
|
||||
if (!Permissions.doubleDrops(mcMMOPlayer.getPlayer(), skill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -110,7 +110,7 @@ public class Repair {
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
Enchantment enchantment = enchant.getKey();
|
||||
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyRepair(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.REPAIR);
|
||||
|
||||
if (Misc.getRandom().nextInt(activationChance) <= getEnchantChance(rank)) {
|
||||
int enchantLevel = enchant.getValue();
|
||||
@@ -237,9 +237,9 @@ public class Repair {
|
||||
int chance = (int) ((SUPER_REPAIR_CHANCE_MAX / SUPER_REPAIR_MAX_BONUS_LEVEL) * skillLevel);
|
||||
if (skillLevel >= SUPER_REPAIR_MAX_BONUS_LEVEL) chance = (int) SUPER_REPAIR_CHANCE_MAX;
|
||||
|
||||
int activationChance = SkillTools.calculateActivationChance(Permissions.luckyRepair(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.REPAIR);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance) && Permissions.repairBonus(player)) {
|
||||
if (chance > Misc.getRandom().nextInt(activationChance) && Permissions.superRepair(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,17 +69,17 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canSuperRepair = Permissions.repairBonus(player);
|
||||
canSuperRepair = Permissions.superRepair(player);
|
||||
canMasterRepair = Permissions.repairMastery(player);
|
||||
canArcaneForge = Permissions.arcaneForging(player);
|
||||
canSalvage = Permissions.salvage(player);
|
||||
canRepairDiamond = Permissions.diamondRepair(player);
|
||||
canRepairGold = Permissions.goldRepair(player);
|
||||
canRepairIron = Permissions.ironRepair(player);
|
||||
canRepairStone = Permissions.stoneRepair(player);
|
||||
canRepairString = Permissions.stringRepair(player);
|
||||
canRepairLeather = Permissions.leatherRepair(player);
|
||||
canRepairWood = Permissions.woodRepair(player);
|
||||
canRepairDiamond = Permissions.repairDiamond(player);
|
||||
canRepairGold = Permissions.repairGold(player);
|
||||
canRepairIron = Permissions.repairIron(player);
|
||||
canRepairStone = Permissions.repairStone(player);
|
||||
canRepairString = Permissions.repairString(player);
|
||||
canRepairLeather = Permissions.repairLeather(player);
|
||||
canRepairWood = Permissions.repairWood(player);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ public enum RepairItemType {
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case ARMOR:
|
||||
return Permissions.armorRepair(player);
|
||||
return Permissions.repairArmor(player);
|
||||
|
||||
case TOOL:
|
||||
return Permissions.toolRepair(player);
|
||||
return Permissions.repairTools(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.otherRepair(player);
|
||||
return Permissions.repairOtherItems(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -23,28 +23,28 @@ public enum RepairMaterialType {
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Permissions.stringRepair(player);
|
||||
return Permissions.repairString(player);
|
||||
|
||||
case LEATHER:
|
||||
return Permissions.leatherRepair(player);
|
||||
return Permissions.repairLeather(player);
|
||||
|
||||
case WOOD:
|
||||
return Permissions.woodRepair(player);
|
||||
return Permissions.repairWood(player);
|
||||
|
||||
case STONE:
|
||||
return Permissions.stoneRepair(player);
|
||||
return Permissions.repairStone(player);
|
||||
|
||||
case IRON:
|
||||
return Permissions.ironRepair(player);
|
||||
return Permissions.repairIron(player);
|
||||
|
||||
case GOLD:
|
||||
return Permissions.goldRepair(player);
|
||||
return Permissions.repairGold(player);
|
||||
|
||||
case DIAMOND:
|
||||
return Permissions.diamondRepair(player);
|
||||
return Permissions.repairDiamond(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.otherMaterialRepair(player);
|
||||
return Permissions.repairOtherMaterials(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@@ -161,16 +160,10 @@ public class SimpleRepairManager implements RepairManager {
|
||||
* @param index Item index to decrement
|
||||
*/
|
||||
private void removeOneFrom(PlayerInventory inventory, int index) {
|
||||
ItemStack item = inventory.getItem(index);
|
||||
if (item.getAmount() > 1) {
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
}
|
||||
else {
|
||||
item = new ItemStack(Material.AIR);
|
||||
}
|
||||
ItemStack item = inventory.getItem(index).clone();
|
||||
item.setAmount(1);
|
||||
|
||||
// I suspect this may not be needed, but I don't think it hurts
|
||||
inventory.setItem(index, item);
|
||||
inventory.removeItem(item);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,8 +194,8 @@ public class SimpleRepairManager implements RepairManager {
|
||||
*/
|
||||
private 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];
|
||||
|
||||
@@ -210,14 +203,8 @@ public class SimpleRepairManager implements RepairManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getTypeId() == itemId) {
|
||||
if (item.getData().getData() == metadata) {
|
||||
location = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (location != -1) {
|
||||
break;
|
||||
if (item.getTypeId() == itemId && item.getData().getData() == metadata) {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.CombatTools;
|
||||
import com.gmail.nossr50.util.ParticleEffectUtils;
|
||||
|
||||
public class BleedTimer implements Runnable {
|
||||
private final static int MAX_BLEED_TICKS = 10;
|
||||
@@ -50,7 +51,7 @@ public class BleedTimer implements Runnable {
|
||||
//Never kill with Bleeding
|
||||
if (player.getHealth() - 1 > 0) {
|
||||
CombatTools.dealDamage(player, 1);
|
||||
player.getWorld().playEffect(player.getEyeLocation(), Effect.STEP_SOUND, Material.REDSTONE_WIRE);
|
||||
ParticleEffectUtils.playBleedEffect(player);
|
||||
}
|
||||
|
||||
entry.setValue(entry.getValue() - 1);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillMonitor implements Runnable {
|
||||
@@ -15,6 +16,10 @@ public class SkillMonitor implements Runnable {
|
||||
long curTime = System.currentTimeMillis();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerProfile profile = Users.getPlayer(player).getProfile();
|
||||
|
||||
/*
|
||||
|
||||
@@ -51,7 +51,7 @@ public class FluxMiningEventHandler {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
|
||||
if (Permissions.secondSmelt(mcMMOPlayer.getPlayer())) {
|
||||
if (Permissions.doubleDrops(mcMMOPlayer.getPlayer(), manager.getSkill())) {
|
||||
int chance = (int) ((Mining.doubleDropsMaxChance / Mining.doubleDropsMaxLevel) * (SkillTools.skillCheck(mcMMOPlayer.getProfile().getSkillLevel(SkillType.MINING), Mining.doubleDropsMaxLevel)));
|
||||
Misc.randomDropItem(location, item, chance);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class FuelEfficiencyEventHandler {
|
||||
}
|
||||
|
||||
protected void calculateBurnModifier() {
|
||||
this.burnModifier = 1 + ((manager.getSkillLevel() / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier);
|
||||
this.burnModifier = 1 + (((double) manager.getSkillLevel() / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier);
|
||||
}
|
||||
|
||||
protected void modifyBurnTime() {
|
||||
|
||||
@@ -28,50 +28,20 @@ public class SmeltResourceEventHandler {
|
||||
|
||||
protected void handleXPGain() {
|
||||
Material sourceType = event.getSource().getType();
|
||||
int xp = 0;
|
||||
int xp = Config.getInstance().getXp(SkillType.SMELTING, sourceType);
|
||||
|
||||
switch (sourceType) {
|
||||
case COAL_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPCoal();
|
||||
break;
|
||||
|
||||
case GLOWING_REDSTONE_ORE:
|
||||
case REDSTONE_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPRedstone();
|
||||
break;
|
||||
|
||||
case IRON_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPIron();
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPGold();
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPDiamond();
|
||||
break;
|
||||
|
||||
case LAPIS_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPLapis();
|
||||
break;
|
||||
|
||||
case EMERALD_ORE:
|
||||
xp = Config.getInstance().getSmeltingXPEmerald();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
if (sourceType == Material.GLOWING_REDSTONE_ORE) {
|
||||
xp = Config.getInstance().getXp(SkillType.SMELTING, Material.REDSTONE_ORE);
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (Permissions.mining(player)) {
|
||||
if (Permissions.skillEnabled(player, SkillType.MINING)) {
|
||||
mcMMOPlayer.beginXpGain(SkillType.MINING, xp / 2);
|
||||
}
|
||||
|
||||
if (Permissions.repair(player)) {
|
||||
if (Permissions.skillEnabled(player, SkillType.REPAIR)) {
|
||||
mcMMOPlayer.beginXpGain(SkillType.REPAIR, xp / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ public class SmeltingCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canFuelEfficiency = Permissions.fuelEfficiency(player);
|
||||
canSecondSmelt = Permissions.secondSmelt(player);
|
||||
canSecondSmelt = Permissions.doubleDrops(player, skill);
|
||||
canFluxMine = Permissions.fluxMining(player);
|
||||
canVanillaXPBoost = Permissions.smeltingVanillaXPBoost(player);
|
||||
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SmeltingManager extends SkillManager {
|
||||
public void fuelEfficiency(FurnaceBurnEvent event) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player) || !Permissions.fuelEfficiency(player)) {
|
||||
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,17 +38,17 @@ public class SmeltingManager extends SkillManager {
|
||||
public void smeltProcessing(FurnaceSmeltEvent event) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (Misc.isNPCPlayer(player)) {
|
||||
if (Misc.isNPCEntity(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SmeltResourceEventHandler eventHandler = new SmeltResourceEventHandler(this, event);
|
||||
|
||||
if (Permissions.smelting(player)) {
|
||||
if (Permissions.skillEnabled(player, skill)) {
|
||||
eventHandler.handleXPGain();
|
||||
}
|
||||
|
||||
if (!Permissions.secondSmelt(player)) {
|
||||
if (!Permissions.doubleDrops(player, skill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SmeltingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public void vanillaXPBoost(FurnaceExtractEvent event) {
|
||||
if (skillLevel < Smelting.vanillaXPBoostRank1Level || !Permissions.smeltingVanillaXPBoost(mcMMOPlayer.getPlayer())) {
|
||||
if (skillLevel < Smelting.vanillaXPBoostRank1Level || !Permissions.vanillaXpBoost(mcMMOPlayer.getPlayer(), skill)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,20 @@ package com.gmail.nossr50.skills.swords;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class BleedEventHandler {
|
||||
private SwordsManager manager;
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private int skillLevel;
|
||||
private LivingEntity defender;
|
||||
protected int skillModifier;
|
||||
|
||||
protected BleedEventHandler(SwordsManager manager, LivingEntity defender) {
|
||||
this.manager = manager;
|
||||
this.mcMMOPlayer = manager.getMcMMOPlayer();
|
||||
this.skillLevel = manager.getSkillLevel();
|
||||
this.defender = defender;
|
||||
|
||||
@@ -39,10 +41,16 @@ public class BleedEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessages() {
|
||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||
}
|
||||
|
||||
if (defender instanceof Player) {
|
||||
((Player) defender).sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
|
||||
Player defendingPlayer = (Player) defender;
|
||||
|
||||
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
|
||||
defendingPlayer.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.skills.swords;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
|
||||
public class Swords {
|
||||
public static double bleedMaxChance = AdvancedConfig.getInstance().getBleedChanceMax();
|
||||
@@ -15,8 +14,5 @@ public class Swords {
|
||||
|
||||
public static int serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
|
||||
public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getSwordsPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getSwordsPVE();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBleed = Permissions.swordsBleed(player);
|
||||
canBleed = Permissions.bleed(player);
|
||||
canCounter = Permissions.counterAttack(player);
|
||||
canSerratedStrike = Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler {
|
||||
return;
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
mcMMO.placeStore.addSpawnedPet(entity);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata);
|
||||
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
|
||||
@@ -25,7 +25,4 @@ public class Taming {
|
||||
|
||||
public static int wolfXp = Config.getInstance().getTamingXPWolf();
|
||||
public static int ocelotXp = Config.getInstance().getTamingXPOcelot();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getTamingPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getTamingPVE();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@ public class TamingManager extends SkillManager {
|
||||
* @param event The event to award XP for
|
||||
*/
|
||||
public void awardTamingXP(EntityTameEvent event) {
|
||||
if (mcMMO.placeStore.isSpawnedMob(event.getEntity())) {
|
||||
if (event.getEntity() == null) {
|
||||
return;
|
||||
}
|
||||
else if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
|
||||
public class Unarmed {
|
||||
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
||||
@@ -23,13 +23,10 @@ public class Unarmed {
|
||||
|
||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||
|
||||
public static boolean pvpEnabled = Config.getInstance().getUnarmedPVP();
|
||||
public static boolean pveEnabled = Config.getInstance().getUnarmedPVE();
|
||||
|
||||
public static double berserkDamageModifier = 1.5;
|
||||
|
||||
public static void blockCracker(Player player, Block block) {
|
||||
if (Misc.blockBreakSimulate(block, player, false)) {
|
||||
if (SkillTools.blockBreakSimulate(block, player, false)) {
|
||||
Material type = block.getType();
|
||||
|
||||
switch (type) {
|
||||
|
||||
@@ -60,8 +60,8 @@ public class UnarmedCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck() {
|
||||
canBerserk = Permissions.berserk(player);
|
||||
canBonusDamage = Permissions.unarmedBonus(player);
|
||||
canDeflect = Permissions.deflect(player);
|
||||
canBonusDamage = Permissions.bonusDamage(player, skill);
|
||||
canDeflect = Permissions.arrowDeflect(player);
|
||||
canDisarm = Permissions.disarm(player);
|
||||
canIronGrip = Permissions.ironGrip(player);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.PerksUtils;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -87,7 +87,7 @@ public class UnarmedManager extends SkillManager {
|
||||
|
||||
double chance = (Unarmed.ironGripMaxChance / Unarmed.ironGripMaxBonusLevel) * eventHandler.skillModifier;
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(SkillTools.calculateActivationChance(Permissions.luckyUnarmed(defender)))) {
|
||||
if (chance > Misc.getRandom().nextInt(PerksUtils.handleLuckyPerks(defender, skill))) {
|
||||
eventHandler.sendAbilityMessages();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@ import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.BlockChecks;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public enum AbilityType {
|
||||
BERSERK(
|
||||
Config.getInstance().getAbilityCooldownBerserk(),
|
||||
Config.getInstance().getAbilityMaxTicksBerserk(),
|
||||
"Unarmed.Skills.Berserk.On",
|
||||
"Unarmed.Skills.Berserk.Off",
|
||||
"Unarmed.Skills.Berserk.Other.On",
|
||||
@@ -20,8 +19,6 @@ public enum AbilityType {
|
||||
"Unarmed.Skills.Berserk.Other.Off"),
|
||||
|
||||
SUPER_BREAKER(
|
||||
Config.getInstance().getAbilityCooldownSuperBreaker(),
|
||||
Config.getInstance().getAbilityMaxTicksSuperBreaker(),
|
||||
"Mining.Skills.SuperBreaker.On",
|
||||
"Mining.Skills.SuperBreaker.Off",
|
||||
"Mining.Skills.SuperBreaker.Other.On",
|
||||
@@ -29,8 +26,6 @@ public enum AbilityType {
|
||||
"Mining.Skills.SuperBreaker.Other.Off"),
|
||||
|
||||
GIGA_DRILL_BREAKER(
|
||||
Config.getInstance().getAbilityCooldownGigaDrillBreaker(),
|
||||
Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(),
|
||||
"Excavation.Skills.GigaDrillBreaker.On",
|
||||
"Excavation.Skills.GigaDrillBreaker.Off",
|
||||
"Excavation.Skills.GigaDrillBreaker.Other.On",
|
||||
@@ -38,17 +33,13 @@ public enum AbilityType {
|
||||
"Excavation.Skills.GigaDrillBreaker.Other.Off"),
|
||||
|
||||
GREEN_TERRA(
|
||||
Config.getInstance().getAbilityCooldownGreenTerra(),
|
||||
Config.getInstance().getAbilityMaxTicksGreenTerra(),
|
||||
"Herbalism.Skills.GTe.On",
|
||||
"Herbalism.Skills.GTe.Off",
|
||||
"Herbalism.Skills.GTe.Other.On",
|
||||
"Herbalism.Skills.GTe.Refresh",
|
||||
"Herbalism.Skills.GTe.Other.Off"),
|
||||
|
||||
SKULL_SPLIITER(
|
||||
Config.getInstance().getAbilityCooldownSkullSplitter(),
|
||||
Config.getInstance().getAbilityMaxTicksSkullSplitter(),
|
||||
SKULL_SPLITTER(
|
||||
"Axes.Skills.SS.On",
|
||||
"Axes.Skills.SS.Off",
|
||||
"Axes.Skills.SS.Other.On",
|
||||
@@ -56,8 +47,6 @@ public enum AbilityType {
|
||||
"Axes.Skills.SS.Other.Off"),
|
||||
|
||||
TREE_FELLER(
|
||||
Config.getInstance().getAbilityCooldownTreeFeller(),
|
||||
Config.getInstance().getAbilityMaxTicksTreeFeller(),
|
||||
"Woodcutting.Skills.TreeFeller.On",
|
||||
"Woodcutting.Skills.TreeFeller.Off",
|
||||
"Woodcutting.Skills.TreeFeller.Other.On",
|
||||
@@ -65,8 +54,6 @@ public enum AbilityType {
|
||||
"Woodcutting.Skills.TreeFeller.Other.Off"),
|
||||
|
||||
SERRATED_STRIKES(
|
||||
Config.getInstance().getAbilityCooldownSerratedStrikes(),
|
||||
Config.getInstance().getAbilityMaxTicksSerratedStrikes(),
|
||||
"Swords.Skills.SS.On",
|
||||
"Swords.Skills.SS.Off",
|
||||
"Swords.Skills.SS.Other.On",
|
||||
@@ -74,8 +61,6 @@ public enum AbilityType {
|
||||
"Swords.Skills.SS.Other.Off"),
|
||||
|
||||
BLAST_MINING(
|
||||
Config.getInstance().getAbilityCooldownBlastMining(),
|
||||
Config.getInstance().getAbilityMaxTicksBlastMining(),
|
||||
null,
|
||||
null,
|
||||
"Mining.Blast.Other.On",
|
||||
@@ -83,25 +68,19 @@ public enum AbilityType {
|
||||
null),
|
||||
|
||||
LEAF_BLOWER(
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
|
||||
private int cooldown;
|
||||
private int maxTicks;
|
||||
private String abilityOn;
|
||||
private String abilityOff;
|
||||
private String abilityPlayer;
|
||||
private String abilityRefresh;
|
||||
private String abilityPlayerOff;
|
||||
|
||||
private AbilityType(int cooldown, int maxTicks, String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.cooldown = cooldown;
|
||||
this.maxTicks = maxTicks;
|
||||
private AbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||
this.abilityOn = abilityOn;
|
||||
this.abilityOff = abilityOff;
|
||||
this.abilityPlayer = abilityPlayer;
|
||||
@@ -110,7 +89,11 @@ public enum AbilityType {
|
||||
}
|
||||
|
||||
public int getCooldown() {
|
||||
return this.cooldown;
|
||||
return Config.getInstance().getCooldown(this);
|
||||
}
|
||||
|
||||
public int getMaxTicks() {
|
||||
return Config.getInstance().getMaxTicks(this);
|
||||
}
|
||||
|
||||
public String getAbilityOn() {
|
||||
@@ -133,8 +116,25 @@ public enum AbilityType {
|
||||
return LocaleLoader.getString(this.abilityRefresh);
|
||||
}
|
||||
|
||||
public int getMaxTicks() {
|
||||
return this.maxTicks;
|
||||
@Override
|
||||
public String toString() {
|
||||
String baseString = name();
|
||||
String[] substrings = baseString.split("_");
|
||||
String formattedString = "";
|
||||
|
||||
int size = 1;
|
||||
|
||||
for (String string : substrings) {
|
||||
formattedString = formattedString.concat(StringUtils.getCapitalized(string));
|
||||
|
||||
if (size < substrings.length) {
|
||||
formattedString = formattedString.concat("_");
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
|
||||
return formattedString;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ public enum AbilityType {
|
||||
return Permissions.berserk(player);
|
||||
|
||||
case BLAST_MINING:
|
||||
return Permissions.blastMining(player);
|
||||
return Permissions.remoteDetonation(player);
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return Permissions.gigaDrillBreaker(player);
|
||||
@@ -164,7 +164,7 @@ public enum AbilityType {
|
||||
case SERRATED_STRIKES:
|
||||
return Permissions.serratedStrikes(player);
|
||||
|
||||
case SKULL_SPLIITER:
|
||||
case SKULL_SPLITTER:
|
||||
return Permissions.skullSplitter(player);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user