mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Improving Chimaera Wing - part 1
* Added cooldown between using Chimaera Wings * Added shapeless recipe to craft a Chimaera Wing (by default 5 feathers)
This commit is contained in:
parent
3349e9cb05
commit
a07f14e326
@ -10,6 +10,7 @@ Key:
|
|||||||
Version 1.4.03-dev
|
Version 1.4.03-dev
|
||||||
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
||||||
+ Improved stats display for child skills
|
+ Improved stats display for child skills
|
||||||
|
+ Added cooldown between using Chimaera Wings
|
||||||
= Fixed bug with Smelting not properly tracking furnaces
|
= Fixed bug with Smelting not properly tracking furnaces
|
||||||
= Fixed bug with Blast Mining not dropping blocks correctly
|
= Fixed bug with Blast Mining not dropping blocks correctly
|
||||||
= Fixed bug with custom blocks not working
|
= Fixed bug with custom blocks not working
|
||||||
@ -25,6 +26,7 @@ Version 1.4.03-dev
|
|||||||
= Fixed bug where the 'mcmmo.commands.ptp.world.all' was registered twice
|
= Fixed bug where the 'mcmmo.commands.ptp.world.all' was registered twice
|
||||||
= Fixed bug where Beast Lore wouldn't work on friendly pets
|
= Fixed bug where Beast Lore wouldn't work on friendly pets
|
||||||
! Moved the Salvage unlock level from config.yml to advanced.yml
|
! Moved the Salvage unlock level from config.yml to advanced.yml
|
||||||
|
! Changed how Chimaera Wings are acquired, you need to craft them now. (By default, use 5 feathers in a shapeless recipe)
|
||||||
- Removed option to disable Salvage via the config file. This should be handled via permissions instead.
|
- Removed option to disable Salvage via the config file. This should be handled via permissions instead.
|
||||||
- Removed the option to use Woodcutting without an axe from the config file.
|
- Removed the option to use Woodcutting without an axe from the config file.
|
||||||
|
|
||||||
|
@ -101,9 +101,12 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
|
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
|
||||||
|
|
||||||
/* Items */
|
/* Items */
|
||||||
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
|
public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
|
||||||
|
public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
|
||||||
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
|
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
|
||||||
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
||||||
|
public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
|
||||||
|
public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
|
||||||
|
|
||||||
/* Particles */
|
/* Particles */
|
||||||
public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
|
public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
|
||||||
|
@ -79,6 +79,7 @@ public class McMMOPlayer {
|
|||||||
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
private Map<ToolType, Integer> toolATS = new HashMap<ToolType, Integer>();
|
||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
|
private int chimaeraWing;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
|
|
||||||
public McMMOPlayer(Player player) {
|
public McMMOPlayer(Player player) {
|
||||||
@ -298,6 +299,23 @@ public class McMMOPlayer {
|
|||||||
recentlyHurt = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
recentlyHurt = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chimaera Wing
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getLastChimaeraTeleport() {
|
||||||
|
return chimaeraWing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastChimaeraTeleport(int value) {
|
||||||
|
chimaeraWing = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actualizeLastChimaeraTeleport() {
|
||||||
|
chimaeraWing = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exploit Prevention
|
* Exploit Prevention
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +48,7 @@ import com.gmail.nossr50.skills.repair.Repairable;
|
|||||||
import com.gmail.nossr50.skills.repair.RepairableManager;
|
import com.gmail.nossr50.skills.repair.RepairableManager;
|
||||||
import com.gmail.nossr50.skills.repair.RepairableManagerFactory;
|
import com.gmail.nossr50.skills.repair.RepairableManagerFactory;
|
||||||
import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
|
import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
|
||||||
|
import com.gmail.nossr50.util.ChimaeraWing;
|
||||||
import com.gmail.nossr50.util.LogFilter;
|
import com.gmail.nossr50.util.LogFilter;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.UpdateChecker;
|
import com.gmail.nossr50.util.UpdateChecker;
|
||||||
@ -114,6 +115,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
registerEvents();
|
registerEvents();
|
||||||
|
registerCustomRecipes();
|
||||||
|
|
||||||
// Setup the leader boards
|
// Setup the leader boards
|
||||||
if (Config.getInstance().getUseMySQL()) {
|
if (Config.getInstance().getUseMySQL()) {
|
||||||
@ -433,6 +435,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
CommandRegistrationManager.registerMchudCommand();
|
CommandRegistrationManager.registerMchudCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerCustomRecipes() {
|
||||||
|
if (Config.getInstance().getChimaeraEnabled()) {
|
||||||
|
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void scheduleTasks() {
|
private void scheduleTasks() {
|
||||||
BukkitScheduler scheduler = getServer().getScheduler();
|
BukkitScheduler scheduler = getServer().getScheduler();
|
||||||
|
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.ShapelessRecipe;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -22,18 +28,25 @@ public final class ChimaeraWing {
|
|||||||
public static void activationCheck(Player player) {
|
public static void activationCheck(Player player) {
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
|
|
||||||
if (!Config.getInstance().getChimaeraEnabled() || inHand.getTypeId() != Config.getInstance().getChimaeraItemId()) {
|
if (!Config.getInstance().getChimaeraEnabled() || !ItemUtils.isChimaeraWing(inHand)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
int amount = inHand.getAmount();
|
int amount = inHand.getAmount();
|
||||||
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt() * Misc.TIME_CONVERSION_FACTOR;
|
long recentlyHurt = UserManager.getPlayer(player).getRecentlyHurt();
|
||||||
|
long lastChimaeraWing = (UserManager.getPlayer(player).getLastChimaeraTeleport());
|
||||||
|
|
||||||
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
if (Permissions.chimaeraWing(player) && ItemUtils.isChimaeraWing(inHand)) {
|
||||||
if (SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
if (!SkillUtils.cooldownOver(lastChimaeraWing * Misc.TIME_CONVERSION_FACTOR, Config.getInstance().getChimaeraCooldown(), player)) {
|
||||||
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
|
player.sendMessage(ChatColor.RED + "You need to wait before you can use this again! " + ChatColor.YELLOW + "(" + SkillUtils.calculateTimeLeft(lastChimaeraWing * Misc.TIME_CONVERSION_FACTOR, Config.getInstance().getChimaeraCooldown(), player) + ")"); //TODO Locale!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SkillUtils.cooldownOver(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, 60, player) && amount >= Config.getInstance().getChimaeraUseCost()) {
|
||||||
|
player.setItemInHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost())));
|
||||||
|
|
||||||
|
if (Config.getInstance().getChimaeraPreventUseUnderground()) {
|
||||||
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||||
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
|
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
|
||||||
@ -41,6 +54,7 @@ public final class ChimaeraWing {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player.getBedSpawnLocation() != null) {
|
if (player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
player.teleport(player.getBedSpawnLocation());
|
||||||
@ -49,15 +63,40 @@ public final class ChimaeraWing {
|
|||||||
player.teleport(player.getWorld().getSpawnLocation());
|
player.teleport(player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserManager.getPlayer(player).actualizeLastChimaeraTeleport();
|
||||||
MetricsManager.chimeraWingUsed();
|
MetricsManager.chimeraWingUsed();
|
||||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
|
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
|
||||||
}
|
}
|
||||||
else if (!SkillUtils.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
else if (!SkillUtils.cooldownOver(recentlyHurt, 60 * Misc.TIME_CONVERSION_FACTOR, player) && amount >= Config.getInstance().getChimaeraUseCost()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt, 60, player)));
|
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillUtils.calculateTimeLeft(recentlyHurt, 60, player)));
|
||||||
}
|
}
|
||||||
else if (amount <= Config.getInstance().getChimaeraCost()) {
|
else if (amount <= Config.getInstance().getChimaeraUseCost()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Config.getInstance().getChimaeraItemId())));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", "Chimaera Wings")); //TODO Locale!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack getChimaeraWing(int amount) {
|
||||||
|
ItemStack itemStack = new ItemStack(Material.FEATHER, amount);
|
||||||
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
itemMeta.setDisplayName(ChatColor.GOLD + "Chimaera Wing"); //TODO Locale!
|
||||||
|
List<String> itemLore = new ArrayList<String>();
|
||||||
|
itemLore.add("mcMMO Item");
|
||||||
|
itemLore.add(ChatColor.GRAY + "Teleports you to your bed."); //TODO Locale!
|
||||||
|
itemMeta.setLore(itemLore);
|
||||||
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ShapelessRecipe getChimaeraWingRecipe() {
|
||||||
|
Material ingredient = Material.getMaterial(Config.getInstance().getChimaeraItemId());
|
||||||
|
int amount = Config.getInstance().getChimaeraRecipeCost();
|
||||||
|
if (amount > 9) {
|
||||||
|
amount = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapelessRecipe ChimaeraWing = new ShapelessRecipe(getChimaeraWing(1));
|
||||||
|
ChimaeraWing.addIngredient(amount, ingredient);
|
||||||
|
return ChimaeraWing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.api.SpoutToolsAPI;
|
import com.gmail.nossr50.api.SpoutToolsAPI;
|
||||||
@ -644,4 +648,28 @@ public class ItemUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isMcMMOItem(ItemStack is) {
|
||||||
|
ItemMeta itemMeta = is.getItemMeta();
|
||||||
|
if (itemMeta.hasLore()) {
|
||||||
|
List<String> itemLore = itemMeta.getLore();
|
||||||
|
if (itemLore.contains("mcMMO Item")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isChimaeraWing(ItemStack is) {
|
||||||
|
if (!isMcMMOItem(is)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemMeta itemMeta = is.getItemMeta();
|
||||||
|
if (itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + "Chimaera Wing")) { //TODO Get localized name
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,9 @@ Mods:
|
|||||||
Items:
|
Items:
|
||||||
Chimaera_Wing:
|
Chimaera_Wing:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Feather_Cost: 10
|
Prevent_Use_Underground: true
|
||||||
|
Use_Cost: 1
|
||||||
|
Recipe_Cost: 5
|
||||||
Item_ID: 288
|
Item_ID: 288
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user