#development

1 messages · Page 144 of 1

spice river
#

ok

lyric gyro
#

[0,3)

spice river
#

thanks

merry knoll
#

in general first part is usually inclusive and second isnt

broken elbow
#

oh. I didn't realise that would reset commits. but makes sense. Will try

dusky harness
#

yes

icy shadow
#

careful

broken elbow
#

Thank you SirYwell.

lyric gyro
#

You're welcome

icy shadow
#

no problem

broken elbow
#

❤️

pastel umbra
#

Wheres the answer?

lyric gyro
#

You're kidding, right?

pastel umbra
#

Ping it

lyric gyro
#

The one answer you've been ignoring from like 4 different people already

sterile hinge
merry knoll
#

prefix - suffix or w.e. will be common in all groups

broken elbow
#

I Just had 2 commits pushed that I wanted to revert back. I've reset them locally then force pushed and it seems to have done exactly that

merry knoll
#

then store permissions of that group as a list

broken elbow
lyric gyro
#

@dense drift confirm?

dusky harness
#

🥲

icy shadow
#

@lyric gyro confirm?

merry knoll
lyric gyro
#

There is a technical reason why it's usually inclusive start / exclusive end for things like arrays/lists etc but I don't think it is justified for PRNGs lmao

icy shadow
#

starting from 0 isn't arbitrary, it makes sense in the context of arrays

sterile hinge
#

for rng it's probably more for sake of consistency

lyric gyro
#

Yea

broken elbow
#

yeah. I knew for 0s. I've seen some document explaining why it makes sense. But I've never seen why inclusive/exclusive is as it is

wheat carbon
#

it's obviously a philosophical thing

lyric gyro
#

shut up pig

wheat carbon
#

ok

lyric gyro
#

I liked the other one

broken elbow
#

pig. how is bungee support going?

wheat carbon
#

yes

broken elbow
#

I understand

wheat carbon
#

I get distracted ok

#

I've been researching all day

#

"researching"

#

I like calling mindless surfing of the internet research

broken elbow
#

sleeping and eating bacon I bet

broken elbow
broken elbow
#

I Might steal that

icy shadow
#

i hate lua

#

on the other hand

wheat carbon
#

lua is beautiful

icy shadow
#

julia my beloved

dusky harness
#

Piggy

#

can i spin the booster thing

#

multi

#

or can you

wheat carbon
#

=multi spin

pure crater
#

Php my love

icy shadow
#

fail

pure crater
#

😻

neat pierBOT
#
New XP Multiplier...
lyric gyro
#

RIP

icy shadow
#

not fail

lyric gyro
#

oh there you go

icy shadow
#

epic

lyric gyro
#

WOAH

dusky harness
#

thank you piggy

wheat carbon
#

idk why cube got rid of the normal commands

broken elbow
#

oh not fail

pure crater
#

Spam

wheat carbon
#

who even likes slash commands

#

slash commands mid

lyric gyro
#

they are okay

dusky harness
#

slash commands are cool

icy shadow
#

they feel extremely unfinished

broken elbow
#

okay-ish

dusky harness
#

I like them

lyric gyro
#

Can I get configuration help in here?

wheat carbon
#

actually no I remember his reasoning

merry knoll
#

discord is ceasing support for nonslash commands soon

#

is why

dusky harness
#

although the permissions part I don't like

broken elbow
dusky harness
#

but I'm getting used to it

icy shadow
#

way too long

broken elbow
wheat carbon
#

he wanted to add slash commands so barry could be eligible for verification

#

even though barry... exists solely in one server

lyric gyro
#

Can we argue about our favourite IDEs?

dusky harness
#

why does barry need verification for 1 server?

pure crater
#

Configuration help please?

dusky harness
#

wait what does verification do

#

🥲

wheat carbon
#

yeah dkim

icy shadow
pure crater
dusky harness
wheat carbon
#

idk

lyric gyro
#

Yeah

#

oh my god so many pings

shell moon
wheat carbon
#

he mentioned the normal command thing too but how is discord even going to enforce that

broken elbow
dusky harness
pure crater
#

Y’all how are you in this beautiful day!

merry knoll
broken elbow
#

and Barry is just in HelpChat

wheat carbon
#

what the fuck

merry knoll
dusky harness
icy shadow
#

fun fact discord slash command permissions are so bad that you cant give boosters permission in the client, you have to get an oauth token and do it through the api 🙃

shell moon
icy shadow
#

and you cant assign individual permissions for subcommands

wheat carbon
#

chatchat alonso

icy shadow
#

so dumb

broken elbow
merry knoll
broken elbow
#

how?

shell moon
pure crater
#

Help my discord account got disabled

wheat carbon
#

we do not support privacy at helpchat

broken elbow
#

how can they claim privacy?

wheat carbon
#

we are literally the google of discord servers

icy shadow
#

to be fair

dusky harness
#

I love how the chat just became like 10x more active after the multiplier 🥲

pure crater
#

My friend got hacked help!!!

icy shadow
#

there are reports of bots harvesting messages for advertising and stuff

wheat carbon
#

everything you guys say is stored, and correlated

dusky harness
#

wait a minute

broken elbow
dusky harness
#

oh wait nevermind

lyric gyro
#

Anyway so yeah as I was saying yesterday I was in a voice chat with some random people and there was this one dude that did not take a shower because he needed to take his dog for a walk and he was exhausted as fuck but he did it anyway, so then he joined the voice chat and started livestreaming walking his dog and oh my god it was so cute, then he got tired, went back home and took a shower. No he did not stream that part

icy shadow
#

carl and a few others apparently spy on your activity status

lyric gyro
#

MEE6 does datamining

merry knoll
#

dont think they can pull activity anymore

shell moon
lyric gyro
#

Oh yeah and he also had the strongest Australian accent I've ever heard

#

It was hilarious

icy shadow
#

was it piggy

pure crater
#

Bloody hell

lyric gyro
#

No

wheat carbon
#

quite possible

dusky harness
#

Cube

wheat carbon
#

how do you know?

icy shadow
#

they are the only 2 australian people on the internet

lyric gyro
#

It was not a pig, it was a human

broken elbow
icy shadow
#

it mustve been one of them

wheat carbon
#

did you record

dusky harness
#

if it's not piggypiglet

#

it has to be funnycube

lyric gyro
#

It was actually really funny

wheat carbon
#

if there's any evidence, and it's from my city, I'll be able to tell you roughly where

#

we can track this guy down

#

is that what we want?

dusky harness
#

could it have been a shape acting like a human?

lyric gyro
dusky harness
#

lol

#

we are developing knowledge

#

(and xp)

lyric gyro
#

yeah of course

wheat carbon
#

emily I don a human disguise in public

lyric gyro
#

don

icy shadow
#

don cheadle

wheat carbon
#

it was the most suitable word

#

and you know it

lyric gyro
#

lmao

icy shadow
#

agony

pastel umbra
wheat carbon
#

yes

#

you should have it cached in memory

icy shadow
#

you should always be caching db queries

#

or you will literally die

lyric gyro
#

But yeah I mean at the end of the day many people end up not using umbrellas, they are kind of overrated, getting a bit wet is not that much big of a deal really, and if you're soaking wet you've got bigger problems to worry about

wheat carbon
#

permissions aren't that big, it's fine to store every permission in memory

#

you can have the entire db in memory

#

perfectly fine

lyric gyro
#

Ayo 94%

broken elbow
icy shadow
#

who?

wheat carbon
#

yeah who's cube

dusky harness
merry knoll
dusky harness
#

well Blitz

broken elbow
lyric gyro
# dusky harness who is john barilaro

Giovanni Domenic "John" Barilaro (born 14 November 1971[2]) is a former Australian politician who served as the 18th Deputy Premier of New South Wales and the New South Wales Leader of the Nationals until 6 October 2021. He was the Minister for Regional New South Wales, Industry and Trade in the second Berejiklian ministry from April 2019,[3][4][5] and a member of the New South Wales Legislative Assembly representing the electoral district of Monaro since 2011 until his resignation in October 2021

lyric gyro
#

Not a problem

dusky harness
#

did you type that yourself using your knowledge or did you steal it off of the internet

lyric gyro
#

I did

#

yes

dusky harness
#

wow

#

very impressive

lyric gyro
#

Usually I type below 100wpm but when someone needs information that quick I can just type that

broken elbow
ebon whale
#

a or b?
yes

lyric gyro
#

yeah

broken elbow
#

best option ever

ebon whale
neat pierBOT
#
✳️ Global Multiplier Expired!

The global multiplier has ran out and has been reset!

pastel umbra
#

what's the best way of caching the db? hashmap?

broken elbow
odd prawn
#

Objects whyyy

pastel umbra
#

hmm ok

pastel umbra
odd prawn
#

Make an object like a DataPlayer and save the data inside it

pastel umbra
pure crater
pastel umbra
pure crater
#

If you are a beginner, learn Java oop first

merry knoll
pastel umbra
#

I was simply asking whats better.....

torpid raft
#

define better

pure crater
sterile hinge
#

Yeah that makes zero sense, and even less in the given context

pastel umbra
#

so...

#

idk what your point is

pure crater
#

Class is an Object

#

Object is what all things in Java fall under

#

Learn the hierarchy and OOP please

grand spruce
stuck canopy
#

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Player sender1 = (Player) sender;

        if (command.getName().equalsIgnoreCase("spawner")) {
            if (args.length < 2) {
                sender1.sendMessage(ChatColor.RED + "/Spawner <mob> <player>");

                if (args[0].equalsIgnoreCase("cave_spider") && sender1.hasPermission("spawnersplugin.command")) {
                    Player player = Bukkit.getPlayerExact(args[1]);
                    player.getInventory().addItem(CaveSpiderSpawner);
                }```
#

why does this not work

cinder forum
stuck canopy
#

It doesnt give player the ItemStack

fiery pollen
#

First, check if your player object is not null

#

Also your object CaveSpiderSpawner, where are you getting it?

stuck canopy
#

its a itemStack

#

getting it in the player's inventory

pure crater
#

But where are you getting it from?

stuck canopy
#

from another class

#

the ItemStack works tho

#

I tried it without the args[1]

formal crane
#

So i need some advise on sql storage, i have a plugin where you can have a vault where you can store items and you have x amount of pages, currently i save every page as base64 (all the items) in yml's but i want to have this with sql.

So the problem is the table, i don't want to have a column for every page because there will be vaults with like 150 pages and some with 4

#

(its also saved so that slots will always be at the exact spot as before)

dusty frost
#

have a table called "page" and have each row be a page? then you can collect them by user or whatever

#

that's a kind of weird setup, though I think that's what i would do

icy shadow
#

if pages are non-empty then i wouldnt even bother, just store 1 item per row and then convert the list to pages

#

like if you cant have empty slots

formal crane
#

like this?

#

i think i am either gonna do page1base64;page2base64 or go with the 2 tables plan

dusty frost
#

might be kinda weird with access if you put them all into one column though

#

I would at least recommend a separate column per

icy shadow
#

1 column, multiple rows

#

that is how you're supposed to do it

#

table entries should be atomic

dusty frost
#

well having an item per row

#

feels like it would be a massive pain

icy shadow
#

why?

#

you just do 1 query and splice them all together

dusty frost
#

thousands of rows per person?

icy shadow
#

if necessary yeah

dusty frost
#

goddamn

#

SQL big weird

icy shadow
#

they can handle billions of rows with ease

dusty frost
#

yeah just feels a little scary

#

and a bit of a waste if each row is literally just a base64 item and an id lol

icy shadow
#

¯_(ツ)_/¯

#

what's being wasted?

formal crane
#

i save every page as base64

dusty frost
#

honestly noSQL moment

icy shadow
#

that's how you're supposed to design sql databases

dusty frost
#

yeah but this isn't really a relational scenario

#

would literally be better to just use a Mongo record per person lol

icy shadow
#

potentially

somber gale
#

Is there an easy way with HTML and JS to list any folder that contains a index.html file?

I would like to have something like for my deploy-preview repository, so that if people get on the main page, they won't have a 404.
Here's the repository for further info (Readme explains the folder structure on the gh-pages branch): https://github.com/gh-pages-deploy/Deploy-Previews

I btw only want the very first index file found in a folder, meaning with a structure like

Andre601/
 |
 |- blog/
     |
     |- 79/
         |
         |- index.html
         |- posts/
             |
             |- index.html

I only want the index file from 79 listed

dusty frost
#

Sounds like an xy problem with your web server?

somber gale
#

...

dusty frost
#

I mean you can just traverse the file hierarchy

#

But it sounds like you want to route 404s to an index, which you would either do in your web server or in whatever backend software you're using

somber gale
#

Have you bothered checking the repository?

#

or like read my message?

#

I did mention gh-pages didn't I?

dusty frost
#

Yeah I did read your message and I looked at the repository. Not exactly sure what the context is.

#

Is this solely hosted through github pages?

somber gale
#

I would've mentioned it if it was anything else

icy shadow
#

client side JS cannot read server side files

dusty frost
#

^

icy shadow
#

it is simply not possible

dusty frost
#

Hence my assumption of a backend server serving files

icy shadow
#

as far as the browser is concerned there is no directory structure, just urls

leaden sinew
formal crane
#

if i want to save a base64 in sql, should i just use the variable TEXT in sql?

winged pebble
#

VARCHAR is usually what I see

formal crane
#

doesnt varchar require me to give a length of chars?

shell moon
#

is it possible to get an entity in the server by uuid, if chunks are not loaded?

dusty frost
#

in some, TEXT is just an alias of VARCHAR(65535)

winged pebble
shell moon
#

i was expecting a "yes" xdd

#

so basically, if i save entity uuid in file/database

#

the only way to know if the entity is still available

#

is that somehow the chunk gets loaded by player or something

#

well kinda weird the question, but anyways

winged pebble
#

Well if it is in a file/database, you could do it

#

Because you'd just check that database instead of the world

shell moon
#

i mean, to delete the entity entry (stored data). ik weird question/issue xdd

formal crane
sterile hinge
#

Why do you think the database shuts down before you can save the data?

#

You‘re the one controlling that part

#

And the exception rather looks like there are multiple connections to the same file

formal crane
formal crane
#

So it turns out the problem is that i have multiple plugins using hikari

sterile hinge
#

That’s why you should relocate dependencies

edgy lintel
#

make like a working index.html in root dir with js redirection which directs to your custom index.html

#

or as an alternative you can register a custom domain with something like andre.com which is top level and redirects to your fake index.html and it will look like its on root

formal crane
stuck canopy
#

how do I make a ArrayList not reset when I restart the server

sterile hinge
#

you don't

#

if you need to persist data on disk, you should do so

stuck canopy
#

or either I can store the data in a file?

proud pebble
#

yes you store the data to file

stuck canopy
#

k so I managed to store the arraylist in the config file when the plugin disables

#

but how do I add the stored data from config back to the ArrayList when the plugin enables

#

spawners.addAll(config.get("spawners-location")); im trying this but it isnt working

#

"spawners" is the ArrayList

#

and its stored like this in the config

#
- Location{world=CraftWorld{name=world},x=130.0,y=54.0,z=14.0,pitch=0.0,yaw=0.0}
- Location{world=CraftWorld{name=world},x=124.0,y=55.0,z=12.0,pitch=0.0,yaw=0.0}
topaz gust
#

However I will warn you storing large amounts of data in a .yml is going to end badly. A better approach would be json or a proper database

formal crane
brittle thunder
#

Instead, use batched updates or just use the same connection normally

formal crane
merry knoll
#

thats also what hikari does for you, it keeps a pool of connections and distributes them as needed

#

instead of constantly opening and closing

keen orbit
#

Your Spigot account has been linked successfully!"....where i can ask help for "VoteParty"?

hoary scarab
#

If you don't put public or private does it automatically assume the instance is private?

sterile hinge
#

No, in most cases it means package private

hoary scarab
sterile hinge
#

package private isn’t private

hoary scarab
#

Ah I see. Thanks.

brittle thunder
#

Access in same package + sub classes

hoary scarab
#

Yeah was thinking something else when I read "package"

errant pilot
#

anyone know how i could make boats move faster? setMaxSpeed is deprecated and doesnt reference another method to use instead of it
I could multiply their velocity when they move but then theyd still be moving forward even if a player stops moving the boat

errant pilot
#

Also the Boat.Type class is giving me ClassNotFoundException and NoClassDefFoundError

stuck canopy
#

so

#

what I did is

#

for onDisable method I saved the arraylist to the config.yml

#

and onEnable method I added all the locations in config.yml back to arraylist and deleted the config file and regenerated it

#

and It works for me

stuck canopy
odd prawn
hoary scarab
spiral prairie
#

just save everytime something changed or smh

hoary scarab
#

Its like if you have the console open and you close the window. Nothing gets saved. (World, player data, etc...)

stuck canopy
#

then how can I fix it

hoary scarab
# stuck canopy then how can I fix it

Really not something you can fix. Because you can never tell when someone kills a server or the server crashes.

Your best bet is to leave the data saved or save at intervals. (Could be timed or when something is changed like Skyslycer said)

spiral prairie
#

yes

stuck canopy
#

aight let me try

dense galleon
#

This isn't Spigot or Paper related, but it's kind of a general Java question though it treats Forge classes

#

Is there any way for me to avoid repetition in this case:
Entities added by my mod should all override hurt() and take 1/3 of the damage they normally would.
The way I would do this, is having a parent class EarthboundEntity extending Entity, have it override hurt() and write the logic for that there, to finally have whatever Entities I add extend EarthboundEntity and have that logic automatically applied to them.
The problem though is that my entities aren't always going to just be Entity. They might need to extend other classes such as Animal or Monster. In those cases, I have to pick between my entity either extending EarthboundEntity to avoid repetition of the code written in there, or have it extend Animal/Monster to avoid repeating the code that is in there.

What's a solution for this weird issue?

sterile hinge
#

decorator pattern would be the an approach, not sure how well it would work with minecraft and your specific situation

lyric gyro
#

ur a decorator pattern

winged pebble
#

Does Forge not have attributes?

dense galleon
#

I don't know, been using Fabric for all this time just jumped onto forge

stuck canopy
#

    FileConfiguration config = plugin.getConfig();

    @EventHandler
    public void onPlace(BlockPlaceEvent e) {

        Location location = e.getBlock().getLocation();
        ItemStack itemInHand = e.getItemInHand();
        if (itemInHand.isSimilar(CaveSpiderSpawner)) {
            config.getStringList("spawners-location").add("" + location);
            plugin.saveConfig();```
#

why does this not add the location to config

#

it resets the config removing everything in it

#

I tried using a simple text instead of location and it didnt work either

dense drift
#

Because you have to get the list, add the location, and then set the list back

stuck canopy
#

ohh so I cant add like that

#

Then ig Ill have to use a array list

formal crane
merry knoll
#

many data with different methods?

#

why not just batch it

formal crane
#

what is that

merry knoll
#

what are you trying to do exactly?

#

update the same table / database with multiple input?

formal crane
#

i have many objects (every vault has its own object) i put them all in one hashmap and onDisable i loop through the hashmap and save each object in the database

merry knoll
#

okay so since its a loop anyway, why do you need to close the connection

#

open connection
loop and put in database
close connection

#

or if the connection is being used often

#

then keep the connection open and use the reference to it

#

and close it on disable

errant pilot
#

How do i listen for the packet when a boat's left/right paddle is moving? im using protocollib
Im trying to figure out if a player is paddling a boat forward so i can apply a speedboost then but i cant figure the packet stuff out

proud pebble
#

cpulsbt you just get the boats velocity or whatever its called and work from there?

#

isnt the movement of the paddles clientside only?

errant pilot
#

yeah i can get the velocity, then speed it up but it would still speed up even when player isnt paddling it because the boat slides forward after you stop paddling

#

i tried storing the last velocity of the boat and checking to see if it slowed down, but because of the speed boost it always showed it was going faster or same speed
I tried doing math to subtract the speed boost value but couldnt figure it out

#
        Vector vec = e.getTo().toVector().subtract(e.getFrom().toVector());

        double speed = vec.length();
        Location loc = boat.getLocation();
        loc.setPitch(0);

        double speedBoost = fboat.getMaxSpeed()/20;
        Vector boostVector = loc.getDirection().multiply(speedBoost);


        if(speed < fboat.getMaxSpeed() && ((!fboat.boosted && speed>fboat.lastSpeed) || (fboat.boosted && speed>fboat.lastSpeed+speedBoost))){
            vec.add(boostVector);
            fboat.boosted = true;
        }else{
            fboat.boosted = false;
        }

        fboat.lastSpeed = speed;

        boat.setVelocity(vec);
#

this is what i was using before

#

but even if the player was holding S to slow down it still didnt think it was decelerating

proud pebble
#

i guess listen to VEHICLE_STEER and print the output to console and read what occurs when and go from there

neat sundial
#

Can someone help me?

#

I have a error

lyric gyro
neat sundial
#

Ok im there

clear aspen
#

hello

#

im looking for some1 familiar with tebex development

dense drift
#

Ask away @clear aspen

clear aspen
dense drift
#

Ah you mean theme development

clear aspen
wise steeple
#

Im redoing a plugin i madea while back basically from scratch
I need to generate a spawner with certain parameters as PDC values
Should i make a static class that has methods to generate that?

#

Also i have a bunch of namespaced keys. I have no idea what to name the class or package to put them in

high edge
#

Would probably be some type of a data package, and then depending on what kind of data would be your class, also yea static methods are probably fine for this

wise steeple
#

Thank you

wise steeple
high edge
#

You are yes

wise steeple
#

lmao

#

Also i couldve sworn there was a way to make namespacedkeys static?

#

And to store them in their own class

#

No?

high edge
#

Well you need to pass in a plugin reference, so you could possibly use the init block

worn jasper
#

Quick question, is PDC run Async? Cause sometimes I set pdc of a player on quit event and it doesn’t save at all, so maybe when I am setting it it’s already too late?

sterile hinge
#

the player already left the server, the server already saved the player's data. Changing something in the PDC afterwards won't have any effect

wise steeple
#

Step 1: Realize you can cancel events
Step 2: Find PlayerQuitEvent
Step 3: troll

warm steppe
#

I'm pretty sure you can't cancel it

stuck canopy
#

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Player sender1 = (Player) sender;

        if (command.getName().equalsIgnoreCase("spawner")) {

             if (args[0].equalsIgnoreCase("cave_spider") && sender1.hasPermission("spawners.command")) {
                    Player player = Bukkit.getPlayer(args[1]);
                    player.getInventory().addItem(CaveSpiderSpawner);
                }```
#

why does this not work with console

dense drift
#

because you cast the sender to a player without any checks

stuck canopy
#

oh

stuck canopy
#

how do I get strings from a database file

hoary scarab
#

So I have always used```java
YamlConfiguration yml = ...;
File file = ...;

public void saveYaml(boolean reload) {
if(yml == null) return;

try {
    if(reload)
        yml.load(file);
    else
        yml.save(file);
    yml = YamlConfiguration.loadConfiguration(file);
} catch (IOException | InvalidConfigurationException e) {
    e.printStackTrace();
}

}
```To save my custom configs. My question is in later versions is yml = YamlConfiguration.loadConfiguration(file); still necessary? Or have they finally made it adjust the instance of yml when running load and save?

high edge
#

Never used that and it worked fine?

hoary scarab
#

Always had to adjust the instance when saving and (re)loading
Otherwise it never gave me the edits from the yaml.

dusky harness
#

well if you load it, then I think that you wouldn't have to load it again and create a new instance

#

and if you save it, then the file already matches what the instance is

hoary scarab
#

I'm gonna test it in a bit to make sure just writing up my new config system.
Figured I would ask though.

lyric gyro
#

pretty sure loadConfiguration is just shorthand for new + .load

shell moon
#

With discord.js it's still not possible to delete messages older than 2 weeks right? But bots can edit their own message even if its much older than 2 weeks right?

robust crow
#

Correct

shell moon
#

Sweet

hoary scarab
#

Sweet? What if people don't talk in your discord for 2 weeks at a time? Your bot can't remove messages you want cleared lol

shell moon
#

I mean the edit part

#

it sucks bots cant delete old messages xd

#

but it has always been like that

#

so people got used to it

hoary scarab
#

I use JDA currently

shell moon
#

¯_(ツ)_/¯

#

I only use that for plugins

#

no libraries allows you to remove messages older than 2 weeks yet right?

hoary scarab
shell moon
hoary scarab
merry knoll
#

its an api limitation not a library one though

shell moon
#

really?

#

nicee

timid garden
#

Hey, I need help! Nowa days my server just loses data out of nowhere
And the world gets deleted, anyone got any idea on why or how?

worn jasper
shell moon
#

no lol

worn jasper
#

How would I solve this issue then?

shell moon
#

priority LOWEST

shell moon
#

just wondering

worn jasper
worn jasper
#

Why wouldnt we?

shell moon
#

bc of the issue you got maybe

worn jasper
shell moon
#

i wouldnt save something in pdc for players tbh

#

indeed, its better to use an external db

high edge
#

What exactly are you storing is the question

worn jasper
#

A boolean basically

#

Lol

#

Also, would storing block data in a chunks pdc be an issue in any case?

high edge
#

Well what kind of Boolean, context bitte

worn jasper
#

The boolean is meant to say if said user has placed a special block called Locker

#

Its the only job it has, its to say if he has it placed or not

high edge
#

And does the locker have data?

worn jasper
#

The block itself, yes, its its own object

#

But its not linked to the PDC

#

Its stored differently

high edge
#

Well why don't you just add an owner to the block data?

#

Or you know, just set the pdc data when they place it down lol

worn jasper
#

Cause I use it outside that, I cant just loop all chunks and check if a block has certain data...

#

That would probably be a pain

#

Even more if the chunk isnt loaded

queen plank
#

I'm trying to simulate a different gravity for entities. I do this by having a loop that is called every tick and runs this code e.setVelocity(e.getVelocity().setY(-he.getGravity())); each iteration. e is the entity modified and he is a wrapper class storing the gravity modifier among other things. However, this line causes massive performance issues on my server. Everything works fine if I continue right before it, but when I include this line I get "server overloaded" in the console and the server drops to ~10 tps

#

Any idea why?

high edge
shell moon
#

he probs want a command like /mylocks

#

and his example is

#
  1. i want to save data in pdc
high edge
#

Then don't store the data in pdcs?

shell moon
#

but i cant bc of delay and i can't store in blocks

high edge
#

And use an actual database

shell moon
#

bc i wont be able to get all protections since they are in diff chunks

#

he should use a database or sth

#

and then load on start

#

i mean, no point on saving it in player either as it wont be loaded when someone attempts to break the sign

#

also you making a locker plugins? public? if so, ppl will prob start asking to lock doors too

#

and i dont remember very well, but you cannot use pdc there right?

#

might be wrong, never messed with doors lol

worn jasper
#

Uh no, not really. Different type of locker, but it’s fine,you are right, I shouldn’t use PDC for this

shell moon
nimble vale
#

is there a good tutorial for adventure chat api

#

i haven't been active since the adventure update on paper

#

so idk where to start

nimble vale
lyric gyro
#

what about the official docs?

nimble vale
#

well let me check again the docs

lyric gyro
#

no, like

#

I'm asking what about them? what was unhelpful

nimble vale
#

actually i remember that it is but its been a while

#

and i guess docs have changed a little bit

lyric gyro
#

hm yeah it was reworked, somewhat

nimble vale
#

so should i store components and replace variables if i need to

#

or just create every time

shell moon
#

creating a new Location and spawning an entity there, loads the chunk 100% of the times right?

nimble vale
shell moon
#

any clue how much time its unloaded after that?

sterile hinge
#

depends

merry knoll
nimble vale
#

isn't that standart the despawn time

shell moon
dusky harness
nimble vale
dusky harness
merry knoll
dusky harness
#

oh right, I forgot that existed

#

lol

merry knoll
#

for some reason i though they were spawning them for a person

dusky harness
merry knoll
#

rather than on the server itself

nimble vale
dusky harness
merry knoll
#

yes

lyric gyro
#

the cost isn't that high but usually I suggest you store messages as constants, like

class Messages {
  static Component NO_PERMISSION = Component.text("asd", NamedTextColor.RED);
  static Component BLOCK_PROTECTED = Component.text("fgh", TextDecoration.BOLD, TextColor.color(0x23c544));
}

etc

#

and then you'd just player.sendMessage(Messages.NO_PERMISSION)

#

or whichever other pattern you like tbh, that's what I tend to do

nimble vale
#

and so i can replace placeholders with that constant variables

merry knoll
#

if the message is different

#

just initialize a new one each time

#

use constants for actually constant variables

shell moon
#

afaik there was a replacement method or sth

nimble vale
merry knoll
#

initializing an object is not costly, no need to be scared of using it

#

you want to do init and cache with the case of connection etc

#

where it actually is costly

nimble vale
#

well actually i don't want to mess with lots of lines with components

lyric gyro
#

If it's not for config stuff, there is a Component#replaceText method that allows you to configure a text replacement based on a regex pattern

nimble vale
#

and sometimes i will be using same message in more than one places with just a little differences

merry knoll
#

little difference is a difference regardless

#

i honestly dont see a point reusing the same object in the case of the components

#

its just a data class

nimble vale
#

i mean a player name for example

#

wouldn't be better if i just replace it

#

and use a constant

merry knoll
#

really not much of a difference

lyric gyro
#

I'd rather have the components already built in a class like I did above and are actually named, than deal with the burden of writing the whole component over and over again - not for any performance reasons or anything, but a readability and usability perspective (and allowing the possibility of maybe, possibly, having two slightly different things where I meant to use the same)

#

just write them once and use anywhere, performance is not the issue here

nimble vale
#

yeah i guess that is best approach here regardless performance

merry knoll
#

Component.text("hi with name1")
Component.text("hi with name2")
for plain text i think this is clean enough

merry knoll
#

altho i probably would just make a method

#

rather than a constant in that case

nimble vale
#

yeah that's the point

nimble vale
#

it's ugly as

merry knoll
#

i mean i did say for components with a lot of parts

#

i do agree with either caching (or just a method)

#

just so its cleaner

nimble vale
#

yeah depends on the situation

merry knoll
#

its just that i felt from the way they typed that they are scared in a way of initializing objects

#

in the case of classes like these, java can handle it extremely well

nimble vale
merry knoll
#

so from a performance perspective

#

no need to be scared, thats how its supposed to work

lyric gyro
#

it really doesn't matter

merry knoll
#

objects are created and garbage collected as needed

lyric gyro
#

short-lived objects are nowhere near a burden to the GC as they used to

merry knoll
#

exactly

merry knoll
# nimble vale actually that was my first opinion

as a rule of thumb, content of the class is what matters and for most objects its no big deal

you mainly want to cache objects that are heavy / take a lot of time (connection to database and reflection are the main examples)

nimble vale
#

it's a good reminder i sometimes act like paranoiac

lyric gyro
#

😅

worn jasper
#

If I had previously a class like public GeneratorData(String tier, String nextTier, String type), how would I migrate everything to an update version that has for example one more parameter?

pure crater
#

Do it manually?

worn jasper
#

in which sense do you mean that?

pure crater
#

Wait I’m confused

#

What do you mean migrate everything to an update version?

neat pierBOT
stuck canopy
#

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if(sender instanceof Player) {

            Player player = (Player) sender;
            if (command.getName().equalsIgnoreCase("oldspawner")) {

                if (args[0].equalsIgnoreCase("convert")) {

                    SpawnerInventory screen = new SpawnerInventory();
                    player.openInventory(screen.getInventory());

                }
            }
        }
        return true;
    }
}
#

help

#

why does this now work

#

oh wait maybe it doesnt work coz I didnt add the command in plugin.yml

stuck canopy
#

yep that was the problem

worn jasper
pure crater
#

Ohhh

#

I actually never thought of that hm

#

Is the extra parameter gonna each have different values for your old already created objects?

#

I was thinking keeping the old constructor and making it call the newer constructor

worn jasper
#

how so?

#

like having a default value

#

or the new parameter?

pure crater
#

Yes

stuck canopy
#

    FileConfiguration config = plugin.getConfig();

    @EventHandler
    public void onPlace(BlockPlaceEvent e) {

        if (e.getBlock().getType() == Material.SPAWNER) {

            CreatureSpawner cs = (CreatureSpawner) e.getBlock().getState();

            Player player = e.getPlayer();
            Location location = e.getBlock().getLocation();
            ItemStack itemInHand = e.getItemInHand();
            if (itemInHand.isSimilar(CaveSpiderSpawner) || itemInHand.isSimilar(CaveSpiderSpawnerOld)) {
                spawners.add("" + location);
                config.set("spawners-location", spawners);
                plugin.saveConfig();
                cs.setSpawnedType(EntityType.CAVE_SPIDER);
                player.sendMessage("worked");
                cs.setDelay(-1);
                cs.setMinSpawnDelay(340);
                cs.setMaxSpawnDelay(340);
                cs.setRequiredPlayerRange(7);
                cs.setMaxNearbyEntities(1);
                cs.setSpawnCount(1);
                cs.update(true);
            }```
#

help

#

in my localhost server with no plugins it updates the spawner entity type to CAVE_SPIDER

#

but in another server with a bunch of plugins it isnt working

#

what could be causing it

tacit belfry
#

What version is it on?

tacit belfry
stuck canopy
stuck canopy
#

it says the msg too

#

"worked"

worn jasper
#

Cause I serialized the previous class (with the previous params)

tacit belfry
#

That might be why, I had a problem a while ago with a config option where it was using legacy block ids. I forget how to fix it though

#

But my problem was with candles

stuck canopy
#

what was the problem?

tacit belfry
#

Oh I think you need to set api-version: 1.18

#

Or something like that

#

I could be completely wrong

pure crater
stuck canopy
tacit belfry
#

Ok hmm

#

What is your local host running and what is the server running

stuck canopy
#

or maybe let me just try deleting plugins 1 by 1 and hopefully figure out which plugin is causing it

tacit belfry
#

Yeah maybe try that

stuck canopy
#

1.18.2 I mean

tacit belfry
#

Both?

stuck canopy
#

yes

tacit belfry
#

Ok

#

Try process of elimination

stuck canopy
#

found it

#

Its ExecutableItems which is causing the problem

formal crane
#

so i am trying to check if the clicked inventory is the same as a other inventory i have in a variable, the problem is that one of them is CraftInventoryCustom and the other is just CraftInventory, any fix?

glossy spoke
heavy wadi
#

Is there some open source stuff available for working with multiple yaml config files in plugins?

#

Or can I just merge all my config files into one on plugin startup and then use the bukkit methods for working with it?

dusky harness
#

triumph config

#

😌

heavy wadi
dusky harness
#

a little busy atm

heavy wadi
#

found it, "no docs on it" scares me a lil bit tho 😄

dusky harness
#

🥲

heavy wadi
#

yes yes I found the triumph thingy you were talking about 😄

#

...but I also found some other stuff 😏

dusky harness
#

🙊

winged pebble
shell moon
#

When using 1.8 (or old versions) is there an easy way to differentiate between the durability of an armor/weapong/etc

#

which is the damage (uses) and the durability for example of a wool (colored) or golden apple (1 when enchanted)

#

?

solemn ocean
#

Guys does anyone know how to create custom pathfindergoals for entities? Like if I want to make new ai stuff, the actual thing is that i dont know how to make a mob have a rotation of abilities when is in aggro with a player (like I'll check if the player in aggro is in range he'll do a certain ability else it'll punch him if he's close for example) or do something else when he has no threat (Like mythic mobs but for my own stuff I really need to make it myself)

proud pebble
#

yeah, create your own inventory holder and add a identification variable to it.

#

its the best way

glossy spoke
#

nobody knows js?😭😭

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

Source

glossy spoke
#

I did

dense drift
#

Well, try to keep it in one support channel.

glossy spoke
#

it returns 0.0

#

well i need it asap

#

i am asking in any channel

stuck canopy
#

hey

#

how can I store the mobs spawned by spawners

#

or how can I remove mobs spawned by spawners with a interval

lyric gyro
nimble vale
#

you can do

first you can create a task which checks for example every 10 seconds
when a mob spawned by a mob spawner you store a timestamp with the entity
and when the 10 seconds over that will check if every entity you store had 10 seconds if its then remove it

#

or you can create a task every time when a mob spawns then remove

lyric gyro
#

Thats a bad idea lol

nimble vale
#

second right

lyric gyro
#

Yeah haha

nimble vale
#

yeah i wasn't sure to write that 😄

lyric gyro
#

If he wants a timer for every entity he could do with a hashmap probably?

nimble vale
#

yeah i guess that works

dense drift
#

There's CreatureSpawnEvent and SpawnCause.SPAWNER or something like that

nimble vale
#

or maybe if there is a way to attach some data to entity i have never done that before

#

or just maps

#

store entity id

lyric gyro
#

There’s PDC and metadata

dense drift
#

If you are on 1.14+, there's PersistentDataContainer

lyric gyro
#

I don’t think metadata remains on restart though yeah?

dense drift
#

It doesnt

lyric gyro
#

Yeah thought so. You probably wouldn’t have to use PDC though since I don’t see why you’d wanna store the entities forever lmao

pure crater
#

So I created an HTTP file Server in Java using Netty, and I was wondering if there are any attacks I should keep in mind of? I created a regex to prevent against requests that try to do a reverse directory traversal attack (where they use ./ and ../), however, I was wondering if there were any other attacks that I could prevent programmatically?

stuck canopy
#

    public void onBlockPlace(BlockPlaceEvent event) {

        new BukkitRunnable() {
            @Override
            public void run() {

                int spawnercount = 1;
                Chunk c = event.getBlock().getLocation().getChunk();
                int cx = c.getX() << 4; // chunks x
                int cz = c.getZ() << 4; // chunks z

                for (int x = cx; x < cx + 16; x++) {
                    for (int z = cz; z < cz + 16; z++) {
                        for (int y = -64; y < 320; y++) {
                            if (event.getBlock().getType() == Material.SPAWNER) {
                                ++spawnercount;
                                if (spawnercount >= 5) {
                                    event.getPlayer().sendMessage(ChatColor.RED + "You can't place more Spawners in this chunk");
                                    event.setCancelled(true);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }.runTaskAsynchronously(plugin);
    }
}```
#

why does this not work

sterile hinge
#

don't access the world asynchronously

#

also, the logic is fundamentally flawed

#

it's even flawed in multiple ways:

  1. you're never checking any block other than the one which was placed
  2. you're therefore either end up with 1 (even if no spawner is set) or 1 + one for each position in the chunk
  3. you're trying to cancel the event after it was already handled
leaden sinew
sterile hinge
#

instead, just use Chunk#getTileEntities(), count CreatureSpawners and cancel the event based on that - no need to do anything asynchronously

stuck canopy
#

oh

#

so I dont need a BukkitRunnable for it?

sterile hinge
#

no

lost bluff
#

hey
does anyone how to code python? i need a bit of help i coded a calculator but idk how to make it into an exe file

#

(ping and reply pls)

lost bluff
#

py installer isnt working

lyric gyro
#

😔

icy shadow
#

guy installer

torpid raft
#

pie installer

plucky delta
#

Anyone able to help me with this? Caused by: java.lang.NoSuchMethodError: 'net.kyori.adventure.text.Component net.kyori.adventure.text.TextComponent.font(net.kyori.adventure.key.Key)'

formal crane
#

Could you provide some code? (and the full error)

plucky delta
#

This is the full error.

#

Well

#

Somethings that are unimportant

broken elbow
#

...

plucky delta
#

return Component.text(stringBuilder.toString().trim()).font(Key.key("colored_pixels:cubes")); this is the code

broken elbow
#

are you shading adventure?

plucky delta
#

Yes I aM.

#

Just using scope compile

#

and using Purpur

#

1.17.1

#

Latest build

dusky harness
#

dont shade adventure

stuck canopy
#

    @EventHandler
    public void onCreatureSpawn(CreatureSpawnEvent e) {

        new BukkitRunnable() {
            @Override
            public void run() {

                if (e.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER)) {
                    e.getEntity().remove();

                }
            }
        }.runTaskTimer(plugin, 0L, 100L);
    }
}```
#

how do I make this somehow work

merry knoll
#

why are you creating a runnable for it?

#

if you just want to not allow spawners to spawn

#

then cancel the event

#

rather than removing the mob

#

if you want them to spawn then get removed after x delay

#

then use runTaskLater

stuck canopy
#

I want to remove the mobs

#

but in a interval

#

with a interval*

merry knoll
#

you want to remove mobs every x seconds?

stuck canopy
#

yesd

merry knoll
#

then you need to create a timer only once

stuck canopy
#

how so?

merry knoll
#

not every spawn event

#

on enable?

#

then loop all mobs and check which ones are spawner spawned

#

(or even better, cache the ones as they spawn and remove that way)

stuck canopy
#

why this complicated

merry knoll
#

its not really complicated

#

what you are doing above is running a repeating timer

#

every time a mob spawns

#

that attempts to remove the same mob constantly

#

what you want to do is run a timer when the server starts that checks the mobs and removes the ones that are spawned by a spawner (if you are doing this for lag reasons, this probably is a really bad idea btw)

stuck canopy
#

Im doing it for my Spawners plugin

hoary scarab
# stuck canopy ```public class SpawnEvent implements Listener { @EventHandler public v...
public class SpawnEvent implements Listener {
    @EventHandler
    public void onCreatureSpawn(CreatureSpawnEvent e) {
        if(e.getSpawnReason() != SpawnReason.SPAWNER)
            return;
        Bukkit.getScheduler().runTaskLater(<JavaPlugin>, () -> e.getEntity().remove(), 100);
    }
}
```Will remove the entity 100 ticks after it spawns. (You should check if its dead or removed already.) Make sure to register the listener.
stuck canopy
#

Cannot resolve method 'runTask(SpawnersPlugin, <lambda expression>, int)'

stuck canopy
#

    @EventHandler
    public void onCreatureSpawn(CreatureSpawnEvent e) {
        if (e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.SPAWNER) {
            if(!e.getEntity().isDead()) {
                Bukkit.getScheduler().runTaskLater(plugin, () -> e.getEntity().remove(), 100);
            }
        }
    }
}```
#

changed the code a bit and it works perfectly

#

tysm for the code

hoary scarab
#

np

shell moon
#

wait, what?

#

he checks if entity is dead after spawning and then remove it 100 ticks later

stuck canopy
#

dude no one cares

#

it works

#

thats all I care about

hoary scarab
shell moon
#

¯_(ツ)_/¯

#

then that would be inside the task

hoary scarab
shell moon
worn jasper
#

Uh, if I run a SyncTask inside an Async task it will wait for the async task to finish right?

pure crater
#

like callSyncMethod? From the scheduler

#

It would schedule it for the next tick

#

And run on the main thread

#

Unless you are talking about something else? Wdym by sync task

worn jasper
#

this use case

#

the idea is to serialize the class, store it and then remove it from cache

#

after that is done

pure crater
#

I may be wrong, but I think it will schedule on to the next tick on the main thread

worn jasper
#

So, it won't really wait for the async task to finish?

pure crater
#

Well in your case, the db operation will be done first, then the sync task will be scheduled on the next tick

#

Because it’s after

#

Unless the db operation is also async

worn jasper
#

the idea is for the db operation to be async too

pure crater
#

Nah I was referring to

#

db.set

merry knoll
#

db operation is async there

#

cache.get is done on the main thread

#

your async thread wont wait for the main thread scheduler to finish

#

it only fires it, rest is handled on the main thread

worn jasper
#

So it doesnt rlly wait for the async task

#

Hmm ok

merry knoll
grand zodiac
uneven shadow
#

I want to make a plugin that listens to a pixelmon event. https://paste.helpch.at/visocigero.java

Basically, Pixelmon's<event>.getPlayer(); returns a EntityPlayerMP
I want to convert this player into a CraftBukkit Player

In the mohist api, under playerAPI, there is a method getCBPlayer that should take EntityPlayerMP, and return a CraftBukkit Player
It's instead asking for something called oq as an arg, but I don't know what that is.

I was hoping someone could help me figure out what oq is, or more generally how to cast EntityPlayerMP to a Player

iron karma
#

anyone can teach me how to make a InventoryCreator?

high edge
#

Have you tried checking the docs?

snow reef
dense galleon
#

This isnt the right channel for datapack support, is it?

#

It's related to a mod I am making

#

But it's just regarding structure nbt and worldgen jsons

hushed badge
#

well its development support, any kind of development, just ask and someone may know the answer

dense galleon
#

made a structure which generates naturally in the world, though ever since I have added it any time I try joining a world in singleplayer I get this warning here

high edge
#

Expected behaviour

dense galleon
#

I mean how can I avoid that from happening

high edge
#

Doubt you can, I'm guessing it's a client oriented warning

dense galleon
#

But I have never seen this issue with any other mod that adds custom structures

hoary scarab
dense galleon
#

Yeah i guess it's expected behavior now

nimble vale
#

there is a mod to just hide that message if you want something like that

iron karma
#

hi

#

One question, I have a plugin that when you die takes a life from your storage (for example, if you have 3 lives, when you die you have 2), how can I make a life recover after X hours?
I had thought that when you die, the exact date of when you died is saved, and check every second if the current date is greater than the saved date

smoky hound
#

yea you can do that. just saved the time when you die, have a task that cheeks the death times or something and if a users time is old enough remove it from the death times list and add their life back or something. alternatively you could maybe schedule a task on death that has a delay and when it runs it adds the life back

lyric gyro
shell moon
#

DeluxeMenu depend on PlaceholderAPI parsing? (for colors)

lyric gyro
#

huh

warm steppe
#

huh? huh

rigid mountain
#

how could i get a potion level from player item consume event,

#

?

dusky harness
#

then there's probably a method in there to get the level

rigid mountain
#

i have the potion mets but there’s no method for the amplifier

#

since level is deprecated

#

it just returns 1

dusky harness
#

you can do getBasePotionData

#

and then isUpgraded & isExtended

#

although as for custom potions...

dense drift
#

amplifier 1 means level 2 iirc

rigid mountain
#

ah

#

i need to number leave though not the boolean

dusky harness
#

i could only find boolean ones

rigid mountain
#

potion meta .getLevel i believe

dusky harness
#

does getCustomEffects also include the base effect tho?

rigid mountain
#

no

lyric gyro
#

no

dense drift
#

the base effect only has a boolean (isAmplified) because default potions have only two levels aka normal and amplified

rigid mountain
#

ahh ok that make sense

lyric gyro
#

the base potion is one of a hardcoded type in-game, it doesn't have a "level" because it's either amplified or not (level 1 and 2 if you like)

rigid mountain
#

would that be level 1 and 2

dusky harness
#

oh

lyric gyro
#

the custom ones are any other effects you can construct and have any other level

rigid mountain
#

ah ok that makes a lot more sense, i was still thinking about like speed pots and such but then i realized i couldn’t find any

dense drift
rigid mountain
#

ok thank@you

lyric gyro
#

the potion effects API is so trash

dense drift
#

spigot api*

lyric gyro
#

yeah fair, but there are bits that are so noticeably worse than the rest lmao

dense drift
#

true

grim oasis
#

I wonder what working with good api is like, maybe one day

dense drift
#

paper or modded

lyric gyro
#

sponge pleading_apple

pure crater
#

Id probably say Spring or something

dense drift
#

well I was talking about minecraft

lyric gyro
#

We can't really comment anything about Minecraft itself, there is no API to use it, it's all hacks and workarounds to hook up into it

#

And actual APIs you've got Sponge and Bukkit... let's just say that Bukkit shows its age :')

wintry grove
#

but at least those APIs can be good lmao

high edge
#

They're a lot newer, bukkit is as expected for something that old

errant pilot
#

Im trying to figure out a way to make moving with a boat faster, the boats dont have gravity so theyd be moving in the air always

the idea with this code is to try and figure out if between 2 of the event checks the boat was moved by the player themselves by pressing W instead of just the speed boost that was applied, i feel like this code should work but it does not at all

@EventHandler
    public void onVehicleMove(VehicleMoveEvent e){

        if(!(e.getVehicle() instanceof Boat boat)) return;
        FlyingBoat fboat = FlyingBoat.boatMap.get(boat);
        if(fboat == null) return;

        Vector vec = e.getTo().toVector().subtract(e.getFrom().toVector());

        double speed = vec.length();
        Location loc = boat.getLocation();
        loc.setPitch(0);

        double speedBoost = fboat.getMaxSpeed()/20;
        Vector boostVector = loc.getDirection().multiply(speedBoost);


        if(speed>fboat.lastSpeed){
            if(speed < fboat.getMaxSpeed()){
                vec.add(boostVector);
            }
        }


        fboat.lastSpeed = vec.length();

        boat.setVelocity(vec);

    }
merry knoll
errant pilot
#

the flyingboat thing is just to get the max speed and see if its a boat i want to boost

merry knoll
#

yes but

#

using the boat instance as key

#

is asking for trouble

#

are you providing your own hash

#

or just using it as key

errant pilot
#

im not really sure what you mean but that part works fine just the boosting is being an issue

merry knoll
#

you sure its just not returning?

errant pilot
#

yep im 100% sure, ive checked with sending the player messages about how fast its going etc

worn jasper
#

Uhm, when adding an item to a player inventory it returns an hashmap if it couldnt add all items right? My question is, it's a Integer, ItemStack hashmap, if I use size(), will it return 1 (only one itemstack) or the amount of items it couldnt add?

winged pebble
#

Map#size() returns the number of entries in the map

worn jasper
dusky harness
worn jasper
dusky harness
#

So an ItemStack with the amount 100?

#

then it will return 1

#

it all depends on your parameter

#

no

#

checkArgument checks if it's false

#

and if it's false, then throw an exception

#

also can u post the exception?

#

since the stacktrace will lead to the code calling it

hoary scarab
#

The code above is whats calling it. But yeah hold on

dusky harness
hoary scarab
#

I'm making it bypass the setItem

lost fiber
#

Hi! I made a menu in the DeluxeMenus plugin, the point of which is that, for example, there is a spawner, and it costs 100,000,000 dollars to deduct that much, and if the player doesn't have money, don't give it to them. How can I do it? It doesn't work for me.

spice river
edgy lintel
wintry grove
#

iirc

#

and why do you make a like that

#

just do

List<String> item_lore = new ArrayList<>()
item_lore = item_meta.getLore()
spiral prairie
#

No

#

Dont

#

No underscores in variable names

#

And yes i just came here to say that

cinder forum
#

↙️ 🐫 💼

past ibex
#

You get player inputs with vehicles!

#

So there should be a method to get the player inputs somewhere in bukkit

#

Velocity is the only way to modify boat speed, really

#

ping me if you reply or want help with movement stuff

errant pilot
#

only way i could think of is comparing the velocities of the boat between events to see if the player pressed W to move it forward or not

past ibex
#

no the player literally sends their inputs to the server

errant pilot
#

mkay how do i intercept those

#

or do you mean like a command?

past ibex
#

PlayerInputPacket

errant pilot
#

aah okay i havent done anything with packets yet in my plugins

past ibex
#

I'm surprised there's no API method for this

#

I guess because the server never actually uses these inputs

#

mojang has just left them in either because they forgot or they want to let people make custom vehicles

#

Take your pick of protocollib or packetevents

#

Or use reflection to read the variables

errant pilot
#

probably gonna go with protocollib since my server already has that on

past ibex
errant pilot
#

oooh epic just gotta figure out how to use it now xD

#

very nice, thank you!

errant pilot
#
protocolManager.addPacketListener(new PacketAdapter(
                this,
                ListenerPriority.NORMAL,
                PacketType.Play.Server.Player_Input
        ) {
            @Override
            public void onPacketSending(PacketEvent event) {
                
            }
        });

im assuming it'd be something like this but i cant find the Player_Input one @past ibex

#

its red when i type it

past ibex
#

client

#

PacketType.Play.Client.Player_Input

#

and onPacketReceiving

errant pilot
#

player input is still red with Client

#

ill check if i have the latest protocollib

#

yeah i am

#

yep this is exactly what i needed

odd prawn
#

Why do you need Player Input for that?

#

You need to listen to the STEER_VEHICLE packets

past ibex
#

depends on mappings

#

Steer boat isn't the same packet as player inputs

#

but steer vehicle sometimes is mapped as player input

wintry grove
#

how does one spawn only the particle of fireworks? I have searched and according to spigot forums you need to use the particle packet

#

but there is no data for fireworks in the protocol in wiki.vg

#

none is data

winged pebble
#

If you're in a later version, you could just use api methods tbh

#

As they basically just send packets

spice river
hoary citrus
#

Can I update an inventory? I’m trying to make an animation using stained glass like some plugins have in their casino or mystery box GUIs

#

Also for some reason Everytime i check if an item is equal to an item I want to change, it returns null

#

Well I fixed the null issue, but it’s not changing the items

#

Used a different method, it works

high edge
#

You're welcome

errant pilot
#

@past ibex How do i make it so when the boat's velocity is changed by colliding with a block or something like that, it actually changes?
right now im doing all the movement by storing the velocity in the FlyingBoat instance and it works perfectly except for when the boat collides with something, once the block is out of the boats way it jumps forward

I tried setting the velocity in the FlyingBoat instance through the VehicleMoveEvent and that worked for the block collision thing but then the movement itself is pretty choppy

#

oh crap theres a vehiclecollision event!

#

ill try using that

#

Hm the event doesnt seem to trigger but the boats movement got really choppy still

high edge
#

Why don't you just manipulate the moveevent when there's a collision, and the rest is handled how you were handling it originally

errant pilot
#

yeah im sorta trying that but the event isnt triggering, ill have to check if i did the listener correctly...

#

listener's fine, weird

#

pft apparently that event is bugged

past ibex
#

The server will just replay client movement and not see collision

#

You should be able to notice collision when their movement in a direction hits 0

#

Not “perfect” detection but you’ll have to deal with it as long as you use client sided vehicles.

dusky harness
#

try isValid

hoary scarab
glacial temple
#

how would I be able to get it to return the value entered in my config.yml? I have

sender.sendMessage(Npunish.plugin.getConfig().getString("default-kick-message"));

set and it returns null and everything else I've tried showed an error that practically told me to just remove it

glacial temple
#

config where I have the messages defined
#Messages default-kick-message: "Breaking the rules"

no error returned in the above ^

#

it kicks but the kick message is just empty

wintry grove
#

is it possible to only make a runTaskTimer run only like 5 times?

#

or a set amount of times

hoary scarab
hoary scarab
wintry grove
#

tried that

#

wait no

#

alright ty

hoary scarab
#
new BukkitRunnable() {
    int count = 0;
    public void run() {
        count++;

        // Your code        

        if(count == 5)
            cancel();
    }
}.runTaskTimer(<JavaPlugin>, <delay>, <timeBetween>);
hoary scarab
worn jasper
#

Hi so, owner.getInventory().remove() removes an Itemstack, the issue I am having is that it removes all itemstacks that match, any way to only remove it once?

#

Or maybe I am using the wrong method?

worn jasper
#

pretty sure it isn't that

#

but it's fine I will just use another method

#

by setting the slot

#

thx

hoary scarab
#

I edited it sorry. Don't have my ide open

glass mason
#

Im using foreach loop to iterate between messages sent before and send them to the user. for some reason I'm getting an error that is repreducable but on my computer nothing weird happens..
Maybe due to downgrading java version in mvn to java 17 (I'm using replit)?

Error:
Exception in thread "Thread-3" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at me.fozystyle.JavaChatServer.readThread.run(readThread.java:54)

Code at me.fozystyle.JavaChatServer.readThread.run 54:
if (server.messageHistory != null) {
for (String s : server.messageHistory) {
sendMessage(s);
}
}
btw messageHistory is a String list:

List<String> messageHistory = new ArrayList<>();
Please ping me if you think you've a solution

lyric gyro
#

what does sendMessage do?

winged pebble
#

You can't use an enhanced for loop on a List and modify the list from inside it

pure crater
#

@glass mason show code and also use HelpChat paste

lyric gyro
#

?paste