#help-development

1 messages · Page 1372 of 1

quaint mantle
#

I tried adding my Custom enchant to a book

#

but when i'm going to anvil

#

putting my book and my items

#

it doesn't give me a new tools

quiet ice
#

I have never programmed CEs via that method as I believe that it is a too large of a hack

quaint mantle
#
Player auth = (Player) sender;
ItemStack newBook = new ItemStack(Material.ENCHANTED_BOOK);
newBook.addUnsafeEnchantment(CustomEnchants.SAVE, 1);
auth.getInventory().addItem(newBook);
quiet ice
#

So I cannot really help you with these unintended consequences

quaint mantle
#

uh

#

i'm just trying to make a custom enchant

quiet ice
#

Though did you specify your enchantment targets?

quaint mantle
#

no

#

how can I

#

cause actually my enchantment is working with the book

quiet ice
#

By overriding the needed methods within your class that overrides Enchantment

quaint mantle
#

but not "in" the book

quiet ice
#

Because you force-set it

quaint mantle
#

like he said

quiet ice
#

Bukkit will not care at that point whether it makes any sense, it will care about it later, which is why it is needed

quaint mantle
#

how can I "non force"

#

you need to add your own functionality with a PrepareAnvilEvent listener if you want it to be compatible with anvils

#

🙁

quiet ice
#

Yeah, good luck with that

quaint mantle
#

like geol said its a pretty hacky subject, a lot of things you need to reimplement yourself

quiet ice
#

That has been the single most painfull thing when I added CEs in

quaint mantle
#

mhmmm

#

okay

#

is there any other way

#

i just want like there is an item

#

and

#

i can gave this item to another item, and the second item got the enchant

heavy path
eternal oxide
#

oh my, do you have some issue with making a full sentence on one line?

heavy path
#

Does anyone know how to fix this or what could cause this behavior?

eternal oxide
quiet ice
#

this has been an issue for a very long time

#

Provided it is what I think it is

heavy path
#

Since i have no clue where this error is thrown i cannot send any code

quiet ice
#

As far as I know there has been no fix as noone knows what the cause is

#

This could have changed since the last time i have heard of that was a few months ago

heavy path
#

Ok i testes something a while ago and I sometimes got this error when calling the hideNpcName function of my npc class https://pastebin.com/g1ricDpn

#

so maybe it is a problem with sending packets?

quiet ice
#

v1_13_R2

#

Are you using 1.13?

heavy path
#

yes

#

1.13.2

quiet ice
#

A rare sight indeed

quaint mantle
#

mhmm okay
so if i'm making an item and giving it the enchant using command, if I want to put this item in a shop (another plugin), how can I? Because, I need to put the name (minecraft:diamond_pickaxe), and I can put enchantments, like: "THORNS:3", so I tried "SAVE:1" (save is my enchantment), but it didn't worked. I guess it's because save is a custom plugin, is there any other way to "create" an item with this custom enchant

quaint mantle
#

yes ofc

#

but i do not want everyone to use the command just to get the enchantment

quiet ice
#

Did you also register the enchantment?

quaint mantle
#

what does it mean

quiet ice
#

Like, Enchamtents#register or whatever it is called

quaint mantle
#

i just made a custom enchantment, and adding it to the items i want

quiet ice
#

(with additional reflection hacks)

quaint mantle
#

i do not think i registered it

quiet ice
#

You may need to do it to unlock more through capabillities

quaint mantle
#
public class CustomEnchants {
    public static final Enchantment SAVE = new EnchantmentWrapper("save", "Save", 1);
    
    public static void register()
    {
        boolean registered = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(SAVE);
        
        if (!registered)
        {
            registerEnchantment(SAVE);
        }
    }
    
    public static void registerEnchantment(Enchantment enchantment)
    {
        boolean registered = true;
        try 
        {
            Field f = Enchantment.class.getDeclaredField("acceptingNew");
            f.setAccessible(true);
            f.set(null,  true);
            Enchantment.registerEnchantment(enchantment);
        }
        catch(Exception e)
        {
            registered = false;
            e.printStackTrace();
        }
        if (registered) 
        {
            
        }
    }
}

Does it mean it's registered?

quiet ice
#

yeah, that would work

quaint mantle
#

yes

#

i'll try again

heavy path
quiet ice
#

I decided to not prepend my message with >

#

The issue is that 1.13.2 has a very low adoption when it was released and is no longer much in use, so it lacks in having a community that knows stuff

heavy path
#

What would be the best version for a minigame or something like that then?

quiet ice
#

Ah yes, the minigame version dillema; there is no best version I am afraid, and your 1.13 compromise between modernity and speed is fairly good, though in most cases you go all out for 1.16

heavy path
#

ok so then another question is there another way to remove the name of a npc since how i do it is something i randomly found out but I dont know if that is the right way

arctic summit
#

?aste

#

?paste

queen dragonBOT
arctic summit
olive badger
#

Hello, i try to recode my plugins with gradle instead of maven but i have an issue with my install.

In my core i want split the different part but keep an mono repo (using multi-project).
I have done that but my dependencies is not shared (the module bukkit and bungeecord doesn't have api, and all module except bukkit doesn't have jetbrains annotation).

My repo : https://github.com/orblazer/gradle-bug
Note: im new in gradle

Thanks by advance

ivory sleet
#

Syr

#

Nice choice

#

What was the issue btw?

olive lance
#

if im searching for a string in a specific color what's the right way to do that

#

would it work if i just used §

quiet ice
#

There is no real way especially after Minimessage/Adventure

dusty herald
#

I suggest stripping the message down; what're you trying to do Gee?

olive lance
#

check for a display name on an item and the color of it determines what i do with it

dusty herald
#

hmm

#

If you're looking for reliable information I suggest using the displayname of a new itemstack based on that Material

#

since the displayname is changeable via an anvil

#

if you're not worried about that then yeah just get the display name and strip it

olive lance
#

how do you mean use a new itemstack

dusty herald
#

new ItemStack(Material)#getItemMeta().getDisplayName()

#

shows how it would look to the client if it were a new item

#

check the meta for nulls though

karmic sapphire
#

Hi guys any one got a nice example how to do custom enchantments in 1.16. i tried a few online examples but dont seem to get any to work

olive lance
#

oh you mean to do that when they obtain the item? And also if the name had a section sign in it and i searched with chatcolor would that work

dusty herald
#

what I have no idea, I usually use that method for my shop plugin for readability

quaint mantle
#

how can I set color with .setLore with Meta thingy

#
ItemMeta meta = currentItem.getItemMeta();
List<String> alLore = new ArrayList<String>();
alLore.add(ChatColor.GOLD + ChatColor.BOLD + "Save I");
meta.setLore(alLore);
currentItem.setItemMeta(meta);
#

The operator + is undefined for the argument type(s) net.md_5.bungee.api.ChatColor, net.md_5.bungee.api.ChatColor

quiet ice
#

Object#toString

quaint mantle
#

uh ?

quiet ice
#

So just ChatColor.GOLD.toString() + ChatColor.BOLD + "Save I"

quaint mantle
#

okay thanks

#

i don't need .ToString() for chatcolorbold?

quiet ice
#

Or ChatColor.GOLD + "" + ChatColor.BOLD + "Save I"

quaint mantle
#

okay ty

#

i got it

quiet ice
#

Now, because the Java compiler will do that automatically

#

At the bytecode level String concentration will use a String builder, so they are basically the same

sand vector
#

This is how I load my config.yml. Is this the same way to load other yml files?

quiet ice
#

nyes

quaint mantle
#

Hello, I'm making a Spigot plugin and following the wiki, when it says "In the window which now is coming up [project structure], you have to browse to your location where the SpigotAPI is stored." Do they want the Spigot-API folder or Spigot-1.16.5.jar?

olive lance
#

is dual hands still a thing in minecraft 1.16 cause i still dont know how to do it and a lot of methods are deprecated cause of it

quiet ice
#

Use maven instead

#

Yes, it still is

quaint mantle
quiet ice
#

yes

#

Using your IDE as your build system will haunt you later.
Of course you could also use gradle

quaint mantle
#

What is the difference between Maven and Gradle?

quiet ice
karmic sapphire
#

People will laugh but i use Eclipse as my IDE

olive lance
#

wow no material.isbrewingitem methods

#

smh

quiet ice
#

I use it too, but you should not use eclipse as your build system

#

The Material class is on the brink of getting deprecated either way

quaint mantle
#

how can I convert string like "&c" to ChatColor

quiet ice
#

It already is internally, you aren't really allowed to work on it

quaint mantle
#

using args in command

olive lance
#

geez

quiet ice
#

ChatColor#translateAlternateColorCodes

quaint mantle
#

because when i'm doing "&cAH" it just says "&cAH" as raw

golden turret
quiet ice
#

Don't use it for configs though

arctic summit
quiet ice
#

Encodings will haunt you otherwise

karmic sapphire
#

Hmmm is gradle very complicated to get started with?

golden turret
quiet ice
#

No

#

It depends on the system

#

Which is why it can have some issues

karmic sapphire
#

ill give it a go some time

quiet ice
#

Plus you can basically copy+paste the build script for every plugin, which is extra pog

olive lance
#

does anybody have a link to a method i can use to deserialize a potion effect from a config

lunar folio
#

Hey I'm storing two things in a dictionary:

blockData.put(block.getLocation(), player.getUniqueId().toString());

A blocks location object and a players UUID as a string. I want to be able to pull that UUID when I do:

blockData.get(aBlock.getlocation())

yet when I try to do it as a Player:

Player playerBlock = blockData.get(block.getLocation());

it doesn't work as it wants an object to be returned. How would I do this

quaint mantle
#

how could I convert a string like "&c Hey" to chat color

#

without using ChatColor.GOLD

lunar folio
quaint mantle
#

so I could just use .replace method ?

quiet ice
#

No

#

ChatColor#translateAlternateColorCodes

As I already said

lunar folio
#

Hm, thanks.

quiet ice
#

Example ChatColor.translateAlternateColorCodes('&', "&4random & bits")

#

Which is also why you should NOT use String#replace

quaint mantle
#

ty

unkempt ore
#

Is there a quick way to support @ selectors in my commands

#

Hmmmm, PsudoCommands plugin

#

Weird that that's not in the Spigot interface itself. Entity[] getEntitySelection(String) or something

unkempt ore
#

@a @e[type=!Player] @a[r=10]

#

@p

#

etc.

quaint mantle
#

Using Tab Completion?

unkempt ore
#

What?

#

That's not what I mean

#

Unless I'm misunderstanding you

#

Say I have a command in my plugin, and I want to be able to pass it a set of players, like in vanilla commands

quaint mantle
#

so /test @a

unkempt ore
#

Yes

#

And it would be a set of Players

#

And /test PlayerName would be a set of Players with one member

quaint mantle
quiet ice
#

There is something that would help you

unkempt ore
#

Psudo Commands, I found it

#

And I don't see how a tab completer is related to this

quiet ice
#

Bukkit has a built in feature for that

unkempt ore
#

Oh?

quiet ice
#

I cannot recall the name of it, but it is in the bukkit class

unkempt ore
#

Lemme see

#

getTag(s)()

#

?

quiet ice
#

Bukkit.selectEntities

unkempt ore
#

Oh baby

#

Hell yeah

#

That seems to be exactly what I needed

quiet ice
#

It also supports parsing player names and UUIDs

unkempt ore
#

Great

#

I don't seem to have the Bukkit docs in my Maven, they're separate, right?

quiet ice
#

They are a pain to resolve, and I still don't know how to get them automatically

#

But eclipse (don't know about intelliJ) appears to generate the javadocs automatically if I tell it to download the sources jar (unfortunately that is not a maven/gradle operation)

unkempt ore
#

Oh, I thought I just had to install the docs separate from the API

#

Doesn't sound very far fetched

#

Docs are big

#

I'll see what it is

quiet ice
unkempt ore
#

You're insane if you think I'll touch a jar manually when a build tool is a possibility

#

I did that before knowing better. Sad life I was living lmao

quiet ice
#

I was just saying that you can add these jars to your IDE globally, under normal circumstances your IDE should pick them up without thinking twice about it, but sometimes IDE do not behave like we want them to

crisp iron
chrome beacon
#

Add some debug messages

quaint mantle
#

hey guys, i'm beginner, how can I add "info"

#

like when i start my server it says "xxx is starting!"

woeful crescent
#

?

#

You mean send a message on enable?

quaint mantle
#

yes

woeful crescent
#

uh

quaint mantle
#

but "log" the messages

#

you know

woeful crescent
#

What do you mean by log the messages

#

which ones

quaint mantle
#

when you start, your server, every plugins are writing into the console "<plugin> is starting!"

woeful crescent
#

Ok...

#

So in your onEnable() print whatever you want

quaint mantle
#

System.out.println?

woeful crescent
#

You can use that

quaint mantle
#

ok ty

woeful crescent
#

But for bukkit, the recommended method is Bukkit.getConsoleSender().sendMessage(String yourMessage);

#

Again, you can still use System.out.println()

#

the other one is just recomended

rugged topaz
#

anyone know what the best way to store data inside mysql for a server? since there's a table then there's values, and it would be easy to create an element of a player's uuid as the primary key each time, what would be the way to store server data such as the most amount of ppl on at a time, spawn location, etc.?

woeful crescent
#

Oh, what?

#

is it logger?

quiet ice
#

Bukkit.getLogger().info("") is just a bit more better, but still not the recommended way

#

The recommended way is using the plugin logger

woeful crescent
#

What's wrong with consoleSender?

quiet ice
#

It litterally performs a command

quaint mantle
quaint mantle
quiet ice
#

Yeah, ignore that

#

But still not the recommended way

quaint mantle
#

its literally just a better System.out.println

#

nothing wrong with it

fading palm
#

anyone know why every method in Velocity's Command class is deprecated

olive lance
#

how would you get all online players in a Player[] i cant think of how to initialize the array after checking if everyone is online

#

without checking everyone twice

#

also not using getOnlinePlayers

fading palm
#

that's like the best way to do it

quaint mantle
#

why not

olive lance
#

well its not all online players im trying to do just certain ones

#

but it applies the same way

fading palm
#

ArrayList<Player> players = Bukkit.getOnlinePlayers() then for loop through them?

quiet ice
#

No, it's a collection afaik

quaint mantle
#

getOnlinePlayers().stream().filter(i -> i.getName().equals("Username")).collect(Collectors.toList());

ivory sleet
#

iirc the list implementation isn’t exposed

quiet ice
#

So don't assume that it is a list, since it can also be a hashset

ivory sleet
#

Oh yeah very true

rotund ravine
#

Or any other collection

#

Also it doesn’t contain Playee

#

Player*

quaint mantle
#

? extends Player

rotund ravine
#

Yeah, it contains something which extends Player

quaint mantle
#

so whats the problem

#

lol

quiet ice
#

In most circumstances that is CraftPlayer

olive lance
#

that gives a list i guess id just go to an array from then. I was trying to do it without arraylists or collections but i guess its not possible

rotund ravine
#

Cause it’s not really a Player, but still a Player

#

You can’t declare it to a Player Set without casting

#

Your method does not care tho

#

If you stream it

ivory sleet
#

You can #map(Player::getPlayer) probably

quaint mantle
#

that would be craftplayer

#

iirc

#

nope

lost matrix
storm tiger
#

Im searching through mongodb looking for values in an descending order with the limit of ten, all of them return their Winstreak from mongo (which is correct) then i use a linked hash map to put it in, but after i put all the values in the map it doesn't have the correct values.

Here is the code:
https://gyazo.com/583d0b99fc49edb712d1160780e7bf2c

lost matrix
storm tiger
#

topStats gets put into cachedStatistics

#

well into another map with the kit name with the stats

lost matrix
#

And the values printed there are right?

#

Speaking of the values printed inside the foreach loop

storm tiger
#

the values printined in the map are incorrect, somehow the double is 0.0 when in mongo its 3.0

lost matrix
quaint mantle
#

That means ur boolean value is false

#

Debug the statistic name and if kitDocument is null ^^

storm tiger
#

its not though, because when i print after it says the correct value.

#

statistic is a enum

quaint mantle
#

kitDocument probably doesnt have the stat name as a key

#

If you're really sure it's returning true, then try changing the 0.0 to a different number. If you get that diff #, then the boolean value is for sure false.

lost matrix
#

Oh i see you dont use return values here but just shove it into a "toInsert" variable. Thats a method with side effects and makes this code quite a bit harder to debug...
But first make some null checks just to be sure

quaint mantle
#

Otherwise if you still get 0.0, then you know there is something wrong with one of your queries elsewhere

lost matrix
# storm tiger statistic is a enum

Are the methods "getTopTenStatistics" (which actually isnt a getter btw) and "refreshFormattedStat" called consecutively on the same thread?

lunar folio
#

How can I make a player respawn at a specific block?

storm tiger
#

They should be called on the same thread (obviously not the main)

#

Im going to change the method name, was just trying to figure this problem out

lost matrix
storm tiger
#

only refresh calls getTopTen

lost matrix
#

But i dont see the refresh method doing anything with the result from your "getTopTenStatistics" method.
The values get just put into some ominous "toInsert" map which is not accessed by the refresh method.

lunar folio
#

Thanks!

storm tiger
#

the toInsert map is from the refresh method, the method creates "topStat" which is a linked hash map and passes it though the method params for getTopTenStatistics, which is then thrown into another map with the key of the kit and a value of the stats, which that map is thrown into cached stats after all kits have been looped

lost matrix
#

Oh i didnt see the method parameter there

lost matrix
storm tiger
#

yeah as ay.ngel told me todo is change the 0.0 and it did change all the values, but i don't see how it gets to that.

#

the checks are correct

lost matrix
#

Ok. Then we are back to our first recommendation.
Check if kitDocument is null or if the kitDocument does not contain the statistics key by just logging that beforehand.

storm tiger
#

i did a check on that already, most are not, some are, which is why i handle that, and i did the contain key and its also the same, true or false if it does.

lost matrix
cinder thistle
storm tiger
#

🤷‍♂️

#

i can unboost real fast

cinder thistle
#

lol

sullen marlin
quiet ice
#

I can now finally compile my Java 16 plugins again!

sullen marlin
#

Lots of counterpoints to gradle is the best

lost matrix
#

I dont want to switch to gradle... i just got nice and comfy with my xml mess

#

Wait, they are all trash talking gradle in there

eternal oxide
#

I just moved from Ant to Maven around 1 year ago. I refuse to move for another 10 years now.

ornate hollow
#

i want to create an api enpoint in my spigot plugin but spring boot and spigot dont work together

I need this in order to retrive players balance from discord id (i already have that logic done)

I will call this from a Fabric mod, what do you recommend me to do now? I heave hard some chat channels but i dont understand at all how they do

#

Would be cool tho if its simple to have an api endpoint for a website or something i plan to do in future

lost matrix
quiet ice
#

You could do a subproccess for your spring boot and do some network IO stuff between the two

ornate hollow
lost matrix
ornate hollow
lost matrix
sullen marlin
#

Yeah I also dunno why spring boot wouldn't work, but jeez 900 pound gorilla

lost matrix
#

"Sry your plugin is 415.17MB above the sites limit"

ornate hollow
#

i study in my native so i never get to hear actual terms in java programmiung, thanks to forums i can actually learn theme

#

like for god sake you have no clue how bad they translate stuff, so unatural

lost matrix
#

Wait. You just want to retrieve the number of users from a fabric mod?

ornate hollow
# lost matrix Ok so you have 2 different servers running? A fabric and a spigot one. Right?

No no no, i have only one server a spigot server that has vault installed, i made a plugin that works as a discord bot and has all the uuids and discord ids linked together in a database, i will use this api endpoing for the discord rpc mod for farbic (since everyone uses fabric). I already have the logic of retriving the balance ready and tested as a discord command so that is not an issue, i need to chose how spigot server and fabric mod for client will communicate

#

So my main question is what would be the best way for a spigot server and a fabric client mod to communicate? Should i make a simple tcp server and do it all that way?

lost matrix
#

From fabric -> spigot

olive badger
#

@ornate hollow you probably could use plugin message or create an custom packet

ornate hollow
#

it would be super simple, single string lmao

lost matrix
#

Or (controversial) you just access the data from an external source like a database or simply use redis as shared memory (maybe even using pub/sub system). This way you dont need to worry about communication.
But if you want communication then the messaging channel is probably the way to go.

ornate hollow
#

Yeah this is a very very nice idea mate

#

Wow thanks

lost matrix
#

If you have your own Economy implementation then you could actually just sit your vault data behind a spring application and let both the client and the server
just access this endpoint. And the endpoint can then also be accessed by websites etc.

ornate hollow
#

thank you

quaint mantle
#
Exception in thread "main" java.lang.NullPointerException
        at me.imaginedev.imengine.GameWindow.addImage(GameWindow.java:26)
        at Main.main(Main.java:16)
#
game.addImage(new ImageIcon("player.png").getImage(), 0, 0);
ornate hollow
#

put the image in project root

#

it will work

lost matrix
quaint mantle
#

didnt want the obvious

quaint mantle
unkempt ore
#

What's the format for ConfigurationSection#getLocation

lost matrix
#

This path is resolved relative to your executed application. So you have 2 options:

  1. Extract all data you want to use into a folder when your application starts and load it into memory when you need it.
  2. Use the ClassLoader to gain access to resources. Those will be streamed and therefore provided as InputStreams.
quaint mantle
crisp iron
zinc saffron
#

Should i use that:

                event.setCancelled(true);
            }```

or that:

```for (ItemStack equipmentPiece : armorstand.getEquipment().getArmorContents()) {
    if (isCrashItem(equipmentPiece)) event.setCancelled(true);```
quaint mantle
unkempt ore
#

Oh, wait, it is a path

#

No, I'm reading the docs

#

I don't know what a path is then, lmao

quaint mantle
#
a:
  b: 2 # a.b is the path
lost matrix
unkempt ore
#

Dude

#

I'm asking about the config's format to parse a Location from

#

Does it just need x y and z children? Yaw, pitch?

quaint mantle
#

test it out

crisp iron
#

ideally it should

quaint mantle
#
@Override
public void onEnable() {
    saveDefaultConfig();
    getConfig().set("a", new Location(2, 2, 2));
    saveConfig();
}
unkempt ore
#

Why isn't that in the docs. That would belong in the docs

#

Man

quaint mantle
#

no idea

lost matrix
unkempt ore
#

That is a good idea

#

Thank you

lost matrix
unkempt ore
#

What?

#

Never use getLocation(String)?

mortal hare
#

is #Enum.valueOf("enumname")'s time complexity O(1) or** O(n)**? Does it loop the enums internally? or it is an internal hashtable, which makes it O(1)?

quaint mantle
#

you should probs just parse your own if i were you

lost matrix
# unkempt ore What?

Dont deserialize by hand.
Just let the serializer resolve the structure:
Location loc = section.getLocation("path.to.your.location");

mortal hare
#

anyone?

lost matrix
unkempt ore
#

Smile, I don't understand how I'm not making myself clear. I'm saying the docs should be a bit more specific, like "Path to a ConfigurationSection with x, y and z children, and optional yaw and pitch children"

mortal hare
lost matrix
unkempt ore
#

Well, yeah, at least those children

zinc saffron
#

Is it faster?

quaint mantle
#

We need another help channel ffs

lost matrix
quaint mantle
#

oops didnt mean static

zinc saffron
#

so no difference?

unkempt ore
#

Smile, my statement didn't say only those children. It should just have those children available

lost matrix
unkempt ore
#

Is there something I'm not understanding

quaint mantle
#

Hi I’m trying to make this work but booleans can’t be with void and I’m not sure how to fix this:

public class list implements Listener {
    @EventHandler
    public static void onChat(AsyncPlayerChatEvent e) {
        Player p = e.getPlayer();
        if (p.setSneaking(true)) {
            p.sendMessage("hey");
        }
    }
}

Here is the error:

   java: incompatible types: void cannot be converted to boolean   

How can I fix this or am I doing something wrong with the event?

unkempt ore
#

"static"

#

Nice

#

Didn't know you could do that

lost matrix
#

You can shove a location into whatever section you want.

  @Override
  public void onEnable() {
    final File testFile = new File(this.getDataFolder(), "test.yml");
    final FileConfiguration configuration = new YamlConfiguration();
    final Location spawnLoc = Bukkit.getWorlds().get(0).getSpawnLocation();
    configuration.set("I.Am.A.Spawn.Location", spawnLoc);
    try {
      configuration.save(testFile);
    } catch (final IOException e) {
      e.printStackTrace();
    }
    final Location deserializedLocation = configuration.getLocation("I.Am.A.Spawn.Location");
  }

The path doesnt matter.

unkempt ore
#

Booked, the error doesn't seem to be there

ornate heart
#

The method shouldn’t be static.
Your class name should start with an uppercase letter.
I believe you meant to use p.isSneaking()

#

@quaint mantle

unkempt ore
#

Why can't it be static, exactly

unkempt ore
eternal oxide
#

No need for static, you shoudl never ever call it yourself

unkempt ore
#

No need, but is it erroneous

quaint mantle
#

Okay thanks

eternal oxide
#

No idea if it woudl even work. It has to match the pattern Bukkit expects for the Eventhandler

unkempt ore
#

It's annotated. But then again, you give an instance of the listener, not its Class

eternal oxide
#

The annotation just says "look here" to Bukkit.

unkempt ore
#

Yeah, that's what I'm thinking

eternal oxide
#

It doesn;t mena take thsi as a handler no matter what

unkempt ore
#

So static doesn't feel like it would be a problem

lost matrix
#

The class is scanned for annotated methods so static ones should get picked up. The relfective invocation of static methods is
actually a little bit faster than the one from instanced ones. But you should not worry about that when writing a plugin. Making them
static is just dirty.

unkempt ore
#

Awesome, we guessed it

#

Speaking of static

#

Please help me guys. I'm helping these kids with their plugin and...

lost matrix
#

Especially because the jit optimizes reflective invocations pretty well (to the point where you cant distinguish them from normal ones)

unkempt ore
#

They're making...mutable...static...utility....classes

lost matrix
#

The whole event handling of spigot is not really state of the art. But it was written before the functional API of Java 8 became a thing and it would be unthinkable to change that now.

eternal night
#

good, make it all static

unkempt ore
#

No

#

Please

sullen marlin
#

Really

#

Why does it all have to be lambdas

#

Though there is an alternate api where you could pass lambdas in

unkempt ore
#

To what?

sullen marlin
#

But annotations have far less boilerplate imo

lost matrix
#

It does not need to be all lambdas. The interfaces can also have concrete implementations.

lost matrix
lost matrix
sullen marlin
#

Theres the registerEvent interface that takes an event and a handler

#

I’m not sure what your idea of state of the art event handling would be

woeful birch
unkempt ore
#

The better pattern in my opinion is the having a top level interface for any event, and abstract classes implementing it for types of events sharing data. Then an "adapter" kind of class implementing an interface for listening to the top level event, say "EventHandler", and instanceofing it to see which abstract method to cast the instance into. Then extending the adapter, and overriding whatever methods are of interest. And the event firing object just takes EventHandler instances

#

At least this is what I'm most familiar with

#

I'm not sure if the pattern has a name

lost matrix
sullen marlin
#

That pattern is silly and slow when you have as many events as bukkit

unkempt ore
#

Ah, that is true

sullen marlin
#

Bukkit used to do it hat way 10 years ago

unkempt ore
#

Mind explaining what exactly it does now? I haven't looked into it

lost matrix
#

Slow in terms of development speed?

unkempt ore
#

That and speed in general

sullen marlin
#

Also makes custom events second class

unkempt ore
#

It would become huge, it's true

#

With so many events firing

ivory sleet
#

Doesn’t jda have like a generic event thing like you described Operation21

lost matrix
unkempt ore
#

That is exactly what I described hahaha

sullen marlin
#

Not sure what type safe means, and reflection is kind of unavoidable unless you force events to be registered. People hate on reflection too much anyway, its rather optimised internally

lost matrix
# sullen marlin Not sure what type safe means, and reflection is kind of unavoidable unless you ...

I actually ran some jmh benchmarks which resulted in reflective invocations being optimized by the jit several minutes before the concrete implementation ones. (On Java 11 they are fast and on 11+ they are indistinguishable from normal method calls)
But the fact that i dont see this approach in enterprise code just made me wonder if there isnt a better way of registering events.
By type safe i mean that this will compile fine but throws runtime exceptions:

  @EventHandler
  public void onBreak(final BlockBreakEvent breakEvent, final BlockPlaceEvent placeEvent) {

  }
eternal night
#

Where are the spigot compile maven plugins when we need them

lost matrix
eternal night
#

Idk XD run exactly those checks lol

lost matrix
#

Ah i see. You can surely write Sonar checkrules for that lul

eternal night
#

Probably 😂 but where is the fun in that

lost matrix
#

No idea. Imagine code quality concerns in spigot plguins...

unkempt ore
#

How does that double handler work

eternal oxide
#

it doesn't

unkempt ore
#

Oh, I see

olive lance
#

I would never put my plugins on a resume at least the ones I’ve done so far

#

The code sucks

ornate hollow
solemn shoal
#

i think this uses it?

#

not sure tho

#

you could check the jar, check if it has the library

#

oh wait nvm

#

spark framework is for web apps in java

ornate hollow
#

yeah it doesnt sue it

solemn shoal
#

no idea, never tried it

ornate hollow
#

i just looked at gradle

#

I mean all i need is a very very basic single api endpoint

solemn shoal
#

i usually write my webapps with ASP.NET Core in C#

arctic summit
ornate hollow
#

i in spring boot but the plugin would be 1gb so not this time

solemn shoal
#

youre setting gamemode to survival? @arctic summit

arctic summit
#

yeah

solemn shoal
#

what is it otherwise?

arctic summit
#

im trying to teleport players after a game is over back to the lobby

#

but i think i fall thru the floor or smthn

#

bc i keep falling to like -5k and dont take void damage

#

and for some reason

#

players who are in spectator

#

stay in spectator

drowsy helm
#

so they instantly go to -5k

#

or?

arctic summit
#

no, i just fall

#

forever

#

from y 71

drowsy helm
#

do the for loop within your runnable

#

rather than a runnable for each player

arctic summit
#

but wouldnt that make it wait 5 seconds for each player?

drowsy helm
#

no

lost matrix
arctic summit
#

its a 5 second delay bc its supposed to run after a title appears and dissapears

drowsy helm
#

after 100 ticks, the for loop starts

#

it doesnt wait between iterations

arctic summit
#

oh ok

#

?paste

queen dragonBOT
arctic summit
#

so like this?

drowsy helm
#

yeah

arctic summit
#

ok ill try it out

lost matrix
# arctic summit oh ok

Try acquiring a chunk ticket for the target chunk. Then teleport after a short delay (20 ticks or so)

arctic summit
#

a chunk ticket?

drowsy helm
#

load the chunk

lost matrix
#

Teleporting all users at once should not be a problem.

drowsy helm
#

just saves having 20 different runnables

#

when you can just have 1

#

also assuming players1v1, redTeam1v1, blueTeam1v1 and specators1v1 doesnt rely on the player variable, you can move that out of your for loop

arctic summit
drowsy helm
#

.addPluginChunkTicket(Plugin)

#

.load can be funky

arctic summit
#

ok

quaint mantle
#

:)

lost matrix
# arctic summit wait so i would do Bukkit.getWorld.getChunk.load()?

Try this

  public void teleportAllPlayersToPotentiallyUnloadedLocation(final Location location, final Collection<Player> playerCollection) {
    final Chunk chunk = location.getChunk();
    chunk.addPluginChunkTicket(plugin);
    Bukkit.getScheduler().runTaskLater(plugin, () -> {
      playerCollection.forEach(player -> player.teleport(location));
      chunk.removePluginChunkTicket(plugin);
    }, 20L);
  }
drowsy helm
#

thats a mouthfull lmao

arctic summit
#

thank you

left swift
#

hello, how can I block noteblock from updating? I put a noteblock with a given instrument, but after updating the block under the noteblock, the instrument updates.

lost matrix
#

lies. This is not verbose enough

drowsy helm
#

i have code for that, one min

lost matrix
arctic summit
#

?paste

queen dragonBOT
arctic summit
#

so it should look like this?

lost matrix
#

And you try to remove it for every player afterwards too.

drowsy helm
# left swift hello, how can I block noteblock from updating? I put a noteblock with a given i...
private CustomBlockType blockType;
    private NoteBlock nb;
    
    @EventHandler(priority = EventPriority.HIGHEST)
    public void physics(BlockPhysicsEvent e) {
        if(e.getBlock().getType() == Material.NOTE_BLOCK) {
            if(!e.getSourceBlock().getRelative(BlockFace.UP).equals(e.getBlock())) return;
            
            nb = (NoteBlock) e.getBlock().getBlockData();            
            if(CustomBlockType.getType(nb.getInstrument(), Byte.toUnsignedInt(nb.getNote().getId())) != null)
                blockType = CustomBlockType.getType(nb.getInstrument(), Byte.toUnsignedInt(nb.getNote().getId()));
            
            Bukkit.getScheduler().runTaskLater(ClusterCore.getInstance(), new Runnable() {
                @Override
                public void run() {    
                    nb.setInstrument(blockType.instrument);
                    nb.setNote(new Note(blockType.note));
                    e.getBlock().setBlockData(nb);
                }
            }, 1);
        }
    }```
It's nto the best way to do it, but just cache the noteblock and replace it. Otherwise theres no immediate way to change it
#

theres other methods that i've seen that do the same thing pretty much

#

thats using some of my own code so you'll have to fiddle around with it

arctic summit
left swift
#

thx, i try it

bitter ridge
#

Can you use Block variable type in switch()?

lost matrix
# left swift thx, i try it

This is my ocd version of that code:

  @EventHandler(priority = EventPriority.HIGHEST)
  public void physics(final BlockPhysicsEvent event) {
    if (event.getBlock().getType() != Material.NOTE_BLOCK) {
      return;
    }

    final Block eventBlock = event.getBlock();
    if (!event.getSourceBlock().getRelative(BlockFace.UP).equals(eventBlock)) {
      return;
    }

    final NoteBlock noteBlock = (NoteBlock) eventBlock.getBlockData();
    final Instrument instrument = noteBlock.getInstrument();
    final Note note = noteBlock.getNote();

    Bukkit.getScheduler().runTask(plugin, () -> {
      noteBlock.setInstrument(instrument);
      noteBlock.setNote(note);
      eventBlock.setBlockData(noteBlock);
    });

  }
lost matrix
bitter ridge
#

Like this?

public void remove(int x, int y, int z, World world, Block block) {
        switch (block){
            case Material.BEDROCK:
                //code
                break;
            case Material.COBBLESTONE:
                //code
                break;
        }
    }
lost matrix
# arctic summit so what should i do?

You could create a collection of Players by iterating over the collection of UUIDs.
Then at the end you just call the teleportAllPlayersToPotentiallyUnloadedLocation with that collection of Players ^^

lost matrix
# arctic summit so what should i do?

Or you can do the following in your own code:
Acquire the ticked before the runnable.
Then release the ticket after every player was teleported.
Thats probably better

drowsy helm
#

thanks for cleaning that up for me smile

lost matrix
# woeful birch Bump

The PacketPlayOutRelEntityMove packet is fired very often and only for fractions of the actual target location.
For players there is an extra packet for position/rotation. So you would need to implement the complete movement yourself
and send a ton of packets for lowly walking the player to the target location.

solemn shoal
#

i just found a weird thing in the spigot api

solemn shoal
#

imagine i is a tool/armor piece

#

i.setDurability(i.getDurability() + 1);

#

guess what this does

lost matrix
solemn shoal
#

no it doesnt

#

im not using an ancient spigot version actually

lost matrix
#

If i is of type ItemStack then yes. If its Damageable then no.

#

Ok go ahead. It reduces the durability by one.

solemn shoal
#

i was about to point that out

#

i think it makes no sense lol

#

should be called setDamage instead of setDurability

lost matrix
#

It increases the received damage... so it kind of makes sense.

#

Damage goes up -> Durability goes down

solemn shoal
#

but its called setDurability

lost matrix
#

But ive been there and have done that like many others.

#

I also think it is quite ambiguous.

solemn shoal
#

wait how can i check if an item is damageable?

quaint mantle
#

instanceof Durable

#

iirc

quaint mantle
#

or Damagable

solemn shoal
#

ah

lost matrix
solemn shoal
#

i was using ItemStack#setDurability(short)

#

did not know about damageable

lost matrix
#

But alright now you know ^^

solemn shoal
#

its still in spigot 1.16.5

lost matrix
#

Didnt know that it still exists ;P

solemn shoal
#

ah, yeah it does

#

but marked as deprecated

#

i instanceof Damageable this should work for checking if its damageable no?

quaint mantle
#

ye

solemn shoal
#

wait

#

what happens if i is null

#

never tried instanceof on null

quaint mantle
#

youll get an npe

solemn shoal
#

a stackoverflow post from 2010 says itll just return false

lost matrix
quaint mantle
solemn shoal
#

same

hot silo
#

Was "org.spigotmc.spigot" removed from the repository?

eternal oxide
#

There has never been a public spigot repo, only the API

patent ice
#

Lies

quaint mantle
#

i thought there was?

hot silo
#

Hmm, I think I just used to remove "-api" from my dependencies and it would add all the NMS stuff

eternal oxide
#

Its illegal to distribute spigot

quaint mantle
patent ice
#

Lier

solemn shoal
#

?bt

queen dragonBOT
quaint mantle
solemn shoal
#

run buildtools

hot silo
#

wack

solemn shoal
#

it puts org.spigotmc.spigot in ur local repo

hot silo
#

thanks 🙂

#

just dumb they removed it

#

buildtools 😴

drowsy helm
#

its a legal thing, they had to

hot silo
#

all good, just takes a lot of time to download and install everything, a bit frustrating

sharp dove
#

can someone help me out im making a plugin that uses chatevent to send messages to people when they say one of the key words like buy or help | shop and stuff like that but i have another plugin that addes [player] or [there rank] of there message so the chat event picks up there [player] first

drowsy helm
#

can you give an example?

#

I dont see hwo that owuld be an issue

quaint mantle
#

so like if someone types "hey im new" and i have that as a key word so when they say that it sends them info messages but with my other plugin its makes them send "[player] hey im new"

#

oh btw this is my alt lol

#

just sent message wrong acc

unreal quartz
#

you've just magically changed identities have you

quaint mantle
#

lmao

sharp dove
#

2 acc

unreal quartz
#

jokes aside, can't you just check what the message contains?

drowsy helm
#

use player async chat event

#

and you can get message

#

rather than the entire line

quaint mantle
#

ah ok thanks

snow bane
#

hey, so i have this method that checks for the lowest item amount in a crafting grid so that it changes the result of a custom item's amount, but it doesnt run. i tried adding system logs in the PrepareItemCraftEvent aswell but none of them run for some reason, so i can't really tell whats wrong
https://paste.myst.rs/vqh3mtla

lost matrix
#

Any reason why you dont implement crafting recipes for items?

drowsy helm
#

if you have a regular recipe it will do it for you

#

messing with ItemCraftEvent isn't really advised, it's super buggy if you try to mess with the result

snow bane
#

na its a shapedrecipe

#

and it wasnt doing it for me

snow bane
lost matrix
# snow bane i have them in a seperate file

Ah i see. Then you should use the namespaces of the recipes for detection.
Would you be interested in an approach that lets each recipe handle custom conditions and
actions for the event they are crafted in?

snow bane
#

that would be cool yes

lost matrix
#

Ok ill write an example. Might take some minutes

snow bane
#

but for now im just trying to have it so the result's amount changes depending on how much items are in the grid

#

like if u had 2 wooden planks on 4 squares u would get 2 crafting tables

lost matrix
drowsy helm
#
            int amount = 64;
            for(Integer i : interactableSlots) {
                if(invInstance.getItem(i) == null || invInstance.getItem(i).getType() == Material.AIR) continue;
                if(invInstance.getItem(i).getAmount() < amount) amount = invInstance.getItem(i).getAmount();
            }```
That's how i handle shift clicking in my custom inventory
#

assuming the recipe is correct, you just find the lowest amount in the matrix

snow bane
#

wait ill take a screenshot

crisp iron
snow bane
#

is there anywhere where i can put an image

drowsy helm
#

you have to verify your acc

snow bane
#

oh i dont have an account

#

ig ill just dm it to u guys

drowsy helm
#

yeah i see it

snow bane
#

so yeah it doesnt do it

drowsy helm
#

look at the code block i sent, that will give the max amount of craftable items

#

you'll have to change it to work with your matrix

#

but assuming your recipe is complete, and the recipe only takes 1 item per slot, you just get the smallest amount from the matrix

snow bane
#

the checkMultiples method

#

it does nothing tho

drowsy helm
#

no need for multiple for loops

snow bane
#

wait does getMatrix return an arraylist object?

drowsy helm
#
    public Integer checkMultiples(PrepareItemCraftEvent event) {
        int amount = 64;
        for (ItemStack item : event.getInventory().getMatrix()) {
            if (item != null) {
                if(item.getAmount() < amount)
                   amount = item.getAmount();
            }

        }
        return amount;
    }```
#

reduce the complexity then you have less points of possible failure

lost matrix
#

Oh i see... you want to set the amount of the result to the smallest amount of the input.
But why? This will really mess up the recipe when someone shift clicks.

snow bane
#

i didnt think of that rip

snow bane
#

it just goes lower and lower as it goes

drowsy helm
#

yep

#

it jsut goes to the lowest stack amount in the matrix

snow bane
#

idk why i made an arraylist while getMatrix literally returns the list

#

lemme see if it works

drowsy helm
#

and Integer temp = list.get(0); assumes the 1st element is the highest

snow bane
#

but wouldnt that not matter if i check if the other elements are smaller?

drowsy helm
#

could be higher though

snow bane
#

but that wouldnt be important if im just looking for the smallest one

drowsy helm
#

oh actually

#

i see where you're coming from

snow bane
#

alr wait so lemme check if it works

drowsy helm
#

yeah

snow bane
#

wait lemme send u the image

lost matrix
drowsy helm
#

man why did i never think of extending ShapedRecipe

#

im gonna rewrite my crafting system

snow bane
#

ive never understood how extending work i should read up on that

#

cuz it seems powerful

lost matrix
#

Or a new sub-class that restricts certain recipes:

public abstract class RestrictedShapedRecipe extends CustomShapedRecipe {

  public RestrictedShapedRecipe(@NotNull final NamespacedKey key, @NotNull final ItemStack result) {
    super(key, result);
  }

  @Override
  public void handlePreparation(final PrepareItemCraftEvent event) {
    if (!this.isAllowedToCraft((Player) event.getView().getPlayer())) {
      event.getInventory().setResult(null);
      this.handleFail(event);
      return;
    }
    this.handleSuccess(event);
  }

  public abstract void handleFail(PrepareItemCraftEvent event);

  public abstract void handleSuccess(PrepareItemCraftEvent event);

  public abstract boolean isAllowedToCraft(Player player);

}

This recipe can only be crafted in a MOUNTAIN biome and above height 200:

public class MountainRecipe extends RestrictedShapedRecipe {

  public MountainRecipe() {
    super(NamespacedKey.minecraft("mountain_recipe"), new ItemStack(Material.GOLD_BLOCK));
    super.shape("gg", "gg");
    super.setIngredient('g', Material.GOLD_INGOT);
  }

  @Override
  public void handleFail(final PrepareItemCraftEvent event) {
    event.getView().getPlayer().sendMessage("You can only attempt this recipe high in the mountains.");
  }

  @Override
  public void handleSuccess(final PrepareItemCraftEvent event) {
    
  }

  @Override
  public boolean isAllowedToCraft(final Player player) {
    final World world = player.getWorld();
    final Location playerLoc = player.getLocation();
    final Biome biome = world.getBiome(playerLoc.getBlockX(), playerLoc.getBlockY(), playerLoc.getBlockZ());
    if (biome != Biome.MOUNTAINS) {
      return false;
    }
    return playerLoc.getY() > 200;
  }
}
#

The chat spam...

drowsy helm
#

I'm still weary on messing with PrepareItemCraftEvent result

#

last time i tried that i ended up getting over 64 stacks of items

lost matrix
#

If you set it null then you cant do anything wrong. But i would also not mess with the result.

solemn shoal
#

question, can spigot load an extracted plugin from a folder?

lost matrix
solemn shoal
#

extracted like this

lost matrix
#

Oh wait... do you mean that you extracted all contents of a jar file into a folder??

drowsy helm
#

#general message

#

found it lol

solemn shoal
#

i dont wanna have to deal with having to shut down my server, halt the batch script, drag the folder into my jar file in 7zip, unhalt the script @lost matrix

drowsy helm
# solemn shoal how

was messing around with PrepareItemCraftEvent, like i was saying it's super iffy lol

solemn shoal
#

lmao

lost matrix
solemn shoal
#

i havent been able to get it to make a jar @lost matrix

lost matrix
solemn shoal
#

im using gradle

lost matrix
#

Gradle has an instane learning curve. Its basically a wall. If you have never used dependency managers before then i would def recommend you to use maven.
You will get a lot more help with it. Especially in the spigot community.

solemn shoal
#

i didnt even know maven was scriptable

crisp iron
solemn shoal
#

check number % 9

crisp iron
#

i did

solemn shoal
#

if number % 9 == 0 its divisible

crisp iron
#

but still nothing

eternal oxide
#

um, why not just +9 to your current number?

drowsy helm
#

whaty do you mean "next" number

lost matrix
crisp iron
#

@eternal oxide inventory requires your size to be divisble by 9

#

can't be between 0 and 54

lost matrix
eternal oxide
#

Yes, so +9 it will always be divisible by 9

crisp iron
#

so lets say im given the number 10,

drowsy helm
#

your question is super vague

crisp iron
#

it should return 18

#

the next value that is divisble by 9

eternal oxide
#

ah, so yoru first number is NOT divisible

lost matrix
#

Oh ok. So you want the next highest number to yours which is divisible by 9. Right?

crisp iron
#

yes

#

Idk what is wrong with doing % 9 but it just hasn't worked

drowsy helm
#

you can divide by 9, round up then * 9

#

Math.ceil(x/9)*9

eternal oxide
#

you just need to for (Double num = i+1, num <= i+9; num++) { if (num % 9 == 0) return num; }

#

you probably want to ++num so it doesn;t return yrou current number

solemn shoal
#

ok so

crisp iron
#

the Math.ceil didn't work

solemn shoal
#

for ayone trying to make a jar task in gradle:

drowsy helm
#

it should work

#

assuming x is an double

eternal oxide
#

teh for loop will

solemn shoal
#
task jarTest(type: Jar){
    from 'build/classes/java/main/'
}```
crisp iron
#

gonna try ElgarlL

drowsy helm
#

just cast x as double

#
Math.ceil(((double)x)/9)*9```
solemn shoal
#

this works, defines a task called jarTest which takes build output an makes a jar in build/libs

crisp iron
#

the for loop that @eternal oxide suggested work

drowsy helm
#

no need for a loop when you can do it in one function lol

eternal oxide
#

The Math.ceil will return teh current number if its divisble by 9

lost matrix
# crisp iron the Math.ceil didn't work

This is my lookup table solution without having to do a bunch of loops:

  private static final List<Integer> INV_SIZES = new ArrayList<>() {{
    for (int i = 1; i <= 6; i++) {
      this.add(i * 9);
    }
  }};

  public static int getSizeFor(final int spaces) {
    return INV_SIZES.get(spaces == 0 ? spaces : Math.floorDiv(spaces - 1, 9));
  }
drowsy helm
#

if 9, return 9, if 10 return 18

eternal oxide
#

next

lost matrix
#

And also if someone sees this he thinks you know what you are doing ^^

  public static int getSizeFor(final int spaces) {
    return (int) Math.ceil(((double) spaces) / 9) * 9;
  }
eternal oxide
#

you need +1 on spaces

lost matrix
cinder thistle
#

I was also tryna set up a multi-module project for the first time sooo

drowsy helm
#

I've never tried gradle, what benefits does it have over maven?

crisp iron
#

im going to use the math.ceil

snow bane
#

@lost matrix yo btw i figured it out i straight up just didnt register the event

lost matrix
snow bane
#

i am slightly not smart

eternal oxide
#

no, it needs to return the next divisible

crisp iron
eternal oxide
#

so if you pass 9 it returns 18

crisp iron
#

this was my original code

eternal oxide
#

and it shoudl never return zero

crisp iron
#

but i knew there was a simpler way

eternal oxide
#

so +1 on the value passed in

drowsy helm
#

so @crisp iron if size is 9 do you want to return 18 or 9?

crisp iron
#

9

lost matrix
drowsy helm
#

right so not +1

eternal oxide
#

damn dood you lied to me 😦

#

you said the NEXT divisble

crisp iron
#

well it's the same thing

lost matrix
#

lies and deception

drowsy helm
#

if x isnt divisible, next

crisp iron
#

lol

eternal oxide
#

nope, that different

crisp iron
#

yeah basically i want the inventory to be compact

#

like a load a unneeded space

#

i explained it that way bc it made the most sense

eternal oxide
#

so 7smile7's method is correct

lost matrix
#

Its from baboon

crisp iron
#

well @drowsy helm method works just fine

eternal oxide
#

ah yep

lost matrix
#

yeah buoobuoo.XD

lost matrix
drowsy helm
#

LOL

#

that monkey race

crisp iron
#

has much as you helped me i cannot help you, i wish i could though

drowsy helm
#

sort of want to get into machine learning, most I've done is facial recognition and emotion detection

lost matrix
sullen marlin
#

image go in number go out

#

you cant explain that

drowsy helm
#

what a great explanation

lost matrix
#

And if we like number we give some nodes a cookie

drowsy helm
#

yeah it sounds super hard though, I'm not sure if its my type of programming

lost matrix
drowsy helm
#

Yeah I can imagine, but if you're looking at going into the field apparently the cash is great

sullen marlin
#

seems like a scam

#

Simple task: k

#

Simple task done with machine learning: OMGWTFBBQ

drowsy helm
#

ml seems so much harder tho lol

lost matrix
#

Well... i also got 30 min of processing time for an IBM quantum computer from my university each week. But i looked at the whole entanglement thing and stopped right away.

#

But im bored so one of those two needs to be brute forced 😦

drowsy helm
sullen marlin
#

are you saying my kettle doesn't need machine learning to know when to boil itself

#

😠

drowsy helm
#

i mean imagine a machine learning bidet

#

dont even have to move a muscle

sullen marlin
#

already exists

lost matrix
hollow bluff
#

I keep getting the error java.io.FileNotFoundException: Jar does not contain plugin.yml and I'm not sure what is causing the issue. It says "Build Success" when running it so the pom.xml file might not be the issue, not really sure but here is a copy of my pom.xml file: https://pastebin.com/ykhuK24E

drowsy helm
sullen marlin
#

open the jar with a zip program and check

drowsy helm
#

i structure mine like that

#

ensure you include it in your pom

drowsy helm
sullen marlin
#

all fun and good till your bidet gets hacked

hollow bluff
sullen marlin
#

check you uploaded the right jar

eternal oxide
hollow bluff
sullen marlin
#

also check the file is valid

hollow bluff
drowsy helm
#

try move resources out of main

sullen marlin
#

ok theres the issue

solemn shoal
sullen marlin
#

the yml needs to be in the root of the jar

solemn shoal
#

hey md_5 you have no experience with gradle do you?

sullen marlin
#

@solemn shoal well its gotta find out what orifices you have

solemn shoal
#

im failing at including my plugin.yml into my jar

lost matrix
solemn shoal
#

oh a bidet is just a toilet

#

deffo a thing if it has wifi access

lost matrix
eternal oxide
#

lol

solemn shoal
#

what is a bidet lol

drowsy helm
#

maybe ML can replace our hobbies one day

eternal oxide
#

washes your arse

drowsy helm
#

write plugins for us

solemn shoal
#

i mean when i google a bidet it shows me toilets

sullen marlin
#

american toilets are the most wtf thing ever tbh

drowsy helm
#

It's basically just a jet of water that washes your ass

#

are they any different?

sullen marlin
#

yes, very

hollow bluff
sullen marlin
#

they're like a lake

lost matrix
drowsy helm
solemn shoal
#

how can americans take a shit without splish splash lol

drowsy helm
#

this channel has taken an interesting turn

lost matrix
#

Maybe thats my first ml project. I got a RPI 4 with a cam and a bidet...

solemn shoal
#

just put a pressure switch under the toilet seat lol

#

spray whilst sitting

lost matrix
#

Hm. I have only done high pressure hydraulic pistons with an arduino before (to lift a car)
That might be a bit much tho... I could maybe lower the pressure and pray that no bug slides into my code.

sullen marlin
#

definitely dont look up jet ski injuries

drowsy helm
#

moey with the suped up jetski

solemn shoal
#

*extends arm through toilet*

drowsy helm
#

I don't understand people who code like rockets and stuff

#

do they just get one chance

#

or like a simulation environment

sullen marlin
#

well if you're elon musk your rockets explode all the time

drowsy helm
#

hey i like elon 😠

solemn shoal
#

Lmao

sullen marlin
drowsy helm
#

hater

solemn shoal
#

Elon big meme

lost matrix
sullen marlin
#

except if youre elon and just use electron

lost matrix
#

And they also use simulations of course

lost matrix
solemn shoal
drowsy helm
solemn shoal
#

I wonder if teslas use electron

lost matrix
solemn shoal
#

No?

sullen marlin
#

they did for the gui

lost matrix
drowsy helm
#

was joke lmao

lost matrix
sullen marlin
#

ye they got early access to ksp 2

lost matrix
#

I could use electron for ml...

solemn shoal
#

Id rathee write python then js

drowsy helm
#

leave

lost matrix
solemn shoal
#

Id rather write c# tho

lost matrix
#

I dont touch js unless i can work with TypeScript

lost matrix
sullen marlin
#

imagine wanting to write anything other than java

drowsy helm
solemn shoal
#

Imagine wanting to write java

lost matrix
#

The only 2 cool features of C# are delegates and the fact that generic types are not erased on runtime

young knoll
#

I like the string interpolation

lost matrix
# drowsy helm java with pointers

I mean. C# only has "real" pointers in unsafe code blocks. And with Java 16 we also got a foreign memory access API that is not unsafe (or OS specific)...

drowsy helm
young knoll
#

The shorthand getters and setters are also nice, as is LINQ

solemn shoal
#

i mean you get to play with pointers in C# outside of unsafe codeblocks too

#

if youre dealing with win32 apis

lost matrix
drowsy helm
#

lombok lel

#

10? thats a bit generous

young knoll
#

Yes but with C# you don't need weird compiler hacks :p

lost matrix
young knoll
#

Isn't Lombok a compiler hack tho

drowsy helm
#

eh it just adds methods on compile

#

not that hacky

lost matrix
#

Its both.

sullen marlin
#

lombok is pretty hackty

#

breaks all the time

lost matrix
#

Look at CDI frameworks like Springboot or Quarkus. They write entire proxy classes and re-write static method on compile time so everything can be lazy initialized.

sullen marlin
#

accessors/tostring/equals are great, everything else is meh

#

if lombok just did those three things it would probably be fine

lost matrix
#

Yeah... And @SneakyThrows about your main method solves all the problems

drowsy helm
#

i only use lombok for the construcotrs and getter/setters

sullen marlin
#

oh yeah constructors too

#

@Delegate is handy on occasion also

#

but pretty rarely

drowsy helm
#

who in their right mind thought "yeah lets put a huge fucking chili on the screen"

lost matrix
#
@Builder
public class PersonData {

  private final String name;
  private final String lastName;
  private final int age;

}
    final PersonData data = PersonData.builder()
        .name("Bob")
        .age(12)
        .lastName("Martin")
        .build();

😄

sullen marlin
#

lombok is spicy, duh

lost matrix
#

And sometimes the @ToString for a class is quite nice if you want to just sysout the fields of that class for debugging.

sullen marlin
#

Tostring all the things

drowsy helm
#

i wasnt aware lombok had a builder annotation

#

thats awesome

young knoll
#

Gosh just write a builder

#

Lazy developers SMH

drowsy helm
#

anything that saves me lines of code, i like lol

#

unless im paid by the hour, then i hate lombok

young knoll
#

Paid per line

graceful crypt
#

how do i register event dont link me spigot website spigot is ip logger

drowsy helm
#

lmao what

#

ip logger

#

getServer().getPluginManager().registerEvents(Listener, plugin)

young knoll
#

MD consumes IPs for nutrients

drowsy helm
#

pog

graceful crypt
#

that didint work

young knoll
#

Didn't work is not helpful

#

What about it didn't work

graceful crypt
#

ok

drowsy helm
#

where are you calling it from

graceful crypt
#

it not work ]

#

a

graceful crypt
drowsy helm
#

great

young knoll
#

Never mind it's a troll

#

Moving on

graceful crypt
#

no

#

i no troll

#

a

untold onyx
#

how do i remove a class from the spigot 1.7 source code

#

without spigot telling me to kms

drowsy helm
#

what class do you want to remove

#

and just fork the source and compile your own jar

#

but you shouldnt need to

untold onyx
#

i want to remove PotionEffects class and add custom effect called GLowing

crude charm
#

there is literally no reason to do that

graceful crypt
#

they dont like it probb

drowsy helm
#

you can do that ontop of spigot

#

no need to remove the class

untold onyx
stone sinew
drowsy helm
#

will probs also cause so many issues

untold onyx
#

i want 1.9 glowing on 1.7 server

#

fine im not removing it

drowsy helm
#

that would be a mod

untold onyx
#

no it isnt

drowsy helm
#

spigot cant do that

untold onyx
#

1.9 glowing is natural

#

yes it can

#

using viaversion

stone sinew
#

Do you want item glowing or entity glowing?

untold onyx
#

entity

#

people connect 1.9+ = yes they see glow

young knoll
#

You can probably do it with packets

#

But 1.7 builds are not available, and are definitely not supported

sullen marlin
#

You can't make 1.7 clients see glow though

untold onyx
graceful crypt
untold onyx
#

1.7 and 1.8 WONT SEE GLOW

crude charm
untold onyx
#

BUT I WANT 1.9+ SEE

young knoll
#

Have you considered

stone sinew
young knoll
#

Updating

untold onyx
#

did i say i want 1.7 and 1.8 to see it

#

no

graceful crypt
#

a

untold onyx
#

i said viaversion