#help-development

1 messages ยท Page 381 of 1

tender shard
#

thanks again

eternal night
#

np gl with the plugin

tender shard
#

thanks โค๏ธ

left depot
#

Yup fixed my copper error

lost matrix
#

Ah yes. Naming generics is hard...

onyx fjord
#

What does K or V stand for

chrome beacon
#

Key, Value

onyx fjord
#

Oh

lost matrix
#

Which doesnt make much sense in a Pair if you ask me

onyx fjord
#

Can it be more letters I've never tried lol

eternal night
#

cool kids know its F and S

onyx fjord
#

Pair imo should be left right

lost matrix
#

T, U is the standard

left depot
#

public static int randomNumber(int minInt, int maxInt) {
        if (minInt >= maxInt) {
            throw new IllegalArgumentException("Error: The maxInt is smaller than the minInt!");
            // Or if you wan't to do it easy:
            // return 0; // Will return 0, if maxInt is bigger than minInt
        }

        Random random = new Random();
        int mynumber = random.nextInt((max - min) + 1) + min;
        return myNumber;
    }
onyx fjord
#

What's T or U

eternal night
#

just generic generic values

left depot
#
int chance = randomNumber(1, 10);
if (chance < 5) {
p.sendMessage("You are the winner!");
else {
p.sendMessage("Try it again :)");
#

Someone see the error?

lost matrix
onyx fjord
#

Pair<X, D>

eternal night
#

Pair<Left, Right>

onyx fjord
#

Based

#

Fvcking zased

eternal night
#

tho really cool kids just create local records when needed

#

without generics

lost matrix
eternal night
#

average mojang code

lost matrix
#

XD

#

They'd have a registry for that too

onyx fjord
#

<P, D, W>

eternal night
#

no smile

#

I don't think you undsterstand

lost matrix
eternal night
#

this was not sarcasm

#

this is reality

onyx fjord
#

It stands for

eternal night
#

like

onyx fjord
#

Greetings from jail

lost matrix
eternal night
#

yup

cunning canopy
#

Anyone know how the clickedPosition value is calculated in PlayerInteractAtEntity event?

eternal night
#

that is sent by the client

cunning canopy
#

And if not? Do you know where in the stash repo I could possibly find it?

cunning canopy
#

oh wait nvm

#

minecraft is not open source whoops

eternal night
#

indeed xD

cunning canopy
#

I am still looking forward to when we start seeing open source games

lost matrix
eternal night
#

I mean the server is effectively shared source at this point dogekek with mojang mappings

cunning canopy
#

but the game itself is not though

eternal night
#

I mean, still very readable

cunning canopy
#

If you decompile the jar?

eternal night
#

yea

#

the hit position however is just the result of the raytrace

left depot
#
Random random = new Random();
                            int randomInt = random.nextInt(19);
                            randomInt++;

                            if(randomInt == 1) {

                            }

                            if(randomInt == 1) {

                            }

                            if(randomInt == 1) {

                            }

                            if(randomInt == 1) {

                            }
#
public static int randInt(int min, int max) {

        // NOTE: Usually this should be a field rather than a method
        // variable so that it is not re-seeded every call.
        Random rand = new Random();

        // nextInt is normally exclusive of the top value,
        // so add 1 to make it inclusive
        int randomNum = rand.nextInt((max - min) + 1) + min;

        return randomNum;
    }
#

this will also work right

left depot
eternal night
#

smiles code looks right

#

obviously with the implication that low is inclusive and high is exclusive

lost matrix
#

^

cunning canopy
eternal night
#

what do you need this for btw

cunning canopy
#

I am doing a raycast and trying to figure out where on the entity the ray hit

#

and I need it in the same format as the position argument of PlayerInteractAtEntityEvent

eternal night
#

spigot has raycasts build in tho ๐Ÿค”

cunning canopy
left depot
#
if(randomInt >= 1) and (randomInt <= 5) {

                            }
tardy delta
#

wat

eternal night
#

and

tardy delta
#

c++ moment

left depot
#

๐Ÿ‘

eternal night
#

great brackets too

#

lmao

left depot
#

xD

cunning canopy
paper venture
#

@lost matrix sorry I think it is the last question, but where should I actually store the manager... I mean I had a problem where to store temporary data and you suggested the manager, but where should I store the manager itself... In the main class? But there might be a lot of players glowing everyone around, so it's not a good way I think...

#

I thought about making this class static and modifying it so I can store several players in it without actually creating instance of it

lost matrix
#

And dont make it static pls

left depot
#

and not and

eternal night
#

if(conditionOne && conditionTwo)

lost matrix
cunning canopy
# lost matrix

Now I get the format of the clickPosition value, but I don't really understand how I can calculate it based on the world location the ray hit and the location of the entity

left depot
#
if(randomInt >= 1 && randomInt <= 5) {

                            }``` 
๐Ÿ‘
lost matrix
cunning canopy
lost matrix
cunning canopy
#

cause I have tried B-A, but the result I end up with is close, but not the same as the PlayerInteractAtEntity

lost matrix
#

Then try using a corner of the BB. Might not be the Location but the low corner.

eternal night
#

what entity are you trying this on

#

some entities receive inflated bounding boxes

cunning canopy
cunning canopy
lost matrix
eternal night
#

that one should be fine

cunning canopy
icy beacon
#

this has been bugging me for the past 2 days

#

i am either legally blind or acf is having a stroke

lost matrix
#

This is because of your OfflinePlayer target i believe

icy beacon
#

what's wrong with it though?

#

it's an internally registered context (registered by acf)

#

should be perfectly fine

lost matrix
#

Try setting it to a String and you will see

icy beacon
#

hm

#

kk

quaint mantle
#

hey thanks for this, working fine. but i wanna ask can i add the "multi line" thing to this?

icy beacon
cunning canopy
#

is there any easy way to fill a boundingbox with particles?

icy beacon
#

iterate through every block in the box ig?

river oracle
#

Iteration dear

lost matrix
weak kayak
#

you could get the size of the bounding box, halve it, spawn particles in the middlemost part of the box and set offsetX, offsetY, and offsetZ to their respective sizes

lost matrix
#

That would result in a elipsoid

weak kayak
#

oh

cunning canopy
lost matrix
#

For corners i would have a util method

cunning canopy
#

What is the data argument of world spawnparticle

icy beacon
#

please help, for some reason the top part does not update and i've been trying to figure it out for a rather long time
https://hastebin.com/share/wufaroqowo.java (method used for updating: updateLeaderboard)
also it seems like the max streak ever part also does not update...

lost matrix
#

Whatever UnderscoreKillstreaks.killstreaks returns might not be updated

icy beacon
#

it's a static MutableMap that is updated everytime a streak is modified in any way

#

the code for updateLeaderboard is identical to that of createLeaderboard (probably should extract it to a separate method later), and creating a new leaderboard actually makes those values correct again

lost matrix
#

A static mutable map... doesnt sound fragile at all

icy beacon
#

xd

#
companion object {
    var killstreaks: MutableMap<UUID, Killstreak> = HashMap()
  }
#

there probably is a better way of doing it

lost matrix
#

You updateLeaderboard method has so much code which should absolutely not be in there

icy beacon
#

but just in case, i wanna make sure that i always access the same map

icy beacon
#

why don't i cache config values?

#

eh, i don't know

#

probably should do that too

#

but that doesn't seem like the problem cause

lost matrix
#

This design is almost certainly the origin of your problem

icy beacon
#

well then, i'll go refactor it and try again

#

thanks for the tips smile

lost matrix
#

Not the cause but it enabled the problem in the first place

icy beacon
#

i guess that's true yeah

lost matrix
#

All of this sorting:

#

Should not be in there.
UpdateLeaderboard should have like 5 to 10 lines max.

  1. Request top list from manager
  2. Throw top list in hologram
icy beacon
#

alrighty i'll take that into account too

cyan yarrow
#

Hey guys, how could i add the totem animation whenever u die in a event

cyan yarrow
#

Thanks ๐Ÿ™

icy beacon
#

haha the refactor shoved 2 entire kilobytes off of the filesize

#

it's now 2215kb

#

about to test

golden turret
#

wow

#

great saving

icy beacon
icy beacon
#

probably will attract users

#

i'll brb, please ping me if you have any ideas on why this is happening

pure musk
#

1.19.3 spigot

weak kayak
#

what's your pom or gradle file look like

iron palm
eternal oxide
#

You forgot an api-version in your plugin.yml

#

probably

pure musk
#
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>```
eternal oxide
#

?paste your actual pom

undone axleBOT
eternal oxide
#

not snippets

weak kayak
#

can you show me the whole dependencies list

rough basin
#

can i change itemmeta's Material?

iron palm
#

oh

#

no

eternal oxide
#

ItemMeta doesn't have a Material

rough basin
#

oh my mistake

iron palm
#

you gotta use ItemStack.setType

rough basin
#

i mean ItemStack

rough basin
eternal oxide
eternal oxide
undone axleBOT
iron palm
eternal oxide
#

Caused by: java.util.ConcurrentModificationException you are modifying the list you are looping over

eternal oxide
#

use an iterator if you want to actively modify a Collection

weak kayak
#

intriguing

iron palm
eternal oxide
#

you get an iterator from the Collection

iron palm
#

oh

#

right

#

so should i use collection?

iron palm
#

๐Ÿ’€

left depot
#
settings = new ConfigManager("settings.yml", true);
        Settings.load();
#

will read the settings.yml file right

eternal oxide
#

no

#

settings != Settings

#

Settings.load() is a static accessor

#

settings is a field

left depot
#
  random-ore:
    ores:
      - copper_ore
  max-drop-count: 1
  respawn-time: 5
Settings.RANDOM_MAX_DROP_COUNT
rapid topaz
#

how do i use PlayerCommandPreProcessEvent

left depot
#

so the max-drop-count should be the settings.RANDOM_MAX_DROP_COUNT

river oracle
rapid topaz
#

well thanks didnt know that

eternal oxide
rapid topaz
#

Why not?

#

I wanna make sure the operators of my server doesnt use any commands

eternal oxide
#

then preprocess is a valid use for you

rapid topaz
#

and i wanna troll them so whenever they use a command, the command willg etprintedf publicly out in the chat

#

get prindet*

#

printed

rough basin
#

what should I do if I want to know how many keys JSONObject has ?

#

shitty js results on google

eternal night
#

Doesn't that thing implement Map

hazy parrot
#

It does

#

keySet

#

Would work probably

rough basin
#

then can I get JsonObject's key by index number?

#

or should I just change them into map

tardy delta
#

what are you trying to achieve?

weak kayak
#

if it does implement Map, you can just call .size() on it

rough basin
weak kayak
#

you could loop over the entries from the #entries() method

eager jacinth
#

"Hello. I have a problem using MiniMessage, has anyone encountered this before? The issue is that I have a string that I want to parse: "<username> started stream on <click:open_url:'https://twitch.tv/<twitch_id>'>Twitch</click>", but when I try to do this, for some unclear reason to me, <twitch_id> is not replaced.

Here is the code: config.getMessage("stream.announcement", Placeholder.unparsed("username", username), Placeholder.unparsed("twitch_id", twitchUrl))
Here is the object: TextComponentImpl{content="omashune started stream on ", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[TextComponentImpl{content="Twitch", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, clickEvent=ClickEvent{action=open_url, value="https://twitch.tv/<twitch_id>"}, hoverEvent=null, insertion=null, font=null}, children=[]}]}

rapid topaz
#

will this work?

echo basalt
#

?tryandsee

undone axleBOT
rapid topaz
#

oh thank you

eternal night
#

It won't be replaced by mini message

#

It isn't even parsed as a potential node (outside the value node of the click event obviously)

#

It's a literal string

eager jacinth
#

so just replace value of obtained string from config? ๐Ÿคช

eternal night
#

Sure or string concat

#

Or String.format

#

Then run mini message over that output

#

If mini message would make that replaceable what would happen if the replacement is a green "hello" XD

eager jacinth
#

damn... Okay, thanks

weak kayak
#

everytime i hear concat i think of cats

rapid topaz
#

yeah i jusat tested and it doesnt work

#

do i just need @eventhandler

#

thank you

iron palm
eternal oxide
#

not right

#

you have to use the iterator to make any changes

iron palm
#

oh

#

in that case

#

gotta retry

#

thanks

scarlet moat
#

Hmm, can someone help me?

private Inventory inventory;
...
public class hvh() {
        inventory = Bukkit.createInventory(this, 27, ChatColor.BLUE + "HVH Search"); // Unknown class: 'inventory'
        initializeItems();
}
iron palm
#

since iterator doesnt have add or set so

#

ok i guess its now fixed

tardy delta
scarlet moat
iron palm
# scarlet moat Hmm, can someone help me? ``` private Inventory inventory; ... public class hvh...

anyways you should do this.

inventory = Bukkit.createInventory(YourPlugin.getInstance(), 27, ChatColor.BLUE + "HVH Search"); 

notes :
YourPlugin must be the class that extends JavaPlugin.
if you do not have getInstance method in your main plugin class then create one
it should be like this :

private static YourPlugin instance;

public static YourPlugin getInstance(){
  return instance;
}

public void onEnable(){
  instance = this;
}
#

also try using better namings and also in pascal case ofc your class name in pascal case would be : Hvh but i recommend you to use better namings but its fine if its just a test project or training one

#

replace the YourPlugin with your main class name

scarlet moat
quaint mantle
#

hello.

tardy delta
#

ugh dont use singletons

icy beacon
#

use dependency injection

tardy delta
#

?di

undone axleBOT
iron palm
icy beacon
#

no lol

iron palm
#

wait i forgot di

#

thats not really better than instance one however if you really hate using statics then there's nothing to discuss

lost matrix
#

Singleton pattern and dependency injection are both viable approaches.
Which one you chose depends on your design strategy.

iron palm
#

yeah they're almost the same when talking about performance

eternal night
#

performance lol

#

if you have to choose between singleton and DI because of performance you fucked up somewhere

iron palm
#

would

        myArrayList.listIterator(index).set(element);
``` work to set an element in my arraylist? Im trying to modify an arraylist without receiving any exception
eternal night
#

why would modifying an array cause an exception

iron palm
#

idk it throws Caused by: java.util.ConcurrentModificationException

eternal night
#

so you are iterating over the array ?

#

there is array.removeIf and obviously normal iterators

#

both support (in their own way) removal during iteration

iron palm
left depot
#

Someone knows why my intelli is crashing?

eternal night
left depot
#

Whas running every time good until 3sec back

tardy delta
#

and we can smell what happens?

iron palm
eternal night
#

no it has removal methods

worldly ingot
#

If you want to edit your list while you're iterating over it you're going to have to make a copy of that list and add to the copy

#

You can't add to a list that you're iterating over

quiet ice
#

CopyOnWriteArrayList my beloved <3

iron palm
eternal night
#

no

#

you also have to use the iterator to iterarte

lost matrix
worldly ingot
#

TIL ListIterator has addition methods

quiet ice
#

It is impossible to use ArrayList in a concurrent environment once you want to use write to it

lost matrix
#

But index access is O(n)

quaint mantle
#

or better yet, a balanced binary search tree.

#

not sure if java has one implemented.

#

probably not.

quiet ice
#

What the hell do you mean there?

old jay
#

I have a question: I used BuildTools do get the remapped-mojang version of spigot but how do I use it with maven?

quiet ice
#

You mean a Red-Black tree @quaint mantle ?

lost matrix
#

Scroll down to NMS

quaint mantle
#

that would be an example of a balanced binary search tree, but there are many more balanced binary search trees.

quiet ice
hazy parrot
quaint mantle
#

red-black trees are better for more write-heavy operations probably.

quiet ice
#

Myes - but only because of the stupidity of the default ArrayList implementation

quaint mantle
#

what is wrong with the ArrayList??

quiet ice
#

copies the array when an element is removed or inserted

#

It's basically COW but not truely

#

Instead of asking why COW exists we should ask why ArrayList exists

quaint mantle
#

it resizes the array, i would assume it is implemented as a dynamic array, meaning it is meant to have an amortized runtime complexity.

#

"COW"?

quiet ice
#

CopyOnWrite

quaint mantle
#

what does that mean?????

quiet ice
#

actually no, ArrayList doesn't copy.
I am confused

#

Ah it only copies if you add the element in the middle of the list

quaint mantle
#

it probably does copy when it gets resized, presumably.

#

why would you add an element in the middle of the list?

quiet ice
#

Well not really copy - it just shifts the elements by copying the list to itself with an offset

quiet ice
quaint mantle
#

if you need to update the elements from the middle of the array, use a different data structure.

#

but still depends entirely on what you are doing.

quiet ice
#

I think I last looked at the implementation while I was too tired so I completely misremembered the implementation - sorry about that one

iron palm
#

omg why this goddamn bullshit doesnt work

        pages.forEach(pack ->{
            for (int i = 0; i < pack.getSize(); i++) {
                if (!pack.contains(i)) {
                    pack.setItem(i, button);
                    break;
                } else if (pages.indexOf(pack) == pages.size() - 1) {
                    InventoryPage page = createPack();
                    page.setItem(0, button);
                    break;
                }
            }
        });```
error:
https://paste.md-5.net/takozubide.php

I tried using iterators but it didnt worked really
undone axleBOT
lost matrix
iron palm
lost matrix
#

11 probably

rough basin
#

I'm trying to find null values on json.
but this code in catch (line 27) does not catch null values
(I'm sure it is blank values on json files).
what did I wrong?
https://paste.md-5.net/cirunarehi.cs

iron palm
tardy delta
#

new Gson() ๐Ÿ˜ข

rough basin
#

didnt used

lost matrix
#

You need TypeTokens for Maps

swift drift
#

Does anyone know how to use mcedit or minecraft region fixer?????

lost matrix
#

Probably a decent amount of people do here.
But this sounds like a question for #help-server

small hawk
#

Almost everything in paper moved to Components, but player.chat() did not. I'm trying Mini Messagess API, can i transform Component to String to send e.g gradient?

tardy delta
#

isnt there Component#content()

eternal oxide
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

tardy delta
#

ok no

rare rover
#

which packet would it be to update the data?

lost matrix
#

ClientboundSetEntityDataPacket

rare rover
#

ty

#

is there a better way of doing this?

@Override
    public void updateHologramLine(Hologram hologram, HologramLine line) {
        LivingEntity entity = ((CraftLivingEntity) line.getArmorStand()).getHandle();
        ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket(entity);
        ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true);
        Location location = hologram.getLocation();
        location.getWorld().getPlayers().forEach(player -> {
            ServerPlayer plr = ((CraftPlayer) player).getHandle();
            plr.connection.send(spawnPacket);
            plr.connection.send(dataPacket);
        });
    }``` because like if there's like 50 holograms in the world with 25 lines wouldn't that cause a bit of lag
#

i could put it on async since its packets ig

lost matrix
#

Is every hologram updated every single tick?

rare rover
#

no that's just when the player changes world, joins, or plugin restarts

#

wait maybe i may have to update them every 5 ticks ish

#

because i wanna add placeholderapi support

lost matrix
#

Then this wont even show in your timings. The server sends thousands of packets per second per player.
Even with hundreds of holograms you wont see any lag.

rare rover
#

okay, im just worried about the loop

#

since if i wanna update all the holograms every second or so

#

like yeah

#

or i could make a thing so it'll only update the hologram lines that have a placeholder on them

#

could reserve some performance

echo basalt
#

you can do it async

#

I'd honestly keep track of spawned holograms for the sake of not sending duplicated spawn packets

lost matrix
#

My first approach to holograms was to map each hologram to the chunk they where in, then listen
for when the chunk is sent to the player and send the hologram afterwards. Completely overengineered.

echo basalt
#

Map<Long, Set<UUID>> chunkMap
Map<UUID, FakeArmorstand> entityMap

lost matrix
#

exactly

echo basalt
#

๐Ÿค”

lost matrix
#

Well but first Map<UUID, WorldHologramDomain>

echo basalt
#

ofc you gotta use world ids

#

and then the hologram domain

#

yeah that's overengineered

#

but worth it

ember cape
#

can i ask for help here??

lost matrix
#

Then each world domain has a Map<Long, ChunkHologramDomain>
and those have a Set<Hologram> or something

lost matrix
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!

ember cape
#

The server you were previously on went down, you have been connected to a fallback server

icy beacon
ember cape
#

whenever try to connect from bungeecord this come

lost matrix
#

ok so a bungeecord issue

echo basalt
#

making a class to wrap a set ehhh

ember cape
#

yes

ember cape
#

ok

lost matrix
echo basalt
#

๐Ÿค”

#

I wonder if this works

#

gotta test

icy beacon
ember cape
#

happens sometime

lost matrix
ember cape
#

with me also

ember cape
#

btw

#

anyone who knows about bungee?

#

that how to fix it

eternal oxide
#

?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!

icy beacon
#

once again you're better off at #help-server , this channel is for those who have problems with developing

frank kettle
#

if I store an URL on the server startup, if i then call for that url will the server make the connection again? or will it get the response it got whenever i stored it on the startup?

lost matrix
#

Creating an instance of a URL does not create any connection

delicate lynx
#

if you store a URL you don't make a connection

frank kettle
#

i think instead of trying to run async the connection for skins whenever a player opens the custom inventory, im thinking on gettign those textures right away at the beginning of the server startup

#

then how do i store the result of a URL connection?

lost matrix
#

Either that or you make the skins lazy

lost matrix
frank kettle
# lost matrix Not worth it.

its for the same "problem" as yesterday when i asked about the calling a function after an async connection was done

lost matrix
#

Just cache the skins

eternal oxide
#

are you expecting the skins to change between startup and them opening the menu?

frank kettle
#

i dotn want to make the server have connections everytime a player opens that inventory

frank kettle
eternal oxide
#

then store them

frank kettle
#

so can I store URLs?

eternal oxide
#

no store the skin

frank kettle
#

or it will do connection everytime i call that variable

eternal oxide
#

it's just a string

frank kettle
#

setSkin(url) calls for a url

quaint mantle
#

i thought u need to modify the profile and resend a PlayerInfoPacket or whatever to everyone

frank kettle
#

you just need to modify a profile

#

im not changing players skins

quaint mantle
#

oh

frank kettle
#

its just "player heads" skins on inventory items

quaint mantle
#

mmm

#

you dont need to do that

frank kettle
#

this is the way i have right now for custom skins

quaint mantle
#

uh

frank kettle
#

but i feel like that calling for URL is a connection all the time and lags when performing it.

lost matrix
#

Cache the ItemStack and only call clone() on it

frank kettle
#

so i wanted to store that when server opens

frank kettle
#

was curious about the URL on how it works

quaint mantle
frank kettle
#

it doesnt lag the server

quaint mantle
#

you dont need a url

frank kettle
#

by lag i mean it happens after

quaint mantle
#

thats so pointless

frank kettle
#

so i wanted to store so it would be smooth

quaint mantle
#
fun construct(): ItemStack { val itemStack = ItemStack(Material.PLAYER_HEAD).apply { durability = 3 } val skullMeta = (itemStack.itemMeta as SkullMeta) if (texture.length < 16) { skullMeta.owner = texture itemStack.itemMeta = skullMeta return itemStack } val gameProfile = GameProfile(UUID.randomUUID(), null) gameProfile.properties.put("textures", Property("textures", texture)) val field: Field? try { field = skullMeta.javaClass.getDeclaredField("profile") field.isAccessible = true field.set(skullMeta, gameProfile) } catch (e: Exception) { e.printStackTrace() } itemStack.itemMeta = skullMeta return itemStack }
frank kettle
#

thats kotlin

lost matrix
frank kettle
#

i will store itemstacks instead

quaint mantle
#

concept is still the same

frank kettle
#

ty for the help

quaint mantle
#

is there a reason to not create a new gameprofile each time?

frank kettle
#

why create game profile and not player profile

#

whats the difference

quaint mantle
#

whats a player profile

frank kettle
#

Bukkit.createPlayerProfile(randomUUID)

quaint mantle
#

idk

frank kettle
icy beacon
#

hey smile

#

i figured out why it wasn't updating

#

so, the self position uses papi so it's always updated

#

and my updateLeaderboard is in fact never called

#

๐Ÿ’€

lost matrix
#

A simple print statement saved the day again

icy beacon
#

thanks for helping though, i applied your tips for refactoring my code and it was easier to figure out the source haha

icy beacon
#

tyty

#

i basically have a list of tasks where i added my task to, but i never started running the task

cunning canopy
#

Oh no.

#

Stackoverflow is down

#

Eveey developers worst nightmare

icy beacon
#

how are they gonna restore stackoverflow if there's no stackoverflow

#

but honestly fuck stackoverflow, it's the most toxic programming community i've seen

tender shard
icy beacon
#

i just shrinked my plugin from 2216kb to 467kb

#

pretty cool

cunning canopy
icy beacon
#

and so is very unwelcoming to newbies

pseudo hazel
#

yes but SO makes an effort to be toxic at some times lol

icy beacon
#

yeah

cunning canopy
#

Because a lot of developers have the I am better than everyone else mindser

icy beacon
#

^

#

what's the code?

pseudo hazel
#

I literally will never post a question on there, i will only read whats already on it xD

icy beacon
#

like, the full code, what class' methods are you overriding

icy beacon
pseudo hazel
#

I am a pro grammer

#

dont at me

cunning canopy
#

Terry davis lol

tender shard
#

who the fuck is terry davis

cunning canopy
#

Maker of templeos

#

He went crazyvor something

icy beacon
#

OH NO! Linux is going into ventricular fibrilation!!!

icy beacon
tender shard
#

also torvalds is a jerk

cunning canopy
#

Yee might be based of what I've seen

tender shard
#

well he said that himself

mellow edge
#

Hello, I never realized that, but should I use org.bukkit.ChatColor or net.md_5.bungee.api.ChatColor to display colors in chat?

tender shard
#

both will work fine

icy beacon
tender shard
#

linus is known to insult people on github for pull requests, not exactly something I'd consider any nice person would ever do

mellow edge
icy beacon
#

slightly offtopic

#

๐Ÿ˜ณ

tender shard
#

anyway, I don't like him

icy beacon
#

even though he's a jerk, his contribution to the programming community overall is huge ngl

tender shard
#

although I agree that he's probably an extremely skilled coder

tender shard
#

still, I wouldn't want to have a beer with him lol

river oracle
#

I would

#

I'd buy a bunch than leave while he isn't looking leaving him with a massive bill

tender shard
#

okay that's a nice idea

#

and he'd be like "fuck miles"

#

lol I'd love to see that

icy beacon
#

and even though it'd happen, you'd get free beers

#

i don't see what's the downside here

tender shard
#

yeah I admit, that's a nice idea

river oracle
#

In conclusion, this is why I should be optics idea manager

icy beacon
#

Okay !

tender shard
#

trelloooo

#

helloooo

icy beacon
#
    plugin.saveConfig()
    plugin.reloadConfig()
#

how performance-heavy is this?

#

shouldn't be called too often, but maybe 10 times a minute

hybrid spoke
icy beacon
#

well if it is heavy i'll find a workaround

lost matrix
#

Its IO so depending on your hard drive speed and your config length it could be
anything from meh up to abysmal

icy beacon
#

tyty

#

oh i just realized that this won't be called often at all

#

alright good thing

tender shard
#

anyway, why do you reload after saving?

#

the config will be exactly what you saved it, all the time

#

there's no need to reload it at all

#

but anyway, you should only save the config in onDisable() or in an async task

mortal hare
#

cant you run this in another thread tho?

#

to bypass the io thread blocking

vivid skiff
lost matrix
vivid skiff
lost matrix
#

Get the BlockData

#

PS: BlockData lacks a location so you need to get both the Block and the BlockData

vivid skiff
#

The plugin is in legacy

lost matrix
#

Then save the Material or whatever.

rapid aspen
#

hi, im trying to do a troll plugin and i want when "utils.blockDrops.get(uuid)" is equal to false it dont drop the block items that the player breaks.

Here is the code, someone help me please:

https://paste.md-5.net/tovotaciti.java

tender shard
#

I mean erm

#

you should know how to check a simple boolean value if you do spigot plugins

rapid aspen
#

i know

tender shard
#

then what's the issue

rapid aspen
#

im doing that

if (!utils.blockDrops.get(uuid)) event.setCancelled(true);

tender shard
#

and what is the issue?

rapid aspen
#

it is not calcelling

#

wait sorry the utils.blockDrops.get(uuid) is null

tender shard
#

it cannot be null if it returns a boolean?

#

oh it's a map, it probabaly returns a Boolean

rapid aspen
#

yes but its returning null because the player.sendMessage("CHAMADO"); dont run

lost matrix
#

Map with boolean values is kinda useless. Just use a Set<UUID> and check for contains

rapid aspen
#

ok ill do that

tender shard
tender shard
#

however this doesn't seem to be OP's problem so yeah, you're right

tender shard
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

tender shard
#

also please do not combine 5 random files in one paste

#

otherwise we don't even know which line number is which

#

just do one paste per file

#

so what's the current issue?

rapid aspen
#

itยดs still not cancelling the BlockDropItemEvent

tender shard
#

but does it print your "CHAMADO" message?

#

(whatever that means)

#

just a future advice, keep your code and debug messages in english so everyone can understand it

rapid aspen
#

no

tender shard
#

print out the result of utils.blockDrops.get(uuid) and the event's uuid

rapid aspen
#

ok

tender shard
#

seems like your map simply does not contain this uuid

#

where do you actually save the UUID into that map?

rapid aspen
#

i changed it to a set you can see the new link i send

brave shadow
#

Hello! I'm a little German YouTuber! I want to program my own Miencarft server with plugins, minigames etc.! I've been working on this for a long time! And now I came to a problem! I have created a very complex adventure map! So now the server is also for other minigames etc.! Is there a possibility to get a plugin that gets a separate clone of the Adventure Map for each player with MultiverseCore? Thanks for any help!

warm mica
#

and please stop using ! after each sentence

brave shadow
brave shadow
tardy delta
#

OptionalBoolean

crystal flax
#

hello can plesse help my

quiet ice
#

Do you have the bungee api on hte build classpath?

brave shadow
tender shard
quiet ice
#

then add it to the classpath

tender shard
#

you also shouldn't offer payments on this discord, this might get you kicked, see this:

quiet ice
#

Also why do you delete your messages?

tender shard
#

?services

undone axleBOT
crystal flax
brave shadow
crystal flax
tender shard
quiet ice
crystal flax
#

Maven

tender shard
#

what's your issue?

quiet ice
#

Then find the bungee api artifact coordinates and add it as a maven dependency

tender shard
#

also why is literally EVERYONE in this chat german lol

quiet ice
#

:)

#

I should REALLY do my homework though

tender shard
#

homework? I thought you're 20+ or sth lol

brave shadow
#

no! Everyone who joins gets a clone of the adventure map that they can play on alone! But all have the same map!

tender shard
quiet ice
tender shard
#

oh you mean, everyone gets the same map, then they can modify it to their likings

brave shadow
#

yes

tender shard
#

are you the one who made a thread in spigot forums about this a few days ago?

crystal flax
quiet ice
tender shard
brave shadow
quiet ice
#

or rather said I'd be surprised if 1.16-R0.4 is the bungeecord-api version

tender shard
#

lemme find it

quiet ice
#

?jd

quiet ice
#

Try 1.19-R0.1-SNAPSHOT instead

#

If you want 1.16 instead, glhf

tender shard
crystal flax
#

ok got...

tender shard
#

(btw if you're looking to hire someone feel free to DM me, but remember it's actually not allowed to talk about this "hire someone" stuff on this discord)

crystal flax
quiet ice
#

did you refresh the maven project?

tender shard
crystal flax
tender shard
#

kk

#

bungeecord usually doesn't change between same versions at all, try to simply use "1.16-R0.1-SNAPSHOT" instead

#

as geol already said

brave shadow
crystal flax
#

@quiet ice?

quaint mantle
#

can you scale a spigot server horizontally

crystal flax
#

??

quaint mantle
#

but when i tried it, i couldn't find a custom title thing

#

are they sending two lines for this or something different?

gray merlin
#

Is there a way I can prioritise the latest version of gson in maven?

#

for some reason my plugin isn't using the latest one and that's causing issues

crystal flax
#

hello with me always come
cannot find symbol
can someone help me

eternal oxide
#

unless you shade/relocation, if it's possible with Gson

tender shard
#

so what's the thing you actually wanna do?

#

send a title, or send a toats message?

gray merlin
tender shard
#

if it's a title: spigot api got everything you need for that.
if it's a toast message: my library (jefflib) got everything you need for that if you're on 1.16.1+.

for everything else: you gotta implement it yourself

gray merlin
#

but I kind of need it to use the latest one tho

#

like in the project itself

#

even if it will use it when jarred

tender shard
#

?paste your full pom.xml pls

undone axleBOT
gray merlin
tender shard
#

okay so two things:

#
  1. spigot does includes outdated libraries, but they are all relocated
  2. if you use use the "actual" class path, (the ones that do NOT start with "org.spigotmc" or or "org.bukkit"), you shouldn't have to worry
#

3.: just put the dependencies that you use ABOVE spigot in your pom.xml file

gray merlin
tender shard
#

yes, it does matter

#

maven basically does stuff like "ok, this guy uses example.class, where does it come from"? and then it goes down the list of your dependencies

#

so yeah, try to put your other dependency at the top, then it should work

gray merlin
#

It still doesn't work... for some reason

tender shard
#

there's also another way, which is to exclude dependencies from dependencies

quaint mantle
tender shard
quaint mantle
#

i thought the image was clear lol

gray merlin
#

I can tell it isn't working because that is still not found

tender shard
#

I cannot help you with that- I only know the basics of Gson and I always hated Gson and that's definitely something I can't answer

gray merlin
#

Yep, but this is a versions issue really

#

It has happened before, I'm not sure how I fixed it, but I'm 100% sure it's due to the version

#

But that was really long ago

quaint mantle
gray merlin
#

Actually one sec

gray merlin
tender shard
gray merlin
#

Future me, if "Gson is not working", or "there's a setObjectToNumberStrategy issue", just check the order of the dependency declarations.

quaint mantle
tender shard
tender shard
gray merlin
tender shard
#

ah ok

gray merlin
#

Thank you!

tender shard
#

no problem

spare mason
#

how i can get the player that ate a custom food?

eternal oxide
#

there is a consume event

spare mason
#

what is it's name

eternal oxide
#

?jd-s

undone axleBOT
eternal oxide
#

search for consume

small hawk
#

Hi i want to make a Revive System in my plugin. I am currently rewriting the old-version of plugin. It is supposed to work like that, u bind block to eliminated player, then place it, and it counts down for e.g 60 seconds, after that player gets unbanned, block changes into air. Revive-block have durability. which means 60 durability, 60 pickaxe breaks or so. In the old version I made dynamic config which created section like this:

reviveBlocks:
  UUID:
    Location: 
    time-placed:
    time-to-break: (which time block should break and the player should get unabnned)
    target: (who is going to be unbanned)
    durability: (Health of the block)

Here's my question, there is a better way to make it e.g without config, like inside of plugin? Note: 1 and more revive block can be placed at the same time?
How should i start with it? Any tips where to store that data (if it's possible)

sullen marlin
#

An object?

#

Does it need to survive restarts

small hawk
#

Well, I can always turn the system off, then schedule the restart, so i guess no

sullen marlin
#

Then just make a class with that stuff as fields

buoyant viper
#

?jd need bungeechat

buoyant viper
#

is TextComponent(String) not a constructor anymore?

#

ig fromLegacyText (or just using ComponentBuilder) suffices but

crystal flax
spare mason
#

how i can give an effect when you eat something bukkit

buoyant viper
sullen marlin
#

ProxyServer not BubgeeCord

river oracle
#

I'm an optimist

sterile token
#

Is ChatGPT down?

river oracle
#

idk

crystal flax
spare mason
tall dragon
#

wdym

#

new to java?

#

or new to the api

spare mason
#

both xd

buoyant viper
remote swallow
#

?events

#

?event-api

undone axleBOT
tall dragon
#

then i would suggest learning some java basics first

river oracle
tall dragon
#

after which u can check out that link

sterile token
sullen marlin
sterile token
#

Its doesnt make sense to hoppe making the best cake if you havent learnt the basics of cooking

crystal flax
river oracle
#

type ProxyServer instead of BungeeCord

tall dragon
#

with your keyboard

river oracle
#

probably

tall dragon
#

push the keys

river oracle
#

^

#

+1

#

๐Ÿ‘๐Ÿฝ

sterile token
crystal flax
#

yes

river oracle
#

?learnjava ??

undone axleBOT
buoyant viper
#

the price id pay for the lombok'd methods to be builder-style

#

ComponentBuilder it is :P

sterile token
river oracle
#

or the java docs

#

both are helpful

sterile token
#

You want to buy the lombook methods?

buoyant viper
sterile token
#

Is there any alternative to kyori but with less code?

crystal flax
#

have thanks

buoyant viper
#

was hoping for like TextComponent theComponent = new TextComponent("Message").setColor(theColor); but setColor is void type

sullen marlin
#

You're meant to use componentbuulder for everything

sterile token
#

Also i have a question related to components, its bug or why when you send too much lines using components some of those lines colors arent apply ยฟ?

buoyant viper
sullen marlin
#

Don't put legacy text in components

sterile token
#

oh right, thanks md4

#

But how would them do it?

sullen marlin
#

.color

crystal flax
sullen marlin
#

Or fromLegacyText / appendLegacy

#

Delete the import

#

?learnjava!

undone axleBOT
sterile token
#

If md5 tells to learn java, you must follow his advice

#

He has lot of experiences and he wouldnt say that to bother you

#

๐Ÿ˜‚

#

So please if you dont learn Java, we wont be able to help you. Because you wont ever understand what we refer to

restive rapids
buoyant viper
crystal flax
sterile token
restive rapids
#

pretty easy task

sterile token
#

Yes

#

I mean you can fully learn java in around 6-8 months

spare mason
#

how i can give a player an effect if you kill a specific mob

restive rapids
#

me a couple years ago I started learning java straight away when using forge api learnt everything the hard way lol

crystal flax
tall dragon
spring minnow
#

how can i remove armor from a mob's drops?

#

apparently clearing the drops list in the EntityDeathEvent doesn't clear the armor

crystal flax
sterile token
#

he?

#

You can pretty learn java in few months

#

Its a pretty easy task, just put to effor to learn it

crystal flax
sterile token
#

Okay def i will not answer like everyone else has done, probably their best choice

#

๐Ÿ˜‚

rapid aspen
sterile token
#
  1. Utils classes should be static
  2. Dont get menus by title
quaint mantle
#

Make it yourself

eternal oxide
buoyant viper
#

yeah, nothing about that code seems to even be able to lead to null where u described

sterile token
#

๐Ÿค”

#

I think thats the problem

buoyant viper
#

thats onmenuclick

#

not onblockbreak

rapid aspen
#

yea

sterile token
#

oh

#

where that

#

he has too much code

buoyant viper
sterile token
#

and tis a mess

rapid aspen
#

sorry

sterile token
#

Not whole plugin because you mix everyone

eternal oxide
sterile token
#

What i have said before

buoyant viper
sterile token
#

Utils has to be static, as i said befoe

sterile token
buoyant viper
#

oh wait, by null, did u mean it wasnt making it past the .contains check?

sterile token
#

The problem as said Elgarl, is that you instancing your utils class everytime so then the Set is alays empty

buoyant viper
#

aka .contains was returning false?

sterile token
buoyant viper
#

ah

rapid aspen
#

yea sorry

buoyant viper
#

then yeah what elgar and verano said are what to do

rapid aspen
#

i was confusing with another thing

buoyant viper
#

make TrollUtils methods and fields static :v and then dont instantiate the class

rapid aspen
#

okkk

sterile token
#

Also that class should be a TrollHandler and instancing it on Main plugin class, finally pass the instance via Dependency Injection

spring minnow
buoyant viper
#

could probably try setting the drops

spring minnow
#

it doesn't work

#

probably bukkit doesn't include armor drops in that

sullen marlin
#

It should

mortal hare
#

do you guys use nullable, not null annotations?

gray merlin
#

I keep getting this issue whenever I try to package my plugin...

#
org.ageofsauron.AOSPlayerManagerReworked.v1_16_5.AOSPlayerManagerReworked is not abstract and does not override abstract method getDefaultBiomeProvider(java.lang.String,java.lang.String) in org.bukkit.plugin.Plugin```
#

Why is this? I've never gotten this before

mortal hare
#

which implementation

#

jetbrains one?

gray merlin
#

yep

chrome beacon
#

Yeah

gray merlin
#

Maven JB

mortal hare
#

do you include them inside gradle or maven project

#

?

gray merlin
#

"them"?

mortal hare
#

annotations

chrome beacon
#

Yeah add it to your project

gray merlin
#

oh i'm stupid I thought it was an answer to my question

#

lol

mortal hare
#

does jetbrains annotations generate assertion code?

#

while processing the annotations

chrome beacon
#

No

mortal hare
#

or they're just simply guidelines in the ide

chrome beacon
#

You can use NonNull from Lombok if you want assertion code

eternal night
#

Intellij has an option to insert runtime checks

#

Tho iirc only works if you compile via idea

#

Which, lmao, what the fuck are you doing if you compile via idea

rare rover
#

would it be best to put variables inside the interface or the class that implements it?

chrome beacon
#

Class that implements it

rare rover
#

thought so

#

okay thanks

#

๐Ÿ™‚

gray merlin
#

I keep getting this issue whenever I try to package my plugin...

org.ageofsauron.AOSPlayerManagerReworked.v1_16_5.AOSPlayerManagerReworked is not abstract and does not override abstract method getDefaultBiomeProvider(java.lang.String,java.lang.String) in org.bukkit.plugin.Plugin```
Why is this? I've never gotten this before
rare rover
#

Would this be the best possible way of doing this???

        Map<Material, List<PlayerGeneratorHandler>> generatorMap = playerGenerators.computeIfAbsent(player, k -> new HashMap<>());
        List<PlayerGeneratorHandler> generatorList = generatorMap.computeIfAbsent(location.getBlock().getType(), k -> new ArrayList<>());
        generatorList.add(this);
        playerGenerators.put(player, generatorMap);```
#

no

#

UUID

#

๐Ÿ™‚

#

but is this the best way?

#

of adding it to the data

#

just trying to add it to a map

#

its kinda lengthy but

#

Map<UUID, Map<Material, List<PlayerGeneratorHandler>>> playerGenerators = new HashMap<>();

#

;-;

#

that's what it does but i felt like this would be the best way

#

performance wise

#

so i can get all the generators with the material without looping all of them

olive lance
#
        Date date = new Date(System.currentTimeMillis());
        System.out.print(date);
    }```
'determine the time complexity' i think it is o(n) but it seems like way tooeasy of a question if it is?
#

there is no loops

#

like wtf

hazy parrot
#

that code is constant lol

#

O(1)

olive lance
#

wait yea O(1) is what i meant

#

shit

#

bro why is that a question literally

worldly ingot
#

Yeah, nothing complicated about it. Just constant

olive lance
#

me who forgot constant time was a thing

quaint tapir
#

can someone explain to me how to schedule a task for later
I've watched 4 videos and read the sheduling page and I still don't know how
I want to make it so when I break a diamond ore it turns to stone
after 10 seconds it should turn back to diamond ore but I don't know how to do it

quaint tapir
hazy parrot
#

lmao

#

you may explain what is confusing you

quaint tapir
#

BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.runTaskLater(plugin, () -> { Bukkit.broadcastMessage("Mooooo!"); }, 20L * 30L /*<-- the delay */);
when I use this code it shows an error for plugin

#

and idk what I need to do

hazy parrot
#

what error

buoyant viper
#

whats the error

hazy parrot
#

if you want people to help you, you have to be specific

buoyant viper
#

it doesnt exist in the method context

#

:P

hazy parrot
#

you haven't just typed plugin without initializing it anywhere, have you ?

buoyant viper
#

u need to pass a (non null, accessible) reference of ur plugin into where it says "plugin"

hazy parrot
#

show how you initialized it

quaint tapir
#

no

#

like

#

I did what you said

#

I didn't initalize it

hazy parrot
#

so pass main class instance using static getter or over the constructor

buoyant viper
#

thatll do it

hazy parrot
#

?di for constructor thingy

undone axleBOT
quaint tapir
#

do I just need to do this for every plugin?

hazy parrot
#

its called dependency injection

gray merlin
#

what version of java does 1.16.5 use?

buoyant viper
#

fukc around and find out

(i think it still runs java 8)

#

if not, try java 17

gray merlin
#

17 doesn't work, neither does 16...

#

i'll just go for 8 and see if it works

undone axleBOT
green tapir
#

how can i code a mech?

#

do i make the model and set it as an entity?

#

and make player mount the entity?

#

if yes then how do i ensure player is in middle of the mech model?

#

so basically i coded a mech and the mech is just a custom modelled giant

#

but how do i mount the player at a specific spot?

#

and use the player direction to set as giant direction?

rough basin
#

I'm not good at making plugins, but maybe it can help

#
  1. spawn the giant and mount player - It's possible but I dont know how to, use google
  2. make the giant facing the same direction(or block) as player
  3. setvelocity
#

this thread will help you a bit, but remember it is set to modify flying mobs

rough basin
bright spire
#

Hey! I switched to a laptop recently and running compilation process on Gradle overheats the machine, this might sound right, but usually compilations on this project manager take long times, long times with the laptop at high temperatures scares me a little.

Is there any way to limit how much cores can gradle use? (Working on Windows 11)

haughty granite
#

from the onAsyncPlayerChat, I want to send a broadcast message if the message contains a specific word

#

but the Bukkit.broadcastMessage() is sent before the player's message, how can I tell him to send it after?

green tapir
#

how do i set a player health permanently to a certain amount of hearts?

fresh timber
#

player.getPlayer().getPlayer().getPlayer().getPlayer()

#

Is there a way to get the weapon used to attack in an EntityDamageByEntity event?

fresh timber
#

hmm

#

nah I dont think that would work

#

im saying the item that was used when the person attacked

#

bcus for bows

#

if they switch items

#

and arrow hits

#

so I wanna get the lore basically of the item that they shot with

lost matrix
lost matrix
haughty granite
#

#getItemInHand().getType()

#

or EntityShootBowEvent ?

lost matrix
#

-> So add data to spawned arrow in launch event
-> Check arrow data in damage event

fresh timber
#

how do you use pdc ive always been so confused and every time I ask someone sends me a useless javadoc website that doesnt tell me anything

lost matrix
#

?pdc

fresh timber
#

.-.

delicate lynx
#

have you tried to read what that says

#

that's not a javadoc

fresh timber
#

yes

#

ik

#

but still makes no sense

#

im kinda stupid :)

#

but yea ig i can try again..

lost matrix
#

PDC is just a key-value map.
The key is always a NamespacedKey and the value is whatever.
You just need to add a Type for every entry you add.

fresh timber
#

so items can hold variable's value..?

#

so you can like put a type and a random value and u can hold values inside mc items

lost matrix
#

Sure you can even store a whole inventory inside an ItemStack. Makes backpacks really easy.
You can store whatever you want in there.

fresh timber
#

o

#

I shoulda done that a while back when I was trying to make backpacks xd

lost matrix
#

Same for every Entity, Chunk and every Block which is a TileState

fresh timber
#

I pretty much was just trying to frickin give the boxes codes in their lore xd

#

so

#

can you store multiple values with different keys in a single item and its different for each item?

lost matrix
#

Yeah for custom items you should also use the PDC.
This way you can change the name or lore and still have the same custom item.

fresh timber
#

hmm

#

would I need like a firearrowevent or smthin?

lost matrix
#

This has come up so many times now... I think its time i write a Tutorial for that.

fresh timber
#

yea that would be nice

#

will it slow down my server much if I add the shooters name to the key and the item that they used when firing arrow to each fired arrow