#help-development

1 messages ¡ Page 2035 of 1

fluid cypress
#

i want to check it with a script

#

you know, in case i come back to make a plugin in 2024 or so

#

i wont remember all this

tender shard
#

you should not do that

fluid cypress
#

thats my primary goal

tender shard
#

you should not just update your dependencies just because there's a new version

fluid cypress
#

but im always compiling to the latest mc version

tender shard
#

you can use mvn version plugin

#

one second

#

mvn versions:display-dependency-updates

#

or for your maven plugins:

#

mvn versions:display-plugin-updates

#

it'll print out all plugins you can "update" then

#

or dependencies

#

but you should never just automatically update them, you should always stick to the version you know that's working for you, and only update if you have a reason to

#

that's basically the whole point of maven - to make your build consistent and reproducable

lavish hemlock
quaint mantle
lavish hemlock
#

I always have to turn to IntelliJ's "before launch tasks" system to get shit to work

tender shard
#

maven-enforcer it is I guess

fluid cypress
lavish hemlock
#

Also:

#

Why the fuck do I need to install a submodule to be able to use it as a dependency

#

Also:

lavish hemlock
#

Why the fuck didn't Maven compile before running one of my submodules?

#

Why do I have to configure it to do that manually?

tender shard
lavish hemlock
#

I'm referring to

#

a completely isolated submodule

#

where

#

I try to run it

#

and then I get a class not found error

#

because Maven didn't even try to compile it

tender shard
#

compile what exactly?

lavish hemlock
#

the submodule

tender shard
#

and what class didn't it find?

lavish hemlock
#

the main class

#

but

#

most likely all of them

#

since it didn't compile

tender shard
#

if your submodule depends on a class from your main module, then of course that won't work

lavish hemlock
#

it doesn't

tender shard
#

then I don't understand your setup

lavish hemlock
#

I had two modules

#

which did not depend on the parent, or each other

#

I just needed to use a parent POM so I could have them in the same Maven project

#

I compiled one and used its binary as an input to the other

#

But manually

#

Because fuck trying to do that through Maven

tender shard
#

works fine for me, you must have gotten something wrong

fluid cypress
lavish hemlock
#

I don't think so because I've done similar things in other projects and its worked fine

fluid cypress
#

thats what maven is using

#

i guess

lavish hemlock
#

For this particular one it just broke

#

Also

#

It is fucking impossible to use Maven for anything complicated and I will take that to my grave

tender shard
lavish hemlock
#

They were incredibly simple POMs though :p

#

No custom logic

lavish hemlock
#

I was trying to place the binary of one submodule inside the binary of another

#

Which is a slightly uncommon thing

#

but shouldn't be too hard, right?

#

If I can describe it in a single sentence, it should be easily done

#

2 hours

tender shard
#

normally you want to have a "distribution" pom that puts your stuff together instead of letting the parent pom do it

lavish hemlock
#

And it still didn't work

lavish hemlock
#

Fucking what is it uhh

#

maven-assembly-plugin is impossible to use

#

And the modules system is god awful

tender shard
#

assembly is the stupid version of the shade plugin

#

I'd always use shade instead of assembly plugin

lavish hemlock
#

Shade plugin has no option not to unpack binaries

#

It is too specific

#

I mean my use-case is pretty specific

#

I was trying to have a dynamic agent jar inside my jar so I could extract it at runtime

#

but

#

binary-in-binary stuff in Java is also common with JNI

#

which is actually common

fluid cypress
#
    <properties>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.source>17</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

this version will change depending on what is minecraft using, right?

tender shard
#

no

#

that only tells maven to compile for java version 17

fluid cypress
#

because thats what minecraft is using?

#

what if i set that to 8, for example

#

i cant use that plugin in 1.17+

golden turret
fluid cypress
#

or something like that

tender shard
#

java 8 plugins run fine on MC 1.18

#

and 1.17

#

etc

fluid cypress
#

then i can set that to 17 forever

#

?

tender shard
tender shard
#

example:

public class DeathMapManager {

    private static final Main main = Main.getInstance();

    private static MapCursor.Type getCursorType() {
        MapCursor.Type type = EnumUtils.getIfPresent(MapCursor.Type.class,main.getConfig().getString(Config.DEATH_MAP_MARKER.toUpperCase(Locale.ROOT)))
                .orElse(null);
        if(type == null) {
            type = MapCursor.Type.RED_X;
            main.getLogger().warning("You are using an invalid value for " + Config.DEATH_MAP_MARKER + ". Please see config.yml for valid values. Falling back to RED_X now.");
        }
        return type;
    }

    public static ItemStack getDeathMap(Location location) {
        ItemStack map = new ItemStack(Material.FILLED_MAP);
        MapMeta meta = (MapMeta) map.getItemMeta();
        MapView view = Bukkit.createMap(location.getWorld());
        view.setScale(MapView.Scale.CLOSE);
        view.setCenterX(location.getBlockX());
        view.setCenterZ(location.getBlockZ());
        view.setUnlimitedTracking(true);
        view.setTrackingPosition(true);
        view.addRenderer(new DeathMapRenderer(getCursorType()));
        meta.setMapView(view);
        PDCUtils.set(meta, NBTTags.DEATH_MAP, PersistentDataType.BYTE,(byte) 1);
        map.setItemMeta(meta);
        return map;
    }

    public static boolean isDeathMap(ItemStack itemStack) {
        if(itemStack == null) return false;
        if(!itemStack.hasItemMeta()) return false;
        return PDCUtils.has(itemStack,NBTTags.DEATH_MAP,PersistentDataType.BYTE);
    }

    private static class DeathMapRenderer extends MapRenderer {

        private boolean isDone = false;
        private final MapCursor.Type type;

        private DeathMapRenderer(MapCursor.Type type) {
            this.type = type;
        }

        @Override
        public void render(@NotNull MapView map, @NotNull MapCanvas canvas, @NotNull Player player) {
            if(isDone) return;
            isDone = true;
            canvas.getCursors().addCursor(new MapCursor((byte)0, (byte)0, (byte)0, type, true));
        }
    }
}

golden turret
#

isnt there a getter method?

tender shard
#

you don't have a MapCanvas outside of a MapRenderer

golden turret
#

:C

tender shard
#

what do yo uneed it for?

golden turret
#

i want to draw some pixels

tender shard
#

yeah, just attach a custom MapRenderer to your map's view

#

as I did above

#

my maprenderer above simply adds a cursor

golden turret
#

a square

tender shard
#

you can use the same to draw your rectangle

golden turret
#

ok thanks

tender shard
#

np

young knoll
#

Claim borders on map

#

That would be nice

golden turret
#

what is the size of a normal map

lavish hemlock
#

intelligence

river oracle
#

Mb it's 128x128

#

Sorry had to look it up on Google

muted sand
#

does spigot have 1.19 support? if it does, can i use buildtools to get it?
are the nms mappings subject to change also?

wet breach
#

most people should stick with shade plugin as that is the most appropriate to use

#

assembly plugin is for when you need to do other things like making a WAR file or configurations need to go into other places.

#

also you need the assembly plugin when dealing with native dependencies

muted sand
warm trout
#

Lets the say the wool block closer to the bottom is the starting location, and the wool block closer to the top is the end location. I've figured out how to get the location in front (stone block), how would I get the blocks to the left/right of it (the dirt blocks)

wet breach
#

and why

#

there is various ways you can do it

#

but which is the most ideal depends on some factors you haven't presented

young knoll
#

Vectors have various rotateAround methods

warm trout
#

I've not figured out how to make it go downwards yet, but that's probably not very hard

wet breach
#

ah ok

#

got the thing for you to look into then or research

wet breach
warm trout
#

Interesting, I'll take a loom

lavish hemlock
#

Our looms cost $20

wet breach
#

lol

warm trout
#

LMAO

warm trout
wet breach
#

yes, the reason I suggested it is that it breaks up the pathfinding up into maps

#

making it easier to see what is near your path

#

similar to like how bounding boxes work

#

you would modify it so that instead of going around ores

#

it will go to ores 🙂

warm trout
#

Hmmmm thank you for explaining

#

I will try do this

warm trout
# wet breach you would modify it so that instead of going around ores

Wait, I've kind of cheesed it, I set it to path find to the location, and when it is done, if it still more than 3 blocks away from the destination it break the 3 blocks in front of them and restart the pathfinding, the only problem is it doesn't work if it isn't right in front, which is why I wanted to break the 3 blocks to the left and right as well

wet breach
#

well, the pathfinding method I stated, when it breaks it up into maps

#

you can better find the ores along the path

#

including in front

warm trout
wet breach
warm trout
#

Sheesh

strong parcel
#

Howdy! Does anyone know how to assign a banner pattern to a shield?

earnest forum
#

bannermeta

#

cast the itemmeta to BannerMeta

#

BannerMeta#setPattern(index, Pattern)

#

@strong parcel

somber hull
#

Yea , you should be able to do item.getMeta

#

But cast it to banner Mets

#

And then set the pattern

#

And then set the meta@of the item to your banner meta

strong parcel
#

Thanks! I am also changing the Display name and lore of the shield. Would setting the item meta to the banner meta overwrite the name and lore changes?

earnest forum
#

no

#

banner meta extends item

#

it has everything item has

strong parcel
#

Okay, so I could do BannerMeta.setDisplay(“Cool shield”) ?

earnest forum
#

yes

strong parcel
#

Alright, thanks!

earnest forum
#

banner meta is just item meta with extra methods for banners

#

same as skullmeta, etc

tough crane
#

Hii , when i dev plugins for spigot 1.17.1 , on file plugin.yml , the api-version is 1.17 or 1.17.1 ?

eternal oxide
#

1.17

tough crane
#

ok thanks :p

eternal oxide
#

website or IDE docs?

tough crane
#

i'm french , and i'm bad in english so not easy for me ^^

eternal oxide
#

Website javadocs are great. Use the search box, top right

#

as for teh layout, it comes with experience.

errant narwhal
#

hi

#

how to make click on leave all the leaves nearby turn to web?

#

i have try to world.getlocation but it only get x+, x- or y+y-, z+z- it don't have every block near change

eternal oxide
#

You want to change all connected leaf blocks in an area to web when you click on one block?

#

You would need to either write an algorithm to search connected blocks from the clicked block (with a range limit), or search an area (cuboid) around the clicked block to find all leaf blocks

vocal cloud
#

Run it async then when you've discovered a block run a sync task to change it

quiet ice
#

I'm currently parsing some poms and came to an edge case: is "${pom.version}" equivalent to "${project.version}" in maven or is there some difference?

manic furnace
#

How can i animate something like a fake fire? Like much smoke that is raising in the air?

visual tide
#

you could spawn smoke particles

manic furnace
#

Yeah but the just fly away in all directions

quiet ice
smoky oak
#

after how many comparations/invocations with a value / uses of a function does it make sense to cache said value/object of the function?

#

for example in event registering

#

when does it start making sense to cache the PluginManager?

lost matrix
smoky oak
#

do you know why it wouldnt improve performance?

quiet ice
#

JIT

#

Or more specifically speaking, JIT will inline this call

glossy venture
#

how would i distribute x amount of objects over y amount of threads, using

List<Object> objs;
/* into */ Map<Integer, List<Object>> distributed;
#

without leaving any

quiet ice
#
for (int i = 0; i < objs.size();i++) {
    distrbuted.put(i % y, objs.get(i));
}
#

it's a pretty bad implementation performance-wise but certainly the easiest

glossy venture
#

seems fine

#

thanks

quiet ice
#

technically it could be a List<List<Object>>

glossy venture
#

oh yeah wait

#

lmfao

smoky oak
#

I'm feeling like im slowly becoming insane here

#

where does the --remapped, --generate-docs and --generate-sources spit out said .jar files???

cold field
#

Heya guys. Does it exists a way to see git blame online on a spigot stash's repo?

undone axleBOT
smoky oak
#

yea see thing is

cold field
smoky oak
tardy delta
#

white mode

cold field
#

Uh, didn't see that XD

#

ty

smoky oak
quiet ice
#

And you are sure that you are building 1.18.2?

smoky oak
#

yes, my args are --rev 1.18.2 --remapped --generate-docs --generate-sources

quiet ice
#

?bt

undone axleBOT
smoky oak
#

thats where i got them from yes

#

which does NOT answer the question why it builds only the api

quiet ice
#

I'm building it myself

#

I never use NMS myself, so I rarely have a bt jar lying around myself, so that command is the easiest way to obtain it

smoky oak
#

on that topic it said that --remapped is not an 'existing profile'

#

do you know the correct argument for that?

cold field
quiet ice
#

Did it use to exist?

cold field
#

yeah

tardy delta
#

did it ever exist 👀

cold field
#

Ohhh, maybe it was a paper thing

hollow bluff
#

just use that

quiet ice
cold field
quiet ice
smoky oak
#

uh

#

which of those do i import

quiet ice
#

Or ~/.m2/repository/org/spigotmc/spigot

spare sky
#

You don't know why when I import org.bukkit.command.CommandSender; so will it give me an error?

quiet ice
#

Did you include the bukkit/spigot-api/etc. jar in your build path?

smoky oak
#

originally i did not since I've been told i can just leave like that but that gives an error

#

something something not avilable something something

spare sky
quiet ice
#

Maven or gradle?

smoky oak
#

me be maven, and reason for this question in the first place is that just leaving it 'as is' does NOT import javadoc

quiet ice
spare sky
quiet ice
spare sky
#

Eclipse

smoky oak
#

do i just hit 'import sources and javadoc' here, then?

smoky oak
quiet ice
smoky oak
#

which i am doing

#

wait

quiet ice
#

You can easily do that while not importing the spigot-api itself by having a classifier

hardy swan
#

different artifact, not classifier

smoky oak
#

what's the correct pom.xml entry then

quiet ice
spare sky
# spare sky okey

Can I have more modulepaths? I'm sorry to ask about stupid questions but I just started and I want to put one plugin from 1.12.2 to 1.18.1

quiet ice
# smoky oak what's the correct pom.xml entry then
        <dependency>
            <groupId>io.github.coolmineman</groupId>
            <artifactId>trieharder</artifactId>
            <version>0.2.0</version>
            <classifier>javadoc</classifier>
            <type>jar</type>
        </dependency>

something like this I guess

minor garnet
#

a doubt, all entities are updated within the world within a period of 50ms (20 tps) or on the tick base of Minecraft?

smoky oak
quiet ice
#

What the hell do you use

quiet ice
quiet ice
smoky oak
#

i dont know what i did but it works now

#

thanks i guess

#

on a different note

#

should i make a public static field for the plugin instance or make it private and write a getter, which method is wrong, and why?

quiet ice
#

technically speaking both are wrong

#

?jd.s

#

?jd-s god damn it

undone axleBOT
smoky oak
#

uh what am i supposed to do then

quiet ice
spare sky
smoky oak
#

MainClass.getPlugin(MainClass.class) somehow looks wrong

#

am i really supposed to do that?

quiet ice
#

MainClass pluginInstance = JavaPlugin.getPlugin(MainClass.class) is correct, yes

smoky oak
#

note taken

#

also

#

is that the fastest method as well?

quiet ice
#

No

smoky oak
#

why not cache the instance in a static variable?

quiet ice
#

you should not use it within your own plugin - for that you should use DI

smoky oak
#

i meant in my own plugin

quiet ice
#

API consumers should only call this method once

quiet ice
undone axleBOT
quiet ice
#

there is no need for a static field

#

And the difference between GETSTATIC and GETFIELD is perhaps a few clock cycles but not much more

smoky oak
#

wait

#

so

#

does this work with commands as well?

#

also

quiet ice
#

It works with pretty much everything and long as you have relatively sane code

smoky oak
#

is that a copy of the mainclass or a pointer?

quiet ice
#

It's a low-level reference, yes

#

To answer your question, it does not copy the contents of the object. It might copy the header structure or whatever, but that is small enough to be discardable

smoky oak
#

ah that makes sense

#

since it can still access the actual object it is closer to a pointer, yes?

quiet ice
#

Yes and an instance comparison will yield true

smoky oak
#

k thanks

#

wish we could just do public this(args){} instead of having to specify the class name

quiet ice
#

You can do

    {
        // Code
    }

If you want to have a no-args constructor. Just note that this block will also be implicitly run when a constructor is invoked with args

smoky oak
#

huh thats interesting if a bit useless

#

i have never found myself using a empty constructor

#

*no-args

quiet ice
#

It is usefull if you are dealing with checked exceptions

visual tide
#

iirc it runs before the constructor

#

init block then constructor

glossy venture
#

oh

#

so thats the concept behind

static {
  // ...
}
quiet ice
#

just that static {} runs on class init and {} on object init

glossy venture
#

yeah

sacred mountain
#

hey wahts the best way to get a random double between two numbers?

sacred mountain
#

ThreadLocalRandom.current().nextDouble(min, max);?

quiet ice
#

yeah

sacred mountain
#

aight thanks

quiet ice
#

A more simplictic solution would be random.nextDouble(max - min) + min

#

Or if you use a more modern version of java even random.nextDouble(min, max) works

#

(where as random is an instance of java.util.Random)

sacred mountain
#

hey does creating a new entitydamageevent and specifiing the damage and entity

#

does that actually damage the entity

#

or do i have to run LivingEntity#damage()

quiet ice
#

The even itself does nothing

#

It's only a signal to plugins

#

Also be aware that event constructors are not public API

#

(A strange design decision though - but it is true)

tardy delta
#

why is the get method in Map not of the signature V get(T t) instead of V get(Object obj)?

sacred mountain
quiet ice
#

yes

quiet ice
#

It could have also been an artifact of the early days of generics

tardy delta
#

fun

glossy venture
#

i wish there was a way to just push a stack frame onto the thread stack and force a synchronous method call

vocal mirage
#

Hello!
I made a command that sends player to a server, and I would like to make a reliable system that tries every 5 seconds to send a player to a server if it's online.
I tried with a while boucle that sends the player if the server is accessible (with the method .canAccess(ProxiedPlayer p) & responds with a ping, and sometimes it sends me even if the server isn't available.

How can I proceed?
Thanks

glossy venture
#

to test my task system

#

i dont have the bukkit scheduler available in junit

#

so i need to do something else

quiet ice
#

A thread group might be good there

glossy venture
quiet ice
#

I however rarely use it so I do not know the name of the central thread pool

glossy venture
#

you mean java.lang.ThreadGroup

#

or something

quiet ice
glossy venture
#

no but i want a structure like

- main -> calls task 1 (sync)
  | main -> executes task 1
- main -> calls task 2 (async)
  | other thread -> executes task 2
  v makes main call task 3
- main -> calls task 3 (...)
#

oh wait

#

i think i see what you mean

quiet ice
#

Also just note that async is the worst word to ever exist

glossy venture
#

does a Callable grant the ability to call it in the thread where it was made

quiet ice
#

It could run on a new thread, on a thread pool, on a thread dedicated for such operations, on the main thread or it could also never run

glossy venture
#

so if i create it in main and call it in other thread will it run on the main thread

quiet ice
#

As such I prefer if people use the words "Off-thread" or "Concurrent"

glossy venture
#

like

Callable c = ...;

{
  // other thread
  c.call();
}
#

wait lemme test

quiet ice
#

Yes that is possible

#

The callable needs to be defined before or while the operation runs. You cannot define it after it runs

regal dagger
#

How to enchant an item?

quiet ice
#

?jd-s

undone axleBOT
glossy venture
#

nah this doesnt work

glossy venture
quiet ice
#

Or you are thinking about futures

quiet ice
glossy venture
#

i simply want to call back to a different thread from another thread

#

whenever its needed

#

could i use threadlocals?

#

oh no wait

quiet ice
#

So something like

task1 () {

}task2 (Lock lock) {
lock.unlock();
}
task3() {}
main() {
    task1();
    Lock lock = createLock();
    lock.lock();
    new Thread(() -> task2(lock)).start();
    lock.awawitUnlock();
    task3();
}

?

#

In that case, you could replace your task2 with a (completeable-)future

glossy venture
#

is lock a built in class

#

oh ye

#

but the problem is that the whole point is that it will be asynchronous

#

so it wont block the caller thread while an async task is running

quiet ice
#

You need to block the thread in order for it process the task

sacred mountain
#

i'm having a small problem with dealing the correct amount of damage to a player.

ive been using LivingEntity#damage(double damage, @Nullable Entity source)
its been quite inaccurate.

#

it dealt 5 hearts when the message says it should have dealt 6.25

#
[12:46:26 INFO]: EntitiesDamaged Fresh Hashmap: {}
[12:46:26 INFO]: PlayerDamage Fresh Hashmap: {}
[12:46:26 INFO]: Shooter: CraftPlayer{name=clonkc}
[12:46:26 INFO]: Entity: CraftPlayer{name=clonkc}
[12:46:26 INFO]: Minimum damage: 10.0
[12:46:26 INFO]: Maximum damage: 14.0
[12:46:26 INFO]: Randomdamage: 12.529193606696865
[12:46:26 INFO]: TruncatedRandomDamage: 12.5
[12:46:26 INFO]: Distance: 4.219880848263866
[12:46:26 INFO]: DistanceTruncated: 4.2
[12:46:26 INFO]: TotalDamage Filled Hashmap: {5c93ac00-5aeb-45f6-8163-b2740cf27a68=12.5}
[12:46:26 INFO]: EntitiesDamaged Filled Hashmap: {5c93ac00-5aeb-45f6-8163-b2740cf27a68=1}
[12:46:26 INFO]: PlayerDamage Filled Hashmap: {}
[12:46:26 INFO]: TotalDamageDealt: 12.5
[12:46:26 INFO]: TotalDamageDealt Truncated: 12.5
[12:46:26 INFO]: Entities Damaged end hashmap: {}
[12:46:26 INFO]: total damage end hashmap: {}
[12:46:26 INFO]: player damage end hashmap: {}```
#

i outputted some info

#

there doesnt seem to be any issues

quiet ice
#

Or if you do not care about when it invokes the task on the main thread and have some tick system

list<Runnable> sdghnjksvb
void tick()
  // caighhklj5r
  sdghnjksvb.foreach(Runnable::run)
}
task2() {
   sdghnjksvb.add(() -> this::task3);
}
glossy venture
#

this might give some backstory

glossy venture
#

with the bukkit scheduler

sacred mountain
#

ok well somethings clearly wrong but i dont know what.

smoky oak
glossy venture
#

but i guess ill test the rest and optimize it later

sacred mountain
smoky oak
#

more distance == less damage

quiet ice
#

Or just stop attempting to try to have something run on thread X

sacred mountain
quiet ice
#

(Concurrency safety!!!)

sacred mountain
#

because im implementing it myself

#

i dont want it to have falloff

smoky oak
#

im unsure if it applies here

#

i just know it happens with tnt and fireballs

quiet ice
#

Like, as soon as everything is thread-safe you don't have to care about on what thread something runs on at all

sacred mountain
#

it does here

#

its a fireballl

smoky oak
#

are you directly dealing damage or setting the damage the fireball does to entities

sacred mountain
#

directly dealing since im using onexplode and not entitydamagebyentityevent

#

i couldnbt really get my head around using entitydamagebyentityevent

#

should i add all the damaged entities by a certain explosion to a hashmap and then get the info there?

smoky oak
#

code for damage plese

sacred mountain
#

but then i would need a multimap/nested map since i would need to store damage values and distance

glossy venture
#

thats not thread safe at all

#

it actually prevents usage of the api asynchronously

sacred mountain
#

should i put it in a paste

smoky oak
#

would help

sacred mountain
smoky oak
#

usually we use something else but meh that works too

#

for the record this discord uses

#

?paste

undone axleBOT
next stratus
#

async block#setType when? 😦

sacred mountain
smoky oak
#

think i found it

#

look at the javadoc

sacred mountain
#

im using that tho

smoky oak
#

that might convert the damage to what's normal for an explosoin

sacred mountain
#

oh right

smoky oak
#

try just using damage(double)

#

im not too sure tho

sacred mountain
#

then i would have to make an entitydamageevent to set the last damage cause

#

otherwise errors would bt thrown

smoky oak
#

wdym?

sacred mountain
#

the player would die from an unknown cause right

#

livingEntity.setLastDamageCause(new EntityDamageEvent(livingEntity, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, truncatedRandomDamage));

blazing rune
#

Is there a way to make like a win and losses system?

smoky oak
#

that sounds about right

#

again just try if that method works at all first

sacred mountain
smoky oak
#

12.5 -> 6.25 hearts

sacred mountain
#

yeah ik

smoky oak
#

that should be an absolute value

sacred mountain
#

shouldve done 5

#

did 20

tall dragon
sacred mountain
#

lmao

#

and this

tardy delta
#

1 entities

sacred mountain
#

yeah

#

me

tardy delta
#

noob

sacred mountain
#

shut

smoky oak
#

i dont think grammar is the issue here

blazing rune
smoky oak
#

also I am really unsure why the damage fluctuates like that, sorry

tall dragon
blazing rune
tall dragon
#

honestly still not sure what u mean with a win/loss system

sacred mountain
#

@tardy delta

#

get good

tardy delta
#

you were given

sacred mountain
#

you recieved

#

ok

blazing rune
sacred mountain
tall dragon
sacred mountain
#

????? why does 150+ damage not kill a zombe

blazing rune
sacred mountain
#

OH I KNOW WHY

tall dragon
sacred mountain
#

i cant damage the entity in the no damage tick, i.e. the part where they are red

#

its just doing the normal fireball damage im fairly sure

blazing rune
tardy delta
#

lol

blazing rune
#

I couldn't find a solution

#

Not asking to spoonfeed

quiet ice
# glossy venture im using bukkit here

Bukkit has it's own API for dealing with this. And if you are outside of Bukkit then there is likely somewhere some API for dealing with pushing a task on the "main" thread. However when creating your own APIs you should just make your (and other's) life easier by making everything thread-safe

blazing rune
#

But if ya got like any suggestions

glossy venture
#

but i already found a solution

#

so its fine

tall dragon
ember estuary
#

How can you generate a vanilla structure, for example an ocean monument ?

glossy venture
#

although im getting this

ember estuary
quiet ice
#

what exactly is your solution there?

sacred mountain
#

ok nvm that completely did not work

quiet ice
#

And why is it using monitors...

sacred mountain
#

its meant to do 1.7 damage wtf is wrong with it

#

[13:12:38 INFO]: Randomdamage: 1.7340708572622148

#

and it insta kills me

#

im fairly sure thats not normal

smoky oak
#

static or JavaPlugin linked instances of FileConfigurations?

sacred mountain
#

i dont use fileconfiguration

smoky oak
#

let me rephrase that

#

which should I use

sacred mountain
#

lmao

#

i have used javaplugin linked

#

in the past but i dont know if htats the best way

#

ask geol

#

he probably knows

glossy venture
quiet ice
#

Ideally you'd not link the file config to anything

smoky oak
#

so a static public one?

quiet ice
#

Nah

smoky oak
#

?

quiet ice
#

And what is the full stacktrace?

quiet ice
# smoky oak ?

Either way I do not know enough context to make a call there

#

public static is probably wrong though

smoky oak
#

well configurations... I've been told earlier to for example not store a static instancce of the MainClass instance, but configurations are something that i feel like they should be global

sacred mountain
#

i setup my whole config in one line lol

quiet ice
#

usually you'd just pass the config down wherever it is needed

sacred mountain
#
setConfiguration(new Configuration(this, YamlDocument.create(new File(getDataFolder(), "config.yml"), getResource("config.yml"), GeneralSettings.DEFAULT, LoaderSettings.builder().setAutoUpdate(true).build(), DumperSettings.DEFAULT, UpdaterSettings.builder().setAutoSave(true).setVersioning(new Pattern(Segment.range(1, Integer.MAX_VALUE), Segment.literal("."), Segment.range(0, 10)), "file-version").build())));
smoky oak
#

well but how to store it

sacred mountain
#

store what

smoky oak
#

the config

sacred mountain
#

i just use a lmobok gettter class

quiet ice
#

field

sacred mountain
#

and the instance is already there

#

so i can do plugin.getConfiguration()

smoky oak
quiet ice
#

lemme draw a schematic

glossy venture
#

ok its a bit messy but this should owrk

tardy delta
#

what is it doin?

quiet ice
#

@smoky oak something like that

quiet ice
glossy venture
#

you create multiple services

quiet ice
#

Also what are you going to do when something crashes?

sacred mountain
quiet ice
#

Or if there is a deadlock

sacred mountain
#

microsoft paint moment

smoky oak
sacred mountain
#

hey how would i set the explosion of an entities last damage to 0

quiet ice
#

You really need to have a supervisor thread (technically you can use the main thread for that but that is going to cause issues)

sacred mountain
#

or nothing

#

and then damage them static

#

with a set amount of damagea

glossy venture
sacred mountain
#

but my problem is that i cant damage them in the no damage ticks time

quiet ice
#

Plus why not inline the wait into the main thread right now it is just wasting CPU cycles

glossy venture
#

although its probably not needed for what im trying to do

quiet ice
#

yes, that is the issue.
Let's say Thread A schedules Task C to run on Thread B. Thread B taskes 583 ms to complete Task C. However Thread A waits until Task C is completed - i. e. it spends more than 583 ms waiting. Why shouldn't Thread A run Task C directly instead of delegating the task to Thread B?

glossy venture
#

its not on a different thread

#

tickLoop() is a direct function

#

check the code

#

i mean TickLoop#run()

quiet ice
#

Even better

glossy venture
#

i have the running flag for terminating the blocking when the process has ended

#

as its not needed

quiet ice
#

uh, I am not sure if you synchronized (lock) is going to work

glossy venture
#

i tested it

#

it doesnt work if i do anything else

quiet ice
#

that would cause a deadlock if used by two different threads

#

at least I think so

glossy venture
#

yeah

#

but the service is meant to be used by one thread

#

idk how to enforce that tho

#

also i spent more than a day on that task system just to use it for building my resource pack on multiple threads

quiet ice
#

I'll be working on a multi-threaded resolution of maven artifacts right about now, so perhaps I can make use of your attempts

glossy venture
#

nice

#

i could make the lock halt for a limited time

#

like a timeout

#

is that a good idea

quiet ice
#

It's pretty staggering on how deep the dependency tree of many artifacts go if you include test and provided dependencies

glossy venture
#

yeah

#

you should make a viewer of dependencies

#

that you can move around in

#

of the humongous tree

#

my artifact wont have any

#

actually

#

paper is huge

#

i bet

quiet ice
#

paper is quite small, junit will be huge

glossy venture
#

no but paper is the whole api + nms and shit

#

so all of the minecraft libs

quiet ice
#

Ah right, actually paper will be nonexistent I assume

glossy venture
#

and everything used by bukkit and spigot

sacred mountain
#

hey i still cannot seem to damage the player properly from an onexplode event.

#

EntittyExplodeEvent i mean

#

ok i finally found the actual damage

[13:51:51 INFO]: Last damage values: 41.0
[13:51:51 INFO]: Last Damage cause: org.bukkit.event.entity.EntityDamageByEntityEvent@691af3e2```
#

why is it 41, i literally cancelled it and set it to 1.5

tall dragon
#

the spaces

#

the spaces are air

#

u have way too many

#

u also have way too many string

crimson terrace
#

you need 3 strings

#

each character represents one item

quiet ice
#

Yeah, the spaces are the issue

crimson terrace
#

first string first row

tall dragon
quiet ice
#

Ah, each string is a row... Then why does it compile in the first place?

tall dragon
#

pretty sure it takes a String...

crimson terrace
#

"ABA","BCB", "ABA"
this would be your correct strings

tender shard
#

everything

#

unless they'll add a 3x9 crafting table in the future lol

tall dragon
#

thats would be kinda cool ngl

crimson terrace
pliant oyster
#

Which inventory type is a double chest?

#

The normal chest is only 3 rows

tall dragon
#

fellas, problem fixed

tender shard
#

now we can finally craft 5 meter torches

pliant oyster
tall dragon
#

finnalyyy

crimson terrace
#

Ive always wanted a longsword

tall dragon
#

i can finally craft a space shuttle now

sacred mountain
coarse shadow
desert tinsel
#

How i can say an integer like: 1000000000000, if it says: Integer number too large

pliant oyster
coarse shadow
#

use long instead of int

tall dragon
#

thank you, thank you. i was unaware of how great an artist i am

coarse shadow
#

or biginteger idk

crimson terrace
tender shard
#

use a long

coarse shadow
#

also i have a question

tender shard
#

integers only go up to ~2.7 billion

desert tinsel
#

ok thx

hollow bluff
sacred mountain
#

long

coarse shadow
#

how can we get a recipe's namespaced key?

pliant oyster
tender shard
#

it will NOT work for MerchantRecipes though

#

only all other types

coarse shadow
sacred mountain
#

Keyed

coarse shadow
#

i wanna use Bukkit.removeRecipe method

tender shard
#

Keyed keyed = (Keyed) myRecipe;

white thicket
#

Can anyone help me? I am trying to setup MySQL to my plugin but I am getting this error;

coarse shadow
#

not a custom recipe

#

i wanna remove a vanilla recipe

quiet ice
white thicket
tender shard
quiet ice
#

Of course it has some precision errors, but you can fully handle really large numbers with it

sacred mountain
quiet ice
#

wat

sacred mountain
#

what about floats*

crimson terrace
#

split the number into 2 longs lol

tender shard
#

long goes up to 9.223.372.036.854.775.807, I guess that's enough in their case

quiet ice
#

floats can too

tall dragon
#

whats the benefit of using BigDecimal?

sacred mountain
#

Float roundedNumber = new BigDecimal(number).setScale(2, RoundingMode.HALF_UP).floatValue(

tall dragon
#

looks like it does have some methods for rounding yea

quiet ice
#

It is more precise when dealing with anything that can be read by a general human

sacred mountain
#

yea

quiet ice
#

Floats/Doubles and such use base 2, BigDecimal deals with base 10 or at least so I assume

tall dragon
#

ah, interesting

ancient jackal
coarse shadow
#

when u do arithmetic calculations, bigdecimal gives more precise results

#

same as biginteger

ancient jackal
#

Arbitrary precision

quiet ice
#

More precise is debateable

ancient jackal
tender shard
#

the city in seattle has a separate computer just for bill gates tax declaration lol

white thicket
tall dragon
#

yea the problem is Vault still uses doubles. so how could i use BigDecimal

#

or will it still work correctly when converting to double at the end of calculations

quiet ice
#

It will work okay-ish

#

There is a huge performance overhead when converting however and as long as you are not working with large numbers doubles are okay

tall dragon
#

untill what treshhold are doubles okay

#

are we talking millions?

ancient jackal
quiet ice
#

it depends on what you define as okay

#

The degradation of the precision is gradual

tall dragon
#

well as long as calculations are not inaccurate by like thousands off its fine for me

quiet ice
quiet ice
woeful crescent
#

what packets are sent when a client hits a player?

tall dragon
quiet ice
#

I have a monolithic listener, yea

quiet ice
tall dragon
#

yes

crimson terrace
#

I made a class basically called "EnchantsListener"

quiet ice
coarse shadow
#

god i still couldnt understand how to get a vanilla recipe's key

glossy venture
#

ay geol the system also works with multiple threads at the same time

#

with ParallelTask

tender shard
#

then use getKey()

#

that's it

coarse shadow
#

yea i understood that

#

but how can i get the recipe object i want

tender shard
#

Bukkit.recipeIterator() gives you an iterator over all registered recipes

#

you can also just use NamespacedKey.minecraft("some-crafting-recipe") to get the key you need

#

what crafting recipe do you want to remove?

coarse shadow
#

enchanting table

lapis widget
#

Sorry your not allowed to work with me

tender shard
lapis widget
#

I will not allow it

coarse shadow
tender shard
woeful crescent
#

which packets inform the player of item details? ik there's WindowItems and PickupItem but what other ones?

lapis widget
#

sheesh

quaint mantle
#

Anyone here worked with protocollib? Can BLOCK_CHANGE packets be cancelled?

Reason I'm asking this is because I've tried cancelling the BLOCK_CHANGE packet yet it still sends the block change to the player.

tender shard
coarse shadow
#

enchanting table has only one recipe, so should i make
Keyed keyed = (Keyed) list.get(0).getKey

white thicket
tender shard
coarse shadow
#

NamespacedKey recipeKey = NamespacedKey.minecraft("enchanting_table");
Bukkit.removeRecipe(recipeKey);

tender shard
#

yes

white thicket
#

yes it is

tender shard
#

I am not sure whether it will be gone forever otherwise

#

probably builtin recipes will reapper after a restart

coarse shadow
#

does it really matter if i wont use it on my server

#

or i can just do addRecipe on onDisable method

white thicket
#

yes

#

I have other plugins connected to it too

#
    public void connect() throws SQLException {
        connection = DriverManager.getConnection(
                "jdbc:mysql://" + HOST + ":" + PORT + "/" + DATABASE + "?useSSL=false",
                USERNAME, PASSWORD);
    }
#

I will test the database wait

granite owl
#

does the ```java
ChatColor.getByChar("");

#

or how does it work

#

if i wanna use hex colors

#

instead of predefined macros

#

enums*

#
static ChatColor
getByChar(char code)
Gets the color represented by the specified color code
``` documentation aint that helpful here
manic delta
#

Is there a way to avoid autospawn? I mean that when someone enters the server for the first time, they tp the default spawn but I don't want that to happen

glossy venture
#

if you want rgb

#

then you can do ChatColor.of(new Color(r, g, b))

hushed spindle
#

im having a bit of confusion with how item metas are supposed to work, i want to differentiate tools from items and im doing that by checking if an item's meta is instanceof Damageable

#

but its returning true for regular items like blaze powder

#

isnt it the case that tools will have a damageable itemmeta and stuff like books get bookmeta etc.

granite owl
#

yea i came as far as to bungee

glossy venture
#

np

granite owl
#
main.gdprLink = new TextComponent(ChatColor.of("#FFFF00") + main.gdprArgs.get("UrlMsg"));
```that far ive got alone 😛
#

for test later its obv outsourced to a config file

glossy venture
#

nice

granite owl
#

protected constructor

#

of class Color

#

cant use it that way

glossy venture
#

i think you have the wrong one

#

you need java.awt.Color

#

not org.bukkit.Color

granite owl
#

javaawt?

#

ah kk

#

😛

granite owl
#

like they NEVER expose their methods to java methods directly

#

except for this one time

hushed spindle
granite owl
#

@glossy venture doesnt work

#

its not rgb colors

#

the first 2 are meta infos

glossy venture
#

code?

granite owl
#

and the 3rd parameter is a predefined int

#

for example 0,0,1 is 0000FF

glossy venture
#

what

granite owl
#
main.gdprLink = new TextComponent(ChatColor.of(new Color(0, 0, 1)) + main.gdprArgs.get("UrlMsg"));
#

this is the hex color of #0000FF

hushed spindle
#

0,0,1 is #00001 right

glossy venture
#

nah its 0, 0, 255

hushed spindle
#

0,0,255 would be 0000FF

glossy venture
#

yeah

granite owl
#

where can i post images hejre

tender shard
glossy venture
#

u need to verify

tender shard
#

then you can post them everywhere

glossy venture
#

use imgur or smth

granite owl
#

dont have a spigot acc rn

#

anyway ingame it shows as 0000FF

#

pure blue

glossy venture
#

why are you wrapping it with a TextComponent

#

that might be the issue

granite owl
#

because it is a link to the data protection agreement

glossy venture
#

because it works fine

#

ah

granite owl
#

to comply with EU law

glossy venture
#

idk whats wrong then

#

because for me it works fine

#

without a TextComponent

granite owl
#

hmm

glossy venture
#

doesnt TextComponent have a color property

granite owl
#

uhm

#

maybe

#

xD

glossy venture
#

lmao use that

#

instead

granite owl
#

but predefined chatcolors work fine

#

main.gdprLink.setColor(null);

#

apparently it does have such a member

#

works now

#

xD

#

and now i can also parse it from hex colors as well

last sleet
#

Hello, i'm trying to get the enchantment(s) from an enchanted book, but it doesn't seem to store them like other items. Is there any way to do it?

hushed spindle
#

that's because enchanted books use EnchantmentStorageMeta i believe

last sleet
#

Ah thanks

hushed spindle
#

anyway, back to my issue

if (t.getItemMeta() instanceof Damageable){
    ItemUtils.damageItem(who, t, 1, EntityEffect.BREAK_EQUIPMENT_MAIN_HAND);
} else {
    if (t.getAmount() <= 1){
        who.getInventory().setItemInMainHand(null);
    } else {
        t.setAmount(t.getAmount() - 1);
    }  
}

this is meant to decrease an item's amount by 1 if it's a normal item, or damage it if it's a tool. the item (t) here is some blaze powder and for some reason t.getItemMeta() instanceof Damageable is returning true, isn't this only meant to be true for items that can, you know, be damaged?

earnest forum
#

i replied to u before

#

try that

hushed spindle
#

i did

#

still true

#

i already replied to you as well

earnest forum
#

didnt see sorry

glossy venture
#

how are you getting the item

#

because that shouldnt be the case

hushed spindle
#

its also not some funky custom item blaze powder either it was taken straight from the creative inventory

#

yeah im confused too lol to my experience this always worked fine

glossy venture
#

how are you getting t

hushed spindle
#

its the item in the player's main hand

#

if there is one

#

i also checked t.getType() and it was saying blaze powder just fine

glossy venture
#

ok thats weird

#

can you print t.getItemMeta().getClass()

#

to the console

hushed spindle
#

sure thing

#

class.bukkit.craftbukkit.v1_18_R1.inventory.CraftMetaItem

glossy venture
#

k

hushed spindle
#

lol

#

yeah wack

glossy venture
#

it extends all of this

#

for no reason

hushed spindle
#

that makes actually no sense

glossy venture
#

so its nothing weird with java

hushed spindle
#

is that a recent thing?

glossy venture
#

they just coded it badly

glossy venture
#

idk

hushed spindle
#

i could have sworn this wasnt the case in earlier versions

glossy venture
#

i can check maybe

#

its in 1.9 too

#

at least Repairable

#

not Damageable

glossy venture
#

maybe you were using paper and it patched it out?

#

or something

hushed spindle
#

i am on paper now

glossy venture
#

what the hell

hushed spindle
#

gonna have to use a different method then i guess

#

might be a requirement with bukkit

#

maybe shit doesnt work properly if it doesnt work this way

glossy venture
#

i think so

#

because otherwise theres no reason for doing that whatsoever

smoky oak
#

if i do

for(int i = fetchStart(); i<fetchEnd(); i++){
  //Code
}

does it call fetchEnd() once and caches it or does it run fetchEnd() every loop?

#

yes

glossy venture
#

because there might be some other thread changing the results

#

the compiler doesnt know

hushed spindle
#

try it? put like a little console output in fetchEnd() and see if its prints several times

glossy venture
#

i usually do

int l = ...;
for (int i = 0; i < l; i++) { }
hushed spindle
#

yeah regardless thats the better usage

glossy venture
#

because the compiler may think "ah, this println is intended behaviour, we should keep calling"

#

but idk if it goes that deep

hushed spindle
#

did you check the fishing state too

#

uhh, show code?

young knoll
#

getActiveItem is not a spigot method

sacred mountain
#

hey im summoning a fireball with player#launchProjectile(Fireball.class) and in my damage listener i cant seem to set the damage? It completely ignores my LivingEntity#damage() or LivingEntity#setLastDamage().

#

my code isnt wrong - i printed out all the values and they work fine, but when i set the damage it doesnt actually do anything

#

and then i checked the actual damage by Sysout(e.getEntity().getLastDamage()) and its completely different

last sleet
#

Hey, if i add an enchantment with bypassrestrictions to false, will the enchantment apply even if it isn't compatible with the item in question? Or do I need to create a hashmap will compatibilities and check from there?

sacred mountain
#

bypassrestrictions speaks for itself

#

so shouldnt it bypass item or vanilla restrictions if you enable that

#

and if not then it wont add?

last sleet
sacred mountain
#

This method is unsafe and will ignore level restrictions or item type. Use at your own discretion.

#

the normal addEnchantments() throws:
IllegalArgumentException - if enchantment null, or enchantment is not applicable

last sleet
# sacred mountain also, any ideas anyone?

Hmm... maybe try creating a new fireball, at the player's location, and then set the damage from there, without using player#launchProjectile? I once made a plugin that shot 3 arrows at once, and I just created the extra arrows

sacred mountain
#

why at the players location?

last sleet
#

Because, otherwise it won't know where to spawn the fireball

sacred mountain
#

but then it will just kill the player

#

not where the player launched it

young knoll
#

What’s the issue

#

.damage works fine

last sleet
#

Yeah, in my arrow plugin i just spawned it in front of the player's head

young knoll
#

You can also setDamage in the damage events

sacred mountain
#

its an EntityExplodeEvent

#

since i need to gather data for the explosion and not just one entity

#

could i just create another listener

young knoll
#

You’ll need to damage them manually then

sacred mountain
#

and do. the damage there

young knoll
#

And probably with a 1 tick delay

sacred mountain
#

scheduler?

#

or runnable

#

its just i cant damage the entity in the no-damage-ticks time

#

and i want to cancel that original damage and set my own

#

but since im not listening for that event im not sure how to

young knoll
#

Yeah you gotta use the damage event to cancel damage

sacred mountain
#

yeah then thats another problem because i need to gather all the data from one explosion

#

to send a message to the shooter which is currenlty "You damaged %count% entities for %totaldmg% damage"

primal sequoia
#

is there a way to make acheivments per world

sacred mountain
#

could i just create another listener that deals with the damage instead of the explosion

#

but then i cant set it individually for each entity bruh

last sleet
#

Well, you could get an entityhitblock event or whatever its called, and when the projectile hits, destroy it, make an explosion effect, and damage them from there, damage which you can take and send to the player

strong parcel
# earnest forum cast the itemmeta to BannerMeta

I tried to do what you told me, but I am still running into an error. Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaBlockState cannot be cast to class org.bukkit.inventory.meta.BannerMeta (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaBlockState and org.bukkit.inventory.meta.BannerMeta are in unnamed module of loader 'app')

sacred mountain
tender shard
#

then you can cast the BlockStateMeta.getBlockState() to Banner

#

and yeah that should be everything

ancient jackal
#

Is there a recommended inventory library I should use for menus

quiet ice
#

There are quite a few. I personally use phoenix616's InventoryGUI library, but inventory framework is more popular

faint aspen
#

(Noobie question) How does the (e.g) Worldguard API interact with the worldguard plugin? how does it "hook" into it and allow me to use the worldguard functionality? In case of that it would take to long to explain, -> what do I have to google to find that out?

quiet ice
#

No idea how they do that but I'd assume either via callbacks or events

wide coyote
ivory sleet
#

Same (:

#

Or well incendo interfaces is sth else also

#

Very sophisticated

sacred mountain
#

Hey im still trying to do my explosion fireball.
I want the fireball to explode, and the surrounding entities to be counted into a map and sent to the shooter as a message "You hit 5 entities for 22.4 damage" and for the entities hit, "you were hit for 6.8 by <player>"

could i use

Map<UUID, Double> totalDamageInner = new HashMap<>();```

Then in my listener:
```totalDamageInner.put(shooter.getUniqueId(), totalDamage.getOrDefault(shooter.getUniqueId(), 0F) + damage);
totalDamage.put(e.getDamager(), totalDamageInner)```
ancient jackal
#

do any of them allow runnables to be done on an item click

ivory sleet
#

Myes

quiet ice
#

I think most do

ancient jackal
#

mmm I like that

quiet ice
strong parcel
glossy venture
#

dude

#

ima have to host an http server on the mc server

#

to host the resource pack download

#

bruh

#

and then somehow get the address the player refers to for the server

#

and use that as the url

#

in the Player#setResourcePack(...) method

cerulean mirage
#

What would be the best practise for saving data to database? Saving it async (as realtime as possible), so for every "action" or save all the "actions" in a hashmap or any data structure and iterate with for loop and batches after a certain amount of time (also perform async). Also the data should be able to get accessed the whole time so that would let me think its better to use the hashmap way instead of requesting connections for every request to get the data.

river oracle
#

Personally I save data real time asynchronously but I'm planning to implement a cache soon here

#

With a hashmap I will warn you about memory usage if you don't cap the size your saving to memory

cerulean mirage
#

or transactions i mean

river oracle
#

Plugin hasn't passed production yet it'd be a lower amount though since I'm developing for a friend probably 10ish transactions per second would be what would be happening on his server

cerulean mirage
#

Which data structure you recommend to use for caching?

river oracle
#

Haven't looked into caching yet. So I'm not quite sure

#

I'm a junior dev so I'm still learning a lot I've got slightly less than a year of experience.

cerulean mirage
#

me too

river oracle
#

There are plenty of good apis out there. Looks like apache commons has caching which is a library I already depend on so I would use that but it all is what works best for you

patent horizon
#

how would i push changes to my repo if i made a new project with the same code but in maven instead of gradle

lilac dagger
#

should be the same only the title you may wanna change if they're different plugins

patent horizon
#

yeah but like how do i connect the new project to the existing repo

lilac dagger
#

you load the old one, do the changes and then push

#

copy paste all the files over

shadow owl
#

Anyone know how to edit the blocks in a Structure Palette?

#

Changing the type isn't working

#

dude, I'll take a look at your problem, but no need to spam and hide other people's messages acting like you're the only person who matters

sacred mountain
#

sorry .

shadow owl
#

It's okay! Your approach should work, but you should change totalDamageInner.put(shooter.getUniqueId(), totalDamage.getOrDefault(shooter.getUniqueId(), 0F) + damage); to totalDamageInner.put(shooter.getUniqueId(), totalDamageInner.getOrDefault(shooter.getUniqueId(), 0F) + damage);, because I assume you want to increment totaleDamageInner for shooter.getUniqueId() by the damage each time

keen basin
#

is there break event for bungeecord

kindred valley
#

Hey may i ask you a question

ivory sleet
#

Use a ConcurrentHashMap tho

#

As you’re gonna use it over multiple threads

kindred valley
#

İm seeing the cod messages white on mobile. How can i fix it

ivory sleet
#

And then the general idea is to save quite often, so for most actions and bulk operations, read when needed (most likely only on join assuming you don’t synchronize data over an entire network in which things become significantly more intricate)

#

I’d advice looking at for instance LuckPerms

#

It’s a great start

#

Also if you want a legit good and maintained caching library (as opposed to just ConcurrentHashMap) then Caffeine is your best bet

EDIT of course maps take some memory, but it’s not going to be the slightest issue unless you’re scaling something to the moon

lilac dagger
#

do it in the enum

#

Common 0
u 4001

#

so on

#

i assume getNumber gets you a random number everytime

#

which is wrong for sure

#

you only need to call that once

#

it is tho

#

if you call it every time you change the rule midway

#

you only need it once