#help-development

1 messages · Page 1783 of 1

ember estuary
#

yeah ik xD

last ledge
#

xD

ember estuary
#

nice one xD

#

u spent like 10$ on that joke

last ledge
#

ye lmao

ember estuary
#

x'DD

#

thats dedication

last ledge
#

ye lol

#

trying to make people's day

#

^^

ember estuary
#

:D

last ledge
#

Social work

ember estuary
#

haha

last ledge
#

;D

ember estuary
#

is md_5 the creator of spigot?

#

or just the project lead nowadays?

#

and is he the owner, or just one of many admins?

#

just wondering

ivory sleet
#

Founder and head maintainer of spigot

#

Unsure if there are any other admins

ember estuary
#

i see

#

thats cool

#

i wonder why he's even studying

#

im making my bachelors degree now and he's like levels above me

#

is it hard to make something like spigot, forge, mcp, .. ?

#

do you just somehow decompile the code and inject your own methods

last ledge
#

imagine having "Owner of Spigot" in your Bio data

ember estuary
#

xD

last ledge
#

md_5 goes to interview, and instead hires the interviewer.

ember estuary
#

is location passed by reference? (I know there is no pass by reference in java, so for all the pros: Is the reference passed by value, or is a copy passed by value?)
Or in other words, does p.getLocation().setYaw() or Location x = p.getLocation(); x.setYaw(); actually change the players yaw?

summer scroll
opal juniper
#

^

ember estuary
#

alright, thank you

opal juniper
#

you need to teleport them

ember estuary
#

to change the yaw?

#

no easier way?

opal juniper
#

yes

#

teleport them to the yaw changed location

ember estuary
#

alright, ty

summer scroll
#

is 1.18 out yet?

#

i mean on the launcher

ember estuary
#

is the release today?

#

damn, time went fast

#

no, 1.17.1 is still the newest

#

@summer scroll

young knoll
#

1.18 release is November 30th

summer scroll
#

well i'm asking

ember estuary
#

ahh

summer scroll
#

it keeps getting heavier and heavier

young knoll
#

What does

summer scroll
#

you know, to run a server with the newest version

young knoll
#

The extra 64 blocks of cave generation certainly doesn’t help

quaint mantle
#

Hello, is there anything wrong with this query ?

crimson terrace
#

yes there is, at least I think so

quaint mantle
#

what is wrong

crimson terrace
#

I think you have to put the ? at the end in ''

ivory sleet
#

probably want to use getString or whatever it’s called

quaint mantle
west oxide
#

how far should i go in learning java before passing to spigot ?

quaint mantle
ivory sleet
ember estuary
#

yeah, u dont need to be far, spigot is super simple

ivory sleet
#

Classes, objects, variables, iteration, methods etc

crimson terrace
#

are you trying to check Where name = '?' ?

quaint mantle
#

yes

#

i want to get the value

#

of the player

crimson terrace
#

dont you have to do * instead of ?

quaint mantle
#

no dude wtf performance 0

#

i used this query in other projects but it was not a getValue
it had a fixed value like presents

#

and i called the method right

#

what is wrong

west oxide
ivory sleet
#

Then you didn’t learn those enough

crimson terrace
proud basin
#

a mutator method

quaint mantle
#

what does that mean

west oxide
ember estuary
#

Is there any way to do this

Location loc = p.getLocation();
loc.setPitch(60f);
p.teleport(loc);

in one line (or in two?) ? (without creating a new Location(...))

#

set just returns a void, it would be so handy if there was a method that returns the changed object

#

its not much, but just wondering if there is

eternal oxide
ember estuary
#

setPitch returns void :/

eternal oxide
#

ah

ember estuary
#

yeah :((

crimson terrace
#

does it matter?

ember estuary
#

nah, but would be nice

crimson terrace
#

no i mean. does it matter that setPitch returns void

ember estuary
#

yeah

#

cause it then passes that to teleport()

#

which wants a location

crimson terrace
#

you set the pitch of the location to the specified value and then teleport the player to that location, right?

ember estuary
#

yeah

#

but thats 3 steps which you have to do separately sadly

golden turret
#

how could i reorder the items in the inventory?

crimson terrace
#

oh I see now

ember estuary
#

xD

golden turret
#

this -> this

ember estuary
#

ah thats what u mean xD

quaint mantle
ember estuary
#

probably with a for loop just counting (and deleting) the items of that type

#

and then add the appropriate amount in empty slots

crimson terrace
ember estuary
#

thats not what he meant, look at the picture @crimson terrace

#

or i understand you wrong

eternal oxide
#

shreb is correct

ember estuary
#

oh alright

eternal oxide
#

taking the items out, then adding them all back (not in a slot) will stack them

ember estuary
#

does sorting the list stack the items?

crimson terrace
#

i mean something like go through every slot in the inventory, add it to a list (if the item is already in the list you just add the amount to that itemstack) and then put them back in

ember estuary
#

ahh i see

#

well thats my solution with a list

crimson terrace
#

sorting doesnt stack but i forgot to mention the stacking yea

ember estuary
#

now depends on if he wants to do it for every item or just a specific one

#

depending on that he needs a list or not

crimson terrace
#

most likely for every item

ember estuary
#

in the example its just one

#

but yeah, might be

#

Can you change the players rotation without him actually turning?

#

so its just instantly changed, no animation

#
Location loc = p.getLocation();
loc.setPitch(60f);
p.teleport(loc);

This makes the player turn super fast to the desired pitch. But I dont want there to be a turn animation

eternal oxide
#

the animation will be client side extrapolation

ember estuary
#

yeah

#

but how to turn it off

#

xD

eternal oxide
#

you don;t

ember estuary
#

extrapolation? isnt it called interpolation?

crimson terrace
#

"Thats the neat part, you dont"

ember estuary
#

:(

golden turret
ember estuary
#

Can you display a map to the player as if he was holding it, without him actually having it in his hand?

quaint mantle
#

No

paper viper
#

did they change NMS? Like it is in the META_INF/versions folder now

#

im so confused

#

lol

#

i understand why they have it like that now (cause of bootstrap class and they need to load libraries like jars and stuff), but how would i use it now lol

ember estuary
#

Should i do Map<Player, ...> or Map<UUID, ...> ?
Can the former be a problem? Or does storing a Player use uuid under the hood anyway?

paper viper
#

you should do the latter

ember estuary
#

but is there a reason?

#

thats what i got now, just wanna know if its unneccesary

paper viper
#

Because player objects become invalid if the player logs out

#

if they log back in, a new player object is created

ember estuary
#

i remove from list if he logs out

#

but alright, good to know

#

will just use uuid to make sure

paper viper
#

Then you are better off using a map with weak keys

ember estuary
#

whats that

eternal oxide
#

WeakHashMap

paper viper
#

so that the player object will be garbage collected automatically once they log out

ember estuary
#

ooh that exists? whaaaat

paper viper
#

yes

ember estuary
#

thats so useful

eternal oxide
#

May be garbage collected

paper viper
#

Yeah

ember estuary
#

how often does the garbage collector run

paper viper
#

it depends

eternal oxide
#

random

ember estuary
#

hmmm

#

idk if i should use weaklink or remove at logout

#

gotta think about it more xD

eternal oxide
#

you may end up with objects that need to be garbage collected, but you won;t cause a memory leak using a weak map

paper viper
#

^

eternal oxide
#

it will however eff up your code

ember estuary
#

alright

young knoll
#

Yeah the new jar in jar stuff with minecraft is weird

paper viper
#

but intellij is indexing the wrong shit now

young knoll
#

No idea how to depend on the old NMS

#

But you can use the remapped one

paper viper
#

Theres isnt a god damn gradle plugin

#

Ughhhhh

young knoll
#

The 1.18 post has a comment that mentions paperclip

#

No idea if that works

long elm
#

Hello, is it possible to sort the players on the basis of their group in the tab list without scoreboard (1.16.5)

paper viper
ember estuary
#

When I cancel PlayerInteractEvent, does it stop the player from breaking stuff?

young knoll
#

Yes

#

Afaik

ember estuary
#

even with stuff thats instantly breakable like sugarcane?

#

ok :D

young knoll
#

If not just use the BlockBreakEvent

ember estuary
#

yea

#

Why do some event.getPlayer()-methods return HumanEntity and some return Player ?

#

whats the point of that?

young knoll
#

Honestly I’m not sure

#

Afaik all HumanEntity are players

#

Might be to do with how the underlying packets work

ember estuary
#

hmmm

#

maybe md_5 just choose to change it later on, but didnt wanna change existing methods?

#

but spigot isnt really downwards compactible, is it

quaint mantle
#

welp lemme check crafthumanentity

#

i have it here

ember estuary
#

npc?

#

thats a thing?

#

i always thought its just fake players sent per nms

quaint mantle
#

ahh yes
/**

  • Represents a human entity, such as an NPC or a player
    */
ember estuary
#

alright

quaint mantle
#

i think player extends this so if you cast then they might still work

ember estuary
#

yeah

#

but backwards casting isnt good xD

#

player -> humanentity is alright, but humanentity->player is bad, cuz if its not a player its gonna give an error i think. but ill just cast anyway, wont use npcs in my plugin. ty.

young knoll
#

Yes but I’ve never seen that happen

#

Even with NPCs

hybrid spoke
#

downcasting is not entirely bad

#

it really depends on the situation. you mostly downcast if you receive something where you already know what it will be. in this case, as long as you know that it will be the player, you can downcast, but it will probably not give any advantages

ember estuary
#

well, can NPCs trigger InventoryClickEvent?

#

idk

#

xD

#

But yeah, i kinda know only players will trigger it in my application

hybrid spoke
#

a NPC is also a player

ember estuary
#

but not a real one, right

hybrid spoke
#

its a fake player but afaik it will also trigger events

quaint mantle
#

if the plugin dont do some wunky things then i guess they arent gonna trigger any inv events

#

might be block breaks or other events like that

hybrid spoke
#

since inventory interactions need to happen clientside first and a NPC doesnt have a clientside, they wont

grand escarp
#

How do you create smithing table recipes? all i can do with this code is 'getAddition' and 'getBase', not set it.

        swordRecipe.```
#

wrong code

#

after

#

swordRecipe

#

i cant set recipes

gray crypt
#

Is there a reason why neither the PlayerPortalEvent nor EntityPortalEnterEvent catch END_GATEWAYs?

golden turret
#

?paste

undone axleBOT
grand escarp
#

yo i just clicked that link

eternal oxide
#

report to Malwarebytes if you can as a false positive

grand escarp
#

ok

hybrid spoke
#

i mean, if i post my malware code on it, they are not wrong

golden turret
#

hello. i need a little help in my crafting system. Basically this code is a bit weird (https://paste.md-5.net/vihahecuhe.php), see the video to understand. Basically, if i put 3 iron, it crafts 1 bucket but if i put 1 iron, it crafts 1 bucket as it had 3 iron. following that logic, if i put 4 irons, it crafts 2 buckets (3 iron for the first bucket and 1 for the second)

night copper
#

Can someone help me I need H E L P

red sedge
#

like if I paste the value it says WHITE_WOOL but it says the material is null

eternal oxide
#

paste the full error

red sedge
#

ok

eternal oxide
#

and use matchMaterial not valueOf

night copper
#

?paste

undone axleBOT
night copper
#

this it the error

red sedge
eternal oxide
#

Caused by: java.lang.IllegalStateException: InventoryOpenEvent cannot be triggered asynchronously from another thread.

night copper
night copper
#

it looks like it is

eternal oxide
#

yes

night copper
#

alright

#

what do i do

eternal oxide
#

call it in a sync method to the main thread

night copper
#

i-

#

what

eternal oxide
#

are you firing this from a command?

night copper
#

no

#

its an event

eternal oxide
#

an async event

night copper
#

um yea

eternal oxide
#

then just run task

#

execute a task it will run sync to teh main thread as it goes via the scheduler

night copper
#

ok

gusty gorge
#

does p#getLocation return the death coordinates if i call it in the PlayerDeathEvent?

quaint mantle
#

yeah i think so

#

hello

#

what is the material for a golden apple

#

and an enchanted golden apple

#

in 1.12.2

night copper
#

legacy_golden_apple

#

just use legacy if its in 1.12

quaint mantle
#

and wait

#

GOLDEN_APPLE is enchanted golden apple i guess

#

what is for the normal ?

#

the api version is 1.12.2

#

not in the plugin.yml

#

the whole api thing

#

as the server is

gusty gorge
#

Then it should just be GOLDEN_APPLE / ENCHANTED_GOLDEN_APPLE

quaint mantle
#

nope

west oxide
#

hey

#

so i made a plugin

#

and tested it on a 1.8.8 server local host

#

and it worked well

#

but then i uploaded it to my server

#

and it didnt even show in /pl

#

not even red

#

idk what the issue is

gusty gorge
#

What does show up? (Is there an error in the console)

quaint mantle
gusty gorge
west oxide
#

wait lemme try again

#

and see

west oxide
gusty gorge
#

Have you double checked that your server is spigot 1.8.8

west oxide
#

yes

#

i use multiple 1.8.8 plugins on it

#

and they all work

#

and i am sure that none of them does the same things my plugin does

#

like basic /gmc etc

gusty gorge
#

Does your plugin print something to the console if loaded?

west oxide
#

i just restarted server to see if any errors and only error that shows is about protocol lib

west oxide
#

and nothing came up

#

idk its just weird

gusty gorge
#

Is it in the right folder?

west oxide
#

yes

#

right with other plugins

eternal oxide
#

not a timer#

night copper
#

oh

eternal oxide
#

you only want to run once

west oxide
night copper
#

but i canceled it

#

so is it fine?

gusty gorge
young knoll
#

I mean I guess

west oxide
young knoll
#

But why bother with a repeating task when you don’t need one

west oxide
#

i'll try uploading the local host jar into the server

gusty gorge
west oxide
static crane
#

Can someone help me, My item isn't enchanted but I have the lore correct. I don't get why the enchant isn't working ``` public static void init(){
createAxe();

}

public static void createAxe(){
    ItemStack Item = new ItemStack(Material.DIAMOND_AXE, 1);
    ItemMeta meta = Item.getItemMeta();

    meta.setDisplayName("§4Battle Axe");
    List<String> lore = new ArrayList<>();
    lore.add("A axe for hero's and warriors");
    lore.add("luck is on your side");
    meta.setLore(lore);
    meta.addEnchant(Enchantment.MENDING, 2, false);
    meta.addEnchant(Enchantment.LUCK, 20, false);
    //meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);

    Item.setItemMeta(meta);

    battleAxe = Item;

}

}```

west oxide
#

wow i actually kind of understand this lol

young knoll
#

You need to switch the false to true

#

To bypass normal level limits

west oxide
#

an axe

#

:P

gusty gorge
west oxide
#

am uploading the jar file from the local host to replace the one on the soulnode server

#

and then i'll restart

gusty gorge
#

Have you tried downloading the server jar from there and test a local host server with the plugin?

restive tangle
#

Why would having lore make your axe have an enchantment glint? I don't see an issue with your code.

west oxide
gusty gorge
west oxide
acoustic pendant
#

To take the # value, would be getInt, getDouble or getString?
I mean, to getting it in the config

grand escarp
#

ok

#
                new NamespacedKey("combined_sword"), sword);
                new ItemStack(better_netherite_sword);
                new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD);
                new RecipeChoice.ExactChoice(Material.DIAMOND);
                Bukkit.getServer().addRecipe(cmbnSword);``` gives me this error
west oxide
#

that means its a plugin that's causing that ?

gusty gorge
#

Try putting all the plugins in the local host folder

ember estuary
#

how can i detect when the player looks around just a little?
the PlayerMoveEvent is only getting triggered after a rotation of > 8 degrees

young knoll
#

Runnable I guess

ember estuary
#

what

crimson terrace
ember estuary
#

ah you mean every tick check his yaw?

#

alright

young knoll
#

Mhm

#

You can’t make a namespaced key like that

ember estuary
#

wonder if thats laggy

young knoll
#

You need a plugin instance

grand escarp
#

well im exteremely new to java

#

and coding in general

#

so

young knoll
#

Or you need to use NamespacedKey.fromString

grand escarp
#

idk

young knoll
#

?learnjava

undone axleBOT
night copper
#

How could I check if a player broke a specific block (a player head)

quaint mantle
#

using NamespacedKey.fromString instead of constructor is api abuse SMH

west oxide
#

how can i make the plugin java 8 ?

#

its in latest java version

night copper
grand escarp
# young knoll Or you need to use NamespacedKey.fromString

60:36
java: constructor SmithingRecipe in class org.bukkit.inventory.SmithingRecipe cannot be applied to given types;
required: org.bukkit.NamespacedKey,org.bukkit.inventory.ItemStack,org.bukkit.inventory.RecipeChoice,org.bukkit.inventory.RecipeChoice
found: org.bukkit.NamespacedKey
reason: actual and formal argument lists differ in length

gusty gorge
grand escarp
quaint mantle
gusty gorge
west oxide
night copper
west oxide
gusty gorge
#

Ah ok, can't help there

quaint mantle
west oxide
#

F

night copper
#

ok

quaint mantle
#

and then cast it to PersistentDataHolder

static crane
gusty gorge
night copper
west oxide
#

but idk what i need to look for

#

cuz too many things on there

quaint mantle
west oxide
#

ohh found it

young knoll
#

Get a java 17 jdk

#

I assume you are doing 1.18-pre5 dev

proud basin
#

I love oracle

red sedge
#

how can I use getConfigurationSection and look through?

quaint mantle
#

getKeys

west oxide
night copper
#

is head a tile block? a chest is

gusty gorge
quaint mantle
night copper
#

alright

young knoll
#

A head is, yes

quaint mantle
#

ah wait

night copper
#

is it?

#

playerhead

young knoll
#

Gotta store the texture somewhere

night copper
#

like a block

quaint mantle
#

I messed up Storage and TileEntity

gusty gorge
# west oxide

Download a jdk/jre in version 8-11 as most servers support that

west oxide
#

where can i find java 8 ?

young knoll
#

Google

quaint mantle
#

Yeah head is TileEntity

west oxide
#

i found it on oracle website

night copper
#

ok

west oxide
#

but they asking me to login

#

is that normal ?

young knoll
#

?java16

undone axleBOT
young knoll
#

Pretty sure that has a 8 build as well

west oxide
#

thanks

quaint mantle
#

See Adoptium aka AdoptOpenJDK

west oxide
grand escarp
#

ItemStack(better_netherite_sword), RecipeChoice(Material.DIAMOND_SWORD), RecipeChoice(better_netherite_ingot) these three want methods but idk what that means 🥴

#

what methods do i add?

solemn glade
#

I've tried about every possible thing I could think of (including this mess) but whatever I do it still says it "Might be null". Does anyone know why?

hollow bluff
#

What would be the best way to load worlds on server start to prevent getting unknown world errors?

spare prism
#

why doesn't execute the code?

    @EventHandler
    public void onInteract(InventoryInteractEvent event) {
        Player player = (Player) event.getWhoClicked();
        System.out.println(1);
        if(Menu.getOpenedMenus().containsKey(player)) {
            System.out.println(2);
            Menu menu = Menu.getOpenedMenus().get(player);
            menu.onAction(event);
        }
    }
visual tide
#

is your event registered?

spare prism
visual tide
#

and the 1 is not printed

spare prism
#

no

visual tide
#

maybe you want to use InventoryClickEvent

young knoll
#

Probably

manic furnace
#

How can i run a method when a player clicks a message?

young knoll
#

Actually, certainly

spare prism
#

won't it work with InventoryInteractEvent?

young knoll
#

The interact event is abstract and cannot be listened too

spare prism
#

ty

west oxide
#

is there any argument that shows all commands on the plugin ?

#

like /plugin

#

shows all commands that the plugin does

#

or do i have to type it all ?

young knoll
#

/pluginname should suggest them all

#

In new versions anyway

visual tide
#

ig you can type your plugin namespace + ":" then tab

#

if thats what you mean

west oxide
#

it shows the command not found thing

west oxide
young knoll
#

Don’t press enter

#

Just type /pluginname and it will suggest all the registered command for it

night copper
#

Caused by: java.lang.IllegalArgumentException: Cannot translate null text and the text is '&2&lZombie Head'

hollow bluff
#
private static File file;
    private static FileConfiguration customFile;

    public ArenaConfiguration() {
        file = new File(TIMV.getInstance().getDataFolder(), "arena.yml");

        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                return;
            }
        }
        customFile = YamlConfiguration.loadConfiguration(file);
    }``` I keep getting an error with this `customFile = YamlConfiguration.loadConfiguration(file);` upon loading the server and I'm not sure why because it should load it fine. It has a bunch of locations in it. This is the error ```Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization
java.lang.IllegalArgumentException: unknown world```
young knoll
#

World isn’t loaded yet

hollow bluff
#

I know but it does teleport me to it

#

even tho I get that error

visual tide
visual tide
hollow bluff
# young knoll World isn’t loaded yet

I have a method for it. It selects a random map thats going to be played and then loads that one with this

private void load() {
        String world = arenaConfiguration.getConfig().getConfigurationSection(getSelected()).getString("worldName");
        //Bukkit.unloadWorld(world, false);
        Bukkit.createWorld(WorldCreator.name(world));
    }```
young knoll
#

Is that run before the config stuff

west oxide
#

is it possible to get an offline player's uuid ?

#

or like issue command on an offline player ?

#

./ban

hollow bluff
#
@Override
    public void onEnable() {
        // Plugin startup logic

        arenaConfiguration = new ArenaConfiguration();
        locationUtility = new LocationUtility(arenaConfiguration);
    }```
eternal oxide
#

You have to load the world before you load any locations

#

and world loading is not instant

hollow bluff
#

LocationUtility selects a unloaded world from arenaConfig and then loads that world after

#

I dont think im using any of the locations first

eternal oxide
#

you can;t even read the locations until the world is loaded

hollow bluff
#

I know. I'm loading the world first

eternal oxide
#

your error says you are not

#

worlds do not load the instant you tell them to

#

it takes time

young knoll
#

There should be a callback function for that

hollow bluff
#

Can I DM the full src so it's easier to see what its wrong because I'm not the best to explain

fierce jolt
#

I hate package naming convetions

#

if I have a project called Super Awesome Bot what in the hell should be the package name

#

super-awesome-bot? SuperAwesomeBot <- no capital letters in package names argh

#

askdfljlsdf

night copper
#

What the event called when a entity like zombie dies

#

entitydeathevent?

fierce jolt
#

yes

ivory sleet
#

Or well your domain whatever you might own

tardy delta
#

Is there a world#isLoaded?

quaint mantle
#

also you can easily mess up classes with packages

royal vale
#

How to update my config in a bungeecord plugin? Like how do I add all the new sections that are created? There's no copyDefaults() option.

quaint mantle
tardy delta
#

Idk

#

I saw the conversation

ivory sleet
#

?jd-bc

tardy delta
#

Just wondering

grand escarp
#

it says'

ivory sleet
grand escarp
#

ItemStack(better_netherite_sword), RecipeChoice(Material.DIAMOND_SWORD), RecipeChoice(better_netherite_ingot));

#

the error is

#
  symbol:   method ItemStack(org.bukkit.inventory.ItemStack)
  location: class com.ragery.customitems.items.ItemManager```
eternal oxide
#

new ItemStack(Material)

ivory sleet
#

In Java you must use the new keyword before the constructor invocation when creating an object

quaint mantle
#

python thoughts

grand escarp
#

i added new to all

#

java: org.bukkit.inventory.RecipeChoice is abstract; cannot be instantiated

#

new error

ivory sleet
#

That too, the class must be concrete if you’re going to instantiate it.

ivory sleet
#

Well are you trying to do?

grand escarp
#

also i want the addition

grand escarp
#

instead of the netherite ingot

#

to be a custom item

#

so idk if this will work

#

instead of normal

fierce jolt
quaint mantle
#

artifactId? Fine. In group id and packages i'd use superawesomebot actually

lean gull
#

hello everyone! i have a question regarding build tools for yall,
i am currently watching a tutorial about nms and in the tutorial they opened up the build tools library or something,
does anyone know how they did that? like the source code for craft bukkit and stuff

grand escarp
#

can i use an itemstack instead of a recipe choice for the smithing recipe?

young knoll
#

RecipeChoice.ExactChoice

#

Not sure if it works for smithing

grand escarp
eternal oxide
#

neither will allow you to set teh number in a stack, if that was your question

grand escarp
#

omg i think i got it

#

there were no errors

#

i need to see if the code works tho

night copper
#

I need help, so I have a item in my inventory that has a NameSpaced Key, and when I break that item (when its placed) how will I know its that item, in other words, how will I get the blocks Namespaced key

#

I put that NameSpaced key in the items PDC

eternal oxide
#

PDC is not transfered to the item when its placed as a block

#

IF the placed block has a PDC then you have to manually add it when placed

#

only blocks which have TileEntities have a PDC

night copper
#

hmm

#

ok

grand escarp
#

ok so

#

the thing is

#

i need diamond sword + <custom item> = <custom sword>

#

but the custom item is a netherite ingot

#

and the sword is a netherite sword

#

how do i get it to override

eternal oxide
#

then use a shaped recipe

grand escarp
#

nono

#

it has to be in a smithing table

#

i want the original recipe to work

eternal oxide
#

then use the correct ItemStacks in your recipe

grand escarp
#

wdym

eternal oxide
#

a netherite ingot (custom) and an diamond sword

grand escarp
#

and the base can be a normal diamond sword

#
  • my new ingot
#

my code is

eternal oxide
#

you only get one result in a recipe

grand escarp
#

SmithingRecipe cmbnSword = new SmithingRecipe(NamespacedKey.fromString("combinedSword"), new ItemStack(better_netherite_sword), new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD), new RecipeChoice.ExactChoice(better_netherite_ingot));

grand escarp
eternal oxide
#

thats not a valid NamespacedKey

grand escarp
#

there's no error

eternal oxide
#

its not valid

grand escarp
#

how do i make it valid...?

eternal oxide
#

is yoru better_netherite_sword already an itemstack?

grand escarp
#

yes

#
        ItemStack sword = new ItemStack(Material.NETHERITE_SWORD, 1);
        ItemMeta swordMeta = sword.getItemMeta();
        swordMeta.setDisplayName("§bSuper Netherite Sword");
        List<String> lore = new ArrayList<>();
        lore.add("§eThis upgraded sword");
        lore.add("§ewill boost your stength");
        lore.add("§eand give you an ability!");
        swordMeta.setLore(lore);
        swordMeta.addEnchant(Enchantment.DURABILITY, 4, false);
        swordMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 4, false);
        sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
        swordMeta.setCustomModelData(2);
        sword.setItemMeta(swordMeta);
        better_netherite_sword = sword;```
eternal oxide
#

then use it, not inside a new ItemStack(bether_etc)

grand escarp
#

then what do i use

#

bc it needs a symbol

eternal oxide
#

you use better_netherite_sword

grand escarp
#

so if i remove the new

#

SmithingRecipe cmbnSword = new SmithingRecipe(NamespacedKey.fromString("combinedSword"), ItemStack(better_netherite_sword), new RecipeChoice.MaterialChoice(Material.DIAMOND_SWORD), new RecipeChoice.ExactChoice(better_netherite_ingot));

eternal oxide
#

no

grand escarp
#

it gives me this

eternal oxide
#

take out the ItemStack( )

grand escarp
#

ohj?

#

ohh

eternal oxide
#

JUST better_netherite_sword

grand escarp
#

let's see

#

starting my server

eternal oxide
#

and fixc yoru NamespacedKey

grand escarp
#

how do i make it valid??

#

bc it still just gives me a netherite sword

eternal oxide
#

new NamespacedKey(plugin, "combinedsword")

#

Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.```
grand escarp
eternal oxide
#

its an instance of yoru plugin

#

yoru main class

#

this if this code is in your main class

grand escarp
#

it's not'

#

but

eternal oxide
#

then you need an instance of yoru plugin

#

?di

undone axleBOT
grand escarp
#

new SmithingRecipe(new NamespacedKey(CustomItems, "combined_sword")

#

customitems is my main class

eternal oxide
#

it has to be an actual instance not just the class

grand escarp
#

how do i make an instance

grand escarp
eternal oxide
#

Bukkit.getPlugin(CustomItems.class)

grand escarp
#

getPlugin is not there

grand escarp
#

new SmithingRecipe(new NamespacedKey(Bukkit.getPlugin(CustomItems.class)

eternal oxide
#

then Bukkit.getPluginManager().getPlugin("CustomItems")

grand escarp
#

ok

#

no error but

#

lemme see if the recipe works

#

lol it's getting stuck at running ant tasks

#

now stuck at

#

synchronizing output directories

gray crypt
#

Does anyone know why I can't set the END_GATEWAY ExitLocations like this?

        //set blocks to END_GATEWAY
        portalBlocks[0].getBlock().setType(Material.END_GATEWAY);
        portalBlocks[1].getBlock().setType(Material.END_GATEWAY);

        destPortalBlocks[0].getBlock().setType(Material.END_GATEWAY);
        destPortalBlocks[1].getBlock().setType(Material.END_GATEWAY);

        //set exit locations of all portal blocks AND set them to be exact
        ((EndGateway) portalBlocks[0].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
        ((EndGateway) portalBlocks[0].getBlock().getState()).setExactTeleport(true);
        ((EndGateway) portalBlocks[1].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
        ((EndGateway) portalBlocks[1].getBlock().getState()).setExactTeleport(true);

        ((EndGateway) destPortalBlocks[0].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
        ((EndGateway) destPortalBlocks[0].getBlock().getState()).setExactTeleport(true);
        ((EndGateway) destPortalBlocks[1].getBlock().getState()).setExitLocation(destPortalBlocks[0].clone().add(0, 10, 0));
        ((EndGateway) destPortalBlocks[1].getBlock().getState()).setExactTeleport(true);
#

It doesn't result in an error.. it just doesn't work

quaint mantle
#

hello how to kill a player, and set the killer of the player to the last player that damaged the player ?

#

nvm found it

young knoll
#

Keep in mind for smithing recipes the meta of the result is not applied

grand escarp
#

do i need to do it with the smithing recipe

#

i tried

#

Bukkit.addRecipe(cmbnSword);

#

and now im trying

#

Bukkit.getServer().addRecipe(cmbnSword);

#

it's still just giving me the default thing

grand escarp
#

that means

#

it wont work

#

how do i make metas apply

young knoll
#

Use the PrepareSmithingEvent

gray crypt
#

What's the best way to check if any player is at a specific location?

grand escarp
round finch
#

register event class

young knoll
#

And distanceSquared

#

?events

#

Gosh I don’t know what the command is

grand escarp
#

i just started coding

#

idk how to use events at all

gray crypt
young knoll
#

You could

#

Depends how often you want to do things

#

As that may be slower than the event

round finch
#

always remeber to have @EventHandler over like

``@EventHandler
public void CustomMelting (PrepareSmithingEvent e){

}
``

in your Event Class

gray crypt
#

I'm already doing it through a different event

grand escarp
#

but what do i do with my existing code

#

and i dont even have an event class

#

IDK WHAT THAT MEANS

round finch
#

Make a normal java class

ivory sleet
#

You might wanna peek at java first, before tackling spigot*

grand escarp
grand escarp
#

now

grand escarp
round finch
#

you can name it EventClass

#

or whatever

grand escarp
#

in my main folder?

round finch
#

Click on Create new java File

grand escarp
#

where

#

ik how to make it

#

but

round finch
#

what you use?

grand escarp
#

where

round finch
#

the program you use to code in it?

grand escarp
#

IntelliJ

#

i know how to make the class

young knoll
#

Generally I have a folder for event listeners

grand escarp
#

ok

#

do i make it in the customitems

#

or

#

items

#

or can it be anywhere

round finch
#

under src -->

#

but you can put where every you feel like

grand escarp
round finch
#

Exemple in com.ragy.customitems

#

it works neither way

grand escarp
#

ok

round finch
#

but tip it to keep your source organized and clean + simple to read

#

avoid terrible naming because it confuse people

grand escarp
#

it's giving errors

#
    @EventHandler
    public void CustomMelting (PrepareSmithingEvent e){


    }
}
#

p

round finch
#

gimme one sec

grand escarp
#

i changed

#

bc not custommelting

#

but

#

i imported the classes

#

what do i do with this code tho

#
import org.bukkit.event.inventory.PrepareSmithingEvent;

public class EventClass {
    @EventHandler
    public void CustomItemRecipes (PrepareSmithingEvent e){


    }
}


#

i have to reference the class right

round finch
#

public class EventClass implements Listener {

grand escarp
#

in the class with the items correct?

#

yea

#

but now what

#

does it just

#

work lol?

round finch
#

ok now you added listener

grand escarp
#

i have that

round finch
#

ok
now to register events
but using
( [Main / Main Instance] here -->) .getServer().getPluginManager().registerEvents(new EventClass(), Main / Main Instance );

#

after you registered you events should work!

grand escarp
#

in this one?

round finch
#

depends how you want it?

grand escarp
#

or my items class

round finch
#

i can teach how to register from other classes

grand escarp
#

confused

grand escarp
#

in my recipe?

round finch
#

you can do it Any Class

grand escarp
#

oh

#

and where

round finch
#

the registering

grand escarp
#

at the top?

round finch
#

but if you want the simple way just

put it in on enable

grand escarp
#

ok

#

and what instance do i put here>

round finch
#

do this.getServer().getPluginManager().registerEvents(new EventClass(), this);

#

(this) will referrer to the main class itself

grand escarp
#

tysm

#

lemme see if plugin works

round finch
#

it should

grand escarp
#

nope

#

public class EventClass implements Listener {

#

java: class EventClass is public, should be declared in a file named EventClass.java

#

but it is

proud basin
#

show your EventClass

round finch
#

have you implements the register listener?

grand escarp
#

wait does that code need to be in the class as well?

round finch
grand escarp
#

yea

proud basin
#

?paste

undone axleBOT
grand escarp
#
import org.bukkit.event.inventory.PrepareSmithingEvent;

public class EventClass {
    @EventHandler
    public void CustomItemRecipes (PrepareSmithingEvent e){


    }
}


proud basin
#

you aren’t implementing the listener…

grand escarp
#

lmfao

round finch
#

lol yeah

#

no listener no listening to event triggering

grand escarp
#

no look

#

it turns gray

proud basin
#

because its not being used

grand escarp
#

exactly

proud basin
#

add implements Listener

#

to your class

grand escarp
#
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareSmithingEvent;

public class EventClass implements Listener {

public class EventClass {
    @EventHandler
    public void CustomItemRecipes (PrepareSmithingEvent e){


    }
}


ancient plank
#

I wonder what the issue is!

proud basin
#

not like he was 1 class in the class

round finch
#

import org.bukkit.event.EventHandler; import org.bukkit.event.Listener;

grand escarp
#

public class EventClass implements Listener { this doesnt need to be in my main class right

proud basin
grand escarp
round finch
#

an asperate file

grand escarp
#

import com.ragery.customitems.items.EventClass; in my main

#

java: cannot find symbol symbol: class EventClass location: package com.ragery.customitems.items

ancient plank
#

just tell him the issue

#

in words

grand escarp
#

it no work

proud basin
#

?learnjava

undone axleBOT
ancient plank
#

instead of spoonfeeding

proud basin
#

this is basics

grand escarp
#

do i just delete?

#

yea sorry

round finch
#

@grand escarp send picature of project

#

and main

tardy delta
#

why dont function?

round finch
#

i wanna see if you made mutiple Classes in same file or something

grand escarp
quaint mantle
#

Just learn java! It will save you a lot of damn time

grand escarp
ancient plank
round finch
#

wait a sec

#

are you trying to run a spigot plugin?

#

that won't work on in a spigot server

grand escarp
#

paper server

round finch
#

that would work too

grand escarp
ancient plank
#

(╯°□°)╯︵ ┻━┻

grand escarp
#

┬─┬ ノ( ゜-゜ノ)

ancient plank
#

have you read the code

#

that they put

tardy delta
#

¯_(ツ)_/¯

ancient plank
#

they put a class inside a class and 1.) that second class doesn't even implement listener, but even then that's completely unnecessary

#

remove the second class and put the eventhandler method in the first class and boom bam bosh look no error

tardy delta
#

😳

round finch
#

wut i missed?

ancient plank
#
public class EventClass implements Listener {

public class EventClass {

oh gee i wonder why it dont work

ancient plank
#

read the errors

round finch
#

D::

ancient plank
#
java: class EventClass is public, should be declared in a file named EventClass.java
grand escarp
#

ok

#

yea

#

i'd done that

tardy delta
#

panik

grand escarp
#

no more error

#

i moved the class

#

let's see if the metas work

#

nope

ancient plank
#

now send your new error and the code that it references

proud basin
#

line 32: runnable cannot run, none one is running.

ancient plank
#

tho I just recommend learning to problem solve your errors yourself & learning basic java :)

#

because I can assure you the errors you're having right now can be easily solved by just simply going through some basic java tutorials

round finch
#

public class EventClass { <--- this is a class

}

round finch
#

avoid making a class in a class

tardy delta
#

why dont function?

#

anyone

ivory sleet
#

?

proud basin
#

because you don’t function fourteen

tardy delta
#

:kek:

round finch
grand escarp
#

it just didnt carry

#

the metas

#

idk if the recipe is overriding the original recipe

hybrid spoke
#

what metas?

grand escarp
#
        ItemStack sword = new ItemStack(Material.NETHERITE_SWORD, 1);
        ItemMeta swordMeta = sword.getItemMeta();
        swordMeta.setDisplayName("§bSuper Netherite Sword");
        List<String> lore = new ArrayList<>();
        lore.add("§eThis upgraded sword");
        lore.add("§ewill boost your stength");
        lore.add("§eand give you an ability!");
        swordMeta.setLore(lore);
        swordMeta.addEnchant(Enchantment.DURABILITY, 4, false);
        swordMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 4, false);
        sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
        swordMeta.setCustomModelData(2);
        sword.setItemMeta(swordMeta);
        better_netherite_sword = sword;```
tardy delta
#

whoa

hybrid spoke
#

return values exist

grand escarp
#

ok

tardy delta
#

Arrays.aslist exists

grand escarp
#

jmbed4f65rtvygbuh78ygih

tardy delta
#

the 1 is redundant

#

🌝

grand escarp
#

i know that now

proud basin
#

Oogalaga did you get this code off google?

grand escarp
#

no i wrote the code

tardy delta
#

stackoverflow is also google 🌝 😳

round finch
#

Arrays.asList(" myString 1 ", " myString 2")

grand escarp
#

but still

tardy delta
#

he pro

grand escarp
#

that isn't the issue at hand

proud basin
#

For some reason I don’t believe you

grand escarp
#

and i dont feel like changing teh code rn

ancient plank
#

should use ChatColor for color codes in text instead of the weird squiggly § symbol

grand escarp
ancient plank
#

do it there too :)

tardy delta
#

lol

round finch
#

or &

#

and repalce it with §

hybrid spoke
#

§ gang

tardy delta
#

i use &

grand escarp
#

anywayy'

tardy delta
#

ayaaa

grand escarp
#

how do i return

#

dsbhuicfnsdihjfvhsdgbfd

round finch
#

if your code look like this

public class EventClass implements Listener {

public class EventClass {

#

you're doing something wrong

grand escarp
#

where do i add the return value

hybrid spoke
#

you dont add it

tardy delta
#

public Class Cookie {
public Cookie getNewCookie() {
return new Cookie();
}
}

grand escarp
#

sedfgh

ancient plank
#

@round finch why're you like 60 years in the fucking past we've moved past that

grand escarp
hybrid spoke
round finch
grand escarp
#

bro

#

why are you typing the Bible

round finch
#

here an exemple

public String getName(){

return myNameString;
}

visual tide
tardy delta
#

where does myString comes fom :kek:

grand escarp
#

how do i add strings>

#

jkjk

tardy delta
#

to what?

grand escarp
#

how

#

can

tardy delta
#

i?

round finch
#

wut you need?

grand escarp
#

i make metas work with smithing recipeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

tardy delta
#

you want to set lore or something?

hybrid spoke
grand escarp
#

again'

#
                "combined_pick"),
                better_netherite_pick, new RecipeChoice.MaterialChoice(Material.DIAMOND_PICKAXE),
                new RecipeChoice.ExactChoice(better_netherite_ingot));
        Bukkit.getServer().addRecipe(cmbnPick);```
tardy delta
#

return sword?

pale escarp
#

Imma ask something illegal - ||Where can i get hands on spigot 1.18 pre5?||

grand escarp
#

we'll just do the pick

grand escarp
pale escarp
#

?

grand escarp
#

idk what's in there

proud basin
#

buildtool?

hybrid spoke
#

?paste

undone axleBOT
grand escarp
proud basin
#

bro

tardy delta
#

and what's the problem?

grand escarp
#

this

tardy delta
#

this?

grand escarp
#

one sec lol

grand escarp
tardy delta
#

are you overriding default recipes?

grand escarp
#

yes

#

i've been asking how to do that

tardy delta
#

that doesnt seem to work

round finch
#

that doesn't look like a furance

grand escarp
#

smithign table

hybrid spoke
#

remove the vanilla one

tardy delta
#

you have to remove the default one

grand escarp
#

but i want the vanilla one to still work

hybrid spoke
#

otherwise the vanilla one will always overwrite yours

#

since it gets added first

grand escarp
#

i guess i can change the ingot to be like

#

iron or gold

#

so nothign overrides

tardy delta
#

doesnt have it a lower priority?

grand escarp
#

wait wait

#

can i remove the original recipe

hybrid spoke
grand escarp
#

and recreate it in the plugin?

hybrid spoke
#

he adds his after the vanilla ones are getting added

tardy delta
#

ah

hybrid spoke
#

you cant have 2 recipes doing the same

grand escarp
#

i want both recipes to work

#

oh

tardy delta
#

that wont work with the same recipe

grand escarp
#

ok i can change the ingot to like iron

tardy delta
#

think logically

#

how can the server know which one you want

grand escarp
#

yea then it wouldnt be a function

#

one input would have 2 outputs

#

and server go

#

bye

tardy delta
#

bye recipe

grand escarp
#

yep

#

since im using a texture pack

#

i can make it iron ingot

west oxide
grand escarp
#

and retexture it to use my own texture

tardy delta
#

just make custom item with new recipe

round finch
#

isn't it possible to override vanilla recipes?

tardy delta
#

i would set it on diamond pickaxe and make different recipes

grand escarp
round finch
#

change the output lol

tardy delta
#

that changes the default one right?

round finch
#

why not change the output

#

and set

grand escarp
round finch
#

the item in output slot

#

change recipe but different thing

grand escarp
#

if diamond pick + better netherite ≠ better netherite pick

#

whats the point

round finch
#

check for name = better netherite?

ember estuary
#

PacketPlayOutSetSlot requires int, int, int, ItemStack.
What are the ints for?
One is the slot, one is probably the id of the container (0 should be players inventory), but whats the last one? and in what order?

proud basin
#

row and column maybe?

round finch
#

idk i have done much Craft SmithingTable

#

to be 100%

grand escarp
#

ig i could just

#

not use smithing table

#

and use crafting table

#

or just

#

make the ingot iron

#

and retexture it

ember estuary
sullen marlin
#

Why do you need packets for this

ember estuary
#

because i only want to replace it client side

#

to avoid any dupes

tardy delta
#

you can use optifine to change texture depending on the item's displayname

stone sinew
#

Up to you. Depends how many different files you want to develop for