Convert String for use with instanceof

Discussion in 'Plugin Development' started by Mindfulhacker, Oct 27, 2014.

Thread Status:
Not open for further replies.
  1. Code:java
    1.  
    2. if(!config.contains("MC-EMP.projectileID")){
    3. config.set("MC-EMP.projectileID", "Snowball");
    4. }
    5. if(event.getEntity() instanceof config.get("MC-EMP.projectileID")) {
    6. //DoShit
    7. }
    8.  


    How do I make this work?
     
  2. Offline

    fireblast709

    Mindfulhacker you could transform the name into a class using Class.forName (with "org.bukkit.entity." as prefix).
     
    ChipDev likes this.
Thread Status:
Not open for further replies.

Share This Page