#help-development

1 messages ยท Page 392 of 1

dry yacht
#

That's how I'd do it.

terse ore
#

What is a Consumer?

dry yacht
#

Basically a callback which takes exactly one argument and returns nothing

#

You could also broadcast right in the method countDown, I just didn't want to hard-code it in

#

This way, it's reusable

tardy delta
#

no varargs?

dry yacht
undone yarrow
#

I put the jar file in my plugins folder but it doesnt appear and wont work in-game

#

I probably made a stupid error But I cant find it

tardy delta
#

theres an IntConsumer in the java package tho

dry yacht
undone yarrow
#

ohh there

#

Ill move it there

dry yacht
#

Otherwise, it won't be added to the final jar.

undone yarrow
#

Ahh alright

terse ore
undone yarrow
#

I always do the maven compile thingy, then package

#

and then put the jar in my plugins folder

dry yacht
dry yacht
#

Or better yet, if you don't mind, you could share the jar. It's kinda hard telling you what's missing, as there could be a thousand different things wrong with it, xD.

undone yarrow
dry yacht
#

Alrighty, gonna check it out real quick

dry yacht
tardy delta
#

hmm jsonObject.get("item").getAsString() should work no? json { "item": "minecraft:yellow_wool" }

#

Cannot invoke "com.google.gson.JsonElement.getAsString()" because the return value of "com.google.gson.JsonObject.get(String)" is null

undone yarrow
#

Do you need to see the code?

terse ore
#

ty for the code @dry yacht, I have modified it

dry yacht
terse ore
#

instead of 120 seconds it will tell 2 minutes

dry yacht
undone yarrow
#

Hmm alright

dry yacht
terse ore
#

way better than what I did tbh

undone yarrow
#

I do have a different plugin in that server, that I made a while ago, and it works

dry yacht
undone yarrow
#

uhh

dry yacht
# terse ore way better than what I did tbh

And way better than those people who just count down some integer in a task which is called every second, xD. Let the scheduler do the work, don't try to be your own scheduler. That's just my opinion about the whole thing.

undone yarrow
dry yacht
# undone yarrow uhh

Sounds stupid, I know, but if you changed the main path, there now should be nothing keeping your plugin from being loaded.

dry yacht
undone yarrow
#

What file?

dry yacht
#

the plugin.yml you posted

undone yarrow
#

It didn't change?

#

It's just moved to the right

#

so not everything's visible

dry yacht
#

Oh, xDD

undone yarrow
#

lmao

dry yacht
#

Well then, you should be fine

#

Again, my server tries to load the plugin

terse ore
#

Does someone know how a tabCompleter is registered?

tardy delta
#

set the overview on package iinstead of project

tardy delta
#

what

#

why are you making a new set

undone yarrow
#

Here's the difference between the current plugin.yml and the one used in the working plugin @dry yacht

tardy delta
#

you are referencing toString before adding

dry yacht
# tardy delta what

The chad way to do it is to extend org.bukkit.command.Command and register in the server's command map yourself.

Just kidding, your way is preferred for beginners, obviously.

terse ore
#

let me check that

dry yacht
tardy delta
#

and im already using too much reflections so i dont bother

eternal oxide
#

use TabExecutor instead of CommandExecutor

#

TabExecutor does both Command and Tab

tardy delta
#

ya no clue why they made that interface

eternal oxide
#

simplicity

dry yacht
tardy delta
#

couldve done smth like <T extends CommandExecutor & TabCompletor> void smth (T t)

#

but ye

#

me making things more difficult then they are ๐Ÿฅน

eternal oxide
#

fine for us but a noob would never understand

tardy delta
#

thats what i love about the minestom discord, its not full of noobs

eternal oxide
#

Its probably toxic to them then

undone yarrow
regal scaffold
#

Good morning guys

terse ore
#

gm

regal scaffold
#

If I am trying to change the velocity of a slime when it gets hit. As in the speed that the slime moves. Do I change the velocity of the SlimeEntity itself or do I need to play with a different thing from EntityDamageFromEventityEvent

#

As in, the slime is a ball

tardy delta
#

huh

undone yarrow
#

ugh why wont it work

eternal oxide
#

easiest way is if it is knocked back in the damage event schedule a task to run the next tick to which will multiply its velocity

regal scaffold
#

Well elgarl, Currently I'm using EntityDamageFromEventityEvent

tardy delta
#

what are you doign

regal scaffold
#

To detect when it gets hit

tardy delta
#

creating a hashset with one player every time :/

#

probably want the set as a field

mortal hare
#

you creating a queue everytime the player executes command??

regal scaffold
eternal oxide
#

runTask... entity.setVelocity(entity.getVelocity().multiply(2))
pseudo ^

mortal hare
#

HashSet queue = new HashSet<Player>();

regal scaffold
#

Yeah that's what I'm doing then

#

But it's not working correctly

#

Unless my multiplier is too low

mortal hare
#

you're adding the player to the new queue

#

every time you execute the command

tardy delta
#

Set<UUID> queue = new HashSet<>();

#

on class level

#

ig some game instance polls players from the queue, its not a real 'queue' tho

mortal hare
#

yea

#

you should be using something like

Deque<Player> queue = new LinkedList();
#

and then queue.add(player) to add the player

tardy delta
#

im thinking too much in c++ terms smh

#

emplace_back

mortal hare
#

queue.poll() to remove the first player from the queue

dry yacht
# undone yarrow ugh why wont it work

It at least tries to load for me, but there's something wrong with the command, xD. I noticed that you've compiled with java 19, so I first had to download that JDK.

Before that, the server would also complain about a higher compile version than it's own runtime. So I don't get how you're not seeing anything in your console. Maybe try setting up a new server, just to try the plugin, xD.

mortal hare
#

queue.pop() would remove the player last from the queue

undone yarrow
#

why can't it just work

tardy delta
#

no u

#

linux fun until windows decides to wipe it

#

well the efi entry

mortal hare
#

yea, but sometimes you need to retrieve the object (in most cases you do need it)

#

well it removes it and retrieves it at the same time

#

The poll() method of Queue Interface returns and removes the element at the front end of the container

undone yarrow
#

It is. It's not that the command won't load. When I type /pl it doesnt even show the plugin

lost matrix
undone yarrow
#

It is...

#

I have another plugin in the same folder, and it loads

#

And I can't find the difference between the 2 plugins

lost matrix
undone yarrow
#

It's a jar file and it's in the folder and it doesnt show up

#

when I type /pl

#

so something's broken

lost matrix
#

Not possible

undone yarrow
#

...

lost matrix
undone yarrow
undone yarrow
#

plugincourse loads

#

scrapcollection doesnt

lost matrix
#

If it doesnt show up at all in /pl then it doesnt have a plugin.yml at all.

#

Look at your logs. There must be an error while you start the server.

undone yarrow
#

theres the logs

#

and theres the plugin.yml

eternal oxide
#

latest.log in server root

undone yarrow
#

ohh alright

lost matrix
#

99.1% sure its something like "invalid plugin.yml"

undone yarrow
#

That doesnt look good

lost matrix
#

Ah or that one

#

You have 2 options:
Compile with an older java version
Run your server with a newer java version

undone yarrow
undone yarrow
#

alright

#

How do I compile with an older version?

lost matrix
#

Are you using maven?

undone yarrow
#

ye

lost matrix
#

How do you compile

undone yarrow
#

I press the maven compile thingy

#

hold on

#

let me ss it

lost matrix
#

Show your pom. Depending on that ill tell you how to change it

#

?paste

undone axleBOT
eternal oxide
#

package not compile

#

compile does not make a jar

mortal hare
lost matrix
#

Yeah that as well

mortal hare
#

man this fan made music disk

#

is such a banger

undone yarrow
#

After compile I press package

undone yarrow
lost matrix
undone yarrow
# lost matrix Show your pom. Depending on that ill tell you how to change it

My pom is really short so I'll post it here ```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.JustinS</groupId>
<artifactId>ScrapCollection</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>19</maven.compiler.source>
    <maven.compiler.target>19</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.17.1-R0.1-SNAPSHOT</version>
    </dependency>
</dependencies>

</project>```

undone yarrow
lost matrix
#

Thats the java version

undone yarrow
#

Ahh

lost matrix
#

Change it to 17

undone yarrow
#

Ill just change it to 17 then

quaint mantle
#

is there a way to limit/scale the amount of hearts shown in the healthbar, cus lets say i want 1000 health i dont want 500 hearts showing

eternal oxide
#

it has a scale method

lost matrix
eternal oxide
#

getScale, setScale and setScaled

lost matrix
#

What type is your queue?

quaint mantle
lost matrix
#

I meant what type the queue variable is

quaint mantle
eternal oxide
#

20

#

and setScaled(true)

regal scaffold
#

How can I detect if a player is jumping or not on the ground

lost matrix
quaint mantle
#

ahh okay

regal scaffold
#

Not with an event

lost matrix
#

A hashset is not a queue

regal scaffold
#

Like player.isJumping()

lost matrix
#

Also you are using raw types which is very bad

undone yarrow
eternal oxide
#

package only

undone yarrow
#

I tried just packaging but it didnt do anythign

#

Same error

eternal oxide
#

package runs compile first

undone yarrow
#

in the logs

eternal oxide
#

run clear before pacakage then

undone yarrow
#

k

lost matrix
regal scaffold
#

How can I detect if a player is not on the ground using something like player#onGround()

regal scaffold
#

Deprecated

#

Oh ok cool

#

Thanks

#

Alright

#

Also, I assume yaw is what controls the view vertically, right?

vocal cloud
#

Yes

eternal oxide
#

pitch is verticle

#

yaw is turn

regal scaffold
#

Perfect, thanks!

#

Making volleyball in mc lol

wet breach
#

Use a linkedlist if you want dequeue functionality. Hashset isnt ordered and therefore cant be used for a queue

regal scaffold
#

Seemed like a fun project

vocal cloud
lost matrix
undone yarrow
#

Good thing is, it now shows up in /pl and I can run the command. Bad thing is, command doesnt do anything, apart from type it out in the chat

regal scaffold
#

plugin.yml

lost matrix
#

plugin.yml -> add command

regal scaffold
#

2-0

lost matrix
undone yarrow
rotund ravine
#

Show us your main class

regal scaffold
#

Show where you register the command

#

fk

#

0-1 for jan

undone yarrow
#
package me.JustinS_2006.particles;
import org.bukkit.plugin.java.JavaPlugin;

public final class ScrapCollection extends JavaPlugin{
    @Override
    public void onEnable(){
        this.getCommand("sc add").setExecutor(new AddParticleCommand());
    }
}
lost matrix
#

You are trying to getCommand("sc add"), arent you

regal scaffold
#

"sc"

#

FK

#

2-1 smile

rotund ravine
regal scaffold
#

I should've predicted it

rotund ravine
#

He was

undone yarrow
#

and uhh whats wrong with it

regal scaffold
#

"sc"

undone yarrow
#

?

regal scaffold
#

So the way commands work

#

Is that when you set a executor you set the executor for the main command not the arguments

#

Then you use the executor to check which command is used

lost matrix
#

Your command is called sc in you plugin.yml
The usage section is completely optional and does nothing really.

undone yarrow
#

hmm I see

regal scaffold
#

So you want to register "sc" and then in your executor class check for the arguments

undone yarrow
#

So I should make the command sc. Then in the command class, I check what argument is used, so in this case add, then do something there?

regal scaffold
#

yes

#

Good practice to use switch for command arguments if yu want

#

Volleyball math

undone yarrow
#

wdym

regal scaffold
#

Either a bunch of ifs or a switch

wet breach
#

So at minimum it would satisfy their requirement for the functionality portion lol

regal scaffold
#
  @Override
  public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
    if (!(cs instanceof Player sender)) return false;
    
    if (args.length == 0) {
      sender.sendMessage(ChatColor.RED + "Incorrect usage");
      return true;
    }
    switch (args[0]) {
      case "add" -> {
        queue.add(sender);
        sender.sendMessage("You were added to the Queue for the game!");
        if(hasPlayer){

        }
        return true;
      }
    }
    return true;
  }
lost matrix
#

Sure. I just like hating on LinkedList because it performs worse in whatever it does. There is just one use case for a LinkedList.

regal scaffold
#

That's a complete accurate way to do commands @undone yarrow

#

Ask questions if you dont understand something

wet breach
#

Anyways time to drive home.

untold jewel
#
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @4fb57196
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]

Never gotten this before. I use Oracle 18 JDK fyi

regal scaffold
#

Wrong import

#

Oh wait

#

What are you trying to do?

eternal oxide
#

Welcome to modern Java ๐Ÿ™‚

#

Reflection

regal scaffold
#

I thought it was reflection too xd

regal scaffold
#

Did you understand it?

undone yarrow
#

ye

regal scaffold
#

Good

#

Always check for sender instance

#

Then arguments

#

Then do the command

echo basalt
#

probably through gson

undone yarrow
regal scaffold
untold jewel
regal scaffold
#

But if you want more either another switch, another if, or check that the arguments length is exactly what you need

#

In each method or where it checks if it's 0

undone yarrow
#

๐Ÿ‘

regal scaffold
#

Either check for 0 && check for exact amount

#

Or if your arguments can have different amount of subarguments

#

Check in each case

#

Accordingly

#

You're using nms?

echo basalt
#

is your Clan serializable?

#

Also what fields does it store?

regal scaffold
#

Send full class plz

#

But I can see it's already missing serializable

echo basalt
#

yeah so

#

Location

#

is not really gonna work

untold jewel
#

sooo

#

what should I have instead

undone yarrow
#

is player.getTargetBlock(); deprecated?

#

I saw somewhere that it was deprecated but the docs dont say it is

hazy parrot
#

If docs doesnt say, it isn't

eternal oxide
#

Time to write your own minecraft now then

native gale
#

Hi! Where can I read about adapting my plugin for bungee?

undone yarrow
#

You're making a plugin that lets you switch your children? Nice

eternal oxide
#

Um, you are holding Players in a queue but you then try to cast it to UUID

regal scaffold
#

xd

eternal oxide
#

change ArrayList queue = new ArrayList<Player>(); to ArrayList queue = new ArrayList<UUID>();

undone yarrow
#

I need a list or an array or anything that can store a multitude of Blocks. What would be the best way to go about doing this?

eternal oxide
#

first work out what you actually want to store

undone yarrow
#

not blocks, but a Block block

#

hard to explain

eternal oxide
#

Why do you need a List of Blocks?

undone yarrow
#

because.... uhm

eternal oxide
#

I ask because it's highly unlikely you actually need Blocks

undone yarrow
#

I need to store locations of blocks that will act as a sort of location you can get an item from when you right click that block

regal scaffold
#

How can I make a function that returns a number between x and y in which if the parameter is 45 it will return y and as the parameter descreses it will go closer to x

eternal oxide
#

So you actually need a List of Locations not Blocks

undone yarrow
#

but locations could work too

eternal oxide
#

then Set<Location>

undone yarrow
eternal oxide
#

Set myLocations = new HashSet<Location>();

undone yarrow
#

What does the HashSet do

eternal oxide
#

prevents storing duplicates

undone yarrow
#

ohh thats cool

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

what am i doing wrong

vocal cloud
#

Not only that but you can call .remove() on sets and it returns a boolean so you don't have to .contains() .remove()

regal scaffold
#

How can I make a function that returns a number between x and y in which if the parameter is 45 it will return y and as the parameter descreses it will go closer to x

#

Is the only way with a spam of ifs?

untold jewel
#

I cannot use Location on gson. What else should I use?

eternal oxide
#

Yes you can but you have to write a TypeAdapter

undone yarrow
#

I have a feeling my code won't work

eternal oxide
undone yarrow
eternal oxide
#

Set is Java

#

its a Class

smoky oak
quaint mantle
eternal oxide
#

why not remove the stat before you do your new adding up?

#

or clear the Map

quaint mantle
#

i tried this before

#

would that work?

eternal oxide
#

no

quaint mantle
#

cus i tried it and it didnt

eternal oxide
#

you need to clear baseStats

#

why are you using currentStats and baseStats?

quaint mantle
#

cus the player always has atleast some of a certain stat

eternal oxide
#

I'm assuming this is totalling mods applied by armour?

quaint mantle
#

nah i have custom stats like base damage or smt that have a default value for all players

eternal oxide
#

then keep a map of yoru base stats and a separate map of your effect totals

quaint mantle
#

yea but how do i add them up to display them/use them

eternal oxide
#

baseStat.get + modified.get

quaint mantle
#

do i just make another map for that?

#

3 maps, base, modifier and total?

eternal oxide
#

you already have two

#

just don;t link them

quaint mantle
#

oh yea

#

alright

eternal oxide
#

baseStats and currentStats

quaint mantle
#

so like

currentstat.put(basestat.get + modifier)
#

whatever

#

u get it

eternal oxide
#

then in your update you just wipe yoru currentStat Map

quaint mantle
#

yea alright

eternal oxide
#

yep, before totalling

quaint mantle
eternal oxide
#

yep

quaint mantle
#

alright thx

#

basically this

tardy delta
#

use merge

eternal oxide
#

yep

quaint mantle
smoky oak
#

well

#
1 2 3
merge
1 1 1
gives
2 3 4

it adds lists element wise

tardy delta
#

check the javadocs

quaint mantle
#

currentStats.merge(statType, aDouble, Double::sum);

tardy delta
#

ya

quaint mantle
#

alrighttt

#

wait no thats not it

#

cus if it doesnt exist id need to add the baseStat too

tardy delta
#

if it doesnt exist it inserts baseStat iirc

quaint mantle
#

well i havent specified it anywhere so how would it

#

i think.. its this?

#

nah

#

oh wait i still need the if statement

#

smart

#

also need to add this

echo basalt
#
private <T, R> List<R> merge(List<T> firstCollection, List<T> secondCollection, BiFunction<T, T, R> transformer) {
  List<R> list = new ArrayList<>();
  int highestSize = Math.max(firstCollection.size(), secondCollection.size());

  for(int index = 0; index < highestSize; index++) {
    T firstElement = (index >= firstCollection.size()) ? null : firstCollection.get(index);
    T secondElement = (index >= secondCollection.size()) ? null : secondCollection.get(index);

    R transformed = transformer.apply(firstElement, secondElement);
    list.add(transformed);
  }

  return list;
}
#

๐Ÿค”

lost matrix
#

Either max the index or provide null for out of index access

echo basalt
#

Because it's not guaranteed that both lists are the same size

lost matrix
#

Oh i scrambled min and max here

#

I thought you where truncating

#

nvm then

echo basalt
#

If firstCollection has 5 elements, and secondCollection only has 3

#

we just assume the last 2 elements are null

#

and transform regardless

#

This might not be intended behavior, some people might prefer truncating

lost matrix
#

Sure sure. I thougth you wanted to truncate

echo basalt
#

or just... throw an exception

lost matrix
#

๐Ÿคท

echo basalt
#

It's basic idiot proofing

hushed pawn
#

Can you suggest some kind of server code that you can find online and rely on it to create your own minigame server architecture?

eternal oxide
#

IF the license permits

lost matrix
#

?basics

undone axleBOT
hushed pawn
#

i just wnat to figure out how big servers are done

#

like mmc or something

smoky oak
#

can someone link me a existing page on how to handle data please? the link in ?cc list doesnt exist

eternal oxide
#

cc list works in #bot-commands

smoky oak
#

well cc list works

#

but what i need is a tutorial on how to use databases

#

thats not from 2015

eternal oxide
#

what kind of database?

smoky oak
#

sqlite

#

like all resources i find are either generalized or old

eternal oxide
#

hasn't really changed since 2015

smoky oak
#

ah

#

on a different topic: if i shove a minecraft object into a database as a BLOB, and then return it, is it possible that it cannot be cast to whatever type it is originally if versions changed?

thorn crypt
#

Hello, I'm using markers with ProtocolLib 5.0.0 (Spigot 1.1.9.3) but I got a problem, when I try to put an ARGB color, it doesn't give me the good color. Here's the code and what it does in game. So I don't see what to use

smoky oak
#

urgh

#

and serialization with NBT isnt fun either

#

whatd you do

eternal oxide
#

use it's serialization method if available

smoky oak
#

would that work with nbt from other plugins included?

eternal oxide
#

it shoudl include all NBT

smoky oak
#

ah

#

interface inventory doesnt have serialization

eternal oxide
#

I do remember some issue with ItemStack enchantments though

#

vague memory

#

ItemStack does

smoky oak
#

so youre telling me to just put 54 serialized item stacks into the db instead of one inventory?

eternal oxide
#

yes, if none are null

smoky oak
#

i mean null check and if yes return new empty item stack?

#

whys the non null bit important

eternal oxide
#

no point in storing if it's null

#

waste of space

#

store ItemStack with it's slot

smoky oak
#

so youre saying to do
UUID | 1 | 2 | 3 |
... | <NULL> | <Serialized Stack> | <SerializedStack>
if i.e. slot 0 doesnt have an item?

jade knot
#

Is it able to tab-complete asynchronously in bungeecord

eternal oxide
#

no nulls at all

smoky oak
#

i mean the database null

#

'no entry'

#

is that what you mean?

eternal oxide
#

depending how many inventories you are storing use a table for eac

#

so you have index, data

smoky oak
#

smth like TABLE_NAME = "inventory_17" ?

eternal oxide
#

or if you are mashing all together then 1|data|3|data|5|data

smoky oak
#

hm

#

problem

#

the number of inventories may change over time

#

so do i just generative code that adds the corresponding table if its needed?

eternal oxide
#

yes

smoky oak
#

i think i know what you mean

#

now i only need to understand the sql code lol

#

wait

#

itemStack serialize returns a mpa

#

*map

#

do i stuff that into the DB as BLOB?

eternal oxide
#

yes

smoky oak
#

ok

eternal oxide
#

or encode to base64

smoky oak
#

i dislike base64 encoding cuz it just feels inherently unsafe

#

i know it exists but i really dont know when to use it

#

the map thing should be more version-change resilient correct?

#

i mean if they change anything about the serialized class that fucks it if its B64

eternal oxide
thorn crypt
dry yacht
regal geyser
#

anyone here good with java? wanna ask little question

opal juniper
#

no we all suck

cold field
#

Does anyone know if it is normal that the world spawnpoint chunk is always loaded?

opal juniper
#

yep that is expected behaviour

#

spawnchunks are kept loaded

cold field
#

Is there a way to disable it?

eternal oxide
#

by default but changeable

#

spigot.yml probably

cold field
#

uh, ok ty.

regal geyser
#
import java.util.Scanner;


public class main {

    public static void main(String[] args) {

    Scanner scanner = new Scanner(System.in);

    int num = scanner.nextInt();

    int i = 1;
    while(i<=10) {
        System.out.println(num * i);
        i++;
    }
}
}
#

what wrong with this code?

pseudo hazel
#

run it

opal juniper
#

define "wrong"

regal geyser
#

get stuck like this when i wanna run it

regal geyser
#

tried different code, worked

pseudo hazel
#

can you type in the terminal?

opal juniper
regal geyser
#

and different ide, worked

#

oh ffs

#

forgot there was input

opal juniper
regal geyser
#

ive been trying to fix it for 30 mins now

frail pilot
#

Wp

pseudo hazel
#

lmao

regal geyser
#

thanks yall lol

pseudo hazel
#

input is like the only thing in this program

regal geyser
#

the worst thing is i wrote the whole code

livid dove
#

This is why God invented afk warning messages ๐Ÿ˜…

"Erm hey buddy its been 10 mins, u gonna put the input in?" ๐Ÿคฃ

tawny remnant
#

how do i set the damage AND velocity of an arrow?:

cold field
lost matrix
charred blaze
#

potion drink event?

lost matrix
#

ItemConsumeEvent

livid dove
charred blaze
thorn crypt
#

Does someone know why this marker appear with this color as I put this rgb(179, 77, 179) ? I can't understand why

mortal hare
#

you can make transparent blocks?

charred blaze
eternal night
#

iirc markers are limited on the colour spectrum

slim pier
#

how to unload? yml file in java plugin

mortal hare
charred blaze
#

yeah what block is that?

opal juniper
#

think it got clamped

mortal hare
#

this seems like an unlocked debug feature

#

of minecraft client

thorn crypt
mortal hare
thorn crypt
slim pier
thorn crypt
mortal hare
#

oh it see

#

Never sent, but used to set different debug markers in the world. Does not render for vanilla clients below version 1.16.5.

thorn crypt
#

Yup

mortal hare
#

last time i checked this

#

this was unrenderable without mods

polar atlas
thorn crypt
mortal hare
#

this seems like a cool way

#

to visualize block selections

#

in vanilla

#

or make colored zones

thorn crypt
slim pier
charred blaze
#

what event is fired when eating a golden apple?

slim pier
tardy delta
#

shut down the server?

lost matrix
charred blaze
slim pier
tardy delta
#

what are we even talking about

slim pier
#

sorry i'm not good at English

charred blaze
#

and then delete it

slim pier
#

thanks

chrome beacon
#

Yeah

charred blaze
#

yeah why not you are just wasting memory

lost matrix
#

ConcurrentModificationException incoming soon

charred blaze
#

wdym

#

send them a title message?

charred blaze
undone axleBOT
charred blaze
#

store it in array or something

#

;-;

lost matrix
#

State machine. Create an Enum which defines the state of the game.
Could be

IDLE,
LOBBY,
SETUP,
ACTIVE

For example

charred blaze
#

creating object only to store single variable?

#

lel

charred blaze
lost matrix
#

Doesnt exist

rotund ravine
#

Hm? Why do you need get

charred blaze
#

why dont you just store booleans in hashset or something?

rotund ravine
#

Are you using the correct collextion for your use? @quaint mantle

charred blaze
#

why not

lost matrix
rotund ravine
#

@quaint mantle Use a different collection

#

A stack or smth

charred blaze
rotund ravine
#

ArrayDeque or similar

charred blaze
#

so why not just storing it in hashset

#

i mean i dont get the point of creating object only to store one variable in it

lost matrix
rotund ravine
#

I told you ArrayDeque or similar

rotund ravine
#

Itโ€™s made for such stuff

charred blaze
#

^

lost matrix
# charred blaze ^

Yes this is perfectly fine. Throwing something in a Map<UUID, Boolean> is not.

rotund ravine
#

@quaint mantle

#

@quaint mantle pollFirst in this case

crisp arch
#

if i wanted to add speed 2 to a player would the amplifier be 1 or 2

chrome beacon
#

1

crisp arch
#

kk ty

chrome beacon
#

?tas For future reference ๐Ÿ™‚

undone axleBOT
crisp arch
#

๐Ÿ’€

rotund ravine
#

Why?

#

Not much sense other than a lookup table to see all the active games etc.

quaint mantle
#

Who will make a light plugin for free?

tardy delta
#

?services

undone axleBOT
brisk estuary
#
public final void setOnScrollFinished(EventHandler<? super ScrollEvent> var1) {
        this.onScrollFinishedProperty().set(var1);
    }
#

The <? super ScrollEvent> just means that it is an instance of a class which is a child of ScrollEvent, right?

lost matrix
#

This looks like decompiled code...

brisk estuary
lost matrix
#

Yes

charred blaze
#

and where do you store that Game object? in hashset?

lost matrix
#

Wait

#

Its super so it must be a parent class

charred blaze
#

how do i get cause of InventoryCloseEvent? like if server made player to close it or player closed it himself

pseudo hazel
#

the server doesnt detect opening and closing of the player inventory, for containers and stuff you can keep a variable to see if its opened by a player or not

#

but there is no existing method to check for it

charred blaze
#

HashMap?

quaint mantle
#

Guys, who will make the plugin for the design?

undone yarrow
#

Ehh what's this? [16:46:17] [Server thread/ERROR]: Error occurred while enabling ScrapCollection v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.JustinS_2006.particles.ScrapCollection.getCommand(String)" is null at me.JustinS_2006.particles.ScrapCollection.onEnable(ScrapCollection.java:7) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:520) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:434) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:619) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487] at java.lang.Thread.run(Thread.java:833) [?:?]

vocal cloud
#

That's a you messed up error

undone yarrow
#

rip

#

bro my internet is going haywire rn wtf

#

Anyways

#

why am I getting that error

lost matrix
#

cause you messed up

#

plugin.yml

chrome beacon
#

You forgot to register the command in the plugin.yml

#

Probably

undone yarrow
#

Why is it suddenly so silent

vocal cloud
#

Show the line that's throwing the error too

undone yarrow
#

doesnt show it

vocal cloud
#

?paste

undone axleBOT
vocal cloud
#

Literally says at me.JustinS_2006.particles.ScrapCollection.onEnable(ScrapCollection.java:7

undone yarrow
vocal cloud
#

That's the wrong class

undone yarrow
tawny remnant
#

why cant i put Extends EntityZombie in coding 1.19??????

undone yarrow
vocal cloud
#

Check to make sure everything looks right in the compiled jar

vocal cloud
kind hatch
tawny remnant
vocal cloud
#

?nms

warm light
#

how can I get the output of a command that I run using Bukkit.dispatchCommand()?

zealous osprey
vocal cloud
warm light
#

I am adding a feature

lost matrix
#

cool

warm light
#

dispatchCommand return Boolean. so how can I get the output? :/

lost matrix
#

Implement CommandSender and dispatch the command with it.

undone yarrow
#

Why am I getting this error? [16:46:17] [Server thread/ERROR]: Error occurred while enabling ScrapCollection v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.JustinS_2006.particles.ScrapCollection.getCommand(String)" is null at me.JustinS_2006.particles.ScrapCollection.onEnable(ScrapCollection.java:7) ~[?:?]` ...
I can't find anything strange in my code, nor in my plugin.yml file.

package me.JustinS_2006.particles;
import org.bukkit.plugin.java.JavaPlugin;

public final class ScrapCollection extends JavaPlugin{
    @Override
    public void onEnable(){
        this.getCommand("sc").setExecutor(new AddParticleCommand());
    }
}
name: ScrapCollection
main: me.JustinS_2006.particles.ScrapCollection
version: 1.0
api-version: 1.17
description: Adds scrap to blocks
commands:
  sc:
    description: Adds a particle effect to a block
    usage: /sc```
quaint mantle
#

Can anyone give me a good example on how to implement custom block models into minecraft with custom textures, without overriding vanilla blocks or losing any vanilla blocks? I am aware of the armorstand and mushroom block data methods, but I don't know how to implement it into my plugin.

lost matrix
quaint mantle
#

because the return value of "me.JustinS_2006.particles.ScrapCollection.getCommand(String)" is null

undone yarrow
lost matrix
#

NPE is the one exception you should never catch

tawny remnant
quaint mantle
lost matrix
#

Yeah. That makes exactly zero sense... The exception already tells you exactly where it was caused.

undone yarrow
#

So uhh what should I do

lost matrix
undone yarrow
#

Why not just use a block that's not available in your world?

quaint mantle
quaint mantle
crimson scarab
#

how would i begin to make or find a non walkable a* path finder bukkit

undone yarrow
#

Shouldntname: ScrapCollection main: me.JustinS_2006.particles.ScrapCollection version: 1.0 api-version: 1.17 description: Adds scrap to blocks commands: sc: description: Adds a particle effect to a block usage: /sc be name: ScrapCollection main: me.JustinS_2006.particles.ScrapCollection version: 1.0 api-version: 1.17 description: Adds scrap to blocks commands: sc: description: "Adds a particle effect to a block" usage: "/sc [arg1]"

glad prawn
#

Why not <effect>

undone yarrow
glad prawn
#

Nothing

undone yarrow
#

Got it working

#

AI proves itself more useful than humans once again

smoky finch
#

Does anyone know why armorstands spawned via packets aren't affected by gravity? I didn't change any of its properties, I just called the ctor, passed it to the spawn packet and sent it to the player

lost matrix
smoky finch
#

Do you know how I can handle their movement manually?

lost matrix
#

Send movement packets for them

smoky finch
#

So when entities fall, a velocity packet is being sent behind the scenes by the server?

#

because performance wise that doesnt sound logical

tawny remnant
#

how can i set skull texture from minecraft heads website

lost matrix
lost matrix
#

Well then the same but get the ItemMeta as SkullItemMeta

#

Or SkullMeta i think

chrome beacon
#

^

lost matrix
mortal hare
#

physics are calculated by the server

#

the only physics that are not calculated by the server are player movement

#

iirc

smoky finch
#

Alright, but how do I actually handle "physics calculation" manually for an entity?

echo basalt
#

there's a move method

#

Client-side behavior is a bit weird

#

certain entities have default speeds and all

#

for example, an Item entity "flies" upwards when spawned, as the client predicts it's a block breaking / entity dying

#

you can prevent that by sending a secondary speed packet setting all axis as 0,0,0

#

Now, packet-based entities with movement seem counter-intuitive

#

you probably just want a real entity hidden with Player#hideEntity (paper) or just send an Entity remove packet

warm galleon
#

For 1.19.3, what is the maven dependency I need to use>

#

?*

remote swallow
#

same as other versions

warm galleon
#

i have not developed plugins in a year and

<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version></version>
            <scope>provided</scope>
</dependency>
#

1.19 doesnt seem to exist

#

not in the spigot-api or spigot artifacts

remote swallow
#

do you have the repo

icy beacon
#

1.19-R0.1-SNAPSHOT

#

and yeah the repo

warm galleon
#

oops

#

is it that one

icy beacon
#
<repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>

yeah seems like it's accurate

warm galleon
remote swallow
#

use 1.19-R0.1-SNAPSHOT as the version and reload maven

icy beacon
#

did you make sure to reload maven?

#

sniped ๐Ÿ˜ฆ

warm galleon
remote swallow
#

im guessing ij only lists versions on your computer

icy beacon
#

yeah it does

remote swallow
#

use 1.19-R0.1-SNAPSHOT anyway and see what happened

icy beacon
#

the ones that are in .m2

warm galleon
#

oh shit its because i misspelled snapshot

icy beacon
#

xD

warm galleon
#

:D

icy beacon
#

happens to all of us

#

oof

smoky finch
warm galleon
#

i missed the A lmao

#

tyty

icy beacon
#

except with intellij you can use the Minecraft Development plugin

#

it does everything for you ๐Ÿ˜„

warm galleon
#

whats thtat

icy beacon
#

it's an intellij plugin

#

basically adds a Spigot plugin preset to projects

#

one sec

warm galleon
echo basalt
#

you can just send movement packets

warm galleon
#

this one? if so i prob should get it

echo basalt
#

with a specific offset

icy beacon
icy beacon
warm galleon
#

damn crazy

icy beacon
# icy beacon

it does everything for you, it'll create a maven project with spigot repo and dep + plugin.yml + main class

warm galleon
icy beacon
#

anytime ๐Ÿ™‚

warm galleon
#

using the plugon

#

plugin

remote swallow
#

yeah

#

spigot ver is next page

warm galleon
#

or is it asking for my project details

remote swallow
#

project details

pseudo hazel
#

yeah this is just your project

warm galleon
#

alright

icy beacon
pseudo hazel
#

the version doesnt matter except for the file it creates xD

icy beacon
#

you can configure all of it later anyway

#

in pom.xml & plugin.yml

#

this plugin is just a shorthand for creating all of it

remote swallow
#

it makes it so you only need to change pom

warm galleon
#

oh i see

icy beacon
#

yeah it's just a convenient shortcut for you

warm galleon
#

i see

icy beacon
#

so you don't have to memorize all the required files, repo, dependency, etc

regal scaffold
#

Is java ever pass by reference?

#

Like if I have a method to set specific slots in a inventory, and I pass it the inventory

#

Do I need to make the method return the inventory and save it back? Can I make the method void and it will keep the changes in the original method

echo basalt
#

you should look into mutable / immutable

regal scaffold
#

setDefaultButtons(inventory);

#saveDefaultButtons

inventory#setItem();
tardy delta
#

java is pass by value

echo basalt
#
Player player = ...;
Player player2 = ...;

Player object = player;

setPlayerName(object, "player1");

object = player2;

setPlayerName(object, "player2");

assert !player.getName().equals(player2.getName());
assert object == player2;
assert player2 != player1;
tardy delta
#

references and primitives are both passed by value

regal scaffold
#

Why do I have 2 different answers

#

I swore I did read that java is pass by value

#

But illusion said reference

tardy delta
#

it is

echo basalt
#

Objects have references that are passed

#

primitives aren't really objects so the value itself is passed

#

Every time you define a variable, you're just creating a new "pointer" to that reference

echo basalt
#

yea

regal scaffold
#

But with primitives it wouldn't

#

Cool. thanks

pseudo hazel
#

good luck using . on primitives

regal scaffold
#

My code isn't made for primitives tho

#

It's for an Inventory

pseudo hazel
#

I mean usually there arent very many options

weak meteor
#

?paste

undone axleBOT
undone yarrow
#

I got a command working that adds specified block locations to a list, but now I want to add a particle effect above all the blocks in that list. How would I do that

#

What class should I put that in, I mean

lost matrix
#

Use a scheduler to schedule the particles

undone yarrow
#

And how would I get my locations from my other class, and reference it in my main class? private final Set scrapLocations = new HashSet<Location>();

#

I want to reference scrapLocations in my main class

eternal oxide
#

do you need them all at teh same time?

undone yarrow
#

wdym

#

All the locations at the same time?

eternal oxide
#

surel;y you just need an add, remove and contains check

weak meteor
#

This is my code: https://paste.md-5.net/taciselovo.js
The problem is everytime i execute my command with a subcommand i get the answer of all below
example:
/astralgkits create
Output inserver:

Create Subcommand
Edit Subcommand
Delete Subcommand
Info Subcommand

idk why if i have the break statement

undone yarrow
#

No? I want to take all the scrapLocations, and add looping particles above them

#

I want to do the spawnParticles in my main class as well

eternal oxide
#

don;t do it in your main

undone yarrow
#

why

eternal oxide
#

Single responsibility principle

undone yarrow
#

So where should I do it then?

eternal oxide
#

each class shoudl have its own purpose

#

do it in a sub class of where you have your scrapLocations

undone yarrow
#

Seems like an odd place to put it, but if that's what people usually do I guess it's fine

eternal oxide
#

no

undone yarrow
#

....

eternal oxide
#

that class should just be a command handler

undone yarrow
#

That class is also where I have my scrapLocations

eternal oxide
#

each class handles one job

#

you should create a class just to handle your locations

undone yarrow
#

That class checks for the sc add command, then puts the block loc in the list

eternal oxide
#

with a public method for add/remove and contains

undone yarrow
eternal oxide
#

in that class you could handle a runnable to do your particles

undone yarrow
#

My original question hasnt been answered though

eternal oxide
#

it has, your scrp locations should not be accecssed from your main

regal scaffold
#

@tender shard

#

Hey, you said you don't do config files anymore, no database or yml and just store all the data into pdcs

remote swallow
#

most stuff could be stored on pdc, a config file is still needed

#

for quite a lot of things

undone yarrow
dry yacht
#

Does anybody know whether org.jetbrains.annotations have any effect at runtime? I'm trying to check for the presence of Nullable at runtime, so I know whether or not to set a default value on an item stack I'm automatically mapping using my config mapper. I cannot access the annotation class at runtime tho, because they're not on the classpath. Would shading them into root scope (as I do not want to relocate, for obvious reasons) hurt anything I'm unaware of?

regal scaffold
#

Hey, is anyone available to give a look at my serializable class please

undone axleBOT
regal scaffold
#

I think I don't but I will check

dry yacht
regal scaffold
#

That is odd

#

Alright

#

Oh wait I got it

#

deserialize

#

It's there

fallen snow
#

Hi everyone, trying to get a player head texture but it's just coming through as a regular steve. Any ideas?

            ItemStack headStack = itemStack.clone();
            SkullMeta meta = (SkullMeta) headStack.getItemMeta();

            GameProfile profile = new GameProfile(UUID.randomUUID(), null);
            profile.getProperties().put("textures", new Property("textures", headURL));
            try {
                Field profileField = meta.getClass().getDeclaredField("profile");
                profileField.setAccessible(true);
                profileField.set(meta, profile);
            } catch (NoSuchFieldException | IllegalAccessException e) {
                e.printStackTrace();
            }

            headStack.setItemMeta(meta);
            return headStack;

1.19.3

regal scaffold
#

Because UUID is not easily serialzable into a PDC

regal scaffold
#

Yeah it has a completely different method for UUID

#

or... that 1 line

#

Also it's inside of an object so it's not that big of a deal

#

Cause I'm storing the entire object

glossy venture
#

very memory inefficient

dry yacht
glossy venture
#

and haram

weak meteor
#

switch (subcommand){
case "create": sender.sendMessage("Create subcommand"); break;
case "edit": sender.sendMessage("Edit subcommand"); break;
case "delete": sender.sendMessage("Delete subcommand"); break;
case "info": sender.sendMessage("info subcommand"); break;
}

im getting every sendMessage in case.
Create will execute all below
Edit all below and stuff

#

Help :(

glossy venture
regal scaffold
#

I mean that's what we were saying

#

What's so wrong about storing as a string

glossy venture
#

memory

#

usage

dry yacht
#

That's why we need 32 gigs nowadays

glossy venture
#

exactly

weak meteor
dry yacht
#

Most developers are ignorant of the underlying machine and want to just live in abstraction land all day.

glossy venture
#

36 * 2 = 72 bytes per UUID per object per container

#

idk if its 46 chars (it wasnt)

#

forgot

dry yacht
#

Uhm... yeah, sure, you got my point! xD

glossy venture
undone yarrow
#

How do I loop through this public Set scrapLocations = new HashSet<Location>();?

#

I want to add particles at all those locations

#

I tried that

#

but it gives weird errors

#

1 sec

#

It just underlines it in red

#

Incompatible types. Found: 'org.bukkit.Location', required: 'java.lang.Object'

#

Locations arent objects right?

#

Somehow that fixes it. What's the difference?

#

But now Im not defining what Hashset is right

glossy venture
undone yarrow
#

But HashSet<> <--- the bracket-thingies are empty?

glossy venture
#

from the declaration

undone yarrow
#

ohh I see

glossy venture
#

so since your Set has type Location the compiler can derive that the HashSet<> should be a HashSet<Location>

undone yarrow
#

yeah alright

#

Thanks

glossy venture
#

well it knows the type of the field, with actual type parameters but it doesnt know the objects generic type

#

the actual type args are part of the field signature

undone yarrow
#

JVM?

analog thicket
#

Hello, I have a problem with getting something from my config. because it makes a map list null when it gets put into the config.YML. That causes this line to make crate null. How would i fix this?

Map<?, ?> crate = (Map<?, ?>) item.get(crateNumber);

https://paste.md-5.net/awimovomux.cs CONFIG

undone yarrow
#

ah alright

analog thicket
#

?paste

undone axleBOT
dry yacht
#

Generics of member fields aren't erased

undone yarrow
#

Anyways, onto my next question.
Now that I have this, how can I run this method, let's say every second. I heard about a getScheduler but Im not sure how it works java public void spawnParticles(Particle particle){ for (Location location : scrapLocations) { location.getWorld().spawnParticle(Particle.SCRAPE, location, 7, 0.2, 0.4, 0.5); }

undone axleBOT
dry yacht
#

What do you mean by recognize? It doesn't typecheck when operating on those members, no, but the information is still there. Unlike on generics in other parts of the code.

#

How am I matching on them at runtime then?

#

That's what I meant

tardy delta
#

!isEmpty ๐Ÿฅน

dry yacht
#

Isn't type erasure happening at compile time tho? So if they persist, isn't it wrong to say "they are wiped"?

buoyant viper
undone yarrow
#

Is there an alternative for schedulers? This shit is weird and messes up my code

#

Via this chat or dms?

river oracle
#

?paste

undone axleBOT
analog thicket
#

How would i fix it to not display null, because i cant get it to work when its there.

undone yarrow
dry yacht
#
  private final java.util.Map<java.lang.Integer, me.blvckbytes.headcatalog.gui.UISlot> slots;
    descriptor: Ljava/util/Map;
    flags: (0x0012) ACC_PRIVATE, ACC_FINAL
    Signature: #26                          // Ljava/util/Map<Ljava/lang/Integer;Lme/blvckbytes/headcatalog/gui/UISlot;>;

Okay, I must really be misunderstanding something then.

undone yarrow
#

I removed them from the posted code because they didn't work and are probably completely wrong

analog thicket
undone yarrow
#

All I removed from ParticleHandler wasjava private static Plugin plugin = null; private int delayID = 1; and ```java
public void spawnParticles(Particle particle, Plug in instance){
plugin = instance;
for (Location location : scrapLocations) {

        location.getWorld().spawnParticle(Particle.SCRAPE, location, 7, 0.2, 0.4, 0.5);
    }
    Bukkit.getScheduler().runTaskLater(this, this::spawnParticles(Particle.SCRAPE), 20L);
}
buoyant viper
#

this::spawnParticles(Particle.SCRAPE)

#

i dont think thats valid java

undone yarrow
#

me neither

#

I was trying stuff

buoyant viper
#

so it was PEBKAC

undone yarrow
#

hoping it would work

buoyant viper
#

ezpz

quaint mantle
#

Idk where else to ask but how do i reset where my resultset loops from?
Cause i use ResultSet.next() but the next time it starts off where it stopped

tardy delta
#

what

quaint mantle
#

i have a database with uuid's of players,
to get the right player i have a resultset with a while loop then check if it the uuid is equal to the selected player, i do this with:
while (resultSet.next())
lets say the last time the first loop result was the correct one, the next time i loop it skips the first entry

FIXED:
i just make a new connection everytime i need the data and then close the connection

undone yarrow
#

What about java public void spawnParticlesEverySecond(Particle particle, Plugin plugin) { BukkitRunnable runnable = new BukkitRunnable() { public void run() { for (Location location : scrapLocations) { location.getWorld().spawnParticle(particle, location, 7, 0.2, 0.4, 0.5); } } }; runnable.runTaskTimer(plugin, 0L, 20L); // run every second (20 ticks) }

#

Then calling it in main as ParticleHandler particleHandler = new ParticleHandler(); particleHandler.spawnParticlesEverySecond(Particle.SCRAPE, plugin);

buoyant viper
#

bytecodeviewer?

dry yacht
#

Alrighty, I'm just gonna be real, I'm confused beyond repair, xD.

tawny remnant
buoyant viper
#

type erasure goes hard

undone yarrow
#

I have this list of locations, but when I try to print it, it just says '[]'. Does this mean there's nothing in the list, or am I printing it wrong? ```java
public Set<Location> scrapLocations = new HashSet<>();

public void ListLocations(CommandSender sender){
    sender.sendMessage(scrapLocations.toString());
}
cobalt thorn
#

Hi, im using a library called XParticle (https://github.com/CryptoMorin/XSeries/blob/master/src/main/java/com/cryptomorin/xseries/particles/XParticle.java) to load images

XParticle.displayRenderedImage(plugin, XParticle.renderImage(plugin.getDataFolder().toPath().resolve("test.png"), 20, 20, 20), () -> player.getLocation(), 1, period,20,20,2);

But gives a problem on the XParticle#renderImage return CompletableFuture<Map<double[], Color>>, but XParticle#displayRenderedImage wants Map<double[], Color>, cast it to it doesn't work any work around?

buoyant viper
# buoyant viper

original class was

import java.util.ArrayList;

public class Generics {
  public static void main(String[] args) {
    var theList = new ArrayList<String>();
    theList.add("This is a string");

    if (!theList.isEmpty()) {
      theList.forEach(System.out::println);
    }

    System.out.println("lolwat");
  }
}```
analog thicket
tardy delta
#

var ew

dry yacht
# buoyant viper original class was ```java import java.util.ArrayList; public class Generics ...

I was talking about fields and method return types, while this is a scoped variable. Maybe the whole reason why I don't get why the JVM doesn't know about these is that I confuse the JVM with what reflection builds upon. I just know that, for parameters - for example - the types are erased, while for member fields and return types they aren't. So they end up in the bytecode. Is reflection directly querying bytecode? Isn't the JVM loading this bytecode into memory and one could thus argue that it does know about them? Again, I'm just massively confused right now, xD

regal scaffold
#

Anyone have a good tool to write item lores

#

Like formatting, colors, etc, website or something

#

Cause sometimes lores are big and needs to look good

dry yacht
#

So no JVM instruction knows of these types, and they are just metadata in the loaded class in memory, which reflect accesses?

#

How doesn't it? It's in the classpool

#

that's bytecode

#

constantpool*

#

Or is bytecode just defined as actual instructions?

#

So reflect queries the constant pool while JVM only executes that bytecode ASM, which doesn't reference types within the classpool, but only like Object or whatever

coral kelp
#

Searching for a Developer for my server must be very good with scipts and be experienced.

tardy delta
#

?services

undone axleBOT
dry yacht
#

Okay, I think that's exactly what I wanted to get at, because I consider the whole class file bytecode. So it's in there, the JVM just doesn't execute anything related to that information. Reflect then goes into the parsed class in memory and looks up this meta information. Alright, that cleared things up.

I thought you meant they are erased, which is why I thought I am going crazy.

undone yarrow
#

When I run Block block = player.getTargetBlock(null, 7); Location blockLoc = block.getLocation();
I get the location of the player, not the block

#

The targeted block isn't 37, 66, 14

#

those are my players coordinates

remote swallow
#

targetted block is on the right

undone yarrow
#

Even then, it doesnt do what it should

remote swallow
#

the targetted block coords are on the right of f3

analog thicket
undone yarrow
#

Shows, once again, that the targetedblock method doesnt do what it should

remote swallow
undone yarrow
#

yes?

remote swallow
#

whats the coords then

undone yarrow
#

what's your point?

#

Look in the chat maybe?

remote swallow
#

you sent a ss of your coords

undone yarrow
#

And of the chat

#

that contains the supposed coords of the block

remote swallow
undone yarrow
granite burrow
#

Is it possible to use the Spigot API outside of Minecraft? I want to access the web API on a website to list all available plugins I have uploaded

quiet ice
# dry yacht I was talking about fields and method return types, while this is a scoped varia...

Generics can be erased (and are erased if you use tools such as proguard correctly) by stripping the signature attribute of the class or class member.
Descriptors (not to be confused with generic signatures - which are optional) are mandatory and cannot be removed.
Local variables (including argument/parameter names) as stored in the LVT (local variable table) can be erased. The LVT may be incomplete.
That being said stackmap is mandatory on Java 7+, which stores the types of the elements in the local variable slots and of the operand stack. It does not store the generic signature of types though

undone yarrow
#

Why does this send nothing? java public void ListLocations(CommandSender sender){ for (Location location : scrapLocations) { sender.sendMessage(location.getX() + ", " + location.getY() + ", " + location.getZ() + ") \n"); } }

#

Even AI can't spot the mistake

remote swallow
#

scrapLocations is empty

analog thicket
#
        List<Map<?, ?>> items = configYML.getMapList("casino.crates");
        for (Map<?, ?> item : items) {
            Integer crateNumber = (Integer) item.keySet().toArray()[0];
            Map<?, ?> crate = (Map<?, ?>) item.get(crateNumber);
            String blockblock = (String) crate.get("block");
            Bukkit.broadcastMessage(blockblock);
        }

Why does crate give null? i am so confused

undone yarrow
#

No

undone yarrow
dry yacht
quiet ice
#

Notch used to back in the old days

#

Hence my Sl-deobf has limited use in the legacy minecraft modding scene (albeit only as a fork as it was originally meant to aid in galimulator modding)

undone yarrow
#

Ugh why can't this stupid code just work?!?!?!
This is simply supposed to add a location to the list if it doesnt exist. But everytime I type /sc add (which is the command that runs this), it keeps saying "location added to the list".

public Set<Location> scrapLocations = new HashSet<>();

    public void AddLoc(Location loc, CommandSender sender){
        if(scrapLocations.contains(loc))
        {
            sender.sendMessage("That block has already been added to the locations.");
            return;
        }
        scrapLocations.add(loc);
        sender.sendMessage("Added (" + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ") to the list.");
    }```
quiet ice
#

But I can guarantee, if mojang still stripped generic signatures, the minecraft modding scene would look fairly different

undone axleBOT
crimson mulch
dry yacht
# quiet ice But I can guarantee, if mojang still stripped generic signatures, the minecraft ...

Yep, that's exactly what I thought. Not only that it would massively increase the difficulty of reverse engineering (well, there are mappings nowadays) but it would also break a lot of reflection. I mean... if a class contains two collections, and I can't rely on field order (which I can't), how would I ever get access to the right one, without distinguishing them based on their generics. That would really force people to compile against every single version there is, in cases like these, I think.

quiet ice
undone yarrow