mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Fixing Java naming conventions for constants in mcMMO.java also added
some Javadocs
This commit is contained in:
parent
8a312da0f5
commit
a919c45b09
@ -102,11 +102,11 @@ public class McrankCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
if (((Player) sender).hasMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
((Player) sender).setMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
|
@ -100,11 +100,11 @@ public class MctopCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
if (((Player) sender).hasMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
((Player) sender).setMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
|
@ -63,9 +63,9 @@ public class BlockListener implements Listener {
|
||||
continue;
|
||||
|
||||
//TODO: Should just store the amount of drops in the metadata itself and use a loop
|
||||
if (event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0) {
|
||||
if (event.getBlock().getState().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0) {
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
event.getBlock().getState().removeMetadata(mcMMO.doubleDrops, plugin);
|
||||
event.getBlock().getState().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, plugin);
|
||||
} else if (event.getBlock().getState().getMetadata(mcMMO.tripleDrops).size() > 0) {
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
@ -81,9 +81,9 @@ public class BlockListener implements Listener {
|
||||
{
|
||||
ItemStack is = new ItemStack(item.getItemStack());
|
||||
|
||||
if(event.getBlock().getMetadata(mcMMO.doubleDrops).size() > 0)
|
||||
if(event.getBlock().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0)
|
||||
{
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.doubleDrops);
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.BONUS_DROPS_METAKEY);
|
||||
|
||||
BonusDrops bonusDrops = (BonusDrops) metadataValue.get(0);
|
||||
Collection<ItemStack> potentialDrops = (Collection<ItemStack>) bonusDrops.value();
|
||||
@ -93,7 +93,7 @@ public class BlockListener implements Listener {
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
}
|
||||
|
||||
event.getBlock().removeMetadata(mcMMO.doubleDrops, plugin);
|
||||
event.getBlock().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, plugin);
|
||||
} else {
|
||||
if(event.getBlock().getMetadata(mcMMO.tripleDrops).size() > 0) {
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.tripleDrops);
|
||||
@ -119,9 +119,9 @@ public class BlockListener implements Listener {
|
||||
{
|
||||
ItemStack is = new ItemStack(item.getItemStack());
|
||||
|
||||
if(event.getBlock().getMetadata(mcMMO.doubleDrops).size() > 0)
|
||||
if(event.getBlock().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0)
|
||||
{
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.doubleDrops);
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.BONUS_DROPS_METAKEY);
|
||||
|
||||
BonusDrops bonusDrops = (BonusDrops) metadataValue.get(0);
|
||||
Collection<ItemStack> potentialDrops = (Collection<ItemStack>) bonusDrops.value();
|
||||
@ -131,7 +131,7 @@ public class BlockListener implements Listener {
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
}
|
||||
|
||||
event.getBlock().removeMetadata(mcMMO.doubleDrops, plugin);
|
||||
event.getBlock().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, plugin);
|
||||
} else {
|
||||
if(event.getBlock().getMetadata(mcMMO.tripleDrops).size() > 0) {
|
||||
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.tripleDrops);
|
||||
@ -525,7 +525,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
private Player getPlayerFromFurnace(Block furnaceBlock) {
|
||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.FURNACE_TRACKING_METAKEY);
|
||||
|
||||
if (metadata.isEmpty()) {
|
||||
return null;
|
||||
@ -644,7 +644,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
if (blockState instanceof Furnace) {
|
||||
Furnace furnace = (Furnace) blockState;
|
||||
if (furnace.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
if (furnace.hasMetadata(mcMMO.FURNACE_TRACKING_METAKEY)) {
|
||||
player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
|
||||
Player furnacePlayer = getPlayerFromFurnace(furnace.getBlock());
|
||||
if (furnacePlayer != null) {
|
||||
|
@ -54,9 +54,9 @@ public class EntityListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEntityTransform(EntityTransformEvent event) {
|
||||
//Transfer metadata keys from mob-spawned mobs to new mobs
|
||||
if (event.getEntity().getMetadata(mcMMO.entityMetadataKey) != null || event.getEntity().getMetadata(mcMMO.entityMetadataKey).size() >= 1) {
|
||||
if (event.getEntity().getMetadata(mcMMO.UNNATURAL_MOB_METAKEY) != null || event.getEntity().getMetadata(mcMMO.UNNATURAL_MOB_METAKEY).size() >= 1) {
|
||||
for (Entity entity : event.getTransformedEntities()) {
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,8 +68,8 @@ public class EntityListener implements Listener {
|
||||
|
||||
//Prevent entities from giving XP if they target endermite
|
||||
if (event.getTarget() instanceof Endermite) {
|
||||
if (event.getEntity().getMetadata(mcMMO.entityMetadataKey) == null || event.getEntity().getMetadata(mcMMO.entityMetadataKey).size() <= 0)
|
||||
event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
if (event.getEntity().getMetadata(mcMMO.UNNATURAL_MOB_METAKEY) == null || event.getEntity().getMetadata(mcMMO.UNNATURAL_MOB_METAKEY).size() <= 0)
|
||||
event.getEntity().setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,11 +98,11 @@ public class EntityListener implements Listener {
|
||||
ItemStack bow = event.getBow();
|
||||
|
||||
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
||||
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
||||
projectile.setMetadata(mcMMO.INFINITE_ARROW_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
|
||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||
projectile.setMetadata(mcMMO.BOW_FORCE_METAKEY, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
||||
projectile.setMetadata(mcMMO.ARROW_DISTANCE_METAKEY, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -123,12 +123,12 @@ public class EntityListener implements Listener {
|
||||
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.bowForceKey)) {
|
||||
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.BOW_FORCE_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, 1.0));
|
||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||
projectile.setMetadata(mcMMO.BOW_FORCE_METAKEY, new FixedMetadataValue(plugin, 1.0));
|
||||
projectile.setMetadata(mcMMO.ARROW_DISTANCE_METAKEY, new FixedMetadataValue(plugin, projectile.getLocation()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,11 +156,11 @@ public class EntityListener implements Listener {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (entity instanceof FallingBlock || entity instanceof Enderman) {
|
||||
boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey);
|
||||
boolean isTracked = entity.hasMetadata(mcMMO.UNNATURAL_MOB_METAKEY);
|
||||
|
||||
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
|
||||
mcMMO.getPlaceStore().setFalse(block);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
} else if (isTracked) {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getDamager().hasMetadata(mcMMO.funfettiMetadataKey)) {
|
||||
if (event.getDamager().hasMetadata(mcMMO.SPAWNED_FIREWORKS_METAKEY)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -564,18 +564,18 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.customNameKey)) {
|
||||
entity.setCustomName(entity.getMetadata(mcMMO.customNameKey).get(0).asString());
|
||||
entity.removeMetadata(mcMMO.customNameKey, plugin);
|
||||
if (entity.hasMetadata(mcMMO.CUSTOM_NAME_METAKEY)) {
|
||||
entity.setCustomName(entity.getMetadata(mcMMO.CUSTOM_NAME_METAKEY).get(0).asString());
|
||||
entity.removeMetadata(mcMMO.CUSTOM_NAME_METAKEY, plugin);
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.customVisibleKey)) {
|
||||
entity.setCustomNameVisible(entity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
||||
entity.removeMetadata(mcMMO.customVisibleKey, plugin);
|
||||
if (entity.hasMetadata(mcMMO.NAME_VISIBILITY_METAKEY)) {
|
||||
entity.setCustomNameVisible(entity.getMetadata(mcMMO.NAME_VISIBILITY_METAKEY).get(0).asBoolean());
|
||||
entity.removeMetadata(mcMMO.NAME_VISIBILITY_METAKEY, plugin);
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
entity.removeMetadata(mcMMO.entityMetadataKey, plugin);
|
||||
if (entity.hasMetadata(mcMMO.UNNATURAL_MOB_METAKEY)) {
|
||||
entity.removeMetadata(mcMMO.UNNATURAL_MOB_METAKEY, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,18 +617,18 @@ public class EntityListener implements Listener {
|
||||
case SPAWNER:
|
||||
case SPAWNER_EGG:
|
||||
if (mcMMO.getConfigManager().getConfigExploitPrevention().doSpawnedEntitiesGiveModifiedXP()) {
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
|
||||
Entity passenger = entity.getPassenger();
|
||||
|
||||
if (passenger != null) {
|
||||
passenger.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
passenger.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
case BREEDING:
|
||||
entity.setMetadata(mcMMO.bredMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.BRED_ANIMAL_TRACKING_METAKEY, mcMMO.metadataValue);
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -648,13 +648,13 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.TNT_TRACKING_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can make this assumption because we (should) be the only ones
|
||||
// using this exact metadata
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.TNT_TRACKING_METAKEY).get(0).asString());
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
@ -691,13 +691,13 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.TNT_TRACKING_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can make this assumption because we (should) be the only ones
|
||||
// using this exact metadata
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.TNT_TRACKING_METAKEY).get(0).asString());
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
@ -735,7 +735,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntsafeMetadataKey)) {
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.SAFE_TNT_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -863,12 +863,12 @@ public class EntityListener implements Listener {
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.UNNATURAL_MOB_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
|
||||
//Profile not loaded
|
||||
//TODO: Redundant
|
||||
@ -951,8 +951,8 @@ public class EntityListener implements Listener {
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
if (event.getEntity().hasMetadata(mcMMO.UNNATURAL_MOB_METAKEY)) {
|
||||
event.getPigZombie().setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||
if (!furnaceBlock.hasMetadata(mcMMO.FURNACE_TRACKING_METAKEY) && furnaceBlock.getMetadata(mcMMO.FURNACE_TRACKING_METAKEY).size() == 0)
|
||||
furnaceBlock.setMetadata(mcMMO.FURNACE_TRACKING_METAKEY, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -74,7 +74,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.FURNACE_TRACKING_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, plugin);
|
||||
furnaceBlock.removeMetadata(mcMMO.FURNACE_TRACKING_METAKEY, plugin);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
@ -200,15 +200,15 @@ public class InventoryListener implements Listener {
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock != null) {
|
||||
if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
|
||||
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
|
||||
if (furnaceBlock.getMetadata(mcMMO.FURNACE_TRACKING_METAKEY).size() > 0)
|
||||
furnaceBlock.removeMetadata(mcMMO.FURNACE_TRACKING_METAKEY, mcMMO.p);
|
||||
|
||||
//Profile not loaded
|
||||
if (UserManager.getPlayer(player) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
|
||||
furnaceBlock.setMetadata(mcMMO.FURNACE_TRACKING_METAKEY, UserManager.getPlayer(player).getPlayerMetadata());
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
final HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!whoClicked.hasMetadata(mcMMO.playerDataKey)) {
|
||||
if (!whoClicked.hasMetadata(mcMMO.PLAYER_DATA_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -472,7 +472,7 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
|
||||
private Player getPlayerFromFurnace(Block furnaceBlock) {
|
||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.FURNACE_TRACKING_METAKEY);
|
||||
|
||||
if (metadata.isEmpty()) {
|
||||
return null;
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.chat.ChatManagerFactory;
|
||||
import com.gmail.nossr50.chat.PartyChatManager;
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@ -151,7 +150,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
Player killedPlayer = event.getEntity();
|
||||
|
||||
if (!killedPlayer.hasMetadata(mcMMO.playerDataKey) || Permissions.hardcoreBypass(killedPlayer)) {
|
||||
if (!killedPlayer.hasMetadata(mcMMO.PLAYER_DATA_METAKEY) || Permissions.hardcoreBypass(killedPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -231,7 +230,7 @@ public class PlayerListener implements Listener {
|
||||
ItemStack dropStack = drop.getItemStack();
|
||||
|
||||
if (ItemUtils.isSharable(dropStack)) {
|
||||
drop.setMetadata(mcMMO.droppedItemKey, mcMMO.metadataValue);
|
||||
drop.setMetadata(mcMMO.DROPPED_ITEM_TRACKING_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
|
||||
SkillUtils.removeAbilityBuff(dropStack);
|
||||
@ -441,8 +440,8 @@ public class PlayerListener implements Listener {
|
||||
Item drop = event.getItem();
|
||||
ItemStack dropStack = drop.getItemStack();
|
||||
|
||||
if (drop.hasMetadata(mcMMO.disarmedItemKey)) {
|
||||
if (!player.getName().equals(drop.getMetadata(mcMMO.disarmedItemKey).get(0).asString())) {
|
||||
if (drop.hasMetadata(mcMMO.DISARMED_ITEM_METAKEY)) {
|
||||
if (!player.getName().equals(drop.getMetadata(mcMMO.DISARMED_ITEM_METAKEY).get(0).asString())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -450,7 +449,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
|
||||
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
||||
if (!drop.hasMetadata(mcMMO.DROPPED_ITEM_TRACKING_METAKEY) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
||||
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
||||
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||
|
@ -52,32 +52,29 @@ import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
public static final String COMPATIBLE_SERVER_SOFTWARE = "Spigot, Paper";
|
||||
public static final String INCOMPATIBLE_SERVER_SOFTWARE = "CraftBukkit";
|
||||
public static final String COMPATIBLE_MINECRAFT_VERSIONS = "1.13.2";
|
||||
/* Metadata Values */
|
||||
public static final String FISH_HOOK_REF_METAKEY = "mcMMO: Fish Hook Tracker";
|
||||
public static final String CUSTOM_DAMAGE_METAKEY = "mcMMO: Custom Damage";
|
||||
public final static String entityMetadataKey = "mcMMO: Spawned Entity";
|
||||
public final static String blockMetadataKey = "mcMMO: Piston Tracking";
|
||||
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
|
||||
public final static String tntMetadataKey = "mcMMO: Tracked TNT";
|
||||
public final static String funfettiMetadataKey = "mcMMO: Funfetti";
|
||||
public final static String tntsafeMetadataKey = "mcMMO: Safe TNT";
|
||||
public final static String customNameKey = "mcMMO: Custom Name";
|
||||
public final static String customVisibleKey = "mcMMO: Name Visibility";
|
||||
public final static String droppedItemKey = "mcMMO: Tracked Item";
|
||||
public final static String infiniteArrowKey = "mcMMO: Infinite Arrow";
|
||||
public final static String bowForceKey = "mcMMO: Bow Force";
|
||||
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
||||
public final static String doubleDrops = "mcMMO: Double Drops";
|
||||
public final static String tripleDrops = "mcMMO: Triple Drops";
|
||||
public final static String UNNATURAL_MOB_METAKEY = "mcMMO: Spawned Entity";
|
||||
public final static String PISTON_TRACKING_METAKEY = "mcMMO: Piston Tracking";
|
||||
public final static String FURNACE_TRACKING_METAKEY = "mcMMO: Tracked Furnace";
|
||||
public final static String TNT_TRACKING_METAKEY = "mcMMO: Tracked TNT";
|
||||
public final static String SPAWNED_FIREWORKS_METAKEY = "mcMMO: Funfetti";
|
||||
public final static String SAFE_TNT_METAKEY = "mcMMO: Safe TNT";
|
||||
public final static String CUSTOM_NAME_METAKEY = "mcMMO: Custom Name";
|
||||
public final static String NAME_VISIBILITY_METAKEY = "mcMMO: Name Visibility";
|
||||
public final static String DROPPED_ITEM_TRACKING_METAKEY = "mcMMO: Tracked Item";
|
||||
public final static String INFINITE_ARROW_METAKEY = "mcMMO: Infinite Arrow";
|
||||
public final static String BOW_FORCE_METAKEY = "mcMMO: Bow Force";
|
||||
public final static String ARROW_DISTANCE_METAKEY = "mcMMO: Arrow Distance";
|
||||
public final static String BONUS_DROPS_METAKEY = "mcMMO: Bonus Drops";
|
||||
//public final static String customDamageKey = "mcMMO: Custom Damage";
|
||||
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
||||
public final static String playerDataKey = "mcMMO: Player Data";
|
||||
public final static String greenThumbDataKey = "mcMMO: Green Thumb";
|
||||
public final static String databaseCommandKey = "mcMMO: Processing Database Command";
|
||||
public final static String bredMetadataKey = "mcMMO: Bred Animal";
|
||||
public final static String DISARMED_ITEM_METAKEY = "mcMMO: Disarmed Item";
|
||||
public final static String PLAYER_DATA_METAKEY = "mcMMO: Player Data";
|
||||
public final static String GREEN_THUMB_METAKEY = "mcMMO: Green Thumb";
|
||||
public final static String DATABASE_PROCESSING_COMMAND_METAKEY = "mcMMO: Processing Database Command";
|
||||
public final static String BRED_ANIMAL_TRACKING_METAKEY = "mcMMO: Bred Animal";
|
||||
|
||||
public static mcMMO p;
|
||||
// Jar Stuff
|
||||
public static File mcmmo;
|
||||
@ -85,7 +82,6 @@ public class mcMMO extends JavaPlugin {
|
||||
/* Managers */
|
||||
private static ChunkManager placeStore;
|
||||
private static ConfigManager configManager;
|
||||
//private static ModManager modManager;
|
||||
private static DatabaseManager databaseManager;
|
||||
private static FormulaManager formulaManager;
|
||||
private static MaterialMapStore materialMapStore;
|
||||
@ -349,6 +345,9 @@ public class mcMMO extends JavaPlugin {
|
||||
return playerLevelUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses reflection to check for incompatible server software
|
||||
*/
|
||||
private void checkForOutdatedAPI() {
|
||||
try {
|
||||
Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent");
|
||||
@ -361,6 +360,11 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ServerSoftwareType based on version strings
|
||||
* Custom software is returned as CRAFTBUKKIT
|
||||
* @return the ServerSoftwareType which likely matches the server
|
||||
*/
|
||||
private ServerSoftwareType getServerSoftware() {
|
||||
if (Bukkit.getVersion().toLowerCase().contains("paper"))
|
||||
return ServerSoftwareType.PAPER;
|
||||
@ -370,6 +374,10 @@ public class mcMMO extends JavaPlugin {
|
||||
return ServerSoftwareType.CRAFTBUKKIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string version of ServerSoftwareType
|
||||
* @return Formatted String of ServerSoftwareType
|
||||
*/
|
||||
private String getServerSoftwareStr() {
|
||||
switch (getServerSoftware()) {
|
||||
case PAPER:
|
||||
@ -438,10 +446,18 @@ public class mcMMO extends JavaPlugin {
|
||||
debug("Was disabled."); // How informative!
|
||||
}
|
||||
|
||||
/**
|
||||
* The directory in which override locales are kept
|
||||
* @return the override locale directory
|
||||
*/
|
||||
public static String getLocalesDirectory() {
|
||||
return localesDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* If an XP rate event is currently in place
|
||||
* @return
|
||||
*/
|
||||
public boolean isXPEventEnabled() {
|
||||
return xpEventEnabled;
|
||||
}
|
||||
@ -454,14 +470,26 @@ public class mcMMO extends JavaPlugin {
|
||||
return upgradeManager;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Sets the xpEventEnabled boolean
|
||||
* @param enabled the new boolean state
|
||||
*/
|
||||
public void setXPEventEnabled(boolean enabled) {
|
||||
this.xpEventEnabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips the XP events boolean
|
||||
*/
|
||||
public void toggleXpEventEnabled() {
|
||||
xpEventEnabled = !xpEventEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug helper method
|
||||
* Prefixes log entries with [Debug]
|
||||
* @param message the message to log with a Debug prefix
|
||||
*/
|
||||
public void debug(String message) {
|
||||
getLogger().info("[Debug] " + message);
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
||||
public MobHealthDisplayUpdaterTask(LivingEntity target) {
|
||||
if (target.isValid()) {
|
||||
this.target = target;
|
||||
this.oldName = target.getMetadata(mcMMO.customNameKey).get(0).asString();
|
||||
this.oldNameVisible = target.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean();
|
||||
this.oldName = target.getMetadata(mcMMO.CUSTOM_NAME_METAKEY).get(0).asString();
|
||||
this.oldNameVisible = target.getMetadata(mcMMO.NAME_VISIBILITY_METAKEY).get(0).asBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@ public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
|
||||
if (target != null && target.isValid()) {
|
||||
target.setCustomNameVisible(oldNameVisible);
|
||||
target.setCustomName(oldName);
|
||||
target.removeMetadata(mcMMO.customNameKey, mcMMO.p);
|
||||
target.removeMetadata(mcMMO.customVisibleKey, mcMMO.p);
|
||||
target.removeMetadata(mcMMO.CUSTOM_NAME_METAKEY, mcMMO.p);
|
||||
target.removeMetadata(mcMMO.NAME_VISIBILITY_METAKEY, mcMMO.p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ public class PistonTrackerTask extends BukkitRunnable {
|
||||
for (Block b : blocks) {
|
||||
Block nextBlock = b.getRelative(direction);
|
||||
|
||||
if (nextBlock.hasMetadata(mcMMO.blockMetadataKey)) {
|
||||
if (nextBlock.hasMetadata(mcMMO.PISTON_TRACKING_METAKEY)) {
|
||||
mcMMO.getPlaceStore().setTrue(nextBlock);
|
||||
nextBlock.removeMetadata(mcMMO.blockMetadataKey, mcMMO.p);
|
||||
nextBlock.removeMetadata(mcMMO.PISTON_TRACKING_METAKEY, mcMMO.p);
|
||||
} else if (mcMMO.getPlaceStore().isTrue(nextBlock)) {
|
||||
// Block doesn't have metadatakey but isTrue - set it to false
|
||||
mcMMO.getPlaceStore().setFalse(nextBlock);
|
||||
|
@ -36,7 +36,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
if (useChat) {
|
||||
displayChat();
|
||||
}
|
||||
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
|
||||
((Player) sender).removeMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY, mcMMO.p);
|
||||
}
|
||||
|
||||
private void displayChat() {
|
||||
|
@ -42,7 +42,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
((Player) sender).removeMetadata(mcMMO.databaseCommandKey, mcMMO.p);
|
||||
((Player) sender).removeMetadata(mcMMO.DATABASE_PROCESSING_COMMAND_METAKEY, mcMMO.p);
|
||||
}
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||
|
@ -52,7 +52,7 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param damager The {@link Entity} who shot the arrow
|
||||
*/
|
||||
public double distanceXpBonusMultiplier(LivingEntity target, Entity damager) {
|
||||
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
|
||||
Location firedLocation = (Location) damager.getMetadata(mcMMO.ARROW_DISTANCE_METAKEY).get(0).value();
|
||||
Location targetLocation = target.getLocation();
|
||||
|
||||
if (firedLocation.getWorld() != targetLocation.getWorld()) {
|
||||
|
@ -188,6 +188,6 @@ public class Herbalism {
|
||||
* @return true if the block is recently regrown, false otherwise
|
||||
*/
|
||||
public static boolean isRecentlyRegrown(BlockState blockState) {
|
||||
return blockState.hasMetadata(mcMMO.greenThumbDataKey) && !SkillUtils.cooldownExpired(blockState.getMetadata(mcMMO.greenThumbDataKey).get(0).asInt(), 1);
|
||||
return blockState.hasMetadata(mcMMO.GREEN_THUMB_METAKEY) && !SkillUtils.cooldownExpired(blockState.getMetadata(mcMMO.GREEN_THUMB_METAKEY).get(0).asInt(), 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.skills.herbalism;
|
||||
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.treasure.HerbalismTreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
@ -341,7 +340,7 @@ public class HerbalismManager extends SkillManager {
|
||||
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
|
||||
int greenThumbStage = getGreenThumbStage();
|
||||
|
||||
blockState.setMetadata(mcMMO.greenThumbDataKey, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
|
||||
blockState.setMetadata(mcMMO.GREEN_THUMB_METAKEY, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
|
||||
Ageable crops = (Ageable) blockState.getBlockData();
|
||||
|
||||
switch (blockState.getType()) {
|
||||
|
@ -88,12 +88,12 @@ public class BlastMining {
|
||||
}
|
||||
|
||||
public static boolean processBlastMiningExplosion(EntityDamageByEntityEvent event, TNTPrimed tnt, Player defender) {
|
||||
if (!tnt.hasMetadata(mcMMO.tntMetadataKey) || !UserManager.hasPlayerDataKey(defender)) {
|
||||
if (!tnt.hasMetadata(mcMMO.TNT_TRACKING_METAKEY) || !UserManager.hasPlayerDataKey(defender)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(tnt.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(tnt.getMetadata(mcMMO.TNT_TRACKING_METAKEY).get(0).asString());
|
||||
|
||||
if (!player.equals(defender)) {
|
||||
return false;
|
||||
|
@ -128,7 +128,7 @@ public class MiningManager extends SkillManager {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
|
||||
//player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||
|
||||
tnt.setMetadata(mcMMO.tntMetadataKey, mcMMOPlayer.getPlayerMetadata());
|
||||
tnt.setMetadata(mcMMO.TNT_TRACKING_METAKEY, mcMMOPlayer.getPlayerMetadata());
|
||||
tnt.setFuseTicks(0);
|
||||
targetBlock.setType(Material.AIR);
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@ -308,7 +307,7 @@ public class TamingManager extends SkillManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
entity.setMetadata(mcMMO.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
((Tameable) entity).setOwner(player);
|
||||
entity.setRemoveWhenFarAway(false);
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class UnarmedManager extends SkillManager {
|
||||
Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand());
|
||||
|
||||
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
|
||||
item.setMetadata(mcMMO.disarmedItemKey, UserManager.getPlayer(defender).getPlayerMetadata());
|
||||
item.setMetadata(mcMMO.DISARMED_ITEM_METAKEY, UserManager.getPlayer(defender).getPlayerMetadata());
|
||||
}
|
||||
|
||||
defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
|
@ -29,7 +29,7 @@ public final class BlockUtils {
|
||||
if (triple)
|
||||
blockState.setMetadata(mcMMO.tripleDrops, mcMMO.metadataValue);
|
||||
else
|
||||
blockState.setMetadata(mcMMO.doubleDrops, mcMMO.metadataValue);
|
||||
blockState.setMetadata(mcMMO.BONUS_DROPS_METAKEY, mcMMO.metadataValue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,11 +69,11 @@ public final class MobHealthbarUtils {
|
||||
boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName));
|
||||
|
||||
if (updateName) {
|
||||
target.setMetadata(mcMMO.customNameKey, new FixedMetadataValue(mcMMO.p, oldName));
|
||||
target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
||||
} else if (!target.hasMetadata(mcMMO.customNameKey)) {
|
||||
target.setMetadata(mcMMO.customNameKey, new FixedMetadataValue(mcMMO.p, ""));
|
||||
target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, false));
|
||||
target.setMetadata(mcMMO.CUSTOM_NAME_METAKEY, new FixedMetadataValue(mcMMO.p, oldName));
|
||||
target.setMetadata(mcMMO.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
||||
} else if (!target.hasMetadata(mcMMO.CUSTOM_NAME_METAKEY)) {
|
||||
target.setMetadata(mcMMO.CUSTOM_NAME_METAKEY, new FixedMetadataValue(mcMMO.p, ""));
|
||||
target.setMetadata(mcMMO.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(mcMMO.p, false));
|
||||
}
|
||||
|
||||
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
||||
|
@ -124,7 +124,7 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasPlayerDataKey = ((Player) sender).hasMetadata(mcMMO.playerDataKey);
|
||||
boolean hasPlayerDataKey = ((Player) sender).hasMetadata(mcMMO.PLAYER_DATA_METAKEY);
|
||||
|
||||
if (!hasPlayerDataKey) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||
|
@ -22,7 +22,7 @@ public final class UserManager {
|
||||
* @param mcMMOPlayer the player profile to start tracking
|
||||
*/
|
||||
public static void track(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().setMetadata(mcMMO.playerDataKey, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
mcMMOPlayer.getPlayer().setMetadata(mcMMO.PLAYER_DATA_METAKEY, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -31,7 +31,7 @@ public final class UserManager {
|
||||
* @param player The Player object
|
||||
*/
|
||||
public static void remove(Player player) {
|
||||
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
|
||||
player.removeMetadata(mcMMO.PLAYER_DATA_METAKEY, mcMMO.p);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,8 +101,8 @@ public final class UserManager {
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(Player player) {
|
||||
//Avoid Array Index out of bounds
|
||||
if (player != null && player.hasMetadata(mcMMO.playerDataKey))
|
||||
return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
|
||||
if (player != null && player.hasMetadata(mcMMO.PLAYER_DATA_METAKEY))
|
||||
return (McMMOPlayer) player.getMetadata(mcMMO.PLAYER_DATA_METAKEY).get(0).value();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@ -122,6 +122,6 @@ public final class UserManager {
|
||||
}
|
||||
|
||||
public static boolean hasPlayerDataKey(Entity entity) {
|
||||
return entity != null && entity.hasMetadata(mcMMO.playerDataKey);
|
||||
return entity != null && entity.hasMetadata(mcMMO.PLAYER_DATA_METAKEY);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public final class CombatUtils {
|
||||
finalDamage += archeryManager.daze((Player) target);
|
||||
}
|
||||
|
||||
if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canRetrieveArrows()) {
|
||||
if (!arrow.hasMetadata(mcMMO.INFINITE_ARROW_METAKEY) && archeryManager.canRetrieveArrows()) {
|
||||
archeryManager.retrieveArrows(target);
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ public final class CombatUtils {
|
||||
double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow);
|
||||
|
||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
||||
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble() * distanceMultiplier);
|
||||
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, arrow.getMetadata(mcMMO.BOW_FORCE_METAKEY).get(0).asDouble() * distanceMultiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,11 +573,11 @@ public final class CombatUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (target.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
if (target.hasMetadata(mcMMO.UNNATURAL_MOB_METAKEY)) {
|
||||
baseXP *= mcMMO.getConfigManager().getConfigExperience().getSpawnedMobXPMult();
|
||||
}
|
||||
|
||||
if (target.hasMetadata(mcMMO.bredMetadataKey)) {
|
||||
if (target.hasMetadata(mcMMO.BRED_ANIMAL_TRACKING_METAKEY)) {
|
||||
baseXP *= mcMMO.getConfigManager().getConfigExperience().getPlayerBredMobsXPMult();
|
||||
}
|
||||
|
||||
@ -814,7 +814,7 @@ public final class CombatUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.hasMetadata(mcMMO.playerDataKey)) {
|
||||
if (!player.hasMetadata(mcMMO.PLAYER_DATA_METAKEY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public final class ParticleEffectUtils {
|
||||
location.setPitch(-90);
|
||||
|
||||
Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
||||
firework.setMetadata(mcMMO.funfettiMetadataKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
firework.setMetadata(mcMMO.SPAWNED_FIREWORKS_METAKEY, new FixedMetadataValue(mcMMO.p, null));
|
||||
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with((MainConfig.getInstance().getLargeFireworks() ? Type.BALL_LARGE : Type.BALL)).trail(true).build();
|
||||
fireworkMeta.addEffect(effect);
|
||||
|
Loading…
Reference in New Issue
Block a user