#help-development

1 messages · Page 1243 of 1

cinder abyss
#

I'm dumb, tried getting and then setting the type, thanks

mortal hare
#

how do you guys deal with situations where you have configurations/code which are identical in terms of functionality, so you decide to abstract them away under single helper function

#

but then you have to name it somehow that fits its functionality. in the end you get ridiculous name which might be too long..

feral bear
#
WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player);
        gameProfile = gameProfile.withName("GOAT : "+player.getName());
        container.getPlayerInfoDataLists().write(1, List.of(
                new PlayerInfoData(gameProfile, 0, EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()), WrappedChatComponent.fromText("GOAT : "+player.getName()))
        ));
#

this not work ;(

sly topaz
#

just name it something like SharedConfiguration or something

mortal hare
# sly topaz just name it something like SharedConfiguration or something
desktops := {
    1: [
        ; Open all file explorer windows in first virtual desktop except for legacy control panel
        {
            process: "explorer.exe",
            title: "^(?!Control Panel$).*$",
        },
        {
            process: "WindowsTerminal.exe"
        }
    ],
    2: [
        {
            process: "Vesktop.exe",
            action: (window, desktop) =>
                MoveWindowToDesktop(window, desktop)
                TryToMaximizeWindow(window)
                SwitchToDesktop(desktop)
                WinActivate(window)
        }
    ],
    3: [
        {
            process: "chrome.exe",
            action: (window, desktop) =>
                MoveWindowToDesktop(window, desktop)
                TryToMaximizeWindow(window)
                SwitchToDesktop(desktop)
                WinActivate(window)
                
        }
    ]
}

basically im making my own Autohotkey script where i can automatically position windows at specific virtual desktops. The problem as you can see, action for what to do in such case is repeating, i cant figure out what kind of name in this case should the function have. MoveActivateAndMaximizeWindowAndSwitchToDesktop?? that sounds so bad

#

my ahk script works just fine, but im thinking how to name things properly in such case where combinatorial explosion happen for specific use cases

#

(my question is language indepedent in a way, im just looking a suggestion how to deal with things like this, where combinatorial explosion makes silly names for helper code)

sly topaz
#

Move, activate and maximize

#

isn't that just focusing

#

just call it FocusWindow or something

mortal hare
#

thats very confusing because SetFocus() on windows focuses a keyboard input on window, not moves it to virtual desktop

sly topaz
#

by virtual desktop you mean a workspace

mortal hare
#

yes

chrome beacon
mortal hare
#

basically im providing suite of functions which you can plug-in to one singular action, and naming such things is kinda awful in a sense

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.

chrome beacon
#

Also if you're just trying to add prefixes use teams

thorn isle
#

pretty sure there's an api method to change the player's display name including the one over their heads as well

sly topaz
feral bear
sly topaz
#

Setup can imply many things so you can also expand that function if it becomes necessary

chrome beacon
feral bear
chrome beacon
#

If so despawn it and then respawn it again

#

See if that helps

thorn isle
#

i'm pretty sure i called it once and then everyone on the server had that over their heads, but maybe it's some interaction with TAB or something else that does it

feral bear
feral bear
chrome beacon
#

That was very quick

#

Too quick in fact

#

There's no way you did it properly

feral bear
chrome beacon
#

You need to stop the client from seeing the old name

#

If you just let them respawn the client will still know about the old name

feral bear
thorn isle
#

moving away doesn't remove the player

#

you need to send a remove player packet

chrome beacon
#

Remove the player from sight then send the remove player packet

feral bear
chrome beacon
#

It is not

thorn isle
#

Player::remove does not send a player remove packet

drowsy helm
#

packets don't get deprecated

#

they get removed completely

chrome beacon
#

Also if you want to keep the username after relogging you need to capture packet being sent

#

or rename them after joining

sly topaz
feral bear
chrome beacon
#

Yeah

#

That's the action

#

Not the packet

feral bear
#

ah ok

mortal hare
sly topaz
#

now you went way too generic lmao

#

but whatever rocks your socks

mortal hare
#

welp it shouldnt be used outside of the config

sly topaz
#

famous last words

mortal hare
#

i hate naming things

#

english needs many bugfixes and patches

#

as buggy as cyberpunk 2077 at launch

feral bear
# chrome beacon Not the packet

I tried this but apart from making the player disappear from the tab it did nothing.

xD

public static void changePlayerNameTag(Main main, Player player) {

        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO_REMOVE);
        packet.getUUIDLists().write(0, Collections.singletonList(player.getUniqueId()));
        for (Player player2 : main.getServer().getOnlinePlayers()) {
            main.manager.sendServerPacket(player2, packet);
        }

        PacketContainer container = main.manager.createPacket(PacketType.Play.Server.PLAYER_INFO);
        container.getPlayerInfoActions().write(0, EnumSet.of(EnumWrappers.PlayerInfoAction.ADD_PLAYER, EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME));
        WrappedGameProfile gameProfile = new WrappedGameProfile(player.getUniqueId(), "test");
        container.getPlayerInfoDataLists().write(1, List.of(
                new PlayerInfoData(gameProfile, 0, EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()), WrappedChatComponent.fromText("test"))
        ));
        
        
        for (Player player2 : main.getServer().getOnlinePlayers()) {
            main.manager.sendServerPacket(player2, container);
        }

        
    }
#

oh

#

its work for nametag

#

But disappears from the tab 😂

sly topaz
#

you need to send another add packet with the listed action iirc

feral bear
chrome beacon
#

It does not

feral bear
chrome beacon
#

They meant the info packet

feral bear
# chrome beacon They meant the info packet

I did it!

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
        this.main.db.addPlayer(e.getPlayer());
        e.setJoinMessage(this.main.prefix+e.getPlayer().getName()+" a rejoins la partie.");

        for ( Player onlinePlayers : Bukkit.getOnlinePlayers()) {
            Utils.changePlayerNameTag(main, onlinePlayers);
        }
    }

public class Utils {
    
    public static void changePlayerNameTag(Main main, Player player) {

        player.setDisplayName("test");
        player.setPlayerListName("test");

        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO_REMOVE);
        packet.getUUIDLists().write(0, Collections.singletonList(player.getUniqueId()));
        for (Player player2 : main.getServer().getOnlinePlayers()) {
            if(player != player2){
                main.manager.sendServerPacket(player2, packet);
            }
        }

        PacketContainer container = main.manager.createPacket(PacketType.Play.Server.PLAYER_INFO);
        container.getPlayerInfoActions().write(0, EnumSet.of(EnumWrappers.PlayerInfoAction.ADD_PLAYER, EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME, EnumWrappers.PlayerInfoAction.UPDATE_LATENCY));
        WrappedGameProfile gameProfile = new WrappedGameProfile(player.getUniqueId(), "test");
        container.getPlayerInfoDataLists().write(1, List.of(
                new PlayerInfoData(gameProfile, 0, EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()), WrappedChatComponent.fromText("test"))
        ));
        
        
        for (Player player2 : main.getServer().getOnlinePlayers()) {
            if(player != player2){
                main.manager.sendServerPacket(player2, container);
            }
        }
        

    }
}
#

However, this only works in the JoinPlayer event.

#

If not, don't see the player. Either way, he disappears from the tab.

fickle spindle
#

why i can't do this? Player p = (Player) sender;
Inventory crafting = Bukkit.createInventory(p, InventoryType.CRAFTER);
p.openInventory(crafting);

thorn isle
#

why do you think you can't do that

fickle spindle
sly topaz
#

player inventory is client-side so it is just not possible from a plugin

thorn isle
#

i think the CRAFTER inventory refers to the new auto crafting block thing

thorn isle
#

do not paraphrase errors

sly topaz
#

right, I was thinking of the crafting grid on the player inventory

fickle spindle
#

sorry the crafter is the new code in the test code i used CRAFTING

#

?paste

undone axleBOT
fickle spindle
sly topaz
#

what are you trying to do, open an autocrafter inventory or the player's?

fickle spindle
#

no the crafting the 3x3 one

sly topaz
#

you mean the workbench?

fickle spindle
#

the "Crafting Table"

#

btw the code is this

@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
    Player p = (Player) sender;
    Inventory crafting = Bukkit.createInventory(p, InventoryType.CRAFTING);
    p.openInventory(crafting);
    return false;
}
sly topaz
#

then that's InventoryType.WORKBENCH, not CRAFTING

fickle spindle
#

and what crafting does?

sly topaz
#

CRAFTING is the 2x2 crafting grid on the player's inventory

fickle spindle
#

oh okay ty

sly topaz
#

though, you probably don't want to use create inventory for this, as the inventory will not work

fickle spindle
#

ty

#

now everything work thx

sly topaz
#

the new API for it is MenuType.CRAFTING.create(player, "inventory title")

kind hatch
#

Isn’t the new api still being worked on?

remote swallow
#

it should work still

sly topaz
#

this part of the API, anyway

#

there was a part that was still not done, not sure what the state of that is

kind hatch
dawn flower
#

why is updateInventory marked as internal?

#

am i supposed to not use it

sly topaz
#

yes

#

it is only really necessary when using packets and the such, anything else should be handled by the server already

dawn flower
#

how do i "update" the player's inventory then? i'm modifying items clientside for dynamic lore but if they switch to creative it messes it up since creative reflects clientside item changes to the server

sly topaz
#

which is a valid scenario to use that method

dawn flower
#

ok

dawn flower
sly topaz
#

I mean, you could've been doing it with a client mod for all I know lol

dawn flower
#

is there a way for anvilprepareevent to work for shift clicking

sly topaz
#

are you in creative

dawn flower
#

i dont remember if i was creative when i tested it

#

lemme try again 1 sec

#

you're a genius

#

i love you

sly topaz
#

np lol

dawn flower
thorn isle
#

uncanny

sly topaz
#

if you are already doing packets why not just use custom enchantments

dawn flower
#

how would that fix my problem

#

or maybe im dumb, could u explain more

sly topaz
#

well, since the enchantment would actually exist on the server, you wouldn't have to manually handle applying to anvil or the such

#

then again, that means discarding what you've been doing up to now so it is up to you

dawn flower
#

intresting

sly topaz
dawn flower
#

wait do i have to discard the lore part as well

sly topaz
#

well yeah since it'd actually be an enchantment and not an addition to the lore

dawn flower
#

no like

#

i still want it to show in the lore

#

does it do that for me

smoky anchor
#

It's gonna be an actual enchant the game recognizes

#

just like vanilla enchants

sly topaz
dawn flower
#

ok

#

oh wait it's for 1.21+ only, i actually want it to be backwards compatible

#

i remember there was a way to register enchants before but it didn't add lore, but does it handle anvils and stuff?

sly topaz
dawn flower
#

uh

sly topaz
#

because custom enchantments have been a thing since 1.20.4 I believe

dawn flower
#

yeah definatly before that even

sly topaz
#

well yeah then just continue doing what you were doing

dawn flower
#

ok

chrome beacon
#

Custom enchants were added in 1.21

#

to datapacks

dawn flower
# dawn flower help

can i send an item change packet when they take the result out of the anvil

jolly maple
#

Hello, I am currently making a gun plugin and I want to create a reload feature and I need to detect the player pressing the key "R" in just plugin, and I am REALLY stuck here... Can somebody help me out? I don't care if the code uses nms

modern tree
#

I am suddenly getting issues with my maven build processes, apparently to the point of running build tools being included. I am beyond confused how this pops up out of nowhere during a session of development. Anything pop to mind to anyone? At a total loss

sly topaz
#

R is not bound to anything by default so you’re out of luck there, better use the swap hands hotkey or something

sly topaz
kind hatch
quaint mantle
#

Im trying to do a custom anti xray but i cannot figure out what i am missing

#

please dm me if u know a fix

jagged thicket
quaint mantle
#

im trying to turn the javasource code to a .jar

mortal vortex
quaint mantle
#

yes

#

😭

mortal vortex
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

jagged thicket
#

why was kotlin

quaint mantle
#

?learnkotlin

#

😔

rotund ravine
#

Learn java first anyway

eager hawk
#

Hi guys! Quick question: is there a way to put the server status on Offline, even when it's online?

#

(I mean like offline in the server selection menu)

eager hawk
#

Nice! How?

jagged thicket
eager hawk
#

I'm sorry, could you telle me where I can edit the memory status?

jagged thicket
#

getConfig().set("memory.status", "offline");

eager hawk
#

Oh amazing, thanks!

#

I will try it out

slender elbow
#

wat

jagged thicket
#

Wait im wrong 💀

#

i was looking at a plugin's source

#

im totally wrong sorry

#

i was looking at how this was spoofing

eager hawk
#

Ohh no worries

#

Can't I just use this plugin?

jagged thicket
#

if it still works

eager hawk
#

oh yea 1.12 lmao

#

old plugin

jagged thicket
#

i mean try it out

#

it might still work

eager hawk
#

yeahh imma try it

modern tree
# sly topaz What does your pom look like and how are you building it

& @kind hatch It was failing to get valid poms and erroring out on build. TBH I have no clue what the problem was. Something caching, but it was outside of ide and the .m2 folder / persiting through restarts because none of that was working yesterday. However some reason today it's all okay. Wonder if I ran too many builds and got timed out by one of my repos or something?

I swear sometimes if there's too stiff of a stiff breeze the magic smoke gets let out of maven and everything breaks 🤣

worthy yarrow
#

That’s why I switched to gradle

sly topaz
#

gradle is worse in terms of how much "magic" ends up being done

#

from your description, it could've been a hundred things really, so I couldn't say for sure but a repository being down is a pretty common issue, though it would've been clear from the error if that was the case

#

my guess is that it was more of an IDE issue than maven's, or at least in my experience, it's always been the IDE integration messing up the build system rather than the build system itself blowing up

worthy yarrow
rough drift
#

sbt:

rough ibex
#

I despise gradles build config

#

makes no sense and feels like incantations combined with a programming language you had in a dream

cursive adder
#

Hi guys, i need help. Im trying run BuildTools for 1.16.5 to get nms. I got this error [WARNING] The requested profile "remapped" could not be activated because it does not exist. And its not creating remapped jars, what can i do?

remote swallow
#

remapped doesnt exist

#

it was added in 1.17

cursive adder
#

so i cant use nms in previous versions?

chrome beacon
#

You can

#

Just no mojang mappings for it (in Spigot)

#

Run BuildTools without the remapped flag and then depend on it like you would with the api but remove -api from the artifact

cursive adder
#

without classifier?

chrome beacon
#

yes

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

chrome beacon
cursive adder
#

okay, now i understand, thank u

dawn flower
#

how do i make a player reel their fishing rod

#

i could be dumb but there isn't a single forum talking about that

#

actually there's one but idk if it's the best way, it says to use nms

storm scaffold
#

Is there a way to set things like the font of an item's display name in Spigot

slender elbow
#

not in the api

storm scaffold
slender elbow
#

nms

storm scaffold
#

Is there a guide to setting up NMS on Spigot? I've only ever used it with Paper before

rough drift
#

?nms

dreamy glade
#

Does anyone know where I can download the official Minecraft Seven font that supports Unicode? The variants I found on the internet either don't support Unicode or only provide partial support for Unicode characters. The one Mojang is currently using is what I want (at least 1.20.6+), but I can't seem to find the font file anywhere in the .minecraft folder.

chrome beacon
#

Minecraft uses GNU Unifont as a fallback when rendering a character a character it doesn't support

#

As for the Minecraft Seven or Mojangles you can find their texture(s) in assets\minecraft\textures\font

#

and you can find the font definition in assets/minecraft/font

dawn flower
#

idk if i'm getting mandela effect rn but i'm like 99% sure there was a way to make a player "use" an item with spigot api, is there actually one?

dreamy glade
chrome beacon
#

Yes

#

Take a look at the font jsons it will show what character corresponds to each texture

lethal nexus
#

hi, hope this is the right channel to ask about buildtools
Im trying to build 1 21 4 with java -jar BuildTools.jar --rev 1.21.4 --remapped remapped-mojang
but running into few exceptions - https://paste.denizenscript.com/View/131850
Ive already tried nuking folder, updating bt, checkin java ver etc etc

chrome beacon
#

.m2 being in your user folder if you haven't moved it

lethal nexus
#

did that unholy amount of times

#

i even nuked whole .m2

dawn flower
#

why doesn't receiveClientPacket with USE_ITEM packet reel in the fishing rod but USE_ITEM_ON does? shouldn't they both reel the rod

#

protocollib btw forgot to mention

chrome beacon
chrome beacon
lethal nexus
#

yea its all weird

chrome beacon
#

oh and that log does not use the latest Buildtools

lethal nexus
#

will try something out

chrome beacon
#

Might not be important then 🤷‍♂️

lethal nexus
#

nuked out whole m2 again, downloaded latest bt and here I am again with the same exception

chrome beacon
#

So I can see why it's failing at creating the csrg

lethal nexus
#

alrigh

rough ibex
#

It likely still works

#

It's not necessarily great and I am rewriting it

vague kayak
#
Patching Block.java
Exception in thread "main" java.lang.RuntimeException: Error patching Block.java
    at org.spigotmc.builder.Builder.lambda$startBuilder$2(Builder.java:617)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
    at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.util.Iterator.forEachRemaining(Unknown Source)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.util.stream.ReferencePipeline.forEach(Unknown Source)
    at org.spigotmc.builder.Builder.startBuilder(Builder.java:568)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
Caused by: difflib.PatchFailedException: Incorrect Chunk: the chunk content doesn't match the target
    at difflib.Chunk.verify(Chunk.java:86)
    at difflib.ChangeDelta.verify(ChangeDelta.java:78)
    at difflib.ChangeDelta.applyTo(ChangeDelta.java:44)
    at difflib.Patch.applyTo(Patch.java:43)
    at difflib.DiffUtils.patch(DiffUtils.java:70)
    at org.spigotmc.builder.Builder.lambda$startBuilder$2(Builder.java:605)
    ... 13 more
#

1.8 build error

rough ibex
#

1.8? Oh boy

#

How fun....

tranquil pecan
vague kayak
rough ibex
#

Cleaning your work dir does nothing?

fair rock
#

I forgot the name of the class something like groups, tags, damn

A Class with several lists where same blocks are grouped like wool, beds, doors etc
Can anyone help me? xd

blazing ocean
#

Tag?

fair rock
#

fr?

#

I just added a damn s .-.

blazing ocean
#

yea

fair rock
#

thanks

#

Theres no tag for redstone components?

#

sadge

vague kayak
sharp elm
#

yo

#
public static void create(Location location, String text) {
        ArmorStand armorStand = (ArmorStand)  location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
        armorStand.setCanPickupItems(false);
        armorStand.setCustomName(text);
        armorStand.setCustomNameVisible(true);
        armorStand.setGravity(false);
        armorStand.setVisible(false);
    }
#
FloatingManage.create(new Location(Bukkit.getWorld("world"), -179, 141, -40), "§l§aFARM ZONE\n§r§fIci vous pouvez §3farm de l'xp §fpour obtenir le grade §eVIP §3gratuitement !");

In enable

#

but not working

#

please help me

chrome beacon
#

I'm going to guess that your plugin is set to load before the world is

#

Also when spawning an entity that you plan on modifying use the spawn method that accepts a consumer

fickle spindle
#

how can i see which plugin give me this datas? [20:37:10 WARN]: [org.bukkit.craftbukkit.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!

#

how can i hide the template additional tooltip? (i tried it with the same method of the potion but it doesn't work :()

empty prawn
#

Looking for someone to help configure plug-ins on a new up-and-coming server called war of the world This will be a OpportunityTo gain experience in development and later on down the road maybe even a paid position on the server

About
This will be a leader based game mode where the objective is to either Be the top leader or dominate the rest of the world

There will be several different countries you can choose from when you start the game there will be guns cars Government and cops etc

The leader of your country will be able to make any laws or change current laws

chrome beacon
#

Did you copy paste that from GPT or smth

#

where did you get those OBJ chars from 💀

fickle spindle
chrome beacon
#

Yeah that's probably a bot

chrome beacon
#

Example:

Legacy plugin Essentials v2.21.0-dev+185-5bf158c does not specify an api-version.

#

I removed the api-version from Essentials and it shows this ^^

fickle spindle
chrome beacon
fickle spindle
chrome beacon
#

Are you testing on Paper

fickle spindle
#

the server? (Purpur)

sullen marlin
#

?whereami

fickle spindle
chrome beacon
#

So?

#

You're testing on Purpur

#

You should be testing on Spigot

fickle spindle
#

i will change it asap

#

but there is a specific meta data for the Templates or there is a default way for hide the additional stuff from ItemMeta?

minor spade
#

gg

chrome beacon
fickle spindle
chrome beacon
#

I used addItemFlags

fickle spindle
#

okay i will try to restart

chrome beacon
#

You probably forgot to reapply the item meta

fickle spindle
#

no okay it was fine like how i wrote ty anyways 🙂

#

?paste

undone axleBOT
fickle spindle
chrome beacon
#

Looks like you have your answer

fickle spindle
chrome beacon
#

You can just ignore it

vague swallow
astral stream
#

Yoo does anyone know how to get to the anti cheat page

chrome beacon
#

you mean on the wiki?

astral stream
#

Yes how do I do it for minceraft bedrock

#

Can you help me step by step

chrome beacon
#

??

astral stream
#

How do I download it

chrome beacon
#

Download what

astral stream
#

The anti cheat

chrome beacon
#

"the anticheat"

#

There are many anticheats

astral stream
#

Yes

#

For the newest update

slender elbow
#

there are many anticheats for the newest update

vague swallow
#

💀

remote swallow
#

welcome back darth mango

vague swallow
#

Thanks but I've never been gone

remote swallow
#

always in our hearts and whereami

vague swallow
#

I am always here and waiting for someone to summon me by using the magic spell

#

?whereami

#

I should code a plugin with that command that summons an NPC of me playing the whereami sound on a horn

umbral ridge
#

hey

#

if you set display text to null and item lore to something... will display name still be there? like a blank text?

#

what if i dont want a display name and i just want a multi line text when i hover an item

#

does display name support multiline? should i just set the item lore and set display name to null??

man i feel so dumb as if im stuck at basics

noble current
#

how i can set the price of my plugin on spigot?

sullen marlin
umbral ridge
#

eh, was looking for a quick yes or no and why what response because then i dont have to go through all the crap with compiling and testing XD and i can smoke my cigarette to the end

urban cloak
#

doesnt testing that take about 30 seconds

#

less time than sending waiting for an answer xd

umbral ridge
#

i have a lot of unfinished stuff laying around classes

urban cloak
#

oh

umbral ridge
#

a lot of layers, PlayerTransaction -> PlayerTransactions -> PlayerWallet -> PlayerBank

rotund ravine
#

Null customname just reverts to the normal itemname btw, no multiline.

umbral ridge
#

oh crap

#

so

rotund ravine
#

Lore can be more lines

umbral ridge
#

can i have a lore without display name

rotund ravine
#

Yes

#

Well

#

You can make it empty (or atleast a space if minecraft doesn’t like empty strings), not sure how good that looks tho

umbral ridge
#

ok thanks!

mortal hare
#

I suck at regex, so maybe you could guys give me a hand to simplify this regex?

^(?:\\$|(?:\\[^\\\s]+)+)\\?$

this works at matching path separated strings

is there any way to simplify this?

rotund ravine
#
^\\(?:[^\\\s]+\\)*[^\\\s]*$```

idk
mortal hare
#

escape it

#

`regex`

#

i think this is the best you can make

#

thanks

#

❤️

umbral ridge
#

is there a way to copy text into a clipboard?

#

with the code

chrome beacon
#

Yeah the Clipboard class from AWT

sly topaz
#

doesn't seem to be trying to capture the strings in-between the path separator

mortal hare
# sly topaz why even use regex for this

i use it since im developing my own script which positions applications in virtual desktops based on regex window styles (or ex styles), classes, process names and window titles

#
desktops := {
    1: [
        ; Open all file explorer windows in first virtual desktop except for legacy control panel
        {
            process: "explorer",
            title: "^(?!Control Panel(?:\\[^\\]+)*$).*$",
            class: "CabinetWClass"
        },
...
#

open intellij and bam its already positioned for you at first virtual desktop

#

open chromium its in second virtual desktop

#

now i can switch between chromium by just using WIN + A, WIN + D

#

without having to manually position applications into virtual desktops as i do

#

declutters your desktop

#

by organizing apps automatically

#

basically backport of window rules from hyprland (linux) or glazewm(windows), but without automatic tiling (because windows apps are not designed for auto tiling)

sly topaz
#

eh, glazewm does a pretty good you at auto tiling

#

I just never understood the hype

#

like, opening apps and organizing them windows was never something that I felt the need to minmax lol, but I do know people love that kind of thing when done right

#

it's like setting up your vim config

mortal hare
#

auto tiling is just not designed for win32 appplications

#

they look awful

sly topaz
#

ah, sub-windows are a pain point of glaze indeed

mortal hare
#

and buggy

sly topaz
#

I hated how it vertically aligned the file explorer dialog when downloading something

mortal hare
#

that's why i've created this script. i wanted to have glaze wm's window rules but without any tiling and just plainly use native windows virtual desktops instead of glazewm's fake ones so that things like snapping would work as usual

sly topaz
#

I eventually just configured glaze to ignore all the proper windows for automatic tiling

#

luckily I don't often use new programs so it wasn't as much of an issue

manic delta
#

How can i make my own hidePlayer() but without the playerinforemovepacket part

slender elbow
#

by replicating that code with nms, but without the playerinforemovepacket part

manic delta
slender elbow
#

some stuff might be private for which you'll need to use reflection

worldly ingot
#

You want to remake the hidePlayer() method... without the thing that hides the player...?

worldly ingot
#

??

manic delta
#

this part exactly

mortal hare
#

but that... hides the player on client...

worldly ingot
#

Are you trying to play Minecraft without the Minecraft client too, or what?

mortal hare
#

well you can apply invisibility potion effect

#

but that would make it prone to hack clients

manic delta
#

I'm making a plugin that vanishes a region, but not with the effect. I want a vanish like that, at least that's what they asked me for, without removing them from the TAB or messing them up (because if I use the tab plugin and send a packet to add them, it gets messed up).

mortal hare
#

it was done like that in legacy versions of minecraft until it became obvious that hack clients exploited this

mortal hare
#

basically a fake player entry

#

and when you go out of vanish you restore it back

manic delta
#

I suggested that too but the client doesn't want that

mortal hare
#

current impl of vanish on spigot/paper sends player info remove packet just because it instructs client to remove player entity from the client's rendering as if the player disconnected from the server

#

its basically a hack to defend against hack clients

#

well if he disagrees, im afraid its impossible to do something like this without applying potion effect. I'll pass on this one, because im clueless of how would you implement such type of vanish on the server. Maybe im wrong, anyone else willing to discuss?

manic delta
mortal hare
#

at this point i would probably edit the TAB plugin's source code to support something like this if it doesnt support it already

manic delta
#

damn

mortal hare
#

minecraft client is just not designed for this. its not a game engine (although its coming closer and closer with each update and data driven datapacks)

#

maybe someday we would have proper support for that

manic delta
#

But I've seen several servers that have this, I know it's possible

mortal hare
#

i guess maybe you can try to just remove the player from entity tracker

#

but i doubt that's enough

#

with mobs im guaranteed it would work for new chunk loads

#

but for player entities im not sure if the follow the same entity distance rules as mobs

sullen marlin
mortal hare
#

arent player entities handled differently

#

on client

#

or im clinging on old legacy version behaviour?

manic delta
mortal hare
sullen marlin
mortal hare
#

maybe in such case it would be better to deprecate this method and propose such functionality to be moved into separate methods: Player#hidePlayerListEntry() / Player#showPlayerListEntry() and Player#hide() and Player#show() or smth like that

#

too bad there's no proper API dedicated to tab player lists on bukkit and everything is mushed into player interfaces

#

it would be neat to have PlayerList Interface which manages the player lists globally but allows to set player lists locally too

#

and in that interface it would be neat to move methods likePlayerList#add(Player) PlayerList#remove(Player), PlayerList#setHeader(string) (for setting it global, or move it under PlayerLists#setHeader(string) utility class since its just for loop for setting header for every player), PlayerList#setHeader(string, Player) PlayerList#setFooter(string) (for setting it global, or move it under PlayerList#setFooter(string) utility class since its just for loop for setting footer for every player), PlayerList#setFooter(string, player) methods

sullen marlin
#

The problem is historically tab lists have depended on the player

#

If you remove a player from the tab list, the player broke

mortal hare
#

but that's not the case anymore rn as i can see if you can just remove the player entity from tracker and that's it?

dawn flower
#
    public static boolean changeMapValue(TurboExpression.ChangeMode mode, Object value, Map<Object, Object> map) {
        try {
            if (mode == TurboExpression.ChangeMode.SET && value instanceof Map<?, ?> m) {
                map.clear();
                map.putAll(m);
            }
        } catch (ClassCastException ex) {
            return false;
        }```
is this safe
sly topaz
#

why are you catching a class cast exception there

dawn flower
#

idk what exception it throws

sly topaz
#

is that Skript related by any chance

dawn flower
#

no

sly topaz
#

well, it shouldn't throw any exceptions

dawn flower
#

if "m" has a different key or value than map it will 100% throw one

sly topaz
#

well, ideally that wouldn't ever happen

#

this whole piece of code smells like bad design somewhere

#

why are you passing around an Object instead of the proper type

dawn flower
#

i'm expecting any map

#

<?, ?> wouldn't let me add a random map called "m" to it

sly topaz
#

if you are excepting any Map, then using Map<?, ?> as the type would do instead of just Object

dawn flower
#
    public static <K, V> boolean changeMapValue(TurboExpression.ChangeMode mode, Object value, Map<K, V> map) {
        try {
            if (mode == TurboExpression.ChangeMode.SET && value instanceof Map<?, ?>) {
                map.clear();
                map.putAll((Map<K, V>) value);
            }
        } catch (ClassCastException ex) {
            return false;
        }```

something like this should also work i think
sly topaz
#

well no since Map<?, ?> isn't the same as Map<K, V>

dawn flower
#

can i just do something similar to if (value instance of Map<K, V>) because it doesn't let me

dawn flower
sly topaz
#

my question is why is the parameter type Object instead of Map<?, ?>

dawn flower
#

because then it yells at me if i try adding a random map with a random key and value type to it

sly topaz
#

and if value and map are supposed to share a key, you could do:

public static <K, V> boolean changeMapValue(TurboExpression.ChangeMode mode, Map<K, V> value, Map<K, V> map) {
            if (mode == TurboExpression.ChangeMode.SET) {
                map.clear();
                map.putAll(value);
            }
}
dawn flower
#

that's the thing

#

value doesn't neccessarily need to be a map

#

it's just an object

sly topaz
#

then pass the class as a parameter too

dawn flower
#

i just want to return false if

  1. value isn't a map and mode is set
  2. value is a map and mode is set but value doesn't share the same key or value with map
dawn flower
#

what is that name of the problem im having

#

ima search it up

mortal hare
#

that way it would infer the value parameter of the map for the value parameter

dawn flower
#

it's called value but it's not the value of the map

mortal hare
#

... V value, Map<K, V> map

dawn flower
#

the "value" could literally be a whole other map to change the original map

#

so it can't be V

sly topaz
#

it is just not a design I'd want to deal with tbh, there's no compile-time safety

#

your initial code should work as is

sly topaz
#

yes

dawn flower
#

k

mortal hare
#

i dont have ide right now and generics for me is confusing to comprehend without its support lol

dawn flower
#

i don't think it'll work

#

i'll just stick with the original one as javier said

#

if i run into issues later on i'll try looking into it

#

also if i change item.getEnchantments() does it reflect on the item

sly topaz
dawn flower
#

ok

#

thanks

ivory sleet
#

Map<?,?> is somewhat diabolical icl though

thorn isle
#

use typed instructions

sharp crest
#

Hi, Is there any way to influence Math.random on the server from the client?

mortal vortex
#

bro is trying to cheat on a roulette server clearly 😭

#

RNG is Timestamp-Dependent.

pseudo hazel
#

lol

smoky anchor
#

I meaaaann
There have been ways to influence enchanting in such a way where you had guaranteed enchants after you do certain actions
It involved casting fishing rod, getting the UUID from it and somehow getting the random seed based on that :D

mortal vortex
#

You have way better channces at predicting RNG out of the 2^48 iterations, than manipulating or influecning it

pseudo hazel
#

yes but also a plugin could just have its own Random instance with a different seed or whatever

sharp crest
mortal vortex
#

@sharp crest look into Apophenia (Illusory Pattern Perception)

#

man me and the boys used to tell eachother "if you hit a chest with your pickaxe 3 times before opening it, you'll get good loot" in fortnite.

#

its nothing more than your braining looking for patterns.

pseudo hazel
#

aka they just have good luck

mortal vortex
#

Yeah

pseudo hazel
#

unless you messed up your plugin ig

#

like resetting the rando with the same seed every time or something

mortal vortex
#

lmfao yeah good point, @sharp crest drop your code.

mortal vortex
sharp crest
pseudo hazel
#

well with the same seed specifically

mortal vortex
#

are you doing this?

long seed = 12345L; 
Random rng = new Random(seed);
#

passing anything to Random

sharp crest
mortal vortex
#

you'd have to be like insanely good at pattern recognition, like beyond that of professional card counterrs

pseudo hazel
#

yeah they are just lucky it seems

mortal vortex
#

yeahp.

#

I cant think of anyone using RandomSecure in a plugin

jagged thicket
#

when setting probability did you set 80 instead of 0.8 or smt

sly topaz
#

It depends on player count so that’s a very small variance anyway, they must play enough to beat the odds

sharp crest
#

🤔

upper hazel
umbral ridge
#

hey

#

can PDC slow down the world loading process?

#

if i have eg.: 20k blocks with PDC, to detect which ones were manually placed

smoky anchor
#

Well the PDC has to be read from disk, so I guess it would

umbral ridge
#

soo if i have a really good disk, m.2 ssd with speeds up to 7000mb/s read and write

smoky anchor
umbral ridge
#

would it have any effect

umbral ridge
#

value like .. true

#

doesn't really matter, as long as it contains a key

#

value does not matter

#

i'd have to check for the key on BlockBreakEvent so for each block that is broken

smoky anchor
#

I feel like you could optimize that a bit
If that's a real thing you made not just thing for sake of example
My approach would be: per chunk have a PDC. That would contain lists of shorts which will be keyed with the y of the subchunk
you can calculate the index from the block pos in subchunk
Might wanna use ShortSet from FastUtil (I believe that should exist) for ultimate speed :D
But I feel like these are all premature microoptimizations...

umbral ridge
#

i like microoptimizations

#

thank you for the info xD i'll try this

smoky anchor
#

Both should help with what you're doing
You'd be storing less data -> world loads faster
and the lookup should be faster like this (? not sure about this one)

umbral ridge
#

all I need this for is, i'll give n amount of xp to the player each time they break a block and to prevent abusing I need PDC

snow kelp
#

Can someone make me a macro for Mac ? I’ll pay

smoky anchor
undone axleBOT
snow kelp
#

Press W + Space at the same time and 1 Tick later add F

#

50ms

solid cargo
#

I suppose for some simple like that you can ask gpt

smoky anchor
polar forge
#

I just downloaded a plugin that doesnt work

#

why do i see stuff like these even tho i imported the repo?

wet breach
#

I have said in the past how efficient this is

#

pdc will never match it

umbral ridge
#

a custom binary file ...

#

then the binary file could reach megabytes in size and io operations could also take long

wet breach
#

custom in the sense choosing which character to use for separations etc

wet breach
#

with java 1.7 and using this method, you can load 10-15 million blocks in 6 seconds and save it in 3

#

might have been 20 million, either way it was a lot

#

we didn't really test the limits of how much before it slowed down, just that it was sufficient amount

umbral ridge
#

what if player breaks like 20 blocks in 1 second with a pickaxe with enchantments

#

for each block i need to check if its been manually placed or not

#

in 600ms

wet breach
#

20 blocks is not 15 million

eternal night
#

loading 15 million blocks and accessing a data structure that holds those blocks is completely different

umbral ridge
#

but 15million blocks have been manually placed and I need to find if any of these 20 blocks match in the binary file

wet breach
#

it was for storing data on blocks placed from players that were in creative so that those in survival could not obtain them if they broke

umbral ridge
#

i dont think that would be optimal

#

ill probably stick to per chunk pdc

wet breach
#

yet currently to date nothing beats it

#

but think what you want, should probably try it before casting doubt

eternal night
#

I mean,honestly the biggest issue is gonna be read/finding the blocks

#

loading IO is pretty damn irrelevant when most chunk loading is async anyway

wet breach
eternal night
#

finding

umbral ridge
wet breach
#

only an issue if you load only parts of the file and not the whole thing

eternal night
#

how so. If I load in a section of bytes from a file into memory, I still need an algorithm to find me specific blocks

wet breach
wet breach
eternal night
#

"load the data"

wet breach
#

look I am not going to argue

umbral ridge
#

yea "load the data" its going to take long

wet breach
#

no

umbral ridge
#

yes

wet breach
#

ok fine then be stuck with your doubt 🙂

umbral ridge
#

for each block that is broken, i need to load the data

wet breach
#

currently nothing beats this method

umbral ridge
#

in your case a binary file

eternal night
#

I just think that the part of "imma do a normal read" vs "i'll directly map a files content into memory" is not as important as the "I need to find a datastructure that properly supports finding block x y and z in a near infinite world"

wet breach
#

you are just saying it is

#

we don't live in a time where we are discovering how to do this stuff

#

its already been done

eternal night
#

Well but doing so on the raw mapped memory is annoying

#

unless you read it all into a proper datastructure

wet breach
#

which you should because why wouldn't you if you loaded it into memory?

#

reading from memory is a whole hell lot faster then any ssd or hdd

#

same with writing

eternal night
#

what

wet breach
#

the OS takes care of writing back to ssd

eternal night
#

The algorithm to correctly organise your giant buffer of a memory mapped file certainly is not "easy"

#

at least to do it (semi)optimally

eternal night
#

"it's been done", I mean, throw it here

#

I'd be shocked if there is an actual consensus on anything regarding that kinda of layout

wet breach
#

you don't need a consensus

#

you don't even need the most efficient

#

they don't have a server of 1k+ players

#

so what efficiency are we needing?

#

it just needs to be efficient enough

umbral ridge
#

how would you structure the binary file to make lookups as fast as possible? wouldnt indexing be necessary? id still have to scan large portions of the file every time a block is broken

wet breach
#

just know reading from a memory mapped file you are not limited to reading or writing in one direction

#

you can read forward or backwards

#

same with writing technically too

umbral ridge
#

can you show me some samples "it's been done"

wet breach
#

if a binary file is large, you can create multiple MappedByteBuffer of different regions of the same file

#

and interact and do stuff with those regions independently of one another

snow kelp
#

Guys please make me a Makro for Mac Minecraft I’ll pay

wet breach
#

just go learn it yourself

#

google some youtube video and stop bugging people

#

also

#

?services

undone axleBOT
slender elbow
#

AHK my beloved

wet breach
#

you are not going to get anything faster then memory. Not even ssd's come close to it

#

the reason the file needs to be binary is because before a file can be loaded into memory it has to be translated to binary first

#

if its already binary, it just saves the OS a step

winter jungle
#

Heya, I'm currently programming for a streamer on Twitch, and he wants to have a game mode where he and the viewers can play along. In the game mode, many things are saved such as teams, points, players, timers, etc.

Does it make sense to use Redis for this, or are normal lists/hash maps also sufficient?

vast ledge
#

It seems unnecessary unless you want to have multiple servers that are synced

#

If you want to save wins and total points, you should write them to a DB at the end of the game

spark remnant
sly topaz
#

what is fortcode

dawn flower
#

what's a backwards compatible way of getting the entity killer in a PlayerDeathEvent?

snow kelp
#

Is Anyone good in Keyboard Maestro Mac ?

chrome beacon
#

Someone probably is

sly topaz
dawn flower
#

k

#

do i just check if getLastDamageEvent is instanceof EntityDamageByEntityEvent

sly topaz
#

Sure that works

dawn flower
#

k

grim hound
#

why does a java 21-compiled plugin throw an unsupported major file version 65 error even when started with hava 21?

chrome beacon
#

Using a library that doesn't supporting Java 21?

#

Such as an old version of ASM

grim hound
chrome beacon
#

That's an old ASM version

jagged thicket
#

DONOT COME TO #general

#

im going to stay here

#

safe spot

chrome beacon
#

You should be using Java 17 for 1.19.4

blazing ocean
#

Ah the pain of old java versions

pure dagger
#

how to change player's health after the event not before,

plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
                if (player.isOnline() && !player.isDead()) {
                    player.setHealth(newHealth);
                }
            }, 1L);

like this?

minor otter
#

That would delay it by 1 tick I believe

pure dagger
#

yeah, is it good solution ?

#

i dont think

#

so

chrome beacon
#

Which event?

pure dagger
#

thats entitydamageentity

minor otter
#

I mean it should work but if you are using newHealth to set damage to the player it wont account for armor or effects hard to tell what you are trying to do from the snippet

#

?tas

undone axleBOT
pure dagger
weak gust
#

Can someone help me with intrinsics of the StructureManager? I am probably missing something trivial here:
Recently I tried the following snippet, just for the purposes of replicating the functionality of the /place -command, but just in the plugin code. The following snippet is from the forums: https://www.spigotmc.org/threads/generate-a-structure.643122/

NamespacedKey structureKey = NamespacedKey.minecraft("mineshaft");
Structure structure = Bukkit.getStructureManager().getStructure(structureKey);
if (structure == null) {
    structure = Bukkit.getStructureManager().loadStructure(structureKey); // Try and load it if it isn't already
    if (structure == null) {
        plugin.getLogger().info("Structure is still null");
        return false; // The structure doesn't exist
    }
}

And it logs the "Structure is still null".
Now the problem is that no matter what I've tried the loadStructure -call always returns a null. I tried to check other keys from minecraft wiki but at least all of these did not seem to work:

NamespacedKey.minecraft("bastion_remnant"),
                NamespacedKey.minecraft("ancient_city"),
                NamespacedKey.minecraft("buried_treasure"),
                NamespacedKey.minecraft("desert_pyramid"),
                NamespacedKey.minecraft("stronghold"),
                NamespacedKey.minecraft("shipwreck")

So can someone enlighten me how should this be used? Thank you!

pure dagger
minor otter
#

runTaskLater is a good solution if you want to be able to adjust the amount of ticks before it runs

#

should run synchronously

#

.runTask would run immediatly after the event so you can't really mess with a delay

pure dagger
#

okay so just runtask

polar forge
#

guys what type of method should i use if i want that a player isnt allowed to edit a sign?

minor otter
#

If a Sign Change event is cancelled, the sign will not be changed.

grim hound
#

can you display dynamic textures with a resource pack?

chrome beacon
#

Depends on what you mean by dynamic

grim hound
#

changes based on context

#

There's some texture A for entity

#

switch it to B

#

without redownloading anything

chrome beacon
#

You can swap the model of the item

grim hound
grim hound
chrome beacon
#

Not enough information to say if that's possible

blazing ocean
#

no chance

grim hound
#

Okay, let me just retract my statement and say exactly what I need

blazing ocean
#

you can piece it together if you have a texture for every individual pixel, for each individual colour, but please don't

blazing ocean
#

yeah, please just don't

grim hound
#

I'm trying to display a model based off of the executing player's skin

#

and uh

grim hound
blazing ocean
#

just have some kind of fake player that re-sends the animation packets

#

jesus

chrome beacon
#

since that already has access to the full player skin texture

blazing ocean
grim hound
#

I see, how hard is that to impl?

chrome beacon
#

How good are you at math

grim hound
grim hound
#

so uh

#

not at high level

#

but good at current level

blazing ocean
#

I really really wouldn't recommend you spawn thousands of entities which actually render

blazing ocean
#

that's not the point

grim hound
#

also its surprisingly lightweight

blazing ocean
#

the client will just die on worse PCs

grim hound
#

I can have 10 of these no problem

#

only goes from 300 to 40 fps when 10 are in place

#

it's fineee

blazing ocean
#

no problem
260 fps less

minor otter
#

not too shabby

grim hound
chrome beacon
#

You'll be doing some shader programming

grim hound
#

never done that

chrome beacon
#

so linear algebra

grim hound
#

uh

#

I don't think I'm fully grasping what I'll be doing

pseudo hazel
#

not fry everyones pcs from the inside

#

as a start

blazing ocean
#

yeah, you should grill them instead

#

tastes much better

grim hound
chrome beacon
#

A repo full of core shaders

pseudo hazel
#

a repo full of shaders to copy code from

chrome beacon
#

JNNGL makes some really cool ones

minor otter
#

waiting for him to update quite a few of them

#

I use GUI Avatars and it's really easy to setup

grim hound
# grim hound

so sending like 800 updates every two ticks isn't ideal?

#

huh, I guess you learn something new every day

grim hound
#

hmmm

grim hound
chrome beacon
grim hound
grim hound
chrome beacon
#

If you've never worked with it I recommend this playlist: https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab

Beginning the linear algebra series with the basics.
Help fund future projects: https://www.patreon.com/3blue1brown

Music: https://vincerubinetti.bandcamp.com/track/grants-etude

Thanks to Elo Marie Viennot and Ambros Gleixner from HTW Berlin (www.htw-berlin.de) for contributing German translations and dubbing.

Thanks also to these viewers for...

▶ Play video
blazing ocean
#

3b1b my beloved

fickle spindle
#

how can i store all the inventory items of someone in an hashmap and give it back_

blazing ocean
#

you see, you can't always integrate 3rd party plugins into your code

fickle spindle
#

i know this plugin i don't want to use it because i need a small stuff of it just to make different inventory for different worlds 🙂

fair rock
fickle spindle
fair rock
#

Just try and see what happens

#

The most of the part is reading and trying c:

fickle spindle
#

but it's a "right" way?

#

because in my mind it work

chilly marsh
#

Where do I make a commission?

fair rock
fickle spindle
chrome beacon
undone axleBOT
fair rock
# fickle spindle oh okay i will just try ty anyways 🙂

The most of the part is reading and trying. The "right" way is only "Is it working". You can follow best practice and follow documentation but there will never be a documentation for anything you want. And btw Bukkit/Spigot didnt start because of "The Right Way". Minecraft dont support plugins at all. Some just "Make it".

fickle spindle
#

ty 🙂

umbral ridge
#

how do you enable word wrap in yml in intellij idea

#

there is no proper setting like "enable word-wrap" A SIMPLE ENABLE/DISABLE

chilly marsh
umbral ridge
#

what the heck is soft wrap and hard wrap. give me a setting, a boolean setting, true /false, yes or no. what the shit

#

whoever designed the yaml settings is a total dumbass

#

and nothing works

jade herald
#

anyone know if I have a published plugin and update it with external download as a GitHub release, and I have another addon that adapts my plugin with another one, can I publish it in the same GitHub release? Or do I need to create a new resource on Spigot for this?

worldly ingot
#

You probably want soft wrapping

umbral ridge
#

i miss Eclipse

#

XD

#

i think i was more productive there

#

i turned on soft wrap but nothing changed, not in yaml or java files

worldly ingot
#

Then it's brokey

worldly ingot
blazing ocean
#

IJ is nice but it is silly at times

cosmic jasper
#

Hii does anyone know how to get the info that a sponge has turned into a wet sponge? I use blockphysicsevent with getChangedType == Sponge and check after it if the Sponge has Water around it. But i think there is a more direct way to see the change of the sponge turning to a wet sponge. I also think about checking the blockstate but im not sure if that would work out. Before wasting my time with that last piece i thought i may ask some pros :3 or i may just leave it like so idk

cosmic jasper
#

Oh wow thank you that is excatly the one i needed but i couldnt find it anywhere 🙏🙏

tall dragon
#

its kinda burried by the fact that so many people asked for this. and your solution was the answer in most places haha

cosmic jasper
#

Haha funny xd

polar forge
#

Hoi ppl

#

^ ToggleCommand

#

so im making a toggle command for a GriefNotifier plugin

#

it sends a message to all OP's whenever someone breaks a block

#

^ BreakBlockListener

#

How could i make a toggle command where i can toggle off teh receiving of those messages?

chrome beacon
#

You already have a toggle command

#

You just need to check if they have it toggled on before sending the message

#

also use a Set of uuids instead of an array list of strings

polar forge
#

sure

chrome beacon
#

and running both contains and remove is redundant

#

Just run remove and check it's return value

polar forge
#

wdym

chrome beacon
#

The remove method returns boolean that shows if something was removed or not

polar forge
#

ok i removed the toggled.add()

chrome beacon
#

Wait why

polar forge
#

u said just run remove

chrome beacon
#

and running both contains and remove is redundant
Just run remove and check it's return value

#

I was just talking about contains and remove

#

I said nothing about add

chrome beacon
#

Just use the return value

#

It's a boolean

polar forge
#

there is already return true;

chrome beacon
#

I wait I didn't see which message you replied to

#

You call contains to check if it's in a Set/List

polar forge
#

yes but how do i turn off the messages ent

thorn isle
#

by not sending one

chrome beacon
#

The messages will be off when the player isn't in the list

#

since you check if they're in the list before sending one

polar forge
#

yes but they in different java classes

chrome beacon
#

so?

#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

polar forge
#

they are not connected actually

chrome beacon
#

Connect them

polar forge
#

Olivo i already know java

chrome beacon
#

You do not

polar forge
#

I do

chrome beacon
#

if you have no idea how to access something from another class

#

then I would not say you know Java

polar forge
#

bruh, duh using this.plugin = plugin

thorn isle
remote swallow
#

You didn't know java last year when you were here and still don't know it properly now, learning java helps a lot when making plugins

grim hound
#

does setCollidable not work?

polar forge
#

they dont remain where u left them

blazing ocean
#

Well, you seemingly aren't learning Java

remote swallow
#

If you don't know how to access classes and just say "this.plugin = plugin" I don't think you know java

chrome beacon
remote swallow
#

What else do you do

polar forge
#

wdym?

thorn isle
#

there are a number of ways to go about this

remote swallow
#

Just adding plugin doesn't give you acess to everything

#

You have another step to do

polar forge
thorn isle
#

so access the set from the listener to disable/enable the messages, yes?

polar forge
#

yus

thorn isle
#

so instead of doing this.plugin = plugin you'd presumably do something with the set rather than the plugin itself?

polar forge
#

wdym?

thorn isle
#

can you explain what this.plugin = plugin does

chrome beacon
# grim hound like what?

Note that the client may predict the collision between itself and another entity, resulting in this flag not working for player collisions. This method should therefore only be used to set the collision status of non-player entities.

To control player collisions, use Team.Option.COLLISION_RULE in combination with a Scoreboard and a Team.

thorn isle
#

no wrong answers here, just try writing down what it is that it does

polar forge
#

we arent here to test my java knowledge?

but sure, it lets u connect the classes, so for example if u used a hashmap in a class, u can recall it in another class by placing plugin. in front

thorn isle
#

i'm not here to spoonfeed you either

polar forge
#

i didnt ask u to?

thorn isle
#

so i need to know where we are starting from to get you to where you need to be

polar forge
#

Im trying to understand the logic behinf it

thorn isle
#

and your current understanding of the topic is where we are starting from

polar forge
#

I dont understand the point to reproach lack of java knowledge if someone needs help

thorn isle
#

i could give you the code to do it word for word, but i'd rather teach you to fish

#

and to do that i need to know where you are right now

polar forge
#

As u should?

#

I never came here to expect u to give me the code

thorn isle
polar forge
#

Well i knew already

#

but this aint the problem im facing

thorn isle
#

can you describe your problem

polar forge
#

But u guys are more worried about my java knowledge then the actual issue im facing

chrome beacon
#

and what is that issue

thorn isle
#

from what i understood your problem is figuring out how to stop sending messages to a specific player

#

is this not the issue?

polar forge
#

^

#

It is yes

thorn isle
#

right

#

so bear with me here

#

you have a set of player names to whom you do not want to send the messages, yes?

#

or rather the converse, that is, a set of player names to whom you want to send the messages

polar forge
#

Those who are in the set, will get the messages i think

#

right?

thorn isle
#

based on the command feedback in your command class yes

#

now, the actual message sending is done in the block break listener

umbral ridge
#

as soon as I added Vault to the project now I can't use that?

thorn isle
#

supposing you had access to the set there, you could do

if (toggled.contains(player.getName())) player.sendMessage(...);
#

but the toggled set is in another class

remote swallow
chrome beacon
#

Also yeah that's Paper API

remote swallow
#

iirc vault 1.7.1 might have fixed smth about it

thorn isle
#

in conclusion you have a hashset in the command class that you need to access from the listener class, yes?

polar forge
#

I think so

thorn isle
#

and this is quite similar to your example of accessing a hashmap from another class, right

polar forge
#

ok thx

thorn isle
#

so now that we've agreed that they are quite similar, let's take a look at the differences

polar forge
#

?

thorn isle
#

the biggest difference is that in your example, the hashmap is in the plugin class; right now, the toggled hashset is in the command class

#

so rather than passing the plugin to your listener class, you'd want to pass the command to your listener class, since that's where the set is

#

how might we go about doing this?

polar forge
#

its pretty the same thing

#

instead of plugin

#

u write the name of the command class

thorn isle
#

getting warmer

polar forge
#

wdym?

thorn isle
#

let's see your main plugin class

umbral ridge
#

why are all chat events deprecated

#

wth

slender elbow
#

paper !!!

umbral ridge
#

NOoooo

chrome beacon
#

'bout to get whereami'd

umbral ridge
#

yes its paperus

#

?amiwhere

#

Found an alternative AsyncChatEvent nvm xD

thorn isle
thorn isle
#

good, and let's also see the updated plugin class

polar forge
#
getServer().getPluginManager().registerEvents(new BlockBreakEventListener(this), this);```
thorn isle
#

right

#

now this is something of a tangential issue, but the way you're setting your command executor isn't right; currently you are setting this as the executor for that command, not your command class

#

what you want to do is construct your command class with new and then pass that to setExecutor instead of this

#

very much like you do with your listener class, which you pass to registerEvents

polar forge
#
getCommand("togglealert").setExecutor(new ToggleCommand());```
thorn isle
#

good

#

now, going back to when we talked about the differences between your example and the current problem, let's remember that rather than your plugin, your listener class needs your command class

#

so instead of passing your plugin to it, you should pass the command

#

so change the this.plugin = plugin bit to this.listener = listener and change the field and constructor parameter types from GriefNotifier to ToggleCommand

polar forge
#
ToggleCommand listener;
    public BlockBreakEventListener(ToggleCommand listener) {
        this.listener = listener;
    }```
thorn isle
#

good

#

and now, in your plugin class, you should be seeing an error

#

because now to construct your BlockBreakEventListener class, it needs a ToggleCommand passed to it

#

there are two ways in which you can fix this error, one of them is wrong and the other is right

#

try fiddling with it to fix the error and then we'll take a look at your main plugin class again

polar forge
#

wait

polar forge
#

in the listener class right?

thorn isle
#

yes, that is the constructor of the listener class now

#

replaces this

    GriefNotifier plugin;
    public BlockBreakEventListener(GriefNotifier plugin) {
        this.plugin = plugin;
    }
polar forge
#

but this.plugin = plugin is also in the listener class

#

ok

thorn isle
#

remove that; like i said, just change the types, don't add a new constructor

polar forge
#

ok done

#

and yes an error

#
getServer().getPluginManager().registerEvents(new BlockBreakEventListener(new ToggleCommand()), this);```
thorn isle
#

right

#

this is one of the two ways to fix the error

#

the wrong way

#

let's see your onEnable in full

polar forge
#

is it wrong or right

#

i dont get it

thorn isle
#

this is wrong yes

#

but it's progress, still

#

let's see your onEnable method in full and I'll explain why and how to make it right

polar forge
thorn isle
#
    @Override
    public void onEnable() {
        // Plugin startup logic

        getServer().getPluginManager().registerEvents(new BlockBreakEventListener(new ToggleCommand()), this);
        getCommand("togglealert").setExecutor(new ToggleCommand());

    }
#

so here we see new ToggleCommand() twice

#

this means that you are actually creating two commands

#

you are creating one and passing it to the listener

#

and then you are creating another and registering it as a command

#

the problem with this is that now there are two toggle commands, there are also two toggled lists; one for each command

#

so what we want to do is only call new ToggleCommand() once but pass that to both the listener and the setExecutor

#

any ideas how to do that?

polar forge
#

no

thorn isle
#

what we need here is a way to hold on to a value for more than just a single expression

#

this would be achieved with a variable

#

let's take a look at your listener class

#
    public void onBlockBreak(BlockBreakEvent event) {
        Player breaker = event.getPlayer();
        Block block = event.getBlock();
        Location blockCoordinates = block.getLocation();

        long X = blockCoordinates.getBlockX();
        long Y = blockCoordinates.getBlockY();
        long Z = blockCoordinates.getBlockZ();

        broadcastMessageToOPs(breaker.getName() + " broke " + block.getBlockData().getMaterial() + " at x" + X + " y" + Y + " z" + Z);

    }
#

notice how we are calling block.getLocation() once but using the result thrice; to get its X, Y and Z coordinate

#

this is because we assign the value to the blockCoordinates variable