#help-development

1 messages Β· Page 1951 of 1

alpine urchin
#

so 1.9 is fine:)

#

ez

tardy delta
#

1.8 :(

alpine urchin
#

ill mod 1.9 to have 1.8 combat

#

will you like them more

tender shard
#

well it's not about mc 1.8, it's about using java15+

alpine urchin
#

1.9 still uses 8

#

rogjt

#

right

tardy delta
#

no instance fields in records allowed hmm i already starting to hate it πŸ˜‚

alpine urchin
#

ok

#

then don’t use ut

#

ez fix

tardy delta
mortal hare
#

that's actually kinda good idea

#

one liner

tardy delta
#

code gone lol

mortal hare
#
public record Pair<A, B>(A a, B b) {}

vs

public class Pair<A, B> {
    private final A a;
    private final B b;

    public Pair(A a, B b) {
        this.a = a;
        this.b = b;
    }

    public A getA() {
        return this.a;
    }

    public B getB() {
        return this.b;
    }
}
tardy delta
#

i could place all thos classes in one file lol

mortal hare
#
Utils.Pair<String, Object> = new Utils.Pair("Hello", randomObject);
sacred mountain
#

how would i string manipulate it so that i can use the string in PotionEffectType.(mystring)

#

so it would add the effect frm the config

tardy delta
#

lol ye 🀣

sacred mountain
tardy delta
#

im everywhere

mortal hare
#

name is a string

#

not an enum

tender shard
#

in your case, k and v

mortal hare
#

use PotionEffectType.getByName() or even better use namespaced keys instead

tardy delta
#

i mean yo cant have fields which arent included in the constructor

mortal hare
#

that way you could use minecraft's potion names

sacred mountain
#

this?

young knoll
#

Mhm

#

Be aware it can return null

tardy delta
#

String.valueOf(arr[0]) meh

mortal hare
#

doesnt this method use spigot named potion effects for checking

#

if you use getByKey() you can specify potion effects how mojang intended to.

young knoll
#

I believe it uses common names

#

Not sure

mortal hare
young knoll
#

Mmm guess not

sacred mountain
#

o

#

well

mortal hare
sacred mountain
#

is there anything that uses the ingame names

mortal hare
#

it has namespaces included

sacred mountain
#

ohk

mortal hare
#

with minecraft names

#

you can just create new namespacedkey

#

and use getByKey()

sacred mountain
#

this should work right

mortal hare
#

it should

blazing scarab
#

More readable

mortal hare
#

and you dont need annotations

#

for example to flag that this value returned is not null

#

since IDE would know that the field is immutable

#

great for multithreaded tasks

#

although this is just syntactic sugar

alpine urchin
#

lambda is language sugar

tender shard
#

and pattern matching is pepper

tardy delta
#

o

#

classes are butter

tender shard
#

records are thyme

#

throw that all together and you have a tasty baba ganoush called java

tardy delta
#

πŸ₯²

#

unfortunately you cant do this

#

and cant add it to method signature because its overridden

tender shard
tardy delta
#

because of throws IOException

tender shard
#

yeah of course

#

you always need to declare it if you don't throw a RuntimeException

tardy delta
#

i cant add throws because the method is overridden from its superclass

tender shard
#

use SneakyThrows if you really have to throw it

#

or wrap it inside your own exception that extends RuntimeException

tardy delta
#

lemme just add it to the method signature of the base class πŸ₯²

alpine urchin
#

ive tried rhat too

tardy delta
#

but you can throw new RuntimeException(e)

#

πŸ˜‘

tender shard
#

you can always throw RuntimeExceptions

#

(in theory you can always always throw any throwable without declaring it)

tardy delta
tender shard
#

yeah what did you expect

mortal hare
#

holy

#

now that's a thicc taskbar

tender shard
#

of course now you have to wrap all calls into try/catch

tender shard
spiral light
#

its huge af

tardy delta
#

im wrapping them in a try catch by default

mortal hare
tender shard
#

oh weird

#

I hate having the icons in the middle

tardy delta
#

and this things says its always false, why?

mortal hare
#

i hate having them at the bottom

#

top taskbar gang

tender shard
glossy venture
tender shard
#

that's why you don't need try/catch for stuff like Integer.parseInt

glossy venture
#

why did i not know that

tardy delta
tender shard
#

or ArrayIndexOutOfBoundException

glossy venture
#

i thought they were hard coded into the compiler

young knoll
#

Or NPE

tender shard
glossy venture
#

to not have to be try/caught

modest garnet
tender shard
#

show Core line 28

modest garnet
#

this.getCommand("minecoins").setExecutor(new minecoins());

tender shard
#

you didnt register minecoins as command in plugin.yml

modest garnet
#

oh yea lmfao

#

ty

tender shard
#

np

tardy delta
#

java is weird

ivory sleet
#

ye

#

SQLException does not derive RuntimeException iirc

tardy delta
#

hmm right

#

and all others do?

ivory sleet
#

well

tardy delta
#

the checked ones

ivory sleet
#

Any class that derives RuntimeException, either explicitly or implicitly can be thrown arbitrarily in principle

visual tide
#

anything that extends RuntimeException you dont have to declare or catch

#

you gotta declare or catch everything else

ivory sleet
#

Yes, sneaky throws is a thing if you wanna throw non-derivatives of RuntimeException, but you should really dissuade yourself from a sneaky throw

tardy delta
#

stupid sql exception lol

ivory sleet
#

Yeah, well checked exceptions are a bit meh

visual tide
#

or just print stack trace and return if that's applicable to your context

ivory sleet
#

but they do enforce you to handle exceptional cases, which is good

tardy delta
#

im trying to handle exception in wrapper

ivory sleet
#

mhm

ivory sleet
#

Because it makes checked exceptions just as unpredictable as unchecked ones

tardy delta
#

and then im doing something like this but i dont want to do a try catch in the method itself

#

where the createKingdom method can throw an sql exception

ivory sleet
#

Usually, you just javadoc the unchecked exceptions, whilst you should declare throws for any checked exception, at least that's what is usually the case. I would be very annoyed if a random checked exception yields from a method that does not tell me anything about it, especially if its an exception such as IOException.

blazing scarab
#

In some contexts you just cannot take an advantage of checked exceptions

ivory sleet
blazing scarab
#

I think rethrowing exceptions would be better rather than whining in logger or printing stack trace

late sonnet
#

Any form to get when a projectile "hit" water? i wanna cancel the bouncing arrow in water.. and dont wanna use a runable for track all the travel of the arrow for this... (because many arrows)

ivory sleet
#

so the stacktrace, will most likely be printed regardless

blazing scarab
#

When you implement some interface, for examples

tardy delta
ivory sleet
tardy delta
#

?paste

undone axleBOT
modest garnet
ivory sleet
#

or you could just have the interface throws Exception, or sth, or perhaps make it a RuntimeException.

late sonnet
tardy delta
#

if i add throws SQLException if my NewStorage, i would need to add a try/catch in every method of the DelegatingStorage instead of handling it in the makeFuture method
https://paste.helpch.at/totitebatu.java

modest garnet
#

ty

ivory sleet
tardy delta
#

so rn im just throwing a runtime ex

late sonnet
ivory sleet
#

lol yeah

#

I assume you tried ProjectileHitEvent already

fluid nacelle
#

I'm having some trouble getting NMS to work for 1.181 (Dependency 'org.spigotmcspigot1.18-R0.1-SNAPSHOT' not found ) even after adding the plugin in and running package ._.

young knoll
#

Did you run buildtools

fluid nacelle
#

Yes

late sonnet
ivory sleet
#

nvm EntityChangeBlockEvent is for sth else

#

hmm, I mean worst case you might just have to stick with a timer, im kinda baffled that there aren't any events for this

late sonnet
ivory sleet
#

ye rip

mortal hare
#

best third party intellij plugin i've ever used

grizzled pollen
#

ok?

mortal hare
#

saves so much time

ivory sleet
#

just rainbow brackets?

mortal hare
#

yes

ivory sleet
#

interesting, maybe I should give it a try then

mortal hare
#

it colors your brackets differently to distinguish scopes

ivory sleet
#

yeye danceDog

blazing scarab
#

I never had problems with brackets

#

Even on netbeans with 0 programming skills

#

😎

mortal hare
#

mega chad

ebon stratus
#

so i made a custom tool, and i want to make a custom efficiency for it, i thought about changing the block hardness with protocol lib break animation packet and efficiency, haste but idk, any other idea?

mortal hare
#

if i was you

#

i would dig up

#

NMS

#

to register custom enchantment or item

forest edge
#

Does anyone know if it is possible to add fake players to teams? Currently trying to organize my tablist with fake players and teams.

blazing scarab
blazing scarab
iron lotus
forest edge
mortal hare
forest edge
#

The server doesn't know about the entity

mortal hare
#

Bukkit API would freak out

#

but it would exist

blazing scarab
#

Have yohu tried? Pretty sure team just keeps those strings and everything is handled clientside

blazing scarab
mortal hare
#

you can extend the existing class

#

that way the item type wouldnt change

#

only the server sided things could be changed

#

just that the Bukkit API wouldnt recognise that as an item

blazing scarab
#

Thats pointless imo

mortal hare
#

it would break

#

everything

#

probs

blazing scarab
warm light
#

how to disable plugin?

mortal hare
#

plugmanX (DONT USE THIS IN MAIN SERVER)

thick scarab
fluid nacelle
#

This is so annoying -_- how do I get CraftBukkit to work?

#

Literally have the local CraftBukkit folder, but the dependency just won't resolve

tardy delta
mortal hare
#

does enhanced for loop uses iterator to iterate primitive arrays

tardy delta
mortal hare
#

literally read that

#

ms ago

#

yeah

#

solved

tardy delta
#

lol

mortal hare
#

what do you guys return

#

empty collection

#

or null

#

i prefer empty collection impl whenever i need to return multiple values

#

since its more flexible

lilac dagger
#

where possbile empty collections

ebon stratus
carmine mica
#

Can I use json for configs or do I have to use yml?

ebon stratus
wary harness
#

any one can send some page link

mortal hare
#
wary harness
#

to compere mojang mapping and spigot

#

PlayerTeam

glass wharf
#

Hey, I have a custom mob system that applies a health bar and level to my mobs, but because of this nbt they dont despawn or count to the mob cap, is there anyway i can override this feature?

mortal hare
wary harness
#

I am looking what is PlayerTeam called in 1.16

tardy delta
mortal hare
#

ddl

tardy delta
#

so you can iterate

iron lotus
mortal hare
#

its called ddl

#

wait no

wary harness
mortal hare
#

1.16.5

candid plover
#

InventoryOpenEvent may only be triggered synchronously. Help?

wary harness
#

I got 1.16.5 but can't import ddl

mortal hare
#

not sure then

#

but what i would do

#

is to open intellij

#

and go to Scoreboard packet class

#

there's usually PacketDataSerializer method there

#

by getting that method you can see what its used in there

wary harness
#

ok thanks

quiet ice
#

What was the forumula for the offline mode UUID again?

lilac dagger
#

UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)

quiet ice
#

thanks

tardy delta
#

UUID.fromString?

#

ah nvm

#

i cant read

midnight shore
#

Hi guys how can i play the dragon defeat rays at an entity? If it is possible

ivory sleet
#

if the method always return immutable objects, then stick with the empty coll

#

if its mutable tho, I'd yield null

#

imo

deft forum
#

anyone know how to create a bossbar

#

?

lilac dagger
#

getServer()createBossbar

#

something like that

#

or Bukkit.createBossbar

deft forum
#

thx

mortal hare
#

1.9+

#

only

blazing scarab
sacred basin
#

Can anyone play minigame for test in my server?
I'm trying to make a video but can not play with alone..
(It takes for a few minutes)

wary harness
#

got big problemsssss

#

uh

#

spigot is down

#

any one knows what to put here

#

data.set(new DataWatcherObject<>(17, DataWatcherSerializer.), (byte)( 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));

#

so DataWatcherSerializer.

#

I am not sure how method works

#

and can't google it of spigot page

#

in 1.17.1 is just EntityDataSerializers.BYTE

blazing scarab
#

nms moment

tardy delta
#

why isnt this working? create table is normal sql

gusty bough
#

Isn't "if not exists" a mysql thing?

tardy delta
#

even without

gusty bough
#

Try with MySql; it should work

tardy delta
#

MySql isnt even a language

#

bruh really

gusty bough
#

` behind and after

#

users

tardy delta
blazing scarab
tardy delta
#

its the intellij sql verifier or something

blazing scarab
#

try Integer instead of INT?

#

Also rmeove ;

worldly ingot
#

Honestly it might be yelling at you because of the semi-colon, yeah

tardy delta
#

nope

worldly ingot
#

That's literally the only thing that would be weird about that, and even a semi-colon is a statement terminator so idk why it would yell at you lol

tardy delta
#

it doesnt recognize table or something

worldly ingot
#

tbf, \users`` is weird

#

wow, can't escape in there

#

'users'

#

but I guess that's a matter of preference

#

Unless IJ is super picky about "NO! NO BACK TICKS!"

blazing scarab
#

no

#

"" and '' is for string literals

modest garnet
#

if you need my code i can send

worldly ingot
#

Yeah but in SQL you can use backticks

tardy delta
#

cant find table i guess

worldly ingot
#

Really? o.O Does IJ actually do that?

#

but I also don't know why it would tell you that it can't find the table when you're writing a CREATE TABLE statement

#

IJ's high as fuck

tardy delta
#

i mean table keyword

#

._.

worldly ingot
#

Ohhh icic

#

The latter still applies

tardy delta
#

imma leave the annotation behind i guess πŸ₯²

forest edge
# blazing scarab Why

Testing it now, it doesn't seem to work. However, I am using an empty string for the fake player's name and I'm using its UUID to add it to the scoreboard team as an entry. I need an empty string for the name to not appear in chat when a player tab completes

blazing scarab
#

Names only

forest edge
#

Hmm... and other entities wouldn't appear in the playerlist

tardy delta
#

what is a sequence in mysql?

#

hmm no its not a table

#

i was thinking it was create sequence instead of create table cause t gave no errors

#

oh works with this language

@Language("MYSQL-PSQL")```
glossy venture
#

what plugin is that

lavish hemlock
#

I don't think it's a plugin

#

I'm pretty sure @Language comes from JetBrains Annotations

modest garnet
tardy delta
#

ye

lavish hemlock
#

org.intellij.lang.annotations.Language @glossy venture

tardy delta
#

minecoins.java:41 nullpointer

modest garnet
#

wassup man

glossy venture
#

oh how do i include intellij into my project

lavish hemlock
#

They have it on Maven Central

modest garnet
# tardy delta minecoins.java:41 nullpointer

p.sendMessage(ChatColor.AQUA + target.getName() + ChatColor.GRAY + " has " + ChatColor.AQUA + "" + ChatColor.BOLD + minecoins + ChatColor.GRAY + " minecoins"); this is my like 41 im confussed lol

tardy delta
#

wasnt it in buildtools or something?

lavish hemlock
#

That also contains @Nullable, @NotNull, @MagicConstant, and other fun goodies.

tardy delta
#

it had it when i added the spigot dependency in some 1.16 version

#

could be something else too

tardy delta
lavish hemlock
#

Oh and Kotlin actually uses the nullable/not-null annotations

modest garnet
lavish hemlock
#

Its compiler can infer nullability from them in non-Kotlin projects

#

but it also compiles with said annotations

tardy delta
#

is the sender null?

#

idk

lavish hemlock
#

Hm you should still be able to cast null

tardy delta
#

i guess

#

ye than you just end up wit null

lavish hemlock
#

Yeah but instanceof also supposedly performs null-checking

tardy delta
#

is he using instanceof πŸ‘€

lavish hemlock
#

So null isn't an instanceof String, but it can still be cast to String

#

null in Java has some of the weirdest fuckin' semantics

#

I imagine it only works this way because of how null pointers work in low-level langs like C and C++

#

(e.g. you can cast a null pointer since it contains 0 information anyway - but good luck trying to use it)

modest garnet
tardy delta
#

wew can use var now on java 16

lavish hemlock
#

Yeah that's been a thing since Java 12 iirc

tardy delta
#

excited

spiral light
#

using var is such a mess O.o why should i use var when i could use Object already (and thats messy too) `?

lavish hemlock
#

Because Object and var have different semantics

#

Object constrains the type of the value

tardy delta
#

var is like const in js but without the final

lavish hemlock
#

When you make a variable an Object, you have to cast to the proper type to use its members.

tardy delta
#

it needs direct initialisation right

lavish hemlock
#

MEANWHILE

#

var matches the type of the right-hand of the variable.

#

e.g.
var s = ""
is not Object s, it's String s

#

That is type inference.

#

Anyway it exists because people don't like typing long class names twice

#

e.g.
MySuperLongClassName n = new MySuperLongClassName();

#

Like, you can reasonably understand the type of that variable, right?

#

It doesn't need to be repeated for ceremony.

tardy delta
#

var a = 1; var b = a;

lavish hemlock
#

var n = new MySuperLongClassName();

tardy delta
#

var n = new Maow();

#

n.eat();

lavish hemlock
#

Oh yeah btw it solves the issue of uhh

#

Always declaring interface types on the left

#

Which is primarily if you-

#

okay then

tardy delta
#

😳

lavish hemlock
#

Which is primarily if you switch out the types on the right

#

I wish Java just had a val tho :p

#

final var is still pretty gross

tardy delta
#

just const

#

its already reserved keyword so why not

vale ember
#

const is short, but is easy to different from var, so +++++++++++++++

lavish hemlock
#

Meh I like val more

vale ember
#

it's easy to misinterpret it as var and vice versa

lavish hemlock
#

I disagree

#

I've been coding in Kotlin for a long time

#

I have never once misread it as var

glossy venture
#

so that would be a certified bruh moment

lavish hemlock
#

Well

#

It wouldn't break your classes

#

Just your sources :)

glossy venture
#

no shit

lavish hemlock
#

In the land of the JVM, there is no such thing as a restricted identifier.

glossy venture
#

yeah because variable names dont exist at runtime

#

or do they

#

idk

#

i dont think so

vale ember
#

they're replaced with var1 var2 and so on

tardy delta
#

oh

lavish hemlock
#

They're not replaced with var1

glossy venture
#

when you decompile them

vale ember
#

if you decompile

lavish hemlock
#

They actually

#

don't exist

#

Decompilers will give them names

glossy venture
#

but it depends on the decompiler

glossy venture
lavish hemlock
#

But variables are essentially just instructions

vale ember
#

do argument name exist?

lavish hemlock
#

You have stack variables and local variables (essentially registers)

tardy delta
lavish hemlock
#

You must compile with -parameters to keep parameter names.

vale ember
lavish hemlock
#

Because that's what the reflection lib will return in place of them

#

You can check with Parameter::isNamePresent()

lavish hemlock
#

They are just represented as values that are used in operations.

#

You have a string, that's just an LDC (load constant) instruction

#

LDC will push a constant value to the stack (e.g. a class literal like String.class or a string "")

#

And then further instructions will use the values on the stack

#

You also have the ILOAD, FLOAD, ALOAD, ISTORE, etc. instructions

#

Which will store values into locals

#

Which also don't have names and are differentiated by index

#

e.g. ILOAD_0 will store the value at the topmost stack index at the local index 0

#

Sorry no

#

I meant ISTORE_0

#

ILOAD_0 retrieves that value from local index 0, and pushes it to the top of the stack.

vale ember
#

wtf is internal in itemstack tostring?

lavish hemlock
#

idk lol

#

But yeah there are some ways to keep local variable names and type information

#

There's the method attributes LocalVariableTable and LocalVariableTypeTable

vale ember
lavish hemlock
#

Uhh it looks like Base64

#

It's probably used to store like

#

properties and shit

#

Bc if you notice, it's actually part of the ItemMeta

vale ember
#

how can i get rid of that shit?

lavish hemlock
#

idfk lol

vale ember
#

it's cause equality test to fail

#

tho theyre equal

lavish hemlock
#

How are you comparing them?

vale ember
#

stack.equals(single(event.getCurrentItem()))

#

single just clones the item stack and set's the amount to 1

#

can nbt be the reason?

lavish hemlock
#

Possibly

vale ember
#

via nms not pdc?

lavish hemlock
#

I don't know enough about stack comparisons :/ sorry

eternal oxide
#

have you tried the simple test? stack.isSimilar(event.getCurrentItem())

vale ember
#

no, but probably the problem is in nbt ill test

#

yeah the problem was nbt

stray crescent
#

I'm using ShockByte as server host and it has built in "startup" paremeters, but what if I wanted to add my own.

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paperclip.jar nogui
dusk flicker
#

You would need to ask them

#

but you really shouldent need to add your own

tardy delta
#

a record generates hashcode and equals method too right?

dusk flicker
#

Unless you can edit them, that is

stray crescent
#

Okay

dusk flicker
#

(You should also be in #help-server, rather than development)

blazing scarab
tardy delta
#

my file became just one line...

vale ember
tardy delta
#

right

#

i could put all my records in one class lol

#

new Utils.Home()

#

it sucks ye but having 20 files with one line..

vale ember
blazing scarab
#

records is a great addition

#

though it breaks encapsulation sometimes

tardy delta
#

already saw people doin this

sonic cosmos
#

hi, how i can send arraylist in player#sendMessage()?

tardy delta
#

iterate over the list and send every string

#

assuming its a string list

#

list.forEach(player::sendMessage) fancy kekw

sonic cosmos
#

thanks!

tardy delta
#

i hope that helped yo

blazing scarab
#

player.sendMessage(String.join("\n", list))

tardy delta
#

meh

#

you dont do System.out.println(String.join("\n", list)) either

vale ember
#

mine

player.sendMessage(list.toArray(String[]::new));

chrome ferry
blazing scarab
tardy delta
#

hashcode

chrome ferry
#

ohh of the record?

tardy delta
#

ye

chrome ferry
#

why would you need to know what anyway?

blazing scarab
#

because implementing hashCode and equals is necessary?

chrome ferry
#

i believe the equals just compares if the object is that class, then it just compares all the fields in it

vale ember
#

The default implementation of hashCode()

The record will use the hash code of all attributes inside the record

The default implementation equals()

The record will use all attributes to decide if tow records are equals or not

https://stackoverflow.com/questions/61719589/do-you-need-to-override-hashcode-and-equals-for-records

tardy delta
#

alr

zealous silo
#

hey, how do you get the 1.18.1 remapped spigot jar? Buildtools just gives me the bootstrap thing, am I missing something obvious?

vale ember
#

--remapped flag on buildtools AFAIK

zealous silo
#

yeah, that just gave me the bootstrap files in a jar though

vale ember
#

well, no clue then

blazing scarab
eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

vale ember
#

why d fuk

gritty urchin
#

Hey I am having a few issues with objects

#

I have this pet object

zealous silo
# eternal oxide ?bootstrap

yes, thank you, I did that. It's not the remapped jar, and it doesn't work with any NMS functions as far as I could tell

gritty urchin
#
private int type;

public Pet(String name, int type) {
        this.name = name;
        this.type = type;
    }

public String getName(Pet pet) {
return pet.name;
}```
eternal oxide
#

?1.18

undone axleBOT
gritty urchin
#

but whenever I create a new pet object and get its name

#

it returns null

tardy delta
#

saw that lol

zealous silo
#

good 4 you

#

I'm tired, lol

gritty urchin
#

try this?

zealous silo
#

nah

gritty urchin
#

why did u delete that lmao

zealous silo
#

because it didn't answer the question

tardy delta
#

he said this.name but you want the name of the other pet

zealous silo
#

exactly

gritty urchin
#

yeah it returns null

tardy delta
#

why not creating a normal getter?

gritty urchin
#

whats not normal about that getter

blazing scarab
#

thats not python

#

it shoudlnt take any arguments

zealous silo
tardy delta
#

that is takes another pet as parameter

#

either make it static or make a normal getter

gritty urchin
#

ur not meant to make getters static lmao

#

static abuse

zealous silo
#

yes, but if you use a function to get a field from an argument, it's not a getter

tardy delta
#
static String getPetNameFor(Pet pet) {
  return pet.name;
}```
#

doesnt make any sense

tardy delta
#

im wondering what he is doing

gritty urchin
#

I create a pet object

zealous silo
gritty urchin
#

I am trying to get its name

zealous silo
#

yes

tardy delta
#

then create a getter

#

?learnjava

undone axleBOT
gritty urchin
#

lmao

#

i think ur the one who needs to learn java

#

buddy

blazing scarab
#

do you know how classes look like in python

tardy delta
#
public String getName() {
  return name
}```
zealous silo
#
return this.name;
}
tardy delta
#

lol

zealous silo
#

that's a getter

zealous silo
tardy delta
#

lets check if im not in the python server

#

nope i am correct 🀑

zealous silo
#

Stop spamming then

blazing scarab
#

Stop playing a moderator

zealous silo
#

With topics irrelevant to the point

#

Stop being an ass

blazing scarab
#

stop telling me what to do

#

Seriosly? I just wanted to say he did the classes simillar how it's done in python..

gritty urchin
#

?

#

ok

lavish hemlock
dusk flicker
#

it's always a shitshow

#

lol

torn shuttle
#

going from making mc plugins trying to follow best code practices to trying to do unity with best code practices feels like I'm suddenly committing some sort of war crime

lavish hemlock
#

Exactly how I feel when I try to get away from Java

torn shuttle
#

like wtf is [SerializeField] private int People { get; set; } = 0; even

zealous silo
#

Going from c++ to java feels like constantly committing warcrimes to be honest

torn shuttle
#

that field is private in one way but public in two ways

#

it's also sort of static but not really

#

and a singleton but not really

#

and thus the race begins, can I make a game before unity gives me an aneurysm

#

oh of course a public field with a getter is actually private...

deft forum
#

anyone know how to get my main file's options from another file?

zealous silo
#

huh?

deft forum
#

how can i access things from another file

zealous silo
#

oh

#

either use the public modifier and get it from an instance of that class, or, if applicable, use a static modifier

deft forum
#

can you translate to an existing language?

blazing scarab
#

learn java

zealous silo
#

I'm with Gepron1x here

#

I suggest you look up a youtube tutorial for basic java

#

not that I don't want to help, but they will explain it much better than I ever could

tardy delta
deft forum
#

i just did this and worked xd

tardy delta
#

private property wait

deft forum
#

wait

#

why i can't send messages here -.-

tardy delta
#

i see

deft forum
#

i just extended my main file xd

lost matrix
tardy delta
#

is = value the init value?

lost matrix
#

Yes its the initial value of that property

tardy delta
#

why a private property tho? for the serialisation?

lavish hemlock
#

Convention

lost matrix
#

No idea... Dont think a private property makes much sense unless you have to follow some sort of convention where fields are always to be replaced by properties.

tardy delta
#

weird 🀑

patent horizon
#

if i wanted to grab someones rank (prefix) through vault, would i use their chat module or permissions module

#

sorry

tardy delta
#

permissions duhh

patent horizon
#

brain fart

tardy delta
#

xd

#

Global warming is causing earth to be 2 degrees hotter than you, baby girl. Sorry

patent horizon
#

yus

tardy delta
#

using luckperms?

patent horizon
#

yes

tardy delta
#

ah i used the luckperms api

patent horizon
#

hm alr

deft forum
zealous silo
#

Spigot 1.18 remapped jar

#

and what is the problem

deft forum
#

the plugin doesn't start

zealous silo
#

what error does it throw

deft forum
#

its in my message

tardy delta
#

isnt it already started?

deft forum
#

idk

#

its in the plugins folder 1 time

zealous silo
#

that's the only error?

#

it doesn't throw anything else?

deft forum
#

yessir

tardy delta
#

have you tried stropping and starting your server again?

deft forum
#

my plugins folder only includes my plugin's jar and plugin metrics

zealous silo
#

yeah

#

try restarting the server

deft forum
#

i did it already

#

i tried it one more time

sterile token
#

Im planning to make a library for spigot, it will contains many features. For example Chat, File, etc would do you recommend me to do it as multi module project?

Library - Main project
-> Chat - Chat related things
-> File - File related things
-> Api - Each module shaded inside

deft forum
#

there is the same err

zealous silo
terse ore
#

How do I check if the player has the server's resource pack or not?

deft forum
#

nope

#

still the same error

sterile token
sterile token
#

Why use that pages? its better to use

?paste

deft forum
#

what is ?paste?

#

πŸ˜„

sterile token
#

The command for getting the paste md5 link

sleek pond
#

?paste

undone axleBOT
sterile token
#

If you wanna send code i recommend using that link

tardy delta
#

epic fail

sleek pond
#

Shhhh

sterile token
#

Im wrong or the bot sometimes doesnt work or have delay?

deft forum
#

i always used srcbin

tardy delta
#

might be your internet connection 🀷

sterile token
#

Try to use paste md5 its better cuz its have syntax format

tardy delta
#

it has a limited amount of characters you can paste iirc

#

πŸ™‰

tardy delta
#

wait is modules a java16 thing?

lavish hemlock
#

Nope

#

Java 9+

tardy delta
#

ooh

sterile token
#

I really like your kidness and you know a lot

lavish hemlock
#

My kindness?

sterile token
lavish hemlock
#

I beg to differ :p

tardy delta
torn shuttle
tardy delta
#

oh rip

#

is something like this possible?

record SomeRecord(UUID id, int playtime, long lastUpdate) {
  public SomeRecord(UUID id) { this(id, 0, 0L) }
}```
#

doesnt seem to work but maybe there is another way

blazing scarab
#

static methods tho

tardy delta
#

hmm ok

#

i was trying to make a record of a class

hexed hatch
#

I need to figure out what records are

ivory sleet
#

Immutable data carriers

tardy delta
#

always those difficult words duke

vale ember
#

what will happen if i damage a player with a negative amount like player.damage(-5)? will it throw exception. don't do anything or heal player with 5?

vale ember
tardy delta
#

it doesnt compile

vale ember
tardy delta
#

hmm

brave sparrow
#

Because that looks valid off the top of my head

tardy delta
#

wait when i havent written this() call yet it showed an error and now its gone

vale ember
tardy delta
#

right.. record fields are final..

brave sparrow
#

Yup

tardy delta
#

having alot of oneliners now

blazing scarab
#

becuase immutability is a good tone

tardy delta
#

new Utils.MyRecord() kekw

lost matrix
#

You dont. Editing an already compiled jar is really difficulty and will not work in many cases.

vale ember
crimson terrace
tardy delta
brave sparrow
sacred mountain
#

i just added a whole new feature to my plugin and it worked first try

#

again

#

second time this has happened this weekend

#

im blessed

vale ember
tardy delta
#

i just added some db code and now i have four databases

blazing scarab
#

4 tables maybe

tardy delta
#

idk its just fun

#

ladies and gentleman we got 4 databases

#

smh..

sacred mountain
#

ok just added a command

#

this will work hopefully

brave sparrow
#

Otherwise you may be doing something wrong

tardy delta
neon minnow
#

I made my own command but if i dont use argument 1 it will say java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 in console. how do i check if its null so it wont throw the error

#

thanks

neon minnow
#

huh

tardy delta
#

?paste your code

undone axleBOT
neon minnow
#

Paste what....

#

I check if (args[1].isNotEmpty()) { }

tardy delta
#

the first element of a list, array, etc starts with index 0

#

no

#

check the length, so if (args.length > 1) {}

brave sparrow
tardy delta
#

idk 🀣

#

not in production yet lol

neon minnow
tardy delta
#

kotlin i guess

neon minnow
#

size

blazing scarab
tardy delta
#

what is that extension mv.db.mv.db

patent horizon
#

whats the easiest way to count the amount of capitals in a string?

lost matrix
lost matrix
#

You should always take a look at the ASCII table first

patent horizon
#

hm

#

thought it would be easier than just looping through each char

#

they have this in kotlin val uppercase = message.content().count(Char::isUpperCase)

lost matrix
#

A is 65 DEC and Z is 90 DEC
So you go over each char c and check if c >= 65 && c <= 90

lost matrix
#
  public long countUpperCaseLetter(String str) {
    return str.chars().filter(Character::isUpperCase).count();
  }
patent horizon
#

count() seems to be returning a long

lost matrix
#

Yes

#

thats why the method returns a long

patent horizon
#

hrm

#

how would i translate that into an integer

#

without blind casting ofc

lost matrix
#

If you are certain that there is no edge case with more than 2.1 billion upper case letters then you are free to just cast to an int.

patent horizon
#

this is for a minecraft chat message

#

so yes

glossy venture
#

a string with more than 2.1 billion characters isnt even allowed

#

the jvm prevents arrays of MAX_INT or longer i think

patent horizon
#

^

ivory sleet
#

count is essentially a long mapper (so you could use the mapToInt instead) and then it uses a reduce operation

gritty urchin
#

Hey

#

how do I create a custom event

ivory sleet
#

create a class which derives Event

#

well

#

?event-api

#

?event

#

hmm

gritty urchin
#

cheers

ivory sleet
#

:p

gritty urchin
#

can someone explain Handlers

#

to me

#

what does that mean

ivory sleet
#

its just a class which stores the listeners

patent horizon
#

is ignoreCancelled used in the sense that you only want your event to be run if other plugins/classes haven't cancelled it already?

ivory sleet
#

mhm

midnight shore
#

Is there a way to set data to a placed block?

ivory sleet
#

elaborate

lost matrix
midnight shore
#

Sorry I don’t know what do you mean, what’s a TileState?

lost matrix
#

Furnace, Hopper, Dispenser etc

midnight shore
#

Oh

#

Isn’t there any API for having a PDC for blocks?

lost matrix
lost matrix
#

Unless its a TileState

dusk flicker
#

?eventapi

undone axleBOT
dusk flicker
#

Conclure ^

midnight shore
#

I remember Jeff Media had an API for this

#

But I cannot recall how is it called

lost matrix
#

I wrote one with MongoDB and one that use the PDC of the chunk containing the Block.

neon minnow
#

val playeruid = Bukkit.getPlayer(args[1]).getUniqueId()

'getPlayer(String!): Player!' is deprecated. Deprecated in Java

This is depreciated in java, i want to use string name to player's uuid

Thanks

dusk flicker
#

check the javadocs

lavish hemlock
#

If it's 1.14+, it uses PDC

midnight shore
lost matrix
dusk flicker
#

you could have just asked alex lol

midnight shore
opal juniper
brave sparrow
hybrid spoke
midnight shore
opal juniper
#

oh its just a PDC

lost matrix
tender shard
#

oh my cbd lib

lost matrix
# tender shard wdym?

You can use the relative x, y and z coordinate of a Block within a chunk

    final int relX = (block.getX() % 16 + 16) % 16;
    final int relZ = (block.getZ() % 16 + 16) % 16;
    final int relY = block.getY();
    return (relY & 0xFFFF) | ((relX & 0xFF) << 16) | ((relZ & 0xFF) << 24);
tender shard
#

I also didn't see a reason to turn the coordinates into a single number since namespacedkeys use strings anyway

lost matrix
tender shard
#

it's just this

#
    /**
     * Gets a String-based NamespacedKey that consists of the block's relative coordinates within its chunk
     *
     * @param block block
     * @return NamespacedKey consisting of the block's relative coordinates within its chunk
     */
    @NotNull
    private static String getOldKey(@NotNull final Block block) {
        final int x = block.getX() & 0x000F;
        final int y = block.getY();
        final int z = block.getZ() & 0x000F;
        return String.format("x%dy%dz%d", x, y, z);
    }
#

yeah could be done a bit more efficient but that would break existing plugins. e.g. oraxen is using it since months

#

they wouldn't like it being changed now

#

Bukkit.getPluginManager().registerEvents

lost matrix
#

?eventapi

undone axleBOT
midnight shore
#

Implements Listener, in the main class on OnEnable. Bukkit.getPluginManager().registerEvents(this, new ClassName());

sterile token
#

Im doing an multi module project on maven. I wonder some recommendations about doing the api.

Api-Module
File-Module - Require Api-Module

How would need to be the api, for accessing the getPlugin() method from my api interface

tender shard
#

what would you use? concat? stringbuilder?

midnight shore
#

Np

lost matrix
hybrid spoke
tender shard
#

alrighty

lost matrix
hybrid spoke
#

lets see

sterile token
blazing scarab
#

Format is very powerful

hybrid spoke
tender shard
#

even if String.format uses a stringbuilder, it still has to parse the format string

brave sparrow
#

It’s deprecated as a warning, it doesn’t break anything

lost matrix
# hybrid spoke bet not

A Formatter which uses a BufferedWriter. Looks like it actually creates quite a bit of objects internally.

tender shard
#

I bet this is the fastest πŸ˜„

return "x" + x + "y" + y + "z" + z;
hybrid spoke
#

this will junk the Stringpool

#

if you call it many times

lost matrix
# neon minnow 1.8.8
  1. Dont use versions this old
  2. It deprecated because you should never refer to a player using his name. Only by his UUID.
hexed hatch
#

Has anyone found a way to disable dolphin despawning? Giving them the persistence required tag does not work

lost matrix
tender shard
#

well anyone feel free to PR if anyone doesn't like String.format πŸ˜„

tardy delta
#

why is there no "x" * 5 in java πŸ₯Ί

lost matrix
#

You are missing an argument

dusk flicker
#

learn the api

tender shard
#

look at the docs

hexed hatch
#

learn java

lost matrix
#

?eventapi

undone axleBOT
dusk flicker
#

?learnspigot

#

need that

tender shard
#

?javadocs

#

?javadoc

dusk flicker
#

?jd-s

undone axleBOT
tender shard
#

yeah so just check the docs, it tells you what parameters a method expects

dusk flicker
#

or just hover over the error, it prob tells you exactly what you need to do

tender shard
#

in this case, a plugin and a listener

blazing scarab
#

not requiring you to use strings

lost matrix
tender shard
#

PDC always uses namespacedkeys which in turn use strings

blazing scarab
#

ikr

lost matrix
#
String.valueOf((relY & 0xFFFF) | ((relX & 0xFF) << 16) | ((relZ & 0xFF) << 24));

;D

blazing scarab
#

NamespacedKeys werent meant to hold any sort of information - thats jusr an identifier

tender shard
sterile token
#

Is there any good tutorial that talks about practices when designing Jar apis with examples??

lost matrix
tender shard
#

also it might break if some time we can build up to Integer.MAX_VALUE height πŸ˜„

blazing scarab
#

i'm thinking about a short array with size 16 * 16 * 256

#

Where short is a key

tender shard
#

even right now we have more than 256 height

tender shard
blazing scarab
#

And a Short2ObjectMap<PersistentDataContianer>

tender shard
#

so I didnt use them

grim ice
#

lol imagine they do that tho

lost matrix
#

It uses 16 bits for the height. Should be plenty. 65k

grim ice
#

best way to destroy game

tender shard
#

there's probably some 1.8 mod that allows it lol

tender shard
lost matrix
#

fine. Add a sign bit and be happy with +/- 32k

blazing scarab
#

Whats the world max height now?

tender shard
#

yeah I could have done that, true, but I don't wanna break oraxen now πŸ˜„

#

and as said, it uses strings anyway, so doesn't really matter imho

lost matrix
#

I think the theoretical limit that can be stored in the new chunk format is 2k

tender shard
#

but

#

individual worlds can have individual worldheights

#

so check WorldInfo#getMinHeight and WorldInfo#getMaxHeight

blazing scarab
tardy delta
#

hehe my cat laying next to me while coding

tender shard
hybrid spoke
#

send pussy pic

tender shard
#

I can send some cock picks next time I visit my chickens

tardy delta
tender shard
#

pet it

#

now

hybrid spoke
tardy delta
#

he is nearly sleeping

hybrid spoke
#

and a weird pillow

dusk flicker
#

cute cat

tardy delta
#

ye πŸ₯²

dusk flicker
#

google

hybrid spoke
blazing scarab
tender shard
tardy delta
#

he was sitting on my keyboard first and now hes there πŸ₯²

tender shard
#

it would be way funnier if google would be called gnoogle

dusk flicker
#

GNOODLE

hybrid spoke
#

googel

tender shard
#

gnoodle sounds like gradle lol

tardy delta
#

gnoogel

sterile token
dusk flicker
#

goodle

tardy delta
#

gnoogel it

hybrid spoke
tender shard
#

yeah verano

#

just gnoodle it

dusk flicker
#

no no, just gnoogel it

tender shard
#

snorkel

dusk flicker
#

bong it

sterile token
quiet ice
#

Usually you'd combine impl and api

dusk flicker
#

actually that could be bad lmao

hybrid spoke
# dusk flicker bong it

i dont understand bongs. everytime i take a sip of it at a party everyone is looking weird at me

sterile token
#

I have read the api class should be an Interface

dusk flicker
#

I still love we have this command

quiet ice
#

You'd probably only need the Classloader

dusk flicker
#

?bing

undone axleBOT
tender shard
#

wtf

dusk flicker
#

lmao

quiet ice
#

API classes can be anything, it depends on what the API is

hybrid spoke
#

but fr why didnt they name bing "bong"

dusk flicker
#

JUST BONG'IN IT

quiet ice
#

If API and impl is strictly the same, no need for useless abstraction, it is isn't then interfaces can be good but needn't be

hybrid spoke
#

JUST BANG'IN IT

blazing scarab
#

Please stop countinuing that unfunny joke

sterile token
dusk flicker
#

Spigot

grim ice
#

WHO USES BING

#

other than win11 weirdos

dusk flicker
#

if I recall I asked for that command lol

dense geyser
#

Maven project content hiding

hybrid spoke
quiet ice
midnight shore
#

Is it possible to make Emotes in minecraft using like ArmorStands? If yes, how can I interpolate between two different poses?

quiet ice
#

While the API package mostly contains interfaces, it also contains classes (mostly to hold the values of the interfaces, similar the Bukkit class in Bukkit) and the same applies to the impl package which contains a few interfaces (while still having mostly classes)

#

But it really depends on what you want to achieve

blazing scarab
#

It is always good to separate contract from implementation

hybrid spoke
quiet ice
#

Sometimes it is just unnecessary

sterile token
quiet ice
#

See fabric and forge, they don't have anything remotely similar to bukkit

midnight shore
blazing scarab
#

Because those are mod loaders, not stable apis

#

There's Fabric API though