#help-development

1 messages · Page 1729 of 1

regal moat
#

How can I make blocks like leaves break slower?

#

Like in Hypixel Skyblock, Deep Caverns

mellow edge
#

maybe if you give player effect

#

and then remove it

#

It is called Mining Fatigue

willow gyro
#

what ip

#

?

mellow edge
#

why am I always typing them instead of then lol

willow gyro
#

What ip address of the server?

mellow edge
#

which server?

willow gyro
#

from minecraft

#

Spigo is not minecraft server?

mellow edge
#

so you want spigotmc mc server idk if that exist

willow gyro
#

yes

mellow edge
#

lol why are you asking that in developtment channel here we are helping with code

warped gazelle
#

hi guys, someone can help me?

#

what's that?

mellow edge
#

are you creating a plugin?

warped gazelle
#

Nope

paper viper
#

then you are in the wrong channel

#

this is for programming

#

for your question

mellow edge
#

yes

ivory sleet
#

ReentrantBlockableEventLoop

#

😼

lean gull
#

is it possible to make the structure block outline in the spigot api?

opal juniper
#

đŸ€”

#

i don’t know tbh

lean gull
#

i think i found it, i think it's called BoundingBox

opal juniper
#

no it isn’t

#

that’s something different

hasty prawn
lean gull
#

the white line outline is called a bounding box, right?

opal juniper
#

yeah but the org.bukkit.util is different

worldly ingot
#

There was a recent structure block API added just a couple days ago

#

Though whether or not that actually displays any bounding box is beyond me. I'd guess not

rapid vigil
#

Hello! I've been trying to run buildtools 1.12.1 but when I start cloning it stops with the error 'You are using Java 16, use Java 8 or 9 to build this version' (Just lazy to copy paste) anyways, I have Java 16 and Java 8 Both installed is there anyway to select the Java 8 so it can use it to build or not?

#

I can just delete Java 16 build it then install it back but I've been wondering if there is a way to let it build on Java 8 instead of Java 16

#

Guess I'll just delete Java 16..

ancient plank
rapid vigil
#

Thank you anyways.

noble knot
#

Hi! I'm quite new to spigot and i can't figure out how to create a list of strings and then use it in this case:

#

It would be a list of words to block

eternal oxide
#

You would have to check each word

waxen plinth
#

Easiest way is to just loop through a list of strings checking if the message contains any of them

#

Most efficient way is to use a prefix tree

#

Beware of uppercase letters

acoustic pendant
opal juniper
#

you need an mkdir there

#

i imagine

#

probably plural

acoustic pendant
opal juniper
#

File#mkdirs() iirc

#

it’s like “make directories”

solid cargo
#

how can i make a cosmetic explosion

acoustic pendant
opal juniper
#

isn’t there a method under world?

solid cargo
#

one that doesnt damage players

#

cough hypixel hyperion cough

opal juniper
#

hmm i think there was a boolean that turned it off

solid cargo
#

there are only 2 booleans on createExplosion

opal juniper
#

oh yeah fire and block break

solid cargo
#

maybe set the power to 2?

opal juniper
#

hmm

solid cargo
#

i mean

#

0

#

setting power to 0 worked

opal juniper
#

cool

solid cargo
#

hmm

#

and how could i add a damager in a certain radius?

vague oracle
#

Loop nearby players and damage them

acoustic pendant
#

hey, could anyone tell me why this doesn't create a folder and a file?

eternal oxide
#

no annotation on the event

tardy delta
#

no

#

System.currentTimeMilllis() is the epoch time

acoustic pendant
#

well, the name wasn't the UUID

eternal oxide
#

not annotated

acoustic pendant
#

wdym?

eternal oxide
#

Eventhandler

acoustic pendant
#

i have it registered

eternal oxide
#

annotate @Eventhandler

acoustic pendant
eternal oxide
#

your event is not annotated with @Eventhander

vague oracle
#

He doesn’t know what an annotation is

eternal oxide
#

I guess

vague oracle
#

Show him a pic

acoustic pendant
#

^^

eternal oxide
#

nope, he's done it before

vague oracle
#

I would but on phone xD

eternal oxide
#

and I'm eating

acoustic pendant
#

but, i don't understand what are you saying

vague oracle
#

You should learn Java first @acoustic pendant

eternal oxide
#

No, only for things of computational significance, file and database access

#

correct

#

use Futures

#

it will not wait. but you can define what happens when it gets the result

tardy delta
#

CompletableFuture.supplyAsync(() -> {};)?

eternal oxide
#

You know what annotations are adri

acoustic pendant
#

no?

eternal oxide
#

you have done other listeners

acoustic pendant
#

yes

#

but

#

i don't know what are you meaning

tardy delta
#

@EventHandler

#

as simple as that

eternal oxide
#

all event listener methods have an annotation of @EventHandler

acoustic pendant
eternal oxide
hasty prawn
#

Can event listener methods be static?

acoustic pendant
hasty prawn
acoustic pendant
#

eeh

#

yes

acoustic pendant
eternal oxide
#

have you added the annotation yet?

acoustic pendant
#

oasdjjasdasj

#

i don't understand

#

what do you mean

eternal oxide
# acoustic pendant what do you mean

I have told you multiple times what an annotation is. I've told you all event listener methods require one, and I've linked you to a tutorial for beginners on using the Listener.

acoustic pendant
#

is it not enough with @EventHandler?

eternal oxide
#

YOU DON'T HAVE IT!

acoustic pendant
#

I literally have it

eternal oxide
acoustic pendant
#

well, so it was My bad

#

this is the code

eternal oxide
#

get rid of ALL the static

#

add a constructor and pass an instance from yrou plugins main class.

#

you are already instancing this class in your onEnable, so pass it

true perch
#

I added a simple queue system for SQL commands to be executed on an async thread. The goal of it is to limit the amount of total sql calls per tick on a single async thread instead of tens of thousands of separate async threads. I simply need to add a string to the "queueSQLCommands" ArrayList for it to pick it up and send it to the SQL.

Is there a better way to do this? Or is what I'm doing fine?

public void beginSQLQueue() {
    new BukkitRunnable() {
        final ArrayList<String> queue = queueSQLCommands;
        int total = 0;
        final int limitPerTick = 10;

        @Override
        public void run() {
            if (!serverRunning) {
                cancel();
            } else {
                for (int i = 0; i < limitPerTick; i++) {
                    if (queue.size() == 0) {
                        break;
                    } else {
                        try {
                            YuCraft.MAIN_CLASS.SQL.getConnection().prepareStatement(queue.get(0)).executeUpdate();
                        } catch (SQLException e) {
                            Bukkit.getLogger().info("Error executing: " + queue.get(0));
                            e.printStackTrace();
                        }
                        queue.remove(0);
                        total++;
                        if (total % 25 == 0) {
                            Bukkit.getLogger().info("Queue executed " + total + " times.");
                        }
                    }
                }
            }
        }
    }.runTaskTimerAsynchronously(this, 0, 1);
}
ancient whale
#

Hey, I would like to know how could I basically know if a block should be affected from an explosion (especially the "native liquid protection" thing) but I can"t think of a way of doing it 😒

#

(One way of doing it would be to be able to make obi appears in the inital blocklist from the ExplodeEvent, but I couldn't find anything that would allow it in spigot config)

tacit drift
#

line 153 from Main.java?

#

huh?

#

oh ok

quaint mantle
clever meteor
#

Hey

#

Can some1 help me code a plugin by any chance

#

Can you add me and I can show u

ivory sleet
#

?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. Create a thread in case the help channel you are using is already in use!

wide coyote
#

it means enchantment is null

#

Main.java, line 77

#

huh?

#

are you it is the line 77

#

probably it is like item.addUnsafeEnchantment()

#

send the whole code please

#

?paste

undone axleBOT
echo basalt
#

you can't get a "Enchantment is null" exception when making an arraylist

wide coyote
#

glow is null

echo basalt
#

glow is null

#

you're calling addUnsafeEnchantment(glow) before calling new Glow()

#

Also using suppresswarnings for your bad code isn't a good solution

#

Neither is making everything static

#

Naming your class Main doesn't tell anything, as there are 200 other Mains

#

And using reflections to access public methods on a specific class is just dumb

#

you're sacrificing performance by not using OOP

#

And potentially crashing servers due to memory leaks

#

You're also repeating code... a lot

#

and making everything in 1 class

#

read

glossy venture
#

you are calling

registerEnchantment(glow)
``` the name of the parameter in your function is `enchantment`
change line 64 to
```java
registerEnchantment(enchantment)
#

or you can replace line 29 (registerEnchantment(glow = new Glow());)
with

glow = new Glow();
registerEnchantment(glow)
``` but if you do that having the `enchantment` parameter in your method is pointless
maiden mountain
#

Quick question, How do i add color codes to my configuration messages?

glossy venture
#

you need to either add them using the ChatColor enum, like so;

player.sendMessage(ChatColor.RED + "hello"); // this will send "hello" in red

or use ChatColor.translateAlternateColorCodes(char, String) like this:

player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&chello"); // this will also send hello
#

you cant use the bukkit api asynchronously

#

you will have to make like a task queue which runs whatever task you want

#

you can use it for sql access though

#

np

maiden mountain
#

@glossy ventureThe thing is, all messages are configurable through the configuration file.

glossy venture
#

ooh

#

wait

maiden mountain
#

Does that mean i have to alternate every message?

glossy venture
#

yes

#

just call that translate method on every message

#

from your configuration file

maiden mountain
#

pain

#

But thanks for the help đŸ’Ș

glossy venture
#

np

#

u can do something like this

public static String t(String s) {
  return ChatColor.translateAlternateColorCodes('&', s);
}
#

to make it faster

#

just call t(<message>) on everything

#

instead of that long function call

#

@maiden mountain

maiden mountain
#

@glossy ventureYeah that makes it way cleaner, thanks bro

glossy venture
#

np

#

re send code plz

#

you are trying to add a null enchantment to an item

#

so im assuming that you forgot to instantiate the glow field

#

use this in your onEnable:

glow = new Glow();
registerEnchantment(glow);
undone axleBOT
glossy venture
#

you are calling loadRecipe before glow is created

#

put it after

maiden mountain
#

Hell yeah, got it working

glossy venture
#

nice

maiden mountain
#

Appreciate the help brother

glossy venture
#

no problem

timber whale
#

quick ez question

glossy venture
#

send the code in your Glow class Glow.java

glossy venture
timber whale
#

what do the parameters in


                location.getWorld().spawnParticle(Particle.REDSTONE,location,1,1,1,1,1,1 );

mean

ivory sleet
#

?jd-s

undone axleBOT
glossy venture
#

depends on the particle

timber whale
#

i read the javadocs

#

its da not there

#

lol

ivory sleet
#

Pretty sure it does tell ya

timber whale
#

oh

#

thank you

glossy venture
#

the parameter names will help

#

but it depends on the particle

#

what some of the values do

timber whale
#

if i did redstone

glossy venture
#

so i recommend getting help from a minecraft wiki or something

timber whale
#

bc im like 99% sure

#

u can make it bigger

glossy venture
#

i have no clue

#

honestly

timber whale
#

hmm ok

#

ty for the javadocs help

timber whale
#

how would i make it a variable LMFAOO

#

like blah particle = location.getWorld().spawnParticle(Particle.REDSTONE,location,1,1,1,1,1,1 );

ivory sleet
#

new Particle.DustOptions(...,...)

timber whale
#

ah ic

glossy venture
#

call

spawnParticle(
  /* type */ Particle.REDSTONE, 
  /* location */ location, 
  /* count */ 1, 
  /* offsets */ 1, 1, 1, 
  /* "extra" */ 1,
  /* data */ new Particle.DustOptions() // contains size and stuff
)
#

that contains the color and size

#

the DustOptions class

#

in the case of redstone

ivory sleet
#

Send ur code from the class Glow, I think it means that

glossy venture
#

yeah

#

you have a Glow.java file

#

that has the class Glow in it

#

send the code of that class

#

because you have an invalid plugin instance reference

#

no the file

#

at com/hitman/recipe/Glow.java

#

just like you sent the code in Main.java

#

yes the glow one

#

copy and paste it into the hastebin

undone axleBOT
glossy venture
#

you forgot to set main to this in onEnable

#
main = this;
``` add this line to the start of `onEnable`
timber whale
#
location.getWorld().spawnParticle(Particle.REDSTONE,location,1,1,.125,.125,.125,new Particle.DustOptions(Color.fromRGB(255, 255, 0), 5) );
#

does that look good

glossy venture
#

yeah

timber whale
#

kk ty

glossy venture
#

looks good to me

clever meteor
#

Hey could some1 help code or find a plugin by any Chance

ivory sleet
#

?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. Create a thread in case the help channel you are using is already in use!

glossy venture
#

what type of plugin

#

i dont think i can code one for you but there are probably many plugins that do what u want

clever meteor
chrome beacon
#

Why not explain here

timber whale
#

it works ty

clever meteor
#

I can't send a ss

ivory sleet
#

if its a plugin request

#

?services <- use that

undone axleBOT
lavish hemlock
#

where would it measure it to? a website, a text file on the server machine in a log folder somewhere, or some in-server thing?

glossy venture
#

yeah i think thats what they want

glossy venture
#

he said it was from a server with 3500 players

#

probably custom coded

lavish hemlock
#

ohh so like the Watchdog announcement on Hypixel?

glossy venture
#

no when a command is run by the admins i think

lavish hemlock
#

oh I see

glossy venture
#

they can monitor their staff

#

but it was from a big server so probably custom coded

lavish hemlock
#

I could probably make a plugin like that in not too long of a time but I'm kinda working on some other stuff rn lol

#

I also have limited experience with Spigot's API so I need to study it a bit more

glossy venture
#

yeah

#

you would most importantly need to interface with the punishment plugin itself

#

which is the hard part

ivory sleet
#

gui?

glossy venture
#

nah chat message when a command is run by an admin

lavish hemlock
glossy venture
ivory sleet
#

I mean if you code everything in a proper you'll have good boundaries between business rules and possible io devices and such so then it shouldn't be too hard nor too messy

glossy venture
#

thats the screenshot he sent me

lavish hemlock
#

I'd make a system where it logs each moderative action in an entry in a chest GUI, which can be hovered over to see its information.

glossy venture
#

but we dont know which plugins they use

ivory sleet
#

ah

glossy venture
lavish hemlock
#

oh neat

#

is it cross-server-restart?

#

the plugin they want

#

I dunno why I'm asking I'm just really curious

glossy venture
#

i dont know

#

you mean proxy

lavish hemlock
#

actually better question

#

actually

#

nvm

glossy venture
#

i got to go soon

lavish hemlock
#

cool

#

you go ahead and do that

glossy venture
#

its 10 pm my time

#

i think im in EST

ivory sleet
#

its 22:06 for me

glossy venture
#

oh

#

nice

#

same

ivory sleet
#

ya

glossy venture
#

exact same actually

ivory sleet
#

live in sweden

glossy venture
#

netherlands

ivory sleet
#

not too far away :p

glossy venture
#

nice

glossy venture
ivory sleet
#

ah so its like 16:00 for you piotr?

glossy venture
#

aka 4 pm

ivory sleet
#

apologies

glossy venture
#

what would we call u otherwise

ivory sleet
#

Idk what to call people unless they state their wanted alias lol

glossy venture
#

same

#

i think everyone has that lmao

sullen marlin
#

Missing event handler annotation

glossy venture
#

yooo

#

md_5

#

epic

#

ive tried making a glow enchantment

#

but it didnt work

#

for some reason

#

at least the glow didnt show

ivory sleet
#

glow enchantment?

glossy venture
#

yeha

#

yeah

#

just visual

clever meteor
#

Hey could some1 help code or find a plugin by any Chance

ivory sleet
#

oh afaik you can pretty much inject an empty nbt compound for the key enchs or Enchantments iirc

clever meteor
#

Been trying so long

glossy venture
#

?services

undone axleBOT
glossy venture
#

jack stop asking here

#

go to the services

#

open a thread or whatever its called

#

bro

#

@quaint mantle

#

why are u trying to cast a vindicator to a player

#

is the vindicator eating the item?

#

what?

#

check if its a player with entity instanceof Player

if (entity instanceof Player)
#

or cast it to org.bukkit.Entity instead of player

#

and use those methods

#

what is that sentence

quaint mantle
#

what an unneeded "fix"

young knoll
#

Indeed

#

You are missing a .

#

Also it depends what e.getEntity is

young knoll
glossy venture
#

remove the potion effect

#

there is also a way to make the entities glow without an effect

young knoll
#

You can't hide the glowing effect iirc

opal juniper
young knoll
#

True

quaint mantle
#

true*

opal juniper
#

i thought you were a python guy

ivory sleet
#

^

#

lmao

#

Turned into Java guy

quaint mantle
#

Python -> Java -> Python -> Java

#

its an endless cycle

opal juniper
#

conga

#

oh

quaint mantle
#

i like that idea

opal juniper
#

language conga

quaint mantle
echo basalt
paper viper
left plover
#

Semicolen

#

I didn't spell that right I think

#

Semicolon

verbal nymph
#

The code below disables all impact damage of arrows EXCEPT for tipped arrows with Instant Healing II effect. Any idea why?

@EventHandler
    void oneEntityDamageByEntity(EntityDamageByEntityEvent e) {
        if(e.getDamager().getType() != EntityType.ARROW) return;
        e.setDamage(0);
}

See this video: https://youtu.be/dZE7aQ6m1zo (pls don't mind me having the skill of a 74 year old who's never touched a PC in their life)

worldly ingot
#

You probably want to do !(e.getDamager() instanceof AbstractArrow) instead to cover all types of arrows

#

Or if you still want spectral arrows to work, !(e.getDamager() instanceof Arrow)

verbal nymph
#

Thanks for your reply, however, that doesn't seem to be it: The tipped arrow with Instant Healing II does meet the if condition, so the issue is not that it's returning in line 3. It's just setDamage(0) not applying for whatever reason.
When I print out getDamage() right after, it gives me 0 for all other arrow types. Just this one shows the usual hit damage.

tender shard
#

what exactly is the problem? entities still get damage when shooting with an instant healing 2 arrow, but not for all other types of arrow? @verbal nymph

#

what about instant healing 1?

#

it's hard to believe that the type of arrow makes any difference, of course the event should work for all types of arrows

round finch
#

?paste

undone axleBOT
round finch
#

why is this happening?

#

my plugin breaks but not on my local server?

marsh burrow
#

Would someone know of a tip to shoot multiple arrows at once without tripping the ProjectileLaunchEvent multiple times causing an infinite loop 😄

quaint mantle
round finch
quaint mantle
tender shard
#

players cannot consume when their hungerbar is full

#

what you COULD do is to deplete the hunger bar when a player right-clicks the item

#

and then restore it back when they do not actually consume the food

#

listen to playerinteractevent

#

then check if it's a rightclick and whether they have something eatable in their hand

#

that's what my former employer's server did

young knoll
#

You could also use an item that can be eaten at full hunger

#

I think golden apples are the only one

valid solstice
#

how do you test your plugins that involves 2 people but you only have 1 minecraft account?

#

ex: i want to test a command that tps one player to another

#

is there any other way

#

like to summon a fake player

quaint mantle
valid solstice
#

oh

#

alright thanks

quaint mantle
#

send plugin yml

#
commands:
  custompotion1:
    description: Gives *** Crate Potion
young knoll
#

UwU

quaint mantle
#

shutup

#

🙂

undone axleBOT
quaint mantle
#

it tells you

#

plugin = this;

#

agreed

young knoll
#

If only I could change my nickname here

paper viper
#

Bro why your main class is called Main

onyx shale
#

Oh god that topic againduke

young knoll
#

Description: S O U P

quaint mantle
paper viper
#

sigh

young knoll
#

Brace yourself

paper viper
#

god damn it when will people ever learn

#

i paste this shit way too much in helpchat and spigot discord

unreal quartz
#

get it on a billboard

young knoll
#

Where do you put a billboard for the most plugin devs to see it

unreal quartz
#

buy every single billboard

paper viper
#

I will ask bill gates to do it

unreal quartz
#

or just project it in the sky cuz the earth is flat

paper viper
#

That's true

#

facts

spare marsh
#

Question

#

So

#

I have a plugin that takes a heart away from you every time you die

#

But

#

If you have a shield and covered the damage

#

It will run it as if you had died

young knoll
#

Are you using the death event

spare marsh
#

EntityDamagedByEntity Event

#

Cause I also need the killer

young knoll
#

You can get the killer in the death event too

#

Use getFinalDamage over getDamage

spare marsh
#

You can? 😼

#

From the PlayerDeathEvent? Wdym? It won't let me

young knoll
#

Player.getKiller iirc

spare marsh
#

Yes My bad was trying something else

#

Thank you

spare marsh
young knoll
#

Then it will return null iirc

spare marsh
quaint mantle
#

check for null then return

#

md_5 spigot
đŸȘŁ

spare marsh
#

By the way how do I make a nether portal from my TestWorld from taking you to world_nether

valid solstice
#

cannot resolve method "playSound"

valid solstice
#

this is the line thats giving me this error sender.playSound(sender.getLocation(), Sound.BLOCK_ANVIL_BREAK);

young knoll
#

What is sender

#

I’m going to guess not a player

quaint mantle
#

we can sender isn't a player, u should check if sender instanceof player?

valid solstice
quaint mantle
#

as

#

commandsender will not have a playsound

young knoll
#

Is it though

valid solstice
#

Player sender = Bukkit.getServer().getPlayer(senderStr);

young knoll
#

I... have several questions

valid solstice
#

why

young knoll
#

Anywho

quaint mantle
#

dont, if u use commands then use if sender instanceof player

#

then playsound

young knoll
#

Are you on a version from not 6 years ago

valid solstice
#

im in 1.17.1 api

quaint mantle
#

wat are u trying to do exactly

#

is that a command

#

to play a sound?

valid solstice
#

its a asyncchatevent

#

then playsound to the player

young knoll
#

Strange, don’t see why it wouldn’t be resolved

quaint mantle
#

give us code maybe

valid solstice
#

ok

young knoll
#

It should at least tell you you have the wrong params

valid solstice
#
@EventHandler
    public static void onChat(AsyncPlayerChatEvent event){
        Player target = event.getPlayer();
        if(MessageAwaiter.getPlayerList().containsValue(target.getDisplayName())){

            String senderStr = (String) MessageAwaiter.getPlayerList().get(target.getDisplayName()); //sender
            Player sender = Bukkit.getServer().getPlayer(senderStr);

            if(event.getMessage().equalsIgnoreCase("y")){
                    sender.playSound(sender.getLocation(), Sound.BLOCK_ANVIL_BREAK);
                    sender.sendMessage("§l§e(!)§r§c You do not have enough resources to teleport to this person");
                }
            }
#

the format in discord is messed up

#

but basically sender is a player

#

not commandsender

#

dont get that confused

young knoll
#

What does the error actually say

valid solstice
#

i cant copy it for some reason

young knoll
#

Ah okay just a weird message format

vague oracle
#

?paste

undone axleBOT
young knoll
#

?jd

young knoll
#

Read the javadocs for playSound

valid solstice
#

weird format?

young knoll
#

I’m not used to seeing a cannot resolve method error if you get the params wrong

valid solstice
young knoll
#

I mean that is what they are for

#

They will tell you the method takes 4 parameters

#

A location, a sound, and 2 floats

river fable
#

Hello.

so i've created a configuration file to save a player's location (im creating a plugin to set homes and teleport back to homes)

public class sethome implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (args.length == 1) {
                String homename;
                homename = args[0];
                Location coords = p.getLocation();
                
                double x = coords.getX();
                double y = coords.getY();
                double z = coords.getZ();
                UUID u = p.getUniqueId();
                File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("Paper").getDataFolder(), File.separator + "PlayerData");
                File f = new File(userdata, File.separator + u + ".yml");
                FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);
                if (!f.exists()) {
                        playerData.createSection(homename);
                        playerData.set(homename +".x", x);
                        playerData.set(homename +".y", y);
                        playerData.set(homename +".z", z);
                      
                            try {
                                playerData.save(f);
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                            p.sendMessage("Successfully set a home with the name " + homename + ".");
                } else {
                    playerData.createSection(homename);
                    playerData.set(homename +".x", x);
                    playerData.set(homename +".y", y);
                    playerData.set(homename +".z", z);
                    try {
                        playerData.save(f);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    p.sendMessage("Successfully set a home with the name " + homename + ".");
                }
            } else {
                p.sendMessage("Please only specify the name of the home.");
            }
        } else {
            sender.sendMessage("This command cannot be executed through the console.");
        }
        return false;
    }
}

^^ this is the class for the /sethome command (used to set a home, and store the coordinates in a yml file)
sorry about the messy code, i havent done java in months, so im a lil rusty

valid solstice
#

the 2 other parameter can be defaulted right?

worldly ingot
#

You're compiling against the Paper API which has a playSound(Location, Sound), and that Sound is from Adventure

river fable
#

now what im curious about is i want to create a new class for the command /home (which allows a player to teleport to a home they previously set)

quaint mantle
#

just use this instead

river fable
#

yes i apologize i know its messy

#

i havent done this is like

#

a year

#

lmao

worldly ingot
#

Append 1.0F, 1.0F to your playSound call and it will work fine

quaint mantle
#
public record SpawnSet(RisingCore plugin, Locations locations, LangUtil langUtil) implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof Player p) {
            if (p.hasPermission("risingcore.spawnsystem")) {
                if (args.length == 1) {
                    String locationName = args[0];
                    if (!locations.getConfig().contains("locations-data." + locationName)) {
                        locations.getConfig().set("locations-data." + locationName, p.getLocation());
                        locations.saveConfig();
                        langUtil.setspawn(p);
                        return true;
                    }
                    langUtil.alrName(p);
                    return true;
                }
                langUtil.noArgs(p);
                return true;
            }
            langUtil.noPerm(p);
            return true;
        }
        langUtil.playerOnly(sender);
        return true;
    }
}
#

the langutil maybe you know what i mean

#

i hope

river fable
#

anyways its a stupid question but what would i do to access that file in a different java class to pull the data i have stored into it?

quaint mantle
#

the location is serializable

valid solstice
#

anyways thanks!

young knoll
#

Wait what

#

Adventure does sounds too

worldly ingot
#

It does everything keyable

young knoll
#

Huh

#

Interesting

quaint mantle
#

is this a good way to create a world :v
getServer().createWorld(new WorldCreator(getConfig().getString("world-settings.deathLand")));

vague oracle
#

What do you mean by good

quaint mantle
#

idk 😂

#

becz there is sometimes people say my code is too bad (joy x2)

summer scroll
vague oracle
#

Pretty sure you have to set target compile versions in the pom.xml

#

something like that

vague oracle
summer scroll
#

I have set the source and target to 16 for the 1.17 modules, and set source and target to 8 for the rest of the modules.

young knoll
#

You can only compile with 1 version

summer scroll
#

If I compile with Java 16, would I still be able to use the plugin on Java 8?

young knoll
#

No

quaint mantle
#

will never return null

summer scroll
#

If I use Java 8, there is an error, it says cannot access 'import net.minecraft.network.protocol.Packet;'

young knoll
#

Java 8 plugins should run on java 16

#

I think

vague oracle
#

always bad if you ignore nullable warnings, doesn't matter if they return null or not

summer scroll
#

Yeah I think so too.

vague oracle
#

Is your core module set to java 16?

unkempt peak
summer scroll
#

let me try that, one sec.

#

you mean set the source and target to 16?

worldly ingot
#

That is if you're referencing any NMS types

young knoll
#

Ah, yeah that’s a problem then

#

Does this mean 1.8-latest support is finally dead

summer scroll
#

It's still possible right?

#

I swear I've done it in the past, I just forgot.

young knoll
#

I mean you can just compile everything with java 16

#

But I don’t think anything pre 1.16.5 will run on 16

river fable
#

how would i go about getting a list of sections in a yml file, and then displaying them?

summer scroll
#

I got this weird warning too when I'm trying to use SDK 16

valid solstice
#

whats the difference of playsound and playeffect?

young knoll
#

playEffect is for various misc effects

#

Like the totem animation or an item breaking

valid solstice
#

ah i see

river fable
#

I have 2 sections in this YML file:

test1:
  x: 9.398253382263606
  y: 97.0
  z: -1.0819892941608558
test2:
  x: 23.992529229161853
  y: 73.0
  z: 70.29534087655867

how would i go about getting the names of these sections in an array and then listing them off to the player?

young knoll
#

getKeys(false)

river fable
# young knoll getKeys(false)

could you elaborate a bit? its a little difficult for me to wrap my head around. i thought getkeys would return the "x" "y" and "z" values? I need it to return the names of the sections. ex: "test1" and 'test2"

valid solstice
#

should i use yml or json for config?

young knoll
#

Calling getKeys on test1 would return x y and z

young knoll
valid solstice
#

ok ty

sullen marlin
#

json doesnt support comments

#

terrible choice for a config lol

jade perch
#

GSON does 🙂

young knoll
#

Keep in mind Yaml comments will be lost if you save the file from your code

#

Unless that has been changed?

sullen marlin
#

why would you change a config from code

young knoll
#

I generally don’t

sullen marlin
#

:>

jade perch
#

I do

young knoll
#

But it would be nice to automatically add new entries when the plugin updates

jade perch
#

Changing config from code is pog

river fable
jade perch
#

Allows for config gui :)

young knoll
young knoll
jade perch
#

I was going to but it got complicated

river fable
jade perch
#

For things like items and such

river fable
#

kinda like how essentials will show u a list of all ur homes

young knoll
#

getKeys will return you a string collection

#

Just display that to them

young knoll
#

String, string list, int, double, boolean

#

Maybe material

jade perch
#

Yeah I can easily support that stuff

#

Hard part is itemstacks cause there isn't really a unified way those are handled

young knoll
#

Yeah

#

Not sure how you would properly reload the config though

river fable
# young knoll Yeah

can i dm u my code? sorry i know i must be really annoying right now, just havent done this in a while lmao

jade perch
#

Wouldn't reload it for other plugins but overwriting it would be simple enough

young knoll
#

fair enough

#

I should look into implementing the new SnakeYaml in my library

#

But I’m lazy

jade perch
#

Right now I convert yaml into json then use gson

#

And vice versa

young knoll
#

Suppose that works

jade perch
#

Then I can use gson serializers for my yaml files and life is easier

young knoll
#

I just don’t modify the files myself

jade perch
#

Yeah that'd be the easiest way

young knoll
#

Add the new values yourself ya lazy owners

jade perch
#

But since I added the config gui support requests have gone down massively

#

Instead of making yml files I do that

valid solstice
#

is spigot api restful?

jade perch
#

What

#

Are you referring to the web api

subtle kite
#

why does this not work : String alert = "[Alert] ";

valid solstice
young knoll
#

Define not work

subtle kite
#

Declaration not allowed here

jade perch
young knoll
#

Where are you trying to declare it

subtle kite
#

ok thank you , your question fix my question

valid solstice
jade perch
young knoll
#

Are you saying I can’t make a POST request to the server itself

jade perch
#

Spam upload 200 plugins

young knoll
#

That would make you the number 2 author

jade perch
#

And the number 1 banned author

young knoll
#

I mean

#

If you spam 200 actual resources that you’ve made you’ll be fine

#

Unless the government comes after you for illicit cloning

jade perch
#

They'll be 200 of the same resource with slightly different names

#

Hereteres nice plugin

#

Hereteres cool plugin

#

Etc

young knoll
#

Well as long as they are nice and cool sounds good to me

jade perch
#

Actually better idea

#

They'll be copies of premium resources with the plugin.yml changed

young knoll
#

I think there is already another site for that

jade perch
#

:(

sullen marlin
#

14 events * 17 actions or whatever = 238 unique plugins

jade perch
#

Time to get to the top

young knoll
#

And I can put them all into my challenges plugin

#

Hurray monopolies

jade perch
#

Off topic question

#

Does anyone know how to find all scoreboards

#

I don't think there is a way

young knoll
#

Have you checked the craftbukkit impl of scoreboard manager

#

Must have a collection of them somewhere

jade perch
#

Yeah I want to do it an api way though

young knoll
#

You’re probably out of luck then

#

Unless PR

jade perch
#

I've managed to block events and commands via the api

young knoll
#

Impressive

jade perch
#

Takes a lot of work to add reflections

young knoll
#

What about stuff like broadcast message

#

Or even just sendMessage

jade perch
#

Well the premise of the plugin is per world plugins

#

Unfortunately I can't get plugin info from that

young knoll
#

Shame

jade perch
#

I wish spigot had an auditing system where stuff like thst ran through a channel so you could change it

#

Like events but for lower level stuff

young knoll
#

Fork

jade perch
#

Well it needs to work with spigot or no one uses it Sadge

young knoll
#

If only we had mixins

#

I’m sure that wouldn’t end badly

jade perch
#

That'll never happen I'm pretty sure MD hates stuff like that

young knoll
#

Shame, I like breaking stuff

jade perch
#

Only other alternative would be to wrap my jar around spigot

#

But then I couldn't make it premium so that doesn't work either

#

Kind of like what optic does with is Anti-Malware

young knoll
#

Yeah, a project like that exists for paper and mixins

#

But that also limits people with hosts that don’t allow that stuff

jade perch
#

True and pwp is already marketed towards people like that

#

(people who can't afford bungee cord)

young knoll
#

I just want to change the piston push limit and let them move tile entities

#

Spigotplz

tacit drift
#

feckers

jade perch
#

Have to use a non premium option

young knoll
#

Someone talked about this before

#

The premium check is client side and you can bypass it

jade perch
#

Ez win

tacit drift
#

someone should just make something like this but open source

young knoll
#

Could do that

#

Don’t want to host it though

tacit drift
#

host it on github

#

oracle cloud jvm

young knoll
#

I’ll just toss 500 challenges into my challenge plugin and call it a day

#

If I ever go back to that

sullen marlin
#

so all scoreboards = 1 + 2

young knoll
#

You could in theory have a scoreboard bound to no players

jade perch
#

and scoreboard's have a plugin attached right

tacit drift
#

cringe

sullen marlin
#

Set<Scoreboard> scoreboards; scoreboards.add(mainScoreboard()); for (Player p : players) scoreboards.add(p.getScoreboard())

jade perch
young knoll
#

True

#

Is there a plugin attached to them? Iirc I don’t think so

jade perch
#

It gets complicated for if there are 2 different plugins handing out a scoreboard

#

Have to look real quick

young knoll
#

BossBar is another thing, I think those can have a namespaced key attached

#

But not always

jade perch
#

Yeah, that's unfortunate scoreboards don't have a plugin attached

carmine elk
#

how do i get spigot on my singeplayer

young knoll
#

You don’t

#

Spigot is a server software

carmine elk
#

?

jade perch
#

You kinda can

#

you just have to connect to localhost instead of going to singleplayer

young knoll
#

I mean you can run a local server and just connect to that

#

Yeah

carmine elk
#

how!

jade perch
#

just look up how making a spigot server

#

then drag in your single player world

sullen marlin
young knoll
carmine elk
young knoll
#

Yeah I found out about the keyed option not too long ago

#

It’s neat

jade perch
#

Your jar isn't called a server. Jar

carmine elk
#

oh

young knoll
#

Or it isn’t in that folder

jade perch
#

When was the boss bar API added? (I support 1.8-1.17 ATM

#

shoot me if you want

sullen marlin
#

whenever boss bars were added

carmine elk
#

I really want to get thius

#

How do i make it work

jade perch
#

You change the name of the server. Jar with the name of the spigot jar file

sullen marlin
#

March 2016

#

what version was that

#

1.8 or 1.9

young knoll
#

No idea

young knoll
#

What was that site that let you compare api versions

sullen marlin
#

1.9

jade perch
#

Now let's hope someone has made this comp at article for me

young knoll
#

How do you manage support across java 8-16?

sullen marlin
#

just compile against 8 and youre more or less there

young knoll
#

Ah wait, you avoid NMS don’t you

jade perch
#

Yeah, I only use the API

young knoll
#

Right

carmine elk
#

how do i do the thingie

young knoll
#

Meh, 1.15 and under users aren’t my problem

jade perch
#

I wouldn't support it if it were really a hassle, but the plugin is really low level so I don't need the new stuff

jade perch
carmine elk
#

;-;

#

the problem is

#

I DONT KNOW HOW TO FIND THEM, IM THAT UMB

#

DUMB

young knoll
#

I linked one

carmine elk
#

where

jade perch
#

here is another one

carmine elk
#

ty

jade perch
#

there are so many literally just type in how make a spigot server on google

young knoll
#

I try to avoid NMS, but it loves to come say hi

#

Other than with the seasons plugin, not much I can do there

jade perch
#

Yeah, if I use NMS I go for modules over reflections

young knoll
#

Same

#

But my last plugin has one line of NMS and it’s very upsetting

jade perch
#

Yeah, having to make 20 implementations for each version is super annoying, but it's the most performant way, if you're going to do it

young knoll
#

This is why I only support current and newer

#

Means I only have to do 1 at a time

jade perch
#

he yanked that from HAC

#

God, my autocomplete is annoying the fuck out of me

young knoll
#

Tempted to do an enchantment plugin next

#

Don’t know if I can beat 200 though

sullen marlin
#

yes we need more of those

jade perch
#

Please, no more of those

young knoll
#

More

#

All the more

quaint mantle
#

No

sullen marlin
#

we could use more backpacks / portable inventories too

young knoll
#

Actually there are probably good free ones already

quaint mantle
#

Stop it

jade perch
#

Maybe some bedwars

young knoll
#

Alright I’ll combine them

#

Custom enchantment backpack bedwars

jade perch
#

add in perms too with a web gui

#

big win

young knoll
#

I enjoy making free plugins that compete with premium ones

jade perch
young knoll
#

Plz no sue

jade perch
#

When are you going to make free version of per world plugins

young knoll
#

Meh

#

Isn’t there one already, or is that dead now

jade perch
#

Doesn't work on the latest versions

young knoll
#

I’ll just uhh, reupload yours for free :p

jade perch
#

Someone legit did that

young knoll
#

I mean, the license allows it

jade perch
#

he called it H Per World Plugins

young knoll
#

Not sure spigot does though

jade perch
#

It does, but he was reuploading one from *******got

young knoll
#

I see

#

So he reuploaded a cracked version of an open source plugin

jade perch
#

Yes haha

young knoll
#

Very nice

jade perch
#

something really cool I saw is someone made a fork and setup a CI for it

#

however he hasn't updated it recently

sullen marlin
#

github has inbuilt ci now

young knoll
#

Removed bstats, added a plugin.yml, and then removed it

jade perch
#

Yes

young knoll
#

Interesting

jade perch
#

Yeah he didn't see my fatty annotations

#

whoever made that is the best

sullen marlin
#

senmori, rip

young knoll
#

I assume the distribution string is different on the pre compiled version

jade perch
#

Yeah I just have a thing in my gradle file that finds that and replaces it

#
    filter { line -> line.replaceAll('VERSION', version) }
    filter { line -> line.replaceAll('DISTRIBUTION', 'self-compiled') }
young knoll
#

Neat

jade perch
#

However it has a big downside in that whenever I have a stacktrace it takes me to the wrong directory

#

So I may change it

young knoll
#

Oh?

jade perch
#

Yeah I have to copy over my src to the build directory

#

then replace the lines and compile

#

so it uses the code from the build dir instead of my src dir

young knoll
#

Ah

jade perch
#

However, as long as I don't make any syntax mistakes it doesn't happen so I'll just be better for now 🙂

young knoll
#

The best way to solve errors is to not have them

carmine elk
#

nothing wokrs

#

i give up 😩

jade perch
#

probably go watch a youtube guide

#

text isn't your friend

carmine elk
#

ive tried it all....

#

:/

jade perch
#

You definitely haven't

carmine elk
#

nah

#

i have

jade perch
#

The problem solving process makes you smarter

#

keep digging

carmine elk
#

ill keep tryin

jade perch
#

I might just make a file for loading stuff like this, it would make creating the guis a lot less of a hassle

maiden mountain
young knoll
#

But it also increased my number of problems

lavish hemlock
#

so many problems

so little time

young knoll
#

I didn’t have to try and decipher netty stack traces before

#

TL;DR don’t register multiple biomes with the same key

river fable
#

hello, in my yml file i have a string with the world name

ivory sleet
#

pog

river fable
#

idrk how to handle this but basically

#

i need to take that data and teleport the player to it

ivory sleet
#

grab the world name

#

and lookup the world based on the name

#

then create a location with the found world if one's found

river fable
#
test:
  x: -142.14804747411188
  y: 63.0
  z: 348.6155324613635
  world: world
#

could u give me an example? im not too sure how to do that lol

#

wait nvm

#

figured it out

#

lmfao

#

thanks buddy ❀

#

@ivory sleet ok

#

so basically

#

i have this:

#
            World w = Bukkit.getWorld(args[0] + ".world");
            Location home = new Location(w, x, y, z);
            p.teleport(home);
#

now when i run the command to teleport to that location

#

i get this:

#

heres the console log:

#
[03:38:46] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'home' in plugin Paper v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeAll(SourceFile:110) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1124) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.IllegalArgumentException: location.world
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer.teleport(CraftPlayer.java:672) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.teleport(CraftEntity.java:493) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        at com.dioz.paper.home.onCommand(home.java:37) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.1.jar:3257-Spigot-dc75aca-960f310]
        ... 19 more
valid solstice
#

should i put my config file in src or in the main ?

river fable
#

what did u do to resolve it?

quaint mantle
eternal night
#

I think they just forgot to actually grab the name of the world

#

Rn you are asking for a world named "test.world"

river fable
eternal night
#

While that is just the yaml path to the name

#

Yea

quaint mantle
#

Yea, or maybe forgot the getstring

eternal night
#

^^

river fable
#

ohhh yah ur ribht

quaint mantle
#

Should be getnow it is ur config file(args[0] + “.world”)

river fable
#

also

#

the .world

#

is the path

#

args[0] defines the section

quaint mantle
#

Dont, if u have the location

#

Then just getworld from the loc

river fable
#

i dont have the location

quaint mantle
#

What are you trying to do exactly? Hmmm first is setspawn then now it is what

river fable
#

all the data required for the location is located in the file, so basically what i was trying to do was pull that data from the file and put it into a location. i was able to pull all coordinates, just had a little trouble with the world.

quaint mantle
#

Hey, did you use get<ur config name>.set(path, p.getLocation());?

#

Or u need to get all the x y z thingy then put it? 😂

river fable
#

why didnt i think of that lmao

quaint mantle
river fable
#

i stored every single value in the config

quaint mantle
#

I think you forgot my ex code

river fable
#
                        playerData.createSection(homename);
                        playerData.set(homename +".x", x);
                        playerData.set(homename +".y", y);
                        playerData.set(homename +".z", z);
                        playerData.set(homename +".world", w);
glossy venture
quaint mantle
#

Do you really forgot what is my ex code LOL?

quaint mantle
#

Then find my ex code for setspawn i gave you

#

(For command btw)

river fable
#

instead of this:

World w = Bukkit.getWorld(args[0] +".world");
#

i should have done this:

#
String wld = playerData.getString(args[0] +".world");
World w = Bukkit.getWorld(wld);
quaint mantle
#

Yeah but i don’t think you really that bald so i dont point it out 😂 but ya know

#

Saving a location is really ez

river fable
#

i havent done this in months my friend

#

not everyone is at the same level as you, thats why we come in here for help

#

🙂

#

thank you for the help man, i appreciate it

quaint mantle
#

Or u only need the getconfig.set(path, p.getloc);

#

Then saveconfig

#

Im in tablet no caps for the word :v

river fable
#

yes ur right

#

i should do p.getloc

#

i will change my plugin to do that

quaint mantle
#

And

river fable
#

i forgot about it lol

quaint mantle
#

If you

#

Trying to get world or coords of it

#

Just use

#

getconfig.getLocation(path).get(x,y,z,world,yaw,pitch)

#

I think i write it right

#

I hope so

glossy venture
#

what is the args variable

#

because it isnt an application right

#

or are you making a command

quaint mantle
#

as it has home

eternal oxide
#

You can only load a location from config AS a Location, if the world its for is loaded.

quaint mantle
#

just seen this floating around

#

i this actually a good way to convert something into base64

glossy venture
#

nice

#

serialization isnt that hard

#

you can make a very simple bytebuffer based serialization and deserialization algorithm using recursive reflection

#

on fields

#

and then when you encounter a primitive you just write its binary data

#

i did this but i didnt completely finish it

#

also has anyone here tried using natives?

#

im using it for my project

#

the object files get compiled correctly but the dll file isnt linked properly

#

the symbol table is empty raising an unsatisfied link error

indigo cave
#

base64 ._.

quartz valve
#

How can i enchant a tool after crafting?

indigo cave
#

use the craft event and add the enchantment

#

and then ItemStack#addEnchantment()

quartz valve
#

okay thx

quartz valve
indigo cave
#

event.getRecipe().getResult()

quartz valve
#

i tried

indigo cave
#

and whats the error?

quartz valve
#

wait

#

There is no error

indigo cave
#

so

#

send code

quartz valve
#

I did this

    @EventHandler
    public void CraftItemEvent(CraftItemEvent event){
        if(event.getRecipe().getResult().getType() == Material.IRON_PICKAXE){
            event.getRecipe().getResult().getItemMeta().addEnchant(Enchantment.DIG_SPEED, 3, true);
        }
        if(event.getRecipe().getResult().getType() == Material.DIAMOND_PICKAXE){
            event.getRecipe().getResult().getItemMeta().addEnchant(Enchantment.DIG_SPEED, 3, true);
        }
        if(event.getRecipe().getResult().getType() == Material.GOLD_PICKAXE){
            event.getRecipe().getResult().getItemMeta().addEnchant(Enchantment.DIG_SPEED, 3, true);
        }
        if(event.getRecipe().getResult().getType() == Material.STONE_PICKAXE){
            event.getRecipe().getResult().getItemMeta().addEnchant(Enchantment.DIG_SPEED, 3, true);
        }
        if(event.getRecipe().getResult().getType() == Material.WOOD_PICKAXE){
            event.getRecipe().getResult().getItemMeta().addEnchant(Enchantment.DIG_SPEED, 3, true);
        }
    }
indigo cave
#

version?

quartz valve
#

1.8.8

indigo cave
#

cant you just use addEnchantment?

#

on an itemstack?

quartz valve
#

Oh yeah

#

i forgot

indigo cave
#

try it

quartz valve
#

Nope. That did not work