#help-development

1 messages · Page 2014 of 1

silver shuttle
#
Bukkit.getOfflinePlayer(UUID.fromString(data.getString(ID + ".owner"))).getName()

Isn't this the proper way to get the name of an offline player?

quiet ice
#

Snow block is a full block

#

player names could get purged after a while

#

otherwise looks fine-ish

silver shuttle
#

so what do I use if they even never joined

sacred mountain
#

hey ive copied an embedded config.yml to my file and then set values, but all the enters (returns) and comments are gone?

quiet ice
#

?jd-s

undone axleBOT
eternal oxide
#

I think, if I remember correctly

silver shuttle
quiet ice
#

player profile afaik

eternal oxide
#

They won't have a name as its a local lookup

lean gull
#

do you use dashes or underscores in custom yml files?

silver shuttle
#

dashes

lean gull
#

kk ty

silver shuttle
#

are more common

#

but you can use any i reckon

quiet ice
#

Something like this

offlinePlayer.getPlayerProfile().update().get().getName();
#

Just note that this would block

simple anvil
#

Is there a way I can make a new effect?

#

Like "Peace"

#

Not a potion but a effect

dire salmon
#

define "effect"

quiet ice
#

potion effect or another effect?

simple anvil
#

Like harming effect

dire salmon
#

thats potion effect

simple anvil
#

Hero of the village effct

quiet ice
#

Particle effect?

#

Ah, yeah that is a potion effect

dire salmon
silver shuttle
#

you cannot make them directly like a custom potion effect, but you can implement it by overwriting something else or using the same effect and adding new attributes

dire salmon
#

^

simple anvil
#

Oh

quiet ice
#

Just note that clients will not see this effect

silver shuttle
#

yup

dire salmon
#

is there a way i can remove particles?

#

like make them disapear

simple anvil
#

Oh, so if I wanted to make a potion effect called "peace" the players would not see it?

simple anvil
silver shuttle
#

in the effect

quiet ice
#

depends on which particles

#

there are hundreds of particles that are created via hundreds of different ways

silver shuttle
#

boolean particles to true

dire salmon
#

no, i mean particles from spawnParticle, not from potion effect

simple anvil
#

Well then

quiet ice
#

Except if you use data packs and sacrifice an already existing potion effect (such as luck)

simple anvil
#

U can't get luck in game right? 1.18.2

dire salmon
#

i dont think someone uses luck
only in EliteMobs, there is a sword that gives luck

dire salmon
simple anvil
#

Ok good, I might do that

quiet ice
#

However the implementation of luck might not be NOP, so you would need to offset the effects

simple anvil
#

Ok

#

Just trying to make a effect called Peace

#

From a peace arrow

lean gull
#

how do i set comments in a custom config file

quiet ice
#

Custom as in?

lean gull
#

custom yml

#

with a custom name

quiet ice
#
# comment
# comment2
key: value
lean gull
#

how do i set it in code tho

quiet ice
#

Snakeyaml didn't support comments until recently so unless you are willing to use something like sponge's configurate you likely cannot via bukkit's API

dire salmon
quiet ice
#

That is a custom potion. not a custom potion effect

dire salmon
#

oh ye nvm

#

you can make custom effects
but i dont think you can show the player they have it

tardy delta
#

nom maths

dire salmon
#

wha

delicate fractal
#

how much ram will a server with max 100 players, just vanilla and some simple plugins for security chat and maybe buycraft take?
and the rest just pure vanilla stuff

tardy delta
#

max gigs is always 20

lean gull
delicate fractal
quiet ice
lean gull
#

wat dat mean

delicate fractal
#

that prob wont even get 100 members on it but just a 100 member cap

quiet ice
#

20 is more or less the upper limit

#

Going further than that is usually causing more harm than good

delicate fractal
dire salmon
#

but imagine it with 20 ram or idk

granite owl
#
while(this.isIndex++ < this.isContent.size())
{
  //...
}
```does this kind of incrementation cause out of bounds exceptions?
tardy delta
granite owl
#

isContent is an arraylist

#

index beginning at 0

#

originally

tardy delta
#

iirc it wont

#

after each loop it will increment and you check again

granite owl
#

but ive got this

quiet ice
granite owl
#
12.03 15:24:27 [Server] Server thread/WARN Caused by: java.lang.IndexOutOfBoundsException: Index 9 out of bounds for length 9
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
12.03 15:24:27 [Server] Server thread/WARN at java.base/java.util.Objects.checkIndex(Objects.java:359)
12.03 15:24:27 [Server] Server thread/WARN at java.base/java.util.ArrayList.get(ArrayList.java:427)
12.03 15:24:27 [Server] Server thread/WARN at utils.IniParser.getNextLine(IniParser.java:152)
12.03 15:24:27 [Server] Server thread/WARN at utils.IniParser.getNextLinePtr(IniParser.java:269)
quiet ice
#

like this it will not throw an exception

granite owl
#
protected boolean getNextLine()
    {
        if (this.isOpen)
        {
            while((this.isIndex++) < this.isContent.size())
            {
                if (this.isContent.get(this.isIndex).length() > 0)
                {
                    if (this.isContent.get(this.isIndex).charAt(0) != '[')
                    {
                        SplitString(this.isContent.get(this.isIndex));
                        return true;
                    }
                    
                    break;
                }
            }
        }
        
        return false;
    }
#

isOpen = boolean

#

isIndex = int

#

isContent = arraylist

#

SplitString worked before and hasnt been changed at all so id exclude that as possibility

quiet ice
#

Yeah, then it will throw an exception

granite owl
#

how

#

maybe im super blind

#

xD

quiet ice
#

You'd need to do ++this.isIndex

chrome beacon
#

Why not use a for loop here?

granite owl
#

ah

#

right

#

increment before

#

not after call

#

xD never used that before teye

#

because the old method was with a BufferedReader, and ive translated it 1:1 into an arraylist syntax

tardy delta
#

lmao continue exists for a reason

granite owl
#

well

#

done so above xD

#
    protected boolean jumpToHeader(String str)
    {
        if (this.isOpen)
        {
            for (this.isIndex = 0; this.isIndex < this.isContent.size(); this.isIndex++)
            {
                if (this.isContent.get(this.isIndex).equals('[' + str + ']'))
                {
                    return true;
                }
            }
        }
        
        return false;
    }
quiet ice
#

The bracket style is really confusing me

granite owl
#

that theye below?

#

c standard

quiet ice
#

C does not have a (as in THE) code style standard

granite owl
#

obv not but ive seem most use it

#

write it like this

tardy delta
#

if (!isOpen) return false lol

granite owl
quiet ice
#

why call this via reflection..

tardy delta
#

you just call it like a field so what?

granite owl
#

i store internally in a boolean if ive opened a file yes

quiet ice
#

I'd just throw an exception there tbh

granite owl
#

i dont have to update every individual plugin later on

#

if they use reflection

quiet ice
#

no

#

Javac does not inline methods

worldly ingot
quiet ice
#

The eclipse compiler might though

granite owl
#

alman style?

#

xD

ancient plank
#

java standards superiority

quiet ice
#

But doubt so, only JIT and AOT (such as graal) compilers should inline methods

granite owl
#

also geol before ive used native methods

lean gull
#

i wanna make a "bot" that when you say a command that starts with !, it says something. for example

input: "!say hi"
output: "[BOT] hi"

quiet ice
#

So if you were to change the method body it would not result in a change

granite owl
#

but my server provider blocks .so file binary code execution

#

so ive rewritten it in dll style for java

#

shrugs

#

and both the .dll and .so file worked under my local server

quiet ice
#

Using reflection is more or less a big no-no in java space when you can avoid it

granite owl
#

ive heared that alot

#

but i want to call my shared methods like from a dll

quiet ice
#

Technically no - you should NEVER use reflections

granite owl
#

and the only way i see to realise it this way

#

is reflection

quiet ice
#

Use method handles instead

granite owl
#

because its not encapsuled?

quiet ice
#

JNI is not reflection just to be clear

granite owl
#

iknow

#

JNI is calling binary code from libs

#

reflection is within java

#

but JNI didnt work because most server providers block binaries

#

for obv reasons

tardy delta
#

lol i didnt know spigot had a conversation api

granite owl
#

thats java native

ancient plank
#

it's old :)

granite owl
#

u have to export ur C functions using JDKs wrapper api

quiet ice
#

I don't really see why though ... most destructive things you can do with natives you can already do with java

granite owl
#

like ive said

#

years before ive programmed very sloppy

#

like every plugin had its own ini parsing implementation

#

so now ive wanted to standartize it

#

in 1 file

#

so that if i make changes to the methods i dont need to update all plugins

quiet ice
#

read the appropriate documentation?

granite owl
#

and ive already tried to call bukkit methods via reflection, does not work

#

because its in a different thread apparently

granite owl
#

and throws a nullptr exception xD

quiet ice
#

Never call bukkit methods off-thread unless it is explicitly specified that it is safe to do so

granite owl
#

well ive tried to test the limits of reflection only anyway

quiet ice
lean gull
#

look at the message i was replying to

ancient plank
#

that's not a question

quiet ice
#

But as I said, I recommend you to switch to method handles, they are much faster than reflection - even though as of J18 method handles are used by reflection

quiet ice
lean gull
#

the question is how do i make it..

ancient plank
#

How do you make plugins for spigot? Use an API for Discord i.e. JDA, Discord4j or, Javacord, learn the API, and make stuff. Simple and easy.

lean gull
#

how do i seperate the command prefix, the command and the things after it?

granite owl
#

@quiet ice ```java
public static Object IniParserPtr()
{
return new IniParser();
}

public static boolean openFilePtr(Object obj, String str, boolean b)
{
    return ((IniParser) obj).openFile(str, b);
}
ancient plank
#

its simple java

lean gull
#

i need something that can seperate it even if it's complex, like "bot please say "hello" and "hi" for me"

ancient plank
#

machine learning wesmart

quiet ice
#

String#substring, String#codepointAt, String#indexof and String#split should suffice here

granite owl
#

thats on the plugin side

#
public IniParser()
    {
        try
        {
            ptr = (Object) IniParserPtr.invoke(IniParserClassPtr);
        }
        catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
        {
            e.printStackTrace();
        }
    }
#

i mean

#

it works

lean gull
#

what's startindex and endindex

quiet ice
#

always rethrow an error

quiet ice
#

hm, discord doesn't like gifs at all

lean gull
#

ok can anybody but geol help?

#

i don't mind reading the docs but i do mind how he's asking it

quiet ice
#

At some point I get fed up, the amount of people that are unable, incompetent or simply unwilling to read the documentation is just stpid

red sedge
#

How can I call a sync method from an Async event

quiet ice
#

Scheduler

red sedge
#

hm?

lean gull
#

being inpatient in a help channel is just stupid

red sedge
#

i might need you to explain a lil more

ancient plank
simple anvil
#

Is there a way to change the command response?
Like reload, when I us that commodity, is there I way I can change the message it sends?

granite owl
#

btw one side question

quiet ice
#

A simple search on the spigot or oracle javadocs answers a third of the questions on here

granite owl
#

if i wanna run dedicated tasks like own fireball logic

red sedge
granite owl
#

is there a better solution than running it in a bukkitsheduler/multithreading it?

red sedge
#

sorry

simple anvil
#

Is there a way to do that?

patent horizon
#

do operators pass all player.hasPermission() checks?

quiet ice
#

I do not think so

ancient plank
#

they do not

tardy delta
#

^^

quiet ice
simple anvil
quiet ice
#

wally

fossil lily
#

What can I use to test for an item in an inventory that has a specific item meta?

simple anvil
#

Oh,im big dumb

quiet ice
#

But your answer would also be I do not think so

crimson terrace
fossil lily
#

How do I check for the itemmeta?

quiet ice
#

/bukkit:reload probably uses sender.sendMessage to send the message

fossil lily
#

With .contains

sterile token
#

Your welcome. Nice to hear that

simple anvil
#

/reload

crimson terrace
fossil lily
#

idk what that is

#

il google it

sterile token
quiet ice
fossil lily
#

hm okay

granite owl
#

also @quiet ice btw ty for the help it works as intended now

simple anvil
#

Idk, I just do /reload

granite owl
#

😛

#

although u wouldnt call it good

sterile token
simple anvil
#

And it says server reloaded

fossil lily
#

erm

#

idk

granite owl
#

also had to start the indexcount at -1 though for files that dont work with headers

fossil lily
#

i think list

young shell
#

How do you lock the Weather to clear in a specific World?

sterile token
granite owl
quiet ice
#

Unless a plugin defines it's own reload command, it'll default to bukkit's reload command (/bukkit:reload)

fossil lily
#

?paste

undone axleBOT
sterile token
#

Nice bot sometime doesnt work

granite owl
#

and its bukkit implementation

crimson terrace
#

it just checks the first part of the message

ancient plank
simple anvil
fossil lily
#

oh!

quiet ice
fossil lily
#
         Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
            public void run(){
                for (Player p : Bukkit.getOnlinePlayers()){

                }
            }
        }, 20l, 10l);
undone axleBOT
fossil lily
#

lol

quiet ice
#

As it will probably use sender.sendMessage

fossil lily
#

all i want to do is check every 10 ticks if a player has an item with an itemmeta

simple anvil
#

Thbaks for your help

quiet ice
#

You could use packets to intercept the messages, but that is about it

crimson terrace
fossil lily
#

Just have it anywhere in the inventory

ivory glacier
#

is there a way i can fix a lighting bug with lava in my custom generator it appears very dark i need to calculate light again or something?

crimson terrace
#

well, you have to loop through all players, then do the stream.anyMatch for the itemMetas of each item and then do whatever

fossil lily
#

aight

misty current
#

hey, small question about design, i have an island object that is meant to store the owner, location and some statistics

#

so i was wondering, should I have a separate object inside Island that holds the statistics?

red sedge
#

quick question, what is the max amount of chars display name can have

quaint mantle
#

good morning lol

crimson terrace
fossil lily
#

I might be doing this wrong, but List.stream isnt a thing

crimson terrace
fossil lily
#

hmm

#

holf on

crimson terrace
#

it exists

worldly ingot
#

List#stream() isn't, but Collection#stream() is

#

From which List inherits

quiet ice
#

ssh

fossil lily
#

ah I got it thanks

crimson terrace
fossil lily
crimson terrace
#

I may be able to help, not sure wether I got it right tho.

fossil lily
#

Aight

fossil lily
crimson terrace
#

code which I think might work, spoonfed tho if its correct

fossil lily
#

Il try that

ivory sleet
#

Objects::equals

#

but else ye probably

crimson terrace
ivory sleet
#

myeah

quaint mantle
#

Should i just use config.yml to store a players money, or should I use mySQL

#

cause mySQL looks a bit advanced for me ngl

ivory sleet
#

make a per player yml flatfile storage perhaps

quaint mantle
#

Also any tutorials on that

ivory sleet
#

yep

#

uh probably

#

google around a little bit

#

in case you dont find anything at all come back here and we can discuss it a little bit Ig

tardy delta
crimson terrace
#

I made the itemMeta null because fast

#

but a filter is easy to slap in

#

dont all items have itemMeta which isnt null?

eternal night
#

air is out there to get you

crimson terrace
#

I see

ivory sleet
#

if and only if ItemStack#getType#isAir then ItemStack#getItemMeta must be null

crimson terrace
#

gotcha, thanks 🙂

grim ice
#

Nope

#

will throw IllegalArgumentException: Plugin already initialized!

#

as your main class has only one instance, which is the one made by Bukkit

#

only pass the instance around with

#

?di

undone axleBOT
grim ice
#

or

#

make it a singleton

hollow bluff
#

How may I do so I can use fireworks without having to click them on the ground?

kindred valley
# grim ice Nope
    HashSet<UUID> deadPlayers = new HashSet<>();
    public HashSet<UUID> getDeadPlayers() {
        return deadPlayers;
    }
    public void setDeadPlayers(HashSet<UUID> deadPlayers) {
        this.deadPlayers = deadPlayers;
    }
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        if(deadPlayers.contains(p)) {
                p.setHealth(0.5F);
                p.setWalkSpeed(0);
            }
    }```
#

this is what i made last

grim ice
#

remove the getter and setter

#

also im not sure if you wanna have Death threats in your class name xD

red sedge
#

ofc you do

#

thats how you make a good plugin

#

right

grim ice
#

anyways you might wanna name your class something like JoinListener

red sedge
#

if someone dares to talk about your source code

#

they wont.

grim ice
#

not sure how is "Die" related to "PlayerJoinEvent"

#

or is that only a portion of the class?

tardy delta
#

dont call your class die

red sedge
#

im not sure if playerjoinevent should be in a class named die

tardy delta
#

or you will die

kindred valley
fossil lily
crimson terrace
tardy delta
#

make methods like addDeadPlayer and removeDeadPlayer, depending on what you want

crimson terrace
fossil lily
#

oh

fossil lily
#

nullpointerexception

grim ice
#

literally

tardy delta
grim ice
#

useless

tardy delta
#

idk what he s doing

grim ice
#

you're trying to abstract away the field from other classes that arent even using the field

#

lmao

kindred valley
grim ice
#

ok

#

yes

fossil lily
#

this is hard :C

crimson terrace
#

send what you currently have

red sedge
#

just needto make sure cuz eventpriority is confusing

#

if i check if the event is cancelled on a event priority that is LOWEST

#

and broadcast smth if it is not cancelled

#

and cancel the event on a priority of HIGHEST

#

the broadcast wont happen right

fossil lily
# crimson terrace send what you currently have
        Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
            public void run(){
                for (Player p : Bukkit.getOnlinePlayers()){
                    
                    if (Arrays.stream(p.getInventory().getContents()).map(ItemStack::getItemMeta).anyMatch(n -> n.equals("" + ChatColor.BLUE + ChatColor.BOLD + "Glowing Pendant"))) {
                        p.sendMessage("You have the item!");
                    }

                }
            }
        }, 20L, 10L);
#

Idk how to get rid of the null pointer exception

#

Nothing is working :C

crimson terrace
#

after the map() you have to put in a .filter(n -> n != null)

quaint mantle
#

How do I mix multiple ChatColor arguments together?
ChatColor.BOLD + ChatColor.GOLD doesnt work

crimson terrace
#

thats how you keep all but null objects

fossil lily
ancient plank
#

chatcolor + "" + chatcolor

crimson terrace
red sedge
#

but why would you ever use that

quaint mantle
#

ah ok

red sedge
#

when you can use colour codes with a colourize function

fossil lily
red sedge
#

they are warning you of the exception

fossil lily
crimson terrace
#

youre not checking if its an actual meta

#

you trying to check for lore?

fossil lily
#

No I want to get the display name

red sedge
#

why are you even checking for meta?

#

so

#

get the item meta

crimson terrace
#

make a static variable for the display name

red sedge
#

and check the display name

kindred valley
red sedge
#

also you probably shouldnt use display name for data storage is what im guessing

kindred valley
#

i fixed it thanks to you

crimson terrace
#

ye, anvils

#

use PDC

#

?PDC

#

?pdc

red sedge
crimson terrace
#

lore isnt safe either if people have plugins to make lore

red sedge
#

yeah

#

so

#

just

#

use

#

pdc

ancient plank
#

type in 1 message pls thx

fossil lily
#

String glowingpendant1 = glowingpendant.getItemMeta().getDisplayName();

red sedge
#

sorry

#

does it look ugly on /data command yes, but its far more practical

grim ice
#

data command alr ugly

#

xD

red sedge
#

i mean

#

yes but it is useful

worldly ingot
# red sedge the broadcast wont happen right

It will be called

@EventHandler(priority = EventPriority.LOWEST)
public void low(Cancellable event) {
    if (!event.isCancelled()) {
        Bukkit.broadcastMessage("Hello");
    }
}

@EventHandler(priority = EventPriority.HIGHEST)
public void high(Cancellable event) {
    event.setCancelled(true);
}```
#

"Hello" will be printed

#

Order is LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR

#

Because a higher priority event is called after a lower priority event, it can override the cancellation status of an event. It thus has a higher priority of cancellation

red sedge
#

it feels confusing

#

cuz priority feels like it the higher should be ran first but also highest having hte last say also makes sense

worldly ingot
#

Yeah, it's confusing at first but you get the hang of it

#

All you really need to remember is LOWEST = first, HIGHEST = last

red sedge
#

alr

hasty prawn
#

I hate when stuff is confusing but it actually makes perfect sense lol

grim ice
#

?paste

undone axleBOT
red sedge
#

it feels like it shouldnt be named priority but it also does

grim ice
#

this just

#

uh

#

aa sec lemme explain

red sedge
#

cant you just

#

check the moveTo's Y location

#

and compare it to the max/min

sacred mountain
#

hey im getting a value from like config like this:

config.getString("items.cooldown-toggle.self.on");

my config looks like this:

items:
  cooldown-toggle:
    self:
      on: "Test message"

It works for the rest of the values in my file but not for this section. Any ideas? i havent made a typo im sure of it.

there is no stacktrace before someone asks, just prints "null" in chat when i do player.sendMessage(config.getString(...)

grim ice
#

so basically, this a player move event, im checking if the player is moving, not just a pitch/yaw change, and then if the distance between him and the ground is higher than maxY, or if the distance between him and the ground is lower than minY, cancel the event and send him a message

https://paste.md-5.net/wogezazola.java

#

however

red sedge
#

if (moveTo#getY() > maxY) e#setCancelled(true)

grim ice
#

its so bugghy

#

o

red sedge
#

am i missing smth

grim ice
#

no, i am omfg

#

my brain

#

actually

#

u r

#

lol

red sedge
#

moveFrom.toVector().equals(moveTo.toVector())
idk

grim ice
#

that doesnt calculate teh distance between the player and t he ground

red sedge
#

okay

grim ice
#

maxY is e.g 2

#

and getY is e.g 64

red sedge
graceful turret
#

how to check if itemstack is slab?

sacred mountain
tardy delta
#

is the path correct, is the string there?

sacred mountain
#

theres another value in my code right next to it called "collisionmessage" and it works just fine

#

yeah there arent any typos

#

its been like this for a few days

sacred mountain
hasty prawn
#

It probably doesn't like the - is my guess

#

If you remove that does it work

tardy delta
#

it works with -'s with me

lapis lark
#

Any help with it?(

hasty prawn
sacred mountain
#

i will check

lapis lark
#

ProtocolLib have no discord

#

F

#

Ok, i can reask question

#

How I can show player that was destroyed by a packet?

#
((CraftPlayer) observer).getHandle().b.a(
                    new PacketPlayOutPlayerInfo(
                            PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,
                            ((CraftPlayer) watched).getHandle()
                    )
            );

            ((CraftPlayer) observer).getHandle().b.a(new PacketPlayOutNamedEntitySpawn(((CraftPlayer) watched).getHandle()));
```This shows player, but it lose overskin and equipment
sacred mountain
#

nevermind there is lots of keys containing hyphens

#
reload-msg: '&aConfig Reloaded!'
  reload-permission: vlu.reload
  game-msg-type: CHAT
  error-msg: '&4[ERROR] &cAn unexpected error has occurred. Please see the console!'
#

all those are using dashes

hasty prawn
#

Hm

#

Might just try separating the path up and see where it's failing to actually retrieve it

#

So do getConfigurationSection("items") for example

sacred mountain
#

ill troubleshoot it later as im just about to leave but thanks anyway

sterile token
#

5L is 5 seconds right?

hasty prawn
#

in what sense

sacred mountain
#

whats the best way to find the exact location

lapis lark
hasty prawn
#

5L just means a long with the value of 5

sterile token
sacred mountain
#

just sysout messages

hasty prawn
#

It's 5 ticks

sterile token
#

Hmn

#

So 20L should be 5 seconds?

hasty prawn
#

20L is 1 second

sterile token
#

Hee?

grim ice
sterile token
#

What the heck

hasty prawn
#

20 ticks in 1 second

grim ice
#

tahts what i do now

sterile token
#

Wait Schedule task timer from bukkit is in ticks?

#

Or what

hasty prawn
#

Yes

sterile token
#

And wait the arguments said: plugin, runnable, l?

#

Making ref to long?

#

Really aamzing

red sedge
grim ice
#

so uh even if the distance between me and the ground is over maxY, it doesnt send me anything except if i click w or s or d or a, however flying upwards stops me, but it does even if im under maxY

sacred mountain
#

i have a java timeunit to ticks converter that i never used

#

would have been useful

grim ice
#

the getDistance() is not mine, I got it from googling for a bit, (my old one was really the same, but i still used the one from google since i thought i mightve missed smth)

red sedge
#

also probably get the abs of that

sterile token
#

Bukkit.getScheduler().runTaskLater(plugin, runnable, 100L); // Will run after 5 seconds?

grim ice
#

ye

sterile token
#

Allrgiht

grim ice
grim ice
# red sedge check what distanceToGround does

private int getDistance(Location e) {
Location loc = e.clone();
int y = loc.getBlockY(), distance = 0;
for (int i = y; i >= 0; i--) {
loc.setY(i);
if (loc.getBlock().getType().isSolid()) break;
distance++;
}
return distance;
}

serene needle
#

How I can make the player exit a boat if he is in a boat

grim ice
#

teleport him to his location

#

mayb that would work

vocal cloud
grim ice
#

or that

serene needle
vocal cloud
ancient plank
sterile token
ancient plank
#

brains are useful tools

hasty prawn
#

How to utilize tool?

vocal cloud
red sedge
#

what is a tool?

sterile token
hasty prawn
#

tool.

sterile token
#

Come on people, you can serve the people food but dont give it cutted. In other worlds, you should help them but dont give all the solution. Sometime they have to learn how to use the documentation and do it byself

red sedge
#

okay so

#

when someone asks for help

#

just write ?jd

tardy delta
#

yes :)

grim ice
#

in other worlds

#

lol

sterile token
#

Im spanish lmaoo

tardy delta
#

in other words

sterile token
#

ahh ok

vocal cloud
#

90% of questions are either a lack of java knowledge or people too lazy to read the docs

#

Probably 95%

sterile token
#

I agree with Mike

tardy delta
#

people should have some basic knowledge of java before they start making a plugin

#

🙉

sterile token
#

It sounds rude, but sometime you get annoyed because you try do on your own reading and reading. And one without reading the docs ask something and they serve the complete thing

lean gull
#

does anyone know what i need to learn in order to be able to generate cool lookin trees with noise generation?

grim ice
#

make 1x10x1 trees B)

ancient plank
#

"Java would be a good place to start--" is what I would say, but y'know.

digital haven
#

Does anyone know why I'm getting this no brainer error lmao

hasty prawn
#

Click Open Project Settings and see what it wants you to change

digital haven
#

Everything is 17

devout canyon
#

It doesn't like 17, try 16 maybe?

#

I had a similar issue once

digital haven
#

Alr

carmine urchin
#

I have all of these methods which all involve the condition if the player is not in creative @EventHandler public void onDrop(PlayerDropItemEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onBreak(BlockBreakEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onPlace(BlockPlaceEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onDamage(EntityDamageByEntityEvent e) { if(e.getDamager() instanceof Player p) { if(p.getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } } Would there be a more efficient way to do this instead of repeating the condition over and over?

quiet ice
#

why do you have a release target of 17.0.2?

#

Only a release target of 17 is valid iirc

devout canyon
#

I think if it's before 1.17 it complains about that

digital haven
undone axleBOT
quiet ice
digital haven
devout canyon
#

Mc

digital haven
#

lmao wtf

quiet ice
lean gull
lean gull
#

im using the spigot tutorial for custom config

quiet ice
#

you can happily compile plugins with java 17 even for minecraft 1.8

devout canyon
#

Huh

quiet ice
#
                    <source>${java.version}</source>
                    <target>${java.version}</target>

This doesn't work...

carmine urchin
quiet ice
#

You need to give it concrete values

digital haven
#

I copied this pom from another project and it worked

quiet ice
#

i. e. 17 or 16

digital haven
#

interesting

quiet ice
#

Likely because you were running it with javac 17.0.0 and not javac 17.0.2

#

or you defined java.version in your properties block

digital haven
#

Yeah the latter sounds more likely

quiet ice
#

actually, you can remove these two lines as you already define source/target in your properties block

#

The whole compiler plugin block can technically be removed if you expand on that logic

digital haven
#

I see, thanks for the help!

vivid cave
#

what packet can I send to "fake" update the player's skin?
(even tho it may technically update it, the clients to whom i'm sending will show the updated one)

quaint mantle
#

Whats the point in that?

vivid cave
#

animating their skin

#

gif skin support

#

call me crazy but i'm doing that

vocal cloud
#

Doesn't the skin need to be downloaded from mojangs servers? I imagine trying to make a gif of a skin will have unintended consequences

quaint mantle
vivid cave
#

no this is possible

quaint mantle
#

But other than that, it cause lag and performance issues trying to.

vivid cave
#

You can physically update someone's skin

vivid cave
#

including animated gif (maps), animated armor with gradiant

#

etc

quiet ice
#

yeah, updating a player's skin should be possible

quaint mantle
#

I have 0 words, go ahead but me personally, idk IF thats possible

#

but it might so xd

quiet ice
#

Outside of perhaps editing the PlayerProfile of the player I have no idea on how to do it however

quaint mantle
#

^^^

lean gull
vivid cave
#

yeah i thought so too

vivid cave
#

but i'll give it a test

quaint mantle
vivid cave
#

thx guys

quaint mantle
#

Needs to be a valid YML file.

red sedge
#

pov: when you know you're writing bad code but you just want it to work so you continue as you near 1.000 lines in a gui class

lean gull
#

isn't it supposed to create it

quiet ice
#

Nah, it is just not present

quiet ice
quaint mantle
quiet ice
#

If it isn't this expection is thrown

quaint mantle
#

I made that mistake 2 days ago.

#

Watched a 2 hour tutorial on java and now im good w/ it

quiet ice
#

The YML validity has nothing to do with it however

lean gull
#

do i make a yml file in the place where the plugin.yml file is stored? i don't get it

quaint mantle
#

one thing im good at is error tracking

quiet ice
#

Do you even know what you want to do

quaint mantle
#

@lean gull What are you trying to do exactly?

quiet ice
quaint mantle
#

By that error, your attempting to get a file that never existed.

quiet ice
#

No, they are copying a file that does not exist

quaint mantle
#

Oh that means copying?

#

Wait... why are you copying a file?

quiet ice
#

Or better yet, they are reading a file that does not exist

lean gull
#

i am?

quaint mantle
undone axleBOT
quiet ice
#

JavaPlugin.saveResource

quaint mantle
#

You clearly dont have java experience, learn it first.

quiet ice
#

?stash

undone axleBOT
ancient plank
#

incoming

lean gull
#

ngl i just copy pasted the code from the tutorial cause i've already spent like 2 hours on making custom yml files before

quaint mantle
#

Read the links I sent above.

lean gull
#

no

#

:)

quaint mantle
#

Dont make a plugin if you dont have java experience.

quaint mantle
#

Cause otherwise, you wont understand anything.

#

Also, I HATE copy n pasters, Just saying :/

quiet ice
#

I love copy & paste

lean gull
#

read my about me, you'll learn a thing or two

quaint mantle
#

Well I meant more like

#

People who watch a tutorial

#

and copy the EXACT code

tardy delta
#

car go vrom

quaint mantle
lean gull
tardy delta
#

lmao

quaint mantle
#

Im simply letting you know, do not try to make a plugin without java experience.

ancient plank
#

they block anyone who tells them to learn java

quaint mantle
#

Thats nice.

lean gull
quiet ice
tardy delta
#

ofc you wont

quaint mantle
#

Yes you would.

lean gull
#

i tried ._.

quaint mantle
#

It sometimes takes longer to click however.

tardy delta
#

nobody will be able to learn java with a ten hours tutorial

quaint mantle
#

So keep trying til it clicks in your head.

ancient plank
#

do your homework

quiet ice
#

I am on team "tutorials are useless"

quaint mantle
#

xd

quiet ice
#

Once you get the ball rolling that is

tardy delta
#

i mean yo are noob

tender shard
#

I wish someone would write a tool to compile normal java code to reflection-only code

#

so that one can use it without needing any imports

rich inlet
#

Hi, how do I get the key of the last entry of a configuration section? :)

quiet ice
#

At that point stackoverflow, spigot and javadocs are far better for anyone

lean gull
#

anyways can someone help me with my error

quaint mantle
quiet ice
quiet ice
quaint mantle
tender shard
quaint mantle
#

@quiet ice hes talking about the error from earlier

quiet ice
#

I know

quaint mantle
#

?learnjava PLEASE

undone axleBOT
grim ice
#

you copy and pasted too

tardy delta
#

if they dont click on it that wont help

rich inlet
quaint mantle
grim ice
#

at least once, you've copy and pasted

quaint mantle
#

I like spicing things up

quaint mantle
lean gull
quaint mantle
#

also @tender shard I see why you got annoyed with me about my questions

grim ice
#

btw as u know roblox lua is it worth learning

quaint mantle
#

lma\

quaint mantle
#

I regret it.

#

SO MUCH.

lean gull
#

jdherobrine, this time, don't bother helping

fossil mural
#

what does getHandle do?

tardy delta
#

configuration sections are basically maps internal and maps are unordered so im not sure how to get the last one, probably manually navigating then

vale ember
#

how to delete all the drop from EntityDeathEvent?

quaint mantle
#

You only ever send code, and say "help"

lean gull
#

i sent the code, i sent the error

grim ice
quiet ice
lean gull
#

now please, leave me alone

vale ember
lean gull
#

can someone nicer help please?

quaint mantle
#

@lean gull Your file location is invalid.

tardy delta
#

hehe my bird is helping me coding sitting on my schoulder

tender shard
quaint mantle
#

File locations usually start at me.

grim ice
tardy delta
lean gull
#

jdherobrine that tells me nothing

quiet ice
quaint mantle
quaint mantle
hybrid spoke
lean gull
tardy delta
#

please when will you learn what constructors are and use dependency injection?

lean gull
#

isn't that the line that makes it?

quiet ice
#

And then move line 53 to line 45

quaint mantle
quiet ice
#

move 54 to 57 to a newly created else block

quaint mantle
#
  • its looking for a file w/out a path
tardy delta
#

that code isnt saving anything to the file lol

#

just saying

quaint mantle
#

why lol

quiet ice
#

And for saving use customConfig.save()

grim ice
#

jk, but at least give a hint kek

hybrid spoke
quaint mantle
#

If its finding a datafolder to store it in, wouldnt you have to input the path to the datafolder?

quiet ice
#

So basically you'd have something like

        customConfigFile = new File(getDataFolder(), "gun-stats.yml");
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            customConfig = new YamlConfiguration();
            customConfig.set("slazor.maxLength", 15);
            customConfig.set("slazor.damage", 4);
            customConfig.set("slazor.reloadSpeed", 30);
            customConfig.set("slazor.chargePerUse", 5);
        } else {

        try {
            customConfig.load(customConfigFile);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
        }
        }
hybrid spoke
quiet ice
#

They still need to save the config file

#

How that is done is up to them

#

But at that point I'd redirect them to ?jd-s

grim ice
lean gull
#

it doesn't make the file

quiet ice
#

You need to save it

lean gull
#

where

#

at the end of the .set?

quiet ice
#

?jd-s

undone axleBOT
terse lily
#

did someone try first experimental snapshot of 1.19? I updated spigot to 1.19_deep_dark_experimental_snapshot-1, everything works as it should, except when warden spawns, it changes its poses twice. I can't test if it's vanilla or spigot bug as I can't start mc because of some weird java issue. does anyone know if it's vanilla bug or maybe someone can test it on vanilla?

quiet ice
quiet ice
terse lily
quaint mantle
terse lily
quaint mantle
lean gull
#

geol you spoonfed me with no explination, then when i ask something that obviously i won't know you do that

quaint mantle
#

Well thats why its cause your trying to make compatability for a snapshop

quiet ice
quaint mantle
#

Snapshots are buggy lol

grim ice
undone axleBOT
quiet ice
#

Just entering save in the search bar of the javadocs suffices to find the correct method for it

lean gull
#

brb

quaint mantle
#

for the last time please

grim ice
#

its rare to see someone holding hands in coding communities

quiet ice
quaint mantle
#

im a bit annoyed now tho

vale ember
#

any idea why the f*ck zombie don't implement Ageable interface?

quiet ice
#

it is just useless spam and does the exact opposite of what it should do

#

The command should be removed

sacred mountain
#

mm yes line numbers

grim ice
#

only people that did it for me were ElgarL and frostalf and SolarRabbit

quaint mantle
vale ember
quiet ice
#

I avoid the command for a reason, instead spamming ?jd-s and ?stash

grim ice
hybrid spoke
vale ember
#

well maybe in 1.18 but in 1.13 it don't seem to

quiet ice
#

Because in bukkit world, both commands are much more valuable than all the linked tutorials combined

grim ice
#

well holding hands isnt ur job but its nice to do

quaint mantle
#

i want to make parrot breeding plugin

#

:troll:

sacred mountain
#

ok

#

use cookies to breed parrots btw

ancient plank
#

gdi

#

I was gonna type that

sacred mountain
#

lmaooo

quaint mantle
#

are you sure

sacred mountain
#

can you create a new instance of a method in a class?

quiet ice
# grim ice Helping him would

fine.
It's

        customConfigFile = new File(getDataFolder(), "gun-stats.yml");
        customConfig = new YamlConfiguration();
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            customConfig.set("slazor.maxLength", 15);
            customConfig.set("slazor.damage", 4);
            customConfig.set("slazor.reloadSpeed", 30);
            customConfig.set("slazor.chargePerUse", 5);
            try {
                customConfig.save(customConfigFile);
             } catch (IOException | InvalidConfigurationException e) {
                e.printStackTrace();
             }
        } else {
           try {
                customConfig.load(customConfigFile);
            } catch (IOException | InvalidConfigurationException e) {
                e.printStackTrace();
            }
        }
sacred mountain
#

like new UserData::createUser(uuid)

hybrid spoke
sacred mountain
#

or will that crwate both the userdata class and the method

quaint mantle
terse lily
grim ice
#

he probably doesnt understand smth

manic crane
#

hello

quaint mantle
quaint mantle
manic crane
#

I have a problem

grim ice
#

Most if not all

quaint mantle
#

Whats your issue?

manic crane
#

with a plugin

quaint mantle
tardy delta
#

whats wrong with FileConfiguration c = YamlConfiguration.loadConfiguration(file)?

manic crane
#

ok

tender shard
manic crane
#

but it was a doubt for a plugin

quaint mantle
#

looks nicer

#

than false

manic crane
#

I want to do this but I don't know how to do it

grim ice
tender shard
tardy delta
#

invalidconfigurationexception just means youre noob

tender shard
#

my brain cant comprehend the huge amount of inforamtion you have about your problem

quaint mantle
#

my brain also fried reading that

tender shard
#

also stop dming me pls

quaint mantle
#

LOL

tardy delta
#

hwwelup hwelp.. cwan anywone hwelp mew?

grim ice
#

yes uwu

tardy delta
#

owo

quaint mantle
#

oh no...

manic crane
#

please

grim ice
#

Lol

#

if ur scared of being laughed at dw

quaint mantle
#

what your telling us is basically "help i have an issue"

sonic phoenix
#

Hello, i made some custom items in my plugin but they are usable in craft like for book and i don't want it, so i made that but it doesn't work

@EventHandler
    public void craftItem(PrepareItemCraftEvent event) {
        System.out.println("Testing craft item event");
        CraftingInventory inv = event.getInventory();
        for(ItemStack stack : inv.getStorageContents()) {
            if(CustomPaper.contains(stack)) {
                inv.setResult(null);
            }
        }
    }```
manic crane
#

I put the image

quaint mantle
#

without any info

sterile token
sonic phoenix
#

If you just can explain me why

sterile token
quaint mantle
#

am i an idiot or smth

sonic phoenix
#

don't have issue

#

"Testing craft item event" just see that

sterile token
#

Explain i listen

#

So i can improvee

#

Its possible to loop a list of custom object, compare a method value and them execute a void?

vocal cloud
#

Yes?

sterile token
#

I tried with ```java
list.stream().filter(object -> object.equals(bla)).map(object::remove);

#

But seems i cannot use the object var inside the map

tardy delta
sterile token
quaint mantle
#

I was about to ask a VERY stupid question.

#

But I caught myself.

tardy delta
#

lol parent doesnt seem the right name for that

quaint mantle
#

javadocs

sterile token
tardy delta
#

imagine catching yourself

spare marsh
#

Best way to check if block is a wooden gate without having to check for every material type that is a gate?

tardy delta
#

boolean loadFromJar or something

#

and have a fallback in case it isnt included in the jar

maiden briar
#

If I have a String with color codes and I want to split it in 16, 15/14 (depends on chatcolor) and 15/14 (depends on chatcolor), how can I copy over the colors to the next substring?

tardy delta
#

wait wha

sterile token
maiden briar
#

String1 = normal text
String2 = &a + test (& color from previous string)
String3 = &a + text (& color from previous string)

kindred valley
#

hey i have this and i want if player has enough money to dispatch command but i dont know how to. java public class HealMe implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { Player p = (Player)commandSender; if(p.getHealth() <= 0.5F) { if(command.getName().equalsIgnoreCase("healme")){ Bukkit.dispatchCommand(p, "givemoney hastane 2000"); Location hastane = new Location(p.getWorld(), 192, 4, 799); p.teleport(hastane); p.setHealth(20F); p.setWalkSpeed(0.2F); p.sendTitle("Iyilestin", "Durumun Iyi"); } } return true; } }

tardy delta
#

assuming the whole first string is colored?

waxen plinth
maiden briar
sterile token
#

I just want to check if object exists inside list and them remove it from the list

List<CustomObject> list = new ArrayList<>();
list.stream().filter(object -> object.getName().equals(name)).map(list::remove); // Pretty lovely told me that the map part its ignored
maiden briar
#

list.removeIf

waxen plinth
#

bruh

sterile token
spare marsh
tardy delta
maiden briar
#

Yes sure

sterile token
maiden briar
#

But colors could also be somewhere in the middle

waxen plinth
maiden briar
#

ChatColor.getLastColor() works fine

sterile token
molten hearth
#

are there any limitations to Bungee plugins or do they have the same capability as Spigot plugins

celest lichen
#

Heyo 😄
Since I couldnt find much on the internet I might just ask here if anybody found a way to create a clickable URL in the kick screen of bungeecord/spigot?

Maybe Reflections or something?

TextComponent setClickEvent did not work sadly :/

celest lichen
molten hearth
#

hmmm alright

kind hatch
tender shard
#

when you tell people you're busy but all you're doing is doing useless stuff

molten hearth
#

because I need an event to be fired across all servers from a bukkit plugin so im not sure how to accomplish that if bungee is more limited

sterile token
celest lichen
celest lichen
sterile token
#

If not the data its never received or its queue until a player joins

molten hearth
#

uh oh

sterile token
#

That why for cross-server its mostly used Redis

#

Because with redis you dont depend from a player

molten hearth
#

isnt redis just a memory store how would it come useful here 🤔

sterile token
#

Redis is a message broker

young knoll
#

Pub sub

sterile token
#

PubSub allow you to publish data on a specifc channels and once the data its send you receive it on every server, listening on that channel

tardy delta
#
TextComponent[] components = new ComponentBuilder()
  .append("Message here")
  .event(new ClickEvent(ClickEvent.Action.OPEN_URL, "url"))
  .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("click on this")))
  .create();
  player.spigot().sendMessage(components);```
#

@celest lichen

tardy delta
#

its different

sterile token
celest lichen
kind hatch
#

@tardy delta @sterile token he’s asking for the message in the kick screen not when they are on the server. Which isn’t clickable.

tardy delta
#

wait wha in disconnect menu

celest lichen
# sterile token What are you trying to do?

I want an early GDPR acceptance question connected to a website where you click I accept.
But everything later like in chat would be annoying to code preventing UUIDs from being used yk?

tardy delta
#

oh kick screen

brave sparrow
#

I don’t think UUIDs are covered in GDPR lol

sterile token
#

Idk what its GDPR, someone?

ivory sleet
#

general data protection rule

young knoll
#

Do clickable components work in the kick screen

tardy delta
#

general data protection regulation

celest lichen
brave sparrow
#

EU data privacy law

tardy delta
#

piracy thing

#

i mean privacy

#

🐗

young knoll
#

Yar har fid- aww

celest lichen
grim ice
#

just saying

#

a few months ago this really helped me progress

tardy delta
young knoll
#

PR!

celest lichen
tardy delta
#

nms i assume?

young knoll
#

You’ll need to use NMS components for that

celest lichen
young knoll
#

Not bungee ones

tardy delta
#

dunno

sterile token
#

Im saving player object like this on mongo, how i would get each user object? Im a bit confused

{
  "mongo-uuid": {
    "uuid": "user-uuid",
    "name": "user-name"
  },
  "mongo-uuid": {
     "uuid": "user-uuid",
     "name": "user-name"
  }
}
celest lichen
young knoll
#

Use mojmap

kind hatch
#

There’s always the mojang mappings

celest lichen
young knoll
#

I’ll look into PRing components for that tho

#

Put it on the list of things to do when not lazy

ivory sleet
#

I mean by its key

sterile token
ivory sleet
#

I mean the json representation is just a json representation

sterile token
#

Document document = mongo#find("collection", Filters.eq("_id")); ?

#

That what you mean

ivory sleet
#

no, but like that json you sent up there does not really have any concretion of how to get certain data

#

on itself

sterile token
#

Hmn

#

I dont understand im dumb today