#help-development

1 messages · Page 840 of 1

sterile flicker
#

What an inattentive person I am, I put _ instead -

#

....

#
net.minecraft.server.v1_8_R3.ExceptionWorldConflict: The save for world located at ./party is being accessed from another location, aborting```
#

new error

#

it looks like i need to remove the players first

quaint mantle
#

@river oracle
You fucked my ass so hard in the benchmarks

sterile flicker
#

.....

quaint mantle
# remote swallow proof?

Benchmark still running, but the avg time of the first test, for both. The difference is about 3 microseconds

remote swallow
#

kek

#

hold on lemme find the minimessage jmh stuff

viral temple
#
            register("test_argument", TestFunctionArgument.class, new EmptyArgumentSerializer(TestFunctionArgument::testFunctionArgument));
            register("test_class", TestClassNameArgument.class, new EmptyArgumentSerializer(TestClassNameArgument::testClassName));
        }```
how sure are we that we can't register custom argument types in brigadier?
remote swallow
#

838 nano seconds v 2240

river oracle
#

that becaues MiniMessage and adventure is more abstracted its bound to be slower

remote swallow
#

also i think thats old parser

#

whats the new one at

river oracle
#

that comes with being platform agnostic

river oracle
river oracle
#

Also I made syntax sacrifices for speed

quaint mantle
remote swallow
river oracle
#

for example replacements are just <$key>

#

also for ! we do bold:! instead of <!bold> which the latter is defintely more syntactically pleasing

remote swallow
#

as long as its under a half a milli per parse for a very detailed

sterile flicker
river oracle
#

the new parser only takes around 200 nanoseconds off the top which is negligable

#

however the new parser is also much more maintainable

sterile flicker
#

what is the way to save the contents the custom inventory that the player will fill

#

?

rotund ravine
#

just save a custom inventoryP?

sterile flicker
#

how?

rare rover
#

so if i have a cache map with the weakKeys, if i leave the game will it automatically be removed from memory by the GC?

#

just for testing purposes ofc

remote swallow
#

the uuid wouldnt be deleted

#

the player would

rare rover
#

So i should replace it with player?

sterile flicker
#

suppose I have a custom inventory created, I want that before playing a mini-game, the inventory opens in front of the player and you can put things down and it will not close until all things are folded and after the player leaves the game, open the inventory again, which will not close until all things are taken how do I save these are the inventories

rare rover
#

cant the object player cause memory leaks?

#

uuid is better?

rotund ravine
rare rover
#

that's what i heard at least

remote swallow
#

the weak key stops the mem leak

rotund ravine
#

so having that as weakkeys on spigot is fine.

rare rover
#

oki, ty

#

🙂

sterile flicker
inner mulch
#

is it possible to move an armorstands head really smooth? (i tested a few things and i didnt turn out super smooth)

shadow night
remote swallow
#

oh cowoconluwube is here, he can explaion

ivory sleet
#

Well its not exactly a pointer, but well, weak keys basically wraps the key objects around in a WeakReference

#

and WeakReference is a specially treated jvm class where the weak ref is not preventing its referent object from being gc’d eventually unlike normal strong references (such as instance variables and local variables when in scope)

ivory sleet
# rare rover

Here its not necessary at all to have weakKeys, instead just make it expire on access/write and maybe invalidate an entry if the corresponding player to that uuid key happens to log off

#

maximum size may also be dangerous in the case of that you wanna track all online players quests (since u might discard unsaved data unknowingly), tho ultimately depends on how u handle caching etc

river oracle
#

if you do use maximum size its best to have removalListeners

#

that way you can ensure tossed data actually is saved

vale knoll
#

Hello, I am trying to check to see if a player has a certain score on a scoreboard objective. The scoreboard won't be visible to the player. The scoreboard is being made via a datapack, so all the plugin has to do is read from it to get the player's score. Here's what I have, which isn't working:

        Score score = e.getPlayer().getScoreboard().getObjective("ph_questingstatus").getScore(e.getPlayer().getName());
        e.getPlayer().sendMessage("" + score.getScore());
        if(score.getScore() == 1) {
            e.getPlayer().sendMessage("The Nether is unavailable in Quest Mode!");
            e.setCancelled(true);
        }
#

score.getScore() is printing out 0, while it is actually 1.

rotund ravine
#

Mods

quaint mantle
#

just do the actions on both of them.

minor junco
#

Just based on assumptions, but I assume you have your own sub coordinates that you simply offset in the world to get the absolute positioning, no? Maybe having a Bukkit task running that keeps track of the position of your vehicle to which you then offset your seat's relative location? (If we're talking about positioning)

upper hazel
#

the itemStack is not hashed in the map when it is created In minecraft?

river oracle
#

no ItemStack's are not hashed when you invoke their constructor

#

they are hashed when you insert them into maps

kindred trellis
#

how do i rebuild a plugin that i made for 1.19 to 1.20?

wet breach
#

change out the dependency and see if there is any errors, if there is no errors I don't think you have to do anything as it should work 🙂

kindred trellis
#

in plugin.yml?

quaint mantle
kindred trellis
quaint mantle
#

are you using gradle or maven

wet breach
#

can't really call it an old project if you don't have the sources anymore

#

and its not that old if its 1.19

kindred trellis
#

i have the sources but i didnt know much about making plugins when i was programming it

quaint mantle
storm jungle
#

where can i advertise myself :DDD

remote swallow
#

?services

undone axleBOT
kindred trellis
#

how do i check that? i know that i use maven on my newer plugins but im not sure about that one

storm jungle
#

check ur pom.xml

kindred trellis
#

i have no pom.xml lol

storm jungle
#

lmao

remote swallow
#

do you have a build.gradle?

storm jungle
#

is it even possible to not have it

kindred trellis
#

but its jjust working fine on new version so i guess we good

remote swallow
shadow night
gleaming grove
#

Is there any event called when I'm removing item from creative inv?

young knoll
#

no

#

that is client side

gleaming grove
#

ok so then is there any better way of checking if an player has item in inv then using taskrunner that loops player inv every X ticks?

carmine mica
#

you can listen to the InventoryCreativeEvent

young knoll
#

Won’t be called for the trash slot

carmine mica
#

wasn't the question.

#

then is there any better way of checking if an player has item in inv

#

the InventoryCreativeEvent is called whenever an item is created in the creative inventory which is every time an item is put into a slot

#

can you be more specific? The creative mode inventory can create any item with any nbt at will, there are 0 restrictions on the kind of item that can be put into the creative inventory (other than experimentally disabled items probably)

gleaming grove
heady apex
#

I still can't reference new 1.20 biomes/items in paper/spigot 1.20.4 does anyone else have this issue

young knoll
#

No

carmine mica
#

wdym reference? there are Material enum (ew) entries for them

young knoll
#

And biome enum entries

heady apex
#

IntelliJ autocomplete does not recognize Material.(any cherry stuff) or Biome.(cherry blossom biome) etc

#

Thus it's not found from the added library in project structure even while it builds and runs on 1.20.4

young knoll
#

Is the added library 1.20.4

heady apex
#

Yeah I deleted the older ones too from project structure just to be sure

steel swan
#

Is there an event that is called when players are splashed with a splash potion?

old sphinx
#

anyone know how to get custom textures on my scoreboard?

heady apex
#

Or PotionSplashEvent

delicate obsidian
#

hey, I created a custom armor trim and trim color/material with a datapack and a resourcepack, Can I access somehow to these in a plugin?

I know I can do new ArmorTrim(TrimMaterial.something, TrimPattern.something) but idk if this can be used with custom datapack trims

young knoll
#

That’s a thing you can do?

#

You can probably get it via Registry

carmine mica
#

yeah, get it from the registry

#

Registry.TRIM_PATTERN, Registry.TRIM_MATERIAL

quaint mantle
young knoll
#

You could also just get the shooter…

river oracle
#

that, that would be too easy

eternal night
#

@young knoll wanna move CreativeCategory enum to an interface 😉

#

thanks in advance

river oracle
#

is there even a reason to do that

eternal night
#

Well it is registry based

remote swallow
#

Registry back?!?

river oracle
#

aren't CreativeCategories jank as fuck anyways on the server

eternal night
#

so

#

hm ?

#

Well yea, the current API struggles a tad

river oracle
#

I'm just curious how its useful since I'm pretty sure those aren't synced

eternal night
#

not yet ™️

remote swallow
#

Lynx are you still a wizard

eternal night
#

neither are cat types

river oracle
#

or at one point they stopped being synced

eternal night
#

I mean, more than just synced regs have been converted

#

and I don't see how creative mode categories are not a potential synced one down the line

#

so would be nice

river oracle
#

not saying its a bad idea just thought they were jank as hell

remote swallow
#

Oh lynx you have to tell the cat about inventory pr

river oracle
#

they all know about my great achievement

#

whether it'll be merged or stuck in PR hell forever is another question

eternal night
#

Oh

#

ehhhh

#

I just got back to paper today 😭

#

was stuck in family christmas stuff

river oracle
#

lynx returned to paper hq

remote swallow
#

It will probably be a major version merge

eternal night
#

probs

river oracle
#

My entire family is sick and our extended family is elderly as hell so we can't do shit

#

🥲

remote swallow
#

Lynx get kenny to give you 2k to give to choco to improve downstream relations and totally not bribe choco to make some ors

#

Prs

eternal night
#

I'll bribe choco if possible NODDERS

#

With whatever neccesary 🥰

remote swallow
#

Even husky day care?

delicate obsidian
eternal night
#

Honestly that sounds so fun I'd even do it myself

remote swallow
#

Do you not know about husky singing

proud badge
#

gradle is suspiciously fast compared to maven

#

maven takes like 10 seconds gradle does it in less than a second

vocal cloud
#

It's the power of caching

river oracle
#

Spotted the guy not using maven cache extension

#

Imagine

young knoll
#

Creative categories are fully client side now

eternal night
river oracle
eternal night
#

I mean

#

more or less

river oracle
#

I couldn't put my finger on it

eternal night
#

The types and registries are in the shared code

river oracle
#

You're shared code

young knoll
#

Can’t the client add more tho via a datapack

#

Or am I trippin

river oracle
#

Ik for sure client sided mods can

eternal night
young knoll
#

You know what I want

#

Solid interaction entities

river oracle
#

Or just synced block registries

#

If that ever happened just wait for the 10000 silver plugins just like mods

young knoll
#

Yeah but I want tiny blocks with the new scale stuff

#

Imagine being a tiny man in a tiny house

river oracle
#

No need for a plugin 💪

#

Seems like a skill issue get smaller

young knoll
#

I…

#

Okay

river oracle
#

L

#

Verify or embed fail for life

glass mauve
#

is there a way to easily create subcommands like this:

commands:
  group:
    add:
      description: ...
      usage: /<command>
    leave:
      description: ...
      usage: /<command>

where it would later create /group add arg1 arg2 and /group leave
without the need to handle all that in one CommandExecutor but instead split that command into multiple subcommands

echo basalt
#

lol no

glass mauve
#

unlucky

#

ty

#

but would be nice if that would be possible tbh

young knoll
#

Use a command framework

glass mauve
#

can you recommend smth?

young knoll
river oracle
#

Shorter

young knoll
glass mauve
#

ok ty :D

trim elk
#

guys how do you access import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;?

quaint mantle
warm mica
young knoll
#

You know what implements ProjectileSource?

slender elbow
#

ligma

#

sorry

quaint mantle
#

Exccuse my shitty sticky keys

remote swallow
quaint mantle
#

Imm talleer than both off u

echo basalt
#

doubt

quaint mantle
#

I am 5'9

echo basalt
#

6'2

quaint mantle
#

WTFF

#

UNIT

remote swallow
#

Im also 5'9 and ztill growing

echo basalt
#

I am an absolute unit

quaint mantle
warm mica
#

W

echo basalt
#

damn I just got a massive urge to make 1k$ by the end of the year

echo basalt
#

bet

quaint mantle
#

I mean sriously, u got to makee moneyy

#

Its possible, do it

wet breach
echo basalt
#

short

#

think I'm negotiating a 3.5k project tomrorow

quaint mantle
#

Just curious what ur working on

echo basalt
#

something regarding helping out a bit with an rpg

#

nothing special

quaint mantle
#

CHAT*

echo basalt
#

I wanted to get minigame infrastructure going but got bored

quaint mantle
echo basalt
#

yea

quaint mantle
#

3.5k is wild!

echo basalt
#

it's nothing

young knoll
#

Wynncraft2

quaint mantle
#

Lol.

echo basalt
#

my boss lady thing is getting me on a 50k project :)

#

might actually be my new top project

#

gotta do math

young knoll
#

“Boss lady thing”

echo basalt
#

uh

#

ye

wet breach
echo basalt
#

maybe once all the deals go through I'll be able to afford food

echo basalt
wet breach
#

Oh short memory

quaint mantle
echo basalt
#

because like

#

we did have a media issue but I never talked to you ab it

#

p sure I didn't

wet breach
#

I dont remember if we did but we are referring to two different things i believe. Coincidence i suppose

echo basalt
#

prolly

#

you aren't talking about the time bosslady paid 15k for marketing and the guy dipped and is declaring for bankrupcy are you

#

I swear we haven't spoken for like a month

wet breach
#

Maybe. I just know you had an offer from some media thing

echo basalt
#

uh

#

I think I know what you're talking about

#

and that was like 6 months ago

wet breach
#

Short time ago

echo basalt
#

oH

#

that one

#

at the conference yeah

#

we exchanged contacts but never went anywhere

#

so not that lady either

#

it was also a solid 5 weeks ago

wet breach
#

Sad, at the very least they could have given you more contacts

echo basalt
#

I swear we haven't spoken for a while because I have been distant for a while

echo basalt
#

after the conference ended I got like 15 emails from companies whose booths I attended

wet breach
#

Well i suppose that is good

echo basalt
#

and I think I can still rewatch most talks n stuff

#

Which is where I'm drawing all the conference's value from rn

#

still have to pay my last parcel on the house and my severance pay is like a week late at this point

wet breach
#

Always keep in some kind of contact. Even if you dont work for them they can always give you more contacts or refer you to others

echo basalt
#

So that's fun

#

Contacts are good yeah

#

But still the main thing I'm getting out of the conference is just new ideas

#

Like if I wanted to build an official business around minecraft I could very well do it with the knowledge I learned there

#

Make a full website and pitch it to people type deal

old sphinx
#

is there no pdc for blocks?

young knoll
#

?blockpdc

undone axleBOT
simple mica
#

is there an api function to randomly enchant an item in a way similar to an enchantment table?

river oracle
#

?jd-s

undone axleBOT
eternal night
#

this one ^

#

oh

#

too late 😭

young knoll
#

Why that one deprecated

old sphinx
#

holy mother of convenience thank god theres a lib for this

eternal night
young knoll
#

Could those perhaps be not our docs

eternal night
#

no no no

river oracle
#

paper docs probably

eternal night
#

neveerrr

river oracle
#

also why did paper deprecate that

eternal night
#

I think we had that already

young knoll
#

Skill issue

eternal night
#

Truely 😭

river oracle
#

💀 no love for my PR nah I get it

young knoll
#

Should have PRed upstream

eternal night
simple mica
#

hmm

eternal night
#

reminds me

#

time to fix the issues on the PDC list thing

#

I am so good at upstream relations

river oracle
young knoll
#

Tbf he’s probably the best out of em all

eternal night
#

rip

river oracle
#

Paper docs spotted

eternal night
#

what does this mean tho

#

where should the second line start

young knoll
#

I assume without the extra spaces?

#

Idk docs are wack

eternal night
#

Hmm, maybe yea 😅

young knoll
#

My ide tries to auto format it like that

river oracle
#

same

eternal night
#

Yea same

#

I mean, makes it easier to read

#

in the IDE

young knoll
#

Yeah idk what the standard is

#

Someone ask John java

simple mica
#

oh paper implemented enchantWithLevels()

eternal night
#

Well the method existed prior and paper generally prefers its own methods over spigots

#

so

#

yea, even tho they do the "same" thing

young knoll
#

Yours smell tho

eternal night
#

😦

#

here I am

#

Trying my best

river oracle
#

is there an actual reason its deprecated outside of that

#

beacuse I'd prefer to receive Feedback if API is actually broken or non-ideal

eternal night
#

I think it initially had a problem with something something

#

but iirc fixed

#

with how it handled itemstack vs CraftItemStack

#

dunno

young knoll
#

Remember when paper deprecated one of their events in favour of ours

old sphinx
#

how would i create a block with a pdc, like i want to create a block which when placed still has that pdc with the lib u guys provided earlier

young knoll
#

Good times

old sphinx
#

im lost

young knoll
#

Put pdc on the item and then copy it with the place event

river oracle
eternal night
#

idk I think there was some weird issue

#

don't recall

river oracle
#

sometimes I wake up at night in a cold sweat

eternal night
#

Yeaaaa

river oracle
#

thinking about them

eternal night
#

ItemStack vs CraftItemStack is a pain

#

the bytecode rewrite to move itemstack to an interface is gonna be wild

river oracle
#

ASM ftw 🔥

eternal night
carmine mica
eternal night
#

wow machine

#

I think it has like, one edge case right ?

#

something something enchanted books

river oracle
eternal night
#

I should have gone to bed after the PRmarathon

carmine mica
#

well that is the broken part, the other part is its very badly implemented. Like it only sometimes mutates the input stack? super weird logic

eternal night
#

my brain is soooo dead

#

oh yea

#

right

river oracle
#

welp suppose I should draft up a patch for that then time to go bug finding

eternal night
#

Yea I thikn that is the ItemStack vs CraftItemStack stuff

#

probably pepe_hand_heart_2

#

if either of you two have comments

#

tldr being instead of
PersistentDataType.LIST.strings()
it would be
PersistentDataType.STRING.listType()

river oracle
#

what would the latter do to the implementation of PersistentDataTypes

eternal night
#

nothing

#

its a default method

#

advantage being that a) PDT could override that

#

and b) get rid of some API types

river oracle
#

then I have no real preference probably the latter to relieve the implementation detail if custom types are implement

eternal night
#

wow

#

NO ONE HAS A PREFERENCE xD

#

neither do I

young knoll
#

Lynx is crying now

eternal night
#

I hate it xD

#

md doesnt, mm doesnt

#

you two don't xD

#

I dont

#

hate it xD

young knoll
#

Clearly we need X_LIST

river oracle
# eternal night neither do I

well from an implementation perspective, If you put it in the curernt types I feel like that is probably better for devs wanting to implement custom types

eternal night
#

Yea

#

I mean that is the one plus point

#

for the other, I think PersistentDataType.LIST.strings() is just cleaner

#

syntax wise

young knoll
#

Wait does this automatically work with custom types

eternal night
#

The listType() method ?

#

yea

young knoll
#

That sounds pretty cool

#

I vote that one

carmine mica
#

it would still be true the other way

eternal night
#

I mean, the current PR also has a method to convert a PDTt to a ListType

#

with that PTD

carmine mica
#

you would just create them differently

eternal night
#

yea

young knoll
#

Ahh

#

Hmm

eternal night
#

youd just do PersistentDataType.LIST.create(customPDTinstance)

carmine mica
#

the only benefit of the default method is the potential for custom pdt to override that method to do whatever

#

and idk how much of a benefit that is

eternal night
#

Yea, which like, that is the upside, the downside being imo it looks worse as a method chain

#

I like the LIST.strings() more than the other way around

young knoll
#

ListType.of

#

:p

eternal night
#

Hmm

#

yea of might be nice

#

but not as a static method

#

I hate those fucking the static imports

#

MM can correct me but I think we had that discussion on an owen PR not too long ago ?

#

with some sus stew stuff ?

#

its weird because if all static constructors just name their shit "of" it explodes on static imports

young knoll
#

Static imports are clearly sin

carmine mica
#

yeah, I'd like ListType#listType instead of ListType#of

eternal night
#

Yea

#

But I think a static method on that might be nice ?

#

hmm

#

More static linking of instances 🙃

#

tbf, you cannot static import instance methods

#

so like PersistentDataType.LIST.of wouild work

#

and you'd shorten it to LIST.of()

#

which is ugly

#

fuck

#

tomorrow lynx job 😂 time to sleep at 3 am

young knoll
#

Alright fuck it time to rewrite the api in a new language

eternal night
#

eyeshake who is gonna code a rust server with me

young knoll
#

I was thinking html

#

The superior language

old sphinx
#

what exactly does this want me to do?

eternal night
#

if your package is like com.thunderins2 you'd want to replace YOUR.PACKAGE.NAMEwith that

old sphinx
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.thunderin</groupId>
    <artifactId>nebula</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Nebula</name>

    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <outputFile>C:\Users\Acer\Desktop\Nebula dEv\plugins\${project.artifactId}-${project.version}.jar</outputFile>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <relocations>
                                <relocation>
                                    <pattern>com.jeff_media.customblockdata</pattern>
                                    <shadedPattern>me.thunderin.customblockdata</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.44.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.jeff-media</groupId>
            <artifactId>custom-block-data</artifactId>
            <version>2.2.2</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>


</project>

when I build now that ive added the stuff for cbd, i get Unsupported class file major version 61

glass mauve
#

am I forced to use static methods for acf commands? they always use it for subcommands in their examples
my problem now is I have a dependency, I could either:

  • use static methods + @Dependency field and add the instance to the CommandManager
    or if it works
  • use normal methods + constructor dependency
    what should I prefer?
kindred trellis
#

where do i call a void for it to be always executed? im looking for something like Update() void in unity

echo basalt
#

constructor dependency

young knoll
bleak stream
#

That sounds painful

kind hatch
#

Soon™ (maybe)

eternal night
#

javadocs fixes

young knoll
#

Omg best pr ever

old sphinx
eternal night
bleak stream
#

Is it good practice to always have the latest version of Maven plugins?

old sphinx
#

well i kind of need it to use cbd

#

or else it throws an error

bleak stream
#

What’s cbd in this case?

old sphinx
#

customblockdata, its a lib which allows for pdc to be used on blocks

old sphinx
eternal night
#

just version change

#

what is screaming at you

#

fuck of emily

slender elbow
#

excuse you

eternal night
old sphinx
#

Plugin 'org.apache.maven.plugins:maven-shade-plugin:3.5.1' not found

slender elbow
old sphinx
#

maven doesnt believe me

eternal night
#

intellij error or mvn package error

young knoll
#

I can confirm

old sphinx
eternal night
#

Well check if mvn package fails

#

in some terminal

#

otherwise, IJ has a repair ide option

kindred trellis
eternal night
#

runTaskTimer

kind hatch
#

Runnables use ticks by default. Just set the interval to 40.

kindred trellis
#

but how do i make a runnable?

kind hatch
#

?scheduling

undone axleBOT
river oracle
#

@eternal night surprisingly not hard fix too bad this wasn't reported to us sooner I must've missed something silly in my initial tests

eternal night
#

I think we barely got it too

#

I mean, issue being you wanna always return the stack

#

do you have a PR ? xD

river oracle
eternal night
#

ah xD

#

I'd love it to be sent muh way

river oracle
#

gotta do a little bit of cleanup quick

eternal night
river oracle
#

CraftItemStack is a mess I still don't fully understands I always havfe to flick back and forth between its impl

eternal night
#

Yea CIS is annoying af

#

one future day

#

we shall be rid of it

#

Well, not really rid of it, more like, rid of ItemStack class

river oracle
#

probably should work out ItemMeta first though prey sure MD really wants a re-impl of that

young knoll
#

He do

eternal night
#

Yea I mean, its gonna be fucked

#

in a perfect world we have a non clone

#

but like, every plugin and their mother depends on that

kind hatch
#

What's wrong with ItemMeta?

eternal night
#

its a) slow b) looses data

#

c) urgh

carmine mica
#

looses data, changes data, doesn't support vanilla stuff, a ton of things

eternal night
#

like item meta parses all of the vanilla nbt tag into some sort of spigot representation

river oracle
#

makes me want to cry when trying to add a ByteSerialization API

eternal night
#

if spigot doesn't represent it all

#

welp now you are fucked

young knoll
#

MD said it should just interact with the NBT directly

eternal night
#

it should yea

#

sponge style would be great

#

while also keeping ItemMeta interface

#

for easy usage

river oracle
#

I thank god every day Inventories were not that horrible to deal with

#

CraftItemStack and ItemStack bring me to tears sometimes

eternal night
#

NODDERS we all need joint therapy sessions

river oracle
#

@eternal night

    private static ItemStack enchantItem(RandomSource source, ItemStack itemStack, int level, boolean allowTreasures) {
        Preconditions.checkArgument(itemStack != null, "ItemStack must not be null");
        Preconditions.checkArgument(!itemStack.getType().isAir(), "ItemStack must not be air");
        itemStack = CraftItemStack.asCraftCopy(itemStack);
        CraftItemStack craft = (CraftItemStack) itemStack;
        return CraftItemStack.asCraftMirror(EnchantmentManager.enchantItem(source, craft.handle, level, allowTreasures));
    }```
#

the amount of copying here hurts the soul, but not really sure what else to do for the desired contract

young knoll
#

Have you tried an exorcism

river oracle
#

no

#

that's the easy way out

glass mauve
#

cant I use acf with java 21?
these lines give me Unsupported class file major version 65

tasks.shadowJar {
    relocate("co.aikar.commands", "me.squidxtv.groupingsystem.acf")
    relocate("co.aikar.locales", "me.squidxtv.groupingsystem.locales")
}
simple mica
#

for some reason when i set a mob to have a new piece of armor, the enchants never appear

 mobEquipment.setItem(slot, newArmor);

the actual armor piece does show up, and the item slot does seem to have the enchantment info but it just never appears in-game

tender shard
glass mauve
#

working with shadwJar works fine until I use relocate

tender shard
#

lucky that it works at all in those cases, I'd say

#

the release notes state jdk 18 is the highest supported in release 8.0.0

glass mauve
#

ah ok

quaint mantle
#

Why isn't this relocated? Script provided no exceptions.

#

It does not work because project written on kotlin?

sterile flicker
#


import com.sumeru.party.SumeruParty;
import com.sumeru.party.utils.PartyUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;

public class PartyGUI implements Listener, InventoryHolder {
    public static final String name = "Party Inventory!";
    private final Inventory inventory;
    public PartyGUI() {
        inventory = SumeruParty.plugin.getServer().createInventory(this, 36, name);
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        if (!(event.getInventory().getHolder() instanceof PartyGUI)) {
            return;
        }
        if (PartyUtils.isInventoryEmpty(player)) {
            SumeruParty.playerInventories.put(player, event.getInventory());
            player.closeInventory();
            event.setCancelled(true);
        }
    }

    @Override
    public Inventory getInventory() {
        return this.inventory;
    }
}``` ``` public static HashMap<Player, Inventory> playerInventories = new HashMap<>();``` gameStart ```if (!PartyUtils.isInventoryEmpty(player)) {
            PartyGUI inventory = new PartyGUI();
            player.openInventory(inventory.getInventory());
        }``` gameEnd ```if (player.isOnline() && (SumeruParty.playerInventories.containsKey(player))) {
                Inventory inventory = SumeruParty.playerInventories.get(player).getHolder().getInventory();
                player.openInventory(inventory);

        }```please help me, I can't put such an item as a bush in the inventory, it throws it away.
#

I want that before playing a mini-game, the inventory opens in front of the player and you can put things down and after the player leaves the game, open the inventory again.

quaint mantle
#

how i fix this error?

quaint mantle
quaint mantle
# sterile flicker ```package com.sumeru.party.gui; import com.sumeru.party.SumeruParty; import c...

Pretty simple
You shouldn't need to implement InventoryHolder or Listener in your PartyGUI class , you should handle listening to events in a seperate class in my opinion

PartyGUI should store playerUUID, and create an inventory for each player.

Create a PartyGUIManager class that manages PartyGUI's for players.

Create a new Map<UUID, PartyGUI> storedParties

And manage each PartyGUI for the player within your PartyGUIManager class, you will create methods inside of their to help you achieve the functionality you are looking for.

In your case its simple once game starts, save all those items in the inventory to your list
in your PartyGUI class you'll have a List<ItemStack> im assuming, or Map<Integer, ItemStack> if you care about slots.

And then retrieve those stored items back once game ends, simple!!

#

I can code this for you, I find it easier to do rather than explain. Its a fairly simple concept

#

If anyone needs a simple CooldownManagerAPI for their code, ping me.

Works with XP bars to display how many seconds in cooldown is left,
uses an Enum of CooldownTypes

CooldownManager.class:
Methods: (start, forceStop, isOnCooldown, hasCooldown, removeCooldown, clearCooldowns, getTimeRemaining, getTimeRemainingFormatted, setTimeRemaining)

#

Super easy to use

sterile flicker
quaint mantle
quaint mantle
sterile flicker
# quaint mantle If it aint broke dont fix it. But yes what i suggested is a better practice IMO

now i have ```public class PartyGUI {

public void openInventory(Player player) {
    if (!PartyUtils.isInventoryEmpty(player)) {
        if (SumeruParty.playerInventories.containsKey(player.getUniqueId())) {
            player.openInventory(SumeruParty.playerInventories.get(player.getUniqueId()));
        } else {
            Inventory inventory = SumeruParty.plugin.getServer().createInventory(player, 36, "Party Inventory!");
            SumeruParty.playerInventories.put(player.getUniqueId(), inventory);
            player.openInventory(inventory);
        }
    }
}
public void storeInventory(Player player) {
    if (SumeruParty.playerInventories.containsKey(player.getUniqueId())) {
        SumeruParty.playerInventories.put(player.getUniqueId(), player.getInventory());
    }
}

public static void restoreInventory(Player player) {
    if (SumeruParty.playerInventories.containsKey(player.getUniqueId())) {
        player.getInventory().clear(); // Clear player inventory before restoring
        player.getInventory().setContents(SumeruParty.playerInventories.get(player.getUniqueId()).getContents());
    }
}

}```

quaint mantle
sterile flicker
#

public static final HashMap<UUID, Inventory> playerInventories = new HashMap<>();

#

i use UUID now

quaint mantle
#

no need for static

quaint mantle
#

He makes great vids that are fun to watch

#

Very educational

#

i think he knows when to use static or not

#

I assumed he didnt because those methods are static inside PartyGUI, when u can use a manager instead which is a lot more efficient

wet breach
#

It is actually easy for someone new to Java to get hooked on static usage since functional programming is easier to learn and work with at times lol

old sphinx
#

would using pdc of an item be a good way to store other items in the item to act a backpack?

undone axleBOT
sterile flicker
#

import com.sumeru.party.utils.PartyUtils;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.UUID;

public class PartyGUI {

    private final JavaPlugin plugin;
    private final InventoryManager inventoryManager;

    public PartyGUI(JavaPlugin plugin) {
        this.plugin = plugin;
        this.inventoryManager = new InventoryManager();
    }


    public void storeInventory(Player player) {
        inventoryManager.storeInventory(player, player.getInventory());
    }

    public void restoreInventory(Player player) {
        if (inventoryManager.containsInventory(player)) {
            player.getInventory().clear();
            player.getInventory().setContents(inventoryManager.getInventory(player).getContents());
        }
    }

    private class InventoryManager {
        private final HashMap<UUID, Inventory> playerInventories = new HashMap<>();

        public boolean containsInventory(Player player) {
            return playerInventories.containsKey(player.getUniqueId());
        }

        public Inventory getInventory(Player player) {
            return playerInventories.get(player.getUniqueId());
        }

        public void storeInventory(Player player, Inventory inventory) {
            playerInventories.put(player.getUniqueId(), inventory);
        }
    }
}```
#
            PartyGUI gui = new PartyGUI(SumeruParty.plugin);
            gui.storeInventory(player);
        }```
#

This is closer to what I need?

#

and if (player.isOnline()) { PartyGUI gui = new PartyGUI(SumeruParty.plugin); gui.restoreInventory(player); }

upper hazel
#

In programming, it's undesirable to overcomplicate code, but I was wondering if it's a good idea to make one good system. I'm making a plugin for artifacts, and I'd like to abstract away their detailed interactions in certain contexts because I have a lot of Enum classes to create ways to interact with players. (This could lead to a lot of nested if constructs. And would like to make a class for example Artifact.workProcessStart();

chrome beacon
#

That's fine

quaint mantle
spare hazel
#

why is my server recommending player names in tab completion instead of the things it should recommed?

sullen marlin
#

The command hasn't coded tab completion

spare hazel
#

no

#

it does have tab completion

#

it just recommends player names

#

im running bungeecord with a bunch of servers

sullen marlin
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

proud badge
#

Is it true that a decompiled jar will always not be identical to the source code?

rotund ravine
#

Mostly’ish

proud badge
#

bruh I keep accidentally uploading github repositories to NedHuman/PluginName instead of Server/PluginName, after I delete them it still says "This folder is already a respository" and I cannot add it again anymore, anyone know how I could fix this? (im using github desktop btw)

sterile flicker
#
        Location spawn = DB.sheepfrenzy;
        World world = spawn.getWorld();
        Random random = new Random();

        int x = random.nextInt(60) - 30;
        int z = random.nextInt(60) - 30;
        x += (int) spawn.getX();
        z += (int) spawn.getZ();

        return new Location(world, x, spawn.getY(), z);
    }

    @org.bukkit.event.EventHandler
    public void onRespawn(PlayerRespawnEvent event) {
        new BukkitRunnable() {
                @Override
                public void run() {
                    if (SumeruParty.players.contains(event.getPlayer().getName()) && (SumeruParty.current_minigame == 1)) {

                        Location spawnpos = getRespawnCoords();
                        Block block = spawnpos.getWorld().getHighestBlockAt((int) spawnpos.getX(), (int) spawnpos.getZ());
                        if (block.getType() != Material.AIR) {
                            event.setRespawnLocation(spawnpos);
                            this.cancel();
                        }
                    }
                }
        }.runTaskTimer(SumeruParty.plugin, 20, 20);
    }``` sorry that I have a habit of throwing code at people, but in this context DB.sheepFreenzy is the main spawn position on the mini-game map. the problem is that there are also tnt that destroy the map and there is a glowstone under the map and if you step on it you will die, and if you leave the main spawn point it can be destroyed by primed tnt and you will endlessly fall on glowstone also without a death screen. I want to use the main spawn point to select a random position on the entire map for which there is a block and not a void and spawn the player there at death
#

but instead respawnLocation is not set at all

#

to check if there is a block under the player, I have not found a better way than to create a repetitive task that checks this

#

if (SumeruParty.players.contains(event.getPlayer().getName()) && (SumeruParty.current_minigame == 1)) { I am also convinced that this condition is executed

rotund ravine
#

You can’t use a tasktimer there

sterile flicker
rotund ravine
#

Remove ur scheduler

sterile flicker
#

and?

#

how then to check block under player for air material

#

can you explain please

#

can i use something like this? ```private boolean isValidRespawnLocation(Location location) {
World world = location.getWorld();
int x = (int) location.getX();
int z = (int) location.getZ();

    return world.getHighestBlockAt(x, z).getType() != Material.AIR;
}```
#

but then the player will need to press the respawn button again

storm scaffold
#

Is there a way to get a Material from an ID like minecraft:dirt?

sullen marlin
#

Material.matchMaterial or whatever

#

check the docs

sterile flicker
# sterile flicker can i use something like this? ```private boolean isValidRespawnLocation(Locatio...
    public void onDeath(PlayerDeathEvent e)
    {
        final Player p = e.getEntity();

        if (SumeruParty.gameStarted && (SumeruParty.players.contains(p.getName()))) {
                e.setDeathMessage(null);
                e.setKeepInventory(true);
                Bukkit.getScheduler().scheduleSyncDelayedTask(SumeruParty.plugin, () -> p.spigot().respawn(), 2);
                Bukkit.getScheduler().scheduleAsyncRepeatingTask(SumeruParty.plugin, () -> {
                    Location spawnpos = getRespawnCoords();
                    if (isValidRespawnLocation(spawnpos)) {
                        p.teleport(spawnpos);
                        SumeruParty.logger.info("fff");
                    }
                }, 0L, 20L);
        }
    }``` I deleted the onrespawn event and put the code in ondeath but it still doesn't work
sterile flicker
shadow night
#

Can I ask a question... Why does your EventHandler annotation contain the whole package name

sterile flicker
shadow night
#

why

rotund ravine
#

There is no need for ur scheduler

sterile flicker
# shadow night why

that's how I want to name the classes, it shouldn't affect anything, I think

sterile flicker
rotund ravine
#

Remove it and try again

shadow night
sterile flicker
hazy parrot
#

Then use while loop, your scheduler will not work as u intended

shadow night
#

The scheduler call is really goofy

sterile flicker
#

?

rotund ravine
#

Sigh

shadow night
#

That looks wrong

sterile flicker
rotund ravine
#
                while (!isValidRespawnLocation(spawnpos)) { spawnPos = getRespawnCoords();}
p.teleport(spawnpos);
          ```

What does getRespawnCoords do tho
meager wolf
#

i remember in an old joke version, u could make custom portals to nearly infinite worlds, and those portals had different colors, is it possible to change portals color in recent versions? 1.20.1

sterile flicker
rotund ravine
#

What does

#

getRespawnCoords do?

rotund ravine
#

I am gonna sleep

sterile flicker
# rotund ravine getRespawnCoords do?

I want to use the main spawn point to select a random position on the entire map for which there is a block and not a void and spawn the player there at death

#

that is, getRespawnCoords takes a random position on the map based on the main point and checks the block highest in x and z using isValidRespawnLocation

#

is this block equal to the air so that the player does not fall during respawn so this block has been blown during the game

#

Do you understand what I want to do?

sterile flicker
wet breach
#

then you can do your processing of it in another thread

#

or in an async task

#

this way you don't cause the main thread to hault

#

once you found what you want, bring it back to the main thread to then teleport I suppose

hazy parrot
#

well i don't believe finding valid cords will block that much that server crash

sterile flicker
wet breach
#

does as it is named

#

gets you a snapshot of the chunk

sterile flicker
#

on server

wet breach
#

you probably should learn more java if you don't understand about not stopping the main game loop

wet breach
hazy parrot
wet breach
#

depends where you start

#

and how you go about finding a valid location

wet breach
#

as well as what you deem as valid

hazy parrot
sterile flicker
#
                do {
                    spawnpos = getRespawnCoords();
                } while (!isValidRespawnLocation(spawnpos));

                ChunkSnapshot chunkSnapshot = spawnpos.getChunk().getChunkSnapshot();
                
                p.teleport(spawnpos);```  how do I use chunkscnapshot in this context
wet breach
#

just fyi

sterile flicker
hazy parrot
#

so there is a problem

wet breach
#

indeed, and easy to make mistake as well

#

they are getting the block coord

#

the block coord isn't ground level

#

rather level with all the rest of the ground

#

so they need to go 1 up on the y

#

if they don't do that, no matter where they traverse on the x and z the spawn location would be invalid as its in the ground 🙂

quaint mantle
hazy parrot
#

@sterile flicker ^ there, frostalf explained

wet breach
#

well I do suppose at some point a valid location would be found

#

but it would take a long while

sterile flicker
quaint mantle
wet breach
#

so its not killing the main thread 🙂

quaint mantle
#

If you want to have a death animation still, you must make a method #fakeKillPlayer that calls correct Packets, i can send you my method for it, its rlly cool and id be happy to share it with you

quaint mantle
wet breach
#

well I explained the problem

#

so maybe they can fix it now

quaint mantle
#

me personally i avoid while loops, too much room for error

hazy parrot
#

?

median trench
#

Hey there, is there any event called on "/clear" at all?

tender shard
median trench
#

alright thank you

peak depot
#

is there a way to use packets without having to guess what does what like just that the methods names are not encrpyted

wet breach
#

you don't know how to read java code?

peak depot
#

sorry that I dont know what xyz.a(b) does

wet breach
#

its what an IDE is for

tender shard
#

then the methods have proper names

wet breach
#

a proper IDE will let you follow code with ease regardless of how many classes it goes through

wet breach
#

a good bit of them though

tender shard
#

all methods have a mapped name

wet breach
#

no

tender shard
#

example?

wet breach
#

spigot doesn't make use of all classes and mojang doesn't release mappings for everything either

#

and I can't just whip you up an example of this at a moments notice either

tender shard
#

I have never encountered a single method that's not mapped

peak depot
#

the methods name are encrpyted thats my problem I know how to read it but if its like player rendering an I need to spawn the player again I should know the name for it and not need to guess if its the sub method a b or c

wet breach
#

of course not because the common stuff that is needed is mapped

tender shard
#

?nms

wet breach
#

my IDE can tell me where any given method is used in a project

#

I can even rename it at will and in all places at once if it makes it easier to track. You can go with mojang mappings too, but just pointing out a decent IDE makes it unnecessary

peak depot
#

I could back track it but why work hard if there would be an easier way

wet breach
#

I guess its difficult for some

onyx fjord
#

is there an event for attempting to use a nether portal even if teleportation wont happen?

peak depot
tender shard
peak depot
#

yup

tender shard
#

try to run mvn package anyway, it should download it

static horizon
#

whats a good kotlin sql ORM?

sterile flicker
# wet breach so they need to go 1 up on the y

thanks. works fine. solution is ```public Location getRespawnCoords() {
Location spawn = Data.sheepfrenzy;
World world = spawn.getWorld();
Random random = new Random();

    int x = random.nextInt(60) - 30;
    int z = random.nextInt(60) - 30;

    return new Location(world, x + spawn.getX(), world.getHighestBlockYAt((int) (x + spawn.getX()), (int) (z+spawn.getZ())) - 1, z + spawn.getZ());
}
private boolean isValidRespawnLocation(Location location) {
    return location.getBlock().getType() != Material.AIR;
}``` and ```Bukkit.getScheduler().scheduleSyncDelayedTask(SumeruParty.plugin, () -> {
                p.spigot().respawn();

                Location spawnpos;
                do {
                    spawnpos = getRespawnCoords();
                } while (!isValidRespawnLocation(spawnpos));
                spawnpos.setY(spawnpos.getY() + 2);
                p.teleport(spawnpos);
            }, 2);```
hazy parrot
sterile flicker
sterile flicker
#

import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

import java.util.HashMap;
import java.util.UUID;

public class PartyGUI {

    public PartyGUI() {
    }

    public void storeInventory(Player player) {
        InventoryManager.getInstance().storeInventory(player, player.getInventory());
    }

    public void restoreInventory(Player player) {
        if (InventoryManager.getInstance().containsInventory(player)) {
            player.getInventory().clear();
            player.getInventory().setContents(InventoryManager.getInstance().getInventory(player).getContents());
        }
    }

    private static class InventoryManager {
        private final HashMap<UUID, Inventory> playerInventories = new HashMap<>();
        private static final InventoryManager instance = new InventoryManager();

        private InventoryManager() {
        }

        public static InventoryManager getInstance() {
            return instance;
        }

        public boolean containsInventory(Player player) {
            return playerInventories.containsKey(player.getUniqueId());
        }

        public Inventory getInventory(Player player) {
            return playerInventories.get(player.getUniqueId());
        }

        public void storeInventory(Player player, Inventory inventory) {
            playerInventories.put(player.getUniqueId(), inventory);
        }
    }
}```
sterile flicker
#

but it's just at the onrestore stage clearing my inventory.

proud badge
#

Hi, I'm trying to modify a plugin's source code to my needs but its bukkit, how could I change it? (IntelliJ)

young knoll
#

Change what

proud badge
#

To Spigot

tender shard
#

spigot "includes" bukkit

#

bukkit plugins run fine on spigot

#

however if you wanna switch to spigot-api just replace the dependency in pom.xml from org.bukkit bukkit-api to org.spigotmc spigot-api

proud badge
young knoll
#

There aren't many of those

lost matrix
proud badge
#

nah I dont wanna modify it a lot

#

Currently it broadcasts all alts, im gonna make it so it only broadcasts if the alts are banned

young knoll
#

My first thought is IP

proud badge
#

yes it stores IPs in a database

lost matrix
lost matrix
umbral ridge
#

but IPs are unrealiable as they're mostly dynamic

young knoll
#

Sadly that falls apart fairly quickly

proud badge
#

is BanEntry available in Bukkit?

#

or wait

young knoll
#

yes

proud badge
#

I can just do .isBanned()

young knoll
#

Spigot has very limited extended api

umbral ridge
young knoll
#

Main thing is components

#

(for now :p)

lost matrix
# umbral ridge If I did a research, I'd find better ways to do it?

Probably not. There is not a lot of information to be gathered from the minecraft client.
You could try some really complicated approaches like heuristic analysis of player behavior
or tracking the internet provider associated with this IP, together with some geo information.

umbral ridge
wet breach
#

the reverse ip's are unique to specific isp's

lost matrix
#

What even is a reverse ip supposed to be...

umbral ridge
#

yeah what is reverse IP

umbral ridge
#

ip -> hostname?

wet breach
#

Reverse IP lookup, also known as reverse DNS lookup, is the process of querying the Domain Name System (DNS) to determine the domain name associated with an Internet Protocol (IP) address

#

all ip's have a reverse

lost matrix
#

No, this "reverse" refers to the lookup process.

wet breach
#

many ip's can map to the same reverse

umbral ridge
#

but hostnames are often different

#

even for the same ISP

#

<a>.<b>.<c>.<isp>.com

#

kind of

#

how are you supposed to parse that and detect it

#

I think my best bet is an ip

wet breach
#

that isn't how the hostnames work

#

hostnames control whole blocks of ip's

sterile flicker
wet breach
#

ip's can't reverse to more then one hostname

umbral ridge
wet breach
#

no

umbral ridge
#

hostname per IP right?

wet breach
#

no

umbral ridge
#

yes

#

XD

wet breach
#

When you control a block of IP's they map to a singular location

#

this is why blocks have to be cut down

umbral ridge
#

how are you supposed to do a reverse ip lookup in java?

#

use public web apis?

wet breach
#

its just a dns lookup

lost matrix
wet breach
#

so like how you would look up a domain's ip in dns, you do the same but for a ptr with the ip

umbral ridge
#

so I first need to get the IPv4 and then use it to query it

sterile flicker
umbral ridge
lost matrix
wet breach
#

you want to this before they join

#

login contains everything you need

#

and is the ideal place because you can suspend the process for a logger period of time unlike the join

#

where they may just DC also if they are not supposed to connect it makes little sense to waste more resources and let them get to the join

lost matrix
#

*And dont make the manager an inner class. That makes no sense.

wet breach
#

unless you strictly only accept ipv4 connections

umbral ridge
#

I dont want to deal with ipv6

wet breach
#

then you need to ensure your server only accepts ipv4 connections

#

otherwise you have a major flaw in your design

umbral ridge
#

I think the easiest way would be to just use the ip they connect with, either ipv4 or v6 and run a lookup in the database for a match

#

and enforce system like 5users / IP

wet breach
#

well just know that ipv4 ptr records are slightly different then ipv6

#

ipv6 is in 4 bit sections where as ipv4 is in 8 bit sections

lost matrix
wet breach
#

NAT is not useless

#

NAT has a natural security to its design

#

IPV6 was designed to allow any machine assigned an ipv6 to connect to the outside world

#

but this is bad if the machine isn't needed to be contacted directly from the outside or you don't want people to just arbitrarily talk to it

#

this is where IPV6 NAT comes in

#

also, since IPV6 NAT exists, this basically makes the infinite ipv6 space more infinite then it was before

umbral ridge
wet breach
#

ipv6 was created before that even started to happen 🙂

#

and that is what its primary purpose was for

#

however, some things were incorporated that ipv4 lacked

#

however NAT came after ipv6 was started and was initially for a stop gap

#

but, it proved effective in not only in the stop gap measure but also being a natural defense in shielding machines from the outside

#

any machine that has a private IP from the private ip space can not be reached directly

#

ipv6 without nat removes this

#

and exposes all machines regardless if internal or not to the outside world

orchid gazelle
#

hello, what do you guys think is the best way to construct an Object with Code that the Object will run once a certain condition happens? Do I just give it a Runnable? Or BukkitRunnable?

wet breach
#

it sounded good but back then DDoS and other malicious things were not prevalent

umbral ridge
#

😣

#

frostalf you could write a book

warm mica
wet breach
orchid gazelle
#

ah okay, so Runnable fits better

#

thanks

warm mica
#

Very useful

sterile flicker
# lost matrix Create only a single instance of ``InventoryManager`` and dont create a new one ...

still not working ```package com.sumeru.party.gui;

import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

import java.util.HashMap;
import java.util.UUID;

package com.sumeru.party.gui;

import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

import java.util.HashMap;
import java.util.UUID;

public class InventoryManager {
private final HashMap<UUID, Inventory> playerInventories = new HashMap<>();
private static final InventoryManager instance = new InventoryManager();

private InventoryManager() {
}

public static InventoryManager getInstance() {
    return instance;
}

public boolean containsInventory(Player player) {
    return playerInventories.containsKey(player.getUniqueId());
}

public Inventory getInventory(Player player) {
    return playerInventories.get(player.getUniqueId());
}

public void storeInventory(Player player, Inventory inventory) {
    playerInventories.put(player.getUniqueId(), inventory);
}

} package com.sumeru.party.gui;

import org.bukkit.entity.Player;

public class PartyGUI {
public void storeInventory(Player player) {
InventoryManager.getInstance().storeInventory(player, player.getInventory());
}

public void restoreInventory(Player player) {
    if (InventoryManager.getInstance().containsInventory(player)) {
        player.getInventory().clear();
        player.getInventory().setContents(InventoryManager.getInstance().getInventory(player).getContents());
    }
}

} player join if (!PartyUtils.isInventoryEmpty(player)) {
PartyGUI gui = new PartyGUI();
gui.storeInventory(player);
}player leaveif (player.isOnline()) {
PartyGUI gui = new PartyGUI();
gui.restoreInventory(player);
}```

dry hazel
#

jesus use a pastebin

umbral ridge
#

jesus christ jesus

umbral ridge
sterile flicker
#

Jesus Christ, Jesus Christ, Your arms open and close.

wet breach
#

o.O

#

having a panic attack there?

sterile flicker
orchid gazelle
warm mica
orchid gazelle
#

alright then

sterile flicker
#

I want to save the player's inventory before joining the game and give it out when exiting the game

minor junco
#

You need to save the contents, not the inventory!

#

The inventory is the same instance that you clear on onrestore

lost matrix
minor junco
#

Make an array copy of the contents

sterile flicker
#

how do I organize everything to keep the contents of the inventory?

minor junco
#

Put them into the map and you're good to go

#

Map<UUID, ItemStack[]>

minor junco
sterile flicker
#

so private final Map<UUID, ItemStack[]> playerInventories = new HashMap<>(); playerInventories.put(player.getUniqueId(), inventory.getContents()); instead of playerInventories.put(player.getUniqueId(), inventory); and public ItemStack[] getInventory(Player player) { instead of public Inventory getInventory

minor junco
#

I mean yeah, but make a copy of the array beforehand

lost matrix
#

getContents() creates a new array each time. I dont think a copy is needed here.

minor junco
#

Since it's not documented 😵‍💫

lost matrix
#

Yeah it should include infos like transitivity of changes and stuff

minor junco
#

Gotta love the docs from spigot

lost matrix
#

Feel free to PR and impove Spigot 🙂

umbral ridge
#

feel free to donate some money to spigot its a new year

minor junco
#

Already did last year

sterile flicker
wet breach
minor junco
#

I mean yes that's what I would do, but it's not specified in the documentation and spigot uses mutability basically everywhere

#

Vector, location even ItemStack

#

So it's not far fetched to think that they're not returning an arraycopy

sterile flicker
#

is there a way to legally extend the intelij idea trial?

umbral ridge
#

only illegally

sterile flicker
#

expires in 4days..

minor junco
#

use the community edition

umbral ridge
#

XD

sterile flicker
remote swallow
#

yes

minor junco
#

yes

#

I'm speechless

umbral ridge
#

yes

wet breach
minor junco
#

Memory complexity

#

Imagine getting the contents and shallow copying 27 slots every time, since inventory is mutable itself it would make sense to not copy the array, even tho it is the better option

wet breach
#

no it wouldn't make sense at all

#

if it were mutable that means you could change the inventory from that method

#

which makes no sense to do or even allow

#

given its purpose it is to give you all the contents in the inventory

#

and you have a method that compliments called setContents()

#

which takes the same array

#

well same kind anyways

minor junco
#

I mean like I said it's the most logical option, but it's an implementation detail that should be specified in the documentation to force underlying implementations to implement it that way, imo

warm mica
minor junco
#

... or just use community edition

#

I don't think most people need the features of the enterprise edition

warm mica
#

The settings syncing feature is nice

#

But you're right

minor junco
#

I guess, yeah

sterile flicker
umbral ridge
onyx fjord
#

what event fires when firework is used to boost elytra?

umbral ridge
#

PlayerInteractEvent?

warm mica
#

Alternatively there is PlayerElytraBoostEvent with paper

onyx fjord
#

actually you can boost without an elytra

warm mica
#

You can?

onyx fjord
#

yes but game will cancel gliding after a tick

#

so you gotta cancel the cancelation of gliding

cinder abyss
#

Hello, I followed mfnalex's nms tutorial (https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/)
But when I add org.spigotmc.spigot, I get errors.

I used BuildTools with mojang mappings, javadoc generation and source generation for the 1.15.2 version.

Here is my pom.xml: https://paste.md-5.net/ugipimiwaf.xml

If you need to access NMS classes from inside your Spigot plugin, it is a very good idea to use the so called Mojang mappings. Disclaimer: This post is obviously written for 1.18.2. If you use another version, you of course have to replace every occurance of “1.18.2” with the version you actually use. What...

chrome beacon
#

they're 1.17.1+

remote swallow
#

they exist for 1.14+ but spigot doesnt not support them till 1.17.1

chrome beacon
#

^^

cinder abyss
#

okay thanks!

#

I could have searched for long...

minor junco
#

Or better: create a thread

sterile flicker
#

thats difference beetwen spawn.getWorld().spawn(spawnpos, Sheep.class); spawn.getWorld().spawnEntity(spawnpos, EntityType.SHEEP);?

sterile flicker
# minor junco Could you resend your code

import org.bukkit.entity.Player;

public class PartyGUI {
    public static void storeInventory(Player player) {
        InventoryManager.getInstance().storeInventory(player, player.getInventory());
    }

    public static void restoreInventory(Player player) {
        if (InventoryManager.getInstance().containsInventory(player)) {
            player.getInventory().clear();
            player.getInventory().setContents(InventoryManager.getInstance().getInventory(player));
        }
    }
}``` and ```package com.sumeru.party.gui;

import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class InventoryManager {
    private final Map<UUID, ItemStack[]> playerInventories = new HashMap<>();
    private static final InventoryManager instance = new InventoryManager();

    private InventoryManager() {
    }

    public static InventoryManager getInstance() {
        return instance;
    }

    public boolean containsInventory(Player player) {
        return playerInventories.containsKey(player.getUniqueId());
    }

    public ItemStack[] getInventory(Player player) {
        return playerInventories.get(player.getUniqueId());
    }

    public void storeInventory(Player player, Inventory inventory) {
        playerInventories.put(player.getUniqueId(), inventory.getContents());
    }
}```
#
            PartyGUI.storeInventory(player);
        }``` or ```if (!PartyUtils.isInventoryEmpty(player)) {
            PartyGUI gui = new PartyGUI();
            gui.storeInventory(player);
        }```
#

I'm waiting for someone to say "jesus, use pastebin"

minor junco
#

jesus, use pastebin

sterile flicker
minor junco
#

Is it the same issue?

sterile flicker
#

did I do the right thing by changing to static?

minor junco
#

You can or you utilize the singleton pattern

#

But please try it first before asking for help if your problem is resolved

wet breach
#

fun fact, if you can guarantee your map to not have null inserted using get() can be more efficient

shadow night
#

What is the point in singletons

wet breach
#

in otherwords no matter where the instance is obtained, there should ever be only a single instance that exists

#

this is what singleton does/is

shadow night
#

But what is the point

lost matrix
#

Be more specific

wet breach
#

its more handy with manager classes or the easiest place to implement

shadow night
#

Why do I want a single instance of the object, why prevent others

wet breach
#

where you only want a single manager object to ever exist or can exist

lost matrix
shadow night
#

In that case, why don't I static everything

wet breach
#

because singletons don't need to exist all the time

#

they can be GC'ed

lost matrix
slender elbow
#

not always they can be made static

wet breach
#

if something instantiates an instance of the singleton, its guaranteed there is only one of it

umbral ridge
ivory sleet
rough drift
#

static or not I don't give a shit, I'm still breaking whatever it is 😂

lost matrix
wet breach
#

the main factor which I stated is that a singleton doesn't need to always exist. If it isn't needed down the road it can be GC'ed

#

statics can't be GC'ed

ivory sleet
#

Testability and, if you deal with multithreading then having a bunch of static fields is a nightmare, esp if they’re mutable

shadow night
#

Hmm

rough drift
#

reminds me of C all over again

ivory sleet
minor junco
#

Man I started a war with bringing out the singleton pattern

slender elbow
# slender elbow not always they can be made static

if the singleton manager depends on some instance of something else, it'd need to be passed to the constructor, so you couldn't make everything static in that case, unless you make all the static methods also take that instance which, ew

rough drift
minor junco
#

Wasn't my intention bois I'm sorry

minor junco
lost matrix
# shadow night Yes

My biggest reason would be lazy initialization.
Having the field initialized eagerly will eventually lead to horrific dependency problems, causing the classloader to break
resulting in very hard to discover bugs.

rough drift
#

I should be upgrading my chat filter yet I'm just here reading about ya'll talk about singletons

wet breach
minor junco
#

yeah I know bruv was ironic

shadow night
#

I like how many messages I could cause by saying like 15 words

minor junco
#

Sorry if the joke didn't land

slender elbow
#

i find it quite interesting how singleton is usually associated with static access

rough drift
ivory sleet
#

I mean the canonical singleton pattern does imply the pattern to have a global access point which ppl usually associate static with

minor junco
lost matrix
# shadow night Yes

Another reason would be instance behavior i guess.
Imagine having an abstract structure for your manager classes, with each manager ensuring certain behavior.
You cant inherit or ensure anything with static methods.

minor junco
rough drift
shadow night
rough drift
#

Now you make me smile I need to reduce processing time from 1.8ms down to at least 0.6ms to get an acceptable time but like, I can't be fu-

minor junco
#

-cking arsed?

rough drift
rough drift
shadow night
#

Oh what

rough drift
#

I am dealing with a lot of data aight?

rough drift
#

Oh wait I found a glaring performance issue

proud badge
#

somehow my pom.xml is gone, how do I regenerate it?

proud badge
#

omg my files are back

#

epic intellij localhistory

cinder abyss
#

Hello, how can I convert net.minecraft.world.entity.EntityType to Bukkit EntityType?

hushed spindle
#

otherwise you might have to map them