#help-development

1 messages · Page 2288 of 1

shadow zinc
#

it is

ashen quest
#

This is yours?

shadow zinc
#

yep

noble lantern
#

you cant fake linked spigot names

shadow zinc
#

me?

noble lantern
#

You sure?

noble lantern
shadow zinc
#

I'll send pics

onyx shale
#

was odd the naming convention but other than that gud

noble lantern
shadow zinc
#

9 bucks

#

what a deal

noble lantern
#

?yamlparser

#

fuck u cafebabe

shadow zinc
#

lol

#

@undone axle get good

noble lantern
#

yeah imma be deadass with u

#

idk why its saying invalid plugin.yml

#

oh

#

api-version

#

set that field

#

thats only difference i see rly is ur missing that field

shadow zinc
#

set it to 1.18?

noble lantern
#

wait no im sorry

#

its at the bottom

shadow zinc
#

yeah, minecrell again

noble lantern
#

whats this

shadow zinc
#

minecrell

noble lantern
#

that could possible cause it

#

im not sure cause thats a valid plugin.yml

shadow zinc
#

I'll delete it and try

noble lantern
#

has the main name and api-version

buoyant viper
shadow zinc
#

yep

#

I got a dual boot

buoyant viper
#

gnome de?

shadow zinc
#

gnome op tbh

noble lantern
sharp flare
#

Dual boot is great but sometimes its fucked up with raid setups

buoyant viper
shadow zinc
#

can you spot the mistake?

noble lantern
#

had to go with the most sparatic one

shadow zinc
#

lol

#

im booting up my test server give me a bit

noble lantern
sharp flare
#

Been using arch linux specifically manjaro, i get the freedom windows doesn't allow

shadow zinc
noble lantern
#

she uses linux

shadow zinc
#

linux is 90% commands, 10% point and click

#

thats my experience so far

buoyant viper
#

for now im still on windows

shadow zinc
#

same error

#

its just not having it today

buoyant viper
sharp flare
shadow zinc
#

invalid yml

sharp flare
#

I cant keep up above

#

Can u provide a paste

shadow zinc
#

wait

#

new error

#

org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: your/package/charts/CustomChart

#

bstats

#

seriously

sharp flare
#

Did u relocated it properly

noble lantern
shadow zinc
#

can I dump my pom?

noble lantern
#

?paste

undone axleBOT
shadow zinc
#

yep obv

noble lantern
#

interesting

sharp flare
#

The scope is redundant as long as it is relocated properly

noble lantern
#

Shouldnt need relocation

sharp flare
#

It will be compile by default

noble lantern
#

just shade in

#

default scope is provided

shadow zinc
#

am I shading?

#

I thought I was

sharp flare
#

Yeah shade it

#

Im on my phone i have shit viewport

noble lantern
#

when no scopes set maven will default on provided iirc but he has a scope set

Maven shade plugin auto shades all compile scopes

But for 1

shadow zinc
#

thats fine scope is compile anyways

noble lantern
#

your/package/charts/CustomChart

your/package/charts?

shadow zinc
#

my charts?

noble lantern
#

never used bstats so maybe i just dont know how it works

#

but i would assume a class called CustomChart is trying to get used and isnt there

shadow zinc
#

OHHHH

#

im so dumb

#

your.package is my package

#

but your package

#

smh

noble lantern
#

oh does bstats ask for a package path to register a chart?

#

tf

shadow zinc
#

it wants my package dir

#

i forgot to change it

noble lantern
#

weird idk why bstats wouldnt just take the Class directly

#

like registerChart(ThatChart.class)

shadow zinc
#

idk

#

gradle figured it out fine

sharp flare
#

Eventually my bstats is shaded in and i dont have any scope set in the dependency

#

Works fine for me

noble lantern
#

oh my bad

#

default scopes actually compile

#

idk why i thought it was provided

sharp flare
#

Yeah i thought i was wrong about it but hope that clarifies it

noble lantern
#

i tend to always set scope with maven whenever i use it

Plus i havent used maven in soooo long

#

been using gradle for like 4 months now

sharp flare
#

I'd try gradle soon with my new projects if time permits

noble lantern
#

gradles honestly sooo easy

#

especially for shading

#

?paste

undone axleBOT
noble lantern
sharp flare
#

Yeah i saw the structure once, its too clean

noble lantern
#

and not to mention import jars is suuuper easy

#

in maven u gotta install-file which is annoying asf

#

thats all u do to import jars in gradle

#

ofc considering you want the entire dir shaded which i do

buoyant viper
#

gradle local include be like

sharp flare
#

Yeah maven sucks on that

noble lantern
sharp flare
#

But i tend to avoid local imports if possible

noble lantern
#

Yeah i only use local imports for testing

#

once my libs stable ill slap it on jitpack

sharp flare
#

Fair

noble lantern
#

i honestly need to learn how to setup a repo on my vps

#

i wonder if jfrog has docker images with jfrog on it already

shadow zinc
#
[18:58:47 ERROR]: Could not load 'plugins/NeoPerformance-1.9.9.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/neomechanical/charts/CustomChart```
noble lantern
#

show screenshot of the files if you can

shadow zinc
noble lantern
#

yeah package path is wrong that you specified for bstats

shadow zinc
#

do I need src.main.cdsfsdf

sharp flare
#

Lol bad import

noble lantern
#

that class should actually exist on your package path of com.neomechanical.neoperformance

#

and then inside of another package called chart

#

where there is a class called CustomChart

#

or

#

just disable bstats for now if you dont have a chart made

shadow zinc
#

im following the guide tho

#

it doesnt say that

noble lantern
#

cause you likely know where the chart is if you made one

#

hmm

#

whats your bstats code?

#

thats throwing that

#

code on theyre website doesnt say anything about sharing a package name or stuff

sharp flare
#

You get the idea

#

Then u can use their methods

shadow zinc
#

do you need anything at ./bstats?

noble lantern
#

wait is bstats in default spigot now?

#

theyre example project doesnt even import bstats

shadow zinc
#

its probably this java metrics = new Metrics(this, pluginId); metrics.addCustomChart(new SimplePie("Language", () -> NeoPerformance.getInstance().getLanguageManager().getLanguage())); metrics.addCustomChart(new SimplePie("halt_at_tps", () -> String.valueOf(getDataManager().getTweakData().getTpsHaltAt())));

shadow zinc
sharp flare
#

If it would then the docs for bstats should have stated it for a specific api version, etc

noble lantern
#

oh you build it locally

#

interesting

#

idk why theres no jitpack hm

sharp flare
#

It does have a jitpack iirc, its in their docs

noble lantern
#

ah maybe im just searching around too fast

#

gtg for now bbl

shadow zinc
#

cya

quaint mantle
#

hi i want to start learning Spigot Plugins does anyone here know where to start and what i should try making first??

worldly star
#

Sorry if too noob, but I need help with updating my intellij buildTools. I have managed to update the BuildTools.jar but I don't know how to bring it into intellij as I'm trying to update my spigot dependency to 1.19. I keep getting the error that dependency not found. Please can someone help me?

quaint mantle
#

._. i don't have coding experince besides basic Python Scripting

shadow zinc
#

YouTube

#

And Google

#

ik ik, Im a genius

shadow skiff
#

used it so much xD

radiant aspen
# quaint mantle hi i want to start learning Spigot Plugins does anyone here know where to start ...

Just follow some tutorial series on youtube: https://www.youtube.com/watch?v=tnJZMaoMPhE&list=PLfu_Bpi_zcDNEKmR82hnbv9UxQ16nUBF7

Then find some plugin idea that interestes you and try code that, then get stuck and ask stupid questions on spigot and keep doing that until you have a really buggy plugin held together by bits of string. Then come back to it a few years later and be like wtf is this shit, and recode it it.

In this episode, I give you a brief overview of what you can expect in this MC Plugin coding series. #Spigot #MCPlugins #PluginTutorial

Java Tutorial: https://www.youtube.com/playlist?list=PLfu_Bpi_zcDPNy6qznvbkGZi7eP_0EL77
How to Setup a Test Server: https://www.youtube.com/watch?v=58MZ4THF73g&ab_channel=KodySimpson

Discord: https://rebrand.l...

▶ Play video
rotund pond
#

Hello everyone !
Do you know how I could create an huge explosion?
CraftWorld#createExplosion() is capped to 10, I need something like 25

radiant aspen
rotund pond
radiant aspen
#

well, try it yourself

#

doesnt mention being capped in the docs

rotund pond
#

Already found it

#

I was thinking about recreating the method by myself

radiant aspen
#

not a great idea

rotund pond
#

Why ?

iron glade
#

Is there an integrated method to get the time a player is on the server?
in the current session

radiant aspen
#

cuz then u dont get the random explosion, the sounds or the particle effects or the damage or the fire

rotund pond
radiant aspen
#

plus calling the createExplosion method calls events meaning it will hook into worldguard and other land protection plugins

rotund pond
#

Mh

radiant aspen
#

recreating the method yourself means not using a spigot implementation?

rotund pond
#

Yeah, but I can base my method on spigot implementation

#

To handle a huge explosion

radiant aspen
#

Anyway, I havent heard anything about it being capped at 10

#

try World#createExplosion(x,y,z,100,true)

rotund pond
#

Here is an example:
player.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 100F, false, true)

radiant aspen
#

yep

#

thats quite a big explosion?

rotund pond
#

Is that 100 blocks ? :x

radiant aspen
#

100 doesnt equal 100 blocks

rotund pond
#

Ah

radiant aspen
#

its power

noble lantern
#

^^

radiant aspen
#

in the docs it says 4F = TNT

#

and tnt is like a 3x3 I think?

noble lantern
#

mans is doing over 20x normal tnt

shadow skiff
#

xD

noble lantern
#

honestly tho

rotund pond
#

Oh, I see so this explosion will just do as much as 25 TNT, but all TNTs are on the same block

noble lantern
#

it may have a limit just not publicly documented

rotund pond
#

Ah f....

radiant aspen
#

I mean try set it to like 500 or smthn, see if its a bigger hole

noble lantern
#

one block will have power os 25 tnt as one single block

#

^

radiant aspen
rotund pond
#

Yeah okay, but that's not what I'm looking for so :/

#

Thank you guys

radiant aspen
#

what are you looking for?

rotund pond
#

I would like to create a huge explosion, not an explosion with huge damages on a single block xD
Something like a 20 blocks explosion

radiant aspen
#

well

noble lantern
#

create a grid of tnt blocks

radiant aspen
#

u could do smthn like

for(int x = 0; x < 100; x+=4){
  for(int y = 0; y < 100; y+=4){
    for(int z = 0; z < 100; z+=4){
      world.createExplosion(x,y,z,4);
    }
  }
}

which will create tnt sized explosions in a 100x100x100 grid, spaced out 4 blocks each tho

#

lag warning tho 👀

#

@rotund pond

rotund pond
#

Well, this should be a bit huge but thank you xD

smoky oak
#

is this the fastest way to iterate a double nested array?

for(Object[] o1 : o0){
  for(Object o2 : o1){
    //do something
  }
}
rotund pond
#

We're going to try somethings

noble lantern
#

well

#

actually

#

im not sure if using index access is faster

#

eg for (int x = 0; x <= (o0.length - 1); x++)

smoky oak
#

might be actually. I do have the sizes of the array, and it shouldnt contain null entries

radiant aspen
noble lantern
#

^

smoky oak
#

eh fair point

noble lantern
#

i would just do my loops like they are in that code

#

cause its simple

smoky oak
#

im just curious

radiant aspen
#

always a tradeoff between optimisation and readability

noble lantern
#

eg lambdas are slightly slower iirc

#

by just a few ms

radiant aspen
noble lantern
#

or slightly faster

#

one of the two

radiant aspen
noble lantern
#

its either faster or slow but its so small a user wont notice it or dev

#

lemme find the article

maiden briar
#

TreeMap<Double, UUID>. If 2 players have the exact same Double as key, what will the TreeMap do?

radiant aspen
#

are you sure you dont have this the wrong way around?

#

shouldnt UUID be the key and Double the value?

maiden briar
#

I want to make a top

maiden briar
chrome beacon
#

Sort things yourself

smoky oak
#

it returns the uuid registered last iirc

radiant aspen
#

What are you trying todo?

#

cuz you can only have 1 key

noble lantern
radiant aspen
#

if you want to sort by value, you could turn into an array and sort the array

maiden briar
#

I have an uuid associated with a score

radiant aspen
#

yeah

#

so you have it the wrong way around

maiden briar
#

And I want to get the UUID's with the 5 highest score

radiant aspen
#

cool

#

so you need a Map<UUID, Double>

noble lantern
radiant aspen
#

and then u can do smthn like Map.values().sort()

maiden briar
#

Because you cannot get by value in Map

noble lantern
#

you can

#

map.values()

#

i beileve

#

might be called something else

worldly star
#

Could someone please help me with updating my dependency to 1.19... I'm not that well versed and I really need some help

radiant aspen
maiden briar
#

Thanks

noble lantern
#

thanks

#

shit*

radiant aspen
#

basically your getting the entrySet of the map, and then sorting by the value

noble lantern
#

didnt know sort was a thing

#

i was gonna loop through that values orgnizing myself once i made my own leaderboards 💀

brave sparrow
#

It’s important to note that in those cases you aren’t sorting the map, you’re copying the data to a new structure and sorting the copied data

radiant aspen
#
List<Map.Entry<UUID, Double>> sorted = map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toList());
#

probabbly the cleanest way

brave sparrow
#

Depends on the map implementation

radiant aspen
brave sparrow
#

LinkedHashMap can be sorted

radiant aspen
ivory sleet
#

^ as well as tree map

timid parrot
#

Is there a way to control player like you are the player

brave sparrow
radiant aspen
brave sparrow
#

As well as make the controller invisible

#

But it will look awful to the player being controlled

#

Actually

#

You know what

#

Here’s how you do it:

#

Disguise the controller as the controlled to every other player

noble lantern
brave sparrow
#

Send the spectate packet to the controlled player to make them spectate the controller

#

Boom

#

For bonus points you can send the controlled player a disguise changing the controller’s skin to theirs in case they F5

radiant aspen
#

Or, just give up and download a plugin that already does that 👀

timid parrot
timid parrot
radiant aspen
#

plus it even has an api

#

Oh, hell naw

#

this some messy code

ivory sleet
#

Holy

brave sparrow
#

Yeah the way they did it just doesn’t seem as nice as my elegant solution lol

radiant aspen
#

Mr AlexTheCoder, are you still working at mineplex?

#

is mineplex even a thing anymore?

brave sparrow
#

Yes and yes

radiant aspen
#

127 java players 💀

#

seems to be a thing on bedrock tho

noble lantern
#

ohp sorry for ping

#

thought i was holding shift

crystal palm
#

just a quick question. probably stupid but oh well
should i use PostLoginEvent or ServerConnectEvent? I want to kick the player if specific conditions are met/not met

ivory sleet
#

What type of conditions?

crystal palm
#

if username starts with something

ivory sleet
#

PostLoginEvent might suffice

crystal palm
#

alright thanks :^)

ivory sleet
#

Wait let me double check lol

#

?jd-bc

ivory sleet
#

You can use PreLoginEvent

#

the username supposedly is disclosed already by the time that event invokes

crystal palm
#

o ok

#

i cant use preloginevent to get the player name/uuid

ivory sleet
#

Yes

#

getPendingConnection#getName

#

or sth

crystal palm
#

buuutt postloginevent should be fine too, right? or does it send the player to the backend before too? :P

ivory sleet
#

Im not sure

crystal palm
#

ill test it rq

ivory sleet
#

But I think backend’s AsyncPlayerPreLoginEvent will fire before

noble lantern
#

why not just use that event ^

brave sparrow
#

They’re on bungee

noble lantern
#

oh

#

oops

#

mb

fallow valley
#
public class VillagerCured implements Listener {
    private final Main main;
    public VillagerCured(Main main) {
        this.main = main;
    }
    public int potionDuration = main.getConfig().getInt("discountDuration");
...

gives me "variable main might not have been initialized" regarding the "main.getConfig" portion?

#

any ideas

ivory sleet
#

Yes

#

the code public VillagerCured(Main main){…} will run after potionDuration = …;

#

so at the time when the variable potionDuration gets initialized the value will of the variable main remains null

quiet ice
ivory sleet
#

Move the initialization part of the variable potionDuration to inside and after the this.main = main part

noble lantern
noble lantern
#

whats JIT

quiet ice
#

for (var x : array)
produces
for (int z = ; z < array.length; z++) { var x = array[z];
so - pretty much the same otherwise

fallow valley
ivory sleet
#

Just in time burchard

quiet ice
noble lantern
#

ahh

quiet ice
#

The actual compiler in the java ecosystem

earnest forum
#

jit trippin

ivory sleet
#

Java is both interpreted and compiled interestingly enough

noble lantern
#

i normally dont tend to stress over small things like that because you just barely notice the difference

#

unless you forget to call .join on a CompletableFuture

ivory sleet
#

Yeah lol

brave sparrow
#

The JIT is incredible these days

fallow valley
ivory sleet
#

Not really

#

Close

eternal oxide
#
int potionDuration;
public VillagerCured(Main main) {
        this.main = main;
        potionDuration = main.getConfig().getInt("discountDuration");
    }```
ivory sleet
#

You made potionDuration to whats called a locally scoped variable

fallow valley
#

sorry lol

eternal oxide
#

Teacher Conclure today 🙂

ivory sleet
fallow valley
eternal oxide
#

now @fallow valley, write 100 lines of I will not use uninitialized variables.

ivory sleet
#

Yeah

fallow valley
eternal oxide
#

Nice, you go out and play now

fallow valley
#

Thank you sir.

fallow valley
#

I promise not to do it again!

ornate mantle
#
deaths:
  1:
    - ["speed", 12]
    - ["haste", 10]

this is in my configuration

#

right now it only has 2 effects

#

the number of effects can be modified

#

how do i get each effect

#
    public Map<PotionEffectType, Integer> getEffectsFor(int deathNumero){
        potionEffectMap = new HashMap<>();
        this.config.getList("deaths." + deathNumero).forEach(effectList -> {
            potionEffectMap.put(
                    PotionEffectType.getByName(
                            String.valueOf(
                                    ((List<Object>) effectList).get(0)
                            )
                    ),
                    (Integer) ((List<Object>) effectList).get(1)
            );
        });

        return potionEffectMap;
    }```
#

this is my current method

ivory sleet
#
class Example{
  static final int C = 19283; //global constant

  // static variable
  // global variable 
  // global field
  // static field
  // mono state
  static Object o = new Object();

  //instance variable
  //field
  //instance field
  //prototype variable
  //prototype field
  Object h2o = new Object();

  void epic(
    //parameter
    //parameter variable
    double o
  ){
    //local variable
    int epic = 459;
  }
}```
@fallow valley
ornate mantle
#

as you can see it doesnt work 💀

ivory sleet
#

For any future references

lost matrix
ornate mantle
#

lemme get the error once more

ivory sleet
#

It is global tho

#

Only one of it

lost matrix
ivory sleet
#

And can be accessed without having to pass an instance

ornate mantle
#

it only confused me more

ivory sleet
#

But with restricted access and visbility Ig

pliant plover
#

Is it possible to make a queue for Bedwars with a Hashmap?

frosty tinsel
#

More likely not

ivory sleet
#

Myes but there are more relevant data structures you could opt in for

lost matrix
#

Whatever that means. You can surely hack it.

tardy delta
#

hashmap not sorted

ivory sleet
#

It is sorted

frosty tinsel
lost matrix
#

LinkedHashMap

ivory sleet
#

Just not by any significant means

tardy delta
#

uh uh

frosty tinsel
#

Just use Queue

lost matrix
#

^

tardy delta
#

forgot about linkedhashmap one

pliant plover
#

I want it just to pick a random PLayer, teleport it to the teambase it belongs, and then remove this Player

ivory sleet
#

The order of a hashmap is conceptually useless 99% of the times

frosty tinsel
pliant plover
frosty tinsel
ivory sleet
#

Wym get order?

tardy delta
#

iterator::next

lost matrix
pliant plover
#

how do I use queue?

ivory sleet
#

^

#

ArrayDeque or LinkedList probably

pliant plover
#

I've never heard of it xD

lost matrix
#

LinkedList is poop.

quiet ice
frosty tinsel
quiet ice
ivory sleet
lost matrix
tardy delta
lost matrix
ivory sleet
#

Indeed

tardy delta
#

arraydeque backed by an array? 🙂

ivory sleet
#

since it provides an Iterator with some notion of order

lost matrix
frosty tinsel
ivory sleet
#

Then whether that order is useful is another debate but ye

frosty tinsel
ivory sleet
#

Yup

frosty tinsel
#

Whether you mean a meaningful order

ivory sleet
#

Precisely

pliant plover
ivory sleet
#

I mean impertinently HashMap has a pretty useless order

lost matrix
quaint mantle
#

@EventHandler
public ShapedRecipe PotionRrr() {
ItemStack Potion = new ItemStack(Material.DIAMOND_BOOTS);
PotionMeta meta = Potion.getItemMeta();
ItemMeta meta1 = Potion.getItemMeta();

    meta1.setDisplayName(ChatColor.GREEN + "Froggy Boots");

    meta.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1200, 20, true, true, true), true);

    Potion.setItemMeta(meta1);
    Potion.setItemMeta(meta);

    ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "FROGGY_BOOTS"), Potion);
    recipe.shape("NNN","N N","NNN");

    recipe.setIngredient('N', Material.NETHERITE_INGOT);

    return recipe;

I'm trying to Make PotionMeta but the PotionMeta meta = Potion.getItemMeta(); Showing red line how can i fix ?

lost matrix
#

You need exactly one argument of type Event

frosty tinsel
tardy delta
#

uhh method naming conventions are gone now?

quaint mantle
ivory sleet
#

FIFO vs LIFO :0

quaint mantle
#

how can i add the PotionMeta

frosty tinsel
#

Stack has different behaviour

lost matrix
frosty tinsel
#

Stack is FILO and Queue is FIFO

ivory sleet
#

LinkedListruns

pliant plover
lost matrix
#

He wants random elements. So if he scrambles a list and puts it in a stack or queue then there is no difference between lifo and fifo

frosty tinsel
#

Ah

lost matrix
timid parrot
quaint mantle
#

I'm trying to Make PotionMeta but the PotionMeta meta = Potion.getItemMeta(); Showing red line how can i fix ? uhm how can i fix

lost matrix
tardy delta
#

variable name start with a lowercase character smh

quaint mantle
tardy delta
#

and method names too 😢

lost matrix
pliant plover
lost matrix
pliant plover
#

ok, thanks

lost matrix
#

UUID is preferred but lets keep it simple

quaint mantle
#

Now my prob is the PotionMeta meta = Potion.getItemMeta(); showing red line how can i fix

ivory sleet
#

<ThingsInsideTheseDiamondBracketsAreTypeArguments> and they are usually as in always the names of classes

quaint mantle
#

i removed the meta1

lost matrix
ivory sleet
#

?learnjava :3

undone axleBOT
quaint mantle
#

ok

#

okok

noble lantern
#

sorry

pliant plover
frosty tinsel
noble lantern
#

i just didnt get to use that

ivory sleet
noble lantern
#

i made that meme today i had to use it, but defo look at links conclure sent

frosty tinsel
#

Where can I find all these commands?

lost matrix
ornate mantle
#
- effect: speed
  multiplier: 12
``` this is a LinkedHashMap right
noble lantern
#

uhm

eternal oxide
#

No

noble lantern
#

idk what that is

timid parrot
noble lantern
#

a yaml exception

lost matrix
ivory sleet
ornate mantle
#

its a linkedhashmap as far as my java errors are concerned

lost matrix
#
- 
  effect: speed
  multiplier: 12
ornate mantle
#

doesnt that do the same thing

tardy delta
#

looks cursed no

ornate mantle
#

really does

eternal oxide
#

Thats just backend. Thats not what it is

#

its stored in a MemorySection

pliant plover
eternal oxide
#

Which I believe is backed by a LinkedHashMap

ornate mantle
#

therefore its a linkedhashmap?

lost matrix
eternal oxide
#

no

pliant plover
#

ok

noble lantern
ornate mantle
#

but its stored as it

tardy delta
#

Stack has a get method

eternal oxide
#

The Config is a LinkedHashMap

#

your Objects are stored IN teh configs backing LinkedHashMap

noble lantern
pliant plover
#

this is how I did it before

noble lantern
#

youd do - 1 on that length iirc

#

or else you get index out of bounds

tardy delta
#

huh i believed not

noble lantern
#

it will go from 0 - length

tardy delta
#

cuz random.nextInt(0, 5) goes from 0 to 4 right?

noble lantern
#

length count starts at 1

#

uhmm

ivory sleet
#

Yeah

noble lantern
#

oh

#

neat

tardy delta
#

noob

ivory sleet
#

By convention most stuff is inclusive exclusive

tardy delta
#

you confused me

noble lantern
ivory sleet
#

Lol

noble lantern
#

imagine being able to write a async websocket

tardy delta
#

ah :'(

noble lantern
#

but cant access array index properly

#

couldnt be me

eternal oxide
#

lol

pliant plover
noble lantern
#

carrotus bro ignore what i said and what fourteen said instead

#

my brain cell count is low today its 3am

tardy delta
#

1 pm here and my brain aint working properly tho

lost matrix
# pliant plover thanks
  public Deque<Player> createRandomOnlinePlayerQueue() {
    List<Player> list = new ArrayList<>(Bukkit.getOnlinePlayers());
    Collections.shuffle(list);
    return new ArrayDeque<>(list);
  }

Something like this

#

bit expensive but you wont call it often

pliant plover
#

Ok, Thanks

noble lantern
#

interesting

crystal palm
# ivory sleet Im not sure

i didnt realize i had to cancel the event and not just disconnect the player lol. had me bashing my head on the table for a while. thnx bud

noble lantern
#

Collections.shuffle

pliant plover
#

does this already remove the People from the queue?

timid parrot
#

how can i do crafting recipes with custom items

noble lantern
#

How resource intensive is that method smile?

#

say for like a list of 200 strings at 16 bytes each

ivory sleet
#

Its like O(2^(-1)n) iirc

tardy delta
#

im wondering if iterator::next on an arraylist is going to give a random element or not

lost matrix
noble lantern
ivory sleet
#

n/2

ivory sleet
#

Sorry my math head is a bit dodo

tardy delta
#

maths lmao

noble lantern
#

all ik is i aint solving that first equation

#

way out of my league

ivory sleet
#

🥲

tardy delta
#

i still remember that from school

#

atleast i remmeber smth

next fossil
#

How will I be able to reset a world with different seeds everytime I restart the server?

lost matrix
tardy delta
#

2 ^ -1 -> 1/2^1 smh

noble lantern
#

wtf is this equation for

tardy delta
#

google big o notation

next fossil
#

There's only a world.getWorldInfo().getSeed() but how would I set it for the server.properties to reset the world with a new seed?

ivory sleet
eternal oxide
lost matrix
next fossil
#

It can't unload the main world

noble lantern
#

oh so its like a calculation oh how large input size can be before it starts slowing down

#

ie its a input/slowdown graph in a sense

eternal oxide
#

You delete it as teh server is starting as you can;t unload it

noble lantern
lost matrix
next fossil
#

Even so, the seed will still be the same

noble lantern
#

tfff

eternal oxide
#

Not if there is no seed set

tardy delta
#

omg how much ive seen that

noble lantern
#

you doing that at 10 months??

eternal oxide
#

it picks a random seed

noble lantern
#

im convinced smile isnt human

#

i think hes some machine learning ai that learns java off spigot code

#

mans is cracked at programming

ashen quest
#

How do I give an Entity a potion effect, i checked for potion methods but didnt find any

lost matrix
#

I would not create one task per arrow.
Create one runnable that maintains a collection of arrows and spawns particles for them.
On shoot -> add to collection
On hit -> remove from collection

ashen quest
noble lantern
#

no the UUID

#

you would make that UUID a local variable

#

so your not constantly calling getUniqueId

frosty tinsel
noble lantern
#

however for that specific method speed wise it doesnt matter, since that is cached already i beileve

#

but design wise it makes a big difference

#

and sometimes some gets do process more heavy code

ashen quest
ivory sleet
#

Yeah explanatory variables superior

noble lantern
#

like getOfflinePlayer

noble lantern
#

100% wanna cache that bullcrap class

tardy delta
noble lantern
ivory sleet
#

I mean the cons of using many local variables is that they do take some space

noble lantern
#

UserRepo repo = plugin.getUserRepository();

ivory sleet
#

Like you push the variable onto the thread stack

ivory sleet
#

But who cares

ashen quest
#

not Entity

noble lantern
#

yeah but once the calling method is over its gone or cleared by GC

ivory sleet
#

Readability >>>

ashen quest
lost matrix
frosty tinsel
#

Or can it?

ashen quest
#

I dont think

#

ill just check if its a living entity and cast

frosty tinsel
#

Why you want to add a potion effect to an Entity

ivory sleet
noble lantern
#

Only LivingEntity can have potion effects

#

unless

#

you use nms

frosty tinsel
#

I don't really know the context

#

I thought you meant Entity

noble lantern
#

Entity can be a ItemFrame, which cant have potion effects

#

hence why it isnt a thing

frosty tinsel
#

Spigot should add the same reactions that or on the forums to the discord (eg. agree, like, winner)

ashen quest
#

everyone, tanks youz

frosty tinsel
noble lantern
#

i need to make more memes for this channel

pliant plover
tardy delta
#

whaat

#

not implementing CommandExecutor?

pliant plover
#

I have

ivory sleet
tardy delta
#

that last one wtf

noble lantern
#

i cant stop laughing at this

pliant plover
#

I think Imma create a thread to send My code, because its hard to explain

ivory sleet
#

Yeah

#

Good choice

noble lantern
#

i thought he was gona say new thread in his code

#

and i was thinking how is that gonna help

frosty tinsel
tardy delta
#

and use code blocks lol

yoro code
noble lantern
#

"Waah i got ratiod"

ivory sleet
noble lantern
#

"remove dislike"

frosty tinsel
#

Ugh

noble lantern
#

my server handles so many requests

ivory sleet
noble lantern
pliant plover
#

Is there any rule for sending .txt files? because I cant really send My code because its too long

noble lantern
#

however idk why it keeps saying they execute on thread 15

tardy delta
#

?paste

undone axleBOT
ivory sleet
#

Are use using the worker pool to accept sockets?

ashen quest
noble lantern
ivory sleet
#

Ah then thats why

#

Hmm

noble lantern
#

i assume because the requests execute so fast that the thread is available immediantly?

#

and it just reuses it?

ivory sleet
#

You might wanna use another thread pool if your socket connections are alive for a longer period of time

#

Yes

#

That partly

noble lantern
#

cause thoe requests do execute in about .001, but theres other factors so the delay is longer

pliant plover
#

Idk

noble lantern
#

but actual code fires isntantly almost

ivory sleet
#

But anyway java sucks when it comes to the socket part

pliant plover
#

?paste

undone axleBOT
ivory sleet
#

Cause usually

noble lantern
ivory sleet
#

We want a thread per socket

noble lantern
#

here let me send my code

ivory sleet
#

Or sth

noble lantern
#

?paste

undone axleBOT
ivory sleet
#

But Java only provides expensive threads

#

Which is why many often use netty

noble lantern
#

ignore my hashmap of conenctedClients

frosty tinsel
noble lantern
#

it was before you taught me atomic stuff

ivory sleet
#

Ah

ivory sleet
#

But likely

frosty tinsel
#

Interesting

noble lantern
#

oh my package name is still org.example

#

i wonder when ill change it

ivory sleet
#

Btw

#

Burchard

#

Netty might be what you wanna use

#

Since it can handle like millions of requests

ashen quest
#

so i want to get the name of a block on BlockPlaceEvent

basically getting the itemstack of that block

#

how do I exactly do that?

noble lantern
ashen quest
noble lantern
#

plus would i need to rewrite my entire socket logic?

ivory sleet
#

Oof true

#

Hmm

noble lantern
#

Cause what i have rn is so nice with json pojo schema parsing

ivory sleet
#

Fair

noble lantern
#

ignore the code, but i made a Bukkit style action handler where the code inside here will be ran async

#

and the second argument is any pojo class you want to accept

#

Itll turn the class into a json schema, validate it and then initialize it to pass to that, its pretty cool i love it xD

#

my old server code was horrendous

ivory sleet
#

Nice (:

ashen quest
#

how do I make a tnt not break stuff and not damage a player?

#

PrimedTNT

noble lantern
#

?paste

undone axleBOT
noble lantern
ashen quest
#

ooh

noble lantern
#

💀

ivory sleet
#

Oh god

ashen quest
#

btw there isnt a method for that i think

noble lantern
#

BlockExplodeEvent?

#

can the jd-s command get a subargument

ivory sleet
#

Nope sadly

noble lantern
#

so we can ?jd-s BlockExplodeEvent

#

aww

ivory sleet
#

I wish

noble lantern
#

google it is

#

dang BlockExplodeEvent wont tell you if it was tnt

#

unless

#

blockList contained the primed tnt that was exploded maybe

#

and you can check the location against that, then cancel event

eternal oxide
#

TnT when it explodes is an Entity

noble lantern
#

ohh

#

So it would fire EntityDeathEvent on explosion?

eternal oxide
#

Blocks exploding are things like Beds in teh nether

dire marsh
#

entityexplodevent exists no?

noble lantern
dire marsh
noble lantern
#

that might work

#

but

#

actually nvm

#

wait if you cancelled that

#

wouldnt the tnt get locked at primed state

#

🤔

dire marsh
#

pretty sure it just disappears

#

but you can clear the block list if you still want it to explode

ashen quest
#

now how do I detect from BlockExplodeEvent if that block is a primed tnt i spawned from my code

noble lantern
#

just would have to handle entity damage then

#

use EntityExplodeEvent

#

PrimedTnt is an entity

ashen quest
#

so how do i detect if thats the PrimedTNT i spawned

rare flicker
#

I'm having an issue with some custom crafting with some custom items :

The custom items are implemented by adding a CustomModelData to them, and are recognized the same way
but that means they are still recognized as normal items for the server

eg : a new ingot that uses the iron ingot as a base will be usable in crafting involving iron, and we don't want that for custom items

My solution was to put every custom recipe in a list, and upon crafting, checking if the recipes in the event matches one of the custom recipes, if not, that means the recipe is vanilla and thus, should not contain any custom item
I then cycle through the items in the crafting matrix and if one of them is a custom item, I cancel the event

But the problem is that the recipe fired in the event seems to not match any of the stored custom recipes.

TL;DR Cannot get #recipe.equals(Recipe other) to work

✅ Solved : Cast recipe to ShapelessRecipe or ShapedRecipe and check if the NameSpacedKey matches

dire marsh
ashen quest
#

Oh so now this is where i store all of em ids in an array

vapid valley
#

Hi I'm tryna hide nametags in my spigot server cz im tryna do a pvp thing with my friends but i can't do anythin. I've tried the team method and don't wanna use the scoreboard methods it seems complicated

rare flicker
#

without any plugins even

vapid valley
#

both don't work

rare flicker
#

lemme test a few things brb

vapid valley
#

sn

vapid valley
#

btw im runnin 1.19

rare flicker
#

i'm gonna test with vanilla teams for now

vapid valley
rare flicker
#

done

rare flicker
vapid valley
rare flicker
#

yup

vapid valley
#

u can set it but others can still see it no?

rare flicker
#

as long as they are in the NoNameTeam no

vapid valley
#

but I wanna hide it from other teams

rare flicker
#

then have both set to "hideForOtherTeam"

vapid valley
#

nd i'm not runnin on a vanilla server

rare flicker
#

lemme test that

vapid valley
#

klm

rare flicker
#

doesnt matter, you still have the vanilla features

vapid valley
#

idk then it's not workin for me hto

#

tho*

rare flicker
#

still works here ; -;)

vapid valley
#

I've tried all of them but no matter what the other team can see my nametag and I can see theirs

#

could it be my plugins then?

rare flicker
#

i mean, it could if one of them uses teams

vapid valley
#

lemme send u a ss of it

rare flicker
#

afaik you cant be in two teams at once

vapid valley
#

but there is this ghost team that appears, says it doesnt exist but its there and i can't remove it either

rare flicker
#

not what i meant

let's say plugin X is using teams for specific features and adds you to one of it's system teams, it would remove you from the team where nametags are hidden

iron glade
#

Does anyone here know if it's possible to keep those 2 lines in one line instead of splitting this text here into a solo line?

vapid valley
#

I don't think any of my plugins do anythin lyk that tho

#

here's my plugin list

rare flicker
#

smth like this?
first line \n second line

vapid valley
#

jus realised i cant send the ss of my plugins here

iron glade
#

that the unformatted text and the formatted text stay in the same line

rare flicker
#

OOOHHH

#

in discord

iron glade
#

yes

rare flicker
#

`like this would render` like this

#

its not exactly the same

#

but its the cloest there is

iron glade
#

test

rare flicker
#

this
is meant to be used to write block text like code

iron glade
#

So just a single `instead of 3?

rare flicker
#

ye

vapid valley
#

@rare flicker issih klm if i send u a ss of my plugins to ur pm

iron glade
rare flicker
#

but mainly have coloration

public static void main(String[] args){
}
rare flicker
vapid valley
#

wait nvm I think ik which plugin is causin the issue

ashen quest
#

i kinda want that animation to show up

#

but without damage to players/blocks

rare flicker
#

play it artificially then

#

cancel it and use particle.huge_explosion iirc

ashen quest
#

ooo

rare flicker
#

nvm it's explosion emitter

ashen quest
#

I dont see any thing related to EXPLOSION in Sound

ashen quest
#

Oo

rare flicker
#

Has anyone ever played around with custom recipes involving custom items?

ashen quest
#

Yea, I just use the custom item itemstack as the result in Crafting event

noble lantern
#

hmmm conclure

#

this is actually running on the one thread (115) Thonk

ivory sleet
#

Yes

noble lantern
#

Added Thread.sleep() and it bricks the request line

rare flicker
noble lantern
#

Even though each requests handles in a future

ivory sleet
#

Wait send code

ashen quest
noble lantern
#

?paste

undone axleBOT
rare flicker
#

aw..

#

i have it working and everything

#

but now i'm trying to cancel custom items from being usable in vanilla recipes

ashen quest
#
ShapedRecipe expBottle = new ShapedRecipe(dingusItemStack);
rare flicker
#

but i cant find a way to recognize a recipe as custom or vanilla

noble lantern
#

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

Executor is:

Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors() * 8);

annd runAsync is just a wrap around of CompletableFuture.runAsync(Runnable).join();

public static void runAsync(Runnable runnable, Executor executor) {
        CompletableFuture.runAsync(runnable, executor).join();
    }
rare flicker
#
    private Recipe maillechorts_rod() {
        ShapedRecipe recipe = DEItem.MAILLECHORTS_ROD.getShapedRecipe();

        recipe.shape("i","l","p");

        recipe.setIngredient('i', new RecipeChoice.ExactChoice(DEItem.MAILLECHORTS_INGOT.getItem()));
        recipe.setIngredient('l', Material.LIGHTNING_ROD);
        recipe.setIngredient('p', new RecipeChoice.ExactChoice(DEItem.MAILLECHORTS_PLATE.getItem()));

        return recipe;
    }
ashen quest
noble lantern
#

would join() make the futures block on the server thread?

noble lantern
#

without calling join() the threads never completed theyre tasks

ashen quest
noble lantern
#

it uses new thread on connections just fine tho

ashen quest
#

what array of itemstacks, from crafting event?

rare flicker
noble lantern
#

wait

rare flicker
#

this is something i want to cancel

noble lantern
#

it doesnt

rare flicker
#

because the bottom right ingot is not a real copper ingot

#

but a custom one

#

so your method would work here

ivory sleet
#

Burchard wait let me boot up my poop laptop

#

Ima check source

#

Of fjp

ashen quest
#

so just use the inventory drop/click event
cast to CraftingInventory if instanceof
loop through the items (has a method for the recipe items)
check if it contains your item
if it does, setResult to null

noble lantern
#

I can give you repo access or just the lib jar if you want to test it out directly

rare flicker
#

but what i also have recipes like this

ashen quest
#

oh

rare flicker
#

which should remain

ashen quest
#

then u need to check for each recipe i guess

#

or wait

#

u can maybe add checks for results

noble lantern
#

The work stealing pool does have 96 threads but i dont think thats the issue

rare flicker
#

tried both

ashen quest
#

oh

noble lantern
#

i have plenty of ram and im on an i7

ashen quest
#

no idea then I am sorry

rare flicker
#

aw... TwT

ashen quest
ashen quest
noble lantern
ashen quest
#

oh

rare flicker
#

i can pastebin my class if you want

ashen quest
#

yea that would be nice

ashen quest
noble lantern
#

it was when it was working

#

not i just stopped and runs on thread 115

#

even after restarts it chooses thread 115 Thonk

ivory sleet
#

First and foremost

#

Yes

#

But thats java 19 😦

ashen quest
#

true

rare flicker
#

i have no idea what this new thing is about

ivory sleet
#

we will get StructuredTaskScopes also

ashen quest
#

its about threads

ivory sleet
#

Which is awesome

ashen quest
noble lantern
ashen quest
#

multithreading on a new level

ivory sleet
#

Yes

ashen quest
noble lantern
#

ill switch my project over rn

ashen quest
#

finally a good java update

noble lantern
#

is the new changes east to implement?

ashen quest
rare flicker
#

what changed exactly?

noble lantern
#

And use on futures?

rare flicker
#

thread creation became less expensive or smth?

ivory sleet
#

Jep 425 adds virtual threads, and jep 428 adds structured concurrency api

#

Yes

ashen quest
noble lantern
#

alr lemme download the jdk and stuff and switch up gradle

#

ugggh fuuuck

ivory sleet
#

And we get better error handling

noble lantern
#

im gonna have to change my auto deployment up

ashen quest
#

wat whut java19 is out?

noble lantern
#

oh is it not

ivory sleet
#

Early access

#

I test it out

noble lantern
#

so not anyone can get it

ivory sleet
#

But iirc still some stuff that needs tweaking

#

Well

#

Its unstable

noble lantern
#

well tbf java 19 wont work for me

#

because my deployments need a gradle docker image

#

and i doubt a jdk 19 is available yet

rare flicker
ivory sleet
#

new ForkJoinPool(Runtime.getAvailableProcessors(),defaultForkJoinWorkerThreadFactory,(t,e)->e.printStackTrace(),true);

#

^ try that impl

ashen quest
rare flicker
#

WOOO

ashen quest
#

GG

rare flicker
#

thanks for trying to help x)

#

made me look again through the docs xD

ashen quest
#

my pleasure

ashen quest
noble lantern
#

building now

ashen quest
#

how does spigot show the fake diamonds/ores stuff when a user tries to xray?

rare flicker
#

i was confused because #Recipe doesnt have a getKey method

ashen quest
#

i want to do something similar

rare flicker
ashen quest
#

oh packets, scary

rare flicker
#

like, when the server send a chunk it replace the ores to stone?

noble lantern
#

weird its still blocking

rare flicker
#

maybe its smth else i never really looked into it

noble lantern
#

and chooses thread 115 always