Hello, I want to get a particle (as a string) out of a .yml file and convert it into a Particel. I want to do that, so I can spawn particle at the Player which he slected previous. I tryed it like that: Particle partikel = (Particle) yamlConfiguration.get(String.valueOf(player));
The method: Code: @EventHandler public static void onPlayerMove(PlayerMoveEvent event) { if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) { Player player = event.getPlayer(); File file = new File("plugins//config//partikel.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file); if (yamlConfiguration.contains(String.valueOf(player))) { String partikell = (String) yamlConfiguration.get(String.valueOf(player)); if (!(partikell == "NONE")) { Particle partikel = (Particle) yamlConfiguration.get(String.valueOf(player)); World world = player.getWorld(); world.spawnParticle(partikel, event.getFrom(), 2, 0, 0.5, 0); } } } } Sorry, I'm new to this forum and I don't know how to format code right. The partikel.yml: CraftPlayer{name=HenriPotter}: HEART
@HenriPotter 1. new File(plugin.getDataFolder(), "partikel.yml") to get the correct file. 2. Use UUID's instead of Player objects.