#help-development

1 messages ยท Page 130 of 1

onyx fjord
#

does mc store that somewhere?

tender shard
onyx fjord
#

WAIT

#

uhh

tender shard
#

you have to keep track of that yourself

onyx fjord
#

kinda theres a thingy

#

i can check if player has discovered ingredient

#

but not all ingredients are craftable

tender shard
#

exactly

#

many things are not "discoverable"

#

e.g.

#

iron ore

#

there is no recipe for iron ore

onyx fjord
#

can i check that tho?

tender shard
#

no

#

you'd have to keep track of this yourself

#

e.g. get a PDC for "items-this-player-already-had-in-their-inv"

#

then save every material's name() there

odd wedge
#

Wouldnโ€™t it be better to check whenever a player picks up, crafts etc

onyx fjord
#

breh then how does mc do that lol

#

all i wanna do is do it as mc does

odd wedge
#

They check when you have it in your inventory

tender shard
odd wedge
#

Then they store the intruders you do

onyx fjord
#

well

#

but recipe discovering kinda works that way

tender shard
#

MC has a builtin statistics thing for "times picked up, times crafted, ..." but this wouldnt e.g. work for stuff that you get added using addItem(...)

onyx fjord
#

yeah

#

then i can check times picked up X

tender shard
#

if that works for you, sure

onyx fjord
#

and if its higher than 0 continuie

#

whats the method

tender shard
#

erm

#

idk

#

sth like this I guess ??? java

#

player.getStatistic(Statistic.MINE_BLOCK, Material.DIRT);

#

oh shit

#

yeah anyway, you get the idea

onyx fjord
#

o

tender shard
#

seems like there is no stat for "picking up stuff"

onyx fjord
#

Statistic.PICKUP

tender shard
#

oh

#

I must have overseen this

onyx fjord
#

is crafting something also counting as pickup?

tender shard
#

idk

#

probably not

#

I think "picking up" refers to the actual "picking stuff up" thing

eternal night
#

^

#

iirc the item entity triggers that

tender shard
#

yeah thats what I think too

eternal night
#

tho you have item crafted too

#

so I guess

#

combine and enjoy

tender shard
#

exactly, just check both

onyx fjord
#

ez fix

tender shard
#

I mean there isnt really any way to obtain an item except for crafting or picking it up

#

except for stuff added by Inventory#addItem(...)

eternal night
#

I mean you won't ever catch those

#

unless you run a task timer

tender shard
#

yeah, checking the "pickup" and "craft" stuff is probably good enough :3

eternal night
#

or you inject yourself into the slot listeners

#

but das work

#

and we all hate work

tender shard
#

btw lynx you probably can answer this

#

wtf are mixins haha

#

is this some forge/fabric invention?

eternal night
#

comes from spongepowered

tender shard
#

or was this part of java like forever?

#

oh okay so it's not part of normal java

eternal night
#

think of it like reflection but on absolute crack

tender shard
#

aight, that's what I suspected. thanks

eternal night
#

theirs docs are an interesting read

#

if you have too much time on your hands

#

pretty powerful tech, just

tender shard
#

maybe tomorrow ๐Ÿ˜„

eternal night
#

hard to learn, harder to master

mint siren
tender shard
#

I know a good amount about "hard things" ๐Ÿง 

#

scnr

fluid river
odd wedge
odd wedge
#

Easy to learn hard to master

fluid river
#

Not easy

odd wedge
#

Yes it is

fluid river
#

After java that was downgraded hardness essence

#

For me

fluid river
#

Bro using -> to call object's method

#

instead of .

tender shard
#

that looks like you have 2 plugins

robust light
#

player.getPersistentDataContainer(); says Cannot resolve symbol, can someone help me?
(PersistentDataContainer data = new player.getPersistentDataContainer();)

fluid river
#

Everytime creating .h file, not only cpp

robust light
undone axleBOT
odd wedge
#

new player.getPDC

eternal night
odd wedge
#

Remove the new keyword

eternal night
#

you cannot use it on spigot or its forks tho

#

as a heads up

tender shard
#

you can, but it's very annoying

eternal night
#

well no

tender shard
#

I've seen plugins use mixin

eternal night
#

you need a custom injector

#

like ignite

tender shard
#

yeah

eternal night
#

or ignition ?

fluid river
#

The worst thing about cpp is that u need to instal gcc compiler urself

tender shard
#

that's what I meant with saying "annoying"

fluid river
#

or not only gcc

odd wedge
#

Sounds like something for me

#

Time to develop a plugin using mixin

fluid river
#

depends on what devs want to use

eternal night
#

or just fork your server software xD

#

and write proper api

tender shard
#

yeah ahaha

mint siren
odd wedge
#

Sounds like a boring idea

tender shard
eternal night
#

or they reloaded

fluid river
#

I tried JNI, wrote the code rly fast and then realized i need gcc to build .dll library

tender shard
#

yeah

fluid river
#

Spent like 2 hours on downloading and installing and removing useless stuff

tender shard
#

that's the problem

fluid river
#

And then realized i installed 32bit gcc

tender shard
#

you cannot cast class A to class B just because they have the same name

odd wedge
#

Imagine not using Vc code and have it install the compiler for you

fluid river
#

And 32 bit can't make .dll i need

#

cuz 64 bit java app

odd wedge
#

You can ask it to yes

fluid river
#

I used normal visual studio

mint siren
fluid river
#

But when i worked with JNI i used Notepad++))))

tender shard
fluid river
#

Cuz i know syntax and includes perfectly

mint siren
tender shard
#

oh okay, then I misunderstood

#

then I also have no clue

mint siren
#

No problem.

tender shard
#

your stacktrace suggests that you have two different .jar files

#

weird

#

try to properly restart the server ๐Ÿ˜›

mint siren
mint siren
heavy swan
#

I made an item with ItemStack and what I want is that when I enchant it in the enchantment table it is added after the lore that the item has, how can I do it?

#

XD

agile anvil
#

Isn't it the base Minecraft behavior ?

#

Could you show us some screen of what you get ?

fluid river
#

or smth similar

#

If item has persistent data container with your custom tag

#

get it's meta, then lore, then change it

robust light
#

how can I set the folder that the plugin is being built to? Using intellij Idea

heavy swan
fluid river
#

Artifact smth

#

Start using maven and just do clean package

rigid drum
#

Gradle*

fluid river
#

who cares

stiff zinc
#

Does anyone have an idea of how Hypixel disables the Done button in the book inventory and also opens another book inventory depending on the ClickEvent

#

I doubt they are using ClickEvent.Action.RUN_COMMAND

quiet ice
#

The click event thing probably uses commands

#

And If I had to guess the done button is not present because the book is signed/immutable

stiff zinc
#

Oh the button is present

#

But you can't click on it

#

I guess

quiet ice
stiff zinc
#

Well I'm not sure, that's why I'm asking haha

#

I'm wondering if there's a way to disable the Done button, or at least listen for an event, so I can know when it's being clicked

twilit roost
#

does someone know some way to make primary command which has another commands under it?
I would like to make it modular the same way CMI does it

iron glade
#

I don't quite get you

hazy parrot
#

which you get passed by onCommand method

twilit roost
#

for example CMI registers the command the normal way but also adds it into /cmi <those cmds there>
which I would like to reacreate
if you get me

quiet ice
#

Probably uses it's (own) command framework

twilit roost
#

yee they have their own framework
im trying to create it somehow but idk where to start

echo basalt
quiet ice
#

Ah, so basically you want to add a subcommand to cmi?

quiet ice
#

Just RE CMI I guess

echo basalt
#

In my custom command util, I have it as "one.two.three.*" -> /one two three <arg>

twilit roost
#

well not to cmi
to my plugin
but the in simillar way they use it

echo basalt
#

type deal

#

you can make it register both as /class code <arg> and /plugin class code <arg> if you're into that

twilit roost
#

ok and how to handle them?

quiet ice
echo basalt
#

register a BaseCommand on the command manager, hadnle tab completion n all

#

it's like 200 lines of processing

cobalt thorn
#

[19:47:25 ERROR]: Could not pass event PlayerInteractEvent to MeridianaCore v1.1
java.lang.NullPointerException: Cannot invoke "java.util.List.get(int)" because the return value of "org.bukkit.inventory.meta.ItemMeta.getLore()" is null

Code: https://sourceb.in/NBEs6wFBRA the line is after getting the thing

cobalt thorn
echo basalt
#

if the lore is null, or the item meta is null (item without lore, let's say), you'll have issues

#

now refactor your code before I call the cops

quiet ice
#

You'd basically have something like

public class CommandNode {
    private Map<String, CommandNode> nodes;

    public boolean execute(String[] args) {
        if (args.length == 0) throw new IllegalStateException();
        String[] z = new String[args.length - 1];
        System.arraycopy(/* You know the jazz */);
        CommandNode n = nodes.get(args[0]);
        if (n != null) n.execute(z);
    }
}
echo basalt
#

a bit more than that

reef lagoon
#

what am i doing wrong

quiet ice
#

For tab completion yeah - but it'd be easy too

echo basalt
quiet ice
#

Because you are using dots for seperators - just using spaces is good enough :)

cobalt thorn
ivory sleet
echo basalt
#

if you want to, for example

cobalt thorn
#

i mean like the error is only there but if i remove that section with return the same give the error

echo basalt
#

/island invite <playername>

reef lagoon
echo basalt
#

In my util, I just do island.invite.* and the playername gets passed as arg[0]

quiet ice
echo basalt
#

I can also override a method has a Map<Integer, List<String>> for tab completion lol

ivory sleet
#

or wrong import

quiet ice
#

Doing it recursively is what makes it so powerful while being simple

echo basalt
#

brigadier is annoying and not my library lol

#

my stupidass prefers to write my own libraries for 90% of things

quiet ice
#

There are plenty of decent to great wrappers out there

echo basalt
#

I only settle for ProtocolLib and NBT-API sometimes

quiet ice
#

But having the tab completion be on the client is kinda nice

echo basalt
#

time to send packets

reef lagoon
quiet ice
echo basalt
#

brigadier grr

fervent gate
#
PersistentDataContainer coalContainer = coalChest.getPersistentDataContainer();

Chest dungeonChest = (Chest) clickedBlock.getState();
PersistentDataContainer container = dungeonChest.getPersistentDataContainer();```
How come these 2 are different when they are the exact same block?

```[21:12:37] [Server thread/INFO]: org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer@c259b700
[21:12:44] [Server thread/INFO]: org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer@3```

These  are the 2 in order, printed out
eternal night
#

getState creates a clone

glossy venture
#

yeah

trim surge
#

anyone here a github god? need massive help lol - if you can vc its easier

fluid river
#

cuz items has null lore in the beginning

fervent gate
#

Which, in my case, is a chest

glossy venture
eternal night
#

Oh lol

fervent gate
glossy venture
#

ok

fervent gate
#

I can't save that directly on a block?

glossy venture
#

pdc does some weird shit to constantly transfer between nbt and pdc i think

#

maybe thats a problem

#

idk

fervent gate
#

is there another way to achieve the same thing?

eternal night
#

Are you updating your state

fervent gate
#

store a unique id in a block, which in my case says that it is a dungeonChest

eternal night
#

Like calling update

fervent gate
#

no

eternal night
#

Well

#

That might be your issue

fervent gate
#

hmm, lemme try that

eternal night
#

(it is)

#

Block states are usually snapshots

#

So any mutation won't show

#

Unless updated

fervent gate
#

didn't know that, thanks

twilit roost
# echo basalt

heey
soo I made this:
just need to get it to execute now

Should I just retrieve the command using its identifier and run execute(..?

echo basalt
#

yes

twilit roost
#

oh thx

granite burrow
#

Is it possible to create a sign GUI that i can call for player's to edit

echo basalt
#

packets

#

but yes

granite burrow
#

dam alright

cobalt thorn
serene sigil
#

hi, how do i get the players total exp? i tried player.getTotalExperience but that returned 0 when i had 100 levels

fluid river
#

bro

#

event.getItem().getItemMeta().getLore() != null

cobalt thorn
serene sigil
prisma palm
#

will p.getName() still work since mojang is discontinuing the name api

fluid river
eternal night
#

They are removing the name history API. Not name API

serene sigil
prisma palm
#

oh ok

#

mb then

cobalt thorn
fluid river
#

as level

serene sigil
#

but i need exp

#

not level

fluid river
#

idk then

fluid river
cobalt thorn
# fluid river where
            if(event.getItem().getItemMeta().getLore() == null || event.getItem().getItemMeta().getLore().size() < 0 || event.getItem().getType() == Material.AIR) {
                return;
            }

this way should work theorecaly

fluid river
#

you basically messed it up

cobalt thorn
fluid river
#

you need || here

#

and you don't even need second check actually

serene sigil
fluid river
#

just leave first

fluid river
#

getLevel() returns level

#

getTotalExperience() returns exp collected through time

serene sigil
fluid river
#

paper maybe has what you need

#

ultimate solution is own exp system

#

which displays level as minecraft level

#

but in core has different setup

vivid skiff
#

How can i check if a player is not standing on a chest?

worldly ingot
#

I don't think vanilla even tracks that value as a single integer

serene sigil
iron glade
worldly ingot
#

To my knowledge, it holds their level and a float from 0 - 1 for the progress of the current level

fluid river
iron glade
#

why would you have to clone it?

fluid river
#

Most of the time if you don't clone location, you gonna mess up everything

iron glade
#

you're not doing anything with the location itself here

#

don't think you need to clone it in this example

fluid river
#

Most of the questions asked on spigotmc forum were solved by clone

serene sigil
fluid river
#

I once tried to build a structure by adding and subtracting ints from location

#

And i only got it working with clone

#

add and subtract methods do not return clones

#

they modify location itself

#

and it sucks

#

I once made a safe location wrapper

worldly ingot
#

Locations fetched from Bukkit objects are more often than not new objects

fluid river
#

with methods like flatMagnitude

worldly ingot
#

No need to clone it

iron glade
fluid river
#

Used it a lot

#

and suggested a lot

eternal oxide
#

In certain cases yes not many thought

fluid river
#

yeah

eternal oxide
#

Player.getLocation() is a clone already

fluid river
#

alr

fluid river
#

not for everything still

serene sigil
fluid river
#

well you can wrap it

#

with CommandPreProcessEvent

#

if it calls some kind of xpchangeevent then u can just apply it to your system

serene sigil
#

wdym?

fluid river
#

you just cancel the event

#

and add xp by your xp system

serene sigil
#

like basically im doing a command to /transfer exp to players

fluid river
#

oof

#

just make level transfer

serene sigil
#

so its harder with exp?

mighty pier
fluid river
serene sigil
#

the problem with transferring levels is that levels get harder and harder to get every time

mighty pier
fluid river
#

ArrayList is better

mighty pier
#

no

fluid river
#

isn't it

mighty pier
#

then no order

#

its meant to mirror target's inventory

#

then you can put items

#

and take out

#

i mean you can with arraylist

#

but

#

then i have to use .add and .remove

#

which is kinda funky

fluid river
#

I would suggest creating a mirror inv

#

With custom holder

#

Instead of lists

mighty pier
#

m

#

maybe

fluid river
#

Holder would have two fields

#

and getters

#

one for who is viewing

#

and one for who's inventory

#

So when you click inv and it's holder is instanceof CustomHolder

#

then you can get target from holder

#

and modify it's inventory

mighty pier
#

not understood

fluid river
#

?

#

call me

serene sigil
fluid river
#

not exp itself

#

in your plugin

fluid river
#

ah rly

#

then i don't know

#

)))))

serene sigil
#

rip

mighty pier
#

turn levels into exp

fluid river
#

I don't know how to get xp formula

#

for level

mighty pier
fluid river
#

Is it published somewhere

molten hearth
mighty pier
#

just

fluid river
mighty pier
#

yes but

#

how store

#

what do i store it in

vivid skiff
#

Nothing is working, i tried like anything

fluid river
#

Inventory inv = Bukkit.createInventory(new CustomHolder(senderPlayer, targetPlayer), 36, targetPlayer.getName() + "'s inventory");

mighty pier
#

customholder

#

not a thing

vivid skiff
#

why isn' t the chest part working this is the code

if (block.getType().equals(Material.AIR) || (block.getWorld().getBlockAt(block.getX(), block.getY() - 1, block.getZ()).getType().equals(Material.AIR)) && !(block.getWorld().getBlockAt(block.getX(), block.getY() - 2, block.getZ()).getType().equals(Material.CHEST)))

mighty pier
#

i have to make an interface?

fluid river
#
public class CustomHolder implements InventoryHolder {

    private UUID viewer, target;

    public Player getViewer() {
        return Bukkit.getPlayer(viewer);
    }

    public Player getTarget() {
        return Bukkit.getPlayer(target);
    }

    public CustomHolder(Player one, Player two) {
        viewer = one;
        target = two;
    }

    @Override
    public Inventory getInventory() {
        return null;
    }
}```

```java
@EventHandler
public void onClick(InventoryClickEvent e) {
    if (e.getInventory() == null || e.getInventory().getHolder() instanceof CustomHolder) {
        CustomHolder holder = (CustomHolder) e.getInventory().getHolder(); // use pattern matching if java > 10
        Player target = holder.getTarget();
    } 
}```

```java
public boolean onCommand(...) {
    Player playerSender = (Player) sender;
    Player targetPlayer = Bukkit.getPlayerExact(args[0]);
    Inventory inv = Bukkit.createInventory(new CustomHolder(senderPlayer, targetPlayer), 36, targetPlayer.getName() + "'s inventory");
    inv.setContents(targetPlayer.getInventory().getContents());
    playerSender.openInventory(inv);
}```
pseudo hazel
#

can I use json components in Player.sendTitle() just like I can can when using the command in vanilla?

#

to do stuff like this /title me title [{"text":"just an example"}]

#

as far as I can see there are only string inputs, which dont work

quaint mantle
#

Aloha again
I am wondering about best practice here
When I want to create a handshake on a plugin channel with a mod
Would I initiate it from the server or from the client?
Or doesn't it really matter?

#

Like
Either starting from player join event
Or from the clients login event

flint coyote
#

I'm not into modding at all. Usually you want to open connections from a client.
In that case it probably does not matter since both sides have the same info.

mighty pier
#

i love getting spoonfed

fluid river
#

ez

#

i think you know java

quaint mantle
mighty pier
#

too lazy to watch the tutorial

pseudo hazel
#

thats a bold claim

fluid river
#

i think it would be better if you start from playerjoinevent

quaint mantle
#

That's how I would have preferred it

fluid river
#

Not in modding at all too

fluid river
mighty pier
#

m

#

tommorow

#

whats your timezone

fluid river
#

it's 23 for me

#

russia

flint coyote
mighty pier
#

same

#

k

#

lithuania

fluid river
#

close

mighty pier
#

yes

fluid river
#

relatively

mighty pier
#

what city?

fluid river
#

Moscow, capital

mighty pier
#

which

#

m

flint coyote
#

So if you just wanna message a plugin do it from the mod. If a plugins has the full control and just has to tell stuff to the mod then do it from the plugins side

mighty pier
#

im gonna be home at like 15:00

fluid river
#

you will have to register outgoing and incoming channels anyways

#

Probably

#

Idk when i'm gonna be home

quaint mantle
fluid river
#

probably 17:00 to 17:30

#

if i don't stop at KFC and spend hour there too

mighty pier
#

do you have homework?

fluid river
#

I'm in a university

#

I basically don't have homework i'm forced to do

flint coyote
#

e.g. from a website

fluid river
#

On some disciplines your homework is needed to get access to exam

#

but i'm already done with them

mighty pier
#

i spend like 10 hours per day doing school stuff

fluid river
#

school = cringe

mighty pier
#

yes

fluid river
#

university = chill

mighty pier
#

my history teacher is really boring

fluid river
#

University = can find a Java programmer job while studying

#

Already applying

#

russia โค๏ธ

mighty pier
#

is kfc not banned?

fluid river
#

mcdonalds has different name

mighty pier
#

yes

fluid river
#

that's all

#

Nothing is banned

odd wedge
fluid river
#

You are russian too?

odd wedge
#

No

quaint mantle
fluid river
#

then tf

odd wedge
#

You know there is something called news

#

I know Russia doesnโ€™t give any news thatโ€™s tru

#

e

mighty pier
#

vpn

fluid river
#

I mean we were talking about russia

#

where i live

odd wedge
#

Russia is a shithole right now

fluid river
#

Not really

#

I mean Moscow is always good

#

No matter what happens to other cities

mighty pier
#

other

fluid river
#

true

#

i'm kinda chillin

#

have 200% more spelling mistakes

odd wedge
#

The gdp dropped 11%

fluid river
#

so?

odd wedge
#

Going to drop

#

More

fluid river
#

and

mighty pier
#

didnt it drop everywhere

#

i mean

fluid river
#

how does that affect russians only

quiet ice
#

The only real issue is that the GDP will not recover significantly anytime soon

mighty pier
#

my lunch money increased due to inflation

fluid river
#

My lunch money didn't change last 3 years

odd wedge
fluid river
#

Except kfc baskets now cost like 0.3 dollars more

river oracle
odd wedge
mighty pier
#

i got 5 euros per week when i was in 1st grade, now i get 15 euros

alpine urchin
#

guys this is development

mighty pier
#

shut up

fluid river
#

politics in chat

odd wedge
fluid river
#

developing our minds

odd wedge
river oracle
ivory sleet
#

Listen to retrooper

quiet ice
#

A lot of countries are hurt by the global situation, it just happens that russia will be one of the few coutries to be affected in the long term

mighty pier
#

there is unclaimed land somwhere in africa, lets go colonize it

#

i forgot where it is

fluid river
#

moscow will just transfer problems to other cities

odd wedge
fluid river
#

And have no problems

#

That's why we are the biggest country

quiet ice
ivory sleet
#

Move to #general in case you guys didnt get it, thanks

mighty pier
#

no

ivory sleet
#

?kick @mighty pier

undone axleBOT
#

Done. That felt good.

river oracle
#

Lmfai

mighty pier
#

wtf

ivory sleet
#

Guys literally, this channel isnt a general chat, take it seriously

mighty pier
#

noone needed help

#

nobody

pseudo hazel
alpine urchin
#

he did

ivory sleet
#

Doesnt mean you can go on and talk about other stuff

iron glade
#

Never seen anyone care if this is general or not tbh

#

like people go off topic all the time here

pseudo hazel
#

but they shouldnt

ivory sleet
#

^

iron glade
#

yeah just saying

pseudo hazel
#

having only 1 help channel is bad enough

pseudo hazel
#

well I havent figured out how yet though

quiet ice
#

Try it out, if it does not work it doesn't otherwise yes

pseudo hazel
#

okay so it doesnt

odd wedge
quiet ice
#

So yeah, then there are no workarounds

quiet ice
ivory sleet
pseudo hazel
#

sad

pseudo hazel
#

thanks for the help anyways

quiet ice
pseudo hazel
#

wdym why

#

I am talking about player.sendTitle

quiet ice
#

?jd-s

undone axleBOT
alpine urchin
#

with spigot api you can send a string with chat colors

#

so i dont see why you want json components

pseudo hazel
#

because I want to send item translations

#

i.e. a title which will show the correct name for whichever language they are using

#

which pretty much requires either TranslatableComponent or JSON

eternal night
#

channel your inner kacper and just say "I never need that"

eternal night
#

lEgAcY tExT iS bEtTeR

eternal night
#

does spigot not have send title with component ?

pseudo hazel
#

I want to refrain from using paper

eternal night
#

like in their spigot()

pseudo hazel
#

idk

#

it only has sendMessage

quiet ice
pseudo hazel
#

but the sendType or w/e doesnt include title

quiet ice
eternal night
#

probably your best bet yea ^

#

or NMS

alpine urchin
#

god damn spigot, i think choco was talking about a pr to rework components

#

so maybe itll be possibly in the future

eternal night
#

nah no rework

#

just more support for them

quiet ice
#

Well more like expansion

eternal night
#

yea

simple silo
#

any idea why my plugin crashes with the error java.lang.NoClassDefFoundError: net/minecraft/nbt/CompoundTag?
My Maven dependency:

<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
</dependency>
eternal night
#

your plugin is not remapped/reobfed

quiet ice
pseudo hazel
#

okay I see, well thanks for the help i guess lol

river oracle
simple silo
quiet ice
#

yeah, you need to use the specialsource plugin there (there is some random post detailing how it works, someone should spam the link in a moment)

quiet ice
#

That was the rando post I mentioned

river oracle
#

๐Ÿ‘€

simple silo
river oracle
#

cuz I need it every time I use nms

quiet ice
#

When it comes to maven I always copy & paste stuff from one of my main plugins

river oracle
#

I've yet to make an OS setup script :( too lazy

quiet ice
#

Archetypes are not my thing

river oracle
#

not a big archetype user huh?

eternal night
#

cool kids just maintain a github template

river oracle
quiet ice
#
java.io.IOException: Unable to find POM for GAV[group=org.eclipse, artifact=jface, version=3.3.0-I20070606-0010 [Interpreted as 3.3-i-20070606-10]]

I hate maven.

simple silo
river oracle
quiet ice
worldly ingot
#

I'M TRYING

eternal night
#

smh

worldly ingot
#

IT'S IN THERE I PROMISE

eternal night
#

๐Ÿ™ doing gods work

worldly ingot
#

I recently bumped it too!

eternal night
#

leaking internal communication ?!

vocal cloud
#

Now do @Since hes_UwU

deep beacon
#

(bungeecord) anyone got any idea how to set forcedHosts using the code?

pulsar parcel
#

can I somehow add entity to team? like team.addEntry(entity.getUniqueId())?

eternal oxide
#

yes

formal comet
#

How create api ?

worldly ingot
#

Anything publicly accessible is an API

#

Whether or not it's good is a different story

remote swallow
#

Anyone know how i could add fortune to custom drops but directly adding it to inventory, this is probably jank as fuck but ill fix it later

Current code:

if (drops == Material.REDSTONE_BLOCK) {
            event.setDropItems(false);
            ItemStack redstone = new ItemStack(Material.REDSTONE, 9);
            player.getInventory().addItem(redstone);

        }
fluid river
#

what do you mean

#

fortune

remote swallow
#

If i had a pickaxe with fortune 5 on, how could i apply that to my ItemStack amount

twilit lynx
worldly ingot
#

I mean applying fortune to the block and drops you're doing here is going to result in dupes, so long as you're aware of that.

#

But yeah, just have to get the level, then add to the drop count however you see fit

remote swallow
#

Does fortune just work by multiplying the drops by fortune amount or is it different

worldly ingot
#

It varies from item to item

#

Lapis for instance is more affected by fortune than coal is

#

The formula to calculate the average drops multiplier is <see attached>, which means Fortune II gives 1.75x (13โ„4) drops on average, Fortune III gives 2.2x (21โ„5) drops on average, etc.

#

At least by the wiki

#

That's average though

fluid river
#

just send data when needed

#

on joins

#

on leaves

#

not on timer

#

except for hard events like move or blockphysics

tender shard
undone axleBOT
pulsar parcel
#

Hi, I am wondering how to add entity to team. I tried team.addEntry(entity.getUniqueId.toString) but it does not work. Is here other way to do it?

agile anvil
pulsar parcel
agile anvil
#

You should Team#getEntries().size()

eternal oxide
#

Teams add players by name, add Entities by UUID

pulsar parcel
agile anvil
pulsar parcel
agile anvil
pulsar parcel
#

if you mean addEntry(p.getName()) yes

agile anvil
#

Mhhh

#

Can you paste your code where you add an entity ?

pulsar parcel
#

I am spawning villager and adding him to team here: https://pastebin.com/n64LUraq (List name are random names)
And here is my team class: https://pastebin.com/K9NDjCKN

eternal oxide
#

You are running this on java 8?

#

if not you need to initialize a driver Class.forName(driver);

eternal oxide
pulsar parcel
#

I know this, I was just testing something and forgot to change it back

eternal oxide
#

Then its not going to work adding by name

#

you can;t "test" somethign which is not going to work

agile anvil
eternal oxide
#

Players you add by name, Entities you add by ID.toString()

agile anvil
#

You should use a singleton pattern, or use dependency injection, or even use static to accomplish what you are trying to do

eternal oxide
#

of course that works.

#

you have not initialized any driver

tender shard
#

did you even shade it properly?

#

oh yeah you did

eternal oxide
#

Show us the code where you initialize the driver

pulsar parcel
tender shard
#

"Failed to get driver instance for ..."

#

did you add the "..." part?

#

or is this the original message?

#

show the URL please

#

because this must be where the error comes from

#

hm looks good to me

#

weird

eternal oxide
#

Class.forName("com.mysql.jdbc.Driver");

tender shard
#

yeah try to run this BEFORE you access mysql stuff

#

what Elgar said

agile anvil
# pulsar parcel oh, so can you give me an example how to make it?

Let's say you have a "Scoreboard" class (the one you already have). You should create an instance of it in your Main class and save it as a variable. (public Scoreboard myScoreboard... And in the onEnable set that variable... myScoreboard = new Scoreboard()).
Then in your Villager class, create a constructor with in arguments Scoreboard scoreboard. Then save this argument in the Villager class to use it ! Instead of doing new Scoreboard() in the Villager class

#

I'm on phone right now, and just about to sleep sorry

eternal oxide
#

then you have no sql driver

tender shard
#

then the problem is obvious, yeah

eternal oxide
#

thats not what I told you

tender shard
#

you fucked up the shading thing

#

wtf

#

why did you class.forName the DataSource object

#

try to use exactly what Elgar sent

eternal oxide
#

if you are using v8 driver you use com.mysql.cj.jdbc.Driver

tender shard
#

how do you compile? using your IDE, or using maven?

eternal oxide
#

but the first one will work for new or old

pulsar parcel
tender shard
#

you do have the maven-shade-plugin in your pom right?

#

I see

agile anvil
tender shard
#

this is your problem

#

you need to have the maven shade plugin

eternal oxide
#

nah, if no shade plugin Hikari is still shaded, but not relocated. It will still work

tender shard
#

without maven-shade, nothing gets shaded

eternal oxide
#

he has no scope on it so it gets shaded

tender shard
#

you need this (without all those relocations)

tender shard
eternal oxide
#

at least in Eclipse with no scope it gets shaded

tender shard
#

whut

#

no

eternal oxide
#

yes

tender shard
#

remove your shade-plugin, then do mvn packave

#

you will see that nothing gets shaded

eternal oxide
#

honestly it does

tender shard
#

it does not

eternal oxide
#

in Eclipse, no plugins and no scope it shades

tender shard
#

with shade plugin

eternal oxide
#

Yes you only get one jar but its all shaded

tender shard
#

without shade plugin

fervent gate
#

Is there a way to have a unique identifier for an inventory?

tender shard
fluid river
tender shard
eternal oxide
#

um you may be correct. I just tested adn it didn;t shade. I guess it changed

fervent gate
tender shard
eternal oxide
#

odd I remember the opposite. It always shaded crap I didn't want with no plugins

#

I guess you are right. my memory is just bad

tender shard
fluid river
eternal oxide
#

yes shade

tender shard
#

yes, you have to add the maven shade plugin to your pom

fluid river
#

and check if inventory clicked is in this list

eternal oxide
#

unless you use the libraries feature in plugin.yml

tender shard
#

no

#

no

#

like this ^

#

you 100% need the <executions> part

#

you just leave it like this

#

and then hopefully, it will work now lol

eternal oxide
#

show your code with teh class.forname in it

undone axleBOT
eternal oxide
#

That is only a valid driver if you are shading the v8 driver for mysql

undone axleBOT
eternal oxide
#

yes, wrong driver

#

uncomment the second one

#

that driver is included with spigot

#

it can;t fail to be there

#

its litterally IN spigot

#

are you not using spigot?

#

is this not Spigot code?

#

Then you need to include a mysql driver as well as Hikari

tender shard
#

oh yeah you ofc need some mysql driver as well

eternal oxide
#

latest that uses the first driver in your code is mysql:mysql-connector-java:8.0.30

tender shard
#

you need java 17+

eternal oxide
#

or use the older v4 of Hikari

#

I think its 4 for legacy

tender shard
#

Hikari needs Java 11+

#

1.8 also works fine on java 11

#

so either go for java 11, or downgrade the hikari version

eternal oxide
#

you have java 8 on your server

#

You can't build for java 11 and run it on java 8

lethal knoll
#

Not sure if I'm doing something wrong, but is it normal that Block::getLocation() doesn't contain a world?

eternal oxide
#

impossible

lethal knoll
#

checking what is wrong

#

okay, what is wrong is me being stupid -_-

#

big faceslap to myself ...

worldly ingot
unborn kiln
#

Hello, how would I go about making it so that NMS EntityPlayer's can take damage?

eternal oxide
#

you are creating a Fake ServerPlayer?

unborn kiln
#

No, an EntityPlayer via packets and NMS

eternal oxide
#

EntityPlayer = curreent day ServerPlayer

unborn kiln
#

alright then, I guess yeah

unborn kiln
#

ty

#

bruh, that legit it missing a whole constructor lmao

eternal oxide
#

no its not

#

read it properly. it is very complete. I used it myself to design my own FakePlayers

unborn kiln
#

๐Ÿค”

eternal oxide
#

Thats because you skimmed it and didn;t read.

#

public class Test extends ServerPlayer {

unborn kiln
#

oh wow, ty for the help

echo basalt
#

uh

#

in what context?

lost matrix
#

You mean for a bukkit task?

#

yes

#

Depends how you scheduled it.

#

Did you use it as a Thread action? Or schedule it with an executor service?

#

Because a runnable is just a normal class that does nothing on its own.

#

"probably"

#

Well then it depends on the executor and how you scheduled it

#

Show some code.

#

If you submit/execute then its being run instantly. Otherwise its scheduled for a time in the future.

#

I would not use an executor service for that. Use the bukkit scheduler.

hazy parrot
#

Yes

#

I mean depends, but generally yes

lost matrix
#

Every variable in java is a references to an actual object.
Exceptions being primitives.

sinful hatch
#

Does spigot's maven repo block non maven/gradle requests? trying to build a plugin on bazel and spigot's maven repo is 403ing

hollow pelican
#

How do you get an Entity from an EntityType?

lost matrix
hollow pelican
#

I'm trying to target an entity in a command by it's type.

lost matrix
#

So you want to target all entities of this type which are currently loaded and active on the server?

hollow pelican
#

Yes.

echo basalt
#

getEntitiesByType is a thing

echo basalt
#

then you just pass the class iirc

#

or byClass or whatever

hollow pelican
#

Thanks. ๐Ÿ™‚

potent quest
#

is there anything i can pass to the stdin of a running spigot jar to get raw data like players info etc if im running it through a pipe in c

lost matrix
#

You want the console output?

echo basalt
#

man's making a C application

#

make a socket system and transmit whatever data you want with a custom plugin

potent quest
#

i dont want the console output specifically, im wondering if theres anything write to the file descriptor of the pipe to get like player count etc

#

fair

echo basalt
#

or use influxdb lol

potent quest
#

making my own server implementation to solve this ong

boreal python
#

How do I get a players name in a scheduled task?
I want it to run the task with each player on the server.

lost matrix
#

Create one task -> inside call Bukkit.getOnlinePlayers()

boreal python
#

yeah but that would get all online players, I just want it to get each player individually

lost matrix
#

Then implement a runnable which knows the UUID

lost matrix
# boreal python yeah but that would get all online players, I just want it to get each player in...
public class SomePlayerTask extends BukkitRunnable {

  private final UUID playerId;

  public SomePlayerTask(UUID playerId) {
    this.playerId = playerId;
  }

  @Override
  public void run() {
    // Get player
    Player player = Bukkit.getPlayer(playerId);
    // If null then the player is offline
    if(player == null) {
      // For this case cancel the task
      this.cancel();
      return;
    }
    
    player.sendMessage("Hi");
  }
}

Later on

new SomePlayerTask(player.getUniqueId()).runTaskTimer(plugin, 20, 20);
stuck flax
#

onCommand, how do I know what the exact name of the command was since there are aliases I want to know if an aliase was used and which one was used

stuck flax
#

ty

#

Also, is it automatically converted to lowercase?

#

nvm

torn shuttle
#

and so it starts, me wondering how I can add scriptable behavior to my plugin via config

drowsy helm
#

good luck

torn shuttle
#

it already feels like a mistake

lost matrix
#

Create your own language

drowsy helm
#

you gonna design your oqwn lang?

torn shuttle
#

I am not exaggerating when I am saying that I am so apprehensive about this one that I have gone out of my way to not write a single line even on paper planning it out

echo basalt
#

ffs magma it's 3:30am just make some presets

torn shuttle
#

3:33 am lucky time to start this

echo basalt
#

bet you'll only start writing code at 6:66 oh wait 6:66 isn't a thing

drowsy helm
#

oyou could use a js or lua interpreter?

torn shuttle
#

I think I want something event-driven

echo basalt
#

I remember using js scripts for a project I worked on

#

and I passed a custom context object you could do math on

torn shuttle
#

and probably not code because if someone shows up on my support channel and asks me about lua one of us will die before the end of that discussion

drowsy helm
#

is this for your mobs plugin

torn shuttle
#

it is

echo basalt
#

today is not the day for overengineering trivial concepts

torn shuttle
#

I am 28 tomorrow

echo basalt
#

today is the day for listening to hood rap and overthinking life

torn shuttle
#

if I don't start now I never will

#

I will be too wise starting tomorrow

echo basalt
#

plenty of time to procrastinate

torn shuttle
#

what I would give to not go back to being 18

drowsy helm
#

happy tomorrowbirthday

#

what was so bad about being 18 lol

torn shuttle
#

everything

lost matrix
echo basalt
#

boomer club

torn shuttle
#

I think I'll go with event-driven presets and global/individual timers...?

drowsy helm
#

how would you format it though

torn shuttle
#

actually you know what just events and then I'll turn the internal timer into an event maybe... or a state

lost matrix
echo basalt
#

why not start a sub-industry and just make a very decent api

torn shuttle
#

because I want the people who work for me to work on this

lost matrix
#

You have:

  • Triggers
  • Conditions
  • Actions
    Those 3 together with a delay() function and you can do a ton
torn shuttle
#

and they are not programmers

echo basalt
#

make em pay you to do it

torn shuttle
#

I have vaguely seen how mythic does it though I've never used it

drowsy helm
#

adding a sync delay function would be interesting

lost matrix
torn shuttle
#

I'm sure what mythic does works well for them but I want something simpler

lost matrix
#

I think their system is quite nice

drowsy helm
#

variables arent very verbose

lost matrix
#

Yeah you always have to look up the docs...

torn shuttle
#

I mean honestly I started elitemobs when I saw the config of mythicmobs, this isn't even a joke

#

my thinking was might as well code it myself

drowsy helm
#

you could make it similar to skript

torn shuttle
#

and I've always tried real hard to keep setting up things real simple at the cost of complexity and customization

drowsy helm
#

how it's very english-like

echo basalt
torn shuttle
#

not myself

echo basalt
#

eh true

lost matrix
#

Use OpenAI and let the user write a text.
"I want the mob to burn if its health is below 30"

drowsy helm
#
when MOB dies:
  particle ANGRY_VILLAGER
  wait 10 seconds
  message "Dead" to player in radius 3
#

i think thats sorta easy to read

torn shuttle
#

hm

drowsy helm
#

but would also mean more complex commands are super verbose

torn shuttle
#

one thing I'm almost certainly going to keep doing is creating premade content and this would probably extend into premade scripts

#

if you can call scripts in scripts with some basic constructors you might be able to skip a lot of the more verbose stuff

drowsy helm
#

executing that super efficiently sounds like a bitch

torn shuttle
#

nah it's pretty easy

#

precache all scripts, store by name, you're already getting your stuff real fast

#

dump it into a nice map

#

bob's your uncle

drowsy helm
#

most importantly

#

what is your file extension going to be called

#

mob.magma? saltedpog3

torn shuttle
#

it's going to be my patreon url

#

wouldn't that be hilarious

drowsy helm
#

lmao

torn shuttle
#

then I'm making a custom storage file

#

that's going to be my twitch channel

#

I'm tapping into a new market

#

ok so here's my thinking

#

events are for cool kids like me ๐Ÿ˜Ž

#

I think I can get away with making it real simple using only events

drowsy helm
#

what would be the alternative to events?

#

cant think of another way

torn shuttle
#

I don't know that mythic uses events

#

but I mean you can just use timers if you want to

drowsy helm
#

events sounds easier on both ends tbh

torn shuttle
#

so what I'll do is events and for the mob power stuff I'll add a priority and a weight

#

higher priority gets executed first (you know, the way that actually makes sense) assuming conditions are cleared, if multiple fall into the same priority then we do a weighed chance roll based on the weight

#

local cooldowns set the cooldown of the power (in case of powers which is the core use case here) and global cooldown sets the cooldown of powers in general

#

which is already how I've started doing things internally anyway

#

once the global cooldown clears an event fires letting the powers know they can get going again

#

I guess this might make reactive powers tricky to make though, hm

drowsy helm
#

whats a reactive power?

torn shuttle
#

stuff that activates when a boss gets hit

drowsy helm
#

gotcha

torn shuttle
#

you have gcd powers which trigger on a delay, reactive powers which trigger when hit, powers that trigger on attack and stuff that is just passive like increased movement speed

#

guess I have to figure out if I can escape my fate of doing 3 timers with 3 different cds each

#

actually sort of possible

#

if I evaluate how long a power is scripted to take I can enforce an internal timer to prevent power overlap, and I just have to tell people to make sure their cooldown timers extend beyond the time the power takes to complete

#

could even make a simple formula to create default cooldowns which grow in length depending on how many ticks they take, if something takes 5 seconds it probably shouldn't be happening back to back

torn shuttle
#

there's no event for grindstones right?

#

the inventory version of it

barren peak
#

I have a question about comparing blocks: I have 2 locations: z1, endLocation. I am testing to see if(z1.getBlock() == endLocation.getBlock())

but for some reason, they are not returning equal. Below is an image of the 2 blocks in log form. Do you know why they arent returning equal, what block property im missing and how I can fix this? Thanks!

echo basalt
#

equals

#

I'd just compare blockX, blockY, blockZ

barren peak
# echo basalt equals

ye I was thinking block x y and z but it seems a bit too complex and more work than is needed. I will try equals and if it doesnt work I will just use xyz

kindred valley
worldly ingot
#

You can .equals() compare them just fine. Internally it just compares the x/y/z coordinates

#

Though getBlock() will always return a new CraftBlock instance, so they'll never ==

drowsy helm
reef lagoon
#

how do I make clickable text that makes the player execute a command

kindred valley
#

I am actually saving the location

#

But its not a former way anyways i will just use my plugin for my server

remote swallow
reef lagoon
#

Okay I got it, thank you

tepid thicket
#

Normally a non-terminated ExecutorService prevents a JVM from shutting down. But not so on Spigot. Why?

#

And what actually happens to the threads? Is the behavior from spigot documented somewhere?

lost matrix
#

The executors just get shut down and the threads are interrupted. This is not documented. Might be nms behavior.
Could as well be the custom class loader from spigot. Would have to dig for that.

tepid thicket
#

Doesn't seem like interruption on the threads. Because if so, they would have the possibility to ignore the interrupt, continue running and prevent the JVM from shutting down. Which was not the case for my tests.

lost matrix
#

Nope. Looks right.

#

"EntityPotionEffectEvent cannot be triggered asynchronously from another thread."

#

Pretty clear, isnt it?

kindred valley
#

Synchronize it

lost matrix
#

Yes and you want to remove it when a button in discord is clicked. I get it.
But you can simply not interact with spigot from another thread.
You need to schedule a bukkit task which will then execute the code on the next tick.

chrome beacon
#

Well that's some messy code

#

Also do what 7smile7 said

lost matrix
#

Thats not a maybe mr "Full Stack Developer". Thats quite messy.
Anyways: All you need to do is run the minecraft related code on the minecraft thread.
Easiest done by scheduling a bukkit task with the BukkitScheduler.

#

We explained in great detail whats wrong.

#

We even gave you the fix for it. All you need to do is write it now.

kindred valley
#

Mann

#

?scheduling

undone axleBOT
lost matrix
#

?scheduling

undone axleBOT
long zephyr
#

gus, do you know why Hex code is not working to me?

public static String translateColorCodes(String message){
        if(message == null) return null;
        String startTag = "&#";
        String endTag = "";
        char COLOR_CHAR = ChatColor.COLOR_CHAR;
        final Pattern hexPattern = Pattern.compile(startTag + "([A-Fa-f0-9]{6})" + endTag);
        Matcher matcher = hexPattern.matcher(message);
        StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
        while (matcher.find())
        {
            String group = matcher.group(1);
            matcher.appendReplacement(buffer, COLOR_CHAR + "x"
                    + COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
                    + COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
                    + COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
            );
        }
        String sr = matcher.appendTail(buffer).toString();
        String aux = null;
        try{
            aux = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(null,sr);
        }catch (Exception ignored){}

        if(aux != null){
            sr = aux;
        }
        return ChatColor.translateAlternateColorCodes('&', sr);
    }

its not print the correct color :(

tepid thicket
lost matrix
#

I looked at the bukkit bootstrap environment and there is nothing to find regarding executor eviction.
But generally it shouldnt matter. We just need to either clean up behind ourselves or simply use the bukkit scheduler ^^

#
}catch (Exception ignored){}

Ah yes. The classic.

tepid thicket
#

Or could it be even by minecraft itsef? Still, definitely seems that the threads are stopped forcefully.

#

Which should be considered at least. Especially when doing I/O or stuff. As it changes the contract for a safe shutdown.

#

Normally shutting down the executor would be enough, here it then MUST be awaited/joined on the main thread, to prevent file/data corruption.

#

But thanks for the clarification.

lost matrix
#

Is your discord broken?

tepid thicket
#

I just edited the message. nvm.

thorny marsh
#

hey i try to send a text for a sign via sendSignChange when placing a sign but unfortunately it doesn't work

ivory sleet
#

If its daemon, usually just shutting the thing down works

#

But anyway, I believe ExecutorService::close is gonna be introduced coupled with the new StructuredTaskScope api which is gonna be a blocking way of terminating a service completely

shadow zinc
#

I need help with my bungeecord callbacks, for some reason its not completing the the future

#

I know this because its returning numbers in the thousands for my player count

#

which is not the case

#

my use of the code is like this

#
                SendAndReceive.send("PlayerCount", gameItem.getServerName()).whenComplete((msg, error) -> {
                    NeoUtils.getInstance().getFancyLogger().fatal(String.valueOf(error.getCause().getCause()));
                    ByteArrayDataInput in = ByteStreams.newDataInput(msg);
                    in.readUTF();
                    int playerCount = in.readInt();
                    specialItem.setLore("Player count: " + playerCount);
                    gameSelectorGUI.setItem(gameItem.slot(), new InventoryItem.InventoryItemBuilder(specialItem::getAndSet)
                            .setAction((event -> BungeeCordUtils.connect((Player) event.getWhoClicked(), gameItem.getServerName())))
                            .build());
                });```
rough drift
#

How could I make a block give off a light level of 15

rough drift
#

no other way?

shadow zinc
rough drift
#

tried it

#

nothing

shadow zinc
#

try again