#help-development

1 messages · Page 299 of 1

somber berry
#

Thx

#

I will try and come back with a answer

ionic thicket
#

Yo, is it normal that in creative mod i can manage to glitch and take the items in guis where i set setcancelled true on inventoryClickEvent, but not in survivalmode?

tardy delta
#

creative mode is client side

chrome beacon
#

Yeah working with Creative mode is a mess since the client has control

ionic thicket
#

oh ok

#

just to be sure if the code needed a fix

#

thank you

somber berry
#

it didn't work, I somehow have to check if the block from location list has been blow up and cancel the event

quaint mantle
#

Hi

#

I'm learing the write plugin but it gives this error

#
[11:20:12 ERROR]: Could not load 'plugins/selamla.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:178) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:154) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1137) ~[purpur-1.19.jar:git-Purpur-1670]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:307) ~[purpur-1.19.jar:git-Purpur-1670]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 7 more
quaint mantle
#

But I have

#

I can't send pictures

undone axleBOT
#

ntm#1234 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

quaint mantle
#

Hmm

#

How can i remove purpur

#

Okey I'm trying

undone axleBOT
quaint mantle
#
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:412) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:224) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:966) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3553-Spigot-14a2382-ef09464]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 7 more
#

It gives this error

#

My JAR file has a plugin.yml

#
name: Selamla
main: org.selamla.Main
version: 1.0.0
somber berry
#

add description

#

I realized that after writing the message 🙂

quaint mantle
#

Oh

#

My plugin.yml file in the org directory

#

I moving the main directory

somber berry
#

it should be in the resources

quaint mantle
#
[11:44:18] [Server thread/ERROR]: [Selamla] Selamla v1.0.0 attempted to register an invalid EventHandler method signature "public void org.selamla.Main.karsilama(org.bukkit.event.player.PlayerJoinEvent,java.lang.String[])" in class org.selamla.Main
#
package org.selamla;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener{
    public void onEnable() {
        getLogger().info("Eklenti başladı.");
        Bukkit.getPluginManager().registerEvents(this, this);
    }
    
    public void onDisable() {
        getLogger().info("Eklenti devre dışı bırakıldı.");
    }

    @EventHandler
    public void karsilama(PlayerJoinEvent event,String args[]) {
        Player oyuncu = event.getPlayer();
        oyuncu.sendMessage(ChatColor.GREEN + "%s adlı oyuncu sunucuya katıldı !",oyuncu.getName());
    }
}
#

Can I use %s without String args[]

#

%s joined the server

#

Like this

#
    @EventHandler
    public void karsilama(PlayerJoinEvent event) {
        Player oyuncu = event.getPlayer();
        oyuncu.sendMessage(ChatColor.GREEN + oyuncu.getName() + " adlı oyuncu sunucuya katıldı !");
    }
}

Is it work ?

#

Thanks for everything

#

I'm new in plugin codding

#

Can I compile code without a Eclipse ?

#

I'm writing codes with VSCode

#

When I was the compile I'm opening Eclipse IDE

#

Can I compile in VSCode

#

IntelliJ IDEA is very heavy ide

#

For my computer

#

How can i compile in terminal

somber berry
#

Block from the location list still get destroyed, I tried different if statements versions and still same result.

carmine urchin
#

When I run the line of code MinecraftServer server = craftPlayer.getHandle().getServer() in the form of a command, the console responds with java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerPlayer org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer.getHandle() I have installed mojang mappings and have the right pom.xml dependencies and plugins. Am I not doing something right?

twilit roost
#

How can I create Ghost Items?
Or just prevent dupe glitch.

I save all content of GUI into PDC
But after save, players can just take those items and get easy Dupe

tardy delta
#

why is your lore method taking in a list of strings and not just varargs and why is it mutable?

#

wait wtf

carmine urchin
#

yes, i have the plugin net.md-5 v1.2.4, is that what you are referring to?

knotty meteor
#
    @EventHandler
    public void onClick(final InventoryClickEvent e) {
        Player p = (Player) e.getWhoClicked();
        if (e.getCurrentItem() == null) {
            return;
        }
        ItemStack item = e.getCurrentItem();
        if (NBTUtils.contains(item, "ticket_inv")) {
            if (e.getClickedInventory().equals(p.getInventory())) {
                if (e.getRawSlot() == 40 || e.getRawSlot() == 41) {
                    e.setCancelled(true);
                    p.sendMessage(Utils.colorize("&cYou cannot place the ticket in your offhand or crafting slots."));
                    return;
                }
            } else {
                e.setCancelled(true);
                p.sendMessage(Utils.colorize("&cYou cannot move the ticket to this inventory."));
            }
        }
    }

Someone knows why i can still put it in my offhand from my inventory?
And why i can place it in the crafting slot but not take it out?
This code is for 1.12.2 and it should make it so that you cant put the item in offhand or crafting slots

tardy delta
#

its maybe an inv move event?

#

didnt see the split part

#

dunno what mess that is

#

i hope youre not setting the item meta on every method

#

well you should only do it at the build method

#

its not just a setter

#

that the impl of ItemStack#setItemMeta, i personally wouldnt call that every time

ionic thicket
#

is there a way to get the slot number in an inventory?

quiet ice
#

Regex

ionic thicket
#

@EventHandler
public void onPlayerInvClick(InventoryClickEvent event){
MenuGui menuGui = new MenuGui(null);

    Inventory playerInventory = event.getInventory();
    
    switch(event.getCurrentItem().get) {
    case 
    }
#

yea

#

I dont have that option?

#

i have 9 slots

#

in my gui

#

i want to set a switch that based on the slot of the item does something

#

what is that #

hybrid spoke
#

you are checking equals on 2 lists

ionic thicket
#

oh

#

ty

carmine urchin
#

Thanks, although again, plugging in the dependencies and plugins into Maven still does not work. Should I do it manually?

somber berry
carmine urchin
#

Is there a specific location that it exports the remapped jar files to? I just set the artifacts for intellij to a specific folder and it just creates one file

#

Ah yeah it's not creating any remapped jar files, the target folder doesn't have any jars

dry yacht
#

Happy to hear that you found a solution! It very much seems like the double-hit when critically damaging is intended for that version, so it would have been very hard to do anything against that. Anyways, you didn't give up and managed to analyze the situation to a point where you could come up with such a creative solution nobody even thought about before, which is what true problem solving is all about: solving the unsolvable. I'm proud to see that there are still people around who have these traits! :)

topaz cape
#

when was teams character limit removed spigoteers?

quaint mantle
#

so i just remembered about forge workspaces for mods and was wondering if theres anything like that for a server jar? all classes included. im guessing not cus legal bs but just wondering. a google search pulled up a bunch of forge stuff

carmine urchin
#

Yep, same error

carmine urchin
#

Yes

#

java -jar BuildTools.jar --rev 1.19.3 --remapped

#

The remapped mojang jars?

#

So yea I have all the remapped jars in BuildTools\Spigot\Spigot-Server\target

#

But not the remapped project jars

rotund ravine
#

Fairly certain it installa them to local maven too

carmine urchin
#

I think so, lemme check

#

Ok I found the remapped 1.19.3 jars in m2\repository\org\spigotmc\spigot\1.19.3-R0.1-SNAPSHOT

#

Ok thx I will watch

ionic thicket
#

Location location = ("world",4,3,5); why is that wrong?

eternal oxide
#

new Location

ionic thicket
#

oh ok

#

but why is that?

#

oh right

orchid gazelle
#

With new Location you create a new Location-Object, where ("world",4,3,5) would instantly error

carmine urchin
#

I think I see the problem. At around 1:00:18 - 1:00:33 in the video. If you look at the top right, he has a configuration called "understanding-nms-build". He refreshes the pom.xml and then runs the configuration. The thing is, I never created a configuration. When I create a maven configuration it asks me for a command line to run. Do you know what this command might be?

quaint mantle
#

How can i send messages to all server

#

like a announcement

tropic ocean
#

/alert <your message>

quaint mantle
#

How can i use in plugin

ionic thicket
#

Bukkit.broadcastMessage("helo boi");

carmine urchin
#

YESSSS!!!!

#

It created the remapped project jars!!!

#

yayy thanks man 🙂

vale ember
#

anyone knows if loading guava cache values asynchronously is safe?

like

CompletableFuture.runAsync(() -> cache.refresh(locale));
// or
CompletableFuture.runAsync(() -> cache.getUnchecked(locale));
hazy parrot
#

Guava cache should be thread safe

#

Check on Google tho

tardy delta
#

whats that class?

vale ember
#

?

tardy delta
#

whats the class of cache?

vale ember
#

idk i just do CacheBuilder.newBuilder().build(new LanguageCacheLoader())

tardy delta
#

Cache<K, V> doesnt have that methods

#

or these docs are outdated

vale ember
#

yeah it implements LoadingCache

#

but i dunno the concrete class

tardy delta
#

i guess async is fine

#

should check impl

vale ember
#

k thanks i wasn't very careful while reading the docs

glossy venture
ionic thicket
#

how to get overworld world?

obsidian drift
#

Where is the site for viewing mojang mappings?

tardy delta
#

0 is overworld, 1 is nether, 2 is end and all others are custom worlds

dusky saddle
#

Hey, i create a custom world with a custom ChunkGenerator. My generateNoise function looks like this: ```java
@Override
public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkData chunkData) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
if (x == 0 && z == 0) {
continue;
}
chunkData.setRegion(x, chunkData.getMinHeight(), z, x + 1, chunkData.getMaxHeight(), z + 1, Material.AIR);
}
}
}

ionic thicket
river oracle
#

I'm making an API for myself that supports multiple databases for one project. Database APIs tend to be fairly bulky is there a decent way to provide support for all these databases without racking up my jar size to like 100mbs from shading

tardy delta
#

sqlite is already included in the server so you dont need to shade that one

#

the libraries section in the plugin.yml is a thing too

river oracle
#

more thinking like MySQL, Mongo etc which aren't provided by spigot

tardy delta
#

im wondering if you can load those jars on the go, like the plugin system does

river oracle
#

ik it changed for me

tardy delta
#

oh i thought that was a linux font issue

#

i dont like it

#

what about other langs

#
#pragma once

void init();
int read(const char*);
struct test {
  int a;
};```
river oracle
#
let: str = "Yeah they definitely did"
let var: str = "Variable"
var str: string := "Go Lang"

looks so eh

tardy delta
#

bleh

#

i wouldnt be surprised if they will charge money for using discord in the future

quaint mantle
#

How to delete all players inventory in my world [lobby] multiverse core

river oracle
#

maybe they are depending on it?

#

i suppose I just wanted to give programmer talk so they run away crying

obsidian drift
#

Anyone know how I can get started with making custom biomes using mojangs mappings?

hazy parrot
#

It's already thing if you are from America afaik

#

It's like buying ranks trough discord

river oracle
obsidian drift
#

I want to make my own biomes so I can change the colour of the sky for example

hazy parrot
river oracle
undone spindle
#

hi im using worldguard and worldedit plugin but i don't know how to convert a bukkit.world into a worldedit.World does anyone have a clue?

obsidian drift
#

It is possible

#

This is just the 1.17 version and not using mappings

#

Ty

quiet ice
#

Involves selling your personal info though

obsidian drift
#

dedicatedserver.getCustomRegistry() doesn't exist in the mappings

#

Idk what i'm meant to use

quiet ice
#

How are the methods named instead?

obsidian drift
#

No idea

fallen patrol
#

Hey I am getting the error:

java.lang.UnsupportedClassVersionError: net/fakkamc/Main has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 61.0

However I am using JDK 17 to compile, anyone know how to solve that?
I am using maven

chrome beacon
#

Also

#

?main

fallen patrol
#

tyy

undone spindle
#

does someone know alot about how yml configs work

#

i have a question about what type i will get returned if its a parent of some variables

hazy parrot
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

undone spindle
#

?

#

i asked the question, but if it wassnt that proper asked i hope its good now?

#

if i try getting a parent in yml what type will it return

#
player:
  time:
    join: 6:00pm

so imagine i have this if i ask for player.time what will it say?

#

thx!

undone axleBOT
rotund ravine
#

?c

#

?c

#

hm

undone spindle
#

?configs

undone axleBOT
tardy delta
#

?cc

lapis swan
#

Is there a way to disable my Plugin if something in the onEnable does not work?
I'm looking for an Bungee solution

tardy delta
#

isnt there a pluginmanager you can ask to disable the plugin?

tardy delta
#

💀

lapis swan
#

So you just disable the commands an forget about the rest ? as there is no disable function ?

rotund ravine
verbal dagger
#

so i'm trying to make a new ender dragon phase when it gets to half health it will get a lot harder and the dragon should be a lot faster. but i just can figure out the speed part so it flys faster. here is my current java class: " @EventHandler
public void onEnderDragonDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof EnderDragon) {
EnderDragon dragon = (EnderDragon) event.getEntity();
double health = dragon.getHealth();
double maxHealth = dragon.getMaxHealth();

        // Check if the ender dragon is at or below half health
        if (health / maxHealth <= 0.5) {
            
            Bukkit.broadcastMessage(ChatColor.RED + "The dragon is now at half health - now its true power rises!");
            // Set the ender dragon's custom name to "Fast Ender Dragon"
            dragon.setCustomName("garry");

            for (Player player : Bukkit.getOnlinePlayers()) {
                Location location = player.getLocation();
                player.playSound(location, Sound.ENTITY_ENDER_DRAGON_GROWL, 0.4f, 0.4f);

                // Set the ender dragon's custom name to be visible
                dragon.setCustomNameVisible(true);
                // Set the ender dragon to be glowing
                dragon.setGlowing(true);
            }
        }
    }"
verbal dagger
#

how?

vale ember
#

three backticks (`) at start and end

verbal dagger
#

bet

#
    public void onEnderDragonDamage(EntityDamageEvent event) {
        if (event.getEntity() instanceof EnderDragon) {
            EnderDragon dragon = (EnderDragon) event.getEntity();
            double health = dragon.getHealth();
            double maxHealth = dragon.getMaxHealth();

            // Check if the ender dragon is at or below half health
            if (health / maxHealth <= 0.5) {

                Bukkit.broadcastMessage(ChatColor.RED + "The dragon is now at half health - now its true power rises!");
                // Set the ender dragon's custom name to "Fast Ender Dragon"
                dragon.setCustomName("garry");

                for (Player player : Bukkit.getOnlinePlayers()) {
                    Location location = player.getLocation();
                    player.playSound(location, Sound.ENTITY_ENDER_DRAGON_GROWL, 0.4f, 0.4f);

                    // Set the ender dragon's custom name to be visible
                    dragon.setCustomNameVisible(true);
                    // Set the ender dragon to be glowing
                    dragon.setGlowing(true);
                }
            }
        }```
rotund ravine
#

Not sure you can change the speed of the ender dragon at all

verbal dagger
#

breh

vale ember
#

maybe try adding attribute

rotund ravine
#

Try doing it with attributes how you usually do it.

verbal dagger
#

i looked a bit in to velocity but im not sure if thats even a thing

rotund ravine
#

It might not even use them though, the ender dragon is a bit iffy

vale ember
verbal dagger
#

sure but im not really that good at coding spigot yet so ill just have to learn some stuff about attribute's

#

thanks a lot

vale ember
#

or Attribute.GENERIC_FLYING_SPEED

#

not sure

verbal dagger
#

ok

vale ember
humble tulip
#

Click the link

#

Scroll down a bit

#

Use the javadocs guys

quiet ice
#

Then what do you want?

#

For the level or overall?

humble tulip
#

It does

dry yacht
#

Before, as you append comments to keys in SnakeYaml, which is what bukkit makes use of. So the configuration-section has to exist before you can append a comment to it. As soon as it exists, it shouldn't matter in which order you perform these two calls.

humble tulip
#

As in how much total exp they have?

rotund ravine
#

?paste

undone axleBOT
quiet ice
chrome coyote
#

how can i disable the alert [Server: Mostrando la particula minecraft:dust]

#

is the alert from the command /execute

#

minecraft:execute

quiet ice
#

I'll give you are tip: It's in server.properties

#

Server operator feedback or something like that

chrome coyote
#

broadcast-console-to-ops=true?

quiet ice
#

most likely

#

But since it is very possible that these maths have an error, here is my approach @last temple :

float remaining = player.getExpToLevel();
float remainingProgress = 1F - player.getExp();
float fullLevel = remaining / remainingProgress;
float exp = fullLevel * player.getExp();
quaint mantle
#

Hey, how can I make it so my custom enchant (Essence enhancer) which I use random.nextInt() to increase the range of random outcome on the breaking of sugar cane changes per level, bearing in mind I am wanting to have like level 500 maxed out

dry yacht
quiet ice
worldly ingot
#

Discord using a different library for syntax highlighting now?

chrome beacon
#

Probably

quiet ice
#

Yes, or they changed the color scheme

worldly ingot
#

Weird. Definitely preferred the old one

quiet ice
#

Same

quaint mantle
quiet ice
#

Lemme open up inkscape real quick to sketch something

dry yacht
#

Too late, I don't care about upstream versions. I only care about version independence.

quaint mantle
dry yacht
#

The port has to be known, as that's what the socket server listens on, and the IP is assigned by the operating system using either DHCP or static IP assignment, so the most easiest way would be to issue a GET request to a public (and reliable) what-is-my-ip API to resolve that. No idea if there are any easier solutions tbh, never needed that.

runic island
#

I have an issue with the website can i post it here?

dry yacht
rotund ravine
quaint mantle
#

Whats best way of setting levels? An enum or?

quiet ice
#

Using gaussian stuff would be a big ugly in that case

quaint mantle
#

Wb setting levels

quiet ice
rotund ravine
#

Just do an Int or smth a short or whatever u want.

quaint mantle
#

I mean like I have the enchantment class, extending Enchantments with implemented methods. Never used it before so it obviously has its own level method so figuring out how to create a getter to it

quiet ice
#

I have never worked with custom enchantment plugins that do it the traditional way of extending enchantment, so I cannot tell

sterile axle
#

use 1.19 in plugin.yml and pom, and just check to make sure nothing you're using was deprecated in spigot's 1.20 release

#

well, rather, if something you are using was already deprecated make sure md didn't actually remove it

#

but that's very rare

quiet ice
#

Just use [1.19,1.20] (or somethin like that) in your pom

#

Although event constructors tend to get changed from time to time

sterile axle
#

does api-version take an array?

quiet ice
#

That ain't an array, that is a version range

#

Hence, pom

sterile axle
#

what field is that in the pom

#

i would seriously advise against depending on multiple versions at the same time if that's the implication here

quaint mantle
#

Can't you use NBT?

quiet ice
#

meant something like that

quaint mantle
#

I mean't for versions

quiet ice
#

maven-metadata.xml 🥳

#

You can - paper also uses snapshots

#

(I've spent too much time on my resolver)

sterile axle
#

spigot works pretty hard to maintain backwards compat. servers running 1.20 should have no issue running a plugin written for 1.19 so long as they're not doing something wack like touching something unsupported (cough cough) or were being naughty and using deprecated code instead of a documented alternative and that deprecated code was then actually dropped (haven't actually seen md do that)

quiet ice
#

The only thing that will break your neck is the new Material API

#

I really hope they will use two classes in the future

#

But from what I heard they will just overwrite the old Material enum

#

Soon ™️

#

It was announced with 1.18 (or 1.17?) I think

#

Future API
There are plans underway to change the way many enums in the API are handled so that custom content can be better supported. These changes are not expected to break most plugin jars (backwards compatibility will be provided), however they may unavoidably break plugin source code (though the Maven version will be bumped if this occurs). To reduce the risk of breakage, please consider avoiding the use of switch statements and EnumSet over enums which implement 'Keyed'.
1.18

quiet ice
#

regestries

tardy delta
#

🥺

quaint mantle
quiet ice
#

Yeah, pretty much

quaint mantle
#

How long you been coding for @quiet ice ?

quiet ice
#

Seriously (i.e. like 30 hours a week)? 2 1/2 years now. But well I did code well before that, just very rarely

#

Don't worry, the code will still run, just not compile

#

HOWEVER

rotund ravine
quiet ice
rotund ravine
quiet ice
#

If they use hacks similar to those that I use over on my galimulator modding toolchain, it would still compile AND run

#

That being said I can pretty much guarantee that they won't implement these hacks - they require advanced bytecode manip wizardy

quaint mantle
#

I learnt so much so quickly now i'm just at a stuck position

quiet ice
worldly ingot
#

Actually it might not even be enabled by default anymore

#

Even if it is, you have to explicitly tell it to do it

rotund ravine
#

Atleast they did when i was active a few years ago

worldly ingot
#

You also can't do it with Maven/Gradle

#

Only basic projects

rotund ravine
quiet ice
worldly ingot
#

You can specify a different compiler with Maven (in fact, Bukkit uses the Eclipse compiler because it doesn't require a JDK), so I do wonder if it's possible to enable that functionality. You'd seriously have to know how to configure Maven to do it though lol

quiet ice
#

Adding ACC_ENUM means that the compiler thinks that the non-enum class is actually an enum and does allow stupid shit with that.

tardy delta
#

me trying to extend Enum 🥺

worldly ingot
#

The most amount of backwards compat we'll be doing is re-adding the static methods that Enum provides. That's about it

quiet ice
worldly ingot
#

And non-static methods like ordinal() I believe also are being re-added. I can't recall

quiet ice
#

And hopefully .name() and so forth

worldly ingot
#

Yes

tardy delta
quiet ice
tardy delta
#

🫡

quiet ice
#

I.e. I have a custom version of fabric's accesswidener that allows me to do

# Enum Hacks
compileOnly denumerised class snoddasmannen/galimulator/EmpireSpecial
compileOnly denumerised class snoddasmannen/galimulator/FlagItem$BuiltinSymbols
extendable              class snoddasmannen/galimulator/FlagItem$BuiltinSymbols
compileOnly denumerised class snoddasmannen/galimulator/MapMode$MapModes
extendable              class snoddasmannen/galimulator/MapMode$MapModes
pulsar parcel
#

I'm trying to check if a player who is in ArrayList dies and if yes, run another code. I tried to do
if (arrayList.contains(player))
but that didn't work. Then I tried to do a loop for all players in the ArrayList and see if the player that died is there.
`for (int i = 0; i < arrayList.size(); i++) {
if (player == arrayList.get(i)) {

}
} `
also without success. Does anyone have any idea how else this could be done?

quiet ice
#

Compare playerUUIDs I guess

#

Are you sure that it is in that arraylist in the first place?

tardy delta
#

use a Set<UUID> instead ^

quiet ice
#

in Players case you can use instance comparision, except if they died

quiet ice
#

Although, even if they died I do not know

rotund ravine
#

Your issue lies elsewhere most like.

quiet ice
#

But yeah, contains should do it

rotund ravine
#

So let us see the full code

#

?paste

undone axleBOT
tardy delta
#

only if they leave the server the object is invalidated iirc

rotund ravine
#

Correct, but only if he does not hold a reference to it.

quiet ice
tardy delta
#

is a weak hashset a thing?

quiet ice
quiet ice
tardy delta
#

ah its not in the java stdlib

quiet ice
#

If there is a map, you can use it as a set (for read ops it is just as easy as calling map#keySet())

tardy delta
#

whatever i was just wondering

#

hmm

pulsar parcel
#

And, one more thing, I am storing strings with player names.

quiet ice
#

💀

chrome beacon
tardy delta
pulsar parcel
quiet ice
#

AND be especially aware that you can no longer lookup the player name history

#

So what is done there cannot be undone

tardy delta
pulsar parcel
dry yacht
# pulsar parcel Yeah, but this plugin is just for one use

You can easily just keep a List of type Player and use contains, as Player is a "singleton" per login-session. You can even use == instead of equals, as it will - of course - have the same memory address.

Just make sure to use a weak referencing collection to not cause a memory leak after the player left. So many plugins make this mistake and are the reason that so many servers have to reboot daily.

pulsar parcel
mighty aurora
#

How do I use NMS to change an entities AI?

dry yacht
austere cove
#

Why not just use a set with UUIDs?

#

no need to mess around with weak references

pulsar parcel
austere cove
#

Server#getPlayerExact(String) (can return null if no such player is online, also is case insensitive)

dry yacht
tardy delta
#

i really didnt already say that 💀

dry yacht
dry yacht
worldly ingot
#

Not sure why it always has to be an overcomplicated topic. Using the Player instance? Hold a Player, make sure you clean up on leave. Not using the Player instance? Hold their UUID

tardy delta
dry yacht
# worldly ingot Not sure why it always has to be an overcomplicated topic. Using the Player inst...

Why overcomplicated tho? I mean, sure thing, as I guess that the PlayerQuitEvent is guaranteed to be called on a socket connection close, removing from the collection at that point in time should be sufficient, but what's so wrong with using a weak reference to not have to think about this at all? It's kind of hard to argue about complexity or efficiency on that, it more likely is just a question of personal taste.

worldly ingot
#

In all likelihood you're saving data on quit anyways

#

At least in any situation where I'm holding a Player, that's true

dry yacht
# worldly ingot In all likelihood you're saving data on quit anyways

Likely, yes, but it seemed to me that they were only keeping this list to flag players who's deaths are watched and somehow processed. But then again, a UUID set would've been more than enough, that's what I should have advised them to use. Just that it's hard to decide on this if you don't know what operations will be performed on that collection and for what purpose.

mighty aurora
#

In NMS if I wanted to create a custom entity that appears as an iron golem would I need my entity class to extend IronGolem or implement IronGolem??

rotund ravine
mighty aurora
#

Well it says "no interface expected. change to implement IronGolem?"

rotund ravine
#

IronGolem is not the nms EntityIronGolem is it?

quaint mantle
#

I have programmed a lobby plugin and a bansystem plugin and now I want to make these two plugins into one plugin. How does this work?

undone axleBOT
rotund ravine
#

I can't tell you based on that line.

#

?askgoodquestion

undone axleBOT
quaint mantle
mighty aurora
# rotund ravine IronGolem is not the nms EntityIronGolem is it?

I don't think what I'm using is NMS though I was told the best way for me to create my custom entity would be NMS as I need to basically change the AI of an Iron Golem to a wolfs AI but I have never done anything with NMS and can't find anything to help me learn or do anything with NMS

mighty aurora
rotund ravine
quaint mantle
rotund ravine
#

It's simple really

dry yacht
remote swallow
#

probably crtl c, ctrl v

rotund ravine
# quaint mantle Why do you need my code to tell me how to combine two plugins?

There are a few reasons why it would be helpful to see your code when trying to help you combine two plugins:

  1. It allows us to understand how you have implemented the individual plugins and how they are interacting with the rest of your code.

  2. It allows us to identify any potential conflicts or issues that may arise when attempting to combine the two plugins.

  3. It allows us to provide more specific and accurate guidance on how to modify your code to successfully combine the two plugins.

Without access to your code, it is difficult for us to accurately assess the situation and provide meaningful assistance.

dry yacht
rotund ravine
quaint mantle
#

What is difficult about a lobby system and a bansstem?

remote swallow
#

does bungee even have banning, isnt that handled per server

rotund ravine
rotund ravine
remote swallow
#

ah yeah, makes sense

rotund ravine
#

If you can't merge your code, we probably don't want it either.

remote swallow
#

if the lobby plugin is proxy, and the ban system is spigot, you would need a check to tell where it is to enable/disable other code

rotund ravine
#

I guess i'll just tell him some general steps

rotund ravine
# quaint mantle I have programmed a lobby plugin and a bansystem plugin and now I want to make t...

To combine two plugins into one, you will need to merge the code from both plugins into a single file or set of files. This will typically involve moving the code for one plugin into the same directory as the code for the other plugin, and then modifying the code to work together as a single plugin.

Here are the general steps you can follow to merge two plugins into one:

  1. Create a new directory for your merged plugin.
  2. Copy the code for both plugins into this directory.
  3. Modify the code to work together as a single plugin. This may involve modifying function names, class names, and variables to avoid conflicts.
  4. Test the merged plugin to ensure that it is functioning as expected.
  5. Package the merged plugin into the appropriate format for distribution.

Keep in mind that merging two plugins can be a complex process, and it may require some significant effort to get everything working correctly. If you are not comfortable with programming or if you are not familiar with the code for one or both of the plugins, you may want to seek help from a more experienced developer.

dry yacht
remote swallow
#

because its lobby i would guess thats bungee

rotund ravine
#

Could be a plugin for the spigot lobby server.

remote swallow
#

ah true

quaint mantle
remote swallow
#

you cant

dry yacht
#

Oh, now everything makes much more sense

remote swallow
#

the simple answer without source code just is impossible

chrome beacon
#

You can though it'll just be a pain

#

also there's no need to do that

quaint mantle
rotund ravine
# quaint mantle I also want to combine two plugins of which I do not have the source code

If you do not have the source code for the two plugins that you want to merge, it will not be possible to directly merge the code as I described in my previous response. Instead, you will need to find another way to combine the functionality of the two plugins.

One option could be to use the two plugins together in your server, and configure them to work together as needed. This may involve setting up communication between the two plugins using plugin channels, or using some other method of integration.

Another option could be to create a new plugin that relies on the two existing plugins to provide the desired functionality. For example, you could create a wrapper plugin that loads the two other plugins and then provides a new set of commands or features that are built on top of the functionality provided by the other two plugins.

Finally, if you are unable to find a way to use the two plugins together or to create a new plugin that relies on them, you may need to consider finding alternatives to one or both of the plugins that can provide the desired functionality.

remote swallow
#

well yeah, if its maven you might get lucky and they include pom but if its gradle you would have to guess the deps other than spigot-api. And then transfer all the decompiled code from those plugins

remote swallow
#

are you sure he didnt just get source code

dry yacht
chrome beacon
#

^^

dry yacht
rotund ravine
#

This is why i still refer to spigot people as dumb.

#

Some sets can have.

#

HashSet can not, you are correct.

#

Yes

chrome beacon
#

Why suppress it though

#

Fix the problem instead?

dry yacht
# rotund ravine Some sets can have.

Yes? I'd say that the definition of a set is to only contain unique elements. The only way that would be possible is if the set cannot determine equality, based on some conditions I cannot think of right now.

chrome beacon
#

...

#

no

rotund ravine
#

What are yo ueven using used for

rotund ravine
remote swallow
#

are you tired

tardy delta
#

i just want to code but i broke my os again

#

heeheehee

remote swallow
#

xrandr --query

dry yacht
remote swallow
#

also didnt you fix that

tardy delta
#

im not even getting a shell lmao

remote swallow
#

sleep

tardy delta
#

💀 lifes over

remote swallow
#

brain wil brain again

dry yacht
remote swallow
#

if i wanted i could use linux

tardy delta
#

lmao i reinstalled it like 5 times this week

remote swallow
#

and have 0 issues

tardy delta
#

youre using linux mint lmao

remote swallow
#

i dont care

#

also im using ubuntu too

tardy delta
#

ofc you dont have issues

#

they come will all drivers you need

remote swallow
#

i should install debian without issue

#

s

#

would be fun]

tardy delta
#

bet

#

i bet youll fuck up

remote swallow
#

ill download vmware

tardy delta
#

vmware gives virtual driver support

#

that cheating

remote swallow
#

dont care

#

im just here to boot debian and ratio you

#

ill do it later

#

im eating now

tardy delta
#

i got this far, then i rebuild smth and it breaks

mighty aurora
#

Question. If I summon a custom entity that implements the IronGolem class(so that its a golem with custom AI). If I set it to be a village golem would it then attack a player if I set the player as its target?

tardy delta
#

luckily im not that kind of idiot

#

i only deleted /bin 💀

remote swallow
#

why do you delete folders in ~

tardy delta
#

?

#

i might aswell install ubuntu but thats bloat asf

remote swallow
#

just dont delete folders in home/~

#

you wont get problems

austere cove
#

i love how most distros have protection for shit like rm -rf / these days

tardy delta
#

😢

remote swallow
#

what does that do

#

im guessing deletes everything

tardy delta
#

removes the root lol

remote swallow
#

oh cool

tardy delta
#

atleast i know what -f does and experienced it :(

austere cove
#

run :(){ :|:& };: u wont

#

(actually don't)

remote swallow
#

ill install another linux distro later just to run that

#

somehow i dont think rm rf / would work on wsl

tardy delta
#

i can test it on my pi 💀

#

its not doing anything rn

remote swallow
#

we can just get alex to run it on his vps vms

tardy delta
#

if it starts smoking we all know what happened

#

heeheehee

#

imma pull power out

remote swallow
#

yes ik that is private ip

dry yacht
tardy delta
#

i paid for the whole ram im gonna use the whole ram

trim lake
#

What is wrong?

String msg = "test";
        sender.sendMessage( new ComponentBuilder(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', msg))) 
        .create());
austere cove
#

cat /dev/random

tardy delta
#

thats just random crap right?

remote swallow
#

new discord java format is soweird

austere cove
#

yes

tardy delta
#

true

remote swallow
austere cove
#

man I used to have a full list of random fun commands

tardy delta
#

tf is this site

mighty aurora
#

What would the best way to create an Iron Golem that would basically act like a wolf be?

remote swallow
#

chinese javadocs

mighty aurora
#

not NMS?

dry yacht
tardy delta
austere cove
#

CommandSender.Spigot#sendMessage(BaseComponent[])

remote swallow
trim lake
maiden thicket
#

u would

#

potentially

dry yacht
# mighty aurora not NMS?

Packets are NMS, just saying. You very likely need to do something along the lines of inheriting from a wolf and changing it's appearance, no idea how that's done tho as I've never done it.

Using packets could work, but is not a smart idea, as you'd have to simulate the whole AI yourself, which is a nightmare.

maiden thicket
#

make an irongolem

#

remove its target and goal selectors

#

and then assign those of a wolf's to it instead

mighty aurora
#

Which ya know

remote swallow
#

sender.sendMessage(TextComponent.fromLegacyText("my text"))

mighty aurora
#

I don't feel like building an entire AI that already exists

dry yacht
trim lake
dry yacht
dry yacht
mighty aurora
#

Cause I want the entity to be an Iron golem but for it to do things like attack things that attack the assigned player and attack the things the player attacks

#

How would I override the target goals?

maiden thicket
#

create an iron golem

#

get its nms object

#

clear its targetSelectors and goalSelectors

#

then look at the wolf nms class

#

and assign what they do in there for the iron golem

mighty aurora
#

I tried to find something for NMS and this is what I made based off of that. Is this a correct NMS class for creation of a "custom" entity like this?

remote swallow
#

what class is getBlockInventory on

#

that would get the chest inventory probably

#

get inventory might get player

remote swallow
#

looks like it shouldnt

tardy delta
#

only CraftChest#getInventory is implemented in that class

twin venture
#

Dependices issuse [not sure if its]

tardy delta
#

it calls getBlockInv

#

it checks if the chest became a double chest if i seem to understand it

maiden thicket
#

unless ur trying to display it using a packet

#

so its not a server side entity

#

you can simply do

dry yacht
dry yacht
twin venture
tardy delta
#

if they dont know the right naming conventions why are they doing nms

dry yacht
maiden thicket
#

the org.bukkit IronGolem golem = world.spawnEntity(...);

CraftIronGolem bukkitGolem = (CraftIronGolem) golem;

the nms IronGolem ironGolem = bukkitGolem.getHandle();

#

u could even skip that second line and go to

the nms IronGolem ironGolem = ((CraftIronGolem)golem).getHandle();

maiden thicket
#

to use nms

#

naming conventions dont determine ur skill level to a point where ur not knowledgeable

tardy delta
#

💀

#

they only determine what kind of idiot you are

maiden thicket
#

???

twin venture
dry yacht
# tardy delta they only determine what kind of idiot you are

I love how many people use the word idiot out in public against others, even they themselves are immensely ignorant towards the true art of engineering. Getting into programming has been made so awfully painful and unbearable by all the egomaniacs in this field.

tardy delta
#

the true art of engineering?

#

go take a look at C++ and youll see what happens when there are no naming conventions

mighty aurora
#

I think I did something wrong but I don't know what. I created the ironGolem in the way you were saying(thank you btw) and then I tried to get the target and goal selector objects but it only shows what is in the picture.

tardy delta
#

need remapped or smth

maiden thicket
maiden thicket
mighty aurora
#

I tried to follow how to do that and it told me to run the build tools then just add a dependency with a classifer of remapped-mojang

maiden thicket
#

i dont know the steps of getting a remapped spigot but i remember it was written on one of the forum threads

#

yeah

#

did u do so

mighty aurora
#

I did so and it intelliJ threw an error that it couldn't find the dependency

maiden thicket
#

did u reload maven

mighty aurora
#

I believe so.

tardy delta
#

i just broke my ears with earbuds at 100%

dry yacht
# tardy delta the true art of engineering?

Yes, in essence the art of problem solving. For you to know conventions and to make use of socially accepted patterns does not at all make you a better programmer. It's such a superficial rating which does not at all have anything to say about the approach itself.

You convention and pattern guys turned 90% of computing into a complicated clusterfuck of rube goldberg machines which look good on the outside but rot on the inside.

There are so many kind people which could bring useful ideas and approaches to the table and you just discourage them from playing in the world of logic by being a smartass and talking their approaches down.

Sorry for the rant, I'm not going to talk any more about this topic.

mighty aurora
#

thanks

somber berry
#

Getting " Could not pass event BlockPistonExtendEvent" "Array index out of range: 0" if the piston extends anywhere. If the piston is besides the block from the list the event works without any problem.

tardy delta
#

e.getBlocks().get(i)

dry yacht
#

You assume that e.getBlocks() and testDataList are of same size, which is of course not (always) the case.

tardy delta
#

probably want a nested for loop

lavish hemlock
mighty aurora
somber berry
#

So what could I change so the event works only on my list and not throwing that error

maiden thicket
#

look at the wolf class and just use the priorities and goals they use

#

and which selectors they use

tardy delta
#

also that isEmpty isnt needed

dry yacht
mighty aurora
maiden thicket
dry yacht
maiden thicket
#

scroll up in the nms irongolem class and left ctrl + click on the package

mighty aurora
#

thanks

somber berry
proven monolith
#

wanting to use Fastboard

remote swallow
#

reload maven

#

also dont add jars to intellijs buildsystem

dry yacht
remote swallow
#

maven install it

proven monolith
#

awesome

#

thanks

real marsh
#

How to delete vehicle from existence ?```
public void onPlayerVehicleDestroy(VehicleDestroyEvent event){
if(event.getVehicle().getType() == EntityType.MINECART_HOPPER){
Delete destroyed vehicle
}
}

Tried: event.getVehicle().getLocation().setY(-20); and event.getVehicle().remove didn't work.
river oracle
#

anyone know whats wrong with this SQL statement? I get an error when putting it through to a prepared statement

INSERT INTO test_collection (employee_id TEXT, name TEXT, age INTEGER) VALUES (?, ?, ?);
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "TEXT": syntax error)
PreparedStatement statement = this.connection.prepareStatement(query)

this is the line of code displayed in the error so I know it has to be with my sql statement

remote swallow
#

TEXT isnt valid im guessing

dry yacht
river oracle
remote swallow
#

driver stuff maybe

river oracle
#

I did downgrade the driver to be the same as spigots so maybe its that?

remote swallow
#

its probably that

mighty aurora
#

How would I make it so that an iron golem is "tamable"(more that they spawn tamed) so that when setting their goals and targets to be the same as a tamed wolf they will still work.

somber berry
proven monolith
#

This is always a big error for me

#

I just got into Minecraft Plugin Making :/

river oracle
remote swallow
proven monolith
worldly ingot
#

The error seems to imply otherwise

proven monolith
river oracle
#

I don't think it is

proven monolith
#

or is it due to 2x the same name

dry yacht
mighty aurora
dry yacht
somber berry
river oracle
# proven monolith

just use proper Format for your packages into your project
com.github.[yourname].[project-name] or me.[yourname].[project-name]
if you own a domain do
[your domain backwords].[yourname].[project-name]
for example mine is for my current project
sh.miles.megumi
sh.miles is my domain
megumi is the project name

remote swallow
#

why is the domain backwards

tardy delta
remote swallow
#

normally isnt it endofdomain.domain.name.project name

#

or normally no name

proven monolith
dry yacht
remote swallow
#

the best way you can do is set group to me.yourname and artifiact as the project name

proven monolith
#

Alright.

river oracle
proven monolith
#

like: me.name.project

tardy delta
#

i also said that lol

river oracle
#

me.attixcll.soilscoreboards

dry yacht
remote swallow
river oracle
dry yacht
river oracle
#

wait no I was wrong I was looking at the wrong statement I c you now my SQL grammar was off and got tripped up by a copy paste from wrong spot lol

#

I somehow always fuck up the stupidest shit xD

proven monolith
woven coral
#

Hey, anybody else getting the issue on 1.19.3 where if you try using the InventoryClickEvent event and then click on an empty slot it doesn't fire?

proven monolith
#

should I rename the SoilScoreboards to Main?

dry yacht
tardy delta
#

forgot the s

woven coral
proven monolith
#

Where?

#

ooh there

remote swallow
dry yacht
# proven monolith uhh..??

The path of main does not point at the correct fully qualified name of your main entry point (JavaPlugin). It needs to be me.atticsoil.soilcoreboards.SoilScoreboards. Btw, you're missing an s in soilcoreboards in your package.

proven monolith
#

I noticed

dry yacht
# proven monolith uhh..??

No idea why specifying the main path is still a requirement, it's so easy to find the only class extending from JavaPlugin. Oh well.

river oracle
proven monolith
dry yacht
proven monolith
#

Yes

dry yacht
#

Image of the file tree please, haha

proven monolith
dry yacht
proven monolith
#

main: me.atticsoil.soilscoreboards.SoilScoreboards - PLUGIN.YML

tardy delta
#

did you repackage?

proven monolith
#

I rebuild the artifact

tardy delta
#

do mvn package and put the jar from /target in your server

proven monolith
#

uhhh?

remote swallow
#

press control twice then type mvn clean pacakge

dry yacht
# proven monolith I rebuild the artifact

Mind sharing your jar? Looks like you don't have much in there anyways, but it would help me to make sure you did everything correctly. Looks like a weird issue...

proven monolith
#

Wym "sharing"

#

the jar

dry yacht
#

Attach it here

undone spindle
#

how do i serialize itemstack into a yml

dry yacht
mighty aurora
#

Anyone willing to help me with creating an iron golem that would basically act like a tamed wolf without needing to change the iron golem class to be a tamable animal?

tardy delta
#

theres also a getItemStack

proven monolith
undone spindle
tardy delta
#

wdym

dry yacht
# proven monolith

Seems like your build process is completely messed up. How do you build your jar?

tardy delta
#

if that class doesnt implement configurationserializable then the config will not know how to save or load it yes

dry yacht
tardy delta
#

^^

undone spindle
#

XD

#

uhm

#

makes sense

proven monolith
#

soilScoreboard

undone spindle
#

now a bell rings in my head

#

i should have known

#

thx!

mighty aurora
#

I'm trying to setup an iron golem that will act like a tamed wolf. I got the NMS object cleared the golems goals and then tried to set the goals to be the tamed wolves goals but it doesn't work because iron golems are not tamable and so not all the goals can be set on the golem preventing it from working

chrome beacon
#

You can write your own goals

real marsh
# harsh totem entity#remove()

Tried like this didn't work or i'm doing it the wrong way ? ```
Entity minecarthopper = event.getVehicle();
minecarthopper.remove();

mossy loom
chrome beacon
#

Show code

#

?paste

undone axleBOT
naive bolt
#

Is their any premade config updated libs?

chrome beacon
#

?

#

Wdym

naive bolt
#

For updating a config

remote swallow
#

one of alex's plugins has one

dry yacht
mighty aurora
#

The issue is that IronGolem isn't a tamable entity

dry yacht
mighty aurora
#

and several of the wolf goals require a tamable entity

naive bolt
#

I think i found alex's plugin. ty

dry yacht
mighty aurora
#

                    ironGolem.targetSelector.removeAllGoals();
                    ironGolem.goalSelector.removeAllGoals();
                    ironGolem.goalSelector.addGoal(5, new MeleeAttackGoal(ironGolem, 1.0, true));
                    ironGolem.goalSelector.addGoal(6, new FollowOwnerGoal(ironGolem, 1.0, 10.0F, 2.0F, false));
                    ironGolem.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(ironGolem));
                    ironGolem.targetSelector.addGoal(2, new OwnerHurtTargetGoal(ironGolem));
                    ironGolem.targetSelector.addGoal(3, (new HurtByTargetGoal(ironGolem, new Class[0])).setAlertOthers(new Class[0]));
                    ironGolem.targetSelector.addGoal(4, new NearestAttackableTargetGoal(ironGolem, net.minecraft.world.entity.player.Player.class, 10, true, false, ironGolem::isAngryAt));```
#

Thats everything for the golem

#

I pulled the goals from the wolf class file

#

I don't think I'm legally allowed to just directly show you that

chrome beacon
#

You're going to need to write your own goals or make your IronGolem tameable

mighty aurora
#

How do i make it tamable

chrome beacon
#

If it's an interface you just implement it

#

Otherwise write your own goal

mighty aurora
#

How would I learn how to do that?

chrome beacon
#

Which one

mighty aurora
#

Write a goal

#

Far as i know its not an interface

chrome beacon
#

You take a look at the existing ones

real marsh
dry yacht
river oracle
#

when working with SQL is it okay to update tables like this? In this scenario I'm only technically changing the age, on the implementation, but in the back end I don't know whether name has also changed. In my scenario its not. Would it be better to just update a value even though it hasn't changed or store some copy of the data to check against what I need updated specifically

UPDATE test_collection SET name = ?, age = ? WHERE employee_id = ?; 
remote swallow
#

you probably canchange the format a bit

#

SET (name, age) VALUES (?, ?) WHERE ect

river oracle
#

damn thats a lot nicer thanks, but questions remains whether its okay to just overwrite values even though they are the same or whether its better to do some weird check for it

dry yacht
river oracle
# dry yacht Where do you call this statement? When updating what exactly?

e.g. I have a data object in this example its just called DataHolder

        final DataHolder exampleData = new DataHolder(UUID.randomUUID(), "John", 20);

        // insert data
        collection.insert(exampleData);

        // update
        exampleData.setAge(21);
        collection.update(exampleData);

its being inserted
than updating just the age, but then when I run the update query I update every value in the column, but the primary key even though they may not have been a change

UPDATE test_collection SET name = ?, age = ? WHERE employee_id = ?; 
dry yacht
river oracle
#

alright thank you

dry yacht
#

But I don't think that you're actually doing the multi-access stuff, as that requires a whole other level of things to think about.

tardy delta
#

keep a boolean in your object whether its updated

river oracle
tardy delta
#

just one field

river oracle
#

I mean I could write byte code to do that , but I rather not

dry yacht
#

With this little addition you can avoid having useless updates which don't actually update anything but tax the system

river oracle
#

but that also works i suppose

dry yacht
#

you still have to do some insert or update check (upsert, as it's often called).

tall dragon
#

is there a good way to calculate how much time the breaking of a certain block with certain tool would take ?

#

don't think the api has a method to do this as far as i know

tardy delta
#

if those updates are done async and youre not waiting for them to return it doesnt matter

#

unless youre trying to limit the amount of queries

river oracle
river oracle
dry yacht
#

But again, you can scrap that, it's nitpicky performance stuff which keeps you from solving the problem at hand.

tardy delta
#

looking at chocos code

remote swallow
#

dafuq is |=

dry yacht
#

Oring and assignment in one

#

Bitwise or to be exact

#

It accomplishes the latch-like behavior I talked about earlier.

tardy delta
#

isDirty = isDirty | oldValue != newValue

#

i believe | works the same as || for booleans

#

but ||= isnt a thing

echo basalt
#

uhh

hazy parrot
#

It is same as "logical or" aside from | actually execute both sides if first is true

echo basalt
#

yeah

#

| is bitwise OR

#

it works for booleans as the logic just works like bytes internally

#

both sides execute regardless if the first one returns true or not

#

I'd honestly just do a markDirty method, as is usual practice

dry yacht
echo basalt
#

well

#

boolean -> byte -> integer

dry yacht
echo basalt
#

anything that's a short or byte is just represented by an int in the typical jvm

echo basalt
#

There's no guarantee that method will be an OR instruction forever

#

you can for example, have a logging system

#

for a replay system of some kinds in the future

dry yacht
#

Ah yes, there we are again. Overcomplication because "you could have x some day, be prepared!"

echo basalt
#

It's standard practice

#

I'm not telling you how to write your code

dry yacht
#

Yep yep, behave as socially accepted, just don't be different because it makes more sense in the current situation.

echo basalt
#

I couldn't care less

dry yacht
# echo basalt I couldn't care less

This is not about me, but about the person who actually persists models in a database and asked that question. But I get the idea, thanks.

echo basalt
#

I've just learned through years of experience, that preparing for a likely future is a nice strategy

#

I've rewritten my code lots of times

#

Over some very stupid changes

#

So I'd rather just write something future-ready even if it comes at an additional overhead

#

encapsulation and all

glossy venture
#

java will probably optimize that out anyways

dry yacht
# echo basalt I've rewritten my code lots of times

That's where sophisticated refactoring comes into play rather than being overly prepared for every little if and when. But hey, to each their own, just didn't want to let that statement be the only one regarding that topic.

glossy venture
#

most likely at runtime

echo basalt
#

yeah, compiler optimization isn't something that apparent

glossy venture
#

i mean the compiler cant just inline a piece of code because it might be overridden or something

dry yacht
#

It's not about the subroutine jump, it's about it being an unnecessary jump for the brain of the reader.

echo basalt
#

So, what is cleaner

dry yacht
echo basalt
#
a = b;
markDirty();
save();

or

a = b;
dirty = (dirty | oldResult != newResult);
save();
#

I don't see the point but then again, we always seem to argue over code style

#

Because we both have different approaches

glossy venture
echo basalt
#

and I won't really go on about this as neither of us will change

glossy venture
#

its risky to optimize that out

dry yacht
glossy venture
#

unless its marked final ofc

echo basalt
#

Your code will eventually get read by people who are not you

dry yacht
echo basalt
#

there's a chance they might be idiots

#

that chance is higher than the chance that it will be read by an actual bit magician

dry yacht
echo basalt
#

seeing a "markDirty" and not understanding the internal logic

#

is still more helpful

#

than just seeing the internal logic

#

You also only have a single code block to change, in the event you actually want to change the implementation

#

or some idiot like me can make a class that extends it and overrides that method

#

for some patchy under-budget commission ;)

white root
#

Is there a way to replace the prefix of the logging format for my plugin?
I wanted to have my plugin log with the prefix AdvancedEngines> but when I set the prefix option in my plugin.yml to prefix: "AdvancedEngines> ", the logs output [AdvancedEngines> ] <log message here> which isnt quite what I had in mind lol
(Ideally I would like to not use just System.out.println)

harsh totem
echo basalt
#

I've done that with bukkit's plugin manager once

#

and used unsafe to inject it into the server

#

choco wasn't happy

glossy venture
echo basalt
#

all because calling dispatchCommand doesn't fire any events

#

what a shame

dry yacht
harsh totem
dry yacht
dry yacht
real marsh
harsh totem
glossy venture
#

and it worked and looked nice

#

so yeah

echo basalt
#

imagine using a logger lmao

dry yacht
echo basalt
glossy venture
#

ssytem.uot.pirntln

glossy venture
dry yacht
echo basalt
#

of course

ocean hollow
#

How can I make it so that you can't put items in the gui?

echo basalt
#

its just a webhook n all

white root
glossy venture
#

like slot is not the input slot, then cancel

ocean hollow
#

I did so, but despite this, if I try, I can shove an item in there

dry yacht
echo basalt
ocean hollow
#

And these items can simply be put in, but cannot be taken away.

dry yacht
ocean hollow
#

Yes, pressing RMB with an item changes the item

serene sigil
#

how do i know detect if its the crafted item? (for instance im trying to create an iron sword that can be renamed to anything and has no lore (so there is no way to detect from the name or the lore that its that item) but when used, it damages the player instead of the entity u hit, which a regular iron sword cant do)

glossy venture
dry yacht
ocean hollow
#

So what should I do?)

dry yacht
ocean hollow
#

okey, wait

hushed spindle
#

is there a way to disable a recipe from a server without completely removing it

#

because my plugin needs to disable certain recipes but if you remove the plugin afterwards those recipes will still be gone

#

i just need some recipes disabled, so make them uncraftable and not have them show up in the recipe book, without completely removing them

#

or do i just deal with removing them and tell the users to return those recipes themselves

#

(cancelling the crafting event alone is not enough because they'll still appear in the book)

vocal cloud
#

You add to the documentation that they need to run a command before removing your plugin.

hushed spindle
#

is there a way to retrieve what the vanilla recipe used to be? because this disabled recipes list can be configured

#

or do i have to code in all the recipes just in case a player removes them lol

#

or using a workaround like persisting all the details of the recipes that are disabled

ocean hollow
#

(Sorry for the messy code)

remote swallow
#

?arrowcode

undone axleBOT
hushed spindle
#

i recommend PersistentDataContainer to add such a tag to the sword

sonic goblet
#

^

hushed spindle
#

it's invisible aside from the extra NBT tag in the f3+h view

#

which you cant really avoid

serene sigil
#

i tried this and then in an event detect if the item the player is holding has that data, but its null

hushed spindle
#

what is null

remote swallow
#

naming conventions out the window

serene sigil
#

huh?

remote swallow
#

?conventions

remote swallow
#

the method should be createSussySword

hushed spindle
#

also you can put the namespacedkey part outside of this method since you reuse the same key always anyway

#

but what is null

serene sigil
serene sigil
#
@EventHandler
    public void hit(EntityDamageByEntityEvent event) {
        if (event.getDamager() instanceof Player player) {
            if (player.getInventory().getItemInMainHand().getType() == Material.IRON_SWORD) {
                if (player.getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Main.getInstance(), "suicideSword"), PersistentDataType.INTEGER)==1) {
                    player.damage(event.getDamage());
                    event.setCancelled(true);
                }
            }
        }
    }```
hushed spindle
#

well the namespacedkey in your created sword is sussySword

#

and here you're looking at suicideSword

serene sigil
#

oh..

#

lmao

#

ok

#

wait

hushed spindle
#

before you try to look at the value a PersistentDataContainer has you should also check for getPersistentDataContainer().has(...)

tardy delta
#

wont get() throw when its not present and you try to unbox

sonic goblet
#

^

tardy delta
#

use getOrDefault

hushed spindle
#

yeah get will throw that NPE

serene sigil
#

oh alr

hushed spindle
#

thats why she should be using has() first

tardy delta
#

i believe theres a getOrDefault

#

trying to not do two map lookups

hushed spindle
#

otherwise when you use literally any other iron sword it'll throw that error

#

is there i forgor

#

there is

remote swallow
#

anyone used yaml anchors before and know if theres something wrong with my format?

items:
  ELYTRA: &ElytraItem
    #Make them match the stuff on https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html or no enchant
    Enchants:
      MENDING: 1
      DURABILITY: 3
    Lore:
      - "Lore Line 1"
      - "Lore Line 2"
    Name: "Epic Elytra name"



vote-gui:
  1: *ElytraItem
hushed spindle
#

just use a yaml validator online

remote swallow
#

the yaml is valid

#

im talking about the alias/anchors

serene sigil
#

i dont get the exeption now tho

remote swallow
#

ah there was something wrong with my anchor/alias format

hushed spindle
serene sigil
#

?paste

undone axleBOT
serene sigil
tardy delta
#

what are yml anchores?

dry yacht
remote swallow
#

its probably alias

#

the &something *something

hushed spindle
serene sigil
#

ye im using the sword i crafted

hushed spindle
#

are you sure you didnt get any startup errors because i know minecraft likes to complain when you register recipes under keys that already exist

dry yacht
remote swallow
#

@tender shard showed me it a few days ago

remote swallow
#

he uses it in one of his plugins

#

it doesnt use any other yaml stuff it looked like

hushed spindle
# serene sigil idk i just did /reload confirm

just check the if conditions in that case, output a message in else statements. but first just make your namespacedkey private static, you dont have to keep remaking the same namespacedkey

#

and that way you also know for sure you're using the same one always

serene sigil
#

ok

mighty aurora
#

I'm confused. I am trying to make an iron golem that basically acts like a tamed wolf(protecting the player and attacking what the player attacks). I have been trying to use NMS but I basically have to take all of the wolf goals and targets and rewrite them so that they actually work for Iron Golems. Anyone have any other ideas?

tender shard
remote swallow
#

it was?

#

has it only been 1 day?

#

the how

tender shard
#

hm or maybe wednesday

remote swallow
#

one sec ill go check

tender shard
#

what you sent is valid yaml

remote swallow
#

in 3 hours it will havebeen 2 days ago

remote swallow
tender shard
#

wait ugh

#

line 3

#

you say "&elytraitem

#

what is that supposed to do

#

it should be like this:

remote swallow
#

connect to the *elytraitem below, yamlint made me do it that way

tender shard
#
items:
  ELYTRA: &elytraitem
    Enchants: ...
#

the & thing has to be the same line

remote swallow
#

same error

tender shard
#

hm lemme check the error msg

serene sigil
# hushed spindle just check the if conditions in that case, output a message in else statements. ...

interesting... it prints out "2" whenever i hit something...

@EventHandler
    public void hit(EntityDamageByEntityEvent event) {
        if (event.getDamager() instanceof Player player) {
            if (player.getInventory().getItemInMainHand().getType() == Material.IRON_SWORD) {
                if (player.getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().has(suicideSword, PersistentDataType.INTEGER)) {
                    Bukkit.broadcastMessage("1");
                    player.damage(event.getDamage());
                    event.setCancelled(true);
                } else {
                    Bukkit.broadcastMessage("2");
                }
            }
        }
    }```
tender shard
#

send your full config

remote swallow
#

one sec ill remove the db stuff

tender shard
#

the config you sent doesnt match the error you got

#

do not remove it completely

#

just "censor" it

#

I need to know the line numbers

remote swallow
hushed spindle
#

try restarting your server

tender shard
#

that should work fine. are you sure that this is exactly the config your plugin uses? maybe check the plugin data folder, whether there's still an old config in that folder