#help-development

1 messages · Page 1895 of 1

thick drum
#

Do I just plonk them in and thats it?

brave sparrow
#

Yup

#

In the dependencies section

thick drum
#

I don't have a dependency section, where would that be?

brave sparrow
#

Show me your POM

sterile token
#

Allright so you want to check the potion type?

thick drum
#
  <modelVersion>4.0.0</modelVersion>
  <groupId>HTTPPost</groupId>
  <artifactId>HTTPPost</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>HTTPPost</name>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
sterile token
#

Helping GoldenEdit

#

Pleas eif not i got confued with many messages

thick drum
patent horizon
#
    @EventHandler
    private void onDamage(EntityDamageEvent event) {
        if (event.getEntity() instanceof Player player && player.getGameMode() == GameMode.ADVENTURE) {
            if (event.getCause() == EntityDamageEvent.DamageCause.VOID && player.getWorld() == Bukkit.getWorld("pacman")) player.teleport(new Location(Bukkit.getWorld("pacman"), -254.5, 77.5, 770.5, 180, 0));
            event.setCancelled(true);
            player.setHealth(20);
        }
    }``` does anyone know why when i get teleported back up from the void, it infinitely loops?
vocal cloud
#

As in it infinitely teleports the player to the same location?

patent horizon
#

yes

#

until i disable the plugin ofc

#

actually i think it's because when the player takes damage from a teleportation, it's considered "void damage"

#

i'll just add a check for if the player is below y=0

tender shard
#

use World.getMinHeight()

#

(1.18 etc)

patent horizon
#

oh right

vocal cloud
#

I mean it shouldn't be happening because VOID damage is only from falling into the void

#

Can't reproduce it

#

Any damage they take would be fall from a height or from suffocation

#

As always if you use the logger that would tell you whats actually happening

patent horizon
#

yeah im still experiencing the problem

vocal cloud
#

Use the logger

#

I assume this is not the issue

crisp forum
#

[01:24:58 INFO]: [VipPerks] [STDOUT] Restarted

Do anyone know why my plugin logs like that

vocal cloud
#

What are you using to log?

patent horizon
#

you're using system out println

#

Bukkit.getLogger().log(new LogRecord(Level.<log type>, "message"));

#

use this

chrome beacon
#

Or just use the easier methods like; severe info or debug

tender shard
#

why not just use the getLogger() from JavaPlugin

#

main.getLogger().warn("Yo bro");

chrome beacon
#

^

vocal cloud
tall nova
#

Cannot find 'include' in class org.apache.maven.plugins.shade.mojo.ArtifactSet
https://hatebin.com/reoaktpfkt why is it saying this when I try to compile this pom

tender shard
vocal cloud
tall nova
#

I spent 2 hours making all my class not static no cap

vocal cloud
sullen marlin
#

though you really dont need it at all iuf your depends are scoped correctly

tender shard
#

it should look like this

tall nova
tender shard
tall nova
tender shard
#

so maven would just ignore all the NMS packages when they are not included

patent horizon
vocal cloud
#

Is the server crashing or something lmfao. I tried your code and I get teleported and that's that

patent horizon
#

not crashing

#

it's fine

tender shard
#

try without other plugins

patent horizon
#

tps is also great

patent horizon
#

when i disable it, i get unstuck

vocal cloud
#

I copy pasted your code and jumped in the void and it worked just fine

tender shard
patent horizon
#

yup

#

all other plugins disabled, just pacman causing it

tall nova
#

Bro.....why does my multi module project compile like this? when i went to the m2 repository and checked one of the modules, instead of the directory being me.name.plugin it showed just the META-INF folder so when i try to import the seperate module it just doesn't work. Furthermore, in the META-INF/maven folder, it shows a folder to every module with the pom file for each instead of actually compiling it

crisp forum
patent horizon
#

ok

crisp forum
#

why there is [null]?

patent horizon
#

you didnt define the author of the log

crisp forum
#

How can I define it

patent horizon
#

uh

#

who knows :)

#

i dont use logger that much and haven't needed it to say the plugin name

sullen marlin
#

goodness, just use Plugin#getLogger like a normal person

patent horizon
#

lol

#

it's probably just showing null because you made a new logrecord

vocal cloud
sterile token
#

For serializing/unserializaing a java class to a string i can use serializable from java api right?

sullen marlin
#

almost always a bad idea

patent horizon
#

tf you doing with serializing classes in spigot

sullen marlin
#

Serializable is toxic also

tall nova
#

System.out.println >>> 🥵

visual tide
#

even better

sterile token
#

md5 the situation is the next im doing a way for seding/receibing class object from Redis but it only allow strings

#

That hy

visual tide
#

sout("[PluginName] " + message)

patent horizon
#

xd

crisp forum
sullen marlin
#

json would be the usual way to do it

vocal cloud
sterile token
sullen marlin
#

dont make a new logrecord, use one of the normal methods

patent horizon
visual tide
#

you should

crisp forum
#

Thanks

patent horizon
vocal cloud
patent horizon
#

._.

#

using base spigot, disabled all other plugins, and it bork

vocal cloud
#

You can see the code running in the background

patent horizon
#

mhm

#

thats the only damage call made in the plugin too

sterile token
#

The situation is the next, im doing a way for seding/receibing class object from Redis but it only allow strings

#

Any ideas?

#

Im against using Json its too ugly

vocal cloud
#

Don't

visual tide
#

serialized classes arent strings

tall nova
#

json is sexy

visual tide
#

theyre bytes

vocal cloud
#

Why on earth are you storing entire classes anyhow. JSON would technically be your best bet for that anyways

sterile token
#

Allright but what do you recommend i need a way for send/receive object classes as string

vocal cloud
#

GSON

visual tide
#

j
s
o
n

sterile token
patent horizon
#

uson

visual tide
#

thats the whole point

sterile token
#

Allright thanks

#

I take a look

visual tide
hard fractal
#

is there a performance difference between 1 global async task and 10 others?

tall nova
#

It would be much more efficient to just transport the data and making a class with it in the code

patent horizon
#

logically yes

#

"is one thing faster than doing it 10 more times?"

visual tide
brave sparrow
#

What do you mean by 10 others

#

10 other what

patent horizon
#

bananas duh

#

math teacher prepared me for this

brave sparrow
#

The answer, as usual with threading, is always “it depends”

vocal cloud
#

Is it more efficient to run 10 tasks sometimes than 1 task constantly? the answer is always yes 10 > 1

brave sparrow
#

Lol

#

Depends on what the 1 task is versus the 10

visual tide
#

1x10 < 1x∞

vocal cloud
#

I assume it's a good old "is it better to queue a timer or store the time and check it every x seconds" question

patent horizon
#

guys which one's faster

sterile token
#

I need something that simplier

brave sparrow
#

That’s what GSON does

visual tide
#

its not very complicated

vocal cloud
#

Just use mongo with POJO lmfao

sterile token
visual tide
#

you just need to know the type when deserialising

visual tide
sterile token
#

Oh

#

Sorry

brave sparrow
#

Lol

sterile token
#

I will look in other utorial

#

Cuz the one you sent explain with a FileWriter

brave sparrow
#

toJson() just returns a string

visual tide
brave sparrow
#

Right

visual tide
#

you dont have to put it in a file lol

vocal cloud
#

Hash it and then send it to Bitcoin miners to crack

sterile token
#

its org.gson right?

visual tide
visual tide
#

i dont get why people are so optimistic about crypto these days

calm linden
#

I'm watching Jack Glak's video for Minecraft Modding with SpigotMC

sterile token
calm linden
#

idk

#

plugin

#

im a beginner so-

sterile token
sterile token
visual tide
#

its not maven's fault

sterile token
#

1- Its client side
2- Server side

visual tide
#

did you add the repo?

vocal cloud
#

My man tripped over his own config and died

visual tide
hexed hatch
#

you gotta add gson to your project structure

calm linden
#

what are you supposed to import in your class

#

like public class Main extends JavaPlugin

#

and above you have to import something

vocal cloud
#

This is a learn java moment

sterile token
visual tide
#

?lear-

tall nova
hexed hatch
#

?learnjava

undone axleBOT
calm linden
#

oop

tall nova
calm linden
#

lol

sterile token
#

This right?

visual tide
#

yes

sterile token
#

Oh allright

paper viper
#

and mods can be server side too

#

for example, i believe hermitcraft servers are fabric but vanilla clients can still join

visual tide
paper viper
visual tide
#

plugins are limited to what a vanillla client will accept

paper viper
#

Well that doesnt mean its not a mod

#

Lol

visual tide
#

mods are limited to what a client with the same mod will accept

paper viper
#

Yeah definately it has less functionality but still considered server side mod

visual tide
#

if youre using mod as only "modification" then yes

#

but

vocal cloud
#

A modification is a change to something base. You're adding not modifying

paper viper
#

i have a friend which has a good explanation, but she left the discord 🥴

sterile token
#

Its difficult to right a simply method for serialize/unserialize a class to json string without using an external library. Like its completly unnecessary for me using Gson only for 2 methods

visual tide
#

where is the line between add and change 🤔

paper viper
#

I mean technically not all mods change the base

#

so its a bit gray area

sterile token
#

I ask if it so difficult

visual tide
#

you could argue cancelling an even is modifying

paper viper
#

I'd argue that mod is like a general category, and plugins would be a subcategory

vocal cloud
paper viper
#

i mean paypal considers plugins modifications too

visual tide
#

this is turning into philosophy debating

sterile token
#

Dicuss in other channel

#

Hahaha

vocal cloud
#

No u

paper viper
#

why dont u learn some java first at least

#

/s lmao

visual tide
#

👀

sterile token
#

I cannot concentrate seeing you on my second screen ague. Hahaha

vocal cloud
#

:pogchamp:

visual tide
#

🍿

vocal cloud
#

Oof

paper viper
#

? learnjava

vocal cloud
#

Epic learn java moment

visual tide
#

plugins > mods cuz forge discord is more toxic than here 😐

vocal cloud
#

Forge discord has lex in it

visual tide
#

unsure if that is implying less toxicity or more toxicity

#

i mean i can guess

vocal cloud
#

Man is super toxic sometimes

paper viper
#

lex has been known to have a toxic history

visual tide
#

to be fair he's at least honest about it

tall nova
#

why spigotforge no exist 😢

vocal cloud
tall nova
#

no shot

#

fr

visual tide
#

and mindsets

visual tide
#

and toxicity levels

#

and ego size

tall nova
paper viper
#

you can use mixins in plugins lol?

rich creek
#

Is there any way the guardians can attack faster?

vocal cloud
#

Probably

#

?jd

vocal cloud
#

I imagine you could emulate it firing or figure out if it has an attribute for fire rate

sterile token
#

Wait with Java reflections you can get all fields names from class and their values?

#

I know that fields names its possible

vocal cloud
#

You can get everything but the kitchen sink

#

If the class is unloaded you can even modify it at runtime. I'd share code here but md_5 would ban me for causing him blindness

sterile token
#

I have an idea for doing my simple serializer

rich creek
vocal cloud
#

Maybe NMS make your own machine gun Guardian

sterile token
#

I think it can work

#

I will try

vocal cloud
#

No

#

Why

#

My god

#

Stop

sterile token
#

Hahaha

#

😂

vocal cloud
#

Yes except gson was made by google and actually works

paper viper
#

gson is good but i also like other json libs

sullen marlin
#

just use gson

#

goodness

sterile token
#

Im not against using Gson for serialize/unserialize class but it has many thinks

#

Like it really unnecessary a complete library just for using 2 methods

paper viper
#

gson is slow tho but pretty extensive

proud forum
#

okay, i am back for assistance. i have watched many of kody simpsons java course videos and i think i can understand a little better now

i want to make a command /opmobs on | off

when using this command, i want it to disable the spawning of mobs with over powered armor when it is on, and normal spawns when it is off

could someone assist me? i am quite new but i know basic java i believe

sterile token
paper viper
#

no just use gson

#

if you are a beginner, just use gson

#

honestly no point of using other json libs unless you have a good reason to

worldly ingot
#

I remember when "Don't use GSON, use JSONSimple" was a beginner tip

paper viper
#

XD

worldly ingot
#

But yeah. Until you have a compelling reason not to use GSON, use GSON

sterile token
#

It duplicate my jar size

#

And i cannot upload to spigot

woeful crescent
#

what do i paste to use maven-shade-plugin

#

and how do i configure it to shade specific jars

golden turret
#

if maven

#

change the scope of gson to compile

sterile token
#

But then how i will use it if set to compile?

golden turret
#

the buildtools already add the gson to the local repo so you shouldn't need to import the dependency

golden turret
sterile token
#

Cuz i will get NPE when the plugin runs

golden turret
#

if using gralde

#

just change implementation to compileOnly

golden turret
#

but

#

if you are the lates version

#

change the scope to provided

#

and add the dependency at plugin.yml

sterile token
#

I have builted Spigot 1.8x

golden turret
#

ok

#

so use buildtools

sterile token
#

?

#

I already have installed on local repo Spigot 1.8x

golden turret
#

are you using spigot-api or spigot?

sterile token
balmy gale
#

how do you get the value of a persistent data container after you assign a value

young knoll
#

get

#

Or getOrDefault

glossy scroll
#

Gson has a lot of bugs

balmy gale
glossy scroll
#

Cant use it on records :(

balmy gale
# young knoll get

can you elaborate on the exact syntax, for example if i was to send a message telling the player that data?

quaint mantle
glossy scroll
tall nova
#

qwcsfe

quaint mantle
sterile token
#

Like if using a map send it values, etc

young knoll
#

It’s PDC

#

PersistentDataContainer#get(NamespacedKey, PersistantDataType)

sterile token
#

Isnt it used for items?

#

I never heard about it. Its only on 1.16+?

young knoll
#

Items, Entities, Tile Entities, and Chunks

rancid snow
#

is there any event that fires when I rightclick a seapickle thats already placed with a seapickle in my hand and it increases the sea pickle count?

young knoll
#

PlayerInteractEvent should be fired

calm linden
#

?learnjava

undone axleBOT
lunar forge
calm linden
#

what

#

no

lunar forge
#

Oh

calm linden
#

ye

#

im noob-

lunar forge
#

Ah no problem, I thought you were sending it as a reply on my message

tall nova
#

lol

sterile token
#

How can i reduce that code?

dusk flicker
#

why do you need to?

sterile token
#

Serializing object to string

dusk flicker
#

thats not a reason

#

Does it work? Is there a problem with it? What do you mean by reduce?

sterile token
dusk flicker
#

Personally I wouldent

sterile token
#

Wy?

vocal cloud
#

Just because you can doesn't mean you should

dusk flicker
#

^

#

Readability is the best

sterile token
vocal cloud
#

No you really don't

dusk flicker
#

Theres no reason to

vocal cloud
#

You have no reason to

#

Rack readin me mind

sterile token
#

Its shorter the code

vocal cloud
dusk flicker
#

You are also doing two things in that method, so you really cant do it in one line without having no readability

vocal cloud
#

Shorter code =/= better code

dusk flicker
#

Shorter the code isnt always good

#

yeah ^

vocal cloud
#

Sttop it

sterile token
#

Omg

#

So you wont help?

vocal cloud
#

We are helping

sterile token
#

Allright thanks

vocal cloud
#

by telling you that shortening it isn't going to make things any better

sterile token
#

I know

dusk flicker
#

1 line statements can be a bitch and a half to debug

sterile token
#

But my eyes fritghen

dusk flicker
#

then break that habit

#

Worst thing you can do is force everything on 1 line

#

Ive worked with a dev that did that, literally put huge enums all on one line

#

Hated working with it

#

Horrible to debug, horrible to do everything

sterile token
#

What happen with readeablity?

#

Im only going to read it

#

Hums

#

But its okay no matter

#

With pacient i will find the way

dusk flicker
#

lets put it this way, I should be able to glance at your code and understand it

ivory sleet
#

Readability has nothing to do with lines and you probably want to make your code readable for yourself as well, especially when the code base grows xd

dusk flicker
#

Or any dev for that matter

ivory sleet
#

Bruh, I just said the converse

sterile token
#

converse?

#

What that

ivory sleet
#

Opposite

dusk flicker
#

to be honest it was a bit confusing how you said it Conclure

ivory sleet
#

It does not matter

brave sparrow
#

You do not want all your code on one line lmao

dusk flicker
#

for very simple things, sure it could be on one line as its readable

brave sparrow
#

What happens a year from now when you have to go back and understand what you did

dusk flicker
#

But that line would not be readable

ivory sleet
#

Well, truth is, one liners can be readable, but they can be arguably be as confusing as readable from time to time

brave sparrow
#

Depends on how long of a line it is

vocal cloud
#

You'll need at least 2 lines for it and 4 is fine anyways

dusk flicker
#

Not like line count matters in any way

sterile token
dusk flicker
#

thats not a good way of coding then

#

Break that habit

tall nova
#

In my multi module nms project, none of the classes are actually used, and I assume thats why none of them are getting compiled, when I try to decompile the jars, it just shows the META-INF and there's no actual classes in it, I've tried putting includes:

                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>me.rishabhvenu.aseplugin.nms.*</include>
                                </includes>
                            </artifactSet>
                        </configuration>``` but it doesn't seem to work
brave sparrow
#

The extra byte you’re saving doesn’t matter much

sterile token
#

Allright so what i can do?

#

Nothing?

dusk flicker
#

Just let it be

brave sparrow
#

Change your style

#

Lol

sterile token
#

I will try

#

But i dont think i would like

brave sparrow
#

You’ll get used to it

sterile token
#

Imagine with C# i dont have methods no more 1 line if they are not necessary

ivory sleet
#

Verano first I’d very much recommend using explanatory variables more, and then extract more functions

brave sparrow
#

And in the long run it will benefit you

#

Your code should basically explain itself to anyone who reads it

#

Just by looking at the method someone should understand roughly what you’re doing and why you’re doing it

sterile token
#

No if it private code who will read it?
I think you only in your way and you are not being open

ivory sleet
#

well it’s not private code

ivory sleet
#

You’re continuously sharing it with us

brave sparrow
#

Later you and current you are essentially two different people

sterile token
brave sparrow
#

You’re not going to remember what you were doing in 12 months

#

2 years

#

Etc

rancid snow
#

it's been 10+ minutes of this arguing btw

ivory sleet
#

Verano thing is wide lines, long functions are rude and impolite to the reader moreover as said the fact that you’re claiming you’re the sole person who reads and touches the code is objectively incorrect.

sterile token
#

Omg

ivory sleet
#

(=

sterile token
#

I will live there and close that code my eyers are burning

#

😂

ivory sleet
#

🥲

brave sparrow
#

There’s a decent chance you could take a break for a week or two and come back and in that short time have no clue what you were doing

sterile token
#

Allright thanks

brave sparrow
#

Context escapes very quickly

paper viper
#

bro

sterile token
#

Recommendation for my lib?

paper viper
#

that whole line is yellow

sterile token
#

What more can i add?

paper viper
#

please

sterile token
paper viper
#

...

sterile token
#

I try to remove that color but intellij doesnt not allow me

paper viper
#

lmao?

brave sparrow
#

It’s telling you not to do that

sterile token
#

I think its a config problem

brave sparrow
#

Lmao

paper viper
#

XD

brave sparrow
#

That’s the IDE suggesting you split that line up I’m pretty sure

sterile token
#

Sometime ago happened to me and i remove that ugly color

#

wait i will see

paper viper
#

its something else

#

but you should still split line

sterile token
#

Its saying "Unchecked cast to T"

brave sparrow
#

Well there’s no way to tell what the issue is with it all on one line

#

Yeah that’ll do it

sterile token
#

But i will listen you

#

And change to multi lines that code

paper viper
#

i dont know what the context here, but as long as you know that whatever type you will be casting to isnt going to give you a cast exception, you should be fine

ivory sleet
#

Well that 1 line still makes it obvious you’re casting readObject() : ()-> Object to T

#

And this is just generics in a nutshell

#

Nothing you can do about except maybe pass a type validator

sterile token
#

type validator?

ivory sleet
#

Although that doesn’t inherently add anything apart from removing the warning

#

Yes

paper viper
#

instanceof or smthing?

ivory sleet
#

Basically you pass a Class<T> and then use
Class::isInstance and ::cast

sterile token
#

That my Packet

ivory sleet
#

since T gets erased, using instanceof would basically be an instanceof Object check which is like redundant

paper viper
#

type erasure 😮‍💨

ivory sleet
#

Wow that emoji

#

Oh nice iOS don’t have it

sterile token
paper viper
#

oh

ivory sleet
#

Wadup

sterile token
#

Now better??

dusk flicker
#

oh lord supress warnings

paper viper
#

its probably you leave the warning there

sterile token
#

Yeat cuz it whas underlying with yellow and fuck m eye

paper viper
#

with the type exception

dusk flicker
#

that means something isnt right

#

not just to annoy you

paper viper
sterile token
paper viper
#

if the type you are casting to is fine

sterile token
#

byte[] can be converted to string?

ivory sleet
#

Indeed

#

String::new and pass the instance of byte[]

sterile token
#

Not forget i was using wrong base64 encoder

#

niceee

brave sparrow
#

Something can work and still be wrong and have something happen later that breaks it

sterile token
#

Allright recommendation to change my code?

#

I will use That methods + Redis Pub/Sub

ivory sleet
#

Let me provide an example

sterile token
#

Dont use gson/json please

#

I see your intentions

quaint bough
#

How do I get this back to ItemStacks?

paper viper
#

you forgot to close your streams

#

thats very bad

#

use a try/resource statement

sterile token
sterile token
paper viper
#

?

vocal cloud
#

Not on the same line please

sterile token
#

in library you dont use try-catch

sterile token
paper viper
#

try-catch != try-resource

quaint bough
quaint bough
sterile token
ivory sleet
#

<t extends Packet> t from(
Class<t> type,
bytes…
){
if (!type.isInstance(in)){
raise SomeException
}
return type.cast(in);
}

#

verano

sterile token
#

Ahh allright

ivory sleet
#

that will get rid of the warning

sterile token
#

That would be the correct way

sterile token
ivory sleet
#

input.read()

#

or sth

sterile token
#

Ahh allright

ivory sleet
#

Tho from a variable

#

As the function read is impure

paper viper
#

i doubt he will know what impure means

#

XD

ivory sleet
#

Hehe

sterile token
ivory sleet
#

First of all

#

try with resources my guy

paper viper
#

yeah i literally just said that XD

#

use try-with-resources

ivory sleet
#

Class<T> not Class<?>

#

(Secondly)

paper viper
#

see this too

paper viper
#

?

ivory sleet
sterile token
#

What that

ivory sleet
#

PulseBeat caught on camera in 4K

sterile token
#

I never seen a link like that before

#

Explain please

rancid snow
#

then ur new to discord?

paper viper
#

Bruh

#

its a discord message

#

Yeah lol

#

XD

rancid snow
#

right click a message and click copy message link

sterile token
#

Ahhh

#

?info

undone axleBOT
paper viper
#

ok

sterile token
#

wait i dont remeber the cmd

ivory sleet
#

?cc list

#

Ah forgot the custom command command is disabled here

sterile token
#

it was a command that say info about your account

ivory sleet
#

?user @ivory sleet

#

Maybe userinfo

#

Sth like that ye

quaint bough
#

how do you cast item to string and back in a config file? Doing this right now but doesn't work:
config.set("items", items); (items is : ItemStack[])
inventory.setContents((ItemStack[]) config.get("items"));

sterile token
#

You should serialize the items for saving

ivory sleet
#

Do it like:
set("items”, Arrays.asList(items))
((List<ItemStack>)getList(“items”)).toArray()

#

iirc

#

We prefer List<E> to E[]

quaint bough
#

Ah

#

Should I add another cast to that ?

ivory sleet
#

oh

#

It’s toArray(new ItemStack[0])

quaint bough
#

oh what

ivory sleet
#

and then yeah the cast List<ItemStack> might be redundant

quaint bough
#

how did that fix it

ivory sleet
#

Generics

#

An intermediate/advanced Java topic

#

but basically type orientation at compile time

sterile token
#

I was told that you need

ivory sleet
#

ItemStack implements ConfigurationSerializable

brave sparrow
#

^

sterile token
#

Lol

brave sparrow
#

It already knows how to serialize ItemStack

#

It’s built in

balmy gale
#

why is "key" red in this code?

woeful crescent
quaint bough
#

well it works now danke

brave sparrow
sterile token
undone axleBOT
ivory sleet
sterile token
#

in 1,8 ItemStack its not serializable i get NPE when using it

woeful crescent
#

;-;

ivory sleet
#

Verano I mean it is

balmy gale
ivory sleet
#

Although 1.8 sucks

sterile token
#

No im an idiot

#

I remeber now

#

I use config seriable because i save a class object to file

#

That why

woeful crescent
vocal cloud
ivory sleet
#

Sadly I don’t possess any maven skills

#

Archonic

balmy gale
ivory sleet
#

?jd-s

undone axleBOT
vocal cloud
#

Yo conclure can we get a ?tryitandsee tag

ivory sleet
#

Tho a prerequisite if you want to understand that is an understanding of the basics semantics of Java and object orientation

#

?tryandsee

#

Thought that one existed

#

Hmm

vocal cloud
#

I need this as a tag in my life

balmy gale
#

PDC confusion

tall nova
#

Someone help me...Im losing my mind..... my multi module pom project for nms abstraction doesn't fucking compile the class files

#

This is the dist module which imports each version

ivory sleet
#

?tryandsee @vocal cloud

undone axleBOT
ivory sleet
#

?tas

undone axleBOT
tall nova
#

I've tried manually including them in it as you can see xml <includes> <include>me.rishabhvenu.aseplugin.nms:*</include> <include>me.rishabhvenu.aseplugin.nms.*</include> </includes>

#

But the jar file ONLY CREATES META INF FOLDER

ivory sleet
#

If you only used gradle Retinal 😅

vocal cloud
#

It deletes the embed @ivory sleet ):

ivory sleet
#

Yeah, it’s too big

vocal cloud
tall nova
bright meteor
#

how do i speed up the daylight cycle 2x?

balmy gale
#

if anyone knows how to get data from a pdc in 1.18 please post example code in chat

buoyant viper
#

?pdc

sullen marlin
valid totem
#

a

woeful crescent
#

how to use maven shade plugin

valid totem
#

@ivory sleet PlayerDeathEvent.setKeepInventory(true); is not working

woeful crescent
#

maven shade plugin anyone

valid totem
#

why do you need maven shade

#

oh

woeful crescent
#

where to download maven shade plug-in?

#

and does it work with 1.8?

brave sparrow
#

It does

valid totem
#

nvm

woeful crescent
#

it's a joke alexthecoder

#

smh my head thank you for trying to be helpful regardless of my efforts to annoy

hasty prawn
wet breach
hardy swan
#

how to install maven

quaint mantle
#

?tas

undone axleBOT
quaint mantle
#

wat?

#

not tool assisted speedrun?

#

sus

dense shoal
#

I'd like to be able to track all messages a player receives whether it's a chat message from a player or if a plugin messaged them. Can I do that with any spigot plugins?

#

Sorry not plugins, I'm looking for an event that gets fired

kind hatch
nova sparrow
#

Do you ugys prefer the paper or spigot api

valid totem
#

spigot

#

(for compatability)

#

Does anyone know how to make it so that when someone mines a chest the chest contents drop but the chest itsself doesnt

kind hatch
#

The reason you have to do it this way is because #getDrops() returns a copy of what the block would drop. You used to be able to edit the list directly, but that was a very long time ago.

tall nova
#

Im using reflection to modify the UUID of a player and I get this error: java.lang.IllegalArgumentException: Can not set java.util.UUID field net.minecraft.world.entity.Entity.ak to java.util.UUID
The method Im using:

public static void setPrivateField(Class<?> clazz, Object obj, String fieldName, Object val) {
        try {
            Field field = clazz.getDeclaredField(fieldName);
            field.setAccessible(true);
            field.set(clazz.cast(obj), val);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }

And I call it like this:

Reflection.setPrivateField(Entity.class, player, "ak", uuid);
#

And the ak variable does exist as a protected UUID

little elm
#

I heard that getOfflinePlayer only works if that player has been on within 30 days. Is this true?

dense shoal
kind hatch
tall nova
dense shoal
#

I'm scratching my head to see why you're trying to do that. Maybe there's an easier way.

tall nova
kind hatch
kind hatch
#

.-.

tall nova
#

lol

#

any idea why the error above occurs tho?

kind hatch
#

Not really. I don't use reflection that often, but I do know that a protected object is package private. Perhaps there is a difference you need to consider with reflection.
You may also have better luck if you use the remapped jar. Not sure if you are creating a plugin for 1.17+ though.

tall nova
#

Yeah it is 1.17+

kind hatch
#

The remapped jar basically deobfuscates NMS.

#

Instead of using NMS, you can now use the Mojang names.

tall nova
#

Ah I see

kind hatch
#

It might make things clearer when trying to access fields.

tall nova
#

I mean, I know that's the field I need to change, I just don't know why it's not working

little elm
tall nova
#

mojang api

little elm
#

Thanks! Is this difficult to use?

kind hatch
golden turret
#

the field typw

#

you know which type is it?

tall nova
#

Wait nevermind I just realized what I did wrong

golden turret
tall nova
#

I was using the CraftPlayer class instead of the getHandle from the CraftEntityt

#

lol

little elm
golden turret
#

you are tying to get the player by name

#

or by his id?

kind hatch
tall nova
#

yeah not sure why they removed it, it's pretty useful

golden turret
#

getOfflinePlayers

golden turret
#

loop

#

check the names

#

if one matched

#

return it

#

if dont

#

mojangapi and cache it

#

that method should be like this

little elm
#

Thank you! I'm trying to get an offline player by their name, with the purpose of getting their UUID. Eg a command of "/money XxXSpigotLoverXxX" will output their money amount regardless of if they're online or not

golden turret
#

i would do my own cache

#

for names

little elm
kind hatch
#

Oh yea, @little elm you were right. The usercache does store the data for a month as it has an expiresOn tag. However, since the method uses the mojang api, it'll just refresh the expiry date once it does expire.

tall nova
#

your own cache is prob overkill

little elm
kind hatch
little elm
#

The API is a lot easier?

#

The Mojang API?

tall nova
#

Yea so guys dont change the players UUID LOL

kind hatch
#

Yea, the spigot api.

little elm
#

Ohhhhh gotcha

kind hatch
#

What you are currently using.

kind hatch
tall nova
kind hatch
#

It fill the screen?

tall nova
#

Nah not one of those but I never seen the error before

#

I wonder if I intercept the packet directly through NMS when they join and modify it maybe it'll work 🤔

thick drum
#

Hey everyone, I have a bunch of stuff relating to storage and stuff which i can't be bothered explaining, but I need a way to trigger some code when a lever is broken. I already have code to test if it is broken by a player, but I also need to know if it is broken during TNT explosions, creeper, the block behind it is broken and it drops off, etc - is there any way to test for this without writing each and every event out?

wet breach
#

?jd

wet breach
#

there is a search bar on the javadocs site that can be used to search for events

kind hatch
thick drum
#

Yeah okay I feared that would be the answer, thanks anyway!

tall nova
#

I think you only need blockbreakevent and entityexplodevent

carmine urchin
#

How do I prevent a jukebox from overlapping a song? It does not stop playing every time after I right click @EventHandler public void onRightClickOnJukebox(PlayerInteractEvent e) { if(e.getClickedBlock().getState() instanceof Jukebox jukebox) { jukebox.stopPlaying() jukebox.setPlaying(Material.MUSIC_DISC_11); jukebox.update(); } }

tall nova
#

It plays 2 at the same time?

carmine urchin
#

yes

carmine urchin
wet breach
#

yes, and unfortunately not sure if you can fix the overlapping part since the client doesn't report when a song is done

#

what you could do as a work around, is to grab the details from minecraft wiki in how long each song is

#

and then have the server kind of wait that time length

carmine urchin
#

Would it be possible to just delete the block entirely so the sound stops and then just place another jukebox?

tall nova
#

Anyone know how can I do something every time a player boosts their elytra?

#

Paper has an event for this PlayerElytraBoostEvent but I want to do it with spigot

wet breach
carmine urchin
#

1.18.1

wet breach
#

?jira

undone axleBOT
wet breach
#

probably best to report the API bug if it is indeed not working

carmine urchin
#

Okay, I was maybe thinking that I wasn't doing something right and it could not entirely be a bug or something, I'll just investigate a bit more, thanks though

hybrid spoke
tall nova
hardy swan
tired dagger
#

Hi, so I've decided to move a project over from Maven to Gradle to see which I like better but I can't figure out how to copy the jar file to another location.

I tried following along from the Gradle docs but the 'from' and 'build' are greyed out and nothing is happening. Ideas?

wet breach
#

Maven is more user friendly then Gradle is

#

and in terms of the whole Gradle vs Maven thing, unless your project is some massive code base you won't notice a difference between either of them

tired dagger
#

It compiles a lot faster

wet breach
#

so does maven

vale ember
wet breach
#

just need to know how to allocate more resources to maven

vale ember
#

gradle is A LOT faster

#
  • it is less verbose
#

you can write 10 lines of gradle which is equivalent of ~50 lines on maven

wet breach
#

just because you never seen it, doesn't mean it doesn't do it, most people don't bother learning what maven can actually do or how well it can do things

vale ember
wet breach
tired dagger
#

IIRC from what I read, Maven compiles all files regardless of if changes were made whereas Gradle only compiles files that were changed

wet breach
#

can even pass arguments to maven from the pom too

wet breach
analog prairie
#

Can I get the player's all items and amount?

wet breach
#

?jd

wet breach
#

use the search bar on the javadocs to search for player inventory

#

or for the player related methods

analog prairie
#

No results found

maiden thicket
#

hello! i created a fake NPC with nms but i'm having an issue where the gameprofile name displays alongside the team prefix

wet breach
#

anyways as for Maven, the reason most people believe it is slow is first they don't bother with messing with settings or even seeing what flags could you send maven compiler. Maven by default is conservative in regards to resources it uses, but you can change this especially if you have a lot of resources to give it. Give maven 2-4GB of ram allocation and it will be decently fast 🙂

maiden thicket
#
        org.bukkit.scoreboard.Team team = this.player.getBukkitEntity().getScoreboard().getTeam(this.teamName) == null ? this.player.getBukkitEntity().getScoreboard().registerNewTeam(this.teamName) : this.player.getBukkitEntity().getScoreboard().getTeam(this.teamName);
        team.prefix(name);
        team.addEntities(this.player.getBukkitEntity());``` that's the code i use to set the team prefix
#

teamName is a randomstringutils alphabetical string

vale ember
#

75 vs 29 (the gradle also have lombok included which will also add like 5-8 lines to maven as well)

tired dagger
wet breach
#

however, Maven can do anything you want it to

vale ember
vale ember
#

but gradle just do it more concise

#

especially with kotlin dsl, it looks very readable

wet breach
vale ember
#

also gradle have special plugin that can generate plugin.yml for you

wet breach
vale ember
wet breach
vale ember
wet breach
#

not really? Not sure what you are basing that on. Have you made a maven plugin before?

buoyant viper
tired dagger
#

^ copied, I mean

spiral light
wet breach
#

anyways so far my point is valid in that unless you have a large code base, performance wise you won't notice a difference between maven or gradle. Just because you don't know how to properly configure maven isn't a factual basis that gradle is better, just you don't know maven very well. So for the most part which you want to use is mainly down to preference for like 80% of the projects

#

I have yet to come across something that gradle does that maven couldn't do

maiden thicket
spiral light
#

Lol the plugin.yml is also auto generated in maven too ... You just need to know how and this is not that diffcult

spiral light
young knoll
#

How does one properly abstract data saving to work with multiple formats

#

My brain cannot seem to think of a good way

wet breach
#

once you know what is common then you can abstract and only leave what needs to be implemented

young knoll
#

Oof, I’m not sure what’s common between yaml and SQL

wet breach
#

SQL uses tables, rows and columns. A table, is essentially like its own file, rows would be similar to sections and columns would be the individual data in those sections

spiral light
#

Just create your own database

young knoll
#

Lul

#

I wonder if I can find a good example somewhere

#

Ideally I’d like to offer yaml, SQLite, MySQL, and maybe json

wet breach
#

SQLite and MySQL are very similar since they are both based on the SQL spec

#

yaml is different in that it isn't designed to be a database more or less a config file

young knoll
#

Yeah but it’s easy to edit

#

And some people want that

wet breach
#

so why not provide a tool to make it easier to edit MySQL or SQLite

young knoll
#

There will be admin commands to edit anything important

#

I just feel some people are used to the yml of essentials

wet breach
#

that is either automatically part of the jar or zip file or as a separate download

young knoll
#

True

#

I guess I can just have a system to register serializers for any class I want

#

Something like HomeSerializerSQLite

#

I’m sure some other plugin has done this that I can look at for brain power

wet breach
#

you can even use yaml as a way to dump data if you want, and then if they want to change it as long as a certain setting is enabled have it load data from a yaml file into the DB

#

and then have the setting disable after that use

young knoll
#

That’s clever

#

Saving and updating the data I can wrap my brain around

#

Just not a good way to query it back out

tired dagger
#

?jd

frigid rock
#

guys how do you get a 2D or 3D region?

drowsy helm
#

get 2 points and iterate through each point between

young knoll
#

Bukkit has a class to help with that

#

BoundingBox

frigid rock
#

ohhh thanks

glossy venture
#

what are the suspicous call warnings in intellij
like "suspicous call to Map.containsKey()" or something

spiral light
#

Maybe wrong key type

young knoll
#

Anyone know of an OS plugin with multiple data storage options?

spiral light
#

Search for plugins that have SQL ... They mostly support other things too

young knoll
#

Hmm

#

Towny maybe

coarse shadow
#

?paste

undone axleBOT
coarse shadow
tall nova
young knoll
#

Open source

tall nova
#

Ohh

tall nova
brave sparrow
#

Might want to specify if you want code you can look at or code you can copy

#

Cause licenses

young knoll
#

Just look at

coarse shadow
#

can someone check the code that i sent

keen rock
#

I'm trying to change the max level of most enchants in the enchantment table to 10. Any idea of how I would go about doing so? Looked for some plugins that already do this but none seem to be working, on 1.18 anyways

drowsy helm
#

you can use unsafe enchant

young knoll
#

Use the enchant item event and modify the getEnchantsToAdd map

quaint mantle
#

although it uses sql databases only. Not sure if this is what you need

young knoll
#

It’s a start

frigid rock
#

but it doesnt work

#

anyone knows how i can select a region, and then, when a player gets to that region it does something?

#

i made a move event here

glossy venture
#

it only selects one y level

#

u sure you are exactly on y 64 when checking

young knoll
#

It might be exclusive

#

So 0 y levels

glossy venture
#

that would explain it

frigid rock
young knoll
#

Try 63 to 65

frigid rock
#

okay

#

okay now it works fine

#

thanks guys

copper scaffold
#

Is it possible, to canchel the join message? when a player joins in vanish? i programmed the vanish plugin

young knoll
#

Try setting the join message to null

#

Or empty

glossy venture
#

null because otherwise it will just print a new line i think

young knoll
#

Probably

quaint mantle
#

support yaml, toml, json

lavish hemlock
#

Tbh wouldn't recommend Simplix all that much

quaint mantle
#

i just found that

lavish hemlock
#

I've used it and it's a bit... ehh

quaint mantle
#

never seen it before, but i sent alr anyway

ivory sleet
#

Configurate 12434b1bf8604b228598a41d3936d2cd

young knoll
#

I don’t intend to use it, just learn how to implement it properly

lavish hemlock
#

Simplix's code is very messy, wouldn't recommend it for analysis

young knoll
#

I want to at least support 1 local and 1 hosted storage option

lost matrix
#

Jackson also supports json and yaml. And has a ton of serialization features. Why not just use that?

young knoll
#

Like SQLite and MySQL

lost matrix
ivory sleet
young knoll
#

Sounds big to shade

#

Ideally I’d also like a non db option

#

Like json

lost matrix
#

Write the code once, support any SQL flavour

ivory sleet
#

Look at LuckyPerms (:

quaint mantle
#

paper dev

young knoll
#

Also calling it luckyperms

ivory sleet
#

They do cool stuff altho they do couple data model and data storage a bit too strongly imo

lost matrix
lavish hemlock
#

ORM is actually somewhat controversial from what I've seen.

ivory sleet
#

Or support yaml

young knoll
#

I might

#

Idk

lavish hemlock
#

No, fuck YAML.

ivory sleet
#

Since yaml is a superset of json

#

you get free json support (:

lavish hemlock
lost matrix
#

You can translate json into yaml later too

lavish hemlock
young knoll
#

Just seems hard to abstract this

#

So I can basically just call save(Object) and it will handle the translation into sql or json or whatever

lost matrix
ivory sleet
lost matrix
#

maybe a namespaced key

ivory sleet
#

Yeah coll

#

Just have an interface above it

#

of course you could also make a facade which has the cache/data model internal encapsulated

young knoll
#

Ah big words :p

ivory sleet
#

Idk how to else describe it lol

#

A wall and button where that button gives you accessibility and interactivity with both the storage implementation and data model

lost matrix
#
public interface TypedStorageHandler<T> {
  void save(NamespacedKey location, T object);
  T load(NamespacedKey location);
}

Or

public interface StorageHandler {
  void save(NamespacedKey location, Object object);
  Object load(NamespacedKey location);
}

Or for better serialization

public interface TypeAwareStorageHandler<T> {
  Class<T> getType();
  void save(NamespacedKey location, T object);
  T load(NamespacedKey location);
}
young knoll
#

I kinda understand why essentials just yeets it all into yml now :p

lost matrix
young knoll
#

So you are saying the object itself should have the serialization and deserialization methods?

ivory sleet
lost matrix
#

I mean...

public interface StorageHandler {
  void save(NamespacedKey location, String object);
  String load(NamespacedKey location);
}

Could also be fine. But then you are bound to blobs.

ivory sleet
#

You can create a serializer

#

which then gets passed to necessary implementations

young knoll
#

That was my original idea

ivory sleet
#

Ya

lost matrix
#

I have one mammoth Jackson instance where every serializer can be registered.

young knoll
#

Each object would have 1 serializer per storage type

ivory sleet
#

Idk if you actually need that for sql, maybe…

lost matrix
young knoll
#

I could probably compress that into 1 for SQL and 1 for flat file

ivory sleet
#

hmm yeah

#

Or stick with sth like a jackson serializer and just encapsulate that (maybe delegate from your serializer)

lost matrix
#

Your schema
[id, data]
With just one column containing a json String XD

young knoll
#

Ah

#

So it would be something like [homes, json string]

lost matrix
#

Because that what relational DBs where build for. Kappa

young knoll
#

Or perhaps a namespace rather than just homes

#

Yeah it does seem a bit like abuse of relational databases

lost matrix
#

In your namespaced key:
namespace:key
Where namespace is the table name and the key is the actual ID

#

Or namespace is the folder name and key is the file name if we are talking about flat files

young knoll
#

Ah that’s clever

#

Namespace could also be the file name and key could be a subsection

lost matrix
young knoll
#

True

#

I need to bind all this data to a player though

#

Easy enough in sql, just add another column

lost matrix
#

playerdata:UUID

glossy venture
#

what is a good way to store permissions in sql

lost matrix
#

<UUID>.json

young knoll
#

Yeah

#

Well some data is player bound, other is not :p

lost matrix
#

worldmanager:globaldata
for example

young knoll
glossy venture
#

yeha

#

but im using a tree structure

#

each permission is a node which stores its own permission value and if it should allow or disallow its child nodes

#

and of course its child nodes

young knoll
#

Huh maybe I need a type of triple namespace

#

So I could do playerdata:uuid:homes

lost matrix