mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Code cleanup part 1
This commit is contained in:
parent
ecce631527
commit
d2faac3b0d
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
@ -1,203 +0,0 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabExecutor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AprilCommand implements TabExecutor {
|
|
||||||
private String skillName;
|
|
||||||
|
|
||||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
|
||||||
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
skillName = StringUtils.getCapitalized(label);
|
|
||||||
|
|
||||||
switch (args.length) {
|
|
||||||
case 0:
|
|
||||||
Player player = (Player) sender;
|
|
||||||
FakeSkillType fakeSkillType = FakeSkillType.getByName(skillName);
|
|
||||||
|
|
||||||
float skillValue = Misc.getRandom().nextInt(99);
|
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", getXPGainString(fakeSkillType)));
|
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Level", (int) skillValue, Misc.getRandom().nextInt(1000), 1000 + Misc.getRandom().nextInt(1000)));
|
|
||||||
|
|
||||||
|
|
||||||
List<String> effectMessages = effectsDisplay(fakeSkillType);
|
|
||||||
|
|
||||||
if (!effectMessages.isEmpty()) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.Effects")));
|
|
||||||
|
|
||||||
for (String message : effectMessages) {
|
|
||||||
player.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> statsMessages = statsDisplay(fakeSkillType);
|
|
||||||
|
|
||||||
if (!statsMessages.isEmpty()) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Commands.Stats.Self")));
|
|
||||||
|
|
||||||
for (String message : statsMessages) {
|
|
||||||
player.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.formatString("[[DARK_AQUA]]Guide for {0} available - type /APRIL FOOLS ! :D", skillName));
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getXPGainString(FakeSkillType fakeSkillType) {
|
|
||||||
switch (fakeSkillType) {
|
|
||||||
case MACHO:
|
|
||||||
return "Get beaten up";
|
|
||||||
case JUMPING:
|
|
||||||
return "Kris Kross will make ya Jump Jump";
|
|
||||||
case THROWING:
|
|
||||||
return "Chuck your items on the floor";
|
|
||||||
case WRECKING:
|
|
||||||
return "I'M GONNA WRECK IT!";
|
|
||||||
case CRAFTING:
|
|
||||||
return "Craft apple pies";
|
|
||||||
case WALKING:
|
|
||||||
return "Walk around the park";
|
|
||||||
case SWIMMING:
|
|
||||||
return "Like a fish on a bicycle";
|
|
||||||
case FALLING:
|
|
||||||
return "Faceplant the floor, headbutt the ground";
|
|
||||||
case CLIMBING:
|
|
||||||
return "Climb the highest mountain";
|
|
||||||
case FLYING:
|
|
||||||
return "I believe I can fly";
|
|
||||||
case DIVING:
|
|
||||||
return "Scuba club 4000";
|
|
||||||
case PIGGY:
|
|
||||||
return "OINK! OINK!";
|
|
||||||
default:
|
|
||||||
return "Sit and wait?";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
|
||||||
switch (args.length) {
|
|
||||||
case 1:
|
|
||||||
return ImmutableList.of("?");
|
|
||||||
default:
|
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
|
|
||||||
List<String> messages = new ArrayList<String>();
|
|
||||||
|
|
||||||
switch (fakeSkillType) {
|
|
||||||
case MACHO:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Punching bag", "Absorb damage, like a bag of sand"));
|
|
||||||
break;
|
|
||||||
case JUMPING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Jump", "PRESS SPACE TO JUMP"));
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Jump Twice", "PRESS SPACE TWICE TO JUMP TWICE"));
|
|
||||||
break;
|
|
||||||
case THROWING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Drop Item", "Randomly drop items, at random"));
|
|
||||||
break;
|
|
||||||
case WRECKING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Ralphinator", "Smash windows with your fists"));
|
|
||||||
break;
|
|
||||||
case CRAFTING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Crafting", "Chance of successful craft"));
|
|
||||||
break;
|
|
||||||
case WALKING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Walk", "Traveling gracefully by foot"));
|
|
||||||
break;
|
|
||||||
case SWIMMING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Swim", "Just keep swimming, swimming, swimming"));
|
|
||||||
break;
|
|
||||||
case FALLING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Skydiving", "Go jump of a cliff. No, seriously."));
|
|
||||||
break;
|
|
||||||
case CLIMBING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Rock Climber", "Use string to climb mountains faster"));
|
|
||||||
break;
|
|
||||||
case FLYING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Fly", "Throw yourself at the ground and miss"));
|
|
||||||
break;
|
|
||||||
case DIVING:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Hold Breath", "Press shift to hold your breath longer"));
|
|
||||||
break;
|
|
||||||
case PIGGY:
|
|
||||||
messages.add(LocaleLoader.getString("Effects.Template", "Carrot Turbo", "Supercharge your pigs with carrots"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> statsDisplay(FakeSkillType fakeSkillType) {
|
|
||||||
List<String> messages = new ArrayList<String>();
|
|
||||||
|
|
||||||
switch (fakeSkillType) {
|
|
||||||
case MACHO:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Damage Taken: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(77))));
|
|
||||||
break;
|
|
||||||
case JUMPING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Double Jump Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case THROWING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Drop Item Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(87))));
|
|
||||||
break;
|
|
||||||
case WRECKING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Wrecking Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(14))));
|
|
||||||
break;
|
|
||||||
case CRAFTING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Crafting Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case WALKING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Walk Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case SWIMMING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Swim Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case FALLING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Skydiving Success: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(37))));
|
|
||||||
break;
|
|
||||||
case CLIMBING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Rock Climber Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case FLYING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Fly Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case DIVING:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Hold Breath Chance: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(27))));
|
|
||||||
break;
|
|
||||||
case PIGGY:
|
|
||||||
messages.add(LocaleLoader.formatString("[[RED]]Carrot Turbo Boost: [[YELLOW]]{0}%", decimal.format(Misc.getRandom().nextInt(80)) + 10));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
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;
|
||||||
@ -101,7 +100,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||||
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||||
|
|
||||||
if (ArcaneForging.arcaneForgingEnchantLoss || ArcaneForging.arcaneForgingDowngrades) {
|
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() || mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
|
||||||
messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING,
|
messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING,
|
||||||
String.valueOf(arcaneBypass ? 100 : repairManager.getKeepEnchantChance()),
|
String.valueOf(arcaneBypass ? 100 : repairManager.getKeepEnchantChance()),
|
||||||
String.valueOf(arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance()))); //Jesus those parentheses
|
String.valueOf(arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance()))); //Jesus those parentheses
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package com.gmail.nossr50.config;
|
//package com.gmail.nossr50.config;
|
||||||
|
//
|
||||||
import java.io.File;
|
//import java.io.File;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Represents a config file that registers keys after its initialized
|
// * Represents a config file that registers keys after its initialized
|
||||||
*/
|
// */
|
||||||
public abstract class ConfigCollections extends Config implements RegistersKeys, ConfigCollection {
|
//public abstract class ConfigCollections extends Config implements RegistersKeys, ConfigCollection {
|
||||||
|
//
|
||||||
public ConfigCollections(String pathToParentFolder, String relativePath, boolean mergeNewKeys) {
|
// public ConfigCollections(String pathToParentFolder, String relativePath, boolean mergeNewKeys) {
|
||||||
super(pathToParentFolder, relativePath, mergeNewKeys);
|
// super(pathToParentFolder, relativePath, mergeNewKeys);
|
||||||
loadKeys();
|
// loadKeys();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public ConfigCollections(File pathToParentFolder, String relativePath, boolean mergeNewKeys) {
|
// public ConfigCollections(File pathToParentFolder, String relativePath, boolean mergeNewKeys) {
|
||||||
super(pathToParentFolder, relativePath, mergeNewKeys);
|
// super(pathToParentFolder, relativePath, mergeNewKeys);
|
||||||
loadKeys();
|
// loadKeys();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -380,8 +380,8 @@ public final class ConfigManager {
|
|||||||
public void registerBonusDrops()
|
public void registerBonusDrops()
|
||||||
{
|
{
|
||||||
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
|
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
|
||||||
bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
|
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
|
||||||
bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
|
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateConfigs()
|
public void validateConfigs()
|
||||||
@ -598,6 +598,17 @@ public final class ConfigManager {
|
|||||||
return bonusDropManager;
|
return bonusDropManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this plugin is using retro mode
|
||||||
|
* Retro mode is a 0-1000 skill system
|
||||||
|
* Standard mode is scaled for 1-100
|
||||||
|
* @return true if retro mode is enabled
|
||||||
|
*/
|
||||||
|
public boolean isRetroMode()
|
||||||
|
{
|
||||||
|
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isBonusDropsEnabled(Material material)
|
public boolean isBonusDropsEnabled(Material material)
|
||||||
{
|
{
|
||||||
return getBonusDropManager().isBonusDropWhitelisted(material);
|
return getBonusDropManager().isBonusDropWhitelisted(material);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.datatypes.experience;
|
package com.gmail.nossr50.datatypes.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
|
||||||
import java.util.concurrent.Delayed;
|
import java.util.concurrent.Delayed;
|
||||||
|
@ -122,7 +122,7 @@ public class AlchemyPotion {
|
|||||||
if (!children.isEmpty()) {
|
if (!children.isEmpty()) {
|
||||||
for (Entry<ItemStack, String> child : children.entrySet()) {
|
for (Entry<ItemStack, String> child : children.entrySet()) {
|
||||||
if (ingredient.isSimilar(child.getKey())) {
|
if (ingredient.isSimilar(child.getKey())) {
|
||||||
return PotionMainConfig.getInstance().getPotion(child.getValue());
|
return PotionConfig.getInstance().getPotion(child.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.subskills;
|
package com.gmail.nossr50.datatypes.skills.subskills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.CoreSkillsConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Rank;
|
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Rank;
|
||||||
@ -41,7 +42,7 @@ public abstract class AbstractSubSkill implements SubSkill, Interaction, Rank, S
|
|||||||
@Override @Deprecated
|
@Override @Deprecated
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
//TODO: This might be troublesome...
|
//TODO: This might be troublesome...
|
||||||
return CoreSkillsMainConfig.getInstance().isSkillEnabled(this);
|
return CoreSkillsConfig.getInstance().isSkillEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,9 +64,9 @@ public class BlockListener implements Listener {
|
|||||||
if(is.getAmount() <= 0)
|
if(is.getAmount() <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
if(!MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
||||||
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
||||||
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0)
|
if(event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0)
|
||||||
@ -245,7 +245,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (blockState.getType() == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player)) {
|
if (blockState.getType() == Repair.getInstance().getAnvilMaterial() && PrimarySkillType.REPAIR.getPermissions(player)) {
|
||||||
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
||||||
}
|
}
|
||||||
else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player)) {
|
else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player)) {
|
||||||
|
@ -895,13 +895,10 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!event.isCancelled())
|
if(mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
|
||||||
{
|
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||||
if(mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
|
|
||||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
|
||||||
|
|
||||||
UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
|
UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,10 +439,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isSharable(dropStack)) {
|
||||||
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
/*if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
||||||
|
@ -16,7 +16,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
import com.gmail.nossr50.datatypes.skills.subskills.acrobatics.Roll;
|
||||||
import com.gmail.nossr50.listeners.*;
|
import com.gmail.nossr50.listeners.*;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.runnables.CheckDateTask;
|
|
||||||
import com.gmail.nossr50.runnables.SaveTimerTask;
|
import com.gmail.nossr50.runnables.SaveTimerTask;
|
||||||
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
import com.gmail.nossr50.runnables.backups.CleanBackupsTask;
|
||||||
import com.gmail.nossr50.runnables.database.UserPurgeTask;
|
import com.gmail.nossr50.runnables.database.UserPurgeTask;
|
||||||
@ -28,7 +27,10 @@ import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
|||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.ChimaeraWing;
|
||||||
|
import com.gmail.nossr50.util.LogFilter;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
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;
|
||||||
@ -60,7 +62,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//private static ModManager modManager;
|
//private static ModManager modManager;
|
||||||
private static DatabaseManager databaseManager;
|
private static DatabaseManager databaseManager;
|
||||||
private static FormulaManager formulaManager;
|
private static FormulaManager formulaManager;
|
||||||
private static HolidayManager holidayManager;
|
/*private static HolidayManager holidayManager;*/
|
||||||
//private static UpgradeManager upgradeManager;
|
//private static UpgradeManager upgradeManager;
|
||||||
|
|
||||||
/* File Paths */
|
/* File Paths */
|
||||||
@ -153,7 +155,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
PartyManager.loadParties();
|
PartyManager.loadParties();
|
||||||
|
|
||||||
formulaManager = new FormulaManager();
|
formulaManager = new FormulaManager();
|
||||||
holidayManager = new HolidayManager();
|
/*holidayManager = new HolidayManager();*/
|
||||||
|
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
@ -273,7 +275,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
ScoreboardManager.teardownAll();
|
ScoreboardManager.teardownAll();
|
||||||
|
|
||||||
formulaManager.saveFormula();
|
formulaManager.saveFormula();
|
||||||
holidayManager.saveAnniversaryFiles();
|
/*holidayManager.saveAnniversaryFiles();*/
|
||||||
placeStore.saveAll(); // Save our metadata
|
placeStore.saveAll(); // Save our metadata
|
||||||
placeStore.cleanUp(); // Cleanup empty metadata stores
|
placeStore.cleanUp(); // Cleanup empty metadata stores
|
||||||
}
|
}
|
||||||
@ -348,9 +350,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
return formulaManager;
|
return formulaManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HolidayManager getHolidayManager() {
|
/*public static HolidayManager getHolidayManager() {
|
||||||
return holidayManager;
|
return holidayManager;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ChunkManager getPlaceStore() {
|
public static ChunkManager getPlaceStore() {
|
||||||
return placeStore;
|
return placeStore;
|
||||||
@ -584,9 +586,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
// Update power level tag scoreboards
|
// Update power level tag scoreboards
|
||||||
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
|
|
||||||
if (getHolidayManager().nearingAprilFirst()) {
|
/*if (getHolidayManager().nearingAprilFirst()) {
|
||||||
new CheckDateTask().runTaskTimer(this, 10L * Misc.TICK_CONVERSION_FACTOR, 1L * 60L * 60L * Misc.TICK_CONVERSION_FACTOR);
|
new CheckDateTask().runTaskTimer(this, 10L * Misc.TICK_CONVERSION_FACTOR, 1L * 60L * 60L * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Clear the registered XP data so players can earn XP again
|
// Clear the registered XP data so players can earn XP again
|
||||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||||
@ -623,7 +625,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
* @return true if retro mode is enabled
|
* @return true if retro mode is enabled
|
||||||
*/
|
*/
|
||||||
public static boolean isRetroModeEnabled() {
|
public static boolean isRetroModeEnabled() {
|
||||||
return getPlayerLevelingSettings().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
|
return configManager.isRetroMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigManager getConfigManager() {
|
public static ConfigManager getConfigManager() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.runnables.database;
|
package com.gmail.nossr50.runnables.database;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.HolidayManager;
|
|
||||||
import com.gmail.nossr50.util.Misc;
|
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Statistic;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class AprilTask extends BukkitRunnable {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!mcMMO.getHolidayManager().isAprilFirst()) {
|
|
||||||
this.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
||||||
int random = Misc.getRandom().nextInt(40) + 11;
|
|
||||||
int betterRandom = Misc.getRandom().nextInt(2000);
|
|
||||||
if (betterRandom == 0) {
|
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
|
||||||
player.sendMessage(unknown("superskill") + " skill increased by 1. Total (" + unknown("12") + ")");
|
|
||||||
// fireworksShow(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Statistic statistic : mcMMO.getHolidayManager().movementStatistics) {
|
|
||||||
if (player.getStatistic(statistic) > 0 && player.getStatistic(statistic) % random == 0) {
|
|
||||||
mcMMO.getHolidayManager().levelUpApril(player, HolidayManager.FakeSkillType.getByStatistic(statistic));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*private void fireworksShow(final Player player) {
|
|
||||||
final int firework_amount = 10;
|
|
||||||
for (int i = 0; i < firework_amount; i++) {
|
|
||||||
int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
|
|
||||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mcMMO.getHolidayManager().spawnFireworks(player);
|
|
||||||
}
|
|
||||||
}, delay);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private String unknown(String string) {
|
|
||||||
return ChatColor.MAGIC + string + ChatColor.RESET + ChatColor.YELLOW;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
import com.gmail.nossr50.util.MobHealthbarUtils;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.alchemy;
|
package com.gmail.nossr50.skills.alchemy;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.alchemy;
|
package com.gmail.nossr50.skills.alchemy;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -25,7 +27,7 @@ public class AlchemyManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getIngredients() {
|
public List<ItemStack> getIngredients() {
|
||||||
return PotionMainConfig.getInstance().getIngredients(getTier());
|
return PotionConfig.getInstance().getIngredients(getTier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIngredientList() {
|
public String getIngredientList() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.alchemy;
|
package com.gmail.nossr50.skills.alchemy;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
@ -34,7 +35,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getChildPotion(PotionMainConfig.getInstance().getPotion(contents[i]), contents[Alchemy.INGREDIENT_SLOT]) != null) {
|
if (getChildPotion(PotionConfig.getInstance().getPotion(contents[i]), contents[Alchemy.INGREDIENT_SLOT]) != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +93,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getValidIngredients(Player player) {
|
private static List<ItemStack> getValidIngredients(Player player) {
|
||||||
return PotionMainConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||||
@ -112,11 +113,11 @@ public final class AlchemyPotionBrewer {
|
|||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ItemStack item = inventory.getItem(i);
|
ItemStack item = inventory.getItem(i);
|
||||||
|
|
||||||
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionMainConfig.getInstance().isValidPotion(item)) {
|
if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AlchemyPotion input = PotionMainConfig.getInstance().getPotion(item);
|
AlchemyPotion input = PotionConfig.getInstance().getPotion(item);
|
||||||
AlchemyPotion output = input.getChild(ingredient);
|
AlchemyPotion output = input.getChild(ingredient);
|
||||||
|
|
||||||
inputList.add(input);
|
inputList.add(input);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -13,13 +15,24 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Archery {
|
public class Archery {
|
||||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
private static List<TrackedEntity> trackedEntities;
|
||||||
|
|
||||||
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
public static double skillShotMaxBonusDamage;
|
||||||
|
|
||||||
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
public static double dazeBonusDamage;
|
||||||
|
|
||||||
public static final double DISTANCE_XP_MULTIPLIER = ExperienceConfig.getInstance().getArcheryDistanceMultiplier();
|
public static double DISTANCE_XP_MULTIPLIER;
|
||||||
|
|
||||||
|
public Archery()
|
||||||
|
{
|
||||||
|
List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
||||||
|
|
||||||
|
skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||||
|
|
||||||
|
dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
||||||
|
|
||||||
|
DISTANCE_XP_MULTIPLIER = ExperienceConfig.getInstance().getArcheryDistanceMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
/*
|
||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
|
||||||
public class ArcaneForging {
|
public class ArcaneForging {
|
||||||
|
|
||||||
public static boolean arcaneForgingDowngrades = AdvancedConfig.getInstance().getArcaneForgingDowngradeEnabled();
|
|
||||||
public static boolean arcaneForgingEnchantLoss = AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled();
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -4,14 +4,41 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class Repair {
|
public class Repair {
|
||||||
public static Material anvilMaterial;
|
private static Repair instance;
|
||||||
|
private Material anvilMaterial;
|
||||||
|
private double repairMasteryMaxBonus;
|
||||||
|
private double repairMasteryMaxBonusLevel;
|
||||||
|
|
||||||
public Repair() {
|
public Repair() {
|
||||||
anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
|
anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
|
||||||
|
|
||||||
|
if(mcMMO.isRetroModeEnabled())
|
||||||
|
{
|
||||||
|
repairMasteryMaxBonus = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusPercentage();
|
||||||
|
repairMasteryMaxBonusLevel = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusLevel();
|
||||||
|
} else {
|
||||||
|
repairMasteryMaxBonus = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getStandard().getMaxBonusPercentage();
|
||||||
|
repairMasteryMaxBonusLevel = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getStandard().getMaxBonusLevel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Material getRepairAnvilMaterial()
|
public static Repair getInstance()
|
||||||
{
|
{
|
||||||
|
if(instance == null)
|
||||||
|
instance = new Repair();
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Material getAnvilMaterial() {
|
||||||
return anvilMaterial;
|
return anvilMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getRepairMasteryMaxBonus() {
|
||||||
|
return repairMasteryMaxBonus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRepairMasteryMaxBonusLevel() {
|
||||||
|
return repairMasteryMaxBonusLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,8 @@ public class RepairManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle the enchants
|
// Handle the enchants
|
||||||
if (ArcaneForging.arcaneForgingEnchantLoss) {
|
// if (ArcaneForging.arcaneForgingEnchantLoss) {
|
||||||
|
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
|
||||||
addEnchants(item);
|
addEnchants(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,8 +274,8 @@ public class RepairManager extends SkillManager {
|
|||||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY)
|
if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY)
|
||||||
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
|
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
|
||||||
|
|
||||||
double maxBonusCalc = Repair.repairMasteryMaxBonus / 100.0D;
|
double maxBonusCalc = Repair.getInstance().getRepairMasteryMaxBonus() / 100.0D;
|
||||||
double skillLevelBonusCalc = (Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * (getSkillLevel() / 100.0D);
|
double skillLevelBonusCalc = (Repair.getInstance().getRepairMasteryMaxBonus() / Repair.getInstance().getRepairMasteryMaxBonusLevel()) * (getSkillLevel() / 100.0D);
|
||||||
double bonus = repairAmount * Math.min(skillLevelBonusCalc, maxBonusCalc);
|
double bonus = repairAmount * Math.min(skillLevelBonusCalc, maxBonusCalc);
|
||||||
|
|
||||||
repairAmount += bonus;
|
repairAmount += bonus;
|
||||||
@ -344,7 +345,7 @@ public class RepairManager extends SkillManager {
|
|||||||
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getKeepEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING))) {
|
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getKeepEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING))) {
|
||||||
int enchantLevel = enchant.getValue();
|
int enchantLevel = enchant.getValue();
|
||||||
|
|
||||||
if (ArcaneForging.arcaneForgingDowngrades && enchantLevel > 1
|
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() && enchantLevel > 1
|
||||||
&& (!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(100 - getDowngradeEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING)))) {
|
&& (!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(100 - getDowngradeEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING)))) {
|
||||||
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
||||||
downgraded = true;
|
downgraded = true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
@ -1,383 +1,383 @@
|
|||||||
package com.gmail.nossr50.util;
|
//package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.skills.AprilCommand;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Statistic;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public final class HolidayManager {
|
|
||||||
private ArrayList<String> hasCelebrated;
|
|
||||||
private int currentYear;
|
|
||||||
private static final int START_YEAR = 2011;
|
|
||||||
|
|
||||||
private static final List<Color> ALL_COLORS;
|
|
||||||
private static final List<ChatColor> ALL_CHAT_COLORS;
|
|
||||||
private static final List<ChatColor> CHAT_FORMATS;
|
|
||||||
|
|
||||||
public enum FakeSkillType {
|
|
||||||
MACHO,
|
|
||||||
JUMPING,
|
|
||||||
THROWING,
|
|
||||||
WRECKING,
|
|
||||||
CRAFTING,
|
|
||||||
WALKING,
|
|
||||||
SWIMMING,
|
|
||||||
FALLING,
|
|
||||||
CLIMBING,
|
|
||||||
FLYING,
|
|
||||||
DIVING,
|
|
||||||
PIGGY,
|
|
||||||
UNKNOWN;
|
|
||||||
|
|
||||||
public static FakeSkillType getByName(String skillName) {
|
|
||||||
for (FakeSkillType type : values()) {
|
|
||||||
if (type.name().equalsIgnoreCase(skillName)) {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static FakeSkillType getByStatistic(Statistic statistic) {
|
|
||||||
switch (statistic) {
|
|
||||||
case DAMAGE_TAKEN:
|
|
||||||
return FakeSkillType.MACHO;
|
|
||||||
case JUMP:
|
|
||||||
return FakeSkillType.JUMPING;
|
|
||||||
case DROP:
|
|
||||||
return FakeSkillType.THROWING;
|
|
||||||
case MINE_BLOCK:
|
|
||||||
case BREAK_ITEM:
|
|
||||||
return FakeSkillType.WRECKING;
|
|
||||||
case CRAFT_ITEM:
|
|
||||||
return FakeSkillType.CRAFTING;
|
|
||||||
case WALK_ONE_CM:
|
|
||||||
return FakeSkillType.WALKING;
|
|
||||||
case SWIM_ONE_CM:
|
|
||||||
return FakeSkillType.SWIMMING;
|
|
||||||
case FALL_ONE_CM:
|
|
||||||
return FakeSkillType.FALLING;
|
|
||||||
case CLIMB_ONE_CM:
|
|
||||||
return FakeSkillType.CLIMBING;
|
|
||||||
case FLY_ONE_CM:
|
|
||||||
return FakeSkillType.FLYING;
|
|
||||||
case WALK_UNDER_WATER_ONE_CM:
|
|
||||||
return FakeSkillType.DIVING;
|
|
||||||
case PIG_ONE_CM:
|
|
||||||
return FakeSkillType.PIGGY;
|
|
||||||
default:
|
|
||||||
return FakeSkillType.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Set<Statistic> movementStatistics = EnumSet.of(
|
|
||||||
Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
|
|
||||||
Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.WALK_UNDER_WATER_ONE_CM,
|
|
||||||
Statistic.PIG_ONE_CM);
|
|
||||||
|
|
||||||
static {
|
|
||||||
List<Color> colors = new ArrayList<Color>();
|
|
||||||
List<ChatColor> chatColors = new ArrayList<ChatColor>();
|
|
||||||
List<ChatColor> chatFormats = new ArrayList<ChatColor>();
|
|
||||||
|
|
||||||
for (ChatColor color : ChatColor.values()) {
|
|
||||||
if (color.isColor()) {
|
|
||||||
chatColors.add(color);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
chatFormats.add(color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (DyeColor color : DyeColor.values()) {
|
|
||||||
// colors.add(color.getFireworkColor());
|
|
||||||
// }
|
|
||||||
|
|
||||||
Collections.shuffle(chatColors, Misc.getRandom());
|
|
||||||
Collections.shuffle(colors, Misc.getRandom());
|
|
||||||
Collections.shuffle(chatFormats, Misc.getRandom());
|
|
||||||
|
|
||||||
ALL_CHAT_COLORS = ImmutableList.copyOf(chatColors);
|
|
||||||
ALL_COLORS = ImmutableList.copyOf(colors);
|
|
||||||
CHAT_FORMATS = ImmutableList.copyOf(chatFormats);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This gets called onEnable
|
|
||||||
public HolidayManager() {
|
|
||||||
currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
|
||||||
|
|
||||||
File anniversaryFile = new File(mcMMO.getFlatFileDirectory(), "anniversary." + currentYear + ".yml");
|
|
||||||
|
|
||||||
if (!anniversaryFile.exists()) {
|
|
||||||
try {
|
|
||||||
anniversaryFile.createNewFile();
|
|
||||||
}
|
|
||||||
catch (IOException ex) {
|
|
||||||
mcMMO.p.getLogger().severe(ex.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hasCelebrated = new ArrayList<String>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
hasCelebrated.clear();
|
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(anniversaryFile.getPath()));
|
|
||||||
String line = reader.readLine();
|
|
||||||
|
|
||||||
while (line != null) {
|
|
||||||
hasCelebrated.add(line);
|
|
||||||
line = reader.readLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.close();
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
mcMMO.p.getLogger().severe(ex.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanupFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cleanupFiles() {
|
|
||||||
File FlatFileDir = new File(mcMMO.getFlatFileDirectory());
|
|
||||||
File legacy = new File(FlatFileDir, "anniversary.yml");
|
|
||||||
List<File> toDelete = new ArrayList<File>();
|
|
||||||
|
|
||||||
if (legacy.exists()) {
|
|
||||||
toDelete.add(legacy);
|
|
||||||
}
|
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile("anniversary\\.(?:.+)\\.yml");
|
|
||||||
|
|
||||||
for (String fileName : FlatFileDir.list()) {
|
|
||||||
if (!pattern.matcher(fileName).matches() || fileName.equals("anniversary." + currentYear + ".yml")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(FlatFileDir, fileName);
|
|
||||||
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
toDelete.add(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File file : toDelete) {
|
|
||||||
if (file.delete()) {
|
|
||||||
mcMMO.p.debug("Deleted: " + file.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This gets called onDisable
|
|
||||||
public void saveAnniversaryFiles() {
|
|
||||||
mcMMO.p.debug("Saving anniversary files...");
|
|
||||||
String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml";
|
|
||||||
|
|
||||||
try {
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(anniversaryFilePath));
|
|
||||||
for (String player : hasCelebrated) {
|
|
||||||
writer.write(player);
|
|
||||||
writer.newLine();
|
|
||||||
}
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
mcMMO.p.getLogger().severe(ex.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This gets called from /mcmmo command
|
|
||||||
public void anniversaryCheck(final CommandSender sender) {
|
|
||||||
GregorianCalendar anniversaryStart = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 3);
|
|
||||||
GregorianCalendar anniversaryEnd = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 6);
|
|
||||||
GregorianCalendar day = new GregorianCalendar();
|
|
||||||
|
|
||||||
if (hasCelebrated.contains(sender.getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getDateRange(day.getTime(), anniversaryStart.getTime(), anniversaryEnd.getTime())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR)));
|
|
||||||
/*if (sender instanceof Player) {
|
|
||||||
final int firework_amount = 10;
|
|
||||||
for (int i = 0; i < firework_amount; i++) {
|
|
||||||
int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
|
|
||||||
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
spawnFireworks((Player) sender);
|
|
||||||
}
|
|
||||||
}, delay);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// else {
|
|
||||||
/*
|
|
||||||
* Credit: http://www.geocities.com/spunk1111/
|
|
||||||
* (good luck finding that in 3 years heh)
|
|
||||||
* .''. . *''* :_\/_: .
|
|
||||||
* :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'.
|
|
||||||
* .''.: /\ : /)\ ':'* /\ * : '..'. -=:o:=-
|
|
||||||
* :_\/_:'.:::. ' *''* * '.\'/.'_\(/_ '.':'.'
|
|
||||||
* : /\ : ::::: *_\/_* -= o =- /)\ '
|
|
||||||
* '..' ':::' * /\ * .'/.\'. ' *
|
|
||||||
* * *..* : *
|
|
||||||
* * * *
|
|
||||||
* * * *
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Color map
|
|
||||||
* AAAA D GGGG JJJJJJ K
|
|
||||||
* AAAAAA DDDDD EEEGGGGGG JJJJJJ KKKKKKK
|
|
||||||
* BBBBAAAAAA DDD EEEGGGGGG I JJJJJ KKKKKKK
|
|
||||||
* BBBBBBACCCCC D FFFF G IIIIIIIHHHHH KKKKKKK
|
|
||||||
* BBBBBB CCCCC FFFFFF IIIIIII HHH K
|
|
||||||
* BBBB CCCCC FFFFFF IIIIIII H k
|
|
||||||
* b FFFF I k
|
|
||||||
* b i k
|
|
||||||
* b i k
|
|
||||||
*/
|
|
||||||
Object[] colorParams = new Object[]{chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose()};
|
|
||||||
sender.sendMessage(String.format(" %1$s.''. %4$s. %7$s*''* %10$s:_\\/_: %11$s.", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %1$s:_\\/_: %4$s_\\(/_ %5$s.:.%7$s*_\\/_* %10$s: /\\ : %11$s.'.:.'.", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %2$s.''.%1$s: /\\ : %4$s/)\\ %5$s':'%7$s* /\\ * %9$s: %10$s'..'. %11$s-=:o:=-", colorParams));
|
|
||||||
sender.sendMessage(String.format("%2$s:_\\/_:%1$s'%3$s.:::. %4$s' %6$s*''* %7$s* %9$s'.\\'/.'%8$s_\\(/_ %11$s'.':'.'", colorParams));
|
|
||||||
sender.sendMessage(String.format("%2$s: /\\ : %3$s::::: %6$s*_\\/_* %9$s-= o =-%8$s /)\\ %11$s'", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %2$s'..' %3$s':::' %6$s* /\\ * %9$s.'/.\\'. %8$s' %11$s*", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %2$s* %6$s*..* %9$s: %11$s*", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams));
|
|
||||||
sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams));
|
|
||||||
// }
|
|
||||||
|
|
||||||
hasCelebrated.add(sender.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getDateRange(Date date, Date start, Date end) {
|
|
||||||
return !(date.before(start) || date.after(end));
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void spawnFireworks(Player player) {
|
|
||||||
// int power = Misc.getRandom().nextInt(3) + 1;
|
|
||||||
// Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)];
|
|
||||||
// double varX = Misc.getRandom().nextGaussian() * 3;
|
|
||||||
// double varZ = Misc.getRandom().nextGaussian() * 3;
|
|
||||||
//
|
//
|
||||||
// Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK);
|
//import com.gmail.nossr50.commands.skills.AprilCommand;
|
||||||
// FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
|
//import com.gmail.nossr50.config.Config;
|
||||||
// FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build();
|
//import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
// fireworkmeta.addEffect(effect);
|
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
// fireworkmeta.setPower(power);
|
//import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
// fireworks.setFireworkMeta(fireworkmeta);
|
//import com.gmail.nossr50.mcMMO;
|
||||||
|
//import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
|
//import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
//import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
|
//import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
|
//import com.google.common.collect.ImmutableList;
|
||||||
|
//import org.bukkit.ChatColor;
|
||||||
|
//import org.bukkit.Color;
|
||||||
|
//import org.bukkit.Statistic;
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//import org.bukkit.command.PluginCommand;
|
||||||
|
//import org.bukkit.entity.Player;
|
||||||
|
//import org.bukkit.event.player.PlayerStatisticIncrementEvent;
|
||||||
|
//
|
||||||
|
//import java.io.*;
|
||||||
|
//import java.util.*;
|
||||||
|
//import java.util.regex.Pattern;
|
||||||
|
//
|
||||||
|
//public final class HolidayManager {
|
||||||
|
// private ArrayList<String> hasCelebrated;
|
||||||
|
// private int currentYear;
|
||||||
|
// private static final int START_YEAR = 2011;
|
||||||
|
//
|
||||||
|
// private static final List<Color> ALL_COLORS;
|
||||||
|
// private static final List<ChatColor> ALL_CHAT_COLORS;
|
||||||
|
// private static final List<ChatColor> CHAT_FORMATS;
|
||||||
|
//
|
||||||
|
// public enum FakeSkillType {
|
||||||
|
// MACHO,
|
||||||
|
// JUMPING,
|
||||||
|
// THROWING,
|
||||||
|
// WRECKING,
|
||||||
|
// CRAFTING,
|
||||||
|
// WALKING,
|
||||||
|
// SWIMMING,
|
||||||
|
// FALLING,
|
||||||
|
// CLIMBING,
|
||||||
|
// FLYING,
|
||||||
|
// DIVING,
|
||||||
|
// PIGGY,
|
||||||
|
// UNKNOWN;
|
||||||
|
//
|
||||||
|
// public static FakeSkillType getByName(String skillName) {
|
||||||
|
// for (FakeSkillType type : values()) {
|
||||||
|
// if (type.name().equalsIgnoreCase(skillName)) {
|
||||||
|
// return type;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static FakeSkillType getByStatistic(Statistic statistic) {
|
||||||
|
// switch (statistic) {
|
||||||
|
// case DAMAGE_TAKEN:
|
||||||
|
// return FakeSkillType.MACHO;
|
||||||
|
// case JUMP:
|
||||||
|
// return FakeSkillType.JUMPING;
|
||||||
|
// case DROP:
|
||||||
|
// return FakeSkillType.THROWING;
|
||||||
|
// case MINE_BLOCK:
|
||||||
|
// case BREAK_ITEM:
|
||||||
|
// return FakeSkillType.WRECKING;
|
||||||
|
// case CRAFT_ITEM:
|
||||||
|
// return FakeSkillType.CRAFTING;
|
||||||
|
// case WALK_ONE_CM:
|
||||||
|
// return FakeSkillType.WALKING;
|
||||||
|
// case SWIM_ONE_CM:
|
||||||
|
// return FakeSkillType.SWIMMING;
|
||||||
|
// case FALL_ONE_CM:
|
||||||
|
// return FakeSkillType.FALLING;
|
||||||
|
// case CLIMB_ONE_CM:
|
||||||
|
// return FakeSkillType.CLIMBING;
|
||||||
|
// case FLY_ONE_CM:
|
||||||
|
// return FakeSkillType.FLYING;
|
||||||
|
// case WALK_UNDER_WATER_ONE_CM:
|
||||||
|
// return FakeSkillType.DIVING;
|
||||||
|
// case PIG_ONE_CM:
|
||||||
|
// return FakeSkillType.PIGGY;
|
||||||
|
// default:
|
||||||
|
// return FakeSkillType.UNKNOWN;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
private static List<Color> colorChoose() {
|
// public final Set<Statistic> movementStatistics = EnumSet.of(
|
||||||
return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1));
|
// Statistic.WALK_ONE_CM, Statistic.SWIM_ONE_CM, Statistic.FALL_ONE_CM,
|
||||||
}
|
// Statistic.CLIMB_ONE_CM, Statistic.FLY_ONE_CM, Statistic.WALK_UNDER_WATER_ONE_CM,
|
||||||
|
// Statistic.PIG_ONE_CM);
|
||||||
private static String chatColorChoose() {
|
//
|
||||||
StringBuilder ret = new StringBuilder(ALL_CHAT_COLORS.get(Misc.getRandom().nextInt(ALL_CHAT_COLORS.size())).toString());
|
// static {
|
||||||
|
// List<Color> colors = new ArrayList<Color>();
|
||||||
for (ChatColor chatFormat : CHAT_FORMATS) {
|
// List<ChatColor> chatColors = new ArrayList<ChatColor>();
|
||||||
if (Misc.getRandom().nextInt(CHAT_FORMATS.size()) == 0) {
|
// List<ChatColor> chatFormats = new ArrayList<ChatColor>();
|
||||||
ret.append(chatFormat);
|
//
|
||||||
}
|
// for (ChatColor color : ChatColor.values()) {
|
||||||
}
|
// if (color.isColor()) {
|
||||||
|
// chatColors.add(color);
|
||||||
return ret.toString();
|
// }
|
||||||
}
|
// else {
|
||||||
|
// chatFormats.add(color);
|
||||||
public boolean isAprilFirst() {
|
// }
|
||||||
if(!Config.getInstance().isAprilFoolsAllowed())
|
// }
|
||||||
return false;
|
//
|
||||||
|
//// for (DyeColor color : DyeColor.values()) {
|
||||||
GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
|
//// colors.add(color.getFireworkColor());
|
||||||
GregorianCalendar aprilSecond = new GregorianCalendar(currentYear, Calendar.APRIL, 2);
|
//// }
|
||||||
GregorianCalendar day = new GregorianCalendar();
|
//
|
||||||
return getDateRange(day.getTime(), aprilFirst.getTime(), aprilSecond.getTime());
|
// Collections.shuffle(chatColors, Misc.getRandom());
|
||||||
}
|
// Collections.shuffle(colors, Misc.getRandom());
|
||||||
|
// Collections.shuffle(chatFormats, Misc.getRandom());
|
||||||
public boolean nearingAprilFirst() {
|
//
|
||||||
if(!Config.getInstance().isAprilFoolsAllowed())
|
// ALL_CHAT_COLORS = ImmutableList.copyOf(chatColors);
|
||||||
return false;
|
// ALL_COLORS = ImmutableList.copyOf(colors);
|
||||||
|
// CHAT_FORMATS = ImmutableList.copyOf(chatFormats);
|
||||||
GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
|
// }
|
||||||
GregorianCalendar end = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.APRIL, 2);
|
//
|
||||||
GregorianCalendar day = new GregorianCalendar();
|
// // This gets called onEnable
|
||||||
|
// public HolidayManager() {
|
||||||
return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
|
// currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||||
}
|
//
|
||||||
|
// File anniversaryFile = new File(mcMMO.getFlatFileDirectory(), "anniversary." + currentYear + ".yml");
|
||||||
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
|
//
|
||||||
Player player = event.getPlayer();
|
// if (!anniversaryFile.exists()) {
|
||||||
Statistic statistic = event.getStatistic();
|
// try {
|
||||||
int newValue = event.getNewValue();
|
// anniversaryFile.createNewFile();
|
||||||
|
// }
|
||||||
int modifier;
|
// catch (IOException ex) {
|
||||||
switch (statistic) {
|
// mcMMO.p.getLogger().severe(ex.toString());
|
||||||
case DAMAGE_TAKEN:
|
// }
|
||||||
modifier = 500;
|
// }
|
||||||
break;
|
//
|
||||||
case JUMP:
|
// hasCelebrated = new ArrayList<String>();
|
||||||
modifier = 500;
|
//
|
||||||
break;
|
// try {
|
||||||
case DROP:
|
// hasCelebrated.clear();
|
||||||
modifier = 200;
|
// BufferedReader reader = new BufferedReader(new FileReader(anniversaryFile.getPath()));
|
||||||
break;
|
// String line = reader.readLine();
|
||||||
case MINE_BLOCK:
|
//
|
||||||
case BREAK_ITEM:
|
// while (line != null) {
|
||||||
modifier = 500;
|
// hasCelebrated.add(line);
|
||||||
break;
|
// line = reader.readLine();
|
||||||
case CRAFT_ITEM:
|
// }
|
||||||
modifier = 100;
|
//
|
||||||
break;
|
// reader.close();
|
||||||
default:
|
// }
|
||||||
return;
|
// catch (Exception ex) {
|
||||||
}
|
// mcMMO.p.getLogger().severe(ex.toString());
|
||||||
|
// }
|
||||||
if (newValue % modifier == 0) {
|
//
|
||||||
mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
|
// cleanupFiles();
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
|
// private void cleanupFiles() {
|
||||||
public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
|
// File FlatFileDir = new File(mcMMO.getFlatFileDirectory());
|
||||||
if(!Config.getInstance().isAprilFoolsAllowed())
|
// File legacy = new File(FlatFileDir, "anniversary.yml");
|
||||||
return;
|
// List<File> toDelete = new ArrayList<File>();
|
||||||
|
//
|
||||||
int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1;
|
// if (legacy.exists()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
// toDelete.add(legacy);
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal));
|
// }
|
||||||
// ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
|
//
|
||||||
}
|
// Pattern pattern = Pattern.compile("anniversary\\.(?:.+)\\.yml");
|
||||||
|
//
|
||||||
public void registerAprilCommand() {
|
// for (String fileName : FlatFileDir.list()) {
|
||||||
if(!Config.getInstance().isAprilFoolsAllowed())
|
// if (!pattern.matcher(fileName).matches() || fileName.equals("anniversary." + currentYear + ".yml")) {
|
||||||
return;
|
// continue;
|
||||||
|
// }
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcfools");
|
//
|
||||||
command.setExecutor(new AprilCommand());
|
// File file = new File(FlatFileDir, fileName);
|
||||||
}
|
//
|
||||||
}
|
// if (file.isDirectory()) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// toDelete.add(file);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (File file : toDelete) {
|
||||||
|
// if (file.delete()) {
|
||||||
|
// mcMMO.p.debug("Deleted: " + file.getName());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // This gets called onDisable
|
||||||
|
// public void saveAnniversaryFiles() {
|
||||||
|
// mcMMO.p.debug("Saving anniversary files...");
|
||||||
|
// String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml";
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// BufferedWriter writer = new BufferedWriter(new FileWriter(anniversaryFilePath));
|
||||||
|
// for (String player : hasCelebrated) {
|
||||||
|
// writer.write(player);
|
||||||
|
// writer.newLine();
|
||||||
|
// }
|
||||||
|
// writer.close();
|
||||||
|
// }
|
||||||
|
// catch (Exception ex) {
|
||||||
|
// mcMMO.p.getLogger().severe(ex.toString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // This gets called from /mcmmo command
|
||||||
|
// public void anniversaryCheck(final CommandSender sender) {
|
||||||
|
// GregorianCalendar anniversaryStart = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 3);
|
||||||
|
// GregorianCalendar anniversaryEnd = new GregorianCalendar(currentYear, Calendar.FEBRUARY, 6);
|
||||||
|
// GregorianCalendar day = new GregorianCalendar();
|
||||||
|
//
|
||||||
|
// if (hasCelebrated.contains(sender.getName())) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!getDateRange(day.getTime(), anniversaryStart.getTime(), anniversaryEnd.getTime())) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// sender.sendMessage(LocaleLoader.getString("Holiday.Anniversary", (currentYear - START_YEAR)));
|
||||||
|
// /*if (sender instanceof Player) {
|
||||||
|
// final int firework_amount = 10;
|
||||||
|
// for (int i = 0; i < firework_amount; i++) {
|
||||||
|
// int delay = (int) (Misc.getRandom().nextDouble() * 3 * Misc.TICK_CONVERSION_FACTOR) + 4;
|
||||||
|
// mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// spawnFireworks((Player) sender);
|
||||||
|
// }
|
||||||
|
// }, delay);
|
||||||
|
// }
|
||||||
|
// }*/
|
||||||
|
//// else {
|
||||||
|
// /*
|
||||||
|
// * Credit: http://www.geocities.com/spunk1111/
|
||||||
|
// * (good luck finding that in 3 years heh)
|
||||||
|
// * .''. . *''* :_\/_: .
|
||||||
|
// * :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'.
|
||||||
|
// * .''.: /\ : /)\ ':'* /\ * : '..'. -=:o:=-
|
||||||
|
// * :_\/_:'.:::. ' *''* * '.\'/.'_\(/_ '.':'.'
|
||||||
|
// * : /\ : ::::: *_\/_* -= o =- /)\ '
|
||||||
|
// * '..' ':::' * /\ * .'/.\'. ' *
|
||||||
|
// * * *..* : *
|
||||||
|
// * * * *
|
||||||
|
// * * * *
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// * Color map
|
||||||
|
// * AAAA D GGGG JJJJJJ K
|
||||||
|
// * AAAAAA DDDDD EEEGGGGGG JJJJJJ KKKKKKK
|
||||||
|
// * BBBBAAAAAA DDD EEEGGGGGG I JJJJJ KKKKKKK
|
||||||
|
// * BBBBBBACCCCC D FFFF G IIIIIIIHHHHH KKKKKKK
|
||||||
|
// * BBBBBB CCCCC FFFFFF IIIIIII HHH K
|
||||||
|
// * BBBB CCCCC FFFFFF IIIIIII H k
|
||||||
|
// * b FFFF I k
|
||||||
|
// * b i k
|
||||||
|
// * b i k
|
||||||
|
// */
|
||||||
|
// Object[] colorParams = new Object[]{chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose(), chatColorChoose()};
|
||||||
|
// sender.sendMessage(String.format(" %1$s.''. %4$s. %7$s*''* %10$s:_\\/_: %11$s.", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %1$s:_\\/_: %4$s_\\(/_ %5$s.:.%7$s*_\\/_* %10$s: /\\ : %11$s.'.:.'.", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %2$s.''.%1$s: /\\ : %4$s/)\\ %5$s':'%7$s* /\\ * %9$s: %10$s'..'. %11$s-=:o:=-", colorParams));
|
||||||
|
// sender.sendMessage(String.format("%2$s:_\\/_:%1$s'%3$s.:::. %4$s' %6$s*''* %7$s* %9$s'.\\'/.'%8$s_\\(/_ %11$s'.':'.'", colorParams));
|
||||||
|
// sender.sendMessage(String.format("%2$s: /\\ : %3$s::::: %6$s*_\\/_* %9$s-= o =-%8$s /)\\ %11$s'", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %2$s'..' %3$s':::' %6$s* /\\ * %9$s.'/.\\'. %8$s' %11$s*", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %2$s* %6$s*..* %9$s: %11$s*", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams));
|
||||||
|
// sender.sendMessage(String.format(" %2$s* %9$s* %11$s*", colorParams));
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// hasCelebrated.add(sender.getName());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean getDateRange(Date date, Date start, Date end) {
|
||||||
|
// return !(date.before(start) || date.after(end));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// public void spawnFireworks(Player player) {
|
||||||
|
//// int power = Misc.getRandom().nextInt(3) + 1;
|
||||||
|
//// Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)];
|
||||||
|
//// double varX = Misc.getRandom().nextGaussian() * 3;
|
||||||
|
//// double varZ = Misc.getRandom().nextGaussian() * 3;
|
||||||
|
////
|
||||||
|
//// Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK);
|
||||||
|
//// FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
|
||||||
|
//// FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build();
|
||||||
|
//// fireworkmeta.addEffect(effect);
|
||||||
|
//// fireworkmeta.setPower(power);
|
||||||
|
//// fireworks.setFireworkMeta(fireworkmeta);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// private static List<Color> colorChoose() {
|
||||||
|
// return ALL_COLORS.subList(0, Math.max(Misc.getRandom().nextInt(ALL_COLORS.size() + 1), 1));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private static String chatColorChoose() {
|
||||||
|
// StringBuilder ret = new StringBuilder(ALL_CHAT_COLORS.get(Misc.getRandom().nextInt(ALL_CHAT_COLORS.size())).toString());
|
||||||
|
//
|
||||||
|
// for (ChatColor chatFormat : CHAT_FORMATS) {
|
||||||
|
// if (Misc.getRandom().nextInt(CHAT_FORMATS.size()) == 0) {
|
||||||
|
// ret.append(chatFormat);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return ret.toString();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean isAprilFirst() {
|
||||||
|
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||||
|
// return false;
|
||||||
|
//
|
||||||
|
// GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
|
||||||
|
// GregorianCalendar aprilSecond = new GregorianCalendar(currentYear, Calendar.APRIL, 2);
|
||||||
|
// GregorianCalendar day = new GregorianCalendar();
|
||||||
|
// return getDateRange(day.getTime(), aprilFirst.getTime(), aprilSecond.getTime());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean nearingAprilFirst() {
|
||||||
|
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||||
|
// return false;
|
||||||
|
//
|
||||||
|
// GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
|
||||||
|
// GregorianCalendar end = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.APRIL, 2);
|
||||||
|
// GregorianCalendar day = new GregorianCalendar();
|
||||||
|
//
|
||||||
|
// return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
|
||||||
|
// Player player = event.getPlayer();
|
||||||
|
// Statistic statistic = event.getStatistic();
|
||||||
|
// int newValue = event.getNewValue();
|
||||||
|
//
|
||||||
|
// int modifier;
|
||||||
|
// switch (statistic) {
|
||||||
|
// case DAMAGE_TAKEN:
|
||||||
|
// modifier = 500;
|
||||||
|
// break;
|
||||||
|
// case JUMP:
|
||||||
|
// modifier = 500;
|
||||||
|
// break;
|
||||||
|
// case DROP:
|
||||||
|
// modifier = 200;
|
||||||
|
// break;
|
||||||
|
// case MINE_BLOCK:
|
||||||
|
// case BREAK_ITEM:
|
||||||
|
// modifier = 500;
|
||||||
|
// break;
|
||||||
|
// case CRAFT_ITEM:
|
||||||
|
// modifier = 100;
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (newValue % modifier == 0) {
|
||||||
|
// mcMMO.getHolidayManager().levelUpApril(player, FakeSkillType.getByStatistic(statistic));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
|
||||||
|
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// int levelTotal = Misc.getRandom().nextInt(1 + UserManager.getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1;
|
||||||
|
// SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||||
|
// NotificationManager.sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal));
|
||||||
|
//// ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void registerAprilCommand() {
|
||||||
|
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// PluginCommand command = mcMMO.p.getCommand("mcfools");
|
||||||
|
// command.setExecutor(new AprilCommand());
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.experience;
|
package com.gmail.nossr50.util.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
|
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.experience;
|
package com.gmail.nossr50.util.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.player;
|
package com.gmail.nossr50.util.player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.random;
|
package com.gmail.nossr50.util.random;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.skills;
|
package com.gmail.nossr50.util.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.skills;
|
package com.gmail.nossr50.util.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.RankConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.sounds;
|
package com.gmail.nossr50.util.sounds;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.SoundConfig;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -14,13 +15,13 @@ public class SoundManager {
|
|||||||
*/
|
*/
|
||||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||||
{
|
{
|
||||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
||||||
{
|
{
|
||||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,13 +29,13 @@ public class SoundManager {
|
|||||||
{
|
{
|
||||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||||
|
|
||||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||||
{
|
{
|
||||||
if(SoundMainConfig.getInstance().getIsEnabled(soundType))
|
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public class SoundManager {
|
|||||||
*/
|
*/
|
||||||
private static float getVolume(SoundType soundType)
|
private static float getVolume(SoundType soundType)
|
||||||
{
|
{
|
||||||
return SoundMainConfig.getInstance().getVolume(soundType) * SoundMainConfig.getInstance().getMasterVolume();
|
return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getPitch(SoundType soundType)
|
private static float getPitch(SoundType soundType)
|
||||||
@ -55,7 +56,7 @@ public class SoundManager {
|
|||||||
else if (soundType == SoundType.POP)
|
else if (soundType == SoundType.POP)
|
||||||
return getPopPitch();
|
return getPopPitch();
|
||||||
else
|
else
|
||||||
return SoundMainConfig.getInstance().getPitch(soundType);
|
return SoundConfig.getInstance().getPitch(soundType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Sound getSound(SoundType soundType)
|
private static Sound getSound(SoundType soundType)
|
||||||
|
Loading…
Reference in New Issue
Block a user