1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #1067 from LinoxGH/master

Added Storm Staff.
This commit is contained in:
TheBusyBiscuit 2019-09-01 14:09:49 +02:00 committed by GitHub
commit 7b5f44a7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 25 deletions

View File

@ -68,6 +68,7 @@
<includes>
<include>**/cscorelib2/updater/**</include>
<include>**/cscorelib2/materials/**</include>
<include>**/cscorelib2/protection/**</include>
</includes>
</filter>
</filters>

View File

@ -455,14 +455,16 @@ public final class SlimefunItems {
/* Staves */
public static final ItemStack STAFF_ELEMENTAL = new CustomItem(Material.STICK, "&6Elemental Staff");
public static final ItemStack STAFF_WIND = new CustomItem(Material.STICK, "&6Elemental Staff &7- &b&oWind", "", "&7Element: &b&oWind", "", "&7&eRight Click&7 to launch yourself forward");
public static final ItemStack STAFF_WIND = new CustomItem(Material.STICK, "&6Elemental Staff &7- &b&oWind", "", "&7Element: &b&oWind", "", "&eRight Click&7 to launch yourself forward");
public static final ItemStack STAFF_FIRE = new CustomItem(Material.STICK, "&6Elemental Staff &7- &c&oFire", "", "&7Element: &c&oFire");
public static final ItemStack STAFF_WATER = new CustomItem(Material.STICK, "&6Elemental Staff &7- &1&oWater", "", "&7Element: &1&oWater", "", "&7&eRight Click&7 to extinguish yourself");
public static final ItemStack STAFF_WATER = new CustomItem(Material.STICK, "&6Elemental Staff &7- &1&oWater", "", "&7Element: &1&oWater", "", "&eRight Click&7 to extinguish yourself");
public static final ItemStack STAFF_STORM = new CustomItem(Material.STICK, "&6Elemental Staff &7- &8&oStorm", "", "&7Element: &8&oStorm", "", "&eRight Click&7 to summon a lightning", "&e5 Uses &7left");
static {
STAFF_WIND.addUnsafeEnchantment(Enchantment.LUCK, 1);
STAFF_FIRE.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5);
STAFF_WATER.addUnsafeEnchantment(Enchantment.WATER_WORKER, 1);
STAFF_STORM.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
}
/* Machines */

View File

@ -10,10 +10,7 @@ public final class Messages {
public static void setup() {
local.setPrefix("&aSlimefun &7> ");
local.setDefault("messages.not-researched", "&4You do not have enough Knowledge to understand this");
local.setDefault("messages.not-enough-xp", "&4You do not have enough XP to unlock this");
local.setDefault("messages.unlocked", "&bYou have unlocked &7\"%research%\"");
local.setDefault("messages.fortune-cookie", "&7Help me, I am trapped in a Fortune Cookie Factory!", "&7You will die tomorrow... by a Creeper", "&7At some Point in your Life something bad will happen!!!", "&7Next week you will notice that this is not the real World, you are in a kind of \"Matrix\" or lets call it Computer game. Yes you are in a Computer Game", "&7This Cookie will taste good in a few seconds", "&7You will die soon and the last word you will hear is gonna be \"EXTERMINATE!!!\"", "&7Whatever you do, do not hug a Creeper... I tried it. It feels good, but it's not worth it.");
local.setDefault("commands.help", "Displays this Help Screen");
local.setDefault("commands.cheat", "Allows you to cheat Items");
local.setDefault("commands.give", "Give somebody some Slimefun Items");
@ -23,7 +20,14 @@ public final class Messages {
local.setDefault("commands.teleporter", "See other Player's Waypoints");
local.setDefault("commands.versions", "Lists all installed Addons");
local.setDefault("commands.open_guide", "Opens Slimefun's guide without using the book");
local.setDefault("commands.stats", "Shows some Stats about a Player");
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
local.setDefault("messages.not-researched", "&4You do not have enough Knowledge to understand this");
local.setDefault("messages.not-enough-xp", "&4You do not have enough XP to unlock this");
local.setDefault("messages.unlocked", "&bYou have unlocked &7\"%research%\"");
local.setDefault("messages.fortune-cookie", "&7Help me, I am trapped in a Fortune Cookie Factory!", "&7You will die tomorrow... by a Creeper", "&7At some Point in your Life something bad will happen!!!", "&7Next week you will notice that this is not the real World, you are in a kind of \"Matrix\" or lets call it Computer game. Yes you are in a Computer Game", "&7This Cookie will taste good in a few seconds", "&7You will die soon and the last word you will hear is gonna be \"EXTERMINATE!!!\"", "&7Whatever you do, do not hug a Creeper... I tried it. It feels good, but it's not worth it.");
local.setDefault("messages.only-players", "&4This Command is only for Players");
local.setDefault("messages.no-permission", "&4You do not have the required Permission to do this");
local.setDefault("messages.usage", "&4Usage: &c%usage%");
@ -59,23 +63,30 @@ public final class Messages {
local.setDefault("messages.disabled-item", "&4&lThis Item has been disabled! How did you even get that?");
local.setDefault("messages.research.start", "&7The Ancient Spirits whisper mysterious Words into your Ear!");
local.setDefault("messages.research.progress", "&7You start to wonder about &b%research% &e(%progress%)");
local.setDefault("commands.stats", "Shows some Stats about a Player");
local.setDefault("messages.fire-extinguish", "&7You have extinguished yourself");
local.setDefault("messages.cannot-place" ,"&cYou cannot place that block there!");
local.setDefault("messages.no-pvp" ,"&cYou cannot pvp in here!");
local.setDefault("machines.pattern-not-found", "&eSorry, I could not recognize this Pattern. Please place the Items in the correct Pattern into the Dispenser.");
local.setDefault("machines.unknown-material", "&eSorry, I could not recognize the Item in my Dispenser. Please put something in that I know.");
local.setDefault("machines.wrong-item", "&eSorry, I could not recognize the Item you right clicked me with. Check the Recipes and see which Items you can use.");
local.setDefault("machines.full-inventory", "&eSorry, my Inventory is too full!");
local.setDefault("miner.no-ores", "&eSorry, I could not find any Ores nearby!");
local.setDefault("backpack.already-open", "&cSorry, this backpack is open somewhere else!");
local.setDefault("backpack.no-stack", "&cYou cannot stack Backpacks");
local.setDefault("workbench.not-enhanced", "&4You cannot use Slimefun Items in a normal Workbench");
local.setDefault("anvil.not-working", "&4You cannot use Slimefun Items in an Anvil");
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
local.setDefault("machines.in-use", "&cThis Block's Inventory is currently opened by a different Player.");
local.setDefault("machines.ignition-chamber-no-flint", "&cIgnition Chamber is missing Flint and Steel.");
local.setDefault("messages.cannot-place" ,"&cYou cannot place that block there!");
local.setDefault("anvil.not-working", "&4You cannot use Slimefun Items in an Anvil");
local.setDefault("backpack.already-open", "&cSorry, this backpack is open somewhere else!");
local.setDefault("backpack.no-stack", "&cYou cannot stack Backpacks");
local.setDefault("miner.no-ores", "&eSorry, I could not find any Ores nearby!");
local.setDefault("workbench.not-enhanced", "&4You cannot use Slimefun Items in a normal Workbench");
local.setDefault("machines.ANCIENT_ALTAR.not-enough-pedestals", "&4The Altar is not surrounded by the needed Amount of Pedestals &c(%pedestals% / 8)");
local.setDefault("machines.ANCIENT_ALTAR.unknown-catalyst", "&4Unknown Catalyst! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_ALTAR.unknown-recipe", "&4Unknown Recipe! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_PEDESTAL.obstructed", "&4Pedestal is obstructed! &cRemove anything above the pedestal!");
local.setDefault("machines.HOLOGRAM_PROJECTOR.enter-text", "&7Please enter your desired Hologram Text in your Chat. &r(Color Codes are supported!)");
local.setDefault("machines.ELEVATOR.no-destinations", "&4No Destinations found");
local.setDefault("machines.CARGO_NODES.must-be-placed", "&4Must be placed onto a Chest or Machine");
local.setDefault("gps.waypoint.new", "&ePlease type in a Name for your new Waypoint in the Chat. &7(Color Codes supported!)");
local.setDefault("gps.waypoint.added", "&aSuccessfully added a new Waypoint");
local.setDefault("gps.waypoint.max", "&4You have reached the Maximum Amount of Waypoints");
@ -85,14 +96,6 @@ public final class Messages {
local.setDefault("robot.started", "&7Your Robot resumed running its Script");
local.setDefault("robot.stopped", "&7Your Robot has paused its Script");
local.setDefault("inventory.no-access", "&4You are not permitted to access this Block");
local.setDefault("machines.ANCIENT_ALTAR.not-enough-pedestals", "&4The Altar is not surrounded by the needed Amount of Pedestals &c(%pedestals% / 8)");
local.setDefault("machines.ANCIENT_ALTAR.unknown-catalyst", "&4Unknown Catalyst! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_ALTAR.unknown-recipe", "&4Unknown Recipe! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_PEDESTAL.obstructed", "&4Pedestal is obstructed! &cRemove anything above the pedestal!");
local.setDefault("machines.HOLOGRAM_PROJECTOR.enter-text", "&7Please enter your desired Hologram Text in your Chat. &r(Color Codes are supported!)");
local.setDefault("machines.ELEVATOR.no-destinations", "&4No Destinations found");
local.setDefault("machines.CARGO_NODES.must-be-placed", "&4Must be placed onto a Chest or Machine");
local.setDefault("android.scripts.already-uploaded", "&4This Script has already been uploaded.");
local.setDefault("android.scripts.enter-name", "", "&ePlease type in a Name for your Script", "");

View File

@ -242,5 +242,6 @@ public final class ResearchSetup {
Slimefun.registerResearch(new Research(242, "Radiant Backpack", 25), SlimefunItems.RADIANT_BACKPACK);
Slimefun.registerResearch(new Research(243, "A Dry Day", 15), SlimefunItems.AUTO_DRIER);
Slimefun.registerResearch(new Research(244, "Diet Cookie", 3), SlimefunItems.DIET_COOKIE);
Slimefun.registerResearch(new Research(245, "Storm Staff", 30), SlimefunItems.STAFF_STORM);
}
}

View File

@ -49,6 +49,8 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialTools;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.compatibility.MaterialHelper;
@ -866,6 +868,77 @@ public final class SlimefunSetup {
new SlimefunItem(Categories.MAGIC, SlimefunItems.STAFF_FIRE, "STAFF_ELEMENTAL_FIRE", RecipeType.MAGIC_WORKBENCH,
new ItemStack[] {null, null, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, null})
.register(true);
new SlimefunItem(Categories.MAGIC, SlimefunItems.STAFF_STORM, "STAFF_ELEMENTAL_STORM", RecipeType.ANCIENT_ALTAR,
new ItemStack[] {SlimefunItems.RUNE_AIR, SlimefunItems.RUNE_WATER, SlimefunItems.ENDER_LUMP_3, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_WATER, SlimefunItems.RUNE_AIR})
.register(true, new ItemInteractionHandler() {
@Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
//Not checking if lores equals because we need a special one for that.
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.STAFF_STORM, false)) {
if (!item.hasItemMeta()) return false;
ItemMeta itemM = item.getItemMeta();
if (!itemM.hasLore()) return false;
List<String> itemML = itemM.getLore();
ItemStack SFitem = SlimefunItems.STAFF_STORM;
ItemMeta SFitemM = SFitem.getItemMeta();
List<String> SFitemML = SFitemM.getLore();
if (itemML.size() < 6) {
// Index 1 and 3 in SlimefunItems.STAFF_STORM has lores with words and stuff so we check for them.
if (itemML.get(1).equals(SFitemML.get(1)) && itemML.get(3).equals(SFitemML.get(3))) {
if (p.getFoodLevel() >= 4 || p.getGameMode() == GameMode.CREATIVE) {
Location loc = p.getTargetBlock(null, 50).getLocation();
if (loc.getWorld() != null && loc.getChunk().isLoaded()) {
if (new ProtectionManager(Bukkit.getServer()).hasPermission(p, loc, ProtectionModule.Action.PVP)) {
loc.getWorld().strikeLightning(loc);
if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) {
FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 4);
Bukkit.getPluginManager().callEvent(event);
p.setFoodLevel(event.getFoodLevel());
}
if (ChatColor.translateAlternateColorCodes('&', "&e5 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e4 Uses &7left"));
} else if (ChatColor.translateAlternateColorCodes('&', "&e4 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e3 Uses &7left"));
} else if (ChatColor.translateAlternateColorCodes('&', "&e3 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e2 Uses &7left"));
} else if (ChatColor.translateAlternateColorCodes('&', "&e2 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e1 Use &7left"));
} else if (ChatColor.translateAlternateColorCodes('&', "&e1 Use &7left").equals(itemML.get(4))) {
e.setCancelled(true);
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
return true;
} else return false;
e.setCancelled(true);
// Saving the changes to lore and item.
itemM.setLore(itemML);
item.setItemMeta(itemM);
if (e.getParentEvent().getHand() == EquipmentSlot.HAND) {
p.getInventory().setItemInMainHand(item);
} else {
p.getInventory().setItemInOffHand(item);
}
} else {
Messages.local.sendTranslation(p, "messages.no-pvp", true);
}
}
} else {
Messages.local.sendTranslation(p, "messages.hungry", true);
}
return true;
}
}
}
return false;
}
});
new SlimefunItem(Categories.TOOLS, SlimefunItems.AUTO_SMELT_PICKAXE, "SMELTERS_PICKAXE", RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null})