api

~ IndividualHolograms API allows you to create Auto-updating interactive placeholders for HoloAPI. Click here for the HoloAPI API.

To get a placeholder to auto-update, simply whitelist it in the config.yml for IndividualHolograms.

Click here for the example below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import com.empcraft.individualholograms.IndividualHolograms;
import com.empcraft.individualholograms.Placeholder;

public class InHoloAddon extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        
        // Check if IH is enabled
        Plugin inholoPlugin = Bukkit.getServer().getPluginManager().getPlugin("IndividualHolograms");
        if ((inholoPlugin!=null) && inholoPlugin.isEnabled()) {
            
            // You can simply instantiate another class which will do this: 

            // Get an instance of IH
            final IndividualHolograms IH = (IndividualHolograms) inholoPlugin;
            
            // Add a placeholder
            IH.addPlaceholder(new Placeholder("walkspeed") {
                @Override
                public String getValue(Player player, Location location, String[] modifiers, Boolean elevated) {
                    // Gets the current hologram
                    IH.getHologram();
                    
                    // Gets the EntityDamageByEntity event (for damage indicators)
                    // Cast to living entity to get health and such
                    IH.getEntity();
                    
                    // Check if the evaluation is caused by a click event
                    // Returns "LEFT" "RIGHT" or "false"
                    IH.getClicked();
                    
                    // Get all placeholders
                    IH.getAllPlaceholders();
                    
                    // Converts a string in the format World,X,Y,Z into a location
                    IH.getloc("World,X,Y,Z", player);
                    
                    // Gets a message from the language file
                    IH.getmsg("MSG1");
                    
                    // Will return a placeholder matching a key
                    IH.getPlaceholder("Key");
                    
                    // Will return a list of placeholder keys
                    IH.getPlaceholderKeys();
                    
                    // Get the original player who is evaluating the hologram
                    IH.getSender();
                    
                    // Set the player to evaluate with in the future
                    IH.setUser(player);
                    
                    // Enable a disabled placeholder by a key;
                    IH.addPlaceholder("");
                    
                    // Disable a placeholder
                    IH.removePlaceholder(placeholder);
                    IH.removePlaceholder("Key");
                    
                    // Quickly evaluate some JS or execute / evaluate some script
                    IH.javascript(line);
                    IH.execute(line, elevation, interact);
                    IH.evaluate(line, elevation, interact);
                    
                    // Don't forget to return a string to replace your placeholder!
                    return ""+player.getWalkSpeed();
                }
            });
        }
        else {
            // Do something else ?
        }
        
    }
}
// Do not add curly brackets {} or colon ":" or semi-colon ";" into your placeholder key
// player = The player you are evaluating for
// location = The location of the sign (can be null if evaluated by another plugin)
// modifiers = list of arguments 
//   e.g. {example:A:B:C} -> modifiers = [A,B,C]
// Elevated = true if another plugin evaluates with additional privileges.

Comments

Posts Quoted:
Reply
Clear All Quotes