#help-development

1 messages · Page 1929 of 1

brave sparrow
#

And you may want to play with the y as well

viral cargo
#

has some code example?

brave sparrow
olive lance
#

What version of java would I compile with if I want to support earlier version as well as 1.18

#

1.14-1.18

young knoll
#

8

#

Most people use 8 for anything below 1.17

olive lance
#

If i do that would it hinder performance for people on newer versions?

#

prolly not

young knoll
#

Not noticeably

#

Depends on the version

#

And if you plugin needs NMS

quaint mantle
#

how can i check if in a radius of 5 blocks ( 5x5 ) there is a stone block?

#

i have a position and i don't know how to do it

young knoll
#

You’d have to do 3 nested loops

#

If you just use the API you can technically still use 8

#

But like, use 17

#

You get so many nice features

quaint mantle
#

?learnjava

undone axleBOT
quaint mantle
#

you dont have to be intelligent

terse ore
terse ore
#

didn't asked for that

sharp flare
#

You have been asking related to basic java on slimefun dc and here

terse ore
#

Have I asked for that?

#

I asked how to get the list

sharp flare
#

And while people offered you help there, no one will spoonfeed u

terse ore
#

maybe a link to docs

sharp flare
terse ore
sharp flare
#

Do your own research and learn java first

terse ore
#

I didn't asked for that x2

sharp flare
#

You expect someone to spoonfeed u everywhere?

terse ore
#

I expect someone actually helping

#

you are repeating the same exact thing even when I try to learn by myself xd

sharp flare
#

You haven't tried any learning

#

And your attitude reflects your replies

terse ore
#

because of your ability to read mentality?

#

you don't know what I've done by myself

#

you aren't a mind reader

sharp flare
#

Why are u asking the same shit over and over?

terse ore
#

You are repeating the same over and over and yourself make this conversation lead to the same point eveytime

#

:c

#

If I ask in here you hate because I am a noob if I ask in slimefun you hate because of the same

#

I finally made the slimefun thing by myself

sharp flare
#

People offered you help there

#

But your attitude

terse ore
#

If I ask a thing I don't want to read you complains about I am a noob bruh

sharp flare
#

Your trying to do things out of your power despite trying learn the basics first

terse ore
#

I mean after all I am learning in another way but learning

sharp flare
#

Goodluck

terse ore
#

thx man

sleek turret
dusk flicker
#

ha noob /s

ivory sleet
#

😦

left swift
#

how can i cancel certain packet? Have I to cancel it for all players (add all players to the channel) or is there any other way

gaunt moss
#
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class DisableDefaultMessage extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        e.setJoinMessage("");
    }
    @EventHandler
    public void onQuit(PlayerQuitEvent e) {
        e.setQuitMessage("");
    }
}

Hi, when I put the plugin on the server it does not load but I have no error

neon minnow
#

I'd like to check if a player is currently pressing shift on a entity click event, how can I do this?

lost matrix
gaunt moss
#

No

lost matrix
gaunt moss
#

No error

sharp flare
#

no error in console log?

lost matrix
# gaunt moss No

This is a binary outcome:
If the jar is in the plugins folder then either of those two events occur:

  • An exception is thrown when the server starts
  • The plugin comes up when you type /pl
    Nothing else is possible.
gaunt moss
#
[01:44:14 ERROR]: Could not load 'plugins\DisableDefaultMessage.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:152) ~[Spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [Spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [Spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [Spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [Spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml`
lost matrix
lost matrix
neon minnow
#

i meant as in right clicking anentityt

lost matrix
lost matrix
sharp flare
neon minnow
#

lol

lost matrix
neon minnow
#

yah thanks

#

thats what i meant 😂

sharp flare
#

oh its answered mb

young knoll
#

Gosh I wish we could check for arbitrary keys

lost matrix
young knoll
#

Yeah

#

Maybe if the server had to specifically register keybinds, that would reduce the packet count a bit

lost matrix
#

true. For example when the player joins you ask them for A, C and K

#

But then security is a big concern

young knoll
#

How so

lost matrix
#

Asking the player to send all keys pressed is just a remote key logger

young knoll
#

You would register a namespaced key and a default button (the client could then change that button in their options menu), when they press it a packet with they namespaced key would be sent

lost matrix
#

That would be a solution. Still doubt something like this would be added.

young knoll
#

Sadly

#

Gotta bring back spout

waxen plinth
#

But I agree that it doesn't seem like something they would ever add

vocal cloud
#

What I did to solve this was write a mod the user could bind keybinds to. When pressed they execute a Command the server picks up as a skill

young knoll
#

Or just make a proper system with packets and a client mod

vocal cloud
#

Yeah but it's a temporary solution atm

brave trellis
#

how would you go about getting a custom skull texture 1.17+

#

from minecraft-heads site

brave trellis
#

much appreciated

surreal valve
#

Looking for a dev that can code for free until our release, we are working on a big project I will give you all the info. but you have to work for free until our server release

Thanks!

next stratus
surreal valve
#

Not much we already have dev working

#

We are almost at realease

next stratus
#

But devs don't work for free...

surreal valve
#

We will continue the chat in DMs

next stratus
#

Devs would need payment for their work

surreal valve
#

Your choice

#

if you wanna join

next stratus
#

But you'd be paying the devs right?

surreal valve
#

Not until realease

next stratus
#

But devs don't work for free, they'll need payment

vocal cloud
#

Imagine working for free and getting paid when they release

next stratus
#

What if they never release?

next stratus
young knoll
#

?services

undone axleBOT
next stratus
#

I was doing a 50/50 deal with someone on paying a dev now they shown their true colors and dropped this is gonna be expensive for me...

unkempt peak
worldly ingot
unkempt peak
#

Well atleast ask in the right channel

surreal valve
#

sure

sharp flare
#

Man there is no such thing as free

surreal valve
#

well, we will see

unkempt peak
#

You do realize your basically attempting to scam people into free work right?

#

Nobody is that gullible and if they are they shouldn't be programming

sharp flare
surreal valve
#

more like ur talking abot urself

#

#NoOffence

unkempt peak
loud haven
#

And it'll end up being a shitty plugin lol

surreal valve
#

we already have devs

#

XD

#

which r very good

unkempt peak
#

Then why are you asking for free ones???

loud haven
#

Suuuuure

surreal valve
#

the devs are

#

free

#

only

sharp flare
surreal valve
#

I hope u do too

sharp flare
#

Expecting somebody to do your work for free? you must be high

surreal valve
#

well

quaint mantle
surreal valve
#

not in 2-3 months

surreal valve
surreal valve
#

but can't

warm light
#

Bee anger == 0 means normal bee?

quaint mantle
#

Ye

#

Same with Wolf etc

sharp flare
surreal valve
sharp flare
#

I guess its free to dream

surreal valve
sharp flare
#

goodluck with your offer

surreal valve
#

some people are fools

low temple
surreal valve
#

thanks

sharp flare
#

why u asking here?

#

in the first place

low temple
surreal valve
#

i really apologize for that

green flower
#

can we move on

surreal valve
surreal valve
low temple
kind hatch
# surreal valve Looking for a dev that can code for free until our release, we are working on a ...

Time is a valuable resource, if people aren't compensated for the time they will lose by committing to your project, they will likely quit after the first day or not even join in the first place. You will be hard pressed to find anyone here who will work under the guise of "payment after server release". I've met several people who said the same thing and based on my experience, it's almost never ended well.

The people who you will get from your request are either

  • Beginner level programmers who are looking for opportunities to grow in plugin development. (Meaning they are still learning and won't be making proper systems)
  • People who are work on their time because they have things that take higher priority than volunteering.
  • Newbies who only copy and paste code or edit configuration files.

I've been down that path before and 9 times out of 10, the projects never get off the ground. The ones that did never made it past two months. Now, I have no clue whether or not your intention is pure, but if somehow get off the ground and you don't pay your developers, you are in for a rude awakening.

This isn't meant to be condescending or an attack towards you, but a reality check. You need to compensate people for their time.

surreal valve
#

i didn't need that

#

won't even read

#

got no time

surreal valve
low temple
surreal valve
sharp flare
#

you got no time to fix your problems?

green flower
#

Feels like a pyramid scheme to me

sharp flare
#

feels like a scam link

surreal valve
surreal valve
low temple
#

"you wanna work until youre eventually paid?"
"When will I get paid and how much"
"You will eventually get paid"

surreal valve
#

Well, it's u choice if you wanna trust us

sharp flare
#

you're a small dev working for free?

surreal valve
#

yes i am working on minor plugins

low temple
sharp flare
#

may god bless you

surreal valve
#

xD

surreal valve
low temple
surreal valve
#

i am not lying

low temple
#

Ive done free work for people too, doesnt mean I should expect anyone to do the same

sharp flare
#

you code for fun

#

that aint gonna end well

low temple
surreal valve
surreal valve
#

i just really want fun

kind hatch
low temple
sharp flare
#

cuz he doesn't know how to deal with it

surreal valve
#

also code for only FUN

#

not just for money..

#

and i am here to look

loud haven
#

Just stop

surreal valve
#

and i aplogize for writing here

quaint mantle
#

Enough

surreal valve
#

this may shall end ig

quaint mantle
#

Kids these days

surreal valve
#

u have a kid pfp

#

some talking about urself xD

loud haven
#

All your comebacks are lameass

surreal valve
#

ha ha jk

low temple
surreal valve
surreal valve
#

bruh

sharp flare
#

this kid is on fire

low temple
surreal valve
#

do you have proof that i'm kid xD

#

?

quaint mantle
#

I have a question boi

sharp flare
#

why do I even need a proof for it

low temple
surreal valve
#

okay ig end this some peole have opnions

surreal valve
kind hatch
quaint mantle
#

You are a small dev but want to teach others how to program? Makes sense

surreal valve
#

does that make a differnce

quaint mantle
#

Look your Information card

#

Idiot

low temple
surreal valve
#

bruh

surreal valve
#

when we will realease you all will understand..

#

Untill then Good Luck 🙂

quaint mantle
#

No because nobody care :(

sharp flare
#

okay free kid

loud haven
kind hatch
surreal valve
#

true but, different people have different opinions

#

mostly people work for money

green flower
#

Bro why are we still arguing about this

#

Waste of time

surreal valve
#

Well to this people true

kind hatch
#

Why do people argue about anything? lol

sharp flare
#

he showed his character thats all I want

surreal valve
#

alteast i am not toxic like u all guys xD

green flower
#

There's no point in bickering with this kid

sharp flare
#

I want to know what its like to work for free for this kid

surreal valve
quaint mantle
#

Seems to me like he can't handle criticism or he can't handle it when no one is representing his point of view.

surreal valve
surreal valve
#

i'll proof it to all of you

#

just wait

quaint mantle
#

No thanks

surreal valve
#

🙂

#

okay don't wait

#

u can go

low temple
#

@surreal valve You should check out r/ChoosingBeggars

quaint mantle
#

Who cares about a minecraft server in 2022 ;(

surreal valve
low temple
sharp flare
surreal valve
low temple
surreal valve
sharp flare
#

Wishing u a goodluck, end it here

surreal valve
#

okay cool

surreal valve
kind hatch
#

prove*

low temple
surreal valve
surreal valve
#

sorry

surreal valve
#

hehe

#

cool

quaint mantle
#

Gn8 all its 5 in the morning rip

surreal valve
#

maybe for u

#

gn8

quaint mantle
#

How much time is it by u m8

surreal valve
#

10?

loud haven
surreal valve
#

am

#

yeah

quaint mantle
loud haven
#

Ah

quaint mantle
#

Im from Germany I live in the Future kappa

marsh crater
#

I didn't get an answer last time on how to download a plugin from the website through a script, so.
In inspect element I copied the download request as a curl request and pasted it in a terminal and outputted it to a file.
but.. my problem is the ?version=434732 If I put this curl request in a bash script, will it download the newest version, or will it download the specific version im messing with right now?
I could always just curl the website html and parse out the url and just replace it in the curl request every time I want to update the plugin.

Does anyone have a less hacky method?

spiral light
#

you wanne just start the server with code or create an server ?

#

well... thats not that easy ... but copy&paste an dictionary to a specific location, edit the server.properties for the right port and register it somehow to bungee and then start it ...

vocal cloud
#

I imagine hypixels system is far removed from spigot

#

In other words what they do is no simple feat that anybody would be able to replicate easily.

midnight shore
#

Actually i think that they don’t remove the lobbies

#

Because then when it is needed you’d must wait until the lobby starts up

chrome beacon
#

They do stop them

#

There just are so many that you don't notice when a new one is started

midnight shore
spiral light
dark arrow
#

I am working on a plugin and I have made 2 crafting recipes and i have made a one final crafting recipe which requires other 2 recipes which i made earlier so how can i use the earlier crafting recipe item in this recipe(All the recipies are in different classes)??

chrome beacon
#

Use RecipeChoice.ExactChoice with your item

dark arrow
#

i can but i have made it on diffrent class

chrome beacon
#

And?

#

Just pass the instance over or create the item in the other class

dark arrow
#

Tysm it worked 🙂

tall nova
#

How would I check if object is instance of “Optional<ItemStack>”

#

Or I guess if an object is an instance of a list of a certain type

#

Because (obj instance of List<Integer>) doesn’t work

dark arrow
#

I have created a custom stick for my plugin

#

so how can i make it so that if i click it it should do a set of actions

chrome beacon
#

Listen to the event and then check item in hand

quaint mantle
chrome beacon
#

I assume you want thr PlayerInteractEvent

quaint mantle
#

Wait

#

Maybe im wrong nvm

dark arrow
#
 public void onWandUse(PlayerInteractEvent event){
        Player player = event.getPlayer();

        if(event.getMaterial()==Material.STICK){
            player.sendMessage(ChatColor.RED+"Yo");
        }

    }
```I tried this code but its not working
stark marlin
#

if(player.getInventory().getItemInMainHand() != null && player.getInventory().getItemInMainHand().getType() == Material.STICK){
Try that instead

#

Also make sure to have @ EventHandler before the method if you don't have

spiral light
#

?notworking

undone axleBOT
#

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

dark arrow
ivory sleet
#

Check if the object is an instance of Optional

#

Then do sth like
Optional filter(ItemStack.class::isInstance)
map(ItemStack.class::cast)
orElse(null)

dark arrow
#

also how to get chat clicable chat buttons

#

i meant is there any special class for that?

ivory sleet
#

Yuh check out bungeecord chat api

dark arrow
#

ok

quaint mantle
#

nope

#

?jd

quaint mantle
#

fade in?

#

probably do some wunky things with lighting

#

i dont know any other possible way than doing it with lighting

stark marlin
#

I'm trying to include a uuid in an item lore, and have it invisible. I'm trying to hide it this way
` public static String invisibleString(String str) {
String invisibleStr = "";
for(char ch : str.toCharArray()) {
invisibleStr += "§" + ch;
}

    return invisibleStr;
}`

When retrieving the string (and replacing all § with nothing) I get "a-c-c-f-1" back instead of "375be66a-566c-4ddc-ad3f-a3e594f87931" that I included in the lore. Any idea why that happens?

#

I have used that method in previous versions of Minecraft and it used to work iirc

sharp flare
#

Why not use pdc

stark marlin
#

I'll look into that, thanks

sharp flare
#

Just use pdc, profit

blazing rune
#

Ok so I'm trying to make a /duel accept command which accepts a duel req but the player who was sent a req can /accept anybody without sending a request

vocal cloud
#

because you need to store each duel invite in a map

sharp flare
#

use their UUID

warm light
#

zombieVillager.getVillagerProfession() == Villager.Profession.ARMORER
always false?

sharp flare
#

and do what mike said

dark arrow
#

In Bungie Cord Chat API when i use text component it says Out side package can't be access

sullen marlin
#

?paste

undone axleBOT
warm light
sullen marlin
#

Your code

vocal cloud
#

?jd

vocal cloud
sullen marlin
#

I don’t think that would always be false

#

Your ide sounds whack

warm light
#

I didn't test that. got error so asking if that code is ok or not

sullen marlin
#

Seems ok

warm light
vocal cloud
#

They give a reason though

dark arrow
#

In Bungie Cord Chat API when i use text component it says Out side package can't be access

undone axleBOT
sullen marlin
#

What exactly does it say

#

@warm light is variable type ZombieVillager or Zombie

#

If Zombie, cast to make error go away

dark arrow
sullen marlin
#

If ZombieVillager then its intellij weirdness with inheritance

#

The method in Zombie is always false, but not ZombieVillager

warm light
#

ok

sharp flare
#

the remapped jar from buildtools works only for post 1.17 right?

#

happy to be wrong, would appreciate answers

sullen marlin
#

Yes

sharp flare
#

appreciate it

#

guess for now I'll avoid nms if its really not needed

short raptor
glossy venture
#

how do i set a premain class and other related manifest attributes like Can-Redefine-Classes with gradle

#

not related to spigot, just general java/gradle

graceful turret
#

will scheduler work when i returned from the method which calls it?

ivory sleet
#

Context?

dapper ether
#

what pattern should i use for balance?

ivory sleet
#

Pattern?

#

Are we talking design patterns?

quaint mantle
#

if thats what you talking about then it wont work

graceful turret
#
Bukkit.getScheduler().runTaskTimer(Main.getInstance(), () -> {
            entityEnderDragon.setHealth(entityEnderDragon.getHealth() - 1.0f);

            if (entityEnderDragon.getHealth() <= 0) {
                sendPacket(new PacketPlayOutEntityDestroy(entityEnderDragon.getId()), p);
                return;
            }

            updateEntity(entityEnderDragon, p);
        }, 20, 1);```
#

by 'return' i want to just cancel this task

quaint mantle
ivory sleet
#

use the consumer then

quaint mantle
#

rrc

ivory sleet
#

runTask(plugin, task -> task.cancel());

#

or sth

graceful turret
quaint mantle
#

maybe use task cancel

ivory sleet
#

And btw

quaint mantle
#

yeah use task cancel for safeness

ivory sleet
#

You still have to return to stop code execution in current method

#

But cancel will stop future conceivable iterations

graceful turret
ivory sleet
#

Yeah

#

it’s a consumer

#

so it’s an arrow function taking one argument

graceful turret
#

yeah

ivory sleet
#

In this case being BukkitTask

#

Ofc you can make it to a lambda body expression

#

Such as
task -> {
task.cancel();
}

#

And also should mention, the name "task" does not matter (could be sth else) just like every other function parameter name

graceful turret
#

one querstion

#

u used ....task.cancel();

#

as an example or i should use it

#

as u wrote it

ivory sleet
#

Yes

#

That is if you don’t want the task to run in the future

graceful turret
#

Bukkit.getScheduler().runTask(Main.getInstance(), task -> task.cancel()); like this?

ivory sleet
#

Well no

#

Obv you need to use runTaskTimer if you need that instead

#

And include the code you want to run

#

I just provided pseudo code

quaint mantle
#

simply

#

instead of that return

#

use task cancel

ivory sleet
#

^ (or maybe both, entirely depending on what you want)

graceful turret
#

it's boss bar method so i want to stop running it when hp/progress is < 0

#

also there's a one problem

#

because when player recived packet which removes the dragon

#

bossbar stays for ~10s

#

is there a packet/method to remove it right away?

quaint mantle
#

just, let it there

quaint mantle
#

?gradle

#

?help gradle

dapper ether
#

what design pattern should i use for economy

hardy swan
#

economy is about transaction, so..

dapper ether
#

so what

hardy swan
#

transaction pattern

dapper ether
#

ahm

#

okay

hardy swan
#

what you want is to support distributed transaction

#

maybe can search that up

dapper ether
#

okay

#

thanks

ivory sleet
#

first and foremost design patterns are implementation details

#

So you there’s no correct answer really

#

you can only find yourself less “right” answers

wary harness
#

So I got map with players which I am looping every 5 ticks because of rotation of armor stand on there head it run on main thread
Now I am adding people to map by listening to packets on entity spawn and destroy
As I read protocollib does that async
So what are my options because I know it could be problematic if different threads read and write/remove data should I make new BukkitRunnable in protocollib litenere and just put add method in it and run it sync

dapper ether
#

i thought about a singleton

hardy swan
#

For what o.O

ivory sleet
#

Static singleton or just singleton?

dapper ether
#

multiple currency’s

ivory sleet
#

Is this an api or just structure?

dapper ether
#

structure

ivory sleet
#

Or are you trying to create behavior here?

dapper ether
#

wdym

ivory sleet
#

Behavior and structure are not the same

#

Hence why there are structural design patterns and behavioral design patterns

#

which are fundamentally separate

sharp flare
ivory sleet
#

Anyhow regardless on what you want you most likely are going to use the behavioral ones so look at those

#

then, some of the structural ones can be good to keep in mind

#

Would also like to mention you most likely want to make it work

dapper ether
#

im new to java sorry my friends insulted me because i didnt use a pattern

ivory sleet
#

Then you refactor the code

#

dont listen to your friend

#

The first thing you learn about hopefully isn’t design patterns

dapper ether
#

i know all basics ig

hardy swan
#

Principles before patterns

dapper ether
#

i read books too

ivory sleet
#

Fundamental object orientation knowledge and java semantics come before principles

#

Well do you remember what you read?

dapper ether
#

what is principles

ivory sleet
#

Else the books are useless

dapper ether
dapper ether
ivory sleet
#

Principles are ideas that try to address a generic problem

dapper ether
#

i know principles

ivory sleet
dapper ether
#

i didnt knew the english word

ivory sleet
#

Ah fair

dapper ether
#

sorry

quaint mantle
ivory sleet
#

Don’t think those definitions help him further

quaint mantle
#

yeah

#

still dunno why i always trust google

ivory sleet
#

I mean google is nice

quaint mantle
#

for that kind of question

ivory sleet
#

🥲

quaint mantle
#

🤮

ivory sleet
quaint mantle
#

wait

#

i just noticed

#

you had nitro?

ivory sleet
#

Ye

vocal cloud
quaint mantle
#

However, the axe doesn't seem to be returning to me... what am I doing wrong?

spiral light
#

what happens instead ? i think you just cancel the task so it cant return before

quaint mantle
#

So the axe throw works

#

And like it despawns at the right times

#

But I don't get the item back

spiral light
#

did you debug it ? i guess armorstand cant be dead or alive ... it has always the same state

quaint mantle
#

Lemme try debugging by sending a message

terse ore
#

Hey, I tried using

            loc.getBlock().setType(Material.DIRT);
            mineWorld.getBlockAt(loc).setType(Material.DIRT);```
For setting a block but it doesn't work
https://pastebin.com/wU5AKSEv
spiral light
#

also this is not the good way to do it: runTaskTimer(SleepyEnchants.getPlugin(SleepyEnchants.class), 0L, 1L);
see dependency injection to use you main class in the right way

#

?notworking

undone axleBOT
#

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

terse ore
#

I tried to use

            loc.getBlock().setType(Material.DIRT);
            mineWorld.getBlockAt(loc).setType(Material.DIRT);```
And it isn't setting the block
spiral light
#

i would check the name of the world from the blockbreakevent and not searching for another world and check if its the same worlds

#

and still

#

?notworking .... what error ? did you debug it ? did you register it ? did you install your plugni ? did you reloaded the server or started it with the new plugin ?

undone axleBOT
#

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

terse ore
#

No error yes I debuged it I registered it I installed it

dark arrow
#

?paste

undone axleBOT
spiral light
quaint mantle
#
               if (player.getInventory().firstEmpty() != -1) {
                            player.getInventory().addItem(thrownItem.get(player.getUniqueId()));
                            thrownItem.remove(player.getUniqueId());
                            sendMsg(player, "&aReturning Axe!");

So I added the "returning ask" to send the message, and the message sends so like

terse ore
#

It gets called yes they aren't null both worlds are the same

quaint mantle
dark arrow
spiral light
spiral light
#

oh

#

you importet the wrongthing -.-

terse ore
dark arrow
dark arrow
dark arrow
spiral light
#

in 'java.awt.TextComponent'. Can

#

i think so.

spiral light
# terse ore yes

your in block break event ... if you set a block but not cancel event it will get destroyd in the process of the blockbreakevent by the server

#

you need to cancel the event

dark arrow
terse ore
young knoll
#

Delay a tick

spiral light
spiral light
quaint mantle
#

Ah lemme check that, thanks

red sedge
#

is there anyway to make a switch statement like

#

between 0 and 24

terse ore
#

How do I delay 1 tick

#

I don't understand bukkit

spiral light
#

?runnable

#

?runnables

#

hmm

#

?schedular

red sedge
#

ouch

spiral light
#

?schedulars

#

wtf is this

#

?scheduling

undone axleBOT
spiral light
#

ahhh

terse ore
#

oki

#

ty

spiral light
young knoll
#

You can switch on a number fine

quaint mantle
red sedge
dark arrow
#

I have created a text component for a clickable chat message and i have create a function to do a specific task so is it possible to run that function when clicked?

spiral light
#

case 0
case 1
case 2
case 3 { number between 0 and 3 included}

red sedge
#

so I need to manually enter every number?

spiral light
#

i think so

#

or use if xD

young knoll
#

Yes

spiral light
#

for that its better

young knoll
#

Or use an if

dark arrow
#

I have created a text component for a clickable chat message and i have create a function to do a specific task so is it possible to run that function when clicked?

spiral light
#

if you let the textcomponent run a cmd and the cmd is linked to your function yes

vocal cloud
dark arrow
# vocal cloud Without code we can only just respond with yes.
public void onWandUse(PlayerInteractEvent event){
        Player player = event.getPlayer();

        if(player.getInventory().getItemInMainHand() != null && player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.GOLD+"The Magical Wand")){

        TextComponent spell = new TextComponent("sad");
        spell.setBold(true);
        spell.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new Text("The magical spell to fill your hunger")));
        spell.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/summon zombie"));
        player.spigot().sendMessage(spell);


        }


    }

    public void onSpellUse(Player player){
        player.setFoodLevel(20);
    }
lost matrix
crude estuary
#

That TextComponent is Sad

#

so Sad

dark arrow
quaint mantle
#

@spiral light how do I check what the itemstack looks like?

spiral light
#

getType ?

tardy delta
#

is it useless to use a PreparedStatement instead of a Statement if you're jsut creating tables?

lost matrix
# dark arrow i did not get it

You will probably not be able to copy that but you might get the idea.
You use some sort of Map<String, Consumer<Player>> or Map<String, Runnable> where you add a generated key with
a specific functionality when creating the click event. Then when the command is run you retrieve that function and call it.

tardy delta
#

i saw it on stackoverflow but on baeldung they say that a preparedstatement is optimized

lost matrix
tardy delta
#

ah thanks

sharp flare
dark arrow
lost matrix
sharp flare
#

But whats the purpose of the click event if u can do it directly saving u some string serialization

tardy delta
#

it will save u alot of time when expending it

sharp flare
young knoll
#

iirc you can use a command that isn't even registered using the PlayerCommandPreProcessEvent

chilly haven
#

Hello is it possible to remove a specific amount od an item from an inventory so like if you have a stack of bones it removes only 10 not the whole stack

lost matrix
# dark arrow ohh

The command itself can be as easy as /spell
But then you can have a Map<UUID, Something>
Where you generate a UUID when the server starts and add it in that map.
Then a spell would look like this:
/spell 8fa62bb4-84ef-11ec-a8a3-0242ac120002
The problem here is that this is not safe as some players can read out the text packets they send to figure
out what argument they have to use. So to be completely safe you should generate a new UUID for
each clickable component and remove it again after the component was clicked.

tardy delta
#

i saw someone handling it commands through listeners

sharp flare
young knoll
#

removeItem respects count iirc

chilly haven
#

Misspelled i meant of

#

Not od

lost matrix
chilly haven
#

I tried that but that didnt work

sharp flare
#

item#getAmount - 10

chilly haven
#

Its like a gui and when you click an item it checks if you have 10 bones and then it removes 10 bones

sharp flare
#

Thats it

lost matrix
chilly haven
#

Il try

tardy delta
#

(short) 10 iirc

lost matrix
#

Wait this respects amount

vocal cloud
#

in the jd maybe

#

?jd

sharp flare
#

You can loop the contents of the inventory if u want

#

Check if the amount is enough, just do checks

#

Then decrement

lost matrix
young knoll
#

Well, 10 items

#

Not 10 stacks

vocal cloud
#

Make sure they have the items first

sharp flare
#

Yeah just do checks

lost matrix
#

ItemStack in the sense of an Object with that material and a single amount. 10x ItemStack{material: BONE, amount: 1}

vocal cloud
#

Use this first

sharp flare
#

Traverse the inventory, just skip null

quaint mantle
sharp flare
#

Oh use the one from mike

quaint mantle
#

Hi um I'm going to ask this again since I debugged and it should work

lean gull
#

can you have a JDA discord bot in the same file as your spigot plugin to connect the two?

lost matrix
# quaint mantle

The first thing you should do is add a ton of new methods so your code is half readable/debuggable

quaint mantle
# quaint mantle

I made an enchantment for throwing an axe, and it's called upon if the player right clicks an item with the enchantment. Everything is working as expected, and the debug messages appear as well. However, the axe isn't being returned, so what am I doing wrong?

lean gull
#

cool, thanks

quaint mantle
#

Oh it returns the item afterwards without the need to picking it up

#

But the problem is the item isn't being returned

#

But yeah kinda similar to a trident

sharp flare
#

Show code

quaint mantle
chilly haven
vocal cloud
#

Just make sure to check if they have it first 👍

sharp flare
#

Oh jeez I'm on a phone rn

chilly haven
#

oye i have another question. When you remove those bones its meant to give you a speed potion that works fine but i dont know how to make the potion length 8 min and not 3.

sharp flare
sharp flare
#

I cant read the code rn, using phone

lost matrix
# quaint mantle

Why dont you just use a snowball and set its texture to an axe?

chilly haven
#

Potion speed = new Potion(PotionType.SPEED);

#

this is what i do rn

quaint mantle
sharp flare
chilly haven
sharp flare
#

Pretty sure your using inventory click event for it

chilly haven
#

yes

sharp flare
#

#getWhoClicked cast to a player interface if u want

lost matrix
sharp flare
#

Use the method from the player entity on adding potion effects

lost matrix
sharp flare
#

Wait let me show u a snippet

chilly haven
sharp flare
#

Oh ita not meant to be added directly to the player as an effect but an item stack?

lost matrix
chilly haven
lost matrix
quaint mantle
#

But will the snowball spin?

lost matrix
quaint mantle
#

yeah that's the main reason why I didn't make it a normal projectile

lost matrix
sharp flare
#

Pretty sure the item is removed when the armorstand is despanwed

#

Crap this autocorrect

quaint mantle
#

I'm not calling on the armor stand's item, but rather the item that's kept in the hashmap

lost matrix
sharp flare
#

Yeah thats a lot of things to process

lost matrix
quaint mantle
#

how do I clone it?

young knoll
#

.clone

lost matrix
#

ItemStack#clone()

quaint mantle
#

oh aight

sharp flare
#

Then retrieve the item from the map, or u want it to spin back to u?

quaint mantle
#

just retrieving it from the map

sharp flare
#

Change the thrownItem#get == null to thrownItem#containsKey(), for readability

young knoll
#

That means two map lookups though

#

Gross

sharp flare
#

Just to make sure

quaint mantle
#

Clone is red fsr

sharp flare
#

Clone the itemstack that will be added

quaint mantle
#

Nvm my bad

#

Was cloning the hashmap XD

#

What do I do with the clone tho?

sharp flare
#

thrownItem.get(uuid)== null why is that == instead of !=

quaint mantle
#

I put the ! at the beginning

lost matrix
sharp flare
#

Ok im done fck this phone

#

Gotta hop up to pc

quaint mantle
#

Alright, but what do I do with the clone?

lost matrix
#

"The only way to go fast is to go well" - Robert C. Martin

quaint mantle
#

Got it, thanks

quaint mantle
lost matrix
# quaint mantle Tho uh this

Add it to the HashMap instead of the original. This was just a guess from us btw. There could be other things that
prevent the item from returning. But nobody wants to properly disect that code.

The very first thing you should do is structure your code with more classes and methods.

quaint mantle
#

Alrighty

#

Yooo it worked

#

Imma organize the code tho, thanks for the tips

robust ginkgo
#

Is there a tool to make plugins with Lua?

dense geyser
robust ginkgo
#

But those are for 1.8

dense geyser
#

figuring out java for this'd probably be your best bet

robust ginkgo
#

I'm terrible at java

dense geyser
#

I went from roblox to java, took me about a year but now im really good at java in a spigot related context (shut up you lot I know java and spigot are different)

#

just focus on trying to so something, and you'll learn it on the way

robust ginkgo
#

okay then ¯_(ツ)_/¯

hybrid spoke
#

what is java? i code in spigot

dense geyser
#

pathetic, learn to code in nms

#

giga chad

#

oh wait I forgot I came here with a question too

#

I might be on something here, I might've just dreamt this or some shit, but in java, I'm pretty sure ive seen enums like this below. I wanted to know if anyone has a name for it or any documentation I can read on it

public enum Enumerator {
    ENUM_ONE {
        //some functional code here
    }
}

does anyone have any clue if this actually exists?

hybrid spoke
#

enum code blocks

dense geyser
#

thank you

#

discord really just tried to call me disabled for using white mode

vocal cloud
#

That is a pretty disabled move

dense geyser
#

sorry, can't see your message, burnt out my retinas

hybrid spoke
#

this is an insult to disabled people

#

white mode is worse

dense geyser
#

racism

#

:(

#

white mode users deserve love and affection too

hybrid spoke
#

nah

tardy delta
#

Nah

dark arrow
earnest wigeon
#

how i Export File in Build tool

chrome beacon
#

?bt

undone axleBOT
lost matrix
#

Ah and Lombok

quaint mantle
#

Lombok

#

Scaryyyy

raw ibex
#

what does Player.getInventory().getArmorContents() return?

lost matrix
#

But when in doubt: javadocs

terse ore
#

what was the ?thingo for waiting a tick?

#

?delay

lost matrix
#

?scheduling

undone axleBOT
terse ore
#

?thx

raw ibex
#

oh item stack

#

but what if its different armor

lost matrix
raw ibex
#

is there an event for advancements

raw ibex
#

specifically the diamond one

lost matrix
raw ibex
#

why?

raw ibex
lost matrix
#

Java style convention

red sedge
#

is there anyway I can make the plauyer place a block on playerinteract event

lost matrix
#

Oh i see

red sedge
#

if i cancel the event

#

it does not place the block

dark arrow
red sedge
#

if i dont cancel the event, if th player clicks on a chest or a noteblock it interacts with the said block

earnest wigeon
#

D:\games\Minecraft\lib\BuildTool\Spigot\Spigot-API

earnest wigeon
#

how i export file form this path

#

i mean Build tool

dark arrow
#

thx

lost matrix
#

Do you want to run BuildTools to get a server jar?

red sedge
earnest wigeon
#

yrp

red sedge
#

I need it so when the player right clicks to a noteblcok

#

it places the block

#

instead of interacting with it

lost matrix
red sedge
#

and then?

#

idk how to make it so the player places the block

lost matrix
#

Dont cancel it in this case

red sedge
#

yeah but when you click on a noteblock with a block it just interacts with the block

lost matrix
undone axleBOT
lost matrix
#

This explains everything

earnest wigeon
#

yep**

#

sorry

lost matrix
#

All good

earnest wigeon
#

im bad for English

raw ibex
#

what type is an advancement?

lost matrix
raw ibex
#

but like

#

how would i use it in an if(event.getAdvancement() == WHAT)

#

i want it to be diamond event

red sedge
spiral light
raw ibex
#

ok is that how it work

lost matrix
# raw ibex how would i use it in an if(event.getAdvancement() == **WHAT**)

First of all: == is only used for identity checks. (If two variables point at the exact same memory location)
Only use it for primitives (int, long, double etc). For Objects you should use .equals()
Advancement is an instance of Keyed. This means it has a method getKey() which returns a NamespacedKey
A NamespacedKey consists of a namespace and a key in this configuration: namespace:key
For minecraft keys its always minecraft:key
To find out what that key is you can look at websites like this one:
https://minecraft.fandom.com/wiki/Advancement

For "Diamonds!" its story/mine_diamond which means the NamespacedKey is probably one of minecraft:story/mine_diamond or minecraft:mine_diamond
Either way you could just for contains. Example:

  public boolean isDiamondsAdvancement(Advancement advancement) {
    NamespacedKey namespacedKey = advancement.getKey();
    String key = namespacedKey.getKey();
    return key.contains("mine_diamond");
  }
lost matrix
raw ibex
earnest wigeon
#

i wanna to use my src

#

for use in my plugin(lib)

gaunt moss
#

Hi, the plugin.yml file can be read in a folder?

red sedge
gaunt moss
earnest wigeon
#

now i can't convert src to jar file

lost matrix
raw ibex
#

is there a way to edit bossbars

lost matrix
raw ibex
#

how?

gaunt moss
earnest wigeon
raw ibex
#

what's the function

lost matrix
terse ore
#

What would 1L be

#

1 tick?

spiral light
terse ore
#

oki

lost matrix
raw ibex
lethal coral
lost matrix
terse ore
eternal oxide
#

depends on the use case

#

but 1 would usually be an integer

#

1L is a long

terse ore
#

okkk

lost matrix
raw ibex
gaunt moss
lost matrix
lost matrix
lost matrix
terse ore
terse ore
#

this will set the block type after 1L right

raw ibex
#

Can't test the plugin atm, but I will get it to work

gaunt moss
lost matrix
raw ibex
#

how can i make a hashmap for the whole class (including event handler)

lost matrix
lost matrix
#

Or do you use maven/gradle

raw ibex
#

will it be available anywhere within a constructor?

lost matrix
raw ibex
#

ok

lost matrix
# raw ibex ok
public class DropListener implements Listener {

  private final Map<String, UUID> someMap; // This map will be accessible in the whole class
  
  public DropListener(Map<String, UUID> someMap) {
    this.someMap = someMap;
  }

  @EventHandler
  public void onEntityDrop(EntityDropItemEvent event) {
    
  }
  ...
}
terse ore
#

I am getting this error

lost matrix
#

Ah nvm

terse ore
#

oh ok

lost matrix
#

The method runTaskLater() returns the started BukkitTask

terse ore
lost matrix
#
BukkitRunnable runnable = new BukkitRunnable(){...}; // Creates an anonymous class
BukkitTask task = runnable.runTaskLater(...); // Runs the task containing the BukkitRunnable
terse ore
#

I am not understanding what you last said

lost matrix
lost matrix
terse ore
lost matrix
raw ibex
lost matrix
terse ore
#

yep

gaunt moss
lost matrix
# terse ore yep

And when the server stops then all the ores that are not respawned by that point are just gone for good? 😄

terse ore
#

this morning I was told to wait 1 tick before changing the blocktype

#

in onload i'll make oll the ores to spawn

#

that's not the problem

lost matrix
#

Yes. Map can contain a HashMap or a LinkedHashMap or any other Object which implements Map.
Same goes for List which can contain an ArrayList or a LinkedList or an ImmutableList or Set which contains a HashSet or a TreeSet etc.
For example if you have an Object field then everything can be put in there as every class extends Object in java.
private final Object someMap = new HashMap<String, String>();
But then you lose functionality.

raw ibex
#

okay

lost matrix
terse ore
eternal oxide
#

The Bukkit runnable task will always be at least 1 tick later

lost matrix
# terse ore but how do I wait that freaking tick

Just like you did it. A more compact version using a lambda:

  @EventHandler
  public void onBreak(BlockBreakEvent event) {
    Block block = event.getBlock();
    JavaPlugin plugin = Ores.getInstance();
    Bukkit.getScheduler().runTaskLater(plugin, () -> block.setType(Material.BEDROCK), 1);
  }
raw ibex
lost matrix
quiet ice
#

Did you forget the constructor?

raw ibex
raw ibex
terse ore
opal juniper
#

it’s pseudo code

#

oh wait

#

ignore me i thought you were taking about something earlier KEKW

terse ore
#

ok

#

Could you help me?

#

I want to wait a tick but nothing is working

opal juniper
#

sure- but it seems he has got it all covered tbh

#

what doesn’t work

terse ore
#
    @EventHandler
    public void onBreak(BlockBreakEvent event) throws InterruptedException {
        Player player = event.getPlayer();
        World playerWorld = player.getWorld();
        World mineWorld = Bukkit.getWorld("mine");
        Block block = event.getBlock();


        if (playerWorld.equals(mineWorld)) {
            player.sendMessage("sad");
            JavaPlugin plugin = Ores.getInstance();
            Bukkit.getScheduler().runTaskLater(plugin, () -> player.sendMessage("asd"), 1);
        }
    }```
#

So it prints sad but not asd

opal juniper
#

are there any errors

terse ore
#

i'm stupid

#

yes plugin cannot be null

opal juniper
#

oh lol

terse ore
#

how tf I haven't thought of seeing console -_-

#
    public static Ores getInstance() {
        return instance;
    }```
#

getInstance from main

#

is something wrong with it?

blazing scarab
#

(Just pass the plugin in constructor)

opal juniper
terse ore
#

wdym by that

#
   public static Ores instance;

    public static Ores getInstance() {
        return instance;
    }```
#

yes ig

opal juniper
#

like in your main class you need an Ores field and then onEnable you need an ores = this at the start

red sedge
#

im not smart enough to do this someone please help

terse ore
#

I don't have anything at onenable

opal juniper
red sedge
#

im trying to make it so whenever a player right clicks to a noteblock it places the block

opal juniper
#

so you need an
instance = this at the start

red sedge
#

instead of interacting with the block

opal juniper
red sedge
#

and

#

placing?

opal juniper
#

you can set the blocks in the event listener

red sedge
#

and

#

the blockplaceenvet?

obtuse ferry
#
ItemMeta meta = border.getItemMeta();
meta.setDisplayName("");
border.setItemMeta(meta);

I want the text to not be there but it does:

terse ore
#

Still plugin cannot be null

obtuse ferry
#

Nah will do

terse ore
#

Break.java

    @EventHandler
    public void onBreak(BlockBreakEvent event) throws InterruptedException {
        Player player = event.getPlayer();
        World playerWorld = player.getWorld();
        World mineWorld = Bukkit.getWorld("mine");
        Block block = event.getBlock();


        if (playerWorld.equals(mineWorld)) {
            player.sendMessage("sad");
            JavaPlugin plugin = Ores.getInstance();
            Bukkit.getScheduler().runTaskLater(plugin, () -> player.sendMessage("asd"), 1);
        }
    }```
Ores.java (Main)
```java
    public static Ores instance;

    public static Ores getInstance() {
        return instance;
    }

    @Override
    public void onEnable() {
        instance = this;
        System.out.println(Color.translate("&aOres para la mina listos <3"));
        loadEvents();
    }```
#

And it says plugin cannot be null

late sonnet
#

@terse oreYou have the error log?

lapis widget
#

I don't see a reason why your not just using Ores.getInstance()

#

instead of plugin

red sedge
lapis widget
#

in break.java

obtuse ferry
red sedge
#

put Ores.getInstance()

late sonnet
# obtuse ferry worked thanks

no problem this remind me for the error try to send a title empty... empty its like null internally for a few things.. then a space can fix many things xd

terse ore
#

?paste

undone axleBOT
red sedge
#

im going to jump off of a bridge

#

ffs

terse ore
#

idk why it's .sql

#

but there's the error Doc

red sedge
terse ore
#

where

#

in onEnable?

late sonnet
#

no

grim ice
#

is there a lombok annotation to select many fields

late sonnet
#

you call the method and save in local var..

#

but not sure if this can be the error

grim ice
#

i dont wanna write @Getter @Setter for every field

spiral light
#

thats the 100th question of him and it still seems like he dont know java O.o

blazing scarab
#

but bruh lombok