#help-development

1 messages · Page 1589 of 1

eternal oxide
#

I've no idea where you are removing it from

grim ice
#

files

#

it was a whole class

#

that extended JavaPlugin

#

lol

#

I deleted it

unkempt ore
#

How do I check if an entity has been killed? Because isDead() doesn't seem to be acting the way I want

unkempt ore
#

I don't think an Egg has health

grim ice
#

lmao

unkempt ore
#

I said Entity

#

Not LivingEntity

grim ice
#

true

eternal oxide
#

Now to use that class you just java RecipesManager manager = new RecipesManager(this); manager.addRecipes();

unkempt ore
#

Or make it a field, passing it this still

#

Unless all you do with the manager is within one method scope

grim ice
#

o

eternal oxide
#

lets not go Fields and passing this at creation just yet 🙂

summer scroll
#

new RecipesManager(this).addRecipes();

#

one line ez xd

grim ice
#

@unkempt ore also use a projectile hit event then check that the projectile is an egg

unkempt ore
grim ice
#

@eternal oxide

#

i already have

#

private RecipesManager recipies = new RecipesManager(this);

grim ice
#

recipies.addRecipes();

unkempt ore
#

An egg could die under more circumstances than landing

summer scroll
unkempt ore
#

It's acting odd

#

I'm doing a little sanity check on the distance from the player. That's my last doubt. But this is a timer task every tick

grim ice
summer scroll
#

thats it then

grim ice
#

Field 'recipies' may be 'final'

#

is a warning

summer scroll
#

yeah you could make it final

#

whatever

unkempt ore
#

Not a warning, more of a suggestion

grim ice
#

yeah ig

#

but intelliJ says its a warning

unkempt ore
#

Do it though

grim ice
#

🤷

#

i did

#

before asking

#

lul

gritty urchin
#

How would I get the co-ordinates for the edge of a client hitbox?

unkempt ore
#

Feel like the bounding box would have something to do with that

grim ice
#

@unkempt ore btw

#

did u try ProjectileHitEvent

unkempt ore
#

No

grim ice
#

try it

unkempt ore
#

No

grim ice
#

ok

unkempt ore
#

I already told you, landing is not the only way to die

#

And I'm not even inside an event

grim ice
#

oh

#

okay

#

also

unkempt ore
#

I'm in a timed task that needs to cancel itself if it sees the that egg has died

grim ice
#

@summer scroll@eternal oxide

#

the plugin still doesnt work

#

lol

unkempt ore
#

Very informative

#

What's the error

grim ice
#

It doesnt give errors

#

NeVERMIND

#

my friend who was testing is dumb

#

/paste

#

?paste

undone axleBOT
grim ice
#

@unkempt ore

#

waiittt

#

dont tell me

#

ITS 1.16

unkempt ore
#
Unsupported API version 1.17
grim ice
#

1.17

#

LMFAO

unkempt ore
#

It could not be clearer

#

Use your eyes

grim ice
#

i hate intelliJ

unkempt ore
#

Bro what

#

How is that IJ's fault

grim ice
#

when i clicked previous

#

it resettted it

unkempt ore
#

Resettted what

grim ice
#

i chose 1.16.5 but when i clicked next then previous

#

it resetted the version i selected

unkempt ore
#

Cringe

summer scroll
#

so youre using like a spigot development plugin on IJ?

grim ice
#

hm?>

#

yes i guess

#

it makes starting projects easier

#

is it wrong to use it?

summer scroll
#

its not wrong but its bad for beginner

#

it makes you dont know how to set it up yourself without the plugin.

#

well, thats just my opinion

full holly
#

how can I make a raw message on bungeecord? (BungeeCord Plugin)

grim ice
#

its easy though

#

lol

#

@unkempt ore sry for pinging but

#

i searched more

#

ProjectileHitEvent is the only way

#

do whatever u like tho

unkempt ore
#

I just said I'm not even in an event, though

#

The timer task needs to periodically check if the egg has died

#

Died, not hit

grim ice
#

how is an egg

#

supposed to die

unkempt ore
#

Kill

grim ice
#

its supposed to break?

unkempt ore
#

Being removed by another plugin

#

Killed

#

With commands

grim ice
#

hmm

unkempt ore
#

This is important. I need to make sure the timer task stays alive for as long as the egg is alive. Not doing this will result in timer task leaks

#

Causing lag

grim ice
#

true

unkempt ore
#

Because it doesn't know when to stop running

grim ice
#

then I have no clue how you're gonna do that, but if you figure it out you're a legend

unkempt ore
#

I mean, isDead() seems to be the way

#

But somehow, I don't know, it's being awful to me

#
@Override
public void run()
{
    if (egg.isDead())
    {
        // This code ran when the egg died
        cancel();
        return;
    }

    // This code NEVER ran for some reason

    var eggLocation = egg.getLocation().clone();
    var distanceFromPlayer = eggLocation.distance(playerLocation);

    if (distanceFromPlayer < distance)
    {
        eggLocation.getBlock()
                   .setBlockData(blockData);
    }
    else
    {
        egg.remove();
        cancel();
    }
}
#

So, something really weird seems to be going on here. I set up a debug print inside the isDead() check, and that one actually prints when the egg lands. I set prints after this check though, and none of them ran

#

None

#

And this is running every tick, started when the egg is thrown

chrome beacon
#

So it does stop

#

?

unkempt ore
#

It does stop, yes, but nothing after the stop check runs, it seems

#

I set up debug prints after the first if statement, and they never ran

#

It does not make sense at all

chrome beacon
#

You're returning after cancelling?

unkempt ore
#

Yes, because I don't want the function to continue running one more time

#

I want it to die right on the spot

#

cancel() doesn't stop the current method's execution

chrome beacon
#

It doesn't stop but you're calling return causing it to stop

#

or am I miss understanding something here

unkempt ore
#

Yes, it would seem

#

Let me reiterate. It stops fine. When the egg lands, that cancel runs because I set up a print statement there and it printed

#

However, outside of the if (after it), I set up a print, and it never printed

cinder plume
#

Guys I need help , whats the corrct function or method to add a potion effect to a player

cinder plume
unkempt ore
#

@chrome beacon I commented my code above to make it clear

cinder plume
#

ill send the codeblock

#

if (sender instanceof Player) {
Player player = (Player) sender;
player.addPotionEffect((new PotionEffect(PotionEffectType.BAD_OMEN, 999, 1)));
}

What is wrong in this method used?

#

?

unkempt ore
#

```java
Your code here
```

cinder plume
#

huh xD

unkempt ore
#

No no, back ticks

granite stirrup
#

.
```java
Code
```

unkempt ore
#

Next to 1

cinder plume
#
        if (sender instanceof Player) {
            Player player = (Player) sender;
            player.addPotionEffect((new PotionEffect(PotionEffectType.BAD_OMEN, 999, 1)));
        }
#

here

#

what have i done wrong here

#

in the potion method

granite stirrup
#

you cant do 999

summer scroll
#

nothing wrong i guess

unkempt ore
#

255

granite stirrup
#

it goes up to 255 pretty sure

cinder plume
#

255 is unlimited right

summer scroll
#

huh, thats the duration right?

unkempt ore
#

Not unlimited

granite stirrup
unkempt ore
#

But the max

cinder plume
#

yes 255 is in the duration slot

#

how do i make a potion effect unlimited

summer scroll
#

duration and then amplifier

unkempt ore
#

Ahh

summer scroll
cinder plume
#

so instead of using 255 i put Integer.MAX_VALUE right?

chrome beacon
summer scroll
cinder plume
summer scroll
#

thats the amplifier

unkempt ore
#

That is the point

#

I'm telling you it never ran

summer scroll
#

amplifier cannot go over 255

grim ice
#

Anyone has an idea of how can I make the custom recipe I made show in the recipe section of minecraft (It does only after you craft it)

cinder plume
#

No no no , my amplifier is 1

#

duration is 255

#

duration is 999**

unkempt ore
#

This is inside a timer task every tick @chrome beacon

summer scroll
#

yes, change to duration to Integer.MAX_VALUE for unlimited duration

chrome beacon
#

So it never runs even if the egg isn't dead

unkempt ore
#

Yes

cinder plume
#

wait

unkempt ore
#

It makes no sense

grim ice
#

max duration is 999,999 isn't it

cinder plume
#

this is what it is rn

granite stirrup
#

theres unnecessary brackets

#

pretty sure

unkempt ore
#

Use Java 16

cinder plume
#

it becomes like this thne

unkempt ore
#
if (sender instanceof Player player)
chrome beacon
unkempt ore
#

Right where they are

granite stirrup
#

player.addPotionEffect(new PotionEffect(PotionEffectType.BAD_OMEN,999,1));

summer scroll
grim ice
#

Anyone has an idea of how can I make the custom recipe I made show in the recipe section of minecraft (It does only after you craft it)

granite stirrup
#

ShapedRecipe i think?

unkempt ore
#

No, no

grim ice
#

I did it

unkempt ore
#

He wants it to show up in the book

grim ice
#

as operation said

#

Shaped Recipe is the type of the recipe

cinder plume
grim ice
#

afaik it can be Shapeless or shaped

unkempt ore
#

Yes

chrome beacon
unkempt ore
#

I'm so confused man

grim ice
#

@granite stirrup what's your problem

unkempt ore
granite stirrup
granite stirrup
unkempt ore
#

Idk

grim ice
#

It doesn't except if u craft the recipe

#

like if you have never crafted it

#

it does not show up

grim ice
#

Oh Nice

#

Elgar you never fail to help

#

such a great guy

eternal oxide
unkempt ore
#

I proved it

#

I put debug prints there (right where the comments are)

unkempt ore
#

The second one never ran

eternal oxide
#

literally right after the isDead test block?

grim ice
#

a meta for Books if im not wrong

unkempt ore
#

Yes. I am sure I'm going insane

gritty urchin
#

How would I get the co-ordinates for the edge of a client hitbox? 1.8.8

granite stirrup
grim ice
#

you use this in like

#

BookMeta bookMeta = (BookMeta) writtenBook.getItemMeta();

eternal oxide
#

I believe you are too

unkempt ore
#

Let me do it one more time

cinder plume
#

Whats going on here?

robust forge
#

Can anyone help me?

@EventHandler
public void onItemHeld(final PlayerItemHeldEvent e) {
   if(!e.getPlayer().getInventory().getItem(e.getPreviousSlot()).hasItemMeta()) {
      return;
   }
}

java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.hasItemMeta()" because the return value of "org.bukkit.inventory.PlayerInventory.getItem(int)" is null

eternal oxide
#

getItem is returning null

robust forge
#

Yea but why?

cinder plume
eternal oxide
granite stirrup
cinder plume
summer scroll
#

no item involved basically

cinder plume
#

My console error goes as follows -
java.lang.NullPointerException: null
at me.arjunraid.theraidgame.Theraidgame.onEnable(Theraidgame.java:10) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-640]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]

unkempt ore
#

Okay, is there something I don't understand about BukkitRunnable#runTaskTimer?

#

It runs the run() method once every period ticks right?

eternal oxide
#

Theraidgame.java:10 is null

cinder plume
eternal oxide
#

No clue without knowing what that line of code is

granite stirrup
cinder plume
#

Ok wait ill send the code for the onEnable and the class

eternal oxide
#

?paste

undone axleBOT
granite stirrup
#

and you will get answer

robust forge
# granite stirrup if its null it means its empty

I tried this too, how can I fix the error? This didnt do the job

public void onItemHeld(final PlayerItemHeldEvent e) {
    if(e.getPlayer().getInventory().getItem(e.getPreviousSlot()).equals(null)) {
        return;
    }
    if(!e.getPlayer().getInventory().getItem(e.getPreviousSlot()).hasItemMeta()) {
        return;
    }
}```
granite stirrup
#

try == null

eternal oxide
robust forge
#

Oh truuu

cinder plume
#
public final class Theraidgame extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("arjraid").setExecutor(new arjraid());
    }

}

That is my main , didnt copy paste the imports

public class arjraid implements CommandExecutor{

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            player.addPotionEffect(new PotionEffect(PotionEffectType.BAD_OMEN,999,1));

        }
        else{
            System.out.println("Nah fam , player only command~!");
        }
        return false;
    }
}

class

hybrid spoke
#

nice classnames

robust forge
eternal oxide
granite stirrup
full holly
#

How can I get the uuid (with the Minecraft Name) on bungeecord? The Player is offline

unkempt ore
# eternal oxide correct

So...call me insane but, I placed a print before the if check this time too. I'm running this task timer every tick. It only printed "Before", and "Inside" once, when the egg landed

unkempt ore
#

Both at once

granite stirrup
cinder plume
eternal oxide
cinder plume
waxen barn
#

bump

summer scroll
#

elgar you forgot yoru

eternal oxide
#

thats arjunraid not arjraid

granite stirrup
#

LOL

#

how tf can you mess up this bad

cinder plume
#

oof wait

#

wait but that is the package name

eternal oxide
unkempt ore
#

Would they show up in logs by default?

eternal oxide
#

all the code in the run()

unkempt ore
#

It's doing this silently

eternal oxide
#

yes usually, but your code is not behaving so don;t trust it

cinder plume
eternal oxide
cinder plume
#

so its there tho innit?

unkempt ore
#

When the egg lands

eternal oxide
#

yep, try/catch and see whats happening

eternal oxide
unkempt ore
#

Nothing is happening

#

Absolutely nothing

summer scroll
unkempt ore
#

May I DM you, elgar?

eternal oxide
#

I have everyone blocked from DM's as I hate people 🙂

unkempt ore
#

Yes, that is why I'm asking

eternal oxide
#

jump in text

unkempt ore
#

What?

eternal oxide
cinder plume
#

@summer scroll im a bit confused can you help me in the dms , would be greatly appreciated

summer scroll
#

no need

#

its a simple problem

#

youre trying to register arjraid not arjunraid

cinder plume
#

yes , bcuz arjraid is the class where the command is so im using it for the command executor

summer scroll
#

just change it to this.getCommand("arjunraid")...

cinder plume
#

and keep .setExecutor(new arjraid()); ?

summer scroll
#

yes thats it really

cinder plume
#

ok wait

summer scroll
#

because you have arjunraid as the command on the plugin.yml

cinder plume
#

ok wait

grim ice
#

How do I make a custom recipe have more than 1 item in a slot

#

like If i want 2 diamonds in 1 slot

cinder plume
#

@summer scroll thanks it worked~

#

I need to understand stuff properly now

livid tundra
summer scroll
#

ExactChoice recipe maybe?

grim ice
#

but i dont want to use it because its a pain in the ass

grim ice
full holly
summer scroll
granite stirrup
full holly
granite stirrup
#

all i know is you have to use nms for it

full holly
#

can I also get with mojangapi?

granite stirrup
#

mojangapi?

summer scroll
# grim ice how?

the default crafting system is using material not itemstack, so you need manually check the amount.

full holly
grim ice
#

Bruh

granite stirrup
#

¯_(ツ)_/¯

grim ice
#

cant i make an item stack

granite stirrup
#

not even related code

#

pretty sure

#

wait whats PAPIExpansion

#

isnt that a papi class i dont think you can just do new PAPIExpansion()

summer scroll
#

its his own class

granite stirrup
#

pretty sure it a interface or abstract class

summer scroll
#

that extends PlaceholderExpansion

granite stirrup
#

show PAPIExpansion code @weary geyser

crude sleet
#

I found the mistake, it was not the Database. I use an API from a buddy for inventorys but the brewing inventory got changed in the 1.17 spigot api. I don't know what was changed in the brewing stand inventory in 1.17, but I tried a different inventory type (a normal inventory) and everything goes normally 😄

undone axleBOT
gritty urchin
#

How to get eye position location

#

Spigot 1.8.8

summer scroll
#

what about your main class, that register the expansion

#

show it too

granite stirrup
granite stirrup
summer scroll
#

the class that register the expansion

granite stirrup
#

looks a little different

summer scroll
#

not the papiexpansion class

granite stirrup
#

yours has onPlaceholderRequest and in the example its onRequest

summer scroll
#

just incase the imports were wrong perhaps?

#

oh its that from the new api?

#

it was onPlaceholderRequest

#

iirc

#

is the import correct? im afraid that there is a class named PAPIExpansion from PAPI

granite stirrup
#

there is a think

#

lol

summer scroll
#

well just incase

#

because the error is kinda weird

#

never have an error like that before

granite stirrup
#

¯_(ツ)_/¯

summer scroll
#

did you depend on papi?

#

or softdepend maybe

granite stirrup
#

what if he has newer api older papi or older api and newer papi?

#

lol if you have papi do /daddy

summer scroll
#

could be yeah xd

#

ok one last try, maybe try to change your class name lol

#

to SkyCoinsExpansion maybe, idk

#

i once have a problem like that too

#

idk why

quaint mantle
#

hello

#

how do i can list all players name.

granite stirrup
#

loop through every player and get they display name

quaint mantle
#

like:
1- Jack
2- Max
3- etc..

#

well i'm new in spigot api development can you help me with that @granite stirrup

#

how do i can loop it

granite stirrup
#

?learnjava

undone axleBOT
quaint mantle
#

i just want code for list players

#

😅

granite stirrup
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

hybrid spoke
#

yeah so code it yourself

granite stirrup
#

tho i can give you a little bit of info

hybrid spoke
#

there is a #getOnlinePlayers method which returns a list with every player online. use a for loop, loop through and send the command sender a message for each player with the name in it

granite stirrup
#

if you want to include offlineplayers tho getOfflinePlayers()

#

so learn java

#

and also check the javadocs for spigot

#

?jd

granite stirrup
#

its handy

unkempt ore
#

Bukkit.getOnlinePlayers().stream().map(Player::getDisplayName).collect(joining(", "))

granite stirrup
#

he doesnt even know for loops

#

XD

unkempt ore
#

Welp

pure glacier
#

yh let alone method references

granite stirrup
#

why would he know about streams

paper geyser
#

I like to read through here to maybe learn a thing or two and I didn't know about streams before and looking it up I don't quite understand what it is haha

#

if someone could give a basic explanation or send a link that gives a basic explanation that would be much appreciated :)

unkempt ore
#

I'll handle this

paper geyser
#

thank you :)

unkempt ore
#

Basically the stream API is a Java framework given to us in Java 8 which, when used properly (such as above) can make functional operations much more clean and concise

#

Now do you know what a lambda is?

paper geyser
#

kind of? I remember learning about them

unkempt ore
#

It's an anonymous function implementing a special interface iternally

paper geyser
#

ahhh

#

theyre used in arraylists right?

#

like forEach

unkempt ore
#

Now, bad example, but say you have a collection of strings, and you want to make all of them uppercase, and then print them. With no streams:

for (var s : strings)
{
  System.out.println(s.toUpperCase());
}

With streams:

strings.stream()
       .map(string -> string.toUpperCase())
       .forEach(string -> System.out.print);
#

You'd want to do the top, as its clearer, but this is just to show you the difference between both

granite stirrup
#

does streams even make a difference

unkempt ore
#
trings.stream()
       .map(String::toUpperCase)
       .forEach(System.out::println);
unkempt ore
granite stirrup
#

f

unkempt ore
#

But maintainability wise they can be very nice when used properly

#

And to use them properly, you must use them functionally

granite stirrup
#

so that means just use for loops?

paper geyser
#

so its just a way to have something else happen to it

unkempt ore
#

No

#

Are you aware of the functional paradigm (at idk)?

granite stirrup
#

dont think so never heard of it lmao

paper geyser
#

yeah haha

#

idk either

unkempt ore
#

It basically means taking an input and making an output. Nothing else. You do not depend on state, and you do not modify state

granite stirrup
#

i just learned by looking at forums and tutorials and learned things myself

unkempt ore
#

Processing data, for example

#

Streams are very good for this

grim ice
#

e.getPlayer().discoverRecipe();

#

how to use

#

e.getPlayer().discoverRecipe();

#

when i do

granite stirrup
#

i dont use streams cuz i dont know how to use them

unkempt ore
grim ice
#

e.getPlayer().discoverRecipe("zombie");

#

it says invalid

unkempt ore
#

With a bunch of theory

grim ice
#

it says it doesnt want a string

#

it wants a namespacedkey

paper geyser
#

yeah so just like "do it in one line if you can"

granite stirrup
paper geyser
#

right?

grim ice
#

but i have a namespacedkey only in my other class

unkempt ore
paper geyser
#

OH

#

no like

granite stirrup
#

new NamespacedKey("minecraft","zombie");?

paper geyser
#

ok i misunderstood

granite stirrup
#

idk if this is how

paper geyser
#

so "if you can handle the input directly do it"

#

or am I still misunderstanding

grim ice
#

help

unkempt ore
#

With streams, you can essentially give operations to it that will go "for each item" in that. It's like dropping a bunch of things down a set of filters

grim ice
#

operation

#

u have an idea

unkempt ore
#

And collecting the end

paper geyser
#

ahh

#

so "grab this from everything here" kind of?

unkempt ore
#

Hmmmm

spark escarp
#

Hey, I'm very new to java and I'm just about ready to finish my first plugin and find out if it works, and I've come across an issue that states there is an "expression expected", does anybody know what is wrong?

spark escarp
#

just copy paste?

paper geyser
#

uhh

grim ice
#

/paste

#

?paste

undone axleBOT
grim ice
#

if its big

spark escarp
#

like the whole project or the line that is broken

grim ice
#

the line

paper geyser
#

line

grim ice
#

just send line here

unkempt ore
#

So say you have a list of players, and you want all players whose name has the letter "A" in them

players.stream()
       .filter(player -> player.getDisplayName().toLowerCase().contains("a"))
       .collect(toList());
spark escarp
#

player.getWorld().playSound(player, Sound.ITEM_TRIDENT_THUNDER, 5, 5,);

unkempt ore
#

The first line is like dropping the players, the second line is the filter they have to pass through, and the third line is where they're collected

spark escarp
#

wait pich and volume didnt send

spark escarp
#

where

grim ice
#

How to use a namespacedkey from a different class

paper geyser
hybrid spoke
#

at the end

unkempt ore
#

Yeah

paper geyser
#

like "this will be filtered"

#

oh ok cool thats super useful

grim ice
#

How to use a namespacedkey from a different class
pls

spark escarp
#

it has one at the end

paper geyser
#

thank you operation!

eternal oxide
unkempt ore
#

That expression will return a List<Player> with the filter applied

grim ice
#

o

unkempt ore
#

A new List<Player> mind you, backed by the Player references

paper geyser
#

ahhh got it

#

again thank you so much!

unkempt ore
#

Yeah

grim ice
#

I'm pretty sure i'll get an insult for being dumb

unkempt ore
#

You could inject them also, like I was @grim ice

spark escarp
grim ice
unkempt ore
#

But it may be cleaner to make a class to hold these keys, make an instance of it in your plugin, and depend on this class that holds the keys in the places in which you need it

grim ice
#

uhhuhuhuh

#

no i dont think so eee

#

since i already made them

#

in a class

eternal oxide
#
private NamespacedKey zombie;
private NamespacedKey skelly;

public RecipesManager(JavaPlugin plugin) {
  this.plugin = plugin;
  this.zombie = new NamespacedKey(plugin, "zombie");
  this.skelly = new NamespacedKey(plugin, "skelly");
}

public NamespacedKey getZombieKey() {
  return zombie;
}```
#

Modify your class like so, and you then then get teh keys

grim ice
#

e

#

this wasn't clear

#

what is blah blah

eternal oxide
#

you create yoru keys there

#

blah blah means put yoru key code there

grim ice
#

I have NamespacedKey key3 = new NamespacedKey(plugin, "enderman");
my reciepsmanager class

#

so i just uh

#

retype that

#

with new

unkempt ore
#

Please do not obfuscate the names like that

spark escarp
#

can anyone please help after you are done helping me after they are done with whatever they are doing I have been working on this error for very long and some people here really seem to know what they are doing lol

eternal night
#

maybe spigot just needs a cute NamespacedKeyContainer

eternal oxide
#

there, simpler

grim ice
#

@eternal oxide 'RecipesManager(JavaPlugin)' is already defined in 'me.hex.onceuncraftable.RecipesManager'

#

e

eternal night
#

?learn

#

aww

#

?java

#

damn

eternal oxide
#

yes, I said modify yoru class, not throw all that code in it as well

grim ice
#

F

grim ice
#

lol

eternal oxide
#

read teh code and look at yours. See where it needs to go

grim ice
#

Okay

eternal oxide
#

then use those keys in teh class, not yoru ones

young knoll
undone axleBOT
eternal night
#

thanks xD

grim ice
#

@eternal oxide

public NamespacedKey getZombieKey() {
    return zombie;
} do i repeat that with eveery namespace i have
#

i have liek 14 or smth

#

e

eternal night
#

|| at some point, a map like structure would probably be better than fields ||

young knoll
#

Probably this point

grim ice
#

uuhuhu

#

a stupid question

#

Can i just

#

implement Listener

#

in my class

#

or wait

#

Nevermind

#

even if i do so ill have the same problem

#

Im confused aaaaaaaaaaa

grim ice
#

It's too much work to start learning from zero again

#

so if u wanna tell me to learn java

eternal night
#

what do you mean, learning from zero 😂

grim ice
#

link me a tutorial on the topic i dont know

eternal night
#

just skip the initial parts ?

grim ice
#

true

#

ok me dumb

#

still uh

#

im confused

#

Elgar you have an idea?

#

of how can i do it without repeating stuff

unkempt ore
#

Can someone help me test my plugin?

#

Yes, it's a virus

eternal night
#

:mind_blown:

#

awwww, no custom emojis

eternal oxide
#

then pull the key based upon name

eternal night
#

an enum might be even better

eternal oxide
#

yep

grim ice
#

e

#

how

eternal oxide
#

busy, cooking wifes dinner

grim ice
#

oo

#

r u using a pc while making dinner

#

cuz ur profile shows ur not using a mobile

spark escarp
#

player.getWorld().playSound(player,Sound.BLOCK_ANVIL_BREAK, 5, 5,); would this work ?

stone sinew
eternal night
#

there is one , too much

spark escarp
#

at the end?

eternal night
#

yea

spark escarp
#

but it underlines eveything in the bracket

#

if i remove that

eternal night
#

mostly because the rest of your arguments don't make sense xD

#

?jd

spark escarp
#

lol

spark escarp
#

oh wait

#

aight im stopid thanks for letting me know ig

eternal night
#

lol

grim ice
#

e help

spark escarp
#

do you also now how I can like have 3 arrows instead of 1

#

when I leftclick the bow

grim ice
#

How to use a namespacedkey I created in a class in a other class???

#

please someone help

chrome beacon
#

.-.

grim ice
#

I searched in all websites i know

#

i found legit nothing

chrome beacon
#

This is part of Java basics

grim ice
#

I know

#

but even in a java tutorial for that

#

i cant figure it out..

paper viper
#

You just define an instance of it…

grim ice
#

How?

paper viper
#

use the constructor

eternal oxide
#

Just do the getters until you are more advanced to know how to use enums

eternal oxide
#

I already showed you

paper viper
#

🥲

grim ice
#

I didn;t understand your explanation

#

i know im dumb ok

eternal oxide
waxen barn
#

bump

grim ice
#

Cannot resolve symbol 'zombie'

#

@eternal oxide I can't understand

waxen barn
eternal oxide
#

Don;t make it static

grim ice
#

i didnt

eternal oxide
#

what is giving you and unresolved symbol?

grim ice
#

zombie

#

and skelly

eternal oxide
#

?paste show some code

undone axleBOT
eternal oxide
#

We'll see how close you got 🙂

grim ice
#

not even a 1 bit close

#

thats my RecipesManager

#

class

eternal oxide
#

you need to add the Fields

grim ice
#

thats what it suggested

eternal oxide
#

same as I showed in the sample code

grim ice
#

private final NamespacedKey skeleton;
private final NamespacedKey zombie;

eternal oxide
#

yep

grim ice
#

im a complete idiot

#

but do i repeat this

#

for all

#

my 14 namedspacekeys?

eternal oxide
#

well, you also need to change yoru code in your addRecipes() method to use getZombieKey() instead of creating a new key in there

grim ice
#

how

#

wait i think i get that

#

uh i prob dont

eternal oxide
#

this line
ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.ZOMBIE_SPAWN_EGG));
would become
ShapedRecipe recipe = new ShapedRecipe(getZombieKey(), new ItemStack(Material.ZOMBIE_SPAWN_EGG));

jade haven
#

is there any way to make mob spawners make them spawn
during the day

#

?

grim ice
#

Oh

#

I have 14 like that

#

public NamespacedKey getZombieKey() {
return zombie;
}

#

i repeat that for each one?

eternal oxide
#

yep, until you are more advanced in Java that is your only option

grim ice
#

ok

shut field
#

how do I use this

eternal oxide
#

you don;t

shut field
#

is that it

#

I already registered the class

eternal oxide
#

its used by Bukkit when you set an entry in your yaml

#

well, you need to replace the null

#

to take your object and build the Map

grim ice
#

?paste

undone axleBOT
grim ice
#

Elgar

shut field
#

yeah that is what I was asking, what does the String and Object represent, the "Map containing the current state of the class"

grim ice
#

i have like 70 lines of code before my actual plugin starts

#

lmao

#

can I drag this at the end of the code

#

or it has to be before it

grim ice
#

hello?

eternal night
#

hello!

eternal night
#

whats the issue with that

grim ice
#

is that normal

eternal night
#

well this is hopefully in its own file right ?

grim ice
#

won't i get clowned on for doing it

grim ice
eternal night
#

Yes but, as elgar already said, until you are more comfortable with java this is sadly the way to go

eternal oxide
#

where methods are in a class makes no difference

#

just add all your getters to teh bottom

grim ice
#

okay

eternal oxide
#

get it workign, then worry about how it looks

grim ice
#

ok

#

but

#

NamespacedKey key5 = new NamespacedKey(plugin, "vindicator");

    ShapedRecipe recipe5 = new ShapedRecipe(key5, new ItemStack(Material.VINDICATOR_SPAWN_EGG));
    recipe5.shape("EEE", "EME", "EEE");

    recipe5.setIngredient('M', Material.EMERALD_BLOCK);
    recipe5.setIngredient('E', Material.IRON_BLOCK);

    Bukkit.addRecipe(recipe5);
#

do i remove

#

first line here

#

and the

#

"key5"

#

n shapedrecipe

eternal oxide
#

yes

#

you replace all keys with teh getters

iron condor
#

how can I disable putting a specific item into an item frame?

eternal oxide
#

detect in PlayerInteractEvent

#

accessing item frame and yoru item in hand

mortal cedar
#

is it possible to change the breaking tool type and the breaking speed of a block? For example, a wooden plank that has the same breaking time as obsidian and must be mined with a pickaxe

grim ice
#

Field can be converted to a local variable
Private field 'plugin' is assigned but never accessed

eternal oxide
#

you no longer need it as you generate all yoru keys in the constructor

grim ice
#

do i remove it

#

the

#

private final JavaPlugin plugin;

#

I assume yes

mighty aurora
#

Is their any way for me to make a plugin that allows for one of two things(or both preferably) those things being longer item pickup range and stackable potions

shut field
#

ElgarL

near crypt
#

how can i get a random number between 1 and 20?

grim ice
#

@eternal oxide sorry for pinging but How do i access the namespacedkeys now ive done all that?

shut field
eternal oxide
#

you use your manager reference like recipiesManager.getZombieKey()

tacit storm
grim ice
#

Non-static method 'getZombieKey()' cannot be referenced from a static context

shut field
eternal oxide
#

don;t access it directly. Remember you made an instance of it in Main

grim ice
#

uh

#

uhhhhhhhhhhhhhhhhhhhhhhhhhhh

eternal oxide
#

you added a field to Main new RecipesManager

grim ice
#

yes

torn shuttle
#

weird question but I never really payed much attention to it, how are you meant to read spgiot build versions and compare them chronologically to other builds?

near crypt
#

@shut field but when i type num. then i can do nothing with it

grim ice
#

but

#

i still cant get it

#

AAAA

#

how am i supposed to get it

torn shuttle
#

like, the commit "numbers" are for the most part just a random string of characters, how can I identify where stuff is?

grim ice
#

recipes.getZombieKey() does not work

#

RecipesManager,getZombieKey() tells me to make stuff static

#

@eternal oxide sorry for the ping but uh

#

how?

eternal night
#

you pass an instance of your recipes manager around

#

not just use the class

grim ice
#

huh

#

how

#

?

#

uh

eternal night
#

?learnjava xD

undone axleBOT
eternal night
#

you create a new instance of it

#

in your onEnable

#
final RecipesManager manager = new RecipesManager(this);
grim ice
#

i had it

#

but it was private final

iron condor
#
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
            if (event.getItem() != null) {
                if (event.getItem().equals(elunarsBook.elunarsBookItem)) {
                    event.setCancelled(true);
                }
            }
}

grim ice
#

@eternal night now what

#

lmao ive been on this

#

for 2 HOURS

#

and i still cant finish it

#

wtf

iron condor
#

what is the action type for placing an item to item frame?

grim ice
#

and check if its right click and the rightclicked block is an empty item frame

#

with a held item not being null

#

thats an alternative way

mighty aurora
#

how would i go about making a plugin that would allow me to change the item pickup range for players as well as allow for stackable potions(doesnt matter if i need to make them in separate plugins or if i can do it in one, just want the features)

grim ice
#

@eternal night u here

eternal night
#

fam I am not going to guide you through this step by step xD

grim ice
#

yeah sorry

#

but may you please

#

i have no friends to help me

#

:/

iron condor
#

isnt item frame an entity?

grim ice
#

uhh

#

Elgar you here

eternal oxide
#

yes

grim ice
#

please

#

help

grim ice
eternal oxide
#

What bit are you stuck on?

grim ice
#

I don't know how to access the Keys

#

in a event class

#

(RecipesManager.getZombieKey());

eternal oxide
#

ok, you must have registered the event class

grim ice
#

tells me to make getZombieKey a static

eternal oxide
#

whast the name of yoru event class?

grim ice
#

uh

#

onJoin

eternal oxide
#

the actual Class is called onJoin?

grim ice
#

yes

#

ill change it

#

i know java conventions blah blah

eternal oxide
#

ok, then you must have at some point use new onJoin()

grim ice
#

yes in main class

#

to register

#

the event

eternal oxide
#

ok, change that to new onJoin(recipesManager)

#

if you called your recipesManager field that in yrou main class

grim ice
#

Expression expected

#

yes i have

#

final RecipesManager recipes = new RecipesManager(this);

eternal oxide
#

ok, then change it to new onJoin(recipes)

grim ice
#

Expected 0 arguments but found 1

eternal oxide
#

then in your onJoin Class it will complain about the constructor

#

so add in yoru constructor (add one if you don;t have one)

#

you add the RecipesManager, the same as you did the JavaPlugin into your RecipesManager class constructor

grim ice
#

what do you mean?

#

oh

#

public onJoin(RescipesManager ???) {

eternal oxide
#

yes

#

??? recipes

grim ice
#

'class' or 'interface' expected

eternal oxide
#

wrong place

grim ice
#

wait wait

#

yeah wrong place

#

di realized

#

ok no error

#

Non-static method 'getZombieKey()' cannot be referenced from a static context when i hover over(RecipesManager.getZombieKey());

eternal oxide
#

yes, you shoudl be using teh recipes instance you passed, not teh static RecipesManager

grim ice
#

1s

#

it should be empty?

#

the public onJoin(RecipesManager recipes) {

#

or?

#

private final RecipesManager recipes;

public onJoin(RecipesManager recipes) {

this.recipes = recipes;
}

#

ok

#

thats what i have

eternal oxide
#

second one, yes

grim ice
#

now i do recipes.getZombieKey()

#

right

eternal oxide
#

yes

grim ice
#

Poggers

#

ty

#

ill test now

unkempt ore
#

Elgar I built on Spigot, deployed to Spigot

#

It still fires when it hits the floor

#

I don't know anymore

rare crow
#

hello

#

can i get some help please

#

is there any source code that is that ususal /hub command

ivory sleet
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

rare crow
ivory sleet
#

Uh yeah

#

Just google it?

rare crow
#

i need somehow to make it to check the location

rare crow
ivory sleet
#

Is this over bungeecord btw?

rare crow
#

tried it

rare crow
quiet ice
#

Then what should the command do?

#

teleport the player to some random world or wat

rare crow
#

after 5 seconds of not moving

quiet ice
#

well, usually you'd have a /setspawn command or something that lets you set the location - afterwards it needs to be somehow stored, but given that it is config serialisable that should not be the issue

rare crow
#

if he moved

#

so i think that i need to make a var witch will have the location of the player

#

and another var witch is the new location and then compare it

quiet ice
#

well, you could listen for a PlayerMoveEvent

rare crow
#

oh

#

i never knew it was a thing

quiet ice
#

But why can't you do player.getLocation().clone() to get the loc of the player?

#

(it should return a clone either way, but let's have ti like that for good measure)

rare crow
#

so i need to compare player.getLocation().clone() and p.getlocation() ?

unkempt ore
#

Alright, I'll cut straight to the chase

#

PlayerEggThrowEvent is firing when the egg lands, not actually when it's thrown

#

Why

rare crow
#

@quiet ice so i just make the listen thing to the PlayerMoveEvent and if it happens i cansel the teleportation ?

quaint mantle
#

Is there projectile launch event

grim ice
#

?paste

undone axleBOT
unkempt ore
#

Yes, there is

grim ice
#

anyone

quaint mantle
#

See what you can get out of that

grim ice
#

has an idea of why this error occured

#

im almost killing myself from exhaustion

quiet ice
unkempt ore
#

No, I know it will work. But I've wasted a day of entirely debugging only to find this

#

I am mad

rare crow
unkempt ore
#

I want to know what the reasoning is behind this

quiet ice
#

proceeds to ping again

grim ice
#

anyone

rare crow
grim ice
#

has even a small idea

rare crow
#

accedent

grim ice
#

why this

#

error occurs

quiet ice
#

source code?

grim ice
#

uh

#

1s

#

?past

#

?paste

undone axleBOT
grim ice
#

this is my RecipesManager class

quiet ice
#

What that means is up to yourself

grim ice
#

uh

#

so

quiet ice
#

In essence it cannot add the ingredient to the recipe because it isn't needed

grim ice
#

why

#

but i want it to add it

quiet ice
#

It isn't needed

grim ice
#

what does that mean

quiet ice
#

        recipe4.shape("NEN", "DTD", "GEG");

        recipe4.setIngredient('E', Material.EMERALD_BLOCK);
        recipe4.setIngredient('Y', Material.ENDER_EYE);
#

There is no need to declare 'Y' because it isn't used

grim ice
#

OH

#

LMAO

quiet ice
#

why it printed the character as an integer is beyond me

#

Well, I do know why but not why

grim ice
#

but

#

what are the lines i need to change

#

i dont get anything from the code except symbol does not appear

eternal oxide
#

delete teh line

#

Y is not in the recipe

#

no ender eye

grim ice
#

done

#

is that the only line

quiet ice
#

You have eyes, you can look for that yourself

grim ice
#

true

#

sorry for being a dumb dependent piece of trash

quiet ice
#

The error message is badly formatted, I have to agree. Unfortunately I cannot change it because I do not wish to sign the CLA

grim ice
#

ok

#

i changed what u told me to

#

and i read the whole thing

#

honestly at this point i just wanna end this frick

#

but honestly Elgar helped me a lot

waxen barn
#

pls

quiet ice
#

what is you maven pom?

grim ice
#

Honestly

#

im re learning java from absolute zero now

#

because people told me to

round finch
#

Hello how would i make a fake item in the shield slot
like a book but without chaninge the Item

like update inventory packet

grim ice
#

and Believe me it's useful

waxen barn
quiet ice
#

Then what exactly did you run?

grim ice
#

2.you prob can setoffhandslot to a certain itemstack

#

if u have one

quaint mantle
quiet ice
#

My guess is that you are not running the shaded jar. One way to solve it is to put specialsource on the classpath

waxen barn
# quiet ice Then what exactly did you run?
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i TridentGamesPlugin.jar -o TridentGamesPlugin-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-mojang.txt --reverse

it is copied from the forum post

grim ice
#

#setOffHandItem

unkempt ore
#

Hex you’re not helping him

grim ice
#

o

unkempt ore
#

He said a fake item

grim ice
#

im bad at helping

unkempt ore
#

An item that isn’t real

grim ice
#

does he mean an item that doesnt exist

unkempt ore
#

He’s trying to mess with packets

grim ice
#

Oh

#

okay

quaint mantle
#

Doesent exist for who?

#

I’m confused

unkempt ore
#

The server

waxen barn
quiet ice
unkempt ore
unkempt ore
#

That’s not what he wants though

quaint mantle
#

For the item to show up for the client a setSlot packet is sent.

waxen barn
grim ice
#

@round finch

unkempt ore
#

I’m not sure why he would want this

grim ice
#

will this maybe help you

quaint mantle
#

A very bad question need more info.

#

Doesent make sense

unkempt ore
#

But it sounds like what he’s asking

unkempt ore
quiet ice
#

ignore it

unkempt ore
#

He’s probably on about protocol lib

quaint mantle
#

That would still help him

unkempt ore
#

True

grim ice
#

well

#

im not the best

#

so im just trying

quiet ice
#

well, the library is not specified

grim ice
#

to send him relevant stuff

#

lol

quaint mantle
#

That’s the best place to reference to

round finch
#

like sending a fake item packet

quaint mantle
#

Doesent change the item for who what

round finch
unkempt ore
#

Yes, see?

#

Look