#help-development

1 messages · Page 819 of 1

worldly ingot
#

Block is purely a Bukkit concept

river oracle
#

do they not? I thought they did well not the blocks themselves but their states

worldly ingot
#

Well that's just it. Bukkit's Block is essentially a wrapper around a position that fetches from the world

#

but like you can have more than one instance of Block whereas that's not the case in server internals

#

The server stores everything about a block just as a single integer 👀

river oracle
carmine mica
#

that's not included block entities

river oracle
#

well cramming everything into 32 bits seems

worldly ingot
#

Bukkit's BlockData is analogous to NMS's block states

river oracle
#

oh okay

worldly ingot
#

Those are stored separately lol

river oracle
#

I was about to be like wtf

young knoll
#

It’s just a big map of states iirc

cinder karma
#

If a player smacks an armor stand with a knockback weapon, is there a way to detect when the stand stops moving? Off the top of my head, I could theoretically use a BukkitTask and check every tick if the armor stand moved, and when it goes 2 ticks without moving, it's stopped? There's not an event for armor stand movement?

eternal oxide
#

no event

wet breach
#

If not, just use a task to check its position. Should be able to utilize pdc to store position for this. Then its a matter of checking its recorded position with current position

young knoll
#

There’s no entity move event

quaint mantle
#

how do i see if a shield has a banner on it

wet breach
river oracle
#

Frost have you ever contributed to CB? Weren't you a forums mod or something back in the day

wet breach
#

Basically i got to approve or reject project pages and check jars that were submitted lol

river oracle
#

Ahhh

wet breach
#

I did try to contribute to CB but evilseph and wolve both rejected my ideas before i could submit them as prs and so i never bothered to try and contribute after that.

river oracle
#

Ahhh

river oracle
#

Tho it'd be a very hot event

wet breach
#

And if so, havent checked, then its just utilizing what is already there

river oracle
river oracle
wet breach
#

I could try. I hate messing with patches though

#

In fact might need to restructure api though

river oracle
wet breach
#

Make a generic move event that player and entity extends from.

river oracle
#

Spigot is where it gets weird imho

wet breach
#

Lol

river oracle
#

I can't imagine further forks

#

Since you're now 3 patch levels up

wet breach
#

Or should there just be entity move event and player extends from that?

#

I guess it dont matter and someone else can fix it lol

river oracle
wet breach
#

Well typically when we have two events like this they either extend a generic event or player extends from the entity

river oracle
#

feel like this is a get it down figure it out later type of thing xD ¯_(ツ)_/¯

wet breach
#

Lol that is why i said i guess someone else can fix it later

river oracle
#

I'd say if you don't plan in doing it make a jira issue and someone will prob get to it

wet breach
#

I think the better approach is the generic event since neither of the events come from the same place

river oracle
#

Yeah probs

glad prawn
#

Why ConfigurationSection.getValues instead of getMap

old cloud
#

Hello, BukkitScheduler#runTaskTimer will run in the main thread right? So if i have a queue of tasks to be executed in a specific interval, there should not be any problems if I add or remove Elements to/from that queue, as Long as its always done in the main thread as well, right?

minor junco
old cloud
#

Like i just wanna know if my theory is correct that there cant be parallel Access to the queue when adding, removing and polling is all done in the Same thread which would mean that the normal task Timer is always being executed in the main Thread as well

ivory sleet
#

Meaning its all single threaded

#

So yes its fine w whatever unthread safe data structure u may have

#

completely different if you start using runTaskTimerAsync

old cloud
#

Yeah okay. To ensure that my methods are only called on the Main thread, can i cache it on startup with Thread#currentThread and then compare it on each method call or is there a better way achieving this? @ivory sleet

ivory sleet
#

There is a better way

#

But why go through all this?

hoary spire
#

Does anybody know, i need add which librarys for proguard? I think spigotmc and spigot api 1.18.2 but i dont know i can download they in where

ivory sleet
old cloud
ivory sleet
#

all methods can be invoked async by default

#

Does that mean we should take precautions as a means of reassurance?

#

No

rotund ravine
#

Just write big ass bold letters in the documentation that it is a nono

ivory sleet
#

if something by nature becomes exposed to concurrent modifications, then by all means add necessary thread safety

#

Otherwise just let it be

rotund ravine
#

Build spigot 1.18 with buildtools

#

Also proguard is an obfuscator

old cloud
ivory sleet
#

ah I see

#

So there is a possibility another thread interacts with the queue?

hoary spire
old cloud
hoary spire
ivory sleet
ivory sleet
#

Then don’t take any thread safety precautions

#

I mean sure if you write an api for the entire world to consume, and the api becomes very large, having small checks here and there can be reasonable

#

But in your case, dont do that

old cloud
ivory sleet
#

You know exactly which parts if your program that will be interacted by multiple threads

ivory sleet
old cloud
#

Yeah, maybe im thinking too much like „what could happen if someone will use that Class in the future“

ivory sleet
#

i mean you can state something like in the javadocs of that class that the underlying queue is not by default thread safe

old cloud
#

Yes, I will do that. Thankyou for the help and the advice 👍

ivory sleet
#

Awesome :)

ivory sleet
#

Usually we try to identify early on what resources will be exposed to a concurrent environment, such that we can properly plan our design around that

old cloud
#

Yeah I mean I knew that i would Never Need to access the thing async, but i was really Like thinking of other ppl
But I think a Note in my docs is a good compromise

formal vector
#

prob not

minor junco
#

anyone knows here how I can remove this?

ivory sleet
#

some ItemFlag right?

minor junco
#

nah

remote swallow
#

probably potion effects

minor junco
#

u reckon

#

imma give it a try sec

#

didn't work

#
      this.itemBuilder = ItemBuilder
          .builder(Material.LEATHER_BOOTS)
          .modify((meta) -> ((LeatherArmorMeta) meta).setColor(team.getTeamEnum().getColor()))
          .name(team.getTeamEnum().getChatColor().toString() + ChatColor.BOLD
              + Language.getInstance().getTeamName(team.getTeamEnum()))
          .flags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_POTION_EFFECTS);

I tried these flags

ivory sleet
#

Try all of them

remote swallow
#

i mean

#

it might be this one

ivory sleet
#

Yeah

#

lol

minor junco
#

huh

#

is that a special item flag?

remote swallow
#

shouldnt be

minor junco
#

like I am not able to see HIDE_DYE

#

for 1.14

remote swallow
#

oh yeah its not in 1.14

minor junco
#

yeah i should've mentioned that I am using 1.14

remote swallow
#

it was added earlier this year

minor junco
#

damn

#

any idea how I could remove it manually in 1.14?

remote swallow
#

probably nms

minor junco
#

mhn okay

kindred valley
#

i made a json file using blockbench with custom model data but its not my model when i give it to myself on game

#

@remote swallow i remember u know about textures

remote swallow
#

no clue

kindred valley
#

have u used blockbench

remote swallow
#

yeah

#

never figured out how it worked properly though

kindred valley
#

i made a block model there then i put custom model data on andesite's json file with model of the block i made on blockbench but somehow model is not chaning

winter galleon
#

hi! i need help, is there a way to check if player can break? using worlguard api

quaint mantle
#

and set prior to lowest

rotund ravine
#

So it runs first??

quaint mantle
#

Wdym

rotund ravine
#

Lowest priority runs first

quaint mantle
#

Ehh highest then

#

Why lowest run first?

rotund ravine
#

Cause it’s lowest priority

quaint mantle
#

It makes no sense to me

dry crater
#

only the last change to the event actually changes it so it is

winter galleon
rotund ravine
#

Ask on worldguard discord

winter galleon
#

okay ty

zealous osprey
#

Heya, I could need some help :)
I want to get the next X amount of chunks in the direction the player is facing. For this, I've implemented Bresenham's line drawing algorithm. However, I get a, somewhat, incorrect result.
The first image depicts a line being drawn from the centre of the chunk, this normally works fairly well.
The second image depicts a line being drawn from the edge of the chunk, this is pretty much always incorrect.
In both instances, the yellow square depicts a chunk which is not considered by the algorithm. This is very annoying since it is paramount that all chunks are considered when the line passes.
For reference: The blue squares are the chunks correctly calculated by the algo and the black squares are just radii around the centre chunk.

Here's the code which I now have:

        final List<int[]> result = new LinkedList<>();

        final Location clone = loc.clone().multiply(1 / 16f);
        clone.add(clone.getDirection().multiply(distance));

        double x0 = (loc.getX() / 16), z0 = (loc.getZ() / 16);
        double x1 = clone.getX(), z1 = clone.getZ();

        double dx = x1 - x0;
        double dz = z1 - z0;

        int steps;
        if (Math.abs(dx) >= Math.abs(dz))   steps = (int) Math.abs(dx);
        else                                steps = (int) Math.abs(dz);

        double xIncrement = dx / steps;
        double yIncrement = dz / steps;

        double x = x0;
        double z = z0;

        for (int i = 0; i <= steps; i++) {
            result.add(new int[] {((int) Math.round(x)), ((int) Math.round(z)) });
            x += xIncrement;
            z += yIncrement;
        }

        return result;
    } ```

The part: final Location clone = loc.clone().multiply(1 / 16f); just ensures that the chunks are viewed as a 1x1 pixel, instead of 16x16.

ivory sleet
icy beacon
ivory sleet
#

soz lol

icy beacon
#

😛

slate tinsel
#

I have installed BuildTools, but how do you now change so that you can see the code as not obfuscated? So you kind of have to change

<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>

Or something to make it work

remote swallow
#

?nms

slate tinsel
#

that was the website I started from but didn't quite understand what to do after installing the build tools

remote swallow
#

modify ur pom

slate tinsel
#

Yes, I have done that as well, but is there a connection needed between builds tools and pom.xml?

remote swallow
#

add everything it shows updating any 1.18.2 to whatever version your on eg 1.20.2

remote swallow
zealous osprey
eternal night
#

I had it partially

#

It's just super ugly with the registry

slate tinsel
eternal night
#

I mean, as ugly as now

#

But I wasn't happy and then uni clapped me

remote swallow
undone axleBOT
remote swallow
#

?servcies @noble adder

#

?services

undone axleBOT
remote swallow
#

you dont have the classifier

slate tinsel
remote swallow
slate tinsel
#

Yes that was what command i run

remote swallow
#

did it complete fully and create spigot-1.20.2.jar in the same folder as the buildtools.jar

#

if anything you ran buildtools for 1.20.2 instead of buildtools for 1.19.4

#

when you need remapped for 1.19.4

wet breach
#

or they used the incorrect jar

#

IE, ran for the correct version but wrong jar used lol

remote swallow
#

well if net.minecraft stops existing when adding the classifier and they say called type server 1.20.2 im gonna guess it was ran for 1.20.2 accidentally

slate tinsel
#

If I download builds tools for 1.19.4 and my plugin should support 1.20.2 - 1.19.4 how can I do?

Also if I use nms and basically my plugin is a "Spigot plugin" does it also work for paper servers?

remote swallow
#

if you need to support multiple versions with nms you either have to use reflection or you need mutlimodule

#

and it should work with paper untill they stop relocating craftbukkit and you then need spigot nms modules and a paper nms module which doesnt really work on maven

shadow night
#

Yo guys, I've seen that you can generate three different kind of jars, jars with your program, plugin, whatever, jar with javadoc and a jar with sources. What are these sources?

austere cove
#

The source code

shadow night
#

Oh

austere cove
#

And you can make your own package qualifiers

#

Javadoc and sources are required for maven central, and are used by your ide for example when looking through a dependency's code

shadow night
#

Interesting

wet breach
hoary spire
#

Do you know i can found bukkit lib 1.18.2 for proguard in where

remote swallow
#

proguard is just for generic java apps not specifically spigot

rotund ravine
#

^

#

Which is why i said proguard was an obfuscator. It doesn’t need any spigot libs

wet breach
#

proguard or any other obfuscator is mostly useless to use for java anyways. Exception is if you need some weird hack optimizations that some obfuscators can provide but like its neglibile that I doubt any plugin would ever come to a point in requiring such things

quaint mantle
remote swallow
#

takes like 2 seconds for me to open recaf

icy beacon
#

Can I somehow listen to region creation with Worldguard API?

#

I also asked on the EngineHub server but perhaps somebody here knows the answer as well

hoary spire
hoary spire
remote swallow
#

so add the required maven plugins to obsfucate

hoary spire
remote swallow
proud badge
#

what would be better for saving lets say for example: player sethomes

Json or yml?

south mason
#

json i think

icy beacon
proud badge
#

Would it not be extremely laggy if I have hundreds of player sethomes?

icy beacon
#

If you load them at startup, then it shouldn't be

#

Or if you load them on demand

chrome beacon
#

You can have more than one file to avoid loading it all at once

icy beacon
#

Like when a player joins

thin iris
#

how do i get the block a player is looking at

icy beacon
thin iris
#

shudders

proud badge
#

I assume I have to load the file async or something

thin iris
#

i dont know how to use raytracing

proud badge
#

to not cause lag

icy beacon
proud badge
#

Right now I'm thinking of the best way to migrate my playerdata from skript to java - and the best solution that I came up with so far is to load it all into a json file, and then put it in my java plugin

icy beacon
#

That's basically it

young knoll
#

Pretty sure you can go even simpler

#

Player.getTargetBlock

icy beacon
#

Oh, taht's a thing?

#

Good to know xD

thin iris
#

isnt that really dated though

#

does it still work

young knoll
#

Don’t see why not

#

Internally I assume it just does the raytrace for you

icy beacon
#

Can I listen to region creation with Worldguard API?

thin iris
icy beacon
#

Yeah

#

But Coll's suggestion is easier to use

#

Only one null check is needed

thin iris
#

alr

#

how do u increment a crops growth stage btw

#

?paste

undone axleBOT
young knoll
#

BlockData

thin iris
young knoll
#

Specifically ageable

thin iris
#

ohh

hoary spire
thin iris
#

i was doing block instanceof Ageable

#

instead of blockdata

#

yay it worked

#

thank u all

hoary spire
#
Warning: there were 268682 unresolved references to classes or interfaces.               [proguard]          You may need to add missing library jars or update their versions.              [proguard]          If your code works fine without the missing classes, you can suppress           [proguard]          the warnings with '-dontwarn' options.                                          [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)   [proguard] Warning: there were 422 unresolved references to program class members.                  [proguard]          Your input classes appear to be inconsistent.                                   [proguard]          You may need to recompile the code.                                             [proguard]          (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)                                        [proguard] Unexpected error                       [proguard] java.io.IOException: Please correct the above warnings first.```
lost matrix
# hoary spire It dont worked. it gaves error

I would honestly not bother with obfuscating your code. 99.9% of the code for spigot plugins is not worth obfuscating. And
it just makes your life harder when it comes to supporting your plugin.

lost matrix
hoary spire
#

I want to obf my code. Do you know anything?

hoary spire
lost matrix
hoary spire
#

Idk. I said. Im planning do it pl advanced. Thats why i want obf it

dry hazel
#

the error gives advice for fixing it

#

proguard is not something you can just plug in and go, you actually have to configure it beforehand

icy beacon
#

As smile mentioned, the user might not even have access to your jar

#

So you're obfuscating just to make a point

lost matrix
#

There is nothing advanced about obfuscating... But your go ahead and do you.
Disable minimizing from proguard and try again.

icy beacon
#

That your project is complex and cool and complex

#

And hard to debug

hoary spire
#

sad

wet breach
#

however there is only one way to create a region and that is with a command

#

well aside from a plugin using the api to do it

#

but there is no event for that

icy beacon
#

The only way I can do it is by listening to the command preprocess event which I'd rather die

#

So I'm contacting the dude who's commissioning me to see if an alternate solution is possible

hoary spire
icy beacon
#

If I really want to copy your code I'll spend a bit of time deobfing it.

wet breach
eternal oxide
#

You don;t have code which anyone will want to copy.

icy beacon
#

All the code in the existence of coding is copied from somebody lol

#

You're implying that you're going to be writing the most unique project ever

wet breach
#

however copying isn't really the issue, second it isn't necessary to deobfuscate to copy code either

#

obfuscation only changes the method, variable and class names

#

not how the actuall code works

eternal oxide
#

Theres only one reason to obfuscate and thats to maintain a copyright.

hoary spire
#

Im not a best

icy beacon
wet breach
#

anyone who has code worth copying that they don't want copied typically don't release such code to the public to begin with

hoary spire
wet breach
#

they could still copy and paste as I explained above

#

obfuscation doesn't change how the code works

icy beacon
#

if they have no knowledge of coding then copying and pasting a couple snippets will do nothing lol

#

Because they have no idea how to chain those snippets into a functioning program

#

And the only way that they can copy your code into a working program is, well

#

By copying your jar

#

Which you cannot prevent if you're distributing it

wet breach
#

you are really overthinking this

icy beacon
wet breach
#

and worrying about nothing

icy beacon
#

They don't need to copy your code

#

Because they will, allegedly, learn easily

#

And thus be able to code by themselves

#

Question to you: if you have a problem while coding that you can't resolve, do you go and ask somebody for help, or do you decompile jars and take code from there to solve your problem?

hoary spire
#

Im trying to mean pom, file ways and plugin.yml.

icy beacon
#

Why would literally anybody copy your pom or plugin.yml

#

That's literally the dumbest thing to copy and the easiest thing to understand

hoary spire
#

no no.

icy beacon
hoary spire
icy beacon
#

Please use a translating service I do not understand what you're trying to say

hoary spire
#

That mean both

icy beacon
#

Well that is highly weird

#

If I would assume that like 0.5% of the people here decompile jars to solve their problem I'd probably be overexaggerating accidentally

#

You need to get familiar with the codebase, find the snippet that you need, and understand how to integrate it into your code

#

Why would ANYONE go through that instead of looking up their problem or asking on the forums

#

Think of it. I'm out of this discussion. Obfuscate your code if you want, it will do absolutely nothing but waste your time

hoary spire
eternal oxide
#

^ nonsense. English but not.

hoary spire
#

Yea. Some.

#

I think i need learn english 💀

#

the part I know doesn't seem to be enough lol

wet breach
round finch
#

your sentence is confusing TheRoborkedi

hoary spire
round finch
#

yamlconfiguration isn't too hard to learn

hoary spire
#

I know

#

And im using alr

round finch
#

whats alr?

#

You mean.. You're using yamlconfiguration, alr `?

hoary spire
#

Yea im using yamlconfiguration

icy beacon
hoary spire
round finch
#

😵‍💫

icy beacon
#

for future reference

round finch
#

i have seen people use alr for alright

hoary spire
#

._.

remote swallow
shadow night
#

Yes

remote swallow
#

if its just alr its prob alright if ifts got stuff before its probably already

round finch
icy beacon
remote swallow
#

makes sense

grim hound
#

I'm injecting the player's channel handler using raw nms. But in 1.20.2 my NetworkManager field search in the PlayerConnection class returned that there is no field like that. Help

glossy venture
#

anyone know why the fuck it says its always 1 or higher

#

oh nvm

#

div has priority

#

ofc

#

sht

minor junco
#

Yup was about to say

#

Operator precedence

worldly ingot
#

Oh, wow, that's niche. I was wondering what operator precedence had to do with anything but I guess if it was zero you'd get an arithmetic exception lol

glossy venture
#

yeah

#

i thought about the arithmetic shit but i didnt realize operator precedence

zealous osprey
minor junco
glossy venture
minor junco
#

Lambda

glossy venture
#

i just called the parameter __

#

thats a valid identifier

worldly ingot
#

Desperate for _ being officially supported as an unnamed param

glossy venture
#

yeah

minor junco
#

Idk why it isn't supported

#

Is there any particular good reason?

zealous osprey
#

Ahh, I overlooked Predicate<T> at the start.
Thaught it was some cool highlighting for returning true

worldly ingot
river oracle
minor junco
#

Mhn

glossy venture
#

at least for this library

worldly ingot
#

lol sucks2suck

minor junco
#

Honestly just upgrade anyways best practice even for libraries

glossy venture
#

nah i want to support 1.8

minor junco
#

Unless your target audience only can use java 8 then you're screwed

glossy venture
#

i made it for my own 1.8 server

river oracle
#

pretty sure orby supports legacy

worldly ingot
#

It's coming in 22

river oracle
#

@glossy venture any reason you aren't forking spigot?

glossy venture
#

ah

river oracle
#

your server

glossy venture
#

java 8+ support?

minor junco
#

Yeah @worldly ingot until clients adapt it we already have AI coding for us

glossy venture
#

why would i fork spigot

river oracle
proud badge
#

whats better: multiple hashmaps, or one hashmap with an object of multiple values?

river oracle
#

gives you better control for bug fixes etc and exploit patching

glossy venture
#

also i have no idea how forking works especially with patches n shit

#

its jsut a server i made bc i was bored no reason to put so much effort into it for me

worldly ingot
minor junco
#

Honestly the cost of hashing, hash collision and tables greatly outweighs a simple data wrapper, so go with the object imo

#

@proud badge

glossy venture
#

if the data is related one object

#

for sure

minor junco
#

Isn't sethome just a one to one relationship

glossy venture
#

maybe id

#

or smth

minor junco
#

Player (ID) to location

proud badge
#

X, Y, Z, World

river oracle
minor junco
glossy venture
#

its alr public whats the vulnerabilities

#

wasnt log4shell patche

#

d

glossy venture
#

thats already an object which represents that

ivory sleet
#

Yea that or block lol

minor junco
# proud badge In my case its a sethome

Create one map that stores another object as a value, which in itself is representing a map I would say. Alternatively you could use a SetMultimap with values each being a data object, that contains the location and home ID whereas the hashcode returns the hash of the ID so you can retrieve and test against the ID at O(1)

#

That might lead to a.equals(b) evaluated true even if A's location differs from B so be careful

astral pilot
#

where can i find the 1.19.4 documentation

chrome beacon
astral pilot
chrome beacon
#

Not much

river oracle
#

not super innacurate

astral pilot
#

okk

chrome beacon
#

if you really want the 1.19.4 Javadoc you'll need to make it yourself with BuildTools

river oracle
#

spigot API does not change much between versions

astral pilot
#

well are the old documentations lost tho

river oracle
#

HelpChat might host them

chrome beacon
#

It has up to 1.19.3

#

not 1.19.4

astral pilot
#

yh

#

ig i can just refer to 1.20

#

if its not that innacurate

chrome beacon
astral pilot
#

yh i heard from u using BuildTools

#

anyways thanks

#

btw do i need nms to make custom mobs

echo basalt
#

ye

chrome beacon
#

Depends on what you mean by custom mobs

#

but probably yes

astral pilot
#

etc

chrome beacon
#

You don't need nms to give custom names to mobs

proud badge
#

should accessing something from a json be async?

astral pilot
#

without modifying the normal mobs

eternal oxide
#

still not needed

astral pilot
eternal oxide
#

when you spawn mobs you can set their name, equipment and even adjust their health/stats

#

just with the API

astral pilot
#

i can't find it

eternal oxide
#

World#spawn

#

the method that takes a consumer

proud badge
#

When people say World#spawn do they mean World.spawn()?

eternal oxide
#

they mean all teh spawn methods

#

whichever one suits best

solemn willow
#

can somebody help me with my code?

package me.uwunugget.morph;

import org.bukkit.plugin.java.JavaPlugin;

public class Morph extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("morph").setExecutor(new ());
    }
}
chrome beacon
solemn willow
#

the

getCommand("morph").setExecutor(new ());
``` part isnt working
chrome beacon
#

You can also do what Conclure does; use :: instead

solemn willow
shadow night
#

This looks like a learnjava moment to me ig

chrome beacon
#

Yeah

solemn willow
#

i basically never made a plugin wich uses commands

shadow night
#

That should be super basic stuff

chrome beacon
#

Just pass it an instance of your command class

solemn willow
#

._.

#

ill ask chatgpt then

shadow night
solemn willow
shadow night
#

Olivo literally told you the answer

eternal oxide
#

he did tell you. Its just your knowledge of Java is too low to understand the answer.

shadow night
#

Which translates to LEARN JAVA

solemn willow
#

E

eternal oxide
#

You shoudl at the minimum start with a first plugin tutorial.

solemn willow
#

like

icy beacon
eternal oxide
#

then follow a more advanced one

solemn willow
#

"hOw To sTarT IntelliJ IDEA"

icy beacon
solemn willow
#

i know the java basics

icy beacon
astral pilot
eternal oxide
#

get teh World object you want to spawn the mob in

astral pilot
#

i mean the docs for it

eternal oxide
#

they were linked above

icy beacon
#

Oh yeah with the consumer is better

astral pilot
#

i see

#

thanks

#

i thought that one was different

solemn willow
#

i get this error if i start my server with the plugin i fixed every issue:

18:01:56 ERROR]: Error occurred while enabling morph v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!
    at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:255) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at me.uwunugget.morph.MorphCommand.<init>(MorphCommand.java:5) ~[morph-1.0-SNAPSHOT Kopie 2.jar:?]
    at me.uwunugget.morph.MorphCommand.onEnable(MorphCommand.java:9) ~[morph-1.0-SNAPSHOT Kopie 2.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-307]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
rotund ravine
#

Don’g create a new version of javaplugin

solemn willow
#

how can i fix this 😭

eternal oxide
#

you can't create a new instance of your main class.

solemn willow
eternal oxide
#

only your main class extends JavaPlugin

rotund ravine
#

Remove “new MorphCommand”

#

Or whatever extends JavaPlugin there is present on the second class

eternal oxide
#

remove extends JavaPlugin from your MorphCommand class

#

and pass an instance from your main when you create it

solemn willow
#

in the main i have:
package me.uwunugget.morph;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;

public class Morphing implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage("This command can only be run by a player.");
        return true;
    }

    Player player = (Player) sender;

    if (command.getName().equalsIgnoreCase("morph")) {
        if (args.length == 1) {

            try {
                EntityType entityType = EntityType.valueOf(args[0].toUpperCase());


                player.getWorld().spawnEntity(player.getLocation(), entityType);
                player.sendMessage("You have morphed into a " + entityType.toString());
            } catch (IllegalArgumentException e) {
                player.sendMessage("Invalid entity type.");
            }
        } else {
            player.sendMessage("Usage: /morph <entityType>");
        }

        return true;
    }

    return false;
}

}

 ```in the second class i have:
```js
package me.uwunugget.morph;

import org.bukkit.plugin.java.JavaPlugin;

public class MorphCommand extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("morph").setExecutor(new MorphCommand ());
    }
}
eternal oxide
#

new MorphCommand(this)

solemn willow
#

bro i meesed up with the `s

rotund ravine
solemn willow
eternal oxide
#

um

chrome beacon
#

?di

undone axleBOT
eternal oxide
#

yeah you shoudl be calling new Morphing(this) not new MorphCommand

rotund ravine
#

ur naming is certainly weird

eternal oxide
#

it is

#

what is your plugin called?

rotund ravine
#

Morph

solemn willow
chrome beacon
#

no

eternal oxide
#

remove ()

solemn willow
#

tf

chrome beacon
#

?learnjava!

undone axleBOT
solemn willow
#

so like this? getCommand("morph").setExecutor(new Morphing(this)); if this is wrong ill eat a broom

eternal oxide
#

then in a constructor in Morphing you need to set a field to the plugin instance

solemn willow
#

kk ill try it now

eternal oxide
#

but you need to add a field to your Morphing class

#

Plugin plugin;

solemn willow
#
getCommand("morph").setExecutor(new Morphing(this));
                                        ^
  required: no arguments
  found:    MorphCommand
  reason: actual and formal argument lists differ in length
```i get this as error-
eternal oxide
#

then in the class constructor you add this.plugin = plugin;

solemn willow
#

idk if i should do it tho

chrome beacon
#

Yeah that's what ElgarL told you to do

#

and then add the second part

eternal oxide
#
JavaPlugin plugin;
public Morphing (JavaPlugin plugin) {
  this.plugin = plugin;
}```
chrome beacon
#

You REALLY should go take some Java course

solemn willow
#

oh

chrome beacon
#

We shouldn't have to spoonfeed you basic Java code

eternal oxide
#

you then have access to plugin in your Morphing class

solemn willow
#

wait imma try it now

#

again-

#

an error from the server log

#
[18:14:35 INFO]: Enabling morph v1.0-SNAPSHOT
[18:14:35 ERROR]: Error occurred while enabling morph v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.uwunugget.morph.MorphCommand.getCommand(String)" is null
    at me.uwunugget.morph.MorphCommand.onEnable(MorphCommand.java:9) ~[morph-1.0-SNAPSHOT Kopie 4.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-307]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
[18:14:35 INFO]: Disabling morph v1.0-SNAPSHOT
eternal oxide
#

errors are good

#

your command is not in your plugin.yml

solemn willow
#

._.

#

i tought its literlly not needed

eternal oxide
#

java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.uwunugget.morph.MorphCommand.getCommand(String)" is null

solemn willow
#

commands: /morph so this in plugin.yml to my knowledge

eternal oxide
#

wrong syntax

solemn willow
#

tf

#

i accidentally made my autoclicker on build artifact

rotund ravine
#

?learnjava

undone axleBOT
eternal oxide
#
commands:
  morph:
    description: "morph command"```
solemn willow
#

._.

eternal oxide
#

check it but that should be correct

solemn willow
#
org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here
 in 'reader', line 10, column 14:
      description: "morph command"
                 ^
#

i dont see anything which is wrong

valid burrow
#

as yall know entities ai gets taken over by the one riding it, so what happens if i take a chicken jonkey and put an armor stand on top? will the zombie still be in controll?

eternal oxide
#

?paste your plugin.yml

undone axleBOT
valid burrow
#

yh its wrong

solemn willow
#

_ _

valid burrow
#

let me give you a correct version

eternal oxide
#

missing : after morph

#

and indent description, as I did

valid burrow
#

like this

eternal oxide
#

yep

solemn willow
#

i wonder why

valid burrow
#

because thats how yamal works

#

you have sections

#

that have sub sections

#

that can have subsections

#

...

eternal oxide
solemn willow
#

i just did /reload confirm im too lazy to shut down my server restart my server, force java to start the process

#

i hope it wont destroy my server

valid burrow
#

the only thing that can happen is that plugins dont load propperly

eternal oxide
#

sometimes it will work. Others the server blows up

valid burrow
#

99% of the time its fine if your plugins dont do certain stuff

#

still wouldnt recommend it

vague swallow
#

Does anyone know if there is a way to start the return of a trident to it's owner?

solemn willow
#

E

solemn willow
#

bro /morph PIGjust summons an fucking pig

#

wtf is this

#

its suposed to replace it with the player

#

tf

valid burrow
#

that does not work lmfao

solemn willow
valid burrow
#

u cant just replace the player

eternal oxide
#

um you asked about doing custom mobs, like name, items and attributes

vague swallow
# valid burrow "start the return"`?

like if it is enchanted with loyality the trident will return to it's owner as soon as it collides with a block or an entity but I want it to return after a specific time

solemn willow
#

no shit sherlock

eternal oxide
#

are you trying to make the player LOOK like a mob?

solemn willow
#

nuh uh im switching back to datapacks

solemn willow
#

wtf you thing is a "morph"

eternal oxide
#

good luck with that

valid burrow
#

find the reason it returns normally and artificially recreate it

#

like if its velocity set the velocity to 0

valid burrow
eternal oxide
#

most basic way would be to spawn the mob and make the player ride it

valid burrow
#

and also

eternal oxide
#

making the player invisible

valid burrow
#

if you keep being so toxic no one here will help youi anymore

solemn willow
#

i wanted to make an command for it but

eternal oxide
#

if you can do it in datapacks go for it

solemn willow
eternal oxide
#

I've not messed with datapacks

valid burrow
eternal oxide
#

not many here have as we all write plugins

valid burrow
#

doing something like morphing propperly requires NMS which is like

#

the most complicated stuff around here

eternal oxide
#

NMS = a pain and version specific

solemn willow
valid burrow
#

net.minecraft.source = nms

solemn willow
#

yeah ill go for datapacks then

#

maybe later i might need help for UI like some sort of chest UI with clickable stuff

valid burrow
#

arl

#

gl

jagged bobcat
hazy parrot
#

y

valid burrow
#

mb

distant dagger
#

Hey is there API to format the Objective Score values ?

#

(with 1.20.3)

eternal night
#

not yet

distant dagger
#

thx

kindred valley
#

which slot is it starting on inventory

#

0 or 1

eternal oxide
#

depends on teh view but 0

#

0 is usually first on hotbar

vague swallow
#

I tried to give the armor stand an AI now, but it's still not working. It is only working as long it has Gravity and is not marker. Is there any way to set a Velocity for an armor stand that is marker and has no gravity?

kindred valley
#

which i need to input

#

to make 54 slots

#

54 or 53

#

54 slots of invenotry

vague swallow
#

bruh

eternal oxide
#

0 to 53

vague swallow
#

why's that

kindred valley
eternal oxide
eternal oxide
#

0 = size 1, 53 = size 54

kindred sentinel
#

What the event is to get if player started breaking block?

grim hound
#

packet listening only

kindred sentinel
#

oh...

#

i need to break block if player is breaking it a lot of time..

#

it's only packets and nms?

river oracle
river oracle
#

Should be what you're looking for my friend

river oracle
river oracle
grim hound
#

for some reason there's no field like that in 1.20.2

kindred valley
#
if(e.getClickedBlock() != null) {
            if(CustomConfigSetup.getFileConfig().getList("locs").contains(e.getClickedBlock().getLocation())) {
                Bukkit.getPlayer("limpeex").sendMessage("WORKS2");
                player.openInventory(InventorySetups.MARKET);
            }
        }``` This turns false
#

While i set it up on onEnable here

public void addLocs(Location loc) {
        ArrayList<Location> set = new ArrayList<>();
        set.add(loc);
        CustomConfigSetup.getFileConfig().set("locs", set);
        CustomConfigSetup.save();
    }```
rotund ravine
#

You don’t set anything there

kindred valley
#

wym

rotund ravine
#

You only add one location and no more

kindred valley
#

yes cause i want to do tht

#

a

echo basalt
#

here's the other fun thing

#

decimal precision

#

your top statement will never work

kindred valley
#

why

proud badge
#

Any way to obtain logout location from the player.dat?

rotund ravine
#

Sure

tribal wraith
#
    {
        super(((CraftWorld)world).getHandle());

        List goalB = (List)getPrivateField("b", PathfinderGoalSelector.class, goalSelector); goalB.clear();
        List goalC = (List)getPrivateField("c", PathfinderGoalSelector.class, goalSelector); goalC.clear();
        List targetB = (List)getPrivateField("b", PathfinderGoalSelector.class, targetSelector); targetB.clear();
        List targetC = (List)getPrivateField("c", PathfinderGoalSelector.class, targetSelector); targetC.clear();

        this.goalSelector.a(0, new PathfinderGoalFloat(this));
        this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, false));
        this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntitySpider.class, 1.0D, true));
        this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
        this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
        this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
        this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
        this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
        this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
        this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
    }``` Does anyone know anything about Pathfinding? My entity has these goals but just walks around like a regular Zombie, doesn't attack players
proud badge
#

whats the exact method to add a value to an array, idk why but I cant seem to find this anywhere on the internet

tribal wraith
#

array_name[index] = value

proud badge
#

yes but what if I dont want the index

#

I just want it to be added

tribal wraith
#

Use a List

glossy venture
#

yeah

#

use an ArrayList<E> instead of E[]

dry hazel
#

or resize it and set the last index

proud badge
#

ok thx

glossy venture
#

if u want a mutable array

proud badge
#

do I use StringBuilder or something if I want it all in one message?

tribal wraith
#

You can concat strings using "" + ""

#

"Hello" + " Hello"

candid galleon
#

StringBuilder can be more performant from what i’ve heard (specifically in for loops / many concatenations)

#

big disagree on it being more convenient

ivory sleet
#

String#concat cat_nice_glasses

ivory sleet
#

I mean JIT and even the jvm does a lot of things to optimize strings in particular

#

but the big point is to avoid throw away object creation when using use string builder in iteration flow since it uses system copyarray under the hood which is fast and neat

vague swallow
#

Just a quick question - I got a ton of coexisting projectiles on my server and all of their movements are individually controlled by a Bukkit Runnable. Would it be more efficient if I controlled all of their movements by only one Bukkit Runnable for all of them?

kindred valley
ivory sleet
#

How many runnable instances darth mango?

kindred valley
vague swallow
ivory sleet
#

Go with a single runnable

vague swallow
#

alright thanks

ivory sleet
#

I think its fair to compromise on that

kindred sentinel
#

How to make velocity of spawned item like from drop of the block?

vague swallow
ivory sleet
#

You can benchmark it maybe?

shadow night
#

Having one runnable is always a good idea ig

kindred sentinel
#
java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Item
World world = block.getWorld();
Location blockLoc = block.getLocation();
Item item = (Item) world.spawnEntity(blockLoc, EntityType.DROPPED_ITEM);
item.setItemStack(new ItemStack(Material.BARRIER));
icy beacon
#

Use consumers for spawning entities to spawn already modified entities. Listeners that listen to CreatereSpawnEvent will receive the spawned entity before you call any other methods
https://blog.jeff-media.com/use-consumers-when-spawning-custom-entities/

When you want to spawn a custom entity, e.g. with a custom name or certain items equipped, you must use the method World#spawn(Location, Class, Consumer) unless you give a shit about compatibility with other plugins. I’ll explain why. The shitty way Usually, you can easily spawn entities like this: That is fine, as...

young knoll
#

You can't spawn an item

#

You need to use dropItem

kindred valley
#

how do we increase attack damage of itemsta

rotund ravine
kindred valley
#
        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier("generic.attackDamage", 7, AttributeModifier.Operation.ADD_NUMBER));
#

When on Head, When on Body

kindred sentinel
#
java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Item
                World world = block.getWorld();
                Location blockLoc = block.getLocation();
                world.spawn(blockLoc, Item.class, (item) -> {
                    item.setItemStack(new ItemStack(Material.BARRIER));
                });
worldly ingot
#

There's a special method for items, World#dropItem()

kindred sentinel
shell robin
#
    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onArmorEquip(ArmorEquipEvent e) {
            if(e.getNewArmorPiece() != null && e.getNewArmorPiece().getType().toString().contains("NETHERITE_")){
                e.setCancelled(true);
            }
    }```This code cancels armor worn by right-clicking, but does not affect armor that has been dragged. How can I fix this?
rotund ravine
#

What is the package of ArmorEquipEvent?

shell robin
#

thats an api

rotund ravine
#

Where?

#

If so tell them

#

There is inventory events for the inventory btw

shell robin
rotund ravine
#

Look at the inventory events and figure it out on your own

#

?jd-s

undone axleBOT
shell robin
#

Well, I already tried it

#

Wait me

#

I will show you

rotund ravine
#

We’ll help if you show us sure

pale bear
shell robin
#
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    if (event.getWhoClicked() == null || event.getInventory() == null || event.getInventory().getType() != InventoryType.CRAFTING) {
        return;
    }    for (int slot : event.getRawSlots()) {
        if (slot >= 5 && slot <= 8) {
            ItemStack draggedItem = event.getOldCursor();
            if (draggedItem != null && (draggedItem.getType() == Material.DIAMOND_HELMET || draggedItem.getType() == Material.DIAMOND_CHESTPLATE
                    || draggedItem.getType() == Material.DIAMOND_LEGGINGS || draggedItem.getType() == Material.DIAMOND_BOOTS
                    || draggedItem.getType() == Material.NETHERITE_HELMET || draggedItem.getType() == Material.NETHERITE_CHESTPLATE
                    || draggedItem.getType() == Material.NETHERITE_LEGGINGS || draggedItem.getType() == Material.NETHERITE_BOOTS)) {
                event.setCancelled(true);
                return;
            }
        }
    }
}```
rotund ravine
#

Try inventoryclickevent too

shell robin
twin venture
rotund ravine
twin venture
rotund ravine
#

Pdc?

twin venture
pale bear
# shell robin in this code?

No, just check in a inv click event with one tick delay, because the armor is registered in the inv after the event, thus 1 tick delay.

rotund ravine
#

Cancelling it works

twin venture
rotund ravine
#

Nothing major

twin venture
#

iam making a gui system for avillable servers for a game type it , but not sure if iam doing it correctly

#

lets say :
/play SOLO ,it will show only SOLO GameModes , and i already did that

#

my problem is something with the inside code itself .. so it should say :

  • if 2 servers have the same arena map , it should show 1 itemstack , and it would say that : amount of servers : 2 for example
#

and in the default case , just add new item for new srevers arenas names that runs

echo basalt
#

Basically you need to keep track of your open GUIs

#

assign some metadata to them or something

#

make a notification system

#

At work, in the past, I just had a registry that allowed me to associate menu IDs with packet ids

#

So that when I received a "update member" packet it'd update all menus in the list

twin venture
#

i do have a random uuid for each server is running

shell robin
# pale bear No, just check in a inv click event with one tick delay, because the armor is re...
@EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getWhoClicked() == null || event.getClickedInventory() == null || event.getSlotType() != InventoryType.SlotType.ARMOR) {
            return;
        }

        ItemStack clickedItem = event.getCurrentItem();

        if (clickedItem != null && (clickedItem.getType() == Material.DIAMOND_HELMET || clickedItem.getType() == Material.DIAMOND_CHESTPLATE
                || clickedItem.getType() == Material.DIAMOND_LEGGINGS || clickedItem.getType() == Material.DIAMOND_BOOTS
                || clickedItem.getType() == Material.NETHERITE_HELMET || clickedItem.getType() == Material.NETHERITE_CHESTPLATE
                || clickedItem.getType() == Material.NETHERITE_LEGGINGS || clickedItem.getType() == Material.NETHERITE_BOOTS)) {
                new BukkitRunnable(){
                @Override
                public void run() {
                   event.setCancelled(true);
                }
            }.runTaskLater(plugin, 1)
            event.setResult(Event.Result.DENY);
        }
    }``` Is that enough?
twin venture
#

so each game server runs , it will have random uuid

echo basalt
#

This is more of a code architecture thing rather than networking

rotund ravine
#

@shell robin don’t run it later

#

Ignore whatever that other guy said

echo basalt
#

But to be honest if you have no clue about this you shouldn't be making a sharded system in the first place

twin venture
#

using arena per world ..

echo basalt
#

take some time to learn

twin venture
#

that's bad for perofrmance ..

#

that's why iam asking to learn ..

#

what is better for my use case?
should i do this or publish?

shell robin
rotund ravine
#

Yes maybe?

shell robin
#

im trying right now

kindred sentinel
#

If i want to save itemstack to persistant data container, how could i do it?

echo basalt
#

?morepdc

undone axleBOT
kindred sentinel
#

Thanks

pale bear
# rotund ravine Ignore whatever that other guy said

I think I didn't explain it well. The way I usually do stuff like this is by checking if the player clicked a armor slot and then after one tick, checking if the armor of the player contains disallowed items. If this is the case, I remove that armor and drop it to the floor. I guess you can do something similar with the ArmorEquipEvent of Paper, but i think it dosn't work in this case. My solution should work tho.

rotund ravine
kindred sentinel
rotund ravine
#

Warrio

#

?morepdc

undone axleBOT
kindred sentinel
#

oh ok i'm sorry

pale bear
rotund ravine
rotund ravine
pale bear
#

yeah

kindred sentinel
#

in creative mode

rotund ravine
#

@kindred sentinel I think in those morepdc by alex itemstack can be used as ConfigurationSerializable

rotund ravine
mellow edge
#

I spent so much time figuring out how could I completely hide a player without making him unhittable (hypixel bedwars invisibility), I tought about making an invisible armour stand and hiding the player (idk if I can apply invis on armour stand)

rotund ravine
#

You can

mellow edge
#

this code should hide an armor stand but it does not:

ArmorStand as = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
      
if(as.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 620/*31s. 1s additional for player to not see armor stand in case of lag!*/, 1, false, false), true))
#

Additionally, does anyone have an alternative method for accomplishing this?

zealous osprey
rotund ravine
mellow edge
#

it is but it will make the armor stand unhittable (iirc)

weak meteor
#

can someone check it?

chrome beacon
weak meteor
#

oh

#

whats the replacement then?

eternal oxide
#

no replacement

#

can;t listen to abstract events

weak meteor
#

OHH

#

yeah

#

yeah

#

sorry

#

its PistonExtendevent

#

then

clear elm
#

i just started creating my firt plugin but i cant load it

eternal oxide
#

load harder!?

clear elm
rotund ravine
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

clear elm
#

this comes up

eternal oxide
#

command not in plugin.yml

clear elm
#

what i have to do right here

#

im new

#

i watched my first tutorial today

eternal oxide
#

see that squiggly line? It says you need an element under the key

#

so description: "test command"

clear elm
#

okay ty

#

like this?

eternal oxide
#

no

clear elm
#

what?

eternal oxide
#

look at the example I linked

rotund ravine
#

Can u send a pic of ur project structure for me. Unrelated

clear elm
#

i gotta go now sry

#

can i dm u tmrw?

rotund ravine
#

No

clear elm
#

okay i ask some1 in this chat

weak meteor
#

how can i spawn a block?

#

like put it in certain coords?

wet breach
#

Just change the block to the one you want

wet breach
radiant latch
#

Hi, I am making a plugin with intellij, and I cant ctrl-click to find references. It says 'No usages found in All Places' when I see it has a usage right below it. I am using spigot and not spigot-api, and when i try to download sources it says it cant find them. When I tried ctrl-clicking in a workspace which uses spigot-api it worked. If anyone has information to fix this I would greatly appreciate it.

wet breach
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

glossy venture
radiant latch
#

so how would I go about fixing this (I assume i need to download the source jars)? are there any guides on this matter

chrome beacon
#

I've never gotten that to work

rare rover
#

hm

#

why isn't this working?

    public static String colorizeHex(String message) {                             
        Matcher matcher = HEX_PATTERN.matcher(message);                            
        while (matcher.find()) {                                                   
            String hex = matcher.group(1);                                         
            Bukkit.broadcastMessage(hex);                                          
            message = message.replaceAll("&#" + hex, ChatColor.of(hex).toString());
        }                                                                          
        return colorize(message);                                                  
    }                                                                              
#

it should be formatting it

young knoll
#

Aren’t you trying to replace &##ff99cc

rare rover
#

yes but ChatColor.of() uses that format

young knoll
#

You just need to remove the # in “&#”

rare rover
#

oh i'm so dumb

#

ty

#

lmao

lavish flower
#

can anyone remind me what's used for optional vs required (<> / [])

kindred valley
#

?paste

undone axleBOT
kindred valley
#

what is the reason

lavish flower
#

im no expert but

Cannot register AttributeModifier. Modifier is already applied
kindred valley
#
MARKET.setItem(20, newIs(Material.DIAMOND_SWORD, 10, "Uzak Dövüşlerde Başarılı", "Kral Edward Tarafından İlk Kez Kullanıldı",
                ChatColor.DARK_RED, "Spiritual Sword",ChatColor.RED, 90, 13, 2));```
lavish flower
#

seems whatever you're trying to do is redundant

restive mango
#

anyone know the conversion factor for bukkit/spigot velocities to vec3 for ClientboundSetEntityMotionPacket?

rare rover
#

Was looking for if I should create a new connection everytime and I am using SQLite. What does this mean? Why do you not have to do it with SQLite?

#

Nvm found a video on youtube on sqlite in java

lavish flower
#

In what instance should onCommand return true/false? I understand that it returns true if it's a "valid command", though I'm not sure what constitutes "valid" vs "invalid". Should the command return false if it's a permission error? Syntax error? Fails to find the specified player? etc etc

young knoll
#

False sends the usage message from the plugin.yml

graceful oak
#

Is there a reason why this is not creating a scoreboard when the server starts? The function is being ran all log messages are going through and no errors?

plugin.getLogger().info("Initializing scoreboard...");

        // Try to initialize the scoreboard
        this.scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getNewScoreboard();
        // Log statement for successful initialization
        plugin.getLogger().info("Scoreboard initialized successfully!");

        // Register the objective
        this.objective = scoreboard.registerNewObjective("Levels", Criteria.DUMMY, "Player Levels");
        this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
gleaming yarrow
#

is InventoryClickEvent also used for survival inventories, including the 2x2 crafting grid and the output?

worldly ingot
#

Objects#requireNonNull() will throw an NPE if the value passed to it is null, which Bukkit's ScoreboardManager will always be before a world has been loaded

sullen marlin
quaint mantle
#

Like it gonna call npe anyway

shadow night
#

It's so the IDE stops complaining

dry hazel
#

it explicitly asserts that you don't want it null and you can attach a custom exception message if it is

eager smelt
#

There is a problem with the Bukkit plugin. When the player uses the "/name" command, the display name changes correctly, but the custom name overhead is not updated; Spigot 1.20.1 is used and the relevant part of the code is:

package chihipiro.nickname.Commands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

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

        if (!(sender instanceof Player)){
            sender.sendMessage(ChatColor.RED + "Please execute this command in-game.");
            return true;
        }
        
        if (args.length != 1) {
            sender.sendMessage(ChatColor.RED + "Please provide the correct number of arguments.");
            return true;
        }

        if (args[0].length() > 16){
            sender.sendMessage(ChatColor.RED + "The length of the name should not exceed 16 characters.");
            return true;
        }

        final Player p = (Player) sender;
        final String name = ChatColor.translateAlternateColorCodes('&', args[0]);

        p.setDisplayName(name);
        p.setPlayerListName(name);
        p.setCustomName(name);  // Set the custom name above the player's head
        p.setCustomNameVisible(true);  // Make the custom name visible

        sender.sendMessage(ChatColor.WHITE + "Your nickname has been set to " + ChatColor.RESET + name);
        return true;
    }
}

. I have restarted the server and checked the console for errors, but the problem persists. Any assistance in resolving this issue would be greatly appreciated.

rotund ravine
#

Read the javadocs if a method isn’t working like you want it to

vague swallow
#

Is there a way to make the charge time of a bow longer or shorter?

twin venture
#

hi , uhh second time i click on the item [it will send a messge using redis to the proxy server , it will send me to the required server] , first time it works just fine but second time , it just stop executing

wide coyote
#

with this little code provided i don't think anyone can help

twin venture
#

nvm i fixed it

#

how i was doing is pretty wrong , as i was creating new threads

tranquil beacon
#

?mappings

undone axleBOT
valid burrow
#

how would yall increase hitboxes for entities ( where you can punch em an shi)

dire marsh
#

interact entity as passenger

echo basalt
#

nms hackery

chrome beacon
#

I don't think nms hackery would help

#

interact entity could work though

echo basalt
#

you're telling me I can't override the nms entity's boundingbox?

chrome beacon
#

Well that's clientside

#

at least for attacking I believe

echo basalt
#

do your own raycasting or sumn

chrome beacon
#

Probably for collsions too since player movement is

vague swallow
#

Why is ItemStack.setDurability() deprecated? Java docs says "durability is now part of ItemMeta" but I can't do ItemMeta.setDurability()... What should I use instead?

rotund ravine
#

Damageable

#

?jd-s

undone axleBOT
rotund ravine
#

Use javadocs and google for more info

quaint mantle
#
@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        sendCompass(player);

        MongoWrapper mwi = helper.getMongoWrapperInstance();
        FindIterable<Document> queryResults = mwi.findDocuments("players", player.getUniqueId().toString(), "type", "skin");

        if (queryResults.iterator().hasNext()) {
            // Player has a skin document, morph their skin
            Document skinDocument = queryResults.first();

            Document skinData = skinDocument.get("skinData", Document.class);
            Document texture = skinData.get("texture", Document.class);

            String textureValue = texture.getString("value");
            String textureSignature = texture.getString("signature");

            helper.getSkinUtils().setCustomSkinAsync(player, textureValue, textureSignature).thenRun(() -> {
                msg.send(player, "Morphing you into your avatar..");
            });
        }```

my onPlayerJoin listener runs twice when a player joins, does anybody know what could be causing this behaviour ?
#

as you can see it is running twice

lost matrix
#

Your iterator has two entries

#

PS: You will cause massive lag with that code

quaint mantle
#

also its simply checking if the iterator hasNext lol

bitter rune
#

What does deprecated mean?

quaint mantle
lost matrix
quaint mantle
bitter rune
#

I have a lot of "old" things in my code then that I should convert; thanks

quaint mantle
#

and i checked if i registered it twice but i dont think so ?

lost matrix
quaint mantle
#

im registering within the constructor of the class

icy beacon
quaint mantle
#

maybe thats the issue ?

icy beacon
bitter rune
#

it can tell i am using paper? neat.

lost matrix
quaint mantle
lost matrix
# quaint mantle why is it dirty ?

Because you are moving the responsibility from your JavaPlugin to your Listener.
Constructors should also contain as little logic as possible. And they 100% shouldnt have any side effects.
They are initializers and shouldnt be used for anything else than initializing.

chrome beacon
#

also is that sync database usage I see 👀

quaint mantle
bitter rune
#

oh right i made the project with paper i remember now; its been almost a year now since i started this project

lost matrix
quaint mantle
#

i dont know yet

#

the listener is being registered in this class

chrome beacon
#

So yes you are registering it twice

quaint mantle
#

i dont really think thats how its done lol

lost matrix
quaint mantle
#

got it

lost matrix
quaint mantle
#

got it

#

thank you all :)

lost matrix
quaint mantle
#

also its only initializing once

eternal night
#

The only downside to the removal of generic params is that you loose the ability to define a creation method on the non-generic type as a parameter of Consumer<ItemMeta> cannot be overwritten by the same method but with param Consumer<M> where M extends ItemMeta.
The current solution to this is a small shortcut back to a typed instance. E.g. if you have a plain ItemType in the API and need a consumer method, you call itemType.typed().createItemStack(meta -> meta....)

lost matrix
bitter rune
#

I dont get a quick fix for ChatColor, but since it is fine with default bukkit does it need to be fixed?

quaint mantle
lost matrix
bitter rune
#

paper

lost matrix
eternal night
#

You can keep using the legacy text format

#

you just have to be fine with the deprecation

quaint mantle
lost matrix
# bitter rune paper
    // Named color
    Component message = Component.text("Some cool message").color(NamedTextColor.RED);
    // RGB color
    Component message = Component.text("Some cool message").color(TextColor.color(40, 30, 150));
lost matrix
eternal night
#

or, even more speed Component.text("Some cool message", NamedTextColor.RED)

#

or, even MORE.speed via static imports text("Some cool message", RED)

quaint mantle
quaint mantle
#

if you mean the database calls, i can make them async

lost matrix
eternal night
quaint mantle
#

ill just go for completable future then

eternal night
#

obviously a full qualified static import

#

not a wildcard one

quaint mantle
#

thank you

lost matrix
eternal night
#

I mean, sure for most calls

bitter rune
eternal night
#

builder calls like this, I generally don't mind

eternal night
#

its a more complete format than legacy