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

Using spigot Particles and BlockData Directional

This commit is contained in:
MisterErwin 2018-09-04 19:04:27 +02:00 committed by TheBusyBiscuit
parent 1a7e094657
commit 81031d3acc
2 changed files with 5 additions and 13 deletions

View File

@ -15,6 +15,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Directional;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
@ -538,17 +539,8 @@ public class CargoNet extends Network {
@SuppressWarnings("deprecation")
private static Block getAttachedBlock(Block block) {
if (block.getData() == 2) {
return block.getRelative(BlockFace.SOUTH);
}
else if (block.getData() == 3) {
return block.getRelative(BlockFace.NORTH);
}
else if (block.getData() == 4) {
return block.getRelative(BlockFace.EAST);
}
else if (block.getData() == 5) {
return block.getRelative(BlockFace.WEST);
if (block.getBlockData() instanceof Directional) {
return block.getRelative(((Directional) block.getBlockData()).getFacing().getOppositeFace());
}
return null;
}

View File

@ -9,8 +9,8 @@ import java.util.ArrayList;
import org.bukkit.Location;
import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.MC_1_8.ParticleEffect;
import me.mrCookieSlime.Slimefun.SlimefunStartup;
import org.bukkit.Particle;
public abstract class Network {
private static List<Network> NETWORK_LIST = new ArrayList<Network>();
@ -157,7 +157,7 @@ public abstract class Network {
public void run() {
for(Location l: connectedLocations) {
try {
ParticleEffect.REDSTONE.display(l.clone().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
l.getWorld().spawnParticle(Particle.REDSTONE, l.clone().add(0.5, 0.5, 0.5), 1);
} catch(Exception e) {
}