#development

1 messages ยท Page 5 of 1

merry knoll
#

inventory holds the GUIPage as holder

sterile hinge
#

GCs walk along references reachable from the GC root, so unreachable circular references don't matter

quaint skiff
#

Any Ideas how to code cosmetic armor?

high edge
#

Resource packs?

lyric gyro
#

with resourcepack

quaint skiff
#

No I mean that you wear a gold chestplate but a diamond chestplate is shown to other players (not that the armor has a different texture)

lyric gyro
#

you would have to make the client desync somehow and show gold chestplate in the inventory but its diamond armor

dense drift
#

Packets, Sensaicraft

quaint skiff
#

So I should use Protocollib as dependency and then look for a packet which sets armor?

spiral prairie
#

yes

merry knoll
stuck canopy
#

how can I stop players from putting any item in their off hand

#
    public void onClick(InventoryClickEvent e) {

        if(e.getClickedInventory() instanceof PlayerInventory) {
            if(e.getClick().equals(ClickType.SWAP_OFFHAND)) {
                e.setCancelled(true);

            }
            if(e.getRawSlot() == 40) {
                e.setCancelled(true);
            }
        }
    }```
quaint skiff
bronze junco
#

Or refer to old combat plugins

obsidian sonnet
stuck canopy
obsidian sonnet
#

I believe that the getRawSlot id for offhand is 45. 40 is the getSlot id

stuck canopy
#

oh

edgy lintel
stuck canopy
#

thanks

edgy lintel
#

amogus

stuck canopy
#

it worked

west socket
#

Idk why they change the slot numbers so often

iron karma
#

hi

mystic gull
#

Hello i want to get the endercrystal class through reflections. In EntityType enum there is a method named getEntityClass(). Is there a way to use the getEntityClass() method through the ENDER_CRYSTAL field ? ```
Class<?> entityClass = ClassUtils.getEntityClass("EntityType");

        Field crystalField = entityClass.getField("ENDER_CRYSTAL");
dark garnet
#
final Location location = getRandomSpawn();
if (location == null || powerups.contains(location)) return;```how can i repeat `getRandomSpawn()` until `powerups.contains(location)` equals `false`? and also make it stop trying after X times (so that it doesnt loop forever)
high edge
#

either a while loop, or a for loop with the desired amount of threshold loops

proud pebble
#

that blocks people from switching to offhand through the hotkey

honest spoke
#

Anyone know how to use the gradle bnd plugin to build a bundle I can then run in OSGi? It seems (from https://www.baeldung.com/osgi) that's it's really simple with the maven-bundle-plugin, but since this obviously doesn't exist on gradle I'm stuck with https://github.com/bndtools/bnd/blob/master/gradle-plugins/README.md . gradle bundle seems to execute fine, but then I can't load the bundle with karaf using either bundle:install com.example/example/1.0 or bundle:install mvn:com.example/example/1.0. I'm assuming this is because karaf doesn't know where to look for the bundle or I haven't published the bundle to maven local? I suppose my question is, why is this (seemingly) so much harder in gradle, and what am I doing wrong? My build.gradle is here https://hastebin.com/ijapuqeruk.gradle

dark garnet
#

so i have Location locationA and List<Location> locations, how can i find the closest location to locationA from locations?

icy shadow
#

d;spigot Location#distanceSquared

uneven lanternBOT
#
public double distanceSquared(@NotNull Location o)
throws IllegalArgumentException```
Description:

Get the squared distance between this location and another.

Returns:

the distance

Parameters:

o - The other location

Throws:

IllegalArgumentException - for differing worlds

icy shadow
#

d;jdk Collections#min

uneven lanternBOT
#
public static T min(Collection coll, Comparator comp)
throws ClassCastException, NoSuchElementException```
Description:

Returns the minimum element of the given collection, according to the order induced by the specified comparator. All elements in the collection must be mutually comparable by the specified comparator (that is, comp.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the collection).

This method iterates over the entire collection, hence it requires time proportional to the size of the collection.

Returns:

the minimum element of the given collection, according to the specified comparator.

Parameters:

coll - the collection whose minimum element is to be determined.
comp - the comparator with which to determine the minimum element. A null value indicates that the elements' natural ordering should be used.

Throws:

ClassCastException - if the collection contains elements that are not mutually comparable using the specified comparator.
NoSuchElementException - if the collection is empty.

dark garnet
#

ty

dark garnet
#

how can i make an item spawn at a location without having it have an offset?

#

cause currently, i have to teleport the item after like a second to make sure it stays at the center of the block

dense drift
#

d;World#dropItem

uneven lanternBOT
#
@NotNull
Item dropItem(@NotNull Location location, @NotNull ItemStack item)```
Description:

Drops an item at the specified Location

Returns:

ItemDrop entity created as a result of this method

Parameters:

location - Location to drop the item
item - ItemStack to drop

dense drift
#

This should make it stay at that location

dark garnet
dense drift
#

Welp

dark garnet
#

figured it out @dense drift:

entity.setVelocity(new Vector(0, 0, 0));```
dense drift
#

Great!

hard wigeon
#

Anyone know how to turn a single module project into a multi module project in intelliJ without everything exploding?

#

and yes, I understand I'll need to abstract a bunch for common, but that's fine

#

whenever I've tried though, IntelliJ always gets mad at me mixing Java versions, and tries to run fabric on Java 11

dusky harness
#

It's worked fine for me so maybe you forgot to specify the versions in the modules? ๐Ÿคท

#

also the module names should be lowercase I think

hard wigeon
#

wait really?

lyric gyro
#

it isn't necessary but it's convention

dusky harness
#

ye

hard wigeon
#

oh, my other issue is what should the main spigot class be, for example?
since rn it's me.fredthedoggy.fredhunt.FredHunt

dusky harness
#

etc.fredhunt.fabric.etc

hard wigeon
#

but do I do me.fredthedoggy.fredhunt.spigot.FredHunt?

dusky harness
#

yea thats what i do

hard wigeon
#

๐Ÿ‘

pulsar ferry
dusky harness
hard wigeon
#

Yeah don't you need gradle for fabric?

#

I was using gradle for this test

pulsar ferry
#

I believe you do yes

dark garnet
#
if (event.getModifiedType() != PotionEffectType.INVISIBILITY) {
    Bukkit.broadcastMessage(event.getModifiedType().toString());
    Bukkit.broadcastMessage(PotionEffectType.INVISIBILITY.toString());
    return;
}```this (the `if` statement) keeps returning `true` even tho they are equal: https://srnyx.has.rocks/java_wRgK9iFUC4.png
hard wigeon
#

d;Spigot PotionEffectType

uneven lanternBOT
#
public abstract class PotionEffectType
extends Object
implements Keyed```
PotionEffectType has 1 extensions, 1 implementations, 1 all implementations, 1 sub classes, 17 methods, and  32 fields.
Description:

Represents a type of potion and its effect on an entity.

hard wigeon
hard wigeon
#

It's an object

dusky harness
hard wigeon
#

with a bunch of static members to grab things like you're doing

#

members might be the wrong word

#

Idk the terminology

lyric gyro
#

โ˜๏ธGH_Nerd

dark garnet
#

ah alr, ty

hard wigeon
dusky harness
#

didn't know that until now either

#

ยฏ_(ใƒ„)_/ยฏ

hard wigeon
# dark garnet ah alr, ty

you should never need ==, since .equals works on enums too, so it's easier to just use Object#equals and never run into that sort of issue

dusky harness
#

primitives

dark garnet
hard wigeon
#

that's not a good reason to use ==

hard wigeon
#

but like who checks primatives

dusky harness
#
((Integer) 1).equals(2)
```ez
#

does that work?

#

idk how autoboxing works

#

kotlin ๐Ÿ˜Œ

hard wigeon
#

Auto Boxing just makes it work iirc

dusky harness
#

well 1.equals(2) won't work

hard wigeon
#

so like Int == Int would convert to int == int

dusky harness
#

so I'm wondering if casting will cause classcastexception

#

or if it'll automatically work

#

๐Ÿคท

hard wigeon
#

new Integer(int)?

#

I got no clue

dusky harness
#

Ohh I forgot theres a method

#

for Integer

#

d;jdk16 Integer#valueOf

uneven lanternBOT
#
public static Integer valueOf(int i)```
Description:

Returns an Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.

Since:

1.5

Returns:

an Integer instance representing i.

Parameters:

i - an int value.

dusky harness
#

there we go

hard wigeon
#

hey dkim, have you made a project with modules before?

dusky harness
#

yes

#

but with gradle ๐Ÿ˜Ž

hard wigeon
#

mine is with gradle too lol

#

anyway, want to turn mine into a multi platform project ๐Ÿ˜‰ ๐Ÿ˜‰

I keep doing dumb stuff & making it not work

#

just like make the modules exist

#

not moving stuff to a common module, that part's easy

dusky harness
#

I'd recommend using kts though

hard wigeon
#

but me no kotlin

#

me java

dusky harness
#

it's either groovy or kotlin

#

๐Ÿฅด

hard wigeon
#

okay you win

dusky harness
#

for the buildscript

hard wigeon
#

kts it is

dusky harness
#

yay

#

yay

#

1 min

hard wigeon
#

lmfao

dusky harness
#

The root should have minimal dependencies, so I have placeholderapi and triumph config, both of which you probably should only have in the plugin module but I guess I forgot

hard wigeon
#

like a dumb person

#

so no paperdev for me

#

oh, also 1.16

dusky harness
#

Ah alr ๐Ÿฅฒ
I forgot about spigot, I haven't made public plugins in a long while

#

but ye u can use spigot api

hard wigeon
#

that's pretty good

dusky harness
#

oooooooh wow

hard wigeon
#

and some person is on bukkit

#

no clue why

dusky harness
#

paper was only like 52% last time I saw

hard wigeon
#

well that's my plugin specifically

#

not global

dusky harness
#

Oh

#

pretty similar

#

oh globally paper is 55.7%

#

wow it matches up really well

lyric gyro
#

It's almost as if proportions were proportional!

dusky harness
#

but I mean 50 servers vs the global 187391

hard wigeon
#

well, there are sketchy things with low number graphs like that

#

like those 6 servers with purpur are probably all on my network

dusky harness
#

๐Ÿ’€

hard wigeon
#

well, 2-3 on my network, my test server, a youtuber's events server I manage, and another test server of mine

lyric gyro
hard wigeon
#

@lyric gyro @dusky harness what's the best programming language

dusky harness
#

kotlin

#

it steals stuff from other langs

#

making it cool

#

๐Ÿ˜Œ

lyric gyro
#

Scala

hard wigeon
#

So tldr; 50% of programmers like kotlin, and the other 50% like Scala

#

proportions scale ๐Ÿ˜ฎ

#

๐Ÿ˜‰ ๐Ÿ˜‰

lyric gyro
#

Kotlin took a few things from Scala but it doesn't even take the cool things

dusky harness
#

๐Ÿฅด

dusky harness
#

what does scala have

#

i only saw it like 2 times so i dont remember

dusty frost
lyric gyro
#

Potentially!

#

dkim I've probably talked about that like 5 times in devden

#

go search peepoSleepers

dusky harness
#

๐Ÿ‘

#

But does scala work on most/all java code

dusty frost
#

it's a JVM lang, so I sure hope so

lyric gyro
#

"on java"?

dusky harness
#

Like iirc it's a functional lang

#

so wouldn't it have some issues?

dusty frost
#

it's pretty hardcore OOP/functional lol

dusky harness
#

if for ex u were trying to make a spigot plugin

dusky harness
dusty frost
#

it has very good interop with Java

lyric gyro
#

Yeah

dusky harness
#

ic

#

thats nice

icy shadow
#

scala is the gateway drug of FP

#

it's not pure enough to be difficult or incompatible with java but has just enough to get you into it

dusty frost
#

i mean even like Streams and Options are gateway drugs into FP

#

or at least into monads

icy shadow
#

theyre barely scratching the surface overall

#

but yes

lyric gyro
#

vavr pausechamp

lyric gyro
trail wigeon
#

Main:
    private final NamespacedKey potionKey = new NamespacedKey(this, "reaping_potion");
    public NamespacedKey getPotionKey() { return potionKey; }
Command:
    PersistentDataContainer reapingpotionPDC = potionMeta.getPersistentDataContainer();
    reapingpotionPDC.set(plugin.getPotionKey(), PersistentDataType.STRING, potionMeta.getDisplayName());
    potion.setItemMeta(potionMeta);
Listener:
        PersistentDataContainer container = event.getItem().getItemMeta().getPersistentDataContainer();
        if (!container.has(plugin.getPotionKey(), PersistentDataType.STRING)) {
            event.getPlayer().sendMessage("work4");
            return;
        }

So I'm a little confused on this every single time I right click the item it sends work4 and I'm not sure why it is anyone have a clue why?

heady steeple
#

Might be bc Iโ€™m on my phone but could you paste it on hastebin or similar? Hard to read

winged pebble
#

I would investigate what the item does have in pdc

midnight viper
#

is there any video guide to learn compliling plugins?

dusky harness
#

(what program did you use to create your plugin)

#

It depends on the program or the tool used, so there can't really be a video showing it in general

midnight viper
#

so i guess which is best IDE for new comers?

winged pebble
#

It depends if they used maven or gradle or neither

midnight viper
#

seems like maven

dusky harness
#

usually

#

since they usually have something called a build tool

#

if not then you'd probably want an IDE

#

can you send the source?

midnight viper
dusky harness
#

if it's maven then you do mvn clean package in command prompt
(Make sure to change the dir to the project directory - ex cd C:\Cool Project)

#

yep its maven

midnight viper
#

in line 62 i need to remove that +5 dmg its causing bows to do very high damage by default

#

rather than vanilla

#

welp i tried... gonna see if some other dev can do it

misty dragon
#
if (args[0] == "help") { //this doesnt work
                // but args[0].equalsIgnoreCase("help") works
                player.sendMessage("Help message!");
                return true;
            }
#

guys, what's the difference of == and equalsIgnoreCase()?

dusky harness
misty dragon
dusky harness
#

ye I typed that before you sent that question

#

gimme a sec

misty dragon
#

ok, im little confusing

merry knoll
#

while equals compares contents

dusky harness
# misty dragon guys, what's the difference of == and equalsIgnoreCase()?

Two differences
== checks for exact equals
args[0] and "help" are not the same instance, so this returns false
However, for example java String a = "test"; String b = a; a == b will return true because it's the exact same instance

equalsIgnoreCase also ignores caps, so test is equal ignore case TeSt

misty dragon
dark garnet
#

is it possible to return an "empty" ChatColor?

#

basically a ChatColor that does nothing

edgy lintel
#

what do you need it for

reef delta
#

Especially in the BlockFromToEvent, does anyone know how to replace a crop's drops? As there is no setDrops method and I can't cancel the event as it would prevent water from flowing.

Additionally, as soon as Block#getDrops() is called- the block drops are made so I can't set to air before, otherwise there are no drops and setting after gives me double. (normal drops and the drops I want).

winged pebble
#

I would think you'd just set it to not drop items and drop them yourself

high edge
#

Check if blockbreakevent get's called if it's broken from water

reef delta
reef delta
high edge
#

Well you could potentially change them when the player picks them up if you can't before that

#

Unless, you spawn new ones and delete the old ones

reef delta
#

For context, I need to label crops based on how they are harvested/made. (Eg. Player, water, piston, etc)

#

Only two categories though, organic and inorganic. Inorganic is basically anything other than by the player.

high edge
#

Either you're missing something simple, or there's no easy way and you're gonna have to go use a hacky wa

#

y

proud pebble
#

im sure you can modify the drops befofe they are spawned as item entities

honest spoke
#

How do you change what the maven-publish plugin actually publishes? Atm it just compiles my code and publishes that, but how can I change it to publish the result of another task? I've tried adding artifact <task> but that just runs the task and doesn't publish anything

pulsar ferry
#

You're trying to publish a fat jar? Aka shadow

honest spoke
#

Trying to publish a bundle made from bnd

pulsar ferry
#

No idea what bnd is but normally it's a good idea to publish the main jar and let every dependency be transitive
But if you want to change it, the artifact should work, I know shadow has a "special" artifact for it, bnd I am not sure

honest spoke
#

Bnd is the only gradle plugin I could find that produces bundles for use in OSGi. To run those bundles though, they need to be installed into maven local, which is what I'm trying to do

stuck canopy
#

help

#
            if (e.isLeftClick() || e.isRightClick()) {
                if (e.getRawSlot() == 5) {
                    if (player.getInventory().getHelmet() == null) {
                        if (e.getCurrentItem() != null) {
                            if (e.getCurrentItem().hasItemMeta()) {
                                if (e.getCurrentItem().getItemMeta().hasDisplayName()) {
                                    if (e.getCurrentItem().getItemMeta().getDisplayName().contains("ยงfLeaflet Hat")) {
                                        ItemStack newItem = e.getCurrentItem();
                                        player.getInventory().setHelmet(newItem);
                                        Bukkit.getServer().getPluginManager().callEvent(new ArmorEquipEvent(player, ArmorEquipEvent.EquipMethod.PICK_DROP, ArmorType.HELMET, null, newItem));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }```
#

why does this not work

#

btw Leaflet Hat is oak leaves

sterile hinge
#

what part of that monstrosity doesn't work as expected?

stuck canopy
#

It doesnt set the Leaflet Hat as player's helmet

lyric gyro
#

how wide is your monitor

stuck canopy
#

wah

merry knoll
#

might want to return out if not true

#

rather than this giga chain of ifs

#

or.. maybe combine them idk

honest spoke
#

Though I did have to set an archive classifier, which I didn't really want to do, which might hurt me later

#

Is there a way to not have it publish the compiled code too?

pulsar ferry
#

If it's java you can just add

java {
    withSourcesJar()
}

And it'll publish the sources (normally)

honest spoke
#

The code's in kotlin, but I just want to publish only the bundle, if that can be done

#

It seems like otherwise I have to add an archive classifier, which the OSGi tool im using doesn't really like

quaint skiff
#

Is someone here well informed with packets?

icy shadow
#

im sure somebody is yes

#

?help

neat pierBOT
#
FAQ Answer:
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait

Source

quaint skiff
#

I already asked the question multiple times but never really got a useful anwser but again, I try to code it so that some players see other armor then others and i coded it and it also returns the right colors for the Players but ingame Players with the Traitor role have no armor and Players with Innocent Role are all Purple (Detective Role works) Here is my Packet Listener : https://paste.helpch.at/ufijusimed.cs (I have no idea why it doesnยดt work :()

dusky harness
#

I'm not sure if this is a packet issue, but I've basically got no ideas

dark garnet
# edgy lintel what do you need it for
// %lt_color%
if (params.equalsIgnoreCase("color")) {
    final ChatColor color = new TeamManager(new PlayerManager(player).getTeam()).getChatColor();
    if (color == null) return "";
    return color.toString();
}``````java
public ChatColor getChatColor() {
    if (team == null) return null;
    if (team.equalsIgnoreCase("lthost")) return ChatColor.DARK_RED;
    if (team.equalsIgnoreCase("ltred")) return ChatColor.RED;
    if (team.equalsIgnoreCase("ltblue")) return ChatColor.BLUE;
    return null;
}```
#

so that instead of passing null, i can pass the empty color

dark garnet
#
team:
  lthost: []
  ltblue:
  - ee1e3f3e-87c4-4d7e-94b3-9e1f12a94f2c
  ltred:
  - e907083e-5db6-41fc-9e32-5c4d99a08712```how do i get the keys under `team` (`lthost`, `ltblue`, `ltred`)?
dense drift
#

d;ConfigurationSection#getKeys

uneven lanternBOT
#
@NotNull
Set<String> getKeys(boolean deep)```
Description:

Gets a set containing all keys in this section.

If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.

If deep is set to false, then this will contain only the keys of any direct children, and not their own children.

Returns:

Set of keys contained within this ConfigurationSection.

Parameters:

deep - Whether or not to get a deep list, as opposed to a shallow list.

dark garnet
#

yep just remembered that lmao, ty

dense drift
#

Np

small berry
#

how do i display a jobs name with job papi

dense drift
#

wrong channel

hard wigeon
dense drift
#

PotionEffect had a color parameter from 1.9 to 1.12.2

#

d;PotionEffect#PotionEffect

uneven lanternBOT
#
public  PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon)```
Description:

Creates a potion effect.

Parameters:

type - effect type
duration - measured in ticks, see getDuration()
amplifier - the amplifier, see getAmplifier()
ambient - the ambient status, see isAmbient()
particles - the particle status, see hasParticles()
icon - the icon status, see hasIcon()

dense drift
#

d;1.12.2 PotionEffect#PotionEffect

uneven lanternBOT
#
public PotionEffect(PotionEffectTypeย type, intย duration, intย amplifier, booleanย ambient, booleanย particles, Colorย color)```
Description:

Creates a potion effect.

Parameters:

type - effect type
duration - measured in ticks, see getDuration()
amplifier - the amplifier, see getAmplifier()
ambient - the ambient status, see isAmbient()
particles - the particle status, see hasParticles()
color - the particle color, see getColor()

hard wigeon
#

not the method of the potion

#

since I need to modify it at a packet level

#

for dumb reasons

dense drift
#

Yeah, but I guess it was removed at all ?

hard wigeon
#

but potions still have colors?

dense drift
#

Yes but the item does

#

d;PotionMeta#setColor

uneven lanternBOT
#
void setColor(@Nullable Color color)```
Description:

Sets the potion color. A custom potion color will alter the display of the potion in an inventory slot.

Parameters:

color - the color to set

hard wigeon
#

right

#

and they show when the player drinks it

#

no?

dense drift
#

Show where?

hard wigeon
#

Idk, that's from memory

dense drift
#

The color is just for the item, nothing much afaik

hard wigeon
#

stuff like this

dense drift
#

E.g healing is pink, jump is green

hard wigeon
dense drift
#

Ah, hm

hard wigeon
#

I just want to make all potions show up gray

#

so you can't tell what they are

#

from color

dense drift
#

Or maybe you can hide the particles at all?

hard wigeon
#

I was asked expressly to make them gray

dense drift
#

Fair

hard wigeon
#

the concept we're pulling off is "anonymous", so you can't figure out who is who

#

eg. all armor is iron

#

all names are "Player"

#

skins are a specific person

#

and enchantments are hidden

#

but being able to say, oh the person with strength will make it too easy to differentiate people, while no potion particles will make it so you can't tell anyone has potions at all

dense drift
hard wigeon
#

I see minecraft:effect, but no colors associated

dense drift
#

Second particle, sorry

hard wigeon
#

aha

#

wait

#

still no colors

dense drift
hard wigeon
#

that's when the potion is splashed, right?

#

like the splash potion itself

#

not the player who radiates the effect

dense drift
#

Sent when a client is to play a sound or particle effect.
jeb_shrug

#

worth a shot I guess

hard wigeon
#

fair

#

alright, just implemented those 2. I'll test it out now

hard wigeon
#

kinda seem to work, but I tried setting it to zero and all particles dissapeared

#

trying with a real color now

dense drift
#

Smh fred ๐Ÿคฃ

hard wigeon
#

still not working

#

and ofcourse lingering potions keep working, and keep their normal color

#

I give up

dense drift
#

But lingering is something different

#

It creates an area, not just some particles when it is used

hard wigeon
#

ah

#

well

#

I think this is what I was looking for

dense drift
#

I don't see anything useful there

hard wigeon
#

oops

#

wrong link

dense drift
hard wigeon
#

mhm

dense drift
#

oh damn

dark garnet
#

its still sending a normally formatted msg

#

could it be because im using LPC as well?

grim oasis
#

i would remove lpc

dark garnet
#

that worked, how can i make them work together?

grim oasis
#

idk what you're doing here, but try changing your listener priority? see if lpc has an api?

#

or lpc's listener priority

dark garnet
grim oasis
#

@EventHandler(priority = EventPriority.HIGH)

dark garnet
#

alright, ty
another problem, the recipients thing isnt working
do i have to set them before i set the msg?

#

oh wait

#

i think i have to clear the set first, and then add who i want

grim oasis
#

if you're setting it manually just make a new list then

#

don't retrieve the current one

dark garnet
#

there's no setRecipients, only getRecipients

grim oasis
#

ah

#

i see

dark garnet
dark garnet
grim oasis
#

ye, usually you don't have 2 chat plugins

dark garnet
#

was only changing chat for a team chat thing

grim oasis
#

ah, you could always cancel the event and send messages manually

#

then it wouldn't go to lpc

dark garnet
grim oasis
#

ah

#

discordsrv has to have an api, no?

#

might be easy to send message there, ๐Ÿคทโ€โ™‚๏ธ

#

many options

dark garnet
#

it does yea, but it'd just be too messy to send each msg manually

grim oasis
#

channel ids and all that

#

too much

dark garnet
#

ig

#

if it comes down to it i might do that

#

but it could arise other issues with other plugins that rely on chat msgs

grim oasis
#

if it works it works fingerguns

#

only gotta code it once

#

i mean, what do you really use lpc for

#

and how hard would THAT be to do

dark garnet
dark garnet
#

literally just have to copy the code i already have

#

BUT, i was thinking of switching to a more advanced chat plugin like venturechat so that i could have moderation stuff

#

๐Ÿ˜ญ

grim oasis
#

just make venture chat

dark garnet
#

do u know if venturechat has an api?

grim oasis
#

๐Ÿคทโ€โ™‚๏ธ

dark garnet
grim oasis
#

if you're gonna use another chat plugin, send messages manually I think is the best

#

or play around with priorities and see if you can get something

dark garnet
grim oasis
#

ic

dark garnet
#

ill just remake parts of venturechat that i need

trail wigeon
#
public void onInventoryClick(InventoryClickEvent event) {
        if (!event.getInventory().equals(inv)) return;
        event.setCancelled(true);
        final ItemStack clickedItem = event.getCurrentItem();
        if (clickedItem == null || clickedItem.getType().isAir()) return;

        final Player p = (Player) event.getWhoClicked();
        Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + p + " - " + ChatColor.YELLOW + "Clicked the slot" + event.getRawSlot());
    }

so this fires I tested it with a send message but it doesn't get past the first if statement anyone have a clue why

dense drift
#

Use InventoryHolder and then check if the inventory's holder is an instanceof your custom holder

somber gale
#

Trying to figure out some system to have for favicons that supports multiple platforms...
Right now I support spigot, paper, bungeecord and velocity. All platforms except spigot allow the usage of a BufferedImage for the favicon.
Spigot uses a CompressedImage, since I use ProtocolLib there, which accepts a Base64 encoded String, (normal?) image string or a byte array...

So right now, my most difficult part is to figure out a system that allows me to turn an image into some form of data that I could use accross all platforms without much work in the end.... Any ideas?

#

Actually. CompressedImage accepts an InputStream, which could be good...

high edge
mystic gull
#

Hello I should use player.getUniqueId() even for cracked players?(it'll never change ?)

high edge
#

Yes

errant kraken
#

how can I get the power level of a target block?

dense drift
#

d;AnaloguePowerable#getPower

uneven lanternBOT
errant kraken
#

AnaloguePowerable powerable = (AnaloguePowerable) block; I hope this works

dense drift
#

d;Material%TARGET

uneven lanternBOT
dense drift
#

I got it from here btw

errant kraken
#

thanks

dense drift
#

np

#

you have to cast its BlockData, not the block

misty dragon
#

Hello guys, i wanna make the folder to save player data

#

Should i name the file by username or UUID?

#

My friend told me should use player's name because its shorter so it'll be faster but i've seen many plugins use UUID

grim oasis
#

save by uuid if you want to allow people to change their names and still have their data

lyric gyro
#

its shorter so it'll be faster
This is untrue btw

misty dragon
merry knoll
high edge
#

:bruh:

lyric gyro
merry knoll
misty dragon
misty dragon
merry knoll
misty dragon
#

that's a good one

merry knoll
#

on online servers, uuid is bound to the account

grim oasis
#

UUID = Unique User ID this

lyric gyro
#

Indexing is wild

merry knoll
merry knoll
#

unless if you want people to be able to manually edit the files

lyric gyro
#

Now I want to read whitepapers about different file systems and disk formats monkaS

#

I need to resist the urge

misty dragon
#

Thanks yall for the answers

merry knoll
#

sqlite is a good option if you want the plugin to work without any external databases

misty dragon
dark garnet
#

is there anyway to set glow color without using teams?

hushed badge
smoky hound
lyric gyro
#

In the end you do need to use teams, even if you don't register them on the server's scoreboard, you need to send team information to the client, since it's based on the player's team colour

dark garnet
#

imma try using glowapi

nimble vale
#

is there a way to create for example 1.16 world with 1.19.2 server jar

lyric gyro
#

no

#

or at least not without using a custom fork and spend countless man-hours rolling back the chunk, world and generation systems to how it was like in 1.16, and everything that depends on it ยฏ_(ใƒ„)_/ยฏ

#

or a custom ChunkGenerator that literally implements the old generation but like, good luck lol

nimble vale
#

oh god

nimble vale
#

its a nightmare

#

maybe i can create a custom world generator

#

well actually purpose is that i don't want the new underground levels

#

like the negative coordinates

lyric gyro
#

It might be easier to do that with data packs

nimble vale
#

i couldn't find anything useful for "disabling it"

lyric gyro
#

But I know literally nothing about those so uh yeah

nimble vale
#

yeah so me

dark garnet
nimble vale
#

i kinda need to reset the world frequently

hoary scarab
#

Just remove 1.17+ blocks from world gen.

#

And set max and min height of the world

nimble vale
dark garnet
#

it'd still generate 1.17+ terrain

nimble vale
#

well only underground would fix my problem

hoary scarab
hoary scarab
nimble vale
#

how is there a such thing as min world height

#

is it that simple

lyric gyro
#

You can change those with data packs, but I mean it would still use the new generation patterns, just with different heights and blocks

dark garnet
misty dragon
#

guys, how to add variable to string quotes like this "my name is {name}"?

#

can i do that?

dense drift
#

?

misty dragon
# dense drift ?

i mean i can i print a string like this

String name = "Jayce"
System.out.printl("my name is {name}");
#

i don't know what its called

dense drift
#

java doesn't have patterns / string interpolation

misty dragon
#

instead of this

String name = "Jayce"
System.out.printl("my name is " + name);
misty dragon
dense drift
#

you could use String#format or printf

dark garnet
#

or .replace("{name}", name) (you'd have to make a string tho)

dense drift
#

what's the context?

upper jasper
#

IntelliJ or gradle seems bugged for me, if I compile any (gradle) project 1 to 3 times it wont include changes if I compile it again

#

Updated gradle and IntelliJ and it's still there

#

Only fix I've found is to fully restart my pc

dusky harness
#

or if you use shadow, gradle clean shadowJar

upper jasper
#

Otherwise it just fucks up

misty carbon
#

^^ still and issue, any help would be appropriated!

dark garnet
#

hi, im using rayTrace and i want it to shoot into the air (as far as the rayTrace maxDistance, so the getHitPosition is basically just 30 blocks in front of the player's eyes) if the RayTraceResult is null, how can i do that?

#

nevermind figured it out:
player.getEyeLocation().getDirection().multiply(Main.config.getInt("gun.distance.max")).toLocation(player.getWorld());

dense drift
#

Is possible to deserialize a custom object from the root of the config using bukkit's config system? all methods require a path =/

lyric gyro
#

no

dense drift
dark garnet
#

whats the correct way to do what im trying to do?

dense drift
#

d;MemorySection#getSerializable

uneven lanternBOT
#
@Nullable
T getSerializable(@NotNull String path, @NotNull Class clazz)```
Description:

Gets the requested ConfigurationSerializable object at the given path. If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null.

Returns:

Requested ConfigurationSerializable object

Parameters:

path - the path to the object.
clazz - the type of ConfigurationSerializable

dense drift
#

does this work only if an object was previously serialized at the path? How do I deserialize an object trough the methods/constructor mentioned here ๐Ÿ‘‡

#

d;ConfigurationSerializable

uneven lanternBOT
#
public interface ConfigurationSerializable```
ConfigurationSerializable has 24 sub interfaces, 10 implementing classes, and  1 methods.
Description:

Represents an object that may be serialized.

These objects MUST implement one of the following, in addition to the methods as defined by this interface:

  • A static method "deserialize" that accepts a single Map< String, Object> and returns the class.
  • A static method "valueOf" that accepts a single Map<String, Object> and returns...

This description has been shortened as it was too long.

dusky harness
dense drift
#

probably not, but depends on how the deserialize method is implemented
well, is not called rn, so I assume it is used only if it finds the ==: path.to.Class thing

dusky harness
#

(you have a ConfigurationSerializable inside of the map returned by serialize)

dense drift
#

aight

dusky harness
dense drift
#

yes, I am

#

but the config doesn't contain a serialized object, so that's might be the problem

dusky harness
#

oh

dense drift
#

Also, I found out you can access the root using "getRoot()" LOL

rigid mountain
#

Hey guys, im trying to upset in mongo with this code, but for some reason i have almost 500 documents when there should only be 2... so its not upsertting

code:

        Gson gson = new Gson();
        String json = gson.toJson(empire).trim();

        main.getEmpireCollection().replaceOne(Filters.eq("id", empire.getName()), Document.parse(json), new UpdateOptions().upsert(true));
    }```
dark garnet
dark garnet
#

i have a sorted (highest int to lowest) Map<Player, Integer>, how can i get a Player based on their "place" (ex: 1st, 2nd, 3rd)

winged pebble
#

Is the integer their place?

dark garnet
dense drift
#

I don't think Concurrent map save the order, does it?

dark garnet
robust flower
#

I have (believe it or not) never worked with Chunks before, so I have some questions:

I'm actually trying so remove a ~150ms scan off the main thread, this scan involves a lot of block comparisons, getting its State (for like comparing Sign text) and stuff. I read that ChunkSnapshot is an "immutable copy" of Chunk, but I have no idea how reliable that is, and still, is the method Chunk#getChunkSnapshot thread safe by itself?

There are also 3 variants to get a chunk from the world:

  • getChunkAt
  • getChunkAtAsync
  • getChunkAtAsyncUrgently

Almost all chunks I'll get are loaded already (but not all), and I know what range of blocks I'll need to access async (I have the minimum and maximum points of the area, which might surpass the size of a single Chunk), which method would make more sense (I'm using Kotlin and have access to Coroutines)?

Also, how do you guys handle these cases were you might need to access blocks from multiple chunks at once (like in intersection of chunks)? Is there a native abstraction in Paper for a "region" (that can range from 1 to n chunk snapshots)?

Does ChunkSnapshot even keep the block NBT data?

lyric gyro
#

I read that ChunkSnapshot is an "immutable copy" of Chunk
Yes, that is true

is the method Chunk#getChunkSnapshot thread safe by itself?
No, you must call it on the server thread, then jump to another thread to scan it however you like, the ChunkSnapshot itself, being immutable, is inherently thread safe after you get hold of it

There are also 3 variants to get a chunk from the world:

  • getChunkAt
  • getChunkAtAsync
  • getChunkAtAsyncUrgently
    [...]
    which method would make more sense
    Just gCAA will be fine if you are unsure whether they are loaded or not, the urgent variant is more useful for stuff like spawning entities and such, you still need to call it on the server thread, get the snapshot and jump to another thread

how do you guys handle these cases were you might need to access blocks from multiple chunks at once (like in intersection of chunks)?
No other way than just calling the methods shrug you can do some fancy maths to get the chunk coordinates for the blocks you need (chunkX = blockX >> 4, obvs same for z)

Is there a native abstraction in Paper for a "region" (that can range from 1 to n chunk snapshots)?
No

Does ChunkSnapshot even keep the block NBT data?
I'm not sure, if it has methods like getBlockState/getState (not getBlock followed by getState) then yes, if not then no

robust flower
#

it has getBlockData, probably not useful to get Sign texts I guess...

lyric gyro
#

lame

hoary scarab
#

I'm pretty sure BoundingBox has a method that returns chunk chords inside the points.

robust flower
#

is copying NBT data from blocks so slow that it is worth to not do so?

#

I mean, they are already loading the chunk and copying the block type, why not also copy the NBT data from the block while on it?

hoary scarab
#

You might have to play around with different methods and see what's right for you.

#

Depending how many chunks your server loads at a time and other factors play huge parts in deciding what methods to use.

lyric gyro
#

Hey guys, world's newest Minecraft Plugin developer here (I started today hehe)

#

And I wanted to know how can I make so that Spectral Arrows explode on impact rather than outlining who you've hit

#

So they are Explosive and not Spectral

#

This is for a minigame I am developing with my friends

#

What do I have to do

#

I don't really know my way around Intellij that much

#

Is it as complicated as it sounds?

#

Also, the minigame we're making is like a wave of mobs that you have to kill to go to the next wave

#

We have to place the mobs manually for now, but I want to randomly generate these waves

#

So it gets progressively harder

#

And I want the mobs to spawn in a fixed location. Is that possible?

#

I believe it is, I mean, what's impossible with Java after all but I want to be sure

#

And how do I develop a wave system?

#

I have a lot of work to do and I don't know how to do it just yet, I need a lot of help.

#

These were a lot of questions but I need help

#

Really hope y'all don't mind helping a beginner!

grim oasis
#

Any java/coding experience?

lyric gyro
#

I'm picking up Java now and I feel like I'm getting the hang of it

#

I have zero experience but it's not hard. Not at all

#

(Even tho I barely started lol)

grim oasis
#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

grim oasis
#

few useful things here

#

Almost everybody here will recommend at least jumping into java itself and learning at least the basics before heading into a plugin

#

from personal experience I started by watching a youtube tutorial on how to make a plugin and didn't even realize how bad the code was

lyric gyro
#

Is everything I asked possible though?

grim oasis
#

yes

#

everything is possible

mental cypress
#

^^. My first time I tried plugin development back in 2014 or 2015 I skipped learning Java and it was hell trying to get more in-depth with plugins.

lyric gyro
#

How do I practice though

#

I'm confused

grim oasis
# neat pier

well there are some things here to help you learn

lyric gyro
#

How do I practice not learn

#

I have no clue how to practice a programming language

grim oasis
#

how can you practice without knowing

lyric gyro
grim oasis
#

well you have an IDE, intellij

#

now you gotta learn how to make something runnable

#

a main method

lyric gyro
#

Also, what java course in Coursera is good?

grim oasis
#

I have no clue sadly, I didn't write the FAQ

#

there's a few intros to java

#

I'd recommend checking out some of the syllabuses

lyric gyro
#

coursera isn't free

#

I learnt HTML in YouTube

#

Maybe I can learn Java there as well

grim oasis
#

what price do you pay

lyric gyro
#

It literally asks me for paying information when I try to start a course

grim oasis
#

does it say why

#

is it if you want a certificate?

lyric gyro
#

Yeah we should change channels, we aren't on topic here

mental cypress
#

That might be a recent change. Can look into updating the response.

grim oasis
lyric gyro
#

Christ

#

That is expensive

#

Thats like 250 bucks a month in my country

mental cypress
#

That's gotta be a somewhat recent change. Will look into it.

misty dragon
#

Can i change the color of raindrops with spigot api?

heady steeple
#

no, rainfall is a texture, can only change from a texture pack

heady steeple
# lyric gyro Christ

If you can find a place to learn Java (YouTube or something idk), afterwards CodedRed makes pretty cool basic tutorials for Minecraft plug-in development

#

If you feel that you really need a from the ground up Java to plug-in development there is mineacademy.

#

Though not free, it teaches basics of Java, and plug-in development from beginner to some pretty advanced stuff. I never finished it because Iโ€™m a bad student and wanted to branch into my own things lol, but sometimes I go back and learn something new. Link https://mineacademy.org/project-orion

wheat carbon
#

๐Ÿคฎ

viral moth
#

just watch enough yt videos and go through enough trial and error and you'll be fineeeee

nimble vale
#

yes it's not that complex to start learning

#

just start from anywhere

#

be passionate and you will find your way by yourself

lyric gyro
#

what's the event name for when you sound a goat horn

#

i wanted to make it so horns are like ultimate abilities

#

you get healing or more resistance or speed etc when you sound them

#

and how do i increase the delay

#

also

#

how do i make the drowned not suffocate when they aren't in water?

#

and attack other mobs, not players

#

because i want to make a horn that spawns a horde of drowneds to help you kill the mobs in the minigame im making

#

the horn i want to use is specifically that one that sounds like a submarine or boat horn

proud pebble
#

and when it comes to making the mobs you spawn attack other mobs i think that requires nms to modify the mob's goals as afaik theres no way to do so using just the spigot/bukkit api

nimble vale
#

well there is a option to disable this thing

#

i guess only disabling it will just fix my problem

lyric gyro
#

I don't think that's what you're going after

#

That's for chunks that have been generated before 1.19 when upgrading to 1.19

dense drift
#

isn't there an option in world setting for min height? I mean, World has a method for this

lyric gyro
#

to get it, yes

#

you can change the min height with data packs only afaik

dense drift
#

Oh?

lyric gyro
#

This guy teached how to turn mobs into allies

#

Creepers, Zombies, etc

#

But

#

I still need to know what's the event when you sound a horn

#

Because I can't use playerinteractevent

#

yeah but it does need nms

#

fuck

nimble vale
lyric gyro
#

can someone help me

nimble vale
#

and searched for a while in javadoc

lyric gyro
#

why cant I send images here

neat pierBOT
lyric gyro
#

Okay

dense drift
#

Is InventoryClickEvent the only way to do something when a player complete a trade?

lyric gyro
#

Why is it red

#

What do I have to do

#

I already installed buildtools

broken elbow
#

did you run buildtools for 1.19.2?

lyric gyro
#

I did for 1.19

broken elbow
#

also you need to tell it to use maven local

lyric gyro
lyric gyro
broken elbow
#

good question. I have no idea how to add the maven local repository on maven. just on gradle xD

proud pebble
#

also you dont have to afaik

#

you just change it to spigot in the pom.xml

lyric gyro
#

It's red, I don't think it will work

proud pebble
lyric gyro
proud pebble
#

from 1.19.2

lyric gyro
#

its not red anymore

#

I just erased the .2

#

and It became white

#

So I already added Maven local repository

proud pebble
#

well yeah cus youve ran buildtools on 1.19 and not 1.19.2

lyric gyro
#

Im stupid lmao I even have the folder open

proud pebble
#

to make your life easier you could use remapped mojang so your not dealing with a() b() etc

lyric gyro
#

do I need to restart Intellij?

proud pebble
#

why would you?

lyric gyro
#

It isn't recognising NMS commands

#

it's red

proud pebble
#

did you click the maven logo?

#

in your pom.xml

lyric gyro
#

Nothing happened

#

It's indexing

#

If that means anything

#

oh wait

#

now it does recognise the nms commands

#

thanks for your help mate

#

but I have another question

#

what is maven

#

and why is it important

proud pebble
#

uhh how else are you gunna compile your code?

#

yk, your setup to use maven to compile

lyric gyro
#

it's a compiler?

proud pebble
#

yes

merry knoll
#

no

lyric gyro
#

oh God

merry knoll
#

not really a compiler per se

#

its way for handling dependencies

proud pebble
#

well maven converts stuff from .java to .class and creates a jar thats useable, i would call that a compiler

lyric gyro
#

hmmm

proud pebble
#

like gradle

merry knoll
#

except that its not the one compiling stuff

#

its a project management tool is the best way to explain

lyric gyro
#

it's importing the command from net.minecraft.world, not net.minecraft.server, should I worry or it's the same thing?

#

the code isn't red or anything

proud pebble
#

the command?

lyric gyro
#

EntityCreature

proud pebble
#

its not a command

#

its a class

lyric gyro
#

yeah that

#

but it's not importing from net.minecraft.server

#

it's importing from net.minecraft.world

#

will this make a difference?

merry knoll
#

yes because thats where the class is located

proud pebble
#

everything isnt located in net.minecraft.server anymore

#

they refactored everything ages ago

merry knoll
#

if you are new to programming, i would stay away from nms stuff personally

lyric gyro
#

I'm hardcore

merry knoll
#

until you know at least basic class structure

lyric gyro
#

I started math with logarithms and then I learnt how to add

merry knoll
#

its up to you, but its going to make it more complex than it should be

#

since you need to deal with casting etc

lyric gyro
#

but will it make a difference or not?

merry knoll
#

yes it will.

lyric gyro
#

fuck

merry knoll
#

if thats not the class you need

#

then its not the class you need

lyric gyro
#

what can I do to solve this?

merry knoll
#

its not a "problem"

#

it depends on the context

#

do you need EntityCreature class?

#

if yes, continue if not.. why are you getting that class

lyric gyro
merry knoll
#

what are you trying to do exactly

lyric gyro
#

Well my idea is taking those horns that were added in minecraft 1.18

#

and make so it when you sound them, you will release a powerful ability

#

kind of like a ultimate attack you know

merry knoll
#

why do you need nms for that?

lyric gyro
#

and one of them specifically

merry knoll
#

spigot library is sufficient

lyric gyro
#

summons a horde of drowneds

#

that will attack other mobs (its part of the minigame)

#

and be your pets for a little while

proud pebble
#

afaik you cannot modify a mob's goals with the spigot api only

#

so nms would be required

#

or atleast thats how i see it

merry knoll
merry knoll
#

start from the easy tasks:
detect if they have the horn (maybe in hand)

#

change the horn data (its name, lore, make it shiny etc)

#

remove the horn, add cooldown

#

^ try making these first, none of them require nms

lyric gyro
#

yeah

#

these aren't hard to do right?

merry knoll
#

if you are new, its going to be hard

proud pebble
#

not really

merry knoll
#

dont expect to do it immediately

lyric gyro
#

mhm

merry knoll
#

but once you are comfortable with that much, you can start looking into nms as well, but its still a big jump

#

especially if you want to support multiple versions

lyric gyro
#

well

#

Idk what to say really

merry knoll
#

just start

lyric gyro
#

yes

#

But I do need EntityCreature to do it

#

right?

merry knoll
#

for ai yes

proud pebble
#

i wouldve thought it would be EntityDrowned

merry knoll
#

entitycreature is the superclass no?

proud pebble
#

ยฏ_(ใƒ„)_/ยฏ

#

all the tutorials ive seen they just extend the mob's class

merry knoll
#

apparently it is
EntityCreature - EntityMonster - EntityDrowned

#

in this order

#

each extending the one before

lyric gyro
#

I see

proud pebble
#

so it would be EntityMonster

merry knoll
#

would need to check the mappings honestly

#

not sure whats under all those classes

proud pebble
#

actually, entitycreature (pathfindermob) is a superclass of all monsters and animals

#

or atleast going off screamingsandles

merry knoll
#

of nms if you are developing for 1.18

#

you can use paperdevbundle for it

#

with gradle

#

makes your life quite a bit easier honestly

proud pebble
#

or you can add md5's plugin to your pom.xml, add <classifier>remapped-mojang</classifier> to your spigot dependancy in the pom.xml after you have added the --remapped flag to your buildtools start script

lyric gyro
#

so I have to extend EntityMonster first?

proud pebble
#

do the other stuff first before you get into the nms stuff

merry knoll
lyric gyro
#

what exactly would be basic java

#

like what part of java can be considered 'basic'

merry knoll
lyric gyro
#

The first plugin I made (a plugin that welcomes and says bye to you when you enter or leave the server) isn't working

merry knoll
#

what is the issue exactly?

#

any errors?

lyric gyro
#

Nope

#

Nothing

merry knoll
#

share the code and we can check

lyric gyro
#

I followed the tutorial exactly and it worked for the dude but not for me

proud pebble
#

copy and pasting code isnt a good way to learn tbh

merry knoll
#

dont follow tutorials exactly, you kinda need to try and fail until you dont anymore

lyric gyro
#

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

public class HelloWorlderListener implements Listener {

    @EventHandler
    public void onLeave (PlayerQuitEvent e){

        Player player = e.getPlayer();

        e.setQuitMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + player.getDisplayName() + ChatColor.RED + " Saiu do servidor :(... Volte sempre!" );

    }

    @EventHandler
    public void onJoin (PlayerJoinEvent e){
        Player player = e.getPlayer();

        e.setJoinMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + player.getDisplayName() + ChatColor.GREEN + " Entrou no servidor! :D Divirta-se!");

    }
}```
merry knoll
#

what is the main class

lyric gyro
#

what is a main class

#

jk

merry knoll
#

also, for future reference

lyric gyro
#

import org.bukkit.plugin.java.JavaPlugin;

public final class HelloWorlder extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic

        getServer().getPluginManager().registerEvents(new HelloWorlderListener(),this);

    }
}

// monki brain moment

merry knoll
#

you should start naming your packages

lyric gyro
#

this?

merry knoll
#

properly

lyric gyro
#

hm

merry knoll
#

helloworder.helloworder while is creative, is not good

proud pebble
lyric gyro
#

Well, first it's extending the JavaPlugin

proud pebble
#

why are you registering your listener in the onDisable method?

#

you want your logic to start onenable and your stuff to exit ondisable

proud pebble
#
@Override
    public void onDisable() {
        // Plugin shutdown logic

        getServer().getPluginManager().registerEvents(new HelloWorlderListener(),this);

    }
lyric gyro
#

The text formation on Discord is different for some reason

#

no wait

#

It isn't

#

Is that why isn't it working?

merry knoll
#

yes

#

you only tell spigot when your plugin is disabling

#

aka when your server is shutting down usually

lyric gyro
lyric gyro
proud pebble
#

yes

merry knoll
#

yes, just think about it in order

#

when my plugin enables, tell spigot to message my plugin when an event happens

#

is what you are doing there

lyric gyro
#

well, now it says the 'HelloWorlder' class was never used

#

warning not error though

merry knoll
#

thats normal

#

you are not using that class

#

your server is

lyric gyro
#

import org.bukkit.plugin.java.JavaPlugin;

public final class HelloWorlder extends JavaPlugin {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new HelloWorlderListener(),this);
        // Plugin startup logic

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic

    }```
#

So now is it correct?

#

Like that?

proud pebble
#

yes

lyric gyro
#

great

#

can yall teach me how do I download the project again

#

I kinda

#

forgor

merry knoll
#

download?

#

or compile?

lyric gyro
#

yeah compile

#

not download

merry knoll
#

you use maven

#

if you are using intellij

proud pebble
#

you click the green arrow

merry knoll
#

there should be a button for it on the top right

lyric gyro
#

you mean build project?

#

thats a hammer not an arrow

proud pebble
#

like that

#

you click the build option

#

or you can click the green arrow if its automatically been put there

lyric gyro
#

I just clicked build project

#

now what do I do

proud pebble
#

dont you have a maven button the left side of intellij?

merry knoll
#

right you mean i think?

lyric gyro
#

yes I do

proud pebble
lyric gyro
#

But mine doesnt look like this

proud pebble
lyric gyro
#

the green arrow is gray

#

the play button

proud pebble
#

then click the maven button

merry knoll
#

on the right there should be a tab

#

with " maven" on it

lyric gyro
#

Yes

#

it's open

#

now

proud pebble
#

do you see Run Configurations?

lyric gyro
#

I see Run Maven Build

#

which is gray

proud pebble
#

double click it

lyric gyro
#

nothing happened

proud pebble
#

post a ss of your maven tab

lyric gyro
proud pebble
#

whats in run configuration

#

click the arrow

#

the little one next to it

lyric gyro
proud pebble
#

what do you see

lyric gyro
#

run, debug, edit, delete

#

nah

#

sorry

#

im stupid

#

you mean the green arrow next to it

proud pebble
#

so you dont see anything like this?

lyric gyro
#

no

proud pebble
#

you see this?

lyric gyro
#

yes

proud pebble
#

click the little down pointing arrow

#

click edit configurations

#

add new configuration

#

in Run add clean package

#

make sure working directory is your project's directory

lyric gyro
#

brb

lyric gyro
#

are you still there?

#

we hired a new internet and i had to recieve the guy who will install it

#

anyways

#

everything is already there @proud pebble

#

clean package, working directory

#

what now

proud pebble
#

you now want to click apply

#

close it

lyric gyro
#

Ok

proud pebble
#

and then click the little arrow again and click the configuration you just made

#

then you should beable to click the green arrow

lyric gyro
#

run mavel build

#

right?

proud pebble
#

yes

lyric gyro
#

i still cant run that one

#

but I already did run the other green arrow

#

next to the maven thing with the down arrow

proud pebble
#

it should let you run it

lyric gyro
#

thats next to debug

proud pebble
#

the green arrow here?

lyric gyro
proud pebble
#

in your project on the left, do you see a target folder?>

lyric gyro
#

and when I run it, a new version of the plugin appeared on the target folder

#

in WE

proud pebble
#

ok thats right

lyric gyro
#

windows explorer

proud pebble
#

now you should beable to stick that jar in your plugins folder and use it

lyric gyro
#

i'm not the one using the plugin

#

it's for a server my friends are making

#

thanks for your help again

#

you are surely a highly helpful human being

proud pebble
#

i do try

nimble vale
#

what was the actual name of "zoom-in" as action in intellij

#

uh it's just "increase font size"

dark garnet
#

is commands.<command>.usage required in plugin.yml?

lyric gyro
#

no

merry knoll
#

does anyone know why shadow is failing to shade this
java.lang.NoSuchMethodError: 'net.kyori.adventure.text.Component me.aki.apexapi.common.util.ColorUtil.colorize(java.lang.String)'

#

they are in dependencies (and their methods show up properly)

#

its failing to relocate too it seems

pulsar ferry
#

Are you building with shadowJar?

merry knoll
#

yes

#

everything else relocates properly

#

for some reason net.kyori doesnt though

#

and it lacks the minimessage as well so im kinda baffled

pulsar ferry
#

Can you show your entire build script?

merry knoll
#

ye one sec

#

@pulsar ferry

pulsar ferry
#

Hmm it looks correct, it might be something to do with paperweight and shadow compatibility stuff, not exactly sure though
also interesting that you add kotlin 1.7 but shade std for 1.5 thonk

merry knoll
#

ah, i just copy pasted from an old project for the versions

#

maybe a weird interaction with extension functions?

#

colorize extends String maybe thats messing with either paperweight or shadow

#

nah, its an interaction with paperweight i think since its integrated in paper maybe they exclude it by default

lyric gyro
#

how do I make it so that the plugin checks what item the player just used

#

?

#

@merry knoll

#

sorry for ping

merry knoll
#

used?

lyric gyro
#
    public void arrowHit(ProjectileHitEvent event) {
        Projectile spectralArrow = event.getEntity();
        if (spectralArrow instanceof SpectralArrow) {
            World world = spectralArrow.getWorld();
            Location location= spectralArrow.getLocation();
            world.createExplosion(location, 2);

        }```
#

but since it isn't a projectile i want

#

(i want a consumable item)

#

how do i do it

proud pebble
#

do what exactly?

lyric gyro
#

check if the item the player used is the correct one

proud pebble
#

actually, why do you want it

lyric gyro
#

that thing with the horns i said earlier remember?

#

that i wanted to do

proud pebble
#

when you say correct one, what would a correct one be?

lyric gyro
#

a goat horn

#

if the player used a goat horn

#

heal

proud pebble
#

then why did you post something relating to a spectal arrow then?

#

playerinteractevent

lyric gyro
#

I said "something like this"

#

Projectile spectralArrow = event.getEntity();

#

this line of code specifically

proud pebble
#

projectile hit event is not at all similar

lyric gyro
#

instead of projectile what do i put