#help-development

1 messages · Page 529 of 1

young knoll
#

If a world with the given name already exists it will be loaded instead

hollow grotto
#

I realized that just now, thank you!

wise mesa
#

to be clear I have no use for this

#

it just popped into my head and I'm just curious

#

but is there a way in spigot to fake a lighting bolt

#

without packets/nms

young knoll
#

Yep

#

Iirc it’s World#strikeLightningEffect

wary mountain
#

the namespacekey for a recipe needs to be unique i suppose?

#

rn i just have it preset to something

young knoll
#

Yes

strong parcel
#

Hey, I am currently working with the EntityExplodeEvent, and I want door blocks to not explode when hit by TNT. Currently, I am looping through blockList and removing the door blocks. I confirmed with a sysOut that the blockList.remove(block) is being run for both the top and bottom of the door. When I test this with regular blocks, they are not broken. However, the door still breaks. Does anyone know why? I am guessing it has something to do with the door being a multiblock.

wet breach
#

You need to ensure the blocks it is attached to and the block below it dont get removed

strong parcel
#

🤦‍♂️

#

Thanks!

#

Lmao I completely forgot that the door needs a block below it too.

wet breach
#

Lol np easy mistake to miss

ivory sleet
#

Based

quaint mantle
#

guys how do i link my spigot with my discord account?

#

?verify

agile anvil
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

!verify Legnano

undone axleBOT
#

A private message has been sent to your SpigotMC.org account for verification!

quaint mantle
#

?paste

undone axleBOT
maiden thicket
#

i'm trying to make something like mineplex's turf wars but i don't know a simple way to do this without just using multiple signs to set rows
(not my map)
basically i'm trying to figure out an efficient way so when a player kills someone on the other team, each row changes to the killer team's color one by one until all rows are done
what i was trying originally is setting a sign on the sides of each row and having it just get every connected block in a certain direction but that seemed way too complicated than it should be
i feel there is a better way to do this but no idea

quaint mantle
#

I am trying to make a plugin called: "anti-grief". With this plugin you have possibility to do some commands:

/anti-grief : this command gives you the list of all the commands of this plug.in

/ag claim [Name] : this command gives you the possibility to claim a minecraft chunk, and save it with [Name] i.e. to name that chunk as you want. In this chunk it is possible to destroy blocks, but as soon as someone destroys a block inside on these chunks, an admin (with op permissions) you are notified with a message and with [Name] where the block was destroyed.

/ag delete [Name] : this command gives you the ability to delete a chunk already saved with [Name].

/ag list : gives you the list of all the chunks saved with the [Name] list.

can you tell me if this script is sufficent?

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

agile anvil
#

I'd go for a method where you set the middle location of the map, and a direction axe for the map (like the y direction, with +y for blue and - y for red). Each time a kill happens, move the y middle and replace each clay block Ith the correct color (maybe you could set the range from the middle to replace block (on the x axis) to avoid having to check connected blocks

agile anvil
maiden thicket
#

i see what you mean, that could possibly work actually, if i had bounds yeah but i also wouldn't know then how many rows are left before the other team wins

agile anvil
maiden thicket
#

well it could change but for now it's fixed

#

i could hypothetically just specify how many rows to win

agile anvil
#

This is the parameters you need :

  • middle location
  • team axe
  • bound of the "playing" map (where the color can change
quaint mantle
agile anvil
#

Otherwise you could try to build, under the map, a pattern easily recognized by your plugin (for instance put sponge blocks in the direction of both teams, and while you change row and stay on the sponge columns, the game could continue)

agile anvil
#

By map I mean java map, not the Minecraft map

smoky anchor
#

I would go for PDC in the chunk instead of saving the data yourself

#

less headache, just let Spigot handle most of the work

quaint mantle
agile anvil
#

?pdc

agile anvil
#

PDC could even replace your map

#

Steve is totally right I'd go for that too

chrome beacon
#

?morepdc

undone axleBOT
quaint mantle
#

okay thanks, will probably try it in the afternoon. Will keep you updated on how it went

tacit drift
#

maybe you find something useful in there

echo basalt
#

Then pre-map the game map to see what blocks will be changed

#

Something like

echo basalt
#

Basically just

#

you have 2 teams

#

you can use a number to keep score

#

if it's positive, team 1 is winning by whatever

#

if it's negative, team 1 is losing by whatever

agile anvil
#

(if your map is large, could be useful)

fossil wraith
#

Anyone knows hoe to get custom Anvil GUI's text in some way?
Need Help

smoky anchor
#

I think using this library is your best bet

fossil wraith
molten hearth
#

has anyone gotten JavaFX to work before from IntelliJ? every time I use javafx:run its throwing Unrecognized option: --module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. for me even tho its using java 11

smoky anchor
#

Do you need JavaFX for a spigot plugin ?

molten hearth
#

no lol

#

im just wondering if anyone got this shit to work 💀

#

I dont think so, I cloned a repo on github

#

(its a uni project template)

#

does intellij do smth special if I make a template?

smoky anchor
#

I think you need some special JDK no ?

molten hearth
#

it was a bit of a pain to get javafx shit to import but it is what it is

smoky anchor
#

oh ye, there are two ways, misread the docs

molten hearth
#

im being trolled on god

#

now I need to download javafx compatible with 20

#

aaah

#

ill give it a try and check in a sec

#
[INFO] --- javafx-maven-plugin:0.0.8:run (default-cli) @ rpg ---
Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.```
#

with java 20

#

does javafx-maven-plugin just do its own thing and use the default java version or something

#

oh you dont want to know

#

one sec

agile anvil
#

Using gradle for JavaFX is a pain since you can't shade JavaFX in your final jar

molten hearth
#
C:\Users\paradise\.jdks\openjdk-20.0.1-1\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Users\paradise\rpg-team-water -Djansi.passthrough=true "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\lib\idea_rt.jar=65112:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2023.1 org.openjfx:javafx-maven-plugin:0.0.8:run
sullen marlin
#

What does the maven plugin do

molten hearth
agile anvil
#

Easiest way: using a JavaFX jdk

but you can also use a gradle plugin (running is easy, creating jar is almost impossible)

molten hearth
#

wait which jdk do I need then 😭

#

javafx makes their own jdks?

agile anvil
#

No

#

But some jdk includes javafx

molten hearth
#

ohh

#

ill try azul ig

agile anvil
molten hearth
#

maven 4 it looks like

#

i only really fucked with the java version in the pom everything else was cloned

#

it could have something 5 decades behind for all I know

#

and no my javafx plugin is 0.0.8

#

i mean their github readme has 0.0.8 i didnt even know 0.0.9 existed

hybrid spoke
molten hearth
#

azul threw the same error

#

about not supporting ``--module-path`

molten hearth
agile anvil
molten hearth
#

yeah

hybrid spoke
#

and what even is that pom

molten hearth
#

it always throws the same fuckin error no matter what version I use

agile anvil
#

You should try to run normally without that plugin

hybrid spoke
#

you dont need any special shit to do stuff with javafx

molten hearth
#

i have a feeling its not even using the right java version and the plugin is just using my local java version

#

but idk how to test that theory

molten hearth
#

because everything above java 9 supports module-path

eternal oxide
#

What are you doing which requires javafx?

molten hearth
eternal oxide
#

ah bummer

molten hearth
#

tell me about it

#
[INFO] --- javafx-maven-plugin:0.0.8:run (default-cli) @ rpg ---
Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[ERROR] Command execution failed.``` corretto failed too
hybrid spoke
#

remove that plugin

hybrid spoke
#

dont code for a specific jdk

molten hearth
#

alright ill give it a try

#

alright

#

using the run feature says the javafx components are missing but im assuming thats because idk its not packaged or sumthin

agile anvil
#

Right

molten hearth
#

meanwhile im downloading java 20

#

fuck I downloaded an outdated java 20

agile anvil
#

This is not required

molten hearth
#

Error: JavaFX runtime components are missing, and are required to run this application

#

SUIIIIIIII

agile anvil
#

JavaFX is not embedded in Java since java 8 or 7 iirc

molten hearth
#

where did my javafx components go lmao

agile anvil
#

You have to package the jfx components in your program

#

Or at least add them in the module path

#

If you want to quickly develop for now, just download a JavaFX JDK and run your app with it!

molten hearth
#

ah yes

#

the javafx components are clearly missing

#

(they are clearly right there and they're packaged with the app)

#

or is there other components only in JDKs

agile anvil
#

Mmhh

#

How do you run your app again?

molten hearth
#

well this time I did C:\Users\paradise\.jdks\corretto-20.0.1\bin\java.exe -jar .\RPG.jar

hybrid spoke
#

just run your main

#

that should work too

molten hearth
#

when I ran my main with intellij it threw the same error

hybrid spoke
#

what sdk are you using for the project

molten hearth
#
C:\Users\paradise\.jdks\openjdk-20.0.1-1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\lib\idea_rt.jar=50574:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\paradise\rpg-team-water\target\classes;C:\Users\paradise\.m2\repository\org\openjfx\javafx-controls\17.0.1\javafx-controls-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-controls\17.0.1\javafx-controls-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-graphics\17.0.1\javafx-graphics-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-graphics\17.0.1\javafx-graphics-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-base\17.0.1\javafx-base-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-base\17.0.1\javafx-base-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-fxml\17.0.1\javafx-fxml-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-fxml\17.0.1\javafx-fxml-17.0.1-win.jar rpg.RPG
hybrid spoke
#

click on it and press f4

molten hearth
#

idk f4 iddnt do anything lol

#

im using corretto-20 tho

hybrid spoke
#

then right click and project settings

#

ah "module settings"

molten hearth
#

oh shit i had openjdk and not corretto

#

das weird

#

anyway

#

one sec

#

that didnt help

#

X-X

hybrid spoke
#

go to project on the left

#

is there corretto too

molten hearth
hybrid spoke
#

then no idea

#

reloaded maven? invalidate caches? otherwise ask google or gpt

molten hearth
#

😭

#

I noticed they make a custom run configurariton

#

configuration*

#

but

#

didnt work so well for me

#

it doesnt even work if I make a new project with the javafx template

#

sick

#

oh I see

#

the maven plugin doesnt work at all

#

the run button does

quaint mantle
#

How to create npc in minecraft 1.16.5?

smoky anchor
#

Unless you want to use NMS and packets then the Citizens plugin has API

livid hearth
#

can someone help me i just started coding

#

i wanna create a plugin

#

for a shop

eternal oxide
#

Do you know Java?

livid hearth
#

not so much

#

very little

smoky anchor
#

Do you need to create it yourself ?
I am sure there exists a lot of plugins for shops.

eternal oxide
#

?basics

undone axleBOT
livid hearth
eternal oxide
#

you NEED basic Java knowledge, then follow a tutorial ^

livid hearth
#

alright

tall saffron
#

Ik is kinda lazy, but how can i easily add some random names, or "players" so i can test the paginated menu i did, java // Get the list of online players List<Player> onlinePlayers = new ArrayList<>(); onlinePlayers.add(player);

wet breach
#

not sure what you mean

#

but you could just not use a player object for testing purposes

#

or better yet, use OfflinePlayer instead

#

since you can still fetch player names with that

tall saffron
#

Oh yeah thanks

wise mesa
#

They can be

#

It’s up to the jre

#

Oops my messages didn’t load

#

Idk why I’m replying to someone from yesterday

quaint mantle
#

hi guys i have a question for coding syntax
example:
players have a combat level and i wanna give extra damage per level
can i do this like this ?

if (playerlevel > 1) {
   add extra damage 1
}
else if (playerlevel > 2) {
   add extra damage 2
}
else if (playerlevel > 3) {
   add extra damage 3
}```
?
#

or can i do this better ?

smoky anchor
#

Are you talking Java ?

quaint mantle
#

actually not java i just wonder syntax

smoky anchor
#

ye, different languages have different syntax

quaint mantle
smoky anchor
#

but if the playerlevel is an integer you'd want to add the integer to the damage
If you have max level of 50 for example, you're not gonna create 50 cases for if.

tardy delta
#

if its bigger than 1, it might be bigger than 2 too

quaint mantle
fleet badger
#

That will not fix it

quaint mantle
#

yes

#

i think now

#

but i understand

#

so can i do this with "if"

#

so my syntax example is true for do this at programming ?

smoky anchor
#

you can but please don't
There are better ways to do whatever you're doing

quaint mantle
#

i just wonder the syntax

#

im new at coding and i wonder this

#

and i thought i could do it with "if"

#

but since im new i wanted to know if there is any other method

fleet badger
#

A better approach would be
event.setdamage(event.getdamage() + player lvl)

#

Without using if

quaint mantle
#

i wanna prevent xp pickup event
can i do this with InventoryPickupEvent ?

#

EntityPickupItemEvent

hybrid spoke
#

alternative: listen to xp change and set it to 0 or when an xp orb is spawned set their amount to 0

quaint mantle
#
    public void getXp(PlayerExpChangeEvent e) {
        Player player = e.getPlayer();
        if (player.getLevel() > 30) {
            player.setExp(1507);
        }
    }```
hybrid spoke
#

yes, but cancel the event instead of re-setting the exp to a fixed amount

quaint mantle
#

if i do with this event players can still pickup orbs

heavy mural
#

Is there a way to prevent a tnt minecart from being ignited by another Explosion?

quaint mantle
hybrid spoke
#

yeah no shit sherlock, but they gain no exp from it

quaint mantle
#

for this event

hybrid spoke
#

otherwise some explosion event

quaint mantle
#

BlockIgniteEvent

hybrid spoke
#

^ that could do it

quaint mantle
#
    public void ignite(BlockIgniteEvent e) {
        Block block = e.getBlock();
        if (block.getType() == Material.TNT_MINECART) {
            e.setCancelled(true);
        }```
quaint mantle
#

what can i do for setCancelled ?

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

quaint mantle
#

😄 alright

hybrid spoke
#

newbie spoonfed by a newbie

heavy mural
hybrid spoke
#

but not that he picks up the orb

#

you could also cancel that the orb targets the player

#

but they can still walk over it and pick it up

quaint mantle
#

maybe this fix

quaint mantle
#

ah

#

thanks

heavy mural
#

I can exempt a tnt Minecart from being affected by an explosion, but I can not prevent it from being affected by the ignition caused by that explosion

And BlockIgnite event does not seem to include entities like a tnt minecart (as far as I tested)

quaint mantle
#

EntityExplodeEvent

#

ah this prevents explode

quaint mantle
#

i look at for entityburnevent can't find

heavy mural
#

EntitycombustEvent does not count the ignition by Explosion of a TNT minecart as a combust event

#

Sadly :(

#

It does trigger on when I ignite the tnt minecart with a flame bow

quaint mantle
#

EntityBlockFormEvent

heavy mural
#

What block would be created?

quaint mantle
heavy mural
#

Could you explain what you mean by fns?

hybrid spoke
#

otherwise try EntityDamageByEntityEvent or rather EntityDamageEvent and check the cause

heavy mural
#

I'll do some more testing

heavy mural
eternal oxide
#

?jd-s

undone axleBOT
native ruin
#

how can you send a packet to a users client?

chrome beacon
#

Use NMS or Protocollib

heavy mural
#

It doesn't seem to have a "cause" element :o

native ruin
chrome beacon
#

Well you can

#

It does depend on the version on how to do it though

native ruin
#

i want to use this .getHandle().connection.send(); but send does not accept a packetcontainer

chrome beacon
#

and what version

native ruin
#

protocollib 5.0.0 and 1.19.4

chrome beacon
#

Use Protocollib to send the packet

#

Not nms

native ruin
#

so how would i do that?

chrome beacon
#

Read the README

native ruin
#

wouldn't that send it to the server?

hybrid spoke
#

read

hybrid spoke
#

whats a packet

lavish cliff
#

Hi guys , i have created some events for my cosmetic but nothing work...
Someone can help me with that? :))?

    public void onSwapHandItems(PlayerSwapHandItemsEvent event) {
        ItemStack item = event.getOffHandItem();
        if (item != null && item.hasItemMeta()) {
            ItemMeta itemMeta = item.getItemMeta();
            if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
                event.setCancelled(true);
            }
        }
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        ItemStack item = event.getCurrentItem();
        if (item != null && item.hasItemMeta()) {
            ItemMeta itemMeta = item.getItemMeta();
            if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
                event.setCancelled(true);
            }
        }
    }

    @EventHandler
    public void onPlayerDropItem(PlayerDropItemEvent event) {
        ItemStack item = event.getItemDrop().getItemStack();
        if (item != null && item.hasItemMeta()) {
            ItemMeta itemMeta = item.getItemMeta();
            if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
                event.setCancelled(true);
            }
        }
    }
}```java
smoky anchor
#

put "java" at the end of the first ```
so it is colored
```java
code
```

smoky anchor
undone axleBOT
undone axleBOT
#

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

smoky anchor
lavish cliff
smoky anchor
lavish cliff
smoky anchor
#

Then the only thing I can think of is the display name not being the same

lavish cliff
hybrid spoke
#

tried to print out a message at the beginning

lavish cliff
#

ITEM:

    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
        Player p = (Player) sender;
        ItemStack item = new ItemStack(Material.PAPER);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"));
        meta.setCustomModelData(15);
        item.setItemMeta(meta);

        p.getInventory().setItemInOffHand(item);
        return false;
    }
}
lavish cliff
smoky anchor
#

Isn't using ChatColor.### better then the magic numbers in strings ?

lavish cliff
#

so i will try with normal chat color?

hybrid spoke
#

people prefer it over color codes because of anxiety disorders that the codes could one day vanish

smoky anchor
smoky anchor
hybrid spoke
#

compare items by #isSimilar

hybrid spoke
#

for that you have ender crystal

lavish cliff
smoky anchor
#

Then you don't register the events

hybrid spoke
lavish cliff
smoky anchor
#

The class has to implement the Listener interface

Bukkit.getPluginManager().registerEvents(new Events(), plugin);
lavish cliff
#

ye ik

smoky anchor
#

send the method where this is

hybrid spoke
#

ender crystal meth

lavish cliff
smoky anchor
#

what do you mean by "string"

smoky anchor
#

Send the stuff around as well

lavish cliff
#

**LanternItemListener **

smoky anchor
#

There is no

Bukkit.getPluginManager().registerEvents(..., plugin);

I would expect one to be in onEnable() method

lavish cliff
#

but the events/placeholder work

#

so i don't think it's the problem

smoky anchor
#

You literally have to register all events in this way, or they will not work

#

Just replace the
new LanternItemListener();
with
Bukkit.getPluginManager().registerEvents(new LanternItemListener(), this);
That should work

lavish cliff
#

ok i will try

#

oh yeah now work

#

sorry

#

last question

#

name of the event block the item swap Offhand to mainhand(?)

smoky anchor
#

ye, sorry, I don't think I understand your question

#

Or I might but I am not sure

#

If you want to prevent swapping the item from mainhand -> offhand and offhand -> mainhand you would use the same event
Just check for a different item

lavish cliff
#

then, I blocked the player could: move the item from the main hand to the left hand but I would also do the opposite.
How can I do that?

smoky anchor
#

You're checking only the offhand item
Now check the mainhand item

#

in the onSwapHandItems method you have

lavish cliff
#

oh ok thanks steve 🙂

opal carbon
#

Couple questions about the forward bungeecord messages

#

#1: With the forwarding done with Forward, the subchannel name is completely set to the subchannel name you specify on the receiving server, it doesn't say "Forward" or anything of the sort. Is that normal? (Assuming it is, just wanted to double check)

#

#2: How the hell does bungeecord ForwardToPlayer work? Does it send a message to the client on the bungeecord channel? How does the response know to go to the server that originally sent the message? Can clients even respond to ForwardToPlayer?

#

Trying to make a sort of wrapper so I never have to touch this again, but wanted to make sure the first thing was expected behavior and actually properly implementing ForwardToPlayer would be nice. (right now i just detect unknown subchannels and set those all to be a incoming forward message)

peak jetty
#

So I have these 2 commands, the /daily works but /store does not, it seems not to get called as I can't see any of the logs I made:

@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        // Daily Command
        if(cmd.getName().equalsIgnoreCase("daily")) {
            if(sender instanceof Player) {
                Player p = ((Player) sender).getPlayer();
                UUID uuid = ((Player) sender).getUniqueId();
                LocalDateTime localDateTime = PlutoAddon.commandCooldown.get(uuid);
                if(localDateTime == null) {
                    PlutoAddon.commandCooldown.put(uuid, LocalDateTime.now());
                    // Reward
                    getServer().dispatchCommand(Bukkit.getConsoleSender(), "crate key give " + p.getName() + " daily 1");
                }
                else if(localDateTime.isBefore(LocalDateTime.now().minusHours(24))) {
                    PlutoAddon.commandCooldown.put(uuid, LocalDateTime.now());
                    // Reward
                    getServer().dispatchCommand(Bukkit.getConsoleSender(), "crate key give " + p.getName() + " daily 1");
                }
                else {
                    p.sendMessage(ChatColor.RED + "You can only use this once a day! Come back tomorrow :)");
                }
            }
            return true;
            // Store Command
        } else if(cmd.getName().equalsIgnoreCase("store")) {
            getLogger().info("/store done");
            if(sender instanceof Player) {
                getLogger().info("was a player");
                Player p = ((Player) sender).getPlayer();
                p.sendMessage("Grab some " + ChatColor.GREEN + "ranks " + ChatColor.RESET + "and " + ChatColor.GREEN + "crates " + ChatColor.RESET + "at » " + ChatColor.AQUA + "store.plutocraft.net");
            }
            return true;
        }
        return false;
    }
smoky anchor
#

show us how/where you're registering them

quaint mantle
#

idu

#

ismy code wrong ?

#
    @EventHandler
    public void getXp(PlayerExpChangeEvent e) {
        Player player = e.getPlayer();
        if (player.getLevel() > 29){
            player.setTotalExperience(1506);
        }
    }```
#

this not working

#

no errors

peak jetty
opal carbon
quaint mantle
#

yes

opal carbon
smoky anchor
opal carbon
quaint mantle
#

already i try setlvl
this works

peak jetty
# smoky anchor yes
name: PlutoAddon
version: '${project.version}'
main: net.plutocraft.plutoaddon.PlutoAddon
api-version: 1.19
authors: [Gizmo0o]
description: Simple addon plugin for PlutoCraft.
website: plutocraft.net
commands:
  daily:
    description: The /daily command.
    usage: /daily
    permission: plutoaddon.daily
    permission-message: You don't have plutoaddon.daily
  store:
    description: The /store command.
    permission: plutoaddon.store
    permission-message: You don't have plutoaddon.store
smoky anchor
#

in the code

quaint mantle
peak jetty
smoky anchor
opal carbon
#

does getCommand().setExecutor() or smthn like that ring a bell

peak jetty
quaint mantle
#

not worked

#

only getlevel and set lvl working

#

idk

smoky anchor
quaint mantle
#

and i can't cancel the event in this event

quaint mantle
#

to class ?

peak jetty
quaint mantle
#

ah

#

u mean like this ?

#

wait

smoky anchor
#

to see what values the getXp() and getTotalXp() have

#

It might give you a hint why it is "not working"

tardy delta
#

lets have some private fun 😏

pseudo hazel
#

nah, i am all about that protected fun 😳

opal carbon
#

Couple questions about the forward bungeecord messages
#1: With the forwarding done with Forward, the subchannel name is completely set to the subchannel name you specify on the receiving server, it doesn't say "Forward" or anything of the sort. Is that normal? (Assuming it is, just wanted to double check)
#2: How the hell does bungeecord ForwardToPlayer work? Does it send a message to the client on the bungeecord channel? How does the response know to go to the server that originally sent the message? Can clients even respond to ForwardToPlayer?
Trying to make a sort of wrapper so I never have to touch this again, but wanted to make sure the first thing was expected behavior and actually properly implementing ForwardToPlayer would be nice. (right now i just detect unknown subchannels and set those all to be a incoming forward message)

#

sorry just resending it all in 1 message so i can make thread

heavy mural
#

I made vehicles indestructible by tnt, however they do still get pushed away due to the explosion, I have tried setting Velocity to 0, 0, 0
But it seems like it doesn't apply. Might it be applied too early or am I interpreting Velocity wrong?

brave sparrow
#

Applied too early

#

More than likely

heavy mural
#

By how many ticks should I delay? I've tried both 1 and 5 ticks delay with scheduler, didn't hit the mark.

brave sparrow
#

1 should do it

peak jetty
#

does anyone know how to make my pluigin command overide a command from another plugin?
i want to make a /discord command but essentialsx discord already has that, since (as far as i know) there is no way to disable the essentialx discord commands in a config.yml file i want to overide it

heavy mural
#

I'll retry then :)

#

just to be sure this should be the code for the scheduler right?

Bukkit.getScheduler().runTaskLater(this, () -> {
    event.getVehicle().setVelocity(new Vector(0, 0, 0));
}, 1);```
bleak fern
#

Does the SpigotMC website have some sort of REST api?

native ruin
opal carbon
bleak fern
#

I appreciate it, thank you.

native ruin
opal carbon
#

Im pretty sure first plugin to register wins

#

so you could put loadbefore in your plugin.yml

eternal oxide
#

with commands it's last to register gets it

#

but they all get a plugin:command

mortal hare
#

hmmm

#

i have one hell of an idea

#

but i wouldnt implement it by myself, since i dont have experience in modifying spigot code

#

so basically you guys know that in order to do some pathfinding from A, C you usually use Djikstra's or A* algorithm, right

#

what if you can vectorize that algorithm by creating a a shared library in C/C++ that would implement Java Native interface and calculate the pathfinding data via SIMD operations and return it back with java's declared native function?

#

imo it could drastically improve performance of the server

#

since SIMD operations on java are not really properly supported yet

#

pseudo micro code:
in java

public native int[] djikstra(parameters);

in .dll file (c)

some_jni_object __java_jni_generated__signature__function(parameters) {
  //do some some SIMD instrinsic stuff on 
}
#

ofc it would lose cross compatibility of the server

#

because code is not run on JVM partially (separate .dlls and .so files could be bundled for *nix and windows to run, tho)

#

but it could boost the performance of ticking pathfindable entities i think

#

what you guys think?

tardy delta
#

then using simd

#

could give it a try id say

#

look what performance says

quiet ice
#

Question is whether it has any large improvements over actually using java

#

You'll have quite a lot of overhead from converting java <-> native

river oracle
#

Make it bannable

#

Hsve your mods teleport to players and ban afk pool usere every so often

#

Ahhh

#

Well, something with player move event in water

#

Check for patterning

#

If a certain pattern repeats to much send a warning out to staff

smoky anchor
#

I think checking for incoming movement packets would work
If no packet was received but the player is constantly moving -> afk pool

river oracle
#

That's my thought

subtle folio
#

like water spreading?

#

or a player swimming in water..?

river oracle
subtle folio
#

yes

river oracle
#

So ideally water wouldn't flow or anything

subtle folio
#

That won't trigger player move event

river oracle
#

Difficult

subtle folio
#

??

#

It doesn't

river oracle
#

Yes idk how to do that then

#

Loop through all players???

#

Or make list that haven't moved in x amount of time

#

Check through them then restartb

subtle folio
#

are AFK pools only in one spot

#

you could check a region

river oracle
#

Seems like that could be faulty so easily

#

What abt players who are just happen to be moving in a square in water

#

They'd get insta kicked you'd need to ensure repetition also as NTDI said water moving player doesn't trigger PlayerMoveEvent

smoky anchor
#

Best solution: build several afk pools
Have players AFK in them
Train an AI on the incoming packets

river oracle
#

Lol now that's innovative

#

Train the AI in c and use jni too

#

Performance go brrrrr

smoky anchor
#

Isn't there a successor to JNI now ?

river oracle
#

Not in jdk yet

#

Afaik

smoky anchor
#

JEP 442 I think
It is in second preview for java 20

flat lark
#

Is there any good scoreboard apis or apis in general that are good with plugin development.

river oracle
#

FastBoard is my personal fav

#

Don't tell nd

#

Md

#

It uses packets shhhh

flat lark
#

It seems like its a config based thing. Im looking for like an api to create custom scoreboards.

smoky anchor
#

Don't know where you're getting that from
Seems pretty API to me
Md, don't look

river oracle
#

Not config thing at all

smoky anchor
river oracle
smoky anchor
#

yep, not the last episode tho
Have not had time, will do today
pls no spoilers 🙂

river oracle
#

I'm not caught up

#

I think it's kinda meh compared to main series but not much to expect from a spin off show

mortal hare
#

there should be some overhead as it needs to be passed to jvm somehow

flat lark
#

It seems okay.

mortal hare
#

but the question is it of how bad the overhead is

river oracle
#

Measure et

mortal hare
#

easier said than done

quiet ice
#

Overhead of ordinary JNI is pretty high from what I know, hence Project Panama exists

#

Well pretty high is probably relative but it means that there is a overhead that could be lower

wise mesa
#

We’ll if we’re talking about project panama

#

Why even use the new foreign function interface

#

Why not use the vector api directly

tardy delta
smoky anchor
#

it's not my code
It's from the fricking github readme :D

tardy delta
#

ew

smoky anchor
#

make a PR to fix it if you can XD

tardy delta
#

would be grateful to clean up someones code

#

but not today

worldly ingot
quaint mantle
#

what does it tell?

#

between 0.0 and 1.0

#

this isnt set player xp ?

#

alright i will try

weak meteor
#

ur puting on 110

#

0 < 110 > 1?

#

!!

quaint mantle
#

i will show 1m

#

i got this from minecraft wiki

#

and i think setxp for current level
totalxp is player totalxp

round finch
thorny dawn
#

someone help me with components, what is the proper way to create a textcomponent?

#

when creating a scoreboard, i am required to provide a component as per the new changes i assume. what should i pass in as the parameter? for titles

thorny dawn
#

yea

#

oh

#

i didnt know it was different there

#

sheet

pseudo hazel
#

stickers are amazing

quiet ice
#

Given that mostly the same logic applies to both paper and bukkit/spigot plugins there is no reason for additional documentation

quiet ice
#

<insert generic geolykt rambling here>

tardy delta
#

finally something working

zinc lintel
#

Can anyone tell me how i update my plugin version from 1.19.3 to 1.19.4 in maven?

#

or add multiple versions

#

but then i get an error that says that it can't be found

#

so this need to be changed just to 1.19.4 right?

quaint mantle
#

hello gus i found a one skill plugin and look,
but i can't find player datas(imean playerlvl,player skillpoints) in file
how they did this ?

zinc lintel
#

it gives me this after the reload

#

wdym?

#

so yours and mine need to match right?

#

didn't work

hard socket
#

how do I change the jdk version?

quaint mantle
#

how can i store my datas (example player-coin)
if can i do this with arraylist when server restart is datas lost ?

tardy delta
zinc lintel
quaint mantle
#

how can i fix this ?
store datas to file

#

ty ill check

hard socket
#

I installed 17 last

tardy delta
#

you have 17 but only 16 is supported, weird

#

anyways if you have it installed just go to the systems environment variables and make sure the path to java 16 is higher than the other java versions so it gets priority

#

go look in Path

hard socket
#

alr

#

thx

hard socket
#

1.8.9 server is starting but not 1.16

wary mountain
hard socket
#

yes

#

server is not starting

wary mountain
#

oh

#

use java 1.8

#

that should fix it

#

flicking 💀

hard socket
#

java 1.8 for 1.16 server?!

wary mountain
#

AYO WOT

wary mountain
tardy delta
#

its weird

hard socket
#

that will not work bruh

wary mountain
#

ikr why would he want to flick me

#

thats gay

remote swallow
wary mountain
#

idk man

hard socket
#

I mean java 16

remote swallow
#

You move it higher in path, or you specify the direct paty to j16 java.exe

wary mountain
#

mb

tardy delta
#

show path variable

wary mountain
#

💀

heavy mural
#
 @EventHandler
  public void onVehicleHit(VehicleDamageEvent event) {
event.getVehicle().getWorld().playEffect(event.getVehicle().getLocation(), Effect.MOBSPAWNER_FLAMES, 0);
        Bukkit.getScheduler().runTaskLater(this, () -> {
          event.getVehicle().setVelocity(new Vector(0, 0, 0));
        }, 1);
        event.setCancelled(true);
}

If a TNT explodes next to this vehicle it prevents the vehicle from being destroyed, but still moves. I thought my Vector approach would remove the movement the explosion provides.
Am I doing something wrong?

hard socket
tardy delta
#

uhh it needs to point to /bin i believe

#

so it finds java.exe which is the jvm executable

hard socket
#

oh yh will try that

#

it worked tysm ❤️

wary mountain
#

whats the most broad/super spigot on event I can use for event listener

#

theres no "Event" one

sullen marlin
#

?xy

undone axleBOT
hazy parrot
#

?jd you can also easy check javadocs for that info

sullen marlin
#

There's no mega broad events

young knoll
#

You can't listen to any of the abstract events

hazy parrot
#

i think he is refering for base class which all events inherit

onyx fjord
#

what event is used when sugarcane breaks because of a different block being placed?

young knoll
#

And we don't have an EventEvent (yet)

onyx fjord
sullen marlin
young knoll
#

It's events all the way down

wise mesa
#

how can I use a completablefuture with the scheduler

sullen marlin
#

CallSyncMethod returns something

young knoll
#

However the ItemSpawnEvent will not have the block

wise mesa
#

but I'd like to use the runTaskAsynchronously function

#

not that it matters that much

onyx fjord
sullen marlin
#

There's no async futures in the api

onyx fjord
#

oh Item nvm

wise mesa
#

but i think that uses a threadpool or something idk

#

my internet is lagging so much holy shit

#

can I make a future run synchronously

#

and just do runTaskAsynchronously and then pass in a runnable where I run the future

young knoll
#

Futures use a thread pool by default

wise mesa
#

oh

#

okay

young knoll
#

All async methods without an explicit Executor argument are performed using the ForkJoinPool.commonPool()

wise mesa
#

alright that's chill

sullen marlin
#

But yes, a pool

#

Oh

#

You mean java methods

young knoll
#

ye

sullen marlin
#

Carry on then

wise mesa
#

so can I just do ForkJoinPool.commonPool().submit() to make a task

#

or a future or whatever

#

nvm ill just google it

wary mountain
#

but i dont think i can listen to those

#

i might just have to put a ton of different event listener functions which would be ugly but oh well 🤷‍♂️

sullen marlin
#

?xy

undone axleBOT
sullen marlin
#

What are you trying to do

wary mountain
#

do you want a generic answer or technical

sullen marlin
#

Just give an answer please lol

tardy delta
sullen marlin
wary mountain
#

ig in general make an items interface with event cancelling lib

tardy delta
#

ah i cant read

sullen marlin
#

Ok, and how is cancelling every event going to help that

wary mountain
#

not every?

sullen marlin
#

Well presumably you have per event code then

wary mountain
#

on the event the interfaces doAction function is called

#

and whatever is in there based on which instance/what class does whatever is set in there

#

for example

#

one that cancels fire tick and fire damage

sullen marlin
#

And why can't doAction be generic with the event type you are concerned with

#

doAction(EntityDamageEvent)

#

Then you don't need to cast either

wary mountain
#

oh you mean for that one instance?

sullen marlin
#

Yes, generics allow you to specialise the overrides in each subclass

#

FireResItem<EntityDamageEvent>

wise mesa
#

okay so I use completablefuture.supplyasync

sullen marlin
#

Or rather, FireResItem extends Item<EntityDamageEvent>

wise mesa
#

and then I use thenAccept on that?

#

is there a thenSupply in case I want to keep chaining returns?

wary mountain
#

but back to the actual question with connecting it to event listeners

wise mesa
#

what's the difference between then accept and then run

#

and then apply

sullen marlin
#

Add another method that returns Class<T> and hook it up to the non-annotation registerListener methods

wise mesa
#

just gonna look at javadoc

#

I'm very confused

sullen marlin
#

Consumer is terminal (void), function returns for chaining presumably

wise mesa
#

ohhhhhh

#

that makes a lot of sense

#

thank you

#

I don't know how I wasn't able to comprehend that

wary mountain
wise mesa
#

it's coming together

wary mountain
wise mesa
#

ignore the 1 related problem lmao

opal carbon
#

what are you even doing lol

heavy mural
#
 @EventHandler
  public void onVehicleHit(VehicleDamageEvent event) {
event.getVehicle().getWorld().playEffect(event.getVehicle().getLocation(), Effect.MOBSPAWNER_FLAMES, 0);

        Bukkit.getScheduler().runTaskLater(this, () -> {
          event.getVehicle().setVelocity(new Vector(0, 0, 0));
        }, 1);

        event.setCancelled(true);
}

If a TNT explodes next to this vehicle it prevents the vehicle from being destroyed, but still moves. I thought my Vector approach would remove the movement the explosion provides.

What could be going wrong?

wise mesa
#

or not

#

idk it might kinda suck

#

for anyone with fawe experience, is it safe to use BukkitAdapter.adapt(world) from an async thread?

storm scaffold
#

How do I tell what kind of goat horn a goat horn is from its ItemMeta?

opal carbon
#

Maybe lore?

#

idk

young knoll
#

Huh

#

I don’t think we have api for that atm

opal carbon
#

it may be in item lore

#

otherwise you're outta luck

#

(i think)

young knoll
#

Free PR time

orchid gazelle
#

Heck I don't have time currently

#

Also, I did not know that Goat Horns even have different types lol

young knoll
#

Yep

orchid gazelle
#

Im gonna be on my pc for 1 more hour max this week

#

Just spontanously decided to drive to Italy tmrw

opal carbon
#

i distinctly remember this causing trouble while trying to make rocket spleef

#

might be wrong though

#

ok yeah i was wrong

#

your code works perfectly though

orchid gazelle
#

Why not make a cancelKnockBack() method instead?

#

And maybe default it for setCanceled but let it override it

#

Oh nvm then

opal carbon
#

the code he sent works perfectly fine for me

#

ok turns out im right about the damage cancelling meaning no kb but only in survival

#

yeah zodra ur code works magnificently on my machine idk man

#

wait no its broken but only when the boat is inside the tnt hitbox

#

thats really dumb

young knoll
#

Okay after a bit of looking we do have an API for goat horns

opal carbon
#

oh we do?

young knoll
#

MusicInstrumentMeta

opal carbon
#

ah

#

thats an incredible unintuitive name

young knoll
#

Well the NBT tag is called instrument

#

So that's what MD went with I guess

opal carbon
#

ok thats fair

#

now im mad at mojang

tender shard
#

goat horns are the best thing ever added to MC

wary mountain
#

is there any equip and unequip armor event. or even a change slot event

young knoll
#

Nope

#

But there is a library for it

wary mountain
young knoll
#

Although do note the open issue

dense geyser
#

does anyone know how to fix Invalid signature file digest for Manifest main attributes shutdown when loading my plugin? I narrowed it down to a single shaded maven dependency causing it when I shade microsoft sqlserver, when I go to run it in minecraft I get the error above. this has never happened before and I've never had an issue with this previously, I was wondering if anyone knew why it could be happening?

weak meteor
#

what

#

the

#

fuck

jagged monolith
weak meteor
#

fuck

#

Im having trouble with one of my files "messages.yml" everything i get from there is null even if the path its correct

#

so im trying to access the path and it looks good

#

but always null idk why

jagged monolith
#

Try without the translate and see if it gets it

weak meteor
#

neither

#

here im with out the translate

#

and when i use it on like 44

#

NPE throws out

wary mountain
#

it explicitly says this*

young knoll
#

Java version error

#

Class file version 61 is java 17

jagged monolith
tender shard
young knoll
#

Oh good someone who knows maven better :p

weak meteor
young knoll
#

Also smh Alex address your open issue

tender shard
#

if someone wants to fix something, they are free to pull request it :3

tender shard
# weak meteor

finally someone who knows that day comes before month when writing out dates

young knoll
#

I think there is an open PR

unique shuttle
tender shard
#

or sth like that

#

which previously was only possible if the target slot was empty

tender shard
#

plugin messages are, if it's not the bungeecord channel, meant to communicate with the client

weak meteor
#

byut

#

my byug

#

isnt

#

fixed

#

and idk what to do

#

:(

unique shuttle
#

I'm trying to send data from one server to another like the name of the arena a player should join. can it be used for that?

tender shard
tender shard
weak meteor
#

not config.yml

#

custom one

tender shard
#

you didnt declare the command in plugin.yml

unique shuttle
#

I'll try but I had the same problem. try changing the name and even using "pluginname:data" haha

tender shard
#

you didnt declare the command in plugin.yml

weak meteor
#

what does relates to config files

tender shard
#

nothing

tender shard
weak meteor
#

nono

#

look

#

idk if getConfig works

tender shard
#

send the stacktrace

#

and ?paste it pls

#

don't send pictures all the time pls

wary mountain
weak meteor
#

k

tender shard
#

including imports, etc

#

the whole files

round finch
#

perfection
project take over 😂

wary mountain
hybrid spoke
wary mountain
#

you dont NEED that

#

do you?

hybrid spoke
#

absolutely

#

also your plugin.yml is located wrong

#

thats where the exception comes from

wary mountain
#

oh

wary mountain
hybrid spoke
#

your plugin.yml belongs into resources

wary mountain
#

oh

hybrid spoke
#

for an example

#

also i doubt that api-version: 1.19.4 will work

hazy parrot
#

You can define variables in abstract classes too

weak meteor
#

yah idk

wary mountain
weak meteor
#

first time using abstract classes

wary mountain
#

i havent done plugin dev in like ages lol mb

tender shard
tender shard
tender shard
# weak meteor

is that the config included in your .jar, or the actual file in your plugins/YourPlugin/ folder?

weak meteor
#

yep

tender shard
#

?

weak meteor
#

i tried everything and nothing works

tender shard
#

if I ask "is it A, or is it B", you cannot reply with "yes", you gotta reply with "A" or "B"

weak meteor
#

ah

#

in jar

tender shard
#

and do you have a messages.yml file actually saved in your plugins/YourPlugin/ folder on the server?

#

if so, how does that one look like?

#

btw why are you creating a new "Messages" object for every command? can't you just reuse the same instance in every command?

weak meteor
tender shard
#

it just makes no sense. but yeah that files looks fine. In your onCommand() method, loop over all keys of the messages config, then show what it prints, e.g. like this:

public boolean onCommand(...) {
  for(String key : messages.getConfig().getKeys(true)) {
    Bukkit.getLogger().info(key + " -> " + messages.getConfig().get(key));
  }
  ...
}
#

how does your Messages class look like?

wary mountain
#

Not sure why but the effects here or its function atleast never seems to be called(its called)

weak meteor
#

like that

tender shard
weak meteor
#

_paste

#

?pasye

#

?paste

undone axleBOT
weak meteor
#

there

wary mountain
tender shard
weak meteor
#

oh

#

going

tender shard
wary mountain
#

look at listener base

tender shard
#

ah ok I see

unique shuttle
tender shard
tender shard
#

oh wait

#

haven't seen the Config class

weak meteor
#

I do it in main

tender shard
#

I thought you extended Configuration

weak meteor
#

nono

#

Config is mine

tender shard
#

you may load your config in main, but in the other class you create a new Messages and never load that

#

I mentioned that earlier, you should reuse your existing "Messages" object instead of creating a new one everytime

weak meteor
#

OKAY

#

so

#

may i make a new class like

#

ConfigManager

#

that has a load config method

#

and for each config

#

make like

#

getMessages()?

tender shard
#

why don't you just create a "Messages" object in your main class, and then use that for all other classes?

weak meteor
#

oh

#

well

#

thats easier

tender shard
#
public class MyMainClass extends JavaPlugin {

  private Messages messages; // also have a getter for this ofc

  // Then in onEnable, create "messages" and load it

}

then in your other classes you just do myPlugin.getMessages().getConfig().getString(...)

weak meteor
#

idk whats a getter

#

👍

#

gotta learn

tender shard
#
private Messages messages;

public Messages getMessages() {
  return messages;
}
#

a "getter" is basically just a method that returns that object

wary mountain
#

oop encapsulation

weak meteor
#

ah

#

epic

#

but like

#

Lombok has smth

#

a decorator

#

loike

#

@getter

tender shard
#

you could also just make the field public but that's a rather bad solution

tender shard
worldly ingot
#

It does have an annotation for that but please don't use it if you don't know what a getter even is lol

#

tbh don't use it at all, but yeah

tender shard
wary mountain
#

the backend implementation was uglier than it could be but i was pretty certain that wouldnt cause issues, but i guess it does and it dosent even leave any logs either

weak meteor
#

?

mortal hare
#

cool i've managed to break the ui of windows

tender shard
#

bad way:

int age = person.age;
int newAge = age +1;
person.age = newAge;

better way:

int age = person.getAge();
int newAge = age +1;
person.setAge(newAge);
#

the reason for this is simple: implementation details, such as "which value does a field have" is not supposed to leak to the outside

#

seems weird at first but it makes sense

#

imagine "person" is not actually a person, but an "Animal" which can either be a human or a cat or a dog. they can all have ages, but you cannot expose fields in an interface

#

so if now "person" becomes a "cat", you cannot just exxhange it when you access fields directly

#

or let's imagine you wanna implement a check in the setter, e.g.

public class Cat {
  private int age;
  public void setAge(int newAge) {
    if(newAge < 0) throw new IllegalArgumentExceptions("No cat can have a negative age!");
  }
}
#

not possible when accessing the field directly, you know

#

encapsulation is a subset of the idea of using contracts. you can promise that "every living thing has an age which you can access through setAge and getAge" but java doesn't support that through fields, only methods

wary mountain
tender shard
wary mountain
#

yea

tender shard
#

contracts are promises to the outside

wary mountain
#

oh all i know is encapsulation helps for security of instance variables

#

that was for an exam 💀

#

i sorta know what that means

tender shard
#

idk anything about computer science exams, I'm a tax lawyer lol

wary mountain
#

the only reason i know half of what i know is because of CS courses... and then i waste it on useless stuff like making minecraft plugins! 💀

tender shard
#

but I can for sure tell you from trial & error and experience that public fields are generally a bad idea, and it's also a bad idea to rely on implementation details, and it's also a bad idea to have redundancy, like creating the "same" (rather similar) object in every class that needs it, instead of injecting it (e.g. creating one Messages class per command, instead of having one Messages class in your main class, and reusing that)

tender shard
#

I have learnt java in school like 15 years ago. but doing MC plugins made me understand java

#

whooo

wary mountain
#

ah for everything to connect well for me, that was unity

#

though translating from csharp to java took a bit

tender shard
#

it's actually extremely similar, isn't it?

wary mountain
#

it is

#

but theres certain things that are different and weird

#

like lambdas at first

#

i thought => was normal

#

java devs just yelled at me saying microsoft ruins everything

#

lol

tender shard
#

yeah true, it took me like 2 years to properly understand what a lambda even is

river oracle
#

I only like half know what a lambda is lol

#

maybe I should read that later

wary mountain
tender shard
#

lol

wary mountain
#

oh

#

like for an action: event -> {}

#

and it triggers that code when event is invoked

#

i used it a lot when making something using swing and awt buttons

tender shard
#

oh I know what you mean. yeah callbacks, in that case, often do use the lambda syntax, but it can also be used for many other things

wary mountain
tender shard
#

e.g. a predicate

wary mountain
#

yeah

tender shard
#
Predicate<Entity> onlyCreepers = e -> e instanceof Creeper;
#

after all, a lambda is just a short way to implement functional interfaces

wary mountain
#

yea

#

also this is cool

#

but why lightmode 💀

#

jetbrains products are great though because of quality of life features like this

river oracle
#

doesn't any modern IDE have that

#

umschlat

worldly ingot
#

Yes

river oracle
#

even vscode uwu

tender shard
#

unfortunately

#

oh that reminds me, I gotta renew my ultimate subscription soon >.<

#

ofc my subscription ends during my planned stay in a psychatric clinic lmao

#

story of my life

wary mountain
#

i have jetbrains student key or whatever its called

tender shard
#

yeah education thingy

wary mountain
#

so im pretty much set for a few years

#

yeah

tender shard
#

same, but gotta renew that every year

wary mountain
#

and then i get to pay like $200 a year

#

which will be fun

tender shard
#

I finished university like 7 years ago but I'm still enrolled for all those free software lol

wary mountain
#

damn

river oracle
#

I don't even use my student subscrition

#

Idk why I renewed it

#

I've never used any of the perks

wary mountain
#

intellij only dosent seem that important, but the jetbrains pack is

#

you dont have any access to rider or clion without

river oracle
#

why would I use ride or clion lol

#

if you wanna code .Net use VisualStudio or VSC

tender shard
#

the only IJ ultimate feature I actually use sometimes is UML graphs

wary mountain