mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 17:53:00 +01:00
Compare commits
1 Commits
dev-serial
...
dev-sounds
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da1841eb9e |
@@ -21,9 +21,6 @@ Version 1.4.08-dev
|
|||||||
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
|
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
|
||||||
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
|
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
|
||||||
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
|
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
|
||||||
= Fixed bug with updating (very) old user data.
|
|
||||||
= Fixed bug with checking maximum durability of mod items.
|
|
||||||
= Fixed exploit involving Call of The Wild.
|
|
||||||
= Fixed bug where LeafBlower permissions were ignored
|
= Fixed bug where LeafBlower permissions were ignored
|
||||||
= Fixed bug with toggle commands not properly displaying the success message.
|
= Fixed bug with toggle commands not properly displaying the success message.
|
||||||
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
= Fixed IllegalArgumentException caused by an empty Fishing treasure category
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -121,7 +121,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.6.4-R2.0</version>
|
<version>RELEASE</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -30,10 +30,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.showversion(sender)) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||||
}
|
|
||||||
|
|
||||||
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.chat.PartyChatManager;
|
import com.gmail.nossr50.chat.PartyChatManager;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@@ -30,11 +28,6 @@ public class PartyChatCommand extends ChatCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = buildChatMessage(args, 0);
|
message = buildChatMessage(args, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String[] extractArgs(String[] args) {
|
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) {
|
private boolean isItemShareCategory(String category) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class PartyHelpCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader"));
|
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader"));
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband"));
|
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband"));
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Help.9", "/party itemshare"));
|
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;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -23,11 +23,6 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMOPlayer.getParty().getAlly() != null) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PartyManager.acceptAllianceInvite(mcMMOPlayer);
|
PartyManager.acceptAllianceInvite(mcMMOPlayer);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||||
String[] displayValues = new String[2];
|
String[] displayValues = new String[2];
|
||||||
|
|
||||||
displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";
|
displayValues[0] = decimal.format(alchemyManager.getBrewSpeed()) + "x";
|
||||||
displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;
|
displayValues[1] = isLucky ? decimal.format(alchemyManager.getBrewSpeedLucky()) + "x" : null;
|
||||||
|
|
||||||
return displayValues;
|
return displayValues;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
import com.gmail.nossr50.util.ModManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ArmorConfigManager {
|
public class ArmorConfigManager {
|
||||||
public ArmorConfigManager(mcMMO plugin) {
|
public ArmorConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
||||||
@@ -15,7 +15,7 @@ public class ArmorConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
|
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "armor.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
import com.gmail.nossr50.util.ModManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class BlockConfigManager {
|
public class BlockConfigManager {
|
||||||
public BlockConfigManager(mcMMO plugin) {
|
public BlockConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
||||||
@@ -15,7 +15,7 @@ public class BlockConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "blocks.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
import com.gmail.nossr50.util.ModManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class EntityConfigManager {
|
public class EntityConfigManager {
|
||||||
public EntityConfigManager(mcMMO plugin) {
|
public EntityConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
|
||||||
@@ -15,7 +15,7 @@ public class EntityConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "entities.default.yml", false);
|
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "entities.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
import com.gmail.nossr50.util.ModManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ToolConfigManager {
|
public class ToolConfigManager {
|
||||||
public ToolConfigManager(mcMMO plugin) {
|
public ToolConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
|
||||||
@@ -15,7 +15,7 @@ public class ToolConfigManager {
|
|||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "tools.default.yml", false);
|
plugin.saveResource(plugin.getDataFolder().getName() + File.separator + "tools.default.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -19,16 +18,16 @@ import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
|||||||
public class PotionConfig extends ConfigLoader {
|
public class PotionConfig extends ConfigLoader {
|
||||||
private static PotionConfig instance;
|
private static PotionConfig instance;
|
||||||
|
|
||||||
private List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
|
public List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
|
||||||
private List<ItemStack> concoctionsIngredientsTierEight = 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() {
|
private PotionConfig() {
|
||||||
super("potions.yml");
|
super("potions.yml");
|
||||||
@@ -190,34 +189,4 @@ public class PotionConfig extends ConfigLoader {
|
|||||||
|
|
||||||
return null;
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,10 +96,6 @@ public class RepairConfig extends ConfigLoader {
|
|||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
|
||||||
maximumDurability = (short) config.getInt("Repairables." + key + ".MaximumDurability");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
reason.add("Maximum durability of " + key + " must be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ public class DatabaseManagerFactory {
|
|||||||
case FLATFILE:
|
case FLATFILE:
|
||||||
return new FlatfileDatabaseManager();
|
return new FlatfileDatabaseManager();
|
||||||
|
|
||||||
case SERIALIZED:
|
|
||||||
return new SerializedDatabaseManager();
|
|
||||||
|
|
||||||
case SQL:
|
case SQL:
|
||||||
return new SQLDatabaseManager();
|
return new SQLDatabaseManager();
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@@ -28,7 +26,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||||
@@ -607,7 +604,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
// Length checks depend on last character being ':'
|
// Length checks depend on last character being ':'
|
||||||
if (line.charAt(line.length() - 1) != ':') {
|
if (line.charAt(line.length() - 1) != ':') {
|
||||||
line = line.concat(":");
|
line = line + ":";
|
||||||
}
|
}
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
|
|
||||||
@@ -624,33 +621,29 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
String oldVersion = null;
|
String oldVersion = null;
|
||||||
|
|
||||||
if (character.length <= 33) {
|
|
||||||
// Introduction of HUDType
|
|
||||||
// Version 1.1.06
|
|
||||||
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
|
||||||
line = line.concat(" :");
|
|
||||||
character = line.split(":");
|
|
||||||
oldVersion = "1.1.06";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!character[33].isEmpty()) {
|
if (!character[33].isEmpty()) {
|
||||||
// Removal of Spout Support
|
// Removal of Spout Support
|
||||||
// Version 1.4.07-dev2
|
// Version 1.4.07-dev2
|
||||||
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
|
// commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968
|
||||||
line = line.replace(character[33], "");
|
line = line.replace(character[33], "");
|
||||||
if (oldVersion == null) {
|
|
||||||
oldVersion = "1.4.07";
|
oldVersion = "1.4.07";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If they're valid, rewrite them to the file.
|
// If they're valid, rewrite them to the file.
|
||||||
if (character.length == 41) {
|
if (character.length > 40) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder newLine = new StringBuilder(line);
|
StringBuilder newLine = new StringBuilder(line);
|
||||||
|
|
||||||
|
if (character.length <= 33) {
|
||||||
|
// Introduction of HUDType
|
||||||
|
// Version 1.1.06
|
||||||
|
// commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a
|
||||||
|
newLine.append(":");
|
||||||
|
oldVersion = "1.1.06";
|
||||||
|
}
|
||||||
if (character.length <= 35) {
|
if (character.length <= 35) {
|
||||||
// Introduction of Fishing
|
// Introduction of Fishing
|
||||||
// Version 1.2.00
|
// Version 1.2.00
|
||||||
@@ -689,7 +682,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
oldVersion = "1.4.06";
|
oldVersion = "1.4.06";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (character.length <= 39) {
|
if (character.length <= 40) {
|
||||||
// Addition of Alchemy
|
// Addition of Alchemy
|
||||||
// Version 1.4.08
|
// Version 1.4.08
|
||||||
newLine.append("0").append(":");
|
newLine.append("0").append(":");
|
||||||
@@ -699,46 +692,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any blanks that shouldn't be there, and validate the other fields
|
|
||||||
String[] newCharacter = newLine.toString().split(":");
|
|
||||||
boolean corrupted = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < newCharacter.length; i++) {
|
|
||||||
if (newCharacter[i].isEmpty() && !(i == 2 || i == 3 || i == 23 || i == 33)) {
|
|
||||||
corrupted = true;
|
|
||||||
|
|
||||||
if (newCharacter.length != 41) {
|
|
||||||
newCharacter = (String[]) ArrayUtils.remove(newCharacter, i);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (i == 37) {
|
|
||||||
newCharacter[i] = String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
|
||||||
}
|
|
||||||
else if (i == 38) {
|
|
||||||
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
newCharacter[i] = "0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isInt(newCharacter[i]) && i == 38) {
|
|
||||||
corrupted = true;
|
|
||||||
newCharacter[i] = Config.getInstance().getMobHealthbarDefault().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isInt(newCharacter[i]) && !(i == 0 || i == 2 || i == 3 || i == 23 || i == 33 || i == 38)) {
|
|
||||||
corrupted = true;
|
|
||||||
newCharacter[i] = "0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (corrupted) {
|
|
||||||
mcMMO.p.debug("Updating corrupted database line for player " + newCharacter[0]);
|
|
||||||
newLine = new StringBuilder(org.apache.commons.lang.StringUtils.join(newCharacter, ":"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldVersion != null) {
|
if (oldVersion != null) {
|
||||||
mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion);
|
mcMMO.p.debug("Updating database line for player " + character[0] + " from before version " + oldVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,440 +0,0 @@
|
|||||||
package com.gmail.nossr50.database;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.datatypes.player.UserData;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
|
|
||||||
public class SerializedDatabaseManager implements DatabaseManager {
|
|
||||||
private final HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
|
||||||
private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
|
||||||
private long lastUpdate = 0;
|
|
||||||
|
|
||||||
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
|
||||||
|
|
||||||
protected SerializedDatabaseManager() {
|
|
||||||
updateLeaderboards();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void purgePowerlessUsers() {
|
|
||||||
int purgedUsers = 0;
|
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
|
||||||
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean powerless = true;
|
|
||||||
for (int skill : data.getSkillLevels().values()) {
|
|
||||||
if (skill != 0) {
|
|
||||||
powerless = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (powerless && file.delete()) {
|
|
||||||
purgedUsers++;
|
|
||||||
Misc.profileCleanup(data.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void purgeOldUsers() {
|
|
||||||
int removedPlayers = 0;
|
|
||||||
long currentTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purging old users...");
|
|
||||||
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean rewrite = false;
|
|
||||||
String name = data.getName();
|
|
||||||
long lastPlayed = data.getLastPlayed();
|
|
||||||
|
|
||||||
if (lastPlayed == 0) {
|
|
||||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(name);
|
|
||||||
lastPlayed = player.getLastPlayed();
|
|
||||||
rewrite = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentTime - lastPlayed > PURGE_TIME) {
|
|
||||||
if (file.delete()) {
|
|
||||||
removedPlayers++;
|
|
||||||
Misc.profileCleanup(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rewrite) {
|
|
||||||
data.setLastPlayed(lastPlayed);
|
|
||||||
serialize(file, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purged " + removedPlayers + " users from the database.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeUser(String playerName) {
|
|
||||||
boolean worked = false;
|
|
||||||
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return worked;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data != null && data.getName().equalsIgnoreCase(playerName)) {
|
|
||||||
mcMMO.p.getLogger().info("User found, removing...");
|
|
||||||
worked = file.delete();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return worked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean saveUser(PlayerProfile profile) {
|
|
||||||
UserData data = new UserData(profile);
|
|
||||||
|
|
||||||
return serialize(new File(mcMMO.getUsersDirectory(), data.getName() + ".mcmmoplayer"), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PlayerStat> readLeaderboard(SkillType skill, int pageNumber, int statsPerPage) {
|
|
||||||
updateLeaderboards();
|
|
||||||
|
|
||||||
List<PlayerStat> statsList = skill == null ? powerLevels : playerStatHash.get(skill);
|
|
||||||
int fromIndex = (Math.max(pageNumber, 1) - 1) * statsPerPage;
|
|
||||||
|
|
||||||
return statsList.subList(Math.min(fromIndex, statsList.size()), Math.min(fromIndex + statsPerPage, statsList.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<SkillType, Integer> readRank(String playerName) {
|
|
||||||
updateLeaderboards();
|
|
||||||
|
|
||||||
Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
|
||||||
|
|
||||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) {
|
|
||||||
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
|
||||||
}
|
|
||||||
|
|
||||||
skills.put(null, getPlayerRank(playerName, powerLevels));
|
|
||||||
|
|
||||||
return skills;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void newUser(String playerName) {
|
|
||||||
serialize(new File(mcMMO.getUsersDirectory(), playerName + ".mcmmoplayer"), new UserData(new PlayerProfile(playerName)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerProfile loadPlayerProfile(String playerName, boolean createNew) {
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return new PlayerProfile(playerName, createNew);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data != null && data.getName().equalsIgnoreCase(playerName)) {
|
|
||||||
return loadFromData(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new PlayerProfile(playerName, createNew);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getStoredUsers() {
|
|
||||||
ArrayList<String> users = new ArrayList<String>();
|
|
||||||
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
users.add(data.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void convertUsers(DatabaseManager destination) {
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
//TODO: log issue
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int convertedUsers = 0;
|
|
||||||
long startMillis = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (destination.saveUser(loadFromData(data))) {
|
|
||||||
convertedUsers++;
|
|
||||||
Misc.printProgress(convertedUsers, progressInterval, startMillis);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseType getDatabaseType() {
|
|
||||||
return DatabaseType.SERIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
private UserData deserialize(File file) {
|
|
||||||
UserData data = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
FileInputStream fis = new FileInputStream(file);
|
|
||||||
ObjectInputStream ois = new ObjectInputStream(fis);
|
|
||||||
|
|
||||||
data = (UserData) ois.readObject();
|
|
||||||
ois.close();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + file.getName() + ": " + e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean serialize(File file, UserData data) {
|
|
||||||
boolean success = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
|
||||||
oos.writeObject(data);
|
|
||||||
oos.close();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
mcMMO.p.getLogger().severe("Exception while writing " + file.getName() + ": " + e.toString());
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlayerProfile loadFromData(UserData data) {
|
|
||||||
return new PlayerProfile(data.getName(), data.getSkillLevels(), data.getSkillXp(), data.getAbilityData(), data.getMobHealthbarType());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the leader boards.
|
|
||||||
*/
|
|
||||||
private void updateLeaderboards() {
|
|
||||||
// Only update leaderboards every 10 minutes.. this puts a lot of strain on the server (depending on the size of the database) and should not be done frequently
|
|
||||||
if (System.currentTimeMillis() < lastUpdate + UPDATE_WAIT_TIME) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
File usersDirectory = new File(mcMMO.getUsersDirectory());
|
|
||||||
File[] userFiles = usersDirectory.listFiles();
|
|
||||||
|
|
||||||
if (userFiles == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastUpdate = System.currentTimeMillis(); // Log when the last update was run
|
|
||||||
powerLevels.clear(); // Clear old values from the power levels
|
|
||||||
|
|
||||||
// Initialize lists
|
|
||||||
List<PlayerStat> mining = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> woodcutting = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> herbalism = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> excavation = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> acrobatics = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> repair = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> swords = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> axes = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> archery = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> unarmed = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> taming = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> fishing = new ArrayList<PlayerStat>();
|
|
||||||
List<PlayerStat> alchemy = new ArrayList<PlayerStat>();
|
|
||||||
|
|
||||||
for (File file : userFiles) {
|
|
||||||
if (!file.isFile() || file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserData data = deserialize(file);
|
|
||||||
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int powerLevel = 0;
|
|
||||||
String playerName = data.getName();
|
|
||||||
Map<SkillType, Integer> skills = data.getSkillLevels();
|
|
||||||
|
|
||||||
powerLevel += putStat(acrobatics, playerName, skills.get(SkillType.ACROBATICS));
|
|
||||||
powerLevel += putStat(alchemy, playerName, skills.get(SkillType.ALCHEMY));
|
|
||||||
powerLevel += putStat(archery, playerName, skills.get(SkillType.ARCHERY));
|
|
||||||
powerLevel += putStat(axes, playerName, skills.get(SkillType.AXES));
|
|
||||||
powerLevel += putStat(excavation, playerName, skills.get(SkillType.EXCAVATION));
|
|
||||||
powerLevel += putStat(fishing, playerName, skills.get(SkillType.FISHING));
|
|
||||||
powerLevel += putStat(herbalism, playerName, skills.get(SkillType.HERBALISM));
|
|
||||||
powerLevel += putStat(mining, playerName, skills.get(SkillType.MINING));
|
|
||||||
powerLevel += putStat(repair, playerName, skills.get(SkillType.REPAIR));
|
|
||||||
powerLevel += putStat(swords, playerName, skills.get(SkillType.SWORDS));
|
|
||||||
powerLevel += putStat(taming, playerName, skills.get(SkillType.TAMING));
|
|
||||||
powerLevel += putStat(unarmed, playerName, skills.get(SkillType.UNARMED));
|
|
||||||
powerLevel += putStat(woodcutting, playerName, skills.get(SkillType.WOODCUTTING));
|
|
||||||
|
|
||||||
putStat(powerLevels, playerName, powerLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkillComparator c = new SkillComparator();
|
|
||||||
|
|
||||||
Collections.sort(mining, c);
|
|
||||||
Collections.sort(woodcutting, c);
|
|
||||||
Collections.sort(repair, c);
|
|
||||||
Collections.sort(unarmed, c);
|
|
||||||
Collections.sort(herbalism, c);
|
|
||||||
Collections.sort(excavation, c);
|
|
||||||
Collections.sort(archery, c);
|
|
||||||
Collections.sort(swords, c);
|
|
||||||
Collections.sort(axes, c);
|
|
||||||
Collections.sort(acrobatics, c);
|
|
||||||
Collections.sort(taming, c);
|
|
||||||
Collections.sort(fishing, c);
|
|
||||||
Collections.sort(alchemy, c);
|
|
||||||
Collections.sort(powerLevels, c);
|
|
||||||
|
|
||||||
playerStatHash.put(SkillType.MINING, mining);
|
|
||||||
playerStatHash.put(SkillType.WOODCUTTING, woodcutting);
|
|
||||||
playerStatHash.put(SkillType.REPAIR, repair);
|
|
||||||
playerStatHash.put(SkillType.UNARMED, unarmed);
|
|
||||||
playerStatHash.put(SkillType.HERBALISM, herbalism);
|
|
||||||
playerStatHash.put(SkillType.EXCAVATION, excavation);
|
|
||||||
playerStatHash.put(SkillType.ARCHERY, archery);
|
|
||||||
playerStatHash.put(SkillType.SWORDS, swords);
|
|
||||||
playerStatHash.put(SkillType.AXES, axes);
|
|
||||||
playerStatHash.put(SkillType.ACROBATICS, acrobatics);
|
|
||||||
playerStatHash.put(SkillType.TAMING, taming);
|
|
||||||
playerStatHash.put(SkillType.FISHING, fishing);
|
|
||||||
playerStatHash.put(SkillType.ALCHEMY, alchemy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int putStat(List<PlayerStat> statList, String playerName, int statValue) {
|
|
||||||
statList.add(new PlayerStat(playerName, statValue));
|
|
||||||
return statValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer getPlayerRank(String playerName, List<PlayerStat> statsList) {
|
|
||||||
if (statsList == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
int currentPos = 1;
|
|
||||||
|
|
||||||
for (PlayerStat stat : statsList) {
|
|
||||||
if (stat.name.equalsIgnoreCase(playerName)) {
|
|
||||||
return currentPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SkillComparator implements Comparator<PlayerStat> {
|
|
||||||
@Override
|
|
||||||
public int compare(PlayerStat o1, PlayerStat o2) {
|
|
||||||
return (o2.statVal - o1.statVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ package com.gmail.nossr50.datatypes.database;
|
|||||||
|
|
||||||
public enum DatabaseType {
|
public enum DatabaseType {
|
||||||
FLATFILE,
|
FLATFILE,
|
||||||
SERIALIZED,
|
|
||||||
SQL,
|
SQL,
|
||||||
CUSTOM;
|
CUSTOM;
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ public class McMMOPlayer {
|
|||||||
private boolean abilityUse = true;
|
private boolean abilityUse = true;
|
||||||
private boolean godMode;
|
private boolean godMode;
|
||||||
|
|
||||||
|
private Sound recentSound;
|
||||||
|
private int lastSound;
|
||||||
|
|
||||||
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
private final Map<AbilityType, Boolean> abilityMode = new HashMap<AbilityType, Boolean>();
|
||||||
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
private final Map<AbilityType, Boolean> abilityInformed = new HashMap<AbilityType, Boolean>();
|
||||||
|
|
||||||
@@ -442,6 +445,50 @@ public class McMMOPlayer {
|
|||||||
godMode = !godMode;
|
godMode = !godMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sounds
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Play a sound at the players location.
|
||||||
|
* Sound will only get played if it's different
|
||||||
|
* compared to the previously played sound or if the cooldown has expired.
|
||||||
|
*
|
||||||
|
* @param sound The Sound to play
|
||||||
|
* @param volume Volume of the sound
|
||||||
|
* @param pitch Pitch of the sound
|
||||||
|
* @param cooldown Cooldown time between sounds
|
||||||
|
*/
|
||||||
|
public void playSound(Sound sound, float volume, float pitch, int cooldown) {
|
||||||
|
if (getRecentSound() == sound && !SkillUtils.cooldownExpired(getLastSound(), 1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRecentSound(sound);
|
||||||
|
actualizeLastSound();
|
||||||
|
player.playSound(player.getLocation(), sound, volume, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playSound(Sound sound, float volume, float pitch) {
|
||||||
|
playSound(sound, volume, pitch, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Sound getRecentSound() {
|
||||||
|
return recentSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecentSound(Sound recentSound) {
|
||||||
|
this.recentSound = recentSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastSound() {
|
||||||
|
return lastSound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actualizeLastSound() {
|
||||||
|
lastSound = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skill notifications
|
* Skill notifications
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
package com.gmail.nossr50.datatypes.player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class UserData implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private UUID playerID;
|
|
||||||
private String name;
|
|
||||||
private long lastPlayed;
|
|
||||||
private HashMap<SkillType, Integer> skillLevels = new HashMap<SkillType, Integer>();
|
|
||||||
private HashMap<SkillType, Float> skillXp = new HashMap<SkillType, Float>();
|
|
||||||
private HashMap<AbilityType, Integer> abilityData = new HashMap<AbilityType, Integer>();
|
|
||||||
private MobHealthbarType mobHealthbarType;
|
|
||||||
|
|
||||||
public UserData(McMMOPlayer mcMMOPlayer) {
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
|
||||||
|
|
||||||
playerID = player.getUniqueId();
|
|
||||||
name = player.getName();
|
|
||||||
lastPlayed = player.getLastPlayed();
|
|
||||||
|
|
||||||
for (SkillType skill : SkillType.values()) {
|
|
||||||
skillLevels.put(skill, mcMMOPlayer.getSkillLevel(skill));
|
|
||||||
skillXp.put(skill, mcMMOPlayer.getSkillXpLevelRaw(skill));
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerProfile profile = mcMMOPlayer.getProfile();
|
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
|
||||||
abilityData.put(ability, (int) profile.getAbilityDATS(ability));
|
|
||||||
}
|
|
||||||
|
|
||||||
mobHealthbarType = profile.getMobHealthbarType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserData(PlayerProfile profile) {
|
|
||||||
name = profile.getPlayerName();
|
|
||||||
|
|
||||||
Player player = mcMMO.p.getServer().getPlayerExact(name);
|
|
||||||
|
|
||||||
if (player == null) {
|
|
||||||
playerID = UUID.fromString(name);
|
|
||||||
lastPlayed = 0L;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
playerID = player.getUniqueId();
|
|
||||||
lastPlayed = player.getLastPlayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (SkillType skill : SkillType.values()) {
|
|
||||||
skillLevels.put(skill, profile.getSkillLevel(skill));
|
|
||||||
skillXp.put(skill, profile.getSkillXpLevelRaw(skill));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AbilityType ability : AbilityType.values()) {
|
|
||||||
abilityData.put(ability, (int) profile.getAbilityDATS(ability));
|
|
||||||
}
|
|
||||||
|
|
||||||
mobHealthbarType = profile.getMobHealthbarType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastPlayed() {
|
|
||||||
return lastPlayed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastPlayed(long lastPlayed) {
|
|
||||||
this.lastPlayed = lastPlayed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<SkillType, Integer> getSkillLevels() {
|
|
||||||
return skillLevels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<SkillType, Float> getSkillXp() {
|
|
||||||
return skillXp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<AbilityType, Integer> getAbilityData() {
|
|
||||||
return abilityData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MobHealthbarType getMobHealthbarType() {
|
|
||||||
return mobHealthbarType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,24 +28,22 @@ public class AlchemyPotion {
|
|||||||
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) {
|
public ItemStack toItemStack(int amount) {
|
||||||
ItemStack potion = new ItemStack(Material.POTION, amount, this.getDataValue());
|
ItemStack potion = new ItemStack(Material.POTION, amount, this.getDataValue());
|
||||||
PotionMeta meta = (PotionMeta) potion.getItemMeta();
|
PotionMeta meta = (PotionMeta) potion.getItemMeta();
|
||||||
|
|
||||||
if (this.getName() != null) {
|
|
||||||
meta.setDisplayName(this.getName());
|
meta.setDisplayName(this.getName());
|
||||||
}
|
|
||||||
|
|
||||||
if (this.getLore() != null && !this.getLore().isEmpty()) {
|
if (this.getLore() != null && !this.getLore().isEmpty()) {
|
||||||
meta.setLore(this.getLore());
|
meta.setLore(this.getLore());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.getEffects().isEmpty()) {
|
if (!this.getEffects().isEmpty()) {
|
||||||
for (PotionEffect effect : this.getEffects()) {
|
for (PotionEffect effect : this.getEffects()) {
|
||||||
meta.addCustomEffect(effect, true);
|
meta.addCustomEffect(effect, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
potion.setItemMeta(meta);
|
potion.setItemMeta(meta);
|
||||||
return potion;
|
return potion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class BlockListener implements Listener {
|
|||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
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
|
// 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());
|
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
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
|
// 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());
|
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
LivingEntity entity = event.getEntity();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.event.inventory.CraftItemEvent;
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
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.InventoryMoveItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.BrewerInventory;
|
|
||||||
import org.bukkit.inventory.FurnaceInventory;
|
import org.bukkit.inventory.FurnaceInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
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.SecondaryAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
|
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
|
||||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
@@ -59,7 +56,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
HumanEntity player = event.getPlayer();
|
HumanEntity player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +73,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
HumanEntity player = event.getPlayer();
|
HumanEntity player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +92,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +110,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
|
if (Misc.isNPCEntity(player) || !SkillType.SMELTING.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +129,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
if (Misc.isNPCEntity(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,164 +138,43 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
||||||
Inventory inventory = event.getInventory();
|
if (event.getInventory().getType() != InventoryType.BREWING || !(event.getInventory().getHolder() instanceof BrewingStand)) {
|
||||||
|
|
||||||
if (!(inventory instanceof BrewerInventory)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHolder holder = inventory.getHolder();
|
if (!(event.getWhoClicked() instanceof Player) || Misc.isNPCEntity(event.getWhoClicked()) || !Permissions.concoctions(event.getWhoClicked())) {
|
||||||
|
|
||||||
if (!(holder instanceof BrewingStand)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HumanEntity whoClicked = event.getWhoClicked();
|
AlchemyPotionBrewer.handleInventoryClick(event);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryDragEvent(InventoryDragEvent event) {
|
public void onInventoryDragEvent(InventoryDragEvent event) {
|
||||||
Inventory inventory = event.getInventory();
|
if (event.getInventory().getType() != InventoryType.BREWING || !(event.getInventory().getHolder() instanceof BrewingStand)) {
|
||||||
|
|
||||||
if (!(inventory instanceof BrewerInventory)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHolder holder = inventory.getHolder();
|
if (!(event.getWhoClicked() instanceof Player) || Misc.isNPCEntity(event.getWhoClicked()) || !Permissions.concoctions(event.getWhoClicked())) {
|
||||||
|
|
||||||
if (!(holder instanceof BrewingStand)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HumanEntity whoClicked = event.getWhoClicked();
|
AlchemyPotionBrewer.handleInventoryDrag(event);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
||||||
Inventory inventory = event.getDestination();
|
if (event.getDestination().getType() != InventoryType.BREWING || !(event.getDestination().getHolder() instanceof BrewingStand)) {
|
||||||
|
|
||||||
if (!(inventory instanceof BrewerInventory)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHolder holder = inventory.getHolder();
|
if (Config.getInstance().getPreventHopperTransfer() && event.getItem() != null && event.getItem().getType() != Material.POTION) {
|
||||||
|
|
||||||
if (!(holder instanceof BrewingStand)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack item = event.getItem();
|
|
||||||
|
|
||||||
if (Config.getInstance().getPreventHopperTransfer() && item.getType() != Material.POTION) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
if (Config.getInstance().getEnabledForHoppers()) {
|
||||||
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
AlchemyPotionBrewer.handleInventoryMoveItem(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +187,7 @@ public class InventoryListener implements Listener {
|
|||||||
public void onCraftItem(CraftItemEvent event) {
|
public void onCraftItem(CraftItemEvent event) {
|
||||||
final HumanEntity whoClicked = event.getWhoClicked();
|
final HumanEntity whoClicked = event.getWhoClicked();
|
||||||
|
|
||||||
if (!whoClicked.hasMetadata(mcMMO.playerDataKey)) {
|
if (Misc.isNPCEntity(whoClicked) || !(whoClicked instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@@ -58,7 +59,6 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
|
|||||||
import com.gmail.nossr50.util.Motd;
|
import com.gmail.nossr50.util.Motd;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
@@ -81,7 +81,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !Config.getInstance().getPreventXPAfterTeleport() || event.getFrom().equals(event.getTo())) {
|
if (Misc.isNPCEntity(player) || !Config.getInstance().getPreventXPAfterTeleport() || event.getFrom().equals(event.getTo())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
Player killedPlayer = event.getEntity();
|
Player killedPlayer = event.getEntity();
|
||||||
|
|
||||||
if (!killedPlayer.hasMetadata(mcMMO.playerDataKey) || Permissions.hardcoreBypass(killedPlayer)) {
|
if (Misc.isNPCEntity(killedPlayer) || Permissions.hardcoreBypass(killedPlayer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
|
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFishHighest(PlayerFishEvent event) {
|
public void onPlayerFishHighest(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
if (Misc.isNPCEntity(player) || !SkillType.FISHING.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
|
if (Misc.isNPCEntity(player) || !SkillType.FISHING.getPermissions(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ public class PlayerListener implements Listener {
|
|||||||
mcMMOPlayer.resetAbilityMode();
|
mcMMOPlayer.resetAbilityMode();
|
||||||
BleedTimerTask.bleedOut(player);
|
BleedTimerTask.bleedOut(player);
|
||||||
mcMMOPlayer.getProfile().save();
|
mcMMOPlayer.getProfile().save();
|
||||||
UserManager.remove(player);
|
UserManager.remove(player.getName());
|
||||||
ScoreboardManager.teardownPlayer(player);
|
ScoreboardManager.teardownPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,8 +374,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.addUser(player);
|
UserManager.addUser(player).actualizeRespawnATS();
|
||||||
mcMMOPlayer.actualizeRespawnATS();
|
|
||||||
ScoreboardManager.setupPlayer(player);
|
ScoreboardManager.setupPlayer(player);
|
||||||
|
|
||||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||||
@@ -405,7 +404,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +420,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +511,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
if (Misc.isNPCEntity(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
/* File Paths */
|
/* File Paths */
|
||||||
private static String mainDirectory;
|
private static String mainDirectory;
|
||||||
private static String flatFileDirectory;
|
private static String flatFileDirectory;
|
||||||
private static String usersDirectory;
|
|
||||||
private static String usersFile;
|
private static String usersFile;
|
||||||
private static String modDirectory;
|
private static String modDirectory;
|
||||||
|
|
||||||
@@ -112,7 +111,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
||||||
public final static String customDamageKey = "mcMMO: Custom Damage";
|
public final static String customDamageKey = "mcMMO: Custom Damage";
|
||||||
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
||||||
public final static String playerDataKey = "mcMMO: Player Data";
|
|
||||||
|
|
||||||
public static FixedMetadataValue metadataValue;
|
public static FixedMetadataValue metadataValue;
|
||||||
|
|
||||||
@@ -251,10 +249,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
return flatFileDirectory;
|
return flatFileDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUsersDirectory() {
|
|
||||||
return usersDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getUsersFilePath() {
|
public static String getUsersFilePath() {
|
||||||
return usersFile;
|
return usersFile;
|
||||||
}
|
}
|
||||||
@@ -331,7 +325,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
mcmmo = getFile();
|
mcmmo = getFile();
|
||||||
mainDirectory = getDataFolder().getPath() + File.separator;
|
mainDirectory = getDataFolder().getPath() + File.separator;
|
||||||
flatFileDirectory = mainDirectory + "flatfile" + File.separator;
|
flatFileDirectory = mainDirectory + "flatfile" + File.separator;
|
||||||
usersDirectory = flatFileDirectory + "users" + File.separator;
|
|
||||||
usersFile = flatFileDirectory + "mcmmo.users";
|
usersFile = flatFileDirectory + "mcmmo.users";
|
||||||
modDirectory = mainDirectory + "mods" + File.separator;
|
modDirectory = mainDirectory + "mods" + File.separator;
|
||||||
fixFilePaths();
|
fixFilePaths();
|
||||||
@@ -381,9 +374,6 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getLogger().warning("Failed to rename tools.yml to tools.default.yml!");
|
getLogger().warning("Failed to rename tools.yml to tools.default.yml!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File currentFlatfilePath = new File(flatFileDirectory);
|
|
||||||
currentFlatfilePath.mkdirs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUpdates() {
|
private void checkForUpdates() {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public final class PartyManager {
|
|||||||
*/
|
*/
|
||||||
public static Party getParty(String partyName) {
|
public static Party getParty(String partyName) {
|
||||||
for (Party party : parties) {
|
for (Party party : parties) {
|
||||||
if (party.getName().equalsIgnoreCase(partyName)) {
|
if (party.getName().equals(partyName)) {
|
||||||
return party;
|
return party;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.runnables.skills;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -12,6 +12,8 @@ import com.gmail.nossr50.skills.alchemy.Alchemy;
|
|||||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||||
|
|
||||||
public class AlchemyBrewCheckTask extends BukkitRunnable {
|
public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||||
|
private final static int INGREDIENT_SLOT = 3;
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private BrewingStand brewingStand;
|
private BrewingStand brewingStand;
|
||||||
private ItemStack[] oldInventory;
|
private ItemStack[] oldInventory;
|
||||||
@@ -24,17 +26,18 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Location location = brewingStand.getLocation();
|
Block block = brewingStand.getBlock();
|
||||||
ItemStack[] newInventory = Arrays.copyOfRange(brewingStand.getInventory().getContents(), 0, 4);
|
ItemStack[] newInventory = Arrays.copyOfRange(((BrewingStand) block.getState()).getInventory().getContents(), 0, 4);
|
||||||
boolean validBrew = AlchemyPotionBrewer.isValidBrew(player, newInventory);
|
|
||||||
|
|
||||||
if (Alchemy.brewingStandMap.containsKey(location)) {
|
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
|
||||||
if (oldInventory[Alchemy.INGREDIENT_SLOT] == null || newInventory[Alchemy.INGREDIENT_SLOT] == null || !oldInventory[Alchemy.INGREDIENT_SLOT].isSimilar(newInventory[Alchemy.INGREDIENT_SLOT]) || !validBrew) {
|
if (oldInventory[INGREDIENT_SLOT] == null || newInventory[INGREDIENT_SLOT] == null || !oldInventory[INGREDIENT_SLOT].isSimilar(newInventory[INGREDIENT_SLOT]) || !AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
|
||||||
Alchemy.brewingStandMap.get(location).cancelBrew();
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.BrewingStand;
|
import org.bukkit.block.BrewingStand;
|
||||||
@@ -23,43 +22,44 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
|||||||
private static int DEFAULT_BREW_TICKS = 400;
|
private static int DEFAULT_BREW_TICKS = 400;
|
||||||
|
|
||||||
private BlockState brewingStand;
|
private BlockState brewingStand;
|
||||||
private Location location;
|
|
||||||
private double brewSpeed;
|
private double brewSpeed;
|
||||||
private double brewTimer;
|
private double brewTimer;
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
public AlchemyBrewTask(BlockState brewingStand, Player player) {
|
public AlchemyBrewTask(BlockState brewingStand, Player player) {
|
||||||
this.brewingStand = brewingStand;
|
this.brewingStand = brewingStand;
|
||||||
this.location = brewingStand.getLocation();
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
brewSpeed = DEFAULT_BREW_SPEED;
|
brewSpeed = DEFAULT_BREW_SPEED;
|
||||||
brewTimer = DEFAULT_BREW_TICKS;
|
brewTimer = DEFAULT_BREW_TICKS;
|
||||||
|
|
||||||
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
|
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);
|
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
brewSpeed = catalysis;
|
brewSpeed = catalysis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Alchemy.brewingStandMap.containsKey(location)) {
|
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
|
||||||
Alchemy.brewingStandMap.get(location).cancel();
|
Alchemy.brewingStandMap.get(brewingStand).cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Alchemy.brewingStandMap.put(location, this);
|
Alchemy.brewingStandMap.put(brewingStand, this);
|
||||||
this.runTaskTimer(mcMMO.p, 1, 1);
|
this.runTaskTimer(mcMMO.p, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (player == null || !player.isValid() || brewingStand == null || brewingStand.getType() != Material.BREWING_STAND) {
|
if (player == null || !player.isValid() || brewingStand == null || brewingStand.getType() != Material.BREWING_STAND) {
|
||||||
if (Alchemy.brewingStandMap.containsKey(location)) {
|
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
|
||||||
Alchemy.brewingStandMap.remove(location);
|
Alchemy.brewingStandMap.remove(brewingStand);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cancel();
|
this.cancel();
|
||||||
@@ -87,20 +87,20 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
|||||||
AlchemyPotionBrewer.finishBrewing(brewingStand, player, false);
|
AlchemyPotionBrewer.finishBrewing(brewingStand, player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Alchemy.brewingStandMap.remove(location);
|
Alchemy.brewingStandMap.remove(brewingStand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishImmediately() {
|
public void finishImmediately() {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
|
|
||||||
AlchemyPotionBrewer.finishBrewing(brewingStand, player, true);
|
AlchemyPotionBrewer.finishBrewing(brewingStand, player, true);
|
||||||
Alchemy.brewingStandMap.remove(location);
|
Alchemy.brewingStandMap.remove(brewingStand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelBrew() {
|
public void cancelBrew() {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
|
|
||||||
((BrewingStand) brewingStand).setBrewingTime(-1);
|
((BrewingStand) brewingStand).setBrewingTime(-1);
|
||||||
Alchemy.brewingStandMap.remove(location);
|
Alchemy.brewingStandMap.remove(brewingStand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.gmail.nossr50.skills.alchemy;
|
package com.gmail.nossr50.skills.alchemy;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
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 catalysisUnlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel();
|
||||||
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
|
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
|
||||||
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
||||||
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
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() {}
|
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.
|
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
|
||||||
*/
|
*/
|
||||||
public static void finishAllBrews() {
|
public static void finishAllBrews() {
|
||||||
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
||||||
|
|
||||||
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
|
|
||||||
|
|
||||||
for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) {
|
for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) {
|
||||||
toFinish.add(alchemyBrewTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
|
|
||||||
alchemyBrewTask.finishImmediately();
|
alchemyBrewTask.finishImmediately();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,15 @@ package com.gmail.nossr50.skills.alchemy;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
public class AlchemyManager extends SkillManager {
|
public class AlchemyManager extends SkillManager {
|
||||||
@@ -19,6 +20,23 @@ public class AlchemyManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, SkillType.ALCHEMY);
|
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() {
|
public int getTier() {
|
||||||
for (Alchemy.Tier tier : Alchemy.Tier.values()) {
|
for (Alchemy.Tier tier : Alchemy.Tier.values()) {
|
||||||
if (getSkillLevel() >= tier.getLevel()) {
|
if (getSkillLevel() >= tier.getLevel()) {
|
||||||
@@ -30,17 +48,31 @@ public class AlchemyManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getIngredients() {
|
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() {
|
public String getIngredientList() {
|
||||||
StringBuilder list = new StringBuilder();
|
StringBuilder list = new StringBuilder();
|
||||||
|
|
||||||
for (ItemStack ingredient : getIngredients()) {
|
for (ItemStack ingredient : getIngredients()) {
|
||||||
short durability = ingredient.getDurability();
|
String string = StringUtils.getPrettyItemString(ingredient.getType()) + (ingredient.getDurability() != 0 ? ":" + ingredient.getDurability() : "");
|
||||||
|
|
||||||
String string = StringUtils.getPrettyItemString(ingredient.getType()) + (durability != 0 ? ":" + durability : "");
|
|
||||||
|
|
||||||
if (string.equals("Long Grass:2")) {
|
if (string.equals("Long Grass:2")) {
|
||||||
string = "Fern";
|
string = "Fern";
|
||||||
}
|
}
|
||||||
@@ -48,20 +80,17 @@ public class AlchemyManager extends SkillManager {
|
|||||||
string = "Pufferfish";
|
string = "Pufferfish";
|
||||||
}
|
}
|
||||||
|
|
||||||
list.append(", ").append(string);
|
list.append(", " + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.substring(2);
|
return list.substring(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double calculateBrewSpeed(boolean isLucky) {
|
public double getBrewSpeed() {
|
||||||
int skillLevel = getSkillLevel();
|
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) {
|
public void handlePotionBrewSuccesses(int amount) {
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import org.bukkit.block.BrewingStand;
|
|||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
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.BrewerInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
@@ -23,54 +27,60 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
public final class AlchemyPotionBrewer {
|
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) {
|
public static boolean isValidBrew(Player player, ItemStack[] contents) {
|
||||||
if (!isValidIngredient(player, contents[Alchemy.INGREDIENT_SLOT])) {
|
if (!isValidIngredient(player, contents[INGREDIENT_SLOT])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int bottle : BOTTLE_SLOTS) {
|
||||||
if (contents[i] == null || contents[i].getType() != Material.POTION) {
|
if (contents[bottle] != null && contents[bottle].getType() == Material.POTION) {
|
||||||
continue;
|
AlchemyPotion potion = PotionConfig.getInstance().potionMap.get(contents[bottle].getDurability());
|
||||||
}
|
|
||||||
|
|
||||||
if (getChildPotion(PotionConfig.getInstance().getPotion(contents[i].getDurability()), contents[Alchemy.INGREDIENT_SLOT]) != null) {
|
if (getChildPotion(potion, contents[INGREDIENT_SLOT]) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AlchemyPotion getChildPotion(AlchemyPotion potion, ItemStack ingredient) {
|
private static AlchemyPotion getChildPotion(AlchemyPotion potion, ItemStack ingredient) {
|
||||||
if (potion != null && potion.getChildDataValue(ingredient) != -1) {
|
if (potion != null && potion.getChildDataValue(ingredient) != -1) {
|
||||||
return PotionConfig.getInstance().getPotion(potion.getChildDataValue(ingredient));
|
return PotionConfig.getInstance().potionMap.get(potion.getChildDataValue(ingredient));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty(ItemStack item) {
|
private static boolean isEmpty(ItemStack item) {
|
||||||
return item == null || item.getType() == Material.AIR || item.getAmount() == 0;
|
return item == null || item.getType() == Material.AIR || item.getAmount() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean removeIngredient(BrewerInventory inventory, Player player) {
|
private static boolean removeIngredient(BrewerInventory inventory, Player player) {
|
||||||
ItemStack ingredient = inventory.getIngredient().clone();
|
ItemStack ingredient = inventory.getIngredient();
|
||||||
|
|
||||||
if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) {
|
if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (ingredient.getAmount() <= 1) {
|
else if (ingredient.getAmount() <= 1) {
|
||||||
inventory.setIngredient(null);
|
inventory.setItem(INGREDIENT_SLOT, null);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ingredient.setAmount(ingredient.getAmount() - 1);
|
ingredient.setAmount(ingredient.getAmount() - 1);
|
||||||
inventory.setIngredient(ingredient);
|
inventory.setItem(INGREDIENT_SLOT, ingredient);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidIngredient(Player player, ItemStack item) {
|
private static boolean isValidIngredient(Player player, ItemStack item) {
|
||||||
if (isEmpty(item)) {
|
if (isEmpty(item)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -85,7 +95,28 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getValidIngredients(Player player) {
|
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) {
|
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||||
@@ -100,60 +131,38 @@ public final class AlchemyPotionBrewer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int bottle : BOTTLE_SLOTS) {
|
||||||
ItemStack item = inventory.getItem(i);
|
if (!isEmpty(inventory.getItem(bottle)) && PotionConfig.getInstance().potionMap.containsKey(inventory.getItem(bottle).getDurability())) {
|
||||||
|
AlchemyPotion input = PotionConfig.getInstance().potionMap.get(inventory.getItem(bottle).getDurability());
|
||||||
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
|
AlchemyPotion output = PotionConfig.getInstance().potionMap.get(input.getChildDataValue(ingredient));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
|
|
||||||
AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
|
|
||||||
|
|
||||||
if (output != null) {
|
if (output != null) {
|
||||||
inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
|
inventory.setItem(bottle, output.toItemStack(inventory.getItem(bottle).getAmount()).clone());
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
|
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!forced) {
|
if (!forced) {
|
||||||
scheduleUpdate(inventory);
|
scheduleUpdate(inventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
private static boolean transferOneItem(InventoryView view, int fromSlot, int toSlot) {
|
||||||
ItemStack from = view.getItem(fromSlot).clone();
|
ItemStack from = view.getItem(fromSlot).clone();
|
||||||
ItemStack to = view.getItem(toSlot).clone();
|
ItemStack to = view.getItem(toSlot).clone();
|
||||||
boolean emptyFrom = isEmpty(from);
|
|
||||||
|
|
||||||
if (emptyFrom) {
|
if (isEmpty(from)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (!isEmpty(to) && from.getAmount() >= from.getType().getMaxStackSize()) {
|
||||||
boolean emptyTo = isEmpty(to);
|
|
||||||
int fromAmount = from.getAmount();
|
|
||||||
|
|
||||||
if (!emptyTo && fromAmount >= from.getType().getMaxStackSize()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (emptyTo || from.isSimilar(to)) {
|
else if (isEmpty(to) || from.isSimilar(to)) {
|
||||||
if (emptyTo) {
|
if (isEmpty(to)) {
|
||||||
to = from.clone();
|
to = from.clone();
|
||||||
to.setAmount(1);
|
to.setAmount(1);
|
||||||
}
|
}
|
||||||
@@ -161,9 +170,9 @@ public final class AlchemyPotionBrewer {
|
|||||||
to.setAmount(to.getAmount() + 1);
|
to.setAmount(to.getAmount() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
from.setAmount(fromAmount - 1);
|
from.setAmount(from.getAmount() - 1);
|
||||||
view.setItem(toSlot, emptyTo ? null : to);
|
view.setItem(toSlot, isEmpty(to) ? null : to);
|
||||||
view.setItem(fromSlot, emptyFrom ? null : from);
|
view.setItem(fromSlot, isEmpty(from) ? null : from);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -175,50 +184,171 @@ public final class AlchemyPotionBrewer {
|
|||||||
* Transfer items between two ItemStacks, returning the leftover status
|
* Transfer items between two ItemStacks, returning the leftover status
|
||||||
*/
|
*/
|
||||||
private static boolean transferItems(InventoryView view, int fromSlot, int toSlot) {
|
private static boolean transferItems(InventoryView view, int fromSlot, int toSlot) {
|
||||||
ItemStack from = view.getItem(fromSlot).clone();
|
if (isEmpty(view.getItem(fromSlot))) {
|
||||||
ItemStack to = view.getItem(toSlot).clone();
|
|
||||||
|
|
||||||
if (isEmpty(from)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (isEmpty(to)) {
|
else if (isEmpty(view.getItem(toSlot))) {
|
||||||
view.setItem(toSlot, from);
|
view.setItem(toSlot, view.getItem(fromSlot).clone());
|
||||||
view.setItem(fromSlot, null);
|
view.setItem(fromSlot, null);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (from.isSimilar(to)) {
|
else if (view.getItem(fromSlot).isSimilar(view.getItem(toSlot))) {
|
||||||
int fromAmount = from.getAmount();
|
if (view.getItem(fromSlot).getAmount() + view.getItem(toSlot).getAmount() > view.getItem(toSlot).getType().getMaxStackSize()) {
|
||||||
int toAmount = to.getAmount();
|
int left = view.getItem(fromSlot).getAmount() + view.getItem(toSlot).getAmount() - view.getItem(toSlot).getType().getMaxStackSize();
|
||||||
int maxSize = to.getType().getMaxStackSize();
|
|
||||||
|
|
||||||
if (fromAmount + toAmount > maxSize) {
|
ItemStack to = new ItemStack(view.getItem(toSlot));
|
||||||
int left = fromAmount + toAmount - maxSize;
|
to.setAmount(to.getType().getMaxStackSize());
|
||||||
|
|
||||||
to.setAmount(maxSize);
|
|
||||||
view.setItem(toSlot, to);
|
view.setItem(toSlot, to);
|
||||||
|
|
||||||
|
ItemStack from = new ItemStack(view.getItem(fromSlot));
|
||||||
from.setAmount(left);
|
from.setAmount(left);
|
||||||
view.setItem(fromSlot, from);
|
view.setItem(fromSlot, from);
|
||||||
|
|
||||||
return true;
|
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(fromSlot, null);
|
||||||
view.setItem(toSlot, to);
|
view.setItem(toSlot, to);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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)) {
|
||||||
|
if (event.getClick() == ClickType.NUMBER_KEY) {
|
||||||
|
scheduleCheck(player, brewingStand);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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);
|
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void scheduleUpdate(Inventory inventory) {
|
private static void scheduleUpdate(Inventory inventory) {
|
||||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||||
if (humanEntity instanceof Player) {
|
if (humanEntity instanceof Player) {
|
||||||
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
|
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
|
||||||
|
|||||||
@@ -91,14 +91,6 @@ public class RepairManager extends SkillManager {
|
|||||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||||
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
||||||
|
|
||||||
short startDurability = item.getDurability();
|
|
||||||
|
|
||||||
// Do not repair if at full durability
|
|
||||||
if (startDurability <= 0) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if they have the proper material to repair with
|
// Check if they have the proper material to repair with
|
||||||
if (!inventory.contains(repairMaterial)) {
|
if (!inventory.contains(repairMaterial)) {
|
||||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
||||||
@@ -111,6 +103,14 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short startDurability = item.getDurability();
|
||||||
|
|
||||||
|
// Do not repair if at full durability
|
||||||
|
if (startDurability <= 0) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do not repair stacked items
|
// Do not repair stacked items
|
||||||
if (item.getAmount() != 1) {
|
if (item.getAmount() != 1) {
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
||||||
@@ -148,7 +148,7 @@ public class RepairManager extends SkillManager {
|
|||||||
|
|
||||||
// BWONG BWONG BWONG
|
// BWONG BWONG BWONG
|
||||||
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
||||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
mcMMOPlayer.playSound(Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repair the item!
|
// Repair the item!
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setItemInHand(heldItemAmount == summonAmount ? null : new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
|
||||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,11 @@ public final class Misc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void profileCleanup(String playerName) {
|
public static void profileCleanup(String playerName) {
|
||||||
|
UserManager.remove(playerName);
|
||||||
|
|
||||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UserManager.remove(player);
|
|
||||||
UserManager.addUser(player);
|
UserManager.addUser(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,8 @@ public final class Motd {
|
|||||||
* @param version Plugin version
|
* @param version Plugin version
|
||||||
*/
|
*/
|
||||||
public static void displayVersion(Player player, String version) {
|
public static void displayVersion(Player player, String version) {
|
||||||
if (Permissions.showversion(player)) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("MOTD.Version", version));
|
player.sendMessage(LocaleLoader.getString("MOTD.Version", version));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display Hardcore Mode settings.
|
* Display Hardcore Mode settings.
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public final class Permissions {
|
|||||||
public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); }
|
public static boolean mobHealthDisplay(Permissible permissible) { return permissible.hasPermission("mcmmo.mobhealthdisplay"); }
|
||||||
public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); }
|
public static boolean updateNotifications(Permissible permissible) {return permissible.hasPermission("mcmmo.tools.updatecheck"); }
|
||||||
public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); }
|
public static boolean chimaeraWing(Permissible permissible) { return permissible.hasPermission("mcmmo.item.chimaerawing"); }
|
||||||
public static boolean showversion(Permissible permissible) { return permissible.hasPermission("mcmmo.showversion"); }
|
|
||||||
|
|
||||||
/* BYPASS */
|
/* BYPASS */
|
||||||
public static boolean hardcoreBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.hardcoremode"); }
|
public static boolean hardcoreBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.hardcoremode"); }
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package com.gmail.nossr50.util.player;
|
package com.gmail.nossr50.util.player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
|
||||||
public final class UserManager {
|
public final class UserManager {
|
||||||
|
private final static Map<String, McMMOPlayer> players = new HashMap<String, McMMOPlayer>();
|
||||||
|
|
||||||
private UserManager() {}
|
private UserManager() {}
|
||||||
|
|
||||||
@@ -24,8 +23,16 @@ public final class UserManager {
|
|||||||
* @return the player's {@link McMMOPlayer} object
|
* @return the player's {@link McMMOPlayer} object
|
||||||
*/
|
*/
|
||||||
public static McMMOPlayer addUser(Player player) {
|
public static McMMOPlayer addUser(Player player) {
|
||||||
McMMOPlayer mcMMOPlayer = new McMMOPlayer(player);
|
String playerName = player.getName();
|
||||||
player.setMetadata(mcMMO.playerDataKey, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
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;
|
return mcMMOPlayer;
|
||||||
}
|
}
|
||||||
@@ -33,51 +40,35 @@ public final class UserManager {
|
|||||||
/**
|
/**
|
||||||
* Remove a user.
|
* Remove a user.
|
||||||
*
|
*
|
||||||
* @param player The Player object
|
* @param playerName The name of the player to remove
|
||||||
*/
|
*/
|
||||||
public static void remove(Player player) {
|
public static void remove(String playerName) {
|
||||||
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
|
players.remove(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all users.
|
* Clear all users.
|
||||||
*/
|
*/
|
||||||
public static void clearAll() {
|
public static void clearAll() {
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
players.clear();
|
||||||
remove(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save all users.
|
* Save all users.
|
||||||
*/
|
*/
|
||||||
public static void saveAll() {
|
public static void saveAll() {
|
||||||
Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers();
|
mcMMO.p.debug("Saving mcMMOPlayers... (" + players.size() + ")");
|
||||||
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.length + ")");
|
for (McMMOPlayer mcMMOPlayer : players.values()) {
|
||||||
|
mcMMOPlayer.getProfile().save();
|
||||||
for (Player player : onlinePlayers) {
|
|
||||||
getPlayer(player).getProfile().save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getPlayerNames() {
|
public static Set<String> getPlayerNames() {
|
||||||
Set<String> playerNames = new HashSet<String>();
|
return players.keySet();
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
||||||
playerNames.add(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return playerNames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<McMMOPlayer> getPlayers() {
|
public static Collection<McMMOPlayer> getPlayers() {
|
||||||
Collection<McMMOPlayer> playerCollection = new ArrayList<McMMOPlayer>();
|
return players.values();
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
||||||
playerCollection.add(getPlayer(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
return playerCollection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,16 +88,10 @@ public final class UserManager {
|
|||||||
* @return the player's McMMOPlayer object
|
* @return the player's McMMOPlayer object
|
||||||
*/
|
*/
|
||||||
public static McMMOPlayer getPlayer(OfflinePlayer player) {
|
public static McMMOPlayer getPlayer(OfflinePlayer player) {
|
||||||
if (player instanceof Player) {
|
|
||||||
return getPlayer((Player) player);
|
|
||||||
}
|
|
||||||
return retrieveMcMMOPlayer(player.getName(), false);
|
return retrieveMcMMOPlayer(player.getName(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static McMMOPlayer getPlayer(OfflinePlayer player, boolean offlineValid) {
|
public static McMMOPlayer getPlayer(OfflinePlayer player, boolean offlineValid) {
|
||||||
if (player instanceof Player) {
|
|
||||||
return getPlayer((Player) player);
|
|
||||||
}
|
|
||||||
return retrieveMcMMOPlayer(player.getName(), offlineValid);
|
return retrieveMcMMOPlayer(player.getName(), offlineValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +99,10 @@ public final class UserManager {
|
|||||||
return retrieveMcMMOPlayer(playerName, offlineValid);
|
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) {
|
private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {
|
||||||
|
McMMOPlayer mcMMOPlayer = players.get(playerName);
|
||||||
|
|
||||||
|
if (mcMMOPlayer == null) {
|
||||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
@@ -129,14 +113,10 @@ public final class UserManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getPlayer(player);
|
mcMMOPlayer = new McMMOPlayer(player);
|
||||||
|
players.put(playerName, mcMMOPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPlayerDataKey(Entity entity) {
|
return mcMMOPlayer;
|
||||||
if (entity == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return entity.hasMetadata(mcMMO.playerDataKey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public final class CombatUtils {
|
|||||||
if (attacker instanceof Player && entityType == EntityType.PLAYER) {
|
if (attacker instanceof Player && entityType == EntityType.PLAYER) {
|
||||||
Player player = (Player) attacker;
|
Player player = (Player) attacker;
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (Misc.isNPCEntity(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.1=[[YELLOW]]Type [[GREEN]]/party alliance accept[[YELLOW]] to accept the invite
|
||||||
Commands.Party.Alliance.Invite.Accepted=[[GREEN]]Alliance invite Accepted.
|
Commands.Party.Alliance.Invite.Accepted=[[GREEN]]Alliance invite Accepted.
|
||||||
Commands.Party.Alliance.None=[[RED]]Your does not have an ally.
|
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.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.Party.Alliance.Help.1=[[RED]] to an alliance with [[DARK_AQUA]]/party alliance invite <player>[[RED]].
|
||||||
Commands.ptp.Enabled=Party teleporting [[GREEN]]enabled
|
Commands.ptp.Enabled=Party teleporting [[GREEN]]enabled
|
||||||
|
|||||||
@@ -1937,9 +1937,6 @@ permissions:
|
|||||||
children:
|
children:
|
||||||
mcmmo.ability.woodcutting.all: true
|
mcmmo.ability.woodcutting.all: true
|
||||||
mcmmo.commands.woodcutting: true
|
mcmmo.commands.woodcutting: true
|
||||||
mcmmo.showversion:
|
|
||||||
default: true
|
|
||||||
description: Show mcMMO version number in /mcmmo and motd
|
|
||||||
mcmmo.tools.*:
|
mcmmo.tools.*:
|
||||||
default: false
|
default: false
|
||||||
description: Implies all mcmmo.tools permissions.
|
description: Implies all mcmmo.tools permissions.
|
||||||
|
|||||||
@@ -116,27 +116,32 @@ Potions:
|
|||||||
### DRINKABLE POTIONS ######################################################
|
### DRINKABLE POTIONS ######################################################
|
||||||
|
|
||||||
8194: # Potion of Swiftness
|
8194: # Potion of Swiftness
|
||||||
|
Effects: ["SPEED 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8202
|
FERMENTED_SPIDER_EYE: 8202
|
||||||
GLOWSTONE_DUST: 8226
|
GLOWSTONE_DUST: 8226
|
||||||
REDSTONE: 8258
|
REDSTONE: 8258
|
||||||
SULPHUR: 16386
|
SULPHUR: 16386
|
||||||
8226: # Potion of Swiftness II
|
8226: # Potion of Swiftness II
|
||||||
|
Effects: ["SPEED 1 1800"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8266
|
FERMENTED_SPIDER_EYE: 8266
|
||||||
REDSTONE: 8258
|
REDSTONE: 8258
|
||||||
SULPHUR: 16418
|
SULPHUR: 16418
|
||||||
8258: # Potion of Swiftness Extended
|
8258: # Potion of Swiftness Extended
|
||||||
|
Effects: ["SPEED 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8202
|
FERMENTED_SPIDER_EYE: 8202
|
||||||
GLOWSTONE_DUST: 8226
|
GLOWSTONE_DUST: 8226
|
||||||
SULPHUR: 16450
|
SULPHUR: 16450
|
||||||
|
|
||||||
8202: # Potion of Slowness
|
8202: # Potion of Slowness
|
||||||
|
Effects: ["SLOW 0 1800"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 8266
|
REDSTONE: 8266
|
||||||
SULPHUR: 16394
|
SULPHUR: 16394
|
||||||
8266: # Potion of Slowness Extended
|
8266: # Potion of Slowness Extended
|
||||||
|
Effects: ["SLOW 0 4800"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 8202
|
GLOWSTONE_DUST: 8202
|
||||||
SULPHUR: 16458
|
SULPHUR: 16458
|
||||||
@@ -178,38 +183,45 @@ Potions:
|
|||||||
SULPHUR: 17472
|
SULPHUR: 17472
|
||||||
|
|
||||||
8201: # Potion of Strength
|
8201: # Potion of Strength
|
||||||
|
Effects: ["INCREASE_DAMAGE 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8200
|
FERMENTED_SPIDER_EYE: 8200
|
||||||
GLOWSTONE_DUST: 8233
|
GLOWSTONE_DUST: 8233
|
||||||
REDSTONE: 8265
|
REDSTONE: 8265
|
||||||
SULPHUR: 16393
|
SULPHUR: 16393
|
||||||
8233: # Potion of Strength II
|
8233: # Potion of Strength II
|
||||||
|
Effects: ["INCREASE_DAMAGE 1 1800"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8200
|
FERMENTED_SPIDER_EYE: 8200
|
||||||
REDSTONE: 8265
|
REDSTONE: 8265
|
||||||
SULPHUR: 16425
|
SULPHUR: 16425
|
||||||
8265: # Potion of Strength Extended
|
8265: # Potion of Strength Extended
|
||||||
|
Effects: ["INCREASE_DAMAGE 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8264
|
FERMENTED_SPIDER_EYE: 8264
|
||||||
GLOWSTONE_DUST: 8233
|
GLOWSTONE_DUST: 8233
|
||||||
SULPHUR: 16457
|
SULPHUR: 16457
|
||||||
|
|
||||||
8197: # Potion of Healing
|
8197: # Potion of Healing
|
||||||
|
Effects: ["HEAL 0"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8204
|
FERMENTED_SPIDER_EYE: 8204
|
||||||
GLOWSTONE_DUST: 8229
|
GLOWSTONE_DUST: 8229
|
||||||
SULPHUR: 16389
|
SULPHUR: 16389
|
||||||
8229: # Potion of Healing II
|
8229: # Potion of Healing II
|
||||||
|
Effects: ["HEAL 1"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8236
|
FERMENTED_SPIDER_EYE: 8236
|
||||||
REDSTONE: 8197
|
REDSTONE: 8197
|
||||||
SULPHUR: 16421
|
SULPHUR: 16421
|
||||||
|
|
||||||
8204: # Potion of Harming
|
8204: # Potion of Harming
|
||||||
|
Effects: ["HARM 0"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 8236
|
GLOWSTONE_DUST: 8236
|
||||||
SULPHUR: 16396
|
SULPHUR: 16396
|
||||||
8236: # Potion of Harming II
|
8236: # Potion of Harming II
|
||||||
|
Effects: ["HARM 1"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 8204
|
REDSTONE: 8204
|
||||||
SULPHUR: 16428
|
SULPHUR: 16428
|
||||||
@@ -243,17 +255,20 @@ Potions:
|
|||||||
SULPHUR: 18752
|
SULPHUR: 18752
|
||||||
|
|
||||||
8193: # Potion of Regeneration
|
8193: # Potion of Regeneration
|
||||||
|
Effects: ["REGENERATION 0 900"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8200
|
FERMENTED_SPIDER_EYE: 8200
|
||||||
GLOWSTONE_DUST: 8225
|
GLOWSTONE_DUST: 8225
|
||||||
REDSTONE: 8257
|
REDSTONE: 8257
|
||||||
SULPHUR: 16385
|
SULPHUR: 16385
|
||||||
8225: # Potion of Regeneration II
|
8225: # Potion of Regeneration II
|
||||||
|
Effects: ["REGENERATION 1 450"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8200
|
FERMENTED_SPIDER_EYE: 8200
|
||||||
REDSTONE: 8257
|
REDSTONE: 8257
|
||||||
SULPHUR: 16417
|
SULPHUR: 16417
|
||||||
8257: # Potion of Regeneration Extended
|
8257: # Potion of Regeneration Extended
|
||||||
|
Effects: ["REGENERATION 0 2400"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8264
|
FERMENTED_SPIDER_EYE: 8264
|
||||||
GLOWSTONE_DUST: 8225
|
GLOWSTONE_DUST: 8225
|
||||||
@@ -277,32 +292,38 @@ Potions:
|
|||||||
SULPHUR: 19264
|
SULPHUR: 19264
|
||||||
|
|
||||||
8195: # Potion of Fire Resistance
|
8195: # Potion of Fire Resistance
|
||||||
|
Effects: ["FIRE_RESISTANCE 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8202
|
FERMENTED_SPIDER_EYE: 8202
|
||||||
REDSTONE: 8259
|
REDSTONE: 3139
|
||||||
SULPHUR: 16387
|
SULPHUR: 16387
|
||||||
8259: # Potion of Fire Resistance Extended
|
3139: # Potion of Fire Resistance Extended
|
||||||
|
Effects: ["FIRE_RESISTANCE 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8266
|
FERMENTED_SPIDER_EYE: 8266
|
||||||
GLOWSTONE_DUST: 8195
|
GLOWSTONE_DUST: 8195
|
||||||
SULPHUR: 16451
|
SULPHUR: 16451
|
||||||
|
|
||||||
8205: # Potion of Water Breathing
|
8205: # Potion of Water Breathing
|
||||||
|
Effects: ["WATER_BREATHING 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 8269
|
REDSTONE: 3405
|
||||||
SULPHUR: 16397
|
SULPHUR: 16397
|
||||||
8269: # Potion of Water Breathing Extended
|
3405: # Potion of Water Breathing Extended
|
||||||
|
Effects: ["WATER_BREATHING 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 8205
|
GLOWSTONE_DUST: 8205
|
||||||
SULPHUR: 16461
|
SULPHUR: 16461
|
||||||
|
|
||||||
8206: # Potion of Invisibility
|
3598: # Potion of Invisibility
|
||||||
|
Effects: ["INVISIBILITY 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 8270
|
REDSTONE: 3662
|
||||||
SULPHUR: 16398
|
SULPHUR: 16398
|
||||||
8270: # Potion of Invisibility Extended
|
3662: # Potion of Invisibility Extended
|
||||||
|
Effects: ["INVISIBILITY 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 8206
|
GLOWSTONE_DUST: 3598
|
||||||
SULPHUR: 16462
|
SULPHUR: 16462
|
||||||
|
|
||||||
3840: # Potion of Blindness
|
3840: # Potion of Blindness
|
||||||
@@ -317,13 +338,15 @@ Potions:
|
|||||||
SULPHUR: 20288
|
SULPHUR: 20288
|
||||||
|
|
||||||
8198: # Potion of Night Vision
|
8198: # Potion of Night Vision
|
||||||
|
Effects: ["NIGHT_VISION 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8206
|
FERMENTED_SPIDER_EYE: 3598
|
||||||
REDSTONE: 8262
|
REDSTONE: 4166
|
||||||
SULPHUR: 16390
|
SULPHUR: 16390
|
||||||
8262: # Potion of Night Vision Extended
|
4166: # Potion of Night Vision Extended
|
||||||
|
Effects: ["NIGHT_VISION 0 9600"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8270
|
FERMENTED_SPIDER_EYE: 3662
|
||||||
GLOWSTONE_DUST: 8198
|
GLOWSTONE_DUST: 8198
|
||||||
SULPHUR: 16454
|
SULPHUR: 16454
|
||||||
|
|
||||||
@@ -345,26 +368,31 @@ Potions:
|
|||||||
SULPHUR: 20800
|
SULPHUR: 20800
|
||||||
|
|
||||||
8200: # Potion of Weakness
|
8200: # Potion of Weakness
|
||||||
|
Effects: ["WEAKNESS 0 1800"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 8264
|
REDSTONE: 8264
|
||||||
SULPHUR: 16392
|
SULPHUR: 16392
|
||||||
8264: # Potion of Weakness Extended
|
8264: # Potion of Weakness Extended
|
||||||
|
Effects: ["WEAKNESS 0 4800"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 8200
|
GLOWSTONE_DUST: 8200
|
||||||
SULPHUR: 16456
|
SULPHUR: 16456
|
||||||
|
|
||||||
8196: # Potion of Poison
|
8196: # Potion of Poison
|
||||||
|
Effects: ["POISON 0 900"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8204
|
FERMENTED_SPIDER_EYE: 8204
|
||||||
GLOWSTONE_DUST: 8228
|
GLOWSTONE_DUST: 8228
|
||||||
REDSTONE: 8260
|
REDSTONE: 8260
|
||||||
SULPHUR: 16388
|
SULPHUR: 16388
|
||||||
8228: # Potion of Poison II
|
8228: # Potion of Poison II
|
||||||
|
Effects: ["POISON 1 450"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8236
|
FERMENTED_SPIDER_EYE: 8236
|
||||||
REDSTONE: 8260
|
REDSTONE: 8260
|
||||||
SULPHUR: 16420
|
SULPHUR: 16452
|
||||||
8260: # Potion of Poison Extended
|
8260: # Potion of Poison Extended
|
||||||
|
Effects: ["POISON 0 2400"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 8204
|
FERMENTED_SPIDER_EYE: 8204
|
||||||
GLOWSTONE_DUST: 8228
|
GLOWSTONE_DUST: 8228
|
||||||
@@ -439,23 +467,28 @@ Potions:
|
|||||||
FERMENTED_SPIDER_EYE: 16392
|
FERMENTED_SPIDER_EYE: 16392
|
||||||
|
|
||||||
16386: # Splash Potion of Swiftness
|
16386: # Splash Potion of Swiftness
|
||||||
|
Effects: ["SPEED 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16394
|
FERMENTED_SPIDER_EYE: 16394
|
||||||
GLOWSTONE_DUST: 16418
|
GLOWSTONE_DUST: 16418
|
||||||
REDSTONE: 16450
|
REDSTONE: 16450
|
||||||
16418: # Splash Potion of Swiftness II
|
16418: # Splash Potion of Swiftness II
|
||||||
|
Effects: ["SPEED 1 1350"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16394
|
FERMENTED_SPIDER_EYE: 16394
|
||||||
REDSTONE: 16450
|
REDSTONE: 16450
|
||||||
16450: # Splash Potion of Swiftness Extended
|
16450: # Splash Potion of Swiftness Extended
|
||||||
|
Effects: ["SPEED 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16394
|
FERMENTED_SPIDER_EYE: 16394
|
||||||
GLOWSTONE_DUST: 16418
|
GLOWSTONE_DUST: 16418
|
||||||
|
|
||||||
16394: # Splash Potion of Slowness
|
16394: # Splash Potion of Slowness
|
||||||
|
Effects: ["SLOW 0 1350"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 16458
|
REDSTONE: 16458
|
||||||
16458: # Splash Potion of Slowness Extended
|
16458: # Splash Potion of Slowness Extended
|
||||||
|
Effects: ["SLOW 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 16394
|
GLOWSTONE_DUST: 16394
|
||||||
|
|
||||||
@@ -488,32 +521,39 @@ Potions:
|
|||||||
GLOWSTONE_DUST: 17440
|
GLOWSTONE_DUST: 17440
|
||||||
|
|
||||||
16393: # Splash Potion of Strength
|
16393: # Splash Potion of Strength
|
||||||
|
Effects: ["INCREASE_DAMAGE 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16392
|
FERMENTED_SPIDER_EYE: 16392
|
||||||
GLOWSTONE_DUST: 16425
|
GLOWSTONE_DUST: 16425
|
||||||
REDSTONE: 16457
|
REDSTONE: 16457
|
||||||
16425: # Splash Potion of Strength II
|
16425: # Splash Potion of Strength II
|
||||||
|
Effects: ["INCREASE_DAMAGE 1 1350"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16392
|
FERMENTED_SPIDER_EYE: 16392
|
||||||
REDSTONE: 16457
|
REDSTONE: 16457
|
||||||
16457: # Splash Potion of Strength Extended
|
16457: # Splash Potion of Strength Extended
|
||||||
|
Effects: ["INCREASE_DAMAGE 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16456
|
FERMENTED_SPIDER_EYE: 16456
|
||||||
GLOWSTONE_DUST: 16425
|
GLOWSTONE_DUST: 16425
|
||||||
|
|
||||||
16389: # Splash Potion of Healing
|
16389: # Splash Potion of Healing
|
||||||
|
Effects: ["HEAL 0"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16396
|
FERMENTED_SPIDER_EYE: 16396
|
||||||
GLOWSTONE_DUST: 16421
|
GLOWSTONE_DUST: 16421
|
||||||
16421: # Splash Potion of Healing II
|
16421: # Splash Potion of Healing II
|
||||||
|
Effects: ["HEAL 1"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16428
|
FERMENTED_SPIDER_EYE: 16428
|
||||||
REDSTONE: 16389
|
REDSTONE: 16389
|
||||||
|
|
||||||
16396: # Splash Potion of Harming
|
16396: # Splash Potion of Harming
|
||||||
|
Effects: ["HARM 0"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 16428
|
GLOWSTONE_DUST: 16428
|
||||||
16428: # Splash Potion of Harming II
|
16428: # Splash Potion of Harming II
|
||||||
|
Effects: ["HARM 1"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 16396
|
REDSTONE: 16396
|
||||||
|
|
||||||
@@ -541,15 +581,18 @@ Potions:
|
|||||||
GLOWSTONE_DUST: 18688
|
GLOWSTONE_DUST: 18688
|
||||||
|
|
||||||
16385: # Splash Potion of Regeneration
|
16385: # Splash Potion of Regeneration
|
||||||
|
Effects: ["REGENERATION 0 675"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16392
|
FERMENTED_SPIDER_EYE: 16392
|
||||||
GLOWSTONE_DUST: 16417
|
GLOWSTONE_DUST: 16417
|
||||||
REDSTONE: 16449
|
REDSTONE: 16449
|
||||||
16417: # Splash Potion of Regeneration II
|
16417: # Splash Potion of Regeneration II
|
||||||
|
Effects: ["REGENERATION 1 338"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16392
|
FERMENTED_SPIDER_EYE: 16392
|
||||||
REDSTONE: 16449
|
REDSTONE: 16449
|
||||||
16449: # Splash Potion of Regeneration Extended
|
16449: # Splash Potion of Regeneration Extended
|
||||||
|
Effects: ["REGENERATION 0 1800"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16456
|
FERMENTED_SPIDER_EYE: 16456
|
||||||
GLOWSTONE_DUST: 16417
|
GLOWSTONE_DUST: 16417
|
||||||
@@ -569,25 +612,31 @@ Potions:
|
|||||||
GLOWSTONE_DUST: 19232
|
GLOWSTONE_DUST: 19232
|
||||||
|
|
||||||
16387: # Splash Potion of Fire Resistance
|
16387: # Splash Potion of Fire Resistance
|
||||||
|
Effects: ["FIRE_RESISTANCE 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16394
|
FERMENTED_SPIDER_EYE: 16394
|
||||||
REDSTONE: 16451
|
REDSTONE: 16451
|
||||||
16451: # Splash Potion of Fire Resistance Extended
|
16451: # Splash Potion of Fire Resistance Extended
|
||||||
|
Effects: ["FIRE_RESISTANCE 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16458
|
FERMENTED_SPIDER_EYE: 16458
|
||||||
GLOWSTONE_DUST: 16387
|
GLOWSTONE_DUST: 16387
|
||||||
|
|
||||||
16397: # Splash Potion of Water Breathing
|
16397: # Splash Potion of Water Breathing
|
||||||
|
Effects: ["WATER_BREATHING 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 16461
|
REDSTONE: 16461
|
||||||
16461: # Splash Potion of Water Breathing Extended
|
16461: # Splash Potion of Water Breathing Extended
|
||||||
|
Effects: ["WATER_BREATHING 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 16397
|
GLOWSTONE_DUST: 16397
|
||||||
|
|
||||||
16398: # Splash Potion of Invisibility
|
16398: # Splash Potion of Invisibility
|
||||||
|
Effects: ["INVISIBILITY 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 16462
|
REDSTONE: 16462
|
||||||
16462: # Splash Potion of Invisibility Extended
|
16462: # Splash Potion of Invisibility Extended
|
||||||
|
Effects: ["INVISIBILITY 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 16398
|
GLOWSTONE_DUST: 16398
|
||||||
|
|
||||||
@@ -601,10 +650,12 @@ Potions:
|
|||||||
GLOWSTONE_DUST: 20224
|
GLOWSTONE_DUST: 20224
|
||||||
|
|
||||||
16390: # Splash Potion of Night Vision
|
16390: # Splash Potion of Night Vision
|
||||||
|
Effects: ["NIGHT_VISION 0 2700"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16398
|
FERMENTED_SPIDER_EYE: 16398
|
||||||
REDSTONE: 16454
|
REDSTONE: 16454
|
||||||
16454: # Splash Potion of Night Vision Extended
|
16454: # Splash Potion of Night Vision Extended
|
||||||
|
Effects: ["NIGHT_VISION 0 7200"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16462
|
FERMENTED_SPIDER_EYE: 16462
|
||||||
GLOWSTONE_DUST: 16390
|
GLOWSTONE_DUST: 16390
|
||||||
@@ -624,25 +675,30 @@ Potions:
|
|||||||
GLOWSTONE_DUST: 20768
|
GLOWSTONE_DUST: 20768
|
||||||
|
|
||||||
16392: # Splash Potion of Weakness
|
16392: # Splash Potion of Weakness
|
||||||
|
Effects: ["WEAKNESS 0 1350"]
|
||||||
Children:
|
Children:
|
||||||
REDSTONE: 16456
|
REDSTONE: 16456
|
||||||
16456: # Splash Potion of Weakness Extended
|
16456: # Splash Potion of Weakness Extended
|
||||||
|
Effects: ["WEAKNESS 0 3600"]
|
||||||
Children:
|
Children:
|
||||||
GLOWSTONE_DUST: 16392
|
GLOWSTONE_DUST: 16392
|
||||||
|
|
||||||
16388: # Splash Potion of Poison
|
16388: # Splash Potion of Poison
|
||||||
|
Effects: ["POISON 0 675"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16396
|
FERMENTED_SPIDER_EYE: 16396
|
||||||
GLOWSTONE_DUST: 16420
|
GLOWSTONE_DUST: 16452
|
||||||
REDSTONE: 16452
|
REDSTONE: 16452
|
||||||
16420: # Splash Potion of Poison II
|
16452: # Splash Potion of Poison II
|
||||||
|
Effects: ["POISON 1 338"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16428
|
FERMENTED_SPIDER_EYE: 16428
|
||||||
REDSTONE: 16452
|
REDSTONE: 16452
|
||||||
16452: # Splash Potion of Poison Extended
|
16452: # Splash Potion of Poison Extended
|
||||||
|
Effects: ["POISON 0 1800"]
|
||||||
Children:
|
Children:
|
||||||
FERMENTED_SPIDER_EYE: 16396
|
FERMENTED_SPIDER_EYE: 16396
|
||||||
GLOWSTONE_DUST: 16420
|
GLOWSTONE_DUST: 16452
|
||||||
|
|
||||||
21504: # Splash Potion of Decay
|
21504: # Splash Potion of Decay
|
||||||
Effects: ["WITHER 0 338"]
|
Effects: ["WITHER 0 338"]
|
||||||
|
|||||||
Reference in New Issue
Block a user