#help-development

1 messages Β· Page 1976 of 1

grim ice
#

u wanna make a variable empty

#

?

tender shard
#

int myNumber = 3;

sacred mountain
#

chrome extension, css and js editor for a specific webpag

tender shard
#

Player somePlayer = Bukkit.getPlayer("name");

#

etc

sacred mountain
#

you can customize a webpage

#

for ur own liking

grim ice
#

idk css or js

#

so rip

sacred mountain
#

i can give you the code for css and js

#

if yuou want

tender shard
#

a PlayerProfile obviously

#

?learnjava

undone axleBOT
grim ice
#

what do u want to do

sacred mountain
tender shard
#

Object object = someObject
String string = someString
PlayerProfile profile = somePlayerProfile

#

no

sacred mountain
#

put in the corresponding ones when u isntall the extension

tender shard
#

you need to learn basic java

#

?learnjava

undone axleBOT
grim ice
#

ty light

tender shard
#

that's why I sent 5 links

#

okay I will explain it quickly

#

every Object in java has a specific class associated

grim ice
#

mfn do u srsly think anyone will listen tbh

tender shard
#

e.g. String is a class

#

that represents, well, text etc

#

your have a custom class called PlayerProfile

sacred mountain
#

to run a method inside a class from my oneable can i do this:

new TestClass().testMethod();
tender shard
#

so if you declare a variable called "profile" and say it's of the type PlayerProfile, it has to be an object that is either of class PlayerProfile, or any class that extends or implements PlayerProfile

sacred mountain
grim ice
#

but

#

prob need

#

()

tender shard
#

no

#

it can also be a subtype

sacred mountain
lost matrix
#

Variable without a value:

Player player = null;

Variable "without" a type nor value:

Object object = null;
grim ice
#

so (new TestClass()).testMethod();

sacred mountain
#

o ok

tender shard
#

Car car = new Mercedes(); // OK
Car car = new Human(); // No

lost matrix
#

Thats why i added quotes.

grim ice
tender shard
#

you WILL HAVE TO LOOK at the basic java tutorials or you won't understand anything

grim ice
#

It has a type but unknown atm

tender shard
lost matrix
tender shard
#

var is just short form

#

var asd = new WhatEverClass()
is the same as
WhatEverClass asd = new WhatEverClass

lost matrix
grim ice
#

o

#

ic

tender shard
#

same applies for "val" except that it's also final then

grim ice
#

kotlin in java uwu

lost matrix
#

The context decides the type. Thats why var x = null; is not valid java because the type can not be determined from the context.

grim ice
#

tbh i like how intellij draws that ovelay

#

so if u type

#

var x = new Integer();

#

intellij draws

#

var x: Integer = ...

lost matrix
#

Yeah it has some nice features like that. Same goes for parameters or call chains.

tender shard
#

nah it actually overlays an error message πŸ˜›

grim ice
#

you're unfunny but HAHHAHA

grim ice
#

get the correct import, boy

#

and why is ur maven bar

#

there

#

wtf

lost matrix
#

Nice to know what type a chain has at every moment

tender shard
desert loom
#

I recently installed IntelliJ and the only thing I don't like is that, by default, it formats single line methods on the same line. (for enums)

grim ice
tender shard
tender shard
#

it's called auto fold or sth like that

desert loom
#

yea I know. I just need to find the option somewhere

grim ice
lost matrix
grim ice
#

and I split my classes into small ones

#

is that wrong

desert loom
#

do you know the name of the option? if not, I'll just find it on google

grim ice
#

I mean it probably depends

tender shard
grim ice
#

Unrelated question but, for example If I wanna do some code that changes durability of an item and does some cool magic on it

#

can I have it on a utility class

#

i find it ugly to have methods not really related to my class purpose on my class, since the method is being used in other places too

#

its not supposed to be only for the class

tender shard
grim ice
#

Alright good that's what I do

#

btw are ClassLoaders worth to learn

tender shard
#

if you need custom ones, yes

#

if not, only if you are interested in how they work

grim ice
#

I don't, but when I asked for topics I can use to progress conclure suggested ClassLoaders

#

I mean i asked for advanced topics

tender shard
#

I never needed custom classloaders so I've never looked at them

grim ice
#

I just learn stuff not cuz i need them

#

i want to get to a good level in the next 5 months (my first year with java is about to end :o)

lost matrix
#

Very usefull: Properly learn how to use streams
It teaches you so much about lambdas, functional programming, scopes and so on.
They are a gateway to understanding CompletableFutures for example.

tender shard
tender shard
grim ice
#

Well I do know somehow an amount of using streams

quaint mantle
#

😘

grim ice
#

Why would you make a class for that

quaint mantle
#

You would have to make a class for utility as well

grim ice
#

which contains other methods too

#

they're stateless though

quaint mantle
#

you can add other methods to the BreakableItem too and rename it

lost matrix
quaint mantle
#

That's an object oriented way

grim ice
#

my point is

#

the naming and the method kinda misleads honestly

tender shard
#

I use this to damage items

    /**
     * Damages given ItemStack by specified amount
     * @param amount damage amount to be applied
     * @param item ItemStack to be damaged
     * @param player Player who damaged the item
     */
    public static void damageItem(int amount, final ItemStack item, @Nullable final Player player){
        final ItemMeta meta = item.getItemMeta();
        if(!(meta instanceof Damageable) || amount < 0) return;
        final int durability = item.getEnchantmentLevel(Enchantment.DURABILITY);
        int k = 0;
        for (int l = 0; durability > 0 && l < amount; l++) {
            if (JeffLib.getRandom().nextInt(durability +1) > 0){
                k++; 
            }
        }  
        amount -= k;
        if(player != null){
            final PlayerItemDamageEvent damageEvent = new PlayerItemDamageEvent(player, item, amount);
            Bukkit.getServer().getPluginManager().callEvent(damageEvent);
            if(amount != damageEvent.getDamage() || damageEvent.isCancelled()){
                damageEvent.getPlayer().updateInventory();
            }
            else if(damageEvent.isCancelled()){
                return;
            }
            amount = damageEvent.getDamage();

        }
        if (amount <= 0)
            return; 
        
        final Damageable damageable = (Damageable) meta;
        damageable.setDamage(damageable.getDamage()+amount);
        item.setItemMeta(meta); 
    }
grim ice
#

since like an itemstack is already breakable

quaint mantle
desert loom
tender shard
#

look at the last 3 lines of the method I sent

grim ice
#

Well is it worth to make a class for every method

tender shard
#

that's the "builtin" way

tender shard
desert loom
#

oh I didn't see that.

grim ice
#

If im gonna make a class just for one method

#

I can just put it in a utility class

lost matrix
desert loom
#

I think that's to replicate vanilla unbreaking enchant.

quaint mantle
#

depends. You should keep classes as simple as possible, 5 methods ideally. Single Responsibility

grim ice
tender shard
grim ice
#

return; is silent, it wont tell you anything

tender shard
#

i've never needed to know whether it was damaged so it's void rn

grim ice
#

I assume you would want to return a boolean so you know the outcome of the method

tender shard
tender shard
lost matrix
tender shard
#

I've not really looked at it

#

no idea what their intention was. I just accepted the PR

#

@tawdry scroll

#

why are you looping over the durability level

tawdry scroll
#

Which?

tender shard
#

damageItem method

#

imagine people having unbreaking level 100k

tawdry scroll
#

Oh thats how its done in mc

tender shard
#

oh ok

#

then I guess it's fine

tawdry scroll
#

You can check to confirm

tender shard
#

nah I believe you lol

#

if vanilla does it like, it should be kept like that

#

so that it will behave exactly the same

#

people who enchant their stuff with 10000000 levels are stupid anyway

grim ice
#

PRing is such a long operation tbh

tawdry scroll
#

No i mean really
Can be mistake from me in reading the nms code

tender shard
grim ice
#

also when did u make that class

#

just wondering

tender shard
#

no idea

grim ice
#

btw

#

ConfigurationSections

#

they dont read the contents from the config

#

everytime

#

you use them right?

tender shard
#

yes, so?

young knoll
#

Correct

grim ice
#

so they store it

tender shard
#

of course

young knoll
#

Mhm

grim ice
#

cool

tender shard
#

pretty bookish scenario

lost matrix
tender shard
#

nothing

young knoll
#

It makes it unassignable

#

Not immutable

tender shard
#

well let's rather say

grim ice
#

how about I make my config like this:

Config:
  example: xd
  example2: lol
  exampleList:
    - "xd"
    - "xd1"

then i can get a configuration section Config, then just access it when i wanna use my config

tender shard
#

a final variable can be assigned once or zero times

lost matrix
#

It makes the variable immutable. What it does not, is making the Object itself immutable.

grim ice
#

that would be better than using the FileConfiguration as a data structure, right?

#

or is it the same

young knoll
#

ConfigurationSection and FileConfiguration are the same

#

Behind the scenes anyway

grim ice
#

alright i'm an idiot then

tender shard
lost matrix
#

No you can use it wherever. The only thing you cant is re-assign a value to it.

grim ice
#

so I should just parse the values of the config and store it in a data class, right?

tender shard
#

a final variable is like a CD-R. You can read it many times but write to it only once

lost matrix
tender shard
#

well depends what you consider a crop

#

if you consider all ageables to be a crop, sure that's fine

#

fire

young knoll
#

You could easily just put the blocks you want in a set

lost matrix
#

CaveVines

grim ice
#

Bamboo, CaveVines, Cocoa, Fire

young knoll
tender shard
olive lance
#

vines bamboo and cocoa i would consider crops

#

not fire tho

#

why is fire ageable

tender shard
#

or it will die when it's full age

lost matrix
tender shard
olive lance
#

ah makes sense

tender shard
grim ice
#

another one is

#

actually nvm thats the solution u would ever need

olive lance
#

Hmm

#

theres a tag LOGS and LOGSTHATBURN

#

what logs dont burn?

young knoll
#

Nether ones

tender shard
grim ice
#

nether

olive lance
#

ah yea

#

forgot there is trees now

grim ice
#

coll i had a dream of you btw

tender shard
#

so LOGS includes LOGSTHATBURN

grim ice
#

i actually did

tender shard
young knoll
#

Kinky

lost matrix
tender shard
#

I doubt it

grim ice
#

I had a dream of a classmate in my class telling me his discord being yours

#

lol

lost matrix
#

If you are speaking of the placed Block then yes.

grim ice
#

wait

tender shard
#

just plant a sapling and check with F3 screen

grim ice
#

and ur discord is Josh, not Coll?

olive lance
#

what blocks infinitely burn?

grim ice
#

my dream didnt know that

tender shard
#

erm

#

netherrack*

olive lance
#

ah perhaps

tender shard
#

you can check with F3 screen

olive lance
#

there is 3 separate tags for blocks that Infinitely burn in end, nether, and overworld

tender shard
#

the stupid fandom mc wiki is too narrow

#

the stupid "popular pages" overlay overlays the actual content

grim ice
#

LMAO

#

nice website design

tender shard
#

yeah one can click on "expand" at the top

#

but

#

why

#

why doesn't it just use full width by default

solid cedar
#

at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.16.5.jar:git-Paper-792]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:85) ~[patched_1.16.5.jar:git-Paper-792]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:73) ~[patched_1.16.5.jar:git-Paper-792]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:61) ~[patched_1.16.5.jar:git-Paper-792]

at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:47) ~[patched_1.16.5.jar:git-Paper-792]

at main.kappelo99.zlecenia.Bounty.bountyGUI(Bounty.java:676) ~[?:?]

at main.kappelo99.zlecenia.Bounty.onCommand(Bounty.java:514) ~[?:?]

at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-792]

... 19 more``` What is this?
grim ice
#

?paste

undone axleBOT
lost matrix
lost matrix
#

You are calling: new ItemStack(null)

tender shard
#

yeah probably

#

or new ItemStack(someVarThat'sNull)

young knoll
#

new null(null)

tender shard
grim ice
desert loom
solid cedar
tender shard
#

that's the internal ItemStack validator

tender shard
#

ez

grim ice
#

and you prob should use descriptive variable names

#

what is 'list'

#

tbh working on client side applications requires way more java knowledge

#

since if you make something laggy

#

people are gonna suffer

#

but most servers have better System Specs than Users'

tender shard
#

if what's a boolean?

grim ice
#

Yes, indeed I'm very glad I don't have to pay to use an IDE, or use a text editor

tender shard
#

null.isLoaded()

#

no

#

if(profile == null)

#

?learnjava

undone axleBOT
grim ice
#

I mean CLion is paid

#

Eclipse sucks imo

tender shard
#

skrubs?

#

no idea what skrub means

#

people don't tell you to ?learnjava to mock you

grim ice
#

means noob

tender shard
#

they tell you because you NEED the basics to know why your stuff doesn't work

solid cedar
#

at main.kappelo99.zlecenia.Bounty.bountyGUI(Bounty.java:690) ~[?:?]

at main.kappelo99.zlecenia.Bounty.onCommand(Bounty.java:514) ~[?:?]

at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-792]

... 19 more``` I changed some code but it isn't work
tender shard
#

noone means to offend someone by doing ?learnjava

tender shard
tender shard
#

because itemstack does not implement itemmeta

grim ice
#

I was made fun of for not learning java on my first weeks

tender shard
#

you have to use getItemMeta() and cast that

grim ice
#

so that isn't totally right

tender shard
#

not because you haven't done so yet

grim ice
#

people nowadays have it a lot easier tbh

tender shard
#

I still remember learning java using actual books lol

#

oh wait no

#

wasn't java

#

it was C

lost matrix
#

I actually did what i always tell people not to do: I learned java using spigot only at first.

solid cedar
#
            SkullMeta headMeta = (SkullMeta) head.getItemMeta();``` here is error or not?
young knoll
#

What is that

tender shard
#

but yeah if you do not why you get a nullpointerexception when you try to call a method isLoaded() while the object you are calling it on is null, then sorry but you have to learn the basics first

young knoll
#

The modern player head

#

But legacy metadata

grim ice
#

no one went and learnt java

grim ice
#

its fucking boring to do without an api to spice it up

next stratus
quaint mantle
next stratus
tender shard
grim ice
#

dunno, but when i was getting screamed at to learn java, i found it boring

next stratus
#

idk how an api would help

lost matrix
grim ice
#

For me. even when I chose to learn java before spigot, when I go to java related servers I get made fun of

tender shard
grim ice
#

since the people there know me from here

#

lol

tender shard
#

yes, if you do not have any profile, you cannot checker whether it's loaded

#

it's like saying hello to a neighbour if you don't have neighbours

tender shard
#

BettanationsNeighbour.sayHello() can't work if you don't have neighbours

next stratus
#

I regret not learning plain java first

tender shard
#

profiles and players can never be cast to a boolean

#

a boolean is a primitive type represnting "yes" or "no"

#

a player is not "yes or no"

next stratus
grim ice
tender shard
#

what do you mean with "check a specific person"

trail pilot
#

Uhm which version should i use for 1.8 to 1.18?

tender shard
rough drift
#

i forgot how to run methods that require to be on the main thread from async, how do i do that again?

trail pilot
#

i dont know guys i never made a plugin from 1.8 to 1.18 lel

tender shard
rough drift
#

ty

tender shard
trail pilot
tender shard
#

the lowest version you want to support

trail pilot
#

but the api is changed

#

from 1.8 to 1.18

tender shard
#

yes of course it has changed

grim ice
#

Oh right I remebered

tender shard
#

but nothing was really removed

grim ice
#

I don't want to run buildtools for each version I wanna support for my plugin

#

(Im using nms)

#

do I just use

tender shard
#

you have to though

grim ice
#

Reflect

next stratus
trail pilot
rough drift
#

either reflection (don't) or use nms for each version (don't)

next stratus
#

I wish I knew how to import nms

tender shard
grim ice
hybrid spoke
#

what's NMS

tender shard
rough drift
#

the only time i used nms was to handle the packets a player sent right after they arrived

trail pilot
rough drift
grim ice
trail pilot
#

lemme change api and see if its broke it

rough drift
#

like CraftPlayer

tender shard
grim ice
#

aka motherless

next stratus
# tender shard what version?

Any, I just can't get my mind around how to import it. There's this real good api I want to use but I can't get it because the maven thing is messed up and the dev won't respond :/

tender shard
grim ice
#

SO WHAT DO I DO HELP

tender shard
grim ice
#

do i like

tender shard
#

then you have NMS

trail pilot
next stratus
tender shard
#

same

#

but probably you want to do a proper multi-version module setup

grim ice
#

fine ill use reflection

next stratus
#

i got that already

olive lance
#

wait when did CraftPlayer become a thing

next stratus
young knoll
#

Since forever

tender shard
#

so maybe... 14 years ago?

olive lance
#

ok i figured

young knoll
#

11 years

tender shard
#

oh ok

young knoll
#

Minecraft wasn’t around 14 years ago

eternal oxide
#

Player = Bukkit (API) CraftPlayer = CraftBukkit (Implementation)

tender shard
hybrid spoke
olive lance
#

didnt 1.0 release in 2009

#

or was that the beta

next stratus
young knoll
#

Beta was in 2009

hybrid spoke
tender shard
olive lance
#

i dont remember when i got it but it was 1.0 release

tender shard
#

born in may 2009

young knoll
#

Classic was may 2009

tender shard
#

alpha 1.0 = july 2010

young knoll
#

I also got it at 1.0

olive lance
#

end of 2011 i guess i got it

tender shard
#

beta 1.3 was released on my 16th birthday

olive lance
#

n i was like 10

#

my first mc world

trail pilot
olive lance
#

so nice

#

couldnt find any fkin sheep tho

lost matrix
#

lol may 2009. Means minecraft is older than most of the 1.8 community

tender shard
#

i dont understand why you want to support 1.8 anyway

next stratus
#

Wait, endermen came before the end?

olive lance
#

pvpreee

tender shard
next stratus
#

I didn't know that lol

trail pilot
rough drift
#

another quick thing, how can you check how many slots a player has free?

hybrid spoke
#

was there an ending before the end got added?

trail pilot
#

i tested the plugin and its work perfectly in newest version of spigot

tender shard
trail pilot
#

les test it in 1.8.8

next stratus
#

it's been almost 8 years since microsoft bought it?!

next stratus
#

I didn't know there were two other founders carl and Jakob

rough drift
hybrid spoke
olive lance
#

damn bro mojang kinda sold only 2.5b for minecraft?

hybrid spoke
#

i never killed the enderdragon by myself anyways

lost matrix
#

I still remember when the nether came out.
We rallied up in the basement and did a lan party through the night. Good times.

tender shard
hybrid spoke
#

but never never alone

tender shard
# rough drift k
    public static int getFreeSlots(Inventory inventory) {
        return (int) Arrays.stream(inventory.getContents()).filter(item -> {
            return item != null && item.getAmount() > 0;
        }).count();
    }
hybrid spoke
#

now i kinda wanna play minecraft survival

tender shard
#

oh wait

#

my method returns the non-empty slots

rough drift
#

yeah

#

it should be item == null || item.getAmount() == 0

tender shard
#
    public static int getFreeSlots(Inventory inventory) {
        return (int) Arrays.stream(inventory.getContents()).filter(item -> item == null  || item.getAmount() == 0).count();
    }
#

yeah, this

rough drift
#

almost as fast as you xD

lost matrix
#

is that even possible. I think not.

tender shard
#

not larger than 0

young knoll
#

You used to be able to get weird items with a red 0 for the stack size

#

Not sure if you still can

lost matrix
#

An item with the amount of 0 will automatically be nulled

tender shard
#

it was possible in 2012

young knoll
#

Then you should just be checking if it’s null or air

red sedge
#

Should I store player data in a file or in PDC

rough drift
tender shard
eternal night
#

also if you need that data offline or not

tender shard
rough drift
#

fair

quaint mantle
#

Pdc is not relational. It is impossible to get data offline without hacks and hard to wipe

tender shard
#

if you have large data, or data you need also when a player is offline, do not use PDC

#

otherwise I'd use PDC

tender shard
hybrid spoke
#

?pdc

rough drift
#

oh yeah

tender shard
#

it's like "proper NBT"

rough drift
#

just load the player.dat file

eternal night
#

smh don't call it nbt!

tender shard
#

a tiny string? or 20MB per player?

trail pilot
#

ok my plugin works perfectly in 1.8.8 to 1.18.1

tender shard
red sedge
#

i mean ig like 2-4 mbs of data at max

#

also i dont think i will need the data when the player is offline

tender shard
#

2-4mb is quite much

#

I'd not use PDC for that

eternal night
#

^

tender shard
#

imagine you have 100 players

#

then you have a 400mb players.dat file

#

doesn't sound very good lol

quaint mantle
tender shard
#

yep

red sedge
#

to be fair its just nbt

#

i dont see why there is just not an nbt option without nms

tender shard
#

no

quaint mantle
#

A relational database > just a file smh

tender shard
quaint mantle
tender shard
#

it's an API to save ANY type of data, using NBT internally

red sedge
#

yeah

#

i just dont see why not have a way to edit the nbt itself without nms

eternal night
#

I mean, who knows if mojang just moves to a new data format in 3 versions

grim ice
#

how to do
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); in reflection?

red sedge
#

maybe im missing smth but i dont see a reason to not have it

tender shard
quaint mantle
#

CraftEntity.class.getMethod("getHandle").invoke()

tender shard
tender shard
young knoll
#

You’d have to use Class.forName

quaint mantle
#

Have you ever heard of

#

Pseudo code

tender shard
#

I have but what you sent is valid java code

quaint mantle
#

ok??

tender shard
#

all my exams in school were asking us to write hand written pseudo code lol

#

it was also allowed to just "describe" the code you would have written

#

actually not a bad idea imho

eternal oxide
#

Thats good training

quaint mantle
tender shard
grim ice
#

wy

#

why

tender shard
#

since 1.17 there's mojang mappings

#

field, class and method names changes with every version

#

you can't use reflection for 1.17+

#

you could use it for 1.16 and below

#

you want to create one NMS module for every version now

grim ice
#

i love my life

#

so i have to build tools

#

for every mother fucking

quaint mantle
#

you kinda can with relfeciton-remapper, even using readable names...

grim ice
#

version

#

what the fuck

tender shard
quaint mantle
#

That's better than reflection. But even better is to not use nms at all

tender shard
#

but for many things you just have to use it

grim ice
#

im trying to copy an entity

#

so i have to use nms

olive lance
eternal night
#

if only there was like a fork of spigot that had a entity de/serializer

#

so you can easily copy an entity

tender shard
eternal night
#

if only people would use the fork :>

#

but I digress

olive lance
#

Yo what even is NBT

#

Actually

eternal night
#

there is always need for NMS at some point

tender shard
#

it's a binary data saving stuff thingy

eternal night
#

even if you PR functionality, older versions will not get the backport

tender shard
quaint mantle
#

Supporting older versions πŸ™„

olive lance
#

So what does it do

tender shard
#

I mean people also don't complain that MSFS2020 doesn't run on windows XP

eternal night
#

I mean, the dream is just maintaining your own custom fork where you can PR whatever API you need

tender shard
#

somehow it's only 13 year old MC players who still use 1.8

grim ice
#

@tender shard i dont get how u did it

#

can u explain

tender shard
#

no idea why the MC community is so reluctant to use supported software

eternal night
#

so you can click fast

tender shard
grim ice
#

Everything

tender shard
grim ice
#

what r u doing

olive lance
#

That gets answered every day

#

Lol

quaint mantle
#

1.8 clicks
1.12.2 performance

#

Thats all

tender shard
#

then there's one module per NMS version that implements this wrapper

#

that's basically it

quaint mantle
#

well "performance"

olive lance
#

I would beg to differ 1.12 offers better performance than 1.8

quaint mantle
#

Windows XP runs faster than Windows 10 you know

tender shard
#

the main reason why people still use 1.8 and 1.12.2 is they are still using "1:0" instead of "dirt"

olive lance
#

What

tender shard
#

they are using hundred years old plugins that never actually respected that all the "magic ids" were deprecated since 5 years

tender shard
#

and for "stone" you used "2"

olive lance
#

Oh yeah I didn’t realize what the 0:1 meant

tender shard
#

and for oak log you used "13:1" or sth, while birch was "13:2"

#

etc

olive lance
#

Stone is 1 tho I though t

tender shard
#

it was an example

olive lance
#

I remember stone brick is 98

#

Nether portal was 89 or 90..

tender shard
#

it was announced 5 years prior that this will be removed, but plugin devs didnt care

#

then 1.13 came and

#

boooom

#

all bad plugins died

#

that was also why I started uploading plugins - because ClickSort was dead

olive lance
#

I don’t think that’s the main reason people didn’t switch tho

#

Def clicking fast

tender shard
#

well there's so many plugins to restore old pvp

olive lance
#

What I really don’t understand

#

Is why 1.8 and not 1.7

#

Everyone used to love 1.7

#

And hated 1.8

#

Because block hitting

tender shard
#

erm why would one use 1.(X-1) if they could use 1.X

olive lance
grim ice
tender shard
tender shard
olive lance
#

You could right click and left click at the same time

tender shard
#

look at core/.../internal/nms

olive lance
#

With sword

#

1.8 removed that

#

And all the pvpers raged

tender shard
olive lance
#

But I guess if you said only 13 yos play 1.8 they prob don’t know about block hitting then

tender shard
rough drift
#

so, runTask does not run sync for some reason, so i tought about using scheduleSyncDelayedTask, with a delay of 0, would that work

tender shard
#

how would you block and attack at the same time

#

that makes no sense

olive lance
#

It was so cool

grim ice
#

nah man im not installing each version's build tools

olive lance
#

The sword would swing in crazy directions when you did it

tender shard
grim ice
#

ik

tender shard
#

latest buildtools can compile all versions

rough drift
olive lance
#

Look up a video of it and tell me it is not lit af

grim ice
#

i dont wanna download each

#

jar thingy

#

u got it

#

each version

eternal oxide
#

download?

tender shard
#

you have to build every version

grim ice
#

same thing

tender shard
#

no

#

it's different

grim ice
#

i dont wanna build

#

each version

eternal oxide
#

just write a bat file

grim ice
#

takes a long time

tender shard
#

well I also don't want to work but I have to to make plugins

#

I also wish I could just explain to intelliJ would I'd like to do but we aren't that far yet

grim ice
#

is there another way without nms to copy entities

tender shard
olive lance
#

Ok literally why is 1.7 not in buildtools I swear for the longest fn time nobody wanted to play 1.8. It was either kids who wanted to play latest version 1.9 or 1.7 for pvp. 1.8 literally nobody played

#

The worst update

#

Version *

tender shard
olive lance
#

1.18*

rough drift
tender shard
#

but they should at least be able to update within a year or two

#

so I guess supporting 1-2 versions behind is okay

#

after all windows 10 still is supported although win11 exists

rough drift
#

its more than a year old and people yet go like "i hab us becs unatiin laaaag" bro viaversion is there for a reason

grim ice
#

how to serialize entities

tender shard
#

same for debian 10 and debian 9

grim ice
#

i wanna serialize an entity

tender shard
#

I think paper can serialize entities

#

not sure though

grim ice
#

ok im installing pape

olive lance
#

Win xp do be fast tho

grim ice
#

no one uses pape

#

isnt there

#

a serializer

#

for anything

tender shard
grim ice
#

like Kryo

#

or XStream

#

idk

hexed hatch
#

What entity are you serializing

grim ice
#

all

hexed hatch
#

Ah

grim ice
#

all types of entities

tender shard
rough drift
grim ice
#

idc

tender shard
grim ice
#

if i make a paper plugin

rough drift
#

oh nice

grim ice
#

ill go down to 55%

#

from like 85%

hexed hatch
#

Paper api do be kinda sexy tho

grim ice
#

to 90%

rough drift
grim ice
#

im on the edge of raging tbh

hexed hatch
#

It’s even got entity ai support

tender shard
grim ice
#

anyways

rough drift
#

i made my ls plugin for 1.17 paper at first, got so many complaints had to port to 1.16.5 spigot, and yet i still get requests like "can you make a 1.14 version?"

grim ice
#

isnt there a way to serialize any object

olive lance
#

does viaversion let 1.7 players connect

tender shard
tender shard
#

viaversion is for future versions only

#

viabackwards is for old versions

rough drift
olive lance
#

the other one

#

viarewind

tender shard
#

and viarewind is for ancient versions like 1.7

olive lance
#

ive never used them

#

ahh so block hitting is still alive then >:)

rough drift
#

no

#

its dead

#

stop it

olive lance
#

thats what i was thinking of then

tender shard
rough drift
#

imo <1.16 should be dropped for everything

tender shard
grim ice
#

can i make my own entity serializer

rough drift
#

even then, 1.16 is a year old

tender shard
#

if I was md5, i wouldn't even have added the log4j fixes

rough drift
tender shard
#

I would have fixed log4j for 1.16+ and tell all others "well, update already"

grim ice
#

gets each field on the class, turns it into a hashmap

rough drift
#

yeah smort

grim ice
#

then

#

construct an entity

quaint mantle
#

And very time consuming

olive lance
#

It says if you want to support 1.7 on a proxy then you dont need legacy support but without a proxy you do? is that true

grim ice
#

from the hashmap

#

Yeah fuck it ill have all versions supported like that

#

and Ill make a library

#

for it

tender shard
olive lance
#

better support 1.7

olive lance
quaint mantle
#

You are still mirroring already existing functionality

grim ice
#

actually what if some versions didnt have a field

#

well if it doesnt have the field it will still work

#

i can do it

tender shard
quaint mantle
#

simply don't fuck and do reflection imo

tender shard
#

using it on all backend servers and NOT on the bungee is the recommended option

grim ice
#

o

#

how would i do it with reflect

olive lance
#

is via* a plugin or is that just talking about viaversion+rewind

quaint mantle
#

You'd need to do some fuzzy reflections

tender shard
grim ice
#

give me an algorithm, or psuedo code or some sort

grim ice
quaint mantle
grim ice
#

using spigot api

#

rn

#

lol

tender shard
quaint mantle
#

Dont rely on names, but analyze method return types and args at runtime

tender shard
#

it will get soooo messy that you could just directly use proper modules + mojang mappings

tender shard
quaint mantle
#

nothing has changed related to nbt in 1.17 and 1.18

tender shard
#

in 1.17 it's Player.playerConnection, in 1.18 it's Player.connection.connection

#

so there's an intermediary object

#

good luck doing that

grim ice
#

manya

#

can u explain in english how would i do it

olive lance
grim ice
#

i dont want code yet, ill try it on my own

quaint mantle
tender shard
olive lance
#

yea i will never bother with that

#

my server days are over

quaint mantle
#

Also 2hex pls provide a proper implementation for Paper

tender shard
grim ice
tender shard
#

as said in 1.18 it's player.connection.connection (two dots)

olive lance
#

closed my server when 1.9 dropped

tender shard
#

in 1.17 it's player.playerConnection (one dot)

#

so it's three-object-chain in 1.18

grim ice
#

still, how do i do it

tender shard
#

but only two-object-chain in 1.17

olive lance
#

cost like 3x as much to run the server when 1.9 came out

grim ice
#

do i like loop through the methods, get their return type, invoke them

tender shard
#

and also it's not called "connection" in either 1.17 or 1.18

grim ice
#

and store the name

tender shard
#

it's only called "playerConnection" in 1.16 and below

grim ice
#

with a class like a Triple

quaint mantle
tender shard
#

in 1.17 it's maybe .a and in 1.18 it's a.b. or sth

tender shard
quaint mantle
#

No

tender shard
quaint mantle
#

Classes names arent obfuscated

grim ice
#

mfn

tender shard
#

they are

#

unless you use mojang mappings

grim ice
#

r u talking about the thing we're talking about??

#

this is spigot not nms

#

im trying to serialize and deserialize an entity

tender shard
tender shard
grim ice
#

without nms

#

org.bukkit.entity.Entity

tender shard
#

you'll have to write your own serializer

grim ice
#

That iss what im doing

quaint mantle
grim ice
#

I need some guidance on it though, so I'm asking manya on a base idea on how to do it

tender shard
#

oh wow how the fuck did I end up on #4 on google

quaint mantle
#

As you can see it's net.minecraft.core.MinecraftSerializableUUID in Spigot

grim ice
#

how to get methods from an object

tender shard
grim ice
#

do I just .getClass()

tender shard
#

net.minecraft.core.SerializableUUID

#

Mojang

#

Spigot: net.minecraft.core.MinecraftSerializableUUID

grim ice
#

but the Bukkit entity class wont have the properties of the entity object

quaint mantle
#

Ikr

tender shard
#

that's different

#

that's not the same

quaint mantle
#

i see

#

not the point

tender shard
#

if you use reflection

#

you must use obfuscated

#

because that's the internal name

quaint mantle
#

Class names are not obfuscated especially

tender shard
#

well not obfuscated but renamed

#

and field names and method names are obfuscated

quaint mantle
#

so just use renamed class names in reflection?

grim ice
#

uhh

tender shard
#

okay to make this clear, let's say you have a method that sends any Packet<?> to a bukkit player

#

sendPacket(Packet<?> packet, Player player)

quaint mantle
#

we're not talking about packets

tender shard
#

how would you do that work for 1.16, 1.17 and 1.18 using reflection?

grim ice
#

not the class of the object including its properties

tender shard
#

I still have no idea what you are talking about though

tender shard
#

e.g. net.minecraft.world.entity.Creeper or however it's called

#

it will NEVER return a bukkit creeper

#

oh wait actually, bullshit

#

if you call it on a bukkit creeper, it will return the CraftCreeper class

#

all actually game related things in spigot are just interfaces, while the CraftThingies are the actual implemantation, and those are actually just wrappers for the underlying NMS class

#

Creeper (NMS) -> wrapped by -> CraftCreeper -> implemenets -> Creeper (Bukkit)

quaint mantle
hasty prawn
#

I think you're completely misunderstanding what he's saying.

tender shard
#

I think we are both talking about two completely different things and we both don't understand what each other is talking about

#

serializing / deserializing an entity as a whole object is simply not possible without NMS

#

how else would you be able to ensure them to have the same entityID and UID

long dew
#

hey yall so i have a minecraft server and i have an issue with mcmmo the players do not gain almost any xp and they cant enchant with the xp they have for some reason

next canyon
#

I'm working on an "offline bonus" system in which I need to subtract the OfflinePlayer#getLastPlayed with current time to know how much time has passed since his last login.
I would like to know when is this timestamp defined. Can I catch the old one on a player login ? or is it updated earlier ?

quiet ice
#

getLastPlayed prints the last time the player logged out iirc

#

Just beware that it might be decades ago if it is the first time the player played

trail pilot
#

finally uploaded my plugin lol

tender shard
tender shard
#

Bukkit.getOfflinePlayers()

quiet ice
#

Though idk really now

#

Eh, just try and see

tender shard
#

My suggestion is this:

next canyon
#

You would map all those timestamps on startup ? and update it on logout ?

#

Issue with such a way of doing it, is that i'm working with a large playerbase, around 100k unique

tender shard
#

tbh actually I'd do it totally different

#
  1. in PlayerQuitEvent save "logout-time" as PDC with current system milliseconds in the player object
  2. when a player joins, get their last-logout-time, and done
next canyon
#

what does PDC means

eternal night
#

?pdc

eternal night
#

smh

next canyon
#

Forgot to say I'm building against 1.8 API

eternal night
#

bruh

tender shard
#

ugh

#

yeah then you have to do some mysql stuff or save it to a yaml or sth else

quiet ice
#

I know that Paper for sure has a method to get last logout time

tender shard
#

why didn't you ask that question 8 years ago when 1.8 was released

next canyon
#

for now I'm doing a PlayerLoginEvent on a monitor priority

tender shard
#

priority doesn't matter

#

the event is not cancellable

#

oh wait

#

login event

#

sorry

tender shard
#

i thought joinevent

tender shard
#

not login time

eternal night
#

oh

#

getLastSeen then

#

idk if that is paper only too

next canyon
#

the big question is: Is the server updating the lastPlayed timestamp before or after calling PlayerLoginEvent

tender shard
next canyon
#

if it's after then I'm fine, but before is an issue

eternal night
#

😦

tender shard
#

getLastPlayed is spigot and returns login time, getLastSeen is paper only :/

eternal oxide
quiet ice
#

To be honest it is an ambiguous name and should be changed

tender shard
next canyon
#

Ok, I'm going to try it and will figure out if it's broken

quiet ice
#

A soft deprecated for removal will always do the trick

next canyon
tender shard
next canyon
#

especially with 600+ players on one instance

quiet ice
#

At some point you need to for changes

next canyon
#

thanks god i'm on a custom fork so I can use Java 15

quiet ice
#

The same thing will happen to the material enum

tender shard
#

tbh I'd just use a yaml file on startup and shutdown

#

or mysql

#

where you can store lastlogouttime

hasty prawn
quiet ice
#

It's going to be changed to a normal class

next canyon
#

btw is there any discord mods for support ? looks like i'm banned on my main but i don't really know why

quiet ice
#

So EnumSet and EnumMap are going to break

#

?tmp-support this thing?

#

?support

undone axleBOT
next canyon
#

arf

#

thanks everyone for your kind help

hasty prawn
tender shard
#

i think

hasty prawn
#

:o

tender shard
#

although I never read any official announcements

quiet ice
#

Internally materials are represented as registries, representing them as enums make no sense for a decade now

lost matrix
hasty prawn
#

Yeah true, custom Materials would be great.

tender shard
hasty prawn
#

Can we make that change faster

tender shard
quiet ice
#

I think biomes are the first to get it

quiet ice
#

But materials are officially going to be de-enumified

tender shard
#

then imho spigot should change it ASAP too

#

it will break ALL existing plugins though that use any kind of material reference

quiet ice
#
Future API
There are plans underway to change the way many enums in the API are handled so that custom content can be better supported. These changes are not expected to break most plugin jars (backwards compatibility will be provided), however they may unavoidably break plugin source code (though the Maven version will be bumped if this occurs). To reduce the risk of breakage, please consider avoiding the use of switch statements and EnumSet over enums which implement 'Keyed'.

Planned Removal of commons-lang
The API currently includes a very outdated copy of commons-lang. This API dependency is now deprecated and will be removed from the API and eventually the Server in a future release. Please consider switching to Google Guava (which is a supported bundled API) or using your own copy of the much more recent commons-lang3.
grim ice
#

How would i get an object methods, getClass() would get the Bukkit Entity class for example, that doesnt include the object's properties

tender shard
#

I guess spigot will add some wrapper that will be fine to use for 5+ years again

tender shard
#

getClass gives you the class

#

then you do getFields() and getDeclaredFields()

quiet ice
#

honestly, at runtime it is kinda-easy to have enums behave like regestries thanks to ASM and the likes. Until something invokes Class#valueOf

hasty prawn
grim ice
#

like

#

imagine the class is

#

class Person {
private int x = 0;

void setX(int i) { x = i; }
int getX() { return x; }
}

#

i made a person object

#

and set the x to 5

#

if i call getClass on the person object

#

and get the method

#

getX

#

will it return 5

#

or 0

serene needle
#

how I can make a mob to move to a specific coordinates

eternal oxide
#

teleport it (if you have a mob), else spawn it

serene needle
#

I want it to walk up there

#

move from possible A (spawn location) to point B

#

nms will also work for me

tender shard
#

getClass returns an object of the class java.lang.Class

tender shard
#

you can only use getMethod on your Class object

#

then invoke that using Method#invoke and then you have to pass your original instance of your Person class

#

and then it will return 5, yes, of course

#

reflection requires two tings:

  1. the method object
  2. the instance object
    then it simply invokes the method on that instance
quiet ice
#

java.lang.Class is basically a descriptor for a class

#

java.lang.Object is the root instance of any class - for now

tender shard
#

yeah and instance, well... is the instance of such a class lol

quiet ice
#

LWorld is going to change a few things

tender shard
quiet ice
#

Valhalla project. Basically adds "Q" types next to the traditional "L" types from what I know. However I may be contanimated with outdated information

trail pilot
tender shard
eternal night
#

java objects types are prefixed with L in fields descriptors in bytecode

#

I am sure you saw stuff like [Ljava.lang.String at some point

quiet ice
#

Basically it is the project behind value types (now known as inline types) that have different memory structure and thus cannot be null from my understanding

eternal night
#

Ehh value classes are nullable

#

primitive classe will not be

tender shard
#

but yeah now that you mention it, I've seen this before