#help-development

1 messages Β· Page 914 of 1

mighty gazelle
#

How can I completly Invisible the players for one player?

analog mantle
#

did you guys know, if(event.getEntity() instanceof final Player p) you can put final in advanced instanceof?

worldly ingot
#

Yes

#

You can annotate it too

analog mantle
#

lol

#

ok i gtg to school

#

bye

sage patio
#

anyone knows a open-source nodejs server to create and upload my plugins (so people can use my plugins API)

#

like nexus, a little bit more simple

slender elbow
#

Player.hideEntity

lost matrix
tender shard
lost matrix
#

Ah he wants to create a maven repo

#

Ok. Then i completely dont understand why nodejs...

sage patio
tender shard
#

no

sage patio
azure vault
#

im having a hard time using spigot with reactivemongo. reactivemongo uses akka which is having a lot of issues with spigot using its own classloader for plugins... it cant find any of its own classes or resources

gaunt sail
#

does anybody know if its possible to create a world that doesn't save at all, I've been looking at the server files and from what I've seen it looks like I'll have to modify the server code

sage patio
sage patio
tender shard
#

then you can't use reposilite nor nexus. but you don't need any of that, you can also just use (S)FTP directly with maven. a maven repo is basically just a directory layout

lost matrix
sage patio
azure vault
#

im already using that spigot feature

#

how do i do the latter?

lost matrix
azure vault
#

i already thought about loading my db class through the system class loader in a bootstrap sort of javaplugin instance, but that would be crazy work

tender shard
azure vault
lost matrix
#

CDI frameworks are notoriously buggy with spigots classloader

sage patio
#

thanks

azure vault
azure vault
lost matrix
#

Thats gonna be a pain. gl

azure vault
#

what class loader even has access to the resources inside plugin jars?

azure vault
#

thread.setcontextclassloader or something like that

#

thread.currentthread

#

but im not sure if i even have access to it considering im using reactivemongo and it handles all of the stuff

rough drift
#

A "BRB gotta set fire to an orfanage"

2s later

B "BRB gotta save some orphans from a fire"

#

agreed

quaint mantle
#

?contribute

spare mason
#

anyone knows why Entity#isValid is returning false when an entity is in the overworld?

spare mason
rough drift
#

then that is correct

spare mason
#

but when i spawn it in other dimensions it works correctly

rough drift
#

#isValid will return false after calling #remove

eternal night
#

you can't just spawn it in a different dimension kekwhyper

spare mason
lost matrix
#

Some spawn chunks will be kept loaded. This prevents the entity from being unloaded which keeps it valid.
If an entity is unloaded then its invalid, no matter where it was before.

lost matrix
spare mason
#

oh wtf, i deleted the world and now it works

#

this is awkward

void vapor
#

Hey, does someone know how to edit player nametag in 1.9.4 i tried some protocollib thing but doesn't work

chrome beacon
#

1.9.4???

#

that's an odd version to be running

quaint mantle
#

I don't want to manually commit over 30 files line by line in the web browser...

#

These tutorials in ?contribute are really old and don't really help, I am really stuck

#

I already tested the changes in a dev server of craftbukkit over an hour ago with the changes and it works. I would like to contribute...

#

From what I understood, I have to commit the changes (childs of BlockState) to my CraftBukkit repository

inner mulch
#

why does intellij tell me there is a typo in a word but doesnt tell me what the typo is?

rough ibex
#

it may not have caught up with its bg tasks and is showing an old typo

river oracle
#

just make sure you don't accidently commit NMS pepe_laugh

river oracle
#

(I asked the IDE btw if you're curious how I know)

inner mulch
#

okay, intellij is always trolling me it tells me something might be null but it doesnt tell me how it knows that

river oracle
#

@echo basalt can I get confirmation on this?? ^

inner mulch
#

πŸ˜”

echo basalt
#

wsup

river oracle
# echo basalt wsup

well IntelliJ keeps not telling him where errors are and I'm pretty sure if it did it'd violate OCP so

#

probably why no?

inner mulch
#

ocp is nice principle

#

very important

#

:)

echo basalt
#

why would IJ violate ocp

rough ibex
#

where did the OCP hurt you

river oracle
#

@inner mulch can you check over my plugin to make sure it follows OCP

inner mulch
#

yes send me source

river oracle
#

okay

river oracle
inner mulch
#

okay

echo basalt
#

did cmarco invade your acc

river oracle
#

my sponsors expect Enterprise code from CabernetMC developers which would only be impeded by FOSS

#

@echo basalt Certified best OCP

#

yet another title to add to the core developer of CabernetMC

eternal night
#

stonks cabernetmc looking more and more stacked

river oracle
eternal night
ornate heart
#

What does ocp stand for

echo basalt
#

open close principle

quaint mantle
#

?contribute

wet breach
#

@molten hearth sorry went home last night and just fell asleep lmao

#

I think it was you that needed help

molten hearth
#

All good lol and yeah it was

zinc moat
#

it is not possible to use String ColorUp = color.toUpperCase(); in a Chatcolor.ColorUp but is there a work around

drowsy helm
#

get the name of a colour?

zinc moat
drowsy helm
#

what?

#

no what are you trying to do

#

explain exactly

#

rn you are just explaining an xy problem

zinc moat
#

oh mb

zinc moat
# drowsy helm explain exactly

Trying to take a argument (img 1) and use that in the function so the code run when compressOres to change the color of the name using compressedIngot.getItemMeta().setDisplayName(ChatColor.Color+ name);

drowsy helm
#

so you want to get the colour of the name and apply it to the ingot output am i right?

zinc moat
drowsy helm
#

use the enum then

zinc moat
#

I am new tho

#

I've had no expirence with enums

drowsy helm
#

instead of taking a string colour take a ChatColor as the variable

#

then you can just do color + name instead of parsing it

zinc moat
#

So like

#

ChatColor color?

drowsy helm
#

yeah

zinc moat
#

Alrigth thanks

#

Huh?

drowsy helm
#

just color

analog mantle
#

Alright im back from school

rough ibex
#

Welcome back

analog mantle
#

How can I make the player drop a specific item in their inventory?

rough ibex
#

Create an item entity and remove it

#

From their inventory

analog mantle
#

Right, I need to force them to drop an armor piece, even if it has curse of binding

civic sluice
analog mantle
#

read my previous msg

zinc moat
#

ChatColor.ValueOf(color)

drowsy helm
#

no

#

just do

#

color + name

#

that would just be doing like 3 extra steps to get to the same palce

analog mantle
#

How can I give the item velocity in the direction?

worldly ingot
#

player.getLocation().getDirection() will get you a vector in the player's looking direction, pass that to item.setVelocity()

#

Maybe multiply it by like 0.25 or something

analog mantle
#

ok sounds good

#

I'm so glad I actually understand what a rotation vector is

#

I had no idea what it was 2 weeks ago

#

Where can I find the code for the player.dropItem(true); method?

#

I basically wanna replicate it

#

I also need to check if that itemstack is null in the armor slot before spawning in the item

#

to prevent any race conditions from occuring

sand spire
#

Is there a way to get a list with all similar items for Material or Block? Like all woodtype doors, all colors glass etc

analog mantle
#

Likely something with Registries

young knoll
#

Tags

worldly ingot
#

It mostly delegates to the super implementation though and then just appends some stat tracking, so EntityHuman's drop() method is more interesting

sand spire
#

Thanks I figured it out

analog mantle
#

why is this always false?
if (!m.getPersistentDataContainer().has(dangerKey, PersistentDataType.INTEGER)) {

eternal night
#

how are you setting it

analog mantle
#

For debugging purposes, I am printing out each step, checking if it's ran

#

and I never see "a"

#

ok i fixed it

analog mantle
rough ibex
#

Did you rm from inventory

analog mantle
#

I dont know how to get the armor index

#

this is not a great help, as it doesn't work

#

it removed it from the... hotbar?

young knoll
#

Yeah spigot maps the slots different

worldly ingot
#

Those are protocol slots

young knoll
#

Use Entity#getEquipment#setWhatever

analog mantle
#

ah

#

the vintage 36 + method

#

Every damn time I do inventory stuff, it's ALWAYS the 36 + method

worldly ingot
#

Yeah, Bukkit doesn't expose those protocol numbers anywhere

#

Just makes more sense to reference numerical slots in the order that items are actually added to your inventory

analog mantle
#

no, it's just basic inventory stuff, happens to me all the time modding on the client side

worldly ingot
#

:p

analog mantle
#

choco, what velocity do they apply to the item on player.dropItem(true); method?

spare mason
#

how could i spawn a vertical circle?

rough ibex
#

in what form?

spare mason
#

?

#

what do you refeer to form?

rough ibex
#

how is the circle made

#

in blocks?

spare mason
#

particles i supose, by now i just want to get the location points

rough ibex
#

simple trig

#

cos, sin give you basically an (x, y) of an angle

#

in radius 1

spare mason
#

its like doing a normal circle but cos is z and sin is y ?

rough ibex
#

uh

#

you're going to need to be specific

spare mason
#

or i am not really understanding this

rough ibex
#

You likely aren't

spare mason
#

like usually when doing a circle it is horizontal

#

but i want it to be vertical to put it behind a player direction

rough ibex
#

what

#

is it vertical or not?

spare mason
#

the circle that i want yes

#

but i don't know how to do it

analog mantle
#

Will this apply an x % damage buff to the damage?
event.setDamage(event.getDamage() + (event.getDamage() * (items.getDouble("Damage Buff") / 100d * dangerInt)));

umbral ridge
#

can you make world border in any color?

#

how do you even change its color

young knoll
#

I believe it changes when expanding and contracting

umbral ridge
#

Is it possible to change its color? also when it's idle?

#

packets maybe?

young knoll
#

I think you can just tell it to contract a tiny fraction of a block over a super long period

slender elbow
#

yeah by making it shrink/grow or not you can change it between pale green/red/light blue

#

that's basically hardcoded

analog mantle
slender elbow
#

i mean you can make it change 0.001 blocks in 9 quintillion milliseconds xD

young knoll
#

Idk what about when it ends

umbral ridge
#

Yeah I'll figure it out

#

I thought Player#teleport automatically loads chunks in the area and also... the world?

#

Also how do you check if world is loaded and how to do you load it

young knoll
#

Bukkit.getWorld to check if it’s loaded

#

Load it with WorldCreator

umbral ridge
#

Yea thanks!

analog mantle
slender elbow
#

it takes a long

umbral ridge
#

a long schnitzel

heavy zephyr
#

@echo basalt

#

I think u can help

#

ik u have experience

echo basalt
#

no clue why you're creating an instance of CC but I suspect your database stuff is hanging

#

It seems to load fine though

#

Just add debug messages every other line and you'll be fine

#

(and no, I'm not the only person that can help you, don't ping or DM me )

heavy zephyr
echo basalt
#

bro i started work like 1 hour ago

heavy zephyr
#

Wdym add debug messages

#

idk how to fix

#

ASHIU(ASD

#

ill js resend

echo basalt
torn shuttle
#

@echo basalt you have modelengine 4 right

echo basalt
#

yeah

heady wasp
#

why can't my plugin (Rythm) find Vault

echo basalt
#

Vault is not an economy service. It just provides an economy API for other plugins to implement

torn shuttle
# echo basalt yeah

weird request but can you send me a single file from some random single bone you might have from a resource pack generated with it because I'm like 95% sure that minecraft doesn't have a feature I could really use right now but that 5% makes me wonder if rewriting the entire thing is actually needed

#

I just need to check if there is a display property for display entities that seemingly no one documented

heady wasp
torn shuttle
#

or if it's not documented because it doesn't exist

heady wasp
#

so that other plugins can hook into Vault and use it

echo basalt
#

Then why are you trying to get the existing economy if that's the case?

#

You need to implement the economy class and register it yourself

torn shuttle
#

yeah I know

echo basalt
#

You want the model file or what?

torn shuttle
#

I was in the middle or writing a post on spigot about it but I already kinda know that there's probably only two people who even know what this is about

#

I just need the rsp output, you can send a whole one if you don't mind, but really I just need the equivalent of a single bone

grave vigil
#

I am working with books, and I'd like to get a clone of the book. I don't want to edit the information or any attribute of the given book, but I want an exact copy of all of its attributes. When I do something like this, the item gets deleted from the player's inventory. How can I get an exact copy of the item stack without editing the itemstack itself?

ItemStack proposalBook = e.getCurrentItem().clone();
echo basalt
#

currentItem hm

#

That looks like InventoryClickEvent?

grave vigil
echo basalt
#

Getting and cloning the item shouldn't cause an issue

#

Now keep in mind the cursor & currentItem fields are before the click and not the end result

#

No clue what you're trying to do exactly, might be XY issue

grave vigil
#

idk, I'll just make a book class to store the information I need. Probably a cleaner implementation anyway

#

wont name book obv

echo basalt
#

does it start with mein

grave vigil
#

no lol

grim hound
#

I'm using raw nms to intercept a LoginInStart packet. But when the users of my plugin use Geyser, suddenly it cannot find that packet. Shouldn't Geyser keep compatibility with native mechanisms?

echo basalt
#

I doubt geyser does login logic packets

grim hound
#

Isn't it a plugin that allows bedrock players on java?

echo basalt
#

It does

#

But still login logic is eh

#

Geyser most likely just fakes a player and a connection instead of faking the whole login process

grim hound
#

It translates packets

echo basalt
#

Β―_(ツ)_/Β―

grim hound
#

That's illogical

#

Others can rely on those mechanics

echo basalt
#

it's nms you can't rely on it

grim hound
#

Ofc you can

echo basalt
#

interesting

#

It seems like geyser runs its own server thing

#

When it receives a request it processes it and creates a tcp session o_o

#

I need to learn more ab netty

worthy star
#

hi, what should i use to use numbers more than the max possible

#

for custom player data so if they have like 8 with another 20 0's

analog mantle
#

How can I add a ClickEvent to a kick message?

worthy star
#

use components

#

kyori adventure

zinc walrus
#

right i'm going a little insane here, why does getServer().getIp() return the servername πŸ’€

#

uwu-1 JOINABLE Purpur 25567 weirdly enough i didn't set the listen address to Purpur

worthy star
#

getServer().getIp() + ".com" duke

zinc walrus
#

lmfao

#

nah i'm using it to build an InetSocketAddress

#

but seriously, am i being stupid or is spigot being stupid because this should be working fine

private final InetSocketAddress address = new InetSocketAddress(getServer().getIp(), getServer().getPort());

#

...oh my god was i replacing the jar in my velocity server..

#

i was. jesus christ i'm too tired for this 😭

#
[servman-spigot] fuck it gamers we ball
[servman-spigot] inetsock info:
[servman-spigot] 127.0.0.1
[servman-spigot] 25567

btw if anyone here wants me to oss this plugin i'm more than happy to, it's a small part of my network that took like half an hour to make lmao. it automatically registers servers with velocity & provides velocity/spigot events for you to hook into

zinc walrus
#

if it's longer than a long, then you've probably done something wrong lmfao

#

and a long is the 64-bit signed integer limit, so you won't really be able to get any higher than it.

worthy star
#

how much 0's does long have

zinc walrus
#

check the link i sent

#

Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

worthy star
#

18 zero's

zinc walrus
#

yeah

#

what are you storing that requires numbers that big??

worthy star
#

a nonillion has 30 zero's and i see some servers with it

#

is it just virtual?

#

or they use some custom data types

zinc walrus
#

probably custom data types

#

because long is the 64bit limit, you can't really get any higher

#

unless you can store unsigned numbers in java, which i'm not too sure on.

#

yeah from what i'm seeing you can't store unsigned ints, it's just not a data type in java. you can ofc make it though

grave vigil
#

For some reason when this code executes, the currentItem visually disappears for the user. They are clicking on it from their inventory while in a custom gui. Is this a common / known thing- or am I just royally messing something up?

        if(e.getCurrentItem().getType() == Material.WRITTEN_BOOK){
            ItemStack givenBook = e.getCurrentItem();
            BookMeta book_meta = (BookMeta) givenBook.getItemMeta();
        }
echo basalt
#

2nd option

analog mantle
zinc walrus
#

could be wrong, check javadocs

analog mantle
zinc walrus
#

huh. weird.

#

i'll check for you, give me a second

analog mantle
#

thanks

zinc walrus
#

i don't think you're able to make kick messages with clickable text

#

because there isn't anything in the API to kick/ban that supports TextComponent

analog mantle
#

Nah SURELY there is

quiet ice
analog mantle
zinc walrus
zinc walrus
#

(you should be using paper anyway imo)

#

but yes you can serialise it to JSON

#

use Jackson or Gson

#

i'd recommend Jackson since it's pretty simple

#

but they both work the same

quiet ice
#

But what are you going to do then?

#

You'd need NMS beyond that point

zinc walrus
#

yeah. god i hate NMS so much

analog mantle
#

na

zinc walrus
#

are you building with gradle or maven, i'll send over how to do it

zinc walrus
analog mantle
#

alright fime

quiet ice
#

You cannot say that tho

analog mantle
#

whats the link

quiet ice
#

At least not here

zinc walrus
zinc walrus
analog mantle
zinc walrus
#

i can't send links to what md5 probably considers a competitor

grave vigil
# echo basalt 2nd option

I tested it in isolation, and I found out that it was me closing the inventory shortly after it- so something like this would 1-1 replicate the issue I'm having. When the inventory closes, the book disappears (but only visually). Is there any way to prevent this?

        if(e.getCurrentItem().getType() == Material.WRITTEN_BOOK){
            ItemStack givenBook = e.getCurrentItem();
            BookMeta book_meta = (BookMeta) givenBook.getItemMeta();
            e.setCancelled(true)
            p.closeInventory()
        }
echo basalt
#

player.updateInventory perhaps

grave vigil
#

yeah that worked

#

ty

quiet ice
grave vigil
#

documentation said that it generally shouldn't be used in plugins lol

zinc walrus
analog mantle
#

but it doesn;t appear

zinc walrus
#

refresh your ide

#

or clear intellij's cache if you're using it. intellij can be a bit weird with that

quiet ice
#

player.kick(Component.text("Hello World")); for example

echo basalt
#

translatable components my beloved

zinc walrus
#

real

echo basalt
#

shame I gotta write my own scoreboard and hologram plugins woeisme

zinc walrus
#

oh my god i am actually so sorry for your loss

echo basalt
#

but hey it's neat to have a self translating server

zinc walrus
#

i had to use NMS to try to bypass stupid character limits for my sb plugin

#

and never actually got around to doing it

echo basalt
#

nms is way too easy

#

now that it's all deobfuscated

#

my issue is just the deadline

zinc walrus
#

yeah, still haven't figured out how to properly deobf it

#

never worked for me lmao

echo basalt
#

gotta translate the whole network, new maps, sounds and menus by sunday

zinc walrus
#

"YoU dOnT hAvE aNy SeRvErS cOnFiGurEd" yeah that's the point mate

echo basalt
#

not saying that

#

just that I can't bother adding more work to my already busy schedule

zinc walrus
#

no i'm talking about my proxy

echo basalt
#

ah

zinc walrus
#

either way it don't work

#

i'm amazing at plugin dev you see

worthy star
#

whats best way for guis? like making slots and the click events

#

instead of using tons of classes

#

for events/making/opening

sullen marlin
#

Pretty sure you can just google inventory gui api

surreal hornet
#

google inventory gui api ? huh google has a spigot api ?

quiet ice
#

I myself am a fan of Phoenix616's InventoryGUI lib

worthy star
#

can i have link

#

i've seen someone using like java gui.addButton()... // some stuff (code for slot) -> e.setCancelled(true) // it cancels click event

quiet ice
worthy star
#

is it some api or built in

quiet ice
#

External API, as stated previously

#

Though I think given your experience you'll be confused regardless of what way you'll go with; I'm afraid

worthy star
#

uh why i can't send screenshots lol

smoky anchor
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

smoky anchor
#

or verify

worthy star
#

i think its redempt.redlib.inventorygui.InventoryGUI;

#

from imports

#

yea it is

#

got it, it looks quite easy to use

#

quick question

#

do i always need to download the plugin of the API i need?

minor junco
#

Depends if the API can run without the plugin (which for most things is the case). Just shade the API into your build or put it as a library in the plugin.yml

#

@worthy star

worthy star
#

ok

#

ty

random monolith
#

This method was previously synchronous and now I have made it asynchronous

public static CompletableFuture<String> convertText(String text, Player player) {
        String option = HSPM4.selectedOption(player);
        if(option.equals(HSPM4.getDefaultOption())) {
            return CompletableFuture.completedFuture(text);
        }

        CompletableFuture<String> translationFuture;

        if(option.equals("Modify")) {
            translationFuture = asyncTranslate(player, text, "es");
            return translationFuture;
        }
        if(option.equals("Modify2")) {
            translationFuture = asyncTranslate(player, text, "en");
            return translationFuture;
        }
        return CompletableFuture.completedFuture(text);
    }```

Now I get an error in all the classes in which I implement it, I have tried everything and I don't know how to solve it

```java
String text = Utils.readJsonField(json,"text");
json = json.replace(text, Utils.convertText(text,event.getPlayer()));```
`Cannot resolve method 'replace(String, CompletableFuture<String>)`

How can I fix this?
eternal oxide
#

You can;t just "make it async" like that

ivory sleet
#

yea a String is not the same as CompletableFuture<String>

random monolith
#

Okey I understand, so, how i can correctly make it async?

eternal oxide
#

First you need to understand Async

#

You can not "wait" for a response from something which is Async

#

So you can't imediately get a response for your replace call.

#

You need to Async the whole thing

#

so it runs off thread and processes the result when finished

random monolith
#

okay

#

and

#

Couldn't I implement thenAccept to replace the text when the translation is ready?

String text = Utils.readJsonField(json, "text");
CompletableFuture<String> translationFuture = Utils.convertText(text, event.getPlayer());

translationFuture.thenAccept(translatedText -> {
    json = json.replace(text, translatedText);

});```
echo basalt
#

is string replace thread safe think3d

tardy delta
#

lets hope that only gets called from one place

ivory sleet
#

should be alright, I mean the only thing is that it may not be atomic what he does, and well, if the variable isn’t volatile then rip

random monolith
tardy delta
#

in parallel?

#

actually not too much of an issue cuz its fully replaced, string is immutable

ivory sleet
#

What I tried to say

#

But like

#

var = var.update

#

That may not be atomic

#

which can be a bit of an issue

random monolith
#

Intellij is saying to me that Variable used in lambda expression should be final or effectively final

#

And i think that text isn't getting the right value

hybrid turret
#

I just want to serialize a HashMap<String, Set<String>> using gson... i can't find shit online and it just writes nothing to the files. also no error, nothing.
I'm at a point where I would even accept some sort of spoon feeding if it solves that ._.

echo basalt
#

yeah gson doesnt like generics

#

I'd make a concrete class

ivory sleet
#

I think you should be able to use a type token

echo basalt
#

yeah you might

ivory sleet
#

if its truly just a Map<String,Set<String>>

hybrid turret
#

right, yeah... i tried that but i was too stupid, but i have an idea now

#

Would this be the correct type?

Type type = new TypeToken<Map<String, Set<String>>>() {}.getType();
ivory sleet
#

I think so yea

hybrid turret
#

Hmm, then it isn't working ig :/

#

json still empty

ivory sleet
#

How does ur entire code look like

hybrid turret
#

nevermind i'm stupid

ivory sleet
#

It works?

hybrid turret
#

yeah, after i changed changing the FileWriter as a try-with-resources statement instead of creating a filewriter instance in the toJson-call

#

I'm not exactly certain WHY this made it work bc usually IJ would warn me if this is an issue but welp

#

whatever

#

thanks anyway :D

#

even works without the TypeAdapter lmao what

ivory sleet
#

yep

#

well there is a built in type adapter factory

quaint mantle
#

Which is best to create a Custom Player instance, abstract the class or a new player class with a provided player at the constructor?

ivory sleet
#

That should be β€œleveraging” the nested collection support

hybrid turret
#

Yeah that's why I was confused that it didn't work immediately.

#

But why was the try-with-resources the issue????

#

Am I not understanding basic java?

ivory sleet
#

Hard to tell w/o the code

eternal oxide
quaint mantle
echo basalt
#

Just make a data class with the player id

#

Keep things separate

eternal oxide
quaint mantle
#

I mean, If i extend the class with custom method, In every events the player is provided I can use that easily

tardy delta
#

kotlin extension methods πŸ‘…

eternal oxide
echo basalt
#
public class MyPlayerData {
  
  private final UUID playerId;

  private MyPlayerData(UUID playerId) {
    this.playerId = playerId;
  }

  public static MyPlayerData create(Player player) {
    Preconditions.checkArgument(player);
    return MyPlayerData.create(player.getUniqueId());
  }

  public static MyPlayerData create(UUID playerId) {
    Preconditions.checkArgument(playerId);
    return new MyPlayerData(playerId);
  }

  public Player getPlayer() {
    return Bukkit.getPlayer(this.playerId);
  }

}
#

type deal

quaint mantle
#

What advantages we have with that?

echo basalt
#

Single responsibility principle, full control over code flow

#

Keep it stupid simple

ivory sleet
eternal oxide
#

API shoudl not be extended and Player is volatile.

echo basalt
#

It's just simple non-hacky code

earnest forum
#

Hi, looking for some help on code structure.
I currently have a wrapper for entities that contains data such as stacksize, dropped items, etc. for a mob stacking plugin. I want to make it so that on a creature spawner event, it checks if the spawner entity has a pdc entry, if so, when the spawn event occurs to add the mobs spawned to an existing stacked mob if there is one within a certain range. Wondering if creating a static list in the mob wrapper and adding all of my stacked mobs into that list, then iterating over that on the spawn event to see if there are any stacked mobs within a certain range is the correct way to go about it, or if there is a more efficient way to do this. Thanks

tardy delta
echo basalt
#

The static factory methods can be bypassed but they're nice to haves

ivory sleet
echo basalt
#

In a perfect world the static factory methods would be package private and you'd have all your data flow through your manager class

tardy delta
#

friend classes πŸ‘…

#

people dont use c++ here :(

hybrid turret
grave vigil
#

is there a way to see if a player leaves a book?

umbral ridge
#

What would be the formula to sync current real life time with the ingame

echo basalt
#

uh

umbral ridge
#

Need to get the ticks..

echo basalt
#

there are 24k ticks in a minecraft day

#

So you just uh

hybrid turret
#

1 tick is 20ms. no?

tardy delta
#

isnt a mc day 20 minutes or smth

echo basalt
#

1 tick is 50ms

hybrid turret
#

oh 50?

echo basalt
#

1/20

hybrid turret
#

AH

#

right

#

that's where i got the 20 from

echo basalt
#

So the formula is something like

#

1 irl day = 24 * 60 * 60 * 20 ticks

#

So then you can come up with a ratio

orchid trout
#

i day is 86400 secobds

echo basalt
#

yeah

orchid trout
#

everyone should know that

echo basalt
#
public static final int HOURS_IN_DAY = 24;
public static final int MINUTES_IN_DAY = HOURS_IN_DAY * 60;
public static final int SECONDS_IN_DAY = MINUTES_IN_DAY * 60;
public static final int TICKS_IN_DAY = SECONDS_IN_DAY * 20;
#

We could also come up with some inverse ratios

#

Or some different measurements that might help us

lost matrix
#

I mean if there are 24k ticks in an mc day and a real day has 24h, then all you need to do is take the real time and multiply it by a thousand.

hybrid turret
#

is it good practice btw to use public constants instead of getters and setters?

echo basalt
#

Well yeah that'd be the case if

#

your measurement is [0.0, 24.0[

lost matrix
hybrid turret
#

uhm

#

shit what are they called

#

the term for string, int, double, boolean etc etc

#

primitive types

echo basalt
#

In a perfect scenario you have a day elapsed %

#

that you just multiply by TICKS_IN_DAY

lost matrix
echo basalt
#

Getters are useful in an inheritance context

orchid trout
#

what if only static

umbral ridge
#

Cant multiply real time by anything... cant multiply hours.. minutes.. seconds.. nothing. I could divide the current seconds and come up with some ratio for mc ticks but its kinda complicated

hybrid turret
#

okay then i meant to drop the setters. whoops

hybrid turret
echo basalt
#

Let's use some alternative measures

umbral ridge
echo basalt
#

1/whatever

hybrid turret
#

✨ percentage ✨

umbral ridge
#

How is percentage going to help me set the world time in ticks

#

Hmmmm i guess

hybrid turret
#

What even is your goal? Syncing up Minecraft with RT?

echo basalt
#
public static final int TICKS_IN_HOUR = 1000; // 24000 ticks in a day / 24 hours in a day
public static final int TICKS_IN_MINUTE = TICKS_IN_HOUR / 60; // These are lossy operations. You might want to divide by 60.0
public static final int TICKS_IN_SECOND = TICKS_IN_MINUTE / 60; // This is not TPS

public static int getWorldTicks(int hours, int minutes, int seconds) {
  return (hours * TICKS_IN_HOUR) +
         (minutes * TICKS_IN_MINUTE) + 
         (seconds * TICKS_IN_SECOND);
}
#

sumn like this

umbral ridge
#

Alrightt

echo basalt
#

Seconds is not going to be accurate as it's below 1

#

it's ab 16.6 ticks per minute

#

you might want to use doubles

#

and just round

lost matrix
#

Solution which uses as little magic numbers as possible:

  public static final long TICKS_IN_MC_DAY = 24000;
  public static final long SECONDS_IN_A_DAY = Duration.of(1, ChronoUnit.DAYS).getSeconds();

  private long getElapsedSecondsOfCurrentDay() {
    LocalTime currentTime = LocalTime.now();
    LocalTime midnight = LocalTime.MIDNIGHT;
    return ChronoUnit.SECONDS.between(midnight, currentTime);
  }

  public int getLocalTimeInTicks() {
    long elapsedSeconds = getElapsedSecondsOfCurrentDay();
    return (int) (elapsedSeconds * (TICKS_IN_MC_DAY / SECONDS_IN_A_DAY));
  }

blobspoonfeed

umbral ridge
#

ChronoUnit

#

XD

echo basalt
#

thumbsup I'm too sleep deprived to use one of the time apis

#

this sleeping every other day thing is messing me up

lost matrix
echo basalt
#

I'm aware

#

I live my work life in phases

#

Sometimes they're a little extreme

#

in january I was broke and made like 600 bucks the entire month so I said "fuck it imma start working more than 15-20 hours a week" and now I'm doing 60+

earnest forum
#

is there any way to let mob spawners spawn hostile mobs during day time?

echo basalt
#

pair that with me having obsession problems

#

and the result is me sleeping 30 minutes every other day

#

or like I did yesterday, sleeping 30 minutes for 3 days in a row and passing out for 14 hours

lost matrix
earnest forum
#

any pointers to help me get started?

#

actually i might just have a runnable that controls spawning

lost matrix
#

net.minecraft.world.level.block.entity.SpawnerBlockEntity

inner mulch
#

Does somebody know how redisson locks work on Detail? Or provide a ressource?

lost matrix
#

All you do is get a lock with a name and then lock it.
Other people wont be able to ack that lock until you relase it.
It follows the java lock specification and works exactly like other locks.

short raptor
#

Can I change the length of time of particle dust transition

#

So it lasts longer

echo basalt
#

no

short raptor
#

gah darn it

echo basalt
#

particle displays when πŸ‘€

inner mulch
#

No Single looks?

#

locks

lost matrix
#

Nope you can only lock a single lock which has a name as his identifier

inner mulch
#

So i cannot lock specific objects?

lost matrix
#

You can lock only locks. If you want to lock an object then you need to make sure it only gets changed by someone that has the lock.

inner mulch
#

Uh i dont think i can understand locks

lost matrix
#

Maybe try using a normal lock first in a terminal java application.
Spawn 4 threads which all do something to your object and synchronize it using a lock.

echo basalt
#

a good rule of thumb I use is just think of multi-server interactions like multi-threading but high latency

#

I end up using locks and thinking of concurrency issues a lot more often

charred blaze
#

how can i make colored messages in console?

echo basalt
#

Try getConsoleSender

umbral ridge
#

use ConsoleCommandSender

eternal oxide
#

Be careful with color in logs. They become hard to read

echo basalt
#

yesterday I learned that minecraft color codes have stupidly simple colors

#

&k isn't really translatable and I cant bother looking up the minimsg equivalent so copilot did it

umbral ridge
#

ahh MiniMessage

echo basalt
#

my beloved <3

#

I'm converting everything to minimsg and dont want to lose legacy compat

earnest forum
#

anyone know if EntityEquipment is pass by reference?

charred blaze
earnest forum
#

if i do spawnedMob.getEquipment().clear(); will this clear the mob's armour

eternal oxide
#

Yes as it returns EntityEquipment which is backed by the inventory

umbral ridge
#

So theres something wrong

#

XD

#

why is it always 0

fixed it.

earnest forum
#

Why does it not clear the "Interact with spawn egg" part when i set the lore?

eternal oxide
#

show code

#

um, thats not lore

earnest forum
#

think i found a solution hold up

#

for some reason that part comes under HIDE_POTION_EFFECTS item flag

#

meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); fixes it

#

weird

worthy star
#

did they change something in commands for 1.20.4?

#

whenever i add a command to my code the plugins starts sending errors

rough drift
#

show

worthy star
#

getCommand("inventory").setExecutor(new InventoryCmd()); here i register the cmd

#

and

rough drift
#

show your plugin.yml

worthy star
#
    public void openGui(Player p) {

        InventoryGUI gui = new InventoryGUI(Bukkit.createInventory(null, 27, Component.text("Inventory.")));

        ItemButton diamond = ItemButton.create(new ItemBuilder(Material.DIAMOND)
                .setName("Best Diamond"), e -> {
                    e.setCancelled(true);
        });

        gui.addButton(1, diamond);

        gui.open(p);
    }``` and here is the code i use
#

quick code, im just learning the api

#

even if i try something else

rough drift
#

and show the error

worthy star
#
name: Inventory
version: '${project.version}'
main: me.hothifa.inventory.Inventory
api-version: '1.20'
commands:
  inventory:
    description: "Lets open some inventories."```
rough drift
#

btw you can use the yml format in discord for that, not java

#

also yeah just send the error

worthy star
#

i can't send error

rough drift
#

why?

worthy star
#

it says error while uploading

rough drift
#

?paste

undone axleBOT
worthy star
#

or may it be because i use plugman instead of restarting?

rough drift
#

put it there

#

and send the link

worthy star
#

oh why?

#

it was working before

rough drift
#

Sometimes it breaks

worthy star
#

here is error anyway

rough drift
#

Yeah plugman fucked it up

#

at com.rylinaux.plugman.util.BukkitCommandWrap.wrap(BukkitCommandWrap.java:92) ~[PlugManX.jar:?]

worthy star
#

ight

rough drift
#

the error is in the plugman command btw

#

not your code

worthy star
#

ight

#

ty

#

it worked after i restarted

median trench
#

Is there any way I can trace an "Internal Exception: java.lang.reflect.InvocationTargetException" from the client? I can't see any trace in either log. And it happens when modifying (creating from scratch) a clientbound packet

rough drift
#

What packet are you modifying and how?

lost matrix
floral drum
#

hi

rough drift
#

hi

floral drum
#

nerds

silent lark
#

hi

median trench
# rough drift What packet are you modifying and how?

It's "ClientboundContainerSetContentPacket" but it worked before so I have no clue what's wrong now. I am just reading the content of the notnull list and putting it into a new notnull list, basically changing an item for another one if it exists. "new ClientboundContainerSetContentPacket(p.containerId, p.stateId, items, carriedItem)" and I send this instead of the original with the ChannelDuplexHandler write (or read idk right now hahah)

rough drift
#

write*

#

you were right

#

anyways, if you literally send the same values, does it work?

median trench
#

you mean with new Clientb...(p.containerId, p.stateId, p.items, p.carriedItem)? or without modifying anything

rough drift
#

yep

#

just send the same values, if the error persists it's something else

median trench
#

same values not working

#

will look through the commits but I don't remember changing anything from the handler

rough drift
#

so there's something else happening, did you check the client logs?

median trench
#

yep literally this and no more logs displayed

[12:29:02] [Render thread/INFO]: Connecting to 127.0.0.1, 25565
[12:29:04] [Render thread/WARN]: Client disconnected with reason: Internal Exception: java.lang.reflect.InvocationTargetException

earnest forum
#

World#getNearbyEntities should return all the entities within the range right? for some reason my code is only detecting a zombie within the range when my player is outside of the range, when my player is inside the range it only returns me

chrome beacon
#

Show your code

earnest forum
#

for (Entity entity : spawnerBlock.getWorld().getNearbyEntities(spawnerBlock.getLocation(), 8, 8, 8))

rough drift
#

I don't know tbh

eternal oxide
#

Your spawnerBlock is not where you think it is

earnest forum
#

it should be where i think it is

median trench
eternal oxide
#

gfetNearbyEntities will never fail to return ALL relevant entities, UNLESS a chunk is not loaded or you did it on ChunkLoad, but before Entities are loaded

rough drift
#

probably, try log it?

earnest forum
#

its inside a runnable that is started when the block is placed

#

spawnerBlock is where it is supposed to be, just checked

median trench
#

okay mb

#

it was another packet listener

lost matrix
earnest forum
#

is it not loaded if im standing inside the chunk?

eternal oxide
#

are your runnables running async?

earnest forum
#

no

eternal oxide
#

then you need to show us full code

#

nothing you have described is possible

rough drift
#

my boy is running EpikSpicottChinaEditionv69420

umbral ridge
#

?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.

umbral ridge
#

its hard to answer

#

XD

earnest forum
#
void startRunnable(){
        new BukkitRunnable() {
            @Override
            public void run() {
                if (stopRunning) {this.cancel(); return;}
                PersistentDataContainer pdc = spawnerBlock.getPersistentDataContainer();
                Bukkit.broadcastMessage("Starting entity check");

                    YMob mobFound = null;
                    for (Entity en : spawnerBlock.getWorld().getNearbyEntities(spawnerBlock.getLocation(), 8, 8, 8)) { // Nearby mobs
                        if (!(en instanceof LivingEntity entity)) continue;
                        for (YMob mob : YMob.mobs) {
                                if (!mob.entity.equals(entity)) return; // Mob is stacked
                                Bukkit.broadcastMessage("Found mob");
                                int spawnedEntityAmount = pdc.get(Keys.SPAWNER_DATA_KEY, PersistentDataType.TAG_CONTAINER).get(Keys.SPAWNER_DATA_AMOUNT_KEY, PersistentDataType.INTEGER);
                                mob.addEntityToStack(spawnedEntityAmount);
                                mobFound = mob;
                            }
                    }

                if (mobFound == null){
                    Bukkit.broadcastMessage("Spawning new mob");
                    Location spawnerLocation = spawnerBlock.getLocation();
                    Random r = new Random();
                    LivingEntity spawnedMob = (LivingEntity) spawnerBlock.getWorld().spawnEntity(spawnerLocation.add(r.nextInt(-3, 4), 0, r.nextInt(-3, 4)), spawnerBlock.getSpawnedType());


                    spawnedMob.getEquipment().clear();
                    new YMob((LivingEntity) spawnedMob, pdc.get(Keys.SPAWNER_DATA_KEY, PersistentDataType.TAG_CONTAINER)
                            .get(Keys.SPAWNER_DATA_AMOUNT_KEY, PersistentDataType.INTEGER));
                }

            }
        }.runTaskTimer(Main.INSTANCE, 0, 60);
    }
wet breach
#

might need to show how you are obtaining spawnerBlock

#

or where it comes from

earnest forum
#
public YSpawner(CreatureSpawner spawner){
        this.spawnerBlock = spawner;
        spawners.add(this);
        startRunnable();

    }
#

this class is initialized on blockplace event

wet breach
#

Do you check if the event was canceled?

#

not sure if that matters or not

earnest forum
#

spawnerBlock isn't the issue

wet breach
#

it is, if the location isn't accurate

earnest forum
#

i checked, and it's the right location

eternal oxide
#

Ok, how do you know this is not detecting mobs?

#

or that it's detecting a Player when they are outside the range?

earnest forum
#

i broadcasted the "en" value inside the for loop, and it only came up with my player's name

earnest forum
eternal oxide
#

Your spawned mob will not have a PDC entry btwq so your code will blow up with an NPE on the .get

#

ah the PDC is on teh spawner?

earnest forum
#

yes

#

its a pdc of a container that contains an entity type and how much of the entity to spawn each iteration

eternal oxide
#

I don;t see you excluding players in your for loop

earnest forum
#

don't really need to do i? if (!mob.entity.equals(entity)) return;

#

my player is never going to be a YMob

#

I just tested it out again, placed the spawner and it spawned the mob but wasn't adding to the stack, then i left the range and came back in and now it is adding to the stack

eternal oxide
#

you never add your spawned YMob to YMobs.mobs

earnest forum
#

it does in the constructor

eternal oxide
#

ok

earnest forum
#
public YMob(LivingEntity _entity, int startingSize){
        this.entity = _entity;
        this.stackSize = startingSize;
        entity.setAI(false);
        entity.setCustomNameVisible(true);

        String type = entity.getType().toString();
        entity.setCustomName(Main.translate("&b"+stackSize+"x &c"+type.substring(0,1)+type.substring(1).toLowerCase()));
        mobs.add(this);
    }
eternal oxide
#

is mobs static?

earnest forum
#

the list is yes

#

public static List<YMob> mobs = new ArrayList<>();

old cloud
#

public 😰

eternal oxide
#

This line if (!mob.entity.equals(entity)) return; // Mob is stacked needs to be a continue

#

else as soon as it sees the player, or ANY other entity your loop stops

earnest forum
#

yea ur right

eternal oxide
#

anything which is not one of your tracked mobs exits the loop

earnest forum
#

what a mistake

earnest forum
eternal oxide
#

np

#

Also, rather than looping over your YMobs you coudl just do mobFound = YMobs.get(en)

eternal oxide
#

err

#

I was thinking map

earnest forum
#

what like <Entity, YMob>?

eternal oxide
#

or with a LIst call indexOf(en) then if no -1 get the index

earnest forum
#

is -1 when it isnt part of the list?

eternal oxide
#

so java if (YMobs.indexOf(en) > -1) { mobFound = Ymobs.get(Ymobs.indexOf(en))

#

you could improve that too

earnest forum
#

wait

#

YMob.mobs is a list of <YMob> but en is an Entity

#

wouldn't work

eternal oxide
#

oh yeah you store it as entity

#

so yea won;t work

earnest forum
#

might just make it a map

#

would make life easier

eternal oxide
#

a Map would be easier

#

entity, YMob

#

or you could ignore me and continue as you are as it's working πŸ˜›

earnest forum
#

nah i should do this

#

would probably make it easier for myself later on

eternal oxide
#

what would be better than even tracking spawned mobs, is adding a PDC to the spawned mob

#

do you clean up your YMObs on death?

earnest forum
#

yeah

#

also on disable

#

i delete all of them

eternal oxide
#

ok

earnest forum
#

don't really plan to make them long-term for lag and all

charred blaze
#

@EventHandler(ignoreCancelled = true)
public void onPotionSplash(PotionSplashEvent event) {
System.out.println(23);
if (!(event.getEntity() instanceof Player)) {
return;
}
System.out.println(24);

#

im getting 23 when dropping splash potions

#

isnt event.getEntity the entity who threw it?

earnest forum
#

its most likely the splash potion itself

#

yeah it is

earnest forum
charred blaze
#

yea

#

ill try it

umbral ridge
#

I would actually need to tell the game, when the sunrise starts and when the sunset ends, which is far more complicated..

#

So it's not so simple afterall

#

Quite a lot of work

#

I could divide the calculated ticks by 2, which would result in halfing the value and the sun would return to... the sky? But I'm not sure how this would work during the night. Because when the night starts, and ticks are at its max world value... the sun would probably jump at sunrise, actually don't know

young knoll
#

Minecraft time is weird

#

0 is sunrise, not midnight

umbral ridge
#

Yes

#

....

#

Help

#

xD

lost matrix
#

Just subtract the offset

young knoll
#

I mean you can just subtract 6000 and then floormod

umbral ridge
#

Hmmm

#

So in scheduler, I update the world time and the sign every 5 seconds.

This is what I have:

long timeInTicks = getWorldTicks(localDateTime.getHour(), localDateTime.getMinute(), localDateTime.getSecond());

Then at the end I just do -6000 ? Where do I floormod?

young knoll
#

after the -6000

#

That will turn -6000 into 18000

umbral ridge
#

That? xD

timeInTicks = (timeInTicks - 6000) % 24000;
umbral ridge
#

what's the first and 2nd value supposed to be

young knoll
#

Yeah that looks good

umbral ridge
#

For some reason that didn't do anything

#

XD

young knoll
#

did you subtract the 6000?

umbral ridge
#

yea

#

one sec

#

If I use floormod the entire scheduler stops working and can't do anything, can't even Bukkit#broadcastMessage anywhere in the code entire project is bugged right now lol

umbral ridge
# young knoll did you subtract the 6000?

Works now, but nothing has changed. it's the same as it was,.... There is some weird stuff happening.

So I do floormod and broadcastMessage right after and nothing prints out, and yet the code after gets executed as if nothing happened..

NEVERMIND, was exporting the plugin in wrong directory ...... COME ONNNNN

quartz pendant
#

anyone got an good idea how to prevent afk fishing?

we're testing with mover, checker and some more, but all of them are not very effective =/

slender elbow
#

surprise them with some chat trivia

#

if they are afk then they won't be able to answer

eternal oxide
quartz pendant
eternal oxide
#

Many players (like myself) totally ignore chat when playing

quartz pendant
#

should be also an option of booth ...

slender elbow
#

present them with a sign to solve a captcha :^)

shadow night
quartz pendant
#

would it be an option if an player fishs some time, the player will be teleportet to an "afk room" where they need to solve an captcha? if they got the captcha in time, he will get teleported back, if not, he will got send to hub or got kicked

eternal oxide
#

I'd probably just stop them catching anything if they fish in teh same 4-5 block area for x amount of time

shadow night
#

what even is the issue what afk fishers

icy beacon
#

Spawn a TNT at the player that will only be diffused if they move a substantial distance from it, and if they don't, destroy their house with an intercontinental ballistic missile

icy beacon
#

Though I'd stick to a weapon of mass destruction. But that's just me

quartz pendant
#

so, anyone knows an plattform to ask for devs that they can code this? (yea, money inclusive, i know)

icy beacon
#

?services

undone axleBOT
quiet ice
#

That generally works; some other methods of vanilla transport (minecarts, water, etc.) could be accounted for too; but given that the fishing rope will snap after some distance no biggie to be had here

icy beacon
#

Either this or HelpChat

shadow night
#

you can ask somebody on bukkit, maybe some bored ass will do it lmfao

icy beacon
#

Bukkit πŸ’€

#

Is it still viable for requests

quiet ice
#

The bukkit forums are quite dead, no?

icy beacon
#

I'd assume

shadow night
#

probably

native ruin
#

the first one is just straight up a hungergames one

quartz pendant
#

send an request in helpchat, maybe this helps

umbral ridge
#

Hey

#

If you change the weather in the world, to eg.: rain, will it ACTUALLY rain in the biomes that.. allow rain?

#

How about snow?

#

If I change the weather to snow, will it snow in biomes that typically allow the snow weather.. or will it snow everywhere, in all biomes, including unloaded chunks, how does this work?

quartz pendant
shadow night
#

it's determined by the biome temperature from what I remember

slender elbow
#

i love the part where you can place an empty cauldron in a desert while it's "raining" and the cauldron will still fill up with water

#

or did they fix that? that was a fun bug

quartz pendant
slender elbow
#

a good way to get water in a desert if you couldn't find any

shadow night
river oracle
#

Which means it's super storm or no storm wild weather patterns

native ruin
#

Imagine if weather was programmed as a moving noise map

twin venture
#

hi , i have a bit of problem with json?
so iam trying to have my json file to look like this :
but now in the loadAllLevels , nothing is being loaded / added to cache map ..

#

here not being sent : any idea why?

chrome beacon
#

Do the if statement pass

#

is it deserializing correctly

twin venture
#

am i doing somth wrong?

#

in LevelManager :
private final Gson gson = new
GsonBuilder().setPrettyPrinting()
.serializeNulls().registerTypeAdapter(LevelWrapper.class, new LevelWrapperAdapter()).create();

slender elbow
#

the endsWith(".json") will always be true because that's what you entered in the file constructor

chrome beacon
#

yeah that entire if check can be removed

twin venture
#

ok removed.

slender elbow
#

and getName only gives you the file name, not the whole path, so that's gonna be false for the second check as well

#

the whole if looked.....

twin venture
#

removed the check

slender elbow
#

iffy

twin venture
#

added few checks it seems that LevelReader is null somehow xD

#

i mean LevelWrapper

slender elbow
#

looks like it's empty more than null

#

empty array/list

twin venture
#

but its not

#

the file is clearly filled

#

isn't this a list of levels?

#

no?

worldly ingot
#

I think your file access is incorrect, no?

#

plugindatafolder//Level.json?

#

new File(plugin.getDataFolder(), "Level.json") would be the correct way to do it rather than concatenating and hoping it separates correctly

twin venture
#

alright let me try ..

slender elbow
#

ig you could try printing what the jsonElement is inside the deserialize method to see what gson truly read

icy beacon
slender elbow
#

"yes"

umbral ridge
#

Emily enters the chat

slender elbow
#

but the other ctor should be used instead

#

new File(dir, fileName)

pastel juniper
#

Why I can't get Block???

#

I m using spigot with mojang deobfuscated maps vesrion 1.18.2

twin venture
#

i k what's wrong , it was a type in the deserlizer xd

worldly ingot
#

You're also probably looking for Blocks not Block

#

The actual class is net.minecraft.world.level.block.Blocks iirc

quaint mantle
#

When i do this:

        rocketShip.centerBlock.addPassenger(player);

It teleports the player but it does not "seat" the player correctly. Is there a reason on why this could be happening?

pastel juniper
restive mango
#

So, I have a strange problem: when I try to use player.chat("string"); I get either an error saying

AsyncNativeChatEvent may only be triggered asynchronously. (in the case I run it in a normal bukkit runnable)

AsyncPlayerChatEvent may only be triggered synchronously. (in the case I run it in an asynchronous bukkit runnable)

anyone got a solution?

chrome beacon
#

What is AsyncNativeChatEvent

eternal oxide
#

Not Spigot

chrome beacon
#

Yeah and it's not Paper

#

so I have no idea what it is

#

Google gives 0 results

restive mango
#

ruff

worldly ingot
#

Sounds like you've got a bug in whatever software you're running

eternal oxide
#

?paste your full error/stacktrace

undone axleBOT
restive mango
#

kk ty

pastel juniper
#

Show, I came up with this
try {
Field field = net.minecraft.world.level.block.Blocks.class.getDeclaredField("strength");
field.setAccessible(true);

        // Check if the field is of type float
        if (field.getType() == float.class) {
            field.setFloat(Blocks.DIAMOND_ORE, 50.0F);
        } else {
            System.out.println("Field is not of type float");
        }
    } catch (NoSuchFieldException e) {
        System.out.println("Field not found: " + e.getMessage());
    } catch (IllegalAccessException e) {
        System.out.println("Illegal access: " + e.getMessage());
    }

and I get
Field not found: strength
I think this happens beacuse it s private, any ideas???

chrome beacon
#

It's not called strength during runtime

elder harness
#

Is it possible to define an api-version of 1.20 in the plugin.yml, but make the plugin still support lower versions?

#

Spigot now automatically disables the plugin if the server version is <1.20

remote swallow
#

what would the point of that be

remote swallow
elder harness
#

I guess I just don't understand what the "api-version" is for

remote swallow
#

thats a setting in bukkit or spigot .yml

elder harness
#

What do you mean?

remote swallow
#

that isnt an offical thing

#

spigot did not add that

#

that is just a setting for end users

chrome beacon
#

the minimum being 1.13

inner mulch
#

guys i tried splitting my interfaces up so i dont have one big one of which i dont even use all methods, is there a clean way of designing my code intented to accept many interfaces? I dont really like the idea of object instanceof myInterface every time i check for one method or something.

chrome beacon
#

depends on what the context is

#

like what method and were is it used

#

It's hard to say without more information

#

generally though avoiding instanceof checks is a good idea

inner mulch
# chrome beacon depends on what the context is

i have one object that accepts "dataloaders", some like sql require to have entries in a table and some dataloader do not, when loading data i'd need to check if its a sql loader to acces the createEntry Method

silent lark
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous usernames, global display names, and server...
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

silent lark
#

?log

#

?help log

chrome beacon
#

maybe, maybe not depends on what the other data loaders are

#

but I assume that they also have some save method

inner mulch
#

yes

chrome beacon
#

then:

save:
SQLDataLoader.save() -> createEntry
NonSQLDataLoader.save() -> do something else

inner mulch
#

dont do it async

inner mulch
chrome beacon
#

Forget what?

inner mulch
#

forget adding the entry code

#

cuz there is no method asking me for it

#

but i guess im gonna remember now

chrome beacon
#

you'll notice when you test it

#

ig

jagged quail
#
print("Hello World")```
#

there we go

native ruin
#

doesn't compile

inner mulch
slender elbow
#

interface Storage { void save(); }
class SqlStorage implements Storage { public void save() { ... sql save logic } }
class MongoStorage implements Storage { public void save() { ... mongo save logic } }

chrome beacon
#

^^

inner mulch
#

i know im gonna use it like this

slender elbow
#

no need to instanceof

inner mulch
#

but hwo does it work in cases where a 2nd method is needed

chrome beacon
#

what second method?

remote swallow
#

if you add a method to the interface and not into a class, it should fail to compile iirc

inner mulch
#

idk for example addentry

slender elbow
#

what epic said

#

you just add the method to the interface and implement it in the implementations

inner mulch
#

interface -> load, addentry <- dead when using mongodb only for sql

if i really wanted to split it up and really do need it in some other case how would that work? instanceof spam?

remote swallow
#

ideally you should have all the same methods

#

they just might end up doing different things internally

inner mulch
#

okay but in cases where its not possible?

slender elbow
#

why would different storage types have different exposed methods?

#

it's abstract

#

load user, save user, load item info, etc

inner mulch
#

bro guys im talking about a case where its needed

slender elbow
#

the implementation takes care of the details

inner mulch
#

a theoretical case

slender elbow
#

that case should not be needed

#

that's why you'd design it like that, in a good way

#

so, in the case that your code is bad, then yeah

inner mulch
#

ok

#

πŸ˜”

remote swallow
#

interface storage
class sql implements storage { storage methods, non storage/interface methdods }

inner mulch
#

ik

dry forum
#
            armorStand.setRotation(stand.getLocation().getYaw(), stand.getLocation().getPitch());```

i have  2 armorstands, armorStand and stand, im crating a new armorstand with the same rotation as stand thats called armorStand, but the rotation isn't the same as stand when i use the code above, its off by quite a lot and idk why this is happening

i debug by sending the yaw of both stands
```[17:50:33 INFO]: x: -65.24243
[17:50:33 INFO]: y: 294.75757```

and they arnt similar at all.. so this doesnt make any sense
lost matrix
dry forum
lost matrix
dry forum
# lost matrix A Location already has pitch and jaw. So if you simply clone the first armorstan...

im using

    ```for (Offset offset : offsetArmorStandHashMap.keySet()) {
        ArmorStand stand = offsetArmorStandHashMap.get(offset);

        Location newLocation = location.clone();
        newLocation.add(offset.x, offset.y, offset.z);

        ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(newLocation, EntityType.ARMOR_STAND);
        armorStand.setRotation(stand.getLocation().getYaw(), stand.getLocation().getPitch());

        Bukkit.broadcastMessage("x: " + armorStand.getLocation().getYaw());
        Bukkit.broadcastMessage("y: " + stand.getLocation().getYaw());
    }```

to spawn armorstands around a central location with offset in relation to the center (i kinda tried to generalize it when i explained the original problem above so it would be easier to understand) but i want to clone stand to a different location, so i need to get the yaw/pitch still for the new armorstand

#

if i clone the location and dont modify the yaw/pitch, the armorstands have no rotation

lost matrix
#

Do you want to spawn ArmorStands in a circle with all of them looking into the center?

dry forum
#

no i have a list of armorstand with an offset attatched to each of them, then the player can select a center location and the armorstand will spawn in relation to the center so they keep their distance from each other if that makes sense

lost matrix
#

Yeah makes sense

#

Tell me again where "location" comes from.

dry forum
#

location is the central location that the player defines

lost matrix
# dry forum location is the central location that the player defines

Try this:

        Location original = armorStand.getLocation();
        for (Offset offset : offsetArmorStandHashMap.keySet()) {
            ArmorStand stand = offsetArmorStandHashMap.get(offset);

            Location newLocation = location.clone();
            newLocation.setDirection(original.getDirection());

            ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(newLocation, EntityType.ARMOR_STAND);

            Bukkit.broadcastMessage("x: " + armorStand.getLocation().getYaw());
            Bukkit.broadcastMessage("y: " + stand.getLocation().getYaw());
        }
dry forum
#

uhh how would i get armorStand.getLocation() before its initialized

#

i assume original is cupose to be the center?

lost matrix
#

Im honestly a bit confused by the structure.
Why do you need key:value access with the offset being the key.

But yeah.

        for (Offset offset : offsetArmorStandHashMap.keySet()) {
            ArmorStand stand = offsetArmorStandHashMap.get(offset);

            Location newLocation = stand.getLocation().add(offset.x, offset.y, offset.z);
            ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(newLocation, EntityType.ARMOR_STAND);

            Bukkit.broadcastMessage("x: " + armorStand.getLocation().getYaw());
            Bukkit.broadcastMessage("y: " + stand.getLocation().getYaw());
        }