#help-development

1 messages · Page 836 of 1

quaint mantle
#

Enable the mock first

clever lantern
#

how

grim hound
#

how do I allow aternos users to install my plugin?

shadow night
shadow night
#

last time I saw that feature, you had to make a server, select bukkit or paper as your server software, navigate to the "Plugins" section and there somewhere there is a button "Can't find a plugin?" or something like that

quaint mantle
#

Enable the mock first

grim hound
shadow night
#

what's your plugin?

grim hound
grim hound
shadow night
grim hound
shadow night
#

no

#

it's insane

#

very cool plugin

grim hound
#

appreciate it man

quaint mantle
#

Cool plugin

shadow night
#

I shall put this to the test when time's sweet embrace permits.

grim hound
#

anyway, I'll add a bot attack detection algorithm today, since I had some issues with the AsyncPreLoginEvent

shadow night
#

oh

#

well, nice

grim hound
shadow night
#

just put it onto some testing server, join, check configs, maybe invite a few friends

onyx fjord
#

i do i was afk at the time

umbral ridge
#

xDD

onyx fjord
#

?

remote swallow
#

you missed the fact of enchantment storage meta and you always set the cap instead of only setting when its higher

onyx fjord
#

im p sure i fixed that like 2+ hours ago

remote swallow
#

kekw

onyx fjord
remote swallow
#

outdated moment kekW

onyx fjord
#

something looks off visually tho

#

table shows 3 and i get 2

#

oh

remote swallow
#

gotta change it in the prepare event too

quaint mantle
#

Increaste the cap

onyx fjord
#

table has its own logic

#

yea

quaint mantle
#

Change cap to 100

#

No one likes enchant cap

onyx fjord
#

its configurable

#

but not above vanilla

quaint mantle
quaint mantle
#

884.736 Sharpness 5 books

shadow night
#

lol

grim hound
#

why does AsyncPreLoginEvent return ALLOWED even if the player's join is disallowed because of a ban?

eternal oxide
#

preLogin is before teh actual login so no ban has been checked yet

patent horizon
#

would anyone know why i can't inherit the ItemBuilder class? nothing inside of it is final, so im not sure where this error is coming from

slender elbow
#

in kotlin classes are final by default, you need to mark it as open (open for extension)

patent horizon
#

ah ok tyvm

#

does everything within it need to be open, or just the class itself?

#

the error doesnt go away but i can't tell if it's just an ide thing

quaint mantle
#

Bytecode optimization

dry hazel
#

only the class needs to be open for it to be capable of extension

patent horizon
#

ah looks like an ide problem, restarting fixed the error

peak depot
#

can I change the default unknown command message with bungeecord so I dont have to put a plugin on every single sub server?

umbral ridge
#

hey, there can't be multiple players with the same name on the server right? Eg. Player1, playER1, plAYeR1

peak depot
#

maby could work on cracked but I dont think it would work on online servers

quiet ice
#

Well, the UUID is the only really unique aspect of a player

#

I would not rely on the name being unique

#

Especially given that there are actually duplicate usernames out there, albeit being very rare

umbral ridge
#

yes, so that would work? if I joined with Player1 and then playER1 would also be able to join?

#

I'll change my algorithm a bit to parse the parameter as a player and then compare their uuid

quiet ice
#

If you just want to select players from the arguments of a command, use bukkit's selector API

#

for everything else: what are you doing?

umbral ridge
#

I've got a /teleport <player> command, and im checking if the command executor isn't the same as parameter name (args[0] takes in a player name)

#

So I should still check the UUID for that?

quiet ice
#

Yes

umbral ridge
#

alright

#

does Bukkit.getPlayerExact() throw an exception if player isnt found?

umbral ridge
quiet ice
#

You will still need to check whether the player has selected itself, but that is just a simpe if (sender != entity)

quiet ice
#

You might also be able to do targetPlayer == player to upset quite a few people out there

#

targetPlayer.equals(player) is the best approach tho

ivory sleet
umbral ridge
#

works

#

making a teleport command is rather complicated

#

have to handle everything, what ifs

#

(teleport command with delay countdown)

ivory sleet
#

Yeah, even the simplest of things become complicated when you do it properly at times

umbral ridge
#

So how do you send a clickable message to the chat?

ivory sleet
#

Player.Spigot::sendMessage

deep herald
#

can someone help me check if a player is in a map from a spigot server?

#

im doing the map in bungee

young knoll
#

?pmc

deep herald
#

i wanna do bungee bukkit

#

might just use redis

warm mica
# deep herald might just use redis

Redis is more effort to set up and more resource hungry for simpler projects. Bungee messaging however requires a player to be online, and there is no 100% promise that your message will be delivered, as with e.g. the player leaving

warm mica
#

Well, then redis is possibly better suited. You also have the benefit of being able to deal with the data on a separate thread, instead of the main thread, as with bungee messaging

ivory sleet
warm mica
ivory sleet
#

Yea, tho for anything manageable at a larger scale docker and kubernetes becomes almost an implied standard

quaint mantle
#
public class CustomItemManager {

    private final Plugin plugin;
    private final Map<String, CustomItemListener> listenerMap;
    private final Map<String, ItemStack> itemStackMap;

    public CustomItemManager(Plugin plugin) {
        this.plugin = plugin;
        this.listenerMap = new HashMap<>();
        this.itemStackMap = new HashMap<>();
    }

}```

for these two hashmaps, should I find a way to combine them?
ivory sleet
#

Not necessarily needed

quaint mantle
#

they will both have the same keys

ivory sleet
#

Then maybe yea

quaint mantle
#

maybe I can combine them in like a CustomItemProvider?

lost matrix
#

Docker. Sure. Kubernetes. Overkill unless you need to really scale.

ivory sleet
#

Well its not always to make it scale

#

Sometimes its just easier to manage and is convenient if you learnt it

#

Ofc if you’ve no interest in expanding your knowledge then yeah prob not sth u wna touch

lost matrix
#

What else would you need orchestration for, if not horizontal scaling? 🤔

lost matrix
ivory sleet
#

I mean sometimes you do it to automate installations and just if someone got a good setup of a service you can yoink it

quaint mantle
ivory sleet
#

But scaling is a key factor obviously

quaint mantle
#

and it's basically the CustomItem

#

and then there's the implementation for the customitem which is the CustomItemListener

ivory sleet
#

Max you could presumably bundle the two maps with some sort of record class

#

Or well their value objects

quaint mantle
#

hm

ivory sleet
#

Record(Listener, Item)

quaint mantle
#

no ik

ivory sleet
#

:>

quaint mantle
#

but then i gotta store the listener in a variable

#

wait

young knoll
#

Pair<L, R>

quaint mantle
#

record does that

young knoll
#

👀

lost matrix
ivory sleet
quaint mantle
#

oh wait

#

I can just make it private right

#

like a private class in the manager

ivory sleet
#

yea

quaint mantle
#

doesn't hashmap do that

#

it has like a node class

lost matrix
#

I kinda dont like where this is going

ivory sleet
#

yes max

quaint mantle
ivory sleet
#

HashMap code is kinda old tho

#

Not a primary example to take inspiration from

lost matrix
#

Packing non-data classes into a record just screams design issue to me.
Same goes for listeners in a map.

echo basalt
#

Or maps in a listener

#

which is a lot more common

quaint mantle
#

ok

#

well i dont have to use a record

#

but it's anyways gonna be private

lost matrix
#

Yeah but that is just because ppl dont know "how to pass a value from one class to another"
And if they get it, they start passing around maps and come to us with impossibly convoluted exceptions
because everything is everywhere at all times.

ivory sleet
echo basalt
#

I worked on a custom item api today

#

Just to mess around and see if I could actually learn something

quaint mantle
#

can i see how u did ur system

echo basalt
#

sure I could replace onClick with an event bus thing

quaint mantle
#

how im doing my thing is

#

u register it to a manager

echo basalt
#

But I just took inspiration from nms

quaint mantle
#

like

echo basalt
#

The manager is still a thing

quaint mantle
#

ok wait hold on

#

i dont think ima pass an itemstack at all

ivory sleet
#

sounds like a good choice

lost matrix
# echo basalt

I would have a few notes on this but i should def go to sleep 🙂
But using the PDC to map functionality to items is my approach as well.

echo basalt
#

I still have an abstraction layer on top that grabs the itemstack from the config based on the identifier and passes it on

quaint mantle
#

CustomItemManager#register(String referenceName, CustomItemConfig, CustomItemListener)

echo basalt
#

I'll be travelling in like 6 hours so eh

#

I should sleep too

minor junco
#

when was PDC introduced btw?

quaint mantle
#

then to get custom items

echo basalt
#

1.14

#

iirc

#

might be 1.13

quaint mantle
#

the only thing which

#

idk if it's a bad or good idea

#

is that the configs will be references

ivory sleet
#

wym by that lol

quaint mantle
#

they're all mutable and you can edit them runtime

ivory sleet
#

what is mutable?

quaint mantle
#

the configs

ivory sleet
#

The config data? Or the references to the configs themselves

echo basalt
#

TBh I've never seen the point in modifying and saving configs

echo basalt
#

they should be read-only imo

quaint mantle
#

so like

ivory sleet
echo basalt
#

So like sure you can still have config values

quaint mantle
#
public abstract class CustomItemConfig {

    protected Material material;
    protected String name;
    protected List<String> lore;
    protected boolean unbreakable;
echo basalt
#

That should just be an item builder

#

and instead of holding all the same fields you just hold meta and modify it

quaint mantle
#

?

#

oh this is a base for a custom item

echo basalt
#

looks like an item builder to me

minor junco
#

yes but it's very similiar to an item builder no?

quaint mantle
#

things can extend it and have their own values like "int specialDamagePercentage"

ivory sleet
#

Max have you by any chance read the items of effective java?

quaint mantle
#

ive scimmed over it

echo basalt
#

I've only read like 25% of effective java and I've actually adjusted my code style around it a bit

#

Stuff like static .of methods

ivory sleet
#

A lot of the design points illusion, I and smile point out sorta derive from effective java more or less

#

Now not everything but a lot of stuff

echo basalt
#

thing is it's like 600 pages

echo basalt
#

I'm ~150 in

quaint mantle
ivory sleet
#

Haha yea, well u can find githubs with summaries

echo basalt
#

i just found the pdf on github

ivory sleet
echo basalt
quaint mantle
#

i have it on my phone lol

ivory sleet
#

but if u rly want it, sure that does work

opal juniper
#

real quick

echo basalt
#

Imma be at my grandma's house tomorrow

quaint mantle
#

christmas?

echo basalt
#

am debating if I should code on my laptop or use it to read effective java

echo basalt
#

Might just bring my driving school book and take notes

#

as I have my exam in a couple weeks

quaint mantle
#

what course

echo basalt
#

it's literally just driving a car

quaint mantle
#

oh

#

lol

echo basalt
#

I have some hours on the road, need to do this exam so I can sign up for more

quaint mantle
#

what country are you in

#

wtf

echo basalt
#

Portugal :)

quaint mantle
#

in us you can get your liscense at 16

echo basalt
#

well I'm 18

minor junco
#

yo is there an event for when a player "leaves" a spectator target, as in when they shift out (without actually listening to the shift entity action)

echo basalt
#

well no

#

scheduler time

minor junco
#

great

echo basalt
#

But yeah I need to do this entire safety course so I can drive

quaint mantle
#

ok maybe i will make the fields final lol

echo basalt
#

and I can sign up to 16 hours of driving before having to do an exam

#

Once I do the exam I need to do the remaining hours

#

Once I hit 32 hours I can sign up for a practical exam where I drive around

ivory sleet
#

well fyi :>

quaint mantle
echo basalt
#

I've got about 7-8 hours right now, my instructor's schedule is completely packed

quaint mantle
#

in the US it's a lot easier

echo basalt
#

narrow roads

quaint mantle
#

yeah in the US it's super easy

echo basalt
#

Went on the highway in my last lesson and nearly crashed because mfs didn't let me merge lanes

quaint mantle
#

there's really nothing hard about driving here lol

#

maybe unless you're city driving

echo basalt
#

here's the other thing

#

it's a manual car

quaint mantle
#

lol

#

gl

#

lmao

echo basalt
#

noob

#

not that hard you just need to prevent it from dying

quaint mantle
#

So here is an export of my Mongo collection (kitData)
https://paste.md-5.net/iyeqimotek.json

I am having trouble after converting from using Bukkit YML configuration to store data, to MongoDB

So far i've spent 6 hours trying to make it work for Mongo (it works on saving this data, and renaming the kit tag, and removing the kit, even loading the kit works) The whole issue here is that when i call my #setUpKitEditorInv method that it won't refresh/update the inventory with the respected column of buttons.

It's very simple, when you save a kit a column of buttons (loadKit, renameKit, removeKit) buttons will be added below the saveKit button.

KitManager class methods:
https://paste.md-5.net/gevebitaha.coffeescript

KitListener (so you can understand how this is being used):
https://paste.md-5.net/jametakowo.java

MenuUtils (where i control the inventory and want to update/refresh) #setUpKitEditorInv is called in KitListener
https://paste.md-5.net/cotizogeze.java

Please help me, i don't know why this is giving me trouble, i've tried literally everything and I think it's about damn time i ask for some help on this

fair crest
#

hey

#

how do i check a item display name

#

for a gui

echo basalt
#

Well, you don't

#

?pdc

quaint mantle
echo basalt
#

Which in turn becomes hard to debug

quaint mantle
fair crest
#

im still new to this. not 100% sure on how to make variables

quaint mantle
fair crest
#

oh wait

echo basalt
#

I'd also go over the main problem areas and refactor them following this guide

#

Split your database logic up and return completablefutures for stuff

fair crest
echo basalt
#

For your database, I'd make a KitLoadout object

#

It can just wrap all the params on the other methods but it helps to make the logic a bit simpler

civic apex
#

how can i detect when a player sends a bungeecord command? Like any bungee command, but not any spigot command/chat message

echo basalt
#

And then you can do something like

public interface KitsStorage {

  KitLoadout getLoadoutSync(UUID playerId, String loadoutId);
  void saveLoadoutSync(UUID playerId, String loadoutId, KitLoadout loadout); // display name would be on the loadout object

  default CompletableFuture<KitLoadout> getLoadoutAsync(UUID playerId, String loadoutId) { // You should override this and make sure the futures finish running on shutdown
    return CompletableFuture.supplyAsync(() -> getLoadoutSync(playerId, loadoutId)); 
  }

  ...
}
#

@quaint mantle

quaint mantle
echo basalt
#

Which means you can do stuff like saveLoadoutAsync(...).thenRun(this::updateMenu)

quaint mantle
echo basalt
#

your mongo

#

and your yml reader

#

If you want to migrate you can read all the data from one and save to the other

quaint mantle
echo basalt
#

Still it's a decent approach that lets you future-proof your stuff

quaint mantle
quaint mantle
#

I think it's pretty nice how they handled their data

echo basalt
#

uH it's like 3am so I might be quiet

quaint mantle
echo basalt
#

Give me like 15 mins

quaint mantle
#

interface - StorageImplementation
class - handles async stuff and exceptions with the StorageImplementation

echo basalt
#

Yeah that's basically what we're doing here

fair crest
#

so how do i make a right click event

quaint mantle
quaint mantle
fair crest
#

alr

quaint mantle
fair crest
quaint mantle
echo basalt
#

give full names to your variables

#

it's in the good habits list

quaint mantle
echo basalt
#

I mean yeah but do other people know that

fair crest
quaint mantle
quaint mantle
echo basalt
#

waiting for your ahh to join the call

#

discord about to disconnect me at any second now

quaint mantle
fair crest
quaint mantle
#

does anyone know why i can do if() thing; while() thing; but not catch() thing;

fair crest
#

or create particles that do that i guess.

quaint mantle
#

and the same with the else keyword

wet breach
quaint mantle
#

?

#

no i mean like the syntax

#

like

wet breach
#

for while statements instead of else its do

quaint mantle
#
if (true) doSomething();
else doSomethingElse();

while (true) doSomethingForever();

try
  throwAnException();
catch (Exception e)
  handleException(e);
#

@wet breach this is what I mean

fair crest
#

yo guys

#

how do i cancel the crossbow shooting a arrow

quaint mantle
#

event.setCancelled(true)

fair crest
#

also which button makes the crossbow shoot

quaint mantle
#

I'm assuming you're new so you should learn how to find the event and register it yourself

wet breach
#

try catch can only exist inside of a code block

#

because its purpose is to catch exceptions that arise

fair crest
echo basalt
#

@quaint mantle

quaint mantle
#

yo illusion

waxen plinth
#

eh, try/catch is just terrible

quaint mantle
#

@waxen plinthi am thinking of a new design lmk what u think of it

waxen plinth
#

I think it would be nice if they had better ways to handle nullability and exceptions inline

quaint mantle
#

so i got rid of passing itemstack completly

#

instead it's something maybe like this

waxen plinth
#

like something to convert it to an Optional, or if you could do a prefix try? to turn something from fallible to nullable

ivory sleet
#

I think switch (x) {
case throws Exception e -> …
}
could B cool

waxen plinth
#

hmm

#

yeah that would be an improvement

quaint mantle
#

CustomItemManager#register(String referenceName, CustomItemConfig config, CustomItemListener itemImpl)

something maybe like this

waxen plinth
#

it's just so terrible to handle exceptions

#

verbose

ivory sleet
#

But yeah Optional is also a bit limited, as its not as powerful as rust Option, Haskell Maybes or yk anything else thats properly addressing nullability

quaint mantle
#

idk abt yall but i kinda like handling exceptions

waxen plinth
ivory sleet
#

I think its also really hard to choose between null, exception and result objects at times, its not made easy to understand when to use what on a deep level

quaint mantle
#

lol

waxen plinth
#

yeah exactly

quaint mantle
#

imagine java but no runtime exception

waxen plinth
#

it was too late when null was baked into the language

ivory sleet
#

Yeah

#

Well they want to address null partially with valhalla

#

Which is a step in the right direction

quaint mantle
#

yk what this reminds me of

waxen plinth
#

god I might need to make a jvm lang

quaint mantle
#

when u get armor of an entity with bukkit it can return null

#

but if you set the armor of an entity u cant use null

waxen plinth
#

if I could make elude target jvm that'd be sick

waxen plinth
ivory sleet
#

Well Max I firmly believe in minimizing the amount of null state, but null can be advantageous to exceptions as they’re way less resource intensive

quaint mantle
#

ok

#

i wasn't even talking abt nulls

#

i was just wondering why java had syntax like that lol

quaint mantle
#

maybe I can pass in the manager within each event?

#

im pretty sure JDA does that

quaint mantle
#
class FileConfigServiceTest {

    @Test
    void testExceptions_loadAndRegister() throws IOException {
        ConfigService<TestConfig> configService = setUpNewConfigService();

        assertDoesNotThrow( () -> configService.loadAndRegister(new ValidConfigWithObjects()) );
        assertDoesNotThrow( () -> configService.loadAndRegister(new ValidConfigWithPrimitives()) );
        assertThrows(IllegalStateException.class, () -> configService.loadAndRegister(new ValidConfigWithObjects()) ); // Loading an existing config.
        assertThrows(IllegalStateException.class, () -> configService.loadAndRegister(new NotValidUnAnnotatedConfig()) );
    }

    @Test
    void testFileContentIsCorrect_loadAndRegister() throws IOException {
        FileConfigService<TestConfig> configService = setUpNewConfigService();
        Gson gson = configService.getGson();
        configService.loadAndRegister(new ValidConfigWithObjects());
        configService.loadAndRegister(new ValidConfigWithPrimitives());
        String contentOfConfigWithObjects = Files.readString(configService.getConfigFolderPath().resolve("ValidConfigWithObjects.json"));
        String contentOfConfigWithPrimitives = Files.readString(configService.getConfigFolderPath().resolve("ValidConfigWithPrimitives.json"));

        assertEquals(new ValidConfigWithObjects(), gson.fromJson(contentOfConfigWithObjects, ValidConfigWithObjects.class));
        assertEquals(new ValidConfigWithPrimitives(), gson.fromJson(contentOfConfigWithPrimitives, ValidConfigWithPrimitives.class));
    }
}

am i doing unit testing correctly

echo basalt
ivory sleet
#

Or well not complicated

#

But like

quaint mantle
#

why

#

doing too much?

ivory sleet
#

You do a ton of shit in ur unit tests

#

yea

#

I reckon you could mock some of the logic

#

With…. mockito ⭐

quaint mantle
#

first one is making sure it's throwing proper exceptions and second one makes sure the saved contents are correct

#

idk what mocking means

quaint mantle
# echo basalt no

Hey can you please just send me those classes so i can have them as reference?

river oracle
#

can someone explain how Gradients Work/ what they are and what an implementation would look lik

#

most of the resources I found on line just use AWT which really doesn't explain a lot as its abstracted behind API

warm mica
echo basalt
#

In short, yes

#

You can have a gradient going over multiple colors in the spectrum

#

So you'd need to interpolate between each color for each character

#

For example, if you have 3 colors, you divide the string up in 3 parts

quaint mantle
#

Bro what time is it for you

echo basalt
#

6:20am

quaint mantle
#

Did you even sleep

echo basalt
#

no

#

family's travelling in an hour

#

I'll just down 15 red bulls

river oracle
#

what sort of math is it

echo basalt
#

you just interpolate

#

lerp all 3 colors

river oracle
#

wtf is an interpolate lol

echo basalt
#

start + (end - start) * progress

river oracle
#

ahhh

untold marsh
#

where I can ask for a price of how much it would cost me to make me a plugin from 0 of some minigame.

echo basalt
#

?services

undone axleBOT
untold marsh
#

yes

fair crest
#

hey guys

#

is this code good or a fail

#

`public class RightClick implements Listener {

@EventHandler
public void ClickEvent(InventoryClickEvent FireClick){

    FireClick.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.WHITE + "M4A1");
            FireClick.isRightClick();
                    FireClick.setCancelled(true);
}

}`

echo basalt
#

?tryandsee

undone axleBOT
river oracle
#

don't even need to try and see

#

it won't work xD

#

getItemMeta returns a clone/copy

echo basalt
#

here's the thing

#

none of it is conditional

#

there's no if check

river oracle
#

ahhh I just realized xD

echo basalt
#

lmfao

fair crest
river oracle
#

?learnjava!

undone axleBOT
fair crest
#

so. do i gotta

#

change it

echo basalt
#

write some actual code yeah

fair crest
fair crest
echo basalt
#

?pdc moment

river oracle
#

facts

fair crest
#

then find the display name and cancel event

#

im still new to this

echo basalt
#

you don't check metadata

#

you just check a tag

#

can you read the actual post

fair crest
#

alr

#

so i don't have the variables to do that

#

ummm

fair crest
fair crest
quaint mantle
#

Like why is it returning a clone and not directly the ItemMeta of the item

river oracle
fair crest
#

hey yall, whenever i use this code to give a item. it doesn't show errors but instead everytime it gives you another crossbow when you try to remove one.

this is the code i used
`public class ClickEvent implements Listener {

@EventHandler
public void ClickEvent(InventoryClickEvent e){

    Player player = (Player) e.getWhoClicked();

    if (e.getView().getTitle().equalsIgnoreCase(ChatColor.RED + "Extreme Gun System"))
        e.setCancelled(true);
        if (e.getCurrentItem() == null){
            return;
        }
        else if (e.getCurrentItem().getType().equals(Material.BOW))
            if (e.getView().getTitle().equals(ChatColor.RED + "Extreme Gun System"));
                player.closeInventory();
                ItemStack arrowItemstack = new ItemStack(Material.ARROW, 1);
                ItemStack item = new ItemStack(Material.CROSSBOW);
                ItemMeta itemMeta = item.getItemMeta();
                itemMeta.setDisplayName(ChatColor.WHITE + "M4A1");
                itemMeta.setUnbreakable(true);
                CrossbowMeta meta = (CrossbowMeta) item.getItemMeta();
                meta.addChargedProjectile(arrowItemstack);
                itemMeta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
                item.setItemMeta(itemMeta);
                player.getInventory().addItem(item);
            if(e.getClickedInventory().getHolder().equals(player)){
                return;`
quaint mantle
#

?learnjava

undone axleBOT
quaint mantle
#

Learn if statements oml

#

this seriously hurts my eyes

undone axleBOT
fair crest
quaint mantle
quaint mantle
#

your if statements make no sense

fair crest
#

so.

#

thats the issues

#

ima test 1 thing then take ya advice

#

wanna see if this wokrs

#

works*

quaint mantle
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

this is how the if statements work in your case

#

the arrows show, what code gets executed if the if statement is successfull

#

the other code just runs without any if statement

#

the indent makes no sense

#

wait

#

the last if statement

#

doesnt execute anything

fair crest
#

k

#

yea i replaced those

#

the ones that didn't do much to me

quaint mantle
#

you might want to use {} more often.

fair crest
#

k

#

thanks for your advice

#

means alot.

upper hazel
#

i was going to do plugin in 1.20.1 and i was find paper-plugin.yml... what this

#

a little confusing

#

won't there be any bugs because of it?

upper hazel
#

oh yea i 😅 forgot

icy beacon
#

Compiling Kotlin stuff with Maven and a lot of libraries is getting slower by the day lmao

#

And my pc isn't even bad

#

I might try to switch to gradle at some point, maybe that'll speed things up

#

Actually it's just the first compilation of the day that's slow. Doesn't make it less weird though but ok

orchid trout
#

java -DIReallyKnowWhatImDoingISwear -jar server.jar -nogui
SEVERE: D is not a recognized option

umbral ridge
#

for flags id take a look at aikar flags docs

eternal oxide
#

java -Xms1G -Xmx1G -Dlog4j2.formatMsgNoLookups=true -jar -DIReallyKnowWhatIAmDoingISwear "%p%" nogui

orchid trout
#

tajks

#

what is "%p%"

eternal oxide
#

server.jar

#

its just my script that searches for the spigot jar to launch, so I don't have to change my script for server jar name changes

#
@echo off
if NOT exist "plugins" mkdir "plugins"
@echo Updating GroupManger...
copy /B/Y P:\eclipse2020-workspace\GroupManager\target\groupmanager.jar plugins

@echo Updating Regen...
copy /B/Y P:\eclipse2020-workspace\Regen\target\Regen.jar plugins

@echo Updating Planter...
copy /B/Y P:\eclipse2020-workspace\Planter\target\Planter.jar plugins

for /f "tokens=*" %%a in ('dir spigot*.jar /b') do set p=%%a

if defined p (
echo Starting Server... %p%
java -Xms1G -Xmx1G -Dlog4j2.formatMsgNoLookups=true -jar -DIReallyKnowWhatIAmDoingISwear "%p%" nogui
) else (
echo No Spigot found!
)
pause```
#

so I can drop whatever server jar in to test

orchid trout
#

and its giving the same error but with x instead of d

eternal oxide
#

I've never done it but it sounds like you are tryign to add a launch command to the VM options

orchid trout
#

to progream argument

#

s

#

i put it in the wrong place

eternal oxide
orchid trout
#

so ive been scraping shit off grass for the past hour

#

gtnjaml

#

thaksn

shadow night
#

Debuggers are amazing

mellow edge
#

I don't know why a random error ocurred when I tried compiling maven and then just every spigot class got unrecognised in intellij:

eternal oxide
#

mvn clean

mellow edge
#

nothing is working even clean will not fix it, I tried deleting .iml and .idea but still it gives me this error

#

also in other maven projects

eternal oxide
#

I don't use IJ so can't advise

#

clear caches and restart?

orchid trout
#

iont get where it is

shadow night
#

It's in your server directory ig

orchid trout
#

in my project folder?

eternal oxide
#

why are you not doing IDE as a local debug server?

orchid trout
#

how

eternal oxide
#

option 3

orchid trout
#

ok

mellow edge
#

I fixed it by just deleting /.m2/org.spigotmc-api and then reinstalling it

eternal oxide
#

I sure hope not

half arrow
#

Can anyone advise on the best way to update countdowns in item lore for example you see it on auction house plugins, the lore updates dynamically every second? I creating runnables feels wrong for this especially if there’s a ton of items

shadow night
#

You could have one runnable looping through all items but that doesn't sound very convinient either

half arrow
#

Yeah sounds messy, trying to find a open source plugin that does it just to get an idea

vocal cloud
#

If you store an item in a list and then add it to an inventory and update it in the list does it update it in the inventory or does add create a copy?

shadow night
#

From what my java knowledge tells me

vocal cloud
#

I can't remember if it's a copy or a reference

shadow night
#

I can't either, but ig you could just try it or assume

vocal cloud
#

I'd test it but I'm in bed and it's comfy.

shadow night
#

Oh lol

#

For such cases I have vnc running on my laptop and on a vm too, so I can test things from my phone

vocal cloud
#

I could do that. Idk if they already have the code for an AH they could just test it easily

dry forum
#

im doing stuff with guis and i wanna get players input but anvilguis are limited to how much text you can have in them and chat wouldnt work for bungee, is there anything else?

shadow night
#

book and quill?

chrome beacon
#

You could use chat with bungee if you wanted to

chrome beacon
#

You'd need a runnable

chrome beacon
#

^^ this or just loop the inventory

#

Some actions do copy the item so it might be worth looping inventory

quaint mantle
#

I learned this the hard way

chrome beacon
#

Does it get cloned if you cancel the event?

quaint mantle
#

what i did to fix it is use

#

?pbd

#

?pdb

#

ah

chrome beacon
#

?pdc

quaint mantle
#

?pbc

#

yes

#

that

#

so i used persistentdataholder to give the item a UUID

#

and then looped trough the inventories to update

quiet ice
umbral ridge
umbral ridge
eternal oxide
#

So long as it keeps workgi

umbral ridge
#

I think they're making some changes to their client GUI

#

so they can no longer support older systems

half arrow
#

why tf are you still on win7?

quiet ice
#

It's Elgar, he has a special right to

eternal oxide
#

yep

grave plover
#

Hello everyone,
I am searching for a way to let players from every version (maybe every 1.20.* version) connect to a spigot server with a plugin. I think I have to use packets, but I am not sure how... I do not want to rely on any other API than spigot / nms itself for security reasons.

chrome beacon
#

Just use ViaVersion

#

security through obscurity is just a bad idea

quiet ice
#

I think I have to use packets
That is a ... rather optimistic guess

grave plover
chrome beacon
#

If you want to do it yourself you'll need to convert every packet yourself

quiet ice
chrome beacon
#

^^ Here's the protocol information

#

Good Luck

quiet ice
#

Because every packet has a use somewhere

grave plover
chrome beacon
#

You can always read the code yourself

grave plover
quiet ice
#

It's like translating english to french. You need to be able to translate every word, not just "Hello", "Goodbye" and "Food"

grave plover
quiet ice
chrome beacon
#

Writing it yourself won't be much faster

grave plover
quiet ice
#

Yeah?

grave plover
#

I didn't know, then it is out of my matter xd

grave plover
# quiet ice Yeah?

I thought there would be similiar / identical ones for basic things like login, because there isnt really much to change from version to version

quiet ice
#

They don't change drastically yes, but noticably enough that you can't just plug and play

#

Again it is much like french and english. Many words are the same, but over time those two languages diverged so much that they aren't compatible [though here my comparision falls apart because french is latin and english germanic, but you get the drill]

grave plover
#

I really thought that it could be easy-going... seems like I have to use protocollib / viaversion... do you have any record on their performance on a server? are they raising cpu load or anything?

chrome beacon
#

They're good enough

grave plover
#

ok, thank you

glossy venture
#

?mappings

undone axleBOT
grim hound
#

packet events is the way

#

but they still won't be able to process different client to server versions without via version

pliant topaz
#

How would i go about making a specific item unmovable in the player's inventory?`This is my code currently but the event doesn't even get triggered


        System.out.println("MOVED");
        if (Objects.equals(CreateBoard.gameState, "RUNNING")) {

            System.out.println(event.getItem());
            if (Objects.equals(event.getItem(), PlaceVillageBlue.get())) {
                event.setCancelled(true);
            }

        }

    }```

Another option I tried was InventoryClickEvent which would be:
```public void InventoryClickEvent(InventoryClickEvent event) {

        if (Objects.equals(CreateBoard.gameState, "RUNNING")) {

            if (Objects.equals(event.getCurrentItem(), PlaceVillageBlue.get())) {
                event.setCancelled(true);
                System.out.println("Cancelled");
            }

        }

    }```

Still, both options don't seem to work. The first doesn't get triggered and the second one makes the item duplicate itself when picked up and it's movable with shift-clicking and also hotkeying.
Anyone knows what I've done wrong?
peak depot
#

can I change the default unknown command message with bungeecord so I dont have to put a plugin on every single sub server?

chrome beacon
#

when they transfer items

lost matrix
#

InventoryMoveItemEvent is fired by hoppers, not players.
You need to cancel the InventoryClickEvent and drop event.

#

Ah and keeping it on death

lost matrix
#

Well this is covered by the click event

chrome beacon
#

better safe than sorry

pliant topaz
#

But cancelling InventoryClickEvent sometimes doesnÄt work

chrome beacon
#

That would probably be because the drag event is firing

pliant topaz
# lost matrix When?

When I shift-click it, it gets cancelled but after that I can just take it and nothing happens

#

Same with hotkey

rotund ravine
#

Are you in creative

pliant topaz
#

yes, why?

lost matrix
rotund ravine
#

So there is an InventoryCreativeEvent to try

pliant topaz
#

Yea, i jheard of it

chrome beacon
#

ah yeah player inventory and creative mode

rotund ravine
#

But otherwise creative breaks every inventory shit

chrome beacon
#

That's a pain

pliant topaz
#

K, I guess I'll try that

#

thank y'all

grim hound
#

since the BanList is not thread-safe, how can I asynchronously check whether a name is banned?

#

I cannot do it sync, since it's in the AsyncPreLoginEvent

#

and the PreLoginEvent is a menace to performance

grim hound
lost matrix
#

Yeah you can load user related data there for example.
Or check if someone is banned. Why are you trying to access the BanList there in the first place?

grim hound
ivory sleet
grim hound
ivory sleet
#

I mean, sure it may not be 100% up to date

quiet ice
ivory sleet
#

But usually even in a concurrent environment reading should be 100% fine

grim hound
#

have any of you ever worked with HashMaps?

ivory sleet
#

Yep

quiet ice
#

A bit dangerous, but as long as you aren't iterating it shouldn't be too bad

lost matrix
ivory sleet
#

I’ve implemented a couple as well in java

ivory sleet
#

Anyway I wasnt sure if you were talking about the existing banlist or ur own, custom one

quiet ice
#

You just may need to take a few precautions to make sure that you actually obtained the right entry in case the hashmap is getting rehashed when you obtained the value. But I think that should be rather easily possible in your case

ivory sleet
#

If its ur custom one, then its pretty fine to just load relevant data in APPLE from ur database or so

lost matrix
#

*PS: BanList is not a HashMap

grim hound
ivory sleet
grim hound
#

1.20.2

lost matrix
# grim hound 1.20.2

Yeh the StoredUserList is backed by one. Doesnt mean you can infer thread (un)safety from it

quiet ice
#

Or you know, if the banlist is a singleton: Just sneakingly change the value of the map on the main thread via reflection or unsafe

lost matrix
#

Here is the main problem. Even reading might trigger a bulk operation.
This means reading cant be done async. (Which is usually the case for normal HashMaps)

grim hound
#

I knew I once found a problem with this

#

never actually got the error, but that doesn't mean it can't happen

quiet ice
#

Yeah then you need to read via reflection, at which point you might as well use reflection to make it thread-safe, at which point you might as well use your own banlist impl (probably possible I guess?)

grim hound
#

but I wanna remain full compatibility with the bukkit one

lost matrix
#

Or just callMethodSync and read from the list on the main thread while blocking the login for a few millis

grim hound
#

so I guess I'll just have to forcibly synchronize them

quiet ice
#

Well I was talking about also registering it to bukkit and substituting bukkit's banlist with it

grim hound
#

btw, since a few big boys are already here

#

how can I intercept the incoming connections, even before the async pre login event?

lost matrix
quiet ice
#

But mah unsafe hackery

grim hound
#

you mean like

#

setting it to a ConcurrentHashMap

#

via reflection

quiet ice
#

Yes. And then get the value of the map

lost matrix
ivory sleet
#

Or just dont use bukkits banlist at all

quiet ice
#

You probably need unsafe and not reflection though, given that it is a final field

ivory sleet
#

And have ur own system

grim hound
#

I only need the name and ip

quiet ice
#

You'll only get ip in the handshake iirc

lost matrix
grim hound
#

and the name in LoginStart?

grim hound
#

or I'd do if I knew how to hook it up

#

can anyone lend a hand?

quiet ice
grim hound
quiet ice
#

when is that handled then?

grim hound
#

I tested it

#

after the Encryption begin

#

so I think at the very end of the LOGIN phase

young knoll
#

Technically you can look up name via uuid

grim hound
ivory sleet
#

W mojang api?

grim hound
ivory sleet
#

Ah

#

Well I still don’t get why you don’t just have your own banlist thingy

#

Why do u need to base it on bukkit

#

Just curious

grim hound
ivory sleet
#

Oh, I mean you could just simply have ur own commands

grim hound
#

have it called sync via the bukkit scheduler

#

or override it with reflection

ivory sleet
#

The callSyncMethod is a bit meh as its bound to the game tick loop

grim hound
ivory sleet
#

Hmm, I see

grim hound
grim hound
#

but it'd still need to wait for the tick loop

ivory sleet
#

If its sync, its pretty much bound to be following the game tick loop… yea

grim hound
#

since that's how synchronization works

grim hound
ivory sleet
#

Thats right

grim hound
#

blocking it shouldn't be a big problem

ivory sleet
#

No it’s completely fine to block it

#

I mean else I really liked the others’ suggestions about injecting some CHM in it all

#

but yes, you could simply do that

ivory sleet
#

CoconutHashMap

#

Concurrent*

grim hound
#

same thing

ivory sleet
#

Lol yea

grim hound
#

I guess I could do that at start-up

#

then I'll do just that

#

but one more thing

grim hound
#

how do I add the connection interceptor?

#

like straight up a player requests to join

#

before the new thread is created

ivory sleet
#

I believe u can prob inject the netty pipeline before it all happens

#

Or something along those lines

grim hound
#

also

#

how do I get their ip

grim hound
#

and how can I do it on spigot?

#

since on Paper there's some afterChannelInit stuff

ivory sleet
grim hound
#

apple?

ivory sleet
#

AsyncPlayerPreLogin

#

Event

grim hound
#

NICE

ivory sleet
#

Like it has an inet address so… thats the ip I reckon :>

#

Yea

grim hound
#

but that is WAAAAAY after the handshake

ivory sleet
#

True

grim hound
#

and the thread creation

#

hmmm

#

makes me wonder how ViaVersion does this stuff

grim hound
#

the user sends the server address?

#

not their own?

dry hazel
#

well the server already knows the user's address from the incoming connection

lost matrix
grim hound
grim hound
lost matrix
dry hazel
grim hound
#

can you

#

elaborate?

lost matrix
#

I would probably use a packet library which already does this

grim hound
#

where can I get the pipeline?

#

@dry hazel ?

quiet ice
#

Somewhere in the nms player class I assume

lost matrix
#

Handshake is a bit different as the there is no actual client yet

quiet ice
#

Ah right yeah

#

There you'd somewhere need to find the global pipeline of the server socket

dry hazel
quiet ice
#

why on earth did you ping me of all people?

#

Quite the opposite. Though I have no experience at all with bungee, so I can only give you the advice that you just throw things at the wall and see what sticks

#

Do beware that not every spigot plugin can be migrated to bungee/velocity (if you make a new stack from scratch, I'd recommend going with velocity, it seems like the better option of the two. Though arguably noone will go away anytime soon)

lost matrix
#

Highly depends on what your plugin does.
Spigot is an actual game server. Bungeecord is just a proxy which routes packets from A to B.
They are fundamentally different from each other.

quiet ice
#

Basically, if a plugin interacts with the world - then it is better that it is done via bukkit, not bungee.

sterile sapphire
#

It says “illegal start of type”

quiet ice
#

that can probably be migrated to bungee - simply change the bukkit/spigot dependency to bungee and fix all the errors that are caused by doing so.
However, I recommend going with a solution that already exists and learning how to work with bungee some other way.

lost matrix
#

This... does IO on the main thread if im not mistake. Not sure if i would want that on my server.

quiet ice
#

Porting generally requires good knowledge of both the source system and the system you are targetting your port at

lost matrix
#

Then there is a 0% chance of you converting this to bungeecord.
This can be ported but it will lose some of its functionality.

sterile sapphire
#

Could u guys help me with this error? It says “illegal start of type” and if u want I can send a pic of the code

lost matrix
quiet ice
#

While I could help you with like the basic things (e.g. what is the substitution of X), it is a bit pointless of a learning exercise for you

sterile sapphire
#

What are those things u send to make the code into a grey box :0

lost matrix
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
quiet ice
#

Especially since you will need to get accustomed to a codebase you have not written yourself. Ordinarily both a blessing and a curse, but for porting (especially between systems this different) it just is a curse compared to writing it yourself.

sterile sapphire
#

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.checkerframework.checker.units.qual.C;

import static org.bukkit.Bukkit.getLogger;

public class CommandExecutor implements org.bukkit.command.CommandExecutor {

    @Override
    public boolean oncommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("Test")) {
            if(sender instanceof Player) {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.GREEN + "Success!");
            } else {
                getLogger().info( "This Command Must Be Ran By A Player");
            }
        }
            return true;
        }
        return false;

    } ```
quiet ice
#

In that case, just use something that already works. Programming is both easier (for people that already can do it well) and harder (for the laymen) than people expect

lost matrix
#

Which requires a very decent amount of coding experience.
As stated before: Spigot and Bungeecord are two completely different pieces of software that have very little in common.

lost matrix
sterile sapphire
lost matrix
#

Wait... no you have enough. Your return false; is just inside your class instead of your method.

sterile sapphire
rotund ravine
#

?services

undone axleBOT
lost matrix
sterile sapphire
#

maven

quiet ice
#

(For eclipse: Ctrl + A, Ctrl + Shift + F)

quiet ice
lost matrix
#

IJ its Ctrl + Alt + L

sterile sapphire
quiet ice
#

Yeah. Chances are something else does that already - especially for a problem this common

quiet ice
#

Please don't tell me you've been using Notepad this whole time

sterile sapphire
#

no

#

im using intelij

#

community version

sterile sapphire
#

me.tom.test.CommandExecutor is not abstract and does not override abstract method onCommand(org.bukkit.command.CommandSender,org.bukkit.command.Command,java.lang.String,java.lang.String[]) in org.bukkit.command.CommandExecutor

#

method does not override or implement a method from a supertype

lost matrix
sterile sapphire
marsh hawk
#

Is there by any chance a known bug, which makes the player see through instead of invisible when applying invisibility?

chrome beacon
#

That can happen with teams

#

it's a setting

steel swan
#

hey, i have an error telling me my world doesnt exist, even if it does.
here is the proof :

#

any idea?

waxen plinth
#

is it loaded

#

the world folder existing doesn't mean it's loaded

steel swan
waxen plinth
#

that doesn't answer whether it's loaded

steel swan
sterile sapphire
#

I deleted the jar on my project, I go to the lifestyle folder and compile but the jar file won’t remake its self

#

Could anyone help me?

remote swallow
#

what are you using to compile

#

well

#

what task are you invoking

waxen plinth
sterile sapphire
#

I deleted the .jar file so I’m trying to re compile it

waxen plinth
#

like multiverse but I'm sure there is something better by now

remote swallow
#

what are you doing to recompile

sterile sapphire
#

I’m clicking compile

#

But it’s not working

remote swallow
#

run package

steel swan
sterile sapphire
steel swan
lost matrix
remote swallow
#

bukkit.yml might have a way to load it

steel swan
lost matrix
steel swan
#

idk how

lost matrix
#

Use a WorldCreator and apply the folder of your world as a name

steel swan
sterile sapphire
#

Ik I’m kinda in the middle on this convosation but I’m looking for a replacement of multiverse, what is a world creator?

steel swan
waxen plinth
#

Bukkit.createWorld

steel swan
waxen plinth
#

only if it doesn't exist already

#

if it does it'll load it

remote swallow
#

that is how you get a world creator iirc

#

ah that just takes the world creator

steel swan
#

ohhhh thx !

#

it worked really nicely

grim hound
#

I'm just wondering but

#

If I close the netty connection

#

It kicks the player out and only shows one kick out message

#

And if I do it on handshake it can't be spoofed with the disconnect packet

#

So is there no way to replace it?

modern basin
#

Hello. We are looking for a MySQL money bridge, to save the vault eco balance to a database, and to be able to load that in a different server. Does anyone know such thing, or is anyone able to help me create this? I already found this one https://www.spigotmc.org/resources/ecobridge.94730/ but whenever someone is offline and gets money added, it doesnt save it to their data, so when they log back in it resets them to the old data

sterile sapphire
#

ive got the .jar file but when i put it in a server and star the server it apears red (isnt working) but idk why

remote swallow
#

check console

#

?paste any errors

undone axleBOT
sterile sapphire
#

i checked it and it said the plugin disabled

#

its set to say that when its off

remote swallow
#

it should throw an error then

pseudo hazel
#

usually like a giant piece of red text

remote swallow
#

on paper, its all white on spigot iirc

pseudo hazel
#

oh my bad

sterile sapphire
#

its having a fit about the server being ran on paper but the plugin being spigot, i thought they were cros compatible

remote swallow
#

they should be

#

?paste the error

undone axleBOT
sterile sapphire
#

this is the error

remote swallow
#

you didnt add the command to plugin.yml

sterile sapphire
#

i have

remote swallow
#

whats test.java line 11 and send ur plugin.yml

sterile sapphire
#

it apears i have used diffrent names for the yml and the test.java line 11

#

silly me 😅

#

atleast i think its that

#

im gonna try it again

sterile sapphire
#

ill send that now

#

yml :

#

Land-Shop:
description: Opens The Land Shop Menu

#

test.java :

#

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

    this.getCommand("Land Shop").setExecutor(new MenuCommand());
#

@remote swallow

eternal oxide
#
  • dash and no dash
#

commands are ONE word

#

no spaces

median trench
#

Does anyone happen to know why Minecraft custom item names infer that the text will be bold from one text to another (in the json form) when the first one is set to true, but ItemStacks don't, so cloning an item will remove the bold from the text parts that haven't set bold to true

grim hound
#

If you mean custom names

#

Because I don't really get what you're saying

#

If one text is given an attribute, the others will also get it unless reset or set to another

median trench
# grim hound ItemStacks also do

Not at all, I have this command:
/give @p iron_helmet{display:{Name:'[{"text":"Ar","italic":false,"bold":true,"color":"#d16736"},{"text":"madura de Bron","color":"#f28e50"},{"text":"ce"}]',Lore:...
and it colours the name the first way.

But when I do e.getCursor().clone() (and put the ItemStack wherever) I get it coloured the second way.

Edit: ItemStack(e.getCursor()) does not fix this issue either

eternal oxide
#

Spigot or paper?

median trench
#

spigot api and paper server

eternal oxide
#

repeat it on a spigot server

median trench
#

give me a sec

median trench
eternal oxide
#

unexpected

kind hatch
#

/about output?

river oracle
#

how do you read JMH benchmarks?

Benchmark                           Mode      Cnt     Score   Error  Units
RipComputer.testGradient          sample  1068013     6.027 ± 0.038  us/op
RipComputer.testGradient:p0.00    sample              4.552          us/op
RipComputer.testGradient:p0.50    sample              5.472          us/op
RipComputer.testGradient:p0.90    sample              6.040          us/op
RipComputer.testGradient:p0.95    sample              7.896          us/op
RipComputer.testGradient:p0.99    sample             11.312          us/op
RipComputer.testGradient:p0.999   sample             74.240          us/op
RipComputer.testGradient:p0.9999  sample            723.351          us/op
RipComputer.testGradient:p1.00    sample           1460.224          us/op

e.g. what is Score mean, CNT etc

lost matrix
#

Depends on your benchmarking mode. Single shot? Average? Throughput?

river oracle
#

SampleTime

#
@Fork(value = 1, warmups = 1)
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
lost matrix
#

Then it is the time measured for a single call on average with a random sampling strategy.
So 6.027 microseconds ber call with an median error of +/- 0.037 microseconds
(us/op = micro seconds per operation)

river oracle
#

ahhh okay

lost matrix
#

Cnt is the Count. So how many samples there are.

river oracle
#

what about score

lost matrix
#

?

#

-> 6.027 micros +/- 0.038 micros

river oracle
#

mmk

lost matrix
#

p0.50 is the 50th percentile. So the worst 50%
p0.9999 is the 99.99th percentile. Showing the worst 0.001%
p1.00 is therefore the single worst measurement.

river oracle
#

ohhh okay

#

so the goal would be not to have a large spread or is that kind of just inevitable

lost matrix
#

It depends on what you want to measure. Usually everything beyond the 99th percentile is disregarded as
there will always be outliers like random bit flips, other processes or quantum effects like random tunneling,
making a perfect run impossible.

lost matrix
#

For a (perfect) hashmap contains it should be constant

n=1   ->  2ms
n=10  ->  2ms
n=100 ->  2ms
...

Meaning O(1) as O is disjunct from n

shadow night
#

what other kinds of time complexety are there

#

besides O (1) and O (n)

quaint mantle
#

log

#

nlogn

kind hatch
quaint mantle
#

lmao n!

river oracle
#

technically an infinte amount

#

as you can modify N in a ton of ways

lost matrix
# shadow night besides O (1) and O (n)

The most common ones are [In decreasing performance]
O(1) constant time
O(log(n)) logarithmic time
O(n) linear time
O(n^2) quadratic time
O(e^n) exponential time
O(n!) factorial time

But there is actually an infinite combination of time complexities because algorithms can be chained.

quaint mantle
#

O(n^n)

shadow night
quaint mantle
#

any algorithm that works like that?

kind hatch
#

Probably

shadow night
quaint mantle
#

Every python algo: n^infinity

river oracle
#

honestly anything e^n and above probably shouldn't be used unless their is no alternatives

lost matrix
#

Recursion usually results in e^n pretty quickly. Combine it with O(n) as a base like a simple iteration and you got n^n

#

Cant think of anything concrete rn. Probably because its so bad.

ivory sleet
#

Yeah big O notation disregards smaller details, but just denotes the general behavior of a function, like n^2 + 10 is still just n^2

#

Which is why also time complexity is just a good way of telling how an algorithm scales, if each operation takes 1 minute in an algorithm its gonna be slow even when n= 10 and O(n) for instance

quaint mantle
#

Thinking Big O of bogo sort

proud badge
quaint mantle
#

Like
list.forEach((a) -> list.remove(a))

shadow night
#
List list = new ArrayList();
for element in list:
 list.remove(element)
``` some pseudocode
proud badge
#

something like this you think could be causing the problem?

quaint mantle
#

No in for scope

proud badge
#

This code is mostly ran async

quaint mantle
#

Do queue for modifing the list

#

Sync stuff

proud badge
proud badge
lost matrix
#

You cant randomly access other peoples api async and pray its thread safe...

shadow night
#

Yep

#

Why do everything async, it's such a pain in the ass

proud badge
lost matrix
#

Nothing in spigot is thread safe unless specifically stated

shadow night
#

Spigot is spogit

proud badge
#

so by how I understand ConcurrentModificationException happens when you try to delete a list element whilst looping through it?

shadow night
#

Yes

proud badge
#

Ok hmm I'll try to think of something to fix that

lost matrix
# proud badge Database lookup

You should def refactor your code. Im seeing a metric ton of repeated code.
It will make it much easier to separate what can be done async and what can be done sync.
And helping is much more efficient.

shadow night
#

I usually just have a second list, after looping I just do firstList.removeAll(listToRemove)

lost matrix
proud badge
#

for those of yall who dont understand what the code is for: I need to check if a block is natural with coreprotect onBlockBreak, instead of opening a new thread for every block I queue them up and async loop through the queue every second

ivory sleet
#

Isn’t there like some sort of callback or anything more reasonable you can do rather than polling it manually?