#help-development

1 messages · Page 1536 of 1

fiery inlet
#

90.000

quaint mantle
#

use 90001

fiery inlet
#

it outputs the same doesnt it

tardy delta
#

90_000???

quaint mantle
#

90_000 is not int

#

i think

fiery inlet
#

then why does it take it

#

im pretty sure its a java function lol

#

to split numbers

quaint mantle
#

wtf

#

that's strange

fiery inlet
#

so it looks good

#

like 90.000

quasi flint
#

90_000 is a string I would asume

fiery inlet
#
int prizeWinnings = new Random().nextInt(90_000);
#

no errors

#

it takes it in

tardy delta
#

my vault depositit method doesnt work either

fiery inlet
#

so its an integer

tardy delta
#

never looked at it lol

quaint mantle
fiery inlet
#

lemme try it

quaint mantle
#

AHHAHAH

#

that won't be works

#

100%

tardy delta
#

why even coming to that idea :/

fiery inlet
#

im pretty sure it will

#

starting server

#

lets see

quaint mantle
#

and there is a random between 0 and 89.999

fiery inlet
#

where does the compile maven function go to lol

#

nvm ima use package

#

erm

#
public Economy eco;

    @Override
    public void onEnable() {
        // Plugin startup logic

        if (!setupEconomy()) {
            System.out.println("This plugin requires Vault & Economy plugin.");
            getServer().getPluginManager().disablePlugin(this);
        }
    }
#

it disables and i have vault and essentials

#

dafuq

#

and yes it prints that

#
private boolean setupEconomy(){
        RegisteredServiceProvider<Economy> economy =
                getServer().
                getServicesManager().
                getRegistration(net.milkbowl.vault.economy.Economy.class); // Checks for Vault
        if (eco != null)
            eco = economy.getProvider();
        return (eco != null);
    }
hybrid spoke
#

is your plugin loaded before or after vault?

tardy delta
#

did you depend it?

quaint mantle
#

did you reload maven?

fiery inlet
#

aha ofcourse it loads vault and essentials right after

#

how to fix

hybrid spoke
#

add it as a dependency

undone axleBOT
crude charm
#

?paste

fiery inlet
#
name: DevTool
version: ${project.version}
main: me.barry.devtool.devtool.DevTool
api-version: 1.16
depend: [ Vault ]
authors: [ barry ]
#

it is dependency

hybrid spoke
#

in your plugin.yml

fiery inlet
#

it is

#

right there

crude charm
tardy delta
fiery inlet
#

does it have to not be capital letters or something small like that lol

tardy delta
#

just like this depend: [Vault]

fiery inlet
#

maven literally did that for me

#

i didnt write it

quaint mantle
hybrid spoke
#

in your case softdepend would be enough

crude charm
#

or this

depend: 
  - Vault
fiery inlet
#

ima try

fiery inlet
#

no it still doesnt work

#
[12:05:25] [Server thread/INFO]: [DevTool] Enabling DevTool v1.0-SNAPSHOT
[12:05:25] [Server thread/INFO]: This plugin requires Vault & Economy plugin.
[12:05:25] [Server thread/INFO]: [DevTool] Disabling DevTool v1.0-SNAPSHOT
quaint mantle
tardy delta
#

maven

quaint mantle
#

IDE

dusty herald
#

😂

tardy delta
#

oh

#

intellij

quaint mantle
#

strange

tardy delta
#

happened when i use this

/**
     * Clean up any left over lock data that is no longer valid.
     *
     * @param event
     */
    @EventHandler
    public void onChunkUnload(ChunkUnloadEvent event){

        PersistentDataContainer container = event.getChunk().getPersistentDataContainer();
        BlockState blockState;

        for (NamespacedKey key : container.getKeys()) {
            if (key.getNamespace().equalsIgnoreCase(Main.getInstance().getName())) {

                String[] data = key.getKey().split("_");
                if (data.length != 3) continue;

                blockState = event.getChunk().getBlock(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])).getState();

                if (!(blockState instanceof TileState || blockState instanceof Lockable || blockState.getBlockData() instanceof Openable)) {
                    Main.getInstance().getLogger().warning(String.format("Unknown Lock removed! %s.", key.getKey()));
                    container.remove(key);
                }
            }
        }
    }
#

ah maybe ?paste was better but yea

quaint mantle
#

?paste

undone axleBOT
tardy delta
#

smh

quaint mantle
#

hm

fiery inlet
#

it enables vault before my plugin now

#

but it still disables

dusty herald
#

have you tried checking the local variable to see if it is null?

crude charm
fiery inlet
#

wat

#

oh i fucked up

#

think i fixed it

tardy delta
#

i think it works now

fiery inlet
#

not really

#

well the vault problem is fixed

#

now it doesnt do anything when i jump xd

#

does absolutely nothing

tardy delta
#

nice debug 👌

earnest sonnet
weary geyser
#

How would you turn a EntityCreature into a Bukkit Entity?

fiery inlet
crude charm
#

it works for everything else

fiery inlet
#

it doesnt even broadcast that though

#
this.getServer().getPluginManager().registerEvents(new JumpEvent(this), this);

this is the right way to register an event right? or am i going nuts

eternal oxide
#

correct

fiery inlet
#

then why doesnt it work lol

#

paper server

#

paper api

#

jump event

eternal oxide
#

implement Listener and annotated?

fiery inlet
#

annotated?

#

listener yes, annotated?

eternal oxide
#

This is Spigot not paper

fiery inlet
#

well i needed the paper for jump

tardy delta
#

wtf still nullpointers

summer scroll
tardy delta
#

i get a nullpointer at this line :/
p.sendMessage(ChatColor.RED + "This block is already locked!");

fiery inlet
tardy delta
#

event.getPlayer()

#

how can that be null

eternal oxide
#

then thats not the line thats null

weary geyser
#

ElgarL

#

Are you good with NMS

eternal oxide
#

Not used it much

fiery inlet
#

the 90_000 works fine

eternal oxide
#

There should be a getBukkitEntity() method

weary geyser
eternal oxide
#

yes

weary geyser
#

How would you do that? Just cast?

eternal oxide
#

the CraftEntity is just the implementation version of Entity

weary geyser
#

So that means that you can cast it

#

Gotcha

#

Waiot

#

Aha

#

You don't need to cast

hybrid spoke
#

you probably dont have to

weary geyser
#

I understand now

#

Yeah it implements it

tardy delta
#

not understanding why

#

[12:28:48] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to MagmaBuildNetwork v1.0
org.bukkit.event.EventException: null

summer scroll
#

full stacktrace please

#

?paste

undone axleBOT
tardy delta
summer scroll
#

LockListener.java:46 show line 46

fiery inlet
summer scroll
#

okay, full code

fiery inlet
#

fml

tardy delta
#

i changed it so let me try again

fiery inlet
#

how do you guys suppose i would format a number with . and ,

summer scroll
fiery inlet
#

ok ty

eternal oxide
tardy delta
#

ah found it

summer scroll
#

oh, that's very useful

fiery inlet
#

does it have to be a double

#

or can numberformat work with ints too

#

ahh it works

#

ty elgar

smoky finch
#

How do you convert a raw slot position to separate x y positions in a chest inventory?
My math is a little f'd up.
For example let's say I have the raw slot pos 12 the x y should be x: 4, y: 2

earnest sonnet
#

Top to bottom Y dimension, left to right X dimension, though you need to pre-assigned those values somewhere I guess? Something like a grid? and uhm, start from 0 x and y can be 0 too

smoky finch
#

Why'd you need to pre assign them? I already made an algorithm to convert x y positions to raw slots, so it's definitely possible to convert them back.

fiery inlet
#

just revert that function then

#

math

#

send the function

#

lemme try revert it

#

reverse*

smoky finch
#

You mean calculate the inverse function?

fiery inlet
#

yeah basically

slim kernel
#

Hello! I am letting a FallingBlock float up with setting the Velocity. Can I somehow stop the block when he is 20 blocks above the starting point?

smoky finch
#

Not sure how it's done.

slim kernel
fiery inlet
smoky finch
#

ah, yes that looks similar

#

I don't know why you made the i variable tho

#

Thanks anyways!

earnest sonnet
fiery inlet
#

you can remove it if u want

#

and just do x

#

just to do the same on both sides

smoky finch
#

wait hold on

#

You got this wrong

#

You got the exact opposite of what I'm trying to do.

#

I want to convert raw position to x y

fiery inlet
#

im not that mathematically genius

earnest sonnet
#

Alright, so I guess you can take the clicked slot and do the / 9 and then take the reminder and multiple it with the reminder that you got from the clicked slot

eternal oxide
earnest sonnet
#

e.g: for a chest with 62 slot, we pick a random number let's say 30, we do 30 / 9 = 3.3, which means it's on the fourth line and then we do 3 * 9 which is 27 and then 30 - 27

earnest sonnet
fiery inlet
#

whats the % on a calc

eternal oxide
#

modulo

earnest sonnet
#

the remainder basically

fiery inlet
#

i know

#

found it on calc

dusk flicker
#

modulo is the best

smoky finch
tardy delta
#

when is the chunkUnloadEvent called?

#

just when a chunk unloads? and when is that

quaint mantle
#

hey guys ! anybody who knows about Gson ?

I've supposedly created a TypeAdapter for Vectors (a writer and reader that write vector to string and return a vector when read).

  1. I'm not sure if that's all I need to do or if I need to create a custom "serializer/deserializer" ?
  2. What I actually want to json write and turn back in is actually a Map<UUID,Collection<Vector>>. I think gson is able to handle Map and UUID, like it has premade function, so is it possible for me to use them and only "provide" my Vector adapter ?

Many thanks !

tardy delta
#

the bible 🙏

eternal oxide
tardy delta
#

elgar i got an error when trying to use your onChunkUnload method

eternal oxide
#

what error?

tardy delta
quaint mantle
tardy delta
#

line 71 is this

 blockState = event.getChunk().getBlock(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])).getState();
quaint mantle
#

Maybe I could try this tho but does it works with Map?

#

sorry I'm big noob

eternal oxide
quaint mantle
#

Hmm right, maybe I can turn the UUID to string easily, but what about the Collection<Vector> ? will it handle it ?

quaint mantle
#

Ok I will try it then, thank you

tardy delta
#

np

wraith rapids
#

don't divide, use a bitmask

eternal oxide
#

yep

tardy delta
#

it says it requires a number from 0 to 15

wraith rapids
#

or, well, floor the double and then use a bitmask

tardy delta
#

these are just coordinates right?

eternal oxide
#

yes, it has to be converted from a world coord to a chunk coord

tardy delta
#

ow these are chunk coordinates

eternal oxide
#

actually we can just use mod 16

tardy delta
#

ki

wraith rapids
#

that is slightly different

#

will not work with negative values

eternal oxide
#

um, true

wraith rapids
#

you need to take the world coordinate and separate the in-chunk block coordinate from the chunk coordinate

#

the easiest way to do that is a bitmask

#

you can also do some math with divides and floors and shit but a bitmask is easiest and anyone who has done similar logic before will understand it better

tardy delta
#

idk what a bitmask even is smh

wraith rapids
#

int block = world & 0b1111

tardy delta
#

ah with bitwise operators

#

never used

hushed lantern
#

I am working with IntelliJ in a Java project and I need firebase (i already added the firebase API). I found this code on the Internet:

#

FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://databaseName.firebaseio.com")
.build();
FirebaseApp.initializeApp(options);

#

But it didn't work because it threw me an error for FileInputStream, for .fromStream, and for InitializeApp. I don't know how to fix the problems and I can't find good documentation or tutorial that can teach me how to use firebase in Java. Please help me how to connect firebase project to my Java project.

My code: https://i.stack.imgur.com/CvK0o.png

eternal oxide
#

that shoudl be 0b1111

#

4 1's

wraith rapids
#

it is

#

or am i blind

eternal oxide
#

blockState = event.getChunk().getBlock(Integer.valueOf(data[0]) & 0b1111, Integer.valueOf(data[1]), Integer.valueOf(data[2]) & 0b1111).getState();

tardy delta
#

uhh

#

i'll try

chrome beacon
#

Actually nvm

tardy delta
#

not understanding but thats something else

eternal oxide
#

Its a bitmask, basically it tells the value to ignore all bits except the minor 4

chrome beacon
undone axleBOT
wraith rapids
#
int blockMask  = 0b00000000000000000000000000001111
int chunkMask  = 0b00000000000000000000000111110000
int regionMask = 0b11111111111111111111111000000000
#

of the 32 bit coordinate, the lowest 4 bits represent the in-chunk coordinate

#

an unsigned value from 0 to 15

#

the next 5 bits represent the chunk coordinate in the region

#

an unsigned value from 0 to 31

#

the rest of the bits represent the coordinate of the region itself

#

for example, take the coordinate 625

#

which in binary is 0000001001110001

#

the last 4 bits, 0001 represent the block location

#

0001 is 1

eternal oxide
#

so a mask of 0x0F

wraith rapids
#

the chunk location is represented by the next 5 bits

#

00111

#

00111 is 1 + 2 + 4 which is 7

#

and the region's location is the remaining bits, 0000001

#

and 1 is again 1

#

so, the coordinate 625 is located in region 1, chunk 7, block 1

lilac dagger
#

what do they mean by Mask?

wraith rapids
#

they mask a value

#

exposing or hiding parts of it

#

something & 0b1111 hides, or masks, everything except the last 4 bits of something

eternal oxide
#

any bit set will allow that relative bit to be counted

lilac dagger
#

oh

eternal oxide
#

any 0 blocks it

lilac dagger
#

it changes the bits by applying some sort of stencil

#

so a mask

wraith rapids
#

sort of yes

lilac dagger
#

i get it

wraith rapids
#

it's a bit-wise and operation

eternal oxide
#

so 0b1111 or 0x0F only counts the last 4 bits

wraith rapids
#

each individual bit is tested for "are both of the bits true"

#

so when you give it a value where only the last 4 bits are true, no other bits can pass the test

hushed lantern
# chrome beacon What error

Errors: FileInputStream: Unhandled exception: java.io.FileNotFoundException Error 2: .fromStream: Unhandled exception: java.io.IOException Error3: .initilializeApp: Cannot resolve Symbol

wraith rapids
#
  11010
& 01111
= 01010
#

and conversely

  11010
| 01111
= 11111
#

and with xor

  11010
^ 01111
= 10101
tardy delta
hushed lantern
wraith rapids
#

integer.valueof returns an Integer

#

which gets unboxed into an int

#

which is redundant

#

use parseInt which returns an int directly

tardy delta
#

but when is chunkUnload called?

ivory sleet
#

Assumably when the chunk is unloading or post that

wraith rapids
#

before it

#

the chunk loading and unloading going under the hood is kinda weird now

#

mojang has like load and ticket levels and shit representing different states of being loaded and ticked

ivory sleet
#

Myeah not my expertise. Oh lol

wraith rapids
#

the api, in typical bukkit fashion, of course reflects absolutely none of this

ivory sleet
#

🥴

wraith rapids
#

the chunk will still be in memory and probably will still be loaded for a few seconds to a minute when the unload event fires

tardy delta
ivory sleet
#

Oh fr, but then it wouldn’t require a load during that time?

wraith rapids
#

it's in memory somewhere in the actual nms

#

just the bukkit api considers it unloaded

ivory sleet
#

Ah fair

wraith rapids
#

because its load level is lower than full, or something

#

but, it's still there, and can even still be ticking

#

and can still contain entities that are not invalid or unloaded

#

that will show up in world.getentities

ivory sleet
#

Oof

wraith rapids
#

it's a mess

ivory sleet
#

Not documented in javadocs I suppose also

wraith rapids
#

as if anybody updated the javadocs whenever mojang pulls something like this

maiden briar
#

Is Bukkit's ConsoleCommandSender the same as Bukkit.getLogger() when you want to send messages? Or is it something else

ivory sleet
#

No

chrome beacon
ivory sleet
#

Bukkit#getLogger gives you a java logger I believe which is used to log stuff

maiden briar
#

Yes I understand the purpose of loggers

ivory sleet
#

Like logging things on different levels, logging async or flushing it to something

maiden briar
#

And what is ConsoleCommandSender then?

hardy swan
#

Colorful loggers

ivory sleet
#

Just an abstraction of System.out.println essentially lol

maiden briar
#

Srs? Never knew that

ivory sleet
#

But almost

maiden briar
#

Haha ok, but you can send colorized messages to it?

ivory sleet
#

Yup

maiden briar
#

Also with & colors if you translate them?

ivory sleet
#

Yeah

maiden briar
#

Nice!

slim kernel
#

Hello! I am letting a FallingBlock float up with setting the Velocity. Can I somehow stop the block when he is 20 blocks above the starting point?

wraith rapids
#

you can send colored messages with the loggers as well

hardy swan
#

Any character you like tbh

wraith rapids
#

it's just slightly more involved

#

and preferred

maiden briar
#

Ok

wraith rapids
#

using the console command sender as a logger is fucking retarded

tardy delta
#

Bukkit.getConsoleSender().sendMessage("[" + ChatColor.RED + bla bla bla

wraith rapids
#

it will respect zero of the end user's logging configuration

maiden briar
#

Nice

chrome beacon
ivory sleet
#

Yeah but ofc doing color shit requires ur console prompt to support colors

maiden briar
slim kernel
wraith rapids
#

store the specific height and compare

slim kernel
#

should I make a scheduler and check everytime if its there already?

chrome beacon
#

^ and since it's moving you might have to use the scheduler

slim kernel
#

oh okay haha

quaint mantle
#

Guys can someone help me with using ConfigurationSerializable, i dont understand and the doc doesnt help me

opal juniper
#

Do you know what serialisation is

quaint mantle
#
    public void onDisable() {

        Map<UUID, Collection<Vector>> classmapp = Territory.getAllTerritories().asMap();
        Map<String , Collection<Vector>> newMap = new HashMap<String, Collection<Vector>>();

        for(Map.Entry<UUID, Collection<Vector>> entry : classmapp.entrySet()) {
            newMap.put((entry.getKey().toString()), entry.getValue());
        }
        ConfigurationSerialization.registerClass(newMap.getClass());```
#

yea

#

this may look dumb atm

opal juniper
#

what are you trying to do

quaint mantle
#

but I'm trying to convert my map into a Map<String, Collection<Vector> because ConfigurationSer handle only map<String,Object> as far as I understood

#

I want to store this map into file

#

I also saw that you must register the class or something that's what im trying to do last line

opal juniper
#

Right, ok i am really not the person to help with this

slim kernel
quaint mantle
#

😦

opal juniper
#

I am not completely familiar with this

wraith rapids
#

don't use the config api as a store-random-shit api

quaint mantle
#

yea it's understandable, kinda tricky

#

I tried using Gson but apparently this bukkit ConfigSer handle Vectors already so..

#

might try back with gson

slim kernel
#

can I somehow delete a falling block?

eternal oxide
#

its an entity, remove it

slim kernel
#

okay

severe zenith
#

is it possible to access the loaded class from the bungeecord plugins in a spigot plugin?

earnest sonnet
#

with reflection I think it's doable

severe zenith
#

ok and is it possible to hide players with bungeecord or only with spigot plugins?

timid kestrel
slim kernel
#

why does my falling block get spawned not exactly in the location? It gets spawned a little bit off everytime..

FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(location, Material.GRAY_CONCRETE_POWDER.createBlockData());
timid kestrel
slim kernel
#
Location location = block.getLocation();
#

thats the location

timid kestrel
#

print it out and double check it 😉

slim kernel
#

okay wait

#

its .0 on Y Z and X

timid kestrel
#

Then I'm not sure 😄 possibly a momentum thing being set somewhere?

slim kernel
#

yes velocity but only to the same position but y + 20

#

fixed it haha

#

thank you tho

wraith rapids
#

the center of a block is at 0.5

#

Block::getLocation returns the location of the bottom-north-east corner of the block

slim kernel
#

okay thank you

quaint mantle
#

Hi, I am working on a Minecraft plugin in a Maven project. I have to use Firebase because I need to fetch data from there and send data to there. Now I don't even know how to connect to my database (I already implemented the firebase API to my pom.xml). I didn't find any kind of documentation or tutorial that can help me. Can somebody send a link to a doc or to a tutorial that can be useful?

maiden briar
#

Bungee PlayerJoinEvent ?

smoky oak
#

An exception occurred while getting the Javadoc
--> Unknown Javadoc Format for...

delicate fractal
#

is it possible to make so when i go spectator mode if u do tab that u can see my name normaly
cuz when i go on my server and do spectator mode to see if people hacking everyone is like oh nice spec mode

smoky oak
#

cant you plug in essentials and /vanish

#

leave an alt account online

#

in vanish

hybrid spoke
delicate fractal
#

how do u do a custom spec m ode

earnest sonnet
wraith rapids
#

Player::hidePlayer hides the player and shouldn't send any packets pertaining to the hidden player

#

at least it does on paper, dunno bout splögget

hybrid spoke
delicate fractal
#

ye but when i completely hide myself they also get angry lol 😦

smoky oak
#

Just hide an alt account

delicate fractal
#

so thats not an option

#

i dont have a alt:(

#

im broke

hybrid spoke
#

make the naruto and send the user 2000 fake players

#

so they would not mind you

delicate fractal
#

lol how

smoky oak
#

Anyone knows how to check if the config.yml differs from the baked in config?

earnest sonnet
hybrid spoke
smoky oak
#

wont help because it can be changed

#

i want to know if edits were made to it

hybrid spoke
#

ah, just compare the values

smoky oak
#

?

#

you mean like last read/write?

hybrid spoke
#

compare the content of the configs

smoky oak
#

ah

hybrid spoke
#

or check the file size

onyx shale
#

the real question is why?

smoky oak
#

tldr i need the config present but I have to edit it often. I don't want to delete the file every time i build the plugin

#

but i also want to avoid a delete and save of the default config to spare the drive

onyx shale
#

why arent you just adding defaults?

#

config.options.copydefautls

#

add the new config options

#

to alrdy existing oe

smoky oak
#

whats the code for that?

onyx shale
#

getConfig().options().copyDefaults(true);

smoky oak
#

that works even if the values are changed in the config in the plugin folder?

onyx shale
#

shouldnt update alrdy existing entrys

smoky oak
#

ye i need to do that

#

because its likely i get from listen:[stone] to something like listen:[stone, diorite] when adding more functionality

onyx shale
#

ahn then nvm

#

listen is a entry

quaint mantle
#

Hi friends ! so I have a Multimap<UUID,Vectors> that links and store user to vectors. But the problem is each time a player (me) disconnect and reconnect, it doesnt identify the UUID as the same although it identifies it as the same entry key ! I dont get it, isnt it supposed to be an unique UUID ?

onyx shale
#

meaning it wont update it if it alrdy exists

quaint mantle
#

can someone help please

smoky oak
#

ur in offline mode?

onyx shale
#

shouldnt matter,the uuid its rather obvious by the name unique

smoky oak
#

it changes if youre in offline mode

onyx shale
#

its created based on ur name

quaint mantle
#

wym oflline mode ?

onyx shale
#

after its always the same

smoky oak
#

server mode

gaunt relic
#

cracked

quaint mantle
#

hmm no server is normal idk lol

#

not cracked

onyx shale
#

also why exactly a multimap?

quaint mantle
#

Well because I need several Vectors associated to each players

#

it's was easier that way than iteratie through collection etc each time

tired nacelle
#

Hi my plugin throws this Could not pass event PlayerJoinEvent to SurvivalMultiplayer v1.0.0 org.bukkit.event.EventException: null should i use the async version of PlayerJoinEvent? (AsyncPlayerPreLoginEvent)

onyx shale
#

anyway the uuid should be the same no matter what

dusk flicker
#

Not the*

quaint mantle
#

I'll just throw you my code so u can see maybe what's wrong if u will because it's incomphrehensible

dusk flicker
#

It's a different event that does different stuff

gaunt relic
#

show us how you set the map

tired nacelle
quaint mantle
#

here is block event

#

I should have "you destroyed yr own block"

#

and it works well

#

untill I disconnect reconntec

#

actually there isnt any Gson thing unless I shut down the server, while here the problem happens only when I disconnect and works well before

#

so it's the exact same map

gaunt relic
quaint mantle
#

and onDisable it makes a conversion

gaunt relic
#

so you add players based on your saved data on enable

quaint mantle
#

yes, I reconstruct the Map if u will

gaunt relic
#

and not do anything that removes or adds elements to the map on join or leave

tired nacelle
#

i just noticed this huh Caused by: java.lang.IllegalArgumentException: Plugin already initialized!

quaint mantle
#

but the problems happens even when the map is empty, I start the server so it creates a null map. player will place a block which will put it into the Map

#

at this point everything works fine

#

they destroy the block and their UUID recognize em as the same

#

but IF I disconect (no restart), the UUID isnt recognized as the same anymore

#

So there isnt even a conversion Gson/Restart happening ! It's the exact same Map !

#

which is really weird

quaint mantle
#

I dont get it lol

smoky oak
#

the uuid OBJECT (UUID@<memory_address_here>) changes, the UUID doesn't.

#

Compare UUID as strings

#

@quaint mantle

quaint mantle
#

oh damn

#

it's the == thing then !

smoky oak
#

yes

#

well more like probably but i cant see any other probable cause

quaint mantle
#

yes I think you are right it makes sense if it changes

#

thanks a lot dude I'll try

noble spire
#

Can you manage the whitelist with spigot?

quaint mantle
smoky oak
#

@noble spire

  1. somehow get the player
  2. player.setWhitelisted(true);
noble spire
#

oh cheers

#

I was looking for a static method that makes sense

smoky oak
#

remember to activate/reload it

noble spire
#

wdym?

smoky oak
#

if you add a player to the whitelist theres a good chance he cant actually join

#

since the server still has the old whitelist loaded

#

Bukkit.setWhitelist(boolean active);
Bukkit.reloadWhitelist();

noble spire
#

ah okay thanks

smoky oak
#

np

noble spire
#

wait, what if the player isn't online

smoky oak
#

thats why i said 'somehow get player'

#

because if theres a white list

noble spire
#

ah, should I then manually edit the whitelist file and reload it?

smoky oak
#

thats an option too

#

alternatively

smoky oak
#

that doesnt work on never joined players

#

i think

#

ah that way around

noble spire
#

you sure?

smoky oak
#

name to uuid doesnt work

noble spire
#

no, but you can use mojang's api

smoky oak
#

true

#

still you somehow need to get that uuid

noble spire
#

like that

smoky oak
#

true

ivory sleet
#

just use Server#getOfflinePlayer(String)

#

?

smoky oak
#

high chance of not working correctly

ivory sleet
#

not true

noble spire
smoky oak
#

that

#

lemme try something

ivory sleet
#

yes its deprecated as a warning because it makes a request to mojang

#

not for removal or anything like that

noble spire
#

hmm, mojang's api is super easy to use tho

smoky oak
#

well you can just run /whitelist add <name> in console since... it does the same thing. grabs uuid and puts it in whitelist

ivory sleet
#

Server#getOfflinePlayer does the request for you and wraps the return with spigot api interface

smoky oak
#

why put it in a plugin in the first place?

noble spire
smoky oak
#

well to your original question, Yes, and depending on how secure you want it, its either very easy or a bit complex

hybrid spoke
noble spire
#

@NotNull

#

nope

ivory sleet
#

to that method an offline player object exist with every possible name

#

read the javadoc

hybrid spoke
#

oh offlineplayer

noble spire
smoky oak
#

yeah they should return a uuid

#

not sure on that one tho

hybrid spoke
smoky oak
#

ok

#

wait

ivory sleet
#

If you want only legal names, you'd have to check that yourself

smoky oak
#

whitelist command recognizes non existent players

noble spire
#

yeah, I'll just use the mojang api ig

hybrid spoke
#

it firstly searches through the cached player list inside the server and if he can't find a player with that name it requests the uuid from mojang

smoky oak
#

thats probably the reason why its deprecated because if the player was already on the server and names changed it returns the wrong uuid

ivory sleet
#

it uses the player name

hybrid spoke
#

would just run that method async since it can slow down the main thread

hybrid spoke
#

its deprecated because it requests to mojang as cloncure just said

ivory sleet
#

^

#

thats the sole reason

smoky oak
#

huh ok

#

also about that error are you perhaps running in offline mode?

noble spire
#

nope

ivory sleet
#

dont involve offline mode PES4_Cry

smoky oak
#

cuz the only responses the whitelist command gives me are either 'added <player> to whitelist' or 'that player doesnt exists'

ivory sleet
#

It might use the cache then

#

yeah very likely

hybrid spoke
#

i am not sure what whitelist add surely does

hybrid spoke
#

probably just iterating through the cached player list

#

so the player have to ping the server or have to try to connect to it to get cached

smoky oak
#

well for me i can add people that were never in any way connected to the server

#

tried bachibachi and it worked

ivory sleet
#

maybe it does make a request then 😮

noble spire
#

#general? This is getting a bit off topic

hybrid spoke
#

its not

noble spire
#

okay ¯_(ツ)_/¯

hybrid spoke
#

and even if its not prohibited

#

just if any1 asks a question here

#

while there is offtopic

smoky oak
#

maybe ur whitelist is corrupt

hybrid spoke
#

but

#

hm

smoky oak
#

its uuid and name

proud basin
#

How could I make a rectangle radius?

hybrid spoke
#

whitelists are weird

smoky oak
#

wat?

#

#general

hybrid spoke
hybrid spoke
proud basin
#

interesting

lusty cipher
#

JavaPlugin#getResource works with folders, right? E.g. lang/en.yml

sage swift
#

yes

#

but i would use File.separator

#

as it may vary

smoky oak
#

yeah that probably wont work on my server im running linux

sage swift
#

actually it usually has no issues but just in case

tall ridge
#

what wont work

lusty cipher
#

yes I was planning on doing Paths.get("lang", "en.yml") anyway, I guess that would work, right?

smoky oak
#

better

#

as for @tall ridge if a os uses a different internal file separator the File.separator grabs that but if it is defined with '/' it crashes

tall ridge
#

can you switch it to \?

smoky oak
#

same issue

#

for example windows would not register it as \

#

since the backslash is on windows the escape character

#

so you would use \ on some os, but on windows it needs to be \

#

see tried to do a double backslash there

lusty cipher
#

\\ on windows 👍

static ingot
#

I'm trying to fork Craftbukkit to make a contribution. All I've done is clone my fork from the stash and apply patches. Can anyone point me towards how to solve these pom.xml errors?

smoky oak
#

you need to have the craftbukkit api linked as well

quaint mantle
#
public class MainMenu{}

I am making this for inventory what will be after implements?

hybrid spoke
#

InventoryHolder

static ingot
quaint mantle
#
@Override
    public Inventory getInventory() {
        
        return null;
    }

I am not familiar with this :/ Inventory gui = Bukkit.createInventory(p, 27, color("&8&lGUI")); this is what I do

hybrid spoke
#

you return it over the method

quaint mantle
#

can i set custom hardness for block?

static ingot
#

lol, this channel's too active. i'll just make a thread

hybrid spoke
#

which is your inventory

quaint mantle
#

that's what I am making, a inventory

hybrid spoke
#

._.

quaint mantle
#

😕

eternal night
static ingot
#

I've done that already

eternal night
#

And change the remote of the created Bukkit and craftbukkit projects

hybrid spoke
#

@quaint mantle inform yourself about instance variables and you will understand it hopefully

eternal night
#

You might also just create a pom.xml file as a root

#

In which both Bukkit and craftbukkit are listed as modules

karmic grove
#

is there a listner for placeing blocks

hybrid spoke
#

BlockPlaceEvent

quaint mantle
#

hey whats the shortcut thing called in intellij settings > keymap for this?

#

like for the //

#

control + /

#

ty

quaint mantle
#

i just told them

hybrid spoke
#

yeah but

#

maybe he means

#

this formatting

quaint mantle
#

oh

hybrid spoke
#

if so, i would like to have that too

quaint mantle
static ingot
hybrid spoke
eternal night
#

Hmm just Google maven pom modules.

#

I am on mobile else I'd supply you my setup :(

static ingot
#

Alright, well much appreciated

quaint mantle
static ingot
#

I tried asking elsewhere as well, but it came to "Why not use paper" instead of actually pointing me towards anything.. xD

hybrid spoke
#

just like you did before

#

but just for this inventory

eternal night
#
<project>
  <modelVersion>4.0.0</modelVersion>
 
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1</version>
  <packaging>pom</packaging>
 
  <modules>
    <module>Bukkit</module>
<module>CraftBukkit</module>
  </modules>
</project>```
static ingot
#

Ohh, okay. That's really simple.

eternal night
#

Plug it into the root dir if your build tools

#

Change the group and artifact Id, doesn't matter what to

karmic grove
#

if i import bukkit listner will it work on spigot 🔰

hybrid spoke
#

spigot is a bukkit fork

static ingot
#

They use the same Listener, but there's no point in using Bukkit instead of Spigot really.

eternal night
#

Who actually used bukkit what

hybrid spoke
#

i think he got confused by the package name

eternal night
#

Ah XD yeah maybe

karmic grove
#

im watvcing a tuturial and hes using bukkit

hybrid spoke
karmic grove
#

why :/

#

hes a good one

quaint mantle
#

no its not if hes using bukkit

eternal night
#

What build/dependency management tool does it use

quaint mantle
#

@hybrid spoke

public class MainMenu implements InventoryHolder{

    public Inventory mainmenu;

    MainMenu(){
        Inventory main_menu = Bukkit.createInventory(Player, 54, color("&7gui"));
    }

    @Override
    public Inventory getInventory() {
        return mainmenu;
    }
    private String color(final String message) {
        return ChatColor.translateAlternateColorCodes('&', message);
    }
}

pls guide

karmic grove
#

event

hybrid spoke
quaint mantle
hybrid spoke
karmic grove
#

yes

hybrid spoke
#

on what side

#

bing?

karmic grove
quaint mantle
hybrid spoke
karmic grove
hybrid spoke
#

its spigot

quaint mantle
hybrid spoke
#

spigot is just a bukkit fork

#

so it uses the bukkit methods, classes, packages, humans, pets

smoky oak
#

is it the same with paper? Can't remember...

hybrid spoke
#

paper is a spigot fork

#

so its also a fork of bukkit

smoky oak
#

k. Are on spigot the elytra dupe and the book disconnect dupe fixed?

quaint mantle
karmic grove
#

becuz im new to java

smoky oak
#

to be fair javadocs are a bit hard to read

quaint mantle
#

so you cant read?

karmic grove
#

and eclipse and everything

hybrid spoke
smoky oak
#

oh right is there a 1.17-api-source.jar yet?

quaint mantle
smoky oak
#

where

quaint mantle
hybrid spoke
#

just like the name, lore etc

quaint mantle
#

okay

#

thanks

hybrid spoke
#

otherwise you can just add a new ItemStack(Material)

hybrid spoke
#

?jd

quaint mantle
#

google next time

#

how to create multiple configs?

granite trail
#

This was a question of me too

#

I never got a correct awnser. :c

smoky oak
#
    FileConfiguration config_players = null;/
    File config_players_file;
    File dataFolder = this.getDataFolder();

    public void savePlayerConfig() {
        try {config_players.save(new File(dataFolder, "config_players.yml"));
        } catch (IOException e) {
            this.getLogger().log(Level.SEVERE,"Could not save file 'config_players.yml' due to unexcepted error.\n"+e.getMessage());}}
    public void loadPlayerConfig() {config_players = YamlConfiguration.loadConfiguration(new File(dataFolder, "config_players.yml"));}
    public FileConfiguration getPlayerConfig() {return config_players;}
    public void setPlayerConfig(FileConfiguration p) {config_players = p;}```
#

@quaint mantle

granite trail
#

And how to get data from them? :D

smoky oak
#

just well grab it?

#

make the config static then you can access it from everywhere once its loaded

#

oh and public

granite trail
#

Ummmmm

#

'k''

karmic grove
#

import org.bukkit.plugin.java.JavaPlugin; why does this import not work "Description Resource Path Location Type
The import org.bukkit cannot be resolved event.java /pluginv2/src/pluginv2 line 2 Java Problem
"

smoky oak
#

are you building with the bukkit api?

karmic grove
#

i dont know what that means so no

smoky oak
#

you need to have the bukkit api in your build path for the ressources

#

ie methods

quaint mantle
#

screenshot the error, the stuff you copied makes little sense

#

and are you using maven or gradle, or just importing jars?

karmic grove
#

nvm dont worry about it

sage swift
smoky oak
#

err no

#

that are methods and variables i put in my main

hybrid spoke
#

?learnjava

undone axleBOT
hybrid spoke
#

^ @quaint mantle

quaint mantle
hybrid spoke
smoky oak
#

in your onEnable you put only loadPlayerConfig()

#

the other parts go around it

quaint mantle
#

cause how will the config load if its not in onEnable

smoky oak
#

load it with loadPlayerConfig() in onEnable but remember it assumes the config FILE exists

uncut osprey
#

hello i need help with SBAHypixelify as the shop is not working am i supposed to ask that here?

uncut osprey
#

ok

vital turret
#

Hey guys, is it better to store new instances in a HashMap, or it doesn't matter ?

        return new PlayerData(uuid);
    }
quaint mantle
#

How would I go about making something like this? https://i.imgur.com/xdjEz9x.gif
There are multiple different types of tnt along side regular tnt, and I cannot figure out to tell them apart so it would work when its stationary and launched

opal juniper
#

How to tell apart the different TNT’s?

quaint mantle
#

yes

#

how would I tell which one is which like if its launched from a tnt cannon for example

#

i tried using location but had that problem ^

onyx shale
opal juniper
#

I mean it would probs be a chain cause like

Item -> Block -> Entity -> Explosion

#

?pdc the entity

opal juniper
#

but you would need to listen for the block being placed

onyx shale
#

dispenser?

opal juniper
#

Different eventListener i guess

onyx shale
#

..

opal juniper
#

but still using the pdc

#

to mark it as a special tnt

#

and then onEntityExplosion just check the pdc

#

and apply the correct effects

quaint mantle
#

Hmm, okay. I’ll give that a try. Thank you

#

in SimplexOctaveGenerator#setWScale() wat is W-coordinate ?

quaint mantle
sage swift
sage swift
#

maybe highest, monitor only if needed

quaint mantle
#

ah, okay

sage swift
#

just make sure you ignoreCancelled

quaint mantle
#

4d in a 3d game ?

sage swift
#

lol idk what it is recar

#

and tbh you shouldnt use spigot's generator

quaint mantle
#

wow the speed of that reply, wat is ur wpm

sage swift
#

at least 4

quaint mantle
#

i think its more that lol

sage swift
#

my statement stands

quaint mantle
#

ok ty anyways

eternal oxide
#

Its only because he has 12 fingers.

quaint mantle
#

i c

quaint mantle
#

that explains alot lol

quaint mantle
sage swift
#

isnt that what you want

hybrid spoke
#

what are you trying

quaint mantle
#

i lit it with flint and steel

sage swift
#

is it a special block?

quaint mantle
#

dont think so, let me check

hybrid spoke
#

store the entity on interacting with tnt

sage swift
#

the gif doesnt really make sense

#

what are you trying to do

quaint mantle
#

Recreate the tnt

hybrid spoke
#

or i think there has to be an event for that

#

otherwise store that block on place and check if the tnt, which is getting activated, is this block

quaint mantle
#

am i missing something?

granite stirrup
#

I realised custom model data is only for items

#

Again

smoky oak
#

ur can custom model any non full block tho?

#

at least i remember a out of shape cake

granite stirrup
smoky oak
#

not sure

sage swift
#

you can use the unused mushrooms for special textures

#

very limiting

hybrid spoke
#

custommodeldata is for itemstacks

smoky oak
#

huh ok

sage swift
granite stirrup
#

I think there was something for blocks

hybrid spoke
#

not sure if blocks have an PDC

#

you could go over that

sage swift
#

they do not

hybrid spoke
#

and store the type of the tnt there

sage swift
#

best bet^

hybrid spoke
#

oh

#

than do it yourself

#

store the blocklocation somewhere

quaint mantle
#

the location wont work if the tnt is launched from a cannon tho

smoky oak
#

If i remember right you can put additional info into blocks but i cant tell you if its permanent

#

isnt it still an entity at that time?

sage swift
#

the block data i sent is your best bet, puyo

hybrid spoke
#

you just said smth from placing and lighting

#

not from shooting

smoky oak
#

not an issue

quaint mantle
#

I mentioned shooting in my original quesiton

smoky oak
#

grab the block where its placed and when its lit just keep track of the created tnt entity then do something when it explodes

quaint mantle
quaint mantle
granite stirrup
#

I think all blocks should be able to hold nbt

#

Lol

hybrid spoke
smoky oak
#

They probably can considering you can stuff chest nbt in a spawner and it still works

#

as a chest

granite stirrup
#

Lol what

sage swift
hybrid spoke
#

gotta check that too

sage swift
#

not the way to go

#

BlockPhysicsEvent is probably called on it

hybrid spoke
#

iirc there isn't an event which handles tnt lighting

granite stirrup
smoky oak
#

@quaint mantle the primeExplosionEvent triggers just before an explosion and there is no specific event for a tnt

#

however something worth looking into is entityspawning

#

and checking if its a tnt

#

problem is you dont get the block that way

opal juniper
#

EntityExplodeEvent

#

It is that

#

for tnt

smoky oak
#

thats the explosion

#

not the trigger

hybrid spoke
#

pretty sure

smoky oak
#

Also it would be possible, if cumbersome, to track the different things that can ignite tnt. Alternatively, make the tnt automatically lit when placed

#

@hybrid spoke EntityExplodeEvent: Called when an entity explodes
ExplosionPrimeEvent: Called when an entity has made a decision to explode.
neither of those are fired when the tnt is lit

hybrid spoke
#

i was just correcting jeff, not responsing to the topic

smoky oak
#

imma check the explosion prime event brb

opal juniper
#

ah sorry

sage swift
#

BlockFadeEvent might be called for it, or BlockFromToEvent, or BlockRedstoneEvent

opal juniper
#

i misunderstood

hybrid spoke
#

there is literally no event for when a tnt is lighted

#

would think of EntitySpawnEvent

#

but probably not

sage swift
#

you can check those for TNT block, then store that location for a tick and wait for a tnt entity to spawn in that location

#

then you have your entity reference

quaint mantle
sage swift
#

then try the others ¯_(ツ)_/¯

quaint mantle
#

alright

sage swift
#

the main point is, try events you think might work until something comes up

#

i like to just put a bunch of handlers for events i hope would work, and then just try it

hybrid spoke
quaint mantle
#

thank you guys

sage swift
hybrid spoke
#

but i think the only way is to get when a tnt could get activated (redstone events, interaction events)

sage swift
#

since the block is storing some data

#

BlockPhysicsEvent is almost definitely called for it lul

smoky oak
sage swift
#

although if you're using @waxen plinth's library, the DataBlock probably wouldn't get auto-removed when the TNT is ignited; so you could use the entity's location for a reference to the DataBlock

earnest sonnet
#

Hey, any easy way to parse date via chat in format such as (51D5h3m) without reggex?

earnest sonnet
# granite stirrup w h y

Basically, I want to get, the duration for something via command arguments and then append it to the current date

granite stirrup
#

i dont think theres any ways without it

#

;-;

earnest sonnet
lusty cipher
#

Is Player#equals(Player) reliable?

#

Or should I use UUIDs instead

earnest sonnet
granite stirrup
#

i saw the Date class maybe it be able to do it

upper mica
#

Hello, will concurrent modification exception be thrown if I delete (set to null) one of configuration sections while looping them?

sage swift
#

?try

#

damn

granite stirrup
#

probs uuid

sage swift
#

dont compare names

#

why would you compare names

granite stirrup
quaint mantle
#

names change, thats a bad idea

granite stirrup
#

ik

earnest sonnet
granite stirrup
#

F

lusty cipher
#

i will use uuids

granite stirrup
#

k

sage swift
#

no dont use uuids

unreal quartz
sage swift
#

dont compare player directly

#

dont do it

lusty cipher
#

🤔

#

i will

granite stirrup
#

why not lol

earnest sonnet
#

@sage swift you're confusing me 🤣

sage swift
#

the "dont use uuids" was a jok

#

dont compare players

earnest sonnet
#

oh xD

granite stirrup
#

ah fuck i accidently compared a player with a player before on accident

#

XD

sage swift
#

if someone relogs then a player object from before they logged out will not be comparable to the current one

unreal quartz
#

it's not that big of a deal, though if you want to be extra cautious then you should compare uuids

sage swift
#

it is a big deal

unreal quartz
#

not really

sage swift
#

use players if you want bad practices

unreal quartz
#

if you're comparing two players in the same event

#

it's not a big deal

sage swift
#

songoda style, one may say

unreal quartz
#

there is no way someone can relog within the same tick

sage swift
#

teach yourself bad practices

unreal quartz
#

right

granite stirrup
#

k i switched my thing out to compare UUIDs

hexed hatch
sage swift
#

no but they are widely regarded as badly coded

granite stirrup
#

lol

#

line 69 is a else XD

sage swift
fiery inlet
#

Whenever i do Bukkit.createInventory

it says it cannot resolve symbol

#

wtf

sage swift
#

what arguments did you pass in

fiery inlet
#
Inventory inv = new Bukkit.createInventory(player, 18, "lol");
#

but intellij shows me as an option

#

whenever im beginning to write it

sage swift
#

ah yes new Bukkit.createInventory

dusk flicker
#

Ah yes

#

Its not like the entire Bukkit class is static or something

sage swift
#

Bukkit.createInventory is a static method

#

new MinecraftServer() when

fiery inlet
#

oh

#

shhh

#

xd ty

granite stirrup
#

wttf

#

why would you create a instance of Bukkit.createInventory can you even do that with methods XD

dusk flicker
#

They are static

#

Soo

delicate fractal
#

is it possible to add a chat cooldown in chat with essentials?

dusk flicker
#

No to my above thing

sage swift
#

give them the wrong help channel 👍

#

spigotillionaire grindset

delicate fractal
#

ok

granite stirrup
#

?

proud basin
#

EXCUSE ME

sage swift
#

excused, 1.8 user

proud basin
sage swift
#

yep

#

bye bye

proud basin
#

wym bye bye

sage swift
#

no help for outdated versions

#

:)

proud basin
#

ur outaded

granite stirrup
#

we only help for versions 1.16.5 and 1.17

#

:)

proud basin
#

uh its 1.16.5

granite stirrup
fiery inlet
#
public void openWorkbench(Player player){
        Inventory workBench = Bukkit.createInventory(player, 9 * 6, ChatColor.color("&7["));

        ItemStack glass_black = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
        ItemMeta meta1 = glass_black.getItemMeta();
        meta1.setDisplayName(ChatColor.color("&7"));
        glass_black.setItemMeta(meta1);
        for (int i = 0; i < 44; i++) {
            workBench.setItem(i, glass_black);
        }

        ItemStack glass_red = new ItemStack(Material.RED_STAINED_GLASS_PANE);
        ItemMeta meta2 = glass_red.getItemMeta();
        meta2.setDisplayName(ChatColor.color("&7"));
        glass_red.setItemMeta(meta2);
        for (int i = 0; i < 44; i++) {
            workBench.setItem(i, glass_red);
        }
    }

Why cant i call this i made in my utils class dafuq

quiet ice
#

I only help 1.17 no nms

granite stirrup
sage swift
fiery inlet
#

WorkbenchUtils.openWorkbench()

#

it wont let me

proud basin
sage swift
#

i love how they changed EntityPlayer.playerInteractManger to EntityPlayer.d in 1.17, that really makes me happy

proud basin
#

bro

#

its not static