mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Quick and dirty 1.13 update. I.e. it now compiles for 1.13.
This commit is contained in:
parent
3d515aab23
commit
0a1559511a
4
pom.xml
4
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>1.5.10-SNAPSHOT</version>
|
<version>1.6.0-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.12.1-R0.1-SNAPSHOT</version>
|
<version>1.13-pre7-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class HerbalismCommand extends SkillCommand {
|
public class HerbalismCommand extends SkillCommand {
|
||||||
private String greenTerraLength;
|
private String greenTerraLength;
|
||||||
@ -87,8 +86,8 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
protected void permissionsCheck(Player player) {
|
protected void permissionsCheck(Player player) {
|
||||||
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
|
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
|
||||||
canGreenTerra = Permissions.greenTerra(player);
|
canGreenTerra = Permissions.greenTerra(player);
|
||||||
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
|
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA);
|
||||||
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
|
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS);
|
||||||
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
|
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
|
||||||
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||||
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
@ -18,6 +12,11 @@ import com.gmail.nossr50.skills.repair.RepairManager;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
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 org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class RepairCommand extends SkillCommand {
|
public class RepairCommand extends SkillCommand {
|
||||||
private String repairMasteryBonus;
|
private String repairMasteryBonus;
|
||||||
@ -49,7 +48,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||||
// We're using pickaxes here, not the best but it works
|
// We're using pickaxes here, not the best but it works
|
||||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE);
|
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
||||||
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
||||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
package com.gmail.nossr50.config.treasure;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import java.util.HashMap;
|
import com.gmail.nossr50.datatypes.treasure.*;
|
||||||
import java.util.List;
|
import com.gmail.nossr50.util.EnchantmentUtils;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -19,15 +19,9 @@ import org.bukkit.material.MaterialData;
|
|||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import java.util.ArrayList;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
import java.util.HashMap;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import java.util.List;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
|
||||||
import com.gmail.nossr50.util.EnchantmentUtils;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
|
|
||||||
public class TreasureConfig extends ConfigLoader {
|
public class TreasureConfig extends ConfigLoader {
|
||||||
|
|
||||||
@ -143,14 +137,14 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
Material material;
|
Material material;
|
||||||
|
|
||||||
if (materialName.contains("INK_SACK")) {
|
if (materialName.contains("INK_SACK")) {
|
||||||
material = Material.INK_SACK;
|
material = Material.INK_SAC;
|
||||||
} else if (materialName.contains("COAL")) {
|
} else if (materialName.contains("COAL")) {
|
||||||
material = Material.COAL;
|
material = Material.COAL;
|
||||||
} else if (materialName.contains("INVENTORY")) {
|
} else if (materialName.contains("INVENTORY")) {
|
||||||
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
|
// Use magic material BEDROCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||||
if (!shakeMap.containsKey(EntityType.PLAYER))
|
if (!shakeMap.containsKey(EntityType.PLAYER))
|
||||||
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
||||||
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BEDROCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
material = Material.matchMaterial(materialName);
|
material = Material.matchMaterial(materialName);
|
||||||
@ -323,9 +317,9 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
if (dropper.equals("Flowers")) {
|
if (dropper.equals("Flowers")) {
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.RED_ROSE, (byte) i)), hylianTreasure);
|
AddHylianTreasure(StringUtils.getFriendlyConfigMaterialDataString(new MaterialData(Material.ROSE_RED, (byte) i)), hylianTreasure);
|
||||||
}
|
}
|
||||||
AddHylianTreasure(StringUtils.getPrettyItemString(Material.YELLOW_FLOWER), hylianTreasure);
|
AddHylianTreasure(StringUtils.getPrettyItemString(Material.DANDELION), hylianTreasure);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (dropper.equals("Pots")) {
|
if (dropper.equals("Pots")) {
|
||||||
|
@ -1,22 +1,5 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.ResultSetMetaData;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
@ -25,11 +8,16 @@ import com.gmail.nossr50.datatypes.database.UpgradeType;
|
|||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
|
||||||
import org.apache.tomcat.jdbc.pool.DataSource;
|
import org.apache.tomcat.jdbc.pool.DataSource;
|
||||||
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
import org.apache.tomcat.jdbc.pool.PoolProperties;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
public final class SQLDatabaseManager implements DatabaseManager {
|
public final class SQLDatabaseManager implements DatabaseManager {
|
||||||
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
||||||
@ -337,7 +325,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
connection = getConnection(PoolIdentifier.MISC);
|
connection = getConnection(PoolIdentifier.MISC);
|
||||||
statement = connection.prepareStatement("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 AND NOT user = '\\_INVALID\\_OLD\\_USERNAME\\_' ORDER BY " + query + " DESC, user LIMIT ?, ?");
|
statement = connection.prepareStatement("SELECT " + query + ", user FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 AND NOT user = '\\_INVALID\\_OLD\\_USERNAME\\_' ORDER BY " + query + " DESC, user LIMIT ?, ?");
|
||||||
statement.setInt(1, (pageNumber * statsPerPage) - statsPerPage);
|
statement.setInt(1, (pageNumber * statsPerPage) - statsPerPage);
|
||||||
statement.setInt(2, statsPerPage);
|
statement.setInt(2, statsPerPage);
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
@ -1132,7 +1120,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
return DatabaseType.SQL;
|
return DatabaseType.SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNameUniqueness(final Statement statement) throws SQLException {
|
private void checkNameUniqueness(final Statement statement) {
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
try {
|
try {
|
||||||
resultSet = statement.executeQuery("SHOW INDEXES "
|
resultSet = statement.executeQuery("SHOW INDEXES "
|
||||||
@ -1205,7 +1193,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUpgradeAddSQLIndexes(final Statement statement) throws SQLException {
|
private void checkUpgradeAddSQLIndexes(final Statement statement) {
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1292,7 +1280,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!names.isEmpty()) {
|
if (!names.isEmpty()) {
|
||||||
new UUIDUpdateAsyncTask(mcMMO.p, names).run();;
|
new UUIDUpdateAsyncTask(mcMMO.p, names).run();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
massUpdateLock.unlock();
|
massUpdateLock.unlock();
|
||||||
@ -1415,7 +1403,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
public enum PoolIdentifier {
|
public enum PoolIdentifier {
|
||||||
MISC,
|
MISC,
|
||||||
LOAD,
|
LOAD,
|
||||||
SAVE;
|
SAVE
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetMobHealthSettings() {
|
public void resetMobHealthSettings() {
|
||||||
|
@ -21,7 +21,7 @@ public enum MaterialType {
|
|||||||
return Material.LEATHER;
|
return Material.LEATHER;
|
||||||
|
|
||||||
case WOOD:
|
case WOOD:
|
||||||
return Material.WOOD;
|
return Material.OAK_WOOD;
|
||||||
|
|
||||||
case STONE:
|
case STONE:
|
||||||
return Material.COBBLESTONE;
|
return Material.COBBLESTONE;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.events.fake;
|
package com.gmail.nossr50.events.fake;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Fish;
|
import org.bukkit.entity.FishHook;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
|
||||||
public class FakePlayerFishEvent extends PlayerFishEvent {
|
public class FakePlayerFishEvent extends PlayerFishEvent {
|
||||||
public FakePlayerFishEvent(Player player, Entity entity, Fish hookEntity, State state) {
|
public FakePlayerFishEvent(Player player, Entity entity, FishHook hookEntity, State state) {
|
||||||
super(player, entity, hookEntity, state);
|
super(player, entity, hookEntity, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.*;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTameEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
|
||||||
import org.bukkit.event.entity.PigZapEvent;
|
|
||||||
import org.bukkit.event.entity.PotionSplashEvent;
|
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -39,6 +7,7 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||||
@ -55,6 +24,23 @@ 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.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -122,8 +108,7 @@ public class EntityListener implements Listener {
|
|||||||
else if (isTracked) {
|
else if (isTracked) {
|
||||||
mcMMO.getPlaceStore().setTrue(block);
|
mcMMO.getPlaceStore().setTrue(block);
|
||||||
}
|
}
|
||||||
}
|
} else if ((block.getType() == Material.REDSTONE_ORE)) {
|
||||||
else if ((block.getType() == Material.REDSTONE_ORE || block.getType() == Material.GLOWING_REDSTONE_ORE) && (event.getTo() == Material.REDSTONE_ORE || event.getTo() == Material.GLOWING_REDSTONE_ORE)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -578,7 +563,7 @@ public class EntityListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
case BEETROOT:
|
case BEETROOT:
|
||||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||||
case CARROT_ITEM: /*
|
case CARROT: /*
|
||||||
* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @
|
* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @
|
||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
@ -586,7 +571,7 @@ public class EntityListener implements Listener {
|
|||||||
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
case MUSHROOM_SOUP: /*
|
case MUSHROOM_STEW: /*
|
||||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
@ -605,13 +590,13 @@ public class EntityListener implements Listener {
|
|||||||
* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER
|
* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER
|
||||||
* @ 1000
|
* @ 1000
|
||||||
*/
|
*/
|
||||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case COOKED_FISH: /*
|
case COOKED_SALMON: /*
|
||||||
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
@ -620,7 +605,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
case SALMON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
|
||||||
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.material.Dye;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.chat.ChatManager;
|
import com.gmail.nossr50.chat.ChatManager;
|
||||||
import com.gmail.nossr50.chat.ChatManagerFactory;
|
import com.gmail.nossr50.chat.ChatManagerFactory;
|
||||||
import com.gmail.nossr50.chat.PartyChatManager;
|
import com.gmail.nossr50.chat.PartyChatManager;
|
||||||
@ -44,6 +11,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
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.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.ShareHandler;
|
import com.gmail.nossr50.party.ShareHandler;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
||||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||||
@ -55,19 +23,22 @@ import com.gmail.nossr50.skills.salvage.Salvage;
|
|||||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.ChimaeraWing;
|
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
|
||||||
import com.gmail.nossr50.util.HardcoreManager;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
|
||||||
import com.gmail.nossr50.util.Motd;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
||||||
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;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -232,8 +203,8 @@ public class PlayerListener implements Listener {
|
|||||||
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
||||||
Item fishingCatch = (Item) event.getCaught();
|
Item fishingCatch = (Item) event.getCaught();
|
||||||
|
|
||||||
if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.RAW_FISH) {
|
if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.SALMON) {
|
||||||
fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
|
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
|
if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
|
||||||
@ -242,7 +213,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case IN_GROUND:
|
case IN_GROUND:
|
||||||
Block block = player.getTargetBlock((HashSet<Material>) null, 100);
|
Block block = player.getTargetBlock(null, 100);
|
||||||
|
|
||||||
if (fishingManager.canIceFish(block)) {
|
if (fishingManager.canIceFish(block)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -554,22 +525,20 @@ public class PlayerListener implements Listener {
|
|||||||
/* GREEN THUMB CHECK */
|
/* GREEN THUMB CHECK */
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
if (heldItem.getType() == Material.INK_SACK) {
|
if (heldItem.getType() == Material.BONE_MEAL) {
|
||||||
if (DyeColor.WHITE == ((Dye) heldItem.getData()).getColor()) {
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case BEETROOT_BLOCK:
|
case BEETROOTS:
|
||||||
case CARROT:
|
case CARROT:
|
||||||
case COCOA:
|
case COCOA:
|
||||||
case CROPS:
|
case WHEAT:
|
||||||
case NETHER_WARTS:
|
case NETHER_WART_BLOCK:
|
||||||
case POTATO:
|
case POTATO:
|
||||||
mcMMO.getPlaceStore().setFalse(blockState);
|
mcMMO.getPlaceStore().setFalse(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(Material.SEEDS, heldItem.getAmount() - 1));
|
player.getInventory().setItemInMainHand(new ItemStack(Material.WHEAT_SEEDS, heldItem.getAmount() - 1));
|
||||||
|
|
||||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
@ -28,12 +14,7 @@ import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager;
|
|||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||||
import com.gmail.nossr50.listeners.BlockListener;
|
import com.gmail.nossr50.listeners.*;
|
||||||
import com.gmail.nossr50.listeners.EntityListener;
|
|
||||||
import com.gmail.nossr50.listeners.InventoryListener;
|
|
||||||
import com.gmail.nossr50.listeners.PlayerListener;
|
|
||||||
import com.gmail.nossr50.listeners.SelfListener;
|
|
||||||
import com.gmail.nossr50.listeners.WorldListener;
|
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.CheckDateTask;
|
import com.gmail.nossr50.runnables.CheckDateTask;
|
||||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||||
@ -53,12 +34,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
|||||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.util.ChimaeraWing;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.HolidayManager;
|
|
||||||
import com.gmail.nossr50.util.LogFilter;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.ModManager;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||||
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
||||||
@ -67,8 +43,20 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class mcMMO extends JavaPlugin {
|
public class mcMMO extends JavaPlugin {
|
||||||
/* Managers */
|
/* Managers */
|
||||||
@ -439,10 +427,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
if (Config.getInstance().getFluxPickaxeEnabled()) {
|
if (Config.getInstance().getFluxPickaxeEnabled()) {
|
||||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.DIAMOND_PICKAXE));
|
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.DIAMOND_PICKAXE));
|
||||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.GOLD_PICKAXE));
|
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.GOLDEN_PICKAXE));
|
||||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.IRON_PICKAXE));
|
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.IRON_PICKAXE));
|
||||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.STONE_PICKAXE));
|
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.STONE_PICKAXE));
|
||||||
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.WOOD_PICKAXE));
|
getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.WOODEN_PICKAXE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,39 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.fishing;
|
package com.gmail.nossr50.skills.fishing;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.WeatherType;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Fish;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Sheep;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.entity.ThrownPotion;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
import org.bukkit.material.Wool;
|
|
||||||
import org.bukkit.potion.Potion;
|
|
||||||
import org.bukkit.potion.PotionType;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
@ -50,17 +16,28 @@ import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
|||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.fishing.Fishing.Tier;
|
import com.gmail.nossr50.skills.fishing.Fishing.Tier;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.potion.Potion;
|
||||||
|
import org.bukkit.potion.PotionType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class FishingManager extends SkillManager {
|
public class FishingManager extends SkillManager {
|
||||||
private final long FISHING_COOLDOWN_SECONDS = 1000L;
|
private final long FISHING_COOLDOWN_SECONDS = 1000L;
|
||||||
@ -104,7 +81,7 @@ public class FishingManager extends SkillManager {
|
|||||||
vehicle.remove();
|
vehicle.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
player.teleport(player.getTargetBlock((HashSet<Material>) null, 100).getLocation(), TeleportCause.PLUGIN);
|
player.teleport(player.getTargetBlock(null, 100).getLocation(), TeleportCause.PLUGIN);
|
||||||
|
|
||||||
String unleashMessage = AdvancedConfig.getInstance().getPlayerUnleashMessage();
|
String unleashMessage = AdvancedConfig.getInstance().getPlayerUnleashMessage();
|
||||||
|
|
||||||
@ -170,7 +147,7 @@ public class FishingManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block targetBlock = getPlayer().getTargetBlock((HashSet<Material>) BlockUtils.getTransparentBlocks(), 100);
|
Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||||
|
|
||||||
if (!targetBlock.isLiquid()) {
|
if (!targetBlock.isLiquid()) {
|
||||||
return false;
|
return false;
|
||||||
@ -201,7 +178,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this is a body of water, not just a block of ice.
|
// Make sure this is a body of water, not just a block of ice.
|
||||||
if (!Fishing.iceFishingBiomes.contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.STATIONARY_WATER)) {
|
if (!Fishing.iceFishingBiomes.contains(block.getBiome()) && (block.getRelative(BlockFace.DOWN, 3).getType() != Material.WATER)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,16 +237,16 @@ public class FishingManager extends SkillManager {
|
|||||||
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
|
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void iceFishing(Fish hook, Block block) {
|
public void iceFishing(FishHook hook, Block block) {
|
||||||
// Make a hole
|
// Make a hole
|
||||||
block.setType(Material.STATIONARY_WATER);
|
block.setType(Material.WATER);
|
||||||
|
|
||||||
for (int x = -1; x <= 1; x++) {
|
for (int x = -1; x <= 1; x++) {
|
||||||
for (int z = -1; z <= 1; z++) {
|
for (int z = -1; z <= 1; z++) {
|
||||||
Block relative = block.getRelative(x, 0, z);
|
Block relative = block.getRelative(x, 0, z);
|
||||||
|
|
||||||
if (relative.getType() == Material.ICE) {
|
if (relative.getType() == Material.ICE) {
|
||||||
relative.setType(Material.STATIONARY_WATER);
|
relative.setType(Material.WATER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +255,7 @@ public class FishingManager extends SkillManager {
|
|||||||
EventUtils.callFakeFishEvent(getPlayer(), hook);
|
EventUtils.callFakeFishEvent(getPlayer(), hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void masterAngler(Fish hook) {
|
public void masterAngler(FishHook hook) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Location location = hook.getLocation();
|
Location location = hook.getLocation();
|
||||||
double biteChance = hook.getBiteChance();
|
double biteChance = hook.getBiteChance();
|
||||||
@ -401,14 +378,14 @@ public class FishingManager extends SkillManager {
|
|||||||
Player targetPlayer = (Player) target;
|
Player targetPlayer = (Player) target;
|
||||||
|
|
||||||
switch (drop.getType()) {
|
switch (drop.getType()) {
|
||||||
case SKULL_ITEM:
|
case PLAYER_HEAD:
|
||||||
drop.setDurability((short) 3);
|
drop.setDurability((short) 3);
|
||||||
SkullMeta skullMeta = (SkullMeta) drop.getItemMeta();
|
SkullMeta skullMeta = (SkullMeta) drop.getItemMeta();
|
||||||
skullMeta.setOwner(targetPlayer.getName());
|
skullMeta.setOwningPlayer(targetPlayer);
|
||||||
drop.setItemMeta(skullMeta);
|
drop.setItemMeta(skullMeta);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BED_BLOCK:
|
case BEDROCK:
|
||||||
if (TreasureConfig.getInstance().getInventoryStealEnabled()) {
|
if (TreasureConfig.getInstance().getInventoryStealEnabled()) {
|
||||||
PlayerInventory inventory = targetPlayer.getInventory();
|
PlayerInventory inventory = targetPlayer.getInventory();
|
||||||
int length = inventory.getContents().length;
|
int length = inventory.getContents().length;
|
||||||
@ -439,20 +416,13 @@ public class FishingManager extends SkillManager {
|
|||||||
case SHEEP:
|
case SHEEP:
|
||||||
Sheep sheep = (Sheep) target;
|
Sheep sheep = (Sheep) target;
|
||||||
|
|
||||||
if (drop.getType() == Material.WOOL) {
|
if (drop.getType().name().endsWith("WOOL")) {
|
||||||
if (sheep.isSheared()) {
|
if (sheep.isSheared()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
drop = new Wool(sheep.getColor()).toItemStack(drop.getAmount());
|
|
||||||
sheep.setSheared(true);
|
sheep.setSheared(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WITHER_SKELETON:
|
|
||||||
if(drop.getType() == Material.SKULL_ITEM){
|
|
||||||
drop.setDurability((short) 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
package com.gmail.nossr50.skills.herbalism;
|
package com.gmail.nossr50.skills.herbalism;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.material.SmoothBrick;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Herbalism {
|
public class Herbalism {
|
||||||
|
|
||||||
@ -32,12 +28,12 @@ public class Herbalism {
|
|||||||
*/
|
*/
|
||||||
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case COBBLE_WALL :
|
case COBBLESTONE_WALL:
|
||||||
blockState.setRawData((byte) 0x1);
|
blockState.setType(Material.MOSSY_COBBLESTONE_WALL);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SMOOTH_BRICK :
|
case STONE_BRICKS:
|
||||||
((SmoothBrick) blockState.getData()).setMaterial(Material.MOSSY_COBBLESTONE);
|
blockState.setType(Material.MOSSY_STONE_BRICKS);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case DIRT :
|
case DIRT :
|
||||||
@ -124,7 +120,7 @@ public class Herbalism {
|
|||||||
if (blockType == Material.CHORUS_PLANT) {
|
if (blockType == Material.CHORUS_PLANT) {
|
||||||
dropAmount = 1;
|
dropAmount = 1;
|
||||||
|
|
||||||
if (block.getRelative(BlockFace.DOWN, 1).getType() == Material.ENDER_STONE) {
|
if (block.getRelative(BlockFace.DOWN, 1).getType() == Material.END_STONE) {
|
||||||
HashSet<Block> blocks = findChorusPlant(block);
|
HashSet<Block> blocks = findChorusPlant(block);
|
||||||
|
|
||||||
dropAmount = blocks.size();
|
dropAmount = blocks.size();
|
||||||
@ -167,7 +163,7 @@ public class Herbalism {
|
|||||||
case DIRT :
|
case DIRT :
|
||||||
case GRASS :
|
case GRASS :
|
||||||
case GRASS_PATH :
|
case GRASS_PATH :
|
||||||
blockState.setType(Material.MYCEL);
|
blockState.setType(Material.MYCELIUM);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
package com.gmail.nossr50.skills.herbalism;
|
package com.gmail.nossr50.skills.herbalism;
|
||||||
|
|
||||||
import java.util.Collection;
|
import com.gmail.nossr50.config.Config;
|
||||||
import java.util.List;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.*;
|
||||||
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||||
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
|
import com.gmail.nossr50.util.*;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.CropState;
|
import org.bukkit.CropState;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -17,27 +27,8 @@ import org.bukkit.material.Crops;
|
|||||||
import org.bukkit.material.NetherWarts;
|
import org.bukkit.material.NetherWarts;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import java.util.Collection;
|
||||||
import com.gmail.nossr50.config.Config;
|
import java.util.List;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
|
|
||||||
public class HerbalismManager extends SkillManager {
|
public class HerbalismManager extends SkillManager {
|
||||||
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
|
public HerbalismManager(McMMOPlayer mcMMOPlayer) {
|
||||||
@ -52,7 +43,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
return item.getAmount() > 0 && item.getType() == Material.SEEDS && BlockUtils.canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
|
return item.getAmount() > 0 && item.getType() == Material.WHEAT_SEEDS && BlockUtils.canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseShroomThumb(BlockState blockState) {
|
public boolean canUseShroomThumb(BlockState blockState) {
|
||||||
@ -104,7 +95,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
ItemStack seed = new ItemStack(Material.SEEDS);
|
ItemStack seed = new ItemStack(Material.WHEAT_SEEDS);
|
||||||
|
|
||||||
if (!playerInventory.containsAtLeast(seed, 1)) {
|
if (!playerInventory.containsAtLeast(seed, 1)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore"));
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.NeedMore"));
|
||||||
@ -123,7 +114,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
public void herbalismBlockCheck(BlockState blockState) {
|
public void herbalismBlockCheck(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE_BLOCK);
|
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE);
|
||||||
|
|
||||||
// Prevents placing and immediately breaking blocks for exp
|
// Prevents placing and immediately breaking blocks for exp
|
||||||
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
@ -279,23 +270,23 @@ public class HerbalismManager extends SkillManager {
|
|||||||
Material seed = null;
|
Material seed = null;
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case CARROT:
|
case CARROTS:
|
||||||
seed = Material.CARROT_ITEM;
|
seed = Material.CARROT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CROPS:
|
case WHEAT:
|
||||||
seed = Material.SEEDS;
|
seed = Material.WHEAT_SEEDS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETHER_WARTS:
|
case NETHER_WART_BLOCK:
|
||||||
seed = Material.NETHER_STALK;
|
seed = Material.NETHER_WART;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POTATO:
|
case POTATOES:
|
||||||
seed = Material.POTATO_ITEM;
|
seed = Material.POTATO;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BEETROOT_BLOCK:
|
case BEETROOTS:
|
||||||
seed = Material.BEETROOT_SEEDS;
|
seed = Material.BEETROOT_SEEDS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -331,8 +322,8 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
case POTATO:
|
case POTATO:
|
||||||
case CARROT:
|
case CARROT:
|
||||||
case BEETROOT_BLOCK:
|
case BEETROOTS:
|
||||||
case CROPS:
|
case WHEAT:
|
||||||
Crops crops = (Crops) blockState.getData();
|
Crops crops = (Crops) blockState.getData();
|
||||||
|
|
||||||
if (greenTerra) {
|
if (greenTerra) {
|
||||||
@ -357,7 +348,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case NETHER_WARTS:
|
case NETHER_WART_BLOCK:
|
||||||
NetherWarts warts = (NetherWarts) blockState.getData();
|
NetherWarts warts = (NetherWarts) blockState.getData();
|
||||||
|
|
||||||
if (greenTerra || greenThumbStage > 2) {
|
if (greenTerra || greenThumbStage > 2) {
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
public class Mining {
|
public class Mining {
|
||||||
|
|
||||||
@ -36,31 +33,56 @@ public class Mining {
|
|||||||
Material blockType = blockState.getType();
|
Material blockType = blockState.getType();
|
||||||
|
|
||||||
switch (blockType) {
|
switch (blockType) {
|
||||||
case ENDER_STONE:
|
case END_STONE:
|
||||||
case GOLD_ORE:
|
case TERRACOTTA:
|
||||||
case HARD_CLAY:
|
case CLAY:
|
||||||
case IRON_ORE:
|
case IRON_ORE:
|
||||||
case MOSSY_COBBLESTONE:
|
case MOSSY_COBBLESTONE:
|
||||||
case NETHERRACK:
|
case NETHERRACK:
|
||||||
case OBSIDIAN:
|
case OBSIDIAN:
|
||||||
case SANDSTONE:
|
case SANDSTONE:
|
||||||
case STAINED_CLAY:
|
case BLACK_GLAZED_TERRACOTTA:
|
||||||
|
case BLACK_TERRACOTTA:
|
||||||
|
case BLUE_GLAZED_TERRACOTTA:
|
||||||
|
case BLUE_TERRACOTTA:
|
||||||
|
case BROWN_GLAZED_TERRACOTTA:
|
||||||
|
case BROWN_TERRACOTTA:
|
||||||
|
case CYAN_GLAZED_TERRACOTTA:
|
||||||
|
case CYAN_TERRACOTTA:
|
||||||
|
case GRAY_GLAZED_TERRACOTTA:
|
||||||
|
case GRAY_TERRACOTTA:
|
||||||
|
case GREEN_GLAZED_TERRACOTTA:
|
||||||
|
case GREEN_TERRACOTTA:
|
||||||
|
case LIGHT_BLUE_GLAZED_TERRACOTTA:
|
||||||
|
case LIGHT_BLUE_TERRACOTTA:
|
||||||
|
case LIGHT_GRAY_GLAZED_TERRACOTTA:
|
||||||
|
case LIGHT_GRAY_TERRACOTTA:
|
||||||
|
case LIME_GLAZED_TERRACOTTA:
|
||||||
|
case LIME_TERRACOTTA:
|
||||||
|
case MAGENTA_GLAZED_TERRACOTTA:
|
||||||
|
case MAGENTA_TERRACOTTA:
|
||||||
|
case ORANGE_GLAZED_TERRACOTTA:
|
||||||
|
case ORANGE_TERRACOTTA:
|
||||||
|
case PINK_GLAZED_TERRACOTTA:
|
||||||
|
case PINK_TERRACOTTA:
|
||||||
|
case PURPLE_GLAZED_TERRACOTTA:
|
||||||
|
case PURPLE_TERRACOTTA:
|
||||||
|
case RED_GLAZED_TERRACOTTA:
|
||||||
|
case RED_TERRACOTTA:
|
||||||
|
case WHITE_GLAZED_TERRACOTTA:
|
||||||
|
case WHITE_TERRACOTTA:
|
||||||
|
case YELLOW_GLAZED_TERRACOTTA:
|
||||||
|
case YELLOW_TERRACOTTA:
|
||||||
handleMiningDrops(blockState);
|
handleMiningDrops(blockState);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GLOWING_REDSTONE_ORE:
|
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
|
|
||||||
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(Material.REDSTONE_ORE));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
case COAL_ORE:
|
case COAL_ORE:
|
||||||
case DIAMOND_ORE:
|
case DIAMOND_ORE:
|
||||||
case EMERALD_ORE:
|
case EMERALD_ORE:
|
||||||
case GLOWSTONE:
|
case GLOWSTONE:
|
||||||
case LAPIS_ORE:
|
case LAPIS_ORE:
|
||||||
case PACKED_ICE:
|
case PACKED_ICE:
|
||||||
case QUARTZ_ORE:
|
case NETHER_QUARTZ_ORE:
|
||||||
case REDSTONE_ORE:
|
case REDSTONE_ORE:
|
||||||
case STONE:
|
case STONE:
|
||||||
case PRISMARINE:
|
case PRISMARINE:
|
||||||
@ -85,10 +107,10 @@ public class Mining {
|
|||||||
case COAL_ORE:
|
case COAL_ORE:
|
||||||
case DIAMOND_ORE:
|
case DIAMOND_ORE:
|
||||||
case EMERALD_ORE:
|
case EMERALD_ORE:
|
||||||
case ENDER_STONE:
|
case END_STONE:
|
||||||
case GLOWSTONE:
|
case GLOWSTONE:
|
||||||
case GOLD_ORE:
|
case GOLD_ORE:
|
||||||
case HARD_CLAY:
|
case TERRACOTTA:
|
||||||
case IRON_ORE:
|
case IRON_ORE:
|
||||||
case LAPIS_ORE:
|
case LAPIS_ORE:
|
||||||
case MOSSY_COBBLESTONE:
|
case MOSSY_COBBLESTONE:
|
||||||
@ -97,18 +119,43 @@ public class Mining {
|
|||||||
case PACKED_ICE:
|
case PACKED_ICE:
|
||||||
case REDSTONE_ORE:
|
case REDSTONE_ORE:
|
||||||
case SANDSTONE:
|
case SANDSTONE:
|
||||||
case STAINED_CLAY:
|
case BLACK_GLAZED_TERRACOTTA:
|
||||||
|
case BLACK_TERRACOTTA:
|
||||||
|
case BLUE_GLAZED_TERRACOTTA:
|
||||||
|
case BLUE_TERRACOTTA:
|
||||||
|
case BROWN_GLAZED_TERRACOTTA:
|
||||||
|
case BROWN_TERRACOTTA:
|
||||||
|
case CYAN_GLAZED_TERRACOTTA:
|
||||||
|
case CYAN_TERRACOTTA:
|
||||||
|
case GRAY_GLAZED_TERRACOTTA:
|
||||||
|
case GRAY_TERRACOTTA:
|
||||||
|
case GREEN_GLAZED_TERRACOTTA:
|
||||||
|
case GREEN_TERRACOTTA:
|
||||||
|
case LIGHT_BLUE_GLAZED_TERRACOTTA:
|
||||||
|
case LIGHT_BLUE_TERRACOTTA:
|
||||||
|
case LIGHT_GRAY_GLAZED_TERRACOTTA:
|
||||||
|
case LIGHT_GRAY_TERRACOTTA:
|
||||||
|
case LIME_GLAZED_TERRACOTTA:
|
||||||
|
case LIME_TERRACOTTA:
|
||||||
|
case MAGENTA_GLAZED_TERRACOTTA:
|
||||||
|
case MAGENTA_TERRACOTTA:
|
||||||
|
case ORANGE_GLAZED_TERRACOTTA:
|
||||||
|
case ORANGE_TERRACOTTA:
|
||||||
|
case PINK_GLAZED_TERRACOTTA:
|
||||||
|
case PINK_TERRACOTTA:
|
||||||
|
case PURPLE_GLAZED_TERRACOTTA:
|
||||||
|
case PURPLE_TERRACOTTA:
|
||||||
|
case RED_GLAZED_TERRACOTTA:
|
||||||
|
case RED_TERRACOTTA:
|
||||||
|
case WHITE_GLAZED_TERRACOTTA:
|
||||||
|
case WHITE_TERRACOTTA:
|
||||||
|
case YELLOW_GLAZED_TERRACOTTA:
|
||||||
|
case YELLOW_TERRACOTTA:
|
||||||
case STONE:
|
case STONE:
|
||||||
case QUARTZ_ORE:
|
case NETHER_QUARTZ_ORE:
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GLOWING_REDSTONE_ORE:
|
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
|
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
|
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
@ -19,6 +7,7 @@ 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.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
|
||||||
@ -27,6 +16,15 @@ import com.gmail.nossr50.util.EventUtils;
|
|||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MiningManager extends SkillManager {
|
public class MiningManager extends SkillManager {
|
||||||
public MiningManager(McMMOPlayer mcMMOPlayer) {
|
public MiningManager(McMMOPlayer mcMMOPlayer) {
|
||||||
@ -71,7 +69,7 @@ public class MiningManager extends SkillManager {
|
|||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || material != Material.GLOWING_REDSTONE_ORE && !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +92,7 @@ public class MiningManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void remoteDetonation() {
|
public void remoteDetonation() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Block targetBlock = player.getTargetBlock((HashSet<Material>) BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||||
|
|
||||||
if (targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true) || !blastMiningCooldownOver()) {
|
if (targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true) || !blastMiningCooldownOver()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
import org.bukkit.material.SmoothBrick;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
@ -17,6 +7,7 @@ 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.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -24,6 +15,13 @@ 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;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
public class UnarmedManager extends SkillManager {
|
public class UnarmedManager extends SkillManager {
|
||||||
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
||||||
@ -64,19 +62,12 @@ public class UnarmedManager extends SkillManager {
|
|||||||
MaterialData data = blockState.getData();
|
MaterialData data = blockState.getData();
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case SMOOTH_BRICK:
|
case STONE_BRICKS:
|
||||||
if (!Unarmed.blockCrackerSmoothBrick) {
|
if (!Unarmed.blockCrackerSmoothBrick) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yes, this is awkward, but it's the *right* way to do it.
|
blockState.setType(Material.CRACKED_STONE_BRICKS);
|
||||||
SmoothBrick smoothBrick = (SmoothBrick) data;
|
|
||||||
|
|
||||||
if (smoothBrick.getMaterial() != Material.STONE) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
smoothBrick.setMaterial(Material.COBBLESTONE);
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package com.gmail.nossr50.skills.woodcutting;
|
package com.gmail.nossr50.skills.woodcutting;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import java.util.List;
|
import com.gmail.nossr50.config.Config;
|
||||||
import java.util.Set;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.TreeSpecies;
|
import org.bukkit.TreeSpecies;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -11,14 +15,9 @@ import org.bukkit.block.BlockState;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.Tree;
|
import org.bukkit.material.Tree;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import java.util.ArrayList;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import java.util.List;
|
||||||
import com.gmail.nossr50.config.Config;
|
import java.util.Set;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
|
|
||||||
public final class Woodcutting {
|
public final class Woodcutting {
|
||||||
public static int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
|
public static int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
|
||||||
@ -29,7 +28,7 @@ public final class Woodcutting {
|
|||||||
protected enum ExperienceGainMethod {
|
protected enum ExperienceGainMethod {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
TREE_FELLER,
|
TREE_FELLER,
|
||||||
};
|
}
|
||||||
|
|
||||||
private Woodcutting() {}
|
private Woodcutting() {}
|
||||||
|
|
||||||
@ -58,20 +57,7 @@ public final class Woodcutting {
|
|||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//TODO Remove this workaround when casting to Tree works again
|
TreeSpecies species = new Tree(blockState.getType()).getSpecies();
|
||||||
TreeSpecies species = TreeSpecies.GENERIC;
|
|
||||||
if (blockState.getData() instanceof Tree) {
|
|
||||||
species = ((Tree) blockState.getData()).getSpecies();
|
|
||||||
}
|
|
||||||
if (blockState.getType() == Material.LOG_2) {
|
|
||||||
byte data = blockState.getRawData();
|
|
||||||
if ((data & 1) != 0) {
|
|
||||||
species = TreeSpecies.ACACIA;
|
|
||||||
}
|
|
||||||
if ((data & 2) != 0) {
|
|
||||||
species = TreeSpecies.DARK_OAK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) {
|
if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) {
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.woodcutting;
|
package com.gmail.nossr50.skills.woodcutting;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.material.Tree;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
@ -19,14 +7,20 @@ 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.datatypes.skills.XPGainReason;
|
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class WoodcuttingManager extends SkillManager {
|
public class WoodcuttingManager extends SkillManager {
|
||||||
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
||||||
@ -54,8 +48,8 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case HUGE_MUSHROOM_1:
|
case BROWN_MUSHROOM_BLOCK:
|
||||||
case HUGE_MUSHROOM_2:
|
case RED_MUSHROOM_BLOCK:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -123,7 +117,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
|
|
||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
|
|
||||||
if (material == Material.HUGE_MUSHROOM_1 || material == Material.HUGE_MUSHROOM_2) {
|
if (material == Material.BROWN_MUSHROOM_BLOCK || material == Material.RED_MUSHROOM_BLOCK) {
|
||||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||||
}
|
}
|
||||||
@ -141,29 +135,16 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//TODO Remove this workaround when casting to Tree works again
|
|
||||||
if (blockState.getData() instanceof Tree) {
|
|
||||||
Tree tree = (Tree) blockState.getData();
|
|
||||||
tree.setDirection(BlockFace.UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (material) {
|
if (BlockUtils.isLog(blockState)) {
|
||||||
case LOG:
|
|
||||||
case LOG_2:
|
|
||||||
if (canGetDoubleDrops()) {
|
if (canGetDoubleDrops()) {
|
||||||
Woodcutting.checkForDoubleDrop(blockState);
|
Woodcutting.checkForDoubleDrop(blockState);
|
||||||
}
|
}
|
||||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||||
break;
|
}
|
||||||
|
if (BlockUtils.isLeaves(blockState)) {
|
||||||
case LEAVES:
|
|
||||||
case LEAVES_2:
|
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.bukkit.CropState;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NetherWartsState;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.material.CocoaPlant;
|
|
||||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
|
||||||
import org.bukkit.material.Crops;
|
|
||||||
import org.bukkit.material.NetherWarts;
|
|
||||||
import org.bukkit.material.SmoothBrick;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
public final class BlockUtils {
|
public final class BlockUtils {
|
||||||
|
|
||||||
@ -43,32 +35,54 @@ public final class BlockUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean canActivateAbilities(BlockState blockState) {
|
public static boolean canActivateAbilities(BlockState blockState) {
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case BED_BLOCK :
|
case BLACK_BED:
|
||||||
|
case BLUE_BED:
|
||||||
|
case BROWN_BED:
|
||||||
|
case CYAN_BED:
|
||||||
|
case GRAY_BED:
|
||||||
|
case GREEN_BED:
|
||||||
|
case LIGHT_BLUE_BED:
|
||||||
|
case LIGHT_GRAY_BED:
|
||||||
|
case LIME_BED:
|
||||||
|
case MAGENTA_BED:
|
||||||
|
case ORANGE_BED:
|
||||||
|
case PINK_BED:
|
||||||
|
case PURPLE_BED:
|
||||||
|
case RED_BED:
|
||||||
|
case WHITE_BED:
|
||||||
|
case YELLOW_BED:
|
||||||
case BREWING_STAND :
|
case BREWING_STAND :
|
||||||
case BOOKSHELF :
|
case BOOKSHELF :
|
||||||
case BURNING_FURNACE :
|
case CAKE:
|
||||||
case CAKE_BLOCK :
|
|
||||||
case CHEST :
|
case CHEST :
|
||||||
case DISPENSER :
|
case DISPENSER :
|
||||||
case ENCHANTMENT_TABLE :
|
case ENCHANTING_TABLE:
|
||||||
case ENDER_CHEST :
|
case ENDER_CHEST :
|
||||||
case FENCE_GATE :
|
case OAK_FENCE_GATE:
|
||||||
case ACACIA_FENCE_GATE :
|
case ACACIA_FENCE_GATE :
|
||||||
case DARK_OAK_FENCE_GATE :
|
case DARK_OAK_FENCE_GATE :
|
||||||
case SPRUCE_FENCE_GATE :
|
case SPRUCE_FENCE_GATE :
|
||||||
case BIRCH_FENCE_GATE :
|
case BIRCH_FENCE_GATE :
|
||||||
case JUNGLE_FENCE_GATE :
|
case JUNGLE_FENCE_GATE :
|
||||||
case FURNACE :
|
case FURNACE :
|
||||||
case IRON_DOOR_BLOCK :
|
|
||||||
case JUKEBOX :
|
case JUKEBOX :
|
||||||
case LEVER :
|
case LEVER :
|
||||||
case NOTE_BLOCK :
|
case NOTE_BLOCK :
|
||||||
case STONE_BUTTON :
|
case STONE_BUTTON :
|
||||||
case WOOD_BUTTON :
|
case OAK_BUTTON:
|
||||||
case TRAP_DOOR :
|
case BIRCH_BUTTON:
|
||||||
|
case ACACIA_BUTTON:
|
||||||
|
case DARK_OAK_BUTTON:
|
||||||
|
case JUNGLE_BUTTON:
|
||||||
|
case SPRUCE_BUTTON:
|
||||||
|
case ACACIA_TRAPDOOR:
|
||||||
|
case BIRCH_TRAPDOOR:
|
||||||
|
case DARK_OAK_TRAPDOOR:
|
||||||
|
case JUNGLE_TRAPDOOR:
|
||||||
|
case OAK_TRAPDOOR:
|
||||||
|
case SPRUCE_TRAPDOOR:
|
||||||
case WALL_SIGN :
|
case WALL_SIGN :
|
||||||
case WOODEN_DOOR :
|
case CRAFTING_TABLE:
|
||||||
case WORKBENCH :
|
|
||||||
case BEACON :
|
case BEACON :
|
||||||
case ANVIL :
|
case ANVIL :
|
||||||
case DROPPER :
|
case DROPPER :
|
||||||
@ -76,12 +90,13 @@ public final class BlockUtils {
|
|||||||
case TRAPPED_CHEST :
|
case TRAPPED_CHEST :
|
||||||
case IRON_DOOR :
|
case IRON_DOOR :
|
||||||
case IRON_TRAPDOOR :
|
case IRON_TRAPDOOR :
|
||||||
|
case OAK_DOOR:
|
||||||
case ACACIA_DOOR :
|
case ACACIA_DOOR :
|
||||||
case SPRUCE_DOOR :
|
case SPRUCE_DOOR :
|
||||||
case BIRCH_DOOR :
|
case BIRCH_DOOR :
|
||||||
case JUNGLE_DOOR :
|
case JUNGLE_DOOR :
|
||||||
case DARK_OAK_DOOR :
|
case DARK_OAK_DOOR :
|
||||||
case FENCE :
|
case OAK_FENCE:
|
||||||
case ACACIA_FENCE :
|
case ACACIA_FENCE :
|
||||||
case DARK_OAK_FENCE :
|
case DARK_OAK_FENCE :
|
||||||
case BIRCH_FENCE :
|
case BIRCH_FENCE :
|
||||||
@ -101,7 +116,7 @@ public final class BlockUtils {
|
|||||||
case PINK_SHULKER_BOX :
|
case PINK_SHULKER_BOX :
|
||||||
case PURPLE_SHULKER_BOX :
|
case PURPLE_SHULKER_BOX :
|
||||||
case RED_SHULKER_BOX :
|
case RED_SHULKER_BOX :
|
||||||
case SILVER_SHULKER_BOX :
|
case LIGHT_GRAY_SHULKER_BOX:
|
||||||
case WHITE_SHULKER_BOX :
|
case WHITE_SHULKER_BOX :
|
||||||
case YELLOW_SHULKER_BOX :
|
case YELLOW_SHULKER_BOX :
|
||||||
return false;
|
return false;
|
||||||
@ -136,11 +151,11 @@ public final class BlockUtils {
|
|||||||
case GRASS_PATH :
|
case GRASS_PATH :
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SMOOTH_BRICK :
|
case STONE_BRICKS:
|
||||||
return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
|
return true;
|
||||||
|
|
||||||
case COBBLE_WALL :
|
case COBBLESTONE_WALL:
|
||||||
return blockState.getRawData() == (byte) 0x0;
|
return true;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return false;
|
return false;
|
||||||
@ -212,8 +227,12 @@ public final class BlockUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isLeaves(BlockState blockState) {
|
public static boolean isLeaves(BlockState blockState) {
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case LEAVES :
|
case OAK_LEAVES:
|
||||||
case LEAVES_2 :
|
case ACACIA_LEAVES:
|
||||||
|
case BIRCH_LEAVES:
|
||||||
|
case DARK_OAK_LEAVES:
|
||||||
|
case JUNGLE_LEAVES:
|
||||||
|
case SPRUCE_LEAVES:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
@ -252,7 +271,7 @@ public final class BlockUtils {
|
|||||||
case DIRT :
|
case DIRT :
|
||||||
case GRASS :
|
case GRASS :
|
||||||
case GRASS_PATH :
|
case GRASS_PATH :
|
||||||
case SOIL :
|
case FARMLAND:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
@ -270,8 +289,8 @@ public final class BlockUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean affectedByBlockCracker(BlockState blockState) {
|
public static boolean affectedByBlockCracker(BlockState blockState) {
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case SMOOTH_BRICK :
|
case STONE_BRICKS:
|
||||||
return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
|
return true;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return false;
|
return false;
|
||||||
@ -313,7 +332,7 @@ public final class BlockUtils {
|
|||||||
public static boolean isPistonPiece(BlockState blockState) {
|
public static boolean isPistonPiece(BlockState blockState) {
|
||||||
Material type = blockState.getType();
|
Material type = blockState.getType();
|
||||||
|
|
||||||
return type == Material.PISTON_MOVING_PIECE || type == Material.AIR;
|
return type == Material.MOVING_PISTON || type == Material.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Fish;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
@ -41,7 +29,18 @@ import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
|||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
|
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
|
||||||
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
|
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.FishHook;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class EventUtils {
|
public class EventUtils {
|
||||||
public static McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
public static McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, SkillType skill) {
|
||||||
@ -252,7 +251,7 @@ public class EventUtils {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FakePlayerFishEvent callFakeFishEvent(Player player, Fish hook) {
|
public static FakePlayerFishEvent callFakeFishEvent(Player player, FishHook hook) {
|
||||||
FakePlayerFishEvent event = new FakePlayerFishEvent(player, null, hook, PlayerFishEvent.State.FISHING);
|
FakePlayerFishEvent event = new FakePlayerFishEvent(player, null, hook, PlayerFishEvent.State.FISHING);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
@ -1,27 +1,14 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import com.gmail.nossr50.commands.skills.AprilCommand;
|
||||||
import java.io.BufferedWriter;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import java.io.File;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import java.io.FileReader;
|
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
||||||
import java.io.FileWriter;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import java.io.IOException;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import java.util.ArrayList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.Calendar;
|
import org.bukkit.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.Statistic;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -30,14 +17,9 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import java.io.*;
|
||||||
import com.gmail.nossr50.commands.skills.AprilCommand;
|
import java.util.*;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import java.util.regex.Pattern;
|
||||||
import com.gmail.nossr50.util.adapter.SoundAdapter;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
public final class HolidayManager {
|
public final class HolidayManager {
|
||||||
private ArrayList<String> hasCelebrated;
|
private ArrayList<String> hasCelebrated;
|
||||||
@ -95,7 +77,7 @@ public final class HolidayManager {
|
|||||||
return FakeSkillType.CLIMBING;
|
return FakeSkillType.CLIMBING;
|
||||||
case FLY_ONE_CM:
|
case FLY_ONE_CM:
|
||||||
return FakeSkillType.FLYING;
|
return FakeSkillType.FLYING;
|
||||||
case DIVE_ONE_CM:
|
case WALK_UNDER_WATER_ONE_CM:
|
||||||
return FakeSkillType.DIVING;
|
return FakeSkillType.DIVING;
|
||||||
case PIG_ONE_CM:
|
case PIG_ONE_CM:
|
||||||
return FakeSkillType.PIGGY;
|
return FakeSkillType.PIGGY;
|
||||||
@ -107,7 +89,7 @@ public final class HolidayManager {
|
|||||||
|
|
||||||
public final Set<Statistic> movementStatistics = EnumSet.of(
|
public final Set<Statistic> movementStatistics = EnumSet.of(
|
||||||
Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
|
Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
|
||||||
Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.DIVE_ONE_CM,
|
Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.WALK_UNDER_WATER_ONE_CM,
|
||||||
Statistic.PIG_ONE_CM);
|
Statistic.PIG_ONE_CM);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.CoalType;
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.FurnaceRecipe;
|
import org.bukkit.inventory.FurnaceRecipe;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.material.Coal;
|
|
||||||
import org.bukkit.material.Dye;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
|
|
||||||
public final class ItemUtils {
|
public final class ItemUtils {
|
||||||
private ItemUtils() {}
|
private ItemUtils() {}
|
||||||
@ -48,10 +43,10 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_SWORD:
|
case DIAMOND_SWORD:
|
||||||
case GOLD_SWORD:
|
case GOLDEN_SWORD:
|
||||||
case IRON_SWORD:
|
case IRON_SWORD:
|
||||||
case STONE_SWORD:
|
case STONE_SWORD:
|
||||||
case WOOD_SWORD:
|
case WOODEN_SWORD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -70,10 +65,10 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_HOE:
|
case DIAMOND_HOE:
|
||||||
case GOLD_HOE:
|
case GOLDEN_HOE:
|
||||||
case IRON_HOE:
|
case IRON_HOE:
|
||||||
case STONE_HOE:
|
case STONE_HOE:
|
||||||
case WOOD_HOE:
|
case WOODEN_HOE:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -91,11 +86,11 @@ public final class ItemUtils {
|
|||||||
Material type = item.getType();
|
Material type = item.getType();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_SPADE:
|
case DIAMOND_SHOVEL:
|
||||||
case GOLD_SPADE:
|
case GOLDEN_SHOVEL:
|
||||||
case IRON_SPADE:
|
case IRON_SHOVEL:
|
||||||
case STONE_SPADE:
|
case STONE_SHOVEL:
|
||||||
case WOOD_SPADE:
|
case WOODEN_SHOVEL:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -114,10 +109,10 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_AXE:
|
case DIAMOND_AXE:
|
||||||
case GOLD_AXE:
|
case GOLDEN_AXE:
|
||||||
case IRON_AXE:
|
case IRON_AXE:
|
||||||
case STONE_AXE:
|
case STONE_AXE:
|
||||||
case WOOD_AXE:
|
case WOODEN_AXE:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -136,10 +131,10 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_PICKAXE:
|
case DIAMOND_PICKAXE:
|
||||||
case GOLD_PICKAXE:
|
case GOLDEN_PICKAXE:
|
||||||
case IRON_PICKAXE:
|
case IRON_PICKAXE:
|
||||||
case STONE_PICKAXE:
|
case STONE_PICKAXE:
|
||||||
case WOOD_PICKAXE:
|
case WOODEN_PICKAXE:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -172,7 +167,7 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_HELMET:
|
case DIAMOND_HELMET:
|
||||||
case GOLD_HELMET:
|
case GOLDEN_HELMET:
|
||||||
case IRON_HELMET:
|
case IRON_HELMET:
|
||||||
case CHAINMAIL_HELMET:
|
case CHAINMAIL_HELMET:
|
||||||
case LEATHER_HELMET:
|
case LEATHER_HELMET:
|
||||||
@ -194,7 +189,7 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_CHESTPLATE:
|
case DIAMOND_CHESTPLATE:
|
||||||
case GOLD_CHESTPLATE:
|
case GOLDEN_CHESTPLATE:
|
||||||
case IRON_CHESTPLATE:
|
case IRON_CHESTPLATE:
|
||||||
case CHAINMAIL_CHESTPLATE:
|
case CHAINMAIL_CHESTPLATE:
|
||||||
case LEATHER_CHESTPLATE:
|
case LEATHER_CHESTPLATE:
|
||||||
@ -216,7 +211,7 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_LEGGINGS:
|
case DIAMOND_LEGGINGS:
|
||||||
case GOLD_LEGGINGS:
|
case GOLDEN_LEGGINGS:
|
||||||
case IRON_LEGGINGS:
|
case IRON_LEGGINGS:
|
||||||
case CHAINMAIL_LEGGINGS:
|
case CHAINMAIL_LEGGINGS:
|
||||||
case LEATHER_LEGGINGS:
|
case LEATHER_LEGGINGS:
|
||||||
@ -238,7 +233,7 @@ public final class ItemUtils {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DIAMOND_BOOTS:
|
case DIAMOND_BOOTS:
|
||||||
case GOLD_BOOTS:
|
case GOLDEN_BOOTS:
|
||||||
case IRON_BOOTS:
|
case IRON_BOOTS:
|
||||||
case CHAINMAIL_BOOTS:
|
case CHAINMAIL_BOOTS:
|
||||||
case LEATHER_BOOTS:
|
case LEATHER_BOOTS:
|
||||||
@ -296,10 +291,10 @@ public final class ItemUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isGoldArmor(ItemStack item) {
|
public static boolean isGoldArmor(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case GOLD_BOOTS:
|
case GOLDEN_BOOTS:
|
||||||
case GOLD_CHESTPLATE:
|
case GOLDEN_CHESTPLATE:
|
||||||
case GOLD_HELMET:
|
case GOLDEN_HELMET:
|
||||||
case GOLD_LEGGINGS:
|
case GOLDEN_LEGGINGS:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -385,7 +380,7 @@ public final class ItemUtils {
|
|||||||
case STONE_AXE:
|
case STONE_AXE:
|
||||||
case STONE_HOE:
|
case STONE_HOE:
|
||||||
case STONE_PICKAXE:
|
case STONE_PICKAXE:
|
||||||
case STONE_SPADE:
|
case STONE_SHOVEL:
|
||||||
case STONE_SWORD:
|
case STONE_SWORD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -402,11 +397,11 @@ public final class ItemUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isWoodTool(ItemStack item) {
|
public static boolean isWoodTool(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case WOOD_AXE:
|
case WOODEN_AXE:
|
||||||
case WOOD_HOE:
|
case WOODEN_HOE:
|
||||||
case WOOD_PICKAXE:
|
case WOODEN_PICKAXE:
|
||||||
case WOOD_SPADE:
|
case WOODEN_SHOVEL:
|
||||||
case WOOD_SWORD:
|
case WOODEN_SWORD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -423,7 +418,7 @@ public final class ItemUtils {
|
|||||||
public static boolean isStringTool(ItemStack item) {
|
public static boolean isStringTool(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case BOW:
|
case BOW:
|
||||||
case CARROT_STICK:
|
case CARROT_ON_A_STICK:
|
||||||
case FISHING_ROD:
|
case FISHING_ROD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -440,11 +435,11 @@ public final class ItemUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isGoldTool(ItemStack item) {
|
public static boolean isGoldTool(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case GOLD_AXE:
|
case GOLDEN_AXE:
|
||||||
case GOLD_HOE:
|
case GOLDEN_HOE:
|
||||||
case GOLD_PICKAXE:
|
case GOLDEN_PICKAXE:
|
||||||
case GOLD_SPADE:
|
case GOLDEN_SHOVEL:
|
||||||
case GOLD_SWORD:
|
case GOLDEN_SWORD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -465,7 +460,7 @@ public final class ItemUtils {
|
|||||||
case IRON_AXE:
|
case IRON_AXE:
|
||||||
case IRON_HOE:
|
case IRON_HOE:
|
||||||
case IRON_PICKAXE:
|
case IRON_PICKAXE:
|
||||||
case IRON_SPADE:
|
case IRON_SHOVEL:
|
||||||
case IRON_SWORD:
|
case IRON_SWORD:
|
||||||
case SHEARS:
|
case SHEARS:
|
||||||
return true;
|
return true;
|
||||||
@ -486,7 +481,7 @@ public final class ItemUtils {
|
|||||||
case DIAMOND_AXE:
|
case DIAMOND_AXE:
|
||||||
case DIAMOND_HOE:
|
case DIAMOND_HOE:
|
||||||
case DIAMOND_PICKAXE:
|
case DIAMOND_PICKAXE:
|
||||||
case DIAMOND_SPADE:
|
case DIAMOND_SHOVEL:
|
||||||
case DIAMOND_SWORD:
|
case DIAMOND_SWORD:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -506,7 +501,7 @@ public final class ItemUtils {
|
|||||||
case ENCHANTED_BOOK:
|
case ENCHANTED_BOOK:
|
||||||
case SHEARS:
|
case SHEARS:
|
||||||
case FISHING_ROD:
|
case FISHING_ROD:
|
||||||
case CARROT_STICK:
|
case CARROT_ON_A_STICK:
|
||||||
case FLINT_AND_STEEL:
|
case FLINT_AND_STEEL:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -568,12 +563,10 @@ public final class ItemUtils {
|
|||||||
case REDSTONE:
|
case REDSTONE:
|
||||||
case GLOWSTONE_DUST: // Should we also have Glowstone here?
|
case GLOWSTONE_DUST: // Should we also have Glowstone here?
|
||||||
case QUARTZ:
|
case QUARTZ:
|
||||||
case QUARTZ_ORE:
|
case NETHER_QUARTZ_ORE:
|
||||||
|
case LAPIS_LAZULI:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case INK_SACK:
|
|
||||||
return ((Dye) item.getData()).getColor() == DyeColor.BLUE;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -588,33 +581,30 @@ public final class ItemUtils {
|
|||||||
public static boolean isHerbalismDrop(ItemStack item) {
|
public static boolean isHerbalismDrop(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case WHEAT:
|
case WHEAT:
|
||||||
case SEEDS:
|
case WHEAT_SEEDS:
|
||||||
case CARROT_ITEM:
|
case CARROT:
|
||||||
case CHORUS_FRUIT:
|
case CHORUS_FRUIT:
|
||||||
case CHORUS_FLOWER:
|
case CHORUS_FLOWER:
|
||||||
case POTATO_ITEM:
|
case POTATO:
|
||||||
case BEETROOT:
|
case BEETROOT:
|
||||||
case BEETROOT_SEEDS:
|
case BEETROOT_SEEDS:
|
||||||
case NETHER_WARTS:
|
case NETHER_WART:
|
||||||
case BROWN_MUSHROOM:
|
case BROWN_MUSHROOM:
|
||||||
case RED_MUSHROOM:
|
case RED_MUSHROOM:
|
||||||
case RED_ROSE:
|
case ROSE_RED:
|
||||||
case YELLOW_FLOWER:
|
case DANDELION_YELLOW:
|
||||||
case CACTUS:
|
case CACTUS:
|
||||||
case SUGAR_CANE:
|
case SUGAR_CANE:
|
||||||
case MELON:
|
case MELON:
|
||||||
case MELON_SEEDS:
|
case MELON_SEEDS:
|
||||||
case PUMPKIN:
|
case PUMPKIN:
|
||||||
case PUMPKIN_SEEDS:
|
case PUMPKIN_SEEDS:
|
||||||
case WATER_LILY:
|
case LILY_PAD:
|
||||||
case VINE:
|
case VINE:
|
||||||
case LONG_GRASS:
|
case TALL_GRASS:
|
||||||
case DOUBLE_PLANT:
|
case COCOA_BEANS:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case INK_SACK:
|
|
||||||
return ((Dye) item.getData()).getColor() == DyeColor.BROWN;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -630,19 +620,34 @@ public final class ItemUtils {
|
|||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case STRING:
|
case STRING:
|
||||||
case FEATHER:
|
case FEATHER:
|
||||||
case RAW_CHICKEN:
|
case CHICKEN:
|
||||||
case COOKED_CHICKEN:
|
case COOKED_CHICKEN:
|
||||||
case LEATHER:
|
case LEATHER:
|
||||||
case RAW_BEEF:
|
case BEEF:
|
||||||
case COOKED_BEEF:
|
case COOKED_BEEF:
|
||||||
case PORK:
|
case PORKCHOP:
|
||||||
case GRILLED_PORK:
|
case COOKED_PORKCHOP:
|
||||||
case WOOL:
|
case WHITE_WOOL:
|
||||||
|
case BLACK_WOOL:
|
||||||
|
case BLUE_WOOL:
|
||||||
|
case BROWN_WOOL:
|
||||||
|
case CYAN_WOOL:
|
||||||
|
case GRAY_WOOL:
|
||||||
|
case GREEN_WOOL:
|
||||||
|
case LIGHT_BLUE_WOOL:
|
||||||
|
case LIGHT_GRAY_WOOL:
|
||||||
|
case LIME_WOOL:
|
||||||
|
case MAGENTA_WOOL:
|
||||||
|
case ORANGE_WOOL:
|
||||||
|
case PINK_WOOL:
|
||||||
|
case PURPLE_WOOL:
|
||||||
|
case RED_WOOL:
|
||||||
|
case YELLOW_WOOL:
|
||||||
case IRON_INGOT:
|
case IRON_INGOT:
|
||||||
case SNOW_BALL:
|
case SNOWBALL:
|
||||||
case BLAZE_ROD:
|
case BLAZE_ROD:
|
||||||
case SPIDER_EYE:
|
case SPIDER_EYE:
|
||||||
case SULPHUR:
|
case GUNPOWDER:
|
||||||
case ENDER_PEARL:
|
case ENDER_PEARL:
|
||||||
case GHAST_TEAR:
|
case GHAST_TEAR:
|
||||||
case MAGMA_CREAM:
|
case MAGMA_CREAM:
|
||||||
@ -653,14 +658,10 @@ public final class ItemUtils {
|
|||||||
case ROTTEN_FLESH:
|
case ROTTEN_FLESH:
|
||||||
case GOLD_NUGGET:
|
case GOLD_NUGGET:
|
||||||
case EGG:
|
case EGG:
|
||||||
|
case ROSE_RED:
|
||||||
|
case COAL:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case COAL: // Not sure we should include this, as it will also trigger when mining
|
|
||||||
return (((Coal) item.getData()).getType() == CoalType.COAL);
|
|
||||||
|
|
||||||
case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
|
|
||||||
return (item.getData().getData() == 0x0);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -674,11 +675,30 @@ public final class ItemUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isWoodcuttingDrop(ItemStack item) {
|
public static boolean isWoodcuttingDrop(ItemStack item) {
|
||||||
switch (item.getType()) {
|
switch (item.getType()) {
|
||||||
case LOG:
|
case ACACIA_LOG:
|
||||||
case LOG_2:
|
case BIRCH_LOG:
|
||||||
case LEAVES:
|
case DARK_OAK_LOG:
|
||||||
case LEAVES_2:
|
case JUNGLE_LOG:
|
||||||
case SAPLING:
|
case OAK_LOG:
|
||||||
|
case SPRUCE_LOG:
|
||||||
|
case STRIPPED_ACACIA_LOG:
|
||||||
|
case STRIPPED_BIRCH_LOG:
|
||||||
|
case STRIPPED_DARK_OAK_LOG:
|
||||||
|
case STRIPPED_JUNGLE_LOG:
|
||||||
|
case STRIPPED_OAK_LOG:
|
||||||
|
case STRIPPED_SPRUCE_LOG:
|
||||||
|
case ACACIA_SAPLING:
|
||||||
|
case SPRUCE_SAPLING:
|
||||||
|
case BIRCH_SAPLING:
|
||||||
|
case DARK_OAK_SAPLING:
|
||||||
|
case JUNGLE_SAPLING:
|
||||||
|
case OAK_SAPLING:
|
||||||
|
case ACACIA_LEAVES:
|
||||||
|
case BIRCH_LEAVES:
|
||||||
|
case DARK_OAK_LEAVES:
|
||||||
|
case JUNGLE_LEAVES:
|
||||||
|
case OAK_LEAVES:
|
||||||
|
case SPRUCE_LEAVES:
|
||||||
case APPLE:
|
case APPLE:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
public final class MaterialUtils {
|
public final class MaterialUtils {
|
||||||
private MaterialUtils() {}
|
private MaterialUtils() {}
|
||||||
@ -11,11 +10,10 @@ public final class MaterialUtils {
|
|||||||
switch (data.getItemType()) {
|
switch (data.getItemType()) {
|
||||||
case COAL_ORE:
|
case COAL_ORE:
|
||||||
case DIAMOND_ORE:
|
case DIAMOND_ORE:
|
||||||
case GLOWING_REDSTONE_ORE:
|
case NETHER_QUARTZ_ORE:
|
||||||
case GOLD_ORE:
|
case GOLD_ORE:
|
||||||
case IRON_ORE:
|
case IRON_ORE:
|
||||||
case LAPIS_ORE:
|
case LAPIS_ORE:
|
||||||
case QUARTZ_ORE:
|
|
||||||
case REDSTONE_ORE:
|
case REDSTONE_ORE:
|
||||||
case EMERALD_ORE:
|
case EMERALD_ORE:
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,23 +1,12 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import org.bukkit.CropState;
|
|
||||||
import org.bukkit.GrassSpecies;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NetherWartsState;
|
|
||||||
import org.bukkit.TreeSpecies;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.material.CocoaPlant;
|
|
||||||
import org.bukkit.material.Crops;
|
|
||||||
import org.bukkit.material.LongGrass;
|
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
import org.bukkit.material.NetherWarts;
|
|
||||||
import org.bukkit.material.Sapling;
|
|
||||||
import org.bukkit.material.Tree;
|
|
||||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.TreeSpecies;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
public class StringUtils {
|
public class StringUtils {
|
||||||
|
|
||||||
@ -53,284 +42,6 @@ public class StringUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getFriendlyConfigMaterialDataString(MaterialData data) {
|
public static String getFriendlyConfigMaterialDataString(MaterialData data) {
|
||||||
switch (data.getItemType()) {
|
|
||||||
case LOG :
|
|
||||||
case LOG_2 : {
|
|
||||||
TreeSpecies species = TreeSpecies.GENERIC;
|
|
||||||
if (data instanceof Tree) {
|
|
||||||
Tree tree = (Tree) data;
|
|
||||||
species = tree.getSpecies();
|
|
||||||
}
|
|
||||||
return createPrettyEnumString(species.name()).replace(" ", "_");
|
|
||||||
}
|
|
||||||
case LONG_GRASS : {
|
|
||||||
LongGrass grass = (LongGrass) data;
|
|
||||||
GrassSpecies species = grass.getSpecies();
|
|
||||||
switch (species) {
|
|
||||||
case DEAD :
|
|
||||||
return "Dead_Bush";
|
|
||||||
|
|
||||||
case FERN_LIKE :
|
|
||||||
return "Small_Fern";
|
|
||||||
|
|
||||||
case NORMAL :
|
|
||||||
return "Small_Grass";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RED_ROSE : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Poppy";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Blue_Orchid";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Allium";
|
|
||||||
|
|
||||||
case 0x3 :
|
|
||||||
return "Azure_Bluet";
|
|
||||||
|
|
||||||
case 0x4 :
|
|
||||||
return "Red_Tulip";
|
|
||||||
|
|
||||||
case 0x5 :
|
|
||||||
return "Orange_Tulip";
|
|
||||||
|
|
||||||
case 0x6 :
|
|
||||||
return "White_Tulip";
|
|
||||||
|
|
||||||
case 0x7 :
|
|
||||||
return "Pink_Tulip";
|
|
||||||
|
|
||||||
case 0x8 :
|
|
||||||
return "Oxeye_Daisy";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case DOUBLE_PLANT : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Sunflower";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Lilac";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Tall_Grass";
|
|
||||||
|
|
||||||
case 0x3 :
|
|
||||||
return "Tall_Fern";
|
|
||||||
|
|
||||||
case 0x4 :
|
|
||||||
return "Rose_Bush";
|
|
||||||
|
|
||||||
case 0x5 :
|
|
||||||
return "Peony";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case RAW_FISH : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Raw_Fish";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Raw_Salmon";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Clownfish";
|
|
||||||
|
|
||||||
case 0x3 :
|
|
||||||
return "Pufferfish";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case COOKED_FISH : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Cooked_Fish";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Cooked_Salmon";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case DIRT : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Dirt";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Coarse_Dirt";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Podzol";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case SAND : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Sand";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Red_Sand";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case QUARTZ_BLOCK : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Quartz_Block";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Chiseled_Quartz_Block";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
case 0x3 :
|
|
||||||
case 0x4 :
|
|
||||||
return "Quartz_Pillar";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case SPONGE : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Sponge";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Wet_Sponge";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case PRISMARINE : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Prismarine";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Prismarine_Brick";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Dark_Prismarine";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case STONE : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Stone";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Granite";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Polished_Granite";
|
|
||||||
|
|
||||||
case 0x3 :
|
|
||||||
return "Diorite";
|
|
||||||
|
|
||||||
case 0x4 :
|
|
||||||
return "Polished_Diorite";
|
|
||||||
|
|
||||||
case 0x5 :
|
|
||||||
return "Andesite";
|
|
||||||
|
|
||||||
case 0x6 :
|
|
||||||
return "Polished_Andesite";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case WOOD : {
|
|
||||||
switch (data.getData()) {
|
|
||||||
case 0x0 :
|
|
||||||
return "Oak_Planks";
|
|
||||||
|
|
||||||
case 0x1 :
|
|
||||||
return "Spruce_Planks";
|
|
||||||
|
|
||||||
case 0x2 :
|
|
||||||
return "Birch_Planks";
|
|
||||||
|
|
||||||
case 0x3 :
|
|
||||||
return "Jungle_Planks";
|
|
||||||
|
|
||||||
case 0x4 :
|
|
||||||
return "Acacia_Planks";
|
|
||||||
|
|
||||||
case 0x5 :
|
|
||||||
return "Dark_Oak_Planks";
|
|
||||||
|
|
||||||
default :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case GLOWING_REDSTONE_ORE :
|
|
||||||
return getPrettyItemString(Material.REDSTONE_ORE).replace(" ", "_");
|
|
||||||
|
|
||||||
case BEETROOT_BLOCK :
|
|
||||||
case CARROT :
|
|
||||||
case POTATO :
|
|
||||||
case CROPS : {
|
|
||||||
if (((Crops) data).getState() == CropState.RIPE) {
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
|
|
||||||
}
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
|
|
||||||
}
|
|
||||||
case NETHER_WARTS : {
|
|
||||||
if (((NetherWarts) data).getState() == NetherWartsState.RIPE) {
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
|
|
||||||
}
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
|
|
||||||
}
|
|
||||||
case COCOA : {
|
|
||||||
if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) {
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
|
|
||||||
}
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
|
|
||||||
}
|
|
||||||
case SAPLING:
|
|
||||||
{
|
|
||||||
TreeSpecies species = TreeSpecies.GENERIC;
|
|
||||||
if (data instanceof Sapling) {
|
|
||||||
Sapling sapling = (Sapling) data;
|
|
||||||
species = sapling.getSpecies();
|
|
||||||
}
|
|
||||||
return createPrettyEnumString(species.name()).replace(" ", "_") + "_Sapling";
|
|
||||||
}
|
|
||||||
case SMOOTH_BRICK :
|
|
||||||
case WOOL :
|
|
||||||
case INK_SACK :
|
|
||||||
case STAINED_CLAY :
|
|
||||||
case STAINED_GLASS :
|
|
||||||
case FLOWER_POT :
|
|
||||||
case MONSTER_EGGS :
|
|
||||||
return getExplicitConfigMaterialDataString(data);
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return getPrettyItemString(data.getItemType()).replace(" ", "_");
|
return getPrettyItemString(data.getItemType()).replace(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,21 @@
|
|||||||
package com.gmail.nossr50.util.skills;
|
package com.gmail.nossr50.util.skills;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import java.util.List;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
|
||||||
|
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -16,22 +29,8 @@ import org.bukkit.material.MaterialData;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import java.util.ArrayList;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import java.util.List;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityEvent;
|
|
||||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
|
|
||||||
public class SkillUtils {
|
public class SkillUtils {
|
||||||
public static int handleFoodSkills(Player player, SkillType skill, int eventFoodLevel, int baseLevel, int maxLevel, int rankChange) {
|
public static int handleFoodSkills(Player player, SkillType skill, int eventFoodLevel, int baseLevel, int maxLevel, int rankChange) {
|
||||||
@ -256,7 +255,7 @@ public class SkillUtils {
|
|||||||
return Material.COBBLESTONE;
|
return Material.COBBLESTONE;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isWoodTool(inHand)) {
|
else if (ItemUtils.isWoodTool(inHand)) {
|
||||||
return Material.WOOD;
|
return Material.OAK_WOOD;
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||||
return Material.LEATHER;
|
return Material.LEATHER;
|
||||||
|
Loading…
Reference in New Issue
Block a user