#help-development

1 messages · Page 281 of 1

fluid river
#

why do we have 4+2

#

and you have 3 + 1

undone yarrow
#

@fluid river I'm open for lessons. Do you want to do it in dms or anywhere else?

opal juniper
#

i think a doctorate is like 7 total

#

3+1+3

#

again though, depends on course and how long you take

undone yarrow
#

k let me get a mic and all

opal juniper
#

lol

fluid river
#

it's all standardised for russians

undone yarrow
#

fair warning, someone's drilling in the wall under my room now and then

fluid river
#

i don't care meh

soft viper
#

Can i change server motd with plugin?

fluid river
#

yes

#

ServerListPingEvent

opal wedge
#

Hey, what packet is sent to cancel the particles of a torch?

fluid river
#

change the description

soft viper
#

thanks

chrome beacon
opal wedge
charred blaze
#

Fatal error trying to convert Chat v1.0:net/multylands/chat/listeners/Book.class
29.12 15:09:20 [Server] INFO org.bukkit.plugin.AuthorNagException: No legacy enum constant for WRITABLE_BOOK. Did you forget to define a modern (1.13+) api-version in your plugin.yml?

#

what does this mean?

tardy delta
#

that you have to put api-version: 1.13 in your plugin

earnest socket
#

shouldn't this be working?

#

I am trying to check if a block is any type of container (chest, furnace, hopper, etc)

#

but it doesn't seem to work

tardy delta
#

isnt it the blockstate?

rotund ravine
#

It is

tardy delta
rotund ravine
wet breach
#

(event.getClickedBlock().getBlockState() instanceof Container)

wooden steeple
#

Hello, I am getting this error when using this class.
I converted packages to version 1.16 and have no idea why the server is returning a warn. Thank you in advance for your help
https://gist.github.com/jonahseguin/2c21843806b7c03b42ad ->.
I have changed:

import net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam;```
Gist

Bukkit class to Easily change and modify a player's nametag prefix & suffix via NMS - NametagEdit.java

rotund ravine
#

?paste

undone axleBOT
rotund ravine
#

@wooden steeple

wooden steeple
#

Okey

rotund ravine
#

Use components and not strings

wooden steeple
#

Could you please explain where?

#

I'm supposed to replace everything with? ChatBaseComponent

earnest socket
#

changed it to the block state and it worked now thanks

fathom carbon
#

how do i check if ItemStack is tool?

#

I tried this but thats true even for blocks and other stuff

humble tulip
#

what blocks are damageable?

fathom carbon
#

apparently?

humble tulip
#

apparently?

#

which blocks?

fathom carbon
#

the statement i sent returns true even if the itemstack is block

#

can u answer my original question?

humble tulip
#

which block?

fathom carbon
#

ANY BLOCK

fathom carbon
humble tulip
#

idk what !! is in kotlin

#

is that the same as event.getItem().getItemMeta()?

fathom carbon
#

yeah

humble tulip
#

but doing a null check?

fathom carbon
#

yes

quiet ice
#

You'd need to do that check manually

fathom carbon
quiet ice
#

?jd-s unless there is an API there, but I doubt so

undone axleBOT
humble tulip
#

if that doesnt work then, just create a Set<Material> of tools

fathom carbon
#

mhm

#

alright

devout bronze
#

java.sql.SQLException: No suitable driver found for mysql

quiet ice
#

I guess you could check the creative category, but that is a dangerous check

fathom carbon
#

was hoping for a better solution but i will have to create a list of all tools then

#

¯_(ツ)_/¯

quiet ice
#

(outside of enchanted_book that is, that is not a tool)

fathom carbon
#

ah thats helpful

#

thanks

tardy delta
#

hardcoding materials?

fathom carbon
#

¯_(ツ)_/¯

quiet ice
#

At worst you' softcode them just like I did - I.e. throw them in a .yml file and call it a day

subtle folio
#

what about roughcode?

quiet ice
#

there is only hard and soft

subtle folio
#

no

#

there is a i between

#

(make a command to set the value and print it Troll )

pulsar prism
#

Is there any way to exclude a spectator mode player from spectating specific players? I want to allow selective spectating per each spectator... if that makes sense

#

I am considering somehow using ProtocoLib to literally hide players who arent needed - but is there any easier way?

fallow violet
#

why not just do player#hidePlayer(JavaPlugin, target);

fluid river
#

^

#

Player#showPlayer() to show again

fallow violet
#

^

fluid river
#

tho you would need to store info somewhere, cuz afair they are hidden forever

fallow violet
#

lmao

fluid river
#

so you might end up with player never see each other again

#

if you forgot to reshow them

fallow violet
#

but you can loop through all players and on playerLeaveEvent you can show them again

fluid river
#

yeah there are many ways

#

but still

#

bycicle invention

river oracle
fluid river
#

)

fallow violet
#

im actually not sure if it stays after leave

fluid river
#

that's why i said afair 💀

fallow violet
#

sorry idk what afair means

fluid river
#

as far as i remember

forest turret
#

Sorry, I don't know in which channel to ask. A good kits plugin for 1.7.10? They are all not working

fluid river
#

help server

forest turret
#

Oh lol

fluid river
#

code it in 10 minutes

#

with stream on

fallow violet
#

^

#

i trust in @fluid river

fluid river
#

for free

river oracle
#

Free java lessons!

fluid river
#

yes

river oracle
#

Freew java lessons! With nukerfall

fallow violet
#

POV you have nothing to do and force others to ask you to make plugins for them

lost matrix
river oracle
forest turret
#

So, from those jokes, I understand there's no a working kit plugin?

river oracle
#

Come on man

fluid river
#

teach you to code own kit plugins in one day

fallow violet
civic wind
#

Just use lunar for block hitting 1.8

river oracle
#

Does essentials work on legacy versions that old

fluid river
#

idk

river oracle
fluid river
#

it worked on 1.5.2 in good ol' days

river oracle
#

I think he should use 1.7.10

forest turret
# fluid river essentials

I tried with that, but first there's no a /createkit command and, I don't know how to take ids for items with other mods

river oracle
forest turret
#

LOL bro

fluid river
#

yeah, you create it manually

fallow violet
#

xddd

fluid river
#

with essentials

#

with config file

fallow violet
#

bro just write your own 5 lines

river oracle
#

What's a config ?!?

fallow violet
forest turret
#

Where I can get item ids from like mods, or minecraft items in general

undone axleBOT
fallow violet
river oracle
#

Wait he uses 1.7 he might need his search engine

#

?bing

undone axleBOT
fallow violet
#

?yahoo

undone axleBOT
sterile token
#

Why a name field? Because is the cache identifier that redis need. Because he can manage many cache at the same time

Why generics? Because i want to be able to work more confortable when catching saving directly object instead of strings

forest turret
fluid river
#

hashmap

pulsar prism
fallow violet
#

jepp

tardy delta
#

just use guava Cache

#

whats the point of that class tho

#

i wanna see impl

fluid river
#

guy reinvented map

tardy delta
#

did smth similar years ago

fallow violet
#

lol

fluid river
#

did this in c++ several days ago

#

goal was to figure out why the fuck is hash needed in hashmap

#

c++ map didn't use hash but i got why it was needed i njava

tardy delta
#

hashmap

#

why is hash needed

fluid river
#

yeah

#

why

chrome beacon
#

Because it's a hasmap

tardy delta
#

cuz its in the name 💀

fluid river
#

why can't java have NoHashMap

tardy delta
#

OnMap

fluid river
#

And now i know why

chrome beacon
#

If you don't want a hash use another map impl

fluid river
#

i guess

fluid river
tardy delta
#

man just made an O(n) map

fluid river
#

well there is TreeMap

#

but still

tardy delta
#

just make a linkedlist and call it a hashmap

fluid river
#

it was using set tho

#

but not a hashset

#

as hashmap in java does

fluid river
#

Set<Entry<Key, Value>>

tardy delta
#

damn lmao

#

set wrapper

fluid river
#

HashMap in java is a HashSet wrapper

#

o_0

tardy delta
#

no

fluid river
#

oh i read it wrong

#

HashSet uses keySet

torn badge
#

Anyone have an idea how I could manipulate the result item in a villager trade without creating a new recipe?

fluid river
#

which is AbstractSet impl

fluid river
#

anyways

torn badge
fallow violet
#

?google

undone axleBOT
fluid river
#

Map uses Set inside

torn badge
#

I have already

fallow violet
#

so u found nothign? hmm

torn badge
#

Nothing that suits my case

tardy delta
torn badge
#

I tried setting the result item in InventoryClickEvent and that worked

#

But not when shift clicking

#

Since the result item is taken from somewhere else then

tardy delta
#

@fluid river map uses an array of linked nodes ^

fallow violet
fluid river
torn badge
#

Yes but the MerchantInventory doesn’t act the same when shift clicking

tardy delta
#

thays a cached view for the Map#entrySet

#

thats not the storage

torn badge
#

And there’s no way to set the result item in a MerchantRecipe

fallow violet
#

maybe just create a villager with custom recipes xd

tardy delta
torn badge
#

Yeah but that’s exactly what I’m not trying to do 😄

fallow violet
#

but whyyy

torn badge
#

Because that would be hundreds of recipes

fallow violet
#

damn

tardy delta
#

wouldnt make sense that the storage field would be null

fallow violet
#

i found something

#

but you have to use nms

#

or you dont create a recipe you modify it

torn badge
#

What’s weird is I already tried modifying the recipe via reflection in InventoryClickEvent

fallow violet
#

and what happend

torn badge
#

Then checked the result item in PlayerTradeEvent and it was in fact the item I wanted

#

But I didn’t receive that item

fallow violet
#

and do you know why?

torn badge
#

No

#

InventoryClickEvent should be called before any trading logic is performed

#

So I don’t know why that wouldn’t work

fallow violet
#

should

#

maybe eventpriority?

#

set it to HIGHEST maybe

torn badge
#

That doesn’t make a difference

#

EventPriority is only for clashes between plugins

fallow violet
#

make sense xd

#

did u see the modified item in the gui tho?

torn badge
#

No the GUI never changes

#

I also tried simply setting the result item in the inventory

#

That works but not for shift clicking

fallow violet
#

then disable shiftclicking in the inventory?

#

xd

torn badge
#

That doesn’t solve the problem tho 😂

fallow violet
#

yeah ik but its a start lmao

#

did u work with PlayerPurchaseEvent? just found it

#

idk much about villagers

torn badge
#

I can’t image PlayerPurchaseEvent being called before InventoryClickEvent

fallow violet
#

but you can try

torn badge
#

But I will try

fallow violet
#

nice

#

tell me the result :p

#

and maybe u can modify the items in the event

torn badge
#

It has a setTrade method so that should actually work

#

The problem when I tried that in PlayerTradeEvent was that I couldn’t get the ingredients anymore

#

Maybe they are still available in PlayerPurchaseEvent

fallow violet
#

who knows

tall citrus
#

I want to do something like this in a cutom yml file called "arenas.yml", i already have the arenas.yml created but, how can I put the data like this format??

fallow violet
#

you can use YAMLConfiguration or something like that

tall citrus
#

Yes

#

I have that BUT

#

i want that format

#

Name:
data1:
data2:

fallow violet
#

just do YAMLConfiguration#set("name.data1", VALUE);

#

just do YAMLConfiguration#set("name.data2", VALUE);

#

just do YAMLConfiguration#set("name.data3", VALUE);

tall citrus
#

trueeeeeeee

fallow violet
#

ez as that

tall citrus
#

omg ty u helped me a lot

fallow violet
#

<3

tall citrus
#

can i sck your nevermind

fallow violet
#

i dont mind

#

ahem

fallow violet
#

good luck with your yml :3

robust light
#

how can I set an expiration for a ban using the banPlayer function? I didnt find anything about it in the docs

fallow violet
#

you could store the timestamp and on join you check if the time is passed on the timestamp and remove the ban

#

you can get the timestamp with System.currentTimeMillis() and convert it with new TimeStamp(System.currentTimeMillis())

#

you store then the timestamp + the ban time in milli seconds

#

and on join you check if System.currentTimeMillis() is greater than the stored time

#

thats a way how to

spice shoal
#

Hi guys, I’m new in developing in Java.

I was trying to develop a plugin that , when a player executes /ally [ player ] , to the selected [ player ] , sends message "Do you want to accept Ally? [YES] [NO].

If the player in question accepts, those 2 players will not be able to hit.

How can I do that?

wet breach
quaint mantle
#

What would be the best way to go about getting any/all players in a radius of a location?

spice shoal
paper viper
#

So many server owners just jump into plugin dev without learning java they come in here crying cause of npe or smthing

spice shoal
#

oh okay.

wet breach
#

?learnjava

undone axleBOT
tardy delta
#

damn internet so fast the speed test page doesnt even want to load in

dry yacht
# paper viper So many server owners just jump into plugin dev without learning java they come ...

While this is very good advise, I do get the fact that it just sucks to go ahead and "learn Java" if what you're really interested in is actually modding a game. This would take a lot of self-discipline which many people just cannot get together.

I also started out with plugins and had an immensely hard time (and asked tons of stupid questions). I just believe that this is part of the journey. As soon as one knows enough and has seen what real programming knowledge can achieve, they'll learn Java (or other languages) "properly".

glossy venture
#

can i do something like

libraries:
  - org.mongodb:mongodb-driver-sync:4.1.1
  - org.ow2.asm:asm-all:6.0_BETA
  - com.github.docker-java:docker-java:3.2.14

for bungeecord in the plugin.yml? (all dependencies are in maven central)
or will i have to shadowjar them in

fallow violet
#

did u try "try it out before asking"?

glossy venture
#

nah but i cant because it wont compile

#

unfinished stuff

fallow violet
#

then finish it lol

glossy venture
#

bruh

fallow violet
#

xddd

wet breach
#

do you know how irritating it is for us who help those here to only get someone coming in here asking super basic questions because they couldn't be bothered to take time to learn the language?

#

for us to then teach them what they could have learned themselves

spice shoal
glossy venture
#

yo frost you know if i can use libraries: in bungeecord plugin.yml?

#

i cant find shit about it online

#

would be very nice

wet breach
#

what is that supposed to do o.O

glossy venture
#

if i could

#

idk

glossy venture
#

was wondering if i could do that in bungee

wet breach
#

?tryit

#

?tryitandsee

#

?tias

glossy venture
#

command fail

#

lmao

wet breach
#

anyways

#

try it I guess

#

or look at bungee source

glossy venture
#

oh yeah smart

dry yacht
# wet breach selfish thinking really

Selfish? Are you not in control of yourself? If you don't want to help somebody because you think the question is too basic for you, then just ignore it. I don't get the big deal. I think that it's immensely selfish and ignorant of you to judge that easily. Not everybody is able to learn this crazy shit on their own, and maybe they'd still like to accomplish some of their goals.

fallow violet
#

calm down guys

glossy venture
#

yessir

#

lets go

wet breach
#

many people are plenty capable

glossy venture
#

holy bing chilling

fallow violet
#
if (angry()) {
  calmDown();
}
fluid river
#

?tryandsee

undone axleBOT
fluid river
#

?tas

undone axleBOT
dry yacht
glossy venture
#

they forgot the "it"

fallow violet
wet breach
dry yacht
molten hearth
fallow violet
#

if someone calls you selfish just ignore it

molten hearth
wet breach
#

I see the new people have some learning to do >>

quaint mantle
#

Anyone know why it's sending the path and not just the value in the path?

fallow violet
#

^

dry yacht
#

You cannot waste somebody's time if they don't give you permission to. Learn to defend yourself against what bothers you, rather than telling others what they can and cannot ask.

wet breach
ivory sleet
#

guys what the heck

fallow violet
#

i dont f know

dry yacht
ivory sleet
#

If you do not want to assist someone here, just ignore them then? Not a big deal

fallow violet
#

^

quaint mantle
#

To be fair he can learn how he likes and if you don't want to help just ignore him

#

Too many spigot developers with big egos

dry yacht
wet breach
#

I have no problems ignoring people, but just wait till someone comes in here with basic questions and everyone ignores them and some other lesser experienced person helps them with even worse code and examples 😛

quaint mantle
wet breach
#

guess I shouldn't have a problem with that

quaint mantle
wet breach
quaint mantle
wet breach
#

it seems you all have a problem that we want this of others

dry yacht
#

I just got a "selfish thinking really" thrown on my head and reacted a bit over the top. I'm sorry for that. Let's just let this topic rest, we all added our opinions and aren't going to change each other anyways.

wet breach
#

no I can't, doesn't mean we can't encourage though

#

and explain why we do so

quaint mantle
#

That was encouragement??

wet breach
#

life is more cruel

dry yacht
# wet breach ?learnjava

Very encouraging, people like these almost made me quit when I tried to start. I'm happy that I persisted and am today where I am now.

quaint mantle
wet breach
#

it gives links to resources

#

to so you can learn

#

?learnjava

undone axleBOT
wet breach
#

see

tardy delta
#

by people doing that

#

the man who told me a lot of stuff here is kicked or banned

dry yacht
dry yacht
wet breach
dry yacht
wet breach
quaint mantle
#

I've never used this entrymap etc so I am new to it

wet breach
#

so how you perceive me or whatever else is just on you I guess 🙂

dry yacht
dry yacht
quaint mantle
#

Yes, so I use a method. I'll paste method

wet breach
#

?paste

undone axleBOT
wet breach
#

use the above link to paste code

#

please

dry yacht
quaint mantle
tardy delta
#

that will get a section then

dry yacht
#

You cannot access another key from a string value

#

But from a map.

quaint mantle
#

So just do it all in one?

dry yacht
#

I'd advise you to do so, and not spread calls and try to get "sections" beforehand to then drill deeper down into them later on.

#

The whole configuration API is in memory anyways, you're not going to get any more performance by doing so.

quaint mantle
#

Yeah Im using a method to get the player name and then i just get player kills by it's self as I need to add the name and kills seperately

#

So I can set them out in the broadcast

#

I need seperate variables for them is what I mean

dry yacht
#

You need to be aware of the fact that a yaml configuration is basically a map at it's top level, mapping string keys to either a map, a list or a scalar (int, string, boolean). So if you don't access a scalar by it's path directly, you'll get a map or a list in response. If you call #getString, it internally stringifies the value, which is why you get the string representation of a section in your chat.

wet breach
quaint mantle
wet breach
#

I would change those player names to include UUID's

#

since player names can change

#

and UUID's don't

quaint mantle
#

Yeah fair point can add UUID

dry yacht
wet breach
#

Anyways, make a player wrapper that works on when player joins

quaint mantle
wet breach
#

and it pulls that that information

quaint mantle
#

kk

wet breach
#

you shouldn't need any looping for that

dry yacht
quaint mantle
#

Top 3

wet breach
#

since you should be able to pull the data by calling their UUID

quaint mantle
#

Yeah i'll do uuid

dry yacht
quaint mantle
#

kk

wet breach
#

so, the way you would get the data is getInt("player." + playerUUID + ".kills")

#

you don't even need their name

#

and you already have their UUID

#

only thing you need to handle is when the player is not in there and thus returns null

fallow violet
#

but if u wanna make a top 10 you have to get the name from the uuid

quaint mantle
#

Yeah

#

I need the name

#

I already have the kills working

fallow violet
#

Bukkit.getOfflinePlayer?

quaint mantle
#

I use offlineplayer

fallow violet
#

maybe

wet breach
#

you can get names using offlineplayer with UUID

fallow violet
#

yeah

wet breach
#

mc server will use the cache and if the player isn't in cache it will do a lookup on mojang servers

dry yacht
quaint mantle
#

kk cool

dry yacht
#

You're going to have a far easier time with YAML once you understand it's internal makeup. It's very simple, intuitive and uses a recursive key-value pattern. You just drill down and can get "intermediary levels" through sections.

quaint mantle
#

Yeah got it working, I understand where I went wrong now.

#

Cheers man appreciate it

dry yacht
#

Happy that you solved it! :)

quaint mantle
#

Although now it's not finding the kills?

dry yacht
#

@humble tulip Oh, btw, are you still interested in the whole topic of packet interception, where I've sent you a small example of mine? I got a clean way to get every packet since the Handshake now, if you'd like I can also share that with you.

fallow violet
#

player.uuid.kills

#

whats not finding xd

dry yacht
quaint mantle
#

All good I made a typo lol

spice shoal
#

Guys i have a question.
Gradient color working in Minecraft plugin message?

#

i have created /discord command but it happened

spice shoal
#

`package me.sussolino.juicepvpcore.juicepvpcore.commands;

import me.sussolino.juicepvpcore.juicepvpcore.JuicePvPCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Discord implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "&r &#e010d4&lDI&#aa1da2&lSCO&#712e84&lRD&f!"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , " &f➥ &e&ndiscord.gg/5vgG9uy5aX"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
}
return true;
}
}`

fallow violet
#

strong

spice shoal
#

idk what is this

fallow violet
#

thats the not working discord link

spice shoal
#

ah lol , thanks for info

fallow violet
#

xd

spice shoal
#

but , why gradient color not working ? :((

#

Shall I try without '&'?

fallow violet
#

.

tardy delta
#

uhh

quaint mantle
#

How can #setDisplayName be null checked? Surely it would be null if the item is null and i've checked that?

spice shoal
spice shoal
#

oh ok , thanks

fallow violet
#

but idk how to make gradiants

spice shoal
#

np

fallow violet
#

^

spice shoal
#

Guys , for create a place holder , i need PlaceHolderAPI as dependecy?

tardy delta
#

yes

spice shoal
#

thx

dry yacht
#

@humble tulip

Here's a little example of the interceptor I talked about: https://paste.md-5.net/agijuxikil.java It still uses my library called BBReflection, which is public on my github, as you know.

I'll very probably still make a lot of architectural changes and fix stuff, but you got everything you need to know there, if you just follow the method calls. Like this, you can easily intercept all packets, like server-list pings and early player packets.

humble tulip
#

Relink your gh pls

dry yacht
humble tulip
#

Can i copy and modify some of your code and put it into my plugin? I just need to intercept 2 play packets

dry yacht
#

Of course, feel free to do so. I still need to add the MIT license once I feel like it, but just go ahead in the meanwhile, :).

spice shoal
#

Guys , how i can implement totem animation?

remote swallow
#

without packets, the easiest method i can think is set there main hand or off hand to a totem then damage them the amount of their health

spice shoal
#

for create a title like this:

how i can do?

remote swallow
#

player#sendTitle ?

spice shoal
#

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
((Player) sender).sendTitle('&b&lStore ');
((Player) sender).sendTitle('&fclick in chat ')
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "#6ec0fa&lST#4882a5&lO#2a4858&lRE&f"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "&f➥ &e&nhttp://www.juicepvp.eu"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
}
return true;
}
}

like this?

remote swallow
#

you can remove the Player p = (Player) sender; and change if (sender instanceof Player) { to if (sender instanceof Player player) { then you can use the player var where you need it, the gradient i doubt will work but the rest looks fine

fallow violet
#

looks better if u invert the instaceof check and return it

spice shoal
#

in "if (sender instanceof Player player) {"

tardy delta
#

then dont

remote swallow
#

ah

#

java 8

spice shoal
#

ah , how i can update it?

fallow violet
#

change java verison

remote swallow
#

^^

fallow violet
#

but maybe u cant

#

bcs server is running on another

#

idk much about versions

remote swallow
#

depends what server version this is for

spice shoal
remote swallow
#

yeah you can update to a higher java version

fallow violet
#

18 is highest

spice shoal
#

site?

remote swallow
#

19 exists now

fallow violet
#

switch to 18

fallow violet
#

nice

#

19 sounds much better

remote swallow
undone axleBOT
spice shoal
#

thanks tvb

remote swallow
spice shoal
#

19?

fallow violet
#

i like every version that supports the nice shit like the instanceof with variable declaration

remote swallow
# spice shoal 19?

17 would be better if this is gonna be public, otherwise select the version your server runs

fallow violet
#

yesss

#

and i hate .8 xd

remote swallow
#

why dont they just delete all trace of java 8

#

would solve all our problems

fallow violet
#

+1

remote swallow
#

same for 1.8

fallow violet
#

/delete java-8

#

xd

remote swallow
#

why did md patch it

#

why

fallow violet
#

/delete-all except java-17+

remote swallow
#

yes

ocean hollow
#

Can legacy methods be used? I need to set the speed for the boat (if possible). I use .setMaxSpeed() and it's deprecated and nothing changes.

remote swallow
#

thats probably fine to use, just checked the jds and boats are complex and many of these methods do not work correctly across multiple versions.

fallow violet
#

boats are complex and many of these methods do not work correctly across multiple versions.
Welcome to java

chrome beacon
#

If something is deprecated read why they are in the Javadocs

remote swallow
#

its bad when my first thought of seeing that was thinking they were using paper

spice shoal
#

now it work

#

thanks

fallow violet
#

it was a joke but nice ig

#

wish me luck guys im in game rn pls i need luck gimme luck

humble tulip
#

Oh i gotta question why is java 8 the last java version on oracles website?

chrome beacon
#

It's not

#

The other versions are just a bit harder to find

fallow violet
#

"create business account"

chrome beacon
#

Yeah which is why use use an openjdk distribution like adoptium

ocean hollow
tardy delta
#

i just use any jdk thats available

#

and doesnt have bugs

remote swallow
tranquil dome
#

How can I use hex codes in TextComponents? Both broadcast and hover are strings that already have working hex code chat colors. But once I make a TextComponent and a HoverEvent, they no longer work. (see image for reference)

            val broadcast = getMessage("minecraft.format", message.content, *placeholders)
            val hover = getMessage("minecraft.hover", message.content, *placeholders)

            val component = TextComponent(broadcast)
            val hoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, Text(hover))

            component.hoverEvent = hoverEvent
            plugin.server.spigot().broadcast(component)
chrome beacon
#

Don't use legacy colors

#

Set the color of the component

tranquil dome
#

What do you mean by that?

#

This is essentially how I set the color to the strings

        // Replace hex color codes with the respective chat color.
        val pattern = Pattern.compile("&#[a-fA-F0-9]{6}")
        var matcher = pattern.matcher(message)

        while (matcher.find()) {
            val color = message.substring(matcher.start(), matcher.end())
            message = message.replace(color, "${net.md_5.bungee.api.ChatColor.of(color.substring(1))}")
            matcher = pattern.matcher(message)
        }

        return ChatColor.translateAlternateColorCodes('&', message)
chrome beacon
#

Yeah don't use those

#

You should be coloring the component

grand magnet
#

Can someone explain to me what the problem is here? When I execute /track, only the selected area is executed. I want to have it so that if I then execute /track again, that the effect is gone.

chrome beacon
tranquil dome
chrome beacon
#

I would use MiniMessage with the Adventure library

#

It's easy to setup and works great

#

It comes bundled with Paper but if you want to maintain Spigot support you can shade it

tardy delta
#

lookin terrible

ionic thicket
remote swallow
#

?di

undone axleBOT
ionic thicket
#

ty

chrome beacon
#

?main

worldly ingot
#

Components in general use a lot of code

#

I’d avoid fromLegacyText() unless you absolutely have to use it

remote swallow
#

choco is alive

worldly ingot
#

Yeah I’m just on vacation lol

remote swallow
#

poor dogs

river oracle
#

I don't like text components in many cases

#

just seems like too much code :P

#

Just let me write my magic string shit

remote swallow
#

i would rather use paper components over the spigot/bungee components

river oracle
#

<gradient:000000:FFFFFF>STG this is easier than having 10,000 lines of code for my components</gradient>

chrome beacon
#

Use MiniMessage uwu

tardy delta
#

parsing 💀

remote swallow
#

i stole that code

#

it was very cool

river oracle
#

did you find the bug I had in it lol, cuz I had to patch it out in my lib

remote swallow
#

havent had a use for it yet lol

#

what was the bug

river oracle
#

you couldn't nest <word:[insert color]> statements

remote swallow
#

oh lol

#

i should probably update the stuff i have

#

i also need to implement it into my translate method

river oracle
#

I still need to make my translations API

#

seeing as I know some spanish might as well translate my plugins and setup API for it

kind hatch
#

What's the maven repo for MiniMessage? I can never seem to find just a standalone version of it.

remote swallow
#

its on kyori

kind hatch
#

Idk what that is.

remote swallow
kind hatch
#

Ty

#

Jfc, why is it 600MB?

remote swallow
#

you what

river oracle
#

adventure is so fucking massive though lol

chrome beacon
#

Yeah it's quite large

#

But it's a great lib

river oracle
#

just use spigot libraries feature with it can't you?

kind hatch
#

Does no one care about file size anymore? :3 I already have dependencies that are large enough.

remote swallow
#

guess not

river oracle
#

apparently not

kind hatch
river oracle
#

you absolutely do

#

if you don't you'd be banking on people using paper

#

so if you get even 1 person not using paper it causes a comparability error

#

yes

#

thats like the whole point

kind hatch
#

Spigot doesn't though.

river oracle
#

if you don't shade it it wouldn't work then

eternal oxide
#

So write for Spigot and don;t use Components. It will work on both

river oracle
#

^

#

or just use spigots components which are pretty decent imho

remote swallow
#

or you use paperlib and code different stuff for each server version

river oracle
#

a lot of people here prob just use paper api, but paper discord is meh so people just come here

#

I use paper api a good amount of the time

eternal oxide
#

same

remote swallow
#

i always run paper for server but never use their api

#

always use spigot api

#

oh papers latest fuckery is

   - We have deprecated the PluginLoader and SimplePluginManager class as future plans may cause this API to no longer function. We highly recommend moving away from using these classes. 
   - We have added the new Position (experimental) api, which can represent coordinates that aren't tied to a world. 
river oracle
#

are they going to hard fork finally

remote swallow
#

i thought they wanted to keep compat with spigot api

river oracle
#

I remember Lynx saying something a while back, but tbh I don't remember exactly what he said so I won't even try

kind hatch
river oracle
#

send the docs

#

I'm curious

#

I have "Light" verisons of all the Things Bukkit has

#

Why does having Location and world separate help?

#

If anything it becomes less clear

#

represent coordinates that aren't tied to a world. this seems very easy

remote swallow
#

whats the point of that

kind hatch
#

Isn't that just a Vector at that point?

river oracle
#

you can super easily construct that though

eternal oxide
#

BlockPosition has no world component so already exists

kind hatch
eternal oxide
#

yes

river oracle
#

quick someone PR this to spigot before paper finishes xD

eternal oxide
#

lol, it's not hard. It would be literally an API class to wrap BlockPosition

river oracle
#

you could just overload the Location taking methods and just use the current world then?

kind hatch
#

No, but fr though. Isn't what they are describing as Position just a fancy Vector class? If it only takes x, y, z as params, then what's the difference?

remote swallow
#

vector is math

#

and math is hard

eternal oxide
subtle folio
#

but a vector is just 3 points

#

😅

eternal oxide
#

Yes, but it's name imples that it has no origin

subtle folio
#

i see

eternal oxide
#

so should not represent a position

subtle folio
#

i don’t live in 4D world, sorry

river oracle
#

Guys I got an idea what if


@Getter
@Setter
public class Position {
  
  private int x;
  private int y;
  private int z;

  public Position(final int x, final int y, final int z){
    this.x = x;
    this.y = y;
    this.z = z;
  }


}```
eternal oxide
#

yep

#

or make it a record

river oracle
#

I don't think so

subtle folio
#

lombok best

eternal oxide
#

depends if BlockPosition is

#

it should follow suit

river oracle
tranquil dome
#

I've used the ComponentBuilder to create a BaseComponent[]. Now how can I broadcast this component array as one message?

sullen marlin
#

Yes, sendMessage / broadcast

river oracle
#

iirc all the component things take in The array

kind hatch
tranquil dome
river oracle
#

there seems to be a Mutable block pos too

#

yep I'm looking at src rn

#

I happened to have 1.19.3 maps up

sullen marlin
#

?jd-s

undone axleBOT
sullen marlin
#

Maybe a kotlin issue idk

river oracle
#

seeing as paper is adding the Position api I now wonder if spigot has some equivalent

sullen marlin
#

The method exists

kind hatch
#

It's still experimental for them, so likely not for spigot.

river oracle
#

hmmm I wonder where this is used at in NMS

#

my decompiler can't search entire projects

kind hatch
#

Would you look at that. BlockPos takes Vec3 as a parameter.

river oracle
#

public static Iterable<MutableBlockPos> spiralAround(final BlockPos firstDirection, final int secondDirection, final Direction center, final Direction radius) this seems cool

river oracle
#

nms has an internal Position class would you look at that

#

I wonder if paper is just bringing that forward

kind hatch
#

Wait, what's the difference between Vec3 and Vec3i?

river oracle
#

no clue

#

ones in the core and ones in hte phys package

#

whats a good decompiler where I can search cross class

#

I just use jd-gui rn

kind hatch
#

Looks like MutableBlockPos also exists.

river oracle
#

yep

kind hatch
#

Also, what tf is #withinManhattan() supposed to mean?

river oracle
#

Nukes 💀

tranquil dome
river oracle
#

kotlin 💀

remote swallow
#

kotlin weird

rotund ravine
#

It is actually quite useful.

#
  • can be used for lots of shit
#
    private fun getBlockPosition(block: Block): Array<out Any> {
        return when (ReflectionSupplier.getLegacy()) {
            ReflectionSupplier.LegacyType.OLD_OLD -> arrayOf(block.x, block.y, block.z)
            ReflectionSupplier.LegacyType.OLD -> arrayOf(
                ReflectionSupplier.NMS_BLOCK_POSITION_CONSTRUCTOR.invokeWithArguments(
                    block.x,
                    block.y,
                    block.z
                )
            )
            else -> arrayOf(
                ReflectionSupplier.CRAFT_BLOCK_METHOD_ACCESS.invoke(
                    block,
                    ReflectionSupplier.GET_POSITION_METHOD_INDEX
                )
            )
        }
    }

    fun boneMeal(block: Block, player: Player, config: Triple<Boolean, Boolean, Int>, cooldown: Pair<Boolean, Int>) {
        if (config.first && !player.hasPermission("twerktree.twerk"))
            return
        if (cooldown.first){
            flushMap() // Flush old cooldowns
            if (config.first && !player.hasPermission("twerktree.cooldownexempt") || !config.first) { // Check for permissions
                if (cooldownMap.containsKey(player.uniqueId)) // Check if player has cooldown and return
                    return
                cooldownMap[player.uniqueId] = System.currentTimeMillis() + cooldown.second // Set player cooldown
            }
        }
        ReflectionSupplier
            .NMS_BONE_MEAL_METHOD_ACCESS
            .invoke(
                null,
                ReflectionSupplier.NMS_BONE_MEAL_APPLY_INDEX,
                boneMealItemStack,
                ReflectionSupplier.CRAFT_WORLD_METHOD_ACCESS.invoke(
                    block.world,
                    ReflectionSupplier.CRAFT_WORLD_HANDLE_METHOD_INDEX
                ),
                *getBlockPosition(block)
            )
        applyEffect(block, player, config)
    }
#

Don't hate on my triple use

sullen marlin
#

Uh

sullen marlin
#

There's a .bonemeal method now

#

Or something similar

rotund ravine
sullen marlin
#

Lol

kind hatch
#

Wtf

river oracle
#

get with the program md all the cool kids use 1.5 nowadays

rotund ravine
#

whilst there was indeed bonemeal on that version

#

i didn't want to extend the functionality to that.

sullen marlin
#

Lol

remote swallow
#

OLD_OLD

#

OLD

#

NEW

#

NEWER

#

NEWEST

#

lmfao

rotund ravine
#

I had Old and new at the start

remote swallow
#

do you move

rotund ravine
#

then there came newer versions

#

and someone wanted and old old version

remote swallow
#

do you just move NEWEST each update

sullen marlin
#

Newestest

remote swallow
#

NEWER_NEWEST

rotund ravine
#

I don't actually change it anymore

remote swallow
#

shouldnt you not care after 1.18

rotund ravine
#

I just haven't updated it since 1.17 and haven't been told it is broken yet.

remote swallow
#

lmfao

#

fair

humble tulip
#

bruh yur plugin works with 1.5?

rotund ravine
#

yes

#

Tested it personally ahaha

humble tulip
#

wtf

remote swallow
#

does spigot exist for 1.5

#

or bukkit

rotund ravine
#

craftbukkit does tho

humble tulip
#

what does your plugin do?

tranquil dome
#

The getMessage method returns a translated message using ChatColor.translateAlternateColorCodes(). In the while loop I split my message into multiple components, giving each a hex color of their own. At the end I send the components. For some reason my components will only have the last assigned hex code as color (see images for reference).

      private fun getComponents(path: String, content: String, vararg placeholders: Pair<String, String>): Array<BaseComponent> {
        var message = getMessage(path, content, *placeholders)
        val componentBuilder = ComponentBuilder()

        val pattern = Pattern.compile("&#[a-fA-F0-9]{6}")
        var matcher = pattern.matcher(message)
        var color = ""

        while (matcher.find()) {
            println(message)
            println(color)
            componentBuilder.append(message.substring(0, matcher.start()))
            if (color.isNotEmpty()) componentBuilder.color(ChatColor.of(color))

            color = message.substring(matcher.start() + 1, matcher.end())
            message = message.substring(matcher.end())
            matcher = pattern.matcher(message)
            println(message)
            println(color)
        }

        if (color.isNotEmpty()) componentBuilder.color(ChatColor.of(color))
        componentBuilder.append(message)

        return componentBuilder.create()
    }
rotund ravine
remote swallow
#

sounds fun

humble tulip
#

twerk

proud bridge
#

hi so

humble tulip
#

hi

proud bridge
#

uhh

humble tulip
#

uhh

proud bridge
#

im doing text components

humble tulip
#

ok

proud bridge
#

and im getting an error

humble tulip
#

nice

remote swallow
#

?paste it

undone axleBOT
proud bridge
#

lemme send the code one sec

humble tulip
#

sure

hardy garnet
#

I'm trying to copy the world and send players currently in world 1 to the copy I just made. Unfortunately, bukkit.getWorld() is not working for me whatsoever :\

proud bridge
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

proud bridge
#

says that this line is wrong

TextComponent duelaccept = new TextComponent("§a§l[YES]");

#

or well that line has an error

humble tulip
#

ah

hardy garnet
#

idk why

humble tulip
#

what's the world name?

#

Bukkit.getWorld(name) is

remote swallow
#

Bukkit.getWorld() isnt a method according to the jds

hardy garnet
#

Yes. I need the world to be loaded in order to be able to get it with getWOrld

#

*getWorld

remote swallow
#

yeah

hardy garnet
#

I meant getWorld(string)

remote swallow
#

ah

hardy garnet
#

I know about world creator it pops up all the time in my research. The problem is that it creates a new world

#

I want a copy of a world

#

or a world with stuff already in it

remote swallow
#

if you have the world in your plugin you can use JavaPlugin#saveResource

hardy garnet
#

One quick question. Root folder for plugins in spigot is the folder containing spigot-1.19.2 (or whatever version you are running)

#

so I call Bukkit.getWorld(name) and the world folder should be in the same folder as the spigot jar

#

or am I mistaken and the world folder needs to be in the plugins folder (where the plugin.jar is)

sullen marlin
#

createWorld is more like loadOrCreateWorld

hardy garnet
remote swallow
#

to call bukkit#getWorld the world file would be in the base directory

#

this directory would have the plugins folder, server jar

#

ect

frail gale
#

What’s better? Auto parsing JSON with toJson and fromJson or manually parsing it with JSONObjects?

hardy garnet
remote swallow
#

yeah you would probably need to use the world creator or Bukkit#createWorld to load it

hardy garnet
#

From what I understand from research, you must call bukkit.getWorld(name) in the onEnable method of the plugin

#

Otherwise it will not load

#

but i've tried this for even the default world (just world) and it still doesn't find it

tardy delta
#

getWorld is just a map lookup

#

check stash

#

iirc

hardy garnet
remote swallow
#

?stash

undone axleBOT
tardy delta
#

i just google spigot stash and then the class youre looking for with 'craft' in front of it

#

like world impl is craftworld

hardy garnet
hazy parrot
#

It doesn't have to be?

remote swallow
#

it does that itself

hazy parrot
#

It automatically converts it to lower case

remote swallow
#

^^

hardy garnet
#

It converts the input to the function to lower case, but if the folder has upper case in it that might cause an issue

#

thats what im checking real quick

remote swallow
#

i would guess it converts that to lowercase too

hardy garnet
#

probably

#

im still trying it though

#

Yea no nothing lmao

sullen marlin
#

no

#

if you want to load a world you need to call createWorld

#

as I said before the method is really a loadOrCreateIfNotExists method

#

getWorld only returns already loaded worlds

hardy garnet
# sullen marlin getWorld only returns already loaded worlds

I understand that I saw that in the docs. I thought that calling getWorld(name) in the onEnable it would load the world, but according to you this is not the case. I am using createWorld(worldCreator) now to load the world. Hopefully that works

#

If that really is the problem, then its even more unintuitive than scoreboards are

tranquil dome
#

Is it possible to support hex codes inside a hoverevent?

#

for HoverEvent.Action.SHOW_TEXT

sullen marlin
#

yes just use another component as the value

tranquil dome
#

oh, it's deprecated tho. Is it fine to use that method?

sullen marlin
#

?

#

doesnt look deprecated to me

tranquil dome
#

Also getting this error from it

sullen marlin
#

youre adding the component as the hover

#

you need to make a new component

#

new HoverEvent(..., new Text(new ComponentBuilder()....hex component)))

remote swallow
#

md how could you

#

using light mode

tranquil dome
#

works now

#

thank you

river oracle
#

hot take light mode isn't that bad

remote swallow
#

hot take you need to leave

rotund ravine
sterile token
#

I made my own cache serializer/deserializer for working with Redis cache simplier, because redis only allows strings or bytes data type

buoyant viper
#

?jd

grand coral
#

do anyone knows how I can make players glow in colors without any scoreboard teams?

eternal oxide
#

why do you not want to use teams?

grand coral
#

and that two has problems with it

remote swallow
#

what?

spice shoal
#

Read my code

remote swallow
#

what about it

spice shoal
#

First variable

#

Don't work

remote swallow
#

what doesnt work

hazy parrot
#

i just think its really bad joke

spice shoal
hazy parrot
#

is it really funny to you ?

spice shoal
#

yeah

hazy parrot
#

im sorry

spice shoal
#

ik , im stupid

hardy garnet
#

Hmm. So I am copying the world to a different "world" and moving all players over to it when I issue a command

#

and the first time works perfectly fine. Fantastic. When I go back to the overworld and issue the command again, the chunks end up corrupted and the copy is all screwed up

quaint mantle
sullen marlin
#

a good one

quaint mantle
sullen marlin
#

netbeans

quaint mantle
#

bruh netbeans

#

i haven't heard anyone talk about that in ages

#

but why is it in light mode???? light mode just seems painful

remote swallow
#

it looks like notepad++ with extra features tbh

sullen marlin
#

cause I dont live in a basement

quaint mantle
remote swallow
quaint mantle
remote swallow
#

imagine

quaint mantle
#

honestly i wouldn't even deny that

#

okay im a go take a hike now at 7:53 PM cya lmao

remote swallow
#

idk why he would think were stupid when he knows we are

hardy garnet
#

You guys have any idea why it works only once per server restart? lol

sullen marlin
#

are you trying to copy a loaded world

remote swallow
#

probably something to do with saving

eternal oxide
#

with no code, no idea

sullen marlin
#

are you using different world names each time

hardy garnet
rotund ravine
#

Where are you cpying to? Another loaded world?

hardy garnet
#

Now that I think about it, maybe I should do world.save() before I do the copy

sullen marlin
#

you cant safely copy a loaded world

hardy garnet
#

but it works the first time lmao

sullen marlin
#

idk share code

hardy garnet
#

One moment

#

This is the entire class

humble tulip
#

creating a discord bot and i want to create a logger so that anything logged is saved to a file similar to how mc works

#

does anyone have a link to an easy way to do this?

hardy garnet
#

I am thinking the reason I am having issues is because I am not unloading the second world (the one im copying to)

remote swallow
hardy garnet
#

The first time it is not loaded, which is why it works. The second time it is (probably) loaded which is what is causing the issues

humble tulip
#

my first thought was using the System.out and modifying it to a custom one that writes toa file

humble tulip
#

not a discord bot in spigot

#

just a discord bot in java

remote swallow
#

discordsrv has console logging options

#

using jda

#

so you could check how that listens to console

humble tulip
#

wait nvm

#

i found it

#

you can just use System.setOut

hazy parrot
#

It has file appender

echo eagle
#

so i'm making a plugin for me and friends that will let us write plugins in Lua. many reasons but the biggest one is that i'm the only programmer in my friend group and lua is easier to learn then java.
i'd like to make this plugin as automatic as possible via reflection methods and such, even if it means having to use a java preprocessor (which seems to be on the table)

i've found a way to make a class that binds every listener to one function that executes the relevant lua function, but there doesn't seem to be any way to pass arguments to the handlers through this method, which kind of makes this pointless. is there any way at all to automatically register listeners and have their arguments get passed to the function? or do i have to use a java preprocessor/codegen

humble tulip
#

what arguments do you want passed to the function?

#

i'm confused?

echo eagle
#

the arguments that spigot passes to the event handlers

humble tulip
#

like? player, block, item etc?

echo eagle
#

yers

#

PlayerMoveEvent(Player player, Location from, Location to)

#

whats enclosed in the parenthesis

#

spigot sends those to event handlers

#

how can i actually capture what it sends

humble tulip
#

spigot sends the event to the eventhandlers

#

not the player, from and to

echo eagle
#

...oh.

humble tulip
#

yep

#

can you show how you'd want the lua code to look

#

for playermoveevent for example

echo eagle
#
function OnPlayerInteract(action, block_clicked, block_face, item)
    io.write(action)
end
#

of course io.write(action) is dummy code but you get the idea

humble tulip
#

sometimes the stuff in an event is mutable

#

and sometimes it's immutable

echo eagle
#

oh wait

humble tulip
#

like this

#

you can set if the event drops items

echo eagle
#

i just read code i wrote earlier and realized that this isn't how spigot does it either

#

it just passes the event as an argument

humble tulip
#

yep

echo eagle
#

two hours of research might have been saved if i had remembered this

humble tulip
#

😂

echo eagle
#

and opening up a stackoverflow post on why i can't get this java preprocessor working with intellij

echo eagle
#

i don't really see how this would help?

#

and also if i can keep this free of other required plugin dependencies i will

humble tulip
#

is lua oo?

echo eagle
#

it has objects

#

i think they're abstractions for structs though

humble tulip
#

does it work similar to java?

unique urchin
#

How i can give to new people a role named member?

echo eagle
#

no not at all

sullen marlin
#

What's wrong with just passing the event

echo eagle
#

i have not worked with lua before making this plugin tbh

humble tulip
#

just tell your frineds learn java 😂

echo eagle
#

i refuse

#

a. lua is easier to learn
b. i will refrain from ranting in a server full of java users about why i hate java so much

unique urchin
#

How i can give to new people a role named member?

remote swallow
#

luckperms?

unique urchin
#

but how

#

to new people

remote swallow
#

do you use luckperms

unique urchin
#

yes

remote swallow
#

you could do that

#

or you just make member a parent role to default

#

or just use default as your default rank

#

and give it the member prefix and that

unique urchin
#

ok

#

thax

sullen marlin
#

What's wrong with just passing the event

unique urchin
#

thx

echo eagle
remote swallow
#

?stash seems like ur friend lol

undone axleBOT
echo eagle
#

and spent way too much time focusing on what the doc showed for the instantiation function