#help-development

1 messages · Page 648 of 1

hybrid spoke
#

?codereview

undone axleBOT
serene sigil
#

what does World#hasSkyLight do?

pseudo hazel
#

what does the docs say

unkempt peak
#

Well from the description I would assume it is the opposite of world#hasCeiling

unkempt peak
#

Yeah

serene sigil
#

So that means that its the overworld and end?

#

that return true

#

?

unkempt peak
#

I think so

hybrid spoke
#

i would assume skylight as overworld

#

since the end doesnt have skylight

#

rhetorically

unkempt peak
#

Is the end light level 0?

tender shard
#

there's also World#isUltraWarm() lol

unkempt peak
#

lol what

tender shard
unkempt peak
#

That's funny

tame wolf
#

world#hasCeiling is true for nether

unkempt peak
#

They're asking about world#hasSkyLight

quaint mantle
#
//in mainclass

    private static Main plugin;

    public static ManaFriends getPlugin() {
        return plugin;
    }


//in other class
   private File file;
   file = new File(Main.getPlugin().getDataFolder());```

is this usage correct?
why wrong ?
unkempt peak
#

?di

undone axleBOT
quaint mantle
#

is this for bungeecord

#

is it the same?

unkempt peak
#

It's for anything in java

hybrid spoke
quaint mantle
hybrid spoke
#

couldnt they just do #isNether #isEnd #isOverworld

tame wolf
#

Nope

quaint mantle
#
    at me.vasir.manafriends.ConfigManager.initializeConfig(ConfigManager.java:18)
    at me.vasir.manafriends.ManaFriends.onEnable(ManaFriends.java:10)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:266)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:295)```
tame wolf
#

Aka

#

A sun

hybrid spoke
#

or you called it before the plugin was initalized

chrome beacon
#

also use di

quaint mantle
chrome beacon
#

?

#

in your on enable

quaint mantle
#

well i create config.class without implement events

tender shard
#

obviously getPlugin() returns null

quaint mantle
#

i try

#

but i do net write something to onEnable

#

btw

#

i understand now

remote swallow
#

you need to add plugin = this

quaint mantle
#

nvm

quaint mantle
unkempt peak
#

Dude your not setting the plugin to anything

quaint mantle
#

ah

echo basalt
#

blud has no clue what he's doing

quaint mantle
iron palm
#

it seems network manager is no more on PlayerConnection in 1.20 so how would u guys get the players' NetworkManager?

echo basalt
#

?learnjava

undone axleBOT
quaint mantle
#

UNDERSTOOD

echo basalt
tender shard
#

set the field as soon as possible

public class MyPlugin extends JavaPlugin {
  private static MyPlugin instance;

  {
    instance = this;
  }
}
echo basalt
#

wait that's for packet handlers

#

uhh

iron palm
quaint mantle
echo basalt
#

Then go for it

remote swallow
flint coyote
#

technically they do

remote swallow
#

technically, but i wouldnt really recomened using them

unkempt peak
#

Does JavaPlugin actually allow you to use a constructor?

#

What's the point of that

chrome beacon
#

It doesn't

flint coyote
#

A constructor with no arguments could work

#

Since I would guess spigot calls that

remote swallow
#

im pretty sure its one with params

lost matrix
unkempt peak
#

Huh thats interesting

echo basalt
#

no point in having a constructor though

sterile breach
#

Hello, arraylists are exposed to concurency problems when working desuss in async?

echo basalt
#

just use onLoad if you want that

quaint mantle
#

Java "creates" it if you don't have it anyway

quaint mantle
#

You can't have a class without constructor

remote swallow
# quaint mantle This

using reflection to access it, just to be able to set 1 variable before onLoad is pretty pointless

echo basalt
#

There's no point in a concurrent list because order doesn't matter

sterile breach
echo basalt
#

Just use a concurrent hash set

#

Or if you really need the order of which things are operating maybe some sort of synchronized list

flint coyote
remote swallow
#

im just going off what 7smile said

quaint mantle
remote swallow
#

i knew there was a constructor for the plugin, just not how you could access it

quaint mantle
#

So the constructor exists always

#

You are just writing it and adding code to It

sterile breach
iron palm
remote swallow
#

?mappings

undone axleBOT
hazy parrot
quaint mantle
#

Which leads to utility constructor, a constructor shouldn't contain class "utils", for example, defining the instance of the plugin. Instead, and as said, a method should be specifically created

echo basalt
#

Collections.synchronizedCollection(new ArrayList<>());

sterile breach
#

do you mean that all operations such as .add are performed in the main thread?

echo basalt
#

But I got no clue why you're trying to preserve order in a concurrent environment

#

Just use a concurrent hashset

echo basalt
#

Sets.newConcurrentHashSet / ConcurrentHashMap.newKeySet

iron palm
vital ridge
#

I added an external jar to my plugin and included it in maven. Do I also need to include the dependency in my plugin.yml?

#

Right now the plugin wont enable spitting out errors that it cannot find some classes.

#

Which are part of the dependency I'm using.

sterile breach
echo basalt
#

That's in any concurrent environment

unkempt peak
#

Why did you add the external jar and use maven?

echo basalt
#

No clue what you're doing

#

But sounds like xy to me

#

?xy

undone axleBOT
vital ridge
#

How should I add my external jar then?

sterile breach
echo basalt
#

If the entire task is performed async in a single separate thread then the order is maintained

remote swallow
echo basalt
#

If you have multiple threads working together, the order doesn't matter because some threads can be quicker than others and your results would've never been in order anyways

remote swallow
#

then add the dep

#

if its a plugin add the depend: name to plugin.yml or shdae it

serene sigil
#

hey, how do you get the same effect as if you are standing under fire? i tried to setFireTicks but that only sets the visual fire... how do you also do the same damage?

sterile breach
echo basalt
#

In what context?

#

Just explain what you're trying to do

#

Unless you want me to explain multithreading from scratch

sterile breach
#

i need to retrieve a list of player info from the db and display it chronologically in a gui

echo basalt
#

So yeah you can fetch the entire list however you want and then sort it

sterile breach
echo basalt
#

The list won't get mixed up because you're doing a single database call in a single separate thread

#

So it's fine

echo basalt
vast ledge
#

play.setBurning

#

or smth

#

player*

serene sigil
#

lol

vast ledge
#

?docs

ripe moat
#

Can i ask questions about Intellij IDEA in here? (I use it to code plugins for my MC server, but i'm kinda new)

#

🙂

ripe moat
vivid hill
#

how can I check if a long is not set?

wary harness
#

to use lambok do I need to shade it in my plugin

serene sigil
wary harness
#

or is it avilable already in server jar?

serene sigil
quaint mantle
vivid hill
serene sigil
#

lol

wary harness
tender shard
#

that looks like one very cursed screenshot

quaint mantle
#

how do i save file ?
or i need ?
bcs my set methods not working

tender shard
#

it excplicitly mentions <scope>provided there

vital ridge
ripe moat
# lost matrix

Thanks. But i need to do it before i start the project, right? This is how i got the screen on the image that i sent: https://imgur.com/a/OcigZGs.
And i want it to be a 1.8 plugin, but i can't select that without the JDK

vital ridge
#

Usually plugins have their maven dependency provided and I just copy paste it

remote swallow
vital ridge
#

Yes.

remote swallow
#

then just add the same maven info to ur other project

echo basalt
#

@sterile breach

tender shard
# vital ridge Yes.

re you using intelliJ? then just double click on "install" in the maven tab of the other project

quaint mantle
#

how do i save file with bungeecord configuration ?

ocean hollow
#

if I assign metadata to the block, then if it is moved by a piston, will the information be saved?

Or how is it generally easier to understand whether a block is generated or placed by a player? Do a database or logic on MetaData or save all blocks in a List?

lost matrix
serene sigil
#

is it possible to make a fog/not so far see effect? my goal is to make players not be able to look very far, kind of like blindness, but a little farer

chrome beacon
#

Could try working with shaders and a resourcepack

lost matrix
serene sigil
chrome beacon
#

Then no

lost matrix
serene sigil
#

wdym?

lost matrix
#

Is a hard cut ok or does it need to be a gradient

serene sigil
#

i guess

#

its alright

chrome beacon
#

then just keep a sphere of display entities around the player

serene sigil
#

what are display entities?

lost matrix
#

I would just use a limited amount of maybe 9 scaled blocks or something.
Then place them in a circle configuration all facing the player.

slim pier
#

How can I make plugins work across multiple versions?? Please tell me how or how to do it

ancient plank
#

simple:

serene sigil
lost matrix
slim pier
#

thanks

onyx fjord
#

😴 tl;dr?

sterile breach
#

at the lowest level. Are threads managed by the processor?

echo basalt
#

uhh yea

sterile breach
#

and on a machine running Windows, for example. Each program is given a main thread and the possibility of creating others?

echo basalt
#

Somewhat

#

This is java and java runs a JVM

sterile breach
#

I'm talking about threads in general, not just java.

lost matrix
echo basalt
#

I'll let smile do the talking

shadow night
#

How can I save all the data about an entity (location, nbt tags and other entity-specific stuff) without actually saving an entity instance?

lost matrix
#

I just wanted to throw that in, feel free explaining the rest

sterile breach
#

so the maximum number of threads depends on the processor? to give you an idea, an i5 processor can have up to how many threads?

lost matrix
shadow night
echo basalt
austere cove
#

Anyone got any idea what causes this message?

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
(it happens when surefire starts running tests)

wet breach
lost matrix
pseudo hazel
#

also there are like a billion different i5

austere cove
onyx fjord
wet breach
#

if we assume 32mb for every thread then you could spawn 1000 threads using up 32GB of ram to allocate all of them

echo basalt
austere cove
#

yea, not just in ram

#

thats my point

lost matrix
sterile breach
#

if I understand correctly:
let's imagine that I add a 1 +1 calculation to A.
then I also ask him for 1 + 2, unless I create another thread. While waiting for 1+1 to be finished, 1+2 will be put on hold in the ram?

wet breach
echo basalt
#

So you're asking if the "instruction queue" is in ram

sterile breach
#

yes

austere cove
pseudo hazel
#

probably yes since your program runs in ram as well

echo basalt
#

Might even be in the cpu cache

lost matrix
sterile breach
#

okay

#

thanks for the explanation

lost matrix
remote swallow
#

are our brains thread safe

echo basalt
#

no

remote swallow
#

when does our mutlithreading update drop

echo basalt
#

ptsd is like a memory leak

pseudo hazel
#

just connect your brain to the X hivemind in 2030

remote swallow
#

when is someone gonna make an implant that adds ads to our thoughts

pseudo hazel
#

thats already there

remote swallow
#

fuck

pseudo hazel
#

do you ever just wake up and be hungry?

remote swallow
#

everyday

pseudo hazel
#

yeah exactly

#

they got you already

serene sigil
#

how to set the render distance in spigot?

lost matrix
#

nvm

serene sigil
#

whats the minimum?

serene sigil
lost matrix
#

you need to use spigot.yml

lost matrix
serene sigil
#

1 chunk?

lost matrix
#

y

remote swallow
#

why should people be allowed to see

#

set it to 0

serene sigil
serene sigil
remote swallow
serene sigil
#

can you not do that?

remote swallow
#

or probably not

#

?tas

undone axleBOT
lost matrix
serene sigil
#

and is it possible to set the view distance of the client?

shadow night
#

Well, ig you can not send chunks that are further away than x, but I don't think the client accepts more chunks than set in settings

sterile breach
#

Hi, its possible to get an entity with a string?

exemple
String type = "cow";
Entity entity = new entoty(type); ?

remote swallow
#

you would have to value of the EntitiyType

sterile breach
#

how?

remote swallow
#

EntityType.valueOf(String)

sterile breach
#

ah yes thanks

shadow night
#

Is it in theory possible to transfer a string into executable code like eval() in js? Like, let's say I need an /eval command that could evaluate any code I pass into it to debug my plugin

pseudo hazel
#

I mean js did it

#

so yes

#

its possible in both theory and practise

ripe moat
lost matrix
chrome beacon
undone axleBOT
chrome beacon
#

also I hope you know basic Java before starting with your plugin

ripe moat
#

Yeah i know basic java

shadow night
ripe moat
shadow night
orchid trout
ripe moat
#

Oh okay, so i can just select version 1.12 or something, and then change it afterwards?

chrome beacon
#

yes

ripe moat
#

Okay, thank yoou

lost matrix
ripe moat
# lost matrix Like what? Kit pvp v17.3?

I don't remember, but i'm pretty sure that on some of the pages of the plugins that i have, it says that they only work for old versions, and besides the plugins, in newer versions of minecraft, there's the super annoying chat reporting thing

chrome beacon
#

super annoying chat reporting thing
it's not really annoying?

quaint mantle
#

how do i send message to console in bungeecord?
sout not working

ripe moat
#

so kinda annoying

remote swallow
#

so just disable it

ripe moat
#

but anyways, i'll just change the version then

chrome beacon
robust ginkgo
#

How do I check if an item is a placeable block? I want to check if the player is holding something that can be placed (any blocks) or something that can't be placed (any non-block item).

robust ginkgo
#

oh alright

tender shard
#

oh chat reporting itself? that's a decent feature

#

glad it was added

robust ginkgo
chrome beacon
#

You don't

#

You call getType

robust ginkgo
#

oh

chrome beacon
#

It causes a block update

buoyant viper
#

^

chrome beacon
#

and since the seed is in an invalid position it will break

#

You can setType with a second argument false and listen to the physics event

#

This method should NOT be used to "hack" physics by placing blocks in impossible locations.

#

Do keep this warning in mind ^^

inner mulch
#

Should I use MySQL Workbench do set up databases for a minecraft server?

chrome beacon
#

Workbench doesn't setup database for you

#

if that's what you're asking

inner mulch
#

everyone says i should you mysql to setup my databases

#

but i dont know which program

kind hatch
#

You need mysql-server installed if you want to setup and access databases.

chrome beacon
#

^^

inner mulch
#

what is this

#

yes i got this

chrome beacon
#

I do recommend just using MariaDB

kind hatch
#

Then make sure it's up and running. Then you can have your plugin connect to it and add your data.

chrome beacon
#

It's fully compatible with MySQL queries and is what most people will be running anyways

inner mulch
#

ok, but this is the program you guys are talking about right?

kind hatch
#

No, the workbench is just a GUI tool that lets you access what is running with mysql-server.

#

It also kinda sucks tbh.

tender shard
#

mysql workbench is shit

chrome beacon
#

HediSQL >>>

kind hatch
inner mulch
eternal night
#

postgres party

#

anyway, usually you'd use something like flyway

robust ginkgo
#

So how do I get the NBT tags from an itemstack?

eternal night
#

to do database migration for you

chrome beacon
#

Postgres is nice

kind hatch
eternal night
inner mulch
#

idk what i should use, you are all talking about something else

chrome beacon
#

use pdc?

#

?pdc

eternal night
#

Generally, the compound tag has get methods or the likes

#

its just a fancy Map<String, NBTTag>

kind hatch
inner mulch
latent wyvern
#

Hi, I am looking for a plugin that logs bans and mutes in my discord server could someone give me some suggestions.

robust ginkgo
kind hatch
inner mulch
inner mulch
#

but i dont know where to start

#

what to use

tacit drift
#

first two checks are redundant

robust ginkgo
#

oh that's part of the ItemMeta type

#

thought it was an ItemStack thing

chrome beacon
# inner mulch but i dont know where to start

MySQL tutorial for beginners - Learn MySQL, the world's most popular open source database.
🔥 Want to master MySQL? Get the full MySQL course: http://bit.ly/2uAoPM3
👍 Subscribe for more SQL tutorials like this: https://goo.gl/6PYaGF

⭐️Want to learn more from me? Check out these links:

Courses: https://codewithmosh.com
Twitter: https://twitter....

▶ Play video
quaint mantle
#

how do i get player from my command args ? in bungeecord

tacit drift
#

get player name, check if it's online

#

etc.

kind hatch
# inner mulch what to use

That's going to depend on what kinda of data you need to store. Is it going to be structured or unstructured data?
If you need structured data, then any SQL language will be the way to go. (MySQL, MariaDB, PostgreSQL)
If you use unstructured data, then any NoSQL language will be what you use. (MongoDB, Redis, Cassandra)

inner mulch
#

structured

#

per player data

silent steeple
kind hatch
# inner mulch per player data

Then you'll probably be best off using MySQL or MariaDB. Plenty of people here know how to write MySQL queries and MariaDB is just MySQL with some extra safety and QOL features.

inner mulch
#

wait what about phpmyadmin?

#

what is stackz talking about

kind hatch
#

That's just a frontend for MySQL.

kind hatch
#

MySQL is backend/cli program.

#

If you want an easier way to modify data in mysql, then a GUI tool will be needed.

hazy parrot
kind hatch
#

Otherwise, you have to use the command line to update your mysql database.

tacit drift
#

PMA is breaking randomly if using that shit program that i forgot how it's called

inner mulch
kind hatch
#

Tbh, I don't really know what xampp is. My best guess would be that it is some sort of software stack like LAMP.

inner mulch
chrome beacon
#

You're going to have to learn SQL to use SQL

#

so take the time

inner mulch
#

yes but i would like to learn it bit by bit

hazy parrot
#

Xampp is just easy way to install apache mysql and tomcat, like gui for all in one

chrome beacon
inner mulch
#

i want to use it and when a problem ocurrs i google again and again until perfection

hazy parrot
#

What

inner mulch
#

apache tomcat?

hazy parrot
#

Apache is webserver

#

And tomcat is

#

Idk

quaint mantle
#

tomcat is for java servlets

#

it hosts them

kind hatch
#

You don't need any of that though. You just need the mysql server.

inner mulch
#

ok so i should install mariadb right?

#

you said its better

kind hatch
quaint mantle
#

what do u mean better

#

its just a db

inner mulch
#

i dont now anything about db

#

i jst want to have one

quaint mantle
#

have you ever interacted with a db

inner mulch
#

no

#

thats why im here

quaint mantle
#

just start with document based dbs

#

you will thank me in 10 years

kind hatch
#

He literally said he needs structured data.

quaint mantle
#

where

inner mulch
#

yes, but i want to have multiple server use the data

quaint mantle
kind hatch
inner mulch
quaint mantle
#

do you know what i mean by document based

inner mulch
#

yes yml

quaint mantle
#

LOLOLOL

#

🤦🏿‍♂️

#

im talking about nosql databses

inner mulch
hazy parrot
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
kind hatch
# inner mulch why so mad

Just ignore him. He's been bitchy for the last couple days. Hard to tell if he's trolling or just extremely pissed off at the world rn.

inner mulch
#

sainte why are you so mad then?

quaint mantle
#

what have i said that makes me appear mad

inner mulch
#

you called me an idiot?

quaint mantle
#

so?

inner mulch
#

seems mad

quaint mantle
#

i am stating a fact and you say im "mad"

hazy parrot
#

Someone not knowing something and have intention to learn = idiot

inner mulch
#

i may be re tarded, but i started programming two weeks ago

hazy parrot
#

Seems right to me

kind hatch
hazy parrot
quaint mantle
#

dont ask stupid questions

kind hatch
#

How do you expect to learn if you don't ask questions?

quaint mantle
#

by reading

hazy parrot
#

His question is one of least stupid I encountered

quaint mantle
#

he thought document dbs was yml

#

🤣

hazy parrot
#

Oh what an idiot

#

Smh

quaint mantle
#

Fr

hazy parrot
#

I hope ur trolling

latent wyvern
#

Hi, I am looking for a plugin that logs bans and mutes in my discord server could someone give me some suggestions.

silent steeple
kind hatch
#

@inner mulch Once you have either MySQL or MariaDB installed, you just have to make sure it's running in the background.

#

Your plugin will interface with the db using command line queries.

#

You can also interact with it using the command line if you want. However GUI programs make it easier.

#

HediSQL looks pretty good. Haven't used it myself as I use the built in tools that IntelliJ provides.

#

phpMyAdmin requires you to set up a lot of stuff in order to use it.

inner mulch
kind hatch
#

In the Ultimate Edition of IntelliJ

inner mulch
#

oh

kind hatch
#

You can get the Ultimate Edition for free if you have a student email.

inner mulch
#

sadly i do not have one

#

okay i will install the programs now

quaint mantle
#

can you not afford education?

kind hatch
storm granite
#


    public static void placePoster(Location location, String type, BlockFace facing){
        ItemStack item = getCustomItem(type);
        ItemFrame itemFrame = (ItemFrame) world.spawnEntity(location, EntityType.GLOW_ITEM_FRAME);
        itemFrame.setFacingDirectionfacing.name();  //NOT SURE WHATT TO DO HERE
        itemFrame.setItem(item);
    }

    public static void placePosters(){
        placePoster(new Location(world,0,92,7),"Tablets",BlockFace.NORTH);
    }
}``` problem is on the marked line, thanks
#

i havbe no idea what method to sie tp set direction or whatever'

tender shard
#

what are you even trying to do?

storm granite
#

place an item frame, with an item in, facing a certain direction.

quaint mantle
#

why did you call .name

storm granite
#

not sure hang on

#

still red without it

quaint mantle
#

yeah

#

because it needs args

tender shard
#

do you know java?

storm granite
#

some

quaint mantle
#

evidently not enough

storm granite
#

problem isnt with it not compiling, i just dont know what method to call there

tender shard
#

setFacingDirection takes in a BlockFace

#

so provide a blockface

#

setFacingDirection(BlockFace.NORTH)

#

for example

storm granite
#

okay i think it working ty

#

is there a way to stop it POPPING every time its not on a block?

#

breaking*

kind hatch
#

Probably not anything reliable. ItemFrames will break if they don't have a supporting block. BlockPhysics will only go so far as any update that is caused to the itemframe will cause it to realize that it's not supported.

chrome beacon
#

ItemFrame is an entity so I believe it just checks the supporting block every few ticks

#

Could use nms to override the tick behaviour

quaint mantle
quaint mantle
#

am i use equals or equals ignore case ?
why

#

oh

hazy parrot
#

"fOo".equalsIgnoreCase("foo") is equal true

#

While equals would be false

quaint mantle
#

alright ty

ocean hollow
#

is there some kind of event that occurs when a player takes any damage? I mean, after the fire, from the entity, from the fall

#

if not, can you give list?)

scenic zenith
#

Does anyone here know how I can prevent the loading of worlds and the loading of chunks to have only the end dimension. So like the 2b2t lobby?

shadow night
ocean hollow
#

thank you guys

inner mulch
#

Is there a simple and efficient way to temporarily save and update an inventory, for example in a trade plugin, or do i need to save it in a file/database to get the results im looking for?

ocean hollow
#

why it doesn't work?

#

I need to have ability for saving it and canceling it later

mortal hare
#

is it normal to return object builders through factories?

opaque scarab
#

When your making dynamic torches, what seems better? (A): You put an instance in a hashmap and update on events, accessing the hashmap and checking if the player is holding the torch. (B): You have a runnable and iterate through a list of instances, checking if the player is holding the torch, every few ticks.

mortal hare
#

im currently developing an api

#

that could be compiled only and accessed if the main classes are within the same class loader

#

so basically i could use builder classes to build implementation specific objects

#

without relying them on compilation time

#

that way i could edit the underlying code without recompiling the whole plugin that relies on it

ocean hollow
#

HeldItemEvent for this

mortal hare
#

A is more efficient

opaque scarab
# ocean hollow A is better

But doesn’t a hashmap search the entire map for a key? If their are multiple players moving in a tick, it will iterate through the map twice, reducing efficiency?

mortal hare
#

hashmap get the hash of the object

#

through that probable index

#

where the object is

#

then does comparison operation to check if the object is equal

#

if it is equal it returns you

opaque scarab
#

Oh, alright makes sense

mortal hare
#

its amortized O(1)

#

worst case O(N) iirc

mortal hare
#

it would compare memory locations (practically) of the player objects

#

that way it wouldnt need to hash the object

#

but be note it doesnt work for strings

#

and integers iirc

opaque scarab
#

So besides strings and integers, it is preferable?

mortal hare
#

or if you want even MORE performance use fastutil

#

in javadocs it says it shouldnt be used because it breaks the contract of the map interface

#

but i tbh think if its created why not use it

#

This class is not a general-purpose Map implementation! While this class implements the Map interface, it intentionally violates Map's general contract, which mandates the use of the equals method when comparing objects. This class is designed for use only in the rare cases wherein reference-equality semantics are required.

#

because you have player objects

#

which are unique

mortal hare
#

each time player joins

#

you're fine

opaque scarab
mortal hare
#

scheduling runnables are a lot expensive operations

#

avoid them as much as you can

#

if you cant avoid them, then use them

#

some runnables require multiple threads to run

#

and firing threads costs performance

#

but nowadays software uses thread pools

#

which fire the threads as soon as the application launches

#

and it halts them until the work is provided to them

ivory sleet
#

they optimize the hell out of runnables

#

or in particular functional interfaces

mortal hare
#

that's very short explanation, but you should get the point

mortal hare
ivory sleet
#

na

opaque scarab
ivory sleet
#

it compiles down to an invokedynamic bytecode instruction

#

much faster than invokevirtual

mortal hare
#

what i meant is the bytecode instruction would get interpreted in binary level

#

and OS level operations regarding threads are not cheap

ivory sleet
#

yeah threads, but runnables arent synonymous to threads

mortal hare
#

it depends

#

how that runnable is runned

ivory sleet
#

i mean sure to a vague extent

#

tho in essence its just a class with a single method, nothing more, nothing less to it (well not rly true but u get the point)

mortal hare
#

yea

#

i guess

cedar marlin
#

not ChatColor.*

quaint mantle
#

am i check if online and last login date ?
with bungeecord ?

mortal hare
#

Use UTF-8

cedar marlin
#

How do I set UTF-8 ?

mortal hare
#

if you're using gradle build system for building plugins, add this to your build.gradle.kts

tasks {
    compileJava {
        options.encoding = Charsets.UTF_8.name()
    }
}

if you're using maven build system for building plugins, add this to your pom.xml

<project>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>
mortal hare
#

and coloring like this exists only for legacy support only

#

it doesnt work with hex color codes as well

#

overall its a bad way

#

if you're using paper, i suggest using TextComponent by retrieving it via Component.text() method, which is provided by adventure-api built into paper-api

sullen marlin
#

?whereami

mortal hare
#

or use bungeecord's chat components

#

dont be mad md_5

#

i should be mad that spigot doesnt have proper component support

quaint mantle
#

am i check players is offline or online ? with bungeecord ?

mortal hare
eternal oxide
#

there is no such thing as an offline player in bungee

quaint mantle
#

well i think somethings

#

brb i will share my code

mortal hare
#

how can i name a builde rclass which provides, when built, multiple objects of the same object

#

and a builder class which when built, provides one object

#

i was thinking
PluralProviderBuilder
and
SingularProviderBuilder

but it doesnt sound right for me

#

any ideas?

#

i dont want to put it inside one builder since implementation could be distinctively different for both of the classes

ivory sleet
#

FactoryBuilder maybe?

#

like the builder builds a factory

#

and the factory is used to create objects

mortal hare
#

yes but im pretty sure there would be no method besides build() for factory builders

#

and it sounds a bit silly

pseudo hazel
#

your system sounds silly

mortal hare
#

it separates user code which uses objects from implementation classes

#

how's that silly

#

i dont need to recompile plugins in that case

#

if the same builder classes with the same method names exist

#

ImplementationClass -> ImplementationBuilder -> Builder interface which is retrieved through some endpoint -> build() retrieves Object interface with implementation specific object -> use that object without relying on the implementation code

pseudo hazel
#

I mean thats fine but then I would atleast name the class after what it is trying to build

#

instead of generic builderfactory

#

because I wouldnt be able to know what it builds or factorizes from that name

mortal hare
#

im not building factories i use factories to create implementation specific builders

#

im naming them properly, i just provided the example

pseudo hazel
#

okay so then its the other way around

#

okay then there is no issue I guess

sharp verge
#

Getting this error:
https://paste.learnspigot.com/orenesamaf.md

With this code:
https://paste.learnspigot.com/uyoxuwured.java

line 140 in the code is: } catch (WorldEditException e) { Has anyone ever gotten an error like this/similar to this. And have an Idea of how to fix it?

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

mortal hare
#

im sorry to ask such generic question, but have you tried updating your world edit plugin? 😄

#

maybe versions do not match

#

if you're using vanilla WorldEdit, it could be laggy with large structures as well

#

FAWE solves this, but im not familiar with its implementation

#

this is not an error

#

its just that the server hangs for over 10 secs with no tick updates

#
[22:48:25 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-550 (MC: 1.19.4) ---
[22:48:25 ERROR]: The server has not responded for 10 seconds! Creating thread dump
#

also to make md_5 happy

mortal hare
#

?whereami

mortal hare
#

goddamnit

#

you're faster lol

quaint mantle
mortal hare
#

I like components

#

Minimessage format is great

sharp verge
chrome beacon
#

Components are neat

quaint mantle
#

Like, why replace sendMessage(String) with sendMessage(Component)?

vital ridge
#

I keep on getting

Caused by: java.lang.IllegalArgumentException: Plugin already initialized!

I added 2 dependencies to my plugin which it uses. But one of the dependency I added also uses the 2nd dependency I added.

#

I ran mvn install on both of the plugins.

#

And then threw the dependency into my pom.xml.

sterile breach
#

Hi, in an hashmap its possible to stock pultiple value for the same key?

spiral imp
#
package me.c0kerat.testingplugin.Commands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

public class ArmorstandCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {

            Player p = (Player) sender;

            if (args.length == 0) {
                p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
            }
            if (args.length == 1) {
                switch (args[0].toLowerCase()){
                    case "baseplate":
                        if (args.length == 2) {
                            if (args[1].equalsIgnoreCase("true")) {
                                p.sendMessage("you chose true");
                            }
                            if (args[1].equalsIgnoreCase("false")) {
                                p.sendMessage("you chose false");
                            }
                        }
                        p.sendMessage("you need to provide a true or false statement");
                        break;
                    default:
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPlease use a correct parameter: &e[baseplate|arms|pose|small|visibility]"));
            }
        }
        }
        return true;
    }
}

im trying to make an easy to use armorstand command, but for some reason, its not detecting whenever I have true or false as my argument 3. please excuse any poor programming optimizations or just straight up stupid coding since ive only pretty much learnt the basics

tall dragon
sterile breach
#

multi map is like hashmap but i can add multiple value for any key?

tall dragon
#

yea. im not sure a multimap is in standard java lib tho

hazy parrot
#

take a note u can do it with normal map too Map<Key, Set<Value>>

river oracle
tall dragon
#

needing this also kinda sounds like a design issue

#

to me at least

hazy parrot
#

Doesn't have to be really

tall dragon
#

that can never be true

#

nvm i read that wrong

#

no i read that right

#

lmfao

spiral imp
#

no I think you're right

#

ya ok I see the problem now

tall dragon
#

in the first one u need to check >=

#

not ==

spiral imp
#

yep

sterile breach
tall dragon
sterile breach
#

by default, caffeine works as a basic hashmap, it can work as a multimap?

tall dragon
#

well idk ive never used caffeine before

#

pretty sure thats a third party library

river oracle
#

they just use generics in their caches

#

there is no MultiCache in caffeine its rather uneeded too

sterile breach
#

okay

#

okay okay, I'll state my problem. For each player I need to store instances of classes that I load on startup and unload when he leaves. And per player I may have to store the same instance 10 times sometimes. How do I tokenize them? hashmap? array?

river oracle
#

also if you're just going to load on join and unload on leave just use a ConcurrentHashMap

sterile breach
#

I can't do otherwise. Each instance represents a row in the db.

river oracle
#

why not have one dataclass? having 10 seems like a huge design flaw

hazy parrot
#

I assume its probably some kind of home system

#

and those are actually instances of Home class or smth like that

sterile breach
#

an instance containing a hashmap?

hazy parrot
#

or I don't really understand why you need that

river oracle
hazy parrot
#

nah i see nothing wrong with it

river oracle
#

though I think in this case if we're using a database a data class is more appropiate

hazy parrot
#

just trying to understand what is he trying to do

river oracle
#

so

class PlayerData {
private final UUID uuid;
private final List<Home> homes;
}
#

seems like the best solution to easily load from a DB

#

then just have a PlayerDataManager and you're good to go

ivory sleet
wary topaz
#

can someone explain what I did?

undone axleBOT
chrome beacon
#

^^

worthy moat
#

Hey I want to display the rank (prefix) of a player in a message I sent with my plugin....How can I get the prefix?

inner mulch
#

Is there a simple and efficient way to temporarily save and update an inventory, for example in a trade plugin, or do i need to save it in a file/database to get the results im looking for?

inner mulch
#

i thought of that too, but would it be inefficient? storing each item that the player put in the trade

worthy moat
#

Not each item on its own

inner mulch
#

in a trade inventory, both the people put their itemsi nto it

worthy moat
#

And I think as loong as you dont perform any not thread safe issues its no problem

worthy moat
inner mulch
#

okay

worthy moat
#

Thats the best way to save something temporarly......You don't need to store it in a db

inner mulch
#

ok thank you for the help :).

chrome beacon
#

make sure your plugin jars from the plugins folder

#

so it doesn't load the old one

#

How are you compiling your jar

worthy moat
# inner mulch ok thank you for the help :).

I actually think its the best solution...I mean a DB is too much for a short inv and you just have to update something as soon as there is a cliick event and the inventory is the one you are monitoring

modest bolt
#

sry to interject, how can I get a block object?

worthy moat
# inner mulch okay

You could create an Object like "TradeContainer" and this one stores the Inventory , the players who are trading and the items each player offers

#

And then you have everything you need

inner mulch
worthy moat
mortal hare
worthy moat
inner mulch
#

yes, i started 2 weeks ago

mortal hare
#

Object is the instance of the class

worthy moat
inner mulch
mortal hare
#

new YourClass()

#

is your object

#

YourClass is the class

worthy moat
worthy moat
mortal hare
#

new keyword instanciates it and makes an object

inner mulch
# worthy moat yes

im german too, and i agree, telling ppl to learn the basics doesnt really help them

mortal hare
#

on one hand you cant really teach java properly on discord

#

on everything

#

on the other hand being rude doesnt help either

worthy moat
inner mulch
#

yeah, i mean if the person doesnt know something like if statements they should probably learn the basics first, but if the qeustions are more complex its not helpful so say something like that.

worthy moat
#

The problem I had back in the day was that I only knew the german names for something like constructer....Then I asked what was is and the only answer I get is "learn java".....It doenst really help if you just tell someone that without knowing why someone does ask that

inner mulch
#

yeah thats not nice

worthy moat
#

yeah

inner mulch
#

you are right, i will start developing my plugin now :)

vital ridge
#

I'm getting this error when starting my server

[00:55:53 ERROR]: Could not load 'plugins\helper.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!

In my plugin, I'm using 2 dependencies, i mvn installed both of them and then threw them into pom.xml. The thing is, one of the dependencies uses the 2nd dependency aswell in it's code.

young knoll
#

Are you doing new MyMainClass anywhere

vital ridge
#

not in my own code.

young knoll
#

Are the dependencies doing that for some reason

vital ridge
#

Well they might, but when both of the dependencies are on my server and I remove my plugin, the error doesnt occur.

icy beacon
vital ridge
#

Well the dependencies are actually connected, the first dependency (a prison core) uses the 2nd dependency (the helper)

icy beacon
#

it's fine for them to be connected as long as it's not in a circle

#

if A depends on B, B can't depend on A

vital ridge
#

yeah a only depends on b.

#

As far as I'm concerned.

icy beacon
#

and what if we add C

#

because there are 3 plugins from what I see

vital ridge
#

Well yeah my plugin depends on the core since I'm using it's functionality.

#

The core uses the helper

#

But noone needs my plugin in order to work, so there should be no circle.

#

But there is that error.

young knoll
#

Do you have 2 plugins with the same name

icy beacon
#

are there any lines in the stacktrace that trace back to some of your code?

icy beacon
vital ridge
vital ridge
#

Only one, let me show it.

#

?paste

undone axleBOT
hazy parrot
#

Well, something is somehow creating new instance of class which is extending JavaPlugin

vital ridge
flint coyote
#

Do you have two Plugins with the Main class called "Main"?

vital ridge
#

No.

hazy parrot
vital ridge
#
CompositeTerminable var10001 = this.terminableRegistry;
#

Just some member initialization

hazy parrot
#

What are those var namings

vital ridge
#

Not sure, not my code.

hazy parrot
#

Send WildTile line 15

#

Is that your pl?

vital ridge
#

Yep

#

thats the beginning of my class

#

which extends java plugin

#

the line of the class definition

hazy parrot
#

I would say it's library problem

#

Is it open source?

vital ridge
#

I got that

#

Before compiling

#

Its a warning

#
[WARNING] WildTile-1.0-SNAPSHOT.jar, XPrison-1.0.jar, helper-1.0.jar define 2 overlapping resources: 
[WARNING]   - META-INF/MANIFEST.MF
[WARNING]   - plugin.yml
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
hazy parrot
#

That is not really problem

vital ridge
#

Gotchu.

chrome beacon
#

Are you shading your helper lib

hazy parrot
#

Is that helper plugin open source?

chrome beacon
#

And trying to load it too?

hazy parrot
chrome beacon
#

I don't think you're supposed to shade helper

vital ridge
#

How should I add it to my project then?

young knoll
#

Maven or gradle?

vital ridge
#

iam adding with maven

young knoll
#

Set scope to provided

vital ridge
#

Done.

#

I ran mvn install on the helper jar file

#

and then added the dependency to my pom.xml

#

Thats how I did it

#

Well I have no idea how to go from here.

#

It cant be the library problem, its such a big plugin they would have discovered it already.

#

Okay

#

I added the <provided> scope to both of the dependencies

#

now I don't get the plugin already intialized error

#

but now it spits our errors that it can't find classes

#

Do I need to include the dependencies in my plugin.yml aswell?

chrome beacon
#

Did you add the helper jar to the server

vital ridge
#

Yes.

#

But I haven't added any dependencies in my plugin.yml

chrome beacon
#

Try doing that

vital ridge
#

How do I know the correct names to add there though

chrome beacon
#

You check the plugin.yml

#

Of the other plugins

vital ridge
#

That worked.

#
if (!Bukkit.getPluginManager().isPluginEnabled("XPrison-1.12.2-RELEASE")) {
            this.getLogger().warning("Unable to hook into UltraPrisonCore! Disabling...");
            this.getServer().getPluginManager().disablePlugin(this);
            return;
        }
#

this method does not work, it returns false, even though I have a plugin named exactly that in my plugins folder

#

Also XPrison is in my dependencies in the plugin.yml

#

I tried changing the XPrison name to Vault and then the method worked correctly.

echo basalt
#

It's not the file name

#

but the name in the plugin.yml

mortal hare
#

that way you dont need to retrieve the plugin by its name

#

and you can just specify that api class instead

vital ridge
#

That worked, now I'm just getting this error in the console:

[02:23:23 ERROR]: Error occurred while enabling WildTile v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
#

i Honestly dont know what the fuck is going on today

mortal hare
#

where are you executing this code

#

on load or on enable?

vital ridge
#

onEnable

mortal hare
#

have you added loadbefore

#

in plugin.yml

vital ridge
#

no

#

What would it do?

mortal hare
#

i meant depend not loadbefore

vital ridge
#

yes

#

the dependencies are added

mortal hare
#

am i correct thinking that you've added depend: XPrison inside plugin.yml

tender shard
vital ridge
#

yeah

#

As the plugin.yml had it

vital ridge
tender shard
#

what's TextUtils line 26?

#

or WildTileEnchantment line 13?

vital ridge
#

That has literally never caused me any problems before

#

In other plugins

mortal hare
# vital ridge X-Prison

im pretty sure your field inside ChatColor.translateAlternateColorCodes() somewhere is null

tender shard
#

i doubt that this is actually line 13. Or if it is, then the stacktrace you sent doesn't match your source code

mortal hare
#

reloadDefaultAttributes() line 49

#

null string object inside ChatColor.translateAlternateColorCodes()

#

if i had to guess

tender shard
#

or does WildTileEnchantment extend XPrisonEnchantment?

vital ridge
#

yes it does

tender shard
#

then it looks like you're creating your enchantment instance before XPrison got properly enabled

#

check in your log whether XPrison gets enabled before your plugin

vital ridge
#

it does

tender shard
#

is this prison thing on github?

vital ridge
#

ALso the code should be in the correct order, I just checked + I followed the exact Devs guide on github

#

yes lemme send it

tender shard
#

the message parameter in TextUtils line 26 is null, so lets see where it comes from

vital ridge
#

Line 26 is just a brace

#

thats the whole function

tender shard
#

there is no "RawName" set for your enchantment in the xprison enchantment config

#

this returns null for your enchantment

#

and then it gets passed to translateAlternateColorCodes which doesn't accept a null to translate

tender shard
#

there's either no Name or no RawName set for that enchantment

vital ridge
#

I did add it

#

I still get the exact same error

#

Even though i shouldnt

#

cuz I specificied both the rawname and name in the config as the dev guide asked me to.

vital ridge
#

Yeah Idk i literall added the rawname and name to the config

#

Like the dev guide told me to

#

Still null

unborn sable
#

Would block.getFace() return the face that is forward on a dispenser?

#

Cause I need a way to modify dispensers but make it look vanilla

young knoll
#

It’s part of BlockData

vital ridge
wet breach
vital ridge
unborn sable
young knoll
#

Check which BlockData type dispenser uses

#

It’ll be in the docs of its material

#

I think it’s orientable

unborn sable
#

When I get the Dispenser event’s (forgot name) block, it won’t let me get it as a Dispenser type instead of just block

vital ridge
unborn sable
#

I try to get the block as a dispenser but it says I can’t cast it as one ( because the only block that comes from the event is a dispenser )

young knoll
#

Show the code

unborn sable
#

K idea is being slow so one minute

#

So it won’t let me copy for some reason

#

There is the code though

young knoll
#

Dispenser is BlockData not a block

#

Use block.getBlockData

unborn sable
#

O

#

Would it be the getFacing method

young knoll
#

Yes

unborn sable
#

Ok

#

Now how would I use that face to spawn an entity 1 block away from the block

simple schooner
#

Can u store an arraylist in a hashmap?

unborn sable
#

I just need to dispense custom spawn eggs like charged creepers and giants

#

They are just spawn eggs with pdc values

young knoll
#

block.getRelative(face)

young knoll
simple schooner
#

Okay thank you

simple schooner
#

Like add objects

#

I'm trying to store the player's created hologram so that they can edit it

unborn sable
young knoll
#

Assuming block is the dispenser

#

It will be the one next to it

young knoll
#

But if you find yourself nesting collections you probably want a data class

unborn sable
simple schooner
#

uhm the problem is, I don't know what that is. I'm new to java, it's only been like 3 days

young knoll
#

A data class is a class designed to just hold data

#

In this case you’d have a Map<UUID,DataClass> and the dataclass would have all the holograms

#

As well as methods to interact with them

simple schooner
#

So I could just store the display entity?

#

im dumb i don't know what im saying

dim oxide
#

anyone can help me with bungee messaging channel?

unborn sable
young knoll
#

I assure you it does exist

#

Are you using the correct dispenser import

unborn sable
#

I see it on the docs

unborn sable
#

Oh

#

I was using org.bukkit.block.Dispenser

young knoll
#

You need the BlockData one

unborn sable
#

Yea now it works lol

echo basalt
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

dim oxide
# echo basalt ?ask

I am trying to do a cross server staffchat using the bungee messaging channel, the thing is that the message is sent but the other server does not receive it

echo basalt
#

The server needs an online player to receive it

dim oxide
#

and there is one

echo basalt
#

Show code

dim oxide
#
    public void bungeeStaffChatSend(Player sender, String message) {
        if (!plugin.getPlugin().getConfig().getBoolean("bungeecord")) {
            return;
        }

        String format = plugin.getConfig().getStaffchatFormat().replace("{player}", sender.getName()).replace("{message}", message);
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF(format);

        sender.sendPluginMessage(plugin.getPlugin(), "kumastaff:staffchat", out.toByteArray());
        System.out.println("Sending message to BungeeCord");
    }

    @Override
 public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
        if (!channel.equals("kumastaff:staffchat")) {
            return;
        }
        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String msg = in.readUTF();
        System.out.println("Received message from BungeeCord");
        player. sendMessage(msg);
    }```
echo basalt
#

Did you register the plugin channel

dim oxide
#

Yes I believe

echo basalt
#

show proof

dim oxide
#

and in the main I did

StaffchatBungee bungee = new StaffchatBungee(this);
bungee.load();```
echo basalt
#

h m

#

w a i t

#

You don't have a bungee plugin in between?

dim oxide
#

No

echo basalt
#

Yeah that's your problem

dim oxide
#

oh

echo basalt
#

You're sending a message through a player

#

and expecting to receive it elsewhere

dim oxide
#

and what should i do then?

echo basalt
#

Switch to redis or make a bungee plugin

dim oxide
#

Is it very difficult to use redis? xd

echo basalt
#

eh

simple schooner
#

can you open an inventory asynchronously

echo basalt
#

Great question

#

don't think so

simple schooner
#

ok

dim oxide
echo basalt
#

It's not complicated

#

But it's an added dependency

#

you'll need a redis server

#

and to either shade or use the library loader feature to load the redis driver

dim oxide
#

oh

simple schooner
echo basalt
#

runTask, do your thing

inner mulch
#

How do I give infinite potion effects to players? Like with the /effect command in the newer versions?

echo basalt
#

set the ticks as integer.max_limit

inner mulch
#

do you also know how i can remove certain effects from a player or can i only remove all of them at once?

young knoll
#

Use -1 for duration

echo basalt
#

literally use your ide

young knoll
#

There is a constant for it somewhere

echo basalt
#

and just type "player.potion" and see what it comes up with

young knoll
#

PotionEffect.INFINITE_DURATION

inner mulch
#

if you are not willing to help on this question then dont, but when i looked i couldnt find something like that

#

maybe im blind

inner mulch
young knoll
#

removePotionEffect