main/PlayEffect API

PlayEffect provides some methods that could be accessed from other plugins to play effect.

Why you need to use PlayEffect API?

  • All effects provided by bukkit combined in one enum class VisualEffect
  • Effect queue that determines effect visibility and prevent sending effect packet if there's no player can see effect. If players move far away from this effects no one will see it.
  • Effect queue limited with number of effect that could played during one tick to prevent network lags when huge amount of packets send in one moment.

How to connected to PlayEffect?

You just need to determine is PlayEffect installed or not using method:

    private static boolean checkPlayEffect(){
        Plugin vplg = Bukkit.getServer().getPluginManager().getPlugin("PlayEffect");
        return  ((vplg != null)&&(vplg instanceof PlayEffect));
    }

If plugin is installed you just need to use PlayEffect.class methods:

        PlayEffect.play(VisualEffect.FIREWORK,player.getLocation(), "type:burst color:red");

PlayEffect API

    /**
     * @param effect    - VisualEffect type. Example: VisualEffect.SMOKE
     * @param loc       - Location where effect will played
     * @param param     - Any effect parameter. Example: "radius:2 num:5"
     */
    public static void play (VisualEffect effect, Location loc, String param)

    /**
     * @param effect    - VisualEffect type. Example: VisualEffect.SMOKE
     * @param loc       - Location where effect will played
     * @param params    - Any supported effect parameter. 
     *                    You can create HashMap<String,String> params and add 
     *                    required parameters to this map
     *                    Example: 
     *                    Map<String,String> params = new HashMap<String,String>();  
     *                    params.put ("radius","2");
     *                    params.put ("num","5");  
     */
    public static void play (VisualEffect effect, Location loc, Map<String,String> params)

    /**
     * @param effect    - Name of the VisualEffect. Example: "smoke", "FIREWORK", etc...
     * @param loc       - Location where effect will played
     * @param params    - Any supported effect parameter. 
     *                    You can create HashMap<String,String> params and add 
     *                    required parameters to this map
     *                    Example: 
     *                    Map<String,String> params = new HashMap<String,String>();  
     *                    params.put ("radius","2");
     *                    params.put ("num","5");  
     */
    public static void play (String effect, Location loc, Map<String,String> params)

    /**
     * @param effect    - VisualEffect type. Example: VisualEffect.SMOKE
     * @param param     - Any effect parameter. Don't forget to
     *                    add "loc" parameter to define effect location 
     *                    Example: "loc:world,10,65,12 radius:2 num:5"
     */
    public static void play (VisualEffect effect, String param)

    /**
     * @param effect    - Name of the VisualEffect. Example: "smoke", "FIREWORK", etc...
     * @param param     - Any effect parameter. Don't forget to
     *                    add "loc" parameter to define effect location 
     *                    Example: "loc:world,10,65,12 radius:2 num:5"
     */
    public static void play (String effect, String param)

    /**
     * @param effect    - Name of the VisualEffect. Example: "smoke", "FIREWORK", etc...
     * @param params    - Any supported effect parameter. 
     *                    You can create HashMap<String,String> params and add 
     *                    required parameters to this map
     *                    Example: 
     *                    Map<String,String> params = new HashMap<String,String>();  
     *                    params.put ("radius","2");
     *                    params.put ("num","5");  
     */
    public static void play (String effect, Map<String,String> params)

    /**
     * Set static (repeating) effect in defined location
     * 
     * @param effect    - VisualEffect type. Example: VisualEffect.SMOKE   
     * @param param     - Any effect parameter. Don't forget to
     *                    add "loc" parameter to define effect location 
     *                    Example: "loc:world,10,65,12 radius:2 num:5"
     * @return          - Return true if effect was set successfully 
     */
    public static boolean set(VisualEffect effect, String param)

    /**
     * Set static (repeating) effect in defined location
     * 
     * @param effect    - VisualEffect type. Example: VisualEffect.SMOKE   
     * @param params    - Any supported effect parameter. 
     *                    You can create HashMap<String,String> params and add 
     *                    required parameters to this map
     *                    Example: 
     *                    Map<String,String> params = new HashMap<String,String>();
     *                    params.put ("loc","world,10,65,20");  
     *                    params.put ("radius","2");
     *                    params.put ("num","5");
     * @return          - Return true if effect was set successfully 
     */
    public static boolean set(VisualEffect ve, Map<String,String> params)

    /**
     * Set static (repeating) effect in defined location
     * 
     * @param effect    - Name of the VisualEffect. Example: "smoke", "FIREWORK", etc...
     * @param param     - Any effect parameter. Don't forget to
     *                    add "loc" parameter to define effect location 
     *                    Example: "loc:world,10,65,12 radius:2 num:5"
     * @return          - Return true if effect was set successfully 
     */
    public static boolean set(String effect, String param)
    
    /**
     * Set static (repeating) effect in defined location
     * 
     * @param effect    - Name of the VisualEffect. Example: "smoke", "FIREWORK", etc...   
     * @param params    - Any supported effect parameter. 
     *                    You can create HashMap<String,String> params and add 
     *                    required parameters to this map
     *                    Example: 
     *                    Map<String,String> params = new HashMap<String,String>();
     *                    params.put ("loc","world,10,65,20");  
     *                    params.put ("radius","2");
     *                    params.put ("num","5");
     * @return          - Return true if effect was set successfully 
     */
    public static boolean set(String effect, Map<String,String> params)

Comments

Posts Quoted:
Reply
Clear All Quotes