#help-development

1 messages · Page 1706 of 1

shadow tide
#

?paste

undone axleBOT
shadow gazelle
#

I'm just using addUnsafeEnchantment, but I have to add it to the crafting result because it just doesn't output it with the enchantment

quaint mantle
hasty prawn
#

getAttribute(GENERICMAXHEALTH).getValue()

shadow tide
#

ahh

#

thanks

quaint mantle
#

can someone review it

hasty prawn
shadow gazelle
#

I'm adding the enchantment to the result with prepare crafting and that works fine

#

It seems the issue is ItemStacks and keeping unsafe enchantments

acoustic pendant
#

how does it work to add the update notifier?

#

i have the request url

#

but how does it work?

young knoll
#

You should use the enchant methods in ItemMeta rather than itemstack

tacit drift
#

it's not your code

quaint mantle
tacit drift
#

well FunkePhase depends a lot on Atlas so idk

#

but if it's straight up from the plugin then it's fine prob

eternal oxide
#

any while loops

#

lockups are usually for loops taking too long, or unending

#

um, running sync?

#

is it running on the main thread?

#

yeah, that will break it

#

You can;t do that

#

if you want to wait for a command you shoudl trigger in the command to start doing whatever you want

#

what is your while loop actually doing?

#

its goal

#

it doesn;t sound an efficient way of doing it

paper viper
#

you should prolly make that async or smthing

eternal oxide
#

is it your plugins command?

paper viper
#

dont make that overload the main thread

#

lol

eternal oxide
#

at teh moiment theres no need for async. I doubt you need anything running

paper viper
#

wait is your while loop using thread.sleep or smthing

eternal oxide
#

if its another plugins command you want to listen for use teh command pre process event

quaint mantle
#
final UUID uuid = player.getUniqueId();
final String message = "This is an annoying message";

new BukkitRunnable() {
    Player player = Bukkit.getPlayer(uuid);

    // Offline?
    if (player == null) {
        this.cancel();
        return;
    }
    player.sendMessage(message);
}
.runTaskTimer(plugin, 0L, 10L * 20L);

something like this

lost matrix
paper viper
#

its fine cause a lot of spigot stuff is deprecated

#

and dont have a replacement

quaint mantle
#

i dont think you need it async

eternal oxide
#

you don;t need async

quaint mantle
#

just use the code i sent

eternal oxide
#

imagines code would send a message every 10 seconds

paper viper
#

i change my mind cause every 10 seconds not gonna do jack shit

quaint mantle
#

you can change that btw

paper viper
#

prolly

#

if you are doing it way more frequently tho def be aware

young knoll
#

That one does have a replacement

#

But afaik it’s only deprecated because people got confused with the name

acoustic pendant
#

Why my code can't resolve "LogLevel" ?

paper viper
#

the schedualer allows for a runnable to be passed tho as an argument

acoustic pendant
#

why?

eternal oxide
#

LogLevel is not in Logger

#

its an Enum

#

LogLevel.WARNING

#

yes

acoustic pendant
#

i'm doing the update checker

#

and the guy

#

did smth like that

#

and it worked for him

eternal oxide
#

then you watched it wrong

#

INFO

acoustic pendant
#

the thing that changes

#

from the guy

#

is this thing

#

and for the guy says

#

message

ancient plank
#

reading is hard huh

eternal oxide
#

LogLevel and message are comments from InteliJ

acoustic pendant
eternal oxide
#

no, you are usign Logger

ancient plank
#

do you know java 🤔

eternal oxide
#

I can see how you are finding it hard to follow a video when you have trouble following what I type.

acoustic pendant
#

i deleted my code

#

and paste the video code

#

and still the same trouble

subtle folio
#

pasting code bad , write code makes muscle memory skillz

ancient plank
#

bet its some funny funny import stuff

acoustic pendant
#

ik

#

but it was for see if that code worked

eternal oxide
#

he's just not seeing teh code correctly in the video

ancient plank
#

learning to read/java might be helpful tbh

eternal oxide
#

he's typing the Intelij comments too

subtle folio
#

🙂 👍

acoustic pendant
eternal oxide
#

you can;t copy/paste from a video

subtle folio
#

is it artifact id import errors

#

that’d be funny

acoustic pendant
eternal oxide
#

link the video you are trying to follow

subtle folio
#

send code

paper viper
#

ahaha it uses Main

opal juniper
#

pulse’s bug-bear

ancient plank
#

was abotu to say that

eternal oxide
#

ok you are using his code correctly

acoustic pendant
paper viper
#

Also that code is literally copied and paste from the forum

ivory sleet
acoustic pendant
#

that's mine

eternal oxide
#

but his code is BAD

subtle folio
#

it’s much better to code all your plugins only in the main class

acoustic pendant
#

uh

eternal oxide
#

he's probaby using some custom logger

paper viper
subtle folio
#

makes it less organized

#

snd harder to read

#

much better for a programmer

ancient plank
paper viper
#

lmao

ivory sleet
subtle folio
paper viper
#

??

subtle folio
#

it was sarcasm anyway

paper viper
#

i cant trust an unverified dude

#

lmao

eternal oxide
#

Yeah, he's using a custom Logger class. You can see it in his project on the left

ivory sleet
#

?main

subtle folio
ivory sleet
#

Aha

paper viper
#

lmfao

ivory sleet
#

Btw Pulse

#

If you want, you could review my code

#

Not because it’s good

#

But ye

#

Lol

paper viper
#

Ok

#

Show

ivory sleet
ivory sleet
#

Oh I forgot to push the newest

#

But

#

Yes

#

That’s about it

paper viper
#

did you give up using final

#

cause it bloats your code

#

lol

ivory sleet
#

yes

#

Lol

#

I might add final before shipping the final product

#

🥔

paper viper
#

lol

#

its fine

ivory sleet
#

Yaa, what code style do u use rn?

paper viper
#

im still using google format cause im too lazy to make a hybrid

#

lmao

ivory sleet
#

Ah

#

With that super indented lambda scope thing also?

paper viper
#

Yeah

#

i absolutely hate it

ivory sleet
#

Oh god lol

#

I mean some of the style is actually quite nice

#

But then we also got the mysterious make my code look ass shit as well

ancient plank
#

show the super indented lambda scope thing

#

i wanna see

ivory sleet
#

You don’t

ancient plank
#

I'm curious

ivory sleet
#

It’s too dangerous

plain scroll
#

How can i just get the name of the world?

paper viper
#

look at javadocs

#

its in WorldInfo

ancient plank
#

reading is still hard!

paper viper
#

Ctrl + F

#

"name"

#

xD

cursive glen
#

Hello!

#

Quick query on my command

opal juniper
#

the problem i sometimes find with REALLY inexperienced programmers is that they print the object, and cause it implements toString they see name or something and then do some completely redundant string manipulation to get the name, for example

paper viper
#

Lmfao that is so true

opal juniper
#

and i mean i understand why they did it ig but still… ugh

paper viper
#

Lol

gritty lake
#

Anyone know if there is a way to send fake ip to the servers from bungee? ip spoof

#

can't find any api for it

#

currently we run manually modifyed spigot to ip spoof but want to run it on bungee instead as a plugin

plain scroll
#

how can i give a player a potion effect? Ive had a look on the doc but its not syncing in lol

#

nvm

#

wait

minor garnet
#

player#addPotionEffect

plain scroll
#

i didnt work

#

nvm

#

simple mistak lol

lost matrix
cursive glen
#

Hello!

#

I need really quick help with a command

#

for some reason I run the command in my server

#

but it does not execute the code set for the command

#

and it does not throw an error either

#
        if(cmd.getName().equalsIgnoreCase("funni")) {
            ItemStack funni_spoon = new ItemStack(Material.STONE_SHOVEL);
            ItemMeta spoonm = funni_spoon.getItemMeta();
            //spoonm.setLore(sl);
            spoonm.setDisplayName(ChatColor.AQUA + "Market Gardener");
            
        }
        
        if(cmd.getName().equalsIgnoreCase("rawpapi")) {
            p.sendMessage("rawpapi");
        }
#

command code ^^

#

neither of them work despite being specified in the yml

tiny whale
#

did you specify the command in your main class?

plain scroll
#

how can i get the "wtbl" variable and use it in the other else if?

#

ik this is simple java baiscs but some help would be noice

cursive glen
tiny whale
cursive glen
#

pretty sure you don't

#

I have a feeling this has to do with 1.17.1 spigot being different

tiny whale
#

oh okay.

plain scroll
#

how can i make like a "lagback" for someone in spectator mode?

tiny whale
# plain scroll how can i make like a "lagback" for someone in spectator mode?

as in prevent them from breaking blocks or prevent them from moving?

what you can do is make an event detecting either action @EventHandler public void onPlayerMoveEvent(PlayerMoveEvent e), and detecting if they are in spectator. if they are, then you can use e.setCancelled(true); to prevent them from doing that event.
Hope this helped!

plain scroll
#

yus

#

tysm!

quaint mantle
#

hey can someone check threads please lol

#

i have a thread, i dont want to flood this channel with it

plain scroll
#

because i have an Invenv click event

#

i wanna add it in there

cursive glen
#

Hey guys!

#

Can I get some sort of plugin.yml format?

tall dragon
plain scroll
#

can i use 2 events in one class?

tall dragon
#

yes

plain scroll
#

how

tall dragon
#

well just do it?

#

wdym how

plain scroll
#

nvm

#

i did it

tall dragon
#

:)

plain scroll
#

[02:20:59 ERROR]: [Ban-EM] Ban-EM v1.1 attempted to register an invalid EventHandler method signature "public void bangui.me.duke.Me.listeners.BanInvListener.onMenuClick(org.bukkit.event.inventory.InventoryClickEvent,org.bukkit.event.player.PlayerMoveEvent)" in class bangui.me.duke.Me.listeners.BanInvListener

#

wait... if its allready registerd why do it het this?

tall dragon
#

well

#

dont register it twice

#

u only need to registyer once

plain scroll
#

yeh i do

#

but i get that error

tall dragon
#

show event code

plain scroll
tall dragon
#

oh i dont work like that

plain scroll
#

shit lol

tall dragon
#

gotta have 2 serperate methods

cursive glen
#

Guys can I get some help?

#

My code is seriously not working and im unsure as to why

quaint mantle
#

would be great to see some code

cursive glen
#

yeah

#

of course

#

my bad

plain scroll
cursive glen
#

quick something of what that looks like

plain scroll
#

wait so like another EventHandler

tall dragon
#

yh

plain scroll
#

ohh

eternal oxide
#

?paste

undone axleBOT
proud basin
#

if 10 is greater than 9. How can x be 5?

plain scroll
tall dragon
#

no

lusty forum
plain scroll
#

no thats not the issue

#

also thats correct

#

lol

cursive glen
#

does the new spigot api require SE 16?

plain scroll
#

depends what vet

quaint mantle
#

spigot 1.17 yes

plain scroll
#

ver*

cursive glen
#

so

plain scroll
#

^ This

cursive glen
#

using say

#

SE 16

#

could make it not work?

#

or soryr

#

Sorry

#

I meant

#

If I use SE 15

#

Would it not work properly?

quaint mantle
#

it has to be java 16

cursive glen
#

Because here's the strange thing

#

I have an event

quaint mantle
#

@ember crag use a different paste site

#

?paste

undone axleBOT
cursive glen
#

and that works

#

but my commands are not functioning

ember crag
quaint mantle
#

it fires twice for each hand

ember crag
#

how do i change that

quaint mantle
#

you can do main hand only

plain scroll
#

how can i add 2 events to a class?

#

thats what i need help with lol

quaint mantle
#

🙂

plain scroll
#

errrrr

#

how?

quaint mantle
#

its literally just the same

ember crag
plain scroll
#

ik

#

ik

quaint mantle
#
@EventHandler
public void onEvent(..Event one) {

}

@EventHandler
public void onEventTwo(..Event two) {

}
plain scroll
#

that didnt work?

quaint mantle
#

it does

cursive glen
#

Man, still not working

#

this is really irritating.

tall dragon
#

@ember crag thats due to the main hand, off hand

#

check for the main hand

ember crag
#

yea i figured it out lol

tall dragon
#

ah, great

ember crag
#

it fires twice because you have two hands

ember crag
#

so just check if the hand is the main hand

tall dragon
#

yea

quaint mantle
#

?learnjava

undone axleBOT
tall dragon
#

@plain scroll your brackets are all messed up haha

plain scroll
#

ik that

quaint mantle
#

and thats the problem

#

its basic java syntax

plain scroll
#

ik...

quaint mantle
#

then fix it

plain scroll
#

ight

cursive glen
#
    public boolean onCommand(Command cmd, CommandSender sender, String label, String[] args) {
        Player p = (Player)sender;
        
        
        if(cmd.getName().equals("funni")) {
            p.sendMessage("Hello!");
        }
        
        
        
        return false;
    }
#

this is my current code, still won't run the command.

tall dragon
#

well have you registered everything

cursive glen
#

This is an in main command method

cursive glen
#

?

#

Oh

#

um

#

does it work like that?

tall dragon
#

yea u dont rlly need that either

#

u set the command label where u register it

cursive glen
#

more of the code

tall dragon
#

probably plugin.yml in your case

cursive glen
#
ublic class Main extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        Bukkit.getServer().getPluginManager().registerEvents(this, this);
    }
    
    @Override
    public void onDisable() {
        
    }
    
    
    public boolean onCommand(Command cmd, CommandSender sender, String label, String[] args) {
        Player p = (Player)sender;
        
        
        if(cmd.getName().equals("funni")) {
            p.sendMessage("Hello!");
        }
        
        
        
        return false;
    }
#

oops p at the start there

tall dragon
#

also add @Override

#

above onCommand

cursive glen
#

it runs an error

#

which is why it wasnt there to begin wtih

#

with

tall dragon
#

pretty sure it will not work without Overriding

cursive glen
#

its worked before

quaint mantle
#

put it there

#

its so people know the method is overriding its superclass

#

and not restricted to only its type

tall dragon
#

ive never actually known if it was absolutely required to work

#

i learn something new today i guess

cursive glen
#

so is it fine despite it throwing an error?

tall dragon
#

what error

cursive glen
#

it throws an error on the method initialization once I add it

#

It says

#

The method onCommand of type Main must override or implement a supertype method.

tall dragon
#

yea

#

thats because your arguments are wrong

#
@Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {

    }
cursive glen
#

wha

#

When in the hell did @NotNull get put in this?

tall dragon
#

i just use it

#

delete it if you want

cursive glen
#

Ive never seen that?

#

wait

tall dragon
#

u dont need it

#

its about CommandSender

#

not being in the right order

cursive glen
#

thank you

#

THANK YOU

#

WTF

#

Ive been messing around with this for hours and it was an order issue

tall dragon
#

yea

#

well no problem

#

do you use intellij?

cursive glen
#

No

tall dragon
#

should start doing it

#

i type "on" and autocomplete the rest

#

in the right order

#

i guess its based on preference but imo intellij is superior to any other ide

ember crag
#

whats the event for when a player leaves a ridable vehicle?

quaint mantle
#

the docs are the gods

#

you worship the docs

#

you learn from the docs

#

they contain every piece of knowledge you may need

ember crag
#

ah thx

tall dragon
#

@quaint mantle is probably doing montgly offerings to the docs 😄

quaint mantle
#

I will sacrifice you to the docs

tall dragon
#

😵

quaint mantle
#

thank u @eternal oxide, lmaoooo

#

idk why i didnt just check FAWE

ember crag
#

how do i set an armor stands direction to a certain block's direction?

quaint mantle
#

How to kick a player using AsyncChatEvent?

#

try it normally, if it doesnt work because its async you can run a sync task

quaint mantle
#

just do what i said

#

Make a async task in asyncchatevent?

young knoll
#

No, it’s already async

#

Just kick them

quaint mantle
#

player.kickPlayer("")

#

return

#

do what i said

#

run a sync task

young knoll
#

Huh didn’t know you couldn’t kick async

subtle folio
#

What is the method for applying levitation to an entity.

young knoll
#

addPotionEffect

subtle folio
#

addPotionEffect method cannot be found in entity.

young knoll
#

You can only apply potion effects to living entities

subtle folio
#

it is allive, i spawned it 1 line above

young knoll
#

Living entity is a type of entity

carmine nacelle
#

What would be the best way to...

holos:
  Test:
    location: world, -377.7475157409223, 81.5, -365.5887585344649
    owner: e42b60b0-c35a-462f-a2b4-b1a9980f399e
    lines:
    - Test
    - Test

rename "Test" to like.. "Testing"?

neon nymph
#

Probably duplicate then delete

quaint mantle
#
ConfigurationSection section = config.getConfigurationSection("holos.Test");
config.set("holos.Test", null);
config.set("holos.Testing", section);
#

try that idk

neon nymph
# quaint mantle

Bukkit.getScheduler().runTask(() -> player.kickPlayer(message));

quaint mantle
#

who's charlie

neon nymph
#

Hazbin hotel

quaint mantle
#

Whut

#

oh an anime

neon nymph
#

Anime

#

Lmao, sort of

timber whale
cursive glen
#

did that thanks

#

Guys, one last question.

#

Is there a way to create a fireball which launches you up in the air like the ones in hypixel?

young knoll
#

Pretty sure those are just normal fireballs

#

That you can throw

cursive glen
#

You can't throw normal fireballs

quaint mantle
#

how do i get the item before bucketfillevent

young knoll
solar sable
#

i barely get above 6 error at least

young knoll
#

They didn’t close the method above

#

You don’t have a { after the cmd.getName it statement

worldly ingot
#

o.O

quaint mantle
#

i need the itemstack

worldly ingot
#

I'd imagine Inventory#get() would return the bucket

#

oh there's no hand in that event either

#

There really should be

quaint mantle
#

its shit

#

pr mr choco

young knoll
#

Doesn’t work with glass bottles either

quaint mantle
#

and i cant listen to the interactevent

#

because its never a liquid

#

Wait

#

ohhhhh

#

i could check the relative of the clicked block face

#

and see if its liquid

#

Big brain time

young knoll
#

What if they don’t click a block face

quaint mantle
#

then im screwed because the bukkit api is missing a chunk of features 🤷🏿‍♂️

young knoll
#

I remember hypixel skyblock having issues with glass bottles a while back

#

Wonder what they did

quaint mantle
#

probably packet stuff

young knoll
#

Interact event, check held item, ray trace check if water is in range?

#

No idea

#

Well you obviously need a corresponding closing bracket

#

If you have an if statement without { } then only the next line is treated as being within the statement

neon nymph
#

It's fine in his case

#

The second if statement is treated like one line, so the first if having no brackets is totally valid

#

But if that's the case, might as well just use one if statement with an &&

#

Oh nvm, scratch that. Second if has a separate else

bright jasper
#

I have some people not receiving Bukkit.broadcastMessage

#

Some do, some dont

young knoll
#

Is it the one with 1 arg

bright jasper
young knoll
#

Should go to everyone

solar sable
#

i see so many error in this that i just cant even process

#

@quaint mantle let me try and see if i can fix it just a lil bit

#

@quaint mantle show your plugin.yml for me please

#

i just need to see if there is an error there too

torn oyster
#

how do i get a player uuid from name (and vice versa) in bungee

#

i remember i had classes

#

that did that

#

but i dont have them anymore

solar sable
#

okay so @quaint mantle after putting the code into my plugin manager, i already see so many error

#

so first of all

#

ChatColor doesnt need any spaces

#

and it doesnt need the org

#

@quaint mantle

player.sendMessage(org.bukkit.ChatColor.BLUE + "Discord: " + org.bukkit.ChatColor.YELLOW + discord);
``` you dont need the org.bukkit.
#

you just need to put

#

ChatColor.BLUE+

#

no space between BLUE and "Discord: "

#

and what you need to do is

#

import the ChatColor

#

nah no needed

#

but what is the store website?

#

like when you do /store what is the link

#

ah

#

thats not a store lol

#

but okay

#

well what you can do is

#

at line...

#

wait

#

what you can change from this

#

player.sendMessage(org.bukkit.ChatColor.YELLOW + "Store: " + org.bukkit.ChatColor.YELLOW + store);

#

is change it to this

#

player.sendMessage(ChatColor.YELLOW + "Store: ");

#

and i think if you put the link in the "Store: "

#

it would work maybe

#

because in minecraft whatever link is in chat, you can click (above soem version)

#

ah good good

#

well just change every org.bukkit. from ChatColor

#

cause its not needed

#

you have this on top of your plugin thing right?

#

aah

#

why do you make the perms "store.store" ? i think its better if its "store.use" lol

#

did you use a tutorial for this or you figured it out on your own?

#

oh so its only the discord that is isnt working

#

try restarting server maybe?

#

hmm

#
public class Store extends JavaPlugin {

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player player = (Player) sender;

        if (cmd.getName().equals("store"))
            if (sender.hasPermission("store.store")) {
                return true;
            } else {
                sender.sendMessage(ChatColor.DARK_RED + "You do not have permission!");
                return true;
            }

        {
            String store = this.getConfig().getString("Store");
            player.sendMessage(ChatColor.YELLOW+"Store: ");
        }
        return false;

    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player player = (Player ) sender;

        if (cmd.getName().equals("discord"))
            if (sender.hasPermission("store.discord")) {
                return true;
            } else {
                sender.sendMessage(ChatColor.DARK_RED + "You do not have permission!");
                return true;
            }

        {
            String discord = this.getConfig().getString("Discord");

            player.sendMessage(ChatColor.BLUE+"Discord: ");
        }
        return false;

    }

}
``` I do not know if this is better or not but its up to you if you wanna copy it (I only changed the chat color problems and i cant seem to find the discord problems)
#

wait hold on

#

hm i see an error hold on

#
public class Store extends JavaPlugin {

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player player = (Player) sender;

        if (cmd.getName().equals("store"))
            if (sender.hasPermission("store.store")) {
                return true;
            } else {
                sender.sendMessage(ChatColor.DARK_RED + "You do not have permission!");
                return true;
            }

        {
            String store = this.getConfig().getString("Store");
            player.sendMessage(ChatColor.YELLOW+"Store: ");
        }
        return false;

    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        Player player = (Player) sender;

        if (cmd.getName().equals("discord"))
            if (sender.hasPermission("store.discord")) {
                return true;
            } else {
                sender.sendMessage(ChatColor.DARK_RED + "You do not have permission!");
                return true;
            }

        {
            String discord = this.getConfig().getString("Discord");

            player.sendMessage(ChatColor.BLUE+"Discord: ");
        }
        return false;

    }

}
#

there

#

itsa bit better

#

but while i was checking for the error, it shows me that inside public boolean there is no tests

young knoll
#

You can only have 1 copy of a method

solar sable
#

oh no wonder

#

so remove the second public boolean

#

yeh because you already have a onCommand

#

thats why it needs to be onCommand1 because you have 2 public booleans

young knoll
#

onCommand1 won't work

#

Commands only call the onCommand method

solar sable
#

well

#

start from removing the second boolean

young knoll
#

All the code needs to be in one method

torn oyster
#
    public int getServerMaxCount(String ip) {
        URLConnection connection;
        try {
            connection = new URL("https://api.mcsrvstat.us/1/" + ip).openConnection();
            String text = new Scanner(connection.getInputStream()).next();
            
            return ((int) ((JSONObject) parser.parse(text)).get("players.max"));
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        }
        return -1;
    }```
#

no idea where else to post it

#

i get Unexpected token END OF FILE at position 232.

#

error

#

no idea what im doing lol

#

this isnt a plugin

solar sable
#

oh

#

if its not a plugin

#

then what is it

#

json file?

torn oyster
#

well its reading mcserverstat

#

thats all u need to know lol

solar sable
#

reading mcserverstat hmm

#

so what are you trying to do? i need to know before helping lol

torn oyster
#

discord bot rich presence

#

not many people try to do it in java

#

gonna set it to like

#

"watching serverip: playersOnline/playersMax"

solar sable
#

Oh

#

like the one in discordsrv?

torn oyster
#

idk

#

ig?

solar sable
#

that they have the "{Numbers of people} has joined this cool server" like that

#

?

torn oyster
#

im just trying to set the bot's rich presence to that

#

anyway i just wanna know why jsonsimple isnt working

solar sable
#

hmm

#

well i dont really know because i dont use json most of the times

#

wait @quaint mantle

torn oyster
#

?paste

undone axleBOT
solar sable
#

@quaint mantle i just realised something

#

are you making 2 commands on 1 singular class?

#

uhm

#

that doesnt really does well

#

so that is the reason yoru /discord doesnt work

#

every command you want to add in your plugin, must have singular class

#

like this

solar sable
#

i have an /add command and /hello command in separate classes

young knoll
#

It is recommended though

solar sable
#

yup

#

because it is just better to have everything organise

#

jeez

#

wait hold on lemme just do thsi rlly quic

subtle folio
#

is it possible to make a squid follow a snowball

solar sable
#

@quaint mantle dont remove the public boolean but instead, make another class for it

#

after you copy and paste it to another class, then you can remove the public boolean from the store class

young knoll
#

You can also remove the name check if you do 1 command per class

solar sable
#

name check?

#

this was my easiest command project lol

young knoll
#

the if (cmd.getName) ...

solar sable
#

wait a sec

#

its a command right? that @quaint mantle is trying to do

#

then why dont you make it implements CommandExecutor

#

instead of extends JavaPlugin?

#

because let me just explain a bit

#

extends JavaPlugin is used in the Main java

#

main java file

#

like this

#

but for commands

#

you gotta use

#

like this

#

i also recommend you using Intellij if you havent already because it works just so flawlessly

#

Case sensitive

#

this.Bukkit.CommandExecutor.getString("Discord");

#

bukkit needs to be case sensitive

#

@quaint mantle always remember case sensitive stuff lol

#

no no dont be

#

lol

#

XD

#

wow thats a great lesonn

#

gimme that link please i need to learn about executing the same task over and over again just means im updating the task everytime

#

i have this scoreboard and it doesnt updates so i need to learn how to update it but on the spigot website, i just dont get it

#

i started like a few days ago and im already addicted and i am actually very trash at math

solar sable
#

oh wow

#

its 1:03 pm here

#

lol

#

well goodnight i guess 👋

#

lol

austere bone
#

hey! need a little help.. idk if this is possible but;

how do you dected who killed someone in special cases?
for example; if PlayerA breaks a block under PlayerB and PlayerB dies in lava or fall damage.. how do i check that PlayerA killed PlayerB

#

or if PlayerA makes a trap for PlayerB

carmine nacelle
#

Anyone know the updated way to check a player's balance with Vault?

#

The github says to use econ#getBalance(OfflinePlayer) but it's deprecated

young knoll
#

Shouldn’t be

#

I thought the string one was deprecated

neon nymph
#

The string is the deprecated one, offlinePlayer is not

young knoll
#

Offline player is also deprecated

#

You need an offline player and a world name

neon nymph
#

It's not in my depend of vault, which is 1.7

#

But idk

young knoll
#

Says it’s been deprecated as of 1.4

neon nymph
#

It doesn't say deprecated in the javadoc

neon nymph
#

Same goes for blockRedstoneEvent, but you'd probably need a way to save who placed the redstone blocks though

solar sable
#

does anyone know how to update a task? can you show me an example of the code? i literally dont understand from the spigot help forum

plain oxide
#

How to balance team functionality with Individual player Scoreboards

solar sable
#

Why dont this work?

#

the repeat task i mean

#

why is "this" not working?

neon nymph
#

Because "this" is not a JavaPlugin

#

Get the instance of your main class, the one that extends JavaPlugin, and put it there

#

"this" references the class it is in. You can use "this" if the line of code is inside your JavaPlugin class itself, because in that case, "this" is referencing the JavaPlugin.

#

You can do so by adding a JavaPlugin field in your PlayerScoreboard class and add a new Plugin p parameter to your constructor

solar sable
#

ah okay

#

thank you

carmine nacelle
#

I don't undertand how to read the spigot docs that well.

#

I know it's BlockData but like.. how do you get Directional from BlockData

neon nymph
#
Plugin plugin;
    
SomeClass (..., Plugin pl) {
    ...
    plugin = pl;
}

After that, you can now use plugin as Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, ...);

solar sable
#

what do i put as the SomeClass ?

neon nymph
#

Oh, you don't have a constructor

#

Create a static plugin field

solar sable
#

i know this is wrong by seeing it :)

neon nymph
#

Since your openScoreboard is static. Just noticed that now

solar sable
#

static?

#

like the ~~ thing?

#

well i just want to repeat the playerscoreboard so it updates every tick/seconds idrc i just need it to update

neon nymph
#

Do this instead

solar sable
#

okie

neon nymph
#
static Plugin p;

public static void setPlugin(Plugin plugin) {
    p = plugin;
}
#

Then in your onEnable() class, insert PlayerScoreboard.setPlugin(this) somewhere.

solar sable
#

okay

solar sable
#

in Main class that has the JavaPlugin or the scoreboard class

neon nymph
#

Anywhere in your scoreboard class

solar sable
#

okie dokie

neon nymph
#

I hope after all this you'll try to understand how these things work

solar sable
#

ill put it at the top

solar sable
#

Tip: I learn better from watching how its done while they explain it ;) thats why i watch tutorial videos

neon nymph
#

Yeah most of us are visual learners

#

Once you've done all that, you can now replace your "this" to "p", the variable we just set up.

solar sable
#

its giving me an error

#

hold on lemme show

#

this and also

terse anvil
#

hello

solar sable
#

also this

neon nymph
#

What does the problem say

solar sable
#

i dont know which one to even click lol

neon nymph
#

Don't import that package lol

#

Import bukkit's

solar sable
#

then what to fix?

#

so org.bukkit.Plugin; ?

neon nymph
#

Yep

neon nymph
solar sable
#

change unknown package? you mean the "Change 1st parameter of method " thing or?

neon nymph
#

At the very top of your PlayerScoreboard class, you'll see import jdk.tools.jlink.plugin.Plugin. Delete that and replace it with bukkit's plugin package.

solar sable
#

okay thank you

neon nymph
#

Lemme reiterate, understand these stuff and maybe watch some basic java videos

lavish hemlock
#

It's specifically a JDK-exclusive package under the jdk.jlink module that contains the API and implementation of the jlink tool.

#

It's basically pseudo-internal, as it is designed as an internal package (given the fact the name starts with jdk), but also open for plugins via its API, which is where jdk.tools.jlink.plugin.Plugin comes from.

carmine nacelle
#
        new BukkitRunnable() {
            boolean switchColor = false;
            public void run() {
                if(player != null) {
                    for(int curSlot = 0; curSlot < holoLineGUI.getContents().length; curSlot++) {
                        if(holoLineGUI.getItem(curSlot) == null || holoLineGUI.getItem(curSlot).getType().equals(Material.WHITE_STAINED_GLASS_PANE) || holoLineGUI.getItem(curSlot).getType().equals(Material.GREEN_STAINED_GLASS_PANE)) {
                            switchColor = !switchColor;

                            if(switchColor) {
                                holoLineGUI.setItem(curSlot, createPlaceholderItem("white"));
                            } else {
                                holoLineGUI.setItem(curSlot, createPlaceholderItem("green"));
                            }
                        }
                    }
                } else {
                    cancel();
                }
            }
        }.runTaskTimer(cadiaCore, 0, 5);

I'm trying to get my items to alternate between green/white item panes, it changes once but then stops, it's not cancelling the runnable

#

I don't get what im doing wrong

lavish hemlock
# neon nymph ```java Plugin plugin; SomeClass (..., Plugin pl) { ... plugin = pl...

Anyway, maybe don't use syntactically incorrect pseudocode with Java beginners who aren't used to it yet.
A better example of what you should do is:

public class PlayerScoreboard {
    private final Plugin pl;

    public PlayerScoreboard(Plugin pl) {
        this.pl = pl;
    }
}

Granted, this would not work in amxyar's case bc of openScoreboard being static.

quaint mantle
#

what about build.gradle in api

#

should i just depend all nms versions ?

lavish hemlock
#

y'know

#

an easy solution to the fuckin' nightmare that is NMS-specific modules

#

is just a better language or buildsystem supporting conditional compilation

opal juniper
#

lol true

lavish hemlock
#

why does Gradle not have this?

opal juniper
#

shrug more of a maven guy myself

lavish hemlock
#

actually in all fairness

#

these buildsystems don't touch the source or compiled classes at all

#

there's no compiler injection or anything

#

since for a system to even work well with conditional compilation, you need annotations

carmine nacelle
#

Anyone know my issue...?

#

it's only changing the colors twice then stopping, even though the runnable should be running constinuously.

lavish hemlock
#

imagine 🥺

class NMSImpl {
    void nms() if (build["nms"] == "1.16") {

    }
}

this is what my ideal lang looks like :)

#

(build would basically be a global variable that stores buildsystem information and can be accessed from a conditional compilation clause)

carmine nacelle
#

figured it out.

ivory sleet
#

@quaint mantle

#

I wrote about it, the dependency hierarchy is unidirectional

quaint mantle
ivory sleet
#

For api?

quaint mantle
#

yes

ivory sleet
#

Nothing really

#

I guess you could have the spigot api there

#

But it’s an api

#

It shouldn’t depend on anything

quaint mantle
#

what version ?

#

i could put

#

1.8.8 i guess

ivory sleet
#

the version +

quaint mantle
#

ok

#

what does the + do ?

ivory sleet
#

The latest afaik

#

But then in each nms module

#

You’d override it with a specific version of the spigot api

#

Or well spigot dependency

quaint mantle
#

for test

#

it is only this

#

and should i

#

use the shadow jar plugin

#

for each depend ?

ivory sleet
#

No

quaint mantle
#

just the main ?

ivory sleet
#

Only for rootproject yes

quaint mantle
#

and can i use the rootproject

#

as the plugin module ?

#

like no plugin module

ivory sleet
#

Don’t

#

The root project should handle the building of your jar, the plugin module is just as said the module which binds everything together

quaint mantle
#

so the plugin build.gradle

#

what should it be

ivory sleet
#

I told you that also

quaint mantle
#

just depend

#

the

#

//build.gradle in plugin
dependencies {
implementation project(':api')
implementation project(':v1-8-r3')
implementation project(':v1-16-r3')
}

#

yes ?

ivory sleet
#

The spigot api also

#

With the version + probably

quaint mantle
#

im using files

#

liek this

ivory sleet
#

Dafuq

#

Maven local boi

quaint mantle
#

with maven local

#

i cannot use multiple versions

ivory sleet
#

Yes you can lol

quaint mantle
#

and

#

the src in rootproject

#

should i move it

#

to

#

plugin ?

ivory sleet
#

The entire nms module system is the entire motive for using multiple versions

#

If you just have one module like that which depends on all spigot versions this is all in veins

#

And depending on all one spigot versions like that simultaneously is not a good idea either

#

Since IntelliJ can only depend on one version of a class per module really

quaint mantle
#

so

#

should i remove

#

the src

#

in rootproject

#

and in the build.gradle

#

should i depend spigot + ?

ivory sleet
#

Yeah

quaint mantle
#

and implementation project(':plugin')

ivory sleet
#

Cant you just upload it to github and I’ll check out what’s not right

quaint mantle
#

no sorry i cant

#

can i just send the build.gradle files ?

ivory sleet
#

Not really enough, it’d be good if I can see the actual system of your files

quaint mantle
#

compileOnly ('org.spigotmcspigot+')

#

bruh emoji

#

compileOnly ('org.spigotmc:spigot:+')

ivory sleet
#

Anyways I can send you an old project of mine demonstrating how it’s done

quaint mantle
#

why it is not working

ivory sleet
#

Because you need to have mavenLocal() as a dependency

#

Or repository I mean

lavish hemlock
#

page no exist

#

why you lie to me

ivory sleet
#

What’s ur gh name pmzhero

#

It’s private

quaint mantle
#

PmzHeroV69

lavish hemlock
#

why you private to it

#

:(

ivory sleet
#

Idk never got it done with

#

So couldn’t bother

lavish hemlock
#

I don't create a repo till a project is either done, or in a state where I wanna show it to people.

ivory sleet
#

I think I just wanted contributions at that point of time

lavish hemlock
#

I deleted like 52 old repos the other day bc I tended to make a lot of unnecessary repos for projects I'd never finish, or just didn't want to show off bc they were trash.

ivory sleet
#

So that’s why I pushed literally everything but making it private

#

lmao

ivory sleet
#

Just click the link now

quaint mantle
#

ok

#

where is the lychee-implementation src

ivory sleet
#

As said never got it done with

#

But it would be equivalent to your plugin module

quaint mantle
#

so the lychee-implementation

#

is the plugin ?

ivory sleet
#

Yes

quaint mantle
#

@ivory sleet so the resources folder

#

will it be applied ?

#

cause these things

ivory sleet
#

**/plugin.yml

#

But yeah

#

The resource sourceset should be applied, why wouldn’t it?

quaint mantle
#

ok

#

when im done i will upload it to a private repo

ivory sleet
#

Alright

quaint mantle
#

what is the lychee-compat

#

?

#

and the api

ivory sleet
#

The api is the module with the interfaces

#

Ignore the lychee compat

quaint mantle
#

ok

ivory sleet
#

But it served as a layer between the nms modules and the plugin module

quaint mantle
#

is there any reason why my .main package imports just wont work...?

#

nothing from my .main package imports

#

unresolved

lavish hemlock
#

can you show the contents of DiscordWebhook as well as the error you get when you try to import the class from your package?

quaint mantle
#

here's another one

lavish hemlock
#

that looks like a warning as opposed to an error

quaint mantle
#

i just made a new class that has some private's in it... i've never used privates

#

should i remove that class and see what happens?

lavish hemlock
quaint mantle
#

i removed the class (i didnt really need itú

lavish hemlock
#

Also... you should use privates, lol

quaint mantle
#

its just really weird because it happened right after i added the class with the privates

quaint mantle
lavish hemlock
#

it just results in better code is all

#

considering your IDE inspections aren't fuckin' crowded with non-essential fields

#

(which is important for API users as well, if you ever make one)

#

(otherwise you run into one of those Python issues where everything is visible so you don't know what you actually need)

quaint mantle
#

ok

#

i'll keep that in mind

#

however, any idea whats going on with my main package

lavish hemlock
#

I feel like blaming Eclipse bc I'm pretty sure I've had this exact issue before when using Eclipse

quaint mantle
#

ah

#

it makes no sense, the errors... just tbh

lavish hemlock
#

where are you importing stuff at? another package or another module of the project?

quaint mantle
#

so i really doubt i did something wrong

quaint mantle
lavish hemlock
#

no I mean

#

the location of your classes that import your other classes

quaint mantle
#

different packages

#

com.ankledev.nectar.bot

#

.serverevent

#

etc..

lavish hemlock
#

show me your file inspector in Eclipse

quaint mantle
#

my what

#

homie i use eclipse for one thing

lavish hemlock
#

the thing on the left that shows your project's files

quaint mantle
#

idk how to do that

#

ohh

#

How can i get a itemstack from the enderPearl in ProjectileHitEvent?

@EventHandler
    public void enderpearlHit(ProjectileHitEvent event) {
        if (event.getHitEntity() == null) return;
        if (!event.getEntity().getType().equals(EntityType.ENDER_PEARL)) return;
        if (!(event.getEntity().getShooter() instanceof Player)) return;
        event.setCancelled(true);

        Projectile enderPearl = event.getEntity();
        Entity hitEntity = event.getHitEntity();
        Player shooter = (Player) enderPearl.getShooter();
        throwers.add(shooter.getUniqueId());

        // Get a ItemStack from the enderPearl

//        hitEntity.remove();
    }
#

all of the errors are regarding DiscordWebhook, or WorldGen

#

sorry .bot has a lot of classes

#

because JDA is kind of a pain

lavish hemlock
quaint mantle
#

im a noob to JDA tbh but like

#

it is working... soooo

lavish hemlock
#

yeah sorry I have no idea what's wrong

#

although if I may offer a few critiques?

quaint mantle
#

not now

lavish hemlock
#

lmao

quaint mantle
#

i dont think i could emotionally handle that right now

#

im sorry

#

one question

#

regarding JDA

#

because like, i hate their Discord server

#

people r like cHecK thE dOCs

#

like "K????"

#

ok so

#

the User events

#

they only fire for me ???

tacit drift
#

No lol

quaint mantle
#

yes, lol

#

i literally changed my alts name, then changed mine

#

only logged the name change for me

ivory sleet
#

The user events are generic for all users?

quaint mantle
#

i can record it if you want, but i can promse u rn

#

the user events only fire for me

tacit drift
#

nope

quaint mantle
#

UserActivityStart, thats for an auto-announce for people streaming

#

a few people are streaming right now

#

no announcement

ivory sleet
#

Sounds weird, does your bot have all permissions needed?

quaint mantle
#

yeah it has admin

solar sable
#

hey @neon nymph sorry for ping but i have some error

tacit drift
#

You need to use methods that are for cache

quaint mantle
#

java.lang.IllegalStateException: Not scheduled yet
getting this error

BukkitScheduler scheduler = plugin.getServer().getScheduler();
        scheduler.scheduleSyncRepeatingTask(plugin, new BukkitRunnable() {
            int count = 0;
            @Override
            public void run() {
                if (count < 16){
                    count++;
                }
                else {
                    this.cancel();
                }
            }
        }, 0L, 1L);```
#

okay

quaint mantle
#

educate please lmao :(

tacit drift
#

I had the same issue when i was trying to get number of users from all guilds the bot was in

quaint mantle
#

!paste

#

im pretty sure im enabling cacheflags right

#

i want them all on tbh

#

so i just sorta assumed that would do the thing

#

.paste

tacit drift
#

One method was using cache, the other wasn't or something like that, and I was getting 7 users instead of 7000~

quaint mantle
#

what is prefix

undone axleBOT
ivory sleet
#

?paste

quaint mantle
#

oh

ivory sleet
#

Lol

solar sable
#

can someone tell me what is still the problem here? i knwo the Plugin is static but idk what is problem

#

know*

quaint mantle
#

I am already checking for it in if (!event.getEntity().getType().equals(EntityType.ENDER_PEARL)) return;

#

JDA user events only firing for the bot owner..?

#

i'm just gonna do that

#

bc there's 10000 people who need help

solar sable
quaint mantle
#

okaay

ivory sleet
solar sable
#

at where?

ivory sleet
#

^

solar sable
#

okay

quaint mantle
#

threads plx

#

I sent the full error

ivory sleet
#

?scheduling

undone axleBOT
ivory sleet
#

I want you to check that out 0_NiX

solar sable
#

still static

#

here is the full thing just cause its better for you to help

#

the one that has JavaPlugin?

#

testing is the name with caps

#

Testing

#

hmm das weird

#

it still has the weird ~~~ thing

lavish hemlock
#

You mean it's deprecated?

solar sable
quaint mantle
#

It doesn't update the item name in the inventory. How can i update it?

@EventHandler
    public void enderpearlHit(ProjectileHitEvent event) {
        if (event.getHitEntity() == null) return;
        if (event.getEntity().getType() != EntityType.ENDER_PEARL) return;
        if (!(event.getEntity().getShooter() instanceof Player)) return;
        event.setCancelled(true);

        EnderPearl enderPearl = (EnderPearl) event.getEntity();
        ItemStack enderPearlItem = enderPearl.getItem();
        ItemMeta enderPearlItemItemMeta = enderPearlItem.getItemMeta();

        Entity hitEntity = event.getHitEntity();
        Player shooter = (Player) enderPearl.getShooter();

        throwers.add(shooter.getUniqueId());

        enderPearlItemItemMeta.setDisplayName("Works");
        enderPearlItem.setItemMeta(enderPearlItemItemMeta);

//        hitEntity.remove();
    }
lavish hemlock
#

Do Testing.class, not Testing.getClass()

solar sable
#

okay

#

now its at the () lol

lavish hemlock
#

...then don't put the () bc we didn't tell you to?

solar sable
#

oh my bad

lavish hemlock
#

it's not a method, it's a keyword

solar sable
#

Okay thank you guys so much!!!

#

<<33

#

double heart for all of you

#

okie dokie

lavish hemlock
#

To sum it up:

solar sable
#

finally i have my scoreboard working

lavish hemlock
#

If you see something gray in your editor, IDEA in this case

solar sable
#

yey

lavish hemlock
#

Just hover over it, it means you can improve it somehow

#

If it's underlined in yellow, it's a warning (not exactly an error, but should still be taken care of if necessary)
If it's underlined in red, it's an error (fix it or else your plugin literally won't compile)

#

mmmmm

#

when you call an error

#

a ~~~

#

you don't know what an error is

#

I initially thought of a deprecation warning bc of the strikethrough but nope

#

yourmom

quaint mantle
#

?jd

quaint mantle
#

Something like a pokeball

#

I want to get the item player throwed and change the name and stuff iin his inventory

#

idk if i would have to use the ProjectileLaunchEvent and put some map or stuff

#

holy fucking god i frogot how much i hate most the people in the JDA discord

#

specifically the #help channel there

#

jesus christ

#

??????

#

so i should use launch

#

anyone good with JDA

#

okay

#

@ivory sleet i have a problem

#

in my plugin module