1.14 Support.

Fixed upgrade sound order.
Fixed particle effects.
This commit is contained in:
Brianna 2019-04-24 04:47:24 -04:00
parent 41f1470542
commit c4f0ea16d1
9 changed files with 11 additions and 138 deletions

View File

@ -92,18 +92,6 @@
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-13</artifactId>
<version>4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>craftbukkit-1-8</artifactId>
<version>4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>askyblock</artifactId>

View File

@ -53,7 +53,6 @@ public class EpicFurnaces extends JavaPlugin {
private Storage storage;
private HologramManager hologramManager;
private Economy economy;
private CraftBukkitHook craftBukkitHook;
private int currentVersion;
@Override
@ -264,7 +263,6 @@ public class EpicFurnaces extends JavaPlugin {
private boolean checkVersion() {
String version = getServer().getClass().getPackage().getName().split("\\.")[3];
currentVersion = Integer.parseInt(version.split("_")[1]);
craftBukkitHook = currentVersion >= 13 ? new CraftBukkitHook113() : new CraftBukkitHook18();
int workingVersion = 8;
if (currentVersion < workingVersion) {
@ -342,7 +340,7 @@ public class EpicFurnaces extends JavaPlugin {
return economy;
}
public CraftBukkitHook getCraftBukkitHook() {
return craftBukkitHook;
public int getCurrentVersion() {
return currentVersion;
}
}

View File

@ -53,8 +53,6 @@ public class OverviewMenu extends FastInv {
for (String line : parts) {
currentLevel.addLore(StringUtils.formatText(line));
}
}
fill(Methods.getGlass());
@ -199,13 +197,13 @@ public class OverviewMenu extends FastInv {
if (instance.getConfig().getBoolean("Main.Upgrade With XP") && accessor.hasPermission("EpicFurnaces.Upgrade.XP")) {
addItem(11, xp.build(), event -> {
furnace.upgrade("XP", event.getPlayer());
event.getPlayer().closeInventory();
furnace.openOverview(event.getPlayer());
});
}
if (instance.getConfig().getBoolean("Main.Upgrade With Economy") && accessor.hasPermission("EpicFurnaces.Upgrade.ECO")) {
addItem(15, eco.build(), event -> {
furnace.upgrade("ECO", event.getPlayer());
event.getPlayer().closeInventory();
furnace.openOverview(event.getPlayer());
});
}

View File

@ -110,10 +110,6 @@ public class FurnaceObject {
BoostData boostData = instance.getBoostManager().getBoost(placedBy);
r = r * (boostData == null ? 1 : boostData.getMultiplier());
if (e.getResult() == null) {
return;
}
e.getResult().setAmount(e.getResult().getAmount() + r);
}
@ -155,10 +151,12 @@ public class FurnaceObject {
}
Location loc = location.clone().add(.5, .5, .5);
instance.getCraftBukkitHook().broadcastParticle(loc, instance.getConfig().getString("Main.Upgrade Particle Type"), 200);
if (instance.getCurrentVersion() > 8)
location.getWorld().spawnParticle(Particle.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), loc.getX(), loc.getY(), loc.getZ(), 200, .5, .5, .5);
if (instance.getConfig().getBoolean("Main.Sounds Enabled")) {
if (instance.getLevelManager().getHighestLevel() == level) {
if (instance.getLevelManager().getHighestLevel() != level) {
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 0.6F, 15.0F);
} else {
player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 2F, 25.0F);

View File

@ -5,6 +5,7 @@ import com.songoda.epicfurnaces.objects.FurnaceObject;
import com.songoda.epicfurnaces.objects.FurnaceObject.BoostType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Furnace;
@ -163,7 +164,8 @@ public class FurnaceTask extends BukkitRunnable {
private void broadcastParticles(Location location) {
if (instance.getConfig().getBoolean("Main.Overheat Particles")) {
instance.getCraftBukkitHook().broadcastParticle(location, "SMOKE", 25, "SMOKE_NORMAL");
if (instance.getCurrentVersion() > 8)
location.getWorld().spawnParticle(Particle.SMOKE_NORMAL, location.getX(), location.getY(), location.getZ(), 25, 0, 0, 0, 0);
}
}
}

View File

@ -1,29 +0,0 @@
<?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.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>craftbukkit-1-13</artifactId>
<dependencies>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>manager</artifactId>
<version>4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.13.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,31 +0,0 @@
package com.songoda.epicfurnaces.hooks;
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) {
}
}
}

View File

@ -1,27 +0,0 @@
<?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.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>craftbukkit-1-8</artifactId>
<dependencies>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>manager</artifactId>
<version>4.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,24 +0,0 @@
package com.songoda.epicfurnaces.hooks;
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);
}
}