#help-development

1 messages · Page 1927 of 1

warm light
grim ice
#

send it in text

grim ice
#

AXOLOTL isnt a configuration section then

warm light
grim ice
#

its a value

#

Drop:
AXOLOTL:
on: true
Chance: 100

#

thats how to do it

warm light
#

ok. thanks

quaint mantle
#

thats basically against the yaml syntax

grim ice
#

mine?]

quaint mantle
#

no

#

his

grim ice
#

I dont even know yaml I just got used to it

quaint mantle
#

so do i

#

let me do a quick research about it

grim ice
#

he forgot an er

quaint mantle
#

oh that

terse ore
#

hello

quaint mantle
#

loooooo

#

Okay so I've tried to change a player's display name above their head using packets PLAYER_INFO,
but it seems to limit me to 16 characters at most. Is there any other way that I can use to do the same thing ?

#

do you know holographic displays and other hologram plugins?

#

just do the same thing but move them on the players head

#

iirc they used invisible armor stand name

quaint mantle
#

Or put it on the side.

#

Such as this.

#

that is iirc

#

i just changed

#

so maybe you can just look at their codes, or hook at them

#

iirc?

#

if i reminisce correctly, if i remember correctly, if i recall correctly

dark arrow
#

    public static ItemStack Magicpowder;

    public static void init(){
    createPowder();
    }

    private static void createPowder(){
        ItemStack powder = new ItemStack(Material.BLAZE_POWDER,1);
        ItemMeta powder_meta = powder.getItemMeta();
        powder_meta.setDisplayName(ChatColor.GOLD+"Magical Powder");
        ArrayList<String> powder_lore = new ArrayList<>();
        powder_lore.add(ChatColor.BLUE+"A part of the Magical Wand");
        powder_meta.setLore(powder_lore);
        powder_meta.addEnchant(Enchantment.DURABILITY,1,false);
        powder_meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        powder.setItemMeta(powder_meta);
        Magicpowder = powder;

        ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("Magic_Powder"),powder);
        powder_recipe.shape("DDD",
                            "TBT"
                           ,"GGG");

        powder_recipe.setIngredient('D',Material.DIAMOND_BLOCK);
        powder_recipe.setIngredient('G',Material.GOLD_BLOCK);
        powder_recipe.setIngredient('T',Material.TOTEM_OF_UNDYING);
        powder_recipe.setIngredient('B',Material.BLAZE_POWDER);
        Bukkit.getServer().addRecipe(powder_recipe);
    }

}```
I wrote this code but it does not shows any error and does not even work so i need help in it
quaint mantle
#

use the java tag

#

for syntax highlighting

dark arrow
#

?

quaint mantle
#
if (!Bukkit.getPlayer("Sammu212").isUsingJavaTag()) {
  Bukkit.sendMessages("Should use java tag");
}```
#

in that case static is normal

#

i dont see anything wrong with it

dark arrow
#

yah but there is no output expected

quaint mantle
#

I don't think so?

dark arrow
#
Oooo 

Nice

quaint mantle
#

If yes, please point out what I'm wrong

dark arrow
#

so it does not require static?

#

ok

#

?

quaint mantle
#

where do you use the init() method

dark arrow
#

by using the creafting recipe

dark arrow
quaint mantle
#

or more specific, where do you call it

dark arrow
quaint mantle
#

initialize

dark arrow
#
public final class HarryPotterWand extends JavaPlugin {

    @Override
    public void onEnable() {
        MagicPowder.init();

    }

}
quaint mantle
dark arrow
#

ok

quaint mantle
#

?learnjava alert

undone axleBOT
dark arrow
#

it shows error

#

and i dont think i should remove it

#

static in create powder function

#

I watched a youtuber to how to create a custom recipe

#

and he used static there

quaint mantle
quaint mantle
undone axleBOT
quaint mantle
#

instead of some random youtube videos

quaint mantle
dark arrow
#

but without static it shows error

quaint mantle
undone axleBOT
quaint mantle
#

?stacktraces

quaint mantle
#

?stacktrace

quaint mantle
dark arrow
quaint mantle
#

the init method is unnecessary anyway

#

non-static method can call static method.

quaint mantle
dark arrow
quaint mantle
#

why dont just call the createpowder since the start

#

?learnjava is the best option for you right now

undone axleBOT
dark arrow
#

i have to create few more recipes

#

so i will call them in init method at once

quaint mantle
quaint mantle
#

So you can just pass stuff to it and not have to create new methods.

#

Static method can't call non-static, I do know it, but vice versa is okay

#

he should learn java, but you should start learning english 😂 (just a joke, dont take it seriously)

dark arrow
#

Bruh I can't remove the static if i do it will show errors

quaint mantle
#

then i suggest you

#

the 4th time?

#

?learnjava

undone axleBOT
quaint mantle
undone axleBOT
dark arrow
#

ok

quaint mantle
#

@quaint mantle

#

If you didn't know.

#

You're welcome!

#

Just looks way better.

glass blaze
#

is decompiling a plugins
is illegal ?

drowsy helm
#

no

young knoll
#

No

drowsy helm
#

but decompiling and redistributing as your own is illegal

elder oyster
#

Is there an event that listens only for block interactions (Similar to PlayerInteractEvent but doesn't fire on player dropping items)

drowsy helm
#

just check if getClickedBlock() is null

elder oyster
#

ok ty

terse ore
#

Why I am getting thos?

hardy swan
elder oyster
sharp flare
#

Whats your super class

#

Or are u even extending javaplugin

terse ore
#

I am in my main class

sharp flare
#

Show the whole code

terse ore
#

?paste

undone axleBOT
sharp flare
#

Or screenshot the top one

young knoll
#

I don’t think getJavaPlugin is a method anywhere

terse ore
young knoll
#

So you can’t override it

sharp flare
#

getjavaplugin is not a member of javaplugin ig

warm light
#

I am using this to get Axolotl but how to get color?

sharp flare
#

Use == if you're comparing something

#

equals are for comparing values from an object

young knoll
#

Cast the entity to axolotl

warm light
sharp flare
#

Check if its an instance of an axolotle and cast it

mint mesa
#

Hey folks, I am currently trying to make RandomUHC, but some of the items that are chosen to be the item to be dropped are null

Apparently this is because some materials are blocks and not items. Is there anyway I can check if its not null? I was gonna do a while(item == null) but that didnt seem to work

#

whenever the item is null, it sends "Item entity 4820 has no item?!" in the console

#

this was removed in version 1.11, however I am using 1.8

vocal cloud
#

I am using 1.8 there's the issue

mint mesa
#

oh does 1.11 make it so its only materials?

young knoll
#

Isn’t there Material#isItem and isBlock

mint mesa
#

isBlock exists, but not isItem

young knoll
#

Well then you can use that

#

Just check !isBlock

mint mesa
#

oh yea

quaint mantle
#

Is there a way to have all the players in different Team 1 rank 1 team and make it so all the players see eachothers teams ?

sharp flare
#

What are you trying to do

quaint mantle
sharp flare
#

I mean its for nugget

mint mesa
#

not in 1.8

quaint mantle
#

Ooooh, sorry.

sharp flare
#

But its answered so nvm

quaint mantle
#

I mean I've tried using Packets PLAYER_INFO to make custom player names, but it doesn't seem to be working.

mint mesa
#

@sharp flare im making randomuhc for a server, but some of the items that are random return null

#

for some reason

young knoll
#

I just told you to use isBlock

mint mesa
#

i know @young knoll I was just explaining the situation

sharp flare
#

Whats a random uhc

mint mesa
sharp flare
#

Oh

mint mesa
#

@young knoll thanks for the quick help, but how would I loop it until I get something that isn't null?

sharp flare
#

Skip if its null

warm light
#

How to get entity from EntityDeathEvent?
Entity not EntityType

sharp flare
#

Do an if condition

warm light
#

What will be the code?

young knoll
#

Use a do while loop

sharp flare
warm light
#

oh thanks

mint mesa
sharp flare
#

You can do a for loop if you can acess the size of the array, just an option

regal dew
#

if using a recent java version, you can immediately cast:
if (event.getEntity() instanceof Player player) {}

#

Java 14 and above

sharp flare
#

If he is using language level 14 above then yes

warm light
young knoll
#

No

#

Check if it’s an axolotl

#

Then cast the entity to an axolotl and check the variant

sharp flare
#

Wtf

limber dust
#

spam

sharp flare
#

Somehow many got summoned again

mint mesa
#

well this decided to make an infinite loop

worldly ingot
#

Yeah, you never re-assign material

mint mesa
#

am I supposed to do it with item and newItem?

worldly ingot
#

Well, given your current condition, it will never be false

young knoll
#

Material material;
do {
assign material
while (material.isBlock)

worldly ingot
#

while (!material.isBlock()), but you never change material

#

I don't really know what you're trying to do, but yeah, infinite loop inevitable there

young knoll
mint mesa
worldly ingot
#

Well, if you want your loop to terminate, either material has to be re-assigned so that the condition can eventually become false and break your loop, you have to write a break statement, or you have to change your condition

mint mesa
warm light
young knoll
#

Welp more ugly pseudo code time

vocal cloud
#

While loops are an incredibly dangerous game.

mint mesa
#

I have realized that

#

I just want to make sure that this "item" is not null

young knoll
#

if (entitytype == axolotl) {
Axolotl axolotl = event.getEntity
if (axolotl.check color or whatever) {
Do stuff
}
}

mint mesa
#

well it isnt null

warm light
#

oh

mint mesa
#

but the error I get is "Item entity 1428 has no item?!"

#

oh I just realized an easy fix

dark arrow
young knoll
#

Check startup logs

rough drift
#
            var containsJS = false
            val manager = ScriptEngineManager()

            manager.engineFactories.forEach {
                if(it.engineName == "js") {
                    containsJS = true
                }
            }

            if(containsJS) {
                val en = try {
                    manager.getEngineByExtension("js")
                } catch (e: Exception) {
                    null
                }

                if(en == null) {
                    Main.INSTANCE.logger.severe("JS Engine is null, some features will not work!")
                } else {
                    val factory = en.factory
                    Assert.assertNotNull("ScriptEngineManager failed to find JavaScript engine", factory)
                    engine = factory.scriptEngine
                }
            }
```So um.... it appears as if `en` is null (error is at `val factory = en.factory`), how is it null exactly?
vocal cloud
#

👀

rough drift
#

Like, did kotlin just forget what if statements are?

graceful turret
#

how to hide player bossbar using packets?

rough drift
#

why do you need packets?

#

there's an API for it IIRC

graceful turret
#

older version

rough drift
#

ohk, well i guess you'd need either protocollib or attach to the packet pipeline using netty (idk if netty is the lib)

#

and you'd need access to the various packets, so you need to include the server jar rather than the API

young knoll
#

Placeholder api?

rough drift
#

and then if you just wanna perma hide it just block the packet

young knoll
#

You mean protocollib?

rough drift
#

oh

#

lmfao

#

yes

#

messed up there

graceful turret
rough drift
#

you need NMS classes

#

include the jar of the server you are targeting as the API

#

then catch the packet

sharp flare
#

if(material != null){
//statement
}

tall warren
#

Hello, I had a problem while coding a simple plugin

First picture : main class
Second picture : Stores x, y, z value when player runs a command "/asetlocation [x] [y] [z]"
Third picture : Prints out x, y ,z values (Just to test the code, this will be replaced with a code that spawns anvil randomly later on)
The problem : When I store x, y, z value with "/setlocation" command and run the "/xyz" command to print out the value of x, y, z , the value is always 0 (no matter what value I set before)

Can anyone help me?

rough drift
#

okay

#

so

#

lemme tell you

#

all classes start with an uppercase

#

the values should be stored in static variables in main

#

and not the command

#

creating a new instance of command won't have the same values

young knoll
sharp flare
#

and encapsulation pls

young knoll
#

Verify

#

Or use imgur

rough drift
#
public class Main extends JavaPlugin {
  public static double x, y, z;

  @Override
  public void onEnable() {
    getCommand("xyz").setExecutor(new XYZTest());
    getCommand("setlocation").setExecutor(new SetLocation());
  }
}
#

thats main

young knoll
#

?main

sharp flare
limber dust
sharp flare
#

static variables belong only to that class

#

you can use getter and setters

rough drift
#
public class SetLocation implements CommandExecutor {
   @Override
  public void onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
    if(sender instanceof Player && args.length >= 3) {
      Main.x = Double.parseDouble(args[0]);
      Main.y = Double.parseDouble(args[1]);
      Main.z = Double.parseDouble(args[2]);
    }

    return true;
  } 
}
#

i prefer static imo

sharp flare
#

goodluck with that

limber dust
#

static isn't great to always use

tall warren
#

oh so do I have to create variables in the main class?

rough drift
#
public class XYZTest implements CommandExecutor {
     @Override
  public void onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
    if(sender instanceof Player) {
      Player player = (Player) sender;

      player.sendMessage(Main.x + "");
      player.sendMessage(Main.y + "");
      player.sendMessage(Main.z + "");
    }
    return true;
  }
}
sharp flare
#

maybe learn java first

rough drift
#

me or makurman

limber dust
rough drift
#

it will just not point to those, it will point to the ones in the new class

tall warren
rough drift
#

which are 0 0 0

limber dust
rough drift
#

fair

sharp flare
rough drift
#

k

sharp flare
#

who's asking the question ?

rough drift
#

makurman

rough drift
sharp flare
#

yeah cuz static is not a better approach on that

rough drift
#

well i mean in this case its better than making 6 new methods

sharp flare
#

then you're not doing OOP

tall warren
#

what's the other method other than using static?

rough drift
#

ig

rough drift
sharp flare
rough drift
#

Because its just extra code that's not needed

sharp flare
#

and properly encapsulated

rough drift
#

well ig you'd do it if you want to manage when you can get/set variables and have events for that or smt

sharp flare
#

you an always do local variables on a single command executor class

rough drift
#

i use methods when i gotta do some calculations before getting

#

like

#

getRemainingXP(Player player), that's a method

#

however if i want like

#

playerCount that's static

tall warren
#

so the reason that the values of variables reset is because I created a new instance right?

rough drift
rough drift
#

in the new one they are reset

sharp flare
#

then use 1 class

tall warren
#

ah I got it thanks

rough drift
sharp flare
#

or getter or setters if you prefer to access the instance variables

rough drift
#

I use INSTANCE to pass in methods that require a plugin instance, otherwise everything's static

limber dust
#

👀

rough drift
#

that's just how i prefer to work, not saying getters/setters are bad

limber dust
#

static abuse is bad though, like it is purely bad practice to do

rough drift
#

what's so bad about static abuse?

sharp flare
#

there nothing bad about static abuse but if there is a better approach in an OOP way better use it in your own advantage

#

I mean stuffs can be static if it belong to that class only

rough drift
#

Yeah generally i go

Shared? Static
Instance? private with getters and setters

#

Tho say a class that can be instanced has a value that never changes i'll generally change it to public static final

tall warren
#

1 more question, do I have to use static if I use getter method?

rough drift
#

and leave the other variables with getters/setters

rough drift
drowsy helm
rough drift
drowsy helm
#

yeah but i don't see a usecase where that would really be applicable

rough drift
#

setting instance of the main class

#
public class YourPluginName extends JavaPlugin {
    public static YourPluginName INSTANCE;

    @Override
    public void onEnable() {
      INSTANCE = this;
    }
}
sharp flare
#

thats for passing plugin instance, command executor is a different thing

rough drift
#

well yeah

dark arrow
drowsy helm
rough drift
#

also, generally variables aint stored in the command unless they are really specific

drowsy helm
#

im talking about getter setters

sharp flare
#

and it doesn't mean your gonna use static everywhere

rough drift
#

wops

#

anyways imma go eat

#

cya

drowsy helm
#

it should give you an error message on startup

dark arrow
sharp flare
drowsy helm
#

check on startup it will tell you why

#

probably a bad plugin.yml

sharp flare
#

show us the console error

dark arrow
#

i did not edited it is the same at default

drowsy helm
#

just show us the error

dark arrow
#

there is no error

drowsy helm
#

there will be if it is red

sharp flare
#

impossible

vocal cloud
#

Send the log in pastebin

sharp flare
#

?paste

undone axleBOT
dark arrow
sharp flare
#

thats not the console error

drowsy helm
#

no your server log

sharp flare
#

its the compile log

drowsy helm
#

not the maven log

sharp flare
#

send the one when your server starts up

dark arrow
drowsy helm
#

bad namespaced key

#

ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("Magic_Powder"),powder);

#

i dont think you can use underscores

dark arrow
#

ohh

sharp flare
#

namespaced keys are always lowercase

drowsy helm
#

oh thats it

#

you can use underscores just no uppercase

dark arrow
#

ok

#

let me try

#

still its disabled

sharp flare
#

pastebin error

dark arrow
#

?

sharp flare
#

paste the error log

#

thats a dummy recipe object you can get an idea from

hollow sand
#

^

hollow sand
sharp flare
#

just from my plugin

hollow sand
#

o

#

cool

sharp flare
#

I ditched making shaped recipe, made a different one and crafting them through a multiblock

dark arrow
#

ohh

sharp flare
#

having a bad time with prepareCraftItem event and craftitemevent (buggy), so I made my own crafting one

hollow sand
#

thats a unique way of making shaped recipes

sharp flare
#

yes specially custom recipes, made mine support stacked item recipes

hollow sand
#

thats very awesome

sharp flare
#

any news sammu

hollow sand
#

@dark arrow

dark arrow
#

yes?

dark arrow
sharp flare
#

show code

dark arrow
#

i though it must be a version error

#

so i created a new code

#

but same error

dark arrow
# sharp flare show code

I will create a new project and do everything as i was told and try it if it did'nt work then I will become sad

sharp flare
#

try to create a new namspaced key object

#

pass your plugin instance and assign a key

dark arrow
#

i named is "magicpowder"

hollow sand
#

show the whole code

#

should be smth like

dark arrow
#

wait i am trying it for one last tile then i will show the code cuz i think its a version error

hollow sand
#

Namespacedkey key = new Namespacedkey(this, "magicpowder");

#

also

dark arrow
#

ok

hollow sand
#

this is a plugin instance

sharp flare
#

I already sent you an screenshot, did u even check it xD

hollow sand
#

the class which extends javaplugin*

sharp flare
#

I mean he can click it

hollow sand
#

¯\_(ツ)_/¯

dark arrow
hollow sand
#

dont write the fn stuff

#

thats an "api"

sharp flare
#

he just needs to pass his plugins instance, assign a key

#

I'm not familiar in the way he is making his namespaced keys

hollow sand
#

@dark arrow can you show a screenshot or paste your whoke code here?

dark arrow
#

ok

hollow sand
#

when pasting do it like java CODE

dark arrow
#

ok

tardy delta
#

whenever i need to check if an user is able to create a home (he hasnt reached the max amount of homes he can have) do i need to get the count of all homes he has in the database and compare it or is there a better way?

sharp flare
#

you can try pdc

quaint mantle
#

Pdc

tardy delta
#

bruh thats stupid im doing db stuff i need to get the amount of homes he already has

hollow sand
tardy delta
#

so which are saved on db

sharp flare
#

mySql?

tardy delta
#

smh whats going on here

hollow sand
#

wdym

sharp flare
#

aare u saving them to mySQL or SQLite?

tardy delta
#

i asked do i need to get the count of all homes he has in the database and compare it or is there a better way?

#

h2

#

its just SQL that doesnt matter

sharp flare
#

then get it from there since it is stored

#

retrieve it

#

and do it async

dark arrow
# hollow sand <@563236350539857930> can you show a screenshot or paste your whoke code here?
public class MagicalPowder {
    HarryPotterWand2 plugin;

    public MagicalPowder(HarryPotterWand2 plugin) {
        this.plugin = plugin;
    }

    public static ItemStack Magicpowder;

    public static void createPowder(){
        ItemStack powder = new ItemStack(Material.BLAZE_POWDER,1);
        ItemMeta powder_meta = powder.getItemMeta();
        powder_meta.setDisplayName(ChatColor.GOLD+"Magical Powder");
        ArrayList<String> powder_lore = new ArrayList<>();
        powder_lore.add(ChatColor.BLUE+"A part of the Magical Wand");
        powder_meta.setLore(powder_lore);
        powder_meta.addEnchant(Enchantment.DURABILITY,1,false);
        powder_meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        powder.setItemMeta(powder_meta);
        Magicpowder = powder;

        ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("magicpowder"),powder);
        powder_recipe.shape("DDD",
                "TBT"
                ,"GGG");

        powder_recipe.setIngredient('D',Material.DIAMOND_BLOCK);
        powder_recipe.setIngredient('G',Material.GOLD_BLOCK);
        powder_recipe.setIngredient('T',Material.TOTEM_OF_UNDYING);
        powder_recipe.setIngredient('B',Material.BLAZE_POWDER);
        Bukkit.getServer().addRecipe(powder_recipe);
        System.out.println(powder_recipe);
    }
}


tardy delta
#

i thinking loading all player homes whenever that player joins is the best idea as they dont have many (~5 max)

dark arrow
#

sorry for the delay

tardy delta
#

static..

#

public static even better

sharp flare
#

make a runnable

tardy delta
#

there wouldnt be players online in onEnable

dark arrow
#
 public void onEnable() {
        // Plugin startup logic
        MagicalPowder.createPowder();
    }```main class
sharp flare
#

you can get the values to a hashmap

#

retrieve data from SQL then to a hashmap

#

Map<UUID, Integer>

#

you can go for events but if I were to do it, a runnnable would do it

tardy delta
#

why would you do events?

sharp flare
#

you mentioned when the player joins?

tardy delta
#

ah that way

sharp flare
#

you can save it to a yml file if u want, there are a lot of options

#

or do it json, still learning json btw so can't elaborate that

dark arrow
#

Thanks To All of you who helped me FN and rock
My Code finally worked After few hours of finding error it worked
and i am about to cry

dark arrow
#

after fixing the version error and the namespaced key error it worked

sharp flare
#

goodluck with your plugin 🙂

dark arrow
#

thx 🙂

sharp flare
#

please format them and avoid using statics when possible 🙂

rough drift
#

I am managing to get exceptions

#

from commented out code

tardy delta
#

?paste the error

undone axleBOT
rough drift
#

yeah no i just wanted to say it because i am pullin my hair out

#

i put some code behind roughly 3 if statements that check for null/possible exceptions, commented out the code, rebuilt and its still, throwing a NPE at the same line

tardy delta
#

then its something else, show your code

quaint mantle
#

Fourteen you changed my life with the addition of adding uwu

rough drift
#
var containsJS = false
            val manager = ScriptEngineManager()

            manager.engineFactories.forEach {
                if(it.engineName == "js") {
                    containsJS = true
                }
            }

            if(containsJS) {
                val en = try {
                    manager.getEngineByExtension("js")
                } catch (e: Exception) {
                    null
                }

                if(en == null) {
                    LSSMP.INSTANCE.logger.severe("JS Engine is null, IF statements will not work!")
                } else {
                    val factory = en.factory
                    Assert.assertNotNull("ScriptEngineManager failed to find JavaScript engine", factory)
                    engine = factory.scriptEngine
                }
            }
#

Tada

quaint mantle
#

Tada, javascript

rough drift
#

the error is at val factory = en.factory

#

en is null

rough drift
quaint mantle
#

Wait or is that kotlin?

#

Oh ok

sharp flare
#

haven't tried kotlin but it feels like lighter than java

rough drift
#

and you need the kt runtime

quaint mantle
rough drift
#

yeah

tardy delta
#

what does that code even do in terms of a spigot plugin? 👀

rough drift
#

If statements inside an event

#

so like

sharp flare
#

I mean you can do plugins with kotlin

quaint mantle
#

I think i know why kotlin was hated… javascript momento

tardy delta
#

just if statements?

rough drift
#

if (%player uuid% == "someuuid") "/runsomething" else if (%player uuid% == "some other") "/dosomething" else "eeeeeeeee"

#

example

tardy delta
#

wth tho

rough drift
#

or you can use world stuff

sharp flare
#

syntax is kinda beginner friendly inside kotlin

tardy delta
#

get the fucking player id from the event i'd say?

tardy delta
#

lol

rough drift
#

this on elimination lets you run commands

#

if you want to do conditional stuff you can

#

its pretty neat

#

a custom language for config would be better tho- wait i am already making one :D

tardy delta
#

i would write code that accepts certain standards but yea..

vocal cloud
#

Honestly if I was the point of writing a custom lang for configs I'd use a database

rough drift
#

smt like that

#

i got alot of the syntax parsing already

#

xD

tardy delta
#

please do not use a custom config lang

ivory sleet
#

Yeah

rough drift
#

ill still make it a scripting lang

ivory sleet
#

You don’t need anything fancy for mere configurations

tardy delta
#

or well its your decision but uhm i think it will be pain

rough drift
#

i mean i have the AST for it already

#

well most of it, couple features are misisn

#

misisn*

#

alsooooo question

#

for the interpreter do i just use a VM (with custom instructions?)

ivory sleet
#

Depends on what you’re doing

#

but like the fact remains, accessibility and simplicity is something to aim for when it comes to a configuration I’d argue for

rough drift
#

it can be used for smt like skript where you have events etc

#

or as a standalone lang

sharp flare
#

or use the right api for it instead

ivory sleet
#

I mean

#

There are already ton of languages

#

Unless this is another learning purpose project I’m to some extent against it

rough drift
#

I mean I'd just learn how VM's work but other than that I'd say its mostly to be used for more advanced stuff than skript but less than java (if used on a server)

ivory sleet
#

Believe certain plugins take advantage of JavaScript for instance

rough drift
#

Yeah thats what it would do

ivory sleet
#

Where they then use graal or quick

#

Thing is, if you have your own language, a lot of things become a lot harder all of a sudden

sharp flare
#

skript is not a good thing to use in a live server

rough drift
#

I'd have a JS part where I handle souce code -> bytecode and then a custom VM to handle it

crude estuary
ivory sleet
#

To some extent Skript can be fine

sharp flare
#

its broken af

#

I mean skript gives joy to other server owners out there trying out stuffs

blazing scarab
#

Kotlin scripts 👉 👉

tardy delta
#

did i just read skript?

sharp flare
#

yep

tardy delta
#

even made my own entry class for it

ivory sleet
#

sounds like you need a record

tardy delta
#

in database its a record so i guess yea

ivory sleet
#

I meant java record class

tardy delta
#

ah java 8+

#

is it in java11?

ivory sleet
#

iirc sadly 16+

tardy delta
#

:C

ivory sleet
#

But it’s very nice having sophisticated hashCode, equals and toString methods

tardy delta
#

its 14

ivory sleet
#

Also iirc they use some sort of lambda meta factory alike thing to make it fast as fuck

#

Oh

#

14 and non preview?

tardy delta
#

idk it just says with the release of java 14 we can now use the record keyword

ivory sleet
#

Oh ok

tardy delta
#

im considering to use java 16 💀

ivory sleet
#

danceDog 🥰

tardy delta
#

but i still dont know

vocal cloud
#

16 is pretty hard to live without

tardy delta
#

why are 90% of the plugins made in java 8

vocal cloud
#

Because 50% of people don't care or don't know about the QoL. The rest code 1.8 plugins

tardy delta
#

the what

vocal cloud
#

Quality of life

tardy delta
#

oh yea

vocal cloud
#

Rekt

#

Can't do if x instance of y z

tardy delta
#

:C

vocal cloud
#

Made my life so much easier

tardy delta
#

hehe makes my life much easier

rough drift
#

has a pretty big ast

#

idk how to send it

#

pasta bin

blazing scarab
tardy delta
#

unfortunately

terse ore
#

How do I change the version of a minecraft plugin?

mighty pier
#

how do i set the motd?

raw ibex
#

hello, what is the event for equiping armour

tardy delta
#

motd file in the server directory

#

wait that was image, i mean in server.properties

#

use motd generator on google

mighty pier
#

k

tardy delta
#

i mean if its permanent use the server properties

raw ibex
#

whats the easiest way to check if someone has full iron armour

tardy delta
#

check the type of all of them

stoic atlas
#

In Javascript we use var foo = args[0] || 100; to assign different value if not available
How do i do the same in Java

solar prairie
#

Javascript is to java as car is to carpet

stoic atlas
#

Help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

stoic atlas
#

It is very easy question but i dont know how to search google

solar prairie
#

If you know js just learn java

stoic atlas
solar prairie
#

I believe your looking for int

stoic atlas
#

Nah

tender shard
tardy delta
#
var foo;
if (args.length > 0) {
  foo = args[0];
} else {
  foo = 100;
}```
stoic atlas
#

O

tardy delta
#

is it already ded 👀

waxen plinth
#

Or a ternary

tardy delta
#

js tho blehh

tender shard
tardy delta
#

i only used it for a bot and it was a pain to do other stuff than the tutorial

waxen plinth
#

var foo = args.length > 0 ? args[0] : 100;

solar prairie
#

Anyone want to be a test dummy in a few days?

tardy delta
#

rn yes

raw ibex
#

Sorry my fault one sec

solar prairie
#

Making a randomevent plugin to simulate RS like events 😢

raw ibex
#

I meant the easiest way to find out when they get full iron

#

so when they get full iron, I do something

tardy delta
#

inv event

#

dont ask me which

raw ibex
#

..

tardy delta
#

its a pain for me

raw ibex
#

ok

tardy delta
#

stupid drag and drop events

raw ibex
#

i dont understand lol

#

whats the easiest way

solar prairie
#

Use a listener on armorslots to look for iron

#

Look on spigot under inventoryGUI for codes

raw ibex
#

ok

#

where do i put that though

#

in my main?

solar prairie
#

No newclass ironarmor or whatever

raw ibex
#

okay

#

no i was talking to okay

#

its ok

#

it will be fine

#

are you asking me?

#

Oh ok

#

Bruh

solar prairie
#

Gets all itemstacks from armor slots

#

Idk but you can do it specifically to just boots ect.

#

Idk what an array is

raw ibex
#

is there an event for equip armour

hybrid spoke
#

no

solar prairie
#

Whats an array

raw ibex
#

wait but this only checks for 1 piece

#

are you talking to me

hybrid spoke
undone axleBOT
tender shard
raw ibex
#

I'm basically trying to add something to a HashMap when someone gets full armour

tender shard
#

you can use the event I've sent

#

what about dispenser equipping?

#

what about equipping armor by dragging?

#

what about equipping armor using right-click?

#

just use the event I've sent

raw ibex
tender shard
raw ibex
#

is it something in spigot already

#

do i have to add it?

tender shard
#

you have to add it yourself

raw ibex
#

Oh ok

#

Does it tell me how on that?

twilit wharf
#

how does hypixel put text above the hotbar?

#

is it the action bar?

tender shard
#

there's no repo information

#

and also it includes a "Main" class so I wouldn't really want to use it lol

#

actually I'll fork it now and make it a proper maven dependency

tender shard
#

am I stupid? the button to edit the markdown file is gone lol

hybrid spoke
twilit wharf
glossy venture
#

action bar

twilit wharf
#

I thought the action bar was higher

glossy venture
#

it looks lower i think because the hud on the bottom reaches to it

#

because u have extra health

#

but i think its an action bar

tender shard
mighty pier
twilit wharf
#

like that?

glossy venture
#

yeah something like that i think

#

try it and see

twilit wharf
#

alright

mighty pier
#

ok but where do i put it

#

in my main class?

tardy delta
#

lol i did something stupid

#

accidentely clicked rebase

#

intellij isnt recognising anything

ivory sleet
#

Try invalidating caches

#

Also you could hard revert

#

and/or then restore from local file cache history

tardy delta
#

hard revert how do i do that?

ivory sleet
#

easiest way is to click up the git window

#

and then right click the commit you wanna revert back to

#

then choose hard revert

tender shard
#

right click on src/main/java -> mark directory as -> sources root

tardy delta
#

it suggested me to use a maven build script and it kinda works again

ivory sleet
#

scary

tardy delta
#

my whole project structure was gone

hasty prawn
#

Kinda working = working good enough

tardy delta
#

i got two

ivory sleet
#

did u copy pasta

tardy delta
#

nah

ivory sleet
#

that looks awfully a lot like a blatant copy pasta

#

hence the (1)

jagged thicket
#

public int maxr = plugin.getConfig().getInt("max delays.value");

   public  static int maxe = maxr;
tardy delta
#

uhm just removed module now

#

works

jagged thicket
#

how do i make this static

tardy delta
#

i guess uwu

#

put static before it?

#

looks like shit but aint gonna say that

ivory sleet
#

?xy

undone axleBOT
jagged thicket
#

it wont work cuz plugin isnt startic

tardy delta
#

🤔

spiral light
#

lol

#

xD

tardy delta
#

thanks tho 💗 😊

#

thats the spiwit

spiral light
#

sending a code and say something is not static but you dont say the exact problem ... how do you think we will know what the problem is

jagged thicket
#

so maxr cant be static because plugin isnt static

ivory sleet
#

first and foremost

#

why do you need static to begin with?

spiral light
#

just sounds like a Zero-Java-Knowledge Problem

quaint mantle
#

?static

jagged thicket
#
[19:49:11 ERROR]: Error occurred while enabling VoteRestart v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "com.orang3i.voterestart.getConfig()" because "this.plugin" is null```
quaint mantle
#

?staticabuse

jagged thicket
#

i get this error

quaint mantle
#

?abuse

ivory sleet
#

oh

#

but static wont help you here buddy

jagged thicket
#

owh

ivory sleet
#

send your code

jagged thicket
#

ok

ivory sleet
#

?paste I suppose

undone axleBOT
quaint mantle
#

?tryitsee

#

?tryitsee

ivory sleet
#

?tas

undone axleBOT
quaint mantle
#

?tryit

hasty prawn
#

Maybe one day Wyvern will have a command work

ivory sleet
#

?tryandsee

undone axleBOT
ivory sleet
quaint mantle
#

Oh yeddddd

hasty prawn
#

Today is not that day

ivory sleet
#

lmao

spiral light
quaint mantle
#

?tryandee

#

What

#

Im rage quitting

ivory sleet
#

I added it a month ago or sth

hardy swan
#

?tns

#

?tryitandsee

#

:I

quaint mantle
#

?tas

spiral light
#

you added it ? .... so your coding this bot ?

ivory sleet
#

also added

#

?justask

undone axleBOT
ivory sleet
#

ands

hardy swan
ivory sleet
#

?askgoodquestion

undone axleBOT
ivory sleet
#

x)

spiral light
#

so where is

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

quaint mantle
#

I wonder if they will work if i use md syntax

spiral light
#

wrong

quaint mantle
#

But it looks like it isn’t

spiral light
#

where is

#

?list

#

?commands

ivory sleet
#

pretty sure it parses the raw content wyvern

quaint mantle
#

?tryandsee

undone axleBOT
hasty prawn
#

HE DID IT peepoClap

jagged thicket
ivory sleet
quaint mantle
#

?tryandsee

quaint mantle
ivory sleet
#

uhm orang3l

#

what code editor do you use?

jagged thicket
#

intelij

ivory sleet
#

okay

#

right click that class of yours

#

and hit reformat

jagged thicket
#

ok

ivory sleet
#

then resend

jagged thicket
#

okk

tardy delta
#

oh god i've never seen something like that

ivory sleet
#

not the prettiest

#

but well

young knoll
#

We need /commands

ivory sleet
#

ye

young knoll
#

Prefixes are so last year

hasty prawn
#

Agreed

ivory sleet
#

well I'd certainly have implemented this if md5 would allow a new bot to enter the stage

young knoll
#

Did ya ask him

tardy delta
#

i dont even know how to implements slash command in jda 🤷

hasty prawn
#

upsertCommand

tardy delta
#

it quit my bot

#

switched to plugins kekw

young knoll
#

I've done it in node

tardy delta
#

i did too

#

before jda

jagged thicket
#

?paste

undone axleBOT
quaint mantle
#

?monkey

#

?main

jagged thicket
quaint mantle
#

?dmca

undone axleBOT
jagged thicket
spiral light
#

dmca is a fucked up thing i guess

fierce quail
#

Hi, i wanna send a message to a player. I wanna use Components for Compatibility and the option to create Keybinds, etc. The problem is, i wanna use the JSOn used by the Tellraw Command, like /tellraw @p ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}]. Thats possible through ComponentSerializer.parse(param); seemingly. But some, lets call him idiot, decided to name The md_5.bungee.chat.api.thing the EXACT same as the net.kyori.adventure.thing. Now, the parser uses the Bungee thing wich is deprecated. Is there any way using the RIGHT component? The Internet cant help, because you CANT TELL THEM APART

young knoll
#

Import the right one?

fierce quail
#

Bruh thanks, i was to stupid to try.

That doesnt work!

red sedge
#

is InventoryInteractEvent an event

#

since its coloured different

#

im not sure

young knoll
#

It's abstract

quiet ice
#

why would it not be an event?

young knoll
#

You can't listen to it

quiet ice
red sedge
#

is there a general event for it

young knoll
#

InventoryClickEvent

fierce quail
red sedge
#

yeah but that does not have inventorydragevent

quaint mantle
waxen plinth
#

Is the issue that you can't import the right one?

young knoll
#

Click event covers all clicks

quiet ice
#

But it still extends event, so it is an event by my books - whether you can listen to it is another story

young knoll
#

I have never needed to use the drag event

red sedge
#

i need to update the inventory whenever any interaction is made

lapis lark
quiet ice
lapis lark
#

If it wont work i can suggest hard coded way with reflection

red sedge
fierce quail
#

Impossible

#

I need some other stuff

red sedge
#

hm?

lapis lark
quiet ice
#

Well with adventure-plattform-bukkit you can use adventure + craftbukkit

quaint mantle
#

Be careful! There is an imposter among us!

fierce quail
# red sedge hm?

Something with Player Skin modifying, i dont remember exactly, has been some months prior

quiet ice
#

There is nothing wrong with using paper to be honest

red sedge
red sedge
quiet ice
#

Paper has some API functions that are soo good

#

like Player#giveExp(int, boolean)

red sedge
#

e.getPlayer().giveExp(int);

quiet ice
#

And then multiply that by 100 or so. There is a diff

quaint mantle
#

But given the fact that they are asking a paper-exclusive feature in spigot, imposter right there

quiet ice
#

Again, adventure-plattform-bukkit

red sedge
#

anyways not the point

quiet ice
quaint mantle
red sedge
#

@fierce quail is it fixed?

quiet ice
fierce quail
#

No

red sedge
fierce quail
#

I just need /tellraw @p ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}] as a component

quiet ice
#

well, adventure wasn't in paper until revently, so not really paper-related

quiet ice
#

It is more sponge related than paper related iirc

red sedge
#

maybe?

#

idk

red sedge
#

idk what type of component you need so

quiet ice
#

Ah, then you cannot use adventure here

#

You need to use the lackluster bungee chat api

fierce quail
#

GsonComponentSerializer

#

Seems like i what iw as seraching for

red sedge
#

can you just explain what you are trying to do

#

not making a component

#

but what is the goal of yours

fierce quail
red sedge
#

but why?

quiet ice
# red sedge still kinda doesnt justify the pain it gives

Not painfull at all

        MethodHandle handle = this.givePlayerExperienceApplyMendingHandle;
        if (handle == null) {
            // Spigot
            p.getWorld().spawn(p.getLocation(), ExperienceOrb.class).setExperience(amount);
        } else {
            // Paper
            try {
                handle.bindTo(p).invoke(amount, true);
            } catch (Throwable t) {
                throw new IllegalStateException("Unable to invoke method", t);
            }
        }
red sedge
#

why do you need that component

fierce quail
#

Because reasons

I want my compemnnt to be readable and storable in a datavbase

red sedge
quiet ice
#

this is completely unrelated mind you

red sedge
#

yeah

#

still painful

red sedge
fierce quail
#

How?

red sedge
#

with color codes?

#

and convert it back to the colored text

fierce quail
#

COMPONENTS

#

LIKE HOVER

#

AND KEYBINDS

hasty prawn
#

How are components and keybinds related at all

young knoll
#

I really need to learn method handles

hasty prawn
#

Are those the things that make Reflection not be terribly slow

quiet ice
fierce quail
#

Solved

quiet ice
#

How did you do it?

jagged thicket
#

orange

ivory sleet
#

but for instance when you use lambda meta factory to wrap the method handle to a callsite you can get a sam instance which translates to that the bytecode instruction is gonna be invokedynamic which is fast

young knoll
#

Dear god that sentence hurts

hasty prawn
tardy delta
#

😶🤌🤌

ivory sleet
#

yeah, well anyhow iirc reflection was particularly slow, not due to simply invocation but it had to go through a lot before the actual invocation

#

(which ofc cannot be cached manageably )

tardy delta
#

dont make a private field public thats what i think uwu

ivory sleet
#

hm

#

ye

#

well reflection is quite interesting in that aspect, I believe it simply has some boolean flag it overrides if you use setAccessible (given some other criteria also such as security with modules for instance)

tender shard
muted sand
#

Is there a way I can get the goal / path of an entity?
Is there a event that's fired if a such thing exists?

ivory sleet
#

I dont think so

tender shard
#

there's EntityTargetevent

#

and EntityTargetLivingEntityEvent

#

e.g. when a zombie decides to kill you, both get called

ivory sleet
#

an EntityGoalChangeEvent would be called just so often (thus its non existence)

muted sand
#

ah hm

#

thanks for the events!

tardy delta
#

i wanted to create an user on the database in the PlayerAsyncPreLoadEvent but it seems that it doesnt have a getPlayer method

tender shard
#

all you have is the ip address, a login result, a name and UUID

tardy delta
#

someone told me to do player stuff on prelogin but i think that they meant i should do stuff with the uuid instead

young knoll
#

Yes

#

What else would you need for a database aside from UUID

tender shard
#

you can ALWAYS get an offlineplayer from an UUID but getName will return null if the player has never joined before

tardy delta
#

well yea i just realised that i only need an uuid

#

but i was checking Player#hasPlayerBefore which doesnt work now

muted sand
tardy delta
#

but in the PlayerLoginEvent there is a getPlayer, is that the stage that the player gets the "loggin in and loading world" on its screen?

tardy delta
#

im wondering how big servers do stuff

tender shard
#

I worked for a server with 300-500 consecutive players

hasty prawn
#

well how did you do stuff

tardy delta
#

handling the first join of a player cant be done in the AsyncPlayerPreLoginEvent bcs there is no getPlayer but in the playerjoin event there is so im wondering when to create a new user

tender shard
young knoll
#

I mean

young knoll
#

You can check firstjoin yourself

#

If the user is already in the database it isn't a first join

tender shard
tardy delta
#

to check if Player#hasPlayedBefore but yea maybe checking on the db itself is a better idea

tender shard
# hasty prawn Sounds fun... <:DD:835705685638905876>

the other devs were a joke. one of them was a genius but he always needed 6 months for a plugin because he always structured everything like a real enterprise project. then some other devs were total jokes and needed 2 months+ for a simple minigame. So I just minded my own business there until I got banned lmao

hasty prawn
tender shard
#

you will probably have some statistics table anyway. just check if COUNT(uuid) == 1 WHERE uuid = ?

hasty prawn
#

I've always kinda wondered why it took Hypixel's devs so long to make minigames

tender shard
hasty prawn
#

True...

eternal oxide
tardy delta
#

so checking in the async pre login event is the best?

tender shard
#

also hypixel sucks. only spam and annoying children

tardy delta
#

ah yea

#

you're right

tender shard
#

if not, I'd just do it in playerjoinevent

hasty prawn
worldly ingot
tardy delta
#

i just want to load the player quickly so he isnt ingame and not fully loaded

worldly ingot
#

I've so many projects I want to setup a Maven for but just haven't been able to

#

I hijacked md's Jenkins and Maven for one of my plugins aPES_Laugh

hasty prawn
#

I believe he's using Nexus

#

And probably some Linux VPS

tardy delta
#

its loading the kingdom profile of the player and after that, chatchannels where the player is in so i dunno when to do that

quiet ice
#

The lazy way of doing it is to use maven-ftp-wagon (I think it is called like that) to deploy to a webserver via ftp that's how I do it at least

#

Okay, it's just ftp-wagon, so close enough

tender shard
worldly ingot
#

Ah just your own server in your own residence or whatever?

tender shard
#

nexus is by far the best if you wanna host a repository. it also supports a ton of repos, maven, apt, ...

#

nope it's a server from Hetzner

worldly ingot
#

Ah oki

tender shard
worldly ingot
#

I need to find something that isn't DigitalOcean because their shit's expensive for very basic hardware

young knoll
#

I've been informed oracle has a free VPS offer

#

Use that :p

worldly ingot
#

Canada

tender shard
#

oh okay I have no idea about hosting companies in NA 😄

hasty prawn
#

OVH?

tender shard
#

well Hetzner also has servers in NA, but only virtual servers

hasty prawn
#

If you have the patience for their panel to load anyways.

worldly ingot
#

Never really looked at OVH tbh, probably fine

hasty prawn
#

I use a VPS from them, never really had any issues

#

And not super expensive

worldly ingot
#

Oh yeah they're not bad at all

hasty prawn
#

Iirc they also have Canada options

worldly ingot
#

Yeah OVH is Canadian aren't they?

hasty prawn
#

🤷‍♂️ could be

tender shard
#

I think they're french

quiet ice
#

They are french iirc

worldly ingot
#

Oh, yeah, DigitalOcean is Québec based I believe

tender shard
#

but canada is just the weird uncle of france, soooo

quiet ice
#

But eh, same thing

young knoll
solar prairie
#

Just google it lol

tender shard
#

this are Hetzner's prices (for virtual servers ofc). 1€ = 1.43 canada money

worldly ingot
#

That looks similar to what OVH is offering