#help-development

1 messages · Page 459 of 1

acoustic gorge
#

do what this guy does

river oracle
#

Are the names of the beacon sections unchangeable e.g. Primary Effect Secondary Effect they are called iirc

rough ibex
#

for a plugin, yes

#

language file in a rspack, no

river oracle
#

alr just making sure

#

I'm going to get addicted to doing spigot PRs

#

I just need feedback on this one to make sure there are no stupid ass mistakes like formatting wise before I go crazy

quaint mantle
#

guys

#

what does Cannot resolve symbol mean?

acoustic gorge
#

Did you google it?

river oracle
#

?learnjava!

undone axleBOT
quaint mantle
#

no but can u tell me???

acoustic gorge
#

Maybe ask google first

quaint mantle
#

....

acoustic gorge
#

I'm being 100% serious

river oracle
#

?google

undone axleBOT
quaint mantle
#

ok googled

#

but cant find an answer

acoustic gorge
#

I just typed in your question and it pops up right there highlighted

acoustic gorge
#

yes

quaint mantle
#

how to resolve it no

acoustic gorge
#

type in cannot resolve symbol into google

#

and then cannot resolve symbol how to fix

quaint mantle
#

i cant find an answer

lost matrix
#

Show your code

quaint mantle
#

package me.adamel.gam;

import org.bukkit.event.Listener;

public class BlockBreakListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
Material material = block.getType();

    for (player : Bukkit.getServer().getOnlinePlayers()); {
        if (player.hasPermission("admin")) {
            player.sendMessage("A block was broken by " + event.getPlayer().getName());
        }
    }
}

}
}

lost matrix
#
Your code goes here
#

Or

#

?paste

undone axleBOT
remote swallow
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
lost matrix
quaint mantle
#

import org.bukkit.event.Listener;

public class BlockBreakListener implements Listener {
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Block block = event.getBlock();
        Material material = block.getType();

        for (player : Bukkit.getServer().getOnlinePlayers()); {
            if (player.hasPermission("admin")) {
                player.sendMessage("A block was broken by " + event.getPlayer().getName());
            }
        }
    }
}
}```
#

ooops

#

forgot to put java

acoustic gorge
#

Oh lol you did actually grab alex's code

quaint mantle
#

import org.bukkit.event.Listener;

public class BlockBreakListener implements Listener {
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Block block = event.getBlock();
        Material material = block.getType();

        for (player : Bukkit.getServer().getOnlinePlayers()); {
            if (player.hasPermission("admin")) {
                player.sendMessage("A block was broken by " + event.getPlayer().getName());
            }
        }
    }
}
}
#

?

lost matrix
#

Here is your problem. Google how to properly do a foreach loop:

quaint mantle
lost matrix
quaint mantle
#

ok

#

i dont get it

lost matrix
#

What do you not get?

quaint mantle
#

i see that i have to put (Player player, instead of just (player

lost matrix
#

Alright

#

Whats not to get there?

quaint mantle
#

i get Cannot resolve method

#

and cannot resolve symbol

remote swallow
#

it might help if you say what those are occuring on

quaint mantle
#

on a lot of things

lost matrix
#

Well then you are calling a method that doesnt exist.
Learn the very very basics of java before you jump into spigot pls.

quaint mantle
#

on Player

#

on EventHandler

remote swallow
#

hover over anything red and press import class

lost matrix
quaint mantle
remote swallow
#

its copied and pasted code so imports wont exist auto

quaint mantle
#

bukkit spigot

remote swallow
#

you need to import the clases

quaint mantle
remote swallow
#

hover over the red words

#

find where it says "Import Class"

quaint mantle
#

yes

remote swallow
#

and press it

quaint mantle
#

ok solved

#

but for methods?

remote swallow
#

they should appear when you import the classes

prime reef
#

Anyone had success using native code in a spigot library? Been thinking since I have some stuff I'm worried about performance for

prime reef
#

FWIW, I'm primarily a C++ dev nowadays and therefore not a huge fan of Java anymore, so if I could offload performance-critical code to a language I actually like...

lost matrix
# prime reef Anyone had success using native code in a spigot library? Been thinking since I ...

Imagine liking to write C++ in 2023
Java has the JIT compiler which optimizes your code on runtime.
Partially to the point where it matches the performance of low
level languages like C++. The overhead of calling native methods
does not justify using a machine code compiled language like C++.
The C compiler also optimizes for exactly your system. There is a good
chance that your code will run much slower on other systems and
for a different OS it wont even run in the first place. I can almost guarantee
you that you will lose performance by using C++.

acoustic gorge
#

does getchunksAt automatically unload when no players are there to load them?

lost matrix
acoustic gorge
#

Ok sweet I'm trying to have some chunks load so that players don't fall through the ground whenever they switch servers

lost matrix
acoustic gorge
#

am I not able to do that through plugin messaging

#

like say to the proxy hey load these chunks and then send the player

lost matrix
#

Because the server does exactly that. So your approach would be:

  • Communicate to the server that a player wants to connect
  • Find out where the location would be
  • Load the chunk
  • Send feedback from the chunk loading server
  • Send the player to the new server after the feedback
quaint mantle
#

guys

#

a question

acoustic gorge
#

Yes essentially that

#

Why do you think that'd be more difficult?

quaint mantle
#

should i just remove A block and place it with block.getType?

#

right?

lost matrix
quaint mantle
#

then created a project with spigot

lost matrix
#

Alright that should do it.
You can tell a player which block he broke by getting the Material of the broken Block
and appending it to a String.

String message = "You broke " + material;

Then simply call Player#sendMessage(String)

remote swallow
#

waiting for the "why does it error"

quaint mantle
#

lemme try

lost matrix
#

Maybe we should just spam basics for questions like this...

river oracle
#

spamming basics does nothing they won't listen or read

quaint mantle
remote swallow
#

you wont listen

slow arrow
#

I'm confused on softdepends
Is it just like, so long as I avoid using classes from a non-existent softdepend, the plugin is allowed to run?

slow arrow
#

I hate that

#

but at the same time it's so convenient

lost matrix
#

A bit tricky at times

slow arrow
#

:headache:

#

that should be an emoji

quaint mantle
#

guys

#

i tested it but i dont get any messages

#

from players

lost matrix
#

You didnt register the listener probably

quaint mantle
#

where do i register it?

lost matrix
#

google

quaint mantle
#

google is my friend

lost matrix
#

Scroll down here. All you need to know about commands, events etc

quaint mantle
slow arrow
#

How do I show text when a user is entering an argument without providing tab completions?

lost matrix
quaint mantle
#

as i showed earlier i put the string for the registration of BlockBreakListener, is it the same as the registration of Listener?

slow arrow
lost matrix
slow arrow
#

but I don't want the text to be tab completable

#

I've seen it done in plugins before

#

It's like, darker gray text
like <name>
but it doesn't actually tab complete anything

lost matrix
#

You need brigadier or another command API exposing this feature.
I dont think Spigot has anything beyond simple tab completion.

slow arrow
#

oh aight

#

not worth it then

#

lmao

#

thx

lost matrix
#

But double check. I havent touched spigots command features in ages.

lost matrix
quaint mantle
#

''' public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(new BlockBreakListener(), this);

}'''
#

oops

#

ive put this

#

like before i even tested it

#

can anyone pls test the plugin and tell me the problem?

lost matrix
#

How about you test the plugin...

#

wtf

quaint mantle
#

i tested it lol

lost matrix
#

Any exceptions in your console?

#

Look at it from start to finish

quaint mantle
#

no it says enabled

lost matrix
#

Show your current code then

quaint mantle
#

which, .java or plugin.yml?

#

lemme give u both

eternal oxide
#

?paste start with your BlockBreakListener

undone axleBOT
quaint mantle
#

done

eternal oxide
#

copy the link here

#

after you clicked save

quaint mantle
eternal oxide
#

you have issues with your encapsulation

quaint mantle
#

what is an encapsulation?

#

is it a bad issue?

tender shard
#

yes

quaint mantle
eternal oxide
river oracle
#

how do you publish a multi-module gradle project into one jar

remote swallow
#

look at epic spigot lib

river oracle
#

I did

quaint mantle
river oracle
#

I'm not sure what I'm doing wrong

remote swallow
eternal oxide
river oracle
#

because nothing in my project is showing up when implementing it

quaint mantle
eternal oxide
#

I left the block stuff in as I guess you are going to do something with it later

river oracle
#

?paste

undone axleBOT
river oracle
remote swallow
#

use publish instead

quaint mantle
#

but u removed player

remote swallow
#

but that looks correct yeah

eternal oxide
#

yes, you never used it

quaint mantle
#

wanna also see my other .java?

#

?paste

undone axleBOT
quaint mantle
eternal oxide
#

looks fine

quaint mantle
#

ok

#

now my plugin is in the plugins folder

#

will it update if i save all?

remote swallow
#

you need to restart

quaint mantle
#

or do i need to remove it and place it again

eternal oxide
#

stop/start yoru server

quaint mantle
#

so it will update alone?

remote swallow
#

if you set the build path sure

quaint mantle
#

if i click on save all

quaint mantle
remote swallow
#

if not no you have to manually move the new jar onto the server

eternal oxide
#

no save all doesn;t auto build, unless configured to

quaint mantle
#

bc i dont have an out folder

eternal oxide
#

the way you have up until now

quaint mantle
eternal oxide
#

are you the person from yesterday using export?

river oracle
eternal oxide
#

then do an export

quaint mantle
#

ok

#

lemme see....

remote swallow
eternal oxide
#

stop server, upload jar to yoru plugin folder and startup

river oracle
#

wonder what is wrong

eternal oxide
#

oh they moved to IJ 😦

quaint mantle
#

u can use he

#

as pronouns

remote swallow
eternal oxide
#

Don;t worry over time I'll call you every pronoun there is 😉

quaint mantle
#

guys, export files or something to HTML, project to eclipse or project to zip files?

remote swallow
#

run mvn package

quaint mantle
remote swallow
#

on the right of your screen do you see a maven tab

quaint mantle
#

yes

remote swallow
#

dopen it

eternal oxide
#

if you are now on InteliJ, right of screen is a maven window

quaint mantle
#

yes

remote swallow
#

then open the drop down, then open life cycles

quaint mantle
#

after that?

#

deploy?

remote swallow
#

package

eternal oxide
#

package

quaint mantle
#

it opened the cmd

eternal oxide
#

now look in your target folder

quaint mantle
#

ok then?

#

where is it?

remote swallow
#

/target/

eternal oxide
#

wherever your project is saved

quaint mantle
#

i dont know where he saves the projects

eternal oxide
#

it should show in the project structure on the left of your screen

remote swallow
#

you made the project

quaint mantle
#

yes found it

#

ok after i clicked on package it was saved right?

eternal oxide
#

yes

remote swallow
#

correct, now you copy the jar YourProject.jar into the plugins folder

quaint mantle
#

but guys

#

its a folder

#

not a .jar document

eternal oxide
#

look in your target folder, not your src

remote swallow
#

there should be around 4 folders and 2 jars in the target folder

quaint mantle
#

ah ok

#

thx

#

1 jar

remote swallow
#

whats it called

quaint mantle
#

GAM-1.0

remote swallow
#

use it

quaint mantle
#

Ok lemme start it...

#

uuuh

#

it says loading Gam v1.0

#

without any errors

remote swallow
#

so test it

distant wave
#

is there an event where if player obtains item through creative menu or /give do something?

lost matrix
distant wave
#

okay

chrome beacon
#

Do be aware that every item move in the creative inventory will trigger that event

#

Since the client deletes the item and then spawns it back in

tender shard
#

what a jerk client

lost matrix
#

boycott the client. Server-side minecraft only from now on

quaint mantle
#

but

#

i would like to add that who has the "admin" permission, and breaks a block, they dont get the message

lost matrix
#

Then add that

quaint mantle
#

i wrote a code but idk if its correct

#

and i tested it but didnt work

#

can someone check if its correct?

lost matrix
#

?code

#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

eternal oxide
#

if (event.getPlayer().hasPermission("admin") return;

quaint mantle
eternal oxide
#

at the very top

quaint mantle
#

to be read with a sarcastic voice

quaint mantle
#

but only that?

humble tulip
#

?tryandsee

undone axleBOT
lost matrix
#

?basics

undone axleBOT
humble tulip
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

lost matrix
#

?issamreal

undone axleBOT
#

Yes Sam is real. I was not programmed to say this by Sam.

weak kayak
#

i wonder if sam is real...

remote swallow
#

i wonder if choco is real

#

?ischocoreal

undone axleBOT
#

No, Choco is not real. I was not programmed to say this by Sam.

weak kayak
#

good question

remote swallow
#

guess not

weak kayak
#

oh dang

quaint mantle
eternal oxide
#

top of the event

#

in the listener

lost matrix
quaint mantle
quaint mantle
eternal oxide
#

in the event method body

chrome beacon
weak kayak
chrome beacon
#

They require spoonfeeding of code

quaint mantle
#

after implements listener

lost matrix
quaint mantle
#

so thats why he uses They

lost matrix
#

wtf... you guys are joking, right?

quaint mantle
#

no

weak kayak
eternal oxide
#

Nope, we use whatever seems correct. don;t give two shits about pronouns

weak kayak
quaint mantle
weak kayak
#
@EventHandler
public void onEvent(SomeEvent event) {
    // <-- here```
weak kayak
#

no prob

lost matrix
weak kayak
#

idk if it's really spoonfeeding i just have no clue how to describe it otherwise so 🤷

quaint mantle
#

it suggests me to do so

lost matrix
# weak kayak ?

Just looked it up in the dictionary. They is only used to refer to a group of people.

lost matrix
undone axleBOT
quaint mantle
weak kayak
# lost matrix Just looked it up in the dictionary. They is only used to refer to a group of pe...

if you were to e.g., talk about someone who left their umbrella somewhere but their coat was obscuring their face, what pronoun would you use seeing as you can't identify their gender?
https://youtu.be/gq5xLI77TGA

A sequel to: https://www.youtube.com/watch?v=iQNdkdqoIdw

Thanks to my patrons!!
Patreon: https://www.patreon.com/user?u=73482298
Special thanks to Calvin for pestering me until I made this video.

Sources:
Baron, D. (1981-2015). The Words that Failed: A chronology of early nonbinary pronouns.
Baron, D. (1986). Grammar and Gender. New Haven.
Bar...

▶ Play video
weak kayak
#

hm, i see

eternal oxide
#

You are German and german is a very gendered language. You shoudl be good at this

weak kayak
#

most people would use they

quaint mantle
#

i use always he

weak kayak
#

👀

eternal oxide
#

There are no girls on the Internet so I use he/they/them when talking to people

lost matrix
#

Anyways. Your code makes very little sense.
You are iterating over all players on the server but you always check the
permission of the player who broke the block.

lost matrix
#

And multiple times for that matter

#

For no reason

weak kayak
lost matrix
#

And you return in the middle, which makes half of your method useless

eternal oxide
quaint mantle
eternal oxide
#

Go back to the code I gave you, it works and it only needs you to add the single line I just showed

lost matrix
# quaint mantle mmmh

You are being unpolite by not learning the basics of the language
but asking us to practically write the code for you.

eternal oxide
quaint mantle
#

ah ok

lost matrix
eternal oxide
#

add the line I gave you a minute ago

lost matrix
eternal oxide
#

yep, I'm hoping he learns a little

#

At least he seems able to handle jibs and jabs.

tardy delta
#

how do i tell it to use the updated version of my root module?

#

its all in the same project

#

ofc its not on maven

lost matrix
#

You need to publish them to your local maven repo

eternal oxide
#

It would be an idea for him to spend an hour learning the basics

quaint mantle
#

btw going to test it

tardy delta
weak kayak
lost matrix
# quaint mantle ok and?

And this will lead to you not learning anything.
If you would sit down and learn the basics of java then
you would be doing all of this on your own by now.
It only takes maybe an hour to learn control flow
and loops.

quaint mantle
lost matrix
remote swallow
#

install should work

tardy delta
#

i never worked with a publish task lol

#

install seems to work

eternal oxide
#

package = just build it.
install = clutter up your local repo,.

lost matrix
#

Why are you using gradle for a multi module setup?
I feel like thats a weakness of gradle.

tardy delta
#

thats maven

lost matrix
#

Just realised

tardy delta
#

kekw

weak kayak
#

lel

lost matrix
#

Werent yout talking about gradle earlier?

remote swallow
#

that was y2k

tardy delta
#

uhh

#

ive been using gradle

lost matrix
#

In that case you should just run the parent project task

lost matrix
tardy delta
#

ye i realised that

#

another college plugin lol

lost matrix
tardy delta
#

so when you only want that module?

quaint mantle
#

well it works

lost matrix
#

Yes if the other modules didnt change then you dont need to build them again

tardy delta
#

alr

torn oyster
#

how come ClientboundSetEntityDataPacket(int, SynchedEntityData, boolean) is not a valid constructor in 1.19.4

#

migrating my code from 1.19.1

lost matrix
torn oyster
#

sendPacket(sp, new ClientboundSetEntityDataPacket(armorStand.getId(), armorStand.getEntityData(), true));

#

that's what i have

#

how would i change it

torn oyster
#

i have not touched java in a few months

lost matrix
tardy delta
#

run

lost matrix
tardy delta
#

smh i always forget one thing when pushing a commit

lost matrix
#

Writing a comment thats no "Added some stuff"

#

For me its "Batch update" for the last 17 commits

torn oyster
#

i forgot what it did

tardy delta
#

its kinda better for me

torn oyster
#

also

#

new ServerPlayer(server, level, profile, null); doesn't work

#

no constructor

quaint mantle
#

I often forget to check the commiter email so sometimes it is the BT email.

#

guys

#

?paste

undone axleBOT
quaint mantle
hazy stirrup
#

Hello I am having some problems. I want to make a command where a person have to enter their coords and the blocks in the coords will become unbreakable meaning after breaking it. it will replace itself. here is the commands class:

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("setup")) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("This command can only be run by a player.");
                return true;
            }

            Player player = (Player) sender;

            if (args.length != 6) {
                player.sendMessage("Usage: /setup <x1> <y1> <z1> <x2> <y2> <z2>");
                return true;
            }

            int x1 = Integer.parseInt(args[0]);
            int y1 = Integer.parseInt(args[1]);
            int z1 = Integer.parseInt(args[2]);
            int x2 = Integer.parseInt(args[3]);
            int y2 = Integer.parseInt(args[4]);
            int z2 = Integer.parseInt(args[5]);

            for (int x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) {
                for (int y = Math.min(y1, y2); y <= Math.max(y1, y2); y++) {
                    for (int z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) {
                        Block block = player.getWorld().getBlockAt(x, y, z);
                        BlockData blockData = block.getBlockData();
                        BlockState blockState = block.getState();
                        player.getWorld().getBlockAt(x, y, z).setType(Material.AIR);
                        blockState.setBlockData(blockData);
                        blockState.update(true);
                    }
                }
            }

            player.sendMessage("Setup completed!");

            return true;
        }

        return false;
    }
}``` After fullfilinTheRequirmentItshowSsetupCompleteButItDontWork
torn oyster
#

doesn't work now either

quaint mantle
#

i get a cannot resolve symbol 'block'

#

and i did alt+enter

torn oyster
#

i believe i use that

lost matrix
remote swallow
remote swallow
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

quaint mantle
#

but it doesnt import it to bukkit

#

but instead to html

remote swallow
#

import the bukkit one then

#

you get a drop down if theirs multiple

quaint mantle
quaint mantle
#

only html

remote swallow
#

so you have a broken dependency

quaint mantle
torn oyster
#

i get that whenever i join

lost matrix
quaint mantle
#

and how do i resolve the problem?

remote swallow
#

because bukkit has the Block class

chrome beacon
#

Wrong reply ;/

quaint mantle
#

lol

hazy stirrup
#

if broken

#

how can i do that

lost matrix
eternal oxide
quaint mantle
remote swallow
#

it wont work and you will get an npe

quaint mantle
#

which order do u suggest me?

remote swallow
#

first learn java then you can answer that yourself

quaint mantle
#

oh it works now

eternal oxide
#

in yoru paste you try to get teh BlockState from block before you created the block variable

quaint mantle
#

thx guys <333

hazy stirrup
#

pls someone help me

lost matrix
# hazy stirrup how can i do that

You need a manager that keeps track of all marked blocks.
Then you need to listen for events like BlockBreakEvent and
check if a marked block was broken

lost matrix
# hazy stirrup pls someone help me

All the code you have there runs in an instant. Just a millisecond.
There is nothing that actually tracks broken blocks or respawns anything.

misty ingot
#

rate my strat (I have never tried this before so lemme know if its trash or good)

I have created a seperate package named "Helpers" and in that I have diff classes for diff kinds of functions which are mainly just meant to do repetitive tasks
whenever I have to say, just send a custom error message to the player and know what the name of the error is, I have a function to which I supply the name and it takes care of it instead of me writing the code over and over again
I know that this is supposed to be good cuz it follows D.R.Y. but im not sure if there is an even better way to do it

ivory sleet
#

utility and helper functions?

#

its mostly good

#

but its good to know the difference between helper functions and utility ones

misty ingot
#

so like would my error function thing come under util or helper?

#

cuz i think util is like opening the same type of inv or sumt over and over again no? (example)

rotund ravine
rotund ravine
# misty ingot so like would my error function thing come under util or helper?

It depends on how you want to organize your code. You can use either “util” or “helper” depending on your preference. Both are commonly used to store utility functions that are used throughout your codebase. You can also create a separate package for error handling if you have a lot of error handling functions.

rotund ravine
misty ingot
#

that was from ChatGPT wasnt it

rotund ravine
#

Bing haha. But i curated it obv.

misty ingot
#

should I name the currency in my plugin "boops" :p? lol

rotund ravine
# misty ingot should I name the currency in my plugin "boops" :p? lol

Sure! Here are 20 outrageous names for an online currency not connected to any real money, but used in-game:
Zappies
BlastBucks
ZapCoins
BoomBucks
ThunderTokens
LightningLoot
ShockShards
BoltBucks
ThunderTreasure
ElectricEarnings
SparkSavings
ShockingShillings
ThunderousTollars
BoltBling
ElectricEmpire
ShockingSovereigns
ThunderousTreasury
BoltBounty
ElectricEconomy
ShockingSavings
I hope you find one that you like!
Received message. Sure! Here are 20 outrageous names for an online currency not connected to any real money, but used in-game: 1. Zappies 2. BlastBucks 3. ZapCoins 4. BoomBucks 5. ThunderTokens 6. LightningLoot 7. ShockShards 8. BoltBucks 9. ThunderTreasure 10. ElectricEarnings 11. SparkSavings 12. ShockingShillings 13. ThunderousTollars 14. BoltBling 15. ElectricEmpire 16. ShockingSovereigns 17. ThunderousTreasury 18. BoltBounty 19. ElectricEconomy 20. ShockingSavings I hope you find one that you like!

#

Shocking Shillings kinda fire

grizzled oasis
#

is possible to save information relative to the player not inside a DB or a yaml file, but like in .dat file or in file that you normaly you cannot edit or see

tardy delta
#

uhh

#

pdc?

pseudo hazel
#

why

grizzled oasis
# pseudo hazel why

I'm saving from advanced slime world, the world string, and its unique for every player instead of saving it inside a yaml that will take many GB saving in sections like .dat file or any other to make lighter everything else and not accumulate string over strings

pseudo hazel
#

okay, then yeah, you can use pdc

grizzled oasis
# tardy delta pdc?

pdc is for newer version like 1.16 and im making a plugin for 1.12.2 for a client

tardy delta
#

💀

#

why even 1.12

grizzled oasis
misty ingot
#

real chads only support 1.20 snapshots

pseudo hazel
#

then just write to a file

icy beacon
#

if you are working with a legacy version you should be paid twice as much

grizzled oasis
icy beacon
#

how easy

grizzled oasis
# icy beacon how easy

just loading a world with slime world and then tp the player inside an save it when the player quit

tardy delta
#

and its not empty

tardy delta
#

original jar is empty ah

#

i did some weird shading

pseudo hazel
grizzled oasis
pseudo hazel
#

in what way does it get messy

grizzled oasis
tardy delta
#

what even is that

pseudo hazel
#

sounds like inefficient world names

#

can a player only have 1 world?

rotund ravine
#

Looks fine to me

misty ingot
#

that does look pretty cool

#

but my eyes would prefer the "normal click left/right arrow buttons and the thing slides away completely" more

#

but yeah that does look good tho

#
    public void showPlayerBank(Player player, UUID targetUUID) {
        Inventory inv;
        OfflinePlayer target;
        if (player.getUniqueId() != targetUUID) {
            target = Bukkit.getOfflinePlayer(targetUUID);
            inv = plugin.getServer().createInventory(null, 27, "&a{name}'s Bank".replace("&", "§").replace("{name}", target.getName()));
        } else {
            target = player;
            inv = plugin.getServer().createInventory(null, 27, "&aYour bank".replace("&", "§"));
        }
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            try {
                PreparedStatement statement = plugin.getConnection().prepareStatement("SELECT purse, bankStored, bankLimit FROM pdata WHERE uuid = ?");
                statement.setString(1, String.valueOf(targetUUID));
                ResultSet results = statement.executeQuery();

                Integer purse = results.getInt("purse");
                Integer bankStored = results.getInt("bankStored");
                Integer bankLimit = results.getInt("bankLimit");

                for (int i = 0; i < 27; i++) {
                    ItemStack item = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
                    ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName("");
                    item.setItemMeta(meta);
                    inv.setItem(i, item);
                }

                // Purse item
                ItemStack balanceItem = new ItemStack(Material.PAPER);
                ItemMeta balanceMeta = balanceItem.getItemMeta();
                balanceMeta.setDisplayName(("&6Purse: &a{purseMoney}")
                        .replace("&", "§")
                        .replace("{purseMoney}", String.valueOf(purse))
                );
                balanceItem.setItemMeta(balanceMeta);
                inv.setItem(11, balanceItem);

                // Player head item
                ItemStack skullItem = new ItemStack(Material.PLAYER_HEAD);
                SkullMeta skullMeta = (SkullMeta) skullItem.getItemMeta();
                skullMeta.setOwningPlayer(target);
                skullMeta.setDisplayName("&f{name}".replace("&", "§"));
                ArrayList<String> lore = new ArrayList<>();
                lore.add("Total Money: {amt}".replace("{amt}", String.valueOf(purse+bankStored)));
                skullMeta.setLore(lore);
                skullItem.setItemMeta(skullMeta);
                inv.setItem(4, skullItem);

                // Bank item
                ItemStack bankItem = new ItemStack(Material.GOLD_BLOCK);
                ItemMeta bankMeta = bankItem.getItemMeta();
                bankMeta.setDisplayName(("&6Bank: &a{bankMoney}&7/&a{bankLimit}")
                        .replace("&", "§")
                        .replace("{bankMoney}", String.valueOf(bankStored))
                        .replace("{bankLimit}", String.valueOf(bankLimit))
                );
                bankItem.setItemMeta(bankMeta);
                inv.setItem(15, bankItem);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        Bukkit.getScheduler().runTask(plugin, () -> player.openInventory(inv));
    }

how does it look

#

(opens an inventory with items that show the player's purse balance, bank balance and their head with total balance)

#

i have also just noticed that my R key is starting to malfunction, time to claim that warranty ig

lost matrix
pseudo hazel
#

how can you split it up in a way where this method doesnt have these goals

tardy delta
#

please place that db code in another method

#

ah thats already said

pseudo hazel
#

I mean I agree with most of what you said, but in the end this method will still do all the things it does now, directly or indirectly

lost matrix
#

For example:

public BankData requestBankData(UUID playerId) {
  //...
}

public ItemStack createBankItem() {
  //...
}

public ItemStack createBalanceItem(BankData bankData) {
  //...
}
tardy delta
#

that itemstack is always the same too

pseudo hazel
#

well yes but then the showBank method will be a chain of these sub methods right?

lost matrix
pseudo hazel
#

yeah so it will still have these 20 goals, but just divided into multiple methods

#

i mean thats fine but I just wanted to clarify

tardy delta
#

itembuilder 🙏

trim surge
#

Anyone here know if its possible to have a Generic "Event" in an abstract class so when extending i can declare the event? (Using it for a Quest system that will have different types of events)

desert spade
trim surge
#

Not exactly - Basically i have a class like so

#
public abstract class BaseQuestListener<T extends Event> implements Listener {

    private final Quest quest;

    public BaseQuestListener(Quest quest) {
        this.quest = quest;
    }

    @EventHandler
    public void onEvent(T event) {
        this.runQuestEvent(event);
    }

    public abstract void runQuestEvent(Event event);
}```
#

however i get the error about static handlers

tardy delta
#

you cannot listen for the Event base class

trim surge
#

what should i use instead?

tardy delta
#

cant you have a QuestEvent class or something that all your quest events extend?

#

then have a listener for that

trim surge
#

so like a custom event?

tardy delta
#

ig thats what you're trying to achieve

trim surge
#

alright yeah ill give it a go

lost matrix
misty ingot
#

ok so im trying to make another method for grabbing the actual bank data and I am confused as to why it says "unexpected return value" when i am returning a ResultSet when i am supposed to return a ResultSet

lost matrix
misty ingot
#

should I remove the scheduler then?

#

cuz its an async issue yeah

lost matrix
#

If you remove the scheduler then the one calling this method has to make sure that its not called from the main thread.

tardy delta
#

probably want a completablefuture

#

no

summer scroll
#

What is the earliest version that has remapped mojang?

misty ingot
#

how should I do that?

lost matrix
lost matrix
summer scroll
# lost matrix I believe 1.17

So with remapped-mojang I don't need to make separate maven module for the other versions right? For 1.17+ versions.

misty ingot
#
    public static ResultSet grabBankData(UUID targetUUID) throws ExecutionException, InterruptedException {
        CompletableFuture<ResultSet> result = new CompletableFuture<>();
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            try {
                PreparedStatement statement = plugin.getConnection().prepareStatement("SELECT purse, bankStored, bankLimit FROM pdata WHERE uuid = ?");
                statement.setString(1, String.valueOf(targetUUID));
                ResultSet resultSet = statement.executeQuery();
                result.complete(resultSet);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        return result.get();
    }

is this the right way to do it?

lost matrix
ivory sleet
lost matrix
#

Also not after returning it

misty ingot
#

ok so I removed the .get()

ivory sleet
#
return CompletableFuture.supplyAsync(() -> {
  //..
  return resultSet;
},runnable -> Bukkit.getScheduler().runTaskAsynchronously(plugin,runnable));
misty ingot
#

now when I get the future after running the method, will it just work like a normal resultset or will I have to extract the set from it in some way first

quaint mantle
#

Guys

lost matrix
#

Oh no...

quaint mantle
#
class myListener implements Listener {
  /*
    Le hashmap sono delle variabili che associano
    un oggetto chiave ad un oggetto valore. Per
    questo codice assoceremo una Location (posizione + mondo)
    al Player che controlla quel blocco.
  */
  HashMap<Location, Player> placedBlocks = new HashMap<>();

  @EventHandler(priority = EventPriority.Monitor)
  public void onPlace(BlockPlaceEvent event) {
    // Se un altro plugin ha cancellato l'evento ritorna
    if (event.isCancelled()) return;
    
    // Registriamo il blocco assieme al proprietario 
    placedBlocks.set(event.getBlock().getLocation(), event.getPlayer())
  }

  @EventHandler(priority = EventPriority.Monitor)
  public void onBreak(BlockBreakEvent event) {
    // Se un altro plugin ha cancellato l'evento ritorna
    if (event.isCancelled()) return;
    
    Location location = event.getBlock().getLocation(); // Prendiamo la location
    Player player = placedBlocks.get(location); // Prendiamo il player

    // Se non l'abbiamo mai registrato o il blocco è il suo ritorna
    if (player == null || player == event.getPlayer()) return;

    // Ormai è stato rotto quindi lo togliamo
    placedBlocks.remove(location);
    
    for (Player player : Bukkit.getOnlinePlayers()) { // Per ogni player nel server
      // Se è admin manda il messaggio
      if (player.hasPermission("my.permission.admin"))
        player.sendMessage("Un malandrino ha distrutto " + getString(location));
    }
  }

  private void getString(Location location) {
    return "x="location.getBlockX() + ", " +
      "y="location.getBlockX() + ", " +
        "z="location.getBlockX(); 
  }
}
#

Ignore the Italian script

vocal cloud
#

?paste

undone axleBOT
quaint mantle
#

Should this work?

vocal cloud
quaint mantle
#

I wanted something like; if player breaks a natural block, then don’t send nothing

misty ingot
#

cuz its still a future

quaint mantle
#

If instead is a block placed by another player then send me a message like; player broke “block”

vocal cloud
#

Why not test it yourself?

lost matrix
quaint mantle
lost matrix
quaint mantle
#

This is the script

#

Can someone check if it looks legit?

quaint mantle
misty ingot
#

or location data

quaint mantle
#

But how?

#

How do I store it

#

ChatGpT helped me a lot

#

But how do I store infos?

vocal cloud
#

Ask ChatGPT

tawdry echo
#

sword, pickaxe, helmet, leggins etc is repairable?

glossy venture
#

if you want it instantly you can call .join()

lost matrix
quaint mantle
#

Ok

#

So

#

He told me to do this

#

?paste

undone axleBOT
glossy venture
quaint mantle
misty ingot
quaint mantle
#

Can anyone check if I wrote the script well?

quaint mantle
misty ingot
misty ingot
quaint mantle
quaint mantle
lost matrix
rustic pecan
#
        this.playerArrayList.forEach(tp -> {
            Player player = Bukkit.getPlayer(tp.getUniqueId());

            int spaceCount = 20 - player.getName().length() - Integer.toString(tp.getTokens()).length();
            String finalString = player.getName() + StringUtils.repeat(" ", spaceCount) + tp.getTokens();
            player.setPlayerListName(finalString);
        });

Hi all, I'm trying to display the player name left-aligned and the number of tokens right-aligned in the tablist, however the final tablist does not display the correct number of spaces.
Is there a limit to how many spaces can be placed consecutively?

quaint mantle
#

I told u guys that everything works fine

#

Thanks to my dear friend

#

(ChatGPT, but shhhhhh)

misty ingot
#

if everything works fine then congratulations, this channel is of no use to you

quaint mantle
#

Sometimes I need your help as well guys

misty ingot
#

ok so everything doesnt work fine

quaint mantle
#

:DD

quaint mantle
lost matrix
ancient plank
#

I like writing my own file extensions

#

.ade

quaint mantle
#

?learn

ancient plank
#

what is .ade you ask? Well, it's just a .txt file but with the first 3 letters of my name in it

ivory sleet
#

?kick @quaint mantle trolling/unserious

undone axleBOT
#

Done. That felt good.

ancient plank
#

damn

misty ingot
granite owl
#

i need some help revolving the JNI, say i have this wrapper ```cpp
JNIEXPORT jlong JNICALL Java_IniParser_new(JNIEnv* pEnv, jclass cls) { return reinterpret_caststd::uintptr_t(new IniParser()); }

misty ingot
#

that did feel good

#

well, dont have to deal with him anymorre

quaint mantle
vocal cloud
quaint mantle
#

I was not trolling?

#

Lol

misty ingot
#

oh lawd hes back

quaint mantle
#

I was just being serious, and I asked for help

misty ingot
quaint mantle
misty ingot
#

just use a damn database
a local one even

quaint mantle
#

The problem is

#

That I don’t know how to setup a database

#

💀

ancient plank
#

technically using a database is more complicated than saving text to a text file

misty ingot
#

but it is better no?

quaint mantle
#

Nop

ancient plank
#

is it better and easy to do? absolutely, and I am not agreeing with their point

#

the least I'll ever do something out of laziness is store things in json

quaint mantle
#

Nah, I’ll store it into a .txt file

ancient plank
#

like my shitty discord bot, saves server configs in json (not great, but I don't have access to the server it's hosted on anymore so it's whatever)

misty ingot
#

i want to die

quaint mantle
lost matrix
misty ingot
quaint mantle
misty ingot
#

@ivory sleet can you type the funny command again

quaint mantle
ivory sleet
#

Egitto, use this channel as a serious means to get assistance, thanks

granite owl
misty ingot
#

I love the "Several people are typing"

#

right as he types anything

ivory sleet
#

thanks :3

quaint mantle
#

What is wrong with that?

lost matrix
lost matrix
quaint mantle
#

Guys a question

#

I would like to make a /goodnight plugin with like, if someone says /gn it adds a percentage to make it day

#

Is it possible?

vocal cloud
#

Yes

lost matrix
#

Yes (but in blue)

quaint mantle
quaint mantle
wise mesa
#

Maybe look at the code for one of those better sleeping plugins

vocal cloud
#

Code, and you should start by learning java

#

?jd-s

undone axleBOT
vocal cloud
#

then you can read the docs

quaint mantle
#

Mmmmmh

#

Ok

#

?paste

undone axleBOT
quaint mantle
#

Ok I’m done with coding for today

limpid oasis
#

goodnight egitto

quaint mantle
#

It’s not night

#

3 pm

limpid oasis
#

goodnight egitto

quaint mantle
#

It’s not night??

limpid oasis
#

it is

quaint mantle
#

But if u guys have time could u please look at the script I wrote?

quaint mantle
limpid oasis
#

line 10 wrong

quaint mantle
#

Oh

limpid oasis
#

jk

quaint mantle
#

Ah ok lol

limpid oasis
#

what is this for

quaint mantle
#

For /goodnight

quaint mantle
#

Im also thinking about making a /rep and /badrep for reputation

#

And if u get good repped u get a cookie

#

Guys please don’t steal my idea

misty ingot
#

I refuse to believe that ChatGPT did not write that code @quaint mantle

misty ingot
quaint mantle
#

My pluginer did

misty ingot
quaint mantle
#

He didn’t…..?

misty ingot
quaint mantle
#

The guy who writes plugins

misty ingot
#

You mean programmer/developer/coder?

quaint mantle
#

Nice name right?

misty ingot
#

Anyway, if you have someone else writing code for you then why are you asking how to write the exact code here too

#

Just... see your pluginners code

quaint mantle
desert spade
#

is that because it's chatgpt

quaint mantle
#

He’s doing it for free

quaint mantle
misty ingot
#

I am shocked by this man's competence

#

I have never seen such an intelligent homo sapien in my entire lifetime

quaint mantle
#

U forgot 2 sapiens

#

Btw I’m off today I’ll return to code tonight

quaint mantle
tardy delta
#

early returns

#

and have the random as a field

fluid river
#

jree

fluid river
quaint mantle
tardy flame
#

Is there any way to remove the result from FurnaceExtractEvent?

quaint mantle
#

Can u please explain me the problem?

fluid river
#

nested ifs

tardy flame
fluid river
#

relatively old practics

quaint mantle
primal rose
primal rose
#

ok

flint coyote
#

Egitto did you still not get it to work? It's been like 20 hours

quaint mantle
#

I added the possibility to get the coords, the player name, which block

flint coyote
#

Oh cool. Looks like you made a lot of progress and have a baseline now that you can build upon

tardy delta
quaint mantle
#

But I miss only one thing

#

And that’s important

tardy delta
#

mans code is a piece of shit

#

like all yt tutorials actually

#

i recommend you look at the forum stuff

primal rose
#

you got any good tuto playlist?

tardy delta
#

i dont know any good playlists

flint coyote
tardy delta
#

exactly

#

i just look at github

primal rose
#

is there a good place where i cn get snippets and learn from them?

quaint mantle
flint coyote
#

I just google specific questions

primal rose
#

or an online code viewer with explenation of the code

desert spade
#

yt tutorials can be something to start with provided you actually try and understand/find out what each step actually does. following it blindly won't help you at all. also would strongly recommend a baseline knowledge of java before doing plugin development

flint coyote
tardy delta
#

i just start thinking about what i want to make and start looking up specific parts of that

quaint mantle
flint coyote
#

Do blocks placed by players have to be known as player placed blocks even if the server restarted?

fluid river
flint coyote
#

Then you need some kind of persistent storage (database, file)

quaint mantle
flint coyote
#

Did you already create that?

quaint mantle
#

Not yet

#

So he writes whenever a player places a block? Like every block placed

flint coyote
#

Yeah that's a little work to put everything in there and parse it to get it out again. Get some sleep and then continue. You made good progress.

flint coyote
quaint mantle
#

Yea, but that’s the important thing, bc I don’t want that every time breaks a block, it sends me an alert

#

Imagine when a player goes to mine

flint coyote
#

Well you chose a pretty hard task to begin with

quaint mantle
#

Yea

#

But it’s essential, no one did this type of plugin

#

Besides minecraftonline

fluid river
#

?jd-s

undone axleBOT
fluid river
#

guess not

tardy flame
#

when player is holding items in between (after he picked up from furnace) inventories which inventory owns the item? player's or the furnace?

fluid river
#

you can check if the click also calls InventoryClickEvent

#

so you can cancel

regal scaffold
#

Lets say I have the string:

This is a 123 string

I'm using regex to be able to split the string into multiple substrings,

I want to be able to change 123 to be a ChatComponent. So I can add events to it.

Do I need to change the entire string to be able to change it?

fluid river
#

you definitely have it

fluid river
#

Construct a component with string.split(" ")[0]?

regal scaffold
#

Oh I can do that?

fluid river
#

if it provides a ChatComponent(String)

fluid river
#

i thought they are from paper

regal scaffold
#

But then to display the new message do I need to add each substring to the component?

summer scroll
#

So a NamespacedKey require to put JavaPlugin on the constructor, If I decided to change the package name of the project will it conflict? Meaning it will be different NamespacedKey.

regal scaffold
#

I assume I can't just change the 1 word

tardy flame
regal scaffold
#

Ok yeah thought so

rotund ravine
lost matrix
regal scaffold
#

So use a for loop to loop through every String in String[]

Add them to a BaseComponent and do the changes before I add it, then replace the original message

summer scroll
regal scaffold
#

Thanks smile, thought so

fluid river
#

and same applies to plugin messages

regal scaffold
#

And nice pfp

regal scaffold
#

Oh

#

Really?

fluid river
#

ChatComponent#append(String) then ig

#

if that's an option

regal scaffold
#

Well, I have an efficient way to know if 123 ( in this case ) is even in the string so I would be unnecessarily checking and converting everything

fluid river
#

String#contains(String substring)?

regal scaffold
#

Regex

#

But yeah

fluid river
#

oh

lost matrix
#

If you really only want only the 123 component to be clickable then i would just create two components for
"This is a " and " string", as well as a clickable component for "123". Then append them to one component.

regal scaffold
#

Ohhhhh

#

But then how can I correctly split my String

#

Into 3 parts

#

That splits everything

#

Which is what he said not to do

lost matrix
#

What are you trying to do?

fluid river
#

your string is dynamic right?

regal scaffold
#

Chat message yes

fluid river
#

it's not always same pattern

regal scaffold
#

I'm trying to convert a chat message that contains 123 ( as regex )

quaint mantle
regal scaffold
#

And replace 123 into a clickable 123

fluid river
lost matrix
quaint mantle
quaint mantle
#

Only claim shit

fluid river
fluid river
#

PDC on chunk when place

regal scaffold
#

^\d{3}-\d{3}-\d{3}$

lost matrix
regal scaffold
#

Regex

fluid river
#

Alert when player breaks the block in a chunk with PDC directing to this exact block

regal scaffold
#

For xxx-xxx-xxx

quaint mantle
#

That’s why I ask help maybe?

granite owl
fluid river
#

with p.sendMessage()

#

like 5 minutes of coding

quaint mantle
#

So far I just made that it tells me when a player breaks natural blocks and placed blocks, and also which type of block and also coordinates

#

And also the name of the player

#

But I want only for placed blocks not natural blocks

fluid river
#

you need to mark blocks with pdc

#

?blockpdc

undone axleBOT
quaint mantle
regal scaffold
#

Any idea then Nuker?

fluid river
#

or using defaut spigot api -> store pdc to chunks

fluid river
#

Block#getChunk()

#

Chunk#getPersistentDataContainer()

#

?jd-s

undone axleBOT
fluid river
#

?pdc

fluid river
#

good luck with that

quaint mantle
#

Is that difficult?

fluid river
#

no

quaint mantle
#

I’ll try

fluid river
#

like 5 mins ig

quaint mantle
#

Ah

lost matrix
#

This will be incredibly hard on the server if you just want to check which block was placed by a player.

#

This describes a very lightweight way of tracking player placed blocks in the chunks PDC

regal scaffold
#
    @EventHandler
    public void playerChatEvent(AsyncPlayerChatEvent event) {
        String[] messageArray = event.getMessage().split(" ");

    }

If someone sends a message in chat like The number is xxx-xxx-xxx

I want to replace the message sent by the user with The number is xxx-xxx-xxx except that xxx-xxx-xxx is a TextComponent.

lost matrix
#

Cancel the event and broadcast your component

regal scaffold
#

But I'm worried about the efficiency of my Component

#

Because the start and the end of xxx-xxx-xxx are just a string. There's no need to convert into anything

lost matrix
#

This event is almost always async. So dont worry too much about performance.

regal scaffold
#

So I should just create as many components for the start and end of the string?

#

Append them to a big one

#

And send that?

lost matrix
#

I would create 3 components.
Prefix, Middle, Suffix with Middle being your number

regal scaffold
#

Yes I understood that, but I'm confused on how can I group array indexes into those categories

nocturne steppe
#

hellloooo, the StructureManager should be able to load structures generated by the structure block in minecraft right?

heavy perch
#

Hi! I know this is not a gradle forum but I am currently out of ideas and google ain't friendly (so does gradle's tutorial page)!
I have a dependency which automatically include kyori's libs + google's gson, which both aren't necessary in my plugin.
I tried excluding the group, the packages, anything when running the shadowjar task, but no changed result, any ideas?

regal scaffold
#
        for (String word : message) {
            beforeNumber.addExtra(word + " ");
            if (word.matches("^\\d{3}-\\d{3}-\\d{3}$")) {
                number.setText(word);
                break;
            }
        }
nocturne steppe
heavy perch
#

The dependency has those in another plugin outside of my packages I believe.

#

And since I am running paper, I don't need kyori's adventure since its included in paper

toxic lion
#

So i have an on playerInteractEvent

and i want to give the player the block it right clicked, it shows no error but it just does not work..

p.getInventory().addItem(new ItemStack((ItemStack) e.getClickedBlock()));

chrome beacon
#

A block is not an ItemStack

lost matrix
#

This will throw an exception

flint coyote
#

You need to get the Material of the block in order to do new ItemStack. e.getClickedBlock().getType()

#

Don't forget the null-check unless you checked if the block can't be null beforehand

toxic lion
#

but thanks ill try

regal scaffold
#

Smile

#

How does using a matcher sound?

#

        Pattern pattern = Pattern.compile("(.*?,\\s*)(\\d{3}-\\d{3}-\\d{3})(,\\s*.*$)");
        // Match the pattern against the string
        Matcher matcher = pattern.matcher(String);
fluid river
#

fava

round finch
#

my fava r rite thing

fluid river
#

lessons

lost matrix
#

phtava

fluid river
#

for jree

nocturne steppe
lost matrix
round finch
#

i wish i could visualize the spigot jar source?

i heard intellij have some features

#

or what plugins is good for intellij?

fluid river
#

spigot.png

round finch
#

fava-reader

fluid river
#

omg

#

you mean you want to look through spigot source code while in IDEA?

round finch
#

💀

river oracle
#

?stash

undone axleBOT
river oracle
#

It's open sowce

fluid river
#

open sauce

peak depot
#

whats the current method to get the inventory title

round finch
#

but i'm used to ecplise

fluid river
#

same

#

idk about eclipse but intellij had this by default ig

hazy parrot
fluid river
#

i usually just google

#

why do you even need name

peak depot
#

to check if its the same name of a inventory thats comming from another plugin

regal scaffold
#
        String regex = ".*\\b(\\d{3}-\\d{3}-\\d{3})\\b.*";

        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(message);

        if (matcher.find()) {
            String prefix = message.substring(0, matcher.start(1));
            String phoneNumber = matcher.group(1);
            String suffix = message.substring(matcher.end(1));
        }
#

Now that's pretty cool

fluid river
#

guy goes for black magic

hazy parrot
#

Tf is even that regex

peak depot
regal scaffold
#

It's a perfect regex for

#

"Hello, my phone number is 123-456-7890. Please call me!"

#

To split into 3 parts, prefix, phone and suffix

#

Where the "prefix" and "suffix" can be absolutely anything

fluid river
regal scaffold
#

And now, I can add some fancy stuff to the phone number

peak depot
fluid river
#

oh

#

mb

#

HumanEntity#getOpenInventory returns view

hazy parrot
#

So event.getView

regal scaffold
#

Is this the best way to combine 3 separate components to then replace the message in AsyncChatEvent

#
            TextComponent newMessage = new TextComponent();
            newMessage.addExtra(prefixComponent);
            newMessage.addExtra(phoneNumberComponent);
            newMessage.addExtra(suffixComponent);
            event.setMessage(newMessage.toLegacyText());
tardy delta
#

ComponentBuilder maybe

regal scaffold
#

Same thing

#

But I can't seem to replace the event

#

with the new message

tardy delta
#

what were you trying again

regal scaffold
#

I think toLegacyText removes all the textComponent features

#

Replace a message in aSyncChatEvent with my custom component message

#

Is the last step, everything else is working

fluid river
#

when i used to code chatmanger

#

i just cancelled the chatevent

#

and sent the message to players

regal scaffold
#

I thought about doing that

#

But damn...

tardy delta
#

i probably did too

fluid river
#

that's the best way ig

regal scaffold
#

That means I need to make a broadcast

fluid river
#

yeah

#

why not

regal scaffold
#

And then it won't work in /msg

fluid river
#

umm

regal scaffold
#

That's annoying

#

And I would need to build the message to have the exact format as the player would

fluid river
#

just do /msg in your own plugin and send the message to the player directly with the component

regal scaffold
#

So it looks like he is sending ity

#

Fair

#

I wonder if reflection or nms can override that

fluid river
#

develop amogus

#

otherwise you are not allowed to be a spigot member

primal rose
#

hi im trying to switch from skript to plugin developement but are classes kind of functions in skript?

fluid river
#

no

#

freejavalessons

primal rose
#

again ;-;

#

i already followed lesson

fluid river
#

oh true

#

and you didn't start to code after that

primal rose
#

true

#

now im trying again

#

and i made more progress than ever

#

i set up a spigot test server AND made a plugin that says something on startup

tardy delta
#

dang

primal rose
#

i think i can get into paid developing