#help-development

1 messages ¡ Page 101 of 1

smoky oak
#

its gotta be in the variable declaration too

#

where do u use it

#

im too tired to think about this rn sorry

candid galleon
#

what's the IDE error?

#

source code?

#

i specifically want to see where you're calling new PlayerEvents.MyGoal(this);

#

there's only two, no harm in uploading both again

undone axleBOT
candid galleon
#

your MyGoal class has a constructor that requires a Mob parameter

#

you're attempting to use an empty constructor, which it doesn't have

#

(new PlayerEvents.MyGoal();)

worldly ice
#

it's because your inner class isn't static

#

you need an instance of your parent class to create an instance of the inner class

candid galleon
#

right, you can import all you want, but that won't change the fact that you aren't supplying an argument for the constructor

worldly ice
#

then just put new PlayerEvents.MyGoal();

#

and it should work

candid galleon
#

bruh

worldly ice
#

well with the args

candid galleon
#

BRUH

worldly ice
#

didn't look at code

#

so idk what your constructor looks like

candid galleon
#

:lul:

#

i too love debugging code without looking at the code

worldly ice
#

i saw the picture

#

so it would be new PlayerEvents.MyGoal(mob);

molten hearth
#

does anyone know if its possible to change the main plugin class file in intellij after having created a project

candid galleon
#

how did you set it?

dusk flicker
#

just rename it?

molten hearth
#

eg instead of me.project.ProjectName.ProjectName it needs to be me.project.ProjectName.ProjectName2

molten hearth
#

I dont want to rename it im entirely changing the file

dusk flicker
#

you just refractor the name; and update your plugin description file

molten hearth
#

yes but the file is also in a different folder

#

instead of me.project.ProjectName.ProjectName I actually need me.project.ProjectName.ProjectName.common.ProjectName

#

bruh what a weird solution

dusk flicker
#

how is that a weird solution

#

thats completely normal for like, every software?

molten hearth
#

it is not allowed to move a class into itself

#

well no

#

it would make sense for a config to point to say Main.java

#

and then you change it accordingly

dusk flicker
#

?main obligatory

dusk flicker
#

eitherway ima be

molten hearth
#

but looking at the gradle settings how the fuck does it even know it wants to run MyThingy.java

dusk flicker
#

?cba night

undone axleBOT
#

Rack#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

candid galleon
#

don't you just have to change the maven main class and the plugin.yml

molten hearth
#

well yes but also this is more of an intellij question and not spigot

#

wait

#

hmm

candid galleon
#

what's the effective difference?

molten hearth
#

what about gradle tho

#

I dont see a main class anything in gradle

candid galleon
#

ha good luck with gradle

molten hearth
#

💀

candid galleon
#

the only thing that makes a main class a main class is spigot

molten hearth
#

I do see archivesBaseName = 'Project' perhaps I can do archivesBaseName = 'common.Project'

candid galleon
#

a raw main class in java would have the good ol public static void main(String[] args)

worldly ingot
#

"main class" for spigot plugins is such a misnomer

torpid sapphire
#

how do you guys usually test plugins? do you just restart the server every time or do you use something like plugman

hasty prawn
#

I have my IDE export the JAR directly into my plugins folder and just /reload

torpid sapphire
#

so reload works fine? it says it often breaks stuff

worldly ingot
#

reload is fine. We mostly discourage its use on production networks

hasty prawn
#

Sure, but it's a testing server. Doesn't matter

torpid sapphire
#

right

#

makes sense

hasty prawn
#

^^ just dont do it on production servers

worldly ingot
#

So long as you're aware that it can break things, that's all

#

but if something's broken, it's probably because you did it lol

hasty prawn
#

Oh yeah I've had stuff break when I /reload, if thats the case then I'll just restart when I'm testing

dusk flicker
#

^

#

I will reload but if I come up with an error restart and see if its persistant

torpid sapphire
#

thanks

zealous glen
#

can you not cancel items from being exploded anymore?

#

I tried like 3 different events regarding entity damage

#

none were called whenever an item entity was exploded

#

I wrote similar plugins for 1.8 servers, however they no longer work the same with 1.18+.

young knoll
#

Map

scarlet creek
#

I am trying to negate explosion damage for players but it doesn't seem to work

Code: @EventHandler public void onPlayerExplosionDamage(EntityDamageByEntityEvent event){ if (event.getEntity() instanceof Player){ Player player = (Player) event.getEntity(); System.out.println("Damaged!"); if (event.getDamager() instanceof Fireball){ System.out.println("Test"); } } }

delicate lynx
#

you didn't cancel the event?

scarlet creek
#

Nothing seems to be outputting

scarlet creek
delicate lynx
#

is your event registered

scarlet creek
#

Yes

#

getServer().getPluginManager().registerEvents(new ExplosionDamage(), this);

#

A player is shooting the fireball

#

I set the fireball shooter to player

#
        // fireball
        Fireball fireball = player.getWorld().spawn(location, Fireball.class);
        // set fireball default explosion to 0 to set custom explosion
        fireball.setYield(0);

        fireball.setVisualFire(false);
        fireball.setShooter(player);
        fireball.setFireTicks(0);
        fireball.setVelocity(player.getLocation().getDirection().multiply(1));
        player.sendMessage("Fireball ammo count: " + ammo.get(player.getName()) );
    }```
#

what check?

#

Oh you meant to check who shot it as the event.getEntity()?

#

alright

#

Not an option since it is not a projectile event

#

Hmm aparently not...

#

Hmmm so it doesnt seem to be EntityDamageBy EntityEvent?

#

Because the event class is registering properly but the Damage event is not outputting anything

#

Yea the listeners in the class are registered

#

I just check with a join message listener in the same class

#

Nope still broken

#

Yup

#

Ah I might've fixed it

scarlet creek
#

But .createExplosion is not an entity right?

young knoll
#

Correct

oblique wigeon
#

Given a vector- how can I change the direction/magnitude of the vector?

#

I'm trying to use Vector#rotateAroundArbitraryAxis(Vector, Double), but I cannot for the life of me create a vector with an angle

#

The vector class only contains an x, y, and z, so how can it store information about direction?

drowsy helm
scarlet creek
young knoll
#

Which event

scarlet creek
#

This one:

    public void onPlayerExplosionDamage(EntityDamageByEntityEvent event){
        if (event.getEntity() instanceof Player){
            Player player = (Player) event.getEntity();
            if (event.getDamager() instanceof Fireball){
                event.setCancelled(true);
            }
        }
    }```
young knoll
#

It does

scarlet creek
#

I'm still taking damage?

young knoll
#

Then it isn’t making it to that line

scarlet creek
#

Hmmm it is...

#

I added a out message to that

#

Ah perhaps it's my .createexplosion that is causing problems

young knoll
#

Pretty much anything you want

#

Make skeletons attack squids by launching tnt at them

drowsy helm
#

make birds only attack players called Coll1234567

young knoll
#

Jokes on you that’s not my minecraft name

granite burrow
#

Is there any way to get if a player was killed by a entity in the PlayerDeathEvent so far after some searching online I couldn't find anything

young knoll
#

Isn’t there a getLastDamageCause

worldly ingot
#

As a part of Player, correct

young knoll
#

You can check if that is an EntityDamageByEntityEvent and work from there

echo basalt
#

locations however, do store 2 angles for rolation

#

funky mojang stuff

#

seems like not accepting a failure automatically assumes it?

#

idk I don't have context

young knoll
#

There aren’t any

oblique wigeon
echo basalt
#

ehh hard

#

people don't really take the time to write docs for 14 hours straight

#

we just learn how to deal with it and use it as a base

#

with NMS, I'd say there are like 2 categories of people

#
  • the ones who are messing around and don't know much
  • the ones who reverse-engineer nms on the moment and learn and assume a lot about the server based on a quick look at the code, helping the category above
#

because?

#

does it though

fleet comet
#

Hey so I'm making custom NPC plugin and i'm on 1.19.2
What is the obfuscated thing for sending packets?

#

b is the player connection

young knoll
#

Why not use remapped?

drowsy helm
#

use moj mappings

fleet comet
fleet comet
fleet comet
#

ohhh

drowsy helm
#

did you run buildtools

fleet comet
drowsy helm
#

with the --remapped flag?

#

dont see why its sayting that

fleet comet
drowsy helm
#

show your pom

fleet comet
#

?paste

undone axleBOT
drowsy helm
#

you need the regular spigot-api dependency aswell iirc

young knoll
#

You shouldn’t

fleet comet
#

@drowsy helmokay so i got it to work without that but tons of imports not working

drowsy helm
#

Yeah all your nms imports

young knoll
#

They’ll all have different names

chrome beacon
fleet comet
chrome beacon
#

Time for some screaming sandals

fleet comet
#

also getHandle().playerConnection doesnt existt

chrome beacon
#

It's just connection

fleet comet
fleet comet
young knoll
#

ServerLevel iirc

fleet comet
#

And NetworkManager

#

And PacketPlayOutPlayerInfo

#

And PacketPlayOutNamedEntitySpawn

#

And PlayerInteractManager

#

And EnumProtocolDirection

drowsy helm
#

i knows its a pain moving everything over

#

but when you want to update your plugin you wont have to change much

onyx fjord
#

how should i approach making a custom player class that can do all player related stuff to the custom player?

#

i guess i can add a method that returns the bukkit player?

scarlet creek
#

How do I add a player to a team? .addplayers is deprecated

onyx fjord
scarlet creek
#

Ah thanks!

manic furnace
#

?paste

undone axleBOT
manic furnace
#

I get from this code

optionsOfPlayers.get(player).get(option_identifier).applyDataToStorage(option);

this exception:

java.lang.ClassCastException: class at.theduggy.edi.storage.OptionStorageData cannot be cast to class java.util.HashMap (at.theduggy.edi.storage.OptionStorageData is in unnamed module of loader 'EDI-1.0-SNAPSHOT.jar' @46a5671f; java.util.HashMap is in module java.base of loader 'bootstrap')

But I dont cast smth

onyx fjord
#

OptionStorageData cannot be cast to class java.util.HashMap

#

@manic furnace

manic furnace
#

But where do I cast smth in that code

onyx fjord
#

idk

#

send a bigger chunk

manic furnace
#

From what?

onyx fjord
#

from the code that errors

manic furnace
quasi flint
#

could i see

#

more?

#

of what that map actually contains / what iz even stores

manic furnace
#

Sry for sending not enough

quasi flint
#

and could j send

#

the whole exception

manic furnace
scarlet creek
#

Is there a way to get registered teams?

quasi flint
#

what is in line 25?

#

and 44

manic furnace
#

In main?

quasi flint
#

yes

manic furnace
#

and that 25: storageManager = new StorageManager();

quasi flint
#

U somehow

#

Cast smth in there

#

I don't know where tho

manic furnace
#

I dnot know either

quasi flint
#

U somehow cast a class

#

To a hashmap

manic furnace
#

ik

quasi flint
#

Sure u use the right params?

manic furnace
#

yeah my ide would show me

quasi flint
#

Not necessarily

manic furnace
#

I think I had smth left in my data file

#

from yesterday with old structure

#

ok bruh now i works after deleting it

red sedge
#

How would i go about implementing this?

example-dialogue:
    - "m: Hello there"
    - "r: Hi!"
    - "m: How are you feeling today?"
    - "r: I'm alright! | Tough."
    - "m0: Great to hear!"
    - "m1: Oh no!"

so texts starting with m will be the message the npc sends, and r is the reply options the player can click on the chat. Thats fine, as long as there is only 1 option, I'm not quite sure how i would go about adding multiple options, especially if they will change the course of the entire dialogue

#

should I just make it so each reply starts a completely new dialogue?

#

I think that might work?

chrome beacon
#

Yeah you'll need branching options

red sedge
#

but it would also bloat the yaml with a bunch of dialogue declarations like

example-dialogue:
example-dialogue-reply-1:
example-dialogue-reply-1-1:
example-dialogue-reply-1-2:
example-dialogue-reply-2:
example-dialogue-reply-2-1:
example-dialogue-reply-2-2:
example-dialogue-reply-2-2-1:
chrome beacon
#

Make an ingame configuration tool to solve that

#

Or maybe a simple website

red sedge
#

hmm

#

okay i'm kind of just worried that the yaml file could get too big

#

but to be fair its like

chrome beacon
#

You can always use another storage format

red sedge
#

one extra line per option

red sedge
lilac dagger
#

which name would be perfect for a class that handles a type of managers?

#

the class can register the managers, load them, unload them, not load them if they're in the disabled list

red sedge
#

ManagerManager

#

and then ManagerManagerManager

#

can you guess whats next?

#

yes!! you're right!

#

ManagerManagerManagerManager

chrome beacon
smoky oak
#

tf did u just link

chrome beacon
#

That's just github?

smoky oak
reef lagoon
#

it's github for me

chrome beacon
#

Looks like CSS failed to load

smoky oak
#

huh

reef lagoon
chrome beacon
#

Well yeah that whole project is satire

#

They don't exactly need to update it

smoky oak
#

oh btw does anyone know why the spigot doc website lags on a 3060???

chrome beacon
#

It doesn't lag on my laptop

#

with integrated graphics

smoky oak
#

when i scroll down it stutters

onyx fjord
#

oop be like

chrome beacon
#

What browser are you using?

smoky oak
#

avast chrome

onyx fjord
chrome beacon
#

Avast 💀

lilac dagger
red sedge
#

MegaManager

#

UltimateManager

smoky oak
#

😐

#

yup

#

its the browser

lilac dagger
#

still horrible

smoky oak
#

urgh

chrome beacon
#

Don't use Avast

red sedge
#

SuperManager

lilac dagger
#

i have it now as manager registry

#

yeah those attributes aren't good as class descriptors

chrome beacon
# chrome beacon Don't use Avast

be warned though. The avast uninstaller doesn't remove everything from your PC. It will leave a background program even after uninstall

lilac dagger
#

don't use antiviruses

red sedge
lilac dagger
#

or at least i don't

chrome beacon
#

Why would they

red sedge
#

many apps leave stuff like user settings

#

from what ive seen

chrome beacon
#

User settings isn't a running program

#

It's just a file

lilac dagger
#

they're not gonna prevent you getting viruses whatsoever

red sedge
#

oh wait theyre leaving programs?

chrome beacon
#

Yes

red sedge
#

rarely

chrome beacon
#

A background program will keep running after uninstall

red sedge
#

but possible

lilac dagger
#

yeah but if a virus is in their database it was 'cause it was a bad one

#

if you click the first download ram for free exe and execute it, you're probably gonna need an av

red sedge
#

still

chrome beacon
#

I just use windows defender

lilac dagger
#

^

lilac dagger
#

same

chrome beacon
#

It's good enough I don't download random exes

lilac dagger
#

it does nothing

#

download programs with notoriety

#

and be sure they're signed

chrome beacon
#

I sometimes do a manual scan with Malware bytes

lilac dagger
#

i used to do that too

#

doesn't do much

chrome beacon
#

Yeah it has never found anything

civic apex
#

can someone explain how to properly unload/load back a world?

smoky oak
#

aint it just calling the method

civic apex
#

im tired of so many unhelpful exceptions

civic apex
red sedge
#

i've never used a antivirus since 2016

lilac dagger
#

that's probably the time i stopped as well

civic apex
#

i stopped this year

red sedge
#

i jsut kind of find it... unnecessary

#

especialyl since before my computer wasnt the best and the antivirus was hogging like 5% of my resources

lilac dagger
#

any better names for a class that handles game managers?

civic apex
red sedge
civic apex
reef lagoon
#

Call it "main"

lilac dagger
#

but it seems inadequate for the functions is gonna have

civic apex
#

i rename my classes/packages often

lilac dagger
#

I made this cool thing 😄

#

it also supports conditionals

chrome beacon
#

If I need fancy configs I use Configurate

#

Also MiniMessage

lilac dagger
#

but do they support conditionals?

chrome beacon
#

Depends on what you mean by that?

lilac dagger
#

<STARTING=I start#<DOI=NOPE#YEP>>

#

it replaces this based on a boolean value

#

it's kinda basic

chrome beacon
#

That seems overly complex

lilac dagger
#

it works tho

#

i did the code

#

but it gives so much power

#

especially for scoreboards

chrome beacon
#

Configurate is my new favorite config library

#

Sadly yaml comments are still W.I.P

lilac dagger
#

Sadge

chrome beacon
lilac dagger
#

I got the inspiration from that one

red sedge
#

not really a spigot development question but is there anyway i can change intellij build path so it updates the plugin in my local servers plugins folder?

#

instead of having to move it every time

buoyant viper
red sedge
buoyant viper
chrome beacon
iron glade
#
                    <outputDirectory>C:\Users\You\Documents\Your Path\plugins</outputDirectory>
                    <finalName>Your plugin_v${project.version}</finalName>
                </configuration>```
lilac dagger
#

if so, is it public?

buoyant viper
#

it is mine, not public yet bc its honestly pretty bare

amber bronze
#

?paste

undone axleBOT
buoyant viper
#

true

#

just really basic reflection stuff rn

#

@lilac dagger

amber bronze
amber bronze
lilac dagger
#

it is well written @buoyant viper

#

mine, not so much

#

it has type tokens

#

which are pretty cool

buoyant viper
#

i got no custom types :(

chrome beacon
#

Well that's simillar to Configurate

amber bronze
#

wanna help me?

buoyant viper
#

just whatever u can get from ConfigurationSection

#

i guess technically it could have a custom type bc of that

#

it just does a plain Field#get

#

so as long as ConfigurationSection#get returns the type u want it would work

timid jetty
#

stupid question i forgor how do i get the systime/

buoyant viper
#

System.currentTimeMillis

timid jetty
#

beautiful ty

tardy delta
#

Serialize just calls toString ;/

red sedge
earnest forum
#

is ItemStack#isSimilar() just .equals() but ignoring amount?

#

?jd-s

undone axleBOT
ivory sleet
#

Yes

#

Thats the intended functionality and contract of the methods at least

opal juniper
#

🤓

earnest forum
#

How can i attach a block to an inventory?

#

Something with InventoryHolders?

#

I have a shulker box which opens a custom inventory on interact

opal juniper
#

i would just listen for the interact event and intercept it

earnest forum
#

Yes but I'm trying to get the shulker box on InventoryClick

opal juniper
#

ohhh, yeah u either need to store the shulker in some sort of Map<Inventory, Whatever> or yeah use the holder

#

iirc its like BlockInventoryHolder

earnest forum
#

can you give any pointers on how to use that

#

im looking at the javadoc and its not helping

opal juniper
#

doesnt look like there is a way to construct it with the API, so probably just make your own class that implements InventoryHolder

earnest forum
#

nvm Bukkit#createInventory(InventoryHolder, ....)

opal juniper
#

?

smoky oak
#

which particles can change color? Is it only colorTransition

earnest forum
#

I can do

opal juniper
earnest forum
#

Bukkit.createInventory((BlockInventoryHolder) tileState, other args)

opal juniper
#

ah ok cool

earnest forum
#

Looks like i can do it

#

haven't tested yet

#

Inventory#getHolder returns a HumanEntity :/

scarlet creek
#

Is it possible for you run vanilla commands in your code? Trying to add players to a team but the scoreboard team system is proving challenging

earnest forum
#

yes

flint coyote
#

Should be Bukkit.dispatchCommand() iirc

earnest forum
#

yeah that

onyx fjord
#

whats the event for "X joined the game"

chrome beacon
#

PlayerJoinEvent

scarlet creek
#

Alright will test it out

onyx fjord
earnest forum
#

are you trying to change the message?

flint coyote
#

it does. Because you can set the message inside it

onyx fjord
#

no i want to do stuff after the message

red sedge
#

?paste

undone axleBOT
flint coyote
#

How would it fire after?

chrome beacon
#

Delay it until next tick I guess

earnest forum
#

yeah

onyx fjord
#

okay basically this is my problem

earnest forum
#

with scheduler

onyx fjord
#

minecraft:brand fires before join

#

but

#

i send message to all ops

#

but then it means if player that fires that packet is op they wont see the message

#

that i send

red sedge
#

https://paste.md-5.net/axagovehuz.xml
I have this as the pom, but when I package the plugin it puts the original-Plugin.jar and the compiled class files
But when I package it again it puts the Plugin-shaded.jar there

chrome beacon
#

Then just delay the message?

#

The scheduler can do that

red sedge
#

But when I package it again it puts the Plugin-shaded.jar there

onyx fjord
#

otherwise no success

flint coyote
#

10 ticks still ain't too bad

chrome beacon
#

You can send stuff in the PlayerJoinEvent

onyx fjord
#

i think it all varies doesnt it

chrome beacon
#

Maybe just use that

onyx fjord
#

wdym can send stuff?

chrome beacon
#

Messages

onyx fjord
#

ye im trying to

smoky oak
#

is it possible to set the velocity of a particle

#

without doing nms bullshit

onyx fjord
#

yes

earnest forum
#

Why does an inventory created in spigot's #getHolder() return an InventoyHolder but an inventory taken from InventoryClickEvent's #getHolder() return a HumanEntity?

red sedge
onyx fjord
#

double extra

#

its for velocity

#

extra - the extra data for this particle, depends on the particle used (normally speed)

  • offsets ig for directions
red sedge
earnest forum
#

They are the same inventory though

#

I'm creating an inventory with a BlockInventoryHolder as the holder in PlayerInteractEvent and opening that to the player, and then on InventoryClickEvent i'm trying to retrieve the holder but I can't

flint coyote
#

well then you can cast it

earnest forum
#

It doesn't work

#

a HumanEntity can't be cast to blockinventoryholder

flint coyote
#

why doesn't it?

#

Well yeah because the inventory holder changes when a player opens it probably

earnest forum
#

Ah

onyx fjord
#
    @Override
    public void onPluginMessageReceived(@NotNull String channel,
                                        @NotNull Player player, @NotNull byte[] bytes) {
        if (bytes.length > 48) player.kickPlayer("Invalid brand packet.");
        PacketPlayer packetPlayer = new PacketPlayer(player);
        String client = new String(bytes);
        packetPlayer.setClientBrand(client);
}
    @EventHandler
    public void onLogin(PlayerLoginEvent event) {
        PacketPlayer packetPlayer = new PacketPlayer(event.getPlayer());

        Bukkit.getScheduler().runTaskLater(instance, () -> {
            for (OfflinePlayer operator : Bukkit.getOperators()) {
                if (!operator.isOnline()) return;
                sendConfigMessage("messages.join",
                        Bukkit.getPlayer(Objects.requireNonNull(operator.getName())),
                        Pair.of("{player}", packetPlayer.getEntity().getName()),
                        Pair.of("{clientName}", packetPlayer.getClientBrand()));
                sendConfigMessage("messages.join", Bukkit.getConsoleSender(),
                        Pair.of("{player}", packetPlayer.getEntity().getName()),
                        Pair.of("{clientName}", packetPlayer.getClientBrand()));

            }
        }, 1);
    }
#

basically i think even after the tick it returns on this line if (!operator.isOnline()) return;

#

oh wait

#

shoudnt i use continue instead?

red sedge
flint coyote
#

continue skips to the next loop run and return is basically a break out of the loop.
Return also exits the event completely

onyx fjord
#

OH

#

ye next iteration

#

still doesnt work tho

red sedge
#

eiei oh
https://paste.md-5.net/axagovehuz.xml
I have this as the pom, but when I package the plugin it puts the original-Plugin.jar and the compiled class files
But when I package it again it puts the Plugin-shaded.jar there

flint coyote
#

continue; -> jump to next iteration
break; -> cancel loop and continue code after loop
return; -> cancel loop and return the value (if existing) of the function that is currently being executed

onyx fjord
#

ye i changed to continue tho same result

flint coyote
#

why don't you loop online players and call sendMessage if isOp?
Or simply do a broadcast with a permission

onyx fjord
#

i thought that there are generally less ops than players online so i thought its more efficient to do it this way

flint coyote
#

Not that it would matter. We are talking about like a maximum of 100 times

red sedge
#

it maybe is

#

but like

#

its really unnoticeable

onyx fjord
#

but broadcast with permission sounds efficient

amber bronze
flint coyote
red sedge
#

It probably does

flint coyote
#

It could also loop over a <Permission, List<Player>> map but I kinda doubt it. Would use a lot of ram for basically nothing.

smoky oak
#

can i influence the movement of a colorable particle

eternal oxide
#

you have to assign final fields at creation

timid jetty
#

Hey so I'm working on a cooldown system where each Player current has a hashmap of Cooldowns. I'm wondering if there is any benefit to doing this with a hashmap instead of just using a sorted array/arraylist

smoky oak
#

iirc hashmap has faster o(n) times but im not sure

buoyant viper
#

something something javas hashmap uses a bucket that makes it go zoom

#

idr

round finch
#

m2/repository/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-SNAPSHOT-javadoc.jar!/org/bukkit/plugin/PluginManager.html#registerEvents(org.bukkit.event.Listener,org.bukkit.plugin.Plugin)

buoyant viper
#

someone like frostalf or 7smile7 probably know

round finch
#

How do i make it show spigot doc info

#

in ecplise

eternal oxide
#

if using maven don;t set any of it yourself

#

there is a single tick box to download javadocs/source

onyx fjord
#
    @EventHandler
    public void onLogin(PlayerLoginEvent event) {
        PacketPlayer packetPlayer = new PacketPlayer(event.getPlayer());

        Bukkit.getScheduler().runTaskLater(instance, () -> {


            announceConfigMessageWithPerms("messages.join",
                    "clientcontroller.admin",
                    Pair.of("{player}", packetPlayer.getEntity().getName()),
                    Pair.of("{clientName}", packetPlayer.getClientBrand()));

        }, 1);
    }
#

apparently packetPlayer.getClientBrand is null

#

:/

round finch
#

how to improve that magic trick

timid jetty
round finch
#

there is no download button for doc

eternal oxide
onyx fjord
#

w7?

eternal oxide
#

yes

onyx fjord
#

decoration buttons dont seem w7 style tho

#

i dont remember them like this

eternal oxide
#

No, I have it set mostly to legacy

#

Mostly Basic, no Aero

#

I like it simple

onyx fjord
smoky oak
#

Elgar do u know if a particle that can be colored can have its movement set?

eternal oxide
#

Particle animations are baked in. They can be given a randomness is all

onyx fjord
#

and speed

eternal oxide
#

if you want to move a particle you have to simulate its movement by spawnign more.

smoky oak
#

well yea how would i set that speed on a colorable particle

#

like

#

the arguments are particle, location, <something weird to do with color>, r/g/b, T

round finch
eternal oxide
#

Did you remove all your settings you added yourself?

#

If so, right click yoru pom and Update project

#

right click pom -> Maven -> update project

round finch
#

?paste

undone axleBOT
round finch
#

here is my mess of a pom

#

yes i'm a maven noob

smoky oak
#

or their speed

eternal oxide
#

you set teh flot values to 0

smoky oak
#

what float values

eternal oxide
#

use teh spawn method that takes a lot of args

eternal oxide
#

however, if you have manually added to teh classpath you may have to edit your .classpath file

smoky oak
#

i only have double values in my spawn function args

eternal oxide
#

yes those

smoky oak
#

yea theyre color

#

and location

#

not randomness

#

or speed

eternal oxide
#

location is where it spawns.

#

teh double (usually) are the randomness

eternal oxide
#

?paste

undone axleBOT
smoky oak
#

block.getWorld().spawnParticle(Particle.SPELL_MOB,loc,0,1,0,0,1);

#

changing the first or last value messes up the color

#

the other three are color

#

and the only other possible argument is T

eternal oxide
iron glade
round finch
#

still nothing showing

eternal oxide
#

is your classpath clean?

#

that really messes eclipse up

iron glade
#

eclipse

round finch
#

before it would work

#

now i'm trying alot

eternal oxide
#

do the update again and be sure you ticked to update snapshots

#

force update

#

that makes it refresh teh source/javadocs

red sedge
#

is there anyway to pop 1 character from the start of the string

buoyant viper
#

substring ?

#

@red sedge

red sedge
#

kk

buoyant viper
#

"hello world".substring(1) == "ello world"

round finch
#

i'm litterally gonna freaking yet this ecplise

#

and redownload

round finch
eternal oxide
#

you know the simplest way, create a fresh project

#

get it going with just Spigot and javadocs working

#

then add yoru other shit

round finch
#

i could make a new project

#

with simple pom

#

to test

eternal oxide
#

yep

round finch
#

if it still doesn't work i'm gonna get a newer ecplise

#

it could be broken

eternal oxide
#

upgrade anyway. newer eclipse is faster

#

It is for me

#

I run two. the new is so slick

round finch
#

alright deletes this ecplise

round finch
eternal oxide
#

java dev

round finch
red sedge
#

How will i do smth like
send "Accept | Deny" to the player
if they click accept in the chat run this command if they click deny run this command

#

but like

#

both of them being in the same message

smoky oak
#

iirc u can link actions to chat messages or check where a message was clicked

#

dont recall how tho

opal juniper
#

use components and hover events / click events

#

part of the md_5 chat api

red sedge
#

Yeah but how do I make it so there are multiple of them in one message

iron glade
tardy delta
#

Componentbuilder

red sedge
#
int id = 0;
for (String string : options) {
    System.out.println(string + id)
}
for (int i = 0; i < options.lenght; i++) {
    System.out.println(options[i] + id)
}

which one is more readable?

red sedge
round finch
iron glade
#

Anyone here happens to know how essentials' /back command works?

round finch
#

also learning a new idea ehhh

eternal oxide
#

Yeah I love my Eclipse

#

write it correctly in your onEnable and onDisable that you can call them to perform a reload

#

initialize everything your plugin uses

#

and in onDisable you clear everything

twilit roost
#

how to get rid of this screen?

#

me irl about to die
me: e.setCanceled(true);
ez claps

#

thx tho

#

i dont think so

red sedge
#

if i do
player.getLocation()
will it constantly update with the player or do i need to clone to location for it to not update

tall dragon
#

it will update with the player obviously. just keep it in a variable if you want to keep one

red sedge
#

so like

#

Location x = player.getLocation()

#

will x update?

chrome beacon
#

You're asking if it's mutable

#

Looks like they are

red sedge
#

No i'm not asking if its mutable

chrome beacon
#

Not sure how the implementation handles things but i would clone it

tall dragon
#

x will not update

red sedge
#

great

onyx fjord
#

wait is broadcast not thread safe?

#

i just saw comment in someones code saying it wtf

undone axleBOT
red sedge
#

you dont need to cast this to plugin

iron glade
#

ye, u can't re-enable it by yourself tho iirc

red sedge
iron glade
#

why don't just make a custom reload method that re-initializes all your stuff?

red sedge
#

just tell people to not use /reload

#

what are you trying to do?

#

cuz i dont think youre trying to reload the entire plugin

#

Yep thats it

iron glade
#

do you want to "update" variables from config stuff?

red sedge
#

just reload the config

#

if youre using the built in configration thing

#

just do

#

reloadConfig iirc

#

Reload the custom items aswell

iron glade
#

show some code of how you set the item name, etc

red sedge
#

yeah you need to re-initialise the custom items for it to take affect

#

unless the items are constnatly reading from the config

#

also the item name will not update

#

yep

#

the item wont update

iron glade
#

yep have to re-init

red sedge
#

unless you set the item in the players inventory to the new item

#

you most likely need to have an id system for every item

#

and have all custom items contain an nbt value with their id

#

so you can update the item to the new form by looking at its id

smoky oak
#

whats the string to grab a FIS from src/main/resources via JavaPlugin#getResource

red sedge
#

eitherway you need to do that

#

i just explained-

#

ok

#

heres a simple more put together explanation anyways

civic apex
#

is World#getPlayers() supposed to also return dead players?

red sedge
#
  1. load the items from the config and put them in a hashmap as ID and ITEMSTACK so it would be like HashMap<String, ItemStack> make sure the itemstack has a nbt data that contains its id
  2. when you run reloadConfig reload the items aka exectue the method you made for step 1
  3. loop thru each players inventory and check their items nbt data, if the id of their item matches the hashmap, remove that item frm the players inventory and add the new item from the hashmap
#

i dont think it gets much simples than that

#

you can use the yaml keys for the ids

#

the "re-init" is the 2nd step

molten hearth
#

IJ question here, how the fuck do I create folders in the right place when IJ collapses them

#

I have folder1.folder2 and if I right click and create it makes folder1.folder2.folder3 and if I want folder4 its gonna do ``folder1.folder2.folder3.folder4` even if I right click folder3 cause its not collapsible

#

I tried creating a folder called folder1.folder2.folder4 and it just made one literally called that

#
- folder 1
  - folder 2
    - folder 3
    - folder 4``` is the setup im tryna have
red sedge
#

might be wrong but it just reloads a plugin, but eitherway you DONT want that

iron glade
#

In case you don't care about updating the "old" item in players' inventory you could do smth like

//some class that handles all your item stacks

private ItemStack someItem;

public void initItems() {
someItem = new ItemStack(Material.Whatever);
ItemMeta someItemMeta = someItem.getItemMeta();
//set display name, etc from config
}

public ItemStack getSomeItem() {
return this.someItem;
}

could be one approach I guess

red sedge
#

because it wont do what you think it will

iron glade
#

That wouldn't change items that already are in player inventories though

iron glade
red sedge
#

cant wait for you to come back abotu updating the players inventory

red sedge
#

well you'd need to change it based on how your items are set up

#

but thatsthe gist

iron glade
#

^

red sedge
#

in that case you'd just

#

return this.Recomb

#

in a different method-

tardy delta
#

naming coventions pls

floral drum
iron glade
#

without calling the init method again this would just return the old item

valid sorrel
#
PacketContainer packet = event.getPacket();
JSONObject jsonPing = new JSONObject(packet.getServerPings().read(0).toJson());
jsonPing.put("asdf", true);
packet.getServerPings().write(0, WrappedServerPing.fromJson(jsonPing.toString()));
System.out.println(packet.getServerPings().read(0).toJson()); // to debug

anyone know why this doesn't work? I'm using protocollib and whatever I do it doesn't have the asdf in the response json also it's a server list ping packet sending if you need that info

onyx fjord
#

whats the reason ppl use lombok

iron glade
#

laziness idk

red sedge
#

its easy

floral drum
onyx fjord
#

how are getters and setters difficult

red sedge
#

and im stupid

floral drum
#

but the only useful thing I found is

#

SneakyThrows

red sedge
#

i dont like it

iron glade
#

Usually I don't mind seeing all my setters and getters etc

red sedge
#

gets overwhelming

onyx fjord
#

wait is lombok in maven central?

drowsy helm
onyx fjord
#

W

#

i can just exclude it from dep and load it on server

valid sorrel
#

server list ping packet help

glossy venture
#

its pretty easy to upload to mvn central its epic

round finch
#

trying to use intellij
not going well

#

why did ecplise have to fail me with spigot doc

red sedge
#

I dont want to pop your spirit but maybe you should consider easier projects before this,
since it seems like youre missing basic java knowledge as well

onyx fjord
#

i wish all my deps were on maven central

#

i could have megabytes saved in jar

round finch
#

how do i run maven in intellij

onyx fjord
#

thanks to spigot

iron glade
round finch
#

yes

drowsy helm
onyx fjord
#

it should be on right side of screen

buoyant viper
drowsy helm
#

if not create a maven project

iron glade
#

good decision honestly

buoyant viper
#

normally hate looking at my own code

round finch
#

bruh how to run maven file

drowsy helm
#

top right

#

big m

buoyant viper
#

./mvn package

#

ezpz

onyx fjord
#

mvn uninstol

buoyant viper
#

wait this isnt gradle theres no local wrapper

iron glade
#

So the basic idea we mentioned is that you have a class handling your item stacks, you save them into variables which are "re-initialized" and you can access

onyx fjord
#

windows users must have bad time with maven

buoyant viper
#

u just put it in ur path?

onyx fjord
#

no package manager

onyx fjord
drowsy helm
#

maven is easy on windows

tardy delta
#

maven good

onyx fjord
#

even i did

drowsy helm
#

wym

tardy delta
#

gradle be like having thousand files for whatever reason

onyx fjord
#

skill issue

tardy delta
#

xml makes sense atleast

buoyant viper
#

then they should learn how to do trivial tasks

onyx fjord
molten hearth
#

suii

round finch
onyx fjord
#

on hdd

round finch
#

how i run pom

drowsy helm
#

top right

#

big m

onyx fjord
#

expand deez

tardy delta
#

fuuuuuck

drowsy helm
tardy delta
#

lets store another int field to hold the comma position smh

onyx fjord
#

i doit like this

#

for maven too

tardy delta
#

i do double shift and type mvn package lol

drowsy helm
#

wait you can do that

tardy delta
#

sometimes click on the green button too

glossy venture
round finch
glossy venture
#

you can apply them to all modules

#

to share code

tardy delta
#

actually double ctrl

onyx fjord
tardy delta
drowsy helm
#

enhance

iron glade
#

been clicking on this

onyx fjord
#

same

#

seweyy

#

i also have easy gradle

#

2 kill daemon

iron glade
#

I should make some shortcut to that though

glossy venture
onyx fjord
#

or

drowsy helm
#

man i've got 5 modules left to do

#

i really cbf coding

onyx fjord
#

ima cool chicken popcorn

drowsy helm
#

why didnt i just pick up drugs as a hobby

#

instead of programming

onyx fjord
#

with spicy sweet chilli sauce

#

and chef special fry seasoning

drowsy helm
#

chicken popcorn?

onyx fjord
#

50% less salt than salt

drowsy helm
#

like chicken flavoured popcorn

#

?

onyx fjord
#

no

tardy delta
onyx fjord
#

chicken but balls

#

💀

iron glade
onyx fjord
#

it looks like popcorn but 15 times bigger

drowsy helm
#

ooh

#

popcorn chicken

onyx fjord
#

kfc call it like dat i think

#

ive been 2 kfc once

iron glade
#

switch p and c from popcorn hehe

onyx fjord
#

was meh

#

mcdonalds fries beat theirs

drowsy helm
#

what country?

onyx fjord
#

easily

#

poland

drowsy helm
#

australia kfc is real good

onyx fjord
#

shakes are good

#

but fries suck

#

i make better myself

drowsy helm
#

depends

#

i really like soggy chips tbh

onyx fjord
#

soggy what

drowsy helm
#

chips

#

chippies

onyx fjord
#

lays?

drowsy helm
#

chips

#

chips = fries

#

chips = chips

onyx fjord
#

oh

drowsy helm
#

ez

onyx fjord
#

my fries say theyre fries tho

#

and lays say "chipsy"

drowsy helm
#

chipsy?

iron glade
#

aren't british people calling fries chips

onyx fjord
#

chipsy is few chips

#

or we call them ciperki

drowsy helm
#

yeah

reef lagoon
#

is there a method for dying leather horse armor

drowsy helm
#

and australians

onyx fjord
#

fix ur language

iron glade
drowsy helm
onyx fjord
#

we call fries frytki

young knoll
#

Chips are the bigger fries

onyx fjord
#

our lang is def older than english american

iron glade
#

Chips in germany is that

#

btw those are the best ones in germany

reef lagoon
#

oh special meta

#

ty

drowsy helm
#

yeah we call both chips

round finch
#

bag in finnish

glossy venture
#

armor

drowsy helm
#

fries, and crisps

reef lagoon
#

yall go off topic as fuck here

iron glade
#

that's normal

drowsy helm
#

welcome to spigot discord

iron glade
#

this is like the real general channel

reef lagoon
#

bruh xd

drowsy helm
#

general chat minus the annoying people

round finch
onyx fjord
drowsy helm
#

what flavour is that

#

dill?

onyx fjord
#

are you guys aware if i can post someones library onto maven repo or nah

drowsy helm
obsidian drift
#

Is there a way to prevent the recipe book from opening when clicked?

drowsy helm
#

looks like someone just smashed their keyboard

iron glade
#

foreign food always hitting different ngl

round finch
#

Finnish chip bag

onyx fjord
# drowsy helm

new better ingridients

with sunflower oil

no preservatives (bruh)

from polish potatoes

iron glade
drowsy helm
onyx fjord
#

yes its dill btw

#

theres also butter + salt

#

actual butter, not what you put on bread

drowsy helm
#

you dont put butter on bread?

onyx fjord
round finch
drowsy helm
#

i put real butter on bread

#

lol

obsidian drift
onyx fjord
#

i know for example in US cheese you put on burgers is not real cheese

drowsy helm
onyx fjord
#

at least it doesnt taste as one

drowsy helm
#

its completely client sided

#

no packet gets sent at all

iron glade
#

guys from which country was best salami you ever ate?

onyx fjord
obsidian drift
#

ServerboundRecipeBookChangeSettingsPacket is sent when the player opens it

#

I just need to close it after that

drowsy helm
#

oh it does too

#

damn

obsidian drift
#

I'm trying to make it so when they click it, it opens up another inventory. This works as expected, but when they open the crafting table again the recipe book is open still...

onyx fjord
#

you can close it

#

thats for sure

#

according to this at least

#

first boolean

drowsy helm
#

if you guys ever go to australia

#

get a HSP

#

what are you trying to do?

#

a void can't return an object

onyx fjord
#

dude thats fucking shoarma

drowsy helm
#

its very good tho

#

type of shit oyu buy on a night out when you are drunk

#

like any existing item?

tardy delta
#

?learnjava

undone axleBOT
onyx fjord
young knoll
onyx fjord
#

from turkish guy

onyx fjord
young knoll
#

Sent from client to server

#

Not server to client

gray merlin
#

Uhhh I tried to upload my plugin and this happened

iron glade
#

Feel free to Dm me so I can explain

gray merlin
#

Do I just put it as an external download then?

drowsy helm
#

yep

gray merlin
#

Existence is pain

drowsy helm
#

whats even in the plugin that exceeds 4mb lol

iron glade
gray merlin
#

10.8MB

drowsy helm
#

wtf

#

are you shading the whole spigot jar

#

my 14k+ loc project with multiple shades is like 3.4mb

gray merlin
#

Oh, are we not supposed to?

drowsy helm
#

no lol

gray merlin
#

Oh.

#

Oh.

drowsy helm
#

lmao

gray merlin
#

Oh.

drowsy helm
#

its provided at runtime

gray merlin
#

Yep now it's 39KB

#

😅

drowsy helm
#

lel

iron glade
#

.............

rapid cargo
#

Hey guys. Is it possible to get a minecart to act like a boat in lava?

lilac dagger
#

How do I target a reshaded library as a dependency in maven?

chrome beacon
#

Wdym?

lilac dagger
#

i changed its path

#

and now it targets what should've been before reshade

#

the gameengine has been reshaded

chrome beacon
#

You mean relocate?

drowsy helm
#

wdym by reshade?

lilac dagger
#

yeah, relocate

#

i relocated the dependency

#

but the new project doesn't know it

chrome beacon
#

Could you show your pom?

#

Ah wait you're depending on it

lilac dagger
#

there are multiple poms

#

the one of the error?

#

or the one that relocates

chrome beacon
#

Basically when importing the class you need to import the one from your relocated package

lilac dagger
#

but that's what I'm trying to figure out

#

this is the relocation

#

and this is of the other module that targets the aforementioned pom

chrome beacon
#

And that's the pom of the project that causes CNF

#

?

lilac dagger
#

yeah

#

the last screenshot

#

it should see the relocation right?

#

or am I wrong?

chrome beacon
#

Hm try removing the last . From the pattern

lilac dagger
#

it'll just make a mess of folders

chrome beacon
#

?

lilac dagger
#

wouldn't it add a prefix to all of these?

chrome beacon
#

Prefixes?

lilac dagger
#

yea

#

plus it wouldn't solve my issue

#

it should be gameenginetester

#

i don't understand maven

quiet ice
#

In your dependent project you could use the shade plugin again to relocate it I believe

lilac dagger
#

i don't think it should be necessary

onyx fjord
#

wat might that be

quiet ice
#

(however by setting it to the provided scope you don't actually shade it in - you just remap the usages)

onyx fjord
#

console shows it properly

lilac dagger
#

worth a try

#

but it's kinda ugly

quiet ice
#

Alternatively you could depend on the shaded jar (and exclude the shaded-in dependency), but that is a bit whack too

lilac dagger
#

it worked

red sedge
#

in a nested for loop, if i but break at the 2nd nest, will it break the whole loop, or just the 2nd nest

#

so like

#
for (int i = 0; i < 5; i++) {
  for (int j = 0; j < 5; i++) {
     break;
  }
}```
tardy delta
#

whole iirc

lilac dagger
#

just the 2nd

#

if you wanna break both label the first loop like this:
labelA: for (

#

and then break labelA;

red sedge
#

i jus want to break the 2nd one

lilac dagger
#

then don't label it

#

yours will work

red sedge
#

okay

lilac dagger
#

add an if or something

#

otherwise it wouldn't do whatever you want it to do in the sec loop

red sedge
#

ye no it ws just for exmaple

onyx fjord
#

do you guys know what might use U+001F ?