mirror of
https://github.com/songoda/EpicFurnaces.git
synced 2025-02-11 17:11:40 +01:00
Fixed a bunch of bugs, ready for deployment.
This commit is contained in:
parent
97b242f825
commit
98e53ce5f4
15
core/pom.xml
15
core/pom.xml
@ -161,10 +161,25 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>worldguard6</artifactId>
|
<artifactId>worldguard6</artifactId>
|
||||||
<version>4.0.19</version>
|
<version>4.0.19</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<artifactId>craftbukkit-1-8</artifactId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<artifactId>craftbukkit-1-13</artifactId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -3,6 +3,7 @@ package com.songoda.epicfurnaces;
|
|||||||
import com.gb6.songoda.epicfurnaces.hooks.PlotSquaredHook;
|
import com.gb6.songoda.epicfurnaces.hooks.PlotSquaredHook;
|
||||||
import com.songoda.epicfurnaces.command.CommandManager;
|
import com.songoda.epicfurnaces.command.CommandManager;
|
||||||
import com.songoda.epicfurnaces.handlers.BlacklistHandler;
|
import com.songoda.epicfurnaces.handlers.BlacklistHandler;
|
||||||
|
import com.songoda.epicfurnaces.hook.CraftBukkitHook;
|
||||||
import com.songoda.epicfurnaces.hooks.*;
|
import com.songoda.epicfurnaces.hooks.*;
|
||||||
import com.songoda.epicfurnaces.listeners.*;
|
import com.songoda.epicfurnaces.listeners.*;
|
||||||
import com.songoda.epicfurnaces.managers.*;
|
import com.songoda.epicfurnaces.managers.*;
|
||||||
@ -26,7 +27,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import org.bukkit.inventory.FurnaceRecipe;
|
import org.bukkit.inventory.FurnaceRecipe;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
@ -35,15 +35,11 @@ import org.json.simple.parser.JSONParser;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.songoda.epicfurnaces.utils.StringUtils.formatText;
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
public class EpicFurnaces extends JavaPlugin {
|
public class EpicFurnaces extends JavaPlugin {
|
||||||
@ -59,19 +55,21 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
private Storage storage;
|
private Storage storage;
|
||||||
private HologramManager hologramManager;
|
private HologramManager hologramManager;
|
||||||
private Economy economy;
|
private Economy economy;
|
||||||
|
private CraftBukkitHook craftBukkitHook;
|
||||||
private int currentVersion;
|
private int currentVersion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatText("&a============================="));
|
Bukkit.getConsoleSender().sendMessage(formatText("&a============================="));
|
||||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatText("&7EpicFurnaces " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
Bukkit.getConsoleSender().sendMessage(formatText("&7EpicFurnaces " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
||||||
|
Bukkit.getConsoleSender().sendMessage(formatText("&aAction: &3Enabling&7..."));
|
||||||
|
|
||||||
if (!checkVersion()) {
|
if (!checkVersion()) {
|
||||||
getPluginLoader().disablePlugin(this);
|
getPluginLoader().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : asList("config", "data", "hooks", "Furnace Recipes", "blacklist")) {
|
for (String name : asList("config", "data", "hooks", "blacklist", "Furnace Recipes")) {
|
||||||
File file = new File(getDataFolder(), name + ".yml");
|
File file = new File(getDataFolder(), name + ".yml");
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
@ -107,8 +105,8 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
this.hologramManager = new HologramManager(this);
|
this.hologramManager = new HologramManager(this);
|
||||||
this.levelManager = new LevelManager(this);
|
this.levelManager = new LevelManager(this);
|
||||||
this.hookManager = new HookManager(this);
|
this.hookManager = new HookManager(this);
|
||||||
|
this.economy = getServer().getServicesManager().getRegistration(Economy.class).getProvider();
|
||||||
|
|
||||||
setupEconomy();
|
|
||||||
checkStorage();
|
checkStorage();
|
||||||
levelManager.loadLevelManager();
|
levelManager.loadLevelManager();
|
||||||
setupRecipes();
|
setupRecipes();
|
||||||
@ -147,11 +145,15 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatText("&a============================="));
|
Bukkit.getConsoleSender().sendMessage(formatText("&a============================="));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(formatText("&a============================="));
|
||||||
|
Bukkit.getConsoleSender().sendMessage(formatText("&7EpicFurnaces " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
||||||
|
Bukkit.getConsoleSender().sendMessage(formatText("&7Action: &cDisabling&7..."));
|
||||||
|
Bukkit.getConsoleSender().sendMessage(formatText("&a============================="));
|
||||||
hologramManager.clearAll();
|
hologramManager.clearAll();
|
||||||
saveToFile();
|
saveToFile();
|
||||||
}
|
}
|
||||||
@ -218,18 +220,16 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
ConfigurationSection cs = getConfiguration("Furnace Recipes").getConfigurationSection("Recipes");
|
ConfigurationSection cs = getConfiguration("Furnace Recipes").getConfigurationSection("Recipes");
|
||||||
|
|
||||||
for (String key : cs.getKeys(false)) {
|
for (String key : cs.getKeys(false)) {
|
||||||
Material item;
|
Material item = Material.matchMaterial(key.toUpperCase());
|
||||||
try {
|
|
||||||
item = Material.valueOf(key.toUpperCase());
|
if (item == null) {
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
getLogger().info("Invalid material from recipes files: " + key.toUpperCase());
|
getLogger().info("Invalid material from recipes files: " + key.toUpperCase());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Material result;
|
Material result = Material.matchMaterial(cs.getString(key.toUpperCase() + ".result"));
|
||||||
try {
|
|
||||||
result = Material.valueOf(cs.getString(key.toUpperCase() + ".result"));
|
if (result == null) {
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
getLogger().info("Invalid material from recipes files: " + cs.getString(key.toUpperCase() + ".result"));
|
getLogger().info("Invalid material from recipes files: " + cs.getString(key.toUpperCase() + ".result"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -249,18 +249,10 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupEconomy() {
|
|
||||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
if (economyProvider != null) {
|
|
||||||
economy = economyProvider.getProvider();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (economy != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkVersion() {
|
private boolean checkVersion() {
|
||||||
String version = getServer().getClass().getPackage().getName().split("\\.")[3];
|
String version = getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||||
currentVersion = Integer.parseInt(version.split("_")[1]);
|
currentVersion = Integer.parseInt(version.split("_")[1]);
|
||||||
|
craftBukkitHook = currentVersion >= 13 ? new CraftBukkitHook113() : new CraftBukkitHook18();
|
||||||
int workingVersion = 8;
|
int workingVersion = 8;
|
||||||
|
|
||||||
if (currentVersion < workingVersion) {
|
if (currentVersion < workingVersion) {
|
||||||
@ -274,28 +266,6 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
File config = new File(getDataFolder(), "Furnace Recipes.yml");
|
|
||||||
if (!config.exists()) {
|
|
||||||
saveResource("Furnace Recipes.yml", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentVersion < 13) {
|
|
||||||
getLogger().info("Converting recipes to fit server version...");
|
|
||||||
|
|
||||||
Charset charset = StandardCharsets.UTF_8;
|
|
||||||
Path path = Paths.get(config.getAbsolutePath());
|
|
||||||
|
|
||||||
try {
|
|
||||||
String content = new String(Files.readAllBytes(path), charset);
|
|
||||||
content = content.replaceAll("GOLDEN", "GOLD")
|
|
||||||
.replaceAll("SHOVEL", "SPADE")
|
|
||||||
.replaceAll("WOODEN", "WOOD")
|
|
||||||
.replaceAll("CLOCK", "WATCH");
|
|
||||||
Files.write(path, content.getBytes(charset));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,10 +297,6 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentVersion() {
|
|
||||||
return currentVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitEnums getBukkitEnums() {
|
public BukkitEnums getBukkitEnums() {
|
||||||
return bukkitEnums;
|
return bukkitEnums;
|
||||||
}
|
}
|
||||||
@ -350,4 +316,8 @@ public class EpicFurnaces extends JavaPlugin {
|
|||||||
public Economy getEconomy() {
|
public Economy getEconomy() {
|
||||||
return economy;
|
return economy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CraftBukkitHook getCraftBukkitHook() {
|
||||||
|
return craftBukkitHook;
|
||||||
|
}
|
||||||
}
|
}
|
@ -12,6 +12,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.songoda.epicfurnaces.command.AbstractCommand.ReturnType.SYNTAX_ERROR;
|
||||||
|
|
||||||
public class CommandManager implements CommandExecutor {
|
public class CommandManager implements CommandExecutor {
|
||||||
|
|
||||||
private EpicFurnaces instance;
|
private EpicFurnaces instance;
|
||||||
@ -63,7 +65,7 @@ public class CommandManager implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||||
AbstractCommand.ReturnType returnType = command.runCommand(sender, strings);
|
AbstractCommand.ReturnType returnType = command.runCommand(sender, strings);
|
||||||
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
|
if (returnType == SYNTAX_ERROR) {
|
||||||
sender.sendMessage(instance.getLocale().getPrefix() + StringUtils.formatText("&cInvalid Syntax!"));
|
sender.sendMessage(instance.getLocale().getPrefix() + StringUtils.formatText("&cInvalid Syntax!"));
|
||||||
sender.sendMessage(instance.getLocale().getPrefix() + StringUtils.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
|
sender.sendMessage(instance.getLocale().getPrefix() + StringUtils.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.songoda.epicfurnaces.command.commands;
|
|||||||
import com.songoda.epicfurnaces.EpicFurnaces;
|
import com.songoda.epicfurnaces.EpicFurnaces;
|
||||||
import com.songoda.epicfurnaces.command.AbstractCommand;
|
import com.songoda.epicfurnaces.command.AbstractCommand;
|
||||||
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,9 +25,9 @@ public class CommandRemote extends AbstractCommand {
|
|||||||
return ReturnType.FAILURE;
|
return ReturnType.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance.getConfiguration("data").contains("data.charged")) {
|
/*if (!instance.getConfiguration("data").contains("data.charged")) {
|
||||||
return ReturnType.FAILURE;
|
return ReturnType.FAILURE;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
return ReturnType.SYNTAX_ERROR;
|
return ReturnType.SYNTAX_ERROR;
|
||||||
@ -37,7 +36,9 @@ public class CommandRemote extends AbstractCommand {
|
|||||||
String furnaceName = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
String furnaceName = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
|
||||||
for (FurnaceObject furnace : instance.getFurnaceManager().getFurnaces().values()) {
|
for (FurnaceObject furnace : instance.getFurnaceManager().getFurnaces().values()) {
|
||||||
if (furnace.getNickname() == null) continue;
|
if (furnace.getNickname() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!furnace.getNickname().equalsIgnoreCase(furnaceName)) {
|
if (!furnace.getNickname().equalsIgnoreCase(furnaceName)) {
|
||||||
continue;
|
continue;
|
||||||
@ -47,8 +48,8 @@ public class CommandRemote extends AbstractCommand {
|
|||||||
if (!uuid.equals(((Player) sender).getUniqueId())) {
|
if (!uuid.equals(((Player) sender).getUniqueId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Block b = furnace.getLocation().getBlock();
|
|
||||||
Furnace furnaceBlock = (Furnace) b.getState();
|
Furnace furnaceBlock = (Furnace) furnace.getLocation().getBlock().getState();
|
||||||
((Player) sender).openInventory(furnaceBlock.getInventory());
|
((Player) sender).openInventory(furnaceBlock.getInventory());
|
||||||
return ReturnType.SUCCESS;
|
return ReturnType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.songoda.epicfurnaces.EpicFurnaces;
|
|||||||
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -12,9 +11,15 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockFormEvent;
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.OVERHEAT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by songoda on 2/26/2017.
|
* Created by songoda on 2/26/2017.
|
||||||
@ -27,18 +32,18 @@ public class BlockListeners implements Listener {
|
|||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onSnowLand(BlockFormEvent event) {
|
public void onSnowLand(BlockFormEvent event) {
|
||||||
if (event.getNewState().getType() != Material.SNOW && event.getNewState().getType() != Material.ICE) {
|
if (event.getNewState().getType() != Material.SNOW && event.getNewState().getType() != Material.ICE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FurnaceObject furnace : instance.getFurnaceManager().getFurnaces().values()) {
|
for (FurnaceObject furnace : instance.getFurnaceManager().getFurnaces().values()) {
|
||||||
if (furnace.getRadius(false) == null || ((Furnace) furnace.getLocation().getBlock().getState()).getBurnTime() == 0) {
|
if (furnace.getRadius(OVERHEAT) == null || ((Furnace) furnace.getLocation().getBlock().getState()).getBurnTime() == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Location location : furnace.getRadius(false)) {
|
for (Location location : furnace.getRadius(OVERHEAT)) {
|
||||||
if (location.getX() != event.getNewState().getX() || location.getY() != event.getNewState().getY() || location.getZ() != event.getNewState().getZ()) {
|
if (location.getX() != event.getNewState().getX() || location.getY() != event.getNewState().getY() || location.getZ() != event.getNewState().getZ()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -50,7 +55,7 @@ public class BlockListeners implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if (event.getBlock().getType() != Material.FURNACE) {
|
if (event.getBlock().getType() != Material.FURNACE) {
|
||||||
return;
|
return;
|
||||||
@ -79,13 +84,7 @@ public class BlockListeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
if (!event.getPlayer().hasPermission("EpicFurnaces.overview") && !event.getPlayer().hasPermission("epicfurnaces.*")) {
|
if (!event.getPlayer().hasPermission("epicfurnaces.overview") && !event.getPlayer().hasPermission("epicfurnaces.*")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block block = event.getBlock();
|
|
||||||
|
|
||||||
if (block.getType() != Material.FURNACE && block.getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,18 +92,29 @@ public class BlockListeners implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FurnaceObject furnace = instance.getFurnaceManager().getFurnace(block.getLocation()).orElseGet(() -> instance.getFurnaceManager().createFurnace(block.getLocation()));
|
if (event.getBlock().getType() != Material.FURNACE && event.getBlock().getType() != instance.getBukkitEnums().getMaterial("BURNING_FURNACE").getType()) {
|
||||||
int level = furnace.getLevel().getLevel();
|
return;
|
||||||
|
|
||||||
if (level != 0) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
ItemStack item = instance.getFurnaceManager().createLeveledFurnace(level, furnace.getUses(), instance);
|
|
||||||
|
|
||||||
event.getBlock().setType(Material.AIR);
|
|
||||||
event.getBlock().getLocation().getWorld().dropItemNaturally(event.getBlock().getLocation(), item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.getFurnaceManager().removeFurnace(block.getLocation());
|
instance.getFurnaceManager().getFurnace(event.getBlock().getLocation()).ifPresent(this::handleBreak);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void onBlockExplode(EntityExplodeEvent event) {
|
||||||
|
Set<FurnaceObject> furnaces = event.blockList().parallelStream()
|
||||||
|
.map(block -> instance.getFurnaceManager().getFurnace(block.getLocation()))
|
||||||
|
.filter(Optional::isPresent)
|
||||||
|
.map(Optional::get)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
furnaces.forEach(this::handleBreak);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBreak(FurnaceObject furnaceObject) {
|
||||||
|
ItemStack item = instance.getFurnaceManager().createLeveledFurnace(furnaceObject.getLevel().getLevel(), furnaceObject.getUses(), instance);
|
||||||
|
furnaceObject.getLocation().getBlock().setType(Material.AIR);
|
||||||
|
furnaceObject.getLocation().getWorld().dropItemNaturally(furnaceObject.getLocation().getBlock().getLocation(), item);
|
||||||
|
|
||||||
|
instance.getFurnaceManager().removeFurnace(furnaceObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,6 @@ package com.songoda.epicfurnaces.listeners;
|
|||||||
import com.songoda.epicfurnaces.EpicFurnaces;
|
import com.songoda.epicfurnaces.EpicFurnaces;
|
||||||
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
||||||
import com.songoda.epicfurnaces.objects.Level;
|
import com.songoda.epicfurnaces.objects.Level;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||||
@ -24,8 +23,6 @@ public class FurnaceListeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCook(FurnaceSmeltEvent event) {
|
public void onCook(FurnaceSmeltEvent event) {
|
||||||
Block b = event.getBlock();
|
|
||||||
|
|
||||||
if ((event.getBlock().isBlockPowered() && instance.getConfig().getBoolean("Main.Redstone Deactivates Furnaces")) || event.getResult() == null) {
|
if ((event.getBlock().isBlockPowered() && instance.getConfig().getBoolean("Main.Redstone Deactivates Furnaces")) || event.getResult() == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -35,6 +35,10 @@ public class FurnaceManager {
|
|||||||
return addFurnace(location, new FurnaceObject(instance, location, instance.getLevelManager().getLowestLevel(), null, 0, 0, new ArrayList<>(), null));
|
return addFurnace(location, new FurnaceObject(instance, location, instance.getLevelManager().getLowestLevel(), null, 0, 0, new ArrayList<>(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFurnace(FurnaceObject furnaceObject) {
|
||||||
|
removeFurnace(furnaceObject.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
public void removeFurnace(Location location) {
|
public void removeFurnace(Location location) {
|
||||||
instance.getHologramManager().remove(registeredFurnaces.remove(location));
|
instance.getHologramManager().remove(registeredFurnaces.remove(location));
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class OverviewMenu extends FastInv {
|
|||||||
|
|
||||||
ItemBuilder fuelShare = new ItemBuilder(instance.getBukkitEnums().getMaterial(instance.getConfig().getString("Interfaces.FuelShare Icon")));
|
ItemBuilder fuelShare = new ItemBuilder(instance.getBukkitEnums().getMaterial(instance.getConfig().getString("Interfaces.FuelShare Icon")));
|
||||||
fuelShare.name(instance.getLocale().getMessage("interface.furnace.fuelsharetitle"));
|
fuelShare.name(instance.getLocale().getMessage("interface.furnace.fuelsharetitle"));
|
||||||
parts = instance.getLocale().getMessage("interface.furnace.fuelshareinfo", furnace.getLevel().getOverheat() * 3).split("\\|");
|
parts = instance.getLocale().getMessage("interface.furnace.fuelshareinfo", furnace.getLevel().getFuelShare() * 3).split("\\|");
|
||||||
fuelShare.lore(Arrays.stream(parts).map(StringUtils::formatText).collect(Collectors.toList()));
|
fuelShare.lore(Arrays.stream(parts).map(StringUtils::formatText).collect(Collectors.toList()));
|
||||||
|
|
||||||
ItemBuilder xp = new ItemBuilder(instance.getBukkitEnums().getMaterial(instance.getConfig().getString("Interfaces.XP Icon")));
|
ItemBuilder xp = new ItemBuilder(instance.getBukkitEnums().getMaterial(instance.getConfig().getString("Interfaces.XP Icon")));
|
||||||
|
@ -17,6 +17,8 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by songoda on 3/7/2017.
|
* Created by songoda on 3/7/2017.
|
||||||
*/
|
*/
|
||||||
@ -31,7 +33,6 @@ public class FurnaceObject {
|
|||||||
private List<Location> radiusOverheat = new ArrayList<>();
|
private List<Location> radiusOverheat = new ArrayList<>();
|
||||||
private List<Location> radiusFuelShare = new ArrayList<>();
|
private List<Location> radiusFuelShare = new ArrayList<>();
|
||||||
private List<String> accessList;
|
private List<String> accessList;
|
||||||
private Map<String, Integer> cache = new HashMap<>();
|
|
||||||
|
|
||||||
public FurnaceObject(EpicFurnaces instance, Location location, Level level, String nickname, int uses, int toLevel, List<String> accessList, UUID placedBy) {
|
public FurnaceObject(EpicFurnaces instance, Location location, Level level, String nickname, int uses, int toLevel, List<String> accessList, UUID placedBy) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
@ -157,11 +158,10 @@ public class FurnaceObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Location loc = location.clone().add(.5, .5, .5);
|
Location loc = location.clone().add(.5, .5, .5);
|
||||||
player.getWorld().playEffect(loc, instance.getBukkitEnums().getParticle(instance.getConfig().getString("Main.Upgrade Particle Type")), 200);
|
instance.getCraftBukkitHook().broadcastParticle(loc, instance.getConfig().getString("Main.Upgrade Particle Type"), 200);
|
||||||
|
|
||||||
if (instance.getConfig().getBoolean("Main.Use Sounds")) {
|
if (instance.getConfig().getBoolean("Main.Sounds Enabled")) {
|
||||||
if (instance.getLevelManager().getHighestLevel() == level) {
|
if (instance.getLevelManager().getHighestLevel() == level) {
|
||||||
//TODO: Sound
|
|
||||||
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 0.6F, 15.0F);
|
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 0.6F, 15.0F);
|
||||||
} else {
|
} else {
|
||||||
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 2F, 25.0F);
|
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 2F, 25.0F);
|
||||||
@ -228,46 +228,50 @@ public class FurnaceObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Location> getRadius(boolean overHeat) {
|
public List<Location> getRadius(BoostType boostType) {
|
||||||
if (overHeat) {
|
if (boostType == OVERHEAT) {
|
||||||
return radiusOverheat.isEmpty() ? null : Collections.unmodifiableList(radiusOverheat);
|
return radiusOverheat.isEmpty() ? null : Collections.unmodifiableList(radiusOverheat);
|
||||||
} else {
|
} else if (boostType == FUEL_SHARE) {
|
||||||
return radiusFuelShare.isEmpty() ? null : Collections.unmodifiableList(radiusFuelShare);
|
return radiusFuelShare.isEmpty() ? null : Collections.unmodifiableList(radiusFuelShare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addToRadius(Location location, boolean overHeat) {
|
public void addToRadius(Location location, BoostType boostType) {
|
||||||
if (overHeat) {
|
if (boostType == OVERHEAT) {
|
||||||
radiusOverheat.add(location);
|
radiusOverheat.add(location);
|
||||||
} else {
|
} else if (boostType == FUEL_SHARE) {
|
||||||
radiusFuelShare.add(location);
|
radiusFuelShare.add(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clearRadius(boolean overHeat) {
|
public void clearRadius(BoostType boostType) {
|
||||||
if (overHeat) {
|
if (boostType == OVERHEAT) {
|
||||||
radiusOverheat.clear();
|
radiusOverheat.clear();
|
||||||
} else {
|
} else if (boostType == FUEL_SHARE) {
|
||||||
radiusFuelShare.clear();
|
radiusFuelShare.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getRadiusLast(boolean overHeat) {
|
public int getRadiusLast(BoostType boostType) {
|
||||||
if (overHeat) {
|
if (boostType == OVERHEAT) {
|
||||||
return radiusOverheatLast;
|
return radiusOverheatLast;
|
||||||
} else {
|
} else if (boostType == FUEL_SHARE) {
|
||||||
return radiusFuelShareLast;
|
return radiusFuelShareLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setRadiusLast(int radiusLast, boolean overHeat) {
|
public void setRadiusLast(int radiusLast, BoostType boostType) {
|
||||||
if (overHeat) {
|
if (boostType == OVERHEAT) {
|
||||||
this.radiusOverheatLast = radiusLast;
|
this.radiusOverheatLast = radiusLast;
|
||||||
} else {
|
} else if (boostType == FUEL_SHARE) {
|
||||||
this.radiusFuelShareLast = radiusLast;
|
this.radiusFuelShareLast = radiusLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,4 +331,8 @@ public class FurnaceObject {
|
|||||||
public int getUses() {
|
public int getUses() {
|
||||||
return uses;
|
return uses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum BoostType {
|
||||||
|
OVERHEAT, FUEL_SHARE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Level {
|
public class Level {
|
||||||
|
|
||||||
private final EpicFurnaces instance;
|
private List<String> description = new ArrayList<>();
|
||||||
private int level, costExperience, costEconomy, performance, fuelDuration, overheat, fuelShare;
|
private int level, costExperience, costEconomy, performance, fuelDuration, overheat, fuelShare;
|
||||||
private String reward;
|
private String reward;
|
||||||
private List<String> description = new ArrayList<>();
|
|
||||||
|
|
||||||
public Level(EpicFurnaces instance, int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare) {
|
public Level(EpicFurnaces instance, int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare) {
|
||||||
this.instance = instance;
|
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.costExperience = costExperience;
|
this.costExperience = costExperience;
|
||||||
this.costEconomy = costEconomy;
|
this.costEconomy = costEconomy;
|
||||||
|
@ -63,11 +63,14 @@ public class StorageYaml extends Storage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doSave() {
|
public void doSave() {
|
||||||
|
if (toSave.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
dataFile.set("data", null); // Clear file
|
dataFile.set("data", null); // Clear file
|
||||||
|
|
||||||
File data = new File(instance.getDataFolder() + "/data.yml");
|
File data = new File(instance.getDataFolder() + "/data.yml");
|
||||||
File dataClone = new File(instance.getDataFolder() + "/data-backup-" + System.currentTimeMillis() + ".yml");
|
File dataClone = new File(instance.getDataFolder() + "/backup/data-backup-" + System.currentTimeMillis() + ".yml");
|
||||||
try {
|
try {
|
||||||
FileUtils.copyFile(data, dataClone);
|
FileUtils.copyFile(data, dataClone);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -2,6 +2,7 @@ package com.songoda.epicfurnaces.tasks;
|
|||||||
|
|
||||||
import com.songoda.epicfurnaces.EpicFurnaces;
|
import com.songoda.epicfurnaces.EpicFurnaces;
|
||||||
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
import com.songoda.epicfurnaces.objects.FurnaceObject;
|
||||||
|
import com.songoda.epicfurnaces.objects.FurnaceObject.BoostType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -9,9 +10,10 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import static com.songoda.epicfurnaces.objects.FurnaceObject.BoostType.*;
|
||||||
|
|
||||||
public class FurnaceTask extends BukkitRunnable {
|
public class FurnaceTask extends BukkitRunnable {
|
||||||
|
|
||||||
private static FurnaceTask plugin;
|
private static FurnaceTask plugin;
|
||||||
@ -69,12 +71,12 @@ public class FurnaceTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void overheat(FurnaceObject furnace) {
|
private void overheat(FurnaceObject furnace) {
|
||||||
if (furnace.getRadius(true) == null || furnace.getRadiusLast(true) != furnace.getLevel().getOverheat()) {
|
if (furnace.getRadius(OVERHEAT) == null || furnace.getRadiusLast(OVERHEAT) != furnace.getLevel().getOverheat()) {
|
||||||
furnace.setRadiusLast(furnace.getLevel().getOverheat(), true);
|
furnace.setRadiusLast(furnace.getLevel().getOverheat(), OVERHEAT);
|
||||||
cache(furnace, true);
|
cache(furnace, OVERHEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Location location : furnace.getRadius(true)) {
|
for (Location location : furnace.getRadius(OVERHEAT)) {
|
||||||
int random = ThreadLocalRandom.current().nextInt(0, 10);
|
int random = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
|
|
||||||
if (random != 1) {
|
if (random != 1) {
|
||||||
@ -101,12 +103,12 @@ public class FurnaceTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fuelShare(FurnaceObject furnace) {
|
private void fuelShare(FurnaceObject furnace) {
|
||||||
if (furnace.getRadius(false) == null || furnace.getRadiusLast(false) != furnace.getLevel().getOverheat()) {
|
if (furnace.getRadius(FUEL_SHARE) == null || furnace.getRadiusLast(FUEL_SHARE) != furnace.getLevel().getFuelShare()) {
|
||||||
furnace.setRadiusLast(furnace.getLevel().getOverheat(), false);
|
furnace.setRadiusLast(furnace.getLevel().getFuelShare(), FUEL_SHARE);
|
||||||
cache(furnace, false);
|
cache(furnace, FUEL_SHARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Location location : furnace.getRadius(false)) {
|
for (Location location : furnace.getRadius(FUEL_SHARE)) {
|
||||||
int random = ThreadLocalRandom.current().nextInt(0, 10);
|
int random = ThreadLocalRandom.current().nextInt(0, 10);
|
||||||
|
|
||||||
if (random != 1) {
|
if (random != 1) {
|
||||||
@ -119,24 +121,25 @@ public class FurnaceTask extends BukkitRunnable {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<FurnaceObject> other = instance.getFurnaceManager().getFurnace(block.getLocation());
|
FurnaceObject other = instance.getFurnaceManager().getFurnace(block.getLocation()).orElseGet(() -> instance.getFurnaceManager().createFurnace(block.getLocation()));
|
||||||
|
|
||||||
if (other.isPresent() && furnace.equals(other.get())) {
|
if (furnace.equals(other)) {
|
||||||
Furnace furnaceBlock = ((Furnace) block.getState());
|
continue;
|
||||||
|
|
||||||
if (furnaceBlock.getBurnTime() == 0) {
|
|
||||||
furnaceBlock.setBurnTime((short) 100);
|
|
||||||
furnaceBlock.update();
|
|
||||||
broadcastParticles(location);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Furnace furnaceBlock = ((Furnace) block.getState());
|
||||||
|
|
||||||
|
if (furnaceBlock.getBurnTime() == 0) {
|
||||||
|
furnaceBlock.setBurnTime((short) 200);
|
||||||
|
furnaceBlock.update();
|
||||||
|
broadcastParticles(location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cache(FurnaceObject furnace, boolean overheat) {
|
private void cache(FurnaceObject furnace, BoostType boostType) {
|
||||||
Block block = furnace.getLocation().getBlock();
|
Block block = furnace.getLocation().getBlock();
|
||||||
int radius = 3 * (overheat ? furnace.getLevel().getOverheat() : furnace.getLevel().getFuelShare());
|
int radius = 3 * (boostType == OVERHEAT ? furnace.getLevel().getOverheat() : furnace.getLevel().getFuelShare());
|
||||||
int rSquared = radius * radius;
|
int rSquared = radius * radius;
|
||||||
int bx = block.getX();
|
int bx = block.getX();
|
||||||
int by = block.getY();
|
int by = block.getY();
|
||||||
@ -147,7 +150,7 @@ public class FurnaceTask extends BukkitRunnable {
|
|||||||
for (int fz = -radius; fz <= radius; fz++) {
|
for (int fz = -radius; fz <= radius; fz++) {
|
||||||
if ((fx * fx) + (fz * fz) <= rSquared) {
|
if ((fx * fx) + (fz * fz) <= rSquared) {
|
||||||
Location location = new Location(block.getWorld(), bx + fx, by + fy, bz + fz);
|
Location location = new Location(block.getWorld(), bx + fx, by + fy, bz + fz);
|
||||||
furnace.addToRadius(location, overheat);
|
furnace.addToRadius(location, boostType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,11 +158,8 @@ public class FurnaceTask extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastParticles(Location location) {
|
private void broadcastParticles(Location location) {
|
||||||
float px = (float) (0 + (Math.random() * 1));
|
|
||||||
float pz = (float) (0 + (Math.random() * 1));
|
|
||||||
|
|
||||||
if (instance.getConfig().getBoolean("Main.Overheat Particles")) {
|
if (instance.getConfig().getBoolean("Main.Overheat Particles")) {
|
||||||
location.getWorld().playEffect(location, instance.getBukkitEnums().getParticle("SMOKE_NORMAL"), 25);
|
instance.getCraftBukkitHook().broadcastParticle(location, "SMOKE", 25, "SMOKE_NORMAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package com.songoda.epicfurnaces.utils;
|
package com.songoda.epicfurnaces.utils;
|
||||||
|
|
||||||
import com.songoda.epicfurnaces.EpicFurnaces;
|
import com.songoda.epicfurnaces.EpicFurnaces;
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -18,12 +17,6 @@ public class BukkitEnums {
|
|||||||
put("NAN", "NAN");
|
put("NAN", "NAN");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private final Map<String, String> particleMap = new HashMap<String, String>() {{
|
|
||||||
put("SMOKE", "SMOKE_NORMAL");
|
|
||||||
put("SPELL_WITCH", "MOBSPAWNER_FLAMES");
|
|
||||||
put("NAN", "NAN");
|
|
||||||
}};
|
|
||||||
|
|
||||||
public BukkitEnums(EpicFurnaces instance) {
|
public BukkitEnums(EpicFurnaces instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
@ -40,18 +33,6 @@ public class BukkitEnums {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Effect getParticle(String name) {
|
|
||||||
if (Arrays.stream(Effect.values()).anyMatch(s -> s.toString().equalsIgnoreCase(name))) {
|
|
||||||
return Effect.valueOf(name.toUpperCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Arrays.stream(Effect.values()).anyMatch(s -> s.toString().equalsIgnoreCase(particleMap.getOrDefault(name, "NAN")))) {
|
|
||||||
return Effect.valueOf(particleMap.get(name.toUpperCase()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getMaterial(String string) {
|
public ItemStack getMaterial(String string) {
|
||||||
Material material = Material.matchMaterial(string);
|
Material material = Material.matchMaterial(string);
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# TurboCharged objects Recipe file
|
|
||||||
Recipes:
|
Recipes:
|
||||||
DIAMOND_SWORD:
|
DIAMOND_SWORD:
|
||||||
result: DIAMOND
|
result: DIAMOND
|
||||||
@ -9,7 +8,7 @@ Recipes:
|
|||||||
DIAMOND_AXE:
|
DIAMOND_AXE:
|
||||||
result: DIAMOND
|
result: DIAMOND
|
||||||
amount: 3
|
amount: 3
|
||||||
DIAMOND_SHOVEL:
|
DIAMOND_SPADE:
|
||||||
result: DIAMOND
|
result: DIAMOND
|
||||||
amount: 1
|
amount: 1
|
||||||
DIAMOND_HOE:
|
DIAMOND_HOE:
|
||||||
@ -36,7 +35,7 @@ Recipes:
|
|||||||
IRON_AXE:
|
IRON_AXE:
|
||||||
result: IRON_INGOT
|
result: IRON_INGOT
|
||||||
amount: 3
|
amount: 3
|
||||||
IRON_SHOVEL:
|
IRON_SPADE:
|
||||||
result: IRON_INGOT
|
result: IRON_INGOT
|
||||||
amount: 1
|
amount: 1
|
||||||
IRON_HOE:
|
IRON_HOE:
|
||||||
@ -54,31 +53,31 @@ Recipes:
|
|||||||
IRON_BOOTS:
|
IRON_BOOTS:
|
||||||
result: IRON_INGOT
|
result: IRON_INGOT
|
||||||
amount: 4
|
amount: 4
|
||||||
GOLDEN_SWORD:
|
GOLD_SWORD:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 2
|
amount: 2
|
||||||
GOLDEN_PICKAXE:
|
GOLD_PICKAXE:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 3
|
amount: 3
|
||||||
GOLDEN_AXE:
|
GOLD_AXE:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 3
|
amount: 3
|
||||||
GOLDEN_SHOVEL:
|
GOLD_SPADE:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 1
|
amount: 1
|
||||||
GOLDEN_HOE:
|
GOLD_HOE:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 2
|
amount: 2
|
||||||
GOLDEN_HELMET:
|
GOLD_HELMET:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 5
|
amount: 5
|
||||||
GOLDEN_CHESTPLATE:
|
GOLD_CHESTPLATE:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 8
|
amount: 8
|
||||||
GOLDEN_LEGGINGS:
|
GOLD_LEGGINGS:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 7
|
amount: 7
|
||||||
GOLDEN_BOOTS:
|
GOLD_BOOTS:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 4
|
amount: 4
|
||||||
CHAINMAIL_HELMET:
|
CHAINMAIL_HELMET:
|
||||||
@ -114,25 +113,25 @@ Recipes:
|
|||||||
STONE_AXE:
|
STONE_AXE:
|
||||||
result: COBBLESTONE
|
result: COBBLESTONE
|
||||||
amount: 3
|
amount: 3
|
||||||
STONE_SHOVEL:
|
STONE_SPADE:
|
||||||
result: COBBLESTONE
|
result: COBBLESTONE
|
||||||
amount: 1
|
amount: 1
|
||||||
STONE_HOE:
|
STONE_HOE:
|
||||||
result: COBBLESTONE
|
result: COBBLESTONE
|
||||||
amount: 2
|
amount: 2
|
||||||
WOODEN_SWORD:
|
WOOD_SWORD:
|
||||||
result: COAL
|
result: COAL
|
||||||
amount: 2
|
amount: 2
|
||||||
WOODEN_PICKAXE:
|
WOOD_PICKAXE:
|
||||||
result: COAL
|
result: COAL
|
||||||
amount: 3
|
amount: 3
|
||||||
WOODEN_AXE:
|
WOOD_AXE:
|
||||||
result: COAL
|
result: COAL
|
||||||
amount: 3
|
amount: 3
|
||||||
WOODEN_SHOVEL:
|
WOOD_SPADE:
|
||||||
result: COAL
|
result: COAL
|
||||||
amount: 1
|
amount: 1
|
||||||
WOODEN_HOE:
|
WOOD_HOE:
|
||||||
result: COAL
|
result: COAL
|
||||||
amount: 2
|
amount: 2
|
||||||
BOW:
|
BOW:
|
||||||
@ -144,7 +143,7 @@ Recipes:
|
|||||||
COMPASS:
|
COMPASS:
|
||||||
result: IRON_INGOT
|
result: IRON_INGOT
|
||||||
amount: 4
|
amount: 4
|
||||||
CLOCK:
|
WATCH:
|
||||||
result: GOLD_INGOT
|
result: GOLD_INGOT
|
||||||
amount: 4
|
amount: 4
|
||||||
SHEARS:
|
SHEARS:
|
||||||
@ -158,4 +157,4 @@ Recipes:
|
|||||||
amount: 5
|
amount: 5
|
||||||
FLINT_AND_STEEL:
|
FLINT_AND_STEEL:
|
||||||
result: IRON_INGOT
|
result: IRON_INGOT
|
||||||
amount: 1
|
amount: 1
|
||||||
|
@ -3,7 +3,7 @@ version: ${project.version}
|
|||||||
main: com.songoda.epicfurnaces.EpicFurnaces
|
main: com.songoda.epicfurnaces.EpicFurnaces
|
||||||
authors: [Brianna, GB6]
|
authors: [Brianna, GB6]
|
||||||
website: https://songoda.com/
|
website: https://songoda.com/
|
||||||
depend: [HolographicDisplays]
|
depend: [HolographicDisplays, Vault]
|
||||||
softdepend: [PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions]
|
softdepend: [PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions]
|
||||||
commands:
|
commands:
|
||||||
epicfurnaces:
|
epicfurnaces:
|
||||||
|
29
hooks/craftbukkit-1-13/pom.xml
Normal file
29
hooks/craftbukkit-1-13/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>hooks</artifactId>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>craftbukkit-1-13</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<artifactId>manager</artifactId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot</artifactId>
|
||||||
|
<version>1.13.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.songoda.epicfurnaces.hooks;
|
||||||
|
|
||||||
|
import com.songoda.epicfurnaces.hook.CraftBukkitHook;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.craftbukkit.v1_13_R2.CraftWorld;
|
||||||
|
|
||||||
|
public class CraftBukkitHook113 implements CraftBukkitHook {
|
||||||
|
@Override
|
||||||
|
public void broadcastParticle(Location location, String name, int amount, String... optional) {
|
||||||
|
if (optional.length != 0) {
|
||||||
|
try {
|
||||||
|
((CraftWorld) location.getWorld()).spawnParticle(Particle.valueOf(optional[0]), location.getX(), location.getY(), location.getZ(), amount, 0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
location.getWorld().playEffect(location, Effect.valueOf(name), amount);
|
||||||
|
return;
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
((CraftWorld) location.getWorld()).spawnParticle(Particle.valueOf(name), location.getX(), location.getY(), location.getZ(), amount, 0, 0, 0, 0);
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
21
hooks/craftbukkit-1-8/pom.xml
Normal file
21
hooks/craftbukkit-1-8/pom.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>hooks</artifactId>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>craftbukkit-1-8</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.songoda</groupId>
|
||||||
|
<artifactId>manager</artifactId>
|
||||||
|
<version>4.0.19</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.songoda.epicfurnaces.hooks;
|
||||||
|
|
||||||
|
import com.songoda.epicfurnaces.hook.CraftBukkitHook;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class CraftBukkitHook18 implements CraftBukkitHook {
|
||||||
|
@Override
|
||||||
|
public void broadcastParticle(Location location, String name, int amount, String... optional) {
|
||||||
|
if (Effect.getByName(name) == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] split = name.split("_");
|
||||||
|
String type;
|
||||||
|
|
||||||
|
if (split.length != 1 && Effect.getByName(name.split("_")[0]) != null) {
|
||||||
|
type = name.split("_")[0];
|
||||||
|
} else {
|
||||||
|
type = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location.getWorld().playEffect(location, Effect.getByName(type), amount);
|
||||||
|
}
|
||||||
|
}
|
@ -4,5 +4,5 @@ package com.songoda.epicfurnaces.hook;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public interface CraftBukkitHook {
|
public interface CraftBukkitHook {
|
||||||
void broadcastParticle(Location location, String name, int amount);
|
void broadcastParticle(Location location, String name, int amount, String... optional);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<module>griefprevention</module>
|
<module>griefprevention</module>
|
||||||
<module>worldguard6</module>
|
<module>worldguard6</module>
|
||||||
<module>worldguard7</module>
|
<module>worldguard7</module>
|
||||||
<!--<module>craftbukkit-1-8</module>-->
|
<module>craftbukkit-1-8</module>
|
||||||
<!--<module>craftbukkit-1-13</module>-->
|
<module>craftbukkit-1-13</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
Loading…
Reference in New Issue
Block a user