#help-development

1 messages · Page 135 of 1

ornate mantle
#
ServerLevel level = ((CraftPlayer) player).getHandle().getLevel();
CustomZombie alberto = new CustomZombie(EntityType.HUSK, level, player.getLocation(), "Xx_alberto_xX");
level.addFreshEntity(alberto);```
#

.addfreshentity does the magic

#

replace alberto with your supreme goat

arctic moth
#

ok

arctic moth
ornate mantle
#

use this when you spawn the entity

arctic moth
ornate mantle
#

yeah this shit happens when you use nms

#

ive been trying to make an npc move for 4 weeks

#

💀

arctic moth
wet breach
#

need to give it some AI

ornate mantle
#

anyways

ornate mantle
#

anyways

#

can u send the entire error

arctic moth
wet breach
#

nope

golden turret
#

not programming specific but which are the valid responses from a call? Like, accepted, reject, cancelled, etc

arctic moth
ornate mantle
arctic moth
wet breach
# arctic moth what ones does goat use

well it depends how the entity was spawned. But typically custom entities don't do anything unless it has some goals which that is what gives it it's AI

arctic moth
#

says SupremeGoat is in an unnamed module

arctic moth
arctic moth
wet breach
ornate mantle
#

anyone know why the npc is spawning so high up?

#

its spawning at the husks coordinates

#

but the husk is down there

#

sometimes the npc spawns underground

#

and moves as the zombie husk moves

#

also for some reason the husk is invisible aswell

ornate mantle
#

npc.spawn(new Location(this.getLevel().getWorld(), this.getX(), this.getY(), this.getZ(), this.getBukkitYaw(), this.getVoicePitch()));

#

this is a modified class of zombie

#
    public void spawn(Location location){

        final float[] currentHealth = new float[1];
        final double[] prevX = {0};
        final double[] prevY = {0};
        final double[] prevZ = {0};

        Logger logger = CustomMobTest.getInstance().getLogger();

        ServerPlayer npc = instance;
        ServerLevel level = npc.getLevel();

        npc.setPos(location.getX(), location.getY(), location.getZ());

        Bukkit.getOnlinePlayers().forEach(player -> {
            sendJoinPackets(player, npc);
            logger.log(Level.INFO, "Sent join packet to " + player.getName());
        });```
golden turret
#

hm

ornate mantle
#

spawn method

#

the first four variables are useless

#

i refactored them somewhere else

golden turret
#

what about the location

ornate mantle
#

what about it

golden turret
#

the reason it is spawning underground is because the getY is underground

ornate mantle
#

its spawning in random areas

golden turret
#

alright

#

then

#

you could do an algorithm to choose the better y for you

ornate mantle
#

nono

#

the husk is spawned via a command

#

so the husk is over ground

#

and its moving fine

#

and the npc moves fine aswell

#

but it spawns in different coordinates

arctic moth
#

how do i add attributes to my custom nms entity

#

the Attribute object makes no sense

#

dont know how to get one

torn oyster
#

whats the new method for PlayerAttemptPickupItemEvent

#

i was updating my plugin but it doesn't exist anymore

#

it might have been a Paper method actually

arctic moth
torn oyster
golden turret
#

EntityPickupItemEvent then

arctic moth
#

oh Attributes is a thing

drowsy helm
#

Use the messaging channel

shadow zinc
#

is the spark cpu usage in its api system or jvm orientated?

#

nvm it literally says cpu system

hazy parrot
#

What are you trying to achieve

shadow zinc
hazy parrot
#

Looks like you didn't understand me

jaunty crag
#

does anyone know how to get dynamic unicode characters for playerheads, or if it is even possible

hazy parrot
#

For what reason

jaunty crag
#

trying to make something similar to what mcc island has

hazy parrot
#

I hope someone other will help you 🙂

drowsy helm
#

I literally gave you the answer

hazy parrot
#

BTW that was the same thing I told you like 12 hours ago

drowsy helm
#

Or use redis

#

If you dont want to use messaging channels

river girder
#

How can i report a plugin developer?

dusk flicker
#

by clicking the report on their profile

shadow zinc
#

lol I can report myself

dusk flicker
#

yooooo

arctic moth
#

how would i force a goat to ram at something? i originally had a runnable setting ram cooldown to 0, but when i made an nms entity for it instead it doesnt work anymore

#
@Override
    public Brain<Goat> getBrain() {
        Brain<Goat> brain =  super.getBrain();

        brain.setMemory(MemoryModuleType.RAM_COOLDOWN_TICKS, 0);

        return brain;
    }
#

it makes the thing always should no cooldown in data but still no ram spam

dusk flicker
#

why do I find the Brain object so funny

#

I might just be tired

granite burrow
#

I've created a random tp plugin and I was wondering if there is a better way to get the highest block in a coordinate without having to load in a chunk

arctic moth
shadow zinc
#

you would need the chunk loaded regardless

arctic moth
#

ik

shadow zinc
#

otherwise how else would you do it?

granite burrow
#

ah so lag is an issue no matter what

arctic moth
shadow zinc
#

well it depends how you do it

arctic moth
#

i use this on every tick and still have 20 tps

#

more laggy on the client than server

granite burrow
#

I have it check a radius of 5,000 blocks around the player, the plugin only runs it up to 1,500 times but whenever I run the command and it takes longer than a couple seconds the server lags, and sometimes crashes

So it checks about 1,500 blocks before teleporting the player, checking if the blocks meet the criteria for the player to be safe

So max that it registers is 1,500 chunks per command. Feel like I may have messed up with my code allowing it to run multiple times

arctic moth
#

in a nested function and return once it finds a good spot and tps

granite burrow
arctic moth
granite burrow
#

It works fine, gets a place to tp each time I let it run forever, however, it isnt great for server performance

#

I have the random restricted from example: 5000 blocks in the x and Z coord, so it gets a random spot within the 5000blocks. It then checks up to 1,500 times to see if the block that was randomly selected is safe, and if it isn't it will not attempt to teleport after that.

But in those 1,500 checks if 2 player's run the command at the same time it lags the server alot, and if the server is a low end server it lags it alot

hasty prawn
#

You can, why wouldn't you be able to?

undone axleBOT
sterile token
#

?paste

undone axleBOT
sterile token
#

Peble

#

I remember you from somewhere else

#

I think the problem is because you are not shading the HikriCP library into your jar

#

But let me make sure if that is the issue

#

Because you normally get NoClassDef... error when you try to use a library which is not already loaded in the JVM

#

... means its continue the exception name just to dont write the full name

#

haha

#

There you have an example for shading dependencies

#

follow the tuto i sent

#

It fully explained how to do it

ebon ether
#

When creating several ItemStacks, should each custom item that I am creating be in a single ItemStack class or should I have a package just named ItemStack & then have an individual class for each item I am creating. What is better optimization wise? I assume one class?

sterile token
ebon ether
#

making a bunch of custom potions.

sterile token
#

ok

#

So i would make a config file if its a public plugin

ebon ether
#

it's not, which is why it's not needed.

sterile token
#

right

#

So you pust every ItemStack inside one class

#

Hmn ok

#

Let me send code

ebon ether
sterile token
# ebon ether thanks.

Something like:

public class CustomPotions {
  
  private ItemStack potion1;  

  public void load() {
    // intiliaze your potions
  }

  // Setters

  // Getters  

}```
sterile token
#

And if you are messing with files i would just do:

An Potion object containing main data for each potion + A repository where to keep all the potions

#

@quaint mantle im with you know sorry mate

drowsy helm
#

Why not use an enum at tjat point

#

And abstraction layer

sterile token
#

Try this code

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>3.2.4</version>
  <configuration>
    <minimizeJar>true</minimizeJar>
    <createDependencyReducedPom>false</createDependencyReducedPom>
    <relocations>
      <relocation>
        <pattern>library.groupId</pattern>
        <shadedPattern>${project.groupId}.libraries.library-name</shadedPattern>
      </relocation>
    </relocations>
  </configuration>
    <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <artifactSet>
          <includes>
            <include>library.groupId:library-artifactId</include>
          </includes>
        </artifactSet>
      </configuration>
    </execution>
  </executions>
</plugin>
#

replace library.groupId with the groupId of what you want to shade
replace library-artifact with the artifactId of what you want to shade
replace library-name with the name of the library you want to keep it

#

Also if you want to a dependency be shade dont add scope provided to it

undone axleBOT
sterile token
#

wait

#

Have you add the code i sent to your pom

#

After you run the project u will have 3 jars i think

#

send a pic of target folder

#

Hmn

#

Can you send me your current pom

#

also how are you building it?

#

hehe

#

you forget that

#

Hahaha

#

shitaa I dropped my stane today when I was welding and it hurts like hell.

#

wait

#

how else i can help?

feral sand
#

Is there any caveats when using getPersistentDataContainer or limitations? I'm considering using this to store a decent amount of entity state/data and wondering if I should use this or a database/api.

oblique wigeon
#

    private void updateInventory(Inventory inv, Player p){
        // Update ComplexItems
        for(ItemStack item : inv.getContents()){
            ComplexItemStack itemStack = ComplexItemStack.of(item);
            if(itemStack != null) {
                Util.sendMessage(p, "Updating Item!");
                itemStack.update(true);
            } else {
                // Update Normal Items
                Util.sendMessage(p, "Updating Item!");
                ItemMeta temp = Bukkit.getItemFactory().getItemMeta(item.getType());
                temp.setLore(List.of("nerd"));
                Util.sendMessage(p, "ItemMeta: " + (item.getItemMeta() == null ? temp : item.getItemMeta()));

                new ComplexItemMeta((item.getItemMeta() == null ? temp : item.getItemMeta()), item);
            }
        }
    }```

I can't set temp's lore, because temp is null, along with if i use `new ItemStack(item.getType()).getItemMeta()`, despite me using these methods before- is there anything i'm doing clearly wrong?
sterile token
#

No

#

Wait

#

where do you code?

#

I would like to see your project

#

like do you have anydesk just to me see how you compile it?

hasty obsidian
#

Lifesteal but with potions

torn oyster
#
    public static String colourize(String message) {
        Matcher matcher = HEX_PATTERN.matcher(ChatColor.translateAlternateColorCodes('&', message));
        StringBuilder buffer = new StringBuilder();

        while (matcher.find()) {
            matcher.appendReplacement(buffer, ChatColor.of(matcher.group(1)).toString());
        }

        return matcher.appendTail(buffer).toString();
    }```
#

this method i have used for a while has suddenly stopped working

#

anyone know why?

golden turret
#

i have one

#

not the best coded one

#

but at least it works

#

<#HEX>

torn oyster
#

RankUtil.getLightColor(p) + p.getDisplayName() + " &7has joined the game. (" + getPlayerList().size() + "/" + getMaxPlayers() + ")"

#

rankutil returns the hex value which isn't translated

#

and it translates that

#

but it does this

#

(same issue before using yours too)

barren peak
#

Is there a way I can give an entity Antikb, but still be able to set its velocity.

I need to keep an entity moving forward, but give it antikb to all attacks from players, explosions, everything etc. (It still needs to take the normal damage from anything just have antikb but still be able to set its velocity)

#

Also is there a simple way to make it face the same direction as its velocity forces it in?

tranquil stump
#

If the player has the permission dune.admin does that mean they also will have all sub perms like dune.admin.setconfig?

eternal oxide
#

only if you gave it

#

dune.admin.setconfig has no relation to dune.admin to a permision plugin, not unless you clearly define it in your plugin.yml

tranquil stump
#

hm

#

maybe just to get rid of any accidental confusion ill use different names

eternal oxide
#

if you want dune.admin to encompass all sub permissions define it in the plugin.yml as having those children.

tranquil stump
#

so would this mean by having dune.setconfig you also have dune.admin?

permissions:
  dune.admin:
    description: Allows DuneAdmin command
    children:
      dune.setconfig:
        description: Allows setconfig
#

im trying to have a single admin command that takes the first arg as what admin action you want to do

eternal oxide
#

be sure your admin nodes are set as either default: false or default: ops

#

Do you want some admins to have access to some admin commands but not others? or an admin is an admin and gets them all.

faint frost
eternal oxide
#

That should be deleted. Its terrible

faint frost
#

honestly im having better luck just looking up examples and learning how it works. By examples i mean working examples that explains what each line does

#

just wish there was an updated explanation on packets. specifically spawning entity's using packets

steady rivet
#

is there a way to change the amount of rows inside of an already created inventory?

vernal summit
#

Hello, I want to create a plugin which teleports all player to another world when an event occurs.
My question is should I use the multiverse api for just two worlds? (the default and the newly created)
I feel like it's overkill
Thanks

knotty escarp
#

hello, I have make a basic gui menu plugin on 1.19.2 and i want to change the background anyone know how to do that because i dont see anything about this subject on forum or ytb

#

thanks

hasty heron
#

How can i give player something in certain World? Like diamond, Iron or something

faint frost
#

huh....

#

why it do that

kindred valley
faint frost
#

dont forget A

kindred valley
#

a

earnest forum
#

i forgot the link but theres a website

#

which translates it into actual names

faint frost
#

fuck okay

#

knew it was something like that

#

any pointers? im not sure what to even look up in this senario

earnest forum
#

ive been googling and its not coming up

faint frost
#

im about to make some sad monkey noises

earnest forum
faint frost
#

big thank

earnest forum
#

do u know what mappings you're using?

faint frost
#

im about to find out

chrome beacon
#

That's obfuscated so no mappings

#

I recommend using Mojang mappings in your project. Will make things much easier for you

faint frost
#

ahh thanks, will do

vernal summit
#

What is the jdk version used by spigot?

vocal cloud
#

Depends on what version you're building against

vernal summit
#

I guess the latest version out there

vocal cloud
#

Java 17 is what you probably want to use then

vernal summit
#

thanks pal

small current
#

is there a way to Instantiate an abstract class as a subclass ? reflections

#

im trying to do it with EntityCreature

boreal seal
#

?paste

undone axleBOT
boreal seal
#

opinions on this

agile anvil
small current
#

reflections

#

i can't extend a class with reflections can i ?

agile anvil
agile anvil
boreal seal
#

otherwise i would make an DI

echo basalt
#

you can still use objects for utility reasons

#

Static only makes sense when you're not dealing with objects

#

or in an object space

boreal seal
#

so its pretty bad ;o?

echo basalt
#

Reasonable usage: Generating a random string
Bad usage: spawning an entity

echo basalt
boreal seal
#

thanks ill think about how to improve it

#

because the issue with HD and other alternatives it wont allow me create some illusions like falling blocks...

sage dragon
#

PotionSplashEvent#getAffectedEntities() does not work if the thrown potion is a splash water bottle...

So I apparently need to do it manually...
What's the range of potions?

echo basalt
#

because they're not meant to?

sage dragon
sage dragon
echo basalt
#

found it within nms

#

actually it's slightly bigger

#

because it derives from the potion's bounding box

#

so

X: -4.25 -> 4.25
Y: -2.25 -> 2.25
Z: -4.25 -> 4.25

#

so it's like 8.5 x 4.5 x 8.5

#

seems wrong

#

might be way too big, divide by 2

hoary mason
#

Hello, what do you recommend me to do in this situation, should I use MiniMessage for better performance?

(I'm updating an item everytime the player breaks a block) https://imgur.com/RA6gteR

echo basalt
#

maybe don't update the name every time you break the block

vivid skiff
#

How can I do that when a player has an item in his hand after 2 seconds he renames it and if within those 2 seconds he changes the item he sends them a message and cancels the event

lost matrix
#

me neither...

vivid skiff
#

I don't know how to explain it

lost matrix
#

I think he wants the player to write something into chat in order to rename the item he is currently holding?

vivid skiff
#

I tried to make it, ill' send the code, it isn' t working

                    Bukkit.getServer().getScheduler().scheduleAsyncDelayedTask(GTaser.getInstance(), new Runnable() {

                        public void run() {
                            if (!(player.getInventory().getItemInMainHand() == Items.taser(3))) {

                                player.sendMessage("§e§lGTASER §8» §7Ricarica annullata!");
                                return;

                            }

                            player.sendMessage("§e§lGTASER §8» §7Ricarica taser in corso...");
                            player.getInventory().removeItem(new ItemStack(Material.FEATHER));

                            final ItemStack item = player.getInventory().getItemInHand();
                            final ItemMeta meta = item.getItemMeta();
                            meta.setDisplayName("§e§lTaser §6[4]");
                            item.setItemMeta(meta);
                        }

                    }, (long) (2 * 20));

                }```
#

I don't know how to expain what i want to do

lost matrix
#

Well if you cant explain what you want to do then you dont actually know what you want to do.
So step one would be figuring out what you actually want.

kindred valley
#

Who renames it?

reef brook
#

relocate issue

vivid skiff
#

No, i mean that i don' t know how to explain it in english. Wait ill find an example

lost matrix
#

?pdc

lost matrix
#

This line of code will randomly fail.

vivid skiff
#

Oh, ok

#

I will change it right away

#

But thats for 1.14 only?

lost matrix
tender shard
peak wharf
#

Hi, i want to change my config in game with a gui, but i want to keep the comments in the config file... this is my code

#

This is for change the config in game

#

And this for load at begin

#

Any idea ?

tender shard
#

there's an option for it to keep comments

#

lemme check

#
getConfig().options().parseComments();
#

try to call this before saving your config after changing it

#

oh and call this BEFORE you do .set(path, answer)

peak wharf
#

ok i will try this

#

not exists

lost matrix
peak wharf
#

minecraft ?

#

1.17

tender shard
#

that's too old then I guess

#

it was added only "recently"

#

although I think 1.17 should be able to to this

#

IIRC it was added in 1.17 or 1.16

peak wharf
#

hmm... so how do i do this 😉

tender shard
#

with the builtin YamlConfiguration, you cannot with your current version, it seems

#

you need to use some third party library

#

(or manually copy the changes to the .yml file 😛 )

#

I just checked, it was added in 1.18.1

peak wharf
tender shard
#

it's "stuff someone else wrote"

peak wharf
#

mhh

#

Isn’t there a lib that keeps comments?

opal juniper
#

probs like configurate or something

hazy parrot
#

It's called simple yaml or something like that

vivid skiff
errant narwhal
#

UH can someone give me a guide to make npc player and make npc damgeable pleas

vivid skiff
tender shard
vivid skiff
tender shard
vivid skiff
errant narwhal
tender shard
#

hm I have no idea about such old versions

#

in mojang mappings, it's easy, but those are 1.17+

molten hearth
#

do we have any docker experts in here

tender shard
#

please just ask

twilit roost
#

I have World time 1 ( lets say 12000) and I want it to smoothly transition to World Time 2 ( 22500)
How should I do it?
via for loops?

molten hearth
#

no 😎

tender shard
#

I am definitely not a docker expert but I know how to do "most" things 😄

molten hearth
#

well

#

I have an issue with a compiled program binding to the host IP

#

within the container

tender shard
#

oh that sucks

molten hearth
#

and it fails as docker doesn't allow to bind directly to the host IP

tender shard
#

is it at least an internal IP?

#

sth like 10.0.0.0/24 or 192.168.0.1/32?

molten hearth
#

I know docker supports stuff like -p HOST_IP:HOST_PORT:CONTAINER_PORT so is there any way to add it

#

no its the public ip lol

tender shard
#

yikes

molten hearth
tender shard
#

only thing I could imagine is to adjust your docker networking settings and setting up a bridge interface or similar on the host so you can assign exactly this IP as the "internal docker ip" to the container

#

but that seems like a horrible solution

molten hearth
#

well I just wanna change the networking settings for that container

#

not sure how to lol

#

is there a conf file

#

or do I need to use the cli like a pleb

tender shard
#

you can't just arbitrarily change this per container

molten hearth
#

bruv

#

if its here why cant it be changed smh

tender shard
#

it's not docker's fault (although I fucking hate docker)

#

wait but that says 0.0.0.0, so you're fine?!

molten hearth
#

yeah because I can listen on 0.0.0.0

#

not the direct IP that is in the compiled program

#

(in the program the IP is set to be like 1.2.3.4 instead of 0.0.0.0)

#

I could re-compile but that will majorly fuck me over most likely yesterday the same thing was throwing errors and today it miraculously works

#

there's some paths it was using to compile that have been deleted by now so uhh yeah

tender shard
#

is it java or something nasty? because changing it in the program itself is probably way easier. otherwise you could "double nat" your stuff but that also seems like a horrible idea

molten hearth
#

its C

tender shard
#

huh not good

molten hearth
#

sheit

#

I guess ill try recompiling it

tender shard
#

you'd need some quite complicated iptables rules to intercept the incoming packets before docker's iptables rules do, then NAT them yourself to the container with a changed destination IP. I don't know how, it's possible, but it's very nasty

molten hearth
#

damn

#

so much and for what lmao

#

if only docker had container conf files

tender shard
#

that wouldn't help anything

#

it's not docker's fault when a tool only listens to 1.2.3.4

molten hearth
#

but docker could pass the IP instead of 0.0.0.0

tender shard
#

0.0.0.0 just means "listen to all interfaces"

molten hearth
#

I mean it supports doing so

#

yeah but it doesnt work apparently lul

tender shard
#

the 0.0.0.0 thing means "no matter on what IP this is incoming, forward port X to docker port Y"

#

if you'd set 1.2.3.4 there it would mean "if something comes in for 1.2.3.4 on port X, forward it to docker port Y"

#

that wouldnt help you, unless 1.2.3.4 is your actual IP

#

and in that case, 0.0.0.0 would still work fine

molten hearth
#

it is

#

its the IP that the server has but within the docker container it seems to uh not work

tender shard
#

yeah but you see, docker containers do not directly have the host's interface

#

they have internal IPs, usually sth like 192.172.0.17

molten hearth
#

well I've seen docker args like -networking=host

#

--net=host

tender shard
#

that still requires NAT

molten hearth
#

bruh

tender shard
#

networking is always a mess 🥲

#

that's why you can literally study this shit at university lol

molten hearth
#

😂

tender shard
#

although I have no idea on how to do it

#

and it'll only work for IPv4

molten hearth
#

ill have a look in a bit tx

tender shard
#

okay wtf

#

?paste

undone axleBOT
tender shard
#

this is the weirdest maven error I got in a looong time

#

anyone any ideas?

twilit roost
#

how can I make Daylight cycle go faster?

tender shard
#

it involves some nasty math, and NMS

hazy parrot
#

Looks like it's corrupted

tender shard
#

I also found that stackoverflow post, but that didnt help. I mean what even am I supposed to remove from my repo? It's complaining about classes that are just now about to get get com piled :/

#

damn wtf I found the problem

#

I used the wrong group id for one of the artifacts

#

no idea why it didnt tell me "couldnt find dependency XY"

#

very weird error message 😄

tender shard
severe marsh
#

How can I access this variable?

obsidian drift
#

Put it inside the BukkitRunnable

#
new BukkitRunnable() {
    boolean randomBool = false;
    @Override
    public void run() {
        // ...
    }
}
severe marsh
#

But what if I want it outside of it?

#
final int[] tapCount = {0};

addSiteButton.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
       tapCount[0]++;
    }

});
``` I found this, is it a good practice?
obsidian drift
#

Yeah that works

#

It's alright practise I think, won't effect performance or anything

grim ice
#

yall know how to obfuscate jars?

#

im not making a plugin just so yk

torn shuttle
#

very specifc question, does anyone know if it's possible to give frost walker to a mob?

quaint mantle
torn shuttle
#

you can't listen to move events from mobs but sure, I'll hack something together failing giving them boots

quasi flint
#

If i remember the Name correctly

quasi flint
#

Tho those are hacky and mostly shit

quaint mantle
#

Right

grim ice
#

:/

livid dove
#

So i have been mucking around with plant growth and was wondering more about the general process. And how exactly the spigot.yml growth modfiers actually play into it all.

Ive seen plenty of posts about how it doesnt work, its bugged etc. But where are these modifiers actually used?

eternal oxide
#

if you just want noobs to not be able to open your jar, generally corrupting the BOM is enough

grim ice
#

u mean bozar?

eternal oxide
#

it is two bytes at teh beginning of teh file which specifies what type the file is

#

Java will still execute it fine but it won;t be openable by many tools

grim ice
#

how to do that

lost matrix
eternal oxide
#

a simple Hex editor like Hexedit

outer river
#

hello, i created a data file in my plugin folder, but when i reload my plugin, this file clear himself and idk why

livid dove
#

within world settings

lost matrix
#

Ah those are use in random ticks to determine if the growth should progress

livid dove
#

Indeed I understand this entire

#

but i want to see where the sausage is made as it were.

#

Because im doing math as I have a seperate plugin that determines when a growth should fail based on % chance

#

So want to up the growth values of these modifiers so I can have biomes that grow some crops faster

#

and some slower, and some at normal minecraft rates

#

Atm I can do slower and normal

#

So my plan is increase these modifiers, and then set the plugin to have "normal" rates be a negative modifier in the plugin. If that makes sense

#

But to do this, I need to know the exact maths behind what these modifiers do and where

#

And as far as ive seen, the main posts about these modifiers have mainly been "They dont bloody well work"

#

So i'd like to see exactly where they are utilised

prisma leaf
#

how to get the spigot 1.8.8 R3

lost matrix
#

This is an implementation question which means you need to start digging

lost matrix
undone axleBOT
prisma leaf
eternal oxide
#

?bt

undone axleBOT
livid dove
lost matrix
livid dove
#

Jebus

#

And the fact its nowhere online implies ... haha

prisma leaf
#

no 1.8.8 1.8.8R3

lost matrix
livid dove
#

Also, why the heck is it not good practice to have some comments, or list, or something to make clear where config entries are implemented

lost matrix
#

Also this is not a dev question

prisma leaf
#

for R3

lost matrix
lost matrix
prisma leaf
#

ich brauche ja R3

livid dove
lost matrix
lost matrix
torn shuttle
#

nope frost walking boots on iron golems will not make the iron golems frost walk

livid dove
#

And i know you say it doesnt belong there. But I am curious as to why a comment not giving even a signpost to where implementation is utilised is nothing but a boon

#

Seems like it'd be good standard practice

torn shuttle
#

doesn't work on zombies either

eternal night
#

It's info for a developer

#

You are not separating these two roles

livid dove
# eternal night It's info for a developer

Oh I get that completely.
I guese im asking why we, as far as I know, don't have an easy way as developers to see where config entities are utilised.

As god forbid, we might forget ourselves haha. Is that not the point of comments?

eternal night
#

I mean you just go to the config file

#

And ask intellij where the field is used

livid dove
#

This is one of those moments haha

torn shuttle
#

my bad

#

I'm dumb

#

it totally works

eternal night
#

😅 we all do from time to time lol

vivid skiff
#

How can i make that a player cant drop something if has his inv closed?

lost matrix
eternal night
#

Iirc there was some hack tho

#

I saw that logic somewhere

vivid skiff
lost matrix
tardy delta
#

use == on enums :}

lost matrix
livid dove
#

Beautiful

#

Cheers

errant narwhal
#

how to make custom npc type player and Player able to damage to npc?

chrome beacon
#

or just use Citizens

lost matrix
lost matrix
chrome beacon
#

Never had any issues with it

lost matrix
#

~4years ago

chrome beacon
#

A lot of things can change in 4 years

livid dove
#

So follow up

#

Ive never had to go into the spigot . jar itself to look for files

lost matrix
#

Yes. Legacy code only gets better with time. Thats a well known rule in development.

livid dove
#

how the heck do i do that in intelij? As the jar is compiled

errant narwhal
lost matrix
grim ice
#

@eternal oxide Uh, do i remove the first two bytes from the left on the jar file?

lost matrix
eternal night
#

Or just open spigot as an actual project

errant narwhal
lost matrix
#

Yeah if you build it then you got the sources. But its less effort just checking like this

rough drift
#

I am here to gib my knowledge

lost matrix
eternal oxide
#

usually with NOP

#

I can;t remember if its the first two or 2 and 3, but replace with 0 and see

errant narwhal
lost matrix
amber bronze
#

?paste

undone axleBOT
amber bronze
lost matrix
#

Who want to bet its an npe?

lost matrix
#

And mark it

#

Ah nvm you already send the code

#
newItemMeta.getLore();

My bet is on this line. It returns null if the ItemMeta didnt have any lore before.

tardy delta
#

myes nice stackoverflow

grim ice
#

aaaa

#

anyone knows how to obfuscate a forge mod?

tardy delta
#

looks like i made it work somehow lol

errant narwhal
#

urr

#

how to use lib disguises??

chrome beacon
errant narwhal
#
        at me.libraryaddict.disguise.DisguiseAPI.disguiseToAll(DisguiseAPI.java:295) ~[?:?]
        at org.devilcryy.commands.onCommand(commands.java:37) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[server.jar:git-Spigot-79a30d7-f4830a1]```
#

can someone help please

tardy delta
#

bruh ij stupid, by not directly throwing an exception in my Validate class, it cannot longer infer the fail contract

chrome beacon
eternal oxide
livid dove
#

it just hit me

#

I think the calc is wrong.

errant narwhal
eternal oxide
#

actualll yOlivo is correct

#

you are performing a bad cast is all

errant narwhal
#
Player p = (Player) sender;
            Location loc = p.getLocation();
            Skeleton Vergil = loc.getWorld().spawn(loc.add(1, 0, 1), Skeleton.class );
            Vergil.setCustomName(ChatColor.BLUE + "Vergil");
            Vergil.setCustomNameVisible(true);
            Vergil.getEquipment().setItemInMainHand(new ItemStack(Material.IRON_SWORD));
            Vergil.setMetadata("Vergil", new FixedMetadataValue(plugin, "vergil"));
            Vergil.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET));
            Vergil.setMaxHealth(50);
            MobDisguise mobDisguise = new MobDisguise(DisguiseType.WITHER);
            mobDisguise.setEntity(Vergil);
            mobDisguise.startDisguise();```
livid dove
#

Shouldn't it be : (int)(100.0F / (float)modifier *((25.0F/f)+1))==0

errant narwhal
#

my code

#

hmm

#

i think mobdisguise

#

not support for bukkit entity

chrome beacon
#

Are you sure that's all the code

errant narwhal
#

nope

chrome beacon
#

Then send the rest

errant narwhal
#

here is all the code

eternal oxide
#

what line is commands.java:37

errant narwhal
#

mobDisguise.setEntity(Vergil);

torn shuttle
#

how do you correctly make a sound play for the player in a way that at least feel global and not based on a location?

errant narwhal
#

oh

#

now i know

#

there is the error lib's disguises can't set player model for entity

boreal seal
#

you made that gun plugin?

#

use a hashmap to store the bulllets dont change item data in real time

#

it will cause that animation to appear

quaint mantle
#

I want to suprise my friend so:

How do I fit picture to the screen for while? (With resourcepack)

boreal seal
#

?paste

undone axleBOT
grim ice
#

how to obfuscate with proguard?

quaint mantle
#

yeah

#

with resourcepack

boreal seal
#

everything is reversable if game can run it

#

so

#

;l

boreal seal
#

pretty simple

quaint mantle
#

oh

#

big brain

boreal seal
#

via packet

quaint mantle
#

🙂

#

can't we just set player's helmet?

boreal seal
#

in newer versions you can use different pictures as well

grim ice
boreal seal
quaint mantle
#

ah

grim ice
#

do u know how to use it or not tho

quaint mantle
#

ty!

boreal seal
boreal seal
tardy delta
#

what would be the scope for jetbrains annotations dependency?

ivory sleet
#

can be whatever

tardy delta
#

i know default is compile but does it actually needs to be compiled into the project?

ivory sleet
#

no

#

well if you wanne use it for runtime

#

but thats rarely the case with these documentation types of annots

errant narwhal
#

is anyone who know how to set player skin for libsdisguise??

kindred valley
#

?paste

undone axleBOT
kindred valley
boreal seal
#

relegions are made for sheeps

fallen lily
#

bruh

#

U lot wanna see a Moonsworth moment?

tardy delta
#

hmm since when is 2+2 5?

#

lol

boreal seal
#

its 5.

#

2+2x2 is 8.

#

🤣

onyx fjord
#

its 6 smartass

boreal seal
#

proof?

#

its 8

onyx fjord
#

math priority

boreal seal
#

because + is first

onyx fjord
#

🤦‍♂️

#

no

boreal seal
#

no no 2 monkey

onyx fjord
#

first is () then its power then its dividing and multiplying and then +-

boreal seal
#

2+2*2 == 8

#

because 2+2 = 4

#

x2

#

8

#

kacper i know math logic

#

but guys it meant to be joke for god sake

#

guys dont correct me i know math rules

#

that * :

#

and etc would go first

ivory sleet
#

in the commutative ring of integers multiplication takes precedence to addition

boreal seal
#

and () even has more weight

tardy delta
#

im fucking up my token buffers by going recursive lol

#

should probably have one per expression brr

onyx fjord
#

how do you verify if String is a valid Integer?

lost matrix
tardy delta
boreal seal
#

no

#

dude

ivory sleet
#

guava Ints.tryParse or Integer.parseInt

boreal seal
#

String check = "\d+";
if (!args[0].matches(check

#

)

onyx fjord
#

hmm

boreal seal
#

just check it

onyx fjord
#

in my old code i found StringUtils.isNumeric

boreal seal
#

if it contains chars

#

nah nah

#

dont use Numberic

onyx fjord
#

is stringutils a bukkit thing?

boreal seal
#

String check = "\d+";
if (!args[0].matches(check) return false or true

ivory sleet
#

wont be able to parse too big numbers

boreal seal
#

he make a xp bottle plugin

#

i dont think players gonna deal thousand of levels

onyx fjord
boreal seal
#

nah my soluation is the best.

onyx fjord
#

oneliner sounds perfect

tardy delta
#

ah f me thinking String#charAt had poor performance but forgot String has a byte[] field

boreal seal
#

a1

#

return false ..

#

1

ivory sleet
#

its not

boreal seal
#

so what do you suggest him to use instead?

onyx fjord
#
    public static boolean isNumeric(final CharSequence cs) {
        if (isEmpty(cs)) {
            return false;
        }
        final int sz = cs.length();
        for (int i = 0; i < sz; i++) {
            if (!Character.isDigit(cs.charAt(i))) {
                return false;
            }
        }
        return true;
    }

this is what apache does

ivory sleet
#

first of all matches() will recompile the regex every time

#

just try catch NumberFormatException with Integer.parseInt

#

or use Ints.tryParse

tardy delta
onyx fjord
#

i dont need minuses anyway

hazy parrot
#
 public static boolean isNumber(String s){
        try {
            Integer.parseInt(s);
            return true;
        }catch (NumberFormatException e){
            return false;
        }
    }
onyx fjord
#

bet

tardy delta
#

tf is this

onyx fjord
#

no idea

boreal seal
#

String check = "\d+"; yourstring.matches(check); is still dope.

tardy delta
#

me tryin to optimize stuff smh

tardy delta
#

better use a Pattern

boreal seal
#

he uses it on command probably

#

i dont think the ms is big deal

#

by theory yeah its better

onyx fjord
#

can i modify how much xp bottle will drop easily?

ivory sleet
tardy delta
#

discord ignoring first backslash smh

hazy parrot
#

"`s`"

#

didn't know discord actually escapes lol

glad prawn
#

Material#valueOf can use number id or only name?

ivory sleet
#

name

#

but more specifically names that match the enum constants only (case sensitive)

tardy delta
#

mmh yes i know what i doing, fucking up my code :(

heavy swan
#

One question can a whole server be made with the Skript plugin?

hazy parrot
#

everything is possible ¯_(ツ)_/¯

#

ig

boreal seal
#

how ever skript has many limitations

quaint mantle
#

Hey Guys, Is there a way for using dll file from C#?

boreal seal
#

no

river oracle
quaint mantle
tardy delta
#

native impl lol

dire marsh
quaint mantle
tardy delta
#

plugin cannot be natively implemented as far as i know

#

also lol

quaint mantle
#

ahh

heavy swan
quaint mantle
#

I tried it but doesn't work so I think there's no way in a normal

onyx fjord
#

hey how can i do this:
I have a large number, i wanna do a for loop that splits it in smaller chunks and then does something with those

livid dove
#

So if we find a bug in spiggot itself

#

where do we go to report it?

chrome beacon
#

?jira

undone axleBOT
chrome beacon
#

^^ report it here

eternal oxide
#

You'd probably be best to state it here first to make sure its a bug

glossy venture
smoky oak
#
if(cfgSection.getBoolean("cost_absolute")) RItemHandler.absCost(droppedItems);
else if(cfgSection.getBoolean("cost_relative")) RItemHandler.absCost(droppedItems,cfgSection.getIntegerList("cost_relative_list"));
else if(cfgSection.getBoolean("cost_material")) {/*implement later*/}
else RItemHandler.absCost(droppedItems);//default
```people always say u shouldnt use else if / chained if, is there a way to optimize this?
hazy parrot
eternal oxide
tardy delta
vernal summit
#

Hello,
Is it possible to teleport player to another world under certain condiition?
(the world does change)
And then teleport him back to the exact coords he was before?

tardy delta
#

as i see stackoverflow its probably possible

smoky oak
tardy delta
#

doesnt teleportation only work in the same world?

smoky oak
#

if i make a tenery operator for that it just results in an even bigger mess

smoky oak
tardy delta
#

huh

smoky oak
#

howd you make nether portals otherwise

eternal oxide
smoky oak
#

ie if else chains

eternal oxide
#

yep probably best

smoky oak
#

I mean
u can use tenary
but u really shouldnt do it if the code block exceeds one instruction or variable assignment

livid dove
#

So... im posting it now... but I think that the growth rates in spiggot have been wrong for like 2 years haha

#

Posting it in bug reports

fresh timber
#

I have this code and I want it to make a 5 sec cooldown on all cmds but it doesnt work. I can still use commands as fast as I want. I have it registered as an event listener in the main.

public class CommandCooldowns implements Listener {

    public CommandCooldowns(CoolPlugin plugin) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }

    HashMap<UUID, Boolean> map = new HashMap<>();
    public void onCommand(PlayerCommandPreprocessEvent event) {
        UUID pUUID = event.getPlayer().getUniqueId();
        if (map.containsKey(pUUID)) {
            event.setCancelled(true);
            event.getPlayer().sendMessage("§cWait! You cannot execute commands this quickly!");
        } else {
            map.put(pUUID, true);
            new DelayedTasks(() -> {
                map.remove(pUUID);
            }, 5 * 20);
        }
    }
}
smoky oak
#

delayedTasks aint spigot

#

use an actual sceduler

#

also

#

common practice is to do a map<uuid, long> for the timestamp the command may be executed again

#

not a scheduler which adds overhead

fresh timber
#

;-; ok

#

I made delayed tasks moterius

#
package coolplugin.util;

import coolplugin.CoolPlugin;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;

import java.util.concurrent.Delayed;

public class DelayedTasks implements Listener {
    private static Plugin plugin = null;
    private int id = -1;

    public DelayedTasks(Plugin instance) {
        plugin = instance;
    }

    public DelayedTasks(Runnable runnable) {
        this(runnable, 0);
    }

    public DelayedTasks(Runnable runnable, long delay) {
        if (plugin.isEnabled()) {
            id = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, runnable, delay);
        } else {
            runnable.run();
        }
    }
}
#

cus its a listener

#

on the code I just sent?

eternal oxide
#

there is No listener in that code

fresh timber
#

yes there is lol

#

PlayerCommandPreprocessEvent

#

its just faster

#

too many letters

#

lol

hazy parrot
fresh timber
#

ok

#

I was talking abt the one before that

eternal oxide
#

We are talking about the last one, you implement Listener but its not a Listener

fresh timber
#

k

#

uh tbh idk then

smoky oak
#

for an event to be processed by bukkit the method it is in - ur onCommand - needs to actually be a method flagged as such. For events that @EventHandler, for commands its @Override

quartz gull
#

you could just have the class extend bukkit runnable

#

instead of runnable in constructor

onyx fjord
#

how do you sort tab completes
lets say i have

foo
bar

and current user input is f, i wanna show foo on top, is there an easy way?

ornate mantle
#

how do i move an nms NPC

#

there any tutorials for it?

#

i need a way to make the npc go to a specific coordinate

eternal oxide
#

If it exists in the world you call its remove method. If it doesn't you send a removeEntity packet

ornate mantle
#

rather than move relative to itself

eternal oxide
#

oh move not remove

#

pretty sure there is a navigateTo method

smoky oak
ornate mantle
eternal oxide
#

Of course they don't

#

You were quite non specific in your question

ornate mantle
#

i spawn an entityplayer at one coordinate

#

and they appear like 10 blocks around it somewhere

#

floating in the air or underground

#

idk whats causing this

#

or how to fix it

eternal oxide
#

an entity will spawn precisely where you tell it to. So you are allowing that randomness

ornate mantle
#

well no shit

#

im not allowing any randomness

#

i spawn in a custom husk

#

the npc player automatically spawns at that husk

#

and is teleported with the husk to make it look like the ServerPlayer is doing the pathfinding

#

the npc moves perfectly fine

#

the head rotation and all

#

it just appears in random coordinates

#

its usually close by

eternal oxide
#

You are colliding with the husk

ornate mantle
#

would entity collision make a packet entity fly out into nowhere?

#

the npc is only visible client side

#

so i dont think thats it

eternal oxide
#

it can make teh client apply collision

ornate mantle
#

bruh

eternal oxide
#

this is client side as it does not exist on the server

ornate mantle
#

how do i disable collision?

#

collision still doesnt explain how it can go that far off

#

are you willing to look at the code

eternal oxide
#

again, you are being very vague, how far is far?

ornate mantle
#

10 ish blocks

#

sometimes too far to see

#

again i do not know why this happens

eternal oxide
#

then thats unlikely collisions

ornate mantle
#

yeah

#

i thought as well cuz collision doesnt make entities go underground

eternal oxide
#

I can only comment on the information YOU provide. tell me half a story and thats all I have to work with

ornate mantle
#

sorry

#

nms 😋😋

eternal oxide
#

As you are using packets your first task is to disable collisions on the husk

#

?stash

undone axleBOT
sage dragon
#

Wasn't PersistentDataContainer for blocks too?

hazy parrot
#

What ever have itemmeta ig

sage dragon
# onyx fjord yes

For some reason I cannot find where I can get it from...

Tried the block itself, BlockState and BlockData 🤔

worldly ingot
#

No, blocks are not persistent data holders

#

Chunks are though

sage dragon
#

Oh, I actually thought they were 🤔

Thanks, I guess

hazy parrot
sage dragon
boreal seal
#

kacper you broke my discord

#

lol

tepid thicket
#

I think my statement still counts true. Executor threads are not deamon threads. Also deamon thread should rarely be used anyway.

#

Not sure if the Executor API gets updated, but at the moment using executor#shutdown and executor#awaitTermination remains the standard pattern.

#

And on Spigot a proper executor shutdown is even more important, as otherwise it might silently break data instead of preventing the server shutdown.

ivory sleet
#

not sure what your point was here

fresh timber
#

in a PlayerCommandPreprocessEvent how do I get the command that they are running?

ivory sleet
#

but most executors are implemented under the management of normal threads, in which you usually have the ability to pass a thread factory that may if wished summon daemon threads

#

shutdown + awaitTerm is what you use normally, but ExecutorService is going to implement AutoClosable soon hence why close() will suffice in the future

wet breach
ivory sleet
#

(And hopefully your concurrency will be structured as well as to avoid dead locks and other unfortunate byproducts)

mighty bane
#

So question, I'm trying to make a custom config file, I followed the wiki but when I try plugin.getCustomConfig in other files. It doesn't recognize it.

ivory sleet
#

lastly, you usually have to implement some sort of locking mechanism when dealing with file IO across multiple threads frequently as opposed to atomically read and write

#

in which even if you terminate the executor accordingly you ought to await said locks to be released (or interrupt)

#

dont get me wrong eko, im not against a proper shutdown design (but usually your executor infrastructure isnt gonna be tightly coupled to your file business logic anyway)

tepid thicket
onyx fjord
#

does apache commons have a method to get closest number from array to given one?

tepid thicket
#

And discovered, that it could be dangerous when forgetting to shutdown. As Spigot by design creates a pitfall there.

ivory sleet
#

anyway especially in enterprise, following principles like humble object pattern is pretty much a must

tepid thicket
#

Deamon threads are rather a niche thing for housekeeping tasks, like clearing caches and stuff.

ivory sleet
#

more than that

barren peak
#

Can you set a direction of an entity while setting its velocity?

(I want to make it always face forward in the direction its velocity is moving it in)

Right now I have this:

//Set Velocity
Vector velocity = target.toVector().subtract(entity.getLocation().toVector());
entity.setVelocity(velocity.normalize().multiply(0.1));

//Set Direction
Vector dirBetweenLocations = target.add(0, 1, 0).toVector().subtract(entity.getLocation().toVector());
entity.getLocation().setDirection(dirBetweenLocations);

but it doesn't work at all, it always faces in the same direction, is there something preventing it from setting direction because of its velocity?

barren peak
#

I tried setting its yaw but that didnt seem to work either

ivory sleet
barren peak
#

just make an entity walk/move from one location to another withought nms

ivory sleet
#

you may (in most cases done so) expose a facade to talk with your concurrency dispatching infrastructure, and then let your file business logic rely on that abstraction

#

but then that file system can live on its own, hence you ought to be able to manage its life regardlessly

barren peak
#

movement wortks good I just need to make it face the direction

#

also im not sure if I did yaw correctly, how would I set yaw with the vector?

Pretty sure I did it wrong when I tried it

glossy venture
#

anyone know why its still putting it in the default directory with the default file name

ivory sleet
#

Not necessarily

#

But iirc the result set’s internal state is changed if for instance the outer scope closes (like the connection)

echo basalt
#

just cache the results like so:
public static final List<ResultSet> RESULT_CACHE = new LinkedList<>();

thank me later

hasty obsidian
#

How do I run an event in a BukkitTask?

echo basalt
#

callEvent?

#

what is your goal

hasty obsidian
#

I am trying to give potion effect in a BukkitTask

ivory sleet
#

But yeah eko for the so called daemon

#

A lot more is using it that mere housekeeping tasks

tepid thicket
#

Eventually. If the tasks it executes is capable of being stopped at any moment.

ivory sleet
hasty obsidian
#

ok thxx

ivory sleet
#

And remember you can still join the threads

#

Or well task objects if you use an es

barren peak
#

Can you not set an entities yaw/direction when you set its velocity?

wet breach
#

file corruption doesn't go away just because you decided to use something different

mighty bane
#

So I was wondering if there was a way to make an item not burn in lava similar to how netherite doesn't burn?

#

Is there not a property I could add to the item?

wet breach
mighty bane
#

Sorry, what I meant was. Doesn't spigot already have a property for this since netherite exists?

mighty bane
#

Thanks, cause I can't really seem to find an example.

#

You can toss the ingot into lava and it won't burn. Same with debris.

barren peak
iron glade
#

try it

#

and you'll know

small current
#

why am i getting wrong number of arguments

barren peak
iron glade
#

are you just setting the yaw of the mob's location?

mighty bane
#

So changing this will prevent it from burning?

wet breach
iron glade
#

add pdc to your item

wet breach
#

it might be sufficient to just modify the metadata of flammable

small current
wet breach
#

since there is an NBT data for such things, you could probably set items and blocks as not being flammable

mighty bane
#

I think I might just cancel event since I already need to check for the burn event for a different reason.

fresh timber
#

how do I get the command the sender used in PlayerCommandPreprocessEvent

tepid thicket
#

Joining a deamon thread would not make too much sense. As described here.

fresh timber
#

ah ok

iron glade
#

I think you can then use #split() to also check for args and stuff

fresh timber
#

k

fresh timber
#

so like this if (event.getMessage() == "/spawn")

ivory sleet
#

but yes for the average concurrency user you probably want to avoid it

iron glade
#

nah

#

don't use == on strings

fresh timber
#

ok so do I use the .equals thingie

iron glade
#

correct

fresh timber
#

k

#

thx

#

k

iron glade
#

I never cast player to CommandSender without checking

tardy delta
#

^^

iron glade
#

He's talking about CommandPreProcessEvent tho and not onCommand

fresh timber
#

no

#

preprocess can cancel event and do stuff before the command executes

#

oncommand happens after the events of command happen I think

small current
#

output of the parameter count

tepid thicket
quaint mantle
#

Idk never done this

small current
barren peak
#

Is it possible to change an entities pitch and yaw withought teleporting them?

small current
iron glade
quaint mantle
small current
#

ok how should i instantiate it

barren peak
#

or no

quaint mantle
tardy delta
#

dont ask me what happened here but got rid of everything lol

quaint mantle
tepid thicket
#

And by that making it effectively a non-daemon thread?

ivory sleet
#

No, im not only talking about joining the threads

#

But tasks that get executed by the threads

small current
vernal summit
#

Is it possible to delay a task, then restart it before it finished if needed?

tepid thicket
tardy delta
#

tasks are runnables?

tepid thicket
#

Eventually were are speaking of different concepts here.

#

Yes. But you cannot "join a runnable", only it's executing thread.

ivory sleet
#

No you can join tasks also

tardy delta
#

whats now the dif between a task and a thread? :/

ivory sleet
#

Ofc joining the task will temporarily make said thread await the tasks thread

#

But thats conceptually a thing

#

Just look at Future or ForkJoinTask

#

And yes I am using join and await synonymously right now to simplify things but ofc they are not really equivalent

tepid thicket
#

ForkJoinTask might be special case there.

ivory sleet
#

No

#

CompletableFuture

#

Its fully possible by implementing a simple lock mechanic

#

Remember Object has notify and wait

oak raven
#

can anyone help me who has like hours of free time to spend on an autistic kid like me? i'd like to make a discord bot, which can make you a role, like a team role, u add peoples to them, add a team name, and the others have to accept it, i have no clue how to code or anything

ivory sleet
#

also BloodEko look at this

#

gonna be a very nice addition to Java once fully implemented :3

vernal summit
#

Is it possible to restart a scheduleSyncDelayedTask?

ivory sleet
#
  • (I believe it talks about ExecutorService::close)
#

but for your curiosity, an executor that uses daemon threads joins them if you await its termination post a shutdown request

#

not the best example

#

and also for file concurrency

#

we have AsynchronousFileChannel, and you could even go so far as to use ReentrantReadWriteLock

#

with Conditions if needed

tepid thicket
ivory sleet
#

yeah, tho shutdown + awaitT isnt bad at all

quaint mantle
#

Hello, how do you get At to have what he writes in color in the chat?

ivory sleet
#

I was just saying that it might not be as fundamental always

shrewd sphinx
#

bro ong why does Bukkit.getOnlinePlayers() return the wrong amount of players on server once a player leaves

oak raven
shrewd sphinx
#

it legit doesnt change from 2 online players