#development

1 messages · Page 7 of 1

dusky harness
#

EntityChangeBlockEvent I think

#

@robust flower anvils?

#

dragon eggs (?)

#

note that anvils can also break when on top of non-full (surface) blocks such as slabs or lilypads

dusky harness
#

not sure

robust flower
dusky harness
#

this is much more than i thought lol

robust flower
#

I love how simple this is! 😄 kill me

dusky harness
#

KOTLIN

#

🥰

mental cypress
#

I just realized tonight that you can do switch expression variable initializations in Java 😂

#

Was on Java 8 for too long and then went to Kotlin

dusty frost
#

Switch expressions 😌

errant kraken
#

So I am extending an abstract class and I have this method ```
@Override
public void join(Player player) {
joinPlayer(player);
}

Is there a way to somehow call joinPlayer (which is also a method in the abstract class) every time join is called instead of having to manually call it in the child class like this?
#

I am basically trying to create some default functionality alongside whatever the dev wants to add later

sterile hinge
#

well whenever a method is overridden, you lose the default behavior as long as super.<method>() isn't called

brittle thunder
#

ops, sorry for the ping, forgot to turn it off

nimble vale
#

is it possible that generating only for example 8 chunks with vanilla word generation and anything else is just air

#

like can i achive this with a plugin or need to make changes in server jar

#

its like skyblock generation actually

#

i guess thats works too

loud sorrel
#

so you wouldn’t be able to prevent block generation on the first run because the world is generated before the plugin is initialized. but, i did see someone delete chunk files

#

you could also just use worldedit if u need to do it once

nimble vale
#

i can make it once but it needs to be like unlimited* amount of that chunks

#

i also need to change the world generator to make it only a specific biome etc etc

#

i don't really know where to start

hoary scarab
nimble vale
#

is it possible to load only a chunk with a worldgenerator

#

like there will be a space between them

hoary scarab
#

I'm sure you can set a chunks generator and run chunk regen. (I could be wrong though. Testing required.)

tropic pasture
#

is there an event for checking when the placeholder value is change in PlaceholderApi

lyric gyro
#

no

#

PAPI is entirely based around polling the value of a placeholder, it's more of an "evaluate this expression" kind of thing

#

@kind granite thoughts?

tropic pasture
#

okay thanks

#

hope it exist Xd

lyric gyro
#

You’re probably better off checking it from the original plugin or just regular events instead of checking when placeholders change

tropic pasture
#

yes but if there is an event for it, i can do just check the placeholder change event instead of checking every plugin and get the api from that plugin

mystic gull
dense drift
#

d;adventure Component#replaceText

uneven lanternBOT
#
@@Contract(pure=true) @@NotNull
Component replaceText(@NotNull @NotNull TextReplacementConfig config)```
Description:

Finds and replaces any text with this or child Components using the provided options.

Since:

4.2.0

Returns:

a modified copy of this component

Parameters:

config - the replacement config

nimble vale
abstract gate
#

is it possible to check if a mob can get to another mob
for example if the zombe is in a 2 block hole the answer is false
if it has a block over it's head and in a 1 block cage
false
but it there is nothing restricting it and if the player were to go afk the zombie could attack the player
the answer is true

merry knoll
#

i dont think it exists in the api

#

but you could write it yourself

abstract gate
#

i wouldn't know the math fo rthat

merry knoll
#

search for A* algorithm

merry knoll
#

i would still check maybe if it exists already in the api

#

if not ^ is your best bet

#

might help

pulsar ferry
#

Pretty sure the built in nms path is a*

merry knoll
#

i think it uses a different algorithm though or rather an edited version of A*

#

since its uniform cube structure rather than nodes with different distances

pulsar ferry
#

Paper exposes a fair bit of the path spigot nada
With nms you can definitely do that though

merry knoll
#

but i am 100% sure that there are some optimizations they did to it since A* itself

#

is fast but not that fast

pulsar ferry
#

But it is still easier to just use the nms pathfinding

hushed pagoda
#

ive been trying to use the spigot/paper docs along with googling what might be wrong but i've had no luck

#

im not getting an error either, it just doesnt want to set/save even though im using the correct method to do so. at least i think i am

low obsidian
#

can anyone help with tipped arrow i wanna display item with slow falling tipped arrow

proper quiver
#

No

worn jasper
#

Quick question, there is the PlayerPortalEvent whoch detects when the players enters the portal, but does that include the animation or not (if in survival)? If it does include the animation, is there an event for when the player "touches" the portal?

warm steppe
#

PlayerPortalEvent

worn jasper
#

That means PlayerPortalEvent doesnt include the animation?

proud pebble
merry knoll
proud pebble
#

like im sure when you teleport its the playerteleportevent

#

cus it has a teleport_cause of endportal,netherportal, end gateway

worn jasper
#

Oh okay, thanks a lot then!

hybrid dome
#

is there any way to make the placeholders dynamic?

#

Like %stats_[arena]%

#

can replace anything on [arena]

dusky harness
hybrid dome
dusky harness
#

and I'll show you from there

hybrid dome
#

please don't angry me

dense drift
#

you have a String parameter on the onRequest method

#

that's everything you have after stats_

dusky harness
hybrid dome
#

i mean

#

a dynamic placeholder

dusky harness
#

that is dynamic

hybrid dome
#

that's too much case

#

i am bad at explaing

#

sorry

#

i want to check stats from players from a random arena

#

i can't create all placeholders for them

#

then i want to create %stats_[arena]%

dusky harness
#

I don't know what method you use to get status from players from an arena

hybrid dome
#

to show a stats from that arena

dusky harness
#

so unless I know I can't say much besides that params will give you [arena]

#

all PAPI controls is that first part

#

stats

#

if the placeholder matches %stats_PARAMS%, it gives it to your method (onRequest)

hybrid dome
#

ok, i want to create placeholders like ajleaderboard (that is what i want from the start, sorry for bad explaining)

dusky harness
#

it depends on each plugin

hybrid dome
#

i have a variable

#

to get the arena stats

#

but it is required

#

the arena name from the placeholder

dusky harness
#

what is the variable type

hybrid dome
dusky harness
#

okay but what variable do you store arena stats in

hybrid dome
#

a value of a config path

warm steppe
#

How would it be possible to override some methods from a class, keeping the original logic, but also adding some of my own logic?

dense drift
#

You can achieve that by calling super.method()

warm steppe
#

oh damn

#

well thanks

dusky harness
#

is it possible to call the original method of a class that overrides a method? 🥲

honest spoke
#

Any reason why error messages in IJ's run "console" look like this? I've never seen this before, and there's no stack trace to go with it

outer fulcrum
#

How do i hide items enchantments?

#

on 1.18 plugin

merry knoll
dusky harness
#

ah rip alr
not even with reflection or something like that?

#

🤷

merry knoll
#

i mean with reflection you can do it

#

but why though, it feels like your class structure is the issue

dusky harness
dusky harness
#

since iirc thats not a thing

dense drift
#

If you have like Class2 extends Class1 where Class1 extends Class, you can call Class.super.method() I believe
And super.method() will call the method from the first super class (in this case Class1)

honest spoke
abstract gate
#

java.lang.IllegalAccessError: class net.neednot.farmnerf.FarmNerf (in unnamed module @0x7eb66914) cannot access class com.sun.tools.javac.util.List (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x7eb66914 why do i get this in the server

#

it disables my plugin

#

ah nvm

#

i was using the wrong listt

#

and the ide was using a different java version

lyric gyro
hybrid dome
#

is there any way to make the placeholder has anything as params at the end?

#

that means player can do %placeholder_[anything he wants]%

#

and the plugin still return values?

lyric gyro
#

PAPI gives you the arguments after the first _ exactly as written

abstract gate
#

what is the spawn reason of a summoned entity

dense drift
#

d;CreatureSpawnEvent$SpawnReason%COMMAND

uneven lanternBOT
errant kraken
#

how can I set a block somewhere in the world without the chunk where the block is to be necessarily loaded by any player?

lyric gyro
#

load the chunk beforehand

dusky harness
#

doesn't setType (or getBlockAt) already load the chunk?

lyric gyro
#

¯\_(ツ)_/¯

proud pebble
#

i think it does load tge chunk

dense drift
#

If anyone has used the paypal webhook api, any idea why it randomly stops sending events after a few of them failed?

#

last event sent is from an hour ago

honest spoke
#

Anyone know why my error messages look like this inside IJ? This is just the same NPE repeated over and over again, there's no stack trace, and every second character is nonsense

sterile hinge
#

looks like an encoding issue in your terminal, can you print the output to a file instead?

honest spoke
#

I'd have to catch every error to do that though

lyric gyro
#

fix your code xx

honest spoke
#

I'm trying 😭

sterile hinge
#

use a debugger and pause on exception automatically :p

honest spoke
#

passing -Dfile.encoding=UTF-8 and -XX:-OmitStackTraceInFastThrow hasn't helped either

sterile hinge
#

did you mistype encoding in your IDE aswell?

honest spoke
#

No

honest spoke
honest spoke
#

I've set both the console and app charset to UTF-8 and the issue persists

lyric gyro
#

can you use a bedrock edition texture file in java?

#

are they the same thing?

#

the proportions and stuff

#

just a file

#

not a resource pack

#

like just the item image

oak ivy
granite hound
#

hey guys im getting an error with my plugin and it says could not load plugin i think its my plugin.yml but ill also send my code my YML: name: EventListeners version: '${project.version}' main: me.gielhauglustaine.eventlisteners.EventListeners api-version: 1.19 authors: [ giel1234 ] description: a tutorial plugin on eventlisteners and my code: https://pastebin.com/4pGCfJ3h

winged pebble
#

What does it say is wrong?

granite hound
#

nothing it just says in my console [16:28:34 ERROR]: Could not load 'plugins/EventListeners-1.0-SNAPSHOT.jar' in folder 'plugins'

winged pebble
#

What does it say right after that

granite hound
#
        at org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:375) ~[paper-1.18.2.jar:git-Paper-344]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:415) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:323) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-344]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-344]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-344]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-344]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
#

unsupported api version

winged pebble
#

You're trying to use 1.19 api version in 1.18

granite hound
#

o yeah i had viaversion installed

#

xd thanks for helping

lyric gyro
#

I don't understand

granite hound
#
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        if (action == Action.RIGHT_CLICK_BLOCK) {
            Block block = event.getClickedBlock();
            if (block.getState() instanceof GreenStainedGlass)
                if (item.getType() == Material.Slimeball) {
                    //do stuff
                    layer Player = Bukkit.getPlayer(giel1234)Player.setHealth(0.0D);
                }
            }
        }
    }
}``` shouldnt this make it so that when right clicking with a slimeball on greenstained glass it would kill me? making a deathrun plugin
warm steppe
#

layer Player

#
public class ActivateTrap implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();
        
        if (action != Action.RIGHT_CLICK_BLOCK) return;
        if (event.getClickedBlock().getType() != Material.GREEN_STAINED_GLASS) return;
        if (item.getType() != Material.Slimeball) return;
        
        player.setHealth(0.0D);
    }
}
#

Idk which is your spigot version, but this should work. @granite hound

granite hound
#

thanks

warm steppe
#

I haven't tested this, use at your own risk

warm steppe
granite hound
#

ok

granite hound
warm steppe
#

Main

granite hound
#

also i mod c# unity games and i know you have to call from main is that here too?

warm steppe
#

You get your PluginManager instance and register your event with #registerEvents(Listener, JavaPlugin);

#

d;PluginManager#registerEvents

uneven lanternBOT
#
void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin)```
Description:

Registers all the events in the given listener class

Parameters:

listener - Listener to register
plugin - Plugin to register

robust flower
#

how expensive is the call to this method?

CraftServer#isPrimaryThread

public boolean isPrimaryThread() {
  return Thread.currentThread().equals(this.console.an) || Thread.currentThread().equals(MinecraftServer.getServer().shutdownThread);
}
granite hound
warm steppe
#

hmm, not quite

#

you need to pass your event (listener) instance (new ActivateTrap())

#

and for the second parameter you can use this keyword

granite hound
#

ok so like this @Override public void onEnable() { // Plugin startup logic void registerEvents(@NotNull Listener (new ActivateTrap()), @NotNull JavaPlugin this)

winged pebble
#

Still not quite

#
Bukkit.getPluginManager().registerEvents(new ActivateTrap(), this);```
warm steppe
#

khem..., ;, khem...

granite hound
warm steppe
#

Just replace your thing with what @winged pebble sent.

granite hound
#

ok thanks

#

it gives an error cannot find symbol when i build

warm steppe
#

What does that error say?

granite hound
#

cannot find symbol

winged pebble
#

For what

granite hound
#

for what you send

winged pebble
#

Which part

granite hound
#

right before the line and before activatetrap

winged pebble
#

Just show me a screenshot

granite hound
#

i cant

#

the server doesnt allow me

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

dusky harness
granite hound
dusky harness
dusky harness
#

then try running mvn clean package instead of build

#

unless that's some IJ thing

#

if you expand Run Configurations on the right, there should be a button package, press that

granite hound
dusky harness
#

what shows up?

#

Or just double click control and a window should pop up, then type mvn clean package and press enter

granite hound
#

its a dropdown menu

#

now theres even more

#

one is cannot access me.gielhauglustaine.deathrun.ActivateTrap

dusky harness
#

so you know the java folder that you just made

granite hound
#

that was already there

dusky harness
#

oh

#

show a screenshot of the file structure plz

dusky harness
neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

granite hound
dusky harness
#

hmm

granite hound
#

there is also one duplicate class: ActivateTrap error

#

and the rest is symbol

winged pebble
#

What does the package at the top of Deathrun say

granite hound
winged pebble
#

The first line of the file

#

And ActivateTrap not Deathrun, sorry

granite hound
#

package me.gielhauglustaine.deathrun;

#

o ok

#

o yeah

#

i didnt add that

#

ok i fixed that but cannot find symbol stays

winged pebble
#

You reran the package goal?

granite hound
#

not that i know

#

how do i do that?

winged pebble
#

I just mean after you changed that file, did you try to compile again

granite hound
#

yes

#

you mean run it right

winged pebble
#

Yes

granite hound
#

yeah i did

winged pebble
#

And you get the same exact error?

granite hound
#

not really the 2 other things got removed but all the cannot find symbols still here

winged pebble
#

You have to be specific my dude

granite hound
#

that is the error

#

it says nothing more

#

cannot find symbols

#

is all it says

#

the other 2 where duplicate class: ActivateTrap error and cannot access me.gielhauglustaine.deathrun.ActivateTrap but those are solved now

winged pebble
#

So the errors are fixed now?

granite hound
#

no not really those two yeah but it still gives 11 of the errors about cannot find symbol

winged pebble
#

Show your pom.xml

granite hound
winged pebble
#

Your groupid doesn't match your package

granite hound
#

what should it be?

#

ahh it has to be without the big letters

#

sorry

winged pebble
#

your base package should be your groupid.artifactid

#

Yeah

granite hound
#

english isnt native language xd

#

hasnt fixed it

#

when editing it did say it wasnt part of the project

#

i think its in the wrong place

winged pebble
#

your artifactid should be lowercase as well

granite hound
#

didnt work

winged pebble
granite hound
#

the pom.xml

winged pebble
#

It said the pom.xml wasn't part of the project?

granite hound
#

i think its the wrong location

#

yes

winged pebble
#

Where do you have it?

granite hound
#

its in that yellow part at Project

winged pebble
#

Yeah, it should be at the root

#

And you clicked the reload button thing at the top right after you edited the pom.xml

#

?

granite hound
#

you mean run deathrun build?

winged pebble
#

No, when you edit the pom.xml in the top right a little square with a reload symbol should show up

granite hound
#

i think i found something

#

every name of deathrun in pom is still with big letters

#

or

winged pebble
granite hound
#

the error is for example cannot resolve symbol bukkit when i go over the word bukkit

winged pebble
#

Send your whole main class file

granite hound
#

import org.bukkit.plugin.java.JavaPlugin;

public final class Deathrun extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        Bukkit.getPluginManager().registerEvents(new ActivateTrap(), this);
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic

    }
}```
winged pebble
#

Yeah you have to import Bukkit

#

It's in the suggested actions

granite hound
#

where is suggested actions?

winged pebble
#

When you hover over the error

granite hound
#
public class ActivateTrap implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();

        if (action != Action.RIGHT_CLICK_BLOCK) return;
        if (event.getClickedBlock().getType() != Material.GREEN_STAINED_GLASS) return;
        if (item.getType() != Material.Slimeball) return;

        player.setHealth(0.0D);

    }
}
``` and for this?
winged pebble
#

Import all the stuff you need to

granite hound
#

in main incompatible types: me.gielhauglustaine.deathrun.ActivateTrap cannot be converted to org.bukkit.event.Listener

winged pebble
#

What Listener did you import

granite hound
#

import org.bukkit.Bukkit; i just added this

winged pebble
#

Okay, intellij will tell you what you need to do

#

If you hover over the errors, it will tell you what's wrong and usually suggest a fix

granite hound
#

what its magically fixed

#

also slimeball gives a red

winged pebble
#

Cause you didn't type it correctly

#

intellisense is your friend

granite hound
#

how can i find the correct

winged pebble
#

intellisense is the auto complete suggestions

granite hound
#

ooo

#

it has

#

yo sick

winged pebble
#

Just type Material. then start typing slimeball

#

It'll help you out

granite hound
#

it works!

plush stirrup
#

I'm getting an Enchantment cannot be null on items that don't get enchants

public class ItemBuilder {
    private Material material;
    private String displayName;
    private Enchantment enchantment;
    private int level;
    private List<String> lore;
    private int amount = 1;
    private short damage = 0;

    public ItemBuilder(@NotNull Material material) {
        this.material = material;
    }

    public @NotNull ItemBuilder setName(@NotNull String displayName) {
        this.displayName = translateHexCodes(displayName, OreNLore.getInstance());
        return this;
    }

    public @NotNull ItemBuilder setLore(@NotNull String... lore) {
        this.lore.addAll(Arrays.stream(lore).map(s -> translateHexCodes(s,OreNLore.getInstance())).collect(toList()));
        return this;
    }

    public @NotNull ItemBuilder setAmount(int amount) {
        if (amount > 0 && amount < 65) this.amount = amount;
        return this;
    }

    public @NotNull ItemBuilder setMaterial(@NotNull Material material) {
        this.material = material;
        return this;
    }

    public ItemBuilder durability(short damage) {
        this.damage = damage;
        return this;
    }
    public ItemBuilder addEnchant(@NotNull Enchantment enchantment, int level) {
        this.enchantment = enchantment;
        this.level = level;
        return this;
    }

    public ItemStack build() {
        ItemStack itemStack = new ItemStack(this.material, this.amount);
        ItemMeta itemMeta = itemStack.getItemMeta();
        if (this.displayName != null) itemMeta.setDisplayName(this.displayName);
        if (this.lore != null) itemMeta.setLore(this.lore);
        if (this.enchantment != null) itemStack.addEnchantment(this.enchantment, this.level);
        return itemStack;
    }
}```
Would anyone know how to fix this?
#

items that don't get enchants say they can't be null

#

Basically like this:

ItemStack barrier = new ItemBuilder(Material.BARRIER).setName("&cOutput").build();```
dense drift
#

use brackets

plush stirrup
#

for?

dense drift
#

ifs

winged pebble
#

readability/maintainabilty, etc

plush stirrup
#

they don't need them, but I can add them

#
public class ItemBuilder {
    private Material material;
    private String displayName;
    private Enchantment enchantment;
    private int level;
    private List<String> lore;
    private int amount = 1;
    private short damage = 0;

    public ItemBuilder(@NotNull Material material) {
        this.material = material;
    }

    public @NotNull ItemBuilder setName(@NotNull String displayName) {
        this.displayName = translateHexCodes(displayName, OreNLore.getInstance());
        return this;
    }

    public @NotNull ItemBuilder setLore(@NotNull String... lore) {
        this.lore.addAll(Arrays.stream(lore).map(s -> translateHexCodes(s,OreNLore.getInstance())).collect(toList()));
        return this;
    }

    public @NotNull ItemBuilder setAmount(int amount) {
        if (amount > 0 && amount < 65) {
            this.amount = amount;
        }
        return this;
    }

    public @NotNull ItemBuilder setMaterial(@NotNull Material material) {
        this.material = material;
        return this;
    }

    public ItemBuilder durability(short damage) {
        this.damage = damage;
        return this;
    }
    public ItemBuilder addEnchant(@NotNull Enchantment enchantment, int level) {
        this.enchantment = enchantment;
        this.level = level;
        return this;
    }

    public ItemStack build() {
        ItemStack itemStack = new ItemStack(this.material, this.amount);
        ItemMeta itemMeta = itemStack.getItemMeta();
        if (this.displayName != null) {
            itemMeta.setDisplayName(this.displayName);
        }
        if (this.lore != null) {
            itemMeta.setLore(this.lore);
        }
        if (this.enchantment != null) {
            itemStack.addEnchantment(this.enchantment, this.level);
        }
        return itemStack;

    }
}
dusky harness
#

can u show the error?

plush stirrup
dusky harness
#

thats interesting

plush stirrup
#

oh

#

i fixed it

#

i put @NotNull before ItemBuilder

#
public @NotNull ItemBuilder addEnchant(@NotNull Enchantment enchantment, int level) {
        this.enchantment = enchantment;
        this.level = level;
        return this;
    }```
#

and it fixed itself

winged pebble
#

That's... odd

dusky harness
#

very odd indeed

#

I'm guessing you accidentally changed something else

plush stirrup
#

¯_(ツ)_/¯

dusky harness
#

since @NotNull isn't compiled into the jar iirc

winged pebble
#

That wouldn't have had any runtime effect

plush stirrup
#

Lemme change it back and i'll see what it does

dusky harness
#

alr

plush stirrup
#

hmph

#

helps if i compile it

#

ok it works

#

man, i have no idea what i changed

winged pebble
#

You probably didn't rebuild/reload properly in between tests

plush stirrup
#

no clue

#

oh well

#

it work snow, thanks for the help

#

i guess?

#

weirdness happened

dusky harness
#

lol

plush stirrup
#

there's one more thing

#

items can't get multiple enchants?

#

i need to do a map don't i

#
ItemStack diamond_sword = new ItemBuilder(Material.DIAMOND_SWORD).setAmount(1)
                .addEnchant(Enchantment.DAMAGE_ALL, 5)
                .addEnchant(Enchantment.DURABILITY, 3)
                .addEnchant(Enchantment.FIRE_ASPECT, 2).build();```
winged pebble
#

Yeah that's what i'd do

#

<Enchantment, Integer>

neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

plush stirrup
# winged pebble <Enchantment, Integer>

How would I use this:

public @NotNull ItemBuilder addEnchants(@NotNull Map<Enchantment, Integer> enchantment) {
        this.enchantments = enchantment;
        return this;
    }```

I feel dumb that I'm not sure how to use a map that's inside of a method
#

I really don't know how to explain it, I hope you guys know what I mean

winged pebble
#

You store the map as a field and then loop through and add each enchant that's in the map

lyric gyro
#

can you play mp3/wav tracks in minecraft

#

i wanted to make it so that it plays il vento d oro when you are the last one alive

#

lol

tight tide
proud pebble
misty dragon
#

Hello guys, i've an economy plugin but how can i check if player don't have enough money to buy items from other plugins?

proud pebble
#

vault

unborn ivy
#

yo , so ive been trying to create something using an external API that has almost no documentation (savage factions) and I have been trying to find a way to find out if the target block is in a Wilderness / warzone chunk

#

can anyone help the api literally doesnt say anything

proud pebble
#

its right there

#

wilderness and warzone are both factions

unborn ivy
#

nvm

proud pebble
unborn ivy
#

i figured out

granite hound
#

hey guys i want to make a deathrun game and the trap activator works but i want to make a basic trap that the red blocks dissapear and the green stay so red and green concrete but i want it to only be in the single area is that possible to select a radius or do i have to specify every blocks coordinate? also would it be possible to make it so you can set the traps up in game as the game will have multiple maps

edgy lintel
#

does persistentdatacontainer essentially a multiversion nms data storage api?

broken elbow
edgy lintel
dense drift
#

is bukkit's NBT implementation

edgy lintel
#

ohh alr so its still stored in minecraft nbttag

dense drift
#

nbt, but you can't edit any tag you want

edgy lintel
#

oh alr got it

broken elbow
#

it is stored wherever NBT tags are stored

#

since they're nbt tags

#

in the end, just with the bukkit namespace

granite hound
#

hey guys i have a question i made it so that when right clicking green glass with slime ball it kills you but i want to activate traps but to do that first i need to be able to make it so that they have different triggers so when i click one green glass with a slimeball something will happen but when doing the same but on a different glass its still green glass but just in another place i need something else to happen does anyone know a way to do that?

merry knoll
#

TrapTriggeredEvent etc

granite hound
#

Thanks

merry knoll
#

a small example is above

granite hound
broken elbow
merry knoll
#

that contains all the information you need with the event

#

for example

granite hound
merry knoll
#

depends, i would make an event for all trap triggers

#

so you can listen to it

#

and go like (redblocktrigger -> fire trap)

#

you can also use the bukkit event system

granite hound
#

Ok and the problem is that it should all be green glass but should do different stuff

merry knoll
#

okay so then you do this instead

granite hound
#

So green glass but there are multiple green glasses but they do different stuff

merry knoll
#

then create a type enum

#

and make your event object have a field with the type

#

so you can check what kind of green grass triggered your event

#

then on your listener

#

you can go

#

switch(type)
case ArrowTrap
case FallTrap

#

etc

#

or another approach is to create an event for each trap type

#

so you just listen to ArrowTrapTriggeredEvent

#

// do logic on arrow trap trigger

#

probably cleaner

#

but i would make an event interface that shares the triggering block and such

granite hound
# merry knoll etc

Ok because the trap types are specified to the area but the traps have different areas in the map too as there are multiple of the same traps but just with other activor green stained glass blocks

merry knoll
#

you pass all those in the event object

#

give me a second, i will give you an example

granite hound
#

Thanks

merry knoll
#
public abstract class TrapTriggeredEvent {
    private final Block  triggeringBlock;
    private final Player triggeringPlayer;

    public TrapTriggeredEvent(Block triggeringBlock, Player triggeringPlayer) {
        this.triggeringBlock = triggeringBlock;
        this.triggeringPlayer = triggeringPlayer;
    }

    public Block getTriggeringBlock() {
        return triggeringBlock;
    }

    public Player getTriggeringPlayer() {
        return triggeringPlayer;
    }
}
#

your generic trap event

#
public class ArrowTrapEvent extends TrapTriggeredEvent{
    public ArrowTrapEvent(Block triggeringBlock, Player triggeringPlayer) {
        super(triggeringBlock, triggeringPlayer);
    }
}
#

a specific trap event

#

and while listening, you do it bukkit style

#
public class ArrowTrapListener implements TrapListener {

    @Override
    public void onTrapTrigger(ArrowTrapEvent event) {
        // do stuff
    }
}
#

this is how i would probably do it

#

@granite hound

granite hound
#

thanks

merry knoll
#

obv you change the paramaters and fields

#

to match what you need

granite hound
#

yeah i should change my the code in super() right?

merry knoll
#

super calls TrapTriggeredEvent constructor there

#

since the specific event is extending it

#

you put the shared stuff into the trap triggered event

#

and specific stuff into the specific events

#

if you only have a type that changes

granite hound
#

ok

merry knoll
#

between traps and no other info changes, then you dont need the different event approach imho

#

i would just make an enum in that case

granite hound
#

so in trap triggered the triggerblock should be set to glass

merry knoll
#

no, you are not setting any of those by hand

#

your producer is creating these objects

#

dynamically as they happen

granite hound
#

ok

merry knoll
#

producer example is in the link i posted

#

above

granite hound
#

shouldnt this line be this.triggeringBlock = GREEN_STAINED_GLASS;?

#

right

merry knoll
#

no

granite hound
#

ok

merry knoll
#

GREEN_STAINED_GLASS doesnt even exist

#

its a Material.GREEN_STAINED_GLASS

#

and a material is not a block

granite hound
#

ok because my activator works but currently when you click it with a slimeball you just die

merry knoll
#

you can do what you want to do simpler with just if else / switch cases

granite hound
merry knoll
#

you code it yourself, code i gave you is not for copy pasting

#

example is in the link

stuck canopy
#

is there a way to add multiple conflicting enchantment to a custom enchant?

#

oh can I use a List of Enchantments in conflictWith() method?

broken elbow
#

umm

broken elbow
#

you're supposed to check what the other enchantment is and return true/false depending if they conflict or not

#

also conflictsWith can accept a list of enchantments yes

#

there's 2 methods

stuck canopy
#

I mean it requires a enchantment and ig it accepts a List of Enchantments as well

broken elbow
#

1 that takes in just 1 enchantment and one that takes in a list

stuck canopy
#

yea I get it

broken elbow
#

but that might be just paper actually, not sure if that method exists in spigot

stuck canopy
#

not a problem for me coz I use paper

olive dirge
#

what's the current most popular version servers are using right now

#

would it be 1.19?

broken elbow
#

1.19 most poular and 1.19.2 after it

olive dirge
#

got it

#

another question for config files, would setting to null be the best way to remove it?

broken elbow
olive dirge
#

hmm interesting alright

#

is matt's itembuilder work in 1.19?

warm steppe
#

yes

olive dirge
#

errr could someone send the link here

warm steppe
olive dirge
#

got it thanks

warm steppe
#

👍

olive dirge
#

what event/events would I use to prevent unequiping armor

lyric gyro
marble nimbus
#

Hey is it possible to detect when a user uses fabric and what mods they use? Or just one of them.

pulsar ferry
#

Yes to both

olive dirge
#

for maven build, is there a way to specific where to install the jar

lyric gyro
#
                System.out.println(contador);
                contador++;
                Thread.sleep(1000);
            }```
#

how do I make so that this statement repeats itself

#

I add return at the end?

#

with what parameters

high edge
#

You remove the condition in your while?

lyric gyro
high edge
#

while (contador < 5){

lyric gyro
merry knoll
lyric gyro
#

i want the statement to repeat itself

merry knoll
#

ah

lyric gyro
#

so it will count to 5

#

and then restart

merry knoll
#

im guessing its a method?

lyric gyro
#

try statement

merry knoll
#

you either wrap the whole thing in another while

#

or you call the function again

#

from the function

#

so it recursively repeats

lyric gyro
#

how do i call the function again?

#

i think i know but i forgor

torpid raft
#

or just add an

if contador == 5)
 contador = 0
merry knoll
#

lets say its
public void countToFive() {
// count to 5
countToFive()
}

torpid raft
#

or to be fancy

contador %= 5;
merry knoll
#

oh no not the modulus operator

torpid raft
#

oh yes, a terrifying endeavor

#

only the biggest of brains can handle how it's modulating

merry knoll
#

you even condensed the operation

#

how will my brain ever grasp what is happening

lyric gyro
#

i also added a blank sout at the end

#

just to make things a little bit less confusing

#

but

#

now it's counting only up to 4

#

what do i do

#

ill just increase the while by one

#

now it's working

#

i'll also avoid asking for help here

nimble vale
#

does anybody knows what will happen if you try to insert a value in mysql while it's the already exact same thing

lyric gyro
merry knoll
#

if you mean update or upsert then it will replace the old value

nimble vale
#

yeah but if you try to insert it again

merry knoll
#

gives exception

#

if you are not sure if the value will be there

#

and just want it to be set

#

then use upsert

nimble vale
granite hound
torpid raft
#

huh

merry knoll
#

override means its overriding a method

#

that your class is implementing

#

in this case its overriding the listeners event method

granite hound
#

o yeah i found that i accidentally changed it to eventlistener instead of traplistener do i have to make a custom listener?

merry knoll
#

yes

granite hound
#

do you have any docs how?

merry knoll
#

that doc shows the full workings of listener pattern

granite hound
#

ok thanks

#

i didnt see that part

lyric gyro
#

please

#

what is going on

winged pebble
#

You sure you don't have the entry point being another class?

granite hound
#

hey i have some errors for myeventproducer can anyone review it and help me with it or something ```package me.gielhauglustaine.deathrun;

import jdk.internal.icu.text.UnicodeSet;

import java.util.Vector;

public class MyEventProducer<myEventListeners_> {
private int id_ = 0;
Vector MyEventListener, myEventListeners_ = new Vector();

         public void addMyEventListener (ArrowTrapListener listener) {
             listeners_.add(listener);
         }

         public void removeMyEventListener(ArrowTrapListener listener) {
           listeners_.remove(listener);
      }

      public void notifyMyEventOccured() {
          int i;
           myEvent myEvent = new myEvent(this, i++);
        while myEventListeners_.hasMoreElements() {
              ArrowTrapListener listener = myEventListeners_.nextElement();
              listener.myEventOccured(myEvent);
            }
     }```
winged pebble
#

I'm confused, how does Vector play into this?

icy shadow
#

It's old version of arraylist

#

Presumably they're following an old tutorial

granite hound
#

I got it from a Java docs

leaden sinew
#

Very old

icy shadow
#

What errors are you getting @granite hound ?

#

Incredibly old

leaden sinew
#

Extremely old

icy shadow
#

Also those names are extremely cursed

leaden sinew
#

Yeah lol

icy shadow
#

I actually thought it was a different language at first

leaden sinew
#

There’s no consistency in any of the names either

leaden sinew
#

Could you explain what you are trying to do?

granite hound
winged pebble
#

You don't have a variable named listeners_

icy shadow
#

Those images have about 2 pixels

granite hound
winged pebble
#

What tutorial are you following?

winged pebble
#

Yeah this tutorial isn't great tbh

winged pebble
granite hound
#

its spigot

#

and what do you mean built in ways

winged pebble
#

The exact same way that bukkit does events

#

You just have your custom event that is fired when it happens, and your Listener that works the exact same way as the other events

granite hound
#

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

public class ActivateTrap implements Listener {
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();

        if (action != Action.RIGHT_CLICK_BLOCK) return;
        if (event.getClickedBlock().getType() != Material.GREEN_STAINED_GLASS) return;
        if (item.getType() != Material.SLIME_BALL) return;

        new ArrowTrapEvent();

    }
}``` should i do it this way?
winged pebble
#

That's how you listen the an event, yes

#

Do you know how to fire an event?

granite hound
#

no not that i know

#

i mean like i think i dont

#

but it can be im not understanding

winged pebble
#

Bukkit.getPluginManager().callEvent(<your event here>)

granite hound
#

also for some reason the triggering block and player have private access but everyhting is public in the script its taken from ```package me.gielhauglustaine.deathrun;

import sun.jvm.hotspot.opto.Block;

public class ArrowTrapEvent extends TrapTriggeredEvent {

public ArrowTrapEvent() {
    super(triggeringBlock, triggeringPlayer);
}

}```

winged pebble
#

Show TrapTriggeredEvent

granite hound
# winged pebble Show TrapTriggeredEvent

import org.bukkit.entity.Player;
import sun.jvm.hotspot.opto.Block;

public abstract class TrapTriggeredEvent {
    private final Block triggeringBlock;
    private final Player triggeringPlayer;

    public TrapTriggeredEvent(Block triggeringBlock, Player triggeringPlayer) {
        this.triggeringBlock = triggeringBlock;
        this.triggeringPlayer = triggeringPlayer;
    }

    public Block getTriggeringBlock() {
        return triggeringBlock;
    }

    public Player getTriggeringPlayer() {
        return triggeringPlayer;
    }
}
winged pebble
#

You have them as private

winged pebble
#

As that's not the right Block

#

And your class needs to extend bukkit's Event

granite hound
#

ok so i changed that but where are they set private?

granite hound
winged pebble
#

When you want the event to be fired

granite hound
#

when they right click with a slimeball on green glass oooo

#

yeah

#

its the activate

#

but do i still need new ArrowTrapEvent(); then?

winged pebble
#

Well as it stands, I see no reason to have that class, it doesn't add anything different than the TrapTriggerEvent

granite hound
granite hound
somber gale
#

Does anyone know if it is doable to store T as a variable in Java?
I currently have this method:

public <T> T getFavicon(Function<BufferedImage, T> function) {
    return function.apply(image); // image is a BufferedImage instance
}

And I want to change it so that it would return T directly if it already has made it before.
Like something similar to f.e.

public <T> T getFavicon(Function<BufferedImage, T> function) {
    if (cached != null)
        return cached;

    return (cached = function.apply(image));
}
winged pebble
somber gale
#

Doesn't work...

#

Also, this lovely error

winged pebble
#
public class Example<T> {
  private T myThing;

  public T getThing() {
    return myThing;
  }
}
winged pebble
#

Like what will define what T is

winged pebble
#

<>

granite hound
winged pebble
#

What did you change it to

granite hound
#

Bukkit.getPluginManager().callEvent(ArrowTrapEvent);

winged pebble
#

You have to pass in a variable

lyric gyro
#

just watched a java tutorial and I didn't really understand. Can someone help me understand this code? please ```class theThread implements Runnable{

String name;
Thread t;

theThread(String name){
    this.name = name;
    t = new Thread(this, name);
    System.out.println("Created New Thread: " + t);
}

public void run() {
    try{
        for (int i = 5; i > 0; i--){
            System.out.println("Thread: " + t + " " + i);
            Thread.sleep(1000);
        }
    }catch (InterruptedException e){
        System.out.println(e);
    }
    System.out.println(t + " is existing.");

}

}

public class creatingMultipleThreads{

public static void main(String[] args){

    theThread theThread1 = new theThread("thread1");
    theThread theThread2 = new theThread("thread2");
    theThread theThread3 = new theThread("thread3");

    theThread1.t.start();
    theThread2.t.start();
    theThread3.t.start();



}

}```

granite hound
#

also @winged pebble if i do it from activatetrap would i still be able to make it so on some green stained glasses when clicked with slimeball it activates a arrowtrap but then on another its for example a parkourtrap?

winged pebble
#

I have no idea

#

Probably though

somber gale
granite hound
#

because now it activates it when pressed with a slimeball but i want the same to be done but have a different result depending on what the glass should be assigned too

somber gale
#

I chose this as it allows me a single method to convert a BufferedImage to any Favicon object using their factory methods

granite hound
winged pebble
#

Well I don't really understand your scenario tbh

granite hound
winged pebble
#

As the type is no longer determined by the input to the function

granite hound
winged pebble
#

I highly suggest you look into some Java tutorials btw

granite hound
#

ok

winged pebble
#

There are a lot of things you're messing up on by not knowing java/oop basics

#

Let me see if I understand what you are trying to do

#

You want to listen for when the player uses a slimeball on a block, depending on the type of block, it will create a certain type of trap?

granite hound
#

its the same block and the same item but a different type of trap

winged pebble
#

How are you going to differentiate what kind of trap they are trying to make?

granite hound
#

the glass is in front of the area where the trap should be

#

i was thinking of connecting them

merry knoll
winged pebble
#

Okay, so basically what I said, but slightly different

granite hound
#

yeah

merry knoll
#

idea was that he would extend the generic event with the different trap types

granite hound
#

because i also need to set the areas that the trap cover

granite hound
winged pebble
#

Well you're going to have to use the interact event to determine which kind of trap they are making

#

I don't see a lot of benefit in making an event for the creation of the trap though, as interact pretty much does what you need

merry knoll
#

i would personally just make different trap events and fire them as needed

winged pebble
#

I don't see the benefit of that

merry knoll
#

as they get triggered

#

its cleaner since logic goes into different classes then

winged pebble
#

The interact event is going to do all the heavy lifting

merry knoll
#

yeah obviously

#

but you avoid a big class

winged pebble
#

Making separate events for each type of trap is overkill

#

Not really

winged pebble
#

The interact just says oh, you want this type of trap boom it's made

merry knoll
#

until you have a bit more experience

winged pebble
#

Whereas creating a separate event to fire just creates another step

merry knoll
#

getting into concurrency will just make it mroe confusing

lyric gyro
#

I managed to do somethings with it

merry knoll
#

concurrency and thread safety is

#

i highly doubt you managed to cover for race conditions

lyric gyro
#

but I don't understand how that code works

lyric gyro
#

im just watching the playlist in order

#

not skipping anything

merry knoll
#

when you have multiple workers

#

editing a variable becomes an issue

#

since its state is not guaranteed

#

translation is

granite hound
#

yeah but the problem is that there will be multiple maps and there will be multiple of the same trap in the same map so it would be nice to make it be simple to set up what the area of the trap is with worldedit or some other plugin or something so you can link your trap area you selected with a green glass or something?

merry knoll
#

lets say you got an int a = 0

#

and you have two threads increasing its amount by 1

#

1000 times each

#

at the same time

#

you would normally expect the end result as 2000

#

but you will get a number between 1000 - 2000 each time

winged pebble
#

This is a good video talking about threads

merry knoll
#

i think, they need to cover oop stuff first honestly

#

threads is a bit after that

winged pebble
#

I mean, if that code is straight from a tutorial, I've got some issues with the tutorial

winged pebble
#

Yeah, some weird things in it tbh

icy shadow
#

actual thread safety is incredibly difficult and anyone that says otherwise is either stupid or lying

lyric gyro
#

can someone explain the code though

#

what is it doing

#

how

#

why

#

whats the purpose

merry knoll
#

your first class is expanding runnable

#

meaning that it is a class with a function in it

lyric gyro
#

runnable being an interface

#

correct?

winged pebble
#

Yes

merry knoll
#

that function is the run() method

#

yes

lyric gyro
#

a function is?

winged pebble
#

public void run() {
}

lyric gyro
#

thats basically a function?

merry knoll
#

yes

winged pebble
#

that is a function

lyric gyro
#

just a method

merry knoll
#

what an interface does

winged pebble
#

a method is a function that belongs to a class

merry knoll
#

is define a default template

lyric gyro
#

i know what an interface does

#

dw i understand interfaces

merry knoll
#

okay, then thats basically it

lyric gyro
#

my biggest question is with t

#

what is t

#

and what is it doing

icy shadow
#

t is the Thread

winged pebble
#

it is the field inside of the class

icy shadow
#

yeah

merry knoll
#

its a thread

lyric gyro
#

ok

merry knoll
#

or worker usually

winged pebble
#
class theThread implements Runnable{

    String name;
    Thread t; // <--------
  
  // ...
}```
merry knoll
#

also please name your classes properly

#

it hurts me atm

granite hound
lyric gyro
merry knoll
#

ClassName <-
functionName

#

it breaks convention

lyric gyro
#

didnt know

#

thanks

merry knoll
#

class names always start with upper letter

winged pebble
lyric gyro
#

Its my class and I name it whatever i want

#

jk

merry knoll
#

i mean you are the one thats gonna struggle to debug

#

with stacktrace

#

so up to you honestly

lyric gyro
#

ok so

#

now I know that t is just a thread

#

but

winged pebble
#

It just makes it easier to read code faster

merry knoll
#

imagine a thread

#

as a worker

lyric gyro
#

how does it have access to other threads

winged pebble
#

It doesn't

lyric gyro
#

how does it know

granite hound
lyric gyro
#

what other threads are doing

merry knoll
#

it doesnt

#

thats why thread safety is difficult

lyric gyro
#

then how

merry knoll
#

its your job to make sure that they are synched properly

winged pebble
#

They are all acting independently of eachother

merry knoll
#

otherwise they write over each other

lyric gyro
#
Created New Thread: Thread[thread2,5,main]
Created New Thread: Thread[thread3,5,main]
Thread: Thread[thread2,5,main] 5
Thread: Thread[thread1,5,main] 5
Thread: Thread[thread3,5,main] 5
Thread: Thread[thread2,5,main] 4
Thread: Thread[thread1,5,main] 4
Thread: Thread[thread3,5,main] 4
Thread: Thread[thread1,5,main] 3
Thread: Thread[thread2,5,main] 3
Thread: Thread[thread3,5,main] 3
Thread: Thread[thread1,5,main] 2
Thread: Thread[thread3,5,main] 2
Thread: Thread[thread2,5,main] 2
Thread: Thread[thread1,5,main] 1
Thread: Thread[thread3,5,main] 1
Thread: Thread[thread2,5,main] 1

Process finished with exit code 0
#

this is the console

icy shadow
#

yeah so what?

#

each thread only prints its own name

#

it doesnt interact with the other threads at all

lyric gyro
#

oh god

#

this is so confusing

merry knoll
#

this is why i said

#

probably avoid threads

#

until you are confident in oop

lyric gyro
#

i'll use them a lot

#

I know that

icy shadow
#

i doubt that

merry knoll
#

eh

winged pebble
#

Normally, code executes from top to bottom, when you introduce concurrency, you start to have branches

icy shadow
#

in modern java you dont tend to use the Thread class directly anyway, there are much more modern patterns for handling concurrency

merry knoll
#

threads are extremely useful, but you need to know what you are doing

granite hound
merry knoll
lyric gyro
#

what does target: this mean?

merry knoll
#

and get the no kotlin emote

icy shadow
icy shadow
lyric gyro
#
        this.name = name;
        t = new Thread(this, name);
        System.out.println("Created New Thread: " + t);
    }```
#

this constructor

merry knoll
#

that you are firing the code in

#

so its the instance of theThread

lyric gyro
#

its easier

merry knoll
#

yes but its an instance of an object

icy shadow
#

instance of a class*

winged pebble
#

^

icy shadow
#

🤓

merry knoll
winged pebble
#

So basically it's just passing itself into the Thread

lyric gyro
#

what is kotlin

#

yeah fuck threads

#

i wanna now about that coroute stuff or whatever

granite hound
winged pebble
#

It is a separate language built on the JVM

icy shadow
#

lol

merry knoll
lyric gyro
merry knoll
#

kotlin is another language

icy shadow
#

no it is not java

#

^

lyric gyro
#

yeah fuck kotlin too

merry knoll
#

that has cross compatibility with java

winged pebble
#

^

#

I'm pretty sure kotlin is the go to language for android development

granite hound
#

its a language that compiles to java

lyric gyro
#

grab the no kotlin spray

merry knoll
#

i will go and eat popcorn with my coroutines

icy shadow
granite hound
#

also i got a question why does everyone hate kotlin?

#

never used it

#

have heard of it

lyric gyro
#

not needed

#

probably

merry knoll
#

they dont really hate it

icy shadow
#

it's a meme

merry knoll
#

^

granite hound
#

o ok

merry knoll
#

its way better than java

icy shadow
#

ehhhhh

#

we'll have to agree to disagree on that one

merry knoll
#

the amount of publics and statics i avoid typing

lyric gyro
#

fun

#

is the name of one of the commands

icy shadow
lyric gyro
#

imagine writing "fun"

#

while enraged that your program didn't work

merry knoll
#

just object usually if you want static access

cinder forum
granite hound
icy shadow
#

worldedit is the de-facto standard

lyric gyro
#

so I came here asking what de code doin

#

and all i understood was

#

"t is a thread"

icy shadow
#

t is a thread, yes

merry knoll
#

okay best way to explain is this

#

you are creating multiple workers

#

that do stuff on their own

#

did discord crash or was that my internet lmao

lyric gyro
#

that was me too

#

anyways

#

thats usually what a worker do

merry knoll
icy shadow
#

discord bad

lyric gyro
#

wrote on python

merry knoll
#

which is fine since as you can see the number is exclusive to one thread

granite hound
#

also how do you import a reference in intellij?

merry knoll
#

import a reference?

granite hound
#

also fawe works too right?

icy shadow
#

huh?

merry knoll
#

dependency you mean?

granite hound
#

yeah

merry knoll
#

fawe i would stay away from

granite hound
#

sorry visual studio c#

icy shadow
#

fawe has nothing to do with worldguard

#

what

merry knoll
#

it multi threads world edit

granite hound
#

i mod slime rancher

merry knoll
#

without giving any flying fucks about thread safety

granite hound
#

ok ill just use normal worldedit for making the areas

cinder forum
icy shadow
merry knoll
lyric gyro
#

what is t.start btw?

merry knoll
#

it starts the worker

lyric gyro
#

and why is our variable t in the middle of it?

merry knoll
#

you are telling the worker go start working

lyric gyro
#

variable no

#

i mean thread

lyric gyro
merry knoll
#

yes

granite hound
#

i think to start the specific worker?

merry knoll
#

threads are simple when they are contained

lyric gyro
#

and why is t

#

in the middle of it

merry knoll
#

issues start happening when they have to interact with objects

#

between each other

lyric gyro
#

so they work separately?

#

if they interact with eachother

#

something goes wrong

icy shadow
#

bro weve said about 10 times that they DONT interact with each other

lyric gyro
#

oh

#

ok

icy shadow
#

they are all completely separate "processes" in this case

merry knoll
#

basically you give the thread a runnable (aka a task)

#

and it runs it

granite hound
#

also i have this event ArrowTrapEvent = me.gielhauglustaine.deathrun.ArrowTrapEvent; for this Bukkit.getPluginManager().callEvent(ArrowTrapEvent);

merry knoll
#

i think i have to give you an actual use case

#

so you get why they are used

#

lets say you have a game and that game needs to get data from the web or a database

lyric gyro
#

i still dont understand why is t there

#

did yall explain why

icy shadow
#

do you understand oop?

lyric gyro
#

what the fuck is an oop

icy shadow
#

that's a no lol

#

object oriented programming

granite hound
#

object oriented programming

lyric gyro
#

oh

#

yes

#

well

icy shadow
#

you should get a grip with that before even attempting thread stuff

merry knoll
lyric gyro
#

Im learning java

icy shadow
#

yeah

#

threads are very late-game

lyric gyro
#

of course

icy shadow
#

you really dont need to worry about that shit rn

lyric gyro
#

I know the basics of java

#

dont worry dude

#

I know the basics of java

merry knoll
#

if you dont know what "oop" stands for

#

trust me you dont

icy shadow
#

event ArrowTrapEvent = me.gielhauglustaine.deathrun.ArrowTrapEvent;
I can't think of a way this is valid code

granite hound
#

yeah intellisense said i needed to do that

lyric gyro
#

Object oriented programming, means that most of the things you are going to do revolve about objects you create and then run. Is this correct or im stupid

icy shadow
#

i highly doubt that

merry knoll
#

they made it confusing for you

#

since they combined runnable with the thread

#

a thread takes a runnable and runs it

#

your runnable class has the thread thats running it

#

as a field

#

thats it

granite hound
#

well it did event ArrowTrapEvent but it has to equal something right?

lyric gyro
merry knoll
#

yes

icy shadow
#

yes

merry knoll
#

thats why we keep saying

#

you need to learn oop

icy shadow
#

and each of them has a different t

#

because they are different objects

merry knoll
#

they are different instances of theThread class

lyric gyro
icy shadow
#

it's a pretty surface-level description

#

but it's not wrong per-se

granite hound
merry knoll
#

around instances

lyric gyro
#

objects

merry knoll
#

when you use the keyword new

lyric gyro
#

right? at this point i dont even know anymore

merry knoll
#

you create a new instance