#help-development

1 messages · Page 926 of 1

ivory sleet
#

which replaces the value if and only if an existing value matches the “oldVal”

#

that can be used if u want to do stuff atomically supposing the map is one of those concurrent ones

#

and the atomic objects I prob dont even need to go through

silver robin
#

So I'm assuming these are javadocs, and only spigot and bukkit have them
In intellij i have two projects set up, one for 1.16.5 and one for 1.20.4, and here are the differences when I view bukkit's LivingEntity interface:

#

I want to see javadoc instead of decompiled code in 1.20.4, but I'm not able to figure out where's the setting for that (is it in maven or intellij or something else), could anyone help me?

inner mulch
#

I currently have a normal map in a liveobject, i will look into these methods

smoky anchor
silver robin
#

I want to add that there is a sources jar in my folder ~\.m2\repository\org\spigotmc\spigot-api\1.16.5-R0.1-SNAPSHOT, but there isn't one for 1.20.4, it only contains snapshot.jar and snapshot-shaded.jar

tender shard
#

BuildTools should have an option to install sources

silver robin
#

I fixed the problem by enabling these options in BuildTools jar, the sources jar was generated

silver robin
charred blaze
#

how do i set keepinventory for only one player?

inner mulch
charred blaze
#

how do u save their inv

#

what is proper way to do this

inner mulch
#

Do you know java

charred blaze
#

what if they leave or something

charred blaze
inner mulch
#

Then use ur knowledge, i showed you the way spoonfeeding isnt good

charred blaze
#

i havent meant i need code

inner mulch
#

?

charred blaze
#

yea i can store his items in hashmap or something

#

but

#

what if he is dead BECAUSE he left

#

can you give items to offline people? no

inner mulch
#

Yes you can

charred blaze
#

you can?

inner mulch
#

With a custom inv System, by saving the inv in a DB and changing it

charred blaze
#

how

#

changing it when

#

whenever player joins?

remote swallow
#

prob on login

charred blaze
#

does giving items to player work when they have respawn screen and havent been respawned?

inner mulch
#

?tryandsee

undone axleBOT
charred blaze
#

?trying takes more time than asking

inner mulch
#

If you are concerned just enable to gamerule for insta respawn with no death screen

charred blaze
#

oh PlayerDeathEvent actually has .setkeepinventory

charred blaze
#

how do i make this disappear?

#

i clicked something on keyboard accidentally and it appeared

lost matrix
#

What are we looking at?

charred blaze
#

otherwise i would have googled it

tall dragon
#

click on greeneddev

#

in ur text

charred blaze
#

and?

young knoll
#

looks like git blame?

tall dragon
#

it goes away

charred blaze
lost matrix
tall dragon
#

did u click this?

lost matrix
#

^

charred blaze
#

oh that one

tall dragon
#

yes that one

charred blaze
#

yea it works

lost matrix
#

This looks like git blame to me as well

charred blaze
#

thanks

tall dragon
#

thats cuz it is

#

;d

charred blaze
#

git "blame"?

young knoll
#

It tells you who to blame for each line

tall dragon
#

u can see whoever to blame for that piece of work

charred blaze
#

is that a thing

#

lol

young knoll
#

When something inevitably breaks

tall dragon
#

u know who to fire

#

super convenient!

charred blaze
#

how do i check for errors after changing something in other classes rather than clicking on each of them?

tall dragon
#

compile untill it works 😂

charred blaze
#

lol

worldly ingot
#

I avoid it but it happens sometimes KEKW

inner mulch
#

enabled or disabled?

worldly ingot
#

It is, it’s just that people tend to use more relevant or descriptive names

#

Either “elytraAllowed” or “state”

inner mulch
#

okay

river oracle
inner mulch
#

@river oracle ocp

worldly ingot
#

Honestly not a huge deal though lol. It’s a parameter name. Worst case it shows up in parameter descriptions via Javadocs or your IDE via code mining

worldly ingot
#

I disagree with ur face

inner mulch
#

choco when will the foraging update release?

slender elbow
#

wow

#

okay

worldly ingot
#

:((

#

The real way to do it

river oracle
#

I just name my variables var1 var2 var3 etc

#

It really cuts down the compile time

inner mulch
icy beacon
#

I don't name my variables because I don't have variables, they violate the idea of OCP

tall dragon
#

really helps with readability!

quaint mantle
#

whats the size of Bukkit Maps?

#

i used 128x128 but thats gives OutoufBoundsException

lost matrix
quaint mantle
#

uh

native ruin
quaint mantle
#
    at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:297) ~[?:?]
    at java.awt.image.BufferedImage.setRGB(BufferedImage.java:1016) ~[?:?]
    at io.github.unjoinable.whosthatpixelmon.MapCommand.onCommand```
#

oh 0-127

#

xD i used 1-128

#

i sometimes forget things start with 0 in this game

native ruin
#

It's everywere

quaint mantle
#

1 question

#

when u use bukkit renderer , does it execute for every player that loads the same map or is it only for 1 map

shadow owl
#

Hey guys, does anyone have tips for using GSON to serialize native Spigot objects (like Location and an ItemStack[]) to strings that can be stored in an SQL database? I currently get errors about fields that are inaccessible, like Location's world Reference (java.lang.Reference)

young knoll
#

Custom adapter

tall dragon
minor lark
#

Hello everyone, I am getting this error on plugin load:

java.lang.IllegalArgumentException: unknown world
I have a location saved in the config, the plugin loads the world referenced in the location as soon as it loads, but the error still shows up... Any idea how to fix?

lost matrix
shadow owl
tall dragon
#

for the location

shadow owl
minor lark
tall dragon
#

only converting to bukkit's object when i need it

#

meaning the worlds already going to be loaded

minor lark
#

But if that's the only way

#

rip

lost matrix
# shadow owl That'd be helpful! I just haven't created a custom type adaptor before but I can...
public class LocationAdapter implements JsonSerializer<Location>, JsonDeserializer<Location> {
  
  private final Type typeToken = new TypeToken<Map<String, Object>>(){}.getType();
  
  @Override
  public JsonElement serialize(Location src, Type typeOfSrc, JsonSerializationContext context) {
    return context.serialize(src.serialize());
  }

  @Override
  public Location deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    return Location.deserialize(context.deserialize(json, typeToken));
  }
}

You can use this adapter for any ConfigurationSerializable like ItemStacks.
It also works for Location[] or any Collection<Location> automatically.

Registering it on a Gson instance:

    Gson gson = new GsonBuilder()
        .disableHtmlEscaping()
        .registerTypeAdapter(Location.class, new LocationAdapter())
        .create();

There is another approach where you simply register a TypeHierarchyAdapter for the ConfigurationSerializeable interface, which simply
lets you auto serialize every Spigot object. But it requires reflections because your need to get the classes and then fetch a static method.

shadow owl
lost matrix
icy beacon
#

I normally write my gson deserializers fully by myself because I'm extra

shadow owl
lost matrix
#

*Would need reflections

#

I mean... you could pass a Function.
Hm, let me just write something

remote swallow
#

not all classes are public, like item stack/item meta is package private so you would need reflection to access it anyway

shadow owl
# lost matrix Nope, you dont have access to the static deserialize method that way

So an adapter like this wouldn't work?

import com.google.gson.*;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import java.lang.reflect.Type;
import java.util.Map;

public class ConfigurationSerializableAdapter implements JsonSerializer<ConfigurationSerializable>, JsonDeserializer<ConfigurationSerializable> {

    @Override
    public JsonElement serialize(ConfigurationSerializable src, Type typeOfSrc, JsonSerializationContext context) {
        // Serialize the ConfigurationSerializable object
        Map<String, Object> serialized = src.serialize();
        return context.serialize(serialized);
    }

    @Override
    public ConfigurationSerializable deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        // Deserialize the JSON element back to a ConfigurationSerializable object
        Map<String, Object> serialized = context.deserialize(json, Map.class);
        return ConfigurationSerialization.deserialize(serialized);
    }
}
lost matrix
#

ConfigurationSerialization.deserializeObject(serialized) this method doesnt exist

remote swallow
#

niether does deserialize

lost matrix
#

This is the best i could come up with, without using reflections.

public class SpigotTypeAdapter<T extends ConfigurationSerializable> implements JsonSerializer<T>, JsonDeserializer<T> {

  private final Type typeToken = new TypeToken<Map<String, Object>>() {}.getType();
  private final Function<Map<String, Object>, T> spigotProxy;

  public LocationAdapter(Function<Map<String, Object>, T> spigotProxy) {
    this.spigotProxy = spigotProxy;
  }

  @Override
  public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) {
    return context.serialize(src.serialize());
  }

  @Override
  public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    Map<String, Object> data = context.deserialize(json, typeToken);
    return spigotProxy.apply(data);
  }

}

Then register with:

    Gson gson = new GsonBuilder()
        .disableHtmlEscaping()
        .registerTypeAdapter(Location.class, new SpigotTypeAdapter<>(Location::deserialize))
        .create();
tall dragon
shadow owl
tall dragon
#

i mean yea that works

remote swallow
#

they are static methods

#

static methods dont exist on interfaces

lost matrix
lost matrix
#
    Gson gson = new GsonBuilder()
        .disableHtmlEscaping()
        .registerTypeAdapter(Location.class, new SpigotTypeAdapter<>(Location::deserialize))
        .registerTypeAdapter(ItemStack.class, new SpigotTypeAdapter<>(ItemStack::deserialize))
        .registerTypeAdapter(BoundingBox.class, new SpigotTypeAdapter<>(BoundingBox::deserialize))
        ...
        .create();

Looks fine

#

Hmm. ItemStack might need a registerTypeHierarchyAdapter because the impl is scuffed

slender elbow
#

wait until you find out none of those classes are final :^)

worldly ingot
#

Wait until you find out I extend ItemStack

slender elbow
#

Auxilor? Is that you?

young knoll
#

Just snbt it

#

:D

sterile flicker
#

why does it not work in inventoryclickevent to cancel the drop of an item from inventory java if(event.getSlot() == -999 || event.getSlot() == -1 || event.getAction().toString().contains("DROP")){ player.sendMessage(ChatColor.RED + "Cancelled!"); event.setCancelled(true); }

#

1.12.2

shadow owl
young knoll
#

Wait until you find out there are 2 ItemStacks

lost matrix
shadow owl
lost matrix
#

In short

icy beacon
#

Has anybody worked with Commons Compress? I'm trying to read the contents of files in a tar archive. But entry.getFile() (entry.file) is null so I cannot read them. What am I doing wrong?
(trigger warning: kotlin)

private fun InputStream.asPack() = TarArchiveInputStream(this).use fullUse@ { tar ->
  var entry = tar.nextEntry

  while (entry != null) {
    println("Iterating over ${entry.name}. File null? ${entry.isFile} | Directory? ${entry.isDirectory}") // for pack_metadata.json gives "File null? true | Directory? false

    if (entry.isDirectory) {
      entry = tar.nextEntry
      continue
    }

    if (!entry.name.endsWith(".json")) {
      entry = tar.nextEntry
      continue
    }

    // irrelevant logic

    entry = tar.nextEntry
    continue
}

I'd like to avoid temp files if possible too ^^

lost matrix
echo basalt
#

why do I feel like itemstack should've been an interface with a static factory method

worldly ingot
#

It should have been, yes

#

They all should have been direct proxies to NMS stacks

shadow owl
worldly ingot
#

Basically unless it's a new ItemStack(), it's a CraftItemStack

#

usually*

shadow owl
#

I assume there's a reason for the distinction?

river oracle
#

no, no there is not

#

well the reason is bad design I suppose

worldly ingot
#

One is a wrapper around an NMS item stack for more direct modification of item data, other is API

dry forum
#

is it possible to have a leash go between 2 locations

young knoll
#

Let's just uhh

#

Fix it

river oracle
#

atleast we got ItemMeta right and that's just NMS

#

that way ItemMeta can eventaully be fixed without destroying the API

young knoll
#

We just turn ItemStack into an interface

river oracle
#

Bytecode pepe_laugh

young knoll
#

And then cry because of the constructor

lost matrix
#

I used packets, which spawned invisible slimes. Then i made one the holder and the other one the leashed.

dry forum
muted dirge
#

how to set a position for EntityArmorStand?? i cant find the method

#

Spigot NMS 1.20.4 (obfuscated)

worldly ingot
worldly ingot
#

Depends on your mappings I suppose

worldly ingot
#

Yeah it should be moveTo()

#

NMS uses moveTo() anyways

#

setPos() might not send a packet to update the client. Unsure of the difference off memory

gray holly
#

Hey, is rhis message normal?
** „Reminder! All resources are the sole responsibility of individual authors and not SpigotMC. Access may be removed at any time. Please refer to the premium resource guidelines.“ **
And do i get it gernerally, or because someone took permissions to a plugin from me?

worldly ingot
#

Just a general reminder that plugins are not immutable and can be deleted from the website at any time

#

Be sure to download and keep up to date frequently if you want to continue using it

young knoll
worldly ingot
#

No :)

gray holly
worldly ingot
#

I don't believe they can

gray holly
#

Ok, because today at 10 am (mez) when i saw this in school, i was afraid, and had fear, that someone took me perms from a plugin, or thag i didnt had acces anymore to one plugin

worldly ingot
#

setPos() does not

young knoll
#

They can only remove you manually if they added you manually

#

iirc

muted dirge
#

thank you so much, i think that would work for me

#

btw getWorld is called dM right?

young knoll
#

boo obfuscated

worldly ingot
#

¯_(ツ)_/¯

young knoll
#

Use remapped :c

remote swallow
#

looks like it

worldly ingot
#

I can assure you that nobody here is going to remember obfuscated names by heart KEKW

remote swallow
#

illusion probably knows a handful

#

md probably knows them all from 2014

muted dirge
#

im a dumb fu#k

chrome beacon
#

It would be less work to use remapped

muted dirge
#

I used
new EntityArmorStand(EntityTypes.d, nmsPlayer.dM());
instead of
new EntityArmorStand(nmsPlayer.dM(), loc.getX(), loc.getY(), loc.getZ());

#

😭

#

idk

sterile flicker
#

why opening an Inventory can call InventoryCloseEvent??

rotund ravine
#

If another is open

young knoll
#

If you already have one open

sterile flicker
#

I don't have inventory open, before opening a new one

icy beacon
sterile flicker
#

[18:29:49 INFO]: Close java if (args.length == 1 && (args[0].equals("play"))) { chessInventory = new ChessInventory(SumeruChess.plugin); Board board = new Board(); player.openInventory(chessInventory.getInventory()); board.drawPieces(player, chessInventory.getInventory(), board.getBlackWhiteBoard()); ChessModel model = new ChessModel(SumeruChess.plugin, board.getBlackWhiteBoard()); Bukkit.getServer().getPluginManager().registerEvents(new ChessListener(model), SumeruChess.plugin); } ChessListener.java java @EventHandler public void onInventoryClose(InventoryCloseEvent event) { if (event.getInventory().getHolder() instanceof ChessInventory) { System.out.println("Close"); event.getHandlers().unregisterAll(this); } }

chrome beacon
#

oh no InventoryHolders

sterile flicker
#
public ChessInventory(SumeruBrain plugin) {
        inventory = plugin.getServer().createInventory(this, 54, "Chess Board");
    }```
young knoll
muted dirge
#

ok wtf

sterile flicker
muted dirge
#

why i cant find noGravity and setCustomName methods

chrome beacon
#

?

#

you mean setGravity

muted dirge
#

it was setNoGravity last time i used nms

chrome beacon
#

oh you're using nms

#

but why though

#

Those methods exist in the api

muted dirge
young knoll
#

I wish

eternal oxide
#

add a nag anytime a plugin uses one.

shadow night
eternal oxide
#

the sysout one from Paper worked

#

harassed all devs to stop using sysout.

shadow night
#

Why is it so important to not systout tho

eternal oxide
#

I agree no point in stopping using sysout

shadow night
#

That why I use errout

eternal oxide
#

Devs only did it to stop being harrassed

chrome beacon
#

Just good practice to properly identify where messages are coming from

shadow night
#

I mean

#

syserr

#

System.err.println

lost matrix
dry forum
bleak eagle
#

bump

chrome beacon
#

I believe that would reset the changes

inner mulch
#

can i force intellij to compile and to stop caring about errors?

mellow edge
#

when a player re-joins, is the new player object created or is the old one kept? if it changes I must literaly recode everything

tall dragon
#

well buckle up

#

cuz its a new one

inner mulch
#

UUID > Player reference

tall dragon
#

the old one is stale after a re join

mellow edge
tall dragon
inner mulch
tall dragon
#

pretty sure this is not an intellij thing

#

Javac simply wont allow it

#

iirc

inner mulch
#

😠

mellow edge
#

should I change everything to name strings or UUIDs

tall dragon
#

uuid's

mellow edge
#

I haven't found the solution...

chrome beacon
#

Eclipse can just replace uncompilable methods with a throw statement

#

though I recommend just fixing your code

quiet ice
#

Eclipse will replace methods with invalid code with stubs to it's best effort, so evidence of a superior IDE here

inner mulch
#

fixing it is not an option currently

tall dragon
#

which is debatable

quiet ice
#

I mean you shouldn't use eclipse to build production builds anyways

#

So this behaviour won't sneak into prod at which point it is fair game

eternal oxide
#

You shoudl be using Maven so your underlying IDE doesn;t matter

inner mulch
#

yo guys which path do i need for hibernate configs?

src/main/resources/hibernate.cfg.xml <- this one good enough?

#

or does it look for the full path?

eternal oxide
#

that path is invalid at runtime

inner mulch
#

which path then?

eternal oxide
#

it depends on how you are packaging yoru jar

#

at runtime there would be no path, all resources are copied to your jar root

inner mulch
#

ok

urban kernel
#

hey! does anyone know of a crates plugin where you have to press stop at a certan time to recieve a certan reward?

#

so it shows in a gui with a stop button. when you press it you get the focused item

#

sorry

inner mulch
#

i wasnt the guy asking the question so ping him

#

okay which is a correct statement, if u are using entities as reference have fun with your memory leaks, uuid's are better and this is not to discuss

#

yes im dumb

shadow night
#

entity references are fine in 99% of cases

icy beacon
#

plz wtf is going on

bleak eagle
#

why is PlayerTextures a feature then..? what is its exact use?

bleak eagle
icy beacon
#

OH NO

pseudo elm
#

guys one class per command or one class for every command?

young knoll
#

Yes but refrencing the entity/player prevents it from being GCed

inner mulch
eternal oxide
young knoll
#

And a entity/player not being GCed is more expensive than a UUID not being GCed

pseudo elm
inner mulch
pseudo elm
#

like one class for an /discord command

inner mulch
#

yes

#

1 class per command

pseudo elm
#

lua better

inner mulch
#

keeps it clean

pseudo elm
#

java too hard

bleak eagle
shadow night
inner mulch
#

UUID > entity reference

chrome beacon
#

WeakSet + Clean up code

pseudo elm
icy beacon
bleak eagle
#

four gigabytes of libraries for tetris

icy beacon
#

But beware because you might never return to oop again

bleak eagle
#

join java server
look inside
people complaining about java

#

oh yeah I don't disagree with that, java is horrible in quite a few aspects

inner mulch
#

generics

bleak eagle
#

already put forward my opinions about it :p

inner mulch
#

type erasure?

#

okay, still type erasure bad

#

okay nerd

#

yes but other languages have better generics

#

with no type erasure

pseudo elm
#

guys what is java good for besides finding a job and minecraft

inner mulch
bleak eagle
#

working in enterprise xD

bleak eagle
pseudo elm
#

why no game

bleak eagle
#

they're such a mess

#

after working in several languages with generics pretty heavily

#

unclear unreadable unmaintainable code

young knoll
#

I mean you can make games in java if you really want to

hushed spindle
#

java just isnt good for games, minecraft should have never been made in java

bleak eagle
#

not to say they are useless - they are useful - just badly implemented

inner mulch
#

c++ is better for this

young knoll
#

But the existing big game engines are not java based

hushed spindle
#

c# is also fine

pseudo elm
#

c++

#

who uses this

bleak eagle
#

people

young knoll
#

Ah yes java bad but C# good

inner mulch
#

every game dev?

chrome beacon
#

LibGDX uwu

pseudo elm
#

like c

young knoll
#

Even though they are both JIT

chrome beacon
#

C# is pain

bleak eagle
hushed spindle
#

java not bad at all, just different purpose

bleak eagle
#

too bad nerd

chrome beacon
pseudo elm
#

c++ is language is older then all of us together#

inner mulch
bleak eagle
#

isn't maturity desireable?

pseudo elm
#

isnt C faster

hushed spindle
#

isnt python older than java lol

pseudo elm
#

i need some new shit

chrome beacon
pseudo elm
#

im young and hungry

bleak eagle
#

thank god c exists to save the day

chrome beacon
#

a whole ms for hello world 👀

bleak eagle
#

writing c because it's "fast" is dumb - c should be written for other reasons

#

mainly simplicity and compatibility with running on bare metal very easily

chrome beacon
hushed spindle
#

you're probably not gonna be making games where the language difference matters

#

in terms of performance

ivory sleet
#

?kick @quaint mantle toxic attitude

hushed spindle
#

does it have sex

undone axleBOT
#

Done. That felt good.

pseudo elm
hushed spindle
#

gross thats sinful

ivory sleet
#

???

hushed spindle
#

not interested

bleak eagle
chrome beacon
#

smh not an AAAA game

bleak eagle
ivory sleet
#

You can’t walk around here calling people “dumb fucks”, end of story

pseudo elm
#

i programm in machine code to get more fast

chrome beacon
hushed spindle
#

gotta squeeze every last bit out of your memory

bleak eagle
#

go is for real men, others are for nerds

#

stop being a jerk please

#

go is flawless

hushed spindle
#

i dunno i think mindfuck is a good language

#

or was it brainfuck

#

forgor

#

actually you should make your games in HolyC

bleak eagle
#

writes in c-sharp for years
uses go for apporximately two minutes
"i switched back to c# from go :("

bleak eagle
ivory sleet
#

Goroutines?

pseudo elm
#

who is this md_5

bleak eagle
#

i'm ya go guy

ivory sleet
#

Or what u now call them 😅

eternal night
#

golang my beloved

bleak eagle
young knoll
slender elbow
#

md4 💪

pseudo elm
#

is he rich

bleak eagle
#

no not really

young knoll
#

He lives in Australia

pseudo elm
#

wow xd

bleak eagle
#

he's australian though schnitzel

young knoll
#

so no

#

Anyone who is rich would not stay in Australia

#

Come at me Australians

pseudo elm
#

imagine spending your life on this and then some stupid people come and make a better version of the thing you did

bleak eagle
#

hm?

pseudo elm
#

paper

young knoll
#

Okay but

#

That's a fork

bleak eagle
#

if getting lost in a thousand patches each conflicting another is better than see yourself out to the paper server sir

young knoll
#

All of the work on spigot was required for paper to be born

bleak eagle
#

ntm it's a fork as coll said

hushed spindle
#

"whats a fork"

young knoll
#

And all of the work on bukkit/craftbukkit was required for spigot to be born

hushed spindle
#

cant we just use a spoon or what

young knoll
#

spork

pseudo elm
#

imagine you open a company build it and then someone else makes it better

bleak eagle
#

spork

eternal night
#

real g's know, all of this is based on mojangs amazing work

#

glowstone represent 💪

young knoll
#

Lynx if you mention the hardfork I will hard fork you 🍴 😡

bleak eagle
#

250 ide warnings in a single vanilla nms class 💪

eternal night
#

softspoon*

hushed spindle
#

comicallysmallknife

young knoll
#

tbf the non-decompiled NMS code is probably a bit less trash

eternal oxide
#

spork

bleak eagle
#

doesn't warrant it being total crap at points

slender elbow
#

birthday party plastic cutlery

young knoll
#

I mean I assume the actual Mojang devs aren't sitting there with 6000 ide warnings like

bleak eagle
#

you sure

#

xD

hushed spindle
#

they're using notepad++ to code didnt you know

eternal oxide
#

a little config setting adjustment and ALL those warnings go away 🙂

pseudo elm
#

guys how do i know when to create a new class for something

bleak eagle
remote swallow
inner mulch
#

?paste

undone axleBOT
hushed spindle
bleak eagle
#

yerp

#

classes are for nerdz

remote swallow
bleak eagle
#

files just got added to computers 2.1, they're pretty cool, should check them out

hushed spindle
#

they're like a thing you do in what they call "school" but idk i never been

young knoll
#

okay but what about files 2

hushed spindle
#

netflix wont fund a files season 2

#

doesnt have enough "pdf files" or whatever they called

#

pdfs arent even that good

frank kettle
#

My plugin creates custom worlds but when the server restarts they are unloaded. and if a player disconnects and logs in after a restart, they will be placed on the default world because the world they disconnected on is unloaded.

I've made all the code to load the world when you teleport to it and such and I know MultiverseCore loads every world on server start but I don't want to load every world right away, only if needed.

I tried loading the world on PlayerJoinEvent but I still get teleported to the default "world" world, where should I load the worlds instead or should I load all of them on server start? I'm afraid this might cause unnecessary lag to the server.

young knoll
#

You'd have to load them before the join event

frank kettle
#

PreLoginEvent is deprecated

remote swallow
#

async pre join event

young knoll
#

Maybe start the loading in AsyncPlayerPreLogin and block until it's done

#

You can block that event for up to 30 seconds before the client gives up

hushed spindle
#

i would assume world loading isnt fast enough to be doable on a playerjoinevent, you could teleport em to that world when its loaded or alternatively keep track of all the custom worlds players are in and only load those worlds

#

or asyncpreloginevent sounds good

frank kettle
#

ok i will try asyncpreloginevent

#

ty guys, i shall be back if i need more assistance

#

🫡

inner mulch
frank kettle
#

It seems the player location on AsyncPlayerPreLoginEvent does not save the world(It's saved as null so I can't use it to find which world to load), i will need to setup a local yml file most likely with which world each player disconnected on and then know which world it is to load on PreLogin 🤔

young knoll
#

There is no player location in that event

#

use the UUID with getOfflinePlayer and get the last location of said OfflinePlayer

frank kettle
#

and then checked the location of the offlineplayer

#

yes, its what i did

frank kettle
# young knoll use the UUID with getOfflinePlayer and get the last location of said OfflinePlay...
@EventHandler
    public void onPreLogin(AsyncPlayerPreLoginEvent event) {
        OfflinePlayer player = Bukkit.getOfflinePlayer(event.getUniqueId());
        PlebUniverse.getInstance().getLogger().info("Player: " + player.getName() + ", location: " + player.getLocation().toString());
    }```

Logs:
`Player: Miau_, location: Location{world=null,x=1.7512713417714039,y=77.0,z=-4.453081250598158,pitch=21.70218,yaw=-145.50967}`
inner mulch
young knoll
#

Well if the world isn't loaded yeah, it's gonna be null

#

Idk if you can get the raw name/uuid of it instead

sterile flicker
#

what should I do if inventoryclickevent cancels the event of dragging an item, but not cancel using buttons such as 1,2,3,4 on the keyboard that also move the item?

lost matrix
sterile flicker
lost matrix
sterile flicker
#

event.getClick().isKeyboardClick()?

#

how do I cancel taking items in a stack?

tawdry echo
#

I have added local .jar as dependency and can I find usages of method from lib class inside lib?

#

Now when I use find usages its only show me inside my code

#

I need to find usages inside lib

chrome beacon
#

Yeah it won't index for those usages

#

Try looking for the source of the plugin

#

if it's not available decompile it and then search

digital pawn
#

on paper theres a PlayerShieldDisableEvent, is there a equivalent in spigot, or what would be the best event, for my plan?: I want to play a own sound if I disable a shield with a axe-hit. also I want to detect a hit on a shield with an item, which do not disable the shield.

eternal night
#

i think alex has a lib that computes that?

#

wait no

#

das armor equip event

digital pawn
#

huh?

#

would have thinked of the EntityDamageByEntityEvent

eternal night
#

I mean, yea you can I guess

#

iirc you can get the players item

#

that it is using

#

getActiveItem

prime sonnet
#

Hi, I need PacketPlayOutEntity class but I use spigot mapoings and this class is not there, adding cradtbukkit.jar as a library I have access to this class, but when building maven it throws the error "cannot find symbol"

digital pawn
# eternal night that it is using

just got that, that looks fine?

    public void onEntityDamage(EntityDamageByEntityEvent event) {
        if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player)) return;

        Player target = (Player) event.getEntity();
        Player attacker = (Player) event.getDamager();

        if (target.isBlocking()) {
            if (isAxe(attacker.getInventory().getItemInMainHand().getType()) || isAxe(attacker.getInventory().getItemInOffHand().getType())) {
                attacker.playSound(attacker.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
            }
        } else {
            if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) {
                attacker.playSound(attacker.getLocation(), Sound.BLOCK_WOOD_HIT, 1, 1);
            }
        }
    }

    private boolean isAxe(Material material) {
        return material == Material.WOODEN_AXE ||
            material == Material.STONE_AXE ||
            material == Material.IRON_AXE ||
            material == Material.GOLDEN_AXE ||
            material == Material.DIAMOND_AXE;
    }
}
eternal night
#

probably? xD I mean just test it

quaint mantle
#

Hi

#

Does anyone know minemen?

slender elbow
#

map men

icy beacon
undone axleBOT
#

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

quaint mantle
#

Yeah alright

#

I just wanted to replicate the physics of the fireballs like in this video

icy beacon
#

I believe all you would need to do is detect when a player rmbs with a fireball, launch it as a projectile and the velocity should take care of itself because it's just an explosion

rough ibex
#

yep

remote swallow
#

?services

undone axleBOT
lost matrix
#

Please dont mass ping, and dont advertise or look for developers on the discord.
The spigot forum has a "hiring" section.

stark moss
#

Hi. Im having this error where when I send "/pauseclock", "/resumeclock" and "/final" nothing happens. The console has no errors when I issue it.
I'm also having another error where after the first is created, any more clocks will automatically result in "End of Quarter" and the progress refuses to go down. This even happens if the clock has ended/I rejoin and it doesn't work anymore.

Here is the script:
https://paste.md-5.net/nucodabamo.java

#

All commands are registered in the Main and in my plugin.yml

sterile token
#

Any idea of what can be happening?

public static void main(String[] args) {
  File path = new File(System.getProperty("user.dir"));
  JsonHandler config = new JsonHandler("test.json", path);
  config.set("test.1", "test");
  config.set("test.2", "test");

  System.out.println("keys=" + config.getKeys());
  System.out.println("keys=" + config.getKeys(true));

}```

Results

keys=[]
keys=[]
#

?paste

undone axleBOT
sterile token
#

Im rechecking them but im not really sure, whats happening tho

tardy delta
#

wouldnt make it more sense to swap those two params of jsonhandler

sterile token
#

but so far im re checking to see what can be happening

tardy delta
#

we need a bit more than that mate

sterile token
#

What do specific need by "more"

#

more code right?

tardy delta
#

getkeys

sterile token
#

isnt is in the same file? Maybe i confused the files

#

for now i didnt implement the file loading / saving, just doing it by memory to test

#

But i still cant find what happening i will start debugging line by line

stark moss
#

Hi. Im having this error where when I

prisma shadow
#

What plug-in is used to create rank keys?

#

and crate keys / crate

#

Tryna find a good one

tall dragon
#

theres loads

#

CrazyCrates was always my go to. but its been a hot minute

prisma shadow
tall dragon
prisma shadow
#

is that wat it is

tall dragon
#

well just search spigot for "Voucher Plugin"

#

loads of those as well

prisma shadow
#

u know that

#

one

#

or naw

tall dragon
inner mulch
#

?paste

undone axleBOT
inner mulch
tall dragon
#

do u have the shade plugin?

inner mulch
#

yes

tall dragon
#

is the class in ur .jar?

#

can check with somethn like winrar

inner mulch
#

i dont have winrra

tall dragon
#

well get it

#

or anything else to look into .jar files

inner mulch
#

ok

rough ibex
#

7zip

#

7zip does rar

slender elbow
#

jar --list -f file.jar 💪

rough ibex
#

disclaimer: only for zip

tardy delta
#

hmm javas char endianness is platform dependent right?

#

like the classfile spec says be, but the lang types are platform dependent

rough ibex
#

I'm fairly sure it's gauranteed to be big

slender elbow
#

the jvm operates in big endian, yes

rough ibex
#

IMO char is fairly dumb

tardy delta
#

?

slender elbow
#

it's just an int in disguise

tardy delta
#

its 16 bit utf16

quaint mantle
#

I thought a char was a byte

tardy delta
#

all numeric types are one or two ints in disguise

young knoll
#

char is an unsigned 16 bit value iirc

rough ibex
quaint mantle
#

oh damn

#

its 2 bytes

rough ibex
#

char can't store every single character

quaint mantle
#

never knew that

rough ibex
#

for example anything above 0xFFFF

#

requires a surrogate pair for UTF-16

young knoll
#

Which is sadge

rough ibex
#

which is then 4 bytes

#

0xD8 0x3E 0xDE 0xE5 for u1fae5

tardy delta
#

?services

undone axleBOT
inner mulch
tardy delta
#

what

inner mulch
#

yeah what?

rough ibex
#

thats not really services

sterile token
#

i need the one you consume looks really powerfull 😂

slender elbow
#

god forbid someone uses #bot-commands 🙏

inner mulch
#

im having issues setting up hibernate, all the tutorials are outdated, does somebody know which dependencies i need and to get a sessionfactory?

inner mulch
chrome beacon
#

Did you provide it at runtime

inner mulch
#

is the scope of core runtime?

chrome beacon
#

you need to shade it in to your plugin or use the library loader

inner mulch
#

i shaded it into my plugin its like 30mbs now

#

it has to be there

chrome beacon
#

and which class is missing

inner mulch
#

Caused by: java.lang.ClassNotFoundException: org.glassfish.jaxb.runtime.v2.ContextFactory

#

Caused by: jakarta.xml.bind.JAXBException: Implementation of Jakarta XML Binding-API has not been found on module path or classpath.

#

these two

tardy delta
#

💀

inner mulch
#

bro its shaded into it idk what these errors mean my plugin isnt usually 30mb

chrome beacon
#

Could you send your pom

inner mulch
#

yes

#

?paste

undone axleBOT
inner mulch
#

i alr tried fixxing it and added dependencies that stackoverflow told me

chrome beacon
#

ah looks like jaxb was provided by the jdk

#

but it's not anymore

inner mulch
#

didnt i add it already?

#

or are these the wrong ones

chrome beacon
inner mulch
inner mulch
#

?paste

undone axleBOT
inner mulch
#

these are all the errors i get

chrome beacon
#

Try adding:

requires java.xml.bind;
requires com.sun.xml.bind;

to a module-info.java file

#

if it doesn't help try setting up a minimal project that recreates the issue

#

and send it so I can play around with your setup

slender elbow
#

yeah that won't help

#

I see service loader in the stack trace, you'd have to set the thread's context classloader to the plugin one

chrome beacon
#

Emily to the rescue 🎉

rough ibex
#

magic runes

slender elbow
#

wherever you initialize hibernate

ClassLoader old = Thread.curentThread().getContextClassLoader()
Thread.curentThread().setContextClassLoader(plugin.getClassLoader())
// .. initialize hibernate
Thread.curentThread().setContextClassLoader(old)

#

whether that be in onEnable or wherever

inner mulch
#

okay, plugin has to be hibernate in this case?

slender elbow
#

uh yeah, whatever thing is shipping hibernate

#

alternatively, hibernate might have a way to configure the classloader it uses

#

but idk about that

inner mulch
slender elbow
#

then just do getClass().getClassLoader

inner mulch
slender elbow
#

well, if it isn't a plugin it doesn't have an onEnable

#

that's just a way to access the current classloader

#

you'd do that in that separate module

inner mulch
#

i accessed the class loader and now i have an even bigger error

#

it seemed to do something

#

?paste

undone axleBOT
inner mulch
#

do you know what this is all about?

slender elbow
#

no clue, but it seems it isn't finding some class

#

never used hibernate so idk what the specifics of that one are

chrome beacon
#

It's trying to use the hibernate reactive api

#

It's a separate dependency and you've probably told it to use it somewhere

inner mulch
#

why does core do that :(

#

i guess i gotta find this reactive dependency

acoustic pendant
#

Hey, quick question, why does 1 and 2 trigger if in the config I only have "Place"??

chrome beacon
#

Have you tried printing the values (of getString) rather than 1 and 2

rough ibex
#

is there a default value set

#

"If the String does not exist but a default value has been specified, this will return the default value."

inner mulch
#

thanks @slender elbow and @chrome beacon i managed to get it to work with your help. :)

rough ibex
#

check docs yep

acoustic pendant
#

Is there a way to solve that without removing the default value?

harsh ginkgo
#

hey, I have a server that needs to reset the map every restart, I did this in a simple way by disabling auto save. However, it causes a memory leak and crash, which is honestly predictable. Is there any alternative I can do? Even better if the chunks are reset after unloading them.

lost matrix
#

How can there be a memory leak if you restart the application?

chrome beacon
#

and crash?

#

How exactly are you restarting

#

if you're using the spigot restart method then make sure to delay the startup a bit in your script so the server has time to stop

wintry lynx
#

Anyone know a good way to get the color of leather Horse Armor? I looked at the Docs and they arent super useful. 90% of the stuff works only for wool. :/

lost matrix
wintry lynx
#

I did too but all it returns is "Cannot be cast"

young knoll
#

It does yes

lost matrix
#

Show your code

#

Casting ItemStack to meta prediction

wintry lynx
wintry lynx
#

Kinda

lost matrix
# wintry lynx

Please refrain from using single letter variables. Having descriptive names for your variables and methods is essential for clean code.
I would also reuse your variables instead of calling get-chains every second line.
It will make your code look much cleaner.

wintry lynx
rough ibex
#

p tells the user nothing

young knoll
#

Player

#

Or maybe piglin

#

Oh porkchop

rough ibex
#

decorated pot

worldly ingot
# wintry lynx

Depending on where that snippet is running, you're probably just casting the meta of all items to LeatherArmorMeta

lost matrix
#

perpetual torment

young knoll
#

Pepsi

rough ibex
#

pepsi makes me sick unironically

#

I can only have diet pepsi

#

and I'm not diabetic

worldly ingot
#

As an aside, call getItemMeta() once and hold it in a variable. It clones the ItemMeta each time you invoke it so invoking it twice just creates an unnecessary copy

#

It's also nullable for air, but if you're instanceof checking it to LeatherArmorMeta that's already covered

young knoll
#

Interesting getting uuid through the player profile

quaint mantle
river oracle
#

@young knoll MD being in the reviewers section of your ItemType/BlockType PR made my heart jump

#

maybe maybe maybe

upper hazel
#

What package is sent when an object is enchanted in animation to the owner of the object?

agile anvil
#

I think the item is just replaced

sterile flicker
#

https://imgur.com/a/UlBoZp5 I'm making chess in minecraft, I've combined two inventories and I want to find out if it's possible to use a resource pack to remove that field named "Inventory" that separates the two inventories

rough ibex
#

Yes, with a language

#

or maybe core shaders

sterile flicker
rough ibex
#

You set the key for it to ""

sterile flicker
#

this inventory

rough ibex
#

no

#

Cant be that hard to find...

sterile flicker
#

or key.categories.inventory=Inventory

agile anvil
#

You should try both

#

But the problem with that is that you may remove the "Inventory" from every other inventory

#

One way could be to rename your chess inventory with a special character of which you assign a texture of a whole inventory, and maybe that can override the "Inventory" in the middle

sterile flicker
#
container.inventory=```
#

this is how to write in a .lang file?

#

or set to ""

white root
sterile flicker
sterile flicker
#

suppose I add unicode at the beginning of inventory description \u2661Ches Board

#

what's next?

agile anvil
#

I'm not an expert on resource pack

agile anvil
#

You might not need the negative characters

sterile flicker
agile anvil
#

Ah never mind 1.12.2 won't work

#

You can't do that

sterile flicker
#

the texture will be very large and will cover the entire inventory

agile anvil
#

As I remember you can't do that before 1.13 or so

#

The itemtexture would match the size of a slot

#

But I'm no expert, maybe you can try

smoky anchor
#

I belive you can, lemme search a video real quick

agile anvil
#

Indeed

smoky anchor
#

It is not exactly a tutorial, but there is a template resourcepack included in the description

hybrid turret
#

I want to store Locations in an sqlite db. So I store the name of the location, x,y,z,yaw and pitch. Would it be better to have an auto incrementing primary key and check for the name every time or just use the name as a primary key? The names are supposed to be unique but ofc the players could try to create a warp twice

drowsy helm
#

lookup time would be near identical, doesnt really matter

#

atleast with the name as primary key you can't have copies but otherwise not much benefit

edgy crystal
#

Hi guys, my Server crashes when i remove an Item in here:

                ItemStack itemStack = event.getItem().clone();
                itemStack.setAmount(1);
                if (player.getInventory().containsAtLeast(itemStack, 1)) {
                    player.getInventory().removeItem(itemStack);
                    Rubbellose rubbellose = new Rubbellose(Main.getInstance().playerManager);
                    rubbellose.startGame(player);
                } else {
                    player.sendMessage(Main.error + "Du hast keinen Rubbellos im Inventar!");
                }
            } else if (event.getItem().getItemMeta().getDisplayName().contains("XP-Case")) {
                ItemStack itemStack = event.getItem().clone();
                itemStack.setAmount(1);
                if (player.getInventory().containsAtLeast(itemStack, 1)) {
                    player.getInventory().removeItem(itemStack);
                } else {
                    player.sendMessage(Main.error + "Du hast keinen XP-Case im Inventar!");
                }
            } else if (event.getItem().getItemMeta().getDisplayName().equals("§6§lCase")) {
                ItemStack itemStack = event.getItem().clone();
                itemStack.setAmount(1);
                if (player.getInventory().containsAtLeast(itemStack, 1)) {
                    player.getInventory().removeItem(itemStack);
                    new Case(player);
                } else {
                    player.sendMessage(Main.error + "Du hast keinen Case im Inventar!");
                }```

if i just do "new Case(player)", the case opens, everything is working. but if i remove it, the server crashes?
quaint mantle
drowsy helm
#

do you get an error message?

edgy crystal
drowsy helm
edgy crystal
# drowsy helm do you get an error message?

getting an crash report:

// Shall we play a game?

Time: 12.03.24, 10:40
Description: Exception in server tick loop

java.lang.AssertionError: TRAP
    at net.minecraft.server.v1_16_R3.ItemStack.checkEmpty(ItemStack.java:153)
    at net.minecraft.server.v1_16_R3.ItemStack.setCount(ItemStack.java:944)
    at net.minecraft.server.v1_16_R3.PlayerInteractManager.a(PlayerInteractManager.java:439)
    at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1573)
    at net.minecraft.server.v1_16_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:32)
    at net.minecraft.server.v1_16_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1)
    at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:28)
    at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18)
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(SourceFile:144)
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(SourceFile:118)
    at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1061)
    at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1054)
    at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(SourceFile:127)
    at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1038)
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:970)
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273)
    at java.base/java.lang.Thread.run(Thread.java:829)
echo basalt
#

oh cool the trap exception

edgy crystal
echo basalt
#

been a while since I've seen it

edgy crystal
#

but the item is removed in the end

drowsy helm
#
                itemStack.setAmount(1);
                if (player.getInventory().containsAtLeast(itemStack, 1)) {
                    player.getInventory().removeItem(itemStack);``` bit of a conflict of interest
#

you're setting count then removing the item in the same tick, should do one or the other

edgy crystal
#

it was like that before:

                itemStack.setAmount(1);
                player.getInventory().removeItem(itemStack);
drowsy helm
#

why?

#

that doesnt really make sense whats the goal

edgy crystal
#

it only should remove 1 item

#

not the whole stack

drowsy helm
#

not how that works

#

you have to set the stack size

edgy crystal
#

ah, does it automatically remove the item if stack size = 0 ?

#

than i could do this:
itemStack.setAmount(itemStack.getAmount() - 1);

drowsy helm
#

no, itll look for an item stack in inventory that is 1 stack size

#

it doesnt remove just 1

#

yeah that should work

edgy crystal
#

ah nice, now it works - thanks @drowsy helm

quaint mantle
#

now trying to set block using NMS, but I got this error
IllegalArgumentException: Cannot get ID of Modern Material

    public void setBlock(@NotNull Location location,
                         @NotNull Material material) {
        val world = location.getWorld();

        val x = location.getBlockX();
        val y = location.getBlockY();
        val z = location.getBlockZ();

        if (y < 0 || y > 512) return;

        val worldServer = ((CraftWorld) world).getHandle();
        val chunk = worldServer.getChunkIfLoaded(x >> 4, z >> 4);
        val chunkSection = chunk.getSections()[y >> 4];

        val blockState = Block.stateById(material.getId());
        chunkSection.setBlockState(x & 0xf, y & 0xf, z & 0xf, blockState);
    }```
echo basalt
#

val yikes

#

pretty sure you gotta createBlockData and get an nms version of that

#

I have something somewhere

#

Yeah

quaint mantle
#

BlockData is a Bukkit class

echo basalt
#

val blockState = ((CraftBlockData) material.createBlockData()).getState();

quaint mantle
#

okay

#

thanks

edgy crystal
echo basalt
#

good ol' 1.16

quaint mantle
#
    public void setBlock(@NotNull Location location,
                         @NotNull Material material) {
        val world = location.getWorld();

        val x = location.getBlockX();
        val y = location.getBlockY();
        val z = location.getBlockZ();

        if (y < 0 || y > 512) return;

        val worldServer = ((CraftWorld) world).getHandle();
        val chunk = worldServer.getChunkIfLoaded(x >> 4, z >> 4);
        val chunkSection = chunk.getSections()[y >> 4];

        val blockState = ((CraftBlockData) material.createBlockData()).getState();
        chunkSection.setBlockState(x & 0xf, y & 0xf, z & 0xf, blockState);
    }```
echo basalt
#

what if you relog

quaint mantle
#

still the same

#

does your code work?

echo basalt
#

Print out blockstate

#

if it prints something other than air it works

quaint mantle
echo basalt
#

Then yeah it works

inner mulch
#

does someone know if hibernate operations are async or do i need to use completablefuture and stuff?

quaint mantle
#

so why am I not seeing it?

edgy crystal
echo basalt
quaint mantle
echo basalt
#

I don't have anything to set blocks fast :)

#

last time I messed with blocks in nms it was uh

#

either client-sided blocks or hacky craftblock impls

upper hazel
#

as they usually call a class that belongs to a specific group of objects and loads them from the config

sterile flicker
#
{
  "textures": {
    "texture": "guis/board_center"
  },
  "elements": [
    {
      "from": [ -16, -16, 15.9375 ],
      "to": [ 32, 32, 16 ],
      "faces": {
        "north": { "uv": [ 11, 16, 0, 5 ], "rotation": 180, "texture": "#texture" },
        "south": { "uv": [ 0, 5, 11, 16 ], "texture": "#texture" }
      }
    }
  ],
  "display": {
    "firstperson_lefthand": {
      "rotation": [ 0, 0, 0 ],
      "translation": [ 0, 0, 0 ],
      "scale": [ 0, 0, 0 ]
    },
    "gui": {
      "rotation": [ 0, 0, 0 ],
      "translation": [ 72, -74, -80 ],
      "scale": [ 3.66, 3.66, 3.66 ]
    }
  }
}
[14:01:08] [Client thread/ERROR]: Unable to parse metadata from minecraft:textures/guis/board_center.png
java.lang.RuntimeException: broken aspect ratio and not an animation
    at cdq.a(SourceFile:213) ~[1.12.2.jar:?]
    at cdp.b(SourceFile:101) [1.12.2.jar:?]
    at cdp.a(SourceFile:76) [1.12.2.jar:?]
    at cgb.n(SourceFile:763) [1.12.2.jar:?]
    at cgb.a(SourceFile:188) [1.12.2.jar:?]
    at cgc.a(SourceFile:23) [1.12.2.jar:?]
    at cev.c(SourceFile:105) [1.12.2.jar:?]
    at cev.a(SourceFile:93) [1.12.2.jar:?]
    at bib.f(SourceFile:761) [1.12.2.jar:?]
    at bib$7.run(SourceFile:2601) [1.12.2.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
    at h.a(SourceFile:46) [1.12.2.jar:?]
    at bib.az(SourceFile:991) [1.12.2.jar:?]
    at bib.a(SourceFile:419) [1.12.2.jar:?]
    at net.minecraft.client.main.Main.main(SourceFile:123) [1.12.2.jar:?]``` texture - https://imgur.com/a/lFy30Ss
#

I made a board based on the parts of the images

#

but how do I get the ratio right for the texture

#

I only have the top and bottom of the board displayed correctly

echo basalt
#

try making it a 1:1 ratio

sterile flicker
#

256x256?

slender elbow
#

sure

quaint mantle
echo basalt
#

yikes updating individual blocks

quaint mantle
#

280M blocks/s

#

tested it

echo basalt
#

I mean the block update packet

#

there are packets to update entire chunks

tardy delta
#

val in java?

quaint mantle
#

yeah, basically you have to cache the blocks and update it

quaint mantle
echo basalt
#

chunk update / multi block

tardy delta
#

since when can lombok introduce new keywords, compiler plugin?

dry hazel
#

compiler hack

tardy delta
#

and what does it expand into?

echo basalt
#

var has been a thing since java 12 iirc

tardy delta
#

im talking about val

quaint mantle
#

val is something like var

tardy delta
#

probably final var then

quaint mantle
#

but is that okay for a single block though

echo basalt
#

it works

lost matrix
#

Maybe add a multiblock change method which lets you change multiple blocks and sends the chunk update packets

young knoll
#

Cries in api

echo basalt
#

maybe we could make a full multi block change api

#

and maybe add support for fake blocks

young knoll
#

I mean there is a multi block change api

echo basalt
#

there is api that wraps the multi block change packet

lost matrix
echo basalt
#

but no proper 5 trillion blocks per second api

echo basalt
sterile flicker
#

if a player has taken an item from the inventory to the cursor, then inventoryclickitem should be called and inside I can get this item player.getItemOnCursor() or event.getCursor right?

smoky anchor
#

?tryandsee

undone axleBOT
sterile flicker
#

already

slender elbow
#

pretty sure it's gonna be the event's current item

#

it's before it's put to the cursor

lost matrix
#

^

slender elbow
#

(or, if putting an item in an inventory, it'll be the other way around)

sterile flicker
#

how do I accurately determine when a player takes something into the cursor?

lost matrix
#

InventoryClickEvent

sterile flicker
#
private boolean isWhitePiece(ItemStack item) {
        return item != null &&
                item.getType() != Material.AIR &&
                (Objects.equals(item.getItemMeta().getDisplayName(), "White pawn") ||
                        Objects.equals(item.getItemMeta().getDisplayName(), "White rook") ||
                        Objects.equals(item.getItemMeta().getDisplayName(), "White queen") ||
                        Objects.equals(item.getItemMeta().getDisplayName(), "White king") ||
                        Objects.equals(item.getItemMeta().getDisplayName(), "White bishop") ||
                        Objects.equals(item.getItemMeta().getDisplayName(), "White knight"));
    }
@EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (!(event.getInventory().getHolder() instanceof ChessInventory) && !event.getInventory().getType().equals(InventoryType.PLAYER)) {
            return;
        }

        Player player = (Player) event.getWhoClicked();

        if (event.getClick().isKeyboardClick()) {
            player.sendMessage(ChatColor.RED + "Недопустимый ход!");
            event.setCancelled(true);
            return;
        }
        ItemStack currentItem = event.getCurrentItem();
        ItemStack cursorItem = event.getCursor();
            if (!isValidMove(event, currentItem, cursorItem)) {
                player.sendMessage(ChatColor.RED + "Invalid Move");
                event.setCancelled(true);
                return;
            }
            if (player.getItemOnCursor() != null && !isWhitePiece(player.getItemOnCursor())) {
                player.setItemOnCursor(null);
            }
            if (event.getClick().isLeftClick()) {
                handleLeftClick(event, player);
            }
    }
``` everything works except for this``` if (player.getItemOnCursor() != null && !isWhitePiece(player.getItemOnCursor())) {
                player.setItemOnCursor(null);
            }```
#

when I capture a pawn named "Black pawn"

shadow night
#

Please don't compare items by name

sterile flicker
#

1.12.2 pdc?

#

there is no

lost matrix
#

You should create a layer on top of this.
Create a ChessBoard and an abstract ChessFigure, a ChessRuleset etc.
It will help you a great deal.

shadow night
#

Yep

#

And if you have a chess board class, you might be able to use it to not compare stuff by name

sterile flicker
lost matrix
sterile flicker
#

what's wrong with comparing by name, i can't select an item in the inventory that is not a figure, and absolutely all pieces have a displayName

rough drift
sterile flicker
rough drift
#

there is nothing stopping that

sterile flicker
rough drift
sterile flicker
#

inventory clears at game start

lost matrix
#

Anyways. You should link this inventory to a custom ChessBoard class. And then create an instance of ChessPiece for every ItemStack on the field.
ChessPiece should be abstract so you can create all the other classes like Pawn, Queen etc. You should also give them a color this way.
Then do your entire logic with Board positions, ChessPieces and a fixed set of rules for the chessboard.

The spigot logic should be linked to this in a way that lets you write it once and never touch it again.

rough drift
sterile flicker
rough drift
lost matrix
# sterile flicker Thanks for the tips

PS: writing a proper chess ruleset is actually quite tricky. I would honestly just shade a chess library and simply link a board state to your spigot inventory.

sterile flicker
rough drift
#

WE MAKING IT OUT OF THE POSITIVE TPS WITH THIS ONE 🔥 🗣️ 🔥 🔥 🗣️ 🔥 🗣️

sterile flicker
rough drift
#

it was a joke

young knoll
#

/tick freeze

#

Beat that

blazing ocean
#

hey, i'm trying to create a splash potion with an effect, i'm trying this:

            private val healthPotion = ItemStack(Material.SPLASH_POTION, 1).apply {
                val meta = itemMeta
                if (meta is PotionMeta) {
                    meta.apply {
                        basePotionType = PotionType.INSTANT_HEAL
                        customEffects.add(PotionEffect(PotionEffectType.HEAL, 1, 2))
                    }
                }
            }

and this just gives me these:

rough drift
#

you need to set the item meta after editing it

blazing ocean
#

thats what meta.apply does

rough drift
#

does it?

chrome beacon
#

cursed kotlin

rough drift
#

^

blazing ocean
#

💀

rough drift
#

yeah

#

you should like

#

set it.

#

itemMeta = meta.apply

blazing ocean
#

wait does it not do that automatically

slender elbow
#

no?

#

kotlin doesn't know how to do that

blazing ocean
#

oh 💀

#

i guess im dumb then

slender elbow
#

apply is just something that's called "scope function"

#

nothing to do with spigot

bleak eagle
#

any easy way to upload resources to textures.minecraft.net (programmatically) apart from skin uploads ..? I swear there was some weird thing with education edition a while ago.. might be a dumb question though

echo basalt
#

mineskin has an api iirc

young knoll
#

hdb makes you do it manually

#

First you have to create a Minecraft Skin. Focusing on the head portion of the skin.

You can design a completely new skin, or you can use an existing head as a base. You can download an existing head's skin file by going to the head page and selecting Download at the bottom.

To create skin designs, some people use programs like paint.net, Photoshop, and MCSkin 3D. You can also use free skin editors from sites like PlanetMinecraft, NovaSkin and The Skindex.

When your skin is finished, upload the skin to your Java Minecraft account, and generate a give code using our Head Command Generator.

Once you have created the give code, you can change back your skin without it affecting the newly generated head.

bleak eagle
#

ooooh okay

#

so skin changes is the way tldr

young knoll
#

Either that or you use mineskin

bleak eagle
#

it looks awesome but how do they do it

#

just a few accounts and then api requests to mojang to change their skins and get the texture value back?

#

since old textures stay after skin changes iirc

#

yeah they do, it's at the bottom of the page

#

there has to be a more convenient way ugh

proud badge
#

if I want to save the items of an inventory (like a player vault) is it best to just save an array of ItemStack

#

instead of Inventory

inner mulch
#

but I'd just save an array of items

#

as this is the thing you want to store

umbral ridge
#

does ThreadLocalRandom only need to be initialized once? or is ThreadLocalRandom#current() always different and I have to reinitialize it each time I generate a new number?

proud badge
#

ok so I should just do private List<ItemStack[]> vaults; (list cause there are multiple vaults)

mighty gazelle
#

How to set this?

Example: (Please see it not for a AD)

hazy parrot
#

How do you reinitialize it

umbral ridge
#

ThreadLocalRandom.current() returns ThreadLocalRandom

#

since It's a static method It's kind of confusing

inner mulch
#

is PlayerSwapHandsItemEvent in an inventory called, if so seperately of a the clickevent?

rough drift
#

it doesn't create a new one @umbral ridge

umbral ridge
rough drift
#

it's a single instance, you can also set it by Thread.currentThread().setRandom() iirc

mighty gazelle
#
@EventHandler
    public void setMotd(ServerListPingEvent e) {
        e.setMaxPlayers(/*And here a STRING-Message*/);
    }

How to set this?

Example: (Please see it not for a AD)

echo basalt
#

you need to return an invalid version

rough drift
#

also stop spamming

echo basalt
#

and set the invalid version text

#

p sure the event doesnt allow for that

#

also stop spamming

rough drift
#

^

echo basalt
#

and follow good habits (check pins)

inner mulch
rough drift
#

me naming it ev or the full event name

echo basalt
#

bad

#

blocked

bleak eagle
#

bukkitEvent

rough drift
#

Calm it was a joke

#

I wouldn't name it ev

echo basalt
#

name it eve

mighty gazelle
#

Okay

inner mulch
#

not naming it event is kinda cringe

rough drift
#

public void adam(And eve)

#

LOL

inner mulch
#

event is just the peak name for events

rough drift
inner mulch
#

no

rough drift
#

mhm

inner mulch
#

ServerListPingEvent event;

#

this is peak

bleak eagle
#

you've said it four times

rough drift
#

ServerListPingEvent eventPingListServer;

inner mulch
umbral ridge
#

you can't know what "e" is, but "event" you know that it's an event variable

inner mulch
#

yes

umbral ridge
#

"e" could be a variable for an exception, but I even name exceptions with "ex" or even exception sometimes

inner mulch
#

yeah variables help reading stuff

mighty gazelle
inner mulch
rough drift
#

Jeka allows you to

#

it's a library downloading library

chrome beacon
#

and what the issue?

undone axleBOT
umbral ridge
#

anywhere

#

It's bad practice

chrome beacon
#

Looks like the shutdown method is causing that error

#

Could you remove it and just get the stacktrace for your setup method

sterile flicker
chrome beacon
#

It mentioned the wrong class loader in the stacktrace so I assumed it was the same issue as yesterday