Giter Site home page Giter Site logo

Comments (2)

fireFerry avatar fireFerry commented on August 24, 2024

Rocky, the developer already told me he would be looking into this. He will later reply with new information.

from commandpanels.

rockyhawk64 avatar rockyhawk64 commented on August 24, 2024

This can be done using PlaceholderAPI, I have created an example item to explain.

You will need to use the JavaScript placeholder and hasvalue with CommandPanels combined. The example below will check to see if the placeholder "vault_eco_balance" which is the player's balance, is greater than 20 or not. If it is, it will return true, otherwise, it will return false.
This is why the value: true can be done, because it will not be comparing a number, but only a true/false value. If you need to reverse the outcome, you can always change value: to false, or even change output: to false (they'll do the same thing in this case).

'23':
  material: REDSTONE_BLOCK
  name: 'You NEED $20!'
  lore:
  - '&cYou have $%vault_eco_balance%'
  hasvalue:
    output: true
    value: true
    compare: '%javascript_greater_than_{vault_eco_balance},20%'
    material: EMERALD_BLOCK
    name: 'You HAVE $20!'

To make this placeholder work, you will need to follow the javascript steps with PlaceholderAPI which is here:
https://github.com/PlaceholderAPI/Javascript-Expansion/wiki/Community-Scripts#how-to-use

When you get to the step that requires you to write javascript, I have done this for you, simply copy and paste this script I made into the greater_than.js file:

var placeholder;

function gThan() {
  if (args.length === 2) {
    placeholder = args[0];
  }else{
    return false;
  }
  if (placeholder > args[1]){
    return true;
  }else{
    return false;
  }
}

gThan();

In the code above, you can see the section that says placeholder > args[1]. Simply change the > to any javascript operator if you want it to be different (https://www.w3schools.com/js/js_comparisons.asp). Make sure to do /cpr and /papi reload when making changes to both plugins.

from commandpanels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.