1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 09:43:00 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
t00thpick1
13e7788b14 Fix off-by-one chunk coords calculation for ChunkStore. 2014-02-03 08:56:22 -05:00
366 changed files with 1268 additions and 3103 deletions

View File

@@ -20,7 +20,6 @@ Version 1.4.08-dev
+ Added new experience bonus perk 'mcmmo.perks.xp.10percentboost.<skillname>' multiplies incoming XP by 1.1
+ 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 support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
= Fixed bug where LeafBlower permissions were ignored
= Fixed bug with toggle commands not properly displaying the success message.
= Fixed IllegalArgumentException caused by an empty Fishing treasure category

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/).
### 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
@@ -47,6 +47,5 @@ Required Libraries:
* JUnit
* EMetrics
* Bukkit
* SpoutPlugin API
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.

51
pom.xml
View File

@@ -22,38 +22,6 @@
<include>.jenkins</include>
</includes>
</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>
<targetPath>com/gmail/nossr50/locale</targetPath>
<filtering>true</filtering>
@@ -144,18 +112,6 @@
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
</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>
<id>Plugin MetricsExtension</id>
<url>http://repo.turt2live.com</url>
@@ -165,15 +121,10 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.6.4-R2.0</version>
<version>RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spoutcraft</groupId>
<artifactId>spoutcraftplugin</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>

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

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

View File

@@ -9,12 +9,12 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils;

View File

@@ -4,10 +4,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
@@ -30,11 +28,6 @@ public class PartyChatCommand extends ChatCommand {
return;
}
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
return;
}
message = buildChatMessage(args, 0);
}
else {

View File

@@ -1,10 +1,6 @@
package com.gmail.nossr50.commands.party;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -221,7 +217,7 @@ public class PartyCommand implements TabExecutor {
}
private String[] extractArgs(String[] args) {
return Arrays.copyOfRange(args, 1, args.length);
return Arrays.copyOfRange(args, 1, args.length - 1);
}
private boolean isItemShareCategory(String category) {

View File

@@ -20,7 +20,7 @@ public class PartyHelpCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader"));
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband"));
sender.sendMessage(LocaleLoader.getString("Party.Help.9", "/party itemshare"));
sender.sendMessage(LocaleLoader.getString("Party.Help.10", "/party xpshare"));
sender.sendMessage(LocaleLoader.getString("Party.Help.10", "/party expshare"));
return true;
default:

View File

@@ -23,11 +23,6 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
return true;
}
if (mcMMOPlayer.getParty().getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
PartyManager.acceptAllianceInvite(mcMMOPlayer);
return true;

View File

@@ -11,10 +11,10 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;

View File

@@ -33,8 +33,8 @@ public class AlchemyCommand extends SkillCommand {
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
String[] displayValues = new String[2];
displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";
displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;
displayValues[0] = decimal.format(alchemyManager.getBrewSpeed()) + "x";
displayValues[1] = isLucky ? decimal.format(alchemyManager.getBrewSpeedLucky()) + "x" : null;
return displayValues;
}

View File

@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
import java.util.List;
import java.util.Set;
import com.gmail.nossr50.util.Motd;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -17,7 +18,6 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.Motd;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;

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

@@ -376,7 +376,7 @@ public class Config extends AutoUpdateConfigLoader {
public int getPTPCommandWarmup() { return config.getInt("Commands.ptp.Warmup", 5); }
public int getPTPCommandRecentlyHurtCooldown() { return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60); }
public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Accept_Required", true); }
public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Confirm_Required", true); }
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
/* Inspect command distance */

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import java.io.File;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
public class ArmorConfigManager {
public ArmorConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "armor.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
}
}
}

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import java.io.File;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
public class BlockConfigManager {
public BlockConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "blocks.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
}
}
}

View File

@@ -16,22 +16,42 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomArmorConfig extends ConfigLoader {
private static CustomArmorConfig instance;
private boolean needsUpdate = false;
public List<Material> customBoots = new ArrayList<Material>();
public List<Material> customChestplates = new ArrayList<Material>();
public List<Material> customHelmets = new ArrayList<Material>();
public List<Material> customLeggings = new ArrayList<Material>();
private List<Repairable> repairables;
public List<Repairable> repairables = new ArrayList<Repairable>();
private List<Material> customBoots = new ArrayList<Material>();
private List<Material> customChestplates = new ArrayList<Material>();
private List<Material> customHelmets = new ArrayList<Material>();
private List<Material> customLeggings = new ArrayList<Material>();
protected CustomArmorConfig(String fileName) {
super("mods", fileName);
public CustomArmorConfig() {
super("mods", "armor.yml");
loadKeys();
}
public static CustomArmorConfig getInstance() {
if (instance == null) {
instance = new CustomArmorConfig();
}
return instance;
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
@Override
protected void loadKeys() {
repairables = new ArrayList<Repairable>();
loadArmor("Boots", customBoots);
loadArmor("Chestplates", customChestplates);
loadArmor("Helmets", customHelmets);
@@ -97,4 +117,20 @@ public class CustomArmorConfig extends ConfigLoader {
materialList.add(armorMaterial);
}
}
public boolean isCustomBoots(Material material) {
return customBoots.contains(material);
}
public boolean isCustomChestplate(Material material) {
return customChestplates.contains(material);
}
public boolean isCustomHelmet(Material material) {
return customHelmets.contains(material);
}
public boolean isCustomLeggings(Material material) {
return customLeggings.contains(material);
}
}

View File

@@ -13,29 +13,40 @@ import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
public class CustomBlockConfig extends ConfigLoader {
private static CustomBlockConfig instance;
private boolean needsUpdate = false;
public List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
public List<MaterialData> customOres = new ArrayList<MaterialData>();
public List<MaterialData> customLogs = new ArrayList<MaterialData>();
public List<MaterialData> customLeaves = new ArrayList<MaterialData>();
public List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customWoodcuttingBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customOres = new ArrayList<MaterialData>();
private List<MaterialData> customLogs = new ArrayList<MaterialData>();
private List<MaterialData> customLeaves = new ArrayList<MaterialData>();
private List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
public HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
private HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
protected CustomBlockConfig(String fileName) {
super("mods", fileName);
public CustomBlockConfig() {
super("mods", "blocks.yml");
loadKeys();
}
public static CustomBlockConfig getInstance() {
if (instance == null) {
instance = new CustomBlockConfig();
}
return instance;
}
@Override
protected void loadKeys() {
loadBlocks("Excavation", customExcavationBlocks);
loadBlocks("Herbalism", customHerbalismBlocks);
loadBlocks("Mining", customMiningBlocks);
loadBlocks("Woodcutting", null);
loadBlocks("Woodcutting", customWoodcuttingBlocks);
loadBlocks("Ability_Blocks", customAbilityBlocks);
if (needsUpdate) {
@@ -74,10 +85,7 @@ public class CustomBlockConfig extends ConfigLoader {
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
MaterialData blockMaterialData = new MaterialData(blockMaterial, blockData);
if (blockList != null) {
blockList.add(blockMaterialData);
}
blockList.add(blockMaterialData);
if (skillType.equals("Ability_Blocks")) {
continue;
@@ -103,4 +111,40 @@ public class CustomBlockConfig extends ConfigLoader {
customBlockMap.put(blockMaterialData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
}
}
public CustomBlock getCustomBlock(MaterialData data) {
return customBlockMap.get(data);
}
public boolean isCustomOre(MaterialData data) {
return customOres.contains(data);
}
public boolean isCustomLog(MaterialData data) {
return customLogs.contains(data);
}
public boolean isCustomLeaf(MaterialData data) {
return customLeaves.contains(data);
}
public boolean isCustomAbilityBlock(MaterialData data) {
return customAbilityBlocks.contains(data);
}
public boolean isCustomExcavationBlock(MaterialData data) {
return customExcavationBlocks.contains(data);
}
public boolean isCustomHerbalismBlock(MaterialData data) {
return customHerbalismBlocks.contains(data);
}
public boolean isCustomMiningBlock(MaterialData data) {
return customMiningBlocks.contains(data);
}
public boolean isCustomWoodcuttingBlock(MaterialData data) {
return customWoodcuttingBlocks.contains(data);
}
}

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.config.mods;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.ConfigLoader;
@@ -11,14 +12,24 @@ import com.gmail.nossr50.datatypes.mods.CustomEntity;
import org.apache.commons.lang.ClassUtils;
public class CustomEntityConfig extends ConfigLoader {
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
private static CustomEntityConfig instance;
protected CustomEntityConfig(String fileName) {
super("mods", fileName);
private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
public CustomEntityConfig() {
super("mods", "entities.yml");
loadKeys();
}
public static CustomEntityConfig getInstance() {
if (instance == null) {
instance = new CustomEntityConfig();
}
return instance;
}
@Override
protected void loadKeys() {
if (config.getConfigurationSection("Hostile") != null) {
@@ -60,4 +71,47 @@ public class CustomEntityConfig extends ConfigLoader {
customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
}
}
public boolean isCustomEntity(Entity entity) {
if (customEntityTypeMap.containsKey(entity.getType().toString())) {
return true;
}
try {
return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
return customEntityClassMap.containsKey(entity.getClass().getName());
}
e.printStackTrace();
return false;
}
}
public CustomEntity getCustomEntity(Entity entity) {
CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
if (customEntity == null) {
try {
customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
customEntity = customEntityClassMap.get(entity.getClass().getName());
}
else {
e.printStackTrace();
}
}
}
return customEntity;
}
public void addEntity(CustomEntity customEntity, String className, String entityName) {
customEntityTypeMap.put(entityName, customEntity);
customEntityClassMap.put(className, customEntity);
}
}

View File

@@ -18,26 +18,46 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
public class CustomToolConfig extends ConfigLoader {
private static CustomToolConfig instance;
private boolean needsUpdate = false;
public List<Material> customAxes = new ArrayList<Material>();
public List<Material> customBows = new ArrayList<Material>();
public List<Material> customHoes = new ArrayList<Material>();
public List<Material> customPickaxes = new ArrayList<Material>();
public List<Material> customShovels = new ArrayList<Material>();
public List<Material> customSwords = new ArrayList<Material>();
private List<Repairable> repairables;
public HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
private List<Material> customAxes = new ArrayList<Material>();
private List<Material> customBows = new ArrayList<Material>();
private List<Material> customHoes = new ArrayList<Material>();
private List<Material> customPickaxes = new ArrayList<Material>();
private List<Material> customShovels = new ArrayList<Material>();
private List<Material> customSwords = new ArrayList<Material>();
public List<Repairable> repairables = new ArrayList<Repairable>();
private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
protected CustomToolConfig(String fileName) {
super("mods", fileName);
private CustomToolConfig() {
super("mods", "tools.yml");
loadKeys();
}
public static CustomToolConfig getInstance() {
if (instance == null) {
instance = new CustomToolConfig();
}
return instance;
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
@Override
protected void loadKeys() {
repairables = new ArrayList<Repairable>();
loadTool("Axes", customAxes);
loadTool("Bows", customBows);
loadTool("Hoes", customHoes);
@@ -112,4 +132,36 @@ public class CustomToolConfig extends ConfigLoader {
customToolMap.put(toolMaterial, tool);
}
}
public boolean isCustomAxe(Material material) {
return customAxes.contains(material);
}
public boolean isCustomBow(Material material) {
return customBows.contains(material);
}
public boolean isCustomHoe(Material material) {
return customHoes.contains(material);
}
public boolean isCustomPickaxe(Material material) {
return customPickaxes.contains(material);
}
public boolean isCustomShovel(Material material) {
return customShovels.contains(material);
}
public boolean isCustomSword(Material material) {
return customSwords.contains(material);
}
public boolean isCustomTool(Material material) {
return customToolMap.containsKey(material);
}
public CustomTool getCustomTool(Material material) {
return customToolMap.get(material);
}
}

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import java.io.File;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
public class EntityConfigManager {
public EntityConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.entities\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "entities.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomEntities(new CustomEntityConfig(fileName));
}
}
}

View File

@@ -1,35 +0,0 @@
package com.gmail.nossr50.config.mods;
import java.io.File;
import java.util.regex.Pattern;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ModManager;
public class ToolConfigManager {
public ToolConfigManager(mcMMO plugin) {
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
Pattern startPattern = Pattern.compile("(?:.+)\\.tools\\.yml");
File dataFolder = new File(mcMMO.getModDirectory());
File vanilla = new File(dataFolder, "tools.default.yml");
ModManager modManager = mcMMO.getModManager();
if (!vanilla.exists()) {
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false);
}
for (String fileName : dataFolder.list()) {
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
continue;
}
File file = new File(dataFolder, fileName);
if (file.isDirectory()) {
continue;
}
modManager.registerCustomTools(new CustomToolConfig(fileName));
}
}
}

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.alchemy;
package com.gmail.nossr50.config.potion;
import java.util.ArrayList;
import java.util.HashMap;
@@ -13,21 +13,21 @@ import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
import com.gmail.nossr50.datatypes.AlchemyPotion;
public class PotionConfig extends ConfigLoader {
private static PotionConfig instance;
private List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
private List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
public List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<ItemStack>();
private Map<Short, AlchemyPotion> potionMap = new HashMap<Short, AlchemyPotion>();
public Map<Short, AlchemyPotion> potionMap = new HashMap<Short, AlchemyPotion>();
private PotionConfig() {
super("potions.yml");
@@ -189,34 +189,4 @@ public class PotionConfig extends ConfigLoader {
return null;
}
public List<ItemStack> getIngredients(int tier) {
switch (tier) {
case 8:
return concoctionsIngredientsTierEight;
case 7:
return concoctionsIngredientsTierSeven;
case 6:
return concoctionsIngredientsTierSix;
case 5:
return concoctionsIngredientsTierFive;
case 4:
return concoctionsIngredientsTierFour;
case 3:
return concoctionsIngredientsTierThree;
case 2:
return concoctionsIngredientsTierTwo;
case 1:
default:
return concoctionsIngredientsTierOne;
}
}
public boolean isValidPotion(ItemStack item) {
return potionMap.containsKey(item.getDurability());
}
public AlchemyPotion getPotion(short durability) {
return potionMap.get(durability);
}
}

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.repair;
package com.gmail.nossr50.config.repair;
import java.util.ArrayList;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.config.skills.repair;
package com.gmail.nossr50.config.repair;
import java.io.File;
import java.util.ArrayList;
@@ -9,9 +9,11 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
public class RepairConfigManager {
private final List<Repairable> repairables = new ArrayList<Repairable>();
private List<Repairable> repairables;
public RepairConfigManager(mcMMO plugin) {
repairables = new ArrayList<Repairable>();
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
File dataFolder = plugin.getDataFolder();
File vanilla = new File(dataFolder, "repair.vanilla.yml");
@@ -32,11 +34,19 @@ public class RepairConfigManager {
}
RepairConfig rConfig = new RepairConfig(fileName);
repairables.addAll(rConfig.getLoadedRepairables());
List<Repairable> rConfigRepairables = rConfig.getLoadedRepairables();
if (rConfigRepairables != null) {
repairables.addAll(rConfigRepairables);
}
}
}
public List<Repairable> getLoadedRepairables() {
if (repairables == null) {
return new ArrayList<Repairable>();
}
return repairables;
}
}

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

@@ -25,7 +25,6 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.spout.huds.HudType;
import com.gmail.nossr50.util.Misc;
public final class FlatfileDatabaseManager implements DatabaseManager {
@@ -259,8 +258,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
writer.append((int) profile.getAbilityDATS(AbilityType.SERRATED_STRIKES)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.SKULL_SPLITTER)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.SUPER_BREAKER)).append(":");
HudType hudType = profile.getHudType();
writer.append(hudType == null ? "STANDARD" : hudType.toString()).append(":");
writer.append(":");
writer.append(profile.getSkillLevel(SkillType.FISHING)).append(":");
writer.append(profile.getSkillXpLevel(SkillType.FISHING)).append(":");
writer.append((int) profile.getAbilityDATS(AbilityType.BLAST_MINING)).append(":");
@@ -773,7 +771,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
Map<SkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
HudType hudType;
MobHealthbarType mobHealthbarType;
// TODO on updates, put new values in a try{} ?
@@ -805,13 +802,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// Acrobatics - Unused
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 {
mobHealthbarType = MobHealthbarType.valueOf(character[38]);
}
@@ -819,7 +809,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
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) {

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.skills.AbilityType;
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.SQLReconnectTask;
import com.gmail.nossr50.util.Misc;
@@ -131,10 +130,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
boolean success = true;
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
HudType hudType = profile.getHudType();
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(
"UPDATE " + tablePrefix + "cooldowns SET "
+ " mining = ?, woodcutting = ?, unarmed = ?"
@@ -1166,7 +1164,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;
try {
@@ -1196,7 +1194,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
HudType hudType;
MobHealthbarType mobHealthbarType;
final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added)
@@ -1245,13 +1242,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
// Acrobatics - Unused - result.getInt(OFFSET_DATS + 11)
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 {
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 2));
}
@@ -1259,7 +1249,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
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) {

View File

@@ -1,4 +1,4 @@
package com.gmail.nossr50.datatypes.skills.alchemy;
package com.gmail.nossr50.datatypes;
import java.util.List;
import java.util.Map;
@@ -25,27 +25,25 @@ public class AlchemyPotion {
}
public String toString() {
return "AlchemyPotion{" + dataValue + ", " + name + ", Effects[" + effects.size() + "], Children[" + children.size() + "]}";
return "AlchemyPotion{" + dataValue + "," + name + ",Effects[" + effects.size() + "], Children[" + children.size() + "]}";
}
public ItemStack toItemStack() {
return toItemStack(1);
}
public ItemStack toItemStack(int amount) {
ItemStack potion = new ItemStack(Material.POTION, amount, this.getDataValue());
PotionMeta meta = (PotionMeta) potion.getItemMeta();
if (this.getName() != null) {
meta.setDisplayName(this.getName());
}
meta.setDisplayName(this.getName());
if (this.getLore() != null && !this.getLore().isEmpty()) {
meta.setLore(this.getLore());
}
if (!this.getEffects().isEmpty()) {
for (PotionEffect effect : this.getEffects()) {
meta.addCustomEffect(effect, true);
}
}
potion.setItemMeta(meta);
return potion;
}

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.SkillType;
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.party.PartyManager;
import com.gmail.nossr50.party.ShareHandler;
@@ -48,12 +47,12 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.spout.SpoutUtils;
import org.apache.commons.lang.Validate;
@@ -90,7 +89,6 @@ public class McMMOPlayer {
private int chimeraWingLastUse;
private Location teleportCommence;
private boolean isSpoutPlayer;
private boolean isUsingUnarmed;
private final FixedMetadataValue playerMetadata;
@@ -405,17 +403,6 @@ public class McMMOPlayer {
teleportCommence = player.getLocation();
}
/*
* Spout support
*/
public boolean isSpoutPlayer() {
return isSpoutPlayer;
}
public void setIsSpoutPlayer(boolean isSpoutPlayer) {
this.isSpoutPlayer = isSpoutPlayer;
}
/*
* Exploit Prevention
*/
@@ -562,12 +549,6 @@ public class McMMOPlayer {
return;
}
McMMOHud spoutHud = profile.getSpoutHud();
if (spoutHud != null) {
spoutHud.setLastGained(skillType);
}
isUsingUnarmed = (skillType == SkillType.UNARMED);
checkXp(skillType);
}
@@ -599,20 +580,11 @@ public class McMMOPlayer {
return;
}
if (this.isSpoutPlayer) {
SpoutUtils.processLevelup(this, skillType, levelsGained);
}
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 (Config.getInstance().getLevelUpSoundsEnabled()) {
player.playSound(player.getLocation(), Sound.LEVEL_UP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
}
if (this.isSpoutPlayer) {
SpoutUtils.processXpGain(player, profile);
}
player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(skillType.toString()) + ".Skillup", levelsGained, getSkillLevel(skillType)));
}
/*
@@ -785,7 +757,7 @@ public class McMMOPlayer {
xp = (float) (xp / skillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
if (Config.getInstance().getToolModsEnabled()) {
CustomTool tool = mcMMO.getModManager().getTool(player.getItemInHand());
CustomTool tool = ModUtils.getToolFromItemStack(player.getItemInHand());
if (tool != null) {
xp *= tool.getXpMultiplier();
@@ -871,7 +843,7 @@ public class McMMOPlayer {
ItemStack inHand = player.getItemInHand();
if (mcMMO.getModManager().isCustomTool(inHand) && !mcMMO.getModManager().getTool(inHand).isAbilityEnabled()) {
if (ModUtils.isCustomTool(inHand) && !ModUtils.getToolFromItemStack(inHand).isAbilityEnabled()) {
return;
}
@@ -975,14 +947,6 @@ public class McMMOPlayer {
profile.resetCooldowns();
}
public McMMOHud getSpoutHud() {
return profile.getSpoutHud();
}
public void setSpoutHud(McMMOHud spoutHud) {
profile.setSpoutHud(spoutHud);
}
public FixedMetadataValue getPlayerMetadata() {
return playerMetadata;
}

View File

@@ -7,13 +7,10 @@ import java.util.Set;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
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.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.AbilityType;
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.util.player.UserManager;
@@ -25,9 +22,7 @@ public class PlayerProfile {
private boolean changed;
/* HUDs */
private HudType hudType;
private MobHealthbarType mobHealthbarType;
private McMMOHud spoutHud;
/* Skill Data */
private final Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
@@ -37,7 +32,6 @@ public class PlayerProfile {
public PlayerProfile(String playerName) {
this.playerName = playerName;
hudType = mcMMO.isSpoutEnabled() ? SpoutConfig.getInstance().getDefaultHudType() : HudType.DISABLED;
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
for (AbilityType abilityType : AbilityType.values()) {
@@ -55,10 +49,8 @@ public class PlayerProfile {
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.hudType = hudType;
this.mobHealthbarType = mobHealthbarType;
skills.putAll(levelData);
@@ -73,7 +65,7 @@ public class PlayerProfile {
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) {
mcMMO.p.getLogger().warning("PlayerProfile for " + playerName + " failed to save");
@@ -88,26 +80,6 @@ public class PlayerProfile {
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
*/

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

@@ -104,7 +104,7 @@ public class BlockListener implements Listener {
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -144,7 +144,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
@@ -214,7 +214,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
@@ -261,7 +261,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -327,7 +327,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}

View File

@@ -143,7 +143,7 @@ public class EntityListener implements Listener {
return;
}
if (!UserManager.hasPlayerDataKey(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
return;
}
@@ -424,7 +424,7 @@ public class EntityListener implements Listener {
// We can make this assumption because we (should) be the only ones using this exact metadata
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -451,7 +451,7 @@ public class EntityListener implements Listener {
// We can make this assumption because we (should) be the only ones using this exact metadata
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -494,7 +494,7 @@ public class EntityListener implements Listener {
Player player = (Player) entity;
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -560,7 +560,7 @@ public class EntityListener implements Listener {
Player player = (Player) event.getOwner();
LivingEntity entity = event.getEntity();
if (!UserManager.hasPlayerDataKey(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
if (Misc.isNPCEntity(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
return;
}

View File

@@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceExtractEvent;
@@ -23,10 +22,8 @@ import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.BrewerInventory;
import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
@@ -35,9 +32,9 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -59,7 +56,7 @@ public class InventoryListener implements Listener {
HumanEntity player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -76,7 +73,7 @@ public class InventoryListener implements Listener {
HumanEntity player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -95,7 +92,7 @@ public class InventoryListener implements Listener {
Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
if (Misc.isNPCEntity(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
return;
}
@@ -113,7 +110,7 @@ public class InventoryListener implements Listener {
Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
if (Misc.isNPCEntity(player) || !SkillType.SMELTING.getPermissions(player)) {
return;
}
@@ -132,7 +129,7 @@ public class InventoryListener implements Listener {
Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
if (Misc.isNPCEntity(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
return;
}
@@ -141,164 +138,43 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryClickEventNormal(InventoryClickEvent event) {
Inventory inventory = event.getInventory();
if (!(inventory instanceof BrewerInventory)) {
if (event.getInventory().getType() != InventoryType.BREWING || !(event.getInventory().getHolder() instanceof BrewingStand)) {
return;
}
InventoryHolder holder = inventory.getHolder();
if (!(holder instanceof BrewingStand)) {
if (!(event.getWhoClicked() instanceof Player) || Misc.isNPCEntity(event.getWhoClicked()) || !Permissions.concoctions(event.getWhoClicked())) {
return;
}
HumanEntity whoClicked = event.getWhoClicked();
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
return;
}
Player player = (Player) whoClicked;
BrewingStand stand = (BrewingStand) holder;
ItemStack clicked = event.getCurrentItem();
ItemStack cursor = event.getCursor();
if ((clicked != null && clicked.getType() == Material.POTION) || (cursor != null && cursor.getType() == Material.POTION)) {
AlchemyPotionBrewer.scheduleCheck(player, stand);
return;
}
ClickType click = event.getClick();
InventoryType.SlotType slot = event.getSlotType();
if (click.isShiftClick()) {
switch (slot) {
case FUEL:
AlchemyPotionBrewer.scheduleCheck(player, stand);
return;
case CONTAINER:
case QUICKBAR:
if (!AlchemyPotionBrewer.isValidIngredient(player, clicked)) {
return;
}
AlchemyPotionBrewer.transferItems(event.getView(), event.getRawSlot(), Alchemy.INGREDIENT_SLOT, click);
event.setCancelled(true);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(player, stand);
return;
default:
return;
}
}
else if (slot == InventoryType.SlotType.FUEL) {
boolean emptyClicked = AlchemyPotionBrewer.isEmpty(clicked);
if (AlchemyPotionBrewer.isEmpty(cursor)) {
if (emptyClicked && click == ClickType.NUMBER_KEY) {
AlchemyPotionBrewer.scheduleCheck(player, stand);
return;
}
AlchemyPotionBrewer.scheduleCheck(player, stand);
}
else if (emptyClicked) {
if (AlchemyPotionBrewer.isValidIngredient(player, cursor)) {
int amount = cursor.getAmount();
if (click == ClickType.LEFT || (click == ClickType.RIGHT && amount == 1)) {
event.setCancelled(true);
event.setCurrentItem(cursor.clone());
event.setCursor(null);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(player, stand);
}
else if (click == ClickType.RIGHT) {
event.setCancelled(true);
ItemStack one = cursor.clone();
one.setAmount(1);
ItemStack rest = cursor.clone();
rest.setAmount(amount - 1);
event.setCurrentItem(one);
event.setCursor(rest);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(player, stand);
}
}
}
}
AlchemyPotionBrewer.handleInventoryClick(event);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryDragEvent(InventoryDragEvent event) {
Inventory inventory = event.getInventory();
if (!(inventory instanceof BrewerInventory)) {
if (event.getInventory().getType() != InventoryType.BREWING || !(event.getInventory().getHolder() instanceof BrewingStand)) {
return;
}
InventoryHolder holder = inventory.getHolder();
if (!(holder instanceof BrewingStand)) {
if (!(event.getWhoClicked() instanceof Player) || Misc.isNPCEntity(event.getWhoClicked()) || !Permissions.concoctions(event.getWhoClicked())) {
return;
}
HumanEntity whoClicked = event.getWhoClicked();
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
return;
}
if (!event.getInventorySlots().contains(Alchemy.INGREDIENT_SLOT)) {
return;
}
ItemStack cursor = event.getCursor();
ItemStack ingredient = ((BrewerInventory) inventory).getIngredient();
if (AlchemyPotionBrewer.isEmpty(ingredient) || ingredient.isSimilar(cursor)) {
Player player = (Player) whoClicked;
if (AlchemyPotionBrewer.isValidIngredient(player, cursor)) {
// Not handled: dragging custom ingredients over ingredient slot (does not trigger any event)
AlchemyPotionBrewer.scheduleCheck(player, (BrewingStand) holder);
return;
}
event.setCancelled(true);
AlchemyPotionBrewer.scheduleUpdate(inventory);
}
AlchemyPotionBrewer.handleInventoryDrag(event);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
Inventory inventory = event.getDestination();
if (!(inventory instanceof BrewerInventory)) {
if (event.getDestination().getType() != InventoryType.BREWING || !(event.getDestination().getHolder() instanceof BrewingStand)) {
return;
}
InventoryHolder holder = inventory.getHolder();
if (!(holder instanceof BrewingStand)) {
return;
}
ItemStack item = event.getItem();
if (Config.getInstance().getPreventHopperTransfer() && item.getType() != Material.POTION) {
if (Config.getInstance().getPreventHopperTransfer() && event.getItem() != null && event.getItem().getType() != Material.POTION) {
event.setCancelled(true);
return;
}
if (Config.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
if (Config.getInstance().getEnabledForHoppers()) {
AlchemyPotionBrewer.handleInventoryMoveItem(event);
}
}
@@ -311,7 +187,7 @@ public class InventoryListener implements Listener {
public void onCraftItem(CraftItemEvent event) {
final HumanEntity whoClicked = event.getWhoClicked();
if (!whoClicked.hasMetadata(mcMMO.playerDataKey)) {
if (Misc.isNPCEntity(whoClicked) || !(whoClicked instanceof Player)) {
return;
}

View File

@@ -58,7 +58,6 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.Motd;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillUtils;
public class PlayerListener implements Listener {
@@ -81,7 +80,7 @@ public class PlayerListener implements Listener {
public void onPlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !Config.getInstance().getPreventXPAfterTeleport() || event.getFrom().equals(event.getTo())) {
if (Misc.isNPCEntity(player) || !Config.getInstance().getPreventXPAfterTeleport() || event.getFrom().equals(event.getTo())) {
return;
}
@@ -130,7 +129,7 @@ public class PlayerListener implements Listener {
Player killedPlayer = event.getEntity();
if (!killedPlayer.hasMetadata(mcMMO.playerDataKey) || Permissions.hardcoreBypass(killedPlayer)) {
if (Misc.isNPCEntity(killedPlayer) || Permissions.hardcoreBypass(killedPlayer)) {
return;
}
@@ -165,7 +164,7 @@ public class PlayerListener implements Listener {
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -208,7 +207,7 @@ public class PlayerListener implements Listener {
public void onPlayerFishHighest(PlayerFishEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
if (Misc.isNPCEntity(player) || !SkillType.FISHING.getPermissions(player)) {
return;
}
@@ -253,7 +252,7 @@ public class PlayerListener implements Listener {
public void onPlayerFishMonitor(PlayerFishEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
if (Misc.isNPCEntity(player) || !SkillType.FISHING.getPermissions(player)) {
return;
}
@@ -294,7 +293,7 @@ public class PlayerListener implements Listener {
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -344,7 +343,7 @@ public class PlayerListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -353,8 +352,7 @@ public class PlayerListener implements Listener {
mcMMOPlayer.resetAbilityMode();
BleedTimerTask.bleedOut(player);
mcMMOPlayer.getProfile().save();
UserManager.remove(player);
ScoreboardManager.teardownPlayer(player);
UserManager.remove(player.getName());
}
/**
@@ -374,9 +372,7 @@ public class PlayerListener implements Listener {
return;
}
McMMOPlayer mcMMOPlayer = UserManager.addUser(player);
mcMMOPlayer.actualizeRespawnATS();
ScoreboardManager.setupPlayer(player);
UserManager.addUser(player).actualizeRespawnATS();
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
Motd.displayAll(player);
@@ -405,7 +401,7 @@ public class PlayerListener implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player)) {
if (Misc.isNPCEntity(player)) {
return;
}
@@ -421,7 +417,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractLowest(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}
@@ -512,7 +508,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
return;
}

View File

@@ -0,0 +1,39 @@
package com.gmail.nossr50.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
public class ScoreboardsListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
ScoreboardManager.setupPlayer(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
ScoreboardManager.teardownPlayer(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
ScoreboardManager.handleLevelUp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
}
}

View File

@@ -1,41 +1,21 @@
package com.gmail.nossr50.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) {
Player player = event.getPlayer();
SkillType skill = event.getSkill();
ScoreboardManager.handleLevelUp(player, skill);
if (!Config.getInstance().getLevelUpEffectsEnabled()) {
return;
}
if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) {
skill.celebrateLevelUp(player);
event.getSkill().celebrateLevelUp(event.getPlayer());
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
}
}

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

@@ -14,13 +14,12 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.mods.ArmorConfigManager;
import com.gmail.nossr50.config.mods.BlockConfigManager;
import com.gmail.nossr50.config.mods.EntityConfigManager;
import com.gmail.nossr50.config.mods.ToolConfigManager;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.config.repair.RepairConfigManager;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory;
@@ -28,8 +27,8 @@ import com.gmail.nossr50.listeners.BlockListener;
import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.InventoryListener;
import com.gmail.nossr50.listeners.PlayerListener;
import com.gmail.nossr50.listeners.ScoreboardsListener;
import com.gmail.nossr50.listeners.SelfListener;
import com.gmail.nossr50.listeners.SpoutListener;
import com.gmail.nossr50.listeners.WorldListener;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.metrics.MetricsManager;
@@ -49,7 +48,6 @@ import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.HolidayManager;
import com.gmail.nossr50.util.LogFilter;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
@@ -57,7 +55,6 @@ import com.gmail.nossr50.util.commands.CommandRegistrationManager;
import com.gmail.nossr50.util.experience.FormulaManager;
import com.gmail.nossr50.util.player.UserManager;
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.UpdateResult;
@@ -68,7 +65,6 @@ public class mcMMO extends JavaPlugin {
/* Managers */
private static ChunkManager placeStore;
private static RepairableManager repairableManager;
private static ModManager modManager;
private static DatabaseManager databaseManager;
private static FormulaManager formulaManager;
private static HolidayManager holidayManager;
@@ -88,7 +84,6 @@ public class mcMMO extends JavaPlugin {
private boolean updateAvailable;
/* Plugin Checks */
private static boolean spoutEnabled;
private static boolean combatTagEnabled;
private static boolean healthBarPluginEnabled;
private static boolean noCheatPlusPluginEnabled;
@@ -115,7 +110,6 @@ public class mcMMO extends JavaPlugin {
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
public final static String customDamageKey = "mcMMO: Custom Damage";
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
public final static String playerDataKey = "mcMMO: Player Data";
public static FixedMetadataValue metadataValue;
@@ -129,7 +123,6 @@ public class mcMMO extends JavaPlugin {
getLogger().setFilter(new LogFilter(this));
metadataValue = new FixedMetadataValue(this, true);
spoutEnabled = getServer().getPluginManager().getPlugin("Spout") != null;
mcpcEnabled = getServer().getName().equals("MCPC+");
combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null;
healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null;
@@ -138,12 +131,6 @@ public class mcMMO extends JavaPlugin {
setupFilePaths();
if (spoutEnabled) {
setupSpout();
}
modManager = new ModManager();
loadConfigFiles();
if (!noErrorsInConfigFiles) {
@@ -307,19 +294,11 @@ public class mcMMO extends JavaPlugin {
return databaseManager;
}
public static ModManager getModManager() {
return modManager;
}
@Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager;
}
public static boolean isSpoutEnabled() {
return spoutEnabled;
}
public static boolean isCombatTagEnabled() {
return combatTagEnabled;
}
@@ -350,47 +329,15 @@ public class mcMMO extends JavaPlugin {
if (oldFlatfilePath.exists()) {
if (!oldFlatfilePath.renameTo(new File(flatFileDirectory))) {
getLogger().warning("Failed to rename FlatFileStuff to flatfile!");
getLogger().warning("Failed to rename FlatFileStuff to flatfile !");
}
}
if (oldModPath.exists()) {
if (!oldModPath.renameTo(new File(modDirectory))) {
getLogger().warning("Failed to rename ModConfigs to mods!");
getLogger().warning("Failed to rename ModConfigs to mods !");
}
}
File oldArmorFile = new File(modDirectory + "armor.yml");
File oldBlocksFile = new File(modDirectory + "blocks.yml");
File oldEntitiesFile = new File(modDirectory + "entities.yml");
File oldToolsFile = new File(modDirectory + "tools.yml");
if (oldArmorFile.exists()) {
if (!oldArmorFile.renameTo(new File(modDirectory + "armor.default.yml"))) {
getLogger().warning("Failed to rename armor.yml to armor.default.yml!");
}
}
if (oldBlocksFile.exists()) {
if (!oldBlocksFile.renameTo(new File(modDirectory + "blocks.default.yml"))) {
getLogger().warning("Failed to rename blocks.yml to blocks.default.yml!");
}
}
if (oldEntitiesFile.exists()) {
if (!oldEntitiesFile.renameTo(new File(modDirectory + "entities.default.yml"))) {
getLogger().warning("Failed to rename entities.yml to entities.default.yml!");
}
}
if (oldToolsFile.exists()) {
if (!oldToolsFile.renameTo(new File(modDirectory + "tools.default.yml"))) {
getLogger().warning("Failed to rename tools.yml to tools.default.yml!");
}
}
File currentFlatfilePath = new File(flatFileDirectory);
currentFlatfilePath.mkdirs();
}
private void checkForUpdates() {
@@ -426,35 +373,28 @@ public class mcMMO extends JavaPlugin {
List<Repairable> repairables = new ArrayList<Repairable>();
if (Config.getInstance().getToolModsEnabled()) {
new ToolConfigManager(this);
repairables.addAll(CustomToolConfig.getInstance().getLoadedRepairables());
}
if (Config.getInstance().getArmorModsEnabled()) {
new ArmorConfigManager(this);
repairables.addAll(CustomArmorConfig.getInstance().getLoadedRepairables());
}
if (Config.getInstance().getBlockModsEnabled()) {
new BlockConfigManager(this);
CustomBlockConfig.getInstance();
}
if (Config.getInstance().getEntityModsEnabled()) {
new EntityConfigManager(this);
CustomEntityConfig.getInstance();
}
// Load repair configs, make manager, and register them at this time
repairables.addAll(new RepairConfigManager(this).getLoadedRepairables());
repairables.addAll(modManager.getLoadedRepairables());
RepairConfigManager rManager = new RepairConfigManager(this);
repairables.addAll(rManager.getLoadedRepairables());
repairableManager = new SimpleRepairableManager(repairables.size());
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() {
PluginManager pluginManager = getServer().getPluginManager();
@@ -464,6 +404,7 @@ public class mcMMO extends JavaPlugin {
pluginManager.registerEvents(new EntityListener(this), this);
pluginManager.registerEvents(new InventoryListener(this), this);
pluginManager.registerEvents(new SelfListener(), this);
pluginManager.registerEvents(new ScoreboardsListener(), this);
pluginManager.registerEvents(new WorldListener(this), this);
}

View File

@@ -170,7 +170,7 @@ public final class PartyManager {
*/
public static Party getParty(String partyName) {
for (Party party : parties) {
if (party.getName().equalsIgnoreCase(partyName)) {
if (party.getName().equals(partyName)) {
return party;
}
}

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.runnables.skills;
import java.util.Arrays;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BrewingStand;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -12,6 +12,8 @@ import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
public class AlchemyBrewCheckTask extends BukkitRunnable {
private final static int INGREDIENT_SLOT = 3;
private Player player;
private BrewingStand brewingStand;
private ItemStack[] oldInventory;
@@ -24,17 +26,18 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
@Override
public void run() {
Location location = brewingStand.getLocation();
ItemStack[] newInventory = Arrays.copyOfRange(brewingStand.getInventory().getContents(), 0, 4);
boolean validBrew = AlchemyPotionBrewer.isValidBrew(player, newInventory);
Block block = brewingStand.getBlock();
ItemStack[] newInventory = Arrays.copyOfRange(((BrewingStand) block.getState()).getInventory().getContents(), 0, 4);
if (Alchemy.brewingStandMap.containsKey(location)) {
if (oldInventory[Alchemy.INGREDIENT_SLOT] == null || newInventory[Alchemy.INGREDIENT_SLOT] == null || !oldInventory[Alchemy.INGREDIENT_SLOT].isSimilar(newInventory[Alchemy.INGREDIENT_SLOT]) || !validBrew) {
Alchemy.brewingStandMap.get(location).cancelBrew();
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
if (oldInventory[INGREDIENT_SLOT] == null || newInventory[INGREDIENT_SLOT] == null || !oldInventory[INGREDIENT_SLOT].isSimilar(newInventory[INGREDIENT_SLOT]) || !AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
Alchemy.brewingStandMap.get(brewingStand).cancelBrew();
}
}
else if (validBrew) {
Alchemy.brewingStandMap.put(location, new AlchemyBrewTask(brewingStand, player));
if (!Alchemy.brewingStandMap.containsKey(brewingStand) && AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
Alchemy.brewingStandMap.put(brewingStand, new AlchemyBrewTask(brewingStand, player));
}
}
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.runnables.skills;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.BrewingStand;
@@ -23,43 +22,44 @@ public class AlchemyBrewTask extends BukkitRunnable {
private static int DEFAULT_BREW_TICKS = 400;
private BlockState brewingStand;
private Location location;
private double brewSpeed;
private double brewTimer;
private Player player;
public AlchemyBrewTask(BlockState brewingStand, Player player) {
this.brewingStand = brewingStand;
this.location = brewingStand.getLocation();
this.player = player;
brewSpeed = DEFAULT_BREW_SPEED;
brewTimer = DEFAULT_BREW_TICKS;
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY));
double catalysis = UserManager.getPlayer(player).getAlchemyManager().getBrewSpeed();
if (Permissions.lucky(player, SkillType.ALCHEMY)) {
catalysis = UserManager.getPlayer(player).getAlchemyManager().getBrewSpeedLucky();
}
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
brewSpeed = catalysis;
}
}
if (Alchemy.brewingStandMap.containsKey(location)) {
Alchemy.brewingStandMap.get(location).cancel();
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
Alchemy.brewingStandMap.get(brewingStand).cancel();
}
Alchemy.brewingStandMap.put(location, this);
Alchemy.brewingStandMap.put(brewingStand, this);
this.runTaskTimer(mcMMO.p, 1, 1);
}
@Override
public void run() {
if (player == null || !player.isValid() || brewingStand == null || brewingStand.getType() != Material.BREWING_STAND) {
if (Alchemy.brewingStandMap.containsKey(location)) {
Alchemy.brewingStandMap.remove(location);
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
Alchemy.brewingStandMap.remove(brewingStand);
}
this.cancel();
@@ -87,20 +87,20 @@ public class AlchemyBrewTask extends BukkitRunnable {
AlchemyPotionBrewer.finishBrewing(brewingStand, player, false);
}
Alchemy.brewingStandMap.remove(location);
Alchemy.brewingStandMap.remove(brewingStand);
}
public void finishImmediately() {
this.cancel();
AlchemyPotionBrewer.finishBrewing(brewingStand, player, true);
Alchemy.brewingStandMap.remove(location);
Alchemy.brewingStandMap.remove(brewingStand);
}
public void cancelBrew() {
this.cancel();
((BrewingStand) brewingStand).setBrewingTime(-1);
Alchemy.brewingStandMap.remove(location);
Alchemy.brewingStandMap.remove(brewingStand);
}
}

View File

@@ -1,11 +1,9 @@
package com.gmail.nossr50.skills.alchemy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.block.BlockState;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
@@ -46,30 +44,36 @@ public final class Alchemy {
}
}
public static final int INGREDIENT_SLOT = 3;
public static int catalysisUnlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel();
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<Location, AlchemyBrewTask>();
public static Map<BlockState, AlchemyBrewTask> brewingStandMap = new HashMap<BlockState, AlchemyBrewTask>();
private Alchemy() {}
/**
* Calculate base brewing speed, given a skill level and ignoring all perks.
*
* @param skillLevel Skill level used for calculation.
*
* @return Base brewing speed for the level.
*/
public static double calculateBrewSpeed(int skillLevel) {
if (skillLevel < catalysisUnlockLevel) {
return catalysisMinSpeed;
}
return Math.min(catalysisMaxSpeed, catalysisMinSpeed + (catalysisMaxSpeed - catalysisMinSpeed) * (skillLevel - catalysisUnlockLevel) / (catalysisMaxBonusLevel - catalysisUnlockLevel));
}
/**
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
*/
public static void finishAllBrews() {
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) {
toFinish.add(alchemyBrewTask);
}
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
alchemyBrewTask.finishImmediately();
}
}

View File

@@ -5,10 +5,12 @@ import java.util.List;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
public class AlchemyManager extends SkillManager {
@@ -18,6 +20,23 @@ public class AlchemyManager extends SkillManager {
super(mcMMOPlayer, SkillType.ALCHEMY);
}
public boolean canCatalysis() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CATALYSIS);
}
public boolean canConcoctions() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CONCOCTIONS);
}
public boolean canUseIngredient(ItemStack item) {
for (ItemStack ingredient : getIngredients()) {
if (item.isSimilar(ingredient)) {
return true;
}
}
return false;
}
public int getTier() {
for (Alchemy.Tier tier : Alchemy.Tier.values()) {
if (getSkillLevel() >= tier.getLevel()) {
@@ -29,17 +48,31 @@ public class AlchemyManager extends SkillManager {
}
public List<ItemStack> getIngredients() {
return PotionConfig.getInstance().getIngredients(getTier());
switch (Alchemy.Tier.fromNumerical(getTier())) {
case EIGHT:
return PotionConfig.getInstance().concoctionsIngredientsTierEight;
case SEVEN:
return PotionConfig.getInstance().concoctionsIngredientsTierSeven;
case SIX:
return PotionConfig.getInstance().concoctionsIngredientsTierSix;
case FIVE:
return PotionConfig.getInstance().concoctionsIngredientsTierFive;
case FOUR:
return PotionConfig.getInstance().concoctionsIngredientsTierFour;
case THREE:
return PotionConfig.getInstance().concoctionsIngredientsTierThree;
case TWO:
return PotionConfig.getInstance().concoctionsIngredientsTierTwo;
default:
return PotionConfig.getInstance().concoctionsIngredientsTierOne;
}
}
public String getIngredientList() {
StringBuilder list = new StringBuilder();
for (ItemStack ingredient : getIngredients()) {
short durability = ingredient.getDurability();
String string = StringUtils.getPrettyItemString(ingredient.getType()) + (durability != 0 ? ":" + durability : "");
String string = StringUtils.getPrettyItemString(ingredient.getType()) + (ingredient.getDurability() != 0 ? ":" + ingredient.getDurability() : "");
if (string.equals("Long Grass:2")) {
string = "Fern";
}
@@ -47,20 +80,17 @@ public class AlchemyManager extends SkillManager {
string = "Pufferfish";
}
list.append(", ").append(string);
list.append(", " + string);
}
return list.substring(2);
}
public double calculateBrewSpeed(boolean isLucky) {
int skillLevel = getSkillLevel();
public double getBrewSpeed() {
return Alchemy.calculateBrewSpeed(getSkillLevel());
}
if (skillLevel < Alchemy.catalysisUnlockLevel) {
return Alchemy.catalysisMinSpeed;
}
return Math.min(Alchemy.catalysisMaxSpeed, Alchemy.catalysisMinSpeed + (Alchemy.catalysisMaxSpeed - Alchemy.catalysisMinSpeed) * (skillLevel - Alchemy.catalysisUnlockLevel) / (Alchemy.catalysisMaxBonusLevel - Alchemy.catalysisUnlockLevel)) * (isLucky ? LUCKY_MODIFIER : 1.0);
public double getBrewSpeedLucky() {
return LUCKY_MODIFIER * Alchemy.calculateBrewSpeed(getSkillLevel());
}
public void handlePotionBrewSuccesses(int amount) {

View File

@@ -8,69 +8,79 @@ import org.bukkit.block.BrewingStand;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.inventory.BrewerInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.config.potion.PotionConfig;
import com.gmail.nossr50.datatypes.AlchemyPotion;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
public final class AlchemyPotionBrewer {
private final static int[] BOTTLE_SLOTS = new int[]{0, 1, 2};
private final static int INGREDIENT_SLOT = 3;
public static boolean isValidBrew(Player player, ItemStack[] contents) {
if (!isValidIngredient(player, contents[Alchemy.INGREDIENT_SLOT])) {
if (!isValidIngredient(player, contents[INGREDIENT_SLOT])) {
return false;
}
for (int i = 0; i < 3; i++) {
if (contents[i] == null || contents[i].getType() != Material.POTION) {
continue;
}
for (int bottle : BOTTLE_SLOTS) {
if (contents[bottle] != null && contents[bottle].getType() == Material.POTION) {
AlchemyPotion potion = PotionConfig.getInstance().potionMap.get(contents[bottle].getDurability());
if (getChildPotion(PotionConfig.getInstance().getPotion(contents[i].getDurability()), contents[Alchemy.INGREDIENT_SLOT]) != null) {
return true;
if (getChildPotion(potion, contents[INGREDIENT_SLOT]) != null) {
return true;
}
}
}
return false;
}
private static AlchemyPotion getChildPotion(AlchemyPotion potion, ItemStack ingredient) {
if (potion != null && potion.getChildDataValue(ingredient) != -1) {
return PotionConfig.getInstance().getPotion(potion.getChildDataValue(ingredient));
return PotionConfig.getInstance().potionMap.get(potion.getChildDataValue(ingredient));
}
return null;
}
public static boolean isEmpty(ItemStack item) {
private static boolean isEmpty(ItemStack item) {
return item == null || item.getType() == Material.AIR || item.getAmount() == 0;
}
private static boolean removeIngredient(BrewerInventory inventory, Player player) {
ItemStack ingredient = inventory.getIngredient().clone();
ItemStack ingredient = inventory.getIngredient();
if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) {
return false;
}
else if (ingredient.getAmount() <= 1) {
inventory.setIngredient(null);
inventory.setItem(INGREDIENT_SLOT, null);
return true;
}
else {
ingredient.setAmount(ingredient.getAmount() - 1);
inventory.setIngredient(ingredient);
inventory.setItem(INGREDIENT_SLOT, ingredient);
return true;
}
}
public static boolean isValidIngredient(Player player, ItemStack item) {
private static boolean isValidIngredient(Player player, ItemStack item) {
if (isEmpty(item)) {
return false;
}
@@ -85,7 +95,28 @@ public final class AlchemyPotionBrewer {
}
private static List<ItemStack> getValidIngredients(Player player) {
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
if (player == null || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CONCOCTIONS)) {
return PotionConfig.getInstance().concoctionsIngredientsTierOne;
}
switch (UserManager.getPlayer(player).getAlchemyManager().getTier()) {
case 8:
return PotionConfig.getInstance().concoctionsIngredientsTierEight;
case 7:
return PotionConfig.getInstance().concoctionsIngredientsTierSeven;
case 6:
return PotionConfig.getInstance().concoctionsIngredientsTierSix;
case 5:
return PotionConfig.getInstance().concoctionsIngredientsTierFive;
case 4:
return PotionConfig.getInstance().concoctionsIngredientsTierFour;
case 3:
return PotionConfig.getInstance().concoctionsIngredientsTierThree;
case 2:
return PotionConfig.getInstance().concoctionsIngredientsTierTwo;
default:
return PotionConfig.getInstance().concoctionsIngredientsTierOne;
}
}
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
@@ -100,21 +131,17 @@ public final class AlchemyPotionBrewer {
return;
}
for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i).clone();
for (int bottle : BOTTLE_SLOTS) {
if (!isEmpty(inventory.getItem(bottle)) && PotionConfig.getInstance().potionMap.containsKey(inventory.getItem(bottle).getDurability())) {
AlchemyPotion input = PotionConfig.getInstance().potionMap.get(inventory.getItem(bottle).getDurability());
AlchemyPotion output = PotionConfig.getInstance().potionMap.get(input.getChildDataValue(ingredient));
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
continue;
}
if (output != null) {
inventory.setItem(bottle, output.toItemStack(inventory.getItem(bottle).getAmount()).clone());
AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
if (output != null) {
inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
if (player != null) {
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
if (player != null) {
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
}
}
}
}
@@ -124,36 +151,18 @@ public final class AlchemyPotionBrewer {
}
}
public static boolean transferItems(InventoryView view, int fromSlot, int toSlot, ClickType click) {
boolean success = false;
if (click.isLeftClick()) {
success = transferItems(view, fromSlot, toSlot);
}
else if (click.isRightClick()) {
success = transferOneItem(view, fromSlot, toSlot);
}
return success;
}
private static boolean transferOneItem(InventoryView view, int fromSlot, int toSlot) {
ItemStack from = view.getItem(fromSlot).clone();
ItemStack to = view.getItem(toSlot).clone();
boolean emptyFrom = isEmpty(from);
if (emptyFrom) {
if (isEmpty(from)) {
return false;
}
boolean emptyTo = isEmpty(to);
int fromAmount = from.getAmount();
if (!emptyTo && fromAmount >= from.getType().getMaxStackSize()) {
else if (!isEmpty(to) && from.getAmount() >= from.getType().getMaxStackSize()) {
return false;
}
else if (emptyTo || from.isSimilar(to)) {
if (emptyTo) {
else if (isEmpty(to) || from.isSimilar(to)) {
if (isEmpty(to)) {
to = from.clone();
to.setAmount(1);
}
@@ -161,9 +170,9 @@ public final class AlchemyPotionBrewer {
to.setAmount(to.getAmount() + 1);
}
from.setAmount(fromAmount - 1);
view.setItem(toSlot, emptyTo ? null : to);
view.setItem(fromSlot, emptyFrom ? null : from);
from.setAmount(from.getAmount() - 1);
view.setItem(toSlot, isEmpty(to) ? null : to);
view.setItem(fromSlot, isEmpty(from) ? null : from);
return true;
}
@@ -175,50 +184,166 @@ public final class AlchemyPotionBrewer {
* Transfer items between two ItemStacks, returning the leftover status
*/
private static boolean transferItems(InventoryView view, int fromSlot, int toSlot) {
ItemStack from = view.getItem(fromSlot).clone();
ItemStack to = view.getItem(toSlot).clone();
if (isEmpty(from)) {
if (isEmpty(view.getItem(fromSlot))) {
return false;
}
else if (isEmpty(to)) {
view.setItem(toSlot, from);
else if (isEmpty(view.getItem(toSlot))) {
view.setItem(toSlot, view.getItem(fromSlot).clone());
view.setItem(fromSlot, null);
return true;
}
else if (from.isSimilar(to)) {
int fromAmount = from.getAmount();
int toAmount = to.getAmount();
int maxSize = to.getType().getMaxStackSize();
else if (view.getItem(fromSlot).isSimilar(view.getItem(toSlot))) {
if (view.getItem(fromSlot).getAmount() + view.getItem(toSlot).getAmount() > view.getItem(toSlot).getType().getMaxStackSize()) {
int left = view.getItem(fromSlot).getAmount() + view.getItem(toSlot).getAmount() - view.getItem(toSlot).getType().getMaxStackSize();
if (fromAmount + toAmount > maxSize) {
int left = fromAmount + toAmount - maxSize;
to.setAmount(maxSize);
ItemStack to = new ItemStack(view.getItem(toSlot));
to.setAmount(to.getType().getMaxStackSize());
view.setItem(toSlot, to);
ItemStack from = new ItemStack(view.getItem(fromSlot));
from.setAmount(left);
view.setItem(fromSlot, from);
return true;
}
to.setAmount(fromAmount + toAmount);
ItemStack to = new ItemStack(view.getItem(toSlot));
to.setAmount(view.getItem(fromSlot).getAmount() + view.getItem(toSlot).getAmount());
view.setItem(fromSlot, null);
view.setItem(toSlot, to);
return true;
}
return false;
}
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
public static void handleInventoryClick(InventoryClickEvent event) {
Player player = event.getWhoClicked() instanceof Player ? (Player) event.getWhoClicked() : null;
BrewingStand brewingStand = (BrewingStand) event.getInventory().getHolder();
ItemStack cursor = event.getCursor();
ItemStack clicked = event.getCurrentItem();
if (clicked != null && clicked.getType() == Material.POTION) {
scheduleCheck(player, brewingStand);
return;
}
if (event.isShiftClick()) {
if (event.getSlotType() == SlotType.FUEL) {
scheduleCheck(player, brewingStand);
return;
}
else if (event.getSlotType() == SlotType.CONTAINER || event.getSlotType() == SlotType.QUICKBAR) {
if (isValidIngredient(player, clicked)) {
if (event.isLeftClick()) {
transferItems(event.getView(), event.getRawSlot(), INGREDIENT_SLOT);
}
else if (event.isRightClick()) {
transferOneItem(event.getView(), event.getRawSlot(), INGREDIENT_SLOT);
}
event.setCancelled(true);
scheduleUpdate(brewingStand.getInventory());
scheduleCheck(player, brewingStand);
return;
}
}
}
else if (event.getRawSlot() == INGREDIENT_SLOT) {
if (isEmpty(cursor) && isEmpty(clicked)) {
return;
}
else if (isEmpty(cursor)) {
scheduleCheck(player, brewingStand);
return;
}
else if (isEmpty(clicked)) {
if (isValidIngredient(player, event.getCursor())) {
if (event.getClick() == ClickType.LEFT || (event.getClick() == ClickType.RIGHT && event.getCursor().getAmount() == 1)) {
event.setCancelled(true);
event.setCurrentItem(event.getCursor().clone());
event.setCursor(null);
scheduleUpdate(brewingStand.getInventory());
scheduleCheck(player, brewingStand);
return;
}
else if (event.getClick() == ClickType.RIGHT) {
event.setCancelled(true);
ItemStack one = event.getCursor().clone();
one.setAmount(1);
ItemStack rest = event.getCursor().clone();
rest.setAmount(event.getCursor().getAmount() - 1);
event.setCurrentItem(one);
event.setCursor(rest);
scheduleUpdate(brewingStand.getInventory());
scheduleCheck(player, brewingStand);
return;
}
}
return;
}
}
}
public static void handleInventoryDrag(InventoryDragEvent event) {
Player player = event.getWhoClicked() instanceof Player ? (Player) event.getWhoClicked() : null;
BrewingStand brewingStand = (BrewingStand) event.getInventory().getHolder();
ItemStack cursor = event.getCursor();
ItemStack ingredient = brewingStand.getInventory().getIngredient();
if (!event.getInventorySlots().contains(INGREDIENT_SLOT)) {
return;
}
if (isEmpty(ingredient) || ingredient.isSimilar(cursor)) {
if (isValidIngredient(player, cursor)) {
// Not handled: dragging custom ingredients over ingredient slot (does not trigger any event)
scheduleCheck(player, brewingStand);
return;
}
else {
event.setCancelled(true);
scheduleUpdate(brewingStand.getInventory());
return;
}
}
}
public static void handleInventoryMoveItem(InventoryMoveItemEvent event) {
Player player = null;
BrewingStand brewingStand = (BrewingStand) event.getDestination().getHolder();
if (isValidIngredient(player, event.getItem())) {
scheduleCheck(player, brewingStand);
return;
}
}
private static void scheduleCheck(Player player, BrewingStand brewingStand) {
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
}
public static void scheduleUpdate(Inventory inventory) {
private static void scheduleUpdate(Inventory inventory) {
for (HumanEntity humanEntity : inventory.getViewers()) {
if (humanEntity instanceof Player) {
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);

View File

@@ -5,11 +5,11 @@ import java.util.List;
import org.bukkit.block.BlockState;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.util.ModUtils;
public class Excavation {
/**
@@ -52,8 +52,8 @@ public class Excavation {
protected static int getBlockXP(BlockState blockState) {
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
if (xp == 0 && ModUtils.isCustomExcavationBlock(blockState)) {
xp = ModUtils.getCustomBlock(blockState).getXpGain();
}
return xp;

View File

@@ -32,6 +32,7 @@ import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -135,8 +136,8 @@ public class HerbalismManager extends SkillManager {
int xp;
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) {
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
if (ModUtils.isCustomHerbalismBlock(blockState)) {
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
xp = customBlock.getXpGain();
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {

View File

@@ -4,11 +4,11 @@ import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
public class Mining {
@@ -21,8 +21,8 @@ public class Mining {
Material blockType = blockState.getType();
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockType != Material.GLOWING_REDSTONE_ORE ? blockType : Material.REDSTONE_ORE);
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
if (xp == 0 && ModUtils.isCustomMiningBlock(blockState)) {
xp = ModUtils.getCustomBlock(blockState).getXpGain();
}
return xp;
@@ -65,7 +65,7 @@ public class Mining {
return;
default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
if (ModUtils.isCustomMiningBlock(blockState)) {
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
}
return;
@@ -104,7 +104,7 @@ public class Mining {
return;
default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
if (ModUtils.isCustomMiningBlock(blockState)) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
}
return;

View File

@@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.mining.BlastMining.Tier;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -69,7 +70,7 @@ public class MiningManager extends SkillManager {
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
}
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
if ((ModUtils.isCustomMiningBlock(blockState) && !ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
return;
}

View File

@@ -48,18 +48,6 @@ public class Repair {
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) {
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
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.StringUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.spout.SpoutUtils;
public class RepairManager extends SkillManager {
private boolean placedRepairAnvil;
@@ -52,12 +51,7 @@ public class RepairManager extends SkillManager {
}
if (Repair.anvilMessagesEnabled) {
if (mcMMOPlayer.isSpoutPlayer()) {
SpoutUtils.sendRepairNotifications(player, anvilType);
}
else {
player.sendMessage(Repair.getAnvilMessage(anvilType));
}
player.sendMessage(Repair.getAnvilMessage(anvilType));
}
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {

View File

@@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables;

View File

@@ -4,10 +4,10 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.util.ModUtils;
public class Smelting {
// The order of the values is extremely important, a few methods depend on it to work properly
@@ -50,6 +50,6 @@ public class Smelting {
MaterialData data = smelting.getData();
Material resourceType = smelting.getType();
return mcMMO.getModManager().isCustomOre(data) ? mcMMO.getModManager().getBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE);
return ModUtils.isCustomOre(data) ? ModUtils.getCustomBlock(data).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(SkillType.SMELTING, resourceType != Material.GLOWING_REDSTONE_ORE ? resourceType : Material.REDSTONE_ORE);
}
}

View File

@@ -16,6 +16,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public final class Woodcutting {
@@ -51,8 +52,8 @@ public final class Woodcutting {
break;
}
if (mcMMO.getModManager().isCustomLog(blockState)) {
return mcMMO.getModManager().getBlock(blockState).getXpGain();
if (ModUtils.isCustomLogBlock(blockState)) {
return ModUtils.getCustomBlock(blockState).getXpGain();
}
switch (((Tree) blockState.getData()).getSpecies()) {
@@ -85,7 +86,7 @@ public final class Woodcutting {
* @param blockState Block being broken
*/
protected static void checkForDoubleDrop(BlockState blockState) {
if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) {
if (ModUtils.isCustomLogBlock(blockState) && ModUtils.getCustomBlock(blockState).isDoubleDropEnabled()) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
}
else {

View File

@@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Tree;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
@@ -23,6 +22,7 @@ import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -126,18 +126,18 @@ public class WoodcuttingManager extends SkillManager {
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
Misc.dropItems(blockState.getLocation(), block.getDrops());
}
else if (mcMMO.getModManager().isCustomLog(blockState)) {
else if (ModUtils.isCustomLogBlock(blockState)) {
if (canGetDoubleDrops()) {
Woodcutting.checkForDoubleDrop(blockState);
}
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
xp = customBlock.getXpGain();
Misc.dropItems(blockState.getLocation(), block.getDrops());
}
else if (mcMMO.getModManager().isCustomLeaf(blockState)) {
Misc.dropItems(blockState.getLocation(), block.getDrops());
else if (ModUtils.isCustomLeafBlock(blockState)) {
Misc.randomDropItems(blockState.getLocation(), block.getDrops(), 10.0);
}
else {
Tree tree = (Tree) blockState.getData();

View File

@@ -12,7 +12,6 @@ import org.bukkit.material.Crops;
import org.bukkit.material.NetherWarts;
import org.bukkit.material.SmoothBrick;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.Repair;
public final class BlockUtils {
@@ -65,7 +64,7 @@ public final class BlockUtils {
return false;
default:
return !isMcMMOAnvil(blockState) && !mcMMO.getModManager().isCustomAbilityBlock(blockState);
return !isMcMMOAnvil(blockState) && !ModUtils.isCustomAbilityBlock(blockState);
}
}
@@ -136,7 +135,7 @@ public final class BlockUtils {
return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;
default:
return mcMMO.getModManager().isCustomHerbalismBlock(blockState);
return ModUtils.isCustomHerbalismBlock(blockState);
}
}
@@ -158,7 +157,7 @@ public final class BlockUtils {
return true;
default:
return isOre(blockState) || mcMMO.getModManager().isCustomMiningBlock(blockState);
return isOre(blockState) || ModUtils.isCustomMiningBlock(blockState);
}
}
@@ -182,7 +181,7 @@ public final class BlockUtils {
return true;
default:
return mcMMO.getModManager().isCustomExcavationBlock(blockState);
return ModUtils.isCustomExcavationBlock(blockState);
}
}
@@ -200,7 +199,7 @@ public final class BlockUtils {
return true;
default:
return mcMMO.getModManager().isCustomLog(blockState);
return ModUtils.isCustomLogBlock(blockState);
}
}
@@ -216,7 +215,7 @@ public final class BlockUtils {
return true;
default:
return mcMMO.getModManager().isCustomLeaf(blockState);
return ModUtils.isCustomLeafBlock(blockState);
}
}

View File

@@ -10,9 +10,10 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.Dye;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.SpoutToolsAPI;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.config.party.ItemWeightConfig;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.locale.LocaleLoader;
public final class ItemUtils {
@@ -32,7 +33,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomBow(type);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomBow(type));
}
}
@@ -54,7 +55,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomSword(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.SWORD);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomSword(type));
}
}
@@ -76,7 +77,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomHoe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.HOE);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomHoe(type));
}
}
@@ -98,7 +99,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomShovel(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.SHOVEL);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomShovel(type));
}
}
@@ -120,7 +121,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomAxe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.AXE);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomAxe(type));
}
}
@@ -142,7 +143,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomPickaxe(type) || SpoutToolsAPI.isSpoutTool(item, ToolType.PICKAXE);
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().isCustomPickaxe(type));
}
}
@@ -164,7 +165,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomHelmet(type);
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomHelmet(type);
}
}
@@ -186,7 +187,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomChestplate(type);
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomChestplate(type);
}
}
@@ -208,7 +209,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomLeggings(type);
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomLeggings(type);
}
}
@@ -230,7 +231,7 @@ public final class ItemUtils {
return true;
default:
return mcMMO.getModManager().isCustomBoots(type);
return Config.getInstance().getArmorModsEnabled() && CustomArmorConfig.getInstance().isCustomBoots(type);
}
}

View File

@@ -2,8 +2,6 @@ package com.gmail.nossr50.util;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
public final class MaterialUtils {
private MaterialUtils() {}
@@ -21,7 +19,7 @@ public final class MaterialUtils {
return true;
default:
return mcMMO.getModManager().isCustomOre(data);
return ModUtils.isCustomOre(data);
}
}
}

View File

@@ -13,10 +13,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.spout.huds.McMMOHud;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.spout.SpoutUtils;
public final class Misc {
private static Random random = new Random();
@@ -151,20 +149,12 @@ public final class Misc {
}
public static void profileCleanup(String playerName) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
McMMOHud spoutHud = UserManager.getPlayer(player).getSpoutHud();
UserManager.remove(playerName);
if (spoutHud != null) {
spoutHud.removeWidgets();
}
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
if (player != null) {
UserManager.remove(player);
UserManager.addUser(player);
if (mcMMO.isSpoutEnabled()) {
SpoutUtils.reloadSpoutPlayer(player);
}
}
}

View File

@@ -167,7 +167,7 @@ public final class MobHealthbarUtils {
return true;
default:
return false;
return ModUtils.isCustomBossEntity(livingEntity);
}
}
}

View File

@@ -1,284 +0,0 @@
package com.gmail.nossr50.util;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.mods.CustomEntity;
import com.gmail.nossr50.datatypes.mods.CustomTool;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
public class ModManager {
private List<Repairable> repairables = new ArrayList<Repairable>();
// Armor Mods
private List<Material> customBoots = new ArrayList<Material>();
private List<Material> customChestplates = new ArrayList<Material>();
private List<Material> customHelmets = new ArrayList<Material>();
private List<Material> customLeggings = new ArrayList<Material>();
// Block Mods
private List<MaterialData> customExcavationBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customHerbalismBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customMiningBlocks = new ArrayList<MaterialData>();
private List<MaterialData> customOres = new ArrayList<MaterialData>();
private List<MaterialData> customLogs = new ArrayList<MaterialData>();
private List<MaterialData> customLeaves = new ArrayList<MaterialData>();
private List<MaterialData> customAbilityBlocks = new ArrayList<MaterialData>();
private HashMap<MaterialData, CustomBlock> customBlockMap = new HashMap<MaterialData, CustomBlock>();
// Entity Mods
private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
// Tool Mods
private List<Material> customAxes = new ArrayList<Material>();
private List<Material> customBows = new ArrayList<Material>();
private List<Material> customHoes = new ArrayList<Material>();
private List<Material> customPickaxes = new ArrayList<Material>();
private List<Material> customShovels = new ArrayList<Material>();
private List<Material> customSwords = new ArrayList<Material>();
private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
public void registerCustomArmor(CustomArmorConfig config) {
customBoots.addAll(config.customBoots);
customChestplates.addAll(config.customChestplates);
customHelmets.addAll(config.customHelmets);
customLeggings.addAll(config.customLeggings);
repairables.addAll(config.repairables);
}
public void registerCustomBlocks(CustomBlockConfig config) {
customExcavationBlocks.addAll(config.customExcavationBlocks);
customHerbalismBlocks.addAll(config.customHerbalismBlocks);
customMiningBlocks.addAll(config.customMiningBlocks);
customOres.addAll(config.customOres);
customLogs.addAll(config.customLogs);
customLeaves.addAll(config.customLeaves);
customAbilityBlocks.addAll(config.customAbilityBlocks);
customBlockMap.putAll(config.customBlockMap);
}
public void registerCustomEntities(CustomEntityConfig config) {
customEntityClassMap.putAll(config.customEntityClassMap);
customEntityTypeMap.putAll(config.customEntityTypeMap);
}
public void registerCustomTools(CustomToolConfig config) {
customAxes.addAll(config.customAxes);
customBows.addAll(config.customBows);
customHoes.addAll(config.customHoes);
customPickaxes.addAll(config.customPickaxes);
customShovels.addAll(config.customShovels);
customSwords.addAll(config.customSwords);
customToolMap.putAll(config.customToolMap);
repairables.addAll(config.repairables);
}
public boolean isCustomBoots(Material material) {
return Config.getInstance().getArmorModsEnabled() && customBoots.contains(material);
}
public boolean isCustomChestplate(Material material) {
return Config.getInstance().getArmorModsEnabled() && customChestplates.contains(material);
}
public boolean isCustomHelmet(Material material) {
return Config.getInstance().getArmorModsEnabled() && customHelmets.contains(material);
}
public boolean isCustomLeggings(Material material) {
return Config.getInstance().getArmorModsEnabled() && customLeggings.contains(material);
}
public boolean isCustomAxe(Material material) {
return Config.getInstance().getToolModsEnabled() && customAxes.contains(material);
}
public boolean isCustomBow(Material material) {
return Config.getInstance().getToolModsEnabled() && customBows.contains(material);
}
public boolean isCustomHoe(Material material) {
return Config.getInstance().getToolModsEnabled() && customHoes.contains(material);
}
public boolean isCustomPickaxe(Material material) {
return Config.getInstance().getToolModsEnabled() && customPickaxes.contains(material);
}
public boolean isCustomShovel(Material material) {
return Config.getInstance().getToolModsEnabled() && customShovels.contains(material);
}
public boolean isCustomSword(Material material) {
return Config.getInstance().getToolModsEnabled() && customSwords.contains(material);
}
public boolean isCustomOre(MaterialData data) {
return Config.getInstance().getBlockModsEnabled() && customOres.contains(data);
}
public boolean isCustomLog(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customLogs.contains(state.getData());
}
public boolean isCustomLeaf(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customLeaves.contains(state.getData());
}
public boolean isCustomAbilityBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customAbilityBlocks.contains(state.getData());
}
public boolean isCustomExcavationBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customExcavationBlocks.contains(state.getData());
}
public boolean isCustomHerbalismBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getData());
}
public boolean isCustomMiningBlock(BlockState state) {
return Config.getInstance().getBlockModsEnabled() && customMiningBlocks.contains(state.getData());
}
public CustomBlock getBlock(BlockState state) {
return customBlockMap.get(state.getData());
}
public CustomBlock getBlock(MaterialData data) {
return customBlockMap.get(data);
}
/**
* Checks to see if an item is a custom tool.
*
* @param item Item to check
* @return true if the item is a custom tool, false otherwise
*/
public boolean isCustomTool(ItemStack item) {
return Config.getInstance().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
}
/**
* Get the custom tool associated with an item.
*
* @param item The item to check
* @return the tool if it exists, null otherwise
*/
public CustomTool getTool(ItemStack item) {
return item == null ? null : customToolMap.get(item.getType());
}
public List<Repairable> getLoadedRepairables() {
return repairables;
}
public boolean isCustomEntity(Entity entity) {
if (!Config.getInstance().getEntityModsEnabled()) {
return false;
}
if (customEntityTypeMap.containsKey(entity.getType().toString())) {
return true;
}
try {
return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
return customEntityClassMap.containsKey(entity.getClass().getName());
}
e.printStackTrace();
return false;
}
}
public CustomEntity getEntity(Entity entity) {
CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
if (customEntity == null) {
try {
customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
customEntity = customEntityClassMap.get(entity.getClass().getName());
}
else {
e.printStackTrace();
}
}
}
return customEntity;
}
public void addCustomEntity(Entity entity) {
if (!Config.getInstance().getEntityModsEnabled()) {
return;
}
File entityFile = new File(mcMMO.p.getDataFolder(), "mods" + File.separator + "entities.default.yml");
YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
String entityName = entity.getType().toString();
String sanitizedEntityName = entityName.replace(".", "_");
if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
return;
}
entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
entitiesFile.set(sanitizedEntityName + ".Tameable", false);
entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
String className = "";
try {
className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
className = entity.getClass().getName();
}
else {
e.printStackTrace();
}
}
CustomEntity customEntity = new CustomEntity(1.0D, false, 0, false, null, 0);
customEntityTypeMap.put(entityName, customEntity);
customEntityClassMap.put(className, customEntity);
try {
entitiesFile.save(entityFile);
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
}
catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,213 @@
package com.gmail.nossr50.util;
import java.io.File;
import org.bukkit.block.BlockState;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomBlockConfig;
import com.gmail.nossr50.config.mods.CustomEntityConfig;
import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.mods.CustomEntity;
import com.gmail.nossr50.datatypes.mods.CustomTool;
public final class ModUtils {
private static boolean customToolsEnabled = Config.getInstance().getToolModsEnabled();
private static boolean customBlocksEnabled = Config.getInstance().getBlockModsEnabled();
private static boolean customEntitiesEnabled = Config.getInstance().getEntityModsEnabled();
private ModUtils() {}
/**
* Get the custom tool associated with an item.
*
* @param item The item to check
* @return the tool if it exists, null otherwise
*/
public static CustomTool getToolFromItemStack(ItemStack item) {
return CustomToolConfig.getInstance().getCustomTool(item.getType());
}
/**
* Get the custom entity associated with an entity.
*
* @param entity The entity to check
* @return the entity is if exists, null otherwise
*/
public static CustomEntity getCustomEntity(Entity entity) {
return CustomEntityConfig.getInstance().getCustomEntity(entity);
}
/**
* Get the custom block associated with an block.
*
* @param blockState The BlockState of the bloc to check
* @return the block if it exists, null otherwise
*/
public static CustomBlock getCustomBlock(BlockState blockState) {
return CustomBlockConfig.getInstance().getCustomBlock(blockState.getData());
}
public static CustomBlock getCustomBlock(MaterialData data) {
return CustomBlockConfig.getInstance().getCustomBlock(data);
}
/**
* Check if a custom block is a woodcutting block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom woodcutting block, false otherwise
*/
public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomWoodcuttingBlock(blockState.getData());
}
/**
* Check if a custom block should not activate abilites.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents an ability block, false otherwise
*/
public static boolean isCustomAbilityBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomAbilityBlock(blockState.getData());
}
/**
* Check if a custom block is a mining block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom mining block, false otherwise
*/
public static boolean isCustomMiningBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomMiningBlock(blockState.getData());
}
/**
* Check if a custom block is an excavation block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom excavation block, false otherwise
*/
public static boolean isCustomExcavationBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomExcavationBlock(blockState.getData());
}
/**
* Check if a custom block is an herbalism block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a custom herbalism block, false otherwise
*/
public static boolean isCustomHerbalismBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomHerbalismBlock(blockState.getData());
}
/**
* Check if a custom block is a leaf block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents leaves, false otherwise
*/
public static boolean isCustomLeafBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomLeaf(blockState.getData());
}
/**
* Check if a custom block is a log block.
*
* @param blockState The BlockState of the block to check
* @return true if the block represents a log, false otherwise
*/
public static boolean isCustomLogBlock(BlockState blockState) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomLog(blockState.getData());
}
public static boolean isCustomOre(MaterialData data) {
return customBlocksEnabled && CustomBlockConfig.getInstance().isCustomOre(data);
}
/**
* Checks to see if an item is a custom tool.
*
* @param item Item to check
* @return true if the item is a custom tool, false otherwise
*/
public static boolean isCustomTool(ItemStack item) {
return customToolsEnabled && CustomToolConfig.getInstance().isCustomTool(item.getType());
}
/**
* Checks to see if an entity is a custom entity.
*
* @param entity Entity to check
* @return true if the entity is a custom entity, false otherwise
*/
public static boolean isCustomEntity(Entity entity) {
return customEntitiesEnabled && CustomEntityConfig.getInstance().isCustomEntity(entity);
}
/**
* Check if a custom entity is a boss.
*
* @param entity The entity to check
* @return true if the entity represents a boss, false otherwise
*/
public static boolean isCustomBossEntity(Entity entity) {
//TODO: Finish this method
return false;
}
public static void addCustomEntity(Entity entity) {
if (!customEntitiesEnabled) {
return;
}
File entityFile = CustomEntityConfig.getInstance().getFile();
YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
String entityName = entity.getType().toString();
String sanitizedEntityName = entityName.replace(".", "_");
if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
return;
}
entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
entitiesFile.set(sanitizedEntityName + ".Tameable", false);
entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
String className = "";
try {
className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
}
catch (Exception e) {
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
className = entity.getClass().getName();
}
else {
e.printStackTrace();
}
}
CustomEntityConfig.getInstance().addEntity(new CustomEntity(1.0D, false, 0, false, null, 0), className, entityName);
try {
entitiesFile.save(entityFile);
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
}
catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -20,6 +20,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
public class HashChunkManager implements ChunkManager {
private static final int FILE_VERSION = 1;
private HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>();
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
@@ -120,7 +121,21 @@ public class HashChunkManager implements ChunkManager {
McMMOSimpleRegionFile regionFile = worldRegions.get(key2);
if (regionFile == null) {
File file = new File(directory, "mcmmo_" + rx + "_" + rz + "_.mcm");
// Pre-Versioned files in negative chunks were being saved/tracked with incorrect chunk numbers
int xLegacy = (x < -1) ? (x + 1) >> 5 : rx;
int zLegacy = (z < -1) ? (z + 1) >> 5 : rz;
File legacy = new File(directory, "mcmmo_" + xLegacy + "_" + zLegacy + "_.mcm");
File file = new File(directory, "mcmmo_" + rx + "_" + rz + "_.v" + FILE_VERSION + ".mcm");
// If the legacy file exists, rename it and the loading will convert it properly
if (legacy.isFile()) {
// The center 4 chunks are unusable so we don't preserve them
if (!((rx == 0 || rx == -1) && (rz == 0 || rz == -1))) {
if (!legacy.renameTo(file)) {
mcMMO.p.debug(String.format("Lost Legacy ChunkStore for %d %d", rx, rz));
}
}
legacy.delete();
}
regionFile = new McMMOSimpleRegionFile(file, rx, rz);
worldRegions.put(key2, regionFile);
}
@@ -293,8 +308,8 @@ public class HashChunkManager implements ChunkManager {
return false;
}
int cx = x / 16;
int cz = z / 16;
int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
String key = world.getName() + "," + cx + "," + cz;
if (!store.containsKey(key)) {
@@ -336,8 +351,8 @@ public class HashChunkManager implements ChunkManager {
return;
}
int cx = x / 16;
int cz = z / 16;
int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
int ix = Math.abs(x) % 16;
int iz = Math.abs(z) % 16;
@@ -382,8 +397,8 @@ public class HashChunkManager implements ChunkManager {
return;
}
int cx = x / 16;
int cz = z / 16;
int cx = (x < 0 ? x - 16 : x) >> 4 << 4;
int cz = (z < 0 ? z - 16 : z) >> 4 << 4;
int ix = Math.abs(x) % 16;
int iz = Math.abs(z) % 16;

View File

@@ -15,7 +15,7 @@ public class PrimitiveChunkStore implements ChunkStore {
transient private boolean dirty = false;
/** X, Z, Y */
public boolean[][][] store;
private static final int CURRENT_VERSION = 7;
private static final int CURRENT_VERSION = 8;
private static final int MAGIC_NUMBER = 0xEA5EDEBB;
private int cx;
private int cz;
@@ -132,6 +132,16 @@ public class PrimitiveChunkStore implements ChunkStore {
fixArray();
dirty = true;
}
if (fileVersionNumber == 7 && cx < 0) {
cx--;
dirty = true;
}
if (fileVersionNumber == 7 && cz < 0) {
cz--;
dirty = true;
}
}
private void fixArray() {

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.UnarmedCommand;
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.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
@@ -328,26 +326,6 @@ public final class CommandRegistrationManager {
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() {
PluginCommand command = mcMMO.p.getCommand("party");
command.setDescription(LocaleLoader.getString("Commands.Description.party"));
@@ -471,9 +449,5 @@ public final class CommandRegistrationManager {
// Skill Commands
registerSkillCommands();
// Spout Commands
registerXplockCommand();
registerMchudCommand();
}
}

View File

@@ -191,10 +191,10 @@ public final class CommandUtils {
public static String displaySkill(PlayerProfile profile, SkillType skill) {
if (skill.isChildSkill()) {
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill));
}
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
}
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<SkillType> skillGroup) {

View File

@@ -1,19 +1,18 @@
package com.gmail.nossr50.util.player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
public final class UserManager {
private final static Map<String, McMMOPlayer> players = new HashMap<String, McMMOPlayer>();
private UserManager() {}
@@ -24,8 +23,16 @@ public final class UserManager {
* @return the player's {@link McMMOPlayer} object
*/
public static McMMOPlayer addUser(Player player) {
McMMOPlayer mcMMOPlayer = new McMMOPlayer(player);
player.setMetadata(mcMMO.playerDataKey, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
String playerName = player.getName();
McMMOPlayer mcMMOPlayer = players.get(playerName);
if (mcMMOPlayer != null) {
mcMMOPlayer.setPlayer(player); // The player object is different on each reconnection and must be updated
}
else {
mcMMOPlayer = new McMMOPlayer(player);
players.put(playerName, mcMMOPlayer);
}
return mcMMOPlayer;
}
@@ -33,51 +40,35 @@ public final class UserManager {
/**
* Remove a user.
*
* @param player The Player object
* @param playerName The name of the player to remove
*/
public static void remove(Player player) {
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
public static void remove(String playerName) {
players.remove(playerName);
}
/**
* Clear all users.
*/
public static void clearAll() {
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
remove(player);
}
players.clear();
}
/**
* Save all users.
*/
public static void saveAll() {
Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers();
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.length + ")");
for (Player player : onlinePlayers) {
getPlayer(player).getProfile().save();
mcMMO.p.debug("Saving mcMMOPlayers... (" + players.size() + ")");
for (McMMOPlayer mcMMOPlayer : players.values()) {
mcMMOPlayer.getProfile().save();
}
}
public static Set<String> getPlayerNames() {
Set<String> playerNames = new HashSet<String>();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
playerNames.add(player.getName());
}
return playerNames;
return players.keySet();
}
public static Collection<McMMOPlayer> getPlayers() {
Collection<McMMOPlayer> playerCollection = new ArrayList<McMMOPlayer>();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
playerCollection.add(getPlayer(player));
}
return playerCollection;
return players.values();
}
/**
@@ -97,16 +88,10 @@ public final class UserManager {
* @return the player's McMMOPlayer object
*/
public static McMMOPlayer getPlayer(OfflinePlayer player) {
if (player instanceof Player) {
return getPlayer((Player) player);
}
return retrieveMcMMOPlayer(player.getName(), false);
}
public static McMMOPlayer getPlayer(OfflinePlayer player, boolean offlineValid) {
if (player instanceof Player) {
return getPlayer((Player) player);
}
return retrieveMcMMOPlayer(player.getName(), offlineValid);
}
@@ -114,29 +99,24 @@ public final class UserManager {
return retrieveMcMMOPlayer(playerName, offlineValid);
}
public static McMMOPlayer getPlayer(Player player) {
return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
}
private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
McMMOPlayer mcMMOPlayer = players.get(playerName);
if (player == null) {
if (!offlineValid) {
mcMMO.p.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
if (mcMMOPlayer == null) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
if (player == null) {
if (!offlineValid) {
mcMMO.p.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
}
return null;
}
return null;
mcMMOPlayer = new McMMOPlayer(player);
players.put(playerName, mcMMOPlayer);
}
return getPlayer(player);
}
public static boolean hasPlayerDataKey(Entity entity) {
if (entity == null) {
return false;
}
return entity.hasMetadata(mcMMO.playerDataKey);
return mcMMOPlayer;
}
}

View File

@@ -39,6 +39,7 @@ import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
@@ -420,8 +421,8 @@ public final class CombatUtils {
}
}
else {
if (mcMMO.getModManager().isCustomEntity(target)) {
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
if (ModUtils.isCustomEntity(target)) {
baseXP = ModUtils.getCustomEntity(target).getXpMultiplier();
}
else if (target instanceof Animals) {
baseXP = ExperienceConfig.getInstance().getAnimalsXP();
@@ -472,7 +473,7 @@ public final class CombatUtils {
default:
baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target);
ModUtils.addCustomEntity(target);
break;
}
}
@@ -608,8 +609,8 @@ public final class CombatUtils {
else if (ItemUtils.isDiamondTool(inHand)) {
tier = 4;
}
else if (mcMMO.getModManager().isCustomTool(inHand)) {
tier = mcMMO.getModManager().getTool(inHand).getTier();
else if (ModUtils.isCustomTool(inHand)) {
tier = ModUtils.getToolFromItemStack(inHand).getTier();
}
return tier;

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

@@ -523,7 +523,7 @@ Commands.Party.Alliance.Invite.0=[[RED]]ALERT: [[GREEN]]You have received a part
Commands.Party.Alliance.Invite.1=[[YELLOW]]Type [[GREEN]]/party alliance accept[[YELLOW]] to accept the invite
Commands.Party.Alliance.Invite.Accepted=[[GREEN]]Alliance invite Accepted.
Commands.Party.Alliance.None=[[RED]]Your does not have an ally.
Commands.Party.Alliance.AlreadyAllies=[[RED]]Your party already has an ally. Disband with [[DARK_AQUA]]/party alliance disband
Commands.Party.Alliance.AlreadyAllies=[[RED]]Your party already has an ally.
Commands.Party.Alliance.Help.0=[[RED]]This party hasn't formed an alliance. Invite a party leader
Commands.Party.Alliance.Help.1=[[RED]] to an alliance with [[DARK_AQUA]]/party alliance invite <player>[[RED]].
Commands.ptp.Enabled=Party teleporting [[GREEN]]enabled

View File

@@ -1,30 +1,24 @@
name: mcMMO
version: ${project.version}-b${BUILD_NUMBER}
description: >
mcMMO takes core Minecraft game mechanics and expands them to add an extensive
RPG experience, the goal of the project has always been a quality RPG
experience. Everything in mcMMO is carefully thought out and is constantly
improving. mcMMO adds eleven skills to train in and level in, while also
offering a high level of customization for server admins. There are countless
features, including custom sounds, graphical elements, and more added when
running mcMMO in conjunction with Spout. I carefully read feedback and
evaluate the mechanics of mcMMO in every update to provide an ever-evolving
experience.
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. 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.
author: nossr50
authors: [GJ, NuclearW, bm01, Glitchfinder, TfT_02, t00thpick1, Riking]
website: http://dev.bukkit.org/server-mods/mcmmo/
main: com.gmail.nossr50.mcMMO
softdepend: [Spout, CombatTag, HealthBar]
softdepend: [CombatTag, HealthBar]
load: STARTUP
commands:
mchud:
description: Change your HUD
xplock:
aliases: [mcxplock]
description: Lock your mcMMO XP bar
xprate:
aliases: [mcxprate]
description: Modify the xp rate or start an event
@@ -658,7 +652,6 @@ permissions:
mcmmo.commands.inspect: true
mcmmo.commands.mcability: true
mcmmo.commands.mccooldown: true
mcmmo.commands.mchud: true
mcmmo.commands.mcmmo.all: true
mcmmo.commands.mcnotify: true
mcmmo.commands.mcrank: true
@@ -675,7 +668,6 @@ permissions:
mcmmo.commands.taming: true
mcmmo.commands.unarmed: true
mcmmo.commands.woodcutting: true
mcmmo.commands.xplock.all: true
mcmmo.commands.defaultsop:
description: Implies all default op mcmmo.commands permissions.
children:
@@ -804,8 +796,6 @@ permissions:
description: Allows access to the mcgod command
mcmmo.commands.mcgod.others:
description: Allows access to the mcgod command for other players
mcmmo.commands.mchud:
description: Allows access to the mchud command
mcmmo.commands.mcmmo.*:
default: false
description: Implies access to all mcmmo.commands.mcmmo permissions
@@ -1161,56 +1151,6 @@ permissions:
description: Allows access to the vampirism command to toggle vampirism on/off
mcmmo.commands.woodcutting:
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.*:
default: false
description: Implies access to all mcmmo.commands.xprate permissions
@@ -1932,87 +1872,71 @@ permissions:
children:
mcmmo.ability.acrobatics.all: true
mcmmo.commands.acrobatics: true
<<<<<<< HEAD
mcmmo.skills.alchemy:
description: Allows access to the Alchemy skill
children:
mcmmo.ability.alchemy.all: true
mcmmo.commands.alchemy: true
=======
mcmmo.commands.xplock.acrobatics: true
>>>>>>> Revert "Dropped SpoutPlugin support"
mcmmo.skills.archery:
description: Allows access to the Archery skill
children:
mcmmo.ability.archery.all: true
mcmmo.commands.archery: true
mcmmo.commands.xplock.archery: true
mcmmo.skills.axes:
description: Allows access to the Axes skill
children:
mcmmo.ability.axes.all: true
mcmmo.commands.axes: true
mcmmo.commands.xplock.axes: true
mcmmo.skills.excavation:
description: Allows access to the Excavation skill
children:
mcmmo.ability.excavation.all: true
mcmmo.commands.excavation: true
mcmmo.commands.xplock.excavation: true
mcmmo.skills.fishing:
description: Allows access to the Fishing skill
children:
mcmmo.ability.fishing.all: true
mcmmo.commands.fishing: true
mcmmo.commands.xplock.fishing: true
mcmmo.skills.herbalism:
description: Allows access to the Herbalism skill
children:
mcmmo.ability.herbalism.all: true
mcmmo.commands.herbalism: true
mcmmo.commands.xplock.herbalism: true
mcmmo.skills.mining:
description: Allows access to the Mining skill
children:
mcmmo.ability.mining.all: true
mcmmo.commands.mining: true
mcmmo.commands.xplock.mining: true
mcmmo.skills.repair:
description: Allows access to the Repair skill
children:
mcmmo.ability.repair.all: true
mcmmo.commands.repair: true
mcmmo.commands.xplock.repair: true
mcmmo.skills.smelting:
description: Allows access to the Smelting skill
children:
mcmmo.ability.smelting.all: true
mcmmo.commands.smelting: true
mcmmo.commands.xplock.smelting: true
mcmmo.skills.swords:
description: Allows access to the Swords skill
children:
mcmmo.ability.swords.all: true
mcmmo.commands.swords: true
mcmmo.commands.xplock.swords: true
mcmmo.skills.taming:
description: Allows access to the Taming skill
children:
mcmmo.ability.taming.all: true
mcmmo.commands.taming: true
mcmmo.commands.xplock.taming: true
mcmmo.skills.unarmed:
description: Allows access to the Unarmed skill
children:
mcmmo.ability.unarmed.all: true
mcmmo.commands.unarmed: true
mcmmo.commands.xplock.unarmed: true
mcmmo.skills.woodcutting:
description: Allows access to the Woodcutting skill
children:
mcmmo.ability.woodcutting.all: true
mcmmo.commands.woodcutting: true
mcmmo.commands.xplock.woodcutting: true
mcmmo.tools.*:
default: false
description: Implies all mcmmo.tools permissions.

View File

@@ -66,7 +66,7 @@ Potions:
0: # Water Bottle
Children:
BLAZE_POWDER: 8192 # Mundane Potion
FERMENTED_SPIDER_EYE: 8200 # Potion of Weakness
FERMENTED_SPIDER_EYE: 4616 # Potion of Weakness
GHAST_TEAR: 8192 # Mundane Potion
GLOWSTONE_DUST: 32 # Thick Potion
MAGMA_CREAM: 8192 # Mundane Potion
@@ -79,70 +79,76 @@ Potions:
16: # Awkward Potion
Children:
APPLE: 5376 # Potion of Health Boost
BLAZE_POWDER: 8201 # Potion of Strength
BLAZE_POWDER: 1289 # Potion of Strength
BROWN_MUSHROOM: 2304 # Potion of Nausea
CARROT_ITEM: 768 # Potion of Haste
FERMENTED_SPIDER_EYE: 8200 # Potion of Weakness
GHAST_TEAR: 8193 # Potion of Regeneration
FERMENTED_SPIDER_EYE: 4616 # Potion of Weakness
GHAST_TEAR: 2561 # Potion of Regeneration
'GOLDEN_APPLE:0': 2816 # Potion of Resistance
GOLDEN_CARROT: 8198 # Potion of Night Vision
GOLDEN_CARROT: 4102 # Potion of Night Vision
'INK_SACK:0': 3840 # Potion of Blindness
'LONG_GRASS:2': 5888 # Potion of Saturation
MAGMA_CREAM: 8195 # Potion of Fire Resistance
MAGMA_CREAM: 3075 # Potion of Fire Resistance
POISONOUS_POTATO: 5120 # Potion of Decay
QUARTZ: 5632 # Potion of Absorption
RED_MUSHROOM: 2048 # Potion of Leaping
ROTTEN_FLESH: 4352 # Potion of Hunger
SLIME_BALL: 1024 # Potion of Dullness
SPECKLED_MELON: 8197 # Potion of Healing
SPIDER_EYE: 8196 # Potion of Poison
SUGAR: 8194 # Potion of Swiftness
WATER_LILY: 8205 # Potion of Water Breathing (Minecraft 1.6)
'RAW_FISH:3': 8205 # Potion of Water Breathing (Minecraft 1.7)
SPECKLED_MELON: 1541 # Potion of Healing
SPIDER_EYE: 4868 # Potion of Poison
SUGAR: 258 # Potion of Swiftness
WATER_LILY: 3341 # Potion of Water Breathing (Minecraft 1.6)
'RAW_FISH:3': 3341 # Potion of Water Breathing (Minecraft 1.7)
32: # Thick Potion
Children:
FERMENTED_SPIDER_EYE: 8200
FERMENTED_SPIDER_EYE: 4616
64: # Mundane Potion Extended
Children:
FERMENTED_SPIDER_EYE: 8264
FERMENTED_SPIDER_EYE: 4680
8192: # Mundane Potion
Children:
FERMENTED_SPIDER_EYE: 8200
FERMENTED_SPIDER_EYE: 4616
SULPHUR: 16384
### DRINKABLE POTIONS ######################################################
8194: # Potion of Swiftness
258: # Potion of Swiftness
Effects: ["SPEED 0 3600"]
Children:
FERMENTED_SPIDER_EYE: 8202
GLOWSTONE_DUST: 8226
REDSTONE: 8258
SULPHUR: 16386
8226: # Potion of Swiftness II
FERMENTED_SPIDER_EYE: 522
GLOWSTONE_DUST: 290
REDSTONE: 322
SULPHUR: 16642
290: # Potion of Swiftness II
Effects: ["SPEED 1 1800"]
Children:
FERMENTED_SPIDER_EYE: 8266
REDSTONE: 8258
SULPHUR: 16418
8258: # Potion of Swiftness Extended
FERMENTED_SPIDER_EYE: 586
REDSTONE: 322
SULPHUR: 16642
322: # Potion of Swiftness Extended
Effects: ["SPEED 0 9600"]
Children:
FERMENTED_SPIDER_EYE: 8202
GLOWSTONE_DUST: 8226
SULPHUR: 16450
FERMENTED_SPIDER_EYE: 522
GLOWSTONE_DUST: 290
SULPHUR: 16706
8202: # Potion of Slowness
522: # Potion of Slowness
Effects: ["SLOW 0 1800"]
Children:
REDSTONE: 8266
SULPHUR: 16394
8266: # Potion of Slowness Extended
REDSTONE: 586
SULPHUR: 16906
586: # Potion of Slowness Extended
Effects: ["SLOW 0 4800"]
Children:
GLOWSTONE_DUST: 8202
SULPHUR: 16458
GLOWSTONE_DUST: 522
SULPHUR: 16970
768: # Potion of Haste
Effects: ["FAST_DIGGING 0 3600"]
Effects: ["FAST_DIGGING 0 3600"]
Children:
GLOWSTONE_DUST: 800
REDSTONE: 832
@@ -155,7 +161,7 @@ Potions:
SULPHUR: 17184
832: # Potion of Haste Extended
Effects: ["FAST_DIGGING 0 9600"]
Effects: ["FAST_DIGGING 0 9600"]
Children:
GLOWSTONE_DUST: 800
SULPHUR: 17216
@@ -177,42 +183,49 @@ Potions:
GLOWSTONE_DUST: 1056
SULPHUR: 17472
8201: # Potion of Strength
1289: # Potion of Strength
Effects: ["INCREASE_DAMAGE 0 3600"]
Children:
FERMENTED_SPIDER_EYE: 8200
GLOWSTONE_DUST: 8233
REDSTONE: 8265
SULPHUR: 16393
8233: # Potion of Strength II
FERMENTED_SPIDER_EYE: 4616
GLOWSTONE_DUST: 1321
REDSTONE: 1353
SULPHUR: 17673
1321: # Potion of Strength II
Effects: ["INCREASE_DAMAGE 1 1800"]
Children:
FERMENTED_SPIDER_EYE: 8200
REDSTONE: 8265
SULPHUR: 16425
8265: # Potion of Strength Extended
FERMENTED_SPIDER_EYE: 4616
REDSTONE: 1353
SULPHUR: 17705
1353: # Potion of Strength Extended
Effects: ["INCREASE_DAMAGE 0 9600"]
Children:
FERMENTED_SPIDER_EYE: 8264
GLOWSTONE_DUST: 8233
SULPHUR: 16457
FERMENTED_SPIDER_EYE: 4680
GLOWSTONE_DUST: 1321
SULPHUR: 17737
8197: # Potion of Healing
1541: # Potion of Healing
Effects: ["HEAL 0"]
Children:
FERMENTED_SPIDER_EYE: 8204
GLOWSTONE_DUST: 8229
SULPHUR: 16389
8229: # Potion of Healing II
FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 1573
SULPHUR: 17925
1573: # Potion of Healing II
Effects: ["HEAL 1"]
Children:
FERMENTED_SPIDER_EYE: 8236
REDSTONE: 8197
SULPHUR: 16421
FERMENTED_SPIDER_EYE: 1836
REDSTONE: 1541
SULPHUR: 17957
8204: # Potion of Harming
1804: # Potion of Harming
Effects: ["HARM 0"]
Children:
GLOWSTONE_DUST: 8236
SULPHUR: 16396
8236: # Potion of Harming II
GLOWSTONE_DUST: 1836
SULPHUR: 18188
1836: # Potion of Harming II
Effects: ["HARM 1"]
Children:
REDSTONE: 8204
SULPHUR: 16428
REDSTONE: 1804
SULPHUR: 18220
2048: # Potion of Leaping
Effects: ["JUMP 0 3600"]
@@ -242,22 +255,25 @@ Potions:
GLOWSTONE_DUST: 2304
SULPHUR: 18752
8193: # Potion of Regeneration
2561: # Potion of Regeneration
Effects: ["REGENERATION 0 900"]
Children:
FERMENTED_SPIDER_EYE: 8200
GLOWSTONE_DUST: 8225
REDSTONE: 8257
SULPHUR: 16385
8225: # Potion of Regeneration II
FERMENTED_SPIDER_EYE: 4616
GLOWSTONE_DUST: 2593
REDSTONE: 2625
SULPHUR: 18945
2593: # Potion of Regeneration II
Effects: ["REGENERATION 1 450"]
Children:
FERMENTED_SPIDER_EYE: 8200
REDSTONE: 8257
SULPHUR: 16417
8257: # Potion of Regeneration Extended
FERMENTED_SPIDER_EYE: 4616
REDSTONE: 2625
SULPHUR: 18977
2625: # Potion of Regeneration Extended
Effects: ["REGENERATION 0 2400"]
Children:
FERMENTED_SPIDER_EYE: 8264
GLOWSTONE_DUST: 8225
SULPHUR: 16449
FERMENTED_SPIDER_EYE: 4680
GLOWSTONE_DUST: 2593
SULPHUR: 19009
2816: # Potion of Resistance
Effects: ["DAMAGE_RESISTANCE 0 450"]
@@ -276,34 +292,40 @@ Potions:
GLOWSTONE_DUST: 2848
SULPHUR: 19264
8195: # Potion of Fire Resistance
3075: # Potion of Fire Resistance
Effects: ["FIRE_RESISTANCE 0 3600"]
Children:
FERMENTED_SPIDER_EYE: 8202
REDSTONE: 8259
SULPHUR: 16387
8259: # Potion of Fire Resistance Extended
FERMENTED_SPIDER_EYE: 522
REDSTONE: 3139
SULPHUR: 19459
3139: # Potion of Fire Resistance Extended
Effects: ["FIRE_RESISTANCE 0 9600"]
Children:
FERMENTED_SPIDER_EYE: 8266
GLOWSTONE_DUST: 8195
SULPHUR: 16451
FERMENTED_SPIDER_EYE: 586
GLOWSTONE_DUST: 3075
SULPHUR: 19523
8205: # Potion of Water Breathing
3341: # Potion of Water Breathing
Effects: ["WATER_BREATHING 0 3600"]
Children:
REDSTONE: 8269
SULPHUR: 16397
8269: # Potion of Water Breathing Extended
REDSTONE: 3405
SULPHUR: 19725
3405: # Potion of Water Breathing Extended
Effects: ["WATER_BREATHING 0 9600"]
Children:
GLOWSTONE_DUST: 8205
SULPHUR: 16461
GLOWSTONE_DUST: 3341
SULPHUR: 19789
8206: # Potion of Invisibility
3598: # Potion of Invisibility
Effects: ["INVISIBILITY 0 3600"]
Children:
REDSTONE: 8270
SULPHUR: 16398
8270: # Potion of Invisibility Extended
REDSTONE: 3662
SULPHUR: 19982
3662: # Potion of Invisibility Extended
Effects: ["INVISIBILITY 0 9600"]
Children:
GLOWSTONE_DUST: 8206
SULPHUR: 16462
GLOWSTONE_DUST: 3598
SULPHUR: 20046
3840: # Potion of Blindness
Effects: ["BLINDNESS 0 225"]
@@ -316,16 +338,18 @@ Potions:
GLOWSTONE_DUST: 3840
SULPHUR: 20288
8198: # Potion of Night Vision
4102: # Potion of Night Vision
Effects: ["NIGHT_VISION 0 3600"]
Children:
FERMENTED_SPIDER_EYE: 8206
REDSTONE: 8262
SULPHUR: 16390
8262: # Potion of Night Vision Extended
FERMENTED_SPIDER_EYE: 3598
REDSTONE: 4166
SULPHUR: 20486
4166: # Potion of Night Vision Extended
Effects: ["NIGHT_VISION 0 9600"]
Children:
FERMENTED_SPIDER_EYE: 8270
GLOWSTONE_DUST: 8198
SULPHUR: 16454
FERMENTED_SPIDER_EYE: 3662
GLOWSTONE_DUST: 4102
SULPHUR: 20550
4352: # Potion of Hunger
Effects: ["HUNGER 0 900"]
@@ -344,31 +368,36 @@ Potions:
GLOWSTONE_DUST: 4384
SULPHUR: 20800
8200: # Potion of Weakness
4616: # Potion of Weakness
Effects: ["WEAKNESS 0 1800"]
Children:
REDSTONE: 8264
SULPHUR: 16392
8264: # Potion of Weakness Extended
REDSTONE: 4680
SULPHUR: 21000
4680: # Potion of Weakness Extended
Effects: ["WEAKNESS 0 4800"]
Children:
GLOWSTONE_DUST: 8200
SULPHUR: 16456
GLOWSTONE_DUST: 4616
SULPHUR: 21064
8196: # Potion of Poison
4868: # Potion of Poison
Effects: ["POISON 0 900"]
Children:
FERMENTED_SPIDER_EYE: 8204
GLOWSTONE_DUST: 8228
REDSTONE: 8260
SULPHUR: 16388
8228: # Potion of Poison II
FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 4900
REDSTONE: 4932
SULPHUR: 21252
4900: # Potion of Poison II
Effects: ["POISON 1 450"]
Children:
FERMENTED_SPIDER_EYE: 8236
REDSTONE: 8260
SULPHUR: 16452
8260: # Potion of Poison Extended
FERMENTED_SPIDER_EYE: 1836
REDSTONE: 4932
SULPHUR: 21284
4932: # Potion of Poison Extended
Effects: ["POISON 0 2400"]
Children:
FERMENTED_SPIDER_EYE: 8204
GLOWSTONE_DUST: 8228
SULPHUR: 16452
FERMENTED_SPIDER_EYE: 1804
GLOWSTONE_DUST: 4900
SULPHUR: 21284
5120: # Potion of Decay
Effects: ["WITHER 0 450"]
@@ -436,28 +465,33 @@ Potions:
16384: # Splash Mundane Potion
Children:
FERMENTED_SPIDER_EYE: 16392
FERMENTED_SPIDER_EYE: 21000
16386: # Splash Potion of Swiftness
16642: # Splash Potion of Swiftness
Effects: ["SPEED 0 2700"]
Children:
FERMENTED_SPIDER_EYE: 16394
GLOWSTONE_DUST: 16418
REDSTONE: 16450
16418: # Splash Potion of Swiftness II
FERMENTED_SPIDER_EYE: 16906
GLOWSTONE_DUST: 16674
REDSTONE: 16706
16674: # Splash Potion of Swiftness II
Effects: ["SPEED 1 1350"]
Children:
FERMENTED_SPIDER_EYE: 16394
REDSTONE: 16450
16450: # Splash Potion of Swiftness Extended
FERMENTED_SPIDER_EYE: 16906
REDSTONE: 16706
16706: # Splash Potion of Swiftness Extended
Effects: ["SPEED 0 7200"]
Children:
FERMENTED_SPIDER_EYE: 16394
GLOWSTONE_DUST: 16418
FERMENTED_SPIDER_EYE: 16906
GLOWSTONE_DUST: 16674
16394: # Splash Potion of Slowness
16906: # Splash Potion of Slowness
Effects: ["SLOW 0 1350"]
Children:
REDSTONE: 16458
16458: # Splash Potion of Slowness Extended
REDSTONE: 16970
16970: # Splash Potion of Slowness Extended
Effects: ["SLOW 0 3600"]
Children:
GLOWSTONE_DUST: 16394
GLOWSTONE_DUST: 16906
17152: # Splash Potion of Haste
Effects: ["FAST_DIGGING 0 2700"]
@@ -487,35 +521,42 @@ Potions:
Children:
GLOWSTONE_DUST: 17440
16393: # Splash Potion of Strength
17673: # Splash Potion of Strength
Effects: ["INCREASE_DAMAGE 0 2700"]
Children:
FERMENTED_SPIDER_EYE: 16392
GLOWSTONE_DUST: 16425
REDSTONE: 16457
16425: # Splash Potion of Strength II
FERMENTED_SPIDER_EYE: 21000
GLOWSTONE_DUST: 17705
REDSTONE: 17737
17705: # Splash Potion of Strength II
Effects: ["INCREASE_DAMAGE 1 1350"]
Children:
FERMENTED_SPIDER_EYE: 16392
REDSTONE: 16457
16457: # Splash Potion of Strength Extended
FERMENTED_SPIDER_EYE: 21000
REDSTONE: 17737
17737: # Splash Potion of Strength Extended
Effects: ["INCREASE_DAMAGE 0 7200"]
Children:
FERMENTED_SPIDER_EYE: 16456
GLOWSTONE_DUST: 16425
FERMENTED_SPIDER_EYE: 21064
GLOWSTONE_DUST: 17705
16389: # Splash Potion of Healing
17925: # Splash Potion of Healing
Effects: ["HEAL 0"]
Children:
FERMENTED_SPIDER_EYE: 16396
GLOWSTONE_DUST: 16421
16421: # Splash Potion of Healing II
FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 17957
17957: # Splash Potion of Healing II
Effects: ["HEAL 1"]
Children:
FERMENTED_SPIDER_EYE: 16428
REDSTONE: 16389
FERMENTED_SPIDER_EYE: 18220
REDSTONE: 17925
16396: # Splash Potion of Harming
18188: # Splash Potion of Harming
Effects: ["HARM 0"]
Children:
GLOWSTONE_DUST: 16428
16428: # Splash Potion of Harming II
GLOWSTONE_DUST: 18220
18220: # Splash Potion of Harming II
Effects: ["HARM 1"]
Children:
REDSTONE: 16396
REDSTONE: 18188
18432: # Splash Potion of Leaping
Effects: ["JUMP 0 2700"]
@@ -540,19 +581,22 @@ Potions:
Children:
GLOWSTONE_DUST: 18688
16385: # Splash Potion of Regeneration
18945: # Splash Potion of Regeneration
Effects: ["REGENERATION 0 675"]
Children:
FERMENTED_SPIDER_EYE: 16392
GLOWSTONE_DUST: 16417
REDSTONE: 16449
16417: # Splash Potion of Regeneration II
FERMENTED_SPIDER_EYE: 21000
GLOWSTONE_DUST: 18977
REDSTONE: 19009
18977: # Splash Potion of Regeneration II
Effects: ["REGENERATION 1 338"]
Children:
FERMENTED_SPIDER_EYE: 16392
REDSTONE: 16449
16449: # Splash Potion of Regeneration Extended
FERMENTED_SPIDER_EYE: 21000
REDSTONE: 19009
19009: # Splash Potion of Regeneration Extended
Effects: ["REGENERATION 0 1800"]
Children:
FERMENTED_SPIDER_EYE: 16456
GLOWSTONE_DUST: 16417
FERMENTED_SPIDER_EYE: 21064
GLOWSTONE_DUST: 18977
19200: # Splash Potion of Resistance
Effects: ["DAMAGE_RESISTANCE 0 338"]
@@ -568,28 +612,34 @@ Potions:
Children:
GLOWSTONE_DUST: 19232
16387: # Splash Potion of Fire Resistance
19459: # Splash Potion of Fire Resistance
Effects: ["FIRE_RESISTANCE 0 2700"]
Children:
FERMENTED_SPIDER_EYE: 16394
REDSTONE: 16451
16451: # Splash Potion of Fire Resistance Extended
FERMENTED_SPIDER_EYE: 16906
REDSTONE: 19523
19523: # Splash Potion of Fire Resistance Extended
Effects: ["FIRE_RESISTANCE 0 7200"]
Children:
FERMENTED_SPIDER_EYE: 16458
GLOWSTONE_DUST: 16387
FERMENTED_SPIDER_EYE: 16970
GLOWSTONE_DUST: 19459
16397: # Splash Potion of Water Breathing
19725: # Splash Potion of Water Breathing
Effects: ["WATER_BREATHING 0 2700"]
Children:
REDSTONE: 16461
16461: # Splash Potion of Water Breathing Extended
REDSTONE: 19789
19789: # Splash Potion of Water Breathing Extended
Effects: ["WATER_BREATHING 0 7200"]
Children:
GLOWSTONE_DUST: 16397
GLOWSTONE_DUST: 19725
16398: # Splash Potion of Invisibility
19982: # Splash Potion of Invisibility
Effects: ["INVISIBILITY 0 2700"]
Children:
REDSTONE: 16462
16462: # Splash Potion of Invisibility Extended
REDSTONE: 20046
20046: # Splash Potion of Invisibility Extended
Effects: ["INVISIBILITY 0 7200"]
Children:
GLOWSTONE_DUST: 16398
GLOWSTONE_DUST: 19982
20224: # Splash Potion of Blindness
Effects: ["BLINDNESS 0 169"]
@@ -600,14 +650,16 @@ Potions:
Children:
GLOWSTONE_DUST: 20224
16390: # Splash Potion of Night Vision
20486: # Splash Potion of Night Vision
Effects: ["NIGHT_VISION 0 2700"]
Children:
FERMENTED_SPIDER_EYE: 16398
REDSTONE: 16454
16454: # Splash Potion of Night Vision Extended
FERMENTED_SPIDER_EYE: 19982
REDSTONE: 20550
20550: # Splash Potion of Night Vision Extended
Effects: ["NIGHT_VISION 0 7200"]
Children:
FERMENTED_SPIDER_EYE: 16462
GLOWSTONE_DUST: 16390
FERMENTED_SPIDER_EYE: 20046
GLOWSTONE_DUST: 20486
20736: # Splash Potion of Hunger
Effects: ["HUNGER 0 675"]
@@ -623,26 +675,31 @@ Potions:
Children:
GLOWSTONE_DUST: 20768
16392: # Splash Potion of Weakness
21000: # Splash Potion of Weakness
Effects: ["WEAKNESS 0 1350"]
Children:
REDSTONE: 16456
16456: # Splash Potion of Weakness Extended
REDSTONE: 21064
21064: # Splash Potion of Weakness Extended
Effects: ["WEAKNESS 0 3600"]
Children:
GLOWSTONE_DUST: 16392
GLOWSTONE_DUST: 21000
16388: # Splash Potion of Poison
21252: # Splash Potion of Poison
Effects: ["POISON 0 675"]
Children:
FERMENTED_SPIDER_EYE: 16396
GLOWSTONE_DUST: 16452
REDSTONE: 16452
16452: # Splash Potion of Poison II
FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 21284
REDSTONE: 21316
21284: # Splash Potion of Poison II
Effects: ["POISON 1 338"]
Children:
FERMENTED_SPIDER_EYE: 16428
REDSTONE: 16452
16452: # Splash Potion of Poison Extended
FERMENTED_SPIDER_EYE: 18220
REDSTONE: 21316
21316: # Splash Potion of Poison Extended
Effects: ["POISON 0 1800"]
Children:
FERMENTED_SPIDER_EYE: 16396
GLOWSTONE_DUST: 16452
FERMENTED_SPIDER_EYE: 18188
GLOWSTONE_DUST: 21284
21504: # Splash Potion of Decay
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

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