#help-development

1 messages · Page 1394 of 1

nova lotus
#

Well I do have a buildtools.jar
But the server stuff is not generating

eternal oxide
queen dragonBOT
nova lotus
eternal oxide
#

save and post teh link here

nova lotus
#

Something went wrong

#

Bruh

gaunt eagle
#

wait, i dont understand -_-
do you want me to use InventoryView instead of InventoryClikEvent as an event?

wraith rapids
#

no

#

InventoryClickEvent extends InventoryEvent

#

InventoryEvent declares a method called getView

#

getView returns an InventoryView

#

InventoryClickEvent inherits this method because it extends InventoryEvent

nova lotus
wraith rapids
#

take the event -> get the view -> get the title

eternal oxide
#

drop the log in here

#

if it will let you

#

probably won.t due to not verified

wraith rapids
#

real men use hatebin

gaunt eagle
wraith rapids
#

you are calling it on the inventory

#

call it on the event

#

e.getView

nova lotus
gaunt eagle
#

right?

eternal oxide
wraith rapids
#

that is progress, yes

#

next, remove the item.gettype() != null part

lost matrix
wraith rapids
#

it's redundant

#

item.gettype can never be null

#

gettype is annotated as @NotNull; it will never return null; the condition will always be true

gaunt eagle
wraith rapids
#

no

#

if the slot is empty, the ItemStack may be null

gaunt eagle
#

ah

wraith rapids
#

item != null would be true then

gaunt eagle
#

okey i get it i think

wraith rapids
#

alternatively, the type of the ItemStack might be Material.AIR

#

you never know with bukkit

#

sometimes the item is null, sometimes it's air

#

best practice to always check both

gaunt eagle
#

the new form is now

wraith rapids
#

alright, next, delete everything

#

you're not supposed to use the inventory title to identify the inventory

#

use the inventory holder or compare the inventory instance instead

#

a player can literally place down a chest they have renamed in an anvil and your inventory logic would fire for it

nova lotus
#

Well I give up

#

Ill try again later

gaunt eagle
#

okey @wraith rapids one more problem xD

#

"page" int defined

#

i mean it must be

#

but wtf is this

#

ah true

#

sorry -_-

wraith rapids
#

Required type: String
Provided: int

#

it even suggests a solution: "Wrap using String.valueOf()"

white obsidian
#

so i'm trying to make a bungeecord cloud type system and for whatever reason it gives me that "could not connect to default or fallback server" even when i register the servers like this

ServerInfo info = ProxyServer.getInstance().constructServerInfo(id, InetSocketAddress.createUnresolved(address, port), "motd", false);
ProxyServer.getInstance().getServers().put(id, info);

my bungeecord config.yml is the default one with no changes (am i meant to change something?)
proxy and spigot servers are both online and the register function is being called
all variables are correct (checked by logging them into bungeecord log)
when i do /server in bungeecord console the spigot server name shows up

wraith rapids
#

i don't really fuck with bungee, but are you sure getServers().put is the right way to register a server

#

seems like a dubious design choice, but then again, all of bungee is one giant fucking dubious design choice

white obsidian
#

pretty sure lol

#

it is getting registered because /server gives me the server name and all that. just really clueless why it doesnt connect me

#

its probably something really obvious that i've been literally staring at for the past 3 hours knowing me lmao

random epoch
sullen marlin
#

you're making it unresolved so its probably not gonna work if you enter a dns entry

white obsidian
#

i changed it to
new InetSocketAddress("localhost", port)
(it's on a localhost) and it still wont work. It actually registers the server on the proxy before the spigot server has fully started, could that be the problem?

woeful moon
#

Which version of the spigot API do you guys suggest to use? I just use 1.16 because my server is 1.16 and it's the most recent, although if I release the plugin it should work on 1.8-1.16

wraith rapids
#

just drop support for anything other than latest and don't think about it

lost matrix
wraith rapids
#

most things are very painful to support on a wide range of versions

#

you'll probably end up having to do reflective hacks everywhere and can't take advantage of the modern api

lost matrix
#

You just miss out on so much API. The plugin im currently writing would take at least 10 times as long if i would use the 1.8 API.

wraith rapids
#

if you absolutely insist on supporting 1.8, use a module based approach and write a completely different module for 1.8

woeful moon
#

Ok

#

Makes sense

#

Just a lot of people use 1.8 or 1.12 so I was thinking there would probably be considerably less downloads

wraith rapids
#

most people who use 1.8 are pvp nerds and probably wouldn't use your plugin anyway

#

unless it's some pvp minigame or something

woeful birch
wraith rapids
#

use paper's pathfinder api

#

it's like 2 method calls or something

#

ez to use and nicely documented

woeful birch
#

so i would have to change to paper instead of spigot?

wraith rapids
#

myes

#

regrettably spigot is quite a bit behind the times and lacks a lot of API stuff that makes a developer's life easier

#

the vast majority of servers run paper anyway, so you might as well jump off the boat before it sinks completely

woeful birch
#

why would you say that on the spigot discord lmao

wraith rapids
#

why wouldn't I

woeful birch
#

idk maybe it's a little rude

wraith rapids
#

the truth doesn't care about peoples' feelings

woeful birch
#

ok

wraith rapids
#

and regardless, I'd place the well-being of you, my dear, aspiring developer, far above the feelings of some guy somewhere

gaunt eagle
#

How do you make bold color for the enums?

wraith rapids
#

real men would just use §l

gaunt eagle
wraith rapids
#

prefix the 2 chatcolors with a "" + or call toString on them

#

it doesn't know you want a string; you can't + together 2 random objects

gaunt eagle
#

like

wraith rapids
#

oh well if that's what you want to do, you can't

#

you're basically fucked i guess

gaunt eagle
#

Just how hard it can be to make a bold red name xD

wraith rapids
#

well, a bold and a red name are defined by 2 chatcolors

#

you can only give it 1

#

you can make it bold, or you can make it red

gaunt eagle
#

yeah i realized it

#

@sullen marlin urgently ChatColor.RED.BOLD should bring an option like xD

wraith rapids
#

I think one of the chat color classes is no longer an enum and you might be able to make an instance of it that is both red and bold but I dunno

#

paper uses adventure now so all of the chatcolor shit is kind of obsolete

#

make the constructor take a ChatColor ... varargs or a Set<ChatColor>, or use some sane text formatting library like adventure

sullen marlin
#

new ComponentBuilder("Hello ").color(ChatColor.RED).bold(true).append("world").create()

cerulean harbor
#

broadcastMessage​(String message)
is it possible to give the message a font color / bold / italics and such?

cerulean harbor
lost matrix
#

ChatColor also has static fields like
ChatColor.WHITE which can be used like this:
String grayHi = ChatColor.GRAY + "Hi";

cerulean harbor
#

nice

#

thanks sm

ornate heart
#

How would i auto fill a map without having the player walk around?

autumn cave
#

What is the difference between ScoreboardManager#getMainScoreboard() and ScoreboardManager#getNewScoreboard()?

lost matrix
ivory sleet
#

the main scoreboard is the scoreboard which may be manipulated with minecraft commands

#

iirc

autumn cave
#

so what does getNewScoreboard() do?

ivory sleet
#

As 7smile7 said

autumn cave
#

Does Scoreboard act as a scoreboard manager or a scoreboard instance?

crude charm
#

Instance

#

You need to get the manager

autumn cave
#

So lets say I made 3 Scoreboard. Server closes, server repons. How do I get those scoreboards back? How do I get the objectives back? Because objectives are in the scoredboard

crude charm
#

Save the things

#

Like say int 10 save it and get it

#

Then display it

#

But it should auto do that?

ivory sleet
#

Just recreate the scoreboard with the objectives on startup again?

crude charm
#

Yeah

autumn cave
#

Ok, and the main scoreboard has the capability of saving everything right?

ivory sleet
#

Yeah I think that’s the case

crude charm
#

Make an enum with sb types, run a timer to update, build a new scoreboard

real dagger
#

I need help with my creeper spawning plugin. I used this tutorial https://www.youtube.com/watch?v=IU7qlx2PbDY and when I test it I would type the command but it wont work? I am not sure if there is something wrong with the plugin or the server

crude charm
#

Like enum

GAMERUNNING,
LOBBY,
TIMER

real dagger
#

the command dosnt even display in the chat when I type it out

#

Also when I start the server it says this build is outdated in the console?

wraith rapids
#

show code

real dagger
#

I cant put images

lost matrix
#

?paste

queen dragonBOT
real dagger
#

ok

wraith rapids
#

we don't want images, either

#

code is text

real dagger
#

oh ok

lost matrix
real dagger
#

I will test that

real dagger
lost matrix
#

And your plugin jar is in the plugins folder?

real dagger
#

yes

lost matrix
#

Any exceptions when the server starts up?

real dagger
#

yeah it says "error, this build is outdated. Server will start up in 20 seconds"

lost matrix
#

What spigot version are you using?

real dagger
#

1.16.5

#

I got confused on the plugin where to download the spigot builder tools so I just downloaded the normal 1.16.5 spigot

lost matrix
#

Ok makes no sense. If any jar is in the plugin folder then spigot recognises it and throws an exception if it couldnt be loaded.

#

So compile the jar, add it to your plugins folder and start the server. Then the console will tell you if something is wrong.

real dagger
#

I mean I wasnt sure if I was supposed to download the build tools so I can make plugins so instead I just downloaded 1.16.5 spigot

lost matrix
#

Doesnt matter.

real dagger
#

oh ok

lost matrix
#

So what does your console say about the jar?

real dagger
#

Also is there supposed to be an extra file in the plugin folder?

lost matrix
#

This can be ignored. If you have a jar in your plugins folder there are only 2 possible outcomes.

  1. There is an error and you can read whats wrong with the jar
  2. The plugin gets enabled and the server tells you something like [YourPlugin] Enabling YourPlugin v1.0.0
real dagger
#

ok

shadow owl
#

ive been trying to get some targeting with NMS working. anyone able to take a look?

real dagger
lost matrix
real dagger
#

I put it in plugins

turbid ridge
#

Hey! Im trying to send a packet to the player with bubble information. Basically im trying to make the little bubbles appear out of water but Im not sure what the name of the packet or what packet category it is. Any help is appreciated!

turbid ridge
#

above the hunger bar when in water*

lost matrix
#

Oh i see

#

I think thats client side. So you probably would need to send the player fake metadata and tell him that his air is going down.

turbid ridge
#

How would I go about doing it? I thought packets were the way to go 🤔

lost matrix
turbid ridge
summer scroll
#

How can I use jetbrains annotations like @urban grotto and @Nullable, I'm trying to do that but I can't seem to find it.

paper viper
#

NotNull -> Whatever field annotated cant be null

summer scroll
#

wow, didn't mean to tag

paper viper
#

Nullable -> Whatever field can be null

lost matrix
#
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
      <version>20.1.0</version>
    </dependency>
summer scroll
#

yeah, the imports isn't org.jetbrains...

paper viper
#

oh oops

#

nvm

#

i read your message wrong

#

shouldn't your ide know the class to import tho if you include it in maven or gradle?

summer scroll
#

There's only an import from sunstack.internal or whatever.

summer scroll
turbid ridge
lost matrix
turbid ridge
#

Ah yes that wont be distracting at all! ;)

paper viper
#

Is there a way to stop all sounds for a player without looping through the entire sound class

#

And if I have to use packets im going to cry lol

lost matrix
#

packet interception is probably the way to go

paper viper
#

🥲

#

alright

#

spigot really should have a method for this

lost matrix
#

I mean its just one PacketAdapter and a Set<UUID> then cancel the packet event when a player is in the set.

paper viper
#

ig

sinful python
#

What's the event for when a player changes the inventory of a brewing stand? I can't seem to find it (like a player adding an item)

sinful python
#

Thanks

#

Most helpful person ever, always here to answer my questions, so fr thanks

paper viper
#

i remember when i used to be active in here 🥲

sinful python
#

How do I get the PotionBrewer from the InventoryViewEvent event?

#

I'm pretty sure I'd use the getClickedInventory method but not sure after that

tame wolf
#

where would i get a varibale that is a item

#

so like items.trident

sinful python
#

Do you have an event that you're detecting?

tame wolf
#

YES

#

sry caps

#

i just need the variable

#

like material.DIAMOND_BLOCK

#

what is the item version of that

sinful python
#

ItemStack ?

#

I'm kinda a noob though

#

blind leading the blind right

tame wolf
#

ok

quaint mantle
#

is anyone here good with regex?

#
    COMMAND_SENDER_IS_NOT_PLAYER("commands.sender_is_not_player", "&6&lEssentials &b» &fOnly players are allowed to utilize this command."),
    COMMAND_NO_PERMISSION("commands.no_permission", "&6&lEssentials &b» &fYou don't have sufficient permissions to execute this command."),
    COMMAND_PLAYER_NOT_FOUND("commands.player_not_found", "&6&lEssentials &b» &fThe specified player doesn't exist."),
    COMMAND_SET_SPAWN("commands.set_spawn", "&6&lEssentials &b» &fThe world spawn has been set to your current location."),
    COMMAND_SPAWN("commands.spawn", "&6&lEssentials &b» &fYou've been teleported to spawn."),
``` I need to replace every dot in the strings between " " that contain the word commands
dusk flicker
#

so

#

if string contains 'commands' replace ' . ' with what one space?

summer scroll
#

If I modify a map inside a map will the value change If I get the Map without re-add the map?

#
private final Map<UUID, Map<String, Integer>> killTracker = new HashMap<>();
``` this is the map.
dusk flicker
#

unless you want to split like your 'commands.spawn' to get 'spawn', if so just split the string at '.' and get the second argument of that

quaint mantle
summer scroll
#

If I want to modify the Map<String, Integer> am I need to re-add the map to the killTracker? like killTracker.put(uuid, map);

dusk flicker
#

then just use a replace function?

#

String.replaceAll('.','_');

#

something like that

quaint mantle
dusk flicker
#

You don't need regex for thos tho

sinful python
#

Sorry to interrupt but what's the material name of the poisonous potato?

quaint mantle
#

I can do it with java yes

sinful python
#

I honestly have no idea it just doesn't seem to exist

quaint mantle
#

I am just in need of changing a bunch of code in an enum

dusk flicker
#

ah so thats the actual problem

#

So you need to edit a lot of strings in your enum?

quaint mantle
#

yeah

#

like a lot

dusk flicker
#

what you could do

sinful python
#

nEVERmind I found it

quaint mantle
#

180 lines

dusk flicker
#

is if you have Notepad++ you can paste it in that, use the replace function, and have the replaced be 'commands.', and the text that will replace it be 'commands_'

quaint mantle
#

well yes I know how to do that, using sublime btw

dusk flicker
#

well just do that then

quaint mantle
#

I need to replace every dot that is present in that string

#

not only the one attached to the commands

dusk flicker
#

ah

quaint mantle
#

yeah that is the problem

dusk flicker
#

Do the arguments chance per command

#

like commands.arg.command2 vs commands.spawn like you had it?

#

with arg changing, etc?

#

Might not be a good way to do that with regex then, the part that you know that is going to be there, such as 'commands' is the easy part

quaint mantle
#

what do you mean by argument change per command?

#

so the only thing I figured is that I can take the strings with ".*?"

#

hahaha

dusk flicker
#

So you said you have multiple periods in your command thing there?

quaint mantle
#

yeah

dusk flicker
#

So that would work I believe

#

but the thing is

#

would it replace your secondary string there with the usage/etc

quaint mantle
#
    COMMAND_ECO_RESET("commands.eco.reset", "&6&lEssentials &b» &fYour balance has been reset."),
    COMMAND_BALANCE_SELF("commands.balance.self", "&6&lEssentials &b» &fYour balance is {balance}."),
    COMMAND_BALANCE_SELF_NOT_PLAYER("commands.balance.self_not_player", "&6&lEssentials &b» &fOnly players can check their own balance."),
    COMMAND_BALANCE_OTHER("commands.balance.other", "&6&lEssentials &b» &fThe balance of {playerName} is {balance}."),
    COMMAND_BALTOP_FORMAT("commands.baltop.format", "&e{position}. &6{playerName} &8» &e$&6{balance}"),
    COMMAND_BALTOP_PAGE_NOT_FOUND("commands.baltop.page_not_found", "&6&lEssentials &b» &fThe specified page couldn't be found."),
    COMMAND_BALTOP_DISPLAYING_PAGE("commands.baltop.displaying_page", "&6&lEssentials &b» &fDisplaying page &6{pageNumber}&f/&6{pageCount}."),
    COMMAND_PAY_USAGE("commands.pay.usage", "&6&lEssentials &b» &fInsufficient arguments."),
    COMMAND_PAY_NOT_ENOUGH_MONEY("commands.pay.not_enough_money", "&6&lEssentials &b» &fYou can't afford this transaction."),
    COMMAND_PAY_SENT("commands.pay.sent", "&6&lEssentials &b» &fYou've sent {amount} to {playerName}."),
    COMMAND_PAY_RECEIVED("commands.pay.received", "&6&lEssentials &b» &fYou've received {amount} from {playerName}."),
#

so the only thing right now that is the problem is the dots in the commands

#

for example commands.pay.sent would need to be replaced with commands.pay_sent

dusk flicker
#

So keep the commands.

quaint mantle
#

yup

dusk flicker
#

just after that have the pay_sent

#

oh

#

thats gonna be a bitch

quaint mantle
#

yeah I don't want to change each line manually but I might have to do that

dusk flicker
#

May be a quicker option (doing it manually) lol

quaint mantle
#

sad times haha

dusk flicker
#

Im not the biggest fan of hardcoded command usages but it works

quaint mantle
#

well it is a config default so yeah it is hardcoded

dusk flicker
#

ah

sinful python
#

Oops I'm trying to create a plugin that allows the creation of a potion with a poisonous potato, but it doesn't even let the player put one in that slot. Is this changeable or hardcoded?

#

Literally forgot you just couldn't put any item into there

quaint mantle
#

you can check which slot is clicked and then set that slot to the item

sinful python
#

Hmm alright

quaint mantle
#

InventoryClickEvent, check pressed slot, set slot to the itemstack the player is holding

#

the more you know the easier it will be

dusty herald
#

the more you learn the easier it will be

quaint mantle
#

not sure if that course has anything like it but if it introduces you to using libraries you could potentially start with spigot

#

but still I wouldn't recommend it

#

? I meant I wouldn't recommend jumping into spigot without at least a few weeks of experience in java

dusk flicker
#

Id recommend you learn as much Java as you can before starting plugin development

#

It would make it a lot easier later on when you start plugin dev

quaint mantle
#

I don't know the courses so I can't tell, what have you roughly done?

#

at least get to classes and objects that is what you really need to understand about java

dusk flicker
#

You need a lot more knowledge than just that

quaint mantle
#

now that I am seeing you should really just go thru the full course

#

the last section introduces you to a lot of thing you will be needing in spigot

dusk flicker
#

yeah you def want all of that

quaint mantle
#

I just think whatever gets to you best, there isn't one perfect solution

idle tulip
#

anyone online?

dusk flicker
#

no

dusty herald
#

no

idle tulip
#

yes @dusty herald i saw u yesterfay

#

maybe

dusty herald
#

what

idle tulip
#

is it morning

dusty herald
#

how

#

im invisible

idle tulip
#

in ur country

dusty herald
#

its 22:31

idle tulip
#

ok i just got up

dusty herald
#

so did i

idle tulip
#

that means around 14 or 15 i saw u

dusty herald
#

i got kicked out of bed for slapping my partner in my sleep

idle tulip
#

:/

dusty herald
idle tulip
#

who was your partner?

dusty herald
#

my partner

idle tulip
#

:/

#

country?

dusty herald
#

united states

idle tulip
#

ok

sinful python
#

How do you get the item that the player is dragging around their inventory?

idle tulip
#

their are 9 hotbars

sinful python
#

Ofc selecting the item in their hand doesn't work bc that's for outside of your inventory

idle tulip
#

u cannt

dusk flicker
#

I think theres like InventoryDragEvent

#

I cba to open the Javadocs atm tho

idle tulip
#

who knows apache netbeans?

sinful python
#

Hmm yeah it exists

idle tulip
#

u know how to use it?

sinful python
#

Is there a way to access that info without creating a whole new listener?

#

No was responding to rack

dusk flicker
#

Uhh

#

I don't believe so

idle tulip
#

i m very new to plugin making and all

#

i just started3 days ago

dusk flicker
#

you should learn java then first

idle tulip
#

yea i have soe basics

#

some*

dusk flicker
#

When did you start learning java

sinful python
#

Bruh why isn't there a getter for that info

idle tulip
#

it was taught a year ago in classes

sinful python
#

I'll try to get it to work ig

idle tulip
#

but not very detailed

dusk flicker
#

Id recommend spending a lot more time learning more java then

idle tulip
#

only problem is platform to make and executing plugin in server

dusk flicker
#

At one point, if you know java good enough, you should be able to transition into a library very easily

quaint mantle
sinful python
#

Do I have to create a whole new listener for it?

quaint mantle
idle tulip
#

also i think jar file cannot be imported in apche netbeans

quaint mantle
#

anyway it's getItemOnCursor()

sinful python
#

Thanks

#

I've been googling for it a lot already ;0;

#

I almost always google stuff for like 10+ minutes before I ask here

idle tulip
#

@dusk flicker can u do me a favour

#

not favour

#

can u give ans to my some question?

dusk flicker
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

idle tulip
#

which ide is best?

dusk flicker
#

IntelliJ imo

idle tulip
#

for beginners

dusk flicker
#

IntelliJ or Eclipse

sage swift
#

eclipse

idle tulip
#

is local server safe?

dusk flicker
#

Eclipse on lower end systems

#

Like a local spigot server?

#

if so, yes

idle tulip
#

like mine

sage swift
#

did you port forward

#

do you know what port forwarding is

dusk flicker
#

If its for testing thats fine

idle tulip
#

for making plugins and starting

dusk flicker
#

I recommend you dont host a public server on your pc tho

#

a private one (without an open port) is best for testing

quaint mantle
#

somehow the getPresistentDataComtainer is not working any reason why ? otherwise ill store uuid elsewhere``` if (e.getCurrentItem().getType().equals(Material.SKULL_ITEM)) {

    PlayerMenuUtility playerMenuUtility = Gat.getPlayerMenuUtility(p);
    playerMenuUtility.SetReport(Bukkit.getPlayer(UUID.fromString(e.getCurrentItem().getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Gat.getPlugin(), "uuid"), PersistentDataType.STRING))));```
dusk flicker
#

oh dear lord you failed on that

idle tulip
#

actually when u have folder its easy to upload plugins and all

#

and i dont wanna spend money

#

i dont know if my port is open or no

#

t

dusk flicker
#

If you didnt do anything to it

#

Its closed

#

You would have to open it

idle tulip
#

ok

#

thanks

#

thanks a lot

spare mason
#

how i cam double the attack of a zombie

young knoll
#

Modify the attack damage attribute

#

Or listen for the damage event and multiple by 2

spare mason
#

but how i can do this only to the zombie

young knoll
#

Check the entity type in either the spawn or damage event

spare mason
#

thanks

quaint mantle
#

How would you create a configuration section from code??

summer scroll
#

I want to remove a String from a List, is it case-sensitive?

dusty herald
#

yes iirc

#

anyone know of a way to tell if a plugin called an event? I want to distinguish events Sadge

#

trying to send a fake player message but I don't want to modify things in there too, atm calling it sync and it's working but I want to use something else

#

I would send a fake chat message to the player with Player#sendMessage but I don't want to interfere with plugins that add those fancy hover things with information on them

#

so atm I'm removing some recipients from receiving the message, filtering it just for them, and shooting it off just for the removed recipients with the "fake" callEvent with only them as recipients

silent hound
#

yo um

#

how do i get the blocks in a tag

#

i mean the materials

#

like #minecraft:planks

dusty herald
#

Tag.PLANKS.isTagged(Material);

silent hound
#

oh

#

thanks

dusty herald
summer scroll
#

So I have a requirement to do something in a list, but how can I check If the player has meet the requirements? The requirements will look like this in a config.

requirements:
  - "money;5000"
  - "bank;10000"
```That means, something will be executed If the player has more than 5k money **and** 10k balance on the bank. My attempt is using for loop and then splitting the String with ";".
merry kindle
#

So i want to make it so when someone places a block it checks if its has a certain NBT tag. I was wondering if there is a way to do it.

#

Cause you cannot create and itemstack out of a block

dusty herald
#

You can create an ItemStack out of a block, just get the type winkdoge

#

last I checked the data doesn't persist after the block is placed

#

could be wrong

young knoll
#

You are correct

#

Only some tile entities persist data from item to block

dusty herald
#

Sadge I wish I could get textcomponent from chat events

#

would make life easier

merry kindle
quaint mantle
merry kindle
#

So when i place it it clears the NBT

quaint mantle
#

.

young knoll
quaint mantle
#

Thank you

merry kindle
young knoll
#

If it’s a tile entity you can store data in nbt

#

If not you’ll need a database of some sort

merry kindle
#

wym?

young knoll
#

What

merry kindle
#

what you mean by database of some sort.

young knoll
#

I mean a database

#

What’s unclear about it

merry kindle
#

what kind of database mysql database or like what you mean. Like i wanna place the blcok get the nbt to check if its a node.

#

how is that in need of a database

young knoll
#

Because blocks don’t store NBT

#

If you only need to data when placing it you can just use BlockPlaceEvent

#

If you need the data to persist you have to store it somewhere yourself

cold field
sage swift
#

how can i shuffle a stream?

#

guess i can Collections.shuffle but its voiddd

dusty herald
#

Collections.shuffle(list);

#

your list is shuffled

#

Collections.shuffle(list); shuffles your list without returning anything

#

what kind of magic land do we live in

sage swift
#

but i want to shuffle a stream without having to collect to list and then shuffle

#

oh well

#

could be dual action

#

shuffle the list and return it

weary geyser
#
public final class RandomComparator<T> implements Comparator<T> {

    private final Map<T, Integer> map = new IdentityHashMap<>();
    private final Random random;

    public RandomComparator() {
        this(new Random());
    }

    public RandomComparator(Random random) {
        this.random = random;
    }

    @Override
    public int compare(T t1, T t2) {
        return Integer.compare(valueFor(t1), valueFor(t2));
    }

    private int valueFor(T t) {
        synchronized (map) {
            return map.computeIfAbsent(t, ignore -> random.nextInt());
        }
    }

}``` @sage swift
#

then just do .sorted(new RandomComparator());

drowsy helm
#

If i give a maven parent a repository will all modules inherit that repo when looking for dependencies?

#

sup sys

drowsy helm
#

not at my computer so cant

#

simple yes or no answer stop being smart

quaint mantle
#

likely yes

weary geyser
cold field
#

where does NMS register commands?

#

@dusty herald I hope you don't mind the ping, Do you know?

dusty herald
#

no idea

idle tulip
#

i coded a plugin how to execute it?

quiet ice
#

rm -rf *.jar

dusty herald
#

dont they might actualyl do that !!

#

plus it's

#

rm -rf / --no-preserve-root /s

idle tulip
#

wht is this?

quiet ice
#

It executes your hard disk, which is not a good thing if you want to just execute your plugin

idle tulip
#

i want to execute my plugin

#

my head is paining

#

after making a simple plugin and now i dont know how to execute

#

:?

quiet ice
#

You don't execute plugins here

idle tulip
#

in server folders

#

?

quiet ice
#

You run the server that loads the plugins

idle tulip
#

i have

#

running

#

but how to take plugin from ide and load into server file??

#

can you help e?

#

me*

quaint mantle
#

just export it

quiet ice
#

If you use gradle, invoke ./gradlew build (unix) or ./gradlew.bat build (windows) to get your plugin jar in ./build/libs or if you use maven mvn clean package to get your plugin jar in the ./target folder

quaint mantle
#

what ide u use

quiet ice
#

If you use Eclipse JDT or ||(I don't know how IntelliJ's is called)||, then please do not use it, you are wasting your time

idle tulip
#

i need step to setp tutorial yt was useless i did export but not working

quaint mantle
#

put that file into your plugins folder

#

and restart your server

idle tulip
#

actually there only one option that is to export and make that project a .zip format

quaint mantle
#

that wont work

#

bcz servers only accepts .jar

eternal oxide
#

Jars are zip format. Just named jar

lost matrix
#

I think you could technically tell java to have a zip file on its classpath. You can even have it exploded in a folder.
The problem is that spigot only scans for .jar files in the plugins folder.

quaint mantle
idle tulip
#

now its says "Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml"

lost matrix
idle tulip
#

uuf i gove up

cold field
idle tulip
#

i give up

cold field
#

Read this

#

And you will be able to do a plugin

idle tulip
#

spigot.jar and spigot api are same?

lost matrix
#

@quaint mantle

  1. The method is deprecated
  2. its (bankname, player)
eternal oxide
#

API is JUST the API. spigot is the implementation (all the source code)

lost matrix
eternal oxide
#

You only need the API to develop the majority of plugins

quaint mantle
idle tulip
#

i got a spigot jar from spigot build tool and according to link u said i need to add api soi will that spigot.jar file?

eternal oxide
#

If not using maven, yes you add the spigot.jar

idle tulip
#

then thanks

#

i m using aven

eternal oxide
#

If using maven you don;t need buildtools for most plugin development

#

When using Maven you don;t manually add any jar/libs to your project

cold field
#

does anyone know a good doc where can I find how to use brigadier instead of bukkit command?

#

😦

cold field
#

Something more in depth?

idle tulip
#

i making a making a mistake either in exporting files or managing files properly

#

that why y plugins fails

eternal oxide
#

If using Maven you don't use export

idle tulip
#

then?

eternal oxide
#

Maven lifecycle goals, clean package

idle tulip
#

wht

#

wait

eternal oxide
#

If you were using export I can safely assume you are using Eclipse?

idle tulip
#

netbeans ide

eternal oxide
#

oh

lost matrix
#

in terminal:
mvn clean install
This is what i've done the first month after discovering maven.
I had no idea what it did exactly but it -"made my plugin go to jar n stuff"- so that was good enough for me. 😄

novel lodge
#

How can I get the Main plugin class from a different class?

lost matrix
novel lodge
#

ok

lost matrix
#

DI or singleton

lost matrix
# novel lodge ok

Use the constructor of the other classes to pass your main class instance.

outer sorrel
#

should i use the latest minecraft version for spigot plugins or 1.13 if i want them to work on all versions?

quiet ice
#

There is no universal version anymore

#

Do yourself a favour and use 1.13

lost matrix
quiet ice
#

Or latest, but 1.12.2 (or earlier) should NOT be used

outer sorrel
#

well a lot of people do so im supporting those versions

#

sorry

silver shuttle
#

When I create the config.yml in the resources folder and have this.saveDefaultConfig(); in my onEnable it should automatically create folder and file in the plugins directory correct?

lost matrix
outer sorrel
#

mini game servers use 1.12 a lot

#

because doesnt lag

quiet ice
#

Good luck porting all the legacy materials to non-legacy materials once 1.17 comes along with the super refractor

#

Okay, I don't actually know when the super refractor comes along, I just know it will in the coming updates

outer sorrel
#

but i understand what your saying

lost matrix
#

And if you do then you dont get plugins from spigot but let them get written to fit your needs.

#

Some plugins are almost impossible to write without PDC for example.

quiet ice
#

silently uses NMS

lost matrix
#

Unless you use a module setup and NMS. Then your plugin just needs 5 times longer to develop

main dew
outer sorrel
#

wait did i have ping on that?

#

if so sorry

silver shuttle
#

When I create the config.yml in the resources folder and have this.saveDefaultConfig(); in my onEnable it should automatically create folder and file in the plugins directory but it doesnt do anything. What am I doing wrong?

outer sorrel
#

also when i make plugins for my own server i just put the api to the version i use

quiet ice
#

1.13 is a big enough compromise given that 1.13 has the material refractor but does not suffer from the stupidity of 1.14 light multithreading

lost matrix
quiet ice
#

What about maximum blindess?

glass sparrow
#

^ + player glow outlines for visualising players?

quiet ice
#

ignore that, that will result in something else

main dew
#

in fact, he wants to do the opposite

quiet ice
#

As torches will be quite useless

main dew
#

max light in all place but I needed a good example

echo ether
#

What is the best way to rotate location's yaw?

main dew
#

sorry i haven't played with the light yet

lost matrix
echo ether
lost matrix
silver shuttle
#

I'm really new to Java

eternal oxide
summer scroll
#

I have a List of Island and inside each island, it has a List of String and I want to get the Island by one of the String on the List, how can I do that? I think I should use nested stream.

eternal oxide
#

Check yoru servers latest.log to see whats happening

lost matrix
# silver shuttle I'm really new to Java

Then spigot is a pretty bad place to start with. I would at least learn the basics with some simple plain java programs.
This call should work if you have a config.yml in your plugin jar and if the plugin is actually enabled. Make sure to have no exceptions in
your console and that the plugin is enabled.

eternal oxide
#

?paste your latest.log

queen dragonBOT
silver shuttle
#

And also theres no exception in the logs or anything and everything in the plugin works fine

eternal oxide
#

impossible

silver shuttle
#

It connected to the MySQL and commands work fine

eternal oxide
#

then savedefault config can not fail to work IF you have a config.yml in yoru jar

lost matrix
silver shuttle
eternal oxide
#

open yoru jar with any zip explorer and see if the config is in there

silver shuttle
#

ooooh yes maybe intellij doesnt export it lemme check

summer scroll
eternal oxide
#

?paste your config.yml

queen dragonBOT
summer scroll
silver shuttle
# eternal oxide ?paste your config.yml

ok this is really weird, I just moved the saveDefaultConfig from the bottom of my onEnable to the top just so I can work better and compiled it and now it works, but it didnt change anything. it was in the right position before

eternal oxide
#

Then you have an exception happening in your onEnable

silver shuttle
#

I didnt

eternal oxide
#

The only reason it can possibly not create your default config is if that code is not running.

silver shuttle
#

well commands worked and responded from the mysql so I am pretty certain it was running

eternal oxide
#

You moved the code and it works, therefore something in your onEnable is exiting early.

silver shuttle
tacit drift
#

has any1 here ever worked with the we api? (ver 6)

eternal oxide
#

Something is exiting early.

silver shuttle
#
    public void onEnable() {
        this.saveDefaultConfig();
        host = "localhost";
        port = "3306";
        database = "minecraft";
        username = "root";
        password = "password";
        try {
            openConnection();
            Statement statement = connection.createStatement();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        getCommand("xcheck").setExecutor(new xcheck());
        getCommand("xadd").setExecutor(new xadd());
        getCommand("xrename").setExecutor(new xrename());
        getCommand("xdelete").setExecutor(new xdelete());
        getCommand("xsetval").setExecutor(new xsetval());
        DatabaseMetaData table = null;
        try {
            table = connection.getMetaData();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        ResultSet tablename = null;
        try {
            tablename = table.getTables(null, null, "xdata", null);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        try {
            if(tablename.next()) {
                return;
            }
            else {
                Statement senddata = connection.createStatement();
                String xdataTable = "CREATE TABLE IF NOT EXISTS xdata ("
                        + "id int NOT NULL AUTO_INCREMENT,"
                        + "item TEXT,"
                        + "data INT,"
                        + "value DOUBLE,"
                        + "PRIMARY KEY (id)"
                        + ")  ENGINE=INNODB;";
               senddata.executeUpdate(xdataTable);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
#

thats my entire onEnable theres no exiting early

eternal oxide
#
                return;
            }```
tacit drift
#

yeah, use pastebin bruh

eternal oxide
#

early return

silver shuttle
#

yeah thanks didnt see that

eternal oxide
#

np

silver shuttle
#

why tf did I even have that, i couldve just used the opposite and skipped the else statement

#

thanks for the help

wraith rapids
#

protip: highlighting any exit statement in ij also highlights all of the other exit statements in that method

rigid hazel
#
<repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>papermc</id>
            <url>https://papermc.io/repo/repository/maven-public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.23</version>
        </dependency>
        <dependency>
            <groupId>com.destroystokyo.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.geysermc</groupId>
            <artifactId>floodgate-bukkit</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>D:/floodgate-bukkit.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.spigot</groupId>
            <artifactId>mysql-spig</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>D:/MySQL.jar</systemPath>
        </dependency>
    </dependencies>```
#

I can't use IChatBaseComponent

#

It didnt import it?

#

What I need to use it?

wraith rapids
#

that's NMS

#

and why are you depending on both paper and spigot

rigid hazel
#

What is NMS @wraith rapids ?

wraith rapids
#

use one; using both can result in conflicts

rigid hazel
#

Okay. Why I cant use IChatBaseComponent?

wraith rapids
#

because it's NMS

#

and NMS is not included in the API

rigid hazel
#

What means NMS?

wraith rapids
#

net.minecraft.server, the package where the non-api code is in

rigid hazel
#

What I have to download to get NMS?

wraith rapids
#

you need to build paper locally and depend on paper instead of paper-api

eternal oxide
#

Don;t use NMS unless you have no alternative

rigid hazel
eternal oxide
#

I'm going to bet you don;t need it, from the state of your pom

rigid hazel
#

I want to write in a book with TextComponent

eternal oxide
#

Then I was right. You do nto need IChatBaseComponent

wraith rapids
#

then use a text component

#

ichatbasecomponent has nothing to do with textcomponent

#

textcomponent is from like bungee or some shit

rigid hazel
#
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
        BookMeta bookMeta = (BookMeta) book.getItemMeta();
        bookMeta.setAuthor(this.getMailSender(id));
        bookMeta.setTitle(this.getMailSubject(id));
        String type = this.getMailType(id);
        List<String> pages = new ArrayList<>();

        if(type.equals("invite"))
        {
            BaseComponent message = new TextComponent("Hallo "+this.getPlayerName(id)+",\n"
                    + "Du wurdest zur Gilde "+this.getMailSender(id)+" eingeladen. Möchtest du beitreten?");

            TextComponent accept = new TextComponent("Annehmen ");
            accept.setBold(true);
            accept.setColor(ChatColor.GOLD);
            accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Einladung annehmen")));
            accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/invite "+this.plugin.getGuildAPI().getGuildInviteCode(this.getMailSender(id))));

            TextComponent refuse = new TextComponent(" Ablehnen");
            accept.setBold(true);
            accept.setColor(ChatColor.GOLD);
            accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Einladung annehmen")));
            accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mailbox delete "+ id));

            message.addExtra(accept);
            message.addExtra("|");
            message.addExtra(refuse);

            

            pages.add();
            bookMeta.addPages();
        }
        player.openBook(book);```
rigid hazel
#

And how I can add this to a book page then?

#

But I want to add a click able event and something else

#

@eternal oxide This is only possible with TextComponent

#

@eternal oxide ?

wraith rapids
#

yeah, well

#

use paper

rigid hazel
#

And how I do that?

#

Any help link or code?

wraith rapids
#

remove the spigot-api dependency in your pom

#

then use this method

#

it doesn't look like spigget lets you use components in books, at least at a trivial glance

rigid hazel
#

Cannot resolve method 'addPages(java.util.List<net.md_5.bungee.api.chat.TextComponent>)'

#

@wraith rapids

wraith rapids
#

restart your ide and rebuild your caches and shit

rigid hazel
#

I had

wraith rapids
#

you have conflicts now because you depended both on spigot and paper at the same time

#

and make sure you're using 1.16.5

rigid hazel
#

bookMeta.addPages(Components ...);

main dew
#

How I can update light use ChunkSection?

eternal oxide
rigid hazel
#

I know. But....

#
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
        BookMeta bookMeta = (BookMeta) book.getItemMeta();
        bookMeta.setAuthor(this.getMailSender(id));
        bookMeta.setTitle(this.getMailSubject(id));
        String type = this.getMailType(id);
        List<TextComponent> pages = new ArrayList<>();

        if(type.equals("invite"))
        {
            TextComponent message = new TextComponent("Hallo "+this.getPlayerName(id)+",\n"
                    + "Du wurdest zur Gilde "+this.getMailSender(id)+" eingeladen. Möchtest du beitreten?");

            TextComponent accept = new TextComponent("Annehmen ");
            accept.setBold(true);
            accept.setColor(ChatColor.GOLD);
            accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Einladung annehmen")));
            accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/invite "+this.plugin.getGuildAPI().getGuildInviteCode(this.getMailSender(id))));

            TextComponent refuse = new TextComponent(" Ablehnen");
            accept.setBold(true);
            accept.setColor(ChatColor.GOLD);
            accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Einladung annehmen")));
            accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mailbox delete "+ id));

            message.addExtra(accept);
            message.addExtra("|");
            message.addExtra(refuse);



            pages.add(message);
            bookMeta.addPages(pages);
        }
        player.openBook(book);```
#

bookMeta.addPages(pages);

#

Doesnt work

#

And this is no problem with the ide

#

public abstract void addPages(@NotNull net.kyori.adventure.text.Component... components)

wraith rapids
#

wrong component

#

it takes adventure's components

rigid hazel
#

Which component then?

wraith rapids
#

not bungeecord's components

#

the two are pretty similar so you should be able to convert your code to use them pretty easily

#

see the adventure javadocs

ivory sleet
wraith rapids
#

or you can use that

#

deprecated on paper though

main dew
#

How I can update light use ChunkSection?

wraith rapids
#

how can i english

#

what do you mean?

rigid hazel
#

org.bukkit.inventory.meta.BookMeta;

#

I use this but it already turns in adventure

wraith rapids
#

call .spigot() on it

main dew
#

I try use fast place block (but latter I have problem with light)

wraith rapids
#

or get with the times and learn the adventure api

eternal oxide
rigid hazel
#

How @wraith rapids BookMeta bookMeta = (BookMeta) book.getItemMeta(); ?

wraith rapids
#

it's deprecated on paper, because you're supposed to use adventure components now

ivory sleet
#

I think bungee chat api + Normal strings are deprecated in favor of adventure on paper elgar

wraith rapids
#

you're not supposed to use the crummy bungee components at all

rigid hazel
#

adventure components now How I disable that?

main dew
eternal oxide
#

Probably, I don;t use paper as this is Spigot/Bungee Support 😉

pearl spire
#

i need help please

wraith rapids
#

i don't pledge allegiance to some brand, i'm here to help developers

ivory sleet
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

wraith rapids
#

it's my moral obligation to redirect people at superior software

ivory sleet
#

Lol

eternal oxide
#

Can;t wait to see you thrown out of McDonalds

pearl spire
#

I have some ranks on my server, and i want the players to go on the NPC'S and click on them and be able to look what this rank gives you how do i do this ?

rigid hazel
#

BookMeta.Spigot bookMeta = (BookMeta.Spigot) book.getItemMeta();

wraith rapids
#

i don't go to mcdonalds

#

mcdonalds is trash

eternal oxide
#

Exactly

rigid hazel
#

Id did this, but now I cant use bookMeta.setAuthor(this.getMailSender(id)); for example

wraith rapids
#

their fries taste like shit

#

their burgers are tiny and taste like shit

#

the only redeeming quality is that you can get a soda for 50 cents

eternal oxide
#

Heathen, their fries are heaven sent!

pearl spire
#

can someone help me

#

go to general if u want to talk about mcdonalds

wraith rapids
#

no

#

general does not exist

lost matrix
pearl spire
#

yy

wraith rapids
#

is that a yes?

pearl spire
#

yes yes

lost matrix
ivory sleet
#

NNY do you still have that 1.8 server? If so invite me (:

pearl spire
#

i have no idea what you just said

wraith rapids
#

of course

#

hold on

lost matrix
wraith rapids
#

GeFyXy5q

ivory sleet
#

A thx

lost matrix
#

Wait... there is a dedicated 1.8 server?

#

want

wraith rapids
#

it died a bit after I took a break from paper mod fucknuggetry but there are still some people there

lost matrix
pearl spire
#

idk how to code lol

wraith rapids
#

then why are you here

pearl spire
#

no im not

ivory sleet
#

Yeah I see nice it’s still maintained somewhat lol

wraith rapids
#

this is the developer channel

lost matrix
wraith rapids
#

you go back to #general

main dew
#

How I can update light use ChunkSection?

eternal oxide
#

Explain better

teal wraith
main dew
#

nmsWorld.c(EnumSkyBlock.BLOCK, new BlockPosition(x,y,z));
you know this metod?

main dew
#

I want update light use ChunkSection no WorldServer

eternal oxide
#

no nms

teal wraith
main dew
#

or how update light on all chunk?

quiet ice
#

You see, people here are most likely to be developers and have no idea on how to administrate a server, which is why there are two channels for two different purposes

wraith rapids
#
  • your question is nonsensical
main dew
#

my question?

wraith rapids
#

the question in #help-server

eternal oxide
main dew
#

a no only one one chunk or better only on one section

eternal oxide
#

Still the question, why do you want to update lighting?

main dew
#

I try use fast metod place blocks

eternal oxide
#

and you have lights left over

main dew
#

cs.setType(x, y & 15, z, ibd);

#

light don't update in this metod

eternal oxide
#

have you tried initLighting() ?

main dew
#

no

eternal oxide
#

its a method of nms Chunk

#

No gurantees as I've not looked at that source

main dew
#

intresting but you have maybe metod to selected blocks in chunk? or better in section?

lost matrix
eternal oxide
#

What spigot version?

main dew
#

1.12.2

main dew
lost matrix
#

Ok nvm. 1.12 has single thread light updates. No idea how that works...

wraith rapids
#

gl with several years old nms questions for versions that barely anyone uses anymore

#

you might have better success with an ouija board

main dew
#

I think version 1.8 and 1.12.2 is popular

wraith rapids
#

1.8 is "popular", 1.12 isn't

lost matrix
wraith rapids
#

iirc 1.12 is like less than 5% of the total pool

opal juniper
#

How do i compare the value of version strings that have multiple decimal points? I cannot just treat them like floats

main dew
#

@lost matrix you can give me link to this information?

plain quest
#

how does bukkit call events?

wraith rapids
#

through reflection

#

paper uses asm which is an order of magnitude faster for high frequency events

lost matrix
wraith rapids
#

like purpur's entity move event 👀

lost matrix
plain quest
#

ok so are there any classes with the callevent() method?

wraith rapids
#

it would be insanely expensive if done reflectively yeah

main dew
wraith rapids
#

what are you trying to do? are you trying to call an event?

plain quest
#

no just for knowledge

lost matrix
cold field
#

what it is a command source?

lost matrix
plain quest
#

yes but the event handlers are used for the api my question is if this method is called in some other class to call eg playermoveevent

main dew
#

thanks

wraith rapids
#

a method is a method

cold field
wraith rapids
#

you can call it however you want as long as you pass the necessary parameters

hybrid spoke
wraith rapids
#

nothing stops you from calling an eventhandler method yourself

lost matrix
plain quest
lost matrix
wraith rapids
#

not exactly, but HandlerLists come closest to that

#

the classes are scanned for EventHandler annotated methods when you call registerEvents on their instances

#

these methods are then shoved onto HandlerLists

hybrid spoke
wraith rapids
#

which are held statically by the event classes themselves

plain quest
#

interesting 🧐

cold field
plain quest
#

ok thnx

wraith rapids
#

which are then accessed by the method mentioned above, and the eventhandlers are fired reflectively

opal juniper
lost matrix
plain quest
wraith rapids
#

yes

#

it is quite slow

hybrid spoke
# opal juniper Yeah, I was gonna split it but will have to think about the logic of what makes ...

you could use major versions for each version/string whatever, like this: https://stackoverflow.com/questions/9170832/list-of-java-class-file-format-major-version-numbers.

major versions

wraith rapids
#

which is why paper did away with reflection

#

and uses code generated at runtime via ASM instead

#

that said, it doesn't really play a big role except for high frequency events

lost matrix
plain quest
#

ok thanks people

cold field
#

😢

opal juniper
#

I have a string:
1.1.1 and i run this:

String[] currentVersionParts = currentVersion.split("."); however that returns an empty array?

lost matrix
#

escape the dot \\.

opal juniper
#

i then realised that i had ignored it was a regex 😄, java really hits different to python

silver shuttle
#

Is there a way I can, without an error, check if an argument is above the 32 bit integer limit?

#

nvm figured it out ^^

#

can just check if the double of it is higher than the limit

#

instead of integers

quiet ice
#

Why not use 64 bit integers (long)?

silver shuttle
#

because I dont need that much and would rather use ints so I dont have the hassle of checking for comma numbers

wraith rapids
#

might be best to use biginteger or something

young knoll
#

Comma numbers?

silver shuttle
#

does mysql support that?

quiet ice
#

Double is a 64 bit floating point number

wraith rapids
#

i doubt it really changes anything but mixing integers with floating point can result in unexpected shit

silver shuttle
#

I need it to be MySQL compatible

quiet ice
#

Especially with big values floating point numbers become really unprecise

#

Be carefull if that is important for you

silver shuttle
wraith rapids
#

since you're only checking if it's bigger than 2^31, it's probably fine to use double but might be better to use biginteger

#

than afterward you can just grab it as a plain int

silver shuttle
wraith rapids
#

ints? yes

silver shuttle
#

bigint?

wraith rapids
#

what?

#

you are checking an argument

#

you aren't in the mysql zone yet

silver shuttle
#

it supports ints, i know, but does it support bigints

wraith rapids
#

it doesn't need to

silver shuttle
#

I am checking to see if the MySQL supports it

wraith rapids
#

you're just using the bigint to check if the argument is greater than the representable range of an int

silver shuttle
#

oh now i got you

wraith rapids
#

Is there a way I can, without an error, check if an argument is above the 32 bit integer limit?

#

which is what you wanted

silver shuttle
#

could do that, but yeah I got it working now

quiet ice
#

So yes, MySQL does support 64 bit integers as BIGINT

silver shuttle
#

ok

wraith rapids
#

note that I was talking about java biginteger though, which is an arbitrary bit length integer

lost matrix
#

Throughput. Cached reflections are very close to native calls. (If the frequency is high enough)

Benchmark                                             Mode  Cnt  Score   Error  Units
ReflectiveInvocationBenchmark.callNative              avgt    5  0,021 ± 0,002  us/op
ReflectiveInvocationBenchmark.invokeReflective        avgt    5  0,070 ± 0,001  us/op
ReflectiveInvocationBenchmark.invokeReflectiveCached  avgt    5  0,029 ± 0,001  us/op

Random Sampling. Again showing that the jit can optimize the reflections pretty nice.

ReflectiveInvocationBenchmark.callNative                                             sample  1212398     0,043 ± 0,001  us/op
ReflectiveInvocationBenchmark.callNative:callNative·p0.999                           sample              0,100          us/op
ReflectiveInvocationBenchmark.callNative:callNative·p0.9999                          sample             14,000          us/op

ReflectiveInvocationBenchmark.invokeReflective                                       sample  1308558     0,095 ± 0,001  us/op
ReflectiveInvocationBenchmark.invokeReflective:invokeReflective·p0.999               sample              0,400          us/op
ReflectiveInvocationBenchmark.invokeReflective:invokeReflective·p0.9999              sample             19,726          us/op

ReflectiveInvocationBenchmark.invokeReflectiveCached                                 sample  1472496     0,053 ± 0,003  us/op
ReflectiveInvocationBenchmark.invokeReflectiveCached:invokeReflectiveCached·p0.999   sample              0,200          us/op
ReflectiveInvocationBenchmark.invokeReflectiveCached:invokeReflectiveCached·p0.9999  sample             14,096          us/op

Surprisingly uncached reflections perform better than i expected. I found out that Class actually has an internal cache for reflections.
I wonder how this changes when i use java 8 instead of 11

quiet ice
#

I wouldn't be surprised if it performs worse

wraith rapids
#

it probably does

main dew
#

I try update light use
nmsWorld.c(EnumSkyBlock.BLOCK, new BlockPosition(x,y,z));
posible make this use
nmsChunk
or
ChunkSection?

lost matrix
#

Java 8
Native didnt change (obvsly) but uncached reflection calls are really horrible. One reason more to avoid this version.

Benchmark                                             Mode  Cnt  Score    Error  Units
ReflectiveInvocationBenchmark.callNative              avgt    5  0,020 ±  0,001  us/op
ReflectiveInvocationBenchmark.invokeReflective        avgt    5  0,279 ±  0,005  us/op
ReflectiveInvocationBenchmark.invokeReflectiveCached  avgt    5  0,028 ±  0,001  us/op
#

They take 14 times the time of a normal method call.

lost matrix
young knoll
#

What is meant by cached reflection

lost matrix
young knoll
#

Ah okay

young knoll
#

I do that with everything but setting a skull via GameProfile

main dew
#

I can try conver this to 1.12.2

young knoll
#

Because CraftSkullMeta isn’t a public class

quiet ice
#

1.14 had a light engine rewrite

#

Unlikely that it can be ported

wraith rapids
#

isn't there api for doing that now?

#

or i guess that might be paper only

quiet ice
#

7smile7 wanted to PR that in iirc

fervent chasm
#

Hey I'm trying to create a mc client, and I tried running it, but it came up with this error message:

    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.lwjgl.Sys$1.run(Sys.java:72)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:87)
    at org.lwjgl.Sys.<clinit>(Sys.java:117)
    at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2995)
    at net.minecraft.client.main.Main.main(Main.java:39)
    at Start.main(Start.java:11)

Except I do have LWJQL in my build path and there are no errors showing in Eclipse IDE
How can I fix this issue?

lost matrix
#

PlayerProfile

lost matrix
young knoll
#

Not sure this is the place to get support for a custom client

quiet ice
#

Either ask Fabric, Forge or Quilt for such questions

#

Though all of them will not help you with hacks

lost matrix
main dew
#

how convert chunk cord to world cord?

young knoll
#

Quilt? Gosh dangit not another mod loader

lost matrix
main dew
#

a yea thanks

cold field
#

does anyone have ever used brigadier?

fervent chasm
#

@lost matrix I'm using JDK 1.8

#

wait wat

quiet ice
#

Are you sure you have your native binaries set up?

novel lodge
#

I'm running a getOnlinePlayers() function on "PlayerRespawnEvent" and for some reason it returns a collection with 0 size

#

Does anybody know why this is happening

quiet ice
#

then there simply is no player online perhaps?

eternal oxide
#

show code

wraith rapids
#

you'd think there'd be at least the player who is currently respawning though

quiet ice
#

Isn't a respawn packet sent when a player joins?

wraith rapids
#

packet yes but this is an event

#

i don't think the event fires for joins

quiet ice
#

though it would be stupid of bukkit to fire it as an event

wraith rapids
#

seems kind of silly

novel lodge
#
    public void respawn(PlayerRespawnEvent event){
        OfflinePlayer[] test = event.getPlayer().getServer().getOfflinePlayers();

        event.getPlayer().getServer().broadcastMessage(String.valueOf(test.length));
}
wraith rapids
#

then again bukkit is pretty fucking silly so

quiet ice
#

That is offline players

novel lodge
#

oh yeh wrong thing

quiet ice
#

Also, use Bukkit#getServer instead

novel lodge
#

This is the code:

    public void respawn(PlayerRespawnEvent event){

        Collection<? extends Player> players = event.getPlayer().getServer().getOnlinePlayers();

        event.getPlayer().getServer().broadcastMessage(String.valueOf(players.size()));
}
#

and ok

wraith rapids
#

shouldn't really make a difference though

#

but it's more readable i guess

quiet ice
#

Bukkit#getOnlinePlayers() should exist though, so even less code.
But yes, not real difference

eternal oxide
#

Its impossible for that to be zero size

wraith rapids
#

maybe he is nearsighted and it's saying 8 and he's reading it as 0

novel lodge
#

I can't send a screenshot but it says 0

eternal oxide
#

Its literally impossible, you are getting the player from the event so at least 1 player object exists. Use Bukkit.getOnlinePlayers()

novel lodge
#
        Collection<? extends Player> players = Bukkit.getOnlinePlayers();
      //When this happens it says in the console 0
        event.getPlayer().getServer().broadcastMessage(String.valueOf(players.size()));
eternal oxide
#

What version of Spigot?

quiet ice
#

Are you sure that this even is the right number?

#

Not that you accidentally read a foreign number

novel lodge
wraith rapids
#

magick

novel lodge
#

I should probably replace all the event.getPlayer() 's with a single variable

eternal oxide
#

ok that IS odd

silver shuttle
#

Is it possible to have a ClickEvent run code instead of commands or so?

eternal oxide
#

I just tested your code and it does in fact report zero

wraith rapids
#

kind of

#

make it run a command, listen to that command, then run code

silver shuttle
#

well then I'd have another command

wraith rapids
#

no direct way of executing code though

silver shuttle
#

damn

#

ok thanks

young knoll
#

Does sending a non registered command still trigger the command event

wraith rapids
#

most people generate like uuid tokens and store them in a map to keep track of what components fire what

young knoll
#

You could do it that way

dusk flicker
#

Haven't seen you in a while NNY

novel lodge
eternal oxide
#

None that springs to mind

spare mason
#

how i can double the attack of the zombies

wraith rapids
#

i took a break from minecraft related discords for a while

pure glacier
#

probably a dumb way to do it, but get the max health of the player, and if the player is hit by a zombie, cancel the event and set the players health to 2 times the damage of a zombie @spare mason

wraith rapids
#

mostly to spawn in a horde of alts

spare mason
#

i only need the DOUBLE attack

eternal oxide
wraith rapids
#

don't the entity damage events have like a method to set the damage

eternal oxide
#

Yep can confirm a dead/respawning player does not appear in Bukkit.getOnlinePlayers()

wraith rapids
#

brilliant

eternal oxide
#

Isn't included in the online list until the respawn event has finished.

eternal oxide
#

Yep

#

I checked in a command and it shows me as online 1 player

lost matrix
#

But just because he is dead doesnt mean he isnt online anymore...

eternal oxide
#

checked in teh respawn event and the online player is empty zero

wraith rapids
#

my guess is that it's because the player is in a pretty different state from normal during death

eternal oxide
#

Bukkit.broadcastMessage("Total Players: " + Bukkit.getOnlinePlayers().size());

#

I guess it moves them to some limbo menu so they can;t be operated on while dead.

novel lodge
#

Is there an event that occurs when the player actually spawns?

quiet ice
#

Probably after the event

pure glacier
#

look in the javadocs

quiet ice
#

I guess you'd schedule a task after the respawn

silver shuttle
#

How do I make somebody do a command? Like sender.DoCommand() or smth

quiet ice
#

(i. e. a tick)

eternal oxide
#

No, thats the event we checked to see if he was online

wraith rapids
#

what's the issue here, though

pure glacier
#

by spawn, do u mean spawn for the first time

eternal oxide
#

at that point he's still dead and not in the online list