Rosewood-Development / PlayerParticles

The PlayerParticles plugin made by Esophose
Other
172 stars 48 forks source link

Create a placeholder style/effect #103

Open EseKriper opened 1 year ago

EseKriper commented 1 year ago

To facilitate the use of the particles to the users I made a menu with deluxemenus and had to use placeholder api javascript to visually show the user that has that particle.

Unfortunately javascript in placeholderapi is outdated and inefficient. We use this code to show 3 style/effect and you can see that it is not very efficient if I want to show more than 3 style/effect.

image

var contador = '%playerparticles_active_amount%'

var style1 = '%playerparticles_particle_style_1%'; var effect1 = '%playerparticles_particle_effect_1%';

var style2 = '%playerparticles_particle_style_2%'; var effect2 = '%playerparticles_particle_effect_2%';

var style3 = '%playerparticles_particle_style_3%'; var effect3 = '%playerparticles_particle_effect_3%';

var pattern = new RegExp('\%');

function particula() { var selecciones = [ style1+'/'+effect1, style2+'/'+effect2, style3+'/

'+effect3 ]; if (contador > 0) { return selecciones.filter(function(t) { return pattern.test(t) == false; }).join('\n'); } else { return "N/A" } } particula();

EseKriper commented 1 year ago

The styles that the player has are enchanted.

image

When you enter the style you can see that the selected effect is enchanted.

image

EseKriper commented 1 year ago

If you add a style/effect marker you can do cool things in deluxemenus like the ones above without being limited by the amount of style/effect the player has.

With the code above I'm limited to 3 style/effect, I can add more but it would be interesting if it was implemented as a placeholder of the plugin.