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

Compare commits

..

44 Commits

Author SHA1 Message Date
TfT_02
d407f85704 Update pom.xml and changelog.txt for 1.4.08 release 2014-03-29 17:06:01 +01:00
TfT_02
458dc7db42 Make database command cooldown configurable 2014-03-29 17:02:08 +01:00
TfT_02
beab794c0e Fixed some issues with the HolidayManager
Was severely lacking more lols
2014-03-29 16:52:41 +01:00
TfT_02
8256f5461c Using an axe is required to earn Woodcutting XP
Not really sure why or when this check had gone missing..
2014-03-26 09:52:59 +01:00
TfT_02
0fe3ad7432 Reworked COTW config options + made COTW item configurable
Adresses #1481 partially
2014-03-23 14:33:57 +01:00
TfT_02
04e5dda127 Actually fix Repair lucky perk with Arcane Forging downgrade chance 2014-03-23 14:33:57 +01:00
TfT_02
f65adea2f9 Added minimum jump strength requirement and config option
for horses summoned with "Call of the Wild"
2014-03-23 13:41:31 +01:00
TfT_02
cdfb0da5c9 Fixed bug where shift right clicking potion ingredients was broken 2014-03-23 12:59:43 +01:00
TfT_02
cfa3d34dff Fix important bug regarding pistons 2014-03-14 15:23:28 +01:00
TfT_02
01b7d4f742 Repair lucky perk should decrease the Arcane Forging downgrade chance,
instead of increasing it.
2014-03-14 15:16:22 +01:00
TfT_02
9a359bf42c We need to use event.getBlock() here
Fix my boo boo from previous commit
2014-03-11 13:33:54 +01:00
TfT_02
ebdf11300b We do need to use a runnable. 2014-03-10 20:51:52 +01:00
TfT_02
e1a8f02bce Make Acrobatics XP prevention cool down, after teleporting configurable
Adds #1906
2014-03-09 15:24:24 +01:00
TfT_02
862d38b587 Clean up all of the imports 2014-03-03 18:27:45 +01:00
GJ
2415767c06 Clean up imports. 2014-03-03 12:22:28 -05:00
GJ
aa59348a94 We only care about blocks that award XP.
Also, this fixes a possible issue where blocks changed by entities other than falling blocks could have been left as tracked even after they were destroyed.
2014-03-03 12:14:01 -05:00
GJ
9c925d3327 We can do this without needing a runnable. 2014-03-03 11:40:36 -05:00
GJ
30f7521a3a Handle healthbars even when skills are disabled. Fixes #1194 2014-03-03 10:29:14 -05:00
GJ
7b3869e385 Use .equals instead of deprecated ID method. 2014-03-03 09:24:24 -05:00
GJ
0e641f7c5b Clean up some of our metadata handling. 2014-03-03 08:48:16 -05:00
GJ
733d16cf35 Don't clone if it's null. Fixes #1894 2014-03-03 08:03:30 -05:00
TfT_02
833bc1b251 Fixed bug where disbanded parties could still see alliance chat 2014-02-28 22:41:47 +01:00
TfT_02
840f3d9382 Fix /party kick command 2014-02-28 22:32:09 +01:00
TfT_02
34d6d867f2 Prevent combat abilities from damaging allied players 2014-02-28 22:08:48 +01:00
TfT_02
e56d5a0454 Exclude vanished players from tab complete list
Part 2 of fixing #1745
2014-02-28 21:56:30 +01:00
TfT_02
53fdf750f4 Pretend like the player is offline when he is vanished
Part 1 of fixing #1745
2014-02-28 21:56:30 +01:00
TfT_02
f096e915cf Changed default amount of XP from mining Quartz Ore
#1886
2014-02-28 19:24:41 +01:00
GJ
ce59488e8e Add FakeEntityTameEvent to match expected behavior for an animal being tamed. 2014-02-28 12:04:00 -05:00
GJ
47db522cc1 Because Bukkit doesn't set this automatically with setTamed. Go figure. Fixes #1888 2014-02-28 11:50:36 -05:00
TfT_02
a2cac82cba Check if player has data key here as well
Fixes #272
2014-02-28 14:45:44 +01:00
GJ
2e74333eb7 Oops. 2014-02-28 08:40:00 -05:00
GJ
0056be2d5f Assorted cleanup. 2014-02-28 08:36:42 -05:00
TfT_02
1d7e034d5e Fix the updater 2014-02-27 22:26:58 +01:00
GJ
8deac175d1 Repair damaged user files. Fixes #1869 2014-02-22 09:52:36 -05:00
GJ
d0b766a2d3 Fixed bug with updating (very) old user data. 2014-02-21 11:38:22 -05:00
GJ
65692f2a83 Fixed bug with checking maximum durability of mod items. Fixes #1634 2014-02-20 12:43:11 -05:00
GJ
d0b0786284 Fixed exploit involving Call of The Wild. Fixes #1877 2014-02-20 11:50:56 -05:00
Luuk Jacobs
87ac1002de Fix potion datavalues for Splash poison II potions 2014-02-18 08:45:44 +01:00
TfT_02
c51fde7f1f Added new permission node to control who can check version number
Negate this permission node to hide the version number from /mcmmo and
motd
2014-02-17 16:31:59 +01:00
TfT_02
0a6735110f Get mod config file resources properly
Fixes #1870 for real
2014-02-16 23:32:14 +01:00
TfT_02
8a284c50a2 Rename mod files to type.default.yml
Fixes #1870
2014-02-16 23:08:22 +01:00
roblikescake
09431ef27c Check durability before repairMaterial 2014-02-16 00:18:27 +01:00
TfT_02
9f9de86d21 The defender isn't necessarily a player here
Besides, the defender doesn’t need to have the player data key anyways
2014-02-16 00:11:15 +01:00
TfT_02
d9c04a09ba No need to clone here and it's not null checked
Fixes #1864
2014-02-15 23:35:14 +01:00
375 changed files with 798 additions and 2255 deletions

View File

@@ -7,7 +7,7 @@ Key:
! Change ! Change
- Removal - Removal
Version 1.4.08-dev Version 1.4.08
+ Added a new skill; Alchemy. Special thanks to EasyMFnE for creating this! + Added a new skill; Alchemy. Special thanks to EasyMFnE for creating this!
+ Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances + Added SecondaryAbilityType enum, and new SecondaryAbilityWeightedActivationCheckEvent, fired when a secondary ability checkes its activation chances
+ Added the possibility to gain experience when using Fishing "Shake" + Added the possibility to gain experience when using Fishing "Shake"
@@ -21,6 +21,13 @@ Version 1.4.08-dev
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config + Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default + Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml + Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
+ Added config options to configure the items used in "Call of the Wild"
+ Added config option to configure the database command cooldown
= Fixed bug where healthbars wouldn't display if skills were disabled
= Fixed bug with "Call of the Wild" entities despawning
= Fixed bug with updating (very) old user data.
= Fixed bug with checking maximum durability of mod items.
= Fixed exploit involving Call of The Wild.
= Fixed bug where LeafBlower permissions were ignored = Fixed bug where LeafBlower permissions were ignored
= Fixed bug with toggle commands not properly displaying the success message. = Fixed bug with toggle commands not properly displaying the success message.
= Fixed IllegalArgumentException caused by an empty Fishing treasure category = Fixed IllegalArgumentException caused by an empty Fishing treasure category
@@ -34,9 +41,12 @@ Version 1.4.08-dev
= Fixed bug where party chat broke if the display name contained special characters = Fixed bug where party chat broke if the display name contained special characters
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work = Fixed bug where `/addlevels all` and `/skillreset all` didn't work
= Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse = Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
= Fixed bug where some horses summoned with "Call of the Wild" were unable to jump
= Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command = Fixed bug where the /ptp request expiration time was checked wrongly - preventing players from using the command
= Fixed bug where Hylian Luck was broken = Fixed bug where Hylian Luck was broken
= Fixed bug where Snow would never drop treasures = Fixed bug where Snow would never drop treasures
= Fixed issues with commands giving away vanished players.
= Fixed bug where the Repair lucky perk would increase the Arcane Forging downgrade chance, instead of decreasing it
! Changed party system. Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members ! Changed party system. Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
! Changed appearance of party member list. Gold = party leader, White = online, Gray = offline, Italic = not nearby ! Changed appearance of party member list. Gold = party leader, White = online, Gray = offline, Italic = not nearby
! Updated localization files ! Updated localization files
@@ -46,6 +56,8 @@ Version 1.4.08-dev
! Changed /ptp config setting, Commands.ptp.Confirm_Required is now Commands.ptp.Accept.Required ! Changed /ptp config setting, Commands.ptp.Confirm_Required is now Commands.ptp.Accept.Required
! Changed config validation for UnlockLevels, they can now also be 0 ! Changed config validation for UnlockLevels, they can now also be 0
! Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other ! Changed config validation for Rank_Levels, successive Ranks can now be less than or equal to each other
! Changed default amount of XP gained from mining Quartz Ore. From 250 to 100 XP.
! Changed Acrobatics config setting, Skills.Acrobatics.Prevent_XP_After_Teleport is now Skills.Acrobatics.XP_After_Teleport_Cooldown
- Removed /stats alias for /mcstats - Removed /stats alias for /mcstats
Version 1.4.07 Version 1.4.07

View File

@@ -5,7 +5,7 @@
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/). Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
### Brief Description ### Brief Description
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds thirteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Additionally, when run in conjuction with SpoutPlugin, mcMMO also has a custom XP bar to allow for easy tracking of progress towards leveling up. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update. The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
## About the Team ## About the Team
@@ -47,6 +47,5 @@ Required Libraries:
* JUnit * JUnit
* EMetrics * EMetrics
* Bukkit * Bukkit
* SpoutPlugin API
http://dev.bukkit.org/server-mods/mcmmo for more up to date information. http://dev.bukkit.org/server-mods/mcmmo for more up to date information.

51
pom.xml
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>1.4.08-SNAPSHOT</version> <version>1.4.08</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<issueManagement> <issueManagement>
@@ -22,38 +22,6 @@
<include>.jenkins</include> <include>.jenkins</include>
</includes> </includes>
</resource> </resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/xpbar/</directory>
<includes>
<include>xpbar*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/healthbar/</directory>
<includes>
<include>health*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/skillicon/</directory>
<includes>
<include>*.png</include>
</includes>
</resource>
<resource>
<targetPath>resources</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/sound/</directory>
<includes>
<include>*.wav</include>
</includes>
</resource>
<resource> <resource>
<targetPath>com/gmail/nossr50/locale</targetPath> <targetPath>com/gmail/nossr50/locale</targetPath>
<filtering>true</filtering> <filtering>true</filtering>
@@ -144,18 +112,6 @@
<id>md_5-releases</id> <id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url> <url>http://repo.md-5.net/content/repositories/releases/</url>
</repository> </repository>
<repository>
<id>sonatype-nexus-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository> <repository>
<id>Plugin MetricsExtension</id> <id>Plugin MetricsExtension</id>
<url>http://repo.turt2live.com</url> <url>http://repo.turt2live.com</url>
@@ -169,11 +125,6 @@
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.spoutcraft</groupId>
<artifactId>spoutcraftplugin</artifactId>
<version>LATEST</version>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit-dep</artifactId> <artifactId>junit-dep</artifactId>

View File

@@ -43,9 +43,7 @@ public final class ExperienceAPI {
public static boolean isNonChildSkill(String skillType) { public static boolean isNonChildSkill(String skillType) {
SkillType skill = SkillType.getSkill(skillType); SkillType skill = SkillType.getSkill(skillType);
if (skill == null) return false; return skill != null && !skill.isChildSkill();
return !skill.isChildSkill();
} }
@Deprecated @Deprecated

View File

@@ -1,29 +0,0 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.player.UserManager;
public class SpoutHudAPI {
private SpoutHudAPI() {}
/**
* Disable the mcMMO XP bar for a player.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar(Player player) {
UserManager.getPlayer(player).getProfile().setHudType(HudType.DISABLED);
}
/**
* Disable the mcMMO XP bar for the server.
* </br>
* This function is designed for API usage.
*/
public static void disableXpBar() {
SpoutConfig.getInstance().setXPBarEnabled(false);
}
}

View File

@@ -1,79 +0,0 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.skills.ToolType;
public final class SpoutToolsAPI {
public static final List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static final List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
private SpoutToolsAPI() {}
/**
* Add a custom Spout tool to mcMMO for XP gain & ability use.
* </br>
* This function is designed for API usage.
*
* @param spoutTool The tool to add
* @param type The type of tool to add
*/
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
switch (type) {
case AXE:
spoutAxes.add(spoutTool);
break;
case HOE:
spoutHoes.add(spoutTool);
break;
case PICKAXE:
spoutPickaxes.add(spoutTool);
break;
case SHOVEL:
spoutShovels.add(spoutTool);
break;
case SWORD:
spoutSwords.add(spoutTool);
break;
default:
break;
}
}
public static boolean isSpoutTool(ItemStack spoutTool, ToolType type) {
return getSpoutTools(type) != null && getSpoutTools(type).contains(spoutTool);
}
private static List<ItemStack> getSpoutTools(ToolType type) {
switch (type) {
case AXE:
return spoutAxes;
case HOE:
return spoutHoes;
case PICKAXE:
return spoutPickaxes;
case SHOVEL:
return spoutShovels;
case SWORD:
return spoutSwords;
default:
return null;
}
}
}

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -58,7 +57,7 @@ public class KrakenCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@@ -4,14 +4,12 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.party.PartySubcommandType; import com.gmail.nossr50.commands.party.PartySubcommandType;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.spout.SpoutUtils;
public class McmmoCommand implements CommandExecutor { public class McmmoCommand implements CommandExecutor {
@Override @Override
@@ -28,16 +26,14 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(mcSplit); sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) { if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.isSpoutEnabled() && sender instanceof Player) { sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
SpoutUtils.sendDonationNotification((Player) sender); sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
} }
else {
sender.sendMessage(LocaleLoader.getString("MOTD.Donate")); if (Permissions.showversion(sender)) {
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal"); sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
}
} }
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
mcMMO.getHolidayManager().anniversaryCheck(sender); mcMMO.getHolidayManager().anniversaryCheck(sender);
return true; return true;

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -62,7 +61,7 @@ public abstract class ToggleCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.database;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -23,7 +22,7 @@ public class McremoveCommand implements TabExecutor {
case 1: case 1:
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (UserManager.getPlayer(playerName, true) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) { if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
return true; return true;
} }
@@ -45,7 +44,7 @@ public class McremoveCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.experience;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -68,7 +67,7 @@ public abstract class ExperienceCommand implements TabExecutor {
int value = Integer.parseInt(args[2]); int value = Integer.parseInt(args[2]);
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
// 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. // 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.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
@@ -96,7 +95,7 @@ public abstract class ExperienceCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.experience;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -66,7 +65,7 @@ public class SkillresetCommand implements TabExecutor {
} }
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
// 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. // 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.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
@@ -94,7 +93,7 @@ public class SkillresetCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
case 2: case 2:
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size())); return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));

View File

@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -17,6 +16,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand; import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand; import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@@ -179,7 +179,7 @@ public class PartyCommand implements TabExecutor {
case INVITE: case INVITE:
case KICK: case KICK:
case OWNER: case OWNER:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
case XPSHARE: case XPSHARE:
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size())); return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
@@ -194,7 +194,10 @@ public class PartyCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size())); List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) { if (matches.size() == 0) {
playerNames = UserManager.getPlayerNames(); Player player = (Player) sender;
Party party = UserManager.getPlayer(player).getParty();
playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
} }

View File

@@ -18,7 +18,7 @@ public class PartyInviteCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true); McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false; return false;

View File

@@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
public class PartyKickCommand implements CommandExecutor { public class PartyKickCommand implements CommandExecutor {
@@ -19,13 +20,15 @@ public class PartyKickCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
if (!playerParty.getMembers().contains(target.getName())) { if (!playerParty.getMembers().contains(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", target.getName())); sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true; return true;
} }
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (target.isOnline()) { if (target.isOnline()) {
Player onlineTarget = target.getPlayer(); Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName(); String partyName = playerParty.getName();

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.party.alliance;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@@ -111,7 +110,7 @@ public class PartyAllianceCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size())); List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
if (matches.size() == 0) { if (matches.size() == 0) {
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
} }

View File

@@ -18,7 +18,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 3: case 3:
String targetName = CommandUtils.getMatchedPlayerName(args[2]); String targetName = CommandUtils.getMatchedPlayerName(args[2]);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName, true); McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false; return false;

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.party.teleport;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@@ -109,7 +108,10 @@ public class PtpCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size())); List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) { if (matches.size() == 0) {
Set<String> playerNames = UserManager.getPlayerNames(); Player player = (Player) sender;
Party party = UserManager.getPlayer(player).getParty();
List<String> playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
} }

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -29,7 +28,7 @@ public class InspectCommand implements TabExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
// 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. // 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.
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
@@ -104,7 +103,7 @@ public class InspectCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.commands.player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -15,7 +14,6 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@@ -47,7 +45,7 @@ public class McrankCommand implements TabExecutor {
} }
String playerName = CommandUtils.getMatchedPlayerName(args[0]); String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
if (mcMMOPlayer != null) { if (mcMMOPlayer != null) {
Player player = mcMMOPlayer.getPlayer(); Player player = mcMMOPlayer.getPlayer();
@@ -73,7 +71,7 @@ public class McrankCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
Set<String> playerNames = UserManager.getPlayerNames(); List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size())); return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default: default:
return ImmutableList.of(); return ImmutableList.of();
@@ -83,8 +81,9 @@ public class McrankCommand implements TabExecutor {
private void display(CommandSender sender, String playerName) { private void display(CommandSender sender, String playerName) {
if (sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName()); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) { if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown")); sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
return; return;
} }

View File

@@ -15,7 +15,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@@ -85,8 +84,9 @@ public class MctopCommand implements TabExecutor {
if (sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName()); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + Misc.PLAYER_DATABASE_COOLDOWN_MILLIS > System.currentTimeMillis()) { if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown")); sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
return; return;
} }

View File

@@ -0,0 +1,205 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
public class AprilCommand implements TabExecutor {
private String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
protected DecimalFormat decimal = new DecimalFormat("##0.00");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
skillName = StringUtils.getCapitalized(label);
switch (args.length) {
case 0:
Player player = (Player) sender;
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
float skillValue = Misc.getRandom().nextInt(99);
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", getXPGainString(fakeSkillType)));
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, Misc.getRandom().nextInt(1000), 1000 + Misc.getRandom().nextInt(1000)));
List<String> effectMessages = effectsDisplay(fakeSkillType);
if (!effectMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
for (String message : effectMessages) {
player.sendMessage(message);
}
}
List<String> statsMessages = statsDisplay(fakeSkillType);
if (!statsMessages.isEmpty()) {
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
for (String message : statsMessages) {
player.sendMessage(message);
}
}
player.sendMessage(LocaleLoader.formatString("[[DARK_AQUA]]Guide for {0} available - type /APRIL FOOLS ! :D", skillName));
return true;
default:
return true;
}
}
private String getXPGainString(FakeSkillType fakeSkillType) {
switch (fakeSkillType) {
case MACHO:
return "Get beaten up";
case JUMPING:
return "Kris Kross will make ya Jump Jump";
case THROWING:
return "Chuck your items on the floor";
case WRECKING:
return "I'M GONNA WRECK IT!";
case CRAFTING:
return "Craft apple pies";
case WALKING:
return "Walk around the park";
case SWIMMING:
return "Like a fish on a bicycle";
case FALLING:
return "Faceplant the floor, headbutt the ground";
case CLIMBING:
return "Climb the highest mountain";
case FLYING:
return "I believe I can fly";
case DIVING:
return "Scuba club 4000";
case PIGGY:
return "OINK! OINK!";
default:
return "Sit and wait?";
}
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return ImmutableList.of("?");
default:
return ImmutableList.of();
}
}
private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<String>();
switch (fakeSkillType) {
case MACHO:
messages.add(LocaleLoader.getString("Effects.Template", "Punching bag", "Absorb damage, like a bag of sand"));
break;
case JUMPING:
messages.add(LocaleLoader.getString("Effects.Template", "Jump", "PRESS SPACE TO JUMP"));
messages.add(LocaleLoader.getString("Effects.Template", "Jump Twice", "PRESS SPACE TWICE TO JUMP TWICE"));
break;
case THROWING:
messages.add(LocaleLoader.getString("Effects.Template", "Drop Item", "Randomly drop items, at random"));
break;
case WRECKING:
messages.add(LocaleLoader.getString("Effects.Template", "Ralphinator", "Smash windows with your fists"));
break;
case CRAFTING:
messages.add(LocaleLoader.getString("Effects.Template", "Crafting", "Chance of successful craft"));
break;
case WALKING:
messages.add(LocaleLoader.getString("Effects.Template", "Walk", "Traveling gracefully by foot"));
break;
case SWIMMING:
messages.add(LocaleLoader.getString("Effects.Template", "Swim", "Just keep swimming, swimming, swimming"));
break;
case FALLING:
messages.add(LocaleLoader.getString("Effects.Template", "Skydiving", "Go jump of a cliff. No, seriously."));
break;
case CLIMBING:
messages.add(LocaleLoader.getString("Effects.Template", "Rock Climber", "Use string to climb mountains faster"));
break;
case FLYING:
messages.add(LocaleLoader.getString("Effects.Template", "Fly", "Throw yourself at the ground and miss"));
break;
case DIVING:
messages.add(LocaleLoader.getString("Effects.Template", "Hold Breath", "Press shift to hold your breath longer"));
break;
case PIGGY:
messages.add(LocaleLoader.getString("Effects.Template", "Carrot Turbo", "Supercharge your pigs with carrots"));
break;
}
return messages;
}
private List<String> statsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<String>();
switch (fakeSkillType) {
case MACHO:
messages.add(LocaleLoader.formatString("[[RED]]Damage Taken: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(77))));
break;
case JUMPING:
messages.add(LocaleLoader.formatString("[[RED]]Double Jump Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case THROWING:
messages.add(LocaleLoader.formatString("[[RED]]Drop Item Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(87))));
break;
case WRECKING:
messages.add(LocaleLoader.formatString("[[RED]]Wrecking Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(14))));
break;
case CRAFTING:
messages.add(LocaleLoader.formatString("[[RED]]Crafting Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case WALKING:
messages.add(LocaleLoader.formatString("[[RED]]Walk Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case SWIMMING:
messages.add(LocaleLoader.formatString("[[RED]]Swim Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case FALLING:
messages.add(LocaleLoader.formatString("[[RED]]Skydiving Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(37))));
break;
case CLIMBING:
messages.add(LocaleLoader.formatString("[[RED]]Rock Climber Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case FLYING:
messages.add(LocaleLoader.formatString("[[RED]]Fly Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case DIVING:
messages.add(LocaleLoader.formatString("[[RED]]Hold Breath Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
break;
case PIGGY:
messages.add(LocaleLoader.formatString("[[RED]]Carrot Turbo Boost: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(80)) + 10));
break;
}
return messages;
}
}

View File

@@ -51,7 +51,6 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations(Player player, float skillValue, boolean isLucky) { protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
boolean isStorming = player.getWorld().hasStorm();
// TREASURE HUNTER // TREASURE HUNTER
if (canTreasureHunt) { if (canTreasureHunt) {
@@ -70,7 +69,7 @@ public class FishingCommand extends SkillCommand {
double totalEnchantChance = 0; double totalEnchantChance = 0;
for (Rarity rarity : Rarity.values()) { for (Rarity rarity : Rarity.values()) {
if (rarity != Rarity.TRAP || rarity != Rarity.RECORD) { if (rarity != Rarity.TRAP && rarity != Rarity.RECORD) {
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity); totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
} }
} }
@@ -92,7 +91,7 @@ public class FishingCommand extends SkillCommand {
// MASTER ANGLER // MASTER ANGLER
if (canMasterAngler) { if (canMasterAngler) {
double rawBiteChance = 1.0 / (isStorming ? 300 : 500); double rawBiteChance = 1.0 / (player.getWorld().hasStorm() ? 300 : 500);
Location location = fishingManager.getHookLocation(); Location location = fishingManager.getHookLocation();
if (location == null) { if (location == null) {

View File

@@ -91,9 +91,9 @@ public class TamingCommand extends SkillCommand {
if (canCallWild) { if (canCallWild) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13"))); messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13")));
messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWOcelotCost())); messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWCost(EntityType.OCELOT)));
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWWolfCost())); messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWCost(EntityType.WOLF)));
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWHorseCost())); messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWCost(EntityType.HORSE)));
} }
return messages; return messages;

View File

@@ -1,58 +0,0 @@
package com.gmail.nossr50.commands.spout;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.google.common.collect.ImmutableList;
public class MchudCommand extends SpoutCommand {
private static final List<String> HUD_TYPES;
static {
ArrayList<String> types = new ArrayList<String>();
for (HudType type : HudType.values()) {
types.add(type.toString());
}
Collections.sort(types);
HUD_TYPES = ImmutableList.copyOf(types);
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], HUD_TYPES, new ArrayList<String>(HUD_TYPES.size()));
default:
return ImmutableList.of();
}
}
@Override
protected boolean noArguments(Command command, CommandSender sender, String[] args) {
return false;
}
@Override
protected boolean oneArgument(Command command, CommandSender sender, String[] args) {
try {
playerProfile.setHudType(HudType.valueOf(args[0].toUpperCase().trim()));
spoutHud.initializeXpBar();
spoutHud.updateXpBar();
return true;
}
catch (IllegalArgumentException ex) {
sender.sendMessage(LocaleLoader.getString("Commands.mchud.Invalid"));
return true;
}
}
}

View File

@@ -1,54 +0,0 @@
package com.gmail.nossr50.commands.spout;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
public abstract class SpoutCommand implements TabExecutor {
protected PlayerProfile playerProfile;
protected McMMOHud spoutHud;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!mcMMO.isSpoutEnabled() || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
playerProfile = UserManager.getPlayer((Player) sender).getProfile();
spoutHud = playerProfile.getSpoutHud();
if (spoutHud == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
switch (args.length) {
case 0:
return noArguments(command, sender, args);
case 1:
return oneArgument(command, sender, args);
default:
return false;
}
}
protected abstract boolean noArguments(Command command, CommandSender sender, String[] args);
protected abstract boolean oneArgument(Command command, CommandSender sender, String[] args);
}

View File

@@ -1,89 +0,0 @@
package com.gmail.nossr50.commands.spout;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
public class XplockCommand extends SpoutCommand {
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
if (matches.size() == 0) {
return StringUtil.copyPartialMatches(args[0], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
}
return matches;
default:
return ImmutableList.of();
}
}
@Override
protected boolean noArguments(Command command, CommandSender sender, String[] args) {
if (spoutHud.getXpBarLocked()) {
unlockXpBar(sender);
return true;
}
lockXpBar(sender, spoutHud.getLastGained());
return true;
}
@Override
protected boolean oneArgument(Command command, CommandSender sender, String[] args) {
if (CommandUtils.shouldEnableToggle(args[0])) {
lockXpBar(sender, spoutHud.getLastGained());
return true;
}
if (CommandUtils.shouldDisableToggle(args[0])) {
unlockXpBar(sender);
return true;
}
if (CommandUtils.isInvalidSkill(sender, args[0])) {
return true;
}
SkillType skill = SkillType.getSkill(args[0]);
if (CommandUtils.isChildSkill(sender, skill)) {
return true;
}
if (!Permissions.xplock(sender, skill)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
lockXpBar(sender, skill);
return true;
}
private void lockXpBar(CommandSender sender, SkillType skill) {
if (skill != null) {
spoutHud.setXpBarLocked(true);
spoutHud.setSkillLock(skill);
spoutHud.updateXpBar();
sender.sendMessage(LocaleLoader.getString("Commands.xplock.locked", skill.getName()));
}
}
private void unlockXpBar(CommandSender sender) {
spoutHud.setXpBarLocked(false);
sender.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
}
}

View File

@@ -777,6 +777,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); } public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); } public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); } public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
/* UNARMED */ /* UNARMED */

View File

@@ -182,20 +182,40 @@ public class Config extends AutoUpdateConfigLoader {
reason.add("Cannot use the same item for Repair and Salvage anvils!"); reason.add("Cannot use the same item for Repair and Salvage anvils!");
} }
if (getTamingCOTWWolfCost() < 1) { if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Bones_Required should be at least 1!"); reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
} }
if (getTamingCOTWOcelotCost() < 1) { if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Fish_Required should be at least 1!"); reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
} }
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) { if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot_Amount should be greater than 0!"); reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
}
if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
}
if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
}
if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
} }
if (getTamingCOTWAmount(EntityType.WOLF) <= 0) { if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf_Amount should be greater than 0!"); reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
}
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
}
if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
} }
return noErrorsInConfig(reason); return noErrorsInConfig(reason);
@@ -218,7 +238,6 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); } public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); } public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); } public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
public boolean getConfigOverwriteEnabled() { return config.getBoolean("General.Config_Update_Overwrite", true); }
public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); } public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); } public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
@@ -229,6 +248,7 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); } public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); } public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); } public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
@@ -423,7 +443,7 @@ public class Config extends AutoUpdateConfigLoader {
/* Acrobatics */ /* Acrobatics */
public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); } public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
public boolean getPreventXPAfterTeleport() { return config.getBoolean("Skills.Acrobatics.Prevent_XP_After_Teleport", true); } public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
/* Alchemy */ /* Alchemy */
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); } public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
@@ -449,11 +469,10 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); } public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
/* Taming */ /* Taming */
public int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); } public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); } public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); } public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); } public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
/* Woodcutting */ /* Woodcutting */
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); } public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }

View File

@@ -15,7 +15,7 @@ public class ArmorConfigManager {
ModManager modManager = mcMMO.getModManager(); ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) { if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false); plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
} }
for (String fileName : dataFolder.list()) { for (String fileName : dataFolder.list()) {

View File

@@ -15,7 +15,7 @@ public class BlockConfigManager {
ModManager modManager = mcMMO.getModManager(); ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) { if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false); plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
} }
for (String fileName : dataFolder.list()) { for (String fileName : dataFolder.list()) {

View File

@@ -15,7 +15,7 @@ public class EntityConfigManager {
ModManager modManager = mcMMO.getModManager(); ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) { if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false); plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "entities.default.yml", false);
} }
for (String fileName : dataFolder.list()) { for (String fileName : dataFolder.list()) {

View File

@@ -15,7 +15,7 @@ public class ToolConfigManager {
ModManager modManager = mcMMO.getModManager(); ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) { if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false); plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "tools.default.yml", false);
} }
for (String fileName : dataFolder.list()) { for (String fileName : dataFolder.list()) {

View File

@@ -96,6 +96,10 @@ public class RepairConfig extends ConfigLoader {
// Maximum Durability // Maximum Durability
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability")); short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
if (maximumDurability <= 0) {
maximumDurability = (short) config.getInt("Repairables." + key + ".MaximumDurability");
}
if (maximumDurability <= 0) { if (maximumDurability <= 0) {
reason.add("Maximum durability of " + key + " must be greater than 0!"); reason.add("Maximum durability of " + key + " must be greater than 0!");
} }

View File

@@ -1,75 +0,0 @@
package com.gmail.nossr50.config.spout;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import org.getspout.spoutapi.keyboard.Keyboard;
public class SpoutConfig extends ConfigLoader {
private static SpoutConfig instance;
private SpoutConfig() {
super("spout.yml");
}
public static SpoutConfig getInstance() {
if (instance == null) {
instance = new SpoutConfig();
}
return instance;
}
@Override
protected void loadKeys() {
// Setup default HUD
}
public HudType getDefaultHudType() {
try {
return HudType.valueOf(config.getString("Spout.HUD.Default", "STANDARD").toUpperCase().trim());
}
catch (IllegalArgumentException ex) {
return HudType.STANDARD;
}
}
public boolean getShowPowerLevel() { return config.getBoolean("HUD.Show_Power_Level", true); }
public Keyboard getMenuKey() {
try {
return Keyboard.valueOf(config.getString("Menu.Key", "KEY_M").toUpperCase().trim());
}
catch (IllegalArgumentException ex) {
return Keyboard.KEY_M;
}
}
/* XP Bar */
public boolean getXPBarEnabled() { return config.getBoolean("XP.Bar.Enabled", true); }
public void setXPBarEnabled(boolean enabled) { config.set("XP.Bar.Enabled", enabled); }
public boolean getXPBarIconEnabled() { return config.getBoolean("XP.Icon.Enabled", true); }
public int getXPBarXPosition() { return config.getInt("XP.Bar.X_POS", 95); }
public int getXPBarYPosition() { return config.getInt("XP.Bar.Y_POS", 6); }
public int getXPIconXPosition() { return config.getInt("XP.Icon.X_POS", 78); }
public int getXPIconYPosition() { return config.getInt("XP.Icon.Y_POS", 2); }
/* HUD Colors */
public double getRetroHUDXPBorderRed() { return config.getDouble("HUD.Retro.Colors.Border.RED", 0.0); }
public double getRetroHUDXPBorderGreen() { return config.getDouble("HUD.Retro.Colors.Border.GREEN", 0.0); }
public double getRetroHUDXPBorderBlue() { return config.getDouble("HUD.Retro.Colors.Border.BLUE", 0.0); }
public double getRetroHUDXPBackgroundRed() { return config.getDouble("HUD.Retro.Colors.Background.RED", 0.75); }
public double getRetroHUDXPBackgroundGreen() { return config.getDouble("HUD.Retro.Colors.Background.GREEN", 0.75); }
public double getRetroHUDXPBackgroundBlue() { return config.getDouble("HUD.Retro.Colors.Background.BLUE", 0.75); }
public double getRetroHUDRed(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
public double getRetroHUDGreen(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
public double getRetroHUDBlue(SkillType skill) { return config.getDouble("HUD.Retro.Colors." + skill.toString().toLowerCase() +".RED", 0.3); }
/* Notification Tiers */
public int getNotificationTier1() { return config.getInt("Notifications.Tier1", 200); }
public int getNotificationTier2() { return config.getInt("Notifications.Tier2", 400); }
public int getNotificationTier3() { return config.getInt("Notifications.Tier3", 600); }
public int getNotificationTier4() { return config.getInt("Notifications.Tier4", 800); }
}

View File

@@ -44,7 +44,7 @@ public interface DatabaseManager {
/** /**
* Retrieve leaderboard info. * Retrieve leaderboard info.
* *
* @param skillName The skill to retrieve info on * @param skill The skill to retrieve info on
* @param pageNumber Which page in the leaderboards to retrieve * @param pageNumber Which page in the leaderboards to retrieve
* @param statsPerPage The number of stats per page * @param statsPerPage The number of stats per page
* @return the requested leaderboard information * @return the requested leaderboard information

View File

@@ -25,8 +25,10 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
import org.apache.commons.lang.ArrayUtils;
public final class FlatfileDatabaseManager implements DatabaseManager { public final class FlatfileDatabaseManager implements DatabaseManager {
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>(); private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
@@ -259,8 +261,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
HudType hudType = profile.getHudType(); writer.append(":");
writer.append(hudType == null ? "STANDARD" : hudType.toString()).append(":");
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":"); writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":"); writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":"); writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
@@ -606,7 +607,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// Length checks depend on last character being ':' // Length checks depend on last character being ':'
if (line.charAt(line.length() - 1) != ':') { if (line.charAt(line.length() - 1) != ':') {
line = line + ":"; line = line.concat(":");
} }
String[] character = line.split(":"); String[] character = line.split(":");
@@ -623,29 +624,33 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
String oldVersion = null; String oldVersion = null;
if (character.length <= 33) {
// Introduction of HUDType
// Version 1.1.06
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
line = line.concat(" :");
character = line.split(":");
oldVersion = "1.1.06";
}
if (!character[33].isEmpty()) { if (!character[33].isEmpty()) {
// Removal of Spout Support // Removal of Spout Support
// Version 1.4.07-dev2 // Version 1.4.07-dev2
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968 // commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
line = line.replace(character[33], ""); line = line.replace(character[33], "");
oldVersion = "1.4.07"; if (oldVersion == null) {
oldVersion = "1.4.07";
}
} }
// If they're valid, rewrite them to the file. // If they're valid, rewrite them to the file.
if (character.length > 40) { if (character.length == 41) {
writer.append(line).append("\r\n"); writer.append(line).append("\r\n");
continue; continue;
} }
StringBuilder newLine = new StringBuilder(line); StringBuilder newLine = new StringBuilder(line);
if (character.length <= 33) {
// Introduction of HUDType
// Version 1.1.06
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
newLine.append(":");
oldVersion = "1.1.06";
}
if (character.length <= 35) { if (character.length <= 35) {
// Introduction of Fishing // Introduction of Fishing
// Version 1.2.00 // Version 1.2.00
@@ -684,7 +689,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
oldVersion = "1.4.06"; oldVersion = "1.4.06";
} }
} }
if (character.length <= 40) { if (character.length <= 39) {
// Addition of Alchemy // Addition of Alchemy
// Version 1.4.08 // Version 1.4.08
newLine.append("0").append(":"); newLine.append("0").append(":");
@@ -694,6 +699,46 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
} }
} }
// Remove any blanks that shouldn't be there, and validate the other fields
String[] newCharacter = newLine.toString().split(":");
boolean corrupted = false;
for (int i = 0; i < newCharacter.length; i++) {
if (newCharacter[i].isEmpty() && !(i == 2 || i == 3 || i == 23 || i == 33)) {
corrupted = true;
if (newCharacter.length != 41) {
newCharacter = (String[]) ArrayUtils.remove(newCharacter, i);
}
else {
if (i == 37) {
newCharacter[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
}
else if (i == 38) {
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
}
else {
newCharacter[i] = "0";
}
}
}
if (StringUtils.isInt(newCharacter[i]) && i == 38) {
corrupted = true;
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
}
if (!StringUtils.isInt(newCharacter[i]) && !(i == 0 || i == 2 || i == 3 || i == 23 || i == 33 || i == 38)) {
corrupted = true;
newCharacter[i] = "0";
}
}
if (corrupted) {
mcMMO.p.debug("Updating corrupted database line for player " + newCharacter[0]);
newLine = new StringBuilder(org.apache.commons.lang.StringUtils.join(newCharacter, ":"));
}
if (oldVersion != null) { if (oldVersion != null) {
mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion); mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion);
} }
@@ -769,11 +814,10 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
} }
} }
private PlayerProfile loadFromLine(String[] character) throws Exception { private PlayerProfile loadFromLine(String[] character) {
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
HudType hudType;
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
// TODO on updates, put new values in a try{} ? // TODO on updates, put new values in a try{} ?
@@ -805,13 +849,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// Acrobatics - Unused // Acrobatics - Unused
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[36])); skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(character[36]));
try {
hudType = HudType.valueOf(character[33]);
}
catch (Exception e) {
hudType = HudType.STANDARD; // Shouldn't happen unless database is being tampered with
}
try { try {
mobHealthbarType = MobHealthbarType.valueOf(character[38]); mobHealthbarType = MobHealthbarType.valueOf(character[38]);
} }
@@ -819,7 +856,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
mobHealthbarType = Config.getInstance().getMobHealthbarDefault(); mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
} }
return new PlayerProfile(character[0], skills, skillsXp, skillsDATS, hudType, mobHealthbarType); return new PlayerProfile(character[0], skills, skillsXp, skillsDATS, mobHealthbarType);
} }
private Map<SkillType, Integer> getSkillMapFromLine(String[] character) { private Map<SkillType, Integer> getSkillMapFromLine(String[] character) {

View File

@@ -22,7 +22,6 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.runnables.database.SQLDatabaseKeepaliveTask; import com.gmail.nossr50.runnables.database.SQLDatabaseKeepaliveTask;
import com.gmail.nossr50.runnables.database.SQLReconnectTask; import com.gmail.nossr50.runnables.database.SQLReconnectTask;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@@ -131,10 +130,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
boolean success = true; boolean success = true;
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType(); MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
HudType hudType = profile.getHudType();
success &= saveLogin(userId, ((int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))); success &= saveLogin(userId, ((int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
saveHuds(userId, (hudType == null ? "STANDARD" : hudType.toString()), (mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString())); success &= saveHuds(userId, (mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()));
success &= saveLongs( success &= saveLongs(
"UPDATE " + tablePrefix + "cooldowns SET " "UPDATE " + tablePrefix + "cooldowns SET "
+ " mining = ?, woodcutting = ?, unarmed = ?" + " mining = ?, woodcutting = ?, unarmed = ?"
@@ -801,7 +799,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
ResultSet resultSet; ResultSet resultSet;
HashMap<Integer, ArrayList<String>> rows = new HashMap<Integer, ArrayList<String>>();
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
@@ -813,13 +810,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
ArrayList<String> column = new ArrayList<String>(); // No reason to do anything here... we're just trying to catch exceptions
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
column.add(resultSet.getString(i));
}
rows.put(resultSet.getRow(), column);
} }
} }
catch (SQLException ex) { catch (SQLException ex) {
@@ -1166,7 +1157,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
} }
private boolean saveHuds(int userId, String hudType, String mobHealthBar) { private boolean saveHuds(int userId, String mobHealthBar) {
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
@@ -1196,7 +1187,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
HudType hudType;
MobHealthbarType mobHealthbarType; MobHealthbarType mobHealthbarType;
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added) final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added)
@@ -1245,13 +1235,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11) // Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
skillsDATS.put(AbilityType.BLAST_MINING, result.getInt(OFFSET_DATS + 12)); skillsDATS.put(AbilityType.BLAST_MINING, result.getInt(OFFSET_DATS + 12));
try {
hudType = HudType.valueOf(result.getString(OFFSET_OTHER + 1));
}
catch (Exception e) {
hudType = HudType.STANDARD; // Shouldn't happen unless database is being tampered with
}
try { try {
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 2)); mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 2));
} }
@@ -1259,7 +1242,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
mobHealthbarType = Config.getInstance().getMobHealthbarDefault(); mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
} }
return new PlayerProfile(playerName, skills, skillsXp, skillsDATS, hudType, mobHealthbarType); return new PlayerProfile(playerName, skills, skillsXp, skillsDATS, mobHealthbarType);
} }
private void printErrors(SQLException ex) { private void printErrors(SQLException ex) {

View File

@@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@@ -83,6 +84,19 @@ public class Party {
return onlineMembers; return onlineMembers;
} }
public List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<String>();
for (Player onlinePlayer : getOnlineMembers()) {
if (player != null && player.canSee(onlinePlayer)) {
onlinePlayerNames.add(onlinePlayer.getName());
}
}
return onlinePlayerNames;
}
public String getName() { public String getName() {
return name; return name;
} }
@@ -337,9 +351,4 @@ public class Party {
return this.getName().equals(other.getName()); return this.getName().equals(other.getName());
} }
@Override
public int hashCode() {
return super.hashCode();
}
} }

View File

@@ -24,7 +24,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
@@ -53,7 +52,6 @@ import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.spout.SpoutUtils;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
@@ -81,7 +79,6 @@ public class McMMOPlayer {
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>(); private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>(); private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
private final Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
private int recentlyHurt; private int recentlyHurt;
private int respawnATS; private int respawnATS;
@@ -90,7 +87,6 @@ public class McMMOPlayer {
private int chimeraWingLastUse; private int chimeraWingLastUse;
private Location teleportCommence; private Location teleportCommence;
private boolean isSpoutPlayer;
private boolean isUsingUnarmed; private boolean isUsingUnarmed;
private final FixedMetadataValue playerMetadata; private final FixedMetadataValue playerMetadata;
@@ -125,7 +121,6 @@ public class McMMOPlayer {
for (ToolType toolType : ToolType.values()) { for (ToolType toolType : ToolType.values()) {
toolMode.put(toolType, false); toolMode.put(toolType, false);
toolATS.put(toolType, 0);
} }
if (!profile.isLoaded()) { if (!profile.isLoaded()) {
@@ -343,28 +338,6 @@ public class McMMOPlayer {
toolMode.put(tool, isPrepared); toolMode.put(tool, isPrepared);
} }
/**
* Get the current prep ATS of a tool.
*
* @param tool Tool to get the ATS for
* @return the ATS for the tool
*/
public long getToolPreparationATS(ToolType tool) {
return toolATS.get(tool);
}
/**
* Set the current prep ATS of a tool.
*
* @param tool Tool to set the ATS for
* @param ATS the ATS of the tool
*/
public void setToolPreparationATS(ToolType tool, long ATS) {
int startTime = (int) (ATS / Misc.TIME_CONVERSION_FACTOR);
toolATS.put(tool, startTime);
}
/* /*
* Recently Hurt * Recently Hurt
*/ */
@@ -405,17 +378,6 @@ public class McMMOPlayer {
teleportCommence = player.getLocation(); teleportCommence = player.getLocation();
} }
/*
* Spout support
*/
public boolean isSpoutPlayer() {
return isSpoutPlayer;
}
public void setIsSpoutPlayer(boolean isSpoutPlayer) {
this.isSpoutPlayer = isSpoutPlayer;
}
/* /*
* Exploit Prevention * Exploit Prevention
*/ */
@@ -562,12 +524,6 @@ public class McMMOPlayer {
return; return;
} }
McMMOHud spoutHud = profile.getSpoutHud();
if (spoutHud != null) {
spoutHud.setLastGained(skillType);
}
isUsingUnarmed = (skillType == SkillType.UNARMED); isUsingUnarmed = (skillType == SkillType.UNARMED);
checkXp(skillType); checkXp(skillType);
} }
@@ -599,20 +555,11 @@ public class McMMOPlayer {
return; return;
} }
if (this.isSpoutPlayer) { if (Config.getInstance().getLevelUpSoundsEnabled()) {
SpoutUtils.processLevelup(this, skillType, levelsGained); player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
else {
if (Config.getInstance().getLevelUpSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
} }
if (this.isSpoutPlayer) { player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
SpoutUtils.processXpGain(player, profile);
}
} }
/* /*
@@ -623,10 +570,6 @@ public class McMMOPlayer {
return player; return player;
} }
public void setPlayer(Player player) {
this.player = player;
}
public PlayerProfile getProfile() { public PlayerProfile getProfile() {
return profile; return profile;
} }
@@ -906,7 +849,6 @@ public class McMMOPlayer {
player.sendMessage(tool.getRaiseTool()); player.sendMessage(tool.getRaiseTool());
} }
setToolPreparationATS(tool, System.currentTimeMillis());
setToolPreparationMode(tool, true); setToolPreparationMode(tool, true);
new ToolLowerTask(this, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR); new ToolLowerTask(this, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
} }
@@ -975,14 +917,6 @@ public class McMMOPlayer {
profile.resetCooldowns(); profile.resetCooldowns();
} }
public McMMOHud getSpoutHud() {
return profile.getSpoutHud();
}
public void setSpoutHud(McMMOHud spoutHud) {
profile.setSpoutHud(spoutHud);
}
public FixedMetadataValue getPlayerMetadata() { public FixedMetadataValue getPlayerMetadata() {
return playerMetadata; return playerMetadata;
} }

View File

@@ -7,13 +7,10 @@ import java.util.Set;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@@ -25,9 +22,7 @@ public class PlayerProfile {
private boolean changed; private boolean changed;
/* HUDs */ /* HUDs */
private HudType hudType;
private MobHealthbarType mobHealthbarType; private MobHealthbarType mobHealthbarType;
private McMMOHud spoutHud;
/* Skill Data */ /* Skill Data */
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
@@ -37,7 +32,6 @@ public class PlayerProfile {
public PlayerProfile(String playerName) { public PlayerProfile(String playerName) {
this.playerName = playerName; this.playerName = playerName;
hudType = mcMMO.isSpoutEnabled() ? SpoutConfig.getInstance().getDefaultHudType() : HudType.DISABLED;
mobHealthbarType = Config.getInstance().getMobHealthbarDefault(); mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
for (AbilityType abilityType : AbilityType.values()) { for (AbilityType abilityType : AbilityType.values()) {
@@ -55,10 +49,8 @@ public class PlayerProfile {
this.loaded = isLoaded; this.loaded = isLoaded;
} }
public PlayerProfile(String playerName, Map<SkillType, Integer> levelData, Map<SkillType, Float> xpData, Map<AbilityType, Integer> cooldownData, HudType hudType, MobHealthbarType mobHealthbarType) { public PlayerProfile(String playerName, Map<SkillType, Integer> levelData, Map<SkillType, Float> xpData, Map<AbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType) {
this.playerName = playerName; this.playerName = playerName;
this.hudType = hudType;
this.mobHealthbarType = mobHealthbarType; this.mobHealthbarType = mobHealthbarType;
skills.putAll(levelData); skills.putAll(levelData);
@@ -73,7 +65,7 @@ public class PlayerProfile {
return; return;
} }
changed = !mcMMO.getDatabaseManager().saveUser(new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), hudType, mobHealthbarType)); changed = !mcMMO.getDatabaseManager().saveUser(new PlayerProfile(playerName, ImmutableMap.copyOf(skills), ImmutableMap.copyOf(skillsXp), ImmutableMap.copyOf(abilityDATS), mobHealthbarType));
if (changed) { if (changed) {
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save"); mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
@@ -88,26 +80,6 @@ public class PlayerProfile {
return loaded; return loaded;
} }
/*
* HUD Stuff
*/
public HudType getHudType() {
return hudType;
}
public McMMOHud getSpoutHud() {
return spoutHud;
}
public void setSpoutHud(McMMOHud spoutHud) {
this.spoutHud = spoutHud;
}
public void setHudType(HudType hudType) {
this.hudType = hudType;
}
/* /*
* Mob Healthbars * Mob Healthbars
*/ */

View File

@@ -1,24 +0,0 @@
package com.gmail.nossr50.datatypes.spout.buttons;
import org.getspout.spoutapi.gui.GenericButton;
public class McMMOButton extends GenericButton {
private Slot slot;
public McMMOButton(String text, String toolTip) {
this.setText(text);
this.setTooltip(toolTip);
}
public void connect(Slot slot) {
this.slot = slot;
}
public void activate() {
slot.activate();
}
public interface Slot {
public void activate();
}
}

View File

@@ -1,12 +0,0 @@
package com.gmail.nossr50.datatypes.spout.huds;
public enum HudType {
DISABLED,
STANDARD,
SMALL,
RETRO;
public HudType getNext() {
return values()[(ordinal() + 1) % values().length];
}
}

View File

@@ -1,106 +0,0 @@
package com.gmail.nossr50.datatypes.spout.huds;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.popups.McMMOMenu;
import com.gmail.nossr50.datatypes.spout.popups.McMMOXpBar;
import org.getspout.spoutapi.SpoutManager;
public class McMMOHud {
private Player player;
private PlayerProfile profile;
private SkillType lastGained;
private SkillType skillLock;
private boolean xpBarLocked;
private McMMOMenu menu;
private McMMOXpBar xpBar;
public McMMOHud(McMMOPlayer mcMMOPlayer) {
this.player = mcMMOPlayer.getPlayer();
this.profile = mcMMOPlayer.getProfile();
initializeXpBar();
}
/**
* Initialize the HUD.
*/
public void initializeXpBar() {
if (SpoutConfig.getInstance().getXPBarEnabled()) {
if (xpBar != null) {
xpBar.removeWidgets();
}
xpBar = new McMMOXpBar(SpoutManager.getPlayer(player), profile.getHudType());
}
}
/**
* Update the XP bar.
*/
public void updateXpBar() {
SkillType skillType = xpBarLocked ? skillLock : lastGained;
if (skillType == null) {
return;
}
xpBar.update(skillType, profile);
}
public boolean isMenuOpened() {
return (menu != null);
}
public void openMenu() {
menu = new McMMOMenu(SpoutManager.getPlayer(player), profile);
}
public void onMenuClose() {
menu = null;
}
public void removeWidgets() {
if (menu != null) {
menu.close();
}
SpoutManager.getPlayer(player).getMainScreen().removeWidgets(mcMMO.p);
}
public SkillType getLastGained() {
return lastGained;
}
public void setLastGained(SkillType type) {
this.lastGained = type;
}
public boolean getXpBarLocked() {
return xpBarLocked;
}
public void setXpBarLocked(boolean locked) {
this.xpBarLocked = locked;
}
public void toggleXpBarLocked() {
xpBarLocked = !xpBarLocked;
}
public SkillType getSkillLock() {
return skillLock;
}
public void setSkillLock(SkillType type) {
this.skillLock = type;
}
}

View File

@@ -1,82 +0,0 @@
package com.gmail.nossr50.datatypes.spout.popups;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.spout.buttons.McMMOButton;
import com.gmail.nossr50.datatypes.spout.buttons.McMMOButton.Slot;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.locale.LocaleLoader;
import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.GenericPopup;
import org.getspout.spoutapi.gui.InGameHUD;
import org.getspout.spoutapi.player.SpoutPlayer;
public class McMMOMenu extends GenericPopup {
private McMMOButton hudButton;
private McMMOButton escapeButton;
private GenericLabel titleLabel = new GenericLabel();
private GenericLabel escapeLabel = new GenericLabel();
private static int centerX = 427 / 2;
private static int centerY = 240 / 2;
public McMMOMenu(final SpoutPlayer spoutPlayer, final PlayerProfile playerProfile) {
// 240, 427 are the bottom right
titleLabel.setText(LocaleLoader.getString("Spout.Menu.Title"));
titleLabel.setWidth(100);
titleLabel.setHeight(100);
titleLabel.setX(centerX - 35);
titleLabel.setY((centerY / 2) - 20);
escapeLabel.setText(LocaleLoader.getString("Spout.Menu.Exit"));
escapeLabel.setWidth(100);
escapeLabel.setHeight(100);
escapeLabel.setX(titleLabel.getX() - 15);
escapeLabel.setY(titleLabel.getY() + 10);
hudButton = new McMMOButton(LocaleLoader.getString("Spout.Menu.HudButton.1", playerProfile.getHudType().toString()), LocaleLoader.getString("Spout.Menu.HudButton.2"));
hudButton.setWidth(120);
hudButton.setHeight(20);
hudButton.setX(centerX - (hudButton.getWidth() / 2));
hudButton.setY(centerY / 2);
hudButton.connect(new Slot() {
@Override
public void activate() {
HudType nextHudType = playerProfile.getHudType().getNext();
McMMOHud spoutHud = playerProfile.getSpoutHud();
playerProfile.setHudType(nextHudType);
spoutHud.initializeXpBar();
spoutHud.updateXpBar();
hudButton.setText("HUD Type: " + nextHudType.toString());
hudButton.setDirty(true);
}
});
escapeButton = new McMMOButton(LocaleLoader.getString("Spout.Menu.ExitButton"), null);
escapeButton.setWidth(60);
escapeButton.setHeight(20);
escapeButton.setX(centerX - (escapeButton.getWidth() / 2));
escapeButton.setY((centerY / 2) + (escapeButton.getHeight() * 2) + 5);
escapeButton.connect(new Slot() {
@Override
public void activate() {
spoutPlayer.getMainScreen().closePopup();
}
});
attachWidget(mcMMO.p, hudButton);
attachWidget(mcMMO.p, titleLabel);
attachWidget(mcMMO.p, escapeLabel);
attachWidget(mcMMO.p, escapeButton);
InGameHUD inGameHud = spoutPlayer.getMainScreen();
inGameHud.attachPopupScreen(this);
inGameHud.setDirty(true);
}
}

View File

@@ -1,305 +0,0 @@
package com.gmail.nossr50.datatypes.spout.popups;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.StringUtils;
import org.getspout.spoutapi.gui.Color;
import org.getspout.spoutapi.gui.GenericGradient;
import org.getspout.spoutapi.gui.GenericTexture;
import org.getspout.spoutapi.gui.InGameHUD;
import org.getspout.spoutapi.gui.RenderPriority;
import org.getspout.spoutapi.gui.Widget;
import org.getspout.spoutapi.player.SpoutPlayer;
public class McMMOXpBar {
private SpoutPlayer spoutPlayer;
private Widget xpBar;
private GenericGradient xpFill;
private GenericGradient xpBackground;
private GenericGradient xpIconBackground;
private GenericGradient xpIconBorder;
private GenericTexture xpIcon;
public McMMOXpBar(SpoutPlayer spoutPlayer, HudType hudType) {
this.spoutPlayer = spoutPlayer;
switch (hudType) {
case RETRO:
initializeXpBarRetro();
break;
case STANDARD:
initializeXpBarStandard();
break;
case SMALL:
initializeXpBarSmall();
break;
case DISABLED:
break;
default:
break;
}
spoutPlayer.getMainScreen().setDirty(true);
}
public void removeWidgets() {
InGameHUD inGameHud = spoutPlayer.getMainScreen();
if (xpBar != null) {
inGameHud.removeWidget(xpBar);
}
if (xpFill != null) {
inGameHud.removeWidget(xpFill);
}
if (xpBackground != null) {
inGameHud.removeWidget(xpBackground);
}
if (xpIconBackground != null) {
inGameHud.removeWidget(xpIconBackground);
}
if (xpIconBorder != null) {
inGameHud.removeWidget(xpIconBorder);
}
if (xpIcon != null) {
inGameHud.removeWidget(xpIcon);
}
}
/**
* Initialize Retro XP bar.
*/
private void initializeXpBarRetro() {
Color border = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBorderRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBorderBlue(), 1f);
Color green = new Color(0f, 1f, 0f, 1f);
Color background = new Color((float) SpoutConfig.getInstance().getRetroHUDXPBackgroundRed(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundGreen(), (float) SpoutConfig.getInstance().getRetroHUDXPBackgroundBlue(), 1f);
xpBar = new GenericGradient();
xpFill = new GenericGradient();
xpBackground = new GenericGradient();
xpBar.setWidth(128);
xpBar.setHeight(4);
xpBar.setX(149);
xpBar.setY(10);
((GenericGradient) xpBar).setBottomColor(border);
((GenericGradient) xpBar).setTopColor(border);
xpBar.setPriority(RenderPriority.Highest);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
xpFill.setWidth(0);
xpFill.setHeight(2);
xpFill.setX(150);
xpFill.setY(11);
xpFill.setBottomColor(green);
xpFill.setTopColor(green);
xpFill.setPriority(RenderPriority.Lowest);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpFill);
xpBackground.setWidth(126);
xpBackground.setHeight(2);
xpBackground.setX(150);
xpBackground.setY(11);
xpBackground.setBottomColor(background);
xpBackground.setTopColor(background);
xpBackground.setPriority(RenderPriority.Low);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBackground);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpIconBackground = new GenericGradient();
xpIconBorder = new GenericGradient();
xpIcon = new GenericTexture();
xpIconBackground.setBottomColor(darkbg);
xpIconBackground.setTopColor(darkbg);
xpIconBackground.setWidth(4);
xpIconBackground.setHeight(4);
xpIconBackground.setPriority(RenderPriority.High);
xpIconBackground.setX(142);
xpIconBackground.setY(10);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIconBackground);
xpIconBorder.setBottomColor(border);
xpIconBorder.setTopColor(border);
xpIconBorder.setWidth(6);
xpIconBorder.setHeight(6);
xpIconBorder.setPriority(RenderPriority.Highest);
xpIconBorder.setX(141);
xpIconBorder.setY(9);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIconBorder);
xpIcon.setWidth(6);
xpIcon.setHeight(6);
xpIcon.setX(141);
xpIcon.setY(9);
xpIcon.setPriority(RenderPriority.Normal);
xpIcon.setUrl("Icon_r.png");
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
}
}
/**
* Initialize Standard XP bar.
*/
private void initializeXpBarStandard() {
xpBar = new GenericTexture();
((GenericTexture) xpBar).setUrl("xpbar_inc000.png");
xpBar.setX(SpoutConfig.getInstance().getXPBarXPosition());
xpBar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpBar.setHeight(8);
xpBar.setWidth(256);
xpBar.setPriority(RenderPriority.Lowest);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpIcon = new GenericTexture();
xpIcon.setUrl("Icon.png");
xpIcon.setHeight(16);
xpIcon.setWidth(32);
xpIcon.setX(SpoutConfig.getInstance().getXPIconXPosition());
xpIcon.setY(SpoutConfig.getInstance().getXPIconYPosition());
xpIcon.setPriority(RenderPriority.High);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
}
}
/**
* Initialize Small XP bar.
*/
private void initializeXpBarSmall() {
xpBar = new GenericTexture();
((GenericTexture) xpBar).setUrl("xpbar_inc000.png");
xpBar.setX(427 / 2 - 64);
xpBar.setY(SpoutConfig.getInstance().getXPBarYPosition());
xpBar.setHeight(4);
xpBar.setWidth(128);
xpBar.setPriority(RenderPriority.Lowest);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpBar);
if (SpoutConfig.getInstance().getXPBarIconEnabled()) {
xpIcon = new GenericTexture();
xpIcon.setUrl("Icon.png");
xpIcon.setHeight(8);
xpIcon.setWidth(16);
xpIcon.setX(427 / 2 - (8 + 64));
xpIcon.setY(SpoutConfig.getInstance().getXPIconYPosition() + 2);
xpIcon.setPriority(RenderPriority.High);
spoutPlayer.getMainScreen().attachWidget(mcMMO.p, xpIcon);
}
}
/**
* Update the XP bar.
*
* @param skillType The skill last used
* @param playerProfile The profile of the player whose XP bar should be updated
*/
public void update(SkillType skillType, PlayerProfile playerProfile) {
switch (playerProfile.getHudType()) {
case RETRO:
updateXpBarRetro(skillType, playerProfile);
break;
case STANDARD:
case SMALL:
updateXpBarStandard(skillType, playerProfile);
break;
case DISABLED:
break;
default:
break;
}
}
/**
* Update XP bar for Standard & Small styles.
*
* @param skillType The skill last used
* @param playerProfile The profile of the player whose XP bar should be updated
*/
private void updateXpBarStandard(SkillType skillType, PlayerProfile playerProfile) {
xpIcon.setUrl(StringUtils.getCapitalized(skillType.toString()) + ".png");
((GenericTexture) xpBar).setUrl(getUrlBar(getXpInc(playerProfile.getSkillXpLevel(skillType), playerProfile.getXpToLevel(skillType), HudType.STANDARD)));
spoutPlayer.getMainScreen().setDirty(true);
}
/**
* Update XP bar for Retro styles.
*
* @param skillType The skill last used
* @param playerProfile The profile of the player whose XP bar should be updated
*/
private void updateXpBarRetro(SkillType skillType, PlayerProfile playerProfile) {
Color color = getRetroColor(skillType);
xpIcon.setUrl(StringUtils.getCapitalized(skillType.toString()) + "_r.png");
xpFill.setBottomColor(color);
xpFill.setTopColor(color);
xpFill.setWidth(getXpInc(playerProfile.getSkillXpLevel(skillType), playerProfile.getXpToLevel(skillType), HudType.RETRO));
spoutPlayer.getMainScreen().setDirty(true);
}
private static Color getRetroColor(SkillType type) {
return new Color((float) SpoutConfig.getInstance().getRetroHUDRed(type), (float) SpoutConfig.getInstance().getRetroHUDGreen(type), (float) SpoutConfig.getInstance().getRetroHUDBlue(type), 1f);
}
private static String getUrlBar(Integer number) {
char[] num = number.toString().toCharArray();
switch (num.length) {
case 1:
return "xpbar_inc00" + number + ".png";
case 2:
return "xpbar_inc0" + number + ".png";
default:
return "xpbar_inc" + number + ".png";
}
}
private static Integer getXpInc(int skillXp, int xpToLevel, HudType hudType) {
double percentage = (double) skillXp / xpToLevel;
double inc;
switch (hudType) {
case RETRO:
inc = 0.0079365079365079;
break;
case STANDARD:
inc = 0.0039370078740157;
break;
default:
return 1;
}
return (int) (percentage / inc);
}
}

View File

@@ -0,0 +1,14 @@
package com.gmail.nossr50.events.fake;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityTameEvent;
/**
* Called when mcMMO tames an animal via Call of the Wild
*/
public class FakeEntityTameEvent extends EntityTameEvent {
public FakeEntityTameEvent(LivingEntity entity, AnimalTamer owner) {
super (entity, owner);
}
}

View File

@@ -15,6 +15,7 @@ public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbili
/** /**
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance * Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
*
* @return The activation chance of the ability * @return The activation chance of the ability
*/ */
public double getChance() { public double getChance() {
@@ -23,7 +24,8 @@ public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbili
/** /**
* Sets the activation chance of the ability [0D-1.0D] * Sets the activation chance of the ability [0D-1.0D]
* @param The activation chance of the ability *
* @param chance The activation chance of the ability
*/ */
public void setChance(double chance) { public void setChance(double chance) {
this.chance = chance; this.chance = chance;
@@ -31,7 +33,8 @@ public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbili
/** /**
* Sets the activation chance of the ability to 100% or 0% * Sets the activation chance of the ability to 100% or 0%
* @param whether it should be successful or not *
* @param success whether it should be successful or not
*/ */
public void setSuccessful(boolean success) { public void setSuccessful(boolean success) {
this.chance = success ? 1.0D : 0D; this.chance = success ? 1.0D : 0D;

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.listeners;
import java.util.List; import java.util.List;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@@ -66,7 +67,7 @@ public class BlockListener implements Listener {
for (Block b : blocks) { for (Block b : blocks) {
if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) { if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) {
b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue); b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue);
if (b.equals(futureEmptyBlock)) { if (b.equals(futureEmptyBlock) && futureEmptyBlock.getType() == Material.AIR) {
mcMMO.getPlaceStore().setFalse(b); mcMMO.getPlaceStore().setFalse(b);
} }
} }
@@ -89,10 +90,14 @@ public class BlockListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) { public void onBlockPistonRetract(BlockPistonRetractEvent event) {
if (event.isSticky()) { if (!event.isSticky()) {
// Needed only because under some circumstances Minecraft doesn't move the block return;
new StickyPistonTrackerTask(event.getDirection(), event.getBlock()).runTaskLater(plugin, 2);
} }
Block movedBlock = event.getRetractLocation().getBlock();
// Needed only because under some circumstances Minecraft doesn't move the block
new StickyPistonTrackerTask(event.getDirection(), event.getBlock(), movedBlock).runTaskLater(plugin, 2);
} }
/** /**
@@ -132,14 +137,15 @@ public class BlockListener implements Listener {
} }
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
Location location = blockState.getLocation();
if (!BlockUtils.shouldBeWatched(blockState)) { if (!BlockUtils.shouldBeWatched(blockState)) {
return; return;
} }
/* ALCHEMY - Cancel any brew in progress for that BrewingStand */ /* ALCHEMY - Cancel any brew in progress for that BrewingStand */
if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(event.getBlock())) { if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(location)) {
Alchemy.brewingStandMap.get(event.getBlock()).cancelBrew(); Alchemy.brewingStandMap.get(location).cancelBrew();
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
@@ -176,7 +182,7 @@ public class BlockListener implements Listener {
} }
/* WOOD CUTTING */ /* WOOD CUTTING */
else if (BlockUtils.isLog(blockState) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) { else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager(); WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
if (woodcuttingManager.canUseTreeFeller(heldItem)) { if (woodcuttingManager.canUseTreeFeller(heldItem)) {

View File

@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@@ -30,10 +31,10 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
@@ -42,6 +43,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
@@ -51,6 +53,7 @@ import com.gmail.nossr50.skills.herbalism.Herbalism;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
@@ -72,14 +75,12 @@ public class EntityListener implements Listener {
return; return;
} }
ItemStack bow = event.getBow(); if (event.getBow().containsEnchantment(Enchantment.ARROW_INFINITE)) {
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue); projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
} }
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0))); projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation()))); projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -91,7 +92,7 @@ public class EntityListener implements Listener {
} }
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0)); projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0));
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, Archery.locationToString(projectile.getLocation()))); projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
} }
/** /**
@@ -101,21 +102,29 @@ public class EntityListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) { public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Entity entity = event.getEntity(); Block block = event.getBlock();
if (!(entity instanceof FallingBlock)) { if (!BlockUtils.shouldBeWatched(block.getState())) {
return; return;
} }
Block block = event.getBlock(); Entity entity = event.getEntity();
boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey);
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) { if (entity instanceof FallingBlock || entity instanceof Enderman) {
mcMMO.getPlaceStore().setFalse(block); boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey);
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
mcMMO.getPlaceStore().setFalse(block);
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
}
else if (isTracked) {
mcMMO.getPlaceStore().setTrue(block);
}
} }
else if (isTracked) { else {
mcMMO.getPlaceStore().setTrue(block); if (mcMMO.getPlaceStore().isTrue(block)) {
mcMMO.getPlaceStore().setFalse(block);
}
} }
} }
@@ -143,7 +152,7 @@ public class EntityListener implements Listener {
return; return;
} }
if (!UserManager.hasPlayerDataKey(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) { if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
return; return;
} }
@@ -174,6 +183,10 @@ public class EntityListener implements Listener {
Player defendingPlayer = (Player) defender; Player defendingPlayer = (Player) defender;
Player attackingPlayer = (Player) attacker; Player attackingPlayer = (Player) attacker;
if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) {
return;
}
// We want to make sure we're not gaining XP or applying abilities when we hit ourselves // We want to make sure we're not gaining XP or applying abilities when we hit ourselves
if (defendingPlayer.equals(attackingPlayer)) { if (defendingPlayer.equals(attackingPlayer)) {
return; return;
@@ -186,6 +199,7 @@ public class EntityListener implements Listener {
} }
CombatUtils.processCombatAttack(event, attacker, target); CombatUtils.processCombatAttack(event, attacker, target);
CombatUtils.handleHealthbars(attacker, target, event.getDamage());
} }
/** /**
@@ -226,6 +240,11 @@ public class EntityListener implements Listener {
if (livingEntity instanceof Player) { if (livingEntity instanceof Player) {
Player player = (Player) entity; Player player = (Player) entity;
if (!UserManager.hasPlayerDataKey(player)) {
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
/* Check for invincibility */ /* Check for invincibility */
@@ -236,7 +255,7 @@ public class EntityListener implements Listener {
switch (cause) { switch (cause) {
case FALL: case FALL:
if (Config.getInstance().getPreventXPAfterTeleport() && SkillUtils.calculateTimeLeft((long) mcMMOPlayer.getTeleportATS() * Misc.TIME_CONVERSION_FACTOR, 5, player) > 0) { if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
return; return;
} }
@@ -557,6 +576,10 @@ public class EntityListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityTame(EntityTameEvent event) { public void onEntityTame(EntityTameEvent event) {
if (event instanceof FakeEntityTameEvent) {
return;
}
Player player = (Player) event.getOwner(); Player player = (Player) event.getOwner();
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
@@ -603,9 +626,8 @@ public class EntityListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) { public void onPotionSplash(PotionSplashEvent event) {
for (PotionEffect effect : ((PotionMeta) event.getEntity().getItem().getItemMeta()).getCustomEffects()) { for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
// (effect.getType() != PotionEffectType.SATURATION) is seemingly broken, so we use deprecated method for now. if (!effect.getType().equals(PotionEffectType.SATURATION)) {
if (effect.getType().getId() != 23) {
return; return;
} }

View File

@@ -183,7 +183,10 @@ public class InventoryListener implements Listener {
return; return;
} }
AlchemyPotionBrewer.transferItems(event.getView(), event.getRawSlot(), Alchemy.INGREDIENT_SLOT, click); if (!AlchemyPotionBrewer.transferItems(event.getView(), event.getRawSlot(), click)) {
return;
}
event.setCancelled(true); event.setCancelled(true);
AlchemyPotionBrewer.scheduleUpdate(inventory); AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(player, stand); AlchemyPotionBrewer.scheduleCheck(player, stand);

View File

@@ -6,6 +6,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -81,7 +82,7 @@ public class PlayerListener implements Listener {
public void onPlayerTeleport(PlayerTeleportEvent event) { public void onPlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !Config.getInstance().getPreventXPAfterTeleport() || event.getFrom().equals(event.getTo())) { if (!UserManager.hasPlayerDataKey(player) || Config.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) {
return; return;
} }
@@ -304,7 +305,7 @@ public class PlayerListener implements Listener {
ItemStack dropStack = drop.getItemStack(); ItemStack dropStack = drop.getItemStack();
if (drop.hasMetadata(mcMMO.disarmedItemKey)) { if (drop.hasMetadata(mcMMO.disarmedItemKey)) {
if (!player.getName().equals(drop.getMetadata(mcMMO.disarmedItemKey).get(0).value())) { if (!player.getName().equals(drop.getMetadata(mcMMO.disarmedItemKey).get(0).asString())) {
event.setCancelled(true); event.setCancelled(true);
} }
@@ -596,21 +597,14 @@ public class PlayerListener implements Listener {
Material type = heldItem.getType(); Material type = heldItem.getType();
TamingManager tamingManager = mcMMOPlayer.getTamingManager(); TamingManager tamingManager = mcMMOPlayer.getTamingManager();
switch (type) { if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.WOLF)) {
case APPLE: tamingManager.summonWolf();
tamingManager.summonHorse(); }
break; else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.OCELOT)) {
tamingManager.summonOcelot();
case BONE: }
tamingManager.summonWolf(); else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.HORSE)) {
break; tamingManager.summonHorse();
case RAW_FISH:
tamingManager.summonOcelot();
break;
default:
break;
} }
break; break;
@@ -633,7 +627,7 @@ public class PlayerListener implements Listener {
return; return;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player);
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server."); mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");

View File

@@ -1,95 +0,0 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.spout.buttons.McMMOButton;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.datatypes.spout.popups.McMMOMenu;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
import org.getspout.spoutapi.event.input.KeyPressedEvent;
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.gui.Button;
import org.getspout.spoutapi.gui.ScreenType;
import org.getspout.spoutapi.player.SpoutPlayer;
public class SpoutListener implements Listener {
/**
* Monitor SpoutCraftEnable events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpoutCraftEnable(SpoutCraftEnableEvent event) {
SpoutPlayer spoutPlayer = event.getPlayer();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(spoutPlayer);
mcMMOPlayer.setIsSpoutPlayer(true);
// TODO: Add custom titles based on skills
if (SpoutConfig.getInstance().getShowPowerLevel()) {
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", spoutPlayer.getTitle(), mcMMOPlayer.getPowerLevel()));
}
mcMMOPlayer.setSpoutHud(new McMMOHud(mcMMOPlayer)); // Setup Party HUD stuff
}
/**
* Monitor Spout ButtonClick events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onButtonClick(ButtonClickEvent event) {
Button button = event.getButton();
if (button instanceof McMMOButton) {
((McMMOButton) button).activate();
}
}
/**
* Monitor Spout ScreenClose events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onScreenClose(ScreenCloseEvent event) {
if (event.getScreen() instanceof McMMOMenu) {
SpoutPlayer spoutPlayer = event.getPlayer();
UserManager.getPlayer(spoutPlayer).getSpoutHud().onMenuClose();
spoutPlayer.getMainScreen().setDirty(true);
}
}
/**
* Monitor Spout KeyPressed events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onKeyPressed(KeyPressedEvent event) {
SpoutPlayer spoutPlayer = event.getPlayer();
if (spoutPlayer.getMainScreen().getActivePopup() != null || event.getScreenType() != ScreenType.GAME_SCREEN) {
return;
}
if (event.getKey() == SpoutConfig.getInstance().getMenuKey()) {
McMMOHud spoutHud = UserManager.getPlayer(spoutPlayer).getSpoutHud();
if (!spoutHud.isMenuOpened()) {
spoutHud.openMenu();
}
}
}
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
@@ -18,7 +17,6 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionMain; import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionMain;
public class WorldListener implements Listener { public class WorldListener implements Listener {
private final ArrayList<BlockStoreConversionMain> converters = new ArrayList<BlockStoreConversionMain>();
private final mcMMO plugin; private final mcMMO plugin;
public WorldListener(final mcMMO plugin) { public WorldListener(final mcMMO plugin) {
@@ -56,9 +54,7 @@ public class WorldListener implements Listener {
plugin.getLogger().info("Converting block storage for " + world.getName() + " to a new format."); plugin.getLogger().info("Converting block storage for " + world.getName() + " to a new format.");
BlockStoreConversionMain converter = new BlockStoreConversionMain(world); new BlockStoreConversionMain(world).run();
converter.run();
converters.add(converter);
} }
/** /**

View File

@@ -20,7 +20,6 @@ import com.gmail.nossr50.config.mods.EntityConfigManager;
import com.gmail.nossr50.config.mods.ToolConfigManager; import com.gmail.nossr50.config.mods.ToolConfigManager;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.config.skills.repair.RepairConfigManager; import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.database.DatabaseManagerFactory;
@@ -29,11 +28,11 @@ import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.InventoryListener; import com.gmail.nossr50.listeners.InventoryListener;
import com.gmail.nossr50.listeners.PlayerListener; import com.gmail.nossr50.listeners.PlayerListener;
import com.gmail.nossr50.listeners.SelfListener; import com.gmail.nossr50.listeners.SelfListener;
import com.gmail.nossr50.listeners.SpoutListener;
import com.gmail.nossr50.listeners.WorldListener; import com.gmail.nossr50.listeners.WorldListener;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.metrics.MetricsManager; import com.gmail.nossr50.metrics.MetricsManager;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.CheckDateTask;
import com.gmail.nossr50.runnables.SaveTimerTask; import com.gmail.nossr50.runnables.SaveTimerTask;
import com.gmail.nossr50.runnables.backups.CleanBackupsTask; import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
import com.gmail.nossr50.runnables.database.UserPurgeTask; import com.gmail.nossr50.runnables.database.UserPurgeTask;
@@ -57,7 +56,6 @@ import com.gmail.nossr50.util.commands.CommandRegistrationManager;
import com.gmail.nossr50.util.experience.FormulaManager; import com.gmail.nossr50.util.experience.FormulaManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.spout.SpoutUtils;
import net.gravitydevelopment.updater.mcmmo.Updater; import net.gravitydevelopment.updater.mcmmo.Updater;
import net.gravitydevelopment.updater.mcmmo.Updater.UpdateResult; import net.gravitydevelopment.updater.mcmmo.Updater.UpdateResult;
@@ -88,12 +86,8 @@ public class mcMMO extends JavaPlugin {
private boolean updateAvailable; private boolean updateAvailable;
/* Plugin Checks */ /* Plugin Checks */
private static boolean spoutEnabled;
private static boolean combatTagEnabled; private static boolean combatTagEnabled;
private static boolean healthBarPluginEnabled; private static boolean healthBarPluginEnabled;
private static boolean noCheatPlusPluginEnabled;
private static boolean compatNoCheatPlusPluginEnabled;
private static boolean mcpcEnabled;
// Config Validation Check // Config Validation Check
public boolean noErrorsInConfigFiles = true; public boolean noErrorsInConfigFiles = true;
@@ -129,19 +123,12 @@ public class mcMMO extends JavaPlugin {
getLogger().setFilter(new LogFilter(this)); getLogger().setFilter(new LogFilter(this));
metadataValue = new FixedMetadataValue(this, true); metadataValue = new FixedMetadataValue(this, true);
spoutEnabled = getServer().getPluginManager().getPlugin("Spout") != null; PluginManager pluginManager = getServer().getPluginManager();
mcpcEnabled = getServer().getName().equals("MCPC+"); combatTagEnabled = pluginManager.getPlugin("CombatTag") != null;
combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null; healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null;
noCheatPlusPluginEnabled = getServer().getPluginManager().getPlugin("NoCheatPlus") != null;
compatNoCheatPlusPluginEnabled = getServer().getPluginManager().getPlugin("CompatNoCheatPlus") != null;
setupFilePaths(); setupFilePaths();
if (spoutEnabled) {
setupSpout();
}
modManager = new ModManager(); modManager = new ModManager();
loadConfigFiles(); loadConfigFiles();
@@ -150,7 +137,7 @@ public class mcMMO extends JavaPlugin {
return; return;
} }
if (mcpcEnabled) { if (getServer().getName().equals("MCPC+")) {
checkModConfigs(); checkModConfigs();
} }
@@ -158,7 +145,7 @@ public class mcMMO extends JavaPlugin {
getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled."); getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
} }
if (noCheatPlusPluginEnabled && !compatNoCheatPlusPluginEnabled) { if (pluginManager.getPlugin("NoCheatPlus") != null && pluginManager.getPlugin("CompatNoCheatPlus") == null) {
getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!"); getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!");
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus"); getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
} }
@@ -316,10 +303,6 @@ public class mcMMO extends JavaPlugin {
mcMMO.databaseManager = databaseManager; mcMMO.databaseManager = databaseManager;
} }
public static boolean isSpoutEnabled() {
return spoutEnabled;
}
public static boolean isCombatTagEnabled() { public static boolean isCombatTagEnabled() {
return combatTagEnabled; return combatTagEnabled;
} }
@@ -328,10 +311,6 @@ public class mcMMO extends JavaPlugin {
return healthBarPluginEnabled; return healthBarPluginEnabled;
} }
public static boolean isMCPCEnabled() {
return mcpcEnabled;
}
/** /**
* Setup the various storage file paths * Setup the various storage file paths
*/ */
@@ -448,13 +427,6 @@ public class mcMMO extends JavaPlugin {
repairableManager.registerRepairables(repairables); repairableManager.registerRepairables(repairables);
} }
private void setupSpout() {
SpoutConfig.getInstance();
getServer().getPluginManager().registerEvents(new SpoutListener(), this);
SpoutUtils.preCacheFiles();
SpoutUtils.reloadSpoutPlayers(); // Handle spout players after a /reload
}
private void registerEvents() { private void registerEvents() {
PluginManager pluginManager = getServer().getPluginManager(); PluginManager pluginManager = getServer().getPluginManager();
@@ -506,6 +478,10 @@ public class mcMMO extends JavaPlugin {
// Update power level tag scoreboards // Update power level tag scoreboards
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR); new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
if (getHolidayManager().nearingAprilFirst()) {
new CheckDateTask().runTaskTimer(this, 10L * Misc.TICK_CONVERSION_FACTOR, 1L * 60L * 60L * Misc.TICK_CONVERSION_FACTOR);
}
} }
private void checkModConfigs() { private void checkModConfigs() {

View File

@@ -260,6 +260,11 @@ public final class PartyManager {
processPartyLeaving(UserManager.getPlayer(member)); processPartyLeaving(UserManager.getPlayer(member));
} }
// Disband the alliance between the disbanded party and it's ally
if (party.getAlly() != null) {
party.getAlly().setAlly(null);
}
parties.remove(party); parties.remove(party);
} }
@@ -459,16 +464,6 @@ public final class PartyManager {
return !party.isLocked() || party.getLeader().equalsIgnoreCase(mcMMOPlayer.getPlayer().getName()); return !party.isLocked() || party.getLeader().equalsIgnoreCase(mcMMOPlayer.getPlayer().getName());
} }
/**
* Check if a string is a valid party name.
*
* @param partyName The party name to check
* @return true if this is a valid party, false otherwise
*/
public static boolean isParty(String partyName) {
return getParty(partyName) != null;
}
/** /**
* Load party file. * Load party file.
*/ */

View File

@@ -0,0 +1,24 @@
package com.gmail.nossr50.runnables;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AprilTask;
import com.gmail.nossr50.util.Misc;
public class CheckDateTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
// Set up jokes
new AprilTask().runTaskTimer(mcMMO.p, 1L * 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
mcMMO.getHolidayManager().registerAprilCommand();
// Jokes deployed.
this.cancel();
}
}

View File

@@ -1,31 +1,31 @@
package com.gmail.nossr50.runnables; package com.gmail.nossr50.runnables;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
public class StickyPistonTrackerTask extends BukkitRunnable { public class StickyPistonTrackerTask extends BukkitRunnable {
private BlockFace direction; private BlockFace direction;
private Block block; private Block block;
private Block movedBlock;
public StickyPistonTrackerTask(BlockFace direction, Block block) { public StickyPistonTrackerTask(BlockFace direction, Block block, Block movedBlock) {
this.direction = direction; this.direction = direction;
this.block = block; this.block = block;
this.movedBlock = movedBlock;
} }
@Override @Override
public void run() { public void run() {
Block newBlock = block.getRelative(direction); if (!BlockUtils.shouldBeWatched(movedBlock.getState()) || movedBlock.getPistonMoveReaction() != PistonMoveReaction.MOVE || !mcMMO.getPlaceStore().isTrue(movedBlock)) {
Block originalBlock = newBlock.getRelative(direction);
if (originalBlock.getType() != Material.AIR || !mcMMO.getPlaceStore().isTrue(originalBlock)) {
return; return;
} }
mcMMO.getPlaceStore().setFalse(originalBlock); mcMMO.getPlaceStore().setFalse(movedBlock);
mcMMO.getPlaceStore().setTrue(newBlock); mcMMO.getPlaceStore().setTrue(block.getRelative(direction));
} }
} }

View File

@@ -28,7 +28,7 @@ public class FormulaConversionTask extends BukkitRunnable {
int convertedUsers = 0; int convertedUsers = 0;
long startMillis = System.currentTimeMillis(); long startMillis = System.currentTimeMillis();
for (String playerName : mcMMO.getDatabaseManager().getStoredUsers()) { for (String playerName : mcMMO.getDatabaseManager().getStoredUsers()) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
PlayerProfile profile; PlayerProfile profile;
// 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. // 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.

View File

@@ -0,0 +1,55 @@
package com.gmail.nossr50.runnables.skills;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.HolidayManager;
import com.gmail.nossr50.util.Misc;
public class AprilTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
this.cancel();
return;
}
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
int betterRandom = Misc.getRandom().nextInt(2000);
if (betterRandom == 0) {
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
fireworksShow(player);
}
for (HolidayManager.FakeSkillType fakeSkillType : HolidayManager.FakeSkillType.values()) {
int random = Misc.getRandom().nextInt(250);
if (random == 0) {
mcMMO.getHolidayManager().levelUpApril(player, fakeSkillType);
break;
}
}
}
}
private void fireworksShow(final Player player) {
final int firework_amount = 10;
for (int i = 0; i < firework_amount; i++) {
int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
@Override
public void run() {
mcMMO.getHolidayManager().spawnFireworks(player);
}
}, delay);
}
}
private String unknown(String string) {
return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;
}
}

View File

@@ -17,10 +17,6 @@ public abstract class SkillManager {
this.skill = skill; this.skill = skill;
} }
public McMMOPlayer getMcMMOPlayer() {
return mcMMOPlayer;
}
public Player getPlayer() { public Player getPlayer() {
return mcMMOPlayer.getPlayer(); return mcMMOPlayer.getPlayer();
} }

View File

@@ -54,7 +54,7 @@ public final class AlchemyPotionBrewer {
} }
private static boolean removeIngredient(BrewerInventory inventory, Player player) { private static boolean removeIngredient(BrewerInventory inventory, Player player) {
ItemStack ingredient = inventory.getIngredient().clone(); ItemStack ingredient = inventory.getIngredient() == null ? null : inventory.getIngredient().clone();
if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) { if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) {
return false; return false;
@@ -101,7 +101,7 @@ public final class AlchemyPotionBrewer {
} }
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i).clone(); ItemStack item = inventory.getItem(i);
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) { if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
continue; continue;
@@ -124,25 +124,24 @@ public final class AlchemyPotionBrewer {
} }
} }
public static boolean transferItems(InventoryView view, int fromSlot, int toSlot, ClickType click) { public static boolean transferItems(InventoryView view, int fromSlot, ClickType click) {
boolean success = false; boolean success = false;
if (click.isLeftClick()) { if (click.isLeftClick()) {
success = transferItems(view, fromSlot, toSlot); success = transferItems(view, fromSlot);
} }
else if (click.isRightClick()) { else if (click.isRightClick()) {
success = transferOneItem(view, fromSlot, toSlot); success = transferOneItem(view, fromSlot);
} }
return success; return success;
} }
private static boolean transferOneItem(InventoryView view, int fromSlot, int toSlot) { private static boolean transferOneItem(InventoryView view, int fromSlot) {
ItemStack from = view.getItem(fromSlot).clone(); ItemStack from = view.getItem(fromSlot).clone();
ItemStack to = view.getItem(toSlot).clone(); ItemStack to = view.getItem(Alchemy.INGREDIENT_SLOT).clone();
boolean emptyFrom = isEmpty(from);
if (emptyFrom) { if (isEmpty(from)) {
return false; return false;
} }
@@ -162,8 +161,8 @@ public final class AlchemyPotionBrewer {
} }
from.setAmount(fromAmount - 1); from.setAmount(fromAmount - 1);
view.setItem(toSlot, emptyTo ? null : to); view.setItem(Alchemy.INGREDIENT_SLOT, to);
view.setItem(fromSlot, emptyFrom ? null : from); view.setItem(fromSlot, from);
return true; return true;
} }
@@ -174,15 +173,15 @@ public final class AlchemyPotionBrewer {
/** /**
* Transfer items between two ItemStacks, returning the leftover status * Transfer items between two ItemStacks, returning the leftover status
*/ */
private static boolean transferItems(InventoryView view, int fromSlot, int toSlot) { private static boolean transferItems(InventoryView view, int fromSlot) {
ItemStack from = view.getItem(fromSlot).clone(); ItemStack from = view.getItem(fromSlot).clone();
ItemStack to = view.getItem(toSlot).clone(); ItemStack to = view.getItem(Alchemy.INGREDIENT_SLOT).clone();
if (isEmpty(from)) { if (isEmpty(from)) {
return false; return false;
} }
else if (isEmpty(to)) { else if (isEmpty(to)) {
view.setItem(toSlot, from); view.setItem(Alchemy.INGREDIENT_SLOT, from);
view.setItem(fromSlot, null); view.setItem(fromSlot, null);
return true; return true;
@@ -196,7 +195,7 @@ public final class AlchemyPotionBrewer {
int left = fromAmount + toAmount - maxSize; int left = fromAmount + toAmount - maxSize;
to.setAmount(maxSize); to.setAmount(maxSize);
view.setItem(toSlot, to); view.setItem(Alchemy.INGREDIENT_SLOT, to);
from.setAmount(left); from.setAmount(left);
view.setItem(fromSlot, from); view.setItem(fromSlot, from);
@@ -206,7 +205,7 @@ public final class AlchemyPotionBrewer {
to.setAmount(fromAmount + toAmount); to.setAmount(fromAmount + toAmount);
view.setItem(fromSlot, null); view.setItem(fromSlot, null);
view.setItem(toSlot, to); view.setItem(Alchemy.INGREDIENT_SLOT, to);
return true; return true;
} }

View File

@@ -4,12 +4,10 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
@@ -63,14 +61,4 @@ public class Archery {
} }
} }
} }
public static Location stringToLocation(String location) {
String[] values = location.split(",");
return new Location(mcMMO.p.getServer().getWorld(values[0]), Double.parseDouble(values[1]), Double.parseDouble(values[2]), Double.parseDouble(values[3]), Float.parseFloat(values[4]), Float.parseFloat(values[5]));
}
public static String locationToString(Location location) {
return location.getWorld().getName() + "," + location.getX() + "," + location.getY() + "," + location.getZ() + "," + location.getYaw() + "," + location.getPitch();
}
} }

View File

@@ -45,7 +45,7 @@ public class ArcheryManager extends SkillManager {
* @param damager The {@link Entity} who shot the arrow * @param damager The {@link Entity} who shot the arrow
*/ */
public void distanceXpBonus(LivingEntity target, Entity damager) { public void distanceXpBonus(LivingEntity target, Entity damager) {
Location firedLocation = Archery.stringToLocation(damager.getMetadata(mcMMO.arrowDistanceKey).get(0).asString()); Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
Location targetLocation = target.getLocation(); Location targetLocation = target.getLocation();
if (firedLocation.getWorld() != targetLocation.getWorld()) { if (firedLocation.getWorld() != targetLocation.getWorld()) {

View File

@@ -54,8 +54,6 @@ public final class Fishing {
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2; public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5; public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5;
public static final double STORM_MODIFIER = 0.909;
private Fishing() {} private Fishing() {}
/** /**

View File

@@ -115,8 +115,8 @@ public class MiningManager extends SkillManager {
/** /**
* Handler for explosion drops and XP gain. * Handler for explosion drops and XP gain.
* *
* @param yield * @param yield The % of blocks to drop
* @param blockList * @param blockList The list of blocks to drop
*/ */
public void blastMiningDropProcessing(float yield, List<Block> blockList) { public void blastMiningDropProcessing(float yield, List<Block> blockList) {
List<BlockState> ores = new ArrayList<BlockState>(); List<BlockState> ores = new ArrayList<BlockState>();

View File

@@ -48,18 +48,6 @@ public class Repair {
return ""; return "";
} }
public static String[] getSpoutAnvilMessages(Material type) {
if (type == repairAnvilMaterial) {
return new String[]{LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
}
if (type == salvageAnvilMaterial) {
return new String[]{"[mcMMO] Anvil Placed", "Right click to salvage!"};
}
return new String[]{"", ""};
}
protected static Material getRepairAndSalvageItem(ItemStack inHand) { protected static Material getRepairAndSalvageItem(ItemStack inHand) {
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) { if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
return Material.DIAMOND; return Material.DIAMOND;

View File

@@ -27,7 +27,6 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.spout.SpoutUtils;
public class RepairManager extends SkillManager { public class RepairManager extends SkillManager {
private boolean placedRepairAnvil; private boolean placedRepairAnvil;
@@ -52,12 +51,7 @@ public class RepairManager extends SkillManager {
} }
if (Repair.anvilMessagesEnabled) { if (Repair.anvilMessagesEnabled) {
if (mcMMOPlayer.isSpoutPlayer()) { player.sendMessage(Repair.getAnvilMessage(anvilType));
SpoutUtils.sendRepairNotifications(player, anvilType);
}
else {
player.sendMessage(Repair.getAnvilMessage(anvilType));
}
} }
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) { if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
@@ -96,7 +90,15 @@ public class RepairManager extends SkillManager {
Material repairMaterial = repairable.getRepairMaterial(); Material repairMaterial = repairable.getRepairMaterial();
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata(); byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1); ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
short startDurability = item.getDurability();
// Do not repair if at full durability
if (startDurability <= 0) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
return;
}
// Check if they have the proper material to repair with // Check if they have the proper material to repair with
if (!inventory.contains(repairMaterial)) { if (!inventory.contains(repairMaterial)) {
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial)); String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
@@ -109,14 +111,6 @@ public class RepairManager extends SkillManager {
return; return;
} }
short startDurability = item.getDurability();
// Do not repair if at full durability
if (startDurability <= 0) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
return;
}
// Do not repair stacked items // Do not repair stacked items
if (item.getAmount() != 1) { if (item.getAmount() != 1) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems")); player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
@@ -346,7 +340,7 @@ public class RepairManager extends SkillManager {
if (getKeepEnchantChance() > Misc.getRandom().nextInt(activationChance)) { if (getKeepEnchantChance() > Misc.getRandom().nextInt(activationChance)) {
int enchantLevel = enchant.getValue(); int enchantLevel = enchant.getValue();
if (ArcaneForging.arcaneForgingDowngrades && enchantLevel > 1 && getDowngradeEnchantChance() > Misc.getRandom().nextInt(activationChance)) { if (ArcaneForging.arcaneForgingDowngrades && enchantLevel > 1 && (100 - getDowngradeEnchantChance()) <= Misc.getRandom().nextInt(activationChance)) {
item.addUnsafeEnchantment(enchantment, enchantLevel - 1); item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
downgraded = true; downgraded = true;
} }

View File

@@ -16,6 +16,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.runnables.skills.BleedTimerTask;
@@ -145,7 +146,7 @@ public class TamingManager extends SkillManager {
return; return;
} }
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWOcelotCost()); callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWCost(EntityType.OCELOT));
} }
/** /**
@@ -156,7 +157,7 @@ public class TamingManager extends SkillManager {
return; return;
} }
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost()); callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWCost(EntityType.WOLF));
} }
/** /**
@@ -167,7 +168,7 @@ public class TamingManager extends SkillManager {
return; return;
} }
callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWHorseCost()); callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWCost(EntityType.HORSE));
} }
/** /**
@@ -226,8 +227,16 @@ public class TamingManager extends SkillManager {
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
FakeEntityTameEvent event = new FakeEntityTameEvent(entity, player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
((Tameable) entity).setOwner(player); ((Tameable) entity).setOwner(player);
entity.setRemoveWhenFarAway(false);
switch (type) { switch (type) {
case OCELOT: case OCELOT:
@@ -246,7 +255,7 @@ public class TamingManager extends SkillManager {
entity.setHealth(entity.getMaxHealth()); entity.setHealth(entity.getMaxHealth());
horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]); horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]);
horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]); horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
horse.setJumpStrength(Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, AdvancedConfig.getInstance().getMaxHorseJumpStrength())); horse.setJumpStrength(Math.max(AdvancedConfig.getInstance().getMinHorseJumpStrength(), Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, AdvancedConfig.getInstance().getMaxHorseJumpStrength())));
//TODO: setSpeed, once available //TODO: setSpeed, once available
break; break;
@@ -260,7 +269,7 @@ public class TamingManager extends SkillManager {
} }
} }
player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount)); player.setItemInHand(heldItemAmount == summonAmount ? null : new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
} }

View File

@@ -19,25 +19,56 @@ import org.bukkit.Color;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.skills.AprilCommand;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public final class HolidayManager { public final class HolidayManager {
private ArrayList<String> hasCelebrated; private ArrayList<String> hasCelebrated;
private int currentYear; private int currentYear;
private final int startYear = 2011; private static final int START_YEAR = 2011;
private static final List<Color> ALL_COLORS; private static final List<Color> ALL_COLORS;
private static final List<ChatColor> ALL_CHAT_COLORS; private static final List<ChatColor> ALL_CHAT_COLORS;
private static final List<ChatColor> CHAT_FORMATS; private static final List<ChatColor> CHAT_FORMATS;
public enum FakeSkillType {
MACHO,
JUMPING,
THROWING,
WRECKING,
CRAFTING,
WALKING,
SWIMMING,
FALLING,
CLIMBING,
FLYING,
DIVING,
PIGGY,
UNKNOWN;
public static FakeSkillType getByName(String skillName) {
for (FakeSkillType type : values()) {
if (type.name().equalsIgnoreCase(skillName)) {
return type;
}
}
return null;
}
}
static { static {
List<Color> colors = new ArrayList<Color>(); List<Color> colors = new ArrayList<Color>();
List<ChatColor> chatColors = new ArrayList<ChatColor>(); List<ChatColor> chatColors = new ArrayList<ChatColor>();
@@ -165,7 +196,7 @@ public final class HolidayManager {
return; return;
} }
sender.sendMessage(ChatColor.BLUE + "Happy " + (currentYear - startYear) + " Year Anniversary! In honor of all of"); sender.sendMessage(ChatColor.BLUE + "Happy " + (currentYear - START_YEAR) + " Year Anniversary! In honor of all of");
sender.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, here's a firework show!"); sender.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, here's a firework show!");
if (sender instanceof Player) { if (sender instanceof Player) {
final int firework_amount = 10; final int firework_amount = 10;
@@ -221,11 +252,11 @@ public final class HolidayManager {
hasCelebrated.add(sender.getName()); hasCelebrated.add(sender.getName());
} }
private boolean getDateRange(Date date, Date start, Date end) { public boolean getDateRange(Date date, Date start, Date end) {
return !(date.before(start) || date.after(end)); return !(date.before(start) || date.after(end));
} }
private void spawnFireworks(Player player) { public void spawnFireworks(Player player) {
int power = Misc.getRandom().nextInt(3) + 1; int power = Misc.getRandom().nextInt(3) + 1;
Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)]; Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)];
double varX = Misc.getRandom().nextGaussian() * 3; double varX = Misc.getRandom().nextGaussian() * 3;
@@ -254,4 +285,31 @@ public final class HolidayManager {
return ret.toString(); return ret.toString();
} }
public boolean isAprilFirst() {
GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
GregorianCalendar aprilSecond = new GregorianCalendar(currentYear, Calendar.APRIL, 2);
GregorianCalendar day = new GregorianCalendar();
return getDateRange(day.getTime(), aprilFirst.getTime(), aprilSecond.getTime());
}
public boolean nearingAprilFirst() {
GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
GregorianCalendar end = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.APRIL, 2);
GregorianCalendar day = new GregorianCalendar();
return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
}
public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
int levelTotal = Misc.getRandom().nextInt(UserManager.getPlayer(player).getSkillLevel(SkillType.MINING)) + 1;
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
player.sendMessage(ChatColor.YELLOW + StringUtils.getCapitalized(fakeSkillType.toString()) + " skill increased by 1. Total (" + levelTotal + ")");
ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
}
public void registerAprilCommand() {
PluginCommand command = mcMMO.p.getCommand("mcfools");
command.setExecutor(new AprilCommand());
}
} }

View File

@@ -10,9 +10,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.SpoutToolsAPI;
import com.gmail.nossr50.config.party.ItemWeightConfig; import com.gmail.nossr50.config.party.ItemWeightConfig;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
public final class ItemUtils { public final class ItemUtils {
@@ -54,7 +52,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomSword(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.SWORD); return mcMMO.getModManager().isCustomSword(type);
} }
} }
@@ -76,7 +74,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomHoe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.HOE); return mcMMO.getModManager().isCustomHoe(type);
} }
} }
@@ -98,7 +96,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomShovel(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.SHOVEL); return mcMMO.getModManager().isCustomShovel(type);
} }
} }
@@ -120,7 +118,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomAxe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.AXE); return mcMMO.getModManager().isCustomAxe(type);
} }
} }
@@ -142,7 +140,7 @@ public final class ItemUtils {
return true; return true;
default: default:
return mcMMO.getModManager().isCustomPickaxe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.PICKAXE); return mcMMO.getModManager().isCustomPickaxe(type);
} }
} }
@@ -500,11 +498,7 @@ public final class ItemUtils {
} }
public static boolean isSmeltable(ItemStack item) { public static boolean isSmeltable(ItemStack item) {
if (item == null) { return item != null && MaterialUtils.isOre(item.getData());
return false;
}
return MaterialUtils.isOre(item.getData());
} }
public static boolean isSmelted(ItemStack item) { public static boolean isSmelted(ItemStack item) {

View File

@@ -13,10 +13,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.spout.SpoutUtils;
public final class Misc { public final class Misc {
private static Random random = new Random(); private static Random random = new Random();
@@ -24,7 +22,6 @@ public final class Misc {
public static final int TIME_CONVERSION_FACTOR = 1000; public static final int TIME_CONVERSION_FACTOR = 1000;
public static final int TICK_CONVERSION_FACTOR = 20; public static final int TICK_CONVERSION_FACTOR = 20;
public static final long PLAYER_DATABASE_COOLDOWN_MILLIS = 1750;
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5; public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0; public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
@@ -66,11 +63,7 @@ public final class Misc {
* @return true if the distance between {@code first} and {@code second} is less than {@code maxDistance}, false otherwise * @return true if the distance between {@code first} and {@code second} is less than {@code maxDistance}, false otherwise
*/ */
public static boolean isNear(Location first, Location second, double maxDistance) { public static boolean isNear(Location first, Location second, double maxDistance) {
if (first.getWorld() != second.getWorld()) { return (first.getWorld() == second.getWorld()) && (first.distanceSquared(second) < (maxDistance * maxDistance) || maxDistance == 0);
return false;
}
return first.distanceSquared(second) < (maxDistance * maxDistance) || maxDistance == 0;
} }
public static void dropItems(Location location, Collection<ItemStack> drops) { public static void dropItems(Location location, Collection<ItemStack> drops) {
@@ -92,41 +85,6 @@ public final class Misc {
} }
} }
/**
* Randomly drop an item at a given location.
*
* @param location The location to drop the items at
* @param is The item to drop
* @param chance The percentage chance for the item to drop
*/
public static void randomDropItem(Location location, ItemStack is, double chance) {
if (random.nextInt(100) < chance) {
dropItem(location, is);
}
}
/**
* Drop items with random quantity at a given location.
*
* @param location The location to drop the items at
* @param is The item to drop
* @param quantity The amount of items to drop
*/
public static void randomDropItems(Location location, ItemStack is, int quantity) {
int dropCount = random.nextInt(quantity + 1);
if (dropCount > 0) {
is.setAmount(dropCount);
dropItem(location, is);
}
}
public static void randomDropItems(Location location, Collection<ItemStack> drops, double chance) {
for (ItemStack item : drops) {
randomDropItem(location, item, chance);
}
}
/** /**
* Drop an item at a given location. * Drop an item at a given location.
* *
@@ -152,19 +110,10 @@ public final class Misc {
public static void profileCleanup(String playerName) { public static void profileCleanup(String playerName) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName); Player player = mcMMO.p.getServer().getPlayerExact(playerName);
McMMOHud spoutHud = UserManager.getPlayer(player).getSpoutHud();
if (spoutHud != null) {
spoutHud.removeWidgets();
}
if (player != null) { if (player != null) {
UserManager.remove(player); UserManager.remove(player);
UserManager.addUser(player); UserManager.addUser(player);
if (mcMMO.isSpoutEnabled()) {
SpoutUtils.reloadSpoutPlayer(player);
}
} }
} }

View File

@@ -34,7 +34,9 @@ public final class Motd {
* @param version Plugin version * @param version Plugin version
*/ */
public static void displayVersion(Player player, String version) { public static void displayVersion(Player player, String version) {
player.sendMessage(LocaleLoader.getString("MOTD.Version", version)); if (Permissions.showversion(player)) {
player.sendMessage(LocaleLoader.getString("MOTD.Version", version));
}
} }
/** /**

View File

@@ -25,6 +25,7 @@ public final class Permissions {
public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); } public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); }
public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); } public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); }
public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); } public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); }
public static boolean showversion(Permissible permissible) { return permissible.hasPermission("mcmmo.showversion"); }
/* BYPASS */ /* BYPASS */
public static boolean hardcoreBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.hardcoremode"); } public static boolean hardcoreBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.hardcoremode"); }

View File

@@ -48,8 +48,6 @@ import com.gmail.nossr50.commands.skills.SwordsCommand;
import com.gmail.nossr50.commands.skills.TamingCommand; import com.gmail.nossr50.commands.skills.TamingCommand;
import com.gmail.nossr50.commands.skills.UnarmedCommand; import com.gmail.nossr50.commands.skills.UnarmedCommand;
import com.gmail.nossr50.commands.skills.WoodcuttingCommand; import com.gmail.nossr50.commands.skills.WoodcuttingCommand;
import com.gmail.nossr50.commands.spout.MchudCommand;
import com.gmail.nossr50.commands.spout.XplockCommand;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@@ -328,26 +326,6 @@ public final class CommandRegistrationManager {
command.setExecutor(new PartyChatCommand()); command.setExecutor(new PartyChatCommand());
} }
private static void registerMchudCommand() {
PluginCommand command = mcMMO.p.getCommand("mchud");
command.setDescription(LocaleLoader.getString("Commands.Description.mchud"));
command.setPermission("mcmmo.commands.mchud");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mchud", "<DISABLED | STANDARD | SMALL | RETRO>"));
command.setExecutor(new MchudCommand());
}
private static void registerXplockCommand() {
PluginCommand command = mcMMO.p.getCommand("xplock");
command.setDescription(LocaleLoader.getString("Commands.Description.xplock"));
command.setPermission("mcmmo.commands.xplock");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "xplock"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xplock", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
command.setExecutor(new XplockCommand());
}
private static void registerPartyCommand() { private static void registerPartyCommand() {
PluginCommand command = mcMMO.p.getCommand("party"); PluginCommand command = mcMMO.p.getCommand("party");
command.setDescription(LocaleLoader.getString("Commands.Description.party")); command.setDescription(LocaleLoader.getString("Commands.Description.party"));
@@ -471,9 +449,5 @@ public final class CommandRegistrationManager {
// Skill Commands // Skill Commands
registerSkillCommands(); registerSkillCommands();
// Spout Commands
registerXplockCommand();
registerMchudCommand();
} }
} }

View File

@@ -90,6 +90,10 @@ public final class CommandUtils {
*/ */
public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) { public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
if (mcMMOPlayer != null) { if (mcMMOPlayer != null) {
if (CommandUtils.hidden(sender, mcMMOPlayer.getPlayer(), false)) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
return false;
}
return true; return true;
} }
@@ -216,6 +220,19 @@ public final class CommandUtils {
} }
} }
public static List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<String>();
for (Player onlinePlayer : mcMMO.p.getServer().getOnlinePlayers()) {
if (player != null && player.canSee(onlinePlayer)) {
onlinePlayerNames.add(onlinePlayer.getName());
}
}
return onlinePlayerNames;
}
/** /**
* Get a matched player name if one was found in the database. * Get a matched player name if one was found in the database.
* *

View File

@@ -2,8 +2,6 @@ package com.gmail.nossr50.util.player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@@ -60,16 +58,6 @@ public final class UserManager {
} }
} }
public static Set<String> getPlayerNames() {
Set<String> playerNames = new HashSet<String>();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
playerNames.add(player.getName());
}
return playerNames;
}
public static Collection<McMMOPlayer> getPlayers() { public static Collection<McMMOPlayer> getPlayers() {
Collection<McMMOPlayer> playerCollection = new ArrayList<McMMOPlayer>(); Collection<McMMOPlayer> playerCollection = new ArrayList<McMMOPlayer>();
@@ -90,28 +78,16 @@ public final class UserManager {
return retrieveMcMMOPlayer(playerName, false); return retrieveMcMMOPlayer(playerName, false);
} }
/** public static McMMOPlayer getOfflinePlayer(OfflinePlayer player) {
* Get the McMMOPlayer of a player.
*
* @param player The player whose McMMOPlayer to retrieve
* @return the player's McMMOPlayer object
*/
public static McMMOPlayer getPlayer(OfflinePlayer player) {
if (player instanceof Player) { if (player instanceof Player) {
return getPlayer((Player) player); return getPlayer((Player) player);
} }
return retrieveMcMMOPlayer(player.getName(), false);
return retrieveMcMMOPlayer(player.getName(), true);
} }
public static McMMOPlayer getPlayer(OfflinePlayer player, boolean offlineValid) { public static McMMOPlayer getOfflinePlayer(String playerName) {
if (player instanceof Player) { return retrieveMcMMOPlayer(playerName, true);
return getPlayer((Player) player);
}
return retrieveMcMMOPlayer(player.getName(), offlineValid);
}
public static McMMOPlayer getPlayer(String playerName, boolean offlineValid) {
return retrieveMcMMOPlayer(playerName, offlineValid);
} }
public static McMMOPlayer getPlayer(Player player) { public static McMMOPlayer getPlayer(Player player) {
@@ -133,10 +109,6 @@ public final class UserManager {
} }
public static boolean hasPlayerDataKey(Entity entity) { public static boolean hasPlayerDataKey(Entity entity) {
if (entity == null) { return entity != null && entity.hasMetadata(mcMMO.playerDataKey);
return false;
}
return entity.hasMetadata(mcMMO.playerDataKey);
} }
} }

View File

@@ -329,7 +329,7 @@ public class ScoreboardManager {
} }
for (String playerName : dirtyPowerLevels) { for (String playerName : dirtyPowerLevels) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true); McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
if (mcMMOPlayer == null) { if (mcMMOPlayer == null) {
continue; continue;

View File

@@ -197,7 +197,7 @@ public final class CombatUtils {
if (attacker instanceof Player && entityType == EntityType.PLAYER) { if (attacker instanceof Player && entityType == EntityType.PLAYER) {
Player player = (Player) attacker; Player player = (Player) attacker;
if (Misc.isNPCEntity(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
@@ -298,15 +298,6 @@ public final class CombatUtils {
} }
} }
} }
else if (attacker instanceof Player) {
Player player = (Player) attacker;
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(target)) {
return;
}
MobHealthbarUtils.handleMobHealthbars(player, target, event.getDamage());
}
} }
/** /**
@@ -506,7 +497,7 @@ public final class CombatUtils {
return false; return false;
} }
if (PartyManager.inSameParty(player, defender) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) { if ((PartyManager.inSameParty(player, defender) || PartyManager.areAllies(player, defender)) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) {
return false; return false;
} }
@@ -558,7 +549,7 @@ public final class CombatUtils {
if (tamer instanceof Player) { if (tamer instanceof Player) {
Player owner = (Player) tamer; Player owner = (Player) tamer;
return (owner == attacker || PartyManager.inSameParty(attacker, owner)); return (owner == attacker || PartyManager.inSameParty(attacker, owner) || PartyManager.areAllies(attacker, owner));
} }
} }
@@ -614,4 +605,18 @@ public final class CombatUtils {
return tier; return tier;
} }
public static void handleHealthbars(Entity attacker, LivingEntity target, double damage) {
if (!(attacker instanceof Player)) {
return;
}
Player player = (Player) attacker;
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(target)) {
return;
}
MobHealthbarUtils.handleMobHealthbars(player, target, damage);
}
} }

View File

@@ -1,474 +0,0 @@
package com.gmail.nossr50.util.spout;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.jar.JarFile;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.player.SpoutPlayer;
public class SpoutUtils {
// The order of the values is extremely important, a few methods depend on it to work properly
protected enum Tier {
FOUR(4) {
@Override public int getLevel() { return SpoutConfig.getInstance().getNotificationTier4(); }
@Override protected Material getAcrobaticsNotificationItem() { return Material.DIAMOND_BOOTS; }
@Override protected Material getArcheryNotificationItem() { return Material.BOW; }
@Override protected Material getAxesNotificationItem() { return Material.DIAMOND_AXE; }
@Override protected Material getExcavationNotificationItem() { return Material.CLAY; }
@Override protected Material getFishingNotificationItem() { return Material.FISHING_ROD; }
@Override protected Material getHerbalismNotificationItem() { return Material.WATER_LILY; }
@Override protected Material getMiningNotificationItem() { return Material.EMERALD_ORE; }
@Override protected Material getSwordsNotificationItem() { return Material.DIAMOND_SWORD; }
@Override protected Material getTamingNotificationItem() { return Material.BONE; }
@Override protected Material getUnarmedNotificationItem() { return Material.DIAMOND_HELMET; }
@Override protected Material getWoodcuttingNotificationItem() { return Material.LOG; }},
THREE(3) {
@Override public int getLevel() { return SpoutConfig.getInstance().getNotificationTier3(); }
@Override protected Material getAcrobaticsNotificationItem() { return Material.GOLD_BOOTS; }
@Override protected Material getArcheryNotificationItem() { return Material.ARROW; }
@Override protected Material getAxesNotificationItem() { return Material.GOLD_AXE; }
@Override protected Material getExcavationNotificationItem() { return Material.SAND; }
@Override protected Material getFishingNotificationItem() { return Material.COOKED_FISH; }
@Override protected Material getHerbalismNotificationItem() { return Material.RED_ROSE; }
@Override protected Material getMiningNotificationItem() { return Material.DIAMOND_ORE; }
@Override protected Material getSwordsNotificationItem() { return Material.GOLD_SWORD; }
@Override protected Material getTamingNotificationItem() { return Material.GRILLED_PORK; }
@Override protected Material getUnarmedNotificationItem() { return Material.GOLD_HELMET; }
@Override protected Material getWoodcuttingNotificationItem() { return Material.WOOD; }},
TWO(2) {
@Override public int getLevel() { return SpoutConfig.getInstance().getNotificationTier2(); }
@Override protected Material getAcrobaticsNotificationItem() { return Material.IRON_BOOTS; }
@Override protected Material getArcheryNotificationItem() { return Material.ARROW; }
@Override protected Material getAxesNotificationItem() { return Material.IRON_AXE; }
@Override protected Material getExcavationNotificationItem() { return Material.GRAVEL; }
@Override protected Material getFishingNotificationItem() { return Material.COOKED_FISH; }
@Override protected Material getHerbalismNotificationItem() { return Material.YELLOW_FLOWER; }
@Override protected Material getMiningNotificationItem() { return Material.GOLD_ORE; }
@Override protected Material getSwordsNotificationItem() { return Material.IRON_SWORD; }
@Override protected Material getTamingNotificationItem() { return Material.GRILLED_PORK; }
@Override protected Material getUnarmedNotificationItem() { return Material.IRON_HELMET; }
@Override protected Material getWoodcuttingNotificationItem() { return Material.LEAVES; }},
ONE(1) {
@Override public int getLevel() { return SpoutConfig.getInstance().getNotificationTier1(); }
@Override protected Material getAcrobaticsNotificationItem() { return Material.CHAINMAIL_BOOTS; }
@Override protected Material getArcheryNotificationItem() { return Material.FLINT; }
@Override protected Material getAxesNotificationItem() { return Material.STONE_AXE; }
@Override protected Material getExcavationNotificationItem() { return Material.GRASS; }
@Override protected Material getFishingNotificationItem() { return Material.RAW_FISH; }
@Override protected Material getHerbalismNotificationItem() { return Material.CACTUS; }
@Override protected Material getMiningNotificationItem() { return Material.IRON_ORE; }
@Override protected Material getSwordsNotificationItem() { return Material.STONE_SWORD; }
@Override protected Material getTamingNotificationItem() { return Material.PORK; }
@Override protected Material getUnarmedNotificationItem() { return Material.CHAINMAIL_HELMET; }
@Override protected Material getWoodcuttingNotificationItem() { return Material.SAPLING; }};
int numerical;
private Tier(int numerical) {
this.numerical = numerical;
}
public int toNumerical() {
return numerical;
}
abstract protected int getLevel();
abstract protected Material getAcrobaticsNotificationItem();
abstract protected Material getArcheryNotificationItem();
abstract protected Material getAxesNotificationItem();
abstract protected Material getExcavationNotificationItem();
abstract protected Material getFishingNotificationItem();
abstract protected Material getHerbalismNotificationItem();
abstract protected Material getMiningNotificationItem();
abstract protected Material getSwordsNotificationItem();
abstract protected Material getTamingNotificationItem();
abstract protected Material getUnarmedNotificationItem();
abstract protected Material getWoodcuttingNotificationItem();
}
private final static String spoutDirectory = mcMMO.getMainDirectory() + "Resources" + File.separator;
private final static String hudDirectory = spoutDirectory + "HUD" + File.separator;
private final static String hudStandardDirectory = hudDirectory + "Standard" + File.separator;
private final static String hudRetroDirectory = hudDirectory + "Retro" + File.separator;
private final static String soundDirectory = spoutDirectory + "Sound" + File.separator;
/**
* Write file to disk.
*
* @param fileName The name of the file
* @param filePath The name of the file path
*/
private static File writeFile(String fileName, String filePath) {
File currentFile = new File(filePath + fileName);
BufferedOutputStream os = null;
JarFile jar = null;
// No point in writing the file again if it already exists.
if (currentFile.exists()) {
return currentFile;
}
try {
jar = new JarFile(mcMMO.mcmmo);
@SuppressWarnings("resource")
InputStream is = jar.getInputStream(jar.getJarEntry("resources/" + fileName));
byte[] buf = new byte[2048];
int nbRead;
os = new BufferedOutputStream(new FileOutputStream(currentFile));
while ((nbRead = is.read(buf)) != -1) {
os.write(buf, 0, nbRead);
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
finally {
if (jar != null) {
try {
jar.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
if (os != null) {
try {
os.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
return currentFile;
}
/**
* Extract Spout files to the Resources directory.
*/
public static ArrayList<File> extractFiles() {
ArrayList<File> files = new ArrayList<File>();
// Setup directories
new File(spoutDirectory).mkdir();
new File(hudDirectory).mkdir();
new File(hudStandardDirectory).mkdir();
new File(hudRetroDirectory).mkdir();
new File(soundDirectory).mkdir();
// XP Bar images
for (int x = 0; x < 255; x++) {
String fileName;
if (x < 10) {
fileName = "xpbar_inc00" + x + ".png";
}
else if (x < 100) {
fileName = "xpbar_inc0" + x + ".png";
}
else {
fileName = "xpbar_inc" + x + ".png";
}
files.add(writeFile(fileName, hudStandardDirectory));
}
// Standard XP Icons
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
String skillName = StringUtils.getCapitalized(skillType.toString());
files.add(writeFile(skillName + ".png", hudStandardDirectory));
files.add(writeFile(skillName + "_r.png", hudRetroDirectory));
}
// Blank icons
files.add(writeFile("Icon.png", hudStandardDirectory));
files.add(writeFile("Icon_r.png", hudRetroDirectory));
// Sound FX
files.add(writeFile("level.wav", soundDirectory));
return files;
}
/**
* Handle level-up notifications through Spout.
*
* @param skillType The skill that leveled up
* @param spoutPlayer The player that leveled up
*/
public static void levelUpNotification(SkillType skillType, SpoutPlayer spoutPlayer) {
PlayerProfile profile = UserManager.getPlayer(spoutPlayer).getProfile();
int skillLevel = profile.getSkillLevel(skillType);
Material notificationItem;
switch (skillType) {
case ACROBATICS:
notificationItem = getAcrobaticsNotificationItem(skillLevel);
break;
case ARCHERY:
notificationItem = getArcheryNotificationItem(skillLevel);
break;
case AXES:
notificationItem = getAxesNotificationItem(skillLevel);
break;
case EXCAVATION:
notificationItem = getExcavationNotificationItem(skillLevel);
break;
case FISHING:
notificationItem = getFishingNotificationItem(skillLevel);
break;
case HERBALISM:
notificationItem = getHerbalismNotificationItem(skillLevel);
break;
case MINING:
notificationItem = getMiningNotificationItem(skillLevel);
break;
case REPAIR:
notificationItem = Material.ANVIL;
break;
case SWORDS:
notificationItem = getSwordsNotificationItem(skillLevel);
break;
case TAMING:
notificationItem = getTamingNotificationItem(skillLevel);
break;
case UNARMED:
notificationItem = getUnarmedNotificationItem(skillLevel);
break;
case WOODCUTTING:
notificationItem = getWoodcuttingNotificationItem(skillLevel);
break;
default:
notificationItem = Material.MAP;
break;
}
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.LevelUp.1"), LocaleLoader.getString("Spout.LevelUp.2", skillType.getName(), skillLevel), notificationItem);
SpoutManager.getSoundManager().playCustomSoundEffect(mcMMO.p, spoutPlayer, "level.wav", false);
}
private static Material getAcrobaticsNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getAcrobaticsNotificationItem();
}
}
return Material.LEATHER_BOOTS;
}
private static Material getArcheryNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getArcheryNotificationItem();
}
}
return Material.FEATHER;
}
private static Material getAxesNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getAxesNotificationItem();
}
}
return Material.WOOD_AXE;
}
private static Material getExcavationNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getExcavationNotificationItem();
}
}
return Material.DIRT;
}
private static Material getFishingNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getFishingNotificationItem();
}
}
return Material.RAW_FISH;
}
private static Material getHerbalismNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getHerbalismNotificationItem();
}
}
return Material.VINE;
}
private static Material getMiningNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getMiningNotificationItem();
}
}
return Material.COAL_ORE;
}
private static Material getSwordsNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getSwordsNotificationItem();
}
}
return Material.WOOD_SWORD;
}
private static Material getTamingNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getTamingNotificationItem();
}
}
return Material.PORK;
}
private static Material getUnarmedNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getUnarmedNotificationItem();
}
}
return Material.LEATHER_HELMET;
}
private static Material getWoodcuttingNotificationItem(int skillLevel) {
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getWoodcuttingNotificationItem();
}
}
return Material.STICK;
}
/**
* Re-enable SpoutCraft for players after a /reload
*/
public static void reloadSpoutPlayers() {
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
for (SpoutPlayer spoutPlayer : SpoutManager.getPlayerChunkMap().getOnlinePlayers()) {
pluginManager.callEvent(new SpoutCraftEnableEvent(spoutPlayer));
}
}
public static void reloadSpoutPlayer(Player player) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer != null) {
mcMMO.p.getServer().getPluginManager().callEvent(new SpoutCraftEnableEvent(spoutPlayer));
}
}
public static void preCacheFiles() {
SpoutManager.getFileManager().addToPreLoginCache(mcMMO.p, extractFiles());
}
public static void processLevelup(McMMOPlayer mcMMOPlayer, SkillType skillType, int levelsGained) {
Player player = mcMMOPlayer.getPlayer();
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer.isSpoutCraftEnabled()) {
levelUpNotification(skillType, spoutPlayer);
/* Update custom titles */
if (SpoutConfig.getInstance().getShowPowerLevel()) {
spoutPlayer.setTitle(LocaleLoader.getString("Spout.Title", spoutPlayer.getName(), mcMMOPlayer.getPowerLevel()));
}
}
else {
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, mcMMOPlayer.getProfile().getSkillLevel(skillType)));
}
}
public static void processXpGain(Player player, PlayerProfile profile) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer.isSpoutCraftEnabled() && SpoutConfig.getInstance().getXPBarEnabled()) {
profile.getSpoutHud().updateXpBar();
}
}
public static void sendRepairNotifications(Player player, Material anvilType) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer.isSpoutCraftEnabled()) {
String[] spoutMessages = Repair.getSpoutAnvilMessages(anvilType);
spoutPlayer.sendNotification(spoutMessages[0], spoutMessages[1], anvilType);
}
else {
player.sendMessage(Repair.getAnvilMessage(anvilType));
}
}
public static void sendDonationNotification(Player player) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer.isSpoutCraftEnabled()) {
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
}
else {
player.sendMessage(LocaleLoader.getString("MOTD.Donate"));
player.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
}
}
}

View File

@@ -23,6 +23,8 @@ import java.util.zip.ZipFile;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.config.Config;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.JSONValue; import org.json.simple.JSONValue;
@@ -440,14 +442,14 @@ public class Updater {
return true; return true;
} }
// Check release vs. beta & dev // Check release vs. beta & SNAPSHOT
if (newTokens.length == 1 && oldTokens.length == 3 && oldVersion == newVersion) { if (newTokens.length == 1 && oldTokens.length == 3 && oldVersion == newVersion) {
return true; return true;
} }
// Check beta vs. dev // Check beta vs. SNAPSHOT
if (version.contains("dev") && title.contains("beta")) { if (version.contains("SNAPSHOT") && title.contains("beta")) {
if (Integer.parseInt(oldTokens[1].substring(3)) <= Integer.parseInt(newTokens[1].substring(4))) { if (Integer.parseInt(oldTokens[1].substring(8)) <= Integer.parseInt(newTokens[1].substring(4))) {
return true; return true;
} }
@@ -465,7 +467,7 @@ public class Updater {
return false; return false;
} }
if (oldTokens.length == 3 && !version.contains("beta") && !version.contains("dev")) { if (oldTokens.length == 3 && !version.contains("beta") && !version.contains("SNAPSHOT")) {
plugin.getLogger().warning("Could not get information about this mcMMO version; perhaps you are running a custom one?"); plugin.getLogger().warning("Could not get information about this mcMMO version; perhaps you are running a custom one?");
result = UpdateResult.FAIL_NOVERSION; result = UpdateResult.FAIL_NOVERSION;
return false; return false;
@@ -519,7 +521,11 @@ public class Updater {
this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime."); this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime.");
this.result = UpdateResult.FAIL_DBO; this.result = UpdateResult.FAIL_DBO;
} }
e.printStackTrace();
if (Config.getInstance().getVerboseLoggingEnabled()) {
e.printStackTrace();
}
return false; return false;
} }
} }

View File

@@ -471,7 +471,9 @@ Skills:
Bonus: 2.0 Bonus: 2.0
CallOfTheWild: CallOfTheWild:
# MinHorseJumpStrength: The minimum jump strength a summoned horse must have
# MaxHorseJumpStrength: The maximum jump strength a summoned horse can have # MaxHorseJumpStrength: The maximum jump strength a summoned horse can have
MinHorseJumpStrength: 0.7
MaxHorseJumpStrength: 2.0 MaxHorseJumpStrength: 2.0
# #
# Settings for Unarmed # Settings for Unarmed

View File

@@ -267,7 +267,8 @@ Skills:
Prevent_AFK_Leveling: true Prevent_AFK_Leveling: true
Max_Tries_At_Same_Location: 3 Max_Tries_At_Same_Location: 3
Prevent_Dodge_Lightning: false Prevent_Dodge_Lightning: false
Prevent_XP_After_Teleport: true # Prevent earning Acrobatics XP a few seconds after teleporting
XP_After_Teleport_Cooldown: 5
Level_Cap: 0 Level_Cap: 0
Alchemy: Alchemy:
# Allow Hoppers to transfer ingredients and brew Rank 1 Alchemy potions # Allow Hoppers to transfer ingredients and brew Rank 1 Alchemy potions
@@ -316,16 +317,24 @@ Skills:
Enabled_For_PVE: true Enabled_For_PVE: true
Level_Cap: 0 Level_Cap: 0
Call_Of_The_Wild: Call_Of_The_Wild:
Bones_Required: 10 # Item_Material: Material of the item needed to summon the pet
Fish_Required: 10 # Item_Amount: Amount of items required to summon the pet
Apples_Required: 10 # Summon_Amount: Amount of pets to summon when using Call Of The Wild
Wolf:
Item_Material: BONE
Item_Amount: 10
Summon_Amount: 1
Ocelot:
Item_Material: RAW_FISH
Item_Amount: 10
Summon_Amount: 1
Horse:
Item_Material: APPLE
Item_Amount: 10
Summon_Amount: 1
# Range to check for nearby pets when using Call Of The Wild, 0 will disable the check # Range to check for nearby pets when using Call Of The Wild, 0 will disable the check
Range: 40.0 Range: 40.0
# Amount of pets to summon when using Call Of The Wild
Wolf_Amount: 1
Ocelot_Amount: 1
Horse_Amount: 1
Unarmed: Unarmed:
Enabled_For_PVP: true Enabled_For_PVP: true
Enabled_For_PVE: true Enabled_For_PVE: true
@@ -386,6 +395,10 @@ Commands:
# If true, when using partial names in commands mcMMO will try to look for a match from # If true, when using partial names in commands mcMMO will try to look for a match from
# the offline players. Enabling this might slow the server down if there are a lot of offline players. # the offline players. Enabling this might slow the server down if there are a lot of offline players.
Match_OfflinePlayers: false Match_OfflinePlayers: false
Database:
# Database command cooldown in milliseconds, cannot be changed below the default value. (1750)
# Prevents players from spamming /mctop or /mcrank
Player_Cooldown: 1750
mcmmo: mcmmo:
Donate_Message: true Donate_Message: true
inspect: inspect:

View File

@@ -129,7 +129,7 @@ Experience:
Mossy_Cobblestone: 30 Mossy_Cobblestone: 30
Netherrack: 30 Netherrack: 30
Obsidian: 150 Obsidian: 150
Quartz_Ore: 250 Quartz_Ore: 100
Redstone_Ore: 150 Redstone_Ore: 150
Sandstone: 30 Sandstone: 30
Stone: 30 Stone: 30

View File

@@ -1,30 +1,24 @@
name: mcMMO name: mcMMO
version: ${project.version}-b${BUILD_NUMBER} version: ${project.version}-b${BUILD_NUMBER}
description: > description: >
mcMMO takes core Minecraft game mechanics and expands them to add an extensive The goal of mcMMO is to take core Minecraft game mechanics and expand them into
RPG experience, the goal of the project has always been a quality RPG add an extensive and quality RPG experience. Everything in mcMMO has been carefully
experience. Everything in mcMMO is carefully thought out and is constantly thought out and is constantly being improved upon. Currently, mcMMO adds thirteen
improving. mcMMO adds eleven skills to train in and level in, while also unique skills to train and level in. Each of these skills is highly customizable
offering a high level of customization for server admins. There are countless through our configuration files, allowing server admins to tweak mcMMO to best suit
features, including custom sounds, graphical elements, and more added when the needs of his or her server. Know that the mcMMO team is dedicated to providing
running mcMMO in conjunction with Spout. I carefully read feedback and an ever-evolving experience, and that we carefully read all feedback and bug reports
evaluate the mechanics of mcMMO in every update to provide an ever-evolving in order to evaluate and balance the mechanics of mcMMO in every update.
experience.
author: nossr50 author: nossr50
authors: [GJ, NuclearW, bm01, Glitchfinder, TfT_02, t00thpick1, Riking] authors: [GJ, NuclearW, bm01, Glitchfinder, TfT_02, t00thpick1, Riking]
website: http://dev.bukkit.org/server-mods/mcmmo/ website: http://dev.bukkit.org/server-mods/mcmmo/
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
softdepend: [Spout, CombatTag, HealthBar] softdepend: [CombatTag, HealthBar]
load: STARTUP load: STARTUP
commands: commands:
mchud:
description: Change your HUD
xplock:
aliases: [mcxplock]
description: Lock your mcMMO XP bar
xprate: xprate:
aliases: [mcxprate] aliases: [mcxprate]
description: Modify the xp rate or start an event description: Modify the xp rate or start an event
@@ -120,6 +114,9 @@ commands:
kraken: kraken:
aliases: [mckraken] aliases: [mckraken]
description: Unleash the kraken! description: Unleash the kraken!
mcfools:
aliases: [macho, jumping, throwing, wrecking, crafting, walking, swimming, falling, climbing, flying, diving, piggy]
description: Deploy jokes
permissions: permissions:
mcmmo.*: mcmmo.*:
default: false default: false
@@ -658,7 +655,6 @@ permissions:
mcmmo.commands.inspect: true mcmmo.commands.inspect: true
mcmmo.commands.mcability: true mcmmo.commands.mcability: true
mcmmo.commands.mccooldown: true mcmmo.commands.mccooldown: true
mcmmo.commands.mchud: true
mcmmo.commands.mcmmo.all: true mcmmo.commands.mcmmo.all: true
mcmmo.commands.mcnotify: true mcmmo.commands.mcnotify: true
mcmmo.commands.mcrank: true mcmmo.commands.mcrank: true
@@ -675,7 +671,6 @@ permissions:
mcmmo.commands.taming: true mcmmo.commands.taming: true
mcmmo.commands.unarmed: true mcmmo.commands.unarmed: true
mcmmo.commands.woodcutting: true mcmmo.commands.woodcutting: true
mcmmo.commands.xplock.all: true
mcmmo.commands.defaultsop: mcmmo.commands.defaultsop:
description: Implies all default op mcmmo.commands permissions. description: Implies all default op mcmmo.commands permissions.
children: children:
@@ -804,8 +799,6 @@ permissions:
description: Allows access to the mcgod command description: Allows access to the mcgod command
mcmmo.commands.mcgod.others: mcmmo.commands.mcgod.others:
description: Allows access to the mcgod command for other players description: Allows access to the mcgod command for other players
mcmmo.commands.mchud:
description: Allows access to the mchud command
mcmmo.commands.mcmmo.*: mcmmo.commands.mcmmo.*:
default: false default: false
description: Implies access to all mcmmo.commands.mcmmo permissions description: Implies access to all mcmmo.commands.mcmmo permissions
@@ -1161,56 +1154,6 @@ permissions:
description: Allows access to the vampirism command to toggle vampirism on/off description: Allows access to the vampirism command to toggle vampirism on/off
mcmmo.commands.woodcutting: mcmmo.commands.woodcutting:
description: Allows access to the woodcutting command description: Allows access to the woodcutting command
mcmmo.commands.xplock.*:
default: false
description: Implies access to all mcmmo.commands.xplock permissions
children:
mcmmo.commands.xplock.all: true
mcmmo.commands.xplock.all:
description: Implies access to all mcmmo.commands.xplock permissions
children:
mcmmo.commands.xplock: true
mcmmo.commands.xplock.acrobatics: true
mcmmo.commands.xplock.archery: true
mcmmo.commands.xplock.axes: true
mcmmo.commands.xplock.excavation: true
mcmmo.commands.xplock.fishing: true
mcmmo.commands.xplock.herbalism: true
mcmmo.commands.xplock.mining: true
mcmmo.commands.xplock.repair: true
mcmmo.commands.xplock.smelting: true
mcmmo.commands.xplock.swords: true
mcmmo.commands.xplock.taming: true
mcmmo.commands.xplock.unarmed: true
mcmmo.commands.xplock.woodcutting: true
mcmmo.commands.xplock:
description: Allows access to the xplock command
mcmmo.commands.xplock.acrobatics:
description: Allows access to the xplock command for acrobatics
mcmmo.commands.xplock.archery:
description: Allows access to the xplock command for archery
mcmmo.commands.xplock.axes:
description: Allows access to the xplock command for axes
mcmmo.commands.xplock.excavation:
description: Allows access to the xplock command for excavation
mcmmo.commands.xplock.fishing:
description: Allows access to the xplock command for fishing
mcmmo.commands.xplock.herbalism:
description: Allows access to the xplock command for herbalism
mcmmo.commands.xplock.mining:
description: Allows access to the xplock command for mining
mcmmo.commands.xplock.repair:
description: Allows access to the xplock command for repair
mcmmo.commands.xplock.smelting:
description: Allows access to the xplock command for smelting
mcmmo.commands.xplock.swords:
description: Allows access to the xplock command for swords
mcmmo.commands.xplock.taming:
description: Allows access to the xplock command for taming
mcmmo.commands.xplock.unarmed:
description: Allows access to the xplock command for unarmed
mcmmo.commands.xplock.woodcutting:
description: Allows access to the xplock command for woodcutting
mcmmo.commands.xprate.*: mcmmo.commands.xprate.*:
default: false default: false
description: Implies access to all mcmmo.commands.xprate permissions description: Implies access to all mcmmo.commands.xprate permissions
@@ -1932,87 +1875,74 @@ permissions:
children: children:
mcmmo.ability.acrobatics.all: true mcmmo.ability.acrobatics.all: true
mcmmo.commands.acrobatics: true mcmmo.commands.acrobatics: true
<<<<<<< HEAD
mcmmo.skills.alchemy: mcmmo.skills.alchemy:
description: Allows access to the Alchemy skill description: Allows access to the Alchemy skill
children: children:
mcmmo.ability.alchemy.all: true mcmmo.ability.alchemy.all: true
mcmmo.commands.alchemy: true mcmmo.commands.alchemy: true
=======
mcmmo.commands.xplock.acrobatics: true
>>>>>>> Revert "Dropped SpoutPlugin support"
mcmmo.skills.archery: mcmmo.skills.archery:
description: Allows access to the Archery skill description: Allows access to the Archery skill
children: children:
mcmmo.ability.archery.all: true mcmmo.ability.archery.all: true
mcmmo.commands.archery: true mcmmo.commands.archery: true
mcmmo.commands.xplock.archery: true
mcmmo.skills.axes: mcmmo.skills.axes:
description: Allows access to the Axes skill description: Allows access to the Axes skill
children: children:
mcmmo.ability.axes.all: true mcmmo.ability.axes.all: true
mcmmo.commands.axes: true mcmmo.commands.axes: true
mcmmo.commands.xplock.axes: true
mcmmo.skills.excavation: mcmmo.skills.excavation:
description: Allows access to the Excavation skill description: Allows access to the Excavation skill
children: children:
mcmmo.ability.excavation.all: true mcmmo.ability.excavation.all: true
mcmmo.commands.excavation: true mcmmo.commands.excavation: true
mcmmo.commands.xplock.excavation: true
mcmmo.skills.fishing: mcmmo.skills.fishing:
description: Allows access to the Fishing skill description: Allows access to the Fishing skill
children: children:
mcmmo.ability.fishing.all: true mcmmo.ability.fishing.all: true
mcmmo.commands.fishing: true mcmmo.commands.fishing: true
mcmmo.commands.xplock.fishing: true
mcmmo.skills.herbalism: mcmmo.skills.herbalism:
description: Allows access to the Herbalism skill description: Allows access to the Herbalism skill
children: children:
mcmmo.ability.herbalism.all: true mcmmo.ability.herbalism.all: true
mcmmo.commands.herbalism: true mcmmo.commands.herbalism: true
mcmmo.commands.xplock.herbalism: true
mcmmo.skills.mining: mcmmo.skills.mining:
description: Allows access to the Mining skill description: Allows access to the Mining skill
children: children:
mcmmo.ability.mining.all: true mcmmo.ability.mining.all: true
mcmmo.commands.mining: true mcmmo.commands.mining: true
mcmmo.commands.xplock.mining: true
mcmmo.skills.repair: mcmmo.skills.repair:
description: Allows access to the Repair skill description: Allows access to the Repair skill
children: children:
mcmmo.ability.repair.all: true mcmmo.ability.repair.all: true
mcmmo.commands.repair: true mcmmo.commands.repair: true
mcmmo.commands.xplock.repair: true
mcmmo.skills.smelting: mcmmo.skills.smelting:
description: Allows access to the Smelting skill description: Allows access to the Smelting skill
children: children:
mcmmo.ability.smelting.all: true mcmmo.ability.smelting.all: true
mcmmo.commands.smelting: true mcmmo.commands.smelting: true
mcmmo.commands.xplock.smelting: true
mcmmo.skills.swords: mcmmo.skills.swords:
description: Allows access to the Swords skill description: Allows access to the Swords skill
children: children:
mcmmo.ability.swords.all: true mcmmo.ability.swords.all: true
mcmmo.commands.swords: true mcmmo.commands.swords: true
mcmmo.commands.xplock.swords: true
mcmmo.skills.taming: mcmmo.skills.taming:
description: Allows access to the Taming skill description: Allows access to the Taming skill
children: children:
mcmmo.ability.taming.all: true mcmmo.ability.taming.all: true
mcmmo.commands.taming: true mcmmo.commands.taming: true
mcmmo.commands.xplock.taming: true
mcmmo.skills.unarmed: mcmmo.skills.unarmed:
description: Allows access to the Unarmed skill description: Allows access to the Unarmed skill
children: children:
mcmmo.ability.unarmed.all: true mcmmo.ability.unarmed.all: true
mcmmo.commands.unarmed: true mcmmo.commands.unarmed: true
mcmmo.commands.xplock.unarmed: true
mcmmo.skills.woodcutting: mcmmo.skills.woodcutting:
description: Allows access to the Woodcutting skill description: Allows access to the Woodcutting skill
children: children:
mcmmo.ability.woodcutting.all: true mcmmo.ability.woodcutting.all: true
mcmmo.commands.woodcutting: true mcmmo.commands.woodcutting: true
mcmmo.commands.xplock.woodcutting: true mcmmo.showversion:
default: true
description: Show mcMMO version number in /mcmmo and motd
mcmmo.tools.*: mcmmo.tools.*:
default: false default: false
description: Implies all mcmmo.tools permissions. description: Implies all mcmmo.tools permissions.

View File

@@ -363,7 +363,7 @@ Potions:
Children: Children:
FERMENTED_SPIDER_EYE: 8236 FERMENTED_SPIDER_EYE: 8236
REDSTONE: 8260 REDSTONE: 8260
SULPHUR: 16452 SULPHUR: 16420
8260: # Potion of Poison Extended 8260: # Potion of Poison Extended
Children: Children:
FERMENTED_SPIDER_EYE: 8204 FERMENTED_SPIDER_EYE: 8204
@@ -633,16 +633,16 @@ Potions:
16388: # Splash Potion of Poison 16388: # Splash Potion of Poison
Children: Children:
FERMENTED_SPIDER_EYE: 16396 FERMENTED_SPIDER_EYE: 16396
GLOWSTONE_DUST: 16452 GLOWSTONE_DUST: 16420
REDSTONE: 16452 REDSTONE: 16452
16452: # Splash Potion of Poison II 16420: # Splash Potion of Poison II
Children: Children:
FERMENTED_SPIDER_EYE: 16428 FERMENTED_SPIDER_EYE: 16428
REDSTONE: 16452 REDSTONE: 16452
16452: # Splash Potion of Poison Extended 16452: # Splash Potion of Poison Extended
Children: Children:
FERMENTED_SPIDER_EYE: 16396 FERMENTED_SPIDER_EYE: 16396
GLOWSTONE_DUST: 16452 GLOWSTONE_DUST: 16420
21504: # Splash Potion of Decay 21504: # Splash Potion of Decay
Effects: ["WITHER 0 338"] Effects: ["WITHER 0 338"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

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