#help-development

1 messages · Page 232 of 1

pine island
#

so smth like this i suppose?:

glossy venture
#

just getDurability()

#

not max

pine island
#

there

#

is

#

no method

#

for

glossy venture
#

wahat

pine island
#

taht

#

the doc even considers it Depriciated

glossy venture
#

yeah there is

glossy venture
#

like dependency

#

because where im looking its not deprecated

#

and exists

pine island
#

im using 1.8

glossy venture
pine island
glossy venture
#

this is 1.19.2 javadocs

pine island
#

oh.

#

oh wait

#

im talking abt Material not ItemStack

quiet ice
#

1.8 materials are different @pine island

glossy venture
#

the material is the same the durability per item stack dictates if it is a gapple or a god apple

wet breach
#

love how they are looking at itemstack, and then trying using a method from one thing to another as if like they should because they said so

glossy venture
#

lmao

pine island
#

what if i check if its Enchanted would that do it-?

glossy venture
#

look

// create items
ItemStack goldenApple = new ItemStack(Material.GOLDEN_APPLE, /* amount */ 1,
  /* data value (durability) */ 0);
ItemStack enchGoldenApple = new ItemStack(Material.GOLDEN_APPLE, /* amount */ 1,
  /* data value (durability) */ 1);

// to check if its a god apple
if (item.getType() == Material.GOLDEN_APPLE && item.getDurability() == 1) {

}
glossy venture
civic wind
quiet ice
glossy venture
#

i liked the durability values system tho

quiet ice
#

Bukkit only enumerates the first integer, but not the second (which is the data value (durability))

glossy venture
#

easy to change shit like wool colors

quiet ice
#

Well to group multiple items we have Tags

glossy venture
#

true

#

but no easy way to randomize a color of wool

#

or can you get a collection of materials under a certain tag

quiet ice
pine island
glossy venture
#

in 1.19.2 you cant just provide a 0-15 number as a color

#

each color of each block is a different id

#

so Material

#

wish Wicked Ways was mixed better the vocals are quiet but its so good

pine island
#

whats the enchantment name for mending?

quiet ice
#

Alternatively you can just accept the hack of using Material#name()

#

?jd-s

undone axleBOT
glossy venture
quiet ice
pine island
#

alirght

#

thanks

glossy venture
#

lmao

pine island
#

couldnt find it

quiet ice
#

1.8 does not have mending

#

Know your versions buddy

pine island
#

it dosnt

#

dang.

quiet ice
#

I donno, seems pretty 1.9+-only to me

glossy venture
#

oh yeah

glossy venture
#

event when you receive experience

#

add durability

#

if it is a damagable

quiet ice
#

Adding new enchantments is pain

pine island
glossy venture
#

true

quiet ice
#

Although adding mending is relatively easier thanks to one not having to mess with the enchantment table, but the anvil still exists soooo - still big pain

#

I'm just talking about raw implementation work - not the enchantments themselves; anvils and plugin interop is rather cumbersome

#

Hell, I have an entire ASM transformer dedicated for slimefun interop

pine island
#

anyway to get past this? (other than changing the items meta)

quiet ice
#

addUnsafeEnch

pine island
#

thanks

#

also anyway to make gapple not edible?

winged anvil
#

thank you for giving this idea, makes my life sm easier

echo basalt
#

mans stalking me

sacred mountain
#

im going to make a subtle-annoyance plugin

#

my server gonna love me

glossy venture
sacred mountain
#

im thinking random block breaks whilst theyre mining or regenerating blocks

#

packet cancelling

#

random noises

fresh timber
#

I am trying to make a plugin that spawns custom entities with nms but when I try to set the custom name, I need a weird object... does anyone know how I can do this?

piglinBrute.setCustomName(what);
winged ridge
fresh timber
#

I don't know how to use ichatbasecomponent

worldly ingot
#

Mojmaps refer to text literal components as Component.literal("The name")

#

There are some added builder, formatting, etc. methods

winged anvil
fresh timber
#

I am trying to spawn custom entities and I get this error when I use this code. How can I do this differently to make it work?

winged ridge
#

How would I make a player walk through a block (if possible 2 blocks high so it's the player's size). Maybe it is possible to convert the block to falling sand but with a texture idk? Or how would I check if the player is touching a certain block so I teleport it on the other side?

pine island
#

How can i destroy an item after its done getting renamed in an anvil

public class anvil implements Listener {
    @EventHandler
    public void renameCheck(InventoryEvent event) {
        //get result of Anvil
        InventoryType inventoryType = event.getInventory().getType();
        if(inventoryType == InventoryType.ANVIL) {
            String[] customItems = new String[]
            {
                "~Angel's Apple~",
                "~Movement Rod"      
            };

            String ItemName = event.getInventory().getItem(2).getItemMeta().getDisplayName();
            if(contains(customItems, ItemName)) {
                //destroy the item they just made
            }
        }
    }

    public boolean contains(String[] arr, String targetValue) {
        for(String s: arr){
            if(s.equals(targetValue))
                return true;
        }
        return false;
    }
}
trim creek
#

Me exporting with maven be like: [3,24] package javax.annotation does not exist

#

I swear I am gonna fuck up Eclipse or either Maven

winged ridge
trim creek
#

idk

humble tulip
#

Idk

trim creek
#

Eclipse is probably more reliable for starters lmao

humble tulip
#

Ur using it

trim creek
#

yes

#

and idk why

humble tulip
trim creek
#

but I already wanna f*ck it up

#

What am I even supposed to add, to just prevent that bug I posted above? xd

humble tulip
#

Eclipse is known to do random shit for no reason

trim creek
humble tulip
trim creek
#

like...
I got an error on player.setGameMode(GameMode.CREATIVE);

#

while it was on correct place, and correct used

#

xd

humble tulip
winged ridge
#

why didn't you install intellij

humble tulip
#

Psh

trim creek
#

bruh its over midnight

#

I got Bukkit and Spigot related errors as well before xd

#

I fixed them by adding the repo and deps into the POM

#

now an javax.annoation is the problem because of support for PAPI lmao

#

it can't find @Nullable lol

#

and now it cannot find a simple dot

#

WHY CAN'T A DOT BE FOUND?!

#

FFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU-

wary topaz
#

How can I list ALL the contents in a config StringList. (For example:)

Test:
test1
test2
^ I want it to list "test1" and "test2" but the size of the list would be random as players can add items to the list.

loud frost
#

.getList()

wary topaz
#

No, it is a colon.

humble tulip
#

And it's config.getStringList()

wary topaz
#

Test:
test2:

humble tulip
#

Is it for a list?

loud frost
humble tulip
#

Or do you want test and test 2 to also have config stuff

worldly ingot
#

You want getKeys(false)

wary topaz
worldly ingot
#

It will get you the keys of all children under that parent

wary topaz
#

Yes but how would I print it to the player as "home1, home2"

worldly ingot
#

Y- You have it. getKeys()

humble tulip
wary topaz
#

Okay thanks.

worldly ingot
#

I would personally avoid handling home saves in a YAML file because that file may get large fast. Generally the better alternative is to make use of some database schema

fresh timber
#

I'm getting this error when I run this code for damage event. Anyone know what I can do differently to fix this?

worldly ingot
#

If you want to handle an EntityDamageByEntityEvent, you should listen for an EntityDamageByEntityEvent, not an EntityDamageEvent

fresh timber
#

ah ok

sterile token
twilit garden
#

how do i put player in a different world?

#

if i have a world called "one" and a world called "two"

#

how would i switch the player between the two

humble tulip
#

teleport them?

twilit garden
#

what

humble tulip
#

player.teleport(Location)

twilit garden
#

no not a location

#

a different world file

humble tulip
#

i'm confused as to what you're asking

#

what do you mean put them in a different world file?

#

and why would you even do that?

twilit garden
#

one world is tghe lobby

#

when i run a command

#

it teleports me / loads a different world file

humble tulip
#

right...

#

but player data is stored in the main world anyways which is the lobby

#

^ i think, not 100% sure

wet breach
twilit garden
#

i just dont know how to make the player load it

#

so basically i have a map, and theirs a command that copies the map, but after that, the player dosent load it

#

and deleating the original world folder and running the server will just generate a new one

#

every single time the copied world name is different

past vapor
#

Is there any way to pause the player's login while we load their data?

wet breach
past vapor
raw sky
#

I need to make a command that will have possibly a few thousand lines of code, whats the best way to do this?

humble tulip
#

use other classes

humble tulip
raw sky
#

So a main command class that calls other classes?

#

Ill get the lsit

#

pretty much just controls the game manager is all, such as forcing maps and a team selector

humble tulip
#

Have your main command class just parse the subcommand

#

And have a class for each subcommand

#

And an interface called subcommand

raw sky
#

ok ty!

wet breach
loud frost
#

What happens if you try to get something from the config which doesnt exist?

river oracle
#

null

vocal cloud
#

Try it and see? Or check the docs

river oracle
#

😱

loud frost
vocal cloud
#

Or you can check the docs which takes even less time

loud frost
#

not true

vocal cloud
#

Yes true?

#

You can literally hold one key and press one mouse button and you'll know

loud frost
vocal cloud
#

Required 3? Buttons?

river oracle
#

tbf I was able to answer in under like a second tho docs are in your IDE so

#

hover?

vocal cloud
river oracle
river oracle
# vocal cloud

what if he uses Eclipse or Netbeans or maybe he is on crack like me and uses VSCODE

vocal cloud
river oracle
#

i forgot the hotkey for doing that on vscode I use that feature so little I usually just try and see even tho its less efficent

loud frost
#

It is bold of you to assume everyone has such fancy tools

river oracle
#

i think eclipse has it

#

you'd have to look it up

#

if it doesn't get a proper IDE lol

remote swallow
loud frost
vocal cloud
undone axleBOT
loud frost
remote swallow
wet breach
#

Someone is obviously too lazy to work a computer. Funny they rather use something not suited for the task but the crossing point for them is reading docs or sesrching lol

blissful escarp
#

Weird question, I'm learning Java/Plugin development, does anyone know a plugin idea that I could make for learning purposes? I wan't to make a plugin to improve my skills but I can't think of any ideas to make, that isn't just simple single event plugins

drowsy helm
#

theres different ways you approach it depending on your knowledge, so once you do it once, you can come back and do it again with improved knowledege

blissful escarp
drowsy helm
#

probably some of the most fun plugins to make aswell

raw sky
#

I am creating a command with a TON of different possibility’s, do I call a method for the different subcommands or do I create a new object to run the code?

#

Not sure on how Java handles memory leaks and performance

drowsy helm
#

depends on the context

#

what is the command for exactly

#

is each subcommand related

#

or completely different

raw sky
#

Completely different features, it handles my gsme manager

drowsy helm
#

yeah probably different classes for each subcommand

blissful escarp
# drowsy helm custom items

do you have any links to videos/articles for this? I'm only finding people suggesting other plugins and not actual coding of one

drowsy helm
#

using a command framework will make your life much easier

blissful escarp
raw sky
raw sky
drowsy helm
#

Aikar Command Framework

#

from the guy who makes paper

#

it's great

raw sky
#

Ok tyvm

remote swallow
drowsy helm
#

no clue

remote swallow
#

yeah he did

wet breach
tardy delta
#

Pink color gone

wet breach
tardy delta
#

;o it's back

remote swallow
#

discord mobile be like:

tardy delta
#

Nearly missed my train lmao

wet breach
#

Oh you meant mine? Or yours?

tardy delta
#

Yours

#

Might be my discord bugged

remote swallow
#

mobile discord does that a lot

wet breach
#

Its your discord. My nitro is on autopay lmao

#

If mine goes away it means magically I can't afford $10

remote swallow
#

im gonna say that would only happen if someone steals your identity

tardy delta
#

But train full of People and ofc they are checking tickets

#

Mfs

remote swallow
#

what else do you expect

wet breach
#

You don't have a ticket?

tardy delta
#

I do

#

They normally don't check if they Cant barely move thro the People standing right

#

Too much People in here

#

Man doing one wagon in ten minutes

glossy venture
#

lmao

#

half the people gone after a wagon

#

useless

wet breach
#

That's how it be. Show ticket or leave lol

vocal cloud
#

Europe moment?

hybrid spoke
onyx fjord
#

We call them kanary

#

And there are entire Facebook groups to warn people about ticket checking

#

It's not that we are not honest, these people are generally just very rude

tardy delta
#

;/

onyx fjord
#

And charge for no reason

#

Trains aren't that expensive for students anyway

#

And all other forms

#

Yeah same here

#

Oh wait no

#

Uni student iirc get free (I might be wrong) but high schoolers get 50% off

#

Uni students get a lot of benefits

#

Cheaper food in some bars

#

Etc etc

hybrid spoke
#

germany be like: hey, you dont have a ticket? pay 60€ and leave. idc how you get home.
meanwhile drunk, drugged or homeless people without a ticket: have a great day

onyx fjord
#

At least you will get to the place you want

hybrid spoke
#

they only stay for one ride

onyx fjord
#

They have no rights to use force

#

Guard != Police

hybrid spoke
#

police wont say anything

#

"you should've simply paid your ticket"

#

and if you defend yourself you are the one guilty

onyx fjord
#

Well you record entire situation, report the guard and demand money for the damages

#

Ez fix

hybrid spoke
#

the only damage i would have is the time lost

#

but thats just speaking of me

onyx fjord
#

Well they violated your rights

#

They have the same rights as normal citizen

#

Unless you are a danger

#

Then they can use force as defense

#

Oh shit it's help development

#

💀

#

Hey guys how to center a div

glossy venture
#

impossible

#

how do you completely disable the join message

#

just set it to null?

#

oh yeah

blissful escarp
#

Does anyone know an effective way to create a visible out-line of a cube, without the use of particles?

Making an area-trigger plugin, and initially I planned on using particles to out-line to selected area before "confirming" the trigger area, although I don't think this will be very server friendly in the bigger areas?

chrome beacon
#

You can use structure block outlines for mid sized areas

blissful escarp
#

never heard of them, will look them up now!

#

the entity or the bullets they fire?

native ruin
#

Send block change

sonic barn
#

I have similar question.... how do I spawn block with nms please? 😄

hybrid spoke
#

you dont

sonic barn
#

hm

#

I want block to move smoothly not like x: 1 to x: 2 ... but x: 1,1 x: 1,2 etc.

native ruin
#

Maybe armorstand?

hybrid spoke
#

falling block then

native ruin
#

Or blocks like sand?

#

What cipher said

sonic barn
twin venture
#

hi , i have a problem i dont know why for some reason only location value is not being saved in json file ..

#

other values , like boolean , strings , etc is saved once i stop the server , but not the location

#

[i have method to save the file once i stop the server]

#

no errors or anything .. it just not save it in json file [Location] .. ideas?

hybrid spoke
#

yeah, my idea would be that it doesnt save it to the json file

remote swallow
#

code?

hybrid spoke
#

we need some code

twin venture
#

other values is saved correctly without any problem

#

one moment , iam opening intellij idea .

#

its not giving me any errors while saving :L

#

so idk what's wrong why its not saving ,-,

hybrid spoke
#

ok cool

twin venture
#

Simple Location is just a util class , i tried with normal Location and its the same .

#

other values , are working and saving without any problem , like for example chance :

#

all these values are saved and working

ivory sleet
#

Does SimpleLocation implement ConfigurationSerializable?

twin venture
#

but this one is not ..

twin venture
ivory sleet
#

Or wait are you using bukkits config stuff or something else?

twin venture
#

its a bit complex

ivory sleet
#

Gson?

twin venture
#

yes

#

each one have its own values ..

#

yeb gson

ivory sleet
#

So well, in this case you probably wanna register an implementation of TypeAdapter<SimpleLocation> to your gson instance

twin venture
#

alr

trim creek
#

PreparedStatement ps2 = plugin.sql.connection().prepareStatement("INSERT IGNORE INTO cuud (PLAYER, UUID, MUTED, BANNED, REASON, BY, SERVER, MVP, PREMIUM) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); - in what way is this wrong?

#

near 'BY, SERVER, MVP, PREMIUM) VALUES ('NeonOwlGery', 'uuid' at line 1

trim creek
#

ah I got it then

#

lmao

#

weird. the plugin connects to MySQL but still throws an error that no operation allowed after connection close

#

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

vagrant stratus
#

Most likely closing the connection somewhere, which means you can't do operations

trim creek
#

but where?

#

Only area I close it is when the plugin gets disabled

#

howelse can it be disabled? xd

vagrant stratus
#

Well, given we have no code or anything else we can't tell you

trim creek
#

This is a method PAPI can call upon requesting the placeholder to check it:

public String getPremium(UUID uuid) {
        try {
            PreparedStatement ps = plugin.sql.connection().prepareStatement("SELECT * FROM `users` WHERE `UUID` = ?");
            ps.setString(1, uuid.toString());
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                if (rs.getString("PREMIUM").equals("TRUE")) {
                    return "§aVan";
                } else {
                    return "§cNincs";
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return "§cHiba";
    }

it gets errorred saying operation is closed

eternal night
#

I love not closing prepared statements

vagrant stratus
#

Ahh, try-with-resource resources is the best

trim creek
#
if (params.equals("premium")) {
            return plugin.sql.getPremium(player.getUniqueId());
        }

and this is what PAPI does btw

eternal night
#

^^^^ pls try-with-resource

trim creek
#

wut

vagrant stratus
#
try (PreparedStatement ps = plugin.sql.connection().prepareStatement(...)) {

}
#

That, it's a wonderful thing. Auto closes it

eternal night
#
try (
  final PreparedStatement statement = plugin.sql.connection().prepareStatement("...")
) {
}
#

cool kids put it on a new line

#

or so I heard

vagrant stratus
#

Cool kids don't care what line it's on as long as it works

eternal night
#

hmm, true that is what cool kids do

hazy parrot
#

.use {} 😌

eternal night
vagrant stratus
trim creek
trim creek
vagrant stratus
#

So the connection is being either closed or severed for some reason

trim creek
#

little one I learned to never use any other variable for MySQL

#

always use one

#

in the case

#

Loader: public MySQL sql = new MySQL(this);

#

and with di or what I just call it

#
public Loader plugin;
    public MySQL(Loader plugin) {
        this.plugin = plugin;
    }
wet breach
#

surround your sql statements in try catch blocks

#

and catch SQLException

wet breach
#

also you can do getWarnings() as well

trim creek
#

also...

#

why does every method gets a never used warning?

wet breach
#

probably are not registering your events

#

but what does your connection code look like for sql?

#

I have a feeling that your problem lies in how you are connecting or creating the connection object

eternal night
#

I mean your IDE is not smart enough to know that registering the listener means that the method is called

#

the minecraft development plugin fixes that but marking them as used when annotated etc

trim creek
#

just wondering why tf did I just switch to that lol

eternal night
#

how would intellij now kekw

trim creek
#
public void connect() throws ClassNotFoundException, SQLException {
        if (!isConnected()) {
            try {
                Class.forName("com.mysql.cj.jdbc.Driver");
                connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + name + "?useSSL=false", user, pass);
                Bukkit.getLogger().info("Connected to MySQL");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
#

it connects

#

just closes or something? xd

#

wait it doesnt has plugin.sql

#

ohshit

wet breach
#

this isn't correct

#

unless you are shading in your own mysql driver

#

in which case you are going to have problems since spigot also shades the mysql driver

trim creek
#

I use the liblary spigot provides

#

is that a problem?

wet breach
#

no, but there shouldn't be cj in there

trim creek
#

isnt the cj less deprecated?

wet breach
#

it should becom.mysql.jdbc.Driver

glossy venture
#

its just inefficient

wet breach
#

but the mysql driver is different because whatever loads the driver first onto the path, that is the driver that is used for everything

glossy venture
#

hm

trim creek
#

still causes the same error btw

wet breach
trim creek
#

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

brave sparrow
#

Your connection is closing

trim creek
#

I realised

#

just don't know why

wet breach
#

most likely due to incorrect user and password

trim creek
#

?paste

undone axleBOT
brave sparrow
#

You should use a connection pool btw

trim creek
brave sparrow
#

Rather than one persistent connection

wet breach
#

well connection pool isn't going to help with this problem

#

connection pool can come after this is resolved lol

brave sparrow
#

Well I think part of the issue is just that mysql is closing the inactive connection after a while

trim creek
#
private String host = "localhost";
    private String port = "3306";
    private String name = "database";
    private String user = "root";
    private String pass = "";
#

humm

#

they all correct

#

even database just renamed lmao

brave sparrow
#

@trim creek is it always failing to connect

trim creek
#

veeery good 😒

#

users kinda dead I guess

wet breach
#

I can't read what it says

trim creek
#

(reupload for privacy reasons lol)

#

(SELECT DISTINCT User, Host FROM mysql.user ) UNION (SELECT DISTINCT User, Host FROM mysql.db ) UNION (SELECT DISTINCT User, Host FROM mysql.tables_priv ) UNION (SELECT DISTINCT User, Host FROM mysql.columns_priv ) UNION (SELECT DISTINCT User, Host FROM mysql.procs_priv ) ORDER BY User ASC, Host ASC

#

this is what I was able to copy lol

#

basically it can't get the users for some reason

wet breach
#

I want the bottom portion about the error

brave sparrow
#

We can read that part

#

Lol

#

Yeah

#

We need to know what the response is

trim creek
#

bottom code:
(SELECT DISTINCT User, Host FROM mysql.user ) UNION (SELECT DISTINCT User, Host FROM mysql.db ) UNION (SELECT DISTINCT User, Host FROM mysql.tables_priv ) UNION (SELECT DISTINCT User, Host FROM mysql.columns_priv ) UNION (SELECT DISTINCT User, Host FROM mysql.procs_priv ) ORDER BY User ASC, Host ASC

#

response?

wet breach
#

the error message

trim creek
#

probably nothing

wet breach
#

at the bottom

#

paste it here or translate what it says

#

the error message is what will tell me more in what is wrong

trim creek
#

Érvénytelen kucslfájl a táblához: db

#

all this reads

#

"invalid keyfile for table: db"

#

I guess I should install a newer version of XAMPP xD

#

I have been using this since 2019 XD

wet breach
#

your temp directory is either not setup correctly for mysql or you ran out of disk space

wet breach
#

it can depending where temp directory is located

trim creek
trim creek
wet breach
#

in mysql settings for where ever is designated the spot for temp directory

#

either it isn't configured, or it ran out of space only two things that will throw that error you are seeing

trim creek
#

this doesn't seems right...

#

max connection at once is 43

#

but the total connections are 201?!

wet breach
#

your settings are probably all out of whack for mysql

trim creek
#

probably

wet breach
#

max connections should be at 2000

trim creek
#

imma try modify what I can

trim creek
wet breach
#

shutdown mysql server before you do

trim creek
wet breach
#

for the time being yes, you can't modify settings properly from phpmyadmin anyways

#

any settings changed from there are only temporary

trim creek
#

oh no

#

total connections are now 241 🤔

wet breach
#

wouldn't worry about that for the time being

#

would just recommend shutting down the mysql server and go appropriately setup the config file for mysql lol

trim creek
#

i dont see anything being incorrect

wet breach
#

what does your config look like?

#

?paste

undone axleBOT
trim creek
#

something went wrong with site lmao

wet breach
#

not sure why you are worrying about the site...

trim creek
wet breach
#

?paste

undone axleBOT
trim creek
#

wast able to send a paste

#

(yes i literally spammed ctrl s)

wet breach
#

apparently you didn't read the warning below

#

anyways still looking

#

if you don't want to use unix sockets

#

then comment those out

trim creek
#

idk what those are

wet breach
#

since you are on windows and your plugins don't make use of such, just go ahead and comment those out

trim creek
#

I didn't even knew I had plugins installed lol

wet breach
#
#socket="C:/xampp/mysql/mysql.sock"

#socket="C:/xampp/mysql/mysql.sock"
wet breach
#

you are not making it use unix sockets, and I am not entirely sure if mysql implements windows unix sockets yet

#

since that is relatively new

#

# bind-address="127.0.0.1" uncomment this since we are telling mysql not to use sockets so we need to tell it an ip to bind to

#

and yes, mysql does have plugins

#

or plugins you could install for it, in case you were curious

trim creek
#

I never modified the file btw

#

only this time

#

for the first time

#

I was like

#

"oh well it works and I understand nothing about those, so I won't edit them"

#

btw months ago users worked well

wet breach
#

add this to your config under [mysqld]

#

max_connections = 2000

trim creek
#

hmmm

#

it didn't threw any errors...

#

POG

#

it somehow is fixed

#

gonna add maxconnections as well

wet breach
#

change max packet size to 128M

trim creek
#

ok

wet breach
#

add this

#

thread_stack = 256K

trim creek
#

to where I added max conects right?

wet breach
#

yes

trim creek
#

for once it either works, or not

#

weird

#

but it works

wet breach
#

alright that is all for now, tomorrow if you are here I can help and show you how to fine tune it and change those values to be more optimal. But for now those should work

#

need to let mysql run for like a few hours before you can fine tune 😛

#

ideally a day or so

#

now that is fixed, we can now try and fix your plugin

trim creek
#

it works o.o

#

Both plugin and SQL

#

no throwing any error

wet breach
trim creek
#

:D

#

Thank you btw :D

wet breach
#

you are welcome

#

you are fortunate that I am well versed with MySQL 😛

trim creek
#

I do plugins since like... almost 1 and a half year...

#

but develope server since like 6 years

wet breach
#

anyways, if you can keep mysql DB server running for like 24 hours and then I can show you how to fine tune it to be super optimal

trim creek
#

so I ain't that good yet :D

wet breach
#

and fine tuning should be done every once in a while as things change you know

trim creek
#

and just "keeping the PC alive overnight" is not that allowed xd

#

but I will try my best to hide it

wet breach
#

Ah ok, well let it run as long as you can then

#

if you have to shut it down, then shut it down

#

we can work with whatever it has saved lol

trim creek
#

true

wet breach
#

anyways, have fun now with your working mysql server 😄

trim creek
#

Thank you :D

#

users still don't work but I already don't mind 😹

#

the only thing I mind is that the plugin is able to connect to it and it works xd

cyan trout
#

Can I set this name?

twilit roost
#

does anyone know why MCP Mapping Viewer doesn't work anymore?

chrome beacon
#

Use screamingsandals

small current
#

should i set game rules like this?
world.setGameRuleValue("announceAdvancements", "false");

quaint mantle
#

Hi sry but how can i do that if(player.getDisplayName().equals(appolon or lesteur)) {

#

(appolon is a String and same for lesteur)

twilit roost
chrome beacon
#

They have every mapping available

twilit roost
#

this is all I can see from them
and I don't think that MCP will be under NMS

chrome beacon
twilit roost
#

ave should be Minecraft
but it can't find it

Mojang nor any other searches

river oracle
#

You'd be looking got a packet

#

It's like client out

chrome beacon
#

^ also you're searching in mojmaps

stark marlin
#

I've previously used this line of code to set the message format in chat in the AsyncPlayerChatEvent. However it seems that newer versions of Minecraft causes an "message has been modified by the server" warning to the player next to the message. Is there a way of setting the "format" that won't show that warning?
event.setFormat(player.getDisplayName() + " §7» " + (player.hasPermission("chat.white") ? "§f" : "§7") + msg);

eternal night
#

you'd have to use the preview event to set the format

stark marlin
#

Ah, I see. Thanks!

winged ridge
#

How would I make a player walk through a block (if possible 2 blocks high so it's the player's size). Maybe it is possible to convert the block to falling sand but with a texture idk? Or how would I check if the player is touching a certain block so I teleport it on the other side?

remote swallow
#

a falling block can be anything if you change it

winged ridge
#

but can i change a normal block into a falling block

#

so i can walk through it

#

maybe with sendBlockChange

#

?

hallow ore
#

./execute if entity @a[x=<xcoord>,y=<ycoord>,z=<zcoord>,distance..1] run <command>

remote swallow
#

not very good to do in a plugin

winged ridge
#

That’s not Java though

hallow ore
#

It is.

remote swallow
#

thats a command

#

not code

#

running a command like that in a plugin isnt the best

hallow ore
#

change <xcode> to the x coordnites

#

change the <ycoords> to the y coords

#

etc

winged ridge
#

Still not code

remote swallow
#

i dont think you understand what this is

hallow ore
#

It's /execute

#

ill send a screenshot for you

remote swallow
#

we are talking about plugins

#

we do not need a screeenshot

hallow ore
#

Oh

#

Plugins??

winged ridge
#

That’s what the server is about

remote swallow
#

what spigot runs

winged ridge
#

Lol

winged ridge
wet breach
#

not suggesting that be the recommended method, but I mean if execute is what you know how to use, then it is a solution, albeit not the most optimal one XD

twin venture
#

Hello , i have specfic value in json , i want to save :
is it possible to specify the value ?

#

bcz its saving everything but not this value .. idk why its really weird ..

vivid skiff
#

How can i create a clickable button witch doesn' t execute a command but a method or something else

#

?

twin venture
#

my current problem is :
all this is editable , and its changed when i restart the server :

but preview location is not updating :

#

i have been googling for hours xD

wet breach
#

maybe...just maybe

#

it would be more helpful to us if you showed the code

#

because at this point, we have no idea either and have no clue in how it is being set or attempted to be set

twin venture
#

this is how iam saving this json files ,
and it does save all values , expect this one "preview-location"

#

all thes values are saved , updated when i close the server :
expect this one ..

wet breach
#

or are you not grabbing and parsing the json?

twin venture
#

see attached code

#

this values :
working just fine , updated when i close the server ..

#

but not previewlocation

#

iam just shocked , why it would'nt work ???????? its just weird -.-

tardy delta
#

cuz it doesnt know how to save locations

wet breach
#

Fourteen beat me to it

tardy delta
#

wouldnt be surprised if it threw an exception too

wet breach
#

take it away fourteen, learn them something new

tardy delta
#

write a typeadapter

twin venture
#

no exception

wet breach
#

that isn't where exceptions happen

tardy delta
#

dunno what that expose thing is doing anyways

twin venture
tardy delta
#

cuz those are primitives or strings

wet breach
#

location is an object

#

gson doesn't know what to do with objects

twin venture
wet breach
#

turn your location object into a string

#

and then feed that in

tardy delta
#

meh

twin venture
#

i have a system for spawning the player :
and it does work just fine

#

it save the data with no probllems

wet breach
#

except location

#

which is neither a primitive nor a string

tardy delta
#

why adding @Expose if i default gson::toJson would take all the fields anyway?

#

if you really wanna exclude them, make them transient

remote swallow
wet breach
#

so the solutions before you, is to either make a typeadapter like suggested by fourteenbrush

#

or turn location into a string

tardy delta
#

wanted to show mine but my chrome seems to be broken

twin venture
#

witch one is better?

wet breach
#

most likely fourteenbrushs recommendation as it is more versatile and can be applied elsewhere later on if you need it

#

what I suggested is just a way to make it work

#

wouldn't help you necessarily to turn that data back into a location

twin venture
#

i know i have everything else working

tardy delta
#

once wrote one

#

wrote so many typeadapters back in the day cuz gson is stupid

small current
#

i have a player object and the player gets offline, what is the return value of player.getName() ?

tardy delta
#

same name

#

the player objects retains its properties but player::isOnline returns false

#

i wouldnt suggest working with invalidated player objects anyhow

small current
#

i have this OLD code but for some reason
line 53 is throwing npe

tardy delta
#

maybe show the linenumbers lmao

small current
#

lmao

trim creek
#

xd

small current
tardy delta
#

return value of countdown::get is null

small current
#

why

#

i update in 45

tardy delta
#

cuz the entry is not in the map

trim creek
#

its not set

small current
#

and only gets removed in 59

#

why shouldn't it be

#

i guess killer.getName() returns something else other than the original

#

i should have the killerName out of the runnable but its an old code

wet breach
# small current

your run method is technically an inner anonymous class and thus does not have access to the method constructor variables

small current
#

i just want to know why

trim creek
#

it returns the killers name

small current
#

i only add and remove

#

in the code i sent

trim creek
#

i mean killer.getName

#

it should return the name of the murderer

wet breach
#

Killer from the method constructor of void play() is not accessible to your run method

small current
#

countdown.put(killer.getName(), 5);

#

i have this

wet breach
#

because run is inside the bukkitrunnable anonymous class

small current
#

so this should work?

#
  • an offline check
pine island
wet breach
#

do you not know what an anonymous class is?

small current
#

no i don't

wet breach
#

alright, they are handy, but when it comes to accessing stuff outside of it, they are limited

tardy delta
#

a class in disguise

wet breach
#

your problem is that it isn't able to obtain the reference of killer

small current
#

the code is so shit i have to fix it i don't even need the hashmap i can just put the int inside the class

small current
#

what should i do

#

killer.getLocation()

#

how can i access this

#

inside the class

#

i could get rid of the killerName

wet breach
#

make a static variable to hold killer above BukkitRunnable or don't use an anonymous class

small current
#

will a bukkitscheduler work?

#

the lambda stuff

wet breach
#

you could just make a proper class or proper inner class instead

#

and pass it that way

small current
#

like this? and in the init args

#

the killer object

wet breach
#

not even close lol

small current
#

:c

wet breach
#

just make a class that implements runnable, and pass that class object to bukkitrunnable

small current
#

that looks like an inner class to me

tardy delta
#

bukkitscheduler where

wet breach
#

pass your variable for killer to that runnable class

small current
wet breach
#

wouldn't make it static

small current
twin venture
wet breach
#

it could be static, but probably really don't want it to be since you want multiple tasks

small current
#

so how can i cancel the task inside the runnable

wet breach
#

cancel()

small current
#

its a runnable class

#

not bukkitrunnable

#

should i extend bukkitrunnable

wet breach
#

you can cancel runnables

small current
wet breach
#

bukkitrunnable extends runnable

chrome beacon
#

A Runnable is a functional interface containing a single run method

small current
#

so should i extend the bukkitrunnable class

chrome beacon
#

Yeah

small current
#

i could do this but deprecated

#

couldn't i just new Task(killer).runTaskTimer

chrome beacon
#

^ Do that

small current
#

thanks

#

there is another issue

#

i have a player data thing

#

i initialize it on join

#

and destroy it on quit

#

for each player

twin venture
#

ok there is some advancment here :

small current
#

but somehow the return value of the player data on player damage is null

twin venture
#

how i can change it to preview-location xd?

small current
#

afk

twin venture
#

is it possible xd?

tardy delta
twin venture
#

what do you mean?

#

oh i removed that

tardy delta
#

create the inner file and if it doesnt exist call file::mkDirs

#

and file::createNewFile

twin venture
#

this is the new method

#

that saved the location

tardy delta
#

so it works?

twin venture
#

but there is a bit of problem xd

#

it save it to :

delicate lynx
#

just make a JSONObject?

twin venture
#

i want it to be saved to "preview-location"

tardy delta
#

do your fancy annotation?

twin venture
#

so if i want to make it preview-location i need to do it like this :

#

right xD?

tardy delta
#

just put the annotation above ur location field that says how to name it?

twin venture
#

iam already doing that ,-,

tardy delta
#

u sure u removed the prev json file so it doesnt get written again?

twin venture
tardy delta
#

thats not how it works

#

register a typeAdapter thro your gson builder

twin venture
#

do i really need to do that ..?

tardy delta
#

yes

#

and the type adapter handles the serializing and deserializing

twin venture
#

you mean this

tardy delta
#

when serializing or deserializing a custom class, it checks if a typeadapter is present or otherwise tries to (de)serialize it themselves

elfin atlas
#

Is there a way to play custom playsounds?

remote swallow
#

you need break;'s probably

winged ridge
#

How to prevent falling blocks from becoming solids when touching ground

rough drift
#

there was an event for that

#

I forgot the name

winged ridge
# rough drift there was an event for that

this is what I have java @EventHandler(priority=EventPriority.LOWEST) public void onFallingBlockLand(EntityChangeBlockEvent event) { Entity ent = event.getEntity(); if (event.getEntityType() == EntityType.FALLING_BLOCK) { event.setCancelled(true); } }

#

but it just makes the block dissapear

rough drift
#

Try setting the priority to highest

#

btw, what java version can I use for 1.19.2+ plugins?

winged ridge
#

yeah it doesn't

tardy delta
#

@twin venture dont dm send it here

elfin atlas
#

2 Questions: 1. Is there a way to stop that Zombies are dying from the sun? 2. How can I'll add a Zombie a head

pine island
#

this isnt the correct way to compare lore right-?

eternal night
#

it isn't

eternal night
#

but comparing lore is already always kind of not good

elfin atlas
pine island
eternal night
#

Well lore comparison usually is for "hey I want to know if this item is my custom item"

#

which

#

use PDC instead

pine island
pine island
eternal night
#

?pdc

pine island
#

aight ty

#

im on 1.8 🤡

eternal night
#

🤡 indeed

pine island
#

i mean

#

i prefer it

eternal night
#

there is NBT-API which iirc has support in 1.8

#

which you can use instead

#

just

ancient plank
#

nbt API 😩

eternal night
#

yea

#

suffering

pine island
#

ughhh cant i just compare lore this is sm work for a private plugin

eternal night
#

I mean sure

#

its a list of strings

#

if you want to know if it contains another specific string

#

there is the .contains method

pine island
#

use the contains method got it

eternal night
#

just don't cry about when you want to change the item lore

#

and all your legacy items no longer work

pine island
#

its fine ill refactor it i guess 💀

vocal cloud
#

1.8 players just can't figure out how to delete the decimal to get to 1.18

elfin atlas
#

Second question how can I set a Zombie a helmet?

vocal cloud
#

?jd-s

undone axleBOT
ancient plank
craggy ermine
#

Guys, I need a very good anti xray plugin

river oracle
#

how do you prevent a players fall damage when teleporting them

#

right now its still being preserved

#

I tried doing Player#setVelocity

#

to all 0's but it didn't do anything

#
    public boolean teleport(Player player) {
        final Optional<Location> location = getLocation();
        if (location.isPresent() && getCharge() > 0) {
            Location loc = location.get().clone();
            player.setVelocity(new Vector(0, 0, 0)); // still keeps fall damage
            player.teleport(loc);
            player.getWorld().playSound(loc, Sound.BLOCK_RESPAWN_ANCHOR_DEPLETE, 1, 1);
            setCharge(getCharge() - 1);
            return true;
        }
        player.getWorld().playSound(player.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 1.0f);
        return false;
    }
            final String worldName = locationArray[0];
            final double x = Double.parseDouble(locationArray[1]);
            final double y = Double.parseDouble(locationArray[2]);
            final double z = Double.parseDouble(locationArray[3]);
            return Optional
                    .of(new Location(TeleportersAddition.getPlugin().getServer().getWorld(worldName), x, y, z));

Whats even more confusing to me is I'm building the location from cordinates

#

don't mind the awful code I'm sorry :*(

tender shard
#

in fact you don'T even need a set, you can just use a field

#

Player currentlyTeleportedPlayer = null;

#

then set it to some player on teleport, in the event check if the currentlyTeleportedPlayer is null, if not cancel event

#

then set it to null again

river oracle
tender shard
#

don't even need to make it a Player

#

boolean someoneIsBeingTeleported = false;

river oracle
#

is hashset O(n) for checking contains

tender shard
#

why not just use a boolean

#

you can never teleport more than one player at once

#

only one after the other

river oracle
#

the class the teleport method is in a wrapper object

twin venture
tender shard
#
private boolean someoneIsTeleporting = false;

public void teleportSomeone(Player player) {
  someoneIsTeleporting = true;
  player.teleport(...);
  someoneIsTeleporting = false;
}

@EventHandler
public void onDamage(PlayerDamageEvent event) {
  if(someoneIsTeleporting) event.setCancelled(true);
}

@river oracle

#

this should always work

river oracle
#

so I can let this object be GC'd

tender shard
#

what's wrong with the code I sent? I mean you do call .teleport on a bukkit Player object, right?

tardy delta
river oracle
twin venture
river oracle
#

I don't see how I could get the boolean working tbh hashset will be easier impl wise

tender shard
twin venture
#

i sent you the 2 classes , i found them on google , and it didn't work

twin venture
tender shard
river oracle
river oracle
#

I'm interested in the impl

#

?paste

undone axleBOT
tender shard
#

one sec

#

On average, the contains() of HashSet runs in O(1) time. Getting the object's bucket location is a constant time operation. Taking into account possible collisions, the lookup time may rise to log(n) because the internal bucket structure is a TreeMap.

tardy delta
#

add it as a typeadapter and let gson take care of it

#

sec

glossy venture
tender shard
#

anyway, TLDR:
contains() in a Set is usually faster while add in a Set is usually slower

loud frost
glossy venture
#

which is best case O(1) if there are no collisions

#

it performs some math to estimate the bucket the data will be in

#

i think

tender shard
#

but tbh who cares about what's faster? You will never have more than 100 players in your list or set 😄

glossy venture
#

i care

tender shard
#

I wouldnt spend a second thinking about it, I would have just used a Set

tender shard
#

that's ofc a valid reason

tender shard
rotund ravine
tender shard
river oracle
#

^

twin venture
river oracle
#

No point in a lot of premature optimization

tender shard
#

nobody cares if your operation took 2ns or 9ns if the server still has 295172285ns leftover in this tick

rotund ravine
#

Write it like an essay

loud frost
#

using a table vs a list is not a time consuming thing, its good practice

tender shard
#

I would simply think "Do I ever need to keep an order or want to have one element in this more than once?" If yes, Set, if no, List

#

erm

#

other way around

#

obviously

#

lol

glossy venture
#

if you can always try to write it to be as fast as possible otherwise changing it later will take more time than if you did it initially

#

thats what i follow

#

if you decide to use a map vs a list later you gotta change names and shit

tender shard
#

depends. if you simply say it's a Collection<Player>, then all you have to change is new HashSet<>() to new ArrayList<>()

tardy delta
#

just doing GSON gson = GsonBuilder.newBuilder().registerTypeAdapter(Location.class, new LocationTypeAdapter()).build() or smth

glossy venture
#

right

glossy venture
#

oh

tender shard
#

what you cannot do is to insert at certain index or something

glossy venture
#

oh yeah you cant just get an element

#

in a collection

tender shard
#

yeah, it doesn't have get(0)

glossy venture
#

but a map is not a collection

rotund ravine
#

HashSet has no index either

tender shard
#

that's true, a map is not a collection

twin venture
tender shard
#

but why would they need a map? all they want to know is whether this player needs to get fall damage cancelled

glossy venture
#

hashset is backed by a map

tender shard
#

yeah but it doesnt expose it

glossy venture
#

and we generalized the conversation to optimization in general

tardy delta
rotund ravine
glossy venture
#

generalized is that a word

tardy delta
#

you removed the old entry so it gets overwritten?

tender shard
#

yeah okay but I was just talking about this case

#

In this case, it doesn't matter at all whether they use a list or set

rotund ravine
glossy venture
#

though if they do it every time someone takes damage

tender shard
#

they could ofc also check if it's fall damage before checking the collection

glossy venture
#

which might be multiple people multiple times per tick

rotund ravine
#

Luckily damage is not playermove

tender shard
#

or, as I suggested, simply use a boolean 😄

twin venture
glossy venture
tender shard
#

it can never happen that two players take damage at the exact same time

glossy venture
#

multiple players can take damage in one tick yeah

tender shard
#

unless people run of those weird forks that promise to make the main thread "async"

rotund ravine
tender shard
twin venture
river oracle
#

It doesn't matter what he reccomended I ended up going with a hashset anyways lol but yea the boolean would work

rotund ravine
#

Teleport does not cause the fall damage that is done a tick after when it has computed it

tender shard
#
  1. I set the boolean to true
  2. I teleport a player
  3. The event gets called
  4. I check if it's true, then cancel
  5. I set it to false again

and only now can this happen for another player, the boolean is already false again

#

this will always work

glossy venture
#

a tick later means there is enough time for more players to be tped

#

id use hash set i dont think you can guarentee order and amount

rotund ravine
#

Yeah

twin venture
rotund ravine
#

Teleport != damage

glossy venture
tender shard
#

well then the boolean won't work ofc

glossy venture
#

you cant ensure order

twin venture
tender shard
#

if it would happen the same tick, a boolean would be enough

glossy venture
#
start tick
Player1 tped
Player2 tped
Player1 takes dmg
Player2 takes dmg
tender shard
#

well @river oracle can't you just call player.setFallDistance(0.0F) before calling teleport?

rotund ravine
#

Most likely

glossy venture
#

yes

tender shard
#

then just do that

rotund ravine
#

Or set their velocity to 0

glossy venture
#

velocity doesnt matter

#

in fall damage

tender shard
#

they already tried setting the velocity

rotund ravine
#

Oh i see, been a while

glossy venture
#

or item click

#

whatever

river oracle
#

I was looking for something like this