#help-development

1 messages · Page 1988 of 1

lunar forge
#

ah

solar dew
#

Help-me fast please, what is the second argument?

grim ice
#

What

#

Well you can

#

with a standard for loop

young shell
#
        Constructor<?> packetConstructor = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment")
                .getDeclaredConstructor(int.class, List.class);
``` I'm trying to get this Class on 1.18.1 but I get a ClassNotFoundException. Any Idea how  to fix that
grim ice
#

or am i bullshitting

ivory sleet
#

2Hex not concurrently

ivory sleet
young shell
#

From what I saw in the NMS Viewer that seams to be the correct name

ivory sleet
#

Does the spigot mapping still apply?

grim ice
#

@ivory sleet hes doing it on main thread

#

tho

quaint mantle
grim ice
#

he can use Iterator

ivory sleet
dire marsh
quaint mantle
#

class names are spigot but everything else is obfuscated

ivory sleet
dire marsh
#

well that's useful

grim ice
#

oo

young shell
grim ice
#

instead of using like

#

arraylist.remove

ivory sleet
#

Idr exactly but it’s definitely possible to brick an ArrayList instance by nesting some iterations and operations

grim ice
#

you use the iterator .remove

ivory sleet
#

yes you literally do

grim ice
#

and it still does the same thing?

ivory sleet
#

enhanced for loops compile down to an iterator usage

#

That’s partly why any Iterable derivative can be used in an enhanced for loop semantic

young shell
#

Concurrently counting stuff is also a fun excercise

brave sparrow
#

If you remove at index you’ll have to decrement your index prior to continuing

solar dew
grim ice
#

@ivory sleet wait so theres no misunderstanding? even with iterator.remove() you still cant do it?

#

im confused

ivory sleet
#

No what I’m saying is that an enhanced for loop of an ArrayList is essentially just an iterator

#

(With next and hasnext)

grim ice
#

Im talking about the iterator.remove()

ivory sleet
#

Yeah that one

#

You can use it ofc

#

But like, internally iterations usually keep track of indices

grim ice
#

but will it produce a CME?

brave sparrow
#

No

#

That’s how you’re supposed to do it

grim ice
#

thats what i thought

ivory sleet
#

When you’re nesting it, then it might occur I believe

grim ice
#

i got seriously confused

#

and if he's accessing it with multiple threads

#

you use

#

CopyOnWriteArrayList

#

right?

brave sparrow
#

Not necessarily

#

That’s one way

#

Or a synchronized list

grim ice
#

yea

ivory sleet
#

CopyOnWriteArrayList has some colossal time complexities iirc

grim ice
#

CopyOnWriteArrayList doesn't lock the list tho

brave sparrow
#

Lol

ivory sleet
#

Yeah kekw

shell hedge
#

Is there a documentation/tutorial on how to set custom nbt tags with nms for 1.18? I only found it for older versions 😐

ivory sleet
#

I’d strongly advocate to not use the nbt implementation mojang uses

#

Instead stick with pdc api

#

Which allows you to interact with nbt but at high level

shell hedge
#

ahh didn't knew there were alternatives

#

I'll take a look at it, thanks 🙂

ebon stratus
#

how do i send a message in the action bar to a player?

ivory sleet
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, message);

grim ice
#

whats ChatMessageType.SYSTEM btw

ivory sleet
#

That’s a thing?

ivory sleet
grim ice
#

error

ebon stratus
#

Cannot resolve method 'sendMessage(net.minecraft.network.chat.ChatMessageType, java.lang.String)'

peak gulch
#

how can i control another player??

grim ice
#

nmn :o

peak gulch
#

nmn??

grim ice
peak gulch
ivory sleet
#

You imported the wrong class Barry

ebon stratus
ivory sleet
#

What error?

ebon stratus
#

just doesn t exist

ivory sleet
#

You might need to add the bungee chat library then

#

As a dependency that is

ebon stratus
#

in 1.17 there is in the nms, but in 1.18..

#

link?

ivory sleet
#

What ide are you using

ebon stratus
#

intellij

ivory sleet
#

How are you building your jar?

ebon stratus
#

Build artifacts

ivory sleet
#

What is the name of your spigot dependency?

#

(Entire name)

peak gulch
ivory sleet
#

Define control

ebon stratus
#

spigot-1.18.1-R0.1-SNAPSHOT and spigot-api-1.18.1-R0.1-SNAPSHOT

ivory sleet
#

Barry

#

You’re using the wrong spigot jar

#

And also

#

You probably want to use maven or gradle

#

Like really

ebon stratus
ivory sleet
#

Believe it’s suffixed with -shaded

ebon stratus
#

oh

ivory sleet
#

If that’s still a thing

ebon stratus
#

tried every jar but not that one

ivory sleet
#

Lmao

ebon stratus
#

should i use the shaded api too?

mellow edge
#

how can I detect piston movement

peak gulch
ivory sleet
ivory sleet
#

?jd-s

undone axleBOT
ivory sleet
#

Go to the top right corner

#

Search BlockEvent

#

And go through those

#

(You can click on BlockEvent and then check all of the subclasses)

ivory sleet
#

Like what you want to do involves a lot of tricky stuff

mellow edge
lost matrix
lost matrix
#

Type in piston

#

BlockPistonExtendEvent
BlockPistonRetractEvent

ivory sleet
#

^

mellow edge
ebon stratus
ivory sleet
#

?bootstrap

undone axleBOT
#

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

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

ivory sleet
#

^

#

This might be to your relevancy

ebon stratus
#

works now thnx

frozen thorn
#

?paste

undone axleBOT
frozen thorn
#

Hello, I got an error when I try to create a config file

ivory sleet
#

Your jar does not contain that file of yours

#

Might be the case that you are exporting your source wrongly

frozen thorn
#

you recommand creating an yml file?

#

in the ressources

ivory sleet
#

Your code requires it

#

So yes

#

I mean alternatively you could generate the yaml file on the spot in the directory

#

But like

#

Then you’d have to change some code to make that work

frozen thorn
#

bc I was doing

public static HashMap<String, Object> getDefaultConfig() {

        HashMap<String, Object> parameters = new HashMap<>();

        parameters.put("spawn-location", new Location(Bukkit.getServer().getWorld("world"), 0, 100, 0, 0, 0));

        return parameters;
    }
ivory sleet
#

The issue isn’t coming from that code tho

unkempt peak
#

yiu dont even need that

ivory sleet
#

Ye

#

So basically

unkempt peak
#

just put a yml file in src with the defaults

frozen thorn
#
// Startup
Config config = new Config("benks.yml", this, Default.getDefaultConfig());
ivory sleet
#

plugin.saveResource

#

^

#

That one

unkempt peak
#

then onEnable saveDeafaultConfig

ivory sleet
#

It copies the file from your jar to your plugin folder

frozen thorn
#

okay thanks

ivory sleet
#

If the file (within the jar) does not exist you’ll get an error just like the one you got

frozen thorn
#

it's working with config.yml name?

silent hound
#

how do i show the usage like tab complete, but not actually tab complete

frozen thorn
#

okay thanks

silent hound
#

like this

unkempt peak
#

just add [<count>] to the tab completer

ivory sleet
#

That’s actually tab completion

#

But it’s the name of an optional argument @silent hound

#

Spigot api does not offer a way to provide tab completion with those sadly

silent hound
#

ah :'(

ivory sleet
#

However I will send you an example

frozen thorn
#

yeah ik ty

silent hound
#

no i've got it

#

ik how to do tab complete, i was just wondering if there was a way to show something, but not let the player actually complete it

ivory sleet
#

the argument("players", … would be shown as <players> in your chat when writing the command

silent hound
#

and wouldn't let you tab complete it

#

right?

ivory sleet
#

No

#

Or well

#

Arguments can still suggest completions

#

But not mandatory

#

(If you don’t want to use nms directly it’s possible to use command api, acf or even cloud as they all include this in their respective apis)

#

@silent hound

undone axleBOT
silent hound
ivory sleet
#

Yeah I agree

#

Don’t prioritize it, tho if you ever find yourself some spare time, why not add it (:

#

zacken in game I believe all human entities are players

#

But like

arctic moth
#

whats the best way of looping through something while having a delay like a bukkitrunnable

ivory sleet
#

In some Minecraft versions, there existed human entity alike mobs which were necessarily not players

unkempt peak
ivory sleet
#

^

#

::runTaskTimer

arctic moth
ivory sleet
#

I mean you can decide when to interrupt the flow

unkempt peak
arctic moth
#

oh so just like have it iterate to the next part of the list each time?

frozen thorn
#

do you know how can I get all .yml in the ressource folder in a list pls?

unkempt peak
#

yes

arctic moth
#

k

ivory sleet
#

Twiz yeah

#

Files::newDirectoryStream is one way

#

But it requires some decent java and oop knowledge

frozen thorn
#

like this

ivory sleet
#

File class is a bit broken

#

And obsolete sadly

#

Yes but it’s still legacy

#

Getting all the files from a directory with a lot of files can result in hang thus also dos

#

Yeah the link I sent you basically summarizes the drawbacks of File (:

eternal night
#

I mean, prefix it with your plugin name or something

unkempt peak
#

Yeah EventEndEvent is too generic

worldly ingot
#

The typical nomenclature (at least per Bukkit's standards) is to prefix with the type of event

#

e.g. if it's a player event, prefix with Player. If a block event, prefix with Block, etc.

frozen thorn
#

what is the path of the ressource folder?

worldly ingot
#

i.e. player-run events/minigame type thing?

#

PlayerEventEndEvent is probably fine then

#

Just kind of an unfortunate situation where you happen to have "event" twice in the name

#

An abstract type would have to be an EventEvent lol

grim ice
unkempt peak
#

Is it a minigame event ending?

frozen thorn
#
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
        final JarFile jar = new JarFile(jarFile);
        final Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
        while(entries.hasMoreElements()) {
            final String name = entries.nextElement().getName();
            if (name.endsWith(".yml") && !name.equals("plugin.yml")) {
                Bukkit.broadcastMessage(name);
            }
        }
        jar.close();```
#

it's working

#

it broadcast all .yml files in the ressources folder of my jar

grim ice
#

lmfao

frozen thorn
#

uh

grim ice
#

also use try(JarFile jar = ...){}

#

auto closing

sacred mountain
#

hey im having a semi brain block, im trying to create a player file like uuid.yml and put a config inside of it, which ive done.

im jus struggling on how to access that file and then get the value from it (yamlconfiguration)

lost matrix
grim ice
#

that would be quite intense for huge serverss

#

like ones with 500 players fe

lost matrix
grim ice
#

o

#

how about 2000?

tall dragon
#

plus if you cache correctly it should be fine

lost matrix
#

Even then.

grim ice
#

o pog

lost matrix
#

Just never do IO on the main thread.

sacred mountain
#

yeah but how would i get the value with the path

this:?

public Boolean getCooldownToggle(UUID uuid) {
if(config.getBoolean("cooldowntoggle")) {
return true;
} else {
return false;
}
}```
#

sorry for the bad code i wrote it without an ide

lost matrix
#

And always do IO async

sacred mountain
#

it can be changed whilst theyre online tho

#

ok

grim ice
#

public boolean getCooldownToggle(UUID uuid){
return getStorage(uuid).getCoolToggle();
}

sacred mountain
#

getStorage?

lost matrix
grim ice
#

make some class

#

for the info

tall dragon
#

and an autosave every like 5-10 minutes might be usefull

lost matrix
#

^

grim ice
#

cuz server might crash or weird stuff

tall dragon
#

indeed

sacred mountain
grim ice
#

make a class for storing the config values

#

PlayerDataManager.getData(uuid).getCooldownToggle() for example

frozen thorn
#

if in plugin.yml there is a permission to a command, does I need to check if player has the permission in the command class?

tall dragon
#

no

#

irc

#

documentation sais, its used to determine if a user can see the command, but it does not specify executing it.

#

so you might just wanna try and see

frozen thorn
#

okay ty

frozen thorn
#

do you know why ConfigManager#getConfig("locations.yml") return null?

young knoll
#

Because you aren't passing the id param

#

You are passing "id" as a string

frozen thorn
#

oh yeah bruh ty

#

it was a mistake

shell hedge
#

Hey, I'm trying to do this in 1.18.1:

Bukkit.getUnsafe().modifyItemStack(itemStack, "Enchantments: [{}]");

My IDE tells me it's deprecated so I searched for an alternative... I only found "should still work", but it prints me this error in console while passing:

[org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers] null
com.mojang.brigadier.exceptions.CommandSyntaxException: Expected '{' at position 0: <--[HERE]
drowsy harness
#

is it possible somehow to modify what blockfaces of a block that is rendered to a certain player?

eternal night
#

that method is deprecated because it is unsafe to use and may break in the future

delicate lynx
#

pretty sure that isn't even the correct format

eternal night
#

spigot does not offer an API alternative

#

And you will need to supply the full nbt tag

#

not just an additions that is to be inserted

shell hedge
#

okay... I'll take a closer look at it 🙈

main dew
#

@drowsy harness

drowsy harness
#

uhm

#

ill send screenshot

main dew
#

Oke

drowsy harness
#

this effect

#

without spectator

main dew
#

How you do that?

drowsy harness
#

Right here I'm in a block with spectator, and Minecraft renders all the visible blockfaces, so there aren't actually visible.

main dew
drowsy harness
#

thought so aswell haha

hexed hatch
#

what is it you're trying to do with that?

main dew
#

Only possible on mods

drowsy harness
#

basically non-euclidean rooms, on a SkyBlock world. So you could cover a room on the outside with this block that has it's faces hidden, and it would be like the harry potter tent.

#

But I'll instead only load blocks that should be visible on the inside.

hexed hatch
#

interesting

main dew
#

Non-euclidean is so good 😅

drowsy harness
#

love it haha

main dew
#

How I can check if player is on ground?

tall dragon
drowsy harness
#

i mean, you could get the players location, get the highest block at that location and compare

tall dragon
#

would yield the same result

drowsy harness
#

yeah

young knoll
#

What if the player is underground

tall dragon
#

yeaa, checking if the player is on ground is just a very difficult question

worldly quest
#

how would i get like a custom textured skull

#

i want to add some lore to it and stuff but i just dont know how to get it

dawn hazel
#

anyone know whats going on?
if i do

return (plugin.Hearts.get(player.getUniqueId())).toString();``` it works just fine
#

but if i do

return (plugin.Hearts.get(player.getUniqueId()) / 2).toString();```
#

.tostring doesnt work anymore

tall dragon
#

what is "Hearts" representing

#

a map?

dawn hazel
#

yeah

#

plugin.Hearts.get(player.getUniqueId()) outputs an integer

tall dragon
#

i usually just suffix an int with "" to convert it to a string

dawn hazel
#

what do you mean?

tall dragon
#

return (plugin.Hearts.get(player.getUniqueId()) / 2) + "";

dawn hazel
#

aaaaaaand

#

no errors

#

thank you

tall dragon
#

im pretty sure Integer.toString also exists

#

if u think this is ugly

dawn hazel
#

tostring didnt work in this case

#

it works without the division

#

but with division it doesnt

tall dragon
#

yh but i mean like Integer.toString((plugin.Hearts.get(player.getUniqueId()) / 2))

dawn hazel
#

hmm

tall dragon
#

i don't actually know why it doesnt work in your case though

#

maybe someone else very smart might answer that for us

hollow bluff
#

String.valueof();

muted sand
#

how do I access methods in my plugin within another plugin?

#

rather how would I make an api for my plugin?

young knoll
#

There are a lot of ways to do it

#

ServiceManager, A static API class, or just getting the other plugin with Bukkit.getPluginManager.getPlugin("name")

worldly quest
#

how would i get like a skull of a person in an itemstack?

muted sand
tall dragon
young knoll
muted sand
#

oh .-.

worldly quest
#

still with skullmeta?

young knoll
#

setOwningPlayer

tall dragon
worldly quest
#

how would i get the playerprofile of a user from like uuid

young knoll
#

getOfflinePlayer(uuid).getPlayerProfile

worldly quest
#

thanks

cursive crow
#

how can i make command arguments show up properly?

#

instead of getting this

young knoll
#

Getting what

cursive crow
#

i want to get something like worldedit or other plugin commands where it suggests arguments

young knoll
#

Implement TabCompleter or TabExecutor

cursive crow
#

thank you

delicate lynx
#

theres a method it will want to add, that will let you set the arguments

worldly quest
#

UUID uuid = UUID.fromString("a working uuid");
headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(uuid));

when i use my own uuid, not with text but with e.getEntity().getKiller().getUniqueId() it works but when i put a string uuid in there it breaks. anyone know why?

figured it out incase anyone else has this issue but the player needs to have joined your server

dapper sapphire
#

How do I set armor slots to nothing because this isn't working

dapper sapphire
#

Its nullable so idk why its not working.

late sonnet
dapper sapphire
#

I found this post,

#

Its for mobs but I assume it would also apply to players

#

Which is a bit annoying because I dont really want to wipe invs

cursive crow
#

is it possible to override structure generation? i couldn't find anything on google

#

like disabling certain structures if a variable is false

late sonnet
dapper sapphire
dapper sapphire
hasty prawn
#

What if you do new ItemStack(Material.AIR)

dapper sapphire
#

I tried both

#

both with .getInventory and .getEquipment

hasty prawn
#

Could you send the full class

dapper sapphire
worldly ingot
#

Looks like you're re-setting the costume again

dapper sapphire
#

Wouldn't be surprised with my ignorance

worldly ingot
#

You are. You have in the disable condition setting it to air, but you never return so it continues on to set the equipment again

#

If you added return true after your "Disabled costume" message, it would probably work fine

worldly ingot
#

(you can use null by the way - it does work ;p)

dapper sapphire
#

I bet it does 😭

hasty prawn
#

It does peepoGiggles

late sonnet
worldly ingot
quaint mantle
#

choco you are so cool

#

even when u used to shit on my code because it looks bad 😄

patent horizon
#

would anyone know what the [...s] does in js?

worldly ingot
#

I remember looking it up a while ago and have suddenly forgot :)))

#

It's one of its newer features

worldly ingot
#

Ah, it's the spread operator. Spreads the contents of the array to possible args

hasty prawn
#

Yes

worldly ingot
#

Which in this case is spreading out the string into each of its individual characters

#

It's a very confusing syntax to read

patent horizon
#

it's like .split("") but more straightforward ig

worldly ingot
#

Yeah pretty much

#

At least in that case

hexed hatch
#

wow that is absolutely disgusting to look at

worldly ingot
#

It will spread out the contents of an array into the arguments of a function where possible. Good example I saw was this:

function example(a, b, c) {
    // whatever
}

const values = [ "first", "second", "third" ]
example(...values)
#

and I suppose strings override the spread operator to spread a string into a string array because example(..."sup") would result in example("s", "u", "p")

sacred scaffold
#

how to make it so when someone dies they go back to the ./setworldspawn

worldly ingot
#

Oh it's just any iterable

sacred scaffold
#

sinec it aint working for me

hexed hatch
#

you asking how to write a plugin to do that, or how to do that with already written plugins

sacred scaffold
#

ok then nvm no1 is responding on hel-server 😠

hexed hatch
#

¯_(ツ)_/¯

worldly quest
#

how would i make it so a wither skeleton skull with lore can be used in a recipe

#

and multiple of them

#

ive searched around but i dont understand it + it uses one item

hexed hatch
lavish hemlock
#

I am currently trying to convert java.time classes to ticks so I can specify times of day in the scheduler, is this correct...?

    public static long timeToTicks(LocalTime thenTime) {
        final var now = LocalDateTime.now();
        final var nowTime = now.toLocalTime();
        if (thenTime.isBefore(nowTime)) {
            final var then = now.toLocalDate().plusDays(1);
            return now.until(thenTime.atDate(then), ChronoUnit.SECONDS) * 20;
        }
        return nowTime.until(thenTime, ChronoUnit.SECONDS) * 20;
    }

I need to explicitly check that the "then" time isn't before "now" because that would produce a negative value, which the scheduler cannot take. I also can't abs it as it would be invalid.

#

With my situation, I have two LocalTimes which represent times where daily tasks will occur. I don't want these values to rely on date as they are repeating.

#

(Also it would make configuration harder)

worldly ingot
#

Could always try it out in a regular Java project

#

No Bukkit dependency there

lavish hemlock
#

I mean I've already tried it out but the result is odd to me.

#

I'm not sure if it's correct.

worldly quest
lavish hemlock
#

Since, when converting ticks back to a Duration with the following situation:

  • now = 21:37
  • then = 21:36
    The "hours" field is 23 and not 24 like I would assume it should be, since the hours are the same.
worldly ingot
#

The hours are the same, but it doesn't sum up to a difference of 24 hours

#

The time between them is 23 hours and 59 minutes

lavish hemlock
#

Oh shit

#

So it should be correct then?

worldly ingot
#

Yes

lavish hemlock
#

Because honestly I'm not gonna wait a full day to test that it works lmao

#

Thank you

ancient plank
#

when I'm testing time I just hope it works

lavish hemlock
#

Same

ancient plank
#

and when it doesn't work, well unfortunate, because I'll just hardcode some values in tbh

hexed hatch
#

oh you're alive again

#

welcome back maow

lavish hemlock
#

I can't really cheese shit here, this is a plugin I'm being paid to make lol

worldly ingot
#

That's the perfect time to cheese things!

ancient plank
#

nobody can hate cheese, not even lactose intolerant people

lavish hemlock
#

In the process, I managed to finally learn java.time

#

Honestly, one of the cleanest APIs in the JDK, but like, the most confusing

ancient plank
#

clean API but its time, and time is confusing

worldly ingot
#

Takes some getting used to but it's very nice

#

Yeah, that's ultimately what it boils down to. Time is a bitch lol

ancient plank
#

time makes me wanna cry all the time

#

time zones hurt, calculating time hurts, all the jazz hurts YMa_MizukiPensive_NOSTEAL and I like jazz..

lavish hemlock
#

I like rock

#

Or more specifically, metalcore

worldly quest
#

is there a good way to make it so multiple items are required for a custom recipe?

#

I'm using exact choice with an item with lore

hardy swan
#

Or you can restrict the amount of items such that it fits into crafting matrix

#

Or you can use villager trading interface to request for multiple items, but limited to 2 distinct ingredient choices

sharp flare
hardy swan
worldly quest
waxen plinth
#

What do you craft at the multiblock?

sharp flare
#

custom items actually, its fun to do when you make sure every check is right and no dupes or some things come out xD

#

Can easily make shapeless recipes with it too with huge slots

narrow stag
#

Hi i have question about one command that idk how to really make. Its /up 1 in WorlEdit. If you don't know, its a command that place block under the player the amount he write in the first argument.

#

Hello

sharp flare
#

get the current y location of the player, you can use the argument to increment the value of the current y and add a block from there and teleport the player. There might be other better ways but thats what came up to my mind

somber hull
#

Or add ig

narrow stag
#

What is the method to place block under the player

somber hull
#

Basically you would get the players location and clone it then place a glass block however many blocks above the player and then place the player one block above the glass block

somber hull
#

Look up on google “Spigot api how to place block”

narrow stag
#

i did this for now

somber hull
#

I’m saying that cause you need to google stuff, but also k forgot the method off the top@lf@my head

somber hull
#

Ahh

narrow stag
#

I did search up on google but didn't find that much about placing block

somber hull
#

You get the location

narrow stag
#

: /

somber hull
#

Right

#

Location.getBlock().setTyoe()

#

Type

narrow stag
#

Like this ?

#

wdym

somber hull
#

🤦‍♂️

#

?learnjava

undone axleBOT
somber hull
somber hull
narrow stag
#

i gtg : (

somber hull
#

🛁

shy wolf
#

hi, how can i change color for particle (dust) in 1.12?

somber hull
shy wolf
#

yep

somber hull
#

Lemme check the docs rq

shy wolf
#

all i sew is offsetY/X/Z

somber hull
#

I need tk@sleep but idc

chrome beacon
shy wolf
#

i need in 1.12 not 1.18.2

chrome beacon
#

Same thing probably

shy wolf
#

nop

hybrid spoke
somber hull
#

First google result

#

Divide the egg by 255 or smthng

#

Idk

#

Rgb *

shy wolf
#

kk let me try

#

its kinda bugy

raw ibex
#

in PlayerDeathEvent, how do you get who killed the e.getEntity()

quasi flint
#

prob the damager

#

lemme get on thedocs

smoky oak
quasi flint
#

^

#

for safety check if killer is null

#

like fall damage etc

raw ibex
#

ok thanks

smoky oak
#

different topic where is the jar i need to use to not see this?

quaint mantle
#

i wonder why it is in living entity by default, instead of in the playerdeathevent

smoky oak
#

i did do the --remapped but im unsure where the jar is im searching

smoky oak
#

one function if one hooks into eneity death

#

i presume its to handle stuff like deaths of named tamed animals for example

quaint mantle
#

oh that could be the reason

smoky oak
#

so

#

my question?

#

is it just the .jar that's spat out?

somber hull
#

It looks sexy

smoky oak
#

you can set backgrounds in intellij

#

and i just used the image i used for my story

#

im going to presume you found the button then

#

settings -> Appearance & behaviour -> Appearance if anyone else's interested

#

on a completely different note

#

and i know im asking this again

#

but nobody is answering

#

how do i get the spigot -> mojang mapping, so that nms functions aint just letters

#

seriously why the fuck is this server dead once i open my mouth, it happens like clockwork

eternal oxide
#

?1.18

undone axleBOT
eternal oxide
#

oh thats changed

#

use --remapped and specialsource plugin as it tells you on the forums

smoky oak
#

special source?

#

@eternal oxide

smoky oak
#

im not too sure what you mean by that tbh

eternal oxide
#

read the three posts by md5

smoky oak
#

ah so

#

the remapped-mojang is the source (?) I'm looking for, and the plugin is to map it back onto what's considered to be allowed to be distributed

#

am i correct in assuming the remapped-mojang.jar also contains the javadoc, then?

eternal oxide
#

look and see?

smoky oak
#

imma do it when i have time

#

but thanks for the link

quaint mantle
#

alex

#

its alex!

#

do you know what plugins might have their source code public?

#

preferably ones that are not old and don't use deprecated code

dusk flicker
#

There's this great thing called Google

tender shard
#

gnoogle*

dusk flicker
#

goggle

quaint mantle
#

by the way does anyone want to do just 1 method with me?

#

just 1 single method

eternal oxide
#

Many plugins on the spigot forums have links to their Github

quaint mantle
#

i'll try with EssentialsX

ivory sleet
#

LuckPerms is decent

#

There’s also a ban plugin written by gepron1x

quaint mantle
#

one guy said i should start making plugins but im having difficulty cuz i dont know how use List and generics

ivory sleet
#

And a guild plugin written by gepron1x and manya

eternal oxide
#

?learnjava

undone axleBOT
ivory sleet
#

generics is well interesting

#

Needless to say it makes it all more confusing due to the type inference and type erasure

quaint mantle
ivory sleet
#

Which api?

quaint mantle
#

paper and pretty sure spigot too

ivory sleet
#

Yeah tho not a lot?

quaint mantle
#

still because i dont know generics and List I cant use the method i wanted to use

ivory sleet
#

Well

#

In simple terms

#

List<T> is the class declaration

#

It takes a generic type parameter

#

Similar to how you have normal constructors which take objects as arguments

quaint mantle
#

it's you!

#

CustomEnchants!

lapis widget
#

"I gotta learn generics"

ivory sleet
#

Only difference is that List<T> has a type constructor which takes a type rather than an object

quaint mantle
#

dude this thing isnt working

lapis widget
#

I gotta actually try development

quaint mantle
#

dude you told me to make plugins but i cant make plugins

#

how do you expect me to make a plugin if i don't know how to use generics

ivory sleet
#

Learn it

#

🙄

quaint mantle
#

yeah but he said i should stop studying java and start making plugins

lapis widget
#

thanks

ivory sleet
#

For what?

#

Oh that’s your plugin

lapis widget
#

yea

ivory sleet
#

Nice

ivory sleet
quaint mantle
#

im salty rn

ivory sleet
#

But you have to really put some grand effort into learning Java and OOP

#

they’re the two things you use for everything else in regards to spigot, paper and modding

quaint mantle
#

yeah i should've stayed focused on that

ivory sleet
#

The reason why I believe doing both concurrently is insightful is because you can apply the theory to some concrete ground such as a plugin which makes you exercise actual practice

quaint mantle
#

i just wanna study my java

#

making a plugin hasn't helped

#

all my plugin does is give items to a player and send messages to the console

#

big whoop

lapis widget
#

Start at the basics of a plugin
Then start at creating larger functions

quaint mantle
#

dude stop giving this advice to newbies to start making a plugin when are still trying to learn java

ivory sleet
#

Torchun

#

What plugin you make makes no difference as of now

#

You just wanna get something to work

#

And then try to understand every little thing you wrote

quaint mantle
ivory sleet
#

Fiddle with it

#

Ask questions

#

Google issues you encounter

#

By “get something to work” it doesn’t mean you just take an easy step and then it’s suddenly done

#

Getting something to work can take time, but let it take some time

quaint mantle
#

now i firmly believe that people should not make plugins until they feel familiar enough with the language

ivory sleet
#

Depends

#

Very much depends on learning style

lapis widget
ivory sleet
#

Anyhow, regardless learning Java on your own before plugins is totally fine

smoky oak
#

i learned java with plugins lol

ivory sleet
#

This channel isn’t made for spigot dev questions merely

quaint mantle
ivory sleet
#

However people might pull the ?learnjava on you if you ask stupid questions

ivory sleet
#

Myeah

#

Some questions I find acceptable is for instance

So generics works as following …, am I right? Or do I miss something?

hardy swan
#

Don't get me wrong, I think you can indeed learn java with plugins, but don't ask questions that are basic java

ivory sleet
#

But questions that are less acceptable would be

So what is generics? How do I use generics?

hardy swan
#

Yea, basically asking for a tutorial

quaint mantle
smoky oak
#

i ask things more of the like 'do i need net.minecraft.world.WorldType.a() or net.minecraft.world.WorldType.b()' bc there's no documentation avaliable for me atm

ivory sleet
#

You can get the information from those websites

#

But let’s say you still didn’t understand a concept fully

#

Or want to revise on your knowledge

#

Then asking a question would be okay imho

quaint mantle
#

oh okay then that works i guess

#

reminds me of how i wasn't able to understand recursion. And I don't want to understand it either.

#

fuck recursion

ivory sleet
#

Lol yeah

hardy swan
#

recursion is the very first thing I learn in college

#

so I would naturally say you need to appreciate that

quaint mantle
ivory sleet
#

Normal loops such as for and while can always replace recursion

quaint mantle
#

To understand recursion, one must first understand recursion.

smoky oak
#

may i suggest: Fractal clock

ivory sleet
#

Lol

hardy swan
quaint mantle
#

i got the recursion joke from a spigoter on the forums

smoky oak
#

that thing eats up 70% of a GM960 Nvidea graphics card btw

ivory sleet
quaint mantle
ivory sleet
#

Both can achieve the equivalent

smoky oak
#

ha. ha. I dont have any money

#

sue me

#

wait no dont

quaint mantle
#

u just got sued

hardy swan
ivory sleet
#

🥲

hardy swan
#

but who will reject a recursive binary search 🙂

ivory sleet
#

Ye

smoky oak
#

how to melt a computer:
\alpha (m,n)=\min{i\geq 1:A(i,\lfloor m/n\rfloor )\geq \log _{2}n}.

quaint mantle
#

guys i just got my hands on something real sweet

smoky oak
#

note to self discord cant use regex

hardy swan
smoky oak
#

fair

#

the one time i had to use nms was when i had to fill in a few hundred thousand blocks every few seconds once

lapis widget
#

xd

hardy swan
#

the one time I had to use nms is because minecraft's raid class actually sucks

smoky oak
#

well luckily i could guess which function i had to use

#

but im not banking on having that luck next time

hardy swan
#

you can always use remapped jar nowadays

#

I don't miss those days where I compare 1.17 remapped and 1.16 obfuscated method in terms of their order

#

to support both

smoky oak
#

havent gotten around to importing it yet

#

do i just import the remapped-mojang in the place of the normal spigot jar?

hardy swan
#

maven?

smoky oak
#

ye

hardy swan
smoky oak
#

where do i do that?

#

(using intelliJ if that helps)

hardy swan
#
<dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot</artifactId>
    <version>1.18.1-R0.1-SNAPSHOT</version>
    <classifier>remapped-mojang</classifier>
    <scope>provided</scope>
</dependency>
smoky oak
#

ooooh

#

wait

#

does that still need the plugin md_5 talks about in the blog post?

hardy swan
#

wdym still

#

this is the case where you need it haha

smoky oak
#

nvmind

hardy swan
#

"In the case where you decide to develop your plugins with the remapped version"

#

or sth like that

smoky oak
#

yeah

#

does the <plugins> tag goes in the same layer as the <dependencies> one?

hardy swan
#

plugins are included as part of the build process

smoky oak
#

wait

#

how do i use that plugin then

hardy swan
#

so it should be

<build>
    <plugins>
        <plugin>...</plugin>
    </plugins>
</build>
#

one sec

lapis widget
#

<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>plugin.yml</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <configuration> <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml </dependencyReducedPomLocation> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

smoky oak
#

'Invalid content was found'

#

where do i put that <plugins> tag?

lapis widget
#

its inside <build> > </build>

smoky oak
#

theres no <build> in my pom.xml

#

imma assume that goes on the same level as <dependencies>

hardy swan
#

then you can add it

#

yes

smoky oak
#

ok last question then

#

the remapped-mojang and remapped-ofc

#

to which categories (classes, sources, javaDoc) do i add them?

hardy swan
#

huh

smoky oak
#

like i still need to import those files after all

hardy swan
#

you are expected to have installed the remapped jar locally

smoky oak
#

um

#

where?

hardy swan
#

So maven stores certain files locally in your computer

smoky oak
#

.m2

hardy swan
#

yes

smoky oak
#

so its already there

#

i can just hit enter?

hardy swan
#

hit enter?

smoky oak
#

use it

#

reload the project with the dependency

hardy swan
#

yes

smoky oak
#

k thanks

#

it works now

#

perfect

#

question tho

#

if i leave the .m2 folder as-is, i dont need to import the remapped jars

#

does this apply to the normal api and javadoc as well?

hardy swan
#

you never had to import any jars from the beginning

smoky oak
#

wellllll

#

im just dumb then

#

good to know

#

oh right

#

any way to move .m2 to a separate drive?

hardy swan
#

I think many people just have that practice of import jars because of some youtube videos

smoky oak
#

yea

#

im not doing that again

hardy swan
smoky oak
#

eh I'll look into it at a later date

#

knowing its possible is enough for me rn

hardy swan
#

if you want an easy answer

#

search up symbolic links

smoky oak
#

that'll be beyond helpful

#

because im really starting to run outta space

#

that 100GB are almost exclusively program files

#

and my steam library is already on D:

hardy swan
#

symbolic links can solve most of these cases, but won't recommend if you ever need the files without your harddisk connected

#

I had chrome files saved in my hard disk for my previous laptop, and whenever I forget to bring my disk around I can't use chrome

smoky oak
#

well i know for a fact I'll not remove D: until this computer dies

#

so

#

not really a problem

lapis widget
#

xd

smoky oak
#

now my 8TB drive is a completely different story

lapis widget
#

its time to replace your what I think is a 120gb ssd

smoky oak
#

dont you think i tried?

lapis widget
#

idk

smoky oak
#

i cant get at it without breaking the board its screwed on

lapis widget
#

interesting

hardy swan
#

buy new comp

smoky oak
#

oy

#

im still broke

#

that didnt magically change in the last ten minutes

lapis widget
#

Is it just the screw thats stuck ?

smoky oak
#

it's stuck HARD

hardy swan
#

go work as se

#

se good pay

smoky oak
#

you mean Software Engineer?

hybrid spoke
hardy swan
smoky oak
lapis widget
hybrid spoke
#

help*

smoky oak
#

eh

hybrid spoke
#

autocorrection

smoky oak
#

not worth the effort

#

ill just get a new laptop in a year or so

hardy swan
smoky oak
#

no

hybrid spoke
#

no

hardy swan
#

if you were to work as an se for an online shopping platform, backend or frontend

smoky oak
#

I can do both but in actuality I can't do either

#

so

#

i dont care

#

whatever gets less tickets from customers i guess

hybrid spoke
#

backend >>>

smoky oak
#

ok then

hardy swan
smoky oak
#

imma ask a friend of mine if the job she has is still hiring

mystic sky
#

Hello md_5

hardy swan
#

just send in your resume, write in it your spigot total downloads

smoky oak
#

0

hardy swan
#

oof

smoky oak
#

reson being that i have developed plugins

#

but not actually put any of them up for download

#

oh btw

#

is there a showcase channel or something like that? I could have sworn this server had one once

young knoll
#

Nope

hardy swan
#

if you are good

hardy swan
#

everywhere is showcase

smoky oak
#

eh fair enough

#

different topic

young knoll
smoky oak
#

it's not possible to tell a client to have 'slight' dark vision without abusing the new light block, correct?

hybrid spoke
raw ibex
#

if i teleport someone during an event, is their location where i teleported them, or where they were when the event wwas called

hardy swan
#

a flex is stronger when the ones you flex to are strong

young knoll
#

Depends when you get the location

#

Before or after you teleport them

raw ibex
#

after

young knoll
#

Then it should be the new one

smoky oak
#

is it possible to somehow insert the compile time of the plugin into a variable?

raw ibex
#

ok ty

young knoll
#

I feel like it’s probably possible with some maven or gradle shenanigans

#

You could definitely insert it into a yaml file and then read that, idk about into code directly

smoky oak
#

wait

#

can i just dump the current time into the config.yml as a value before compiling?

ivory sleet
#

Yea

#

There are certain plugins and apis in gradle for instance

#

Idk bout maven tho

sweet pike
#

Is there a way to implement something like this via TabCompleter

young knoll
#
    return new Date().format('yyyyMMddHHmmss')
}```
smoky oak
#

thats runtime

#

not compile time

young knoll
#

Not if you use that in your build.gradle

#

And then reference it with ${buildTime()}

smoky oak
#

im using maven

raw ibex
#

can spigot remove curse of binding?

smoky oak
#

yes

chrome beacon
#

You will need to use Brigadier for your commands

young knoll
sweet pike
#

ohh okay, so mojang does give a wait for you to use them?

quaint mantle
#

What

young knoll
#

Mhm

#

That’s what brigadier is all about

sweet pike
quaint mantle
#

use a lib that supports brigadier though

#

Like cloud or acf

smoky oak
#

I can confirm that you cannot do this with TabCompletionEvent. It just provides possible autocompletes, but does not make the red text pop up if its one that you shouldnt use

raw ibex
young knoll
#

Brigadier is open source

smoky oak
young knoll
#

Idk if it has any docs

raw ibex
young knoll
#

But cloud and ACF do

raw ibex
#

just do regular remove?

smoky oak
#

you should be able to get a list of enchantments from an item and remove curse of binding from it

#

then reapply that to the item

raw ibex
#

oh ok

smoky oak
#

wait a sec

#

ItemStack#removeEnchantment(Enchantment.BINDING_CURSE);

#

LOL

#

its as simple as that

young knoll
#

Yeah there’s a convenience method in ItemStack too

#

Probably

raw ibex
#

is there an event for when someone removes a piece of armor

smoky oak
#

inventoryClickEvent

#

you need to run some checks tho

#

also there's more than one option

#

for example left click and shift left click

#

it absolutely melted my mind when i was trying to sort it out once

young knoll
smoky oak
#

I'd like to stick to nms and spigot thank you very much

young knoll
#

Why

#

You don’t want to shade a tiny lib

quaint mantle
#

(Just Use Paper)

smoky oak
quaint mantle
#

(Which also handles dispensers and such)

young knoll
#

(So does the lib)

smoky oak
#

if i do it nms and bukkit only at least it runs on everything

#

idk what you guys want

young knoll
#

I want you to use the lib?

smoky oak
#

my issue wasnt even connected to armor

quaint mantle
raw ibex
#

how do i use it

#

ill just use curse of binding

young knoll
#

Of course it works

#

It has a maven artifact for you to use

raw ibex
sleek pond
#

2 minutes

#

Ctrl c, Ctrl v

raw ibex
#

ok

young knoll
#

2 minutes to copy and paste?

#

Cmon coders are supposed to be good at that :p

sleek pond
#

Yea

#

But this guy doesn't seem to know how to use maven, so...

visual tide
#

you must be experienced in gradle then

raw ibex
#

lol i was joking

visual tide
#

i salute you

raw ibex
#

idk what gradle is

#

i only use maven because that's how i learned

#

what is plugin.yml gradle or maven

#

cos i have pom.xml

visual tide
raw ibex
#

but the video i started watching had plugin.yml

raw ibex
#

hmm thats what i thought

visual tide
#

if you use maven you'll need a pom and a plugin.yml

raw ibex
#

whatabout gradle

#

i dont have a plugin.yml

visual tide
#

in gradle the build file is build.gradle

raw ibex
#

oh ok

visual tide
#

you'll always need a plugin.yml

#

whether you use maven or gradle or javac

raw ibex
#

oh ok

#

hm

#

what's the function to equip something

visual tide
#

like put armor on a player?

raw ibex
#

wait i got it

#

how do i only make an event handler happen when i do a command, and make it stop when i do another command

lilac dagger
#

can the jetbrains annotations be removed at compile time?

#

i don't see their point

quaint mantle
lilac dagger
#

how?

#

that's what i don't fully know

#

can i just scope it as provided and will the plugin work just fine on runtime without the lib?

lilac dagger
#

one more question, can i make my own placeholders in the pom file?

tender shard
#

sure

#

you can define them in <properties>

#

you can also do stuff like regex placeholders

lilac dagger
#

that's really cool

tender shard
#

I always use a property for the "Main: class.name" in plugin.yml that automatically uses
${project.groupId}.${project.artifactId.lowercase}.${project.artifactId}

#

but that lowercase part is a part bit more complicated and requires a plugin iirc

atomic sorrel
#

hello, does anybody know how i controll an entity with wasd? (im a passenger from the entity)

lilac dagger
#

nms

#

look at a pet plugin for the exact methods you got to override

#

or at the pig class and the create something like that for your ridable entities

smoky oak
#

wait how do you grab the movement keys pressed while you're a passenger?

#

does that send a packet?

#

@lilac dagger

lilac dagger
#

it has to

#

otherwise how would pig/horses work?

smoky oak
#

hm

#

do you by chance know if packets get send while being a passenger in spectrator mode and tryign to move?

#

apart ffrom shift

atomic sorrel
#

ok i try 🙂

smoky oak
#

ah well

lilac dagger
#

try equiping a pig with a saddle and then put yourself passenger

smoky oak
#

that aint spectrator mode tho

#

wait a moment

lilac dagger
#

code it

smoky oak
#

can you trick the client into displaying the warped filters from spectator mode using packets?

lilac dagger
#

warped filters?

smoky oak
#

go spectrator

#

posess creeper

#

hit /kill

#

wait thats not a thing anymore

#

why

#

uuuuuuuurg

#

why did that get fixed

sonic goblet
#

Wouldn’t even need to save it to config if you don’t want it being persistent

quaint mantle
#

How to get displayname of offline player?

#

`OfflinePlayer target;

InventoryMaker inventoryMaker = new InventoryMaker(profile.getTheme().getPrimaryColor() + target.getName() + ''' + (target.getName().endsWith("s") ? "" : "s") + " Stats", 3);`

tardy delta
#

what does @royal oxide OFF do?

#

ah shit

sonic goblet
chrome beacon
tardy delta
#

oh

chrome beacon
quaint mantle
#

Thx I fixed it