|
| 1 | +package ca.jamiesinn.trailgui; |
| 2 | + |
| 3 | +import ca.jamiesinn.trailgui.util.ITrailManager; |
| 4 | +import org.bukkit.entity.Player; |
| 5 | +import org.bukkit.inventory.ItemStack; |
| 6 | +import org.bukkit.material.MaterialData; |
| 7 | + |
| 8 | +public class ParticleManager |
| 9 | +{ |
| 10 | + private static final String VERSION = org.bukkit.Bukkit.getServer().getClass().getCanonicalName().split("\\.")[3]; |
| 11 | + private static ITrailManager MANAGER; |
| 12 | + |
| 13 | + static |
| 14 | + { |
| 15 | + try |
| 16 | + { |
| 17 | + Class<?> managerClass = Class.forName("ca.jamiesinn.trails." + (VERSION.contains("1_9") ? "1_9_x" : "1_8_x") + ".TrailManager"); |
| 18 | + MANAGER = (ITrailManager) managerClass.newInstance(); |
| 19 | + } |
| 20 | + catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) |
| 21 | + { |
| 22 | + e.printStackTrace(); |
| 23 | + } |
| 24 | + } |
| 25 | + |
| 26 | + public static void spawnParticle(Player player, double location, int amount, int cooldown, float speed, int range, String type) |
| 27 | + { |
| 28 | + MANAGER.spawnParticle(player, location, amount, 0, speed, 0, type); |
| 29 | + } |
| 30 | + public static void spawnItemParticle(Player player, double location, int amount, int cooldown, float speed, int range, String type, ItemStack item) |
| 31 | + { |
| 32 | + MANAGER.spawnItemParticle(player, location, amount, speed, range, type, item); |
| 33 | + } |
| 34 | + public static void spawnBlockParticle(Player player, double location, int amount, int cooldown, float speed, int range, String type, MaterialData data) |
| 35 | + { |
| 36 | + MANAGER.spawnBlockParticle(player, location, amount, speed, range, type, data); |
| 37 | + } |
| 38 | +} |
0 commit comments