#help-development

1 messages ยท Page 1997 of 1

quiet ice
#

my formula still applies then

silver shuttle
#

any more about this?

raw ibex
#
haughty storm
#

only found one vid but had a problem with my pom.xml

grim ice
#

fucking

#

hell

#

wtf

#

ur lib has everything wtf

viral temple
#

what version added PersistentDataContainer ๐Ÿค”

grim ice
#

thats cool af

quaint mantle
#

he doesnt have one thing, where is my gf

viral temple
grim ice
#

but it exists in 1.13 in some other way

viral temple
#

๐Ÿค”

grim ice
#

dont think any major change happened to NKs

viral temple
#

ok ty

ebon coral
#

Does setCustomName work in tablist?

#

I have both fakePlayer.setCustomNameVisible(true); fakePlayer.setCustomName(Component.nullToEmpty(this.items.getOrDefault(i, ""))); and it seems to not be working

round finch
#

Sorry I'm curious!
it is possible to save data into a block with data-container or something like that sort

waxen plinth
waxen plinth
#

You can't do it with non tile entities normally

#

But my library has a helper for doing exactly that

ebon coral
#

SMH

#

ADVERT

rough drift
ebon coral
#

jk ily

rough drift
#

whats your point

ebon coral
#

Nah listen home slices

round finch
#

i mean with spigot?

ebon coral
#

How do I set a custom name in the tab of the list

#

!??!

waxen plinth
#

Nope, can't do it with pure spigot

grim ice
#

i discover new sutff about it

round finch
#

oh ok ok

grim ice
#

everyday

#

lmao

round finch
#

will it save and not be lost on reload?

rough drift
waxen plinth
#

It will not be lost on reload

grim ice
#

i can give you years

round finch
#

Cool! ๐Ÿ™‚ โค๏ธ

waxen plinth
# rough drift give me a month

I admire your confidence but redlib has been continuously developed for 3 years so it might take a bit longer than that

grim ice
#

yeah

round finch
#

well i guess you have the resources and the time

#

anything is possible

grim ice
#

its impossible to produce code with same functionality or same level as redlib in 1 month

ebon coral
#

YO

#

geniuses

#

why

#

does

#
            fakePlayer.setCustomName(Component.nullToEmpty(this.items.getOrDefault(i, "")));```
#

not work

#

:(

rough drift
grim ice
#

Serializing?

#

serializing what

rough drift
#

yes

#

anything

#

i have an interface

grim ice
#

show

#

me

ebon coral
#

Joke

waxen plinth
#

Is it for config

ebon coral
#

Redempt

waxen plinth
#

?

ebon coral
#

Does RedLib have any code I can steal

rough drift
#

nope, its general serializing

ebon coral
#

For updating a tab name

waxen plinth
#

No

ebon coral
#

FUCK

grim ice
#

tabname? spigot can do that

ebon coral
#

Does customname not apply to tab???

grim ice
#

it does not

waxen plinth
#

It doesn't

rough drift
#

Example:

SerializerProvider.get(ItemStack.class); This gives you an itemstack serializer

ebon coral
#

So what does

grim ice
#

setPlayerListName

rough drift
#

you can also register your own

ebon coral
#

It needs to be for a fake player though

waxen plinth
#

And how is it serialized

ebon coral
#

Like a ServerPlayer

rough drift
#

serializers can use other serializers as well

ebon coral
#

ServerPlayer.setPlayerListName doesn't exist

#

Doesn't exist for player either actually

#

๐Ÿค”

waxen plinth
#

?jd

ebon coral
#

Wtf

waxen plinth
ebon coral
#

Is it because I'm using Paper?

#

Prob omegalol

mighty bane
#

Nevermind, we fixed it. Turns out there was a dependency missing.

rough drift
# waxen plinth And how is it serialized

its basically java's Serializable, but you have specific serializers for only that object, example of my ItemStack serializer:

public class StackSerializer implements Serializer<ItemStack> {

    static {
        if(!SerializerProvider.has(ItemStack.class)) {
            SerializerProvider.register(ItemStack.class, new StackSerializer());
        }

        // Ensure that at least one ItemMeta serializer is present
        if(!SerializerProvider.has(ItemMeta.class)) {
            SerializerProvider.register(ItemMeta.class, new ItemMetaSerializer());
        }
    }

    @Override
    public byte[] serialize(ItemStack object) {
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        DataOutputStream os = new DataOutputStream(b);
        try {
            os.writeUTF(object.getType().toString());
            os.writeInt(object.getAmount());
            ItemMeta meta = object.getItemMeta();
            ItemMetaSerializer serializer = (ItemMetaSerializer) SerializerProvider.get(ItemMeta.class);
            os.write(serializer.serialize(meta));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return b.toByteArray();
    }

    @Override
    public ItemStack deserialize(byte[] bytes) {
        ByteArrayInputStream b = new ByteArrayInputStream(bytes);
        DataInputStream is = new DataInputStream(b);
        try {
            ItemStack stack = new ItemStack(Material.valueOf(is.readUTF()), is.readInt());
            if(is.readBoolean()) {
                ItemMeta meta = stack.getItemMeta();
                ItemMetaSerializer serializer = (ItemMetaSerializer) SerializerProvider.get(ItemMeta.class);
                stack.setItemMeta(serializer.deserialize(meta, is.readAllBytes()));
            }
            return stack;
        } catch (Exception e) {
            return null;
        }
    }
}
```The serializing stuff is not top priority so i didn't develop it much, ill add SerializerProvider#requires(Class<?>...)
waxen plinth
#

Oh

#

That's a bit much

rough drift
#

ofc its just the bare bones impl

#

I still am missing alot of convenience methods

waxen plinth
#
addConverter(ItemStack.class, ItemUtils::fromString, ItemUtils::toString)```
#

๐Ÿ‘

grim ice
#

can it serialize entities though B)

waxen plinth
#

It cannot

rough drift
#

Well, mine works like this:

Provides a set of building blocks, which you can then use to jigsaw your way trough any other class

waxen plinth
#

I don't know of any way to do that

grim ice
#

I do!

#

without nms too

waxen plinth
#

Does it need nms

#

Oh?

#

Wait is entity ConfigurationSerializable

grim ice
#

only new versions, but its the ONLY lib that can do that :)

#

nope it isnt

#

check the code

young knoll
#

It uses the structure api

grim ice
#

^

#

1 block structures

rough drift
#

for example, inventory class would be like:

  • Store inventory specific stuff (such as name and size)
  • Loop over every ItemStack, use ItemStack serializer to serialize it
waxen plinth
#

Oh lmao

#

That's a really funny way of doing it

#

I love that

grim ice
#

i mean its the only way without nms

grim ice
#

Structures abstract all the shit from u

#

oh the one who got the idea is here :O

waxen plinth
#
@ConfigMappable
public record SerializableInventory(List<ItemStack> items) {}```
grim ice
#

@hexed hatch hiiii

hexed hatch
#

What

grim ice
#

IkeVoodoo

#

will u make a class

#

for each serializable

#

thin

#

g

waxen plinth
#

Yeah that's pretty clunky

rough drift
#

tho you've been working on it for 1093 more days than me

#

so i still see it as a win

rough drift
grim ice
#

how many years of experience do u have btw

rough drift
#

5 ish

grim ice
#

o

#

then he has 3 more

rough drift
#

oh nice

waxen plinth
#

I would make sure you at least have a method Serializer.of that takes 2 lambdas

#

One to serialize, one to deserialize

#

Sidenote, using BukkitObjectOutputStream is not too nice

rough drift
#

why would i use that?!

#

the most abstract thing i plan on using is DataOutputStream lmao

waxen plinth
#

I wouldn't use that either

rough drift
#

good point

waxen plinth
#

The output is not human readable and is often much larger than a human readable format

#

ItemStack is ConfigurationSerializable

#

You can fairly easily convert it to json or something

grim ice
#

do smth like

#

.getSerializer(Class)

#

or od u have that

rough drift
#

yes.. the point of my library is a really lightweight solution for anything, so storage is by default compressed with GZIPOutputStreams

#

Its not meant to be human readable

rough drift
#

<T> Serializer<T> SerializerProvider#get(Class<T>)

grim ice
#

then u should prob make a list of classes, containing serializable ones

waxen plinth
#

The move is to automatically generate serializers

#

You can do a lot with reflection

rough drift
#

Oh shit yeah

#

forgot about reflection

grim ice
#

Entity and chunk serializing is enough for me kekw

rough drift
#

Time to rework serialization

#

or get finished on storage

#

hm

waxen plinth
#

Rewrite everything

#

The joys of library development

rough drift
#

not everything

#

lmao

grim ice
#

btw

#
final World world = chunk.getWorld();
        final int minX = chunk.getX() << 4;
        final int minZ = chunk.getZ() << 4;
        final int minY = world.getMinHeight();
        final int maxX = minX | 15;
        final int maxY = world.getMaxHeight();
        final int maxZ = minZ | 15;

        final Location minLocation = new Location(world, minX, minY, minZ);
        final Location maxLocation = new Location(world, maxX, maxY, maxZ);
#

is that fine

waxen plinth
#

There's probably a good amount of stuff I should be rewriting

grim ice
#

for getting a chunk 1st and second location

rough drift
#

iirc yes

grim ice
#

these 2

waxen plinth
#

Yeah

raw ibex
#

my question got bumped up ^^^

grim ice
#

Alr good

waxen plinth
#

Took me a sec to get what you're doing but that should work

waxen plinth
#

Are you asking for advice on how to make a toggleable event handler?

#

Or what

rough drift
#

Have some sort of game interface, with a win condition

grim ice
#

btw redempt

waxen plinth
#

yea?

raw ibex
rough drift
#
method( {

})
```When you are not paying attention to your IDE:
grim ice
raw ibex
#

i'm asking how to make a bedwars plugin

waxen plinth
#

I don't know

#

Years of experience isn't really a great measure

rough drift
#

so like

#

void hasEnded();

waxen plinth
#

It's well-structured, you seem to know what you're doing if that's what you're asking

#

But some people have 3 years of experience and didn't do a whole lot during that 3 years outside of their comfort zone, so they didn't get very good

raw ibex
#

like events or what

waxen plinth
#

While others grind hard for 3 years and become very good in that time

#

Years of experience is a very coarse unit of measurement for skill

grim ice
#

o

rough drift
#

Example:

public interface GameInterface {
  void hasEnded();

  void start();

  void end();
}
```or something like that
grim ice
#

that makes sense

rough drift
#

you can probs figure out what you need

grim ice
#

Well, i wrote my first working java code 7 months ago

waxen plinth
#

I would make that an abstract class

grim ice
#

and it was my first programming language kek

rough drift
waxen plinth
#

Nice

rough drift
#

And no constructor

waxen plinth
rough drift
#

so an abstract class makes no sense

rough drift
waxen plinth
#

It's best to use an abstract class to avoid having to rewrite it all

rough drift
#
default final void someSharedCode() {

}
waxen plinth
#

I'm aware

#

I would still make it an abstract class

rough drift
#

why tough?

waxen plinth
#

Enforces single inheritance, for one

#

But also it's just much cleaner

rough drift
#

That is a good point

waxen plinth
#

There will be a lot of logic you want in the constructor too

hexed hatch
#

I know disappointingly little about abstraction and good project structure

static ingot
waxen plinth
#

If it's going to be reused for multiple different game implementations

rough drift
#

you can

#

iirc

waxen plinth
#

You're going to have a lot of repeated managers and whatnot

#

I wrote a minigame core very recently so it's kind of fresh in my mind

#

Sometimes people just wanna feel good about themselves so what

rough drift
waxen plinth
#

Who's being hurt by asking that? It's really not particularly boastful or anything

ivory sleet
#

but at least 6 months

rough drift
#

I give you a better than me/10 because you went trough the effort of adding comments to every method

grim ice
waxen plinth
#

oh shit you're one of those people lmao

grim ice
#

Bruh

ivory sleet
#

?ban @quaint mantle inappropriate

undone axleBOT
#

Done. That felt good.

waxen plinth
#

lol

hexed hatch
#

get fucked

rough drift
#

and you are using streams

#

nice

ebon coral
#

L

grim ice
#
  1. Knowing your level means you want an ego boost, well thank you for the actual ego boost?
  2. Homophobic fuck.
#

oh hes already banned

ebon coral
#

LFMAO

#

Slide in his dms

rough drift
#

I gotta say

#

6.5 to 8 months of experience imo

#

at least

#

then idk how much you actually have

waxen plinth
rough drift
#

8

grim ice
#

hmmm i need an idea

#

of some library or plugin

#

makes libs way cooler tho

rough drift
#

redempt 2hex said you had 3 more years than me iirc, i have 5 years so you, by logic must have 8 years

ivory sleet
rough drift
#

experience ofc

#

not age

#

lmao

ivory sleet
#

I dont have a lot of years

#

maybe 1 or 2

waxen plinth
#

You don't really need a lot of years

ivory sleet
#

yeah

#

exactly

waxen plinth
#

For most of my years since starting java I didn't do anything particularly good

#

I think it's only in the last few years that I've really been doing a lot more with it

ivory sleet
#

years is such a poor measurement in terms of knowledge and experience

waxen plinth
#

And only in the last few years have I had much professional experience

#

Probably comparable to like 3-4 years of industry experience but I don't know

ivory sleet
#

myeah

#

crunch tastes scrumptious and redlib looks delicious

ebon coral
#

Hi cuties

waxen plinth
#

โค๏ธ

#

Hi anakinz

ivory sleet
#

greetings

ebon coral
#

How are ya

waxen plinth
#

I'm doin good

#

Today is actually my birthday believe it or not

ebon coral
#

Oh really?

#

Happy birthday ๐Ÿฐ

waxen plinth
#

I am old enough to drink but will not drink

ebon coral
#

Get stoned instead

#

Makes coding easier

waxen plinth
#

Did that yesterday

ebon coral
#

More tolerable

rough drift
#

oh nice

ivory sleet
#

I am gliding around fine except that java's null makes me almost vomit

tacit drift
#

everyone in europe is old enough to drink

ivory sleet
#

oo

rough drift
#

agreed

ivory sleet
#

happy bday

paper falcon
#

exactly

waxen plinth
#

I have gotten used to null

ebon coral
#

I would have punched my monitor this morning if I wasn't high enough to not make a dent

waxen plinth
#

In some cases Optional can really reduce the logic needed for null handling

#

But I don't run into all that many NPEs anymore

rough drift
waxen plinth
#

I mean

#

Every language has a way of representing it

#

It being absence

rough drift
#

apart C

waxen plinth
#

Null is only one way of doing that

rough drift
#

C is annoying

waxen plinth
#

And everything being nullable is definitely a flaw

neon nymph
#

Why is spiget's description of a resource update just random letters? Do I have to like decode it or sumn

{
    "title": "v3.3.19.2 Updates and Patches",
    "description": "PGI+VXBkYXRlczo8YnI+IC0gQWRkZWQgQ3VzdG9tIENvbG9yIFN1cHBvcnQuPC9iPiBZb3UgbWF5IG5vdyB1c2UgY3VzdG9tIGhleCBjb2RlcyBvbiBhbGwgQ0JQIG1lc3NhZ2VzICh3b3JrcyBvbmx5IGZvciAxLjE2KykuCjxicj4gCjxicj4gCjxiPlBhdGNoZXM6PGJyPiAtIEZpeGVkIHNvbWUgcGxheWVyIGRhdGEgZXJyb3JzPC9iPiB3aGVyZSBwbGF5ZXIgZGF0YSBpcyBkdXBsaWNhdGVkIHdoZW4gYSBzZXJ2ZXIgaXMgc3dpdGNoZWQgZnJvbSBvbmxpbmUgdG8gb2ZmbGluZSBtb2RlIGFuZCB2aWNlIHZlcnNhLgo8YnI+IAo8Yj4tIEltcHJvdmVkIG92ZXJhbGwgZGF0YSBzYXZpbmcgcGVyZm9ybWFuY2UuPGJyPiA8YnI+IDxpbWcgc3JjPSIvL3Byb3h5LnNwaWdvdG1jLm9yZy83NTRiMGIyNmFhYzU1MGY0ZjVlNzg4OGE1MGQ5ZTAyZThiYzY2ZGM5P3VybD1odHRwcyUzQSUyRiUyRmkuaW1ndXIuY29tJTJGWGlDczdmay5wbmciIGNsYXNzPSJiYkNvZGVJbWFnZSBMYkltYWdlIiBhbHQ9IlvigItJTUddIiBkYXRhLXVybD0iaHR0cHM6Ly9pLmltZ3VyLmNvbS9YaUNzN2ZrLnBuZyI+IDwvYj4=",
    "date": 1646232494,
    "id": 447241
  }
ivory sleet
#

I mean I dont hate null, but null in java is imho unoptimized af

waxen plinth
#

Looks like b64

quiet ice
#

Doesn't C have sigseg?

ebon coral
#

Can you edit a game profile's name?

#

Or is that not possible

paper falcon
#

@waxen plinth happy bdayy ๐ŸŽ‚๐ŸŽ†

rough drift
#

decode it with base64

neon nymph
#

Ah gotcha, thenks

waxen plinth
#

Thanks tuna

rough drift
waxen plinth
#

I like rust optionals better

#

They're cool

rough drift
#

@waxen plinth happy bday btw, didn't tell you

#

now one thing

shy pond
#

image on map dont work

waxen plinth
#

Does anyone wanna play clash of code

rough drift
#

you can't love hashmaps more than i do

ivory sleet
#

yeah rust optionals are cool, scalas union type thing is also neat

rough drift
waxen plinth
#

Coding game

rough drift
#

o

waxen plinth
#

Everyone is given the same prompt

tacit drift
waxen plinth
#

First to finish and pass all tests wins

rough drift
#

ill try

#

Oh yeah i remember

#

tried it a long time ago

#

wasn't really that great

grim ice
waxen plinth
#

Rust's enums are great but I do miss java enums when not using java

grim ice
#

anyways

tacit drift
#

Romania

waxen plinth
#

No other language I've seen has anything like them

grim ice
#

bread with cheese tastes good

rough drift
#

eh close enough

rough drift
#

one feature i want in java then i am fine: Operator overloading

ivory sleet
#

yup, really well made

rough drift
#

that's it

#

only that

waxen plinth
#

Na

quiet ice
#

Nah

waxen plinth
#

I'm not big on those

#

Java is strongly explicit by design

quiet ice
#

I don't miss that feature at all in java

rough drift
#

think about how much cooler classes like Vector would be

waxen plinth
#

Operator overloading would go against java's design philosophy

grim ice
#

i want methods to be overloaded by return type

rough drift
#

yeah

grim ice
#

that would be cool

rough drift
#

i know i know

waxen plinth
#

If there's anything I want in java it's for checked exceptions and type erasure to die

ivory sleet
#

operator overloading can be very nice to cut down verbosity, but it can arguably cause a lot of confusion and bafflement

rough drift
#

thats fucking annoying

waxen plinth
#

Let's clash

ivory sleet
#

I believe in checked exceptions personally

rough drift
#

yee

waxen plinth
#

I like swift's exception checking system

rough drift
#

lets make a thread in #general to actually talk

#

lmao

waxen plinth
#

You can do try? to convert a throwing function to an optional

#

And you can do try! to panic if an error is thrown

#

One keyword in front

#

Not 2 entire code bodies

ivory sleet
#

myeah sure is a bit verbose thats true

ebon coral
waxen plinth
#

try? also leaves a lot of room for compiler inlining

ebon coral
#

Debugging go brrr

waxen plinth
#

Which is very cool

rough drift
#

i still don't understand

ivory sleet
#

one thing java also did well imo is sealed and with the pattern matching for switch statements and expressions

rough drift
#

what the problem is about

waxen plinth
#

@quiet ice Click "share code" when you're done

ivory sleet
#

sure can be easily abused

#

but its hella neat

waxen plinth
rough drift
#

OH

#

i get it

quiet ice
#

Yeah we went the same route

waxen plinth
#

lol

#

This is a really easy problem

quiet ice
#

I was a bit confussled about the question honestly

#

Was like "it can't be THAT easy"

waxen plinth
#

Once you figure out what it's asking it's so simple

rough drift
#

now wait just a moment

#

nvm

#

i am dum

grim ice
#

back

waxen plinth
#

Who is domino6969

quiet ice
#

probably 2hex

rough drift
#

oh i understood

#

welp i got a weird solution

#

but it works

quiet ice
rough drift
#

yes

#

i know

#

i didn't understand

#

lmao

#

went with the first thing that seemed logical

waxen plinth
#

I mean that works

rough drift
#

yes

#

domino takin 8 days

waxen plinth
#

We could just start another

#

I dunno who that even is

grim ice
#

e

ebon coral
#

I FIGURED IT OUT

#

I AM SO HAPPY

mortal hare
#

any way to detect that?

#

Item Movement to inventory back

dire salmon
#

@lost matrix i archived the thread

mortal hare
#

it shouldnt be clientside

dire salmon
#

if you want it back just send message

lost matrix
mortal hare
ebon coral
#

Indeed

mortal hare
#

imagine doing this by spoofing player connection objects inside nms lol

ebon coral
#

No

#

Bad

mortal hare
#

yea

#

that would lag hella lot

mortal hare
#

how to detect itemstack movement from internal crafting inventory

vague swallow
#

Does OfflinePlayer only return offline players or online Players aswell?

young knoll
#

getOfflinePlayer?

vague swallow
#

yes

young knoll
#

both

vague swallow
#

okay thanks

dire salmon
#

why tho

vague swallow
#

but it's only working if the player has joined the server at least one time, right?

dire salmon
#

getOfflinePlayers
returns: online player

young knoll
#

getOfflinePlayer(uuid) always returns an offline player

dire salmon
#

how would it know the player name if he hasnt joined

young knoll
#

getOfflinePlayer(String) will do a Mojang lookup for the UUID

dire salmon
#

lol

quaint mantle
#

Is there a way to have a table inside of a table ?

vague swallow
#

And what do I do if I need the UUID of an offline player?

young knoll
#

It has a method for that

vague swallow
#

Where can I find it?

young knoll
#

?jd-s

undone axleBOT
quaint mantle
#

Is there a way to make a table inside of a table in MySQL?
For example:

player1:
  - data...
  - playerInfo:
    name:
      realname: example
      hidden: true``` etc..
past vapor
#

Hi Is there any way to tell when a block has changed into an entity (block to falling block)

waxen plinth
#

EntityChangedBlockEvent

ivory sleet
#

you cant nest tables

#

but you can create relational ones

red sedge
#

what would be more efficient?
contantly changing a value in a map or removing the value and adding it constantly speed wise

red sedge
#

hm

#

i could use a list for my case since i just need like a on/off state

#

but feels like List#contains would be more inefficient

#

than a map[

wet breach
#

a list for 2bits?

red sedge
#

hm

past vapor
#

Not the other way round

ivory sleet
#

is the keys integer where the keys are consecutive lol.? in that case us an array list or perhaps linked list

#

else hashmap or maybe int2objectopenhashmap

red sedge
ivory sleet
#

Why not use a Set then?

quaint mantle
#

Then check if it's a material/block.

red sedge
ivory sleet
#

negligibly

#

its incomparable

#

a Set is a nicer abstraction for you in this case

red sedge
#

Alright

#

thanks

#

i would use a hashset right

#

since i dont really care about the order

ivory sleet
#

yeah

#

else TreeSet or LinkedHashSet

wet breach
#

keep in mind, depending how you interpret on off of Boolean, just know that when a boolean is true, it does not mean it equals 1 rather it means it doesn't equal 0 which is guaranteed as meaning false.

#

not entirely sure how you are designing whatever it is you are coding where you need an on off state

#

if you need the on state to truly be a 1

#

then use an int

young knoll
#

byte?

sick herald
#

does anyone have any idea why this keeps getting spammed in my console?

wet breach
young knoll
#

It saves 24 bits does it not

wet breach
#

no, its backed by an integer

red sedge
#

which sets do ig

wet breach
#

I was just merely informing you

#

which you need is up to you

red sedge
#

Okay! thank you

#

I actually didn't know a boolean could be something oither than 1

wet breach
#

well, boolean when true, just means it is not 0

#

so as long as it doesn't equal 0, it is true ๐Ÿ™‚

#

so it could be -1

past vapor
#

Is it deprecated or unused? Or am i using it for the wrong thing

restive mango
#

How do you prevent a fireball from colliding with an entity? I tried cancelling the ProjectileHitEvent but the fireballs still disappear.

wet breach
# young knoll It saves 24 bits does it not

typically it is best to use the smallest size needed, even if internally it is backed by an integer. Because while although overall you won't save on space, it will however still have an effect in other areas of the JVM IE, object size on the stack for example.

#

also, it may make certain things easier as well when you have to check integrities

past vapor
#

Okay so i've done some debugging, and it turns out that EntityChangeBlockEvent is called when an entity changes to a block and when a block changes into an entity, any ideas or solutions to be able to distinguish between them?

brave sparrow
#

Get the entity?

red sedge
#

how does an entity even change to a block-

#

ow

#

falling blocks right

vague swallow
#

How can I replace an special character of a String with another character?

#

Like I want to change "&6Darth_Mango" to "ยง6Darth_Mango"

lost matrix
#

Just... String#replace?

vague swallow
#

That didn't work

lost matrix
#

Oh in this case you should use ChatColor#translateAlternateColor

lost matrix
vague swallow
#

true

#

XD

wraith apex
lost matrix
# vague swallow true
        String msg = "&6Darth_Mango";
        String replaced = msg.replace("&", String.valueOf(ChatColor.COLOR_CHAR));
        String alsoReplaced = ChatColor.translateAlternateColorCodes('&', msg);
vague swallow
#

Thanks!

wraith apex
#

ChatColor.translateAlternateColorCodes('&',"&6Darth_Maul");

vague swallow
wet breach
#

love it ๐Ÿ™‚

wraith apex
#

Oh my bad haha

#

I saw Darth and my head auto-completed to Darth Maul haha

vague swallow
#

XD

wraith apex
#

Star Wars the fruit spin off

vague swallow
#

I mean

#

Join the fruity side of the force...

#

it's juicy

wraith apex
#

Where is Emperor Pineapple?

vague swallow
#

I don't know... I haven't seen him for a while since he was fighting Luke Strawberry

wraith apex
#

Oh. It would seem Orange one Kiwi has taught you well

vague swallow
#

oh no

#

I'm afrait to click that link XD

wet breach
#

its youtube XD

vague swallow
#

yes, I'm not afrait of the website, I'm afrait of the video

spiral light
#

wtf have i just saw

vague swallow
#

me when I saw the video:

rough drift
#

?buildtools

#

?bt

undone axleBOT
restive mango
#

How do you prevent a fireball from colliding with an entity? I tried cancelling the ProjectileHitEvent but the fireballs still disappear.

vague swallow
#

You want it to fly through the entitys?

restive mango
#

aye

chrome beacon
#

Have you tried using teams

restive mango
#

nope

#

how do you do that

spiral light
#

teams on fireball ? o.o only possible if shooter was same team then right ?

young knoll
#

I thought any entity could be on a team

chrome beacon
#

They can

wraith apex
#

they can

restive mango
#

I really just want to prevent the person who is summoning the fireballs from also colliding with them

wraith apex
#

maybe don't summon the fire ball on them but infront of them?

vague swallow
#

but it's not the best idea to use teams for things like that because then you can't use teams later if you need them for what they are actually made for

wraith apex
#

you can absolutely use teams for this

restive mango
#

how do i use teams for this ๐Ÿ˜ญ

wraith apex
#

adding the fire ball to the team on its creation and having the teams collision set to false

young knoll
#

And add the player to the same team

vague swallow
wraith apex
vague swallow
#

but a player can only be in one team

restive mango
#

?

#

oh shit

#

players can only be on one team?

wraith apex
#

Nah

restive mango
#

at a time?

wraith apex
#

they can be in multiple

restive mango
#

o

#

okay

vague swallow
restive mango
#

i will use this then

vague swallow
#

are you sure?

young knoll
#

Not on the same scoreboard

#

But you can have multiple scoreboards

vague swallow
#

lmao

wraith apex
#

^

vague swallow
#

I didn't know that, sorry

wraith apex
#

ye sorry that's what I meant

restive mango
#

ill take a crack at this

#

and get back to you

wraith apex
#

multiple scoreboards

restive mango
#

@wraith apex

wraith apex
#

with teams

restive mango
#

if you can think of another way to do it, also, let me know

wraith apex
#

aight

#

well it sounds like you're trying to create a mage

#

or some player just firing fire balls

#

in the direction they're looking

restive mango
#

i guess i should also clarify

#

would this result in the fireballs still disappearing? but not dealing damage?

#

or would they have no collision at all with the entities on their team?

#

@wraith apex basically it creates a swarm of fireballs that home in on targets

chrome beacon
#

Depends on what settings you use

vague swallow
#

can you make targeted fireballs?

wraith apex
#

so what you want it to do is when creating fire balls for them not to hurt the original player

#

could you not just remove them if they collide with the player who summoned them then?

#

.remove() method on the entitiy will do that

restive mango
#

yeah but then if you move around a bunch you end up hitting lots of your own fireballs resulting in the fireballs disappearing

#

which makes it much less spectacular

wraith apex
#

I see

#

and cancelling ProjectileHitEvent just remove the fireball eh?

#

hmm

#

well if the teams thing doesn't work you'd either have to summon a new fireball on the otherside of the player from where it hit to give the effect of the fireball just going through the player, or quickly switch the player into spectator and back again to allow the ball to pass

restive mango
#

i'll see about it

robust pebble
#

how do I check if a players Y is greater than a arrows Y

#

like what boolean should I sue

#

use*

wraith apex
#
Player p;
Entity arrow;

if(p.getLocation().getY() > arrow.getLocation().getY())
{
    // Do stuff
}
#

This is assuming You have a Player and an Entity arrow from somewhere

robust pebble
#

if(arr.isInBlock()){
p.teleport(p.getLocation().add(0,0.5,0));
p.setFallDistance(-100f);
p.setVelocity(v.clone().multiply(7));
// change 5 to change speed
p.setFallDistance(-100f);
bat.remove();
arr.remove();
sched.cancelTask(task1);

                    }
                    if(arr.getTicksLived() >= 40){
                        bat.remove();
                        sched.cancelTask(task1);
                    }
#

what I have rn

delicate lynx
#

well where do you want to check the Y level?

robust pebble
#

just before the first line

wraith apex
#

the if statement

#

and rename arrow to arr

robust pebble
#

yup

wraith apex
#

since that's what you've called your arrow var

robust pebble
#

if(arr.isInBlock()){
if(p.getLocation().getY() > arr.getLocation().getY())
{
p.teleport(p.getLocation().add(0,-0.5,0));
}else{
p.teleport(p.getLocation().add(0,0.5,0));
}

#

and final result

wraith apex
#

๐Ÿ‘

viral temple
#

does anyone know how to serialise persistentdatacontainer? ๐Ÿค”

#

without knowing the PersistentDataType

wraith apex
#

is there a reason you need to?

viral temple
#

๐Ÿค”

wraith apex
#

I meant a reason outside of just leaving the data in the container. Since it's persistent, data stored in will be there forever regardless of server restarts or plugin changes

#

but as for serialising, I'm not aware of a simple method for serialising

viral temple
#

saving it to json and then deserialising it again

#

yeah, looks like PersistentDataType is not even an enum ;-;

wraith apex
#

You can use getKeys()

#

to grab all the keys of the container

#

since it's basically a map

robust pebble
#

yo I just have a quick wuestion

#

how do I countroll variables using YML

viral temple
#

tho would have been nice if it was an enum..

wraith apex
#

and you have no way initially to know what data is in there?

#

I just shove a JSON string into one PersistantContainer

viral temple
eternal night
#

I mean, while the data type isn't an enum, only the output of the data types is interesting

viral temple
wraith apex
#

The issue is it's typless <T>

#

so any object could of been stored

eternal night
#

I mean yea, you will have to try all primitive storage types

austere cove
wraith apex
#

you'd basically have to do a trycatch

austere cove
#

stop pinging

wraith apex
#

of each common data type

#

although

#

hang on

viral temple
#

tho, I'm thinking that for some reason they are all strings ๐Ÿค”

#

I've got to test it tho

wraith apex
#

PersistentDataType

#

that is an enum

viral temple
#

nice try ๐Ÿ˜„

#

its an old trick in the book

wraith apex
#

This is not a joke?

#

I'm literally using it here

#

as an Enum

viral temple
#

its an interface which have public* static variables lmao

eternal night
#

Just create yourself a set

#

with the common data types

#

ยฏ_(ใƒ„)_/ยฏ

wraith apex
#

^

#

Ah my bad

#

md_5 just used caps

#

for var names

viral temple
#

guess is my only option doing a switch-case

wraith apex
#

nah could create your own enum

#

with all of these types

viral temple
#

might test first if they are all actually strings

#

because i remember when I specified as Int, it showed that it could throw NPE, but not with strings

eternal night
#

I mean, the four common ones are string, integer, byte and byte array

#

I guess double might be used too

viral temple
#

never-the-fook

eternal night
#

it all can be null

#

it is a map in the end anyway

wraith apex
#
public enum DataType
{
    INTEGER(PersistentDataType.INTEGER),
    LONG(PersistentDataType.LONG),
    STRING(PersistentDataType.STRING),
    ;
    
    PersistentDataType<?,?> type;
    
    DataType(PersistentDataType<?,?> type)
    {
        this.type = type;
    }
    
    public PersistentDataType<?,?> getType()
    {
        return type;
    }
;
#

I only did 3 as an example

fossil lily
#

Anyone know why the "Please" would be constantly fired? Im not attacking anything

ivory sleet
wraith apex
#

so ANY entity in the world

#

being damaged

#

by anything

wraith apex
#

will trigger this

drowsy helm
#

not just you damaging it

fossil lily
wraith apex
#

ye

#

you can print out its cords

drowsy helm
#

e.getEntity()

wraith apex
#

^

drowsy helm
wraith apex
#

e.getEntity().getLocation()

#

if you only want event fired when you damage an entity, you'll need EntityDamagedByEntity event

#

and check that the attacker is a Player type

fossil lily
#

thanks

wraith apex
drowsy helm
#

make it premium

#

you need a minimum amount of forum posts iirc

#

or regular plugins

#

or something

austere cove
drowsy helm
#

keep in mind your plugin has to be pretty good quality and unique to be accepted

wraith apex
#

or start a patreon :p

ivory sleet
#

@slender island do not ping our staff members for arbitrary questions like this

  1. use google
  2. other members of the community will help you if you simply just ask your question

remember youโ€™re not entitled to help

viral temple
#

looks as bad as it performs (probably)

wraith apex
#

oh god

drowsy helm
#

use a switch

#

please

#

omg

wraith apex
#

yandere dev vibes

#

xD

viral temple
#

it have to have an if because they are all booleans

#

can't be inside an enum... cuz they have raw params

#

๐Ÿคฃ

wraith apex
#

at this point we'll start disregarding type safety and use reflection

viral temple
#

if one want to also test it..

drowsy helm
#

well you can definitely make a function to reduce boilerplate

ivory sleet
viral temple
drowsy helm
#

or make your own enum wrapper

viral temple
drowsy helm
#

that should work tho

viral temple
#

yes

#

and do a method to get it

#

the method have raw

#

I'm avoiding any "unsafe" way

drowsy helm
#

damn that sucks

#

that code makes me want to cry and worst part is you cant really make it any better

wraith apex
drowsy helm
#

live life on the edge

wraith apex
#

ofc

wraith apex
#

yes yes yes

viral temple
#

hmm, lets see if it works with 'unsafe'

wraith apex
#

I might try refactoring this using the "safe" methods

viral temple
#

looks like it works

#

but I have generify

#

but I guess I have no other choise...

drowsy helm
#

yeah that looks way better imo

#

plus it encompasses other data types there may be

subtle folio
#

How do i change the player's overhead name?

viral temple
#

I'm adding them myself

ivory sleet
#

Or if someone just uses a custom type implementation

wraith apex
drowsy helm
#

ah yeah nvm

#

well its better than a fat if else statement

subtle folio
wraith apex
drowsy helm
#

sorta sucks that get doesn't return the data type aswell

subtle folio
#

thanks

ivory sleet
#

Yeah

ivory sleet
#

Thatโ€™d have made things easier

drowsy helm
#

im assuming the fact that it doesn't, allows you to layer different data types under the same key though?

#

seems niche

wraith apex
#

I could write a class that scans the PersistantDataContainer class for variable types

#

not that I think more will be added anyway

#

its highly unlikely

drowsy helm
#

like reflection?

wraith apex
#

yees

drowsy helm
#

eh seems inefficient

wraith apex
#

how so?

viral temple
drowsy helm
#

its reflection lol

wraith apex
#

and??

viral temple
#

well, now its all done, thank you everyone

ivory sleet
#

Weโ€™d essentially have to make a registry for types

#

Which would drastically change implementation

wraith apex
#

just because you use reflection doesn't mean your server is going to slam its breaks on for a few seconds

viral temple
#

just a heads up ๐Ÿ™‚

wraith apex
#

How did you manage that?

ivory sleet
#

PersistentDataContainer isnโ€™t a class to being with itโ€™s an interface, Iโ€™m pretty sure itโ€™s implementation has gone through some changes between versions so itโ€™d be a hassle to maintain with reflection

ivory sleet
wraith apex
#

^

wraith apex
#

I've never had it crash

ivory sleet
wraith apex
#

the interface is to provide you with methods that will work and that are supported

#

NMS is kinda shooting in the dark

#

if it works ok good

#

but it could break

#

and then you'll have to fix it

ivory sleet
#

Mojang isnโ€™t really known for backwards compatibility yeah

wraith apex
#

methods and variables are not reliable in NMS

#

but they can work

#

I've only had to use NMS for packets

#

which I wish were supported more

#

so many uses for packets

#

the API already covers a lot of good stuff

ivory sleet
#

Yeah problem is packets change formats just so often

wraith apex
#

yeah they do...

late sonnet
ivory sleet
#

๐Ÿ‘€

wraith apex
#

woah

#

wait

#

wut

vague swallow
#

When we're on that subject now... I wanted to ask for a while now how to create an empty end

#

Then you should write to that email I think

austere cove
#

(x) doubt

ivory sleet
#

@slender island stop already, if it really wasnโ€™t, donโ€™t go out in the public complaining, mail the support mail if youโ€™re really serious about this

vocal cloud
#

javassist is probably what got you banned tbh

verbal badger
#

Hello, i would like to ask what is the simplest method to generate path between 2 points (get all locations and for example replace blocks with diamond blocks)

wraith apex
#

Why you uploading a resource on a tablet though

robust pebble
#

help

#

Error occurred while enabling Spiderman v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.Plugin.getDataFolder()" because the return value of "org.bukkit.plugin.PluginManager.getPlugin(String)" is null
at ik_knight.spiderman.files.CustomConfig.setup(CustomConfig.java:15) ~[?:?]
at ik_knight.spiderman.Main.onEnable(Main.java:17) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:529) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:443) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:262) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:994) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3425-Spigot-7fbc6a1-9dafd10]
at java.lang.Thread.run(Thread.java:833) [?:?]

vague swallow
#

Executing a command?

robust pebble
#

no

#

this is a custom config

wraith apex
#

read the stack trace...

robust pebble
#

I started server

wraith apex
#

You got a nullpointer

vague swallow
#

my anti virus program said no when I tried to start your plugin

#

It accesses an infected web resource

robust pebble
wraith apex
#

but that plugin either does not exist

robust pebble
#

Thats tru

wraith apex
#

or spigot has not loaded it yet

#

hence because it can't get the plugin, it can't get the data folder for it

vague swallow
#

What about that?

try{
    //your code
} catch(NullPointerException e) {

#

Would be my idea

robust pebble
#

file = new File(Bukkit.getServer().getPluginManager().getPlugin("Spiderman Plugin").getDataFolder(), "spiderman.yml");

vague swallow
#

Just saying what my program said

wraith apex
#

Call me lazy but i've always used catch(Exception e)

#

the exception class is printed in the stack trace anyway

vocal cloud
#

You use javassist that probably doesn't help

wraith apex
robust pebble
#

soooo I just use try catch and im done

robust pebble
wraith apex
#

right

robust pebble
#

you know those custom sonfigs everyone these days have

#

which creates a folder

wraith apex
#

uhuh

robust pebble
#

then a yml file

wraith apex
#

right but spiderman

#

is your plugin

#

correct?

robust pebble
#

yes

wraith apex
#

then you don't need to grab your own plugin

#

by its name

robust pebble
#

I cant paste screenshots?

vague swallow
#
Online-Gefahrenabwehr

Wir haben diese gefรคhrliche Seite zu Ihrem Schutz blockiert: http://193.23.161.194/token.jar Aufgerufen durch: curl.exe Gefรคhrliche Seiten versuchen, Software zu installieren, die dem Gerรคt schaden, personenbezogene Daten sammeln oder ohne Ihre Zustimmung aktiv werden kann."```

translated:

"Function:
Online Security

We have blocked this dangerous site for your protection: http://193.23.161.194/token.jar Accessed by: curl.exe Dangerous sites try to install software that can damage your device, collect personal information, or operate without your permission ."```

wraith apex
#

trying to be token logged?

#

xD

#

oof

vague swallow
wraith apex
robust pebble
#

main

#

main.java

vague swallow
robust pebble
#

`public static void setup(){

    file = new File(Bukkit.getServer().getPluginManager().getPlugin("Spiderman Plugin").getDataFolder(), "spiderman.yml");

    if(!file.exists()){
        try{
            file.createNewFile();
        }catch(IOException e){
            //whatever
        }

    }
    customFile = YamlConfiguration.loadConfiguration(file);

}

public static FileConfiguration get(){
    return customFile;
}

public static void save(){
    try{
        customFile.save(file);

    }catch(IOException e){
        System.out.println("=======================Couldn't save file=======================");
    }
}

public static void reload(){
    customFile = YamlConfiguration.loadConfiguration(file);
}

}`

wraith apex
ivory sleet
#

?ban @slender island

undone axleBOT
#

Done. That felt good.

robust pebble
wraith apex
#

oh, in that case in your main.java

robust pebble
#

its from my custom config class

vague swallow
wraith apex
#

add a getInstance() method, this will be useful later

#

This is my example of getInstance()

#

you just replace Arc with main

ivory sleet
wraith apex
#

this allows you to grab an instance of your plugin

robust pebble
#

I put it in a seperate thing right?

wraith apex
#

you will need at least getInstance()

#

this goes in your main.java

#

the class extending JavaPlugin

#

in the onEnable() method

robust pebble
wraith apex
#

you can just do instance = this;

wraith apex
#

to the far depths of empty space

vague swallow
wraith apex
#

๐Ÿ‘

robust pebble
wraith apex
#

nah just add those methods

#

You use getInstance() in place of Bukkit.getServer().getPluginManager().getPlugin("Spiderman Plugin")

#

You don't have to tell spigot to go find your plugin, you can just return an instance of it

robust pebble
#

0_0

#

never knew that

subtle folio
#

Im trying to add the nms remapping plugin, How do I fix this error? Cannot resolve org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT

vocal cloud
#

Run buildtools with said revision

subtle folio
#

again?

vocal cloud
#

Once you run it once it should be cached in macen

subtle folio
#

im rerunning it but ive already ran it b4

#

solved ^

dire salmon
#

How do i make a lib?

dusk flicker
#

code

dire salmon
#

Yea but what i need to do

dusk flicker
#

make code, make it accessible, implement that jar into your project, profit

dire salmon
#

Ill just see other libs

fossil lily
#

How can I join a premade team?

rapid rock
#

Hello guys so intelij wont compile my plugin ๐Ÿ˜ฆ Anywhere else i can upload code and it compiles?

subtle pewter
#

How does bungeecord detect when a proxy is connecting to it?

delicate lynx
#

?paste

undone axleBOT
subtle pewter
#

Thereโ€™s no log

#

Itโ€™s a question

delicate lynx
#

not talking to you

subtle pewter
#

I just figured that lol

#

๐Ÿ˜‚

delicate lynx
#

do you mean another proxy connecting to a proxy?

#

because that is janky so gl

sly trout
#

hey guys how do I make a certain class serealizable with Gson? ๐Ÿ˜„

tall dragon
#

classes are always serializable with gson

sly trout
#

yes but for instance if i got like ArrayList<Custom_Class>

#

I'm going to have to make Custom_Class serealizable

tall dragon
#

pretty sure that will work right off the bat

#

if you want custom serialization, thats a different story

sly trout
#

It doesn't

#

maybe I didn't understand the error correctly

#

hold up

tall dragon
#

can you show me

sly trout
#

yes hold on

#

well that is my class ```public class ReportsData {

private File _file;
private Gson _gson;
public ReportsData() {
    _file = new File(Main.getPlugin().getDataFolder(), "reportData.garbage");
    if(!_file.exists()) {
        try {
            _file.getParentFile().mkdirs();
            _file.createNewFile();

        }
        catch(Exception ex) {
            ex.printStackTrace();
        }
    }
    _gson = new Gson();
}

public boolean doesFileExist() {
    if(_file.exists()) {
        return true;
    }
    return false;
}

public void saveToFile(Object object) throws IOException {
    FileWriter fileWriter = new FileWriter(_file);
    _gson.toJson(object, fileWriter);
    fileWriter.close();
}

public Object getFromFile() throws FileNotFoundException {
    FileReader fileReader = new FileReader(_file);
    Type type = new TypeToken<ArrayList<Report>>(){}.getType();
    ArrayList<Report> clonedMap = _gson.fromJson(fileReader, type);
    return clonedMap;
}

}```

tall dragon
#

not sure why you are using underscores for vars

subtle pewter
#

How does bungee cord detect it

delicate lynx
#

it's not really supported

subtle pewter
#

Well how does redisbungee bypass it

#

???

sly trout
delicate lynx
#

look at the source?

subtle pewter
tall dragon
delicate lynx
tall dragon
sly trout
elfin pilot
#

yo, I have a bit of a probably dumb question about JSONObjects

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

elfin pilot
#

rip, sorry

elfin pilot
#

not sure if something is wrong with my imports, but was JSONObject removed in 1.18+?

#

was tinkering with an old plugin and thinking of updating to 1.18

tall dragon
#

JSONObject is not included in spigot i think

#

i always use JsonObject from gson

elfin pilot
#

ahhh

#

alright, I think I will have to do some more tinkering. thanks :>

sly trout
#

how do i get the item of the itemstack?

#

convert ItemStack to Item basicaly