#development

1 messages ยท Page 6 of 1

proud pebble
#

ive already said it

#

PlayerInteractEvent

lyric gyro
#

isn't player interact event below the eventhandler?

proud pebble
#

that sentence makes no sense

lyric gyro
#

ok look

#
    public void hornSounded(PlayerInteractEvent) {```
#

this is what I figured it out

#

does it make sense

#

?

proud pebble
#

wheres the event string

#

yk, to make the method actually valid

lyric gyro
#

ok look

proud pebble
#

cus you've declared a input type, but not what its called

lyric gyro
#

i'll send you the whole thing ok?

#

import net.minecraft.util.datafix.fixes.GoatHornIdFix;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Item;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.SpectralArrow;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;

public class CustomItems implements Listener {

    @EventHandler
    public void arrowHit(ProjectileHitEvent event) {
        Projectile spectralArrow = event.getEntity();
        if (spectralArrow instanceof SpectralArrow) {
            World world = spectralArrow.getWorld();
            Location location= spectralArrow.getLocation();
            world.createExplosion(location, 2);

        }
    }

    @EventHandler
    public void hornSounded(PlayerInteractEvent) {


    }

}
#

have a look

proud pebble
#

you want to identify if the item used is a goat horn

lyric gyro
#

yes

proud pebble
#

well its quite simple

#

get the itemstack that was used, get its material, check if it was a goat horn and bobs your uncle

lyric gyro
#

nods with head to pretend i understood

proud pebble
#

now if you want to get a very specific goat horn then the best option would be to use nms and add a nbt tag to that item or you can simply use persistentdatacontainers which does the exact same thing as the nms way but with a bit of extra text in the nbt tags

#

id say majority would say to use pdc as its very simple to do

proud pebble
lyric gyro
#

well in my defence I know some programming languages but nothing that will actually help me

lyric gyro
#

and

proud pebble
#

playerinteractevent has a couple methods that make it dead easy to get exactly what i said

lyric gyro
#

I could be the best java programmer but I'd still struggle a little bit with spigot

torpid raft
#

look into the spigot api docs

proud pebble
#

not as much as you are

torpid raft
#

they're very clear

proud pebble
#

and some of the other stuff relating to the spigotapi can be figured out with a few key word searches on google

lyric gyro
#

what is an itemstack though

#

explain to me really quickly

torpid raft
#

it's

#

it's a

proud pebble
#

an item

lyric gyro
#

itemstack is an item?

proud pebble
#

yes

#

item + stack

#

stack being quanity afaik

#

a stack of item

lyric gyro
#

why they just dont call it item then ๐Ÿ’€

proud pebble
#

very simple

#

Item is the entity varient of itemstack

lyric gyro
#

ah fuck this

proud pebble
#

yk, the one that exists on the floor

lyric gyro
#

yeah

#

so when I drop an item

#

it's an item

#

not an item stack

#

is that correct?

proud pebble
#

yes

lyric gyro
#

ohhh

lyric gyro
torpid raft
#

it

lyric gyro
#

and a nbt tag

proud pebble
#

an nbt tag is a simple chunk of data thats stored on an itemstack for example

#

enchantments on an item is stored in the nbt data

#

for example

#

the custom name, lore, unbreakability, etc are all other forms of data stored within nbt

lyric gyro
#

but

#

the horns are separate items

proud pebble
#

you can also store your own data inside of the container

proud pebble
#

and their material type

#

wait

#

actually they're not

#

hmm

lyric gyro
proud pebble
#

those are tooltips

#

visual only

#

not exactly lore

lyric gyro
#

wouldn't lore be visual only?

#

and they are separate items

#

sorry for so many questions

proud pebble
#

tooltips are clientside only, they cannot be changed unless the client was modified too, lore is seperate, it can be changed on the server.

lyric gyro
#

but they look the same

#

?

proud pebble
#

they may look similar, but they are seperate

lyric gyro
#

god]

#

aww and here I was thinking it would be simple

proud pebble
#

tooltips can be dynamic but lore is static

lyric gyro
#

now I have to figure out things I have no clue how to do

lyric gyro
#

but I want specific goat horns

#

because they will all do something different

proud pebble
#

if (event.getItem().getType() == Material.GOAT_HORN)

#

currently it seems, the spigotapi doesnt have a method for getting goat horn instrument types

lyric gyro
#

and paper?

#

well actually

#

I have nms

proud pebble
#

afaik the data is stored as nbt data so it would be extractable

lyric gyro
#

extracted? what am I doing now? rescuing a hostage?

proud pebble
#

yk, get the compoundtag from the itemstack, get the string contained in the instrument tag

#

its extractable

lyric gyro
#

for once I feel like I am understanding a word that comes out of your mouth

#

so whatcha mean is

proud pebble
#

itemstacks have a nbt data container, its called a compoundtag

#

in the compoundtag there will be a tag called instruments or something like that

lyric gyro
#

so it's where the data is stored?

proud pebble
#

getString("instrument")

#

according to the wiki, yes

lyric gyro
#

can you explain better the compound tag please, never asked you anything (well I actually did more than 10 times only today)

proud pebble
#

compound tag is basically just a big list of data

#

you can have a compound tag inside of a compound tag

#

like you can have a list of lists

#

lets say you got a box, you can have many things inside of that box

#

all single things

#

or you could also have a smaller box inside of that box

lyric gyro
#

OH

#

I get it now

#

so basically

#

get the list of the itemstack

#

the data

#

the list of data

#

get the string (the name of the horn basically)

proud pebble
#

every piece of data has 2 things, an identifier and a value.

#

the identifier would be instrument

lyric gyro
#

what does that mean

proud pebble
#

its type will be string

#

so getString() would be used

#

its how you get the data, you ask the list for the value of the identifier

#

itll either return the value, or an empty string or maybe null i cant remember

lyric gyro
#

like it can be anything

proud pebble
#

your trying to get the value

#

according to the minecraft wiki, the tag is called instrument

#

which you need to know the id to get the value

#

like when giving yourself an item, you need to specify the item type to get the value

#

you cant just type redthingy when you want a barrier

lyric gyro
#

like if the devs wanted it to call monkey instead of instrument

#

would that change anything

proud pebble
lyric gyro
#

when you want to get an item in minecraft

#

you type /give (player) minecraft:(item)

#

and the value is like the item itself

#

?

#

idk a better way to put it

vapid thistle
#

I've been trying to make a placeholder expansion and it doesn't appear to be working no matter what I do. my placeholder expansion does show up in /papi list as well as there are no errors in the server console. I am making this as a standalone jar which I am putting in the expansions folder.

but when I use it in game it simply doesn't work. I have downloaded expansions from the ecloud and they work just fine, but this is all I get with my own:

> papi reload
[02:06:14 INFO]: [PlaceholderAPI] Placeholder expansion registration initializing...
[02:06:14 INFO]: [PlaceholderAPI] Fetching available expansion information...
[02:06:14 INFO]: [PlaceholderAPI] Successfully registered expansion: exampleplaceholder [1.0.0]
[02:06:14 INFO]: 1 placeholder hook(s) registered!
> papi parse --null %testplaceholder%
[02:06:56 INFO]: %testplaceholder%
>

my code is below, this is essentially all that's included in my project

public class ExamplePlaceholder extends PlaceholderExpansion {
    @Override
    public String getIdentifier() {
        return "exampleplaceholder";
    }

    @Override
    public String getAuthor() {
        return "edgeburnmedia";
    }

    @Override
    public String getVersion() {
        return "1.0.0";
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public String onRequest(OfflinePlayer player, String params) {
        if (params.equals("testplaceholder")) {
            return "an example placeholder";
        } else {
            return null;
        }
    }
}
gritty phoenix
#

I like to ask why I can't open the deluxemenus wiki site

high edge
vapid thistle
granite mountain
#

hmmm im getting this java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null

neat pierBOT
granite mountain
#
@Override
    public void onEnable() {
        new Placeholders().register();
    }``` main class
#
public class Placeholders extends PlaceholderExpansion {
    @Override
    public @NotNull String getIdentifier() {
        return "papiutil";
    }

    @Override
    public @NotNull String getAuthor() {
        return "Pickle";
    }

    @Override
    public @NotNull String getVersion() {
        return "1.0.0";
    }

    @Override
    public String onRequest(OfflinePlayer player, String params) {
        if(params.contains("doubleparse_")) {
            String[] splitStr = params.trim().split("_");
            Bukkit.getLogger().info(splitStr[0]+" "+splitStr[1]);
            return PlaceholderAPI.setPlaceholders(player, PlaceholderAPI.setPlaceholders(player, splitStr[1]));
        }

        return null;
    }
}```
#

placholders

warm steppe
#

@granite mountain Show your plugin.yml file, please.

#

It should be located in your resources folder.

#

/src/main/resources/

granite mountain
#

ok sure sorry i didnt replay sooner

#
name: PapiUtil
version: '${project.version}'
main: net.picklestring.papiutil.Papiutil
api-version: 1.19
authors: [ pickle ]
description: util for papi
website: infinity-craft.net
depend: [PlaceholderAPI]```
dense drift
#

Why arent you making an expansion instead of a plugin?

granite mountain
#

i dont really know how tbh

warm steppe
#

what build tool are you using?

#

gradle or maven

granite mountain
#

maven

warm steppe
#

oml

dense drift
#

All you have to do is to create a project, make a class that extends PlaceholderExpansion and then just put the jar in /plugins/PlaceholderAPI/expansions

warm steppe
#

send pom.xml

granite mountain
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>net.picklestring</groupId>
    <artifactId>papiutil</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>PapiUtil</name>

    <description>util for papi</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <url>infinity-craft.net</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.11.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
warm steppe
#

why do you have shade plugin?

granite mountain
#

idk i used a intellij plugin to make it

warm steppe
#

try removing it

dense drift
#

That will shadow only dependencies that are marked as include or whatever is the scope

#

If you open the jar, does it have papi classes inside?

granite mountain
granite mountain
dense drift
granite mountain
#

wait how do i check

dense drift
#

Open it with winrar

granite mountain
dense drift
#

Use whatever program you have there to open archives

granite mountain
#

ok i'll try and find one to open jar

#

wait i wasnt building using maven i was using intellij. i'm dumb it works now thanks guys

granite mountain
lucid mica
#

Anyone know how to check if the player is eating an enchanted golden apple and not the normal one?

high edge
#

Just check the items material?

lucid mica
high edge
#

What version?

lucid mica
#

1.12.2

high edge
#

ah so janky materials then, you're gonna have to check the data as well

lucid mica
#

How would I do that

#

Got it

lucid mica
#

Know why when I eat the golden apple before the effect I added it doesnt readd it? So like if I eat the apple the effect I added adds but if I eat another golden apple before the effect has ran out it doesnt put it back to the duration I set it just stays as it is

spice river
#

So i get this error when i try to load maven
Cannot resolve org.spigotmc :spigot : 1.16.5-R0.1-SNAPSHOT
thats my pom

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
neat pierBOT
#
๐Ÿ“‹ Your paste: Jokemaster3000
https://paste.md-5.net/buhufocuso

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

#
๐Ÿ“‹ Your paste: Jokemaster3000
https://paste.md-5.net/haluhagela

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

dense drift
#

How can I summon a lightning strike that doesn't deal damage? I tried player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.LIGHTNING, CreatureSpawnEvent.SpawnReason.CUSTOM); and World#strikeLightning but both deal damage

sterile hinge
#

strikeLightningEffect?

dense drift
#

oml

#

thank you ywell

dusky harness
#

rip the sir

#

only ywell

#

๐Ÿ’€

ripe island
#

Hello

#

PlaceholderAPI have a parser that i can add it to mine plugin?
lore example %player%

#

itemmeta.lore(Parser.parseKyori(RewardFile.getStringList(sezione.getCurrentPath() + ".lore")));

hoary scarab
ripe island
#

Mmmh ok

broken elbow
#

use that static method to replace placeholders

hoary scarab
broken elbow
ripe island
#

Yeah i will add it to mine Parser

hoary scarab
broken elbow
# hoary scarab Suggestion for the api then xD

you can open an issue on github for it. not a bad idea I usually didn't really care as its very easy to just stream it. but it wouldn't be that bad to just have a setPlaceholders method that takes in a collection of strings and returns another back

hoary scarab
#

I don't "do github" lol I barely like posting my shit to it. I'm sure its already been requested anyways.

broken elbow
#

nah. its not. I'll open an issue

#

or feature request rather

dense drift
broken elbow
#

let it go gaby. I'll just do it

hoary scarab
#

Nah I get that. I just don't like too

hushed badge
#

pretty sure u can do lists now

broken elbow
#

what?

hushed badge
#

yeah wasn't that added a while back

broken elbow
#

omg you're right

#

I didn't know about it

#

@ripe island no need for the extra util methods

#

there's already methods for that in PlaceholderAPI

#

and its been there for a while now

#

I had no idea

#

lmao

ripe island
#

..?

#
public static List<Component> parseKyoriPAPI(List<String> message, Player utente) {
        List<Component> parsed = new ArrayList<>();
        for (int i = 0; i <  message.size(); i++) {
            PlaceholderAPI.setPlaceholders(utente, message.get(i));
            parsed.add(i,MiniMessage.miniMessage().deserialize(message.get(i)).decoration(TextDecoration.ITALIC, false));
        }
        return parsed;
    }

I doit this but don't work :C

#

Method names?

broken elbow
ripe island
#

Oki

broken elbow
#

papi supports list parsing apparently

#

and it has for a long time. I just didn't know bcz I'm dumb xD

dense drift
#

Btw append the component to an empty component that has italic set to false, rn it will override the italic thats set manually

broken elbow
#

thank you gaby โค๏ธ

dense drift
#

Anytime brother

broken elbow
#

for agreeing with me

dense drift
#

ngl I didn't know either ๐Ÿ˜ฌ

broken elbow
#

ok. minimessage question. what exception does MIniMessage throw when you deserialize a string which has section symbols in it? I can't seem to find it.

#

is it not actually an exception?

lyric gyro
#

it is

broken elbow
#

and as I type I found it

#

just used IntelliJ's scope searching lol

#

its a ParsingExceptionImpl

#

wonder why the javadocs don't mention it tho.

lyric gyro
#

it's not something you should expect to happen

broken elbow
#

well

lyric gyro
#

but I agree it should be documented

broken elbow
#

also. the client parses colors like ยงA? I thought its case sensitive.

#

good to know lol

dense drift
#

Emily, while you are here, is there a better way than this to get all permissions that start with a certain value to compare them? Ignore the comments

        return LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player).getNodes().stream()
                .filter(NodeType.PERMISSION::matches) // Accept only permission nodes
                .map(NodeType.PERMISSION::cast) // Cast the node
                .map(PermissionNode::getPermission) // Get the permission
                .filter(it -> it.startsWith(node)) // Filter permissions that start with the specified node
                .map(it -> it.replace(node, "")) // Get the value
                .map(Ints::tryParse) // Try to parse it to an integer
                .filter(Objects::nonNull); // Filter possible null values```
#

basically there's this permission like something.duration.X and I need to get the highest X of all the permissions the player can have

broken elbow
#

that's awful

#

why do it using permissions? ๐Ÿ˜ฆ

lyric gyro
#

can you remove all the leading spaces? can't read shit on mobile lol

dense drift
broken elbow
# lyric gyro can you remove all the leading spaces? can't read shit on mobile lol
return LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player).getNodes().stream()
.filter(NodeType.PERMISSION::matches) // Accept only permission nodes
.map(NodeType.PERMISSION::cast) // Cast the node
.map(PermissionNode::getPermission) // Get the permission
.filter(it -> it.startsWith(node)) // Filter permissions that start with the specified node
.map(it -> it.replace(node, "")) // Get the value
.map(Ints::tryParse) // Try to parse it to an integer
.filter(Objects::nonNull); // Filter possible null values```
#

or that

broken elbow
#

lol

broken elbow
lyric gyro
#

you should really really really really be using meta nodes

dense drift
#

fair, fair

lyric gyro
#

and meta data cache

steep dragon
#

emily, while you're here, ๐Ÿ˜˜

broken elbow
#

oh. those are also a thing. I forgot about meta.

dense drift
#

lol for a second I thought discord is broken when I saw Emily and Emilia typing LOL

broken elbow
#

well discord is still broken

lyric gyro
#

yeah the CachedMetaData is precisely for this stuff but they have their own "format"

dense drift
#

hmm, I see

#

is metadata inherited from groups?

lyric gyro
#

everything in the Cached*Data is calculated

dense drift
lyric gyro
#

meta.<key>.<value>

#

iirc

dense drift
#

ah like a permission

steep dragon
#

lp metadata is awesome and more people should abuse it

lyric gyro
#

yeah but those are treated specially precisely to be used as a Map lookup

dense drift
#

do I want getMetaValue or queryMetaValue?

lyric gyro
#

most likely get

hoary scarab
#

Real question... Has anyone actually used vault for any of its other features besides economy xD

dense drift
#

permissions?

lyric gyro
#

query returns a Result? it can have some added benefits but for the most part just get is fine

dense drift
#

ah I thought it returns all metas with that key (like from all groups the player has)

broken elbow
lyric gyro
#

a single meta key always evaluates to a single value (in the same sense that a single permission key evaluates to a single true/false/undefined result)

#

LP takes inheritance and all that into consideration when calculating it

dense drift
#

for a second I thought normal metas also have priorities, but looks like that's only for prefixes and suffixes, which is great

lyric gyro
#

yeah

hoary scarab
#

Ok cause I never see plugins use those methods and only just read the resource page a month ago xD

dense drift
#

this is great wtf

lyric gyro
#

there are some configurations regarding meta ordering and something about weight, don't remember exactly, I remember suggesting adding weights to meta nodes and luck pointed me to the config lol

dense drift
#
[LP] -> max-ban-duration = '12' (inherited from self) 
[LP] -> max-ban-duration = '1' (inherited from default) ```
I wonder which one will be returned ![thinkfused](https://cdn.discordapp.com/emojis/795445143658430496.webp?size=128 "thinkfused")
dense drift
#

Oh sweet

#

The second option is just PERFECT

lyric gyro
#

:d

dense drift
#

Because I need the lowest for one meta and the highest for another kek

lyric gyro
#

I love that you can configure it per meta key

dense drift
#

YAS

#

Smh blitz

broken elbow
#

๐Ÿง…

dense drift
#

You got me this time

broken elbow
#

I did indeed

dense drift
#

Man I love LP

lyric gyro
#

I've never seen anyone make use of those settings, it's always nice when you do

steep dragon
dense drift
lyric gyro
#

but it's better if LuckPerms does the work it already can, no? ;d

steep dragon
#

i don't think i've ever perceived the metadata as anything but a key-value storage with multiple values per key, that's how i always use it

lyric gyro
#

well, "yes" i suppose

#

but for the majority of use cases one needs a single result, ideally aligned with the inheritance rules

#

I guess an exceptional example could be discord roles, and mapping your plugin key to the role id

#

so if you have many roles you can still fetch them all

leaden oar
#

anyone wanna make a srv? Dm

lyric gyro
#

no

leaden oar
#

lol

steep dragon
lyric gyro
#

it's not hard to come up with examples, say you have a chat plugin and your name colour is determined by a meta key, funny-chat-name-colour

#

default could be white, VIP green, admin something else etc

steep dragon
#

no no i mean i haven't personally implemented anything with that usecase

lyric gyro
#

ah

ripe island
#

Hi guys in mine GUI i need to load 12 blocks that have on lore 2 Placeholders and i'm parsing it with PlaceholderAPI.setPlaceholders

(the for(cycle) of these items is Bukkit.runasynctask) but for loading 1 of these items with placeholders takes about 1 second per block

                                itemmeta.lore(Parser.parseKyori(PlaceholderAPI.setPlaceholders(player,
                                        MenuFile.getStringList(sezione.getCurrentPath() + ".lore"))));

This are the placeholders how i can improve the performance?

    public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
        if(params.equalsIgnoreCase("level")) {
            return String.valueOf(instance.getDatabaseManager().getLvl(player.getName()));
        }
        if(params.equalsIgnoreCase("exp")) {
            return String.valueOf(instance.getDatabaseManager().getExp(player.getName()));
        }
        return null;
    }
icy shadow
#

doing database queries in a placeholder (or anywhere on the main thread) is an incredibly bad idea

#

you should be caching things rather than always querying the database

ripe island
#

Okok

#

Did you have something for see an example?
I don't have any idea for do it

ripe island
hoary scarab
#

Create a class and use maps or what ever you prefer to cache the data then set the data in the database when you no longer need it cached

dark garnet
#

why is PlayerInteractEvent fired when i drop an item?

#

and how do i filter that out

lyric gyro
#

it's ultimate stupidity

dark garnet
#

bruhhh

#

whatever its fine, not rly something i need to fix

lyric gyro
#

What am I doing wrong

broken elbow
lyric gyro
#

what

broken elbow
#

you're comparing nothing to 71

lyric gyro
#

oh

#

jesus tysm

lyric gyro
lyric gyro
#

it's printing out 1 instead of 2

#

why

broken elbow
#

well. bcz the first check is true?

#

71 is bigger than 18

lyric gyro
#

so I need to add && < 71?

broken elbow
#

well it depends on what you're trying to achieve?

lyric gyro
#

what do I have to do so it prints 2 instead of one when the first int is 71?

broken elbow
#
if (idade == 71) {
    // PRINT 2 HERE
} ```
lyric gyro
#

if first int is superior to 18 but lower than 71

#

print one

#

if first int is 71 or superior

#

print two

#

otherwise

#

print three

#

i am doing exactly like the guy on the tutorial is doing and his works perfect

#

mine doesnt

broken elbow
neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

broken elbow
#

you can try some from here this

lyric gyro
#

all of these are paid

#

youtube is free

#

well im not doing exactly like the tutorial

#

as his starts with false and mine starts with true

#

but anyways

#

JetBrains Academy has a 3 month free trial and it has exceedingly good reputation

#

That you still have to input credit card info

#

If I had one Id do it but I dont

broken elbow
#

do you? I thought I've set that up before without it

lyric gyro
#

most likely

broken elbow
#

it clearly says its not actually required. you just need an account

lyric gyro
#

i'll check it out then

misty dragon
#

Guys i need some help, im getting this bug

java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "java.util.List.get(int).p" is null
        at com.blockbreakreward.handler.BlockBreakEventHandler.AddBlockBreakToPlayersList(BlockBreakEventHandler.java:85) ~[?:?]
#

but my code is check if its not a null value

if (Plugin.plugin.players.get(i) != null) {
                        if (pler.getUniqueId().equals(Plugin.plugin.players.get(i).p.getUniqueId())) {
                            PlayerProcessor.CreatePlayerFileAndSetValue(pler.getPlayer(), p);
                            return;
                        }
                    }
#

:\

#

secs let me take a look

misty dragon
#

fixed it, nvm โค๏ธ

lucid mica
#

Anyone know how to fix this in my yaml? (<unknown>): did not find expected key while parsing a block mapping at line 128 column 9

jade wave
#

Run it thru a yml checker @lucid mica

glacial sleet
#

anyone here got experience with mythic mobs API

#
    private final BukkitAPIHelper mythicMobs = MythicBukkit.inst().getAPIHelper();
#

im trying to get instance but its returning null

lucid mica
jade wave
#

Seems like u gotta fix your indentation

#

Just backspace - Friedbee back by one.

lucid mica
#

Didn't fix it

jade wave
#

I can't see the full indentation but that's your issue.

lucid mica
jade wave
#

If you are using vs code

#

Shift + Alt + F

lucid mica
jade wave
#

Wdym

lucid mica
# jade wave Shift + Alt + F

That doesnt do anything, there is 2 red lines and the first says "All mapping items must start at the same column" and "Map keys must be uniqueYAML"

jade wave
#

Just look up what it means...

#

Google is a good friend

lucid mica
#

That didnt help at all

#

Fixed it

dense drift
#

Is there anything I can do to stop player's health going back to 10 hearts when the rejoin, even though their max health is 13?

high edge
#

Just set it on join?

#

I guess

dense drift
#

I do set it on join

#

Fixed, I had to use Player#setHealthScale

dense drift
#

once a recipe is registered, is not possible to replace it while the server is running?

#

I tried this but the old recipe is still in-game

Bukkit.removeRecipe(recipe.getKey());
Bukkit.addRecipe(recipe);```
dense drift
#

ih

#

sad

lyric gyro
#

whats the difference between if and switch?

#

will it change anything? one is faster than the other?

dense drift
#
            Bukkit.removeRecipe(recipe.getKey());
            Bukkit.addRecipe(recipe);

            for (final var player : Bukkit.getOnlinePlayers()) {
                player.undiscoverRecipe(recipe.getKey());
                player.discoverRecipe(recipe.getKey());
            }```
Easy fix
turbid jewel
#

Does anyone know a lightweight/open sourced runtime dependency manager?

mental cypress
broken elbow
#

haha

turbid jewel
#

ooo

#

aight, i c

mental cypress
#

It might be a little broken but I think there's forks that fix it.

dusky harness
broken elbow
#

do you really maintain it?

dusky harness
#

I use it for one of my projects

#

without it my jar would be like 80mb

#

lol

broken elbow
#

wtf

#

are you downloading the whole fucking minecraft server?

dusky harness
#

I think I counted 26 dependencies

#

๐Ÿคฃ

#

it's all because of the kotlin script thing I think
I keep forgetting to take it out (it doesn't even work rn since it's relocated)

#

but even still the jar size is too big to send through discord (plugin is for a server owner)

broken elbow
#

lol

#

dropbox

lyric gyro
#

just get nitro

dusky harness
#

I just used wetransfer ๐Ÿคท

#

first thing that pops up

#

when google "file transfer" or somethign liket hat

lyric gyro
#

help

dusky harness
#

?help

neat pierBOT
#
FAQ Answer:
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait

Source

lyric gyro
#

I made an infinite loop on intellij and now I can't stop it

dusky harness
#

wha

lyric gyro
#

how do I stop it

dusky harness
#

t

#

task manager

#

ctrl shift esc

lyric gyro
#

what now

dusky harness
#

select intellij

#

end task

lyric gyro
#

is that really the only way to stop it

dusky harness
#

Uhh

#

it is one way

#

the easiest way

#

other way is restart your pc

#

๐Ÿ˜ƒ

#

or signing out

lyric gyro
dusky harness
#

I'd guess that you already tried to close the program

lyric gyro
#

while loops

#

infinite while loops

dusky harness
#

Can't you just end the java program inside

#

stop button

#

red square

lyric gyro
#

i already tried that

dusky harness
#

and what happened

lyric gyro
#

the issue is that the program started the loop again after a few seconds

dusky harness
#

what program is this

lyric gyro
#

intellij

dusky harness
#

what code are you running

lyric gyro
#

I already earsed it

#

but it was basically

dusky harness
#

how do you know that it's still running then?
Just press the red square, if it doesn't stop then, it should've replaced the red square with a skull emoji (I think) which you can press to kill the loop

lyric gyro
#
  variable1++;
 sout("I will be here forever. " + number)
}
#

that was the code

#

and it just didn't stop

turbid jewel
#

Shutdown your computer? xd

dusky harness
#

Just press the red square, if it doesn't stop then, it should've replaced the red square with a skull emoji (I think) which you can press to kill the loop

#

or close intellij

#

or end task

#

or show an entire screenshot and I'll tell you what to do

lyric gyro
#

I already restarted Intellij

#

but where the hell is this red square with a skull

wheat carbon
#

task manager and kill java

dusky harness
#

the program is already stopped I guess then

dusky harness
#

or do it if you want to make sure

pulsar ferry
#

It can sometimes still be running in the background if it doesn't exit properly so task manager to be sure

dusky harness
wheat carbon
#

yeah I've had ij detach from run configs before

#

does happen

lyric gyro
#

imagine you restart your pc and somehow the loop is still going

pulsar ferry
#

Lmao

wheat carbon
#

you using windows?

lyric gyro
#

yes

wheat carbon
#

open cmd and run this %0|%0

#

it'll kill any looping processes

dusky harness
#

whats that do-

#

๐Ÿคจ

#

๐Ÿคจ

#

๐Ÿคจ

#

๐Ÿคจ

lyric gyro
#

you could also delete system32, it would kill any looping process

dusky harness
#

lol

lyric gyro
#

but it would also kill your computer

wheat carbon
#

you can trust me i'm an admin of helpchat

#

i literally help

dusky harness
#

yes

#

piggy is Admin

#

PiggyPiglet

#

he has that red crown next to his name

wheat carbon
#

no message

#

wonder if he ran it

dusky harness
#

that command looks a little familiar

#

from a video

#

๐ŸŸฆ

wheat carbon
#

๐Ÿด but no ๐Ÿ”ช

lyric gyro
dusky harness
dusky harness
#

where r u typing from

#

๐Ÿค”

lyric gyro
#

oh shit

dusky harness
#

lol

#

๐Ÿ’€

lyric gyro
#

The loop is still going

#

after the bsod

#

๐Ÿ’€

dusky harness
#

๐Ÿ‘ฒ

#

๐Ÿงข

#

๐Ÿ

lyric gyro
#

๐Ÿ
๐Ÿ”๏ธ

#

did you know

#

goats typically live in mountains

dusky harness
#

no I did not

#

thank you for telling me

lyric gyro
#

yeah they do

dusky harness
#

thank you

#

very much

lyric gyro
#

no problem. use this information in your next coding session

dusky harness
#

I appreciate the knowledge that you bring to me!

#

Will do.

#

I think it will improve my coding speed

#

I did not know that goats lived in mountains

lyric gyro
#

yeah helped me a lot

dense drift
#

is possible to get the entity from a Merchant?
I get it from Inventory click event final var merchant = ((MerchantInventory) event.getClickedInventory()).getMerchant();
But is not an instance of Villager or AbstractVillager

mental cypress
dense drift
#

that's the player I think ๐Ÿ˜ฌ

#

Gets the player this merchant is trading with, or null if it is not
ye

hoary scarab
#

Hmm well says Merchant is villager abstractvillager and wanderingtrader

#

So cast?

dense drift
#

I tried merchant intanceof Villager villager and it didn't work

hoary scarab
#

Odd. Debug it i guess

dense drift
#
[19:51:32 INFO]: [AeroQuests] [STDOUT] merchant.getClass() = class org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMerchant
[19:51:32 INFO]: [AeroQuests] [STDOUT] (merchant instanceof AbstractVillager) = false
[19:51:32 INFO]: [AeroQuests] [STDOUT] (merchant instanceof Villager) = false```
hoary scarab
#

I'm not even seeing CraftMerchant in the java docs? Or atleast when google searching

broken elbow
#

that extends Merchant

#

its basically the implementation of the merchant

hoary scarab
#

What about instanceof WanderingTrader?

dense drift
#

no

hoary scarab
#

Try using InventoryHolder casted to villager

dense drift
#

๐Ÿ˜ฎ I completely forgot about this, damn it

#

it works

#

@graceful hedge hyperkappa fixed

graceful hedge
#

Very pog fingerguns

hoary scarab
dense drift
#

thanks yapp

hoary scarab
#

np

dense drift
#

Does anybody know if it is possible to edit the chat message after it was modified by VentureChat? It has an event but it is immutable ๐Ÿ˜

icy shadow
#

thats a no then ig

dense drift
#

stupid plugin

dense drift
#

yup, it worked

lyric gyro
#

is there a way to uninstall fuckin nms and install it again in an older version?

#

and the spigot server too

#

i need to know

merry knoll
lyric gyro
#

ok at this point you know i am a beginner

#

and you know you will have to explain me this

#

but i am not as dumb as i was before

#

I actually did watch some java tutorials

#

and now i know the basics of java

dusky harness
lyric gyro
#

so you dont need to talk like you are talking to a 5 year old

#

you can talk like you would talk to a 7 year old basically

#

so we have that

#

lol

lyric gyro
#

I don't need to delete any files

dusky harness
dusky harness
lyric gyro
#

ok thanks

dusky harness
#

np

lyric gyro
#

can I use the same folder I used for the 1.19 buildtools btw?

#

just delete whats in there

#

and another thing

#

do i have to redo all my spigot projects?

#

and ANOTHER thing

#

do I have to do something else for creating projects for that specific version i want?

#

@dusky harness

dusky harness
dusky harness
dusky harness
#

which I'm guessing you'd know how to do since you already selected an nms version

lyric gyro
#

yeah

#

so basically

#

just run buildtools on the version i want?

dusky harness
#

yes

lyric gyro
#

thanks for the help

dusky harness
#

๐Ÿ‘

lyric gyro
#

how the fuck do I downgrade my java version

#

I wanted to downgrade it to java 10 but I just cant download from oracles official website

#

it asks me to create an account

icy shadow
#

not sure why you want 10, there's 11 here

lyric gyro
#

because I need to develop plugins for 1.12.2

#

and I cant download nms with java 17

#

not for 1.12.2

icy shadow
#

yeah 8 or possibly 11 should work then

lyric gyro
#

it said on the terminal it was either 8 or 10

#

im not sure if 11 will work

winged pebble
#

You can just give it the full path to the java 8 or 10 bin files

dusky harness
#

he didn't have java 8 or 10 installed

winged pebble
#

Yeah, just letting him no he doesn't have to downgrade the installed version

proud pebble
#

just change the jdk to 8

#

in the ide

dusky harness
#

running buildtools in the IDE ๐Ÿคจ

open jewel
thorn cape
#

is there a way to hide the player model from the client maybe by resource pack or something? I want to hide the player from themselves and using an invisibility potion will still how them as just transparent.

warm steppe
#

Spectator mode

lyric gyro
#

why

winged pebble
#

Because you added a semicolon right after your second for loop

#

So f = 5

#

but the highest index is 4

lyric gyro
#

I see

#

I seethe

sterile hinge
#

that's why you should declare the variable in the loop header

cinder forum
#

Hi, any idea, why is
this line

int savedPlaytime = playersCollection.find(filter).first().getInteger("playtime").intValue();

causing this error?

java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap')
sterile hinge
#

playtime is a long, not an int

cinder forum
#

its int64 in document

broken elbow
cinder forum
#

๐Ÿค”

broken elbow
#

an int32 is an int

#

64 is for 64 bits

cinder forum
#

I mean yeah Java int is 32 bit but still but ig it makes sense ty

broken elbow
thorn cape
lyric gyro
#

Why isn't it possible

broken elbow
lyric gyro
#

why not you (not going to insult you)

broken elbow
#

use listaDeNumeroCabulosa.toString();

#

instead

#

hmm tho there should be a static method tho iirc

lyric gyro
#

now it says unexpected token

broken elbow
#

yeah. weird.

lyric gyro
#

and identifier expected

#

the fuck is wrong with my ide

broken elbow
#

restart

#

if it doesn't work, invalidate cache

lyric gyro
#

yeah the previous method I tried worked for the guy thats teaching me

#

but not for me

#

and im completly sure I did everything exactly like he did

lyric gyro
lyric gyro
#

the method you gave me is not what I wanted to do

#

I wanted to print them out individually, not add them

proud pebble
#

then you will want to for loop over the array and print them

lyric gyro
#

print them in the same line

#

but individually

lyric gyro
#

is there possibly any way that I could develop a plugin on spigot that would randomly and automatically spawn mobs made with the custom mob plugin?

#

its for a tower defence minigame

#

except you are the one killing the mobs

#

so the waves would be infinite

#

and automatically generated

broken elbow
#

its definitely possible. but judging by the posts you've made in the past few days its most likely out of your capabilities. I do recommend you practice some more java first.

lyric gyro
lyric gyro
#

I want to do this as soon as possible of course but I know that it will take some time

#

maybe a few weeks

#

best thing i can do in spigot now is a plugin that welcomes you or says bye when you enter or leave the server

#

and even then I need help for this lol

cinder forum
#

Hi, how can I update string in object in object (key)?

var value = 1;
Bson playerUpdate = Updates.set("???", value);
torpid raft
#

are you asking how you would change the "???" into a different string?

cinder forum
#

nope, jsut want to change value of servers.kitpvp.key

#

but i dont know how to access servers.kitpvp.key

torpid raft
#

try changing "???" into "servers.kitpvp.key"

#

?

cinder forum
#

tried but doesnt work

#

you can have dots in the names so that would be broken ig

torpid raft
#

look into the bson api, you probably need to access 'servers' then 'kitpvp' then 'key' with separate statements

cinder forum
#

๐Ÿ‘ :*

cinder forum
#

still didnt found it :d

#

aight, the dots are working fine, i forgot to convert uuid to string...

warm steppe
#

Is there a "longer" Map#of()?

#

Ah, found Map#ofEntries()

lyric gyro
#

can someone explain to me why the error 'can't resolve' symbol keeps annoying the living shit out of me

#

here's the code

#

    public static void main(String[] args){

        /*
        Classes & Declaring Objects (Ep. 17)
         */

        class Human {
            String name;
            int age;
            static boolean isMale;
            double height;
            double weight;
            String species = getClass().getSimpleName();

        }



        Human human1 = new Human();

        human1.name = "Peter Griffin";
        human1.age = 44;
        human1.isMale = true;
        human1.height = 1.80;
        human1.weight = 122;


        System.out.println("Hello, my name is " + human1.name);
        System.out.println("I am " + human1.age + " years old!");

        //Unmovable rock in the way

        if (isMale == true){
            System.out.println("Im a man!");
        }else{
            System.out.println("Im a woman!");
        }

        System.out.println("My height is " + human1.height + " meters, and my weight is " + human1.weight + " kilograms.");
        System.out.println("I am a " + human1.species + ". Ehehehhehehehehe");

        Human human2 = new Human();
        human2.name = "Lois Griffin";
        human2.age = 48;
        human2.isMale = false;
        human2.height = 1.72;
        human2.weight = 52.16;

        System.out.println("Hi, mah name is " + human2.name);
        System.out.println("I am " + human2.age + " years old!");
        System.out.println("I am " + human2.height + " metahs tall!");
        System.out.println("My weight is " + human2.height + " kilograms.");
        System.out.println("My husband's name is Petah and " + human2.isMale);


    }


}
#

specifically this part

#
        //Unmovable rock in the way

        if (isMale == true){
            System.out.println("Im a man!");
        }else{
            System.out.println("Im a woman!");
        }```
#

it keeps saying that it cant resolve symbol 'IsMale'

#

even though i did absolutely nothing wrong

cinder nimbus
lyric gyro
#

and it worked for peter griffin

#

now that I added lois to the collection it doesn't work

#

it doesnt work for her

#

not even if

#

not even if I just change the object name

cinder nimbus
#

human2.isMale == false?

lyric gyro
#

yes

#

look

#

it wasnt working

#

so all i did was

#
        human2.name = "Lois Griffin";
        human2.age = 48;

        if (human2.isMale == true){
            System.out.println("Im a man!");
        }else{
            System.out.println("Im a woman!");
        }

        human2.isMale = false;
        human2.height = 1.72;
        human2.weight = 52.16;

        System.out.println("Hi, mah name is " + human2.name);
        System.out.println("I am " + human2.age + " years old!");
        System.out.println("I am " + human2.height + " metahs tall!");
        System.out.println("Mah weight is " + human2.height + " kilograms.");
        System.out.println("Mah husband's name is Petah and " + human2.isMale);```
#

and instead of sayin im a woman

#

it says false

#

why

cinder nimbus
#

static i presume?

lyric gyro
#

well

#

before the variable wasnt static

#

but now it is because the IDE kept me giving another error

#

I don't actually have to put the same lines of code for every object right?

#

I should be able to put it just once

cinder nimbus
#

you can setup default values though

lyric gyro
#

that's not really what i am trying to do

frigid pollen
#

so I am looking for a database tools and wanted to try SQL Server Management Studio 2019 but I cannot get it to connect to my remote mariaDB server I am guessing this is not possible?

lyric gyro
#

notice how the if is

#

if male then print "im a male"

#

if woman then print "im a woman"

#

whats happening is that

#

OOOOH

#

its exactly this

#

eureka

#

because Im saying to print "im a woman or im a male"

cinder nimbus
#

you don't validate if null

lyric gyro
#

but here System.out.println("Mah husband's name is Petah and " + human2.isMale);

cinder nimbus
#

so if isMale isn't set it defaults to is female

lyric gyro
#

get it?

cinder nimbus
lyric gyro
#

yes

#

the console is saying

#

'Mah husband's name is Petah and false'

#

I wanted it to say

cinder nimbus
#

oh do you want the console to say is male

lyric gyro
#

'Mah husband's name is Petah and I am a woman'

#

get it?

cinder nimbus
lyric gyro
#

that's why it isnt working

#

well now lets see how to fix it

frigid pollen
# cinder nimbus it should be possible

Odd do you know how because I am using the correct data to login to connect but it is failing. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

cinder nimbus
# lyric gyro that's why it isnt working

look at class methods for something like


        class Human {
            String name;
            int age;
            static boolean isMale;
            double height;
            double weight;
            String species = getClass().getSimpleName();
            
            public String getGender(){
                if(isMale){
                    return "male";
                }else{
                    return "false";
                }
            }
        }

then use 
Human human = new Human();

...
...
human.getGender(); //<- this will return "male" or "female"
cinder nimbus
lucid mica
#

Is there a way to change the amount of golden hearts I get when I eat a god apple?

dense drift
#

It is just a potion effect

warm steppe
#
System.out.prinln(human2.isMale ? "Im a man!" : "Im a woman!");
#

It is a inline if statement

#

Pretty useful thing, i use it a lot

#

First you put your if statement, then question mark and then put what it should return if true and then colon for false and return smth

dense drift
stuck hearth
#

Don't need ternary operators in Kotlin ๐Ÿ˜Ž

dense drift
#

true, but sometimes looks better than if (x) y else z

brittle thunder
#

Then there's y if x else z ๐Ÿ˜ท

dense drift
#

python?

brittle thunder
#

yea

lucid mica
#

Anyone know why I'm getting absorption iv and not 1? My code is p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 2400, 1), true);

dense drift
#

d;PotionEffect#PotionEffect

uneven lanternBOT
#
public  PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles)```
Description:

Creates a potion effect with no defined color.

Parameters:

type - effect type
duration - measured in ticks, see getDuration()
amplifier - the amplifier, see getAmplifier()
ambient - the ambient status, see isAmbient()
particles - the particle status, see hasParticles()

dense drift
#

amplifier 1 is level 2

lucid mica
#

So I changed it to 1 to see if that changed anything but it still kept giving me iv

dense drift
#

that's weird

#

d;Player#addPotionEffect

uneven lanternBOT
#
@Deprecated
boolean addPotionEffect(@NotNull PotionEffect effect, boolean force)```
Description:

Adds the given PotionEffect to the living entity.

Only one potion effect can be present for a given PotionEffectType.

Deprecation Message:

no need to force since multiple effects of the same type are now supported.

Returns:

whether the effect could be added

Parameters:

effect - PotionEffect to be added
force - whether conflicting effects should be removed

dense drift
#

no need to force since multiple effects of the same type are now supported.

lucid mica
#

let me try without force

#

Nope still IV

#

If it changes anything its for when I'm eating a god apple. I'm changing the effects for when you eat it

#

And I'm using 1.12.2

dense drift
#

make sure you cancel the event and add your own effects

lucid mica
dense drift
#

Is possible to get all items crafted? If I use click + control to take all items I get only one from ItemCraftEvent but 16 in inventory

broken elbow
#

doesn't it just fire 16 times?

#

it would be funny

dense drift
#

nope

#

d;methods CraftItemEvent

uneven lanternBOT
#
Methods:
org.bukkit.event.inventory.CraftItemEvent#CraftItemEvent
org.bukkit.event.inventory.CraftItemEvent#getInventory
org.bukkit.event.inventory.CraftItemEvent#getRecipe```
dense drift
#

not many things I can use I guess

#

I hoped maybe PlayerStatisticIncrementEvent will fire once kek but it is ok I guess

mystic gull
#

Hello, is there a way to automatically translate the item of the player with the language he is using ?

dense drift
#

depends where you need that, @mystic gull

#

for messages, there's adventure, which offers TranslatableComponent s

mystic gull
#

I just want to translate like "You received [item_name] !"

dense drift
#

do you use paper?

mystic gull
#

yes

dense drift
#

Ok, what you need is Component#translatable and then pass a translatable instance, on paper, Material extends Translatable

lyric gyro
#
text()
  .append(text("You received "))
  .append(itemStack.displayName())
  .append(text('!'));

:)

dense drift
#

does ItemStack#displayName fallback to the item type?

lyric gyro
#

it returns whatever the vanilla system uses for, e.g. the feedback for /give and such

dense drift
#

hmm, interesting

cinder forum
#

Hi ๐Ÿ‘‹ I need to print placeholder asynchronously but because it's on quit event, empty string is printed, how could I solve that?

@EventHandler
public void onQuit(PlayerQuitEvent event) {
  Player player = event.getPlayer();

  plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
    System.out.println(PlaceholderAPI.setPlaceholders(player, "%player_health%");
});
lyric gyro
#

Why do you need to print it asynchronously

cinder forum
#

real code do db query

hoary scarab
cinder forum
#

basically im trying to save placeholder(s) value to database on quit

lyric gyro
#

take the placeholders before jumping to the async task

cinder forum
#

oh wait, you can use OfflinePlayer ๐Ÿค”

#

is it okay to use it?

dusky harness
#

(synchronously)

cinder forum
#

it can be any placeholder

dusky harness
#

Ohhh

#

get the placeholder, save it to a variable, then do the db stuff async ```java
@EventHandler
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();

String result = PlaceholderAPI.setPlaceholders(player, "%player_health%");
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
// db stuff
});

cinder forum
#

๐Ÿ‘

wintry grove
#

time to be that dumbass that uses c++ in a place full of java

So, I'm currently messing with JNA shit bc I want to make native notifications using the windows sdk thing, the part of the java part (like accessing the .dll and shit) is clearer than shit, my problem now is to setup that fricking .dll, I know the basics of c++ and should have no problem on making the code in c++, but I also need to setup the windows sdk thing so I can bundle it into my .dll, which is kind of a problem.

#

if anyone can help with this I'd be very thankful

#

and before anyone says I have tried things like notify

#

but I dont like the result

stuck canopy
#

how do I give custom texture to player heads in paper

#

for some reason GameProfile isnt available in paper

errant kraken
#

is it possible to detect if an arrow was shot at full charge?

stuck canopy
#

oh

stuck canopy
wraith scarab
#

Hi i'm try to use protocol lib to get when a player press TAB in the chat to cancel / change what the user got right now i'm at the start of this project and i want to know how to do certains things ->
Here a link of a error with the code
https://pastebin.com/VpBcLCd5

at the error i get net.minecraft.server.v1_8_R3.PacketPlayOutTabComplete@30392545[
a={/?,........}
]

and i want to know to get this thing (the a)
so i'm here to ask you this
thx for read me and thx for any kind of help

dusky harness
#

like what does it represent

#

if you mean the text, then it's event.getPacket().getStrings().read(0)

#

and it should be the same on all versions

nimble vale
#

does anyone knows if redis or specifically jedis is thread-safe

#

or should i create a queue based system for publishing messages

dusky harness
#

the "Client" means client -> server packet

wraith scarab
#

super(SL_Main.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.TAB_COMPLETE);

#

PacketType.Play.Server.TAB_COMPLETE

#

and a is a private string[] from the Packet class :

public class PacketPlayOutTabComplete implements Packet<PacketListenerPlayOut> {
    private String[] a;

    public PacketPlayOutTabComplete() {
    }

    public PacketPlayOutTabComplete(String[] var1) {
        this.a = var1;
    }

    public void a(PacketDataSerializer var1) throws IOException {
        this.a = new String[var1.e()];

        for(int var2 = 0; var2 < this.a.length; ++var2) {
            this.a[var2] = var1.c(32767);
        }

    }

    public void b(PacketDataSerializer var1) throws IOException {
        var1.b(this.a.length);
        String[] var2 = this.a;
        int var3 = var2.length;

        for(int var4 = 0; var4 < var3; ++var4) {
            String var5 = var2[var4];
            var1.a(var5);
        }

    }

    public void a(PacketListenerPlayOut var1) {
        var1.a(this);
    }
}

#

but i'm going to try the thing you say with the packetwrapper

dusky harness
ripe island
#

My plugin all work fine, but THIS METHOD with this database call give me a lot of lag problems in the server

    @Override
    public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
        if(params.equalsIgnoreCase("balance")) {
            return String.valueOf(instance.getGems().bilancioPlayer(player.getName()));
        }
        return null;
    }
#

What i can use?

#

Bukkit.getScheduler().runTaskAsynchronously(); say invalid return value

dusky harness
#

Retrieve player data every couple seconds or so and store it in a HashMap

#

then in onRequest get from the hashmap

ripe island
#

Mmmh ok

#

i will search

wraith scarab
dusky harness
#

oh you are

#

oh are you trying to modify the tab completion

wraith scarab
#

and if i use the wrapper for server packet that not working because i need a class from mojang (Suggestion)

dusky harness
#

try this

wraith scarab
#

thx a lot

royal marlin
dark garnet
#

i thought i had done it with application.mainClass.set("io.ktor.server.netty.EngineMain") (i have no idea what io.ktor.server.netty.EngineMain is i did this a while ago), i tried changing it to com.extendedclip.papi.expansion.server.ServerExpansion but that didnt work either

icy shadow
#

what

#

what on earth does ktor and a java main class have to do with this

dusky harness
#

I'm not sure if this issue is related to the github issue

warm steppe
#

i dont even know what to say, why is there ktor being used for papi placeholder expansion?

dusky harness
#

and plugins/expansions should not have their main class set

#

Also make sure to relocate your dependencies

#

wait a minute

#

ktor isn't even in your build script ๐Ÿคจ

#

and it's in java

#

Uhhhhh

#

If this error is coming from your expansion, make sure to relocate caffeine

#

If not, then identify what expansion is causing this issue

#

you shouldn't set the main class and you shouldn't be using ktor here

dark garnet
#

cause i literally have no idea what ktor is

icy shadow
#

ok still why do you have a main class

#

placeholders do not need them

#

as dkim19375 aka kotlin = best aka kotlin = best said

dusky harness
dark garnet
#

its mine

#

so what do i do?

#

remove main class and then what?

dusky harness
#

relocate caffeine

dark garnet
#

how do i do that?

icy shadow
#

yeah thats probably the issue

dusky harness
#

uhh

#
tasks.shadowJar {
    relocate("com.github.benmanes.caffine", "com.extendedclip.papi.expansion.server.libs.caffeine")
}
#

@dark garnet

#

and remove the application plugin

#

and update the papi dependency :))

dark garnet
#

yea i havent touched this expansion in a long time

dark garnet
dusky harness
#

so that it doesn't conflict with other plugins or expansions

dark garnet
#

ahh

dark garnet
dusky harness
#

the error said benmanes

dark garnet
#

implementation("com.github.ben-manes.caffeine:caffeine:3.1.1")

dusky harness
#

thats not the package

#

thats what maven/gradle uses to find the dependency

dark garnet
#

oh

dark garnet
#

not including it at all works too

#

lmao

dusky harness
#

you should only see com.extendedclip...

#

(and maybe like a META-INF file etc)

dark garnet
lucid mica
#

Anyone know why I'm getting absorption IV and not 1? p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 2400, 1), true); When I cancel the event then add my effects it works but it doesnt remove the golden apple and all other stuff that it messes with lol

robust flower
#

Assuming I would like to listen for all events that could remove blocks (like BlockExplodeEvent, BlockBurnEvent, etc), is there an extensive list of what events should I listen for to acomplish this goal?

dusky harness
#

safest way would probably to save the blocks in something like a schematic and compare the blocks using that

robust flower
dusky harness
#

ยฏ_(ใƒ„)_/ยฏ

#

although you prob got that already

#

oh wait

#

oh block breaks

#

nvm

robust flower
lyric gyro
#

take a snapshot of the entire world

#

every tick

#

and compare it with the previous one

robust flower
dusky harness
#

wdym by "normal"?

#

leaves can decay

#

sponges can remove water

robust flower
#

anything that is not considered automatic or periodic effect, in other words, all block breaks that require some kind of interaction of players or other entities

dusky harness
#

torches can also break sand

#

not sure if thats considered player interaction

robust flower
dusky harness
#

ah right

dusky harness
#

would that work

robust flower
#

sorry, I should have said "solid" blocks

dusky harness
#

okay

robust flower
#

then... is there a list for those events?

dusky harness
#

by that it seems like you're saying if I use an item, so I guess

  • BlockBreakEvent
  • BlockExplodeEvent
  • EntityExplodeEvent
  • BlockBurnEvent
#

since this would also exclude grass etc which could be broken in other ways

#

so those are the only ones I can think of for full blocks, and left/right clicking from a player

past ibex
#

Piston push event

robust flower
dusky harness
#

also cannot break full blocks (afaik)

past ibex
#

BlockBreakBlockEvent in paper

#

Which is good for pistons and water destroying

#

BlockDestroyEvent which is also paper only

robust flower
dusky harness
#

ENDERMEN

#

I FORGOT

#

Endermen can pick up blocks

robust flower
dusky harness
#

Okay but you said no physics, only full blocks, only entity/player interaction so I think thats it

#

i dont think blockdestroyevent is required

#

unless theres something we missed

#

Oh one more

#

lol

#

@robust flower zombies breaking doors in hard mode

robust flower