#development

1 messages Β· Page 14 of 1

grim oasis
#

bruh

stuck hearth
#

I can do that in Forge

grim oasis
#

there are plenty of people that know how to create a custom entity, even with NMS

#

Just nobody that is currently helping you...

stuck hearth
lyric gyro
grim oasis
#

stop

#

be patient

lyric gyro
#

i'll try this out

#

i doubt it will work

stuck hearth
#

Well no that wont work lol

lyric gyro
#

    public GoatSoldier(EntityType<? extends Goat> entitytypes, Level world) {
        super(entitytypes, world);
    }
}```
#

uhhh idk if thats it

grim oasis
#

you will not be able to follow the tutorial you wanted to with Goat

lyric gyro
#

what am I supposed to do

#

there is a class named goat

#

and an interface named goat

#

idk which one to use

stuck hearth
#

EntityGoat

#

If you're following the tutorial

lyric gyro
#

but

#

but there is no entity goat

grim oasis
#

I have no clue how to use nms

lyric gyro
#

😒

grim oasis
#

I am currently googling it

#

why don't you do the same

#

instead of trying to go around it

dusky harness
#

you're also using spigot remapped iirc

grim oasis
#

If you want to make a custom entity with NMS, you need NMS

dusky harness
grim oasis
#

If you want to make a custom entity without NMS, follow a different tutorial (if even possible)

lyric gyro
#

I have NMS

#

that is not the issue

grim oasis
#

You do not

lyric gyro
#

lmao i literally do

grim oasis
#

If you do not have EntityGoat showing up then it's not in your sources

#

maven?

dusky harness
#

@lyric gyro seems like it's just Goat

#

net.minecraft.world.entity.animal.goat.Goat

grim oasis
dusky harness
lyric gyro
#

I do have nms

stuck hearth
dusky harness
#

weird naming

#

lol

grim oasis
lyric gyro
#

yes

grim oasis
lyric gyro
#

repo?

grim oasis
#

for spigot Idk how to get it

lyric gyro
#

what is a repo

grim oasis
#

can you send your pom.xml

#

I just wanna see for myself

#

cuz I got no clue

lyric gyro
#

ok

#

hold on

#

guys idk how to do this ill just ask for help on helpchat

#

oh no wait

grim oasis
#

Okay so I'd say continue with your tutorial

#

EntityGoat seems to just have been renamed

lyric gyro
#

whoever designed nms renaming stuff no one asked for:

grim oasis
#

but not EntityPig πŸ˜‰

#

oh lmao

#

I just realized

#

there was never an EntityGoat

lyric gyro
#

what

grim oasis
#

and EntityPig was just never renamed

#

Goat was the first time it was added, never EntityGoat

lyric gyro
#

so goat

#

is the same as entitygoat

#

except

#

entity goat doesnt exist

grim oasis
#

there is no EntityGoat

#

you made it up

lyric gyro
#

WHY THE

#

FUCK

grim oasis
#

never was

#

the answer? spigot sucks

lyric gyro
#

ill have a word to whoever made this like that

grim oasis
#

gl

lyric gyro
grim oasis
#

this is a low place to start getting mad at spigot's code πŸ˜‰

grim oasis
#

πŸ˜‚

lyric gyro
#

this is how I know I am becoming a programmer and plugin developer

#

getting mad with spigot

grim oasis
#

get your rubber duck

wintry grove
#

Use paper

#

Ez fix

#

Better mappings

dusky harness
#

he's using maven

#

🀒

lyric gyro
dark garnet
stuck hearth
#

gradle kts > gradle

dark garnet
#
(System.currentTimeMillis() - time) / 60000f + "m"```why does this only show `#.#`, instead of the full decimal? (`time` is a `float`)
dark garnet
#

o wait

dusky harness
#

:))

dark garnet
#

miss-copied

dusky harness
#

mis-copied*

#

:))

dark garnet
#

discord said its miss-copied

dusky harness
#

Hmmm

dusky harness
#

oh bc of the dash

dark garnet
#

i think its miss-copied and miscopied

#

yeah

#

so why does it happen

dusky harness
#

also why float instead of double?

dark garnet
dusky harness
#

then no it won't be #.#

#

oh yes it will be #.##

#

wait no

dark garnet
dusky harness
#

could also be 0.0205 for example

#

you don't do anything to limit it at 2 decimal places

#

unless you don't care about that

#

I'm confused

dark garnet
#

but first i need to figure out why it isnt showing decimals in the first place

#

cause when i add decimal format (with #.##) it changes it from #.# to #

#

ping me if u reply im going to bed πŸ’€

#

i mean, i dont sleep, real devs dont sleep i am real dev

lyric gyro
#

was wondering if I could some implement a placeholder to this

 assert player != null;
            if (player.hasPermission("adminitem.spacehelm")) {
                ItemStack itemStack = new ItemStack(Material.RED_STAINED_GLASS);

                ItemMeta itemMeta = itemStack.getItemMeta();
                itemMeta.setDisplayName(ChatColor.RED + "Dctr's Space Helmet");

                itemMeta.setLore(Arrays.asList(
                        ChatColor.GRAY + "" + ChatColor.ITALIC + "Drop this item to decrease your FPS",
                        ChatColor.GRAY + "" + ChatColor.ITALIC + "Immune to drops.",
                        " ",
                        ChatColor.DARK_GRAY + "To: " + player.getDisplayName(),
                        ChatColor.DARK_GRAY + "From: " + ChatColor.RED + "[ADMIN] " + ((Player)sender).getDisplayName(),
                        " ",
                        ChatColor.DARK_GRAY + "Edition: Coming Soon!",
                        " ",
                        ChatColor.RED + "" + ChatColor.BOLD + "SPECIAL"
                ));

only the part which says to: and from:
somethign like from: %vault_rank% %player_name%

merry knoll
#

you could if you want the text to be editable in config

nimble vale
#

yeah just get the string from config

#

and then replace placeholder with whatever the value is

#

name or rank for example

stuck hearth
#

Also maybe don't assert the player isn't null and do a proper check :x

lyric gyro
stuck hearth
#

Doesn't make it good practice

#

Gonna crash the server when there's a null player lmao

nimble vale
#

it may be for the test purposes tho

stuck hearth
#

Yeah again that's what a check is for.
Unless you're testing whether or not assert will crash your environment

lyric gyro
icy shadow
# dark garnet ping me if u reply im going to bed πŸ’€

using float is generally a bad idea, it's not gonna be very accurate and so you'll probably get rounding or accuracy errors.
data types generally have no correlation to how you're formatting them so decimalformat is definitely what you should do

nimble vale
#

you can parse vault rank with papi

#

and just replace player name with player#getName

lyric gyro
#

I can do both?

proud pebble
#

or you could hook into vault instead of parsing it with papi

north mortar
#

how to add placeholder competition for expansion?

north mortar
dusky harness
#

I think u override get Placeholders method

#

On phone rn so can't really check

broken elbow
#

and I think you're wrong

#

@north mortar either you overrride the getPlaceholders method, and if that doesn't work it means that the placeholders are taken from the ecloud

dark garnet
icy shadow
#

double

dark garnet
icy shadow
#

what?

#

they are data types, they have nothing to do with how you print them

#

but also no

#

im also not sure what you're doing to make it only print 1 decimal place in the first place

lyric gyro
#

huh

#

but double is imprecise with 0.1 + 0.2 πŸ€“πŸ€“GH_Nerd

icy shadow
#

your face is imprecise

lyric gyro
#

actually it isn'tGH_Nerd

icy shadow
#

you're biased

lyric gyro
#

How do I create a

#

thingy

#

that

#

gets the current health of a mob

#

that getHealth() method part

#

how do I make it get the current health of a mob

#

I have created a class

#

with a listener

#

With EntityDamaged Event

#

i am not really sure how to do that

torpid raft
#

probably by getting the entity from the event object and get the health from that

wintry grove
#

Event#getEntity or smt like that

#

then LivingEntity#getHealth()

lyric gyro
torpid raft
#

what methods does the EntityDamageEvent have

#

if you're using intellij it should autosuggest them to you

wintry grove
#

the event parameter is to get pretty much everything that is passed to the event

#

event.getEntity() or smt like that

lyric gyro
#

@wintry grove ```package me.systemoutprintln.dev.hornspawn.listeners;

import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.goat.Goat;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class GoatDamageListener implements Listener {

@EventHandler
public void goatDamaged (EntityDamageEvent event){
    GoatSoldier goat = (GoatSoldier) event.getEntity();
    goat.getHealth();

}

}```

#

I dont really know what im supposed to do here

wintry grove
#

that should actually do it

torpid raft
#

that's gonna error out

#

you need to absolutely sure your event.getEntity() returns a GoatSoldier

wintry grove
#

wait true

#

do a if(event.getEntity() instanceof GoatSoldier)

#

and inside that if add that code

torpid raft
#

also what is that package name lmfao
me.systemoutprintln.dev

lyric gyro
torpid raft
#

i like it

lyric gyro
#

i was literally lazy to think of a name

#

so I just thought "SystemOutPrintLn"

#

and it isnt bad

#

first thing that came into my head, it looks pretty great on minecraft

lyric gyro
#
    public void goatDamaged (EntityDamageEvent event){
        GoatSoldier goat = (GoatSoldier) event.getEntity();
        if(event.getEntity() instanceof GoatSoldier){
            goat.getHealth();
        }```
#

how do you add markdown to text blocks

torpid raft
#

nope

#

for code blocks do
```
code
```

lyric gyro
#

Ik

#

I'm asking for markdown

hushed badge
#

```java
```

lyric gyro
#

like this

#

it looks nice and more readable

#

with colors and stuff

#
aaaaa
#

oh

#

🧐

icy shadow
#

hold on a minute...

#

that looks

lyric gyro
#
print("Hello World")
#

that's nice

#
fun aaaaa
wintry grove
#

I need it

lyric gyro
#

they even have kotlin, thats cool

icy shadow
#

betterdiscord eeeeee

wintry grove
#

pain

lyric gyro
#

yesterday

wintry grove
#

betterdiscord?

lyric gyro
#

not a fan of these themes with backgrounds but this one isnt bad

icy shadow
#

eeeeee

lyric gyro
#

yeah

icy shadow
#

i think you mean no

#

because that would be bannable

wintry grove
#

yes

lyric gyro
#

betterdiscord isnt bannable

wintry grove
#

I miss annie/dark pain

#

it is

lyric gyro
#

it isnt

wintry grove
#

modified clients of discord are

icy shadow
#

it is

lyric gyro
#

only if you install a plugin that violates the tos

icy shadow
#

no

#

modifying the client is bannable

merry knoll
#

it is actually against tos

wintry grove
merry knoll
#

do people care no

lyric gyro
#

then ban me discord 🀑

icy shadow
#

they might

wintry grove
icy shadow
#

more importantly the staff here have to uphold tos

#

which could include banning you

lyric gyro
#

yeah im disabling it

icy shadow
#

disabling what?

#

i dont know what you're talking about

lyric gyro
#

betterdiscord

icy shadow
#

?

#

whats that

lyric gyro
#

yeah actually

#

what are we talking about

merry knoll
#

took less time to catch on than expected

torpid raft
merry knoll
torpid raft
#

servers dont sound very clientlike

icy shadow
lyric gyro
#

imagine banning someone because they wanted to use a background

torpid raft
#

darn there go my dreams of making twidiscord

lyric gyro
#

but not banning the thousands of servers that promote hate and illegal stuff

lyric gyro
#

whats wrong with this

torpid raft
#

bad

lyric gyro
#

why

torpid raft
#

you are still running into the issue of putting some random entity type into the GoatSoldier box

#

think about what would happen if this event was called because a player damaged a pig

#

a pig is not a GoatSoldier but you are trying to coerce it into being one

#

that's gonna throw an error and break yer code

lyric gyro
#

then how do I make sure

#

It only gets the health of the custom entity I made

torpid raft
#

you need to make your check to see if it is the right entity type before you try to make it into that entity

wintry grove
#

just change the first line to be inside the if

lyric gyro
#
@EventHandler
    public void goatDamaged (EntityDamageEvent event){
        if(event.getEntity() instanceof GoatSoldier){
            GoatSoldier goat = (GoatSoldier) event.getEntity();
            goat.getHealth();
        }```
#

i did what you said

torpid raft
#

better, it shouldnt error now

lyric gyro
#

ok now the next part

torpid raft
#

i still dont know if you will actually ever get a goat soldier from getEntity though

#

did you actually make a custom entity?

wintry grove
#

it should return a living entity at most

#

and if he did it correctly

lyric gyro
#

this wonderful custom name here

wintry grove
#

it should be abe to cast

torpid raft
#

brb

lyric gyro
#

goat soldier is just a goat

#

that attacks monsters

#

hostile mobs

#

they are actually called soldier goat

#

I only figured that it was wrong when I was about to start doing what im doing now

#

it's cause I want to be a programmer not a pro grammar

high edge
lyric gyro
#

is it my server

#

or did i do something wrong?

#

if you feel like it you can download it and test it by yourself

high edge
#

You get an error when it doesn't work?

lyric gyro
#

nope

#

i dont get any error messages

#

it just doesnt work sometimes

#

I play the horn and nothing happens

#

not even the cooldown i set to it is applied

lyric gyro
high edge
#

What version of java you on

merry knoll
lyric gyro
lyric gyro
#

but if I compile like that

#

it won't work

merry knoll
#

then there is another issue in your code

#

with the goat syntax is wrong

lyric gyro
#

but wont update the health

merry knoll
#

yes

#

then you fucked up the logic

#

somewhere

lyric gyro
#

is it here maybe?

high edge
high edge
#

Why the hell are you on java 8

#

It's 2022 for crying out loud

icy shadow
#

common java 8 L

merry knoll
#

people dont want to update

#

it aint my stuff so eh

high edge
#

Force them to, if they don't want to, tell them to f off

merry knoll
#

i couldnt care less on what they use shrug

lyric gyro
#

thats the error it gives me

icy shadow
#

L

lyric gyro
#

as well as

high edge
#

Set the language to 17..

icy shadow
#

update ur java

lyric gyro
#

Variable 'goat' is already defined in the scope

high edge
#

Since you said you're using 17 lol

lyric gyro
#

I have both of them installed

merry knoll
#

did you define

lyric gyro
#

why the fuck is the ide using java 8 for this project

merry knoll
#

your environment

high edge
#

Open Project Structure in IJ

#

And change that shit

lyric gyro
#

how do I change java version

#

in intellij

high edge
#

google.com: how to change java language level in intellij

lyric gyro
#

is use ddg

#

i*

high edge
#

The what now?

lyric gyro
#

duck duck go

high edge
#

Same shit

lyric gyro
#

what

#

it says

#

the language level is 18

lyric gyro
high edge
#

No

#

First time using java

lyric gyro
high edge
#

I don't read minds, show the entire code

lyric gyro
# high edge I don't read minds, show the entire code
package me.systemoutprintln.dev.hornspawn.customentity;

import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.goat.Goat;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.level.Level;
import org.bukkit.ChatColor;
import org.bukkit.Location;

//Goat Soldier made by MouBieCat

public class GoatSoldier extends Goat {

    public GoatSoldier(Level level, Location loc) {
        super(EntityType.GOAT, level);
        this.setPos(loc.getX(), loc.getY(), loc.getZ());
        this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(50.0f);
        this.setHealth(50.0f);
        this.setCustomName(Component.Serializer.fromJson(
                "{\"text\":\"" + "Soldier Goat" + "(" + getHealth() + "/" + getMaxHealth() + ChatColor.RED + "β™₯" + ChatColor.WHITE + ")" + "\"}"
        ));
        this.setCustomNameVisible(true);
    }

    @Override
    protected void registerGoals() {
        this.goalSelector.removeAllGoals();
        this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Monster.class, 16.0F));
        this.goalSelector.addGoal(2, new RandomLookAroundGoal(this));
        this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, false));
        this.targetSelector.removeAllGoals();
        this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Monster.class, true));

    }
}

#

here's the entire goat soldier thing

#
package me.systemoutprintln.dev.hornspawn.listeners;

import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class GoatDamageListener implements Listener {

    @EventHandler
    public void goatDamaged (EntityDamageEvent event){
        if(event.getEntity() instanceof GoatSoldier){
            GoatSoldier goat = (GoatSoldier) event.getEntity();
            goat.getHealth();
        }


    }

}
#

and the class with the listener

thick oyster
#

How can i make something that when a player joins for the first time the players uuid gets loads into a yml file like this:

Players:
uuidofplayer1:
SomeValue: ""

when a other player joins for the first time it needs to be looking like this:

Players:
uuidofplayer1:
SomeValue: ""
uuidofplayer2:
SomeValue: ""

lyric gyro
stuck hearth
#

Hronse

lyric gyro
viral moth
#

is it not compiling?

#

whats your issue?

stuck hearth
#

I don't have an issue thank

lyric gyro
#

this

#

getHealth() is supposed to get the current health of the creature

#

but it's not updating

#

when the creature takes damage

#

so it's just

#

50/50

#

always

#
package me.systemoutprintln.dev.hornspawn.listeners;

import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class GoatDamageListener implements Listener {

    @EventHandler
    public void goatDamaged (EntityDamageEvent event){
        if(event.getEntity() instanceof GoatSoldier){
            GoatSoldier goat = (GoatSoldier) event.getEntity();
            goat.getHealth();
        }


    }

}
#

So I made this class

#

to do that

#

but it's also not working

wintry grove
#

Now I'm back with some string work here sunglas

Lets say I have this string "Imagine saying gg"

I want to check if the string has a certain blocked word, for that I could just do a <String>.contains("gg")
it does work, sort of, it does detect that it is a blocked word, but if I use for example something like "eggs", it will also think it is a blocked word, bc it finds the gg on it

#

so my question here is: is it possible to only check for words? and how would I do so

#

thanks in advance

#

could for example the String#matches("hello") work?

broken elbow
#

depends what you consider a word to be?

#

if your definition of a word, is 1 or more characters* put together and split by spaces then you can easily just split your text at spaces

wintry grove
#

something separated by two spaces I guess

broken elbow
#

loop thru all the words and check if they are your word

merry knoll
fiery pollen
#

Hey guys, does anyone know a good video/documentation about creating an API for your plugin?

torpid raft
#

regex bad

wintry grove
grand zodiac
#

How can I store a variable in a file?

torpid raft
#

depends on the variable

grand zodiac
#

Just a standard integer

torpid raft
#

just write it to a file with a FileWriter or whatever else you want to use

#

then you can later read it back with a Scanner

grand zodiac
#

thanks

torpid raft
#

πŸ‘

fiery pollen
#

are you able to change inventory names after the inventory has been made

lyric gyro
#

where can i find information on how to change a player's skin in 1.19?

lyric gyro
#

how do you set up a spigot server on linux

#

how do you do this on linux

lyric gyro
#

just use paper peepoSleepers

lyric gyro
#

to run my spigot server

#

sucks to be you i guess

torpid raft
#

assemble your spigot jar with buildtools and then run it

#

🀷

lyric gyro
#

i forgot to download spigot

#

lmao

dusky harness
#

Imagine running buildtools 😌

lyric gyro
dusky harness
#

Well there's also different desktop environments

#

Some are more aimed for performance

lyric gyro
#

@dusky harness how do I Save and quit

#

go back to terminal that is

dusky harness
#

Oh ur using vim

#

Wow

#

Impressove

#

Press esc

#

Then :qw

#

Or smth like tyat

#

Might be :q

#

Tried using it today but I'm on phone so I decided to just use nano lol

dusky harness
lyric gyro
#

:wq

#

with the :

#

i think I got it

dusky harness
#

Ohhhhh

lyric gyro
#

just :w

dusky harness
#

What's the q

lyric gyro
#

quit

dusky harness
#

I thought it was q

#

Hmmm

lyric gyro
#

w for write

dusky harness
#

What about w?

#

Oh

#

Oh I mixed it up then

#

Lol

lyric gyro
#

WHAT

#

why is uploading so slow

lyric gyro
#

spigot.jar

#

check the file name

#

what file

#

oh

#

wait

#

Ik what I did wrong

#

now ill install intellij

grand zodiac
#

Hi! Does anyone here know how to save the contents of a hashmap to a yml file?

winged pebble
#

Depends more on what is in the map tbh

grand zodiac
#

a player and an integer

proud pebble
grand zodiac
#

good idea ty

merry knoll
#

for that type of usage you probably should use a database though

#

yml is not made for that purpose

proud pebble
#

like what its for

grand zodiac
#

Keeping track of how many times a player has broken cobblestone

proud pebble
#

ahh i see

merry knoll
#

defo a database

#

look into h2

#

or sqlite

torpid raft
#

doesnt matter too much if they use yml tbh

merry knoll
torpid raft
#

the yml is also cached

merry knoll
#

exactly what i am saying

#

you dont want it cached lmao

#

with a lot of players, thats asking for trouble

torpid raft
#

?

#

even with thousands of players in the file that's a few kb at most

merry knoll
#

the way yamlConfiguration works is that it caches all

#

when the file is loaded

#

a server login easily hits thousands if not 100k+

torpid raft
#

ok so a few mb at most

#

and no reason you can't cull it

merry knoll
#

but why though when a perfect solution exists

#

whats the point of supporting bad practices

torpid raft
#

effort

merry knoll
#

barely any honestly

queen plank
#

I want to run this plugin on a 1.17 server, but I keep getting the same error despite using the correct version? What is wrong?

[12:58:21] [Server thread/ERROR]: Could not load 'plugins\Cage-1.0.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.18
        at org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:304) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:409) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[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) [?:?]
<dependency>
              <groupId>org.spigotmc</groupId>
              <artifactId>spigot-api</artifactId>
              <version>1.17-R0.1-SNAPSHOT</version>
              <scope>provided</scope>
        </dependency>
dense drift
#

open plugin.yml and set api-version to 1.17

queen plank
#

Bruh, me dum dum

#

Thank you

dense drift
#

np

icy shadow
#

says a lot about society

broken elbow
#

Does it?

icy shadow
#

yeah

queen plank
#

Is there any way to override Event listeners with abstract classes?

high edge
#

wdym

broken elbow
#

wdym

high edge
#

oh hi Blitz

broken elbow
#

oh hi Frosty

queen plank
#

I have a PlayerAdvancementDoneEvent for 1.17 and want to change what it does when in 1.18. So I have version classes sort of that change the behaviour of different functions depending on version and want to change the PlayerAdvancementDoneEvent from 1.17 and down compared to 1.18 and up.

#

What is the best approach to do this?

high edge
#

Honestly I'd just have two different listeners, and register the appropriate one

queen plank
#

Yeah, that is the thing. If the version is 1.15 to 1.17 it has the same behaviour. So I want to just call the current server version class which calls all lower version classes as I otherwise has to rewrite all code from 1.15 in the 1.16 one and from 1.5 AND 1.16 in the 1.17 one.

#

So I was hoping I could just override it in the 1.18 and don't have to rewrite everything for every version

lyric gyro
#

Can't you just use a different Listener for each version range that keeps the same behaviour? There's no reason to have abstract classes here

high edge
#

Doesn't even make sense to have abstract classes

queen plank
#

Yeah I could, but some versions have a changed behaviour. So I need one for 1.15, one for 1.16 and so on. I could make a "1.15 to 1.17" one but then I would need a "1.15 to 1.18" and a "1.16 to 1.18" etc classes

queen plank
lyric gyro
#

Please read my message

high edge
#

I feel like your versions system is janky

#

Make it so a listener can specify a range of versions it supports, then just go off of that

lyric gyro
#

Your messages seem to conflict with each other

#

You want something that works on version ranges but you want something that doesn't work on version ranges?

queen plank
#

I want it to work a certain way in 1.15 to 1.17 and I want it to work another way for 1.18 and 1.19.

#

I could make a version range listener as you suggest

dusky harness
#

depending on what the listener does, you can also just make if statements in the listener

And also an enum with minecraft versions so you can do like ```java
if (MinecraftVersion.isBetween(MinecraftVersion.v1_15, MinecraftVersion.v1_17)) {
// etc
}

broken elbow
#

or

#

or

#

listen to this

#

crazy idea

queen plank
#

However, I have like 30 listeners I need to do this for which means I have a lot of different classes

broken elbow
lyric gyro
queen plank
lyric gyro
#

Versions that behave differently will require different reactions, if there are 30 versions and 10 behave differently you'll need 10 classes for each behaviour

dusky harness
#

in spigot api at least, it's backwards compatible

#

besides Sound

broken elbow
broken elbow
dusky harness
#

o

queen plank
#

I want event.getAdvancement().getDisplay() for example, but AdvancementDisplay does not exist pre 1.19

dusky harness
#

interesting

broken elbow
#

also yeah new stuff

high edge
#

There's actually a really really simple solution to this

queen plank
#

Yes?

high edge
#

Screw multiversion support reversed_fingerguns

broken elbow
dusky harness
#

πŸ’€

queen plank
broken elbow
queen plank
#

lol

lyric gyro
#

yeah blitz has a lot of experience in that field

high edge
#

As should everyone else.

broken elbow
#

haha no

#

unless you want to cry

high edge
#

What's that

hoary scarab
#

Versions my plugin supports

high edge
#

I always knew you were cringe

merry knoll
# icy shadow

imma cache all my data in individual yml files and keep all loaded

icy shadow
#

true

merry knoll
lyric gyro
#

i mean the number of files and the storage method doesn't matter when you're loading all of the data anyway

merry knoll
lyric gyro
#

where can i find information on how to change a player's skin in 1.19?

dusky harness
#

or use SkinsRestorer (and its api)

lyric gyro
#

how would i use skinsrestorer?

dense galleon
#

How do I set the yellow number next to a player's name in the tablist?

dense drift
#

that's an objective with display set to tablist

dense galleon
#

Yep found it

lyric gyro
#

I tried downloading spigot remapped

#

and now theres this error that idk how to solve

#

Plugin 'net.md-5:specialsource-maven-plugin:1.2.2' not found

lyric gyro
#

also

#

"The requested profile "remapped" could not be activated because it does not exist."

#

it says this on the terminal

proud pebble
#

tho when you run buildtools, are you using java 17?

lyric gyro
#

yeah

#

im using j17

#

java*

proud pebble
#

whats your start script for buildtools

#

?

proud pebble
lyric gyro
#

I downloaded it today

lyric gyro
proud pebble
#

then run the remapped version

#

so remove --remapped on the end and run, then add it back and run that

lyric gyro
#

I kinda that already did that

proud pebble
#

what?

lyric gyro
#

then I realised I needed remapped

#

then I tried running remapped

#

and this happened

proud pebble
#

im sure i had this conversation with something else because they had the exact same problem

lyric gyro
proud pebble
# lyric gyro did it work for them or not

yk what, try downloading java 1.19.2, then try 1.19 remapped, cus someone else mentioned have the latest version so id assume the latest version of the major version or it just doesnt like working idk

lyric gyro
#

ok

proud pebble
#

if that works then yay, if not im not sure what to suggest

#

owait it was youy

#

hmm

lyric gyro
#

thats why

#

idk what i did last time

proud pebble
lyric gyro
#

ill do that now

proud pebble
#

wait

#

im talking about minecraft 1.19.2

#

not java 1.19.2

lyric gyro
#

k

lyric gyro
lyric gyro
#

what do i do

proud pebble
proud pebble
#

you also made sure to update the specialsource plugin to have 1.19 in everywhere

lyric gyro
#

you mean pom.xml?

proud pebble
#

when i copy and pasted the md5 plugin from the spigot website it had 1.17.1 or whatever by default

#

if you havent already it needs to be updated to have the right version

lyric gyro
#

idk if i did it correctly

#

do i need to download spigot 1.19.2?

proud pebble
#

did you update the 4 locations i just showed you

lyric gyro
#

im copying the pom.xml from another plugin i was developing

#

so yes

proud pebble
#

the project was for 1.19 yes

lyric gyro
#

mhm

proud pebble
#

actually you might have to build 1.19 regular aswell

lyric gyro
#

build 1.19.2 or 1.19

proud pebble
#

have you built the remapped 1.19 successfully?

lyric gyro
#

it gives me that error

#

remapped doesnt exist

proud pebble
#

still?

#

urgh

lyric gyro
#

you told me to run bt on 1.19.2 right?

proud pebble
#

yes

lyric gyro
#

ill try to do that

#

do i have to download spigot

proud pebble
#

you havent dont that yet>?

lyric gyro
#

for this version

#

nah

proud pebble
#

...

lyric gyro
#

yeah

#

when you said run 1.19.2

proud pebble
#

i told you to build 1.19.2 regular, then to build 1.19 remapped

lyric gyro
#

i thought you wanted me to download minecraft 1.19.2

proud pebble
#

i never said download minecraft 1.19.2, because thats irrelevant to this

#

you asked if java 1.19.2 existed, which made me though you were talking about java jdk 1.19.2

lyric gyro
#

i dont think i have to

#

since im not running a server

#

just running bt

proud pebble
#

you dont download spigot 1.19.2

#

you use buildtools to build 1.19.2

#

you dont have to use the jar

#

if you say thats the same thing, im making sure you understand what i mean cus if you go to getbukkit or whatever website and download 1.19.2 thats not gunna fix your isue

lyric gyro
#

im revving 1.19.2

#

then I just rev 1.19 again?

proud pebble
#

hopefully yes

#

do 1.19.2, then do 1.19 then do 1.19 --remapped

#

if that doesnt work idk what will

lyric gyro
#

thats what im seeing

#

why

#

WHY

proud pebble
#

ig it just hates you

#

very few to no one has this issue

#

maybe you cant get the remapped jar of 1.19 anymore idk

lyric gyro
#

seriously

#

serves little to no purpose

#

"hurrr durrr to do this specific thing you gotta use remapped! ur using ofuscated"

#

and whats the difference?

#

"good question"

proud pebble
#

maybe just use 1.19.2 ig

#

or wait till someone else can say why its doing it

#

maybe buildtools is bugged idk

stuck hearth
lyric gyro
#

im going insane

stuck hearth
#

Yeah

proud pebble
#

why does it complain that remapped doesnt exist?

#

maybe it requires java 17.0.3 or some bs like that

torpid raft
#

1.7.3

stuck canopy
#

    public static void onSell(Player player, ItemStack itemStack, String title) throws UserDoesNotExistException, MaxMoneyException, NoLoanPermittedException {

        if (!SoldItems.containsKey(player)) {
            player.sendMessage("1");

            List<ItemStack> items = new ArrayList<>();
            items.add(itemStack);

            SoldItems.put(player, items);
            player.sendMessage("2");
            List<String> lore = itemStack.getItemMeta().getLore();
            int cost = Integer.parseInt(lore.get(lore.size() - 3).replace("Β§6", "").replace(" Coins", ""));
            player.sendMessage("3");
            Economy.add(player.getName(), cost);
            player.sendMessage("4");
        }```
#

why is this hasmap not working

#

I think its not letting me enter any data coz it doesnt msg me "2"

#

but it does msg me "1"

stuck hearth
#

Is there an error?

stuck canopy
stuck hearth
#

Not in the console?

stuck canopy
stuck hearth
#

Not sure. I would check the contents of the map and maybe use a logger instead of sending chat messages

#

I also wouldn't use the player object as a key either

topaz gust
#

As static should not be used as an β€œaccessor” aka: β€œI put it as static cause otherwise I couldn’t access it” instead statics are for things that should not pertain to any single class and should exist instead outside of classes.

median solar
#

What's the best way to check if a player is a real player?
I'm making a plugin that uses the onPlayerDeath event and during some tests it was triggered by a chunk loader from an another plugin (that creates an invisible npc I guess).

hoary scarab
median solar
#

Yeah it's WildLoaders

#

I was thinking about using its API but I wished I had no other dependencies. That's the only way?

hoary scarab
#

You can check wildloaders src and see if ome_r sets any PDC data to tell if its a fake entity or not.

stuck hearth
#

I would just use the api, optional dep if necessary.
It's already on the server, why not use it

proud pebble
#

persistentdatacontainer

hoary scarab
#

^^^

proud pebble
#

looking at wildloaders very briefly looks like they use nms, so wouldnt suprise me if they dont use pdc at all

hoary scarab
median solar
#

soo at the end I should use their API to make my life easy?

proud pebble
#

probably yeah

median solar
#

and one more thing, when I add their api as dependency, the wildloaders plugin will be required to be installed to make my plugin work?

night ice
hoary scarab
frigid pollen
#

I have the following problem with org.mongodb:mongo-java-driver v3.12.11 I want to disable the logging but It doesn't work with the config files for logback, log4j or log4j2 it almost looks like it doesn't use those configs at al when I try to log a message it the same format as mongodb.

Setup:
Server: paper-1.19-81
Dependencies: paper-api:1.19-R0.1-SNAPSHOT, spigot:1.19-R0.1-SNAPSHOT, lombok:1.18.24, mongo-java-driver:3.12.11

dense galleon
#

Is there an event for when the totem of undying is used?

dense drift
#

^

dense galleon
#

Ah I tried looking for revive and totem rip

#

thanks

lyric gyro
#

WHATS WRONG

#

with this GODDAMN IDE

frigid pollen
#

you're opening the plugin tag two times

lyric gyro
frigid pollen
#

check if you have a matching clΓΆosing tag

lyric gyro
#

found the issue

frigid pollen
#

there should be another opening tag after that

#

yes

lyric gyro
#

@proud pebble

#

HEy

#

I'm really sorry for the ping

#

But regarding what happened yesterday

#

That I couldnt use remapped build tools

#

I just changed the 1.2.2 in my pom.xml

#

to 1.2.3

#

and the error is gone

#

will that make a difference?

#

oh wait

#

nevermind

#

hang on

#

I changed back to 1.2.2

#

now the error

#

is actually gone

#

programming is pretty much like god ig

#

it works in mysterious ways

#

the error legit is gone

#

i cant believe

frigid pollen
stuck hearth
#

Might just be their build tools lol

wary dust
#

Anyone know anything about the memory leak with Bukkit.unloadWorld

lyric gyro
#

Is there a way to decompile spigot projects without losing the methods in the code?

#

I wrote a plugin

#

And switched to Linux

#

but forgot to make a backup of the project

#

so I had to use a download that I had

#

decompile it

#

and copy and paste the code

#

But all the methods that I've used are basically gone, reduced to atoms

#

replaced by letters

#

and I can't remember what I used

broken elbow
#

and that's why you use github kids

#

😭 cries internally knowing he has done the same thing.

lyric gyro
#

but it was an older version of it

#

but most of the code was already written

#

so I only had to copy and paste

#

I just need help rewriting only a single class

#

thankfully you cant do the same mistake twice

#

so from now on

#

I'll store every single version

#

of my projects

#

in github

marble nimbus
#

is there a way to get the MCBrand via Bungeecord or is that only possible via Paper?

frigid pollen
#

So I've dug around a bit since I wanted to edit the MongoDB log format and it seems t be similar to the server log format is it possible that we can no longer change the log format via plugin and need to to change it in the server files?

merry knoll
#

you can pull it from bungee side

marble nimbus
merry knoll
#

Player.getPendingConnection().version i think

#

and player.getmodlist afaik

#

@marble nimbus

marble nimbus
#

that is just protocol version

#

but I need the actual Brand

merry knoll
#

then you probably need to check the handshake

#

some clients send it during it, so you need to read that packet most likely

#

if its not available in the api itself
edit: look below

lyric gyro
#

pluginmsg

#

minecraft:brand channel

marble nimbus
#

Thanky emi

thin grove
#

Hello there! Can anyone tell me if there is a support channel here?

dense drift
#

"HelpChat"

thin grove
dense drift
#

Support with?

thin grove
dense drift
shy geode
#

Hey guys

fiery pollen
#

Hello guys, so I keep on loading my plugin and it keeps crashing. I've tried to find the issue but I can't find it, I tried commenting out code and seeing if it dissapears but nothing works. Anyone got an idea?

https://paste.helpch.at/udezusenic.bash

#

Nevermind that error came bc I didn't have papi installed and I had it as a dependency

merry knoll
#

whats here?

fiery pollen
#

Oh its fine, I fixed it. But It was a sout.

olive dirge
#

Is there a good way to reset something every week on Sunday for example?

icy shadow
#

that might just be the vaguest question i've ever heard

lyric gyro
#

put a reminder on your calendar

dense drift
#

They are probably asking how to schedule a task

urban heath
#

Sup everyone. Question.

#

When you get Nitro for the server it doesn't upgrade everyone? I got nitro thinking my admins could post larger videos. But its still gives them the error.

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

torpid raft
olive dirge
#

Sorry for the vague question haha, I guess I shoulda asked if a task scheduler be the best option? Don't they reset when server crashes/reloads/etc?

torpid raft
#

you can use a task scheduler in conbination with a persistent storage eg. sql or a file

icy shadow
#

crontab should persist across crashes

torpid raft
#

on startup load in the time you want to restart at and set your scheduler up with that

icy shadow
#

but also complicated

torpid raft
#

crontab ez

wintry grove
#

I'm about to boost here and change my name to Professional Regex Idiot.

Now, what things in a regex allow me to parse words in a string?, iirc there were things like \b or smt like that that match the end of a word

#

would I have to use that to sort of catch every single word in the string?

#

and also how would I go ahead and make it return a list or array of all words in the string? String#split() or some shit like that?

#

thanks in advance again

lyric gyro
wintry grove
#

it hasnt helped a lot tbh

#

I'll do a split with space

#

that should work

#

but I prefer using a regex

#

to make sure it works good

#

thats where my problem is

merry knoll
#

just use \w+

merry knoll
#

but this matches numbers in the words too

#

\b[^\d\W]+\b this for matching words without numbers in them

edgy lintel
#

is there nms decompiled code for convenience that i can check for one sec

edgy lintel
#

like decompiled nms code with mojang/spigot obfuscation mappings

#

that actually changes the obfuscated code

dense drift
#

paperweight

edgy lintel
#

i need to see like one decompiled class

#

whats that?

dusky harness
#

Paper api plus nms

dense drift
dusky harness
#

But decompiled and mapped

edgy lintel
#

oh ok thats cool
thx bro appreciate it

dusky harness
#

If ur using paper api u can keep that and run reobfJar instead of shadowJar

edgy lintel
#

that doesnt seem to be containing the decompiled code
so i have to run with the mappings myself?

dusky harness
#

Well

#

When u refresh gradle

dense drift
#

you can not distribute mojang code

dusky harness
#

It'll decompile etc

#

So it'll take a while the first time

edgy lintel
#

alr i will just stick to obfuscated code cuz i know nothing about gradle
thx anyway

dusky harness
#

Maven?

#

Spigot has a plugin

#

But u have to run buildtools again with like a remapped flag and then change the dep to smth

#

I think it says in 1.17 spigot release post

dense drift
#

java -jar BuildTools.jar --rev 1.19.2 --remapped

#

probably these two as well

dusky harness
#

And the maven plugin

dense drift
#

idk about any maven plugin

dusky harness
#

But also made by md_5

#

It's needed to use that jar

icy shadow
#

maven dude _5

edgy lintel
icy shadow
#

wdym "do"

#

it's just the source code for spigot

edgy lintel
hoary scarab
edgy lintel
#

OMG IT WORKS

icy shadow
#

yw

edgy lintel
#

your welcome for your welcome

edgy lintel
#

pfffft

hoary scarab
#

I've recently been saving all the remapped from 1.17+ lol

edgy lintel
#

oh cool
the remaps arent 100% remapped tho
like there are still variables inside functions which are unobfuscated
but anyway i appreciate it so much lol

#

also is it possible that an eventlistener with priority high gets called BEFORE priority normal in special circumstances, rendering the priority high useless?

hoary scarab
edgy lintel
hoary scarab
#

Actually I'm not sure lol. But based on the above it should run in those orders.

lyric gyro
#

it goes from lowest -> low -> normal -> high -> highest -> monitor

edgy lintel
icy shadow
#

if there's an exception it wont even finish running the other events afaik

#

actually maybe it will

edgy lintel
lyric gyro
#

no

icy shadow
#

🀨

lyric gyro
#

they will always be called in that order

edgy lintel
#

idk man sth about these orders are bothering me so much that im starting to feel like its a bug

#

alr thx

lyric gyro
#

it would be stupid if a deterministic call order was not deterministic

icy shadow
#

it's not a bug lmao

lyric gyro
#

it's there for a reason, to be deterministic

edgy lintel
#

oh alr true

hoary scarab
#

@edgy lintel you could make a listener with each priority and see the order its sent in if you don't trust it.

edgy lintel
#

nvm

sterile hinge
lyric gyro
#

"β˜ƒοΈ" is null

icy shadow
#

how does that actually work?

high edge
lyric gyro
icy shadow
#

the NPE "because x is null"

#

are the names of each bit just stored in the bytecode?

lyric gyro
#

they are in the LVT yes

#

there are some javac flags to not save them and stuff like that

icy shadow
#

so surely after java 15 or whatever, local variables always have names stored

lyric gyro
#

not if you remove them

lyric gyro
icy shadow
#

no

icy shadow
#

ergo

lyric gyro
#

but you can remove them, so no, not "always"

icy shadow
#

decompiled spigot after java 16-17 should have them

#

anyway

#

idc

lyric gyro
#

the snowman thing is a bit different tho

#

I think that's proguard's doings

icy shadow
#

dunno what the snowman thing is

lyric gyro
#

in the minecraft classes local variable names are remapped to the snowman emoji

icy shadow
#

oh

#

lol

lyric gyro
#

and there was a version or two an NPE was thrown and it showed couldn't invoke blah.blah because \β˜ƒοΈ is null

icy shadow
#

lol

#

there should be more funny things in programming languages

#

little easter eggs for the people who go digging in specifications and source code

lyric gyro
#

why is .getHealth() not getting the current health of the mob?

#
public void upNewHealthCustomName() {
        this.setCustomName(Component.Serializer.fromJson(
                "{\"text\":\"" + "Soldier Goat" + "(" + ((int) getHealth()) + "/" + ((int) getMaxHealth()) + ChatColor.RED + "β™₯" + ChatColor.WHITE + ")" + "\"}"
        ));
        this.setCustomNameVisible(true);
    }
#
package me.systemoutprintln.dev.hornspawn.listeners;

import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class GoatDamageListener implements Listener {

    @EventHandler
    public void goatDamaged (EntityDamageEvent event){
        if(event.getEntity() instanceof GoatSoldier){
            GoatSoldier goat = (GoatSoldier) event.getEntity();
            goat.upNewHealthCustomName();
            System.out.println("This event was triggered correctly");
        }

        System.out.println("Debug message");


    }

}
#

they took damage btw

shell moon
#

System.out.println("This event was triggered correctly");

#

was fired?

#

if it did, then debug directly getHealth

somber gale
#

Would apreciate some help.
I currently have this interface:

public interface PluginCore<T, P, P2>{

    // Unrelated methods

    List<P> createPlayers(List<String> lines, P2 player, Placeholders... placeholders);
}

My plugin works on Spigot, Paper, BungeeCord and Velocity and P2 is only really used on Spigot and Paper as those are the only platforms that provide usable player data for what I need.
So, I would like to get rid of P2 while still providing OfflinePlayer usage to the Spigot and Paper version...

Is there anything I can use?
Like something similar to this?

<P2> List<P> createPlayers(List<String> lines, /* ...? ,*/ Placeholders... placeholders);
icy shadow
#

null?

somber gale
#

?

steep dragon
icy shadow
#

i worded poorly, i meant they would by default

#

as opposed to older versions where they presumably wouldnt without a flag, as there would be no point

steep dragon
#

javac retains plenty of "useless" attributes that are only intended for debugging purposes, i.e. signatures in addition to descriptors

#

if you invoke javac directly with no extra flags, it doesn't store the LVT

somber gale
sterile hinge
#

names are only stored in the LVT when compiling with the -g flag. Even in the jshell, you won't have names for local variable names (besides parameters because jshell uses -parameters by default)

edgy lintel
edgy lintel
#

just saw your post on spigot and i saw other guys saying the same thing like me

merry knoll
#

damage applies after the event since the event can be cancelled

#

but it's deterministic and not a may not have

high edge
#

adding a cache perhaps?

somber gale
#

I already have a cache for the Favicon itself, which I assume takes the most time

#

Because after a while is this warning gone, probs because the cache takes action

sterile hinge
#

Profile it to see which part is slow, improve that part

icy shadow
#

rewrite it in rust

#

πŸ€“

high edge
#

Don't write it at all, it'll be fastest

viral moth
median solar
#

How can I get the block the player is looking at?
I know about getTargetBlock but I don't know how to get the block only if the player actually can interact with it (with the black border)

somber gale
viral moth
#

this is how i would do it

#

at the very start of the event, get the current time in ms and store it in a variable

#

and then randomly go down through your code and just print to the console the difference in time from the current time compared to the start time, add like 5 of those in and you should hopefully see a big difference in one of them. continue to do this on the section of code to determine which method call(s) (if more than one) is taking the most time

#

@somber gale

sly barn
#

I have a problem with PlaceholderAPI using the jar file as library

I'm importing the class of PlaceholderAPI but the import can't be resolved if the version is 2.11.x
For example this is my Main code:
https://paste.helpch.at/osaxemazef.java

My IDE gives error on the "import me.clip.placeholderapi.PlaceholderAPI" saying that the import can't be resolved but if I use the versione 2.10.10 it works fine

#

As I was saying in #placeholder-api the problem isn't in code but it is that the import doesn't works with the version 2.11.x but using 2.10.10 my code works fine

high edge
#

Use a build system

sly barn
#

I was thinking to it but the thing is not that...
I know that I should use a build system but the problem is that at the moment I'm not using it and the problem is in PlaceholderApi 2.11.x, all others placeholderAPI versions work fine

somber gale
#

Use a build system

#

Just use one

#

Using jars directly is bad and ugly

#

And actually bother reading the wiki, as you're clearly using WAY outdated stuff