#help-development

1 messages · Page 2158 of 1

humble tulip
#

Oh json

glossy scroll
#

i just dislike typeadapters

tender shard
#

well

subtle folio
#

I see, thanks for the example!

tender shard
#

serializing basically means "converting sth to a Map<String,Object>"

wicked remnant
#

bungeecord doesn't seem to be respecting my softdepends at all

tender shard
#

you are running a weird fork of floodgate

wicked remnant
#

yeah thats my fork

#

floodgate isn't a proxy

#

its a helper-plugin for Geyser

tender shard
#

oh yeah mb. floodgate is the weird version of geyser

#

you have a typo in your bungee.yml file @wicked remnant

#

it's "softdepend" and NOT "softdepends"

#

so just remove the "s" at the end and it should work

fallow violet
humble tulip
subtle folio
humble tulip
#

You just wanna save the inv?

subtle folio
#

Correct

humble tulip
#

Check the itemstackserializer

tender shard
humble tulip
#

In utils

subtle folio
#

I see, does that take a list of ItemStacks?

humble tulip
#

Yep

subtle folio
#

and I can just load those into a inventory gui?

humble tulip
#

Yep

subtle folio
#

and then on restart/quit I can save deserialize and save it to a yml file and vice versa?

humble tulip
#

Yes

subtle folio
#

Sweet, you're the best.

tender shard
#

NO

#

I AM BEST

subtle folio
#

You're both the best 🙂

humble tulip
#

Its basically the same plugin ur making so it'll do the same stuff

tender shard
#

I can live with that

fallow violet
tender shard
#

on the right side of your IntelliJ window, there should be a tab called "maven"

#

open that and double click on "package"

humble tulip
fallow violet
#

then

#

help me

tender shard
subtle folio
humble tulip
#

Clean install

#

Or install

drowsy helm
#

lmao

fallow violet
#

i dont have the window

tender shard
#

if you double click that, maven will compile your plugin and put inside C\Path-To-Your-Plugin\target\

tender shard
fallow violet
#

ok

glossy scroll
#

i love it when i google my question

#

find i literally asked the same exact thing 5 years ago

tender shard
#

lol

#

what are you trynig to do

glossy scroll
#

serialize/deserialize itemstack via json

humble tulip
#

Why do u wanna use json?

tender shard
#

why is everyone trying to use json today

humble tulip
#

And not anything else

#

U can use a base64 string

tender shard
#

itemstacks are meant to be serialzed to byte[]

#

not json, and not to base64

humble tulip
#

I convert the bytearray to base64

glossy scroll
#

but i now realize

#

redis has a byte array feature

#

i should just use that

humble tulip
#

Oh well that's even better

tender shard
#
GitHub

Adds a ton of new PersistentDataTypes, including support for all collections, maps and arrays to the Bukkit API! - MorePersistentDataTypes/ConfigurationSerializableDataType.java at master · JEFF-Me...

glossy scroll
#

yep im experienced with that sorta thing haha

twilit wharf
#

How can I center text on a items lore?
I tried to create my own class but that was super wonky, most text was too far left or too far right.

dusk flicker
#

Thats probably going to be a difficult one; probably going to have to make a method for it yourself
Lore length isnt set so centered is really a dependent on every case

twilit wharf
#

yeah I tried to make one myself and got something that looks like this:

#

for some reason it just doesnt look right

glossy scroll
#

itemstack maintains its hashcode and everything

quaint mantle
#

to make it odd

quaint mantle
#

nvm

twilit wharf
#

I know the little dividers are perfectly centered.

#

I dont know what the Click to view or Settings isnt tho

#

I didnt add the ChatColor.* to the string to centered

waxen plinth
#

It's really narrow

#

The horizontal bars and wrapped text

#

Widen them

wicked remnant
twilit wharf
waxen plinth
#

If you don't know what I mean by "widen the horizontal bar" then you're beyond my help

twilit wharf
#

I know how to do that, idk how the widen the wrapped text

waxen plinth
#

How are you wrapping it

#

Just put more words on the same line

twilit wharf
#

I manually separated them

twilit wharf
fallow violet
#

what does this mean?

dusk flicker
#

that there is a warning

fallow violet
#

oh yeah nevermind xdd

#

My plugin.yml looks like this: But why the console say there is no one?

dusk flicker
#

either its in the wrong directory
or your maven (Im assuming its maven but no idea) is screwed up

#

can you show your entire project directory?

fallow violet
kind hatch
#

Your plugin.yml is in the wrong directory.

#

It needs to go in the resources folder

dusk flicker
#

your plugin yml needs to be in resources

fallow violet
#

oh

#

thanks

wraith marsh
#

so im trying to make a custom configuration file but i run into an error when enabling it
Cannot invoke "org.bukkit.plugin.Plugin.getDataFolder()" because the return value of "org.bukkit.plugin.PluginManager.getPlugin(String)" is null

fallow violet
#

How can I connect right to redis? because this redisClient = RedisClient.create("redis://localhost:6379"); throws this error Unable to connect to localhost/<unresolved>:637

wraith marsh
#

yeah one sec

dusk flicker
#

?di

undone axleBOT
wraith marsh
#

oh yeah

#

thanks

wraith marsh
dusk flicker
#

oh my god

#

I see why

#

.getPlugin("playerData")

wraith marsh
#

yeah

dusk flicker
#

thats not how that works

wraith marsh
#

ik thts the problem

dusk flicker
#

thats asking for a plugin name

#

replace Bukkit.getServer().getPluginManager().getPlugin("playerData").getDataFolder() with a reference to your main class
(which is generally a singleton or DI)

wraith marsh
#

OH

#

I GET IT

#

i was following a tutorial but ig i was just being stupid

#

so do i use di?

dusk flicker
#

do you have a instance variable/method in your main class?

wraith marsh
#

uh

dusk flicker
#

send your main class in a paste if you can lol

#

?paste

undone axleBOT
wraith marsh
#

hold on

#

ima try to do something

#

does something like this work?

dusk flicker
#

ye

#

just none of that needs to be static

wraith marsh
#

it gives an error when i dont make it static

dusk flicker
#

then how you are referencing it is an issue

#

that code you sent is pure static abuse

wraith marsh
#

what

dusk flicker
#

You would store a variable in your main class of playerData, and in your onEnable set that variable to a new playerData with the plugin instance (in this case, this; then you would call variable.setup;

#

?learnjava Will help a lot

undone axleBOT
wraith marsh
dusk flicker
#

the public playerData would be in your main class

wraith marsh
#

okay

dusk flicker
#

I'll pull up an example from one of my projects real quick

wraith marsh
#

kk

dusk flicker
#

Basically what you are doing, but I have it in the onLoad rather than enable.

In this case look at DatabaseManager at the top and in the method shown. You would also need a getter to actually get the variable from the main class, I'm using Lombok but your IDE can generate one

wraith marsh
#

yeah

#

ill try this

fallow violet
#

Guys. Why its telling me now RedisURI Already in use... Does that mean i can only connect one time to redis or what?

dusk flicker
fallow violet
#

yeah my pterodactyl panel is connected mybe

#

how can i connect now with my plugin?

dusk flicker
dusk flicker
undone axleBOT
dusk flicker
#

exactly what it is

fallow violet
wraith marsh
#

ah i get it

#

ill try now

dusk flicker
#

(for the api)

fallow violet
#

wdym?

#

In my plugin?

dusk flicker
#

yeah

fallow violet
#

idk actually

dusk flicker
#

can you show your pom?

#

in a paste

fallow violet
dusk flicker
#

oh you are using lettuce

#

yeah ive never touched lettuce for the api

fallow violet
#

should i just switch?

wraith marsh
#

its still telling me to make it static

dusk flicker
dusk flicker
wraith marsh
#

i dont have perms

#

cant verify

dusk flicker
#

upload it to imgur or smth

wraith marsh
#

kk

fallow violet
#

ok but how can i fix it now :o

wraith marsh
ocean prism
#

some one can help me setup grief prevention please

dusk flicker
fallow violet
dusk flicker
wraith marsh
#

yeah but it causes errors in main class

fallow violet
#

oh boi

dusk flicker
#

then we will fix those in a minute

#

were working right now to fix the large amount of static abuse you got lol

wraith marsh
#

ok lol

fallow violet
#

i like lurking in the chat and watching you :>

wraith marsh
dusk flicker
#

get rid of all static

wraith marsh
#

ok lol

#

10 related problems

#

uh

dusk flicker
#

well go to the first one

#

lol

wraith marsh
#

alright

dusk flicker
#

Most of them should be as simple as replacing the class callout with the variable you defined in your main class

wraith marsh
#

theyre all the same

dusk flicker
#

Im assuming its like playerData.get() or smth like that

wraith marsh
#

yes

#

lol

dusk flicker
#

Is that in your main class?

wraith marsh
#

no

#

its a command

dusk flicker
#

alright so you need a reference to your main class, and you are going to use that reference to replace playerData in that image

wraith marsh
#

okay

#

so the same thing as in the other class

dusk flicker
#

ye

kind hatch
#

Do it for all your classes. You don't need static in most cases.

wraith marsh
#

Cannot resolve method 'get' in 'DinnerChad'

#

its getting the main instead of the playerData class

dusk flicker
#

do you have an instance variable in your main class>

wraith marsh
#

oh yeah

#

one sec

#

lol

dusk flicker
#

yeah get that, and then use that variable to get playerData

wraith marsh
#

wdym?

#

its still getting the main class instead of playerdata

dusk flicker
#

DinnerChat.getInstanceThingy.playerdata or smth

wraith marsh
#

i dont really understand

#

im gonna send a ss

dusk flicker
#

alr

wraith marsh
#

imgur doesnt work

#

smh

dusk flicker
#

lmao

wraith marsh
#

uh

#

idk

dusk flicker
#

could always verify

wraith marsh
#

i cant

#

check verification channel

dusk flicker
#

Only non-verified can see it (and staff)

wraith marsh
#

wait it worked

#

it literally worked this time after like 10 times of trying

dusk flicker
#

lol

wraith marsh
dusk flicker
#

do you name all your vars the same thing lol?

#

access2.access.get()

#

(for the xyz)

wraith marsh
#

oh

#

right i understand why

dusk flicker
#

really should name those vars better tho

wraith marsh
#

lol i dont know why im just very bad at naming

#

but it gets the job done

#

ok checking to make sure that this is correct

dusk flicker
#

missing the method variable in that one

#

homeCommand(DinnerChad access2)

wraith marsh
#

yes

dusk flicker
#

otherwise NPE

wraith marsh
dusk flicker
#

pass 'this' into it

wraith marsh
#

yeah ik

#

it automatically does it

#

when you concatenate it with string

#

ive learned a lot

#

thanks @dusk flicker :D

dusk flicker
#

np

lethal python
#
if (e.getCustomName() == null && e.getCustomName().equalsIgnoreCase("waystone")) return;
ancient plank
#

Kappa

lethal python
#

is this fine right, the && means if the first one fails the second one won't be evaluated so no null pointer

#

right⸮

#

is that ok

humble tulip
#

what is the defualt pitch for a sound minecraft?

lethal python
#

i put it as 1 and it sounded right

humble tulip
#

sounds too high

lethal python
#

oh dear

#

try 0.5 maybe

humble tulip
lethal python
#

why

humble tulip
#

since if the first is true, then you will be doing null.eqaulsIgnoreCase

#

it should be !=

lethal python
#

oopsie

#

yea

#

i just wanted to know if the && made it safe

humble tulip
#

yeah

lethal python
#

coolio

humble tulip
#

if you wanna evaluate everyting

#

use &

lethal python
#

yep

humble tulip
#

sounds very low

#

compared to default

ancient plank
#

Google is your friend

crude pine
#

do scoreboard prefixes no longer change the color of the player's name?

I'm setting the prefix, and the prefix shows, but the color doesnt go to the player's name

I printed the prefix to the console too to make sure no reset was added or anything, and it wasnt. It ends in §c yet the player's name is still white

please ping me if you reply

lethal python
#

my playerinteractentityevents are not firing when i click an invisible armorstand

#

how can i get a right clicked invisible armorstand

sharp flare
#

kinda new to making custom pdc types, any things that could go wrong with this

#

it works though

#

same with this

vocal cloud
#

That is scary ngl

sharp flare
#

yeah since im also catching a generic exception

sharp flare
wraith marsh
#

hog

vocal cloud
sharp flare
#

oh unoptimized?

#

since doing straight deserialize and serialize of objects using stream

wraith marsh
#

any way i can disable this warning?

sharp flare
#

oops ping sorry

vocal cloud
#

I don't mind. Idk I just usually find it interesting how people create crazy methods to serialize items to PDC

sharp flare
#

aight appreciate it

#

I might as well store the array byte input stream in a input or output buffered stream

reef mantle
#
@EventHandler
public void onUseItem(PlayerInteractEntityEvent event) {
  final Player player = event.getPlayer();
  final ItemStack usedItem = player
      .getInventory()
      .getItem(event.getHand());
  
  // ...
  
  usedItem.setAmount(usedItem.getAmount() - 1);
  player
      .getInventory()
      .setItem(event.getHand(), usedItem);
  player.updateInventory();
}

Trying to consume 1 item from the stack used in a player interact event. After the setItem method call, usedItem.getAmount() returns 0, so I must be misunderstanding these methods. What's the correct pattern to achieve this effect?

crimson terrace
#

Unless of course you wanna restart the server and still get the item

crimson terrace
vocal cloud
quiet ice
crimson terrace
#

XD

crimson terrace
wet breach
#

people use PDC for the wrong things usually

#

it is convenient but it shouldn't be used for everything

wet breach
rough drift
wet breach
#

technically you can

crimson terrace
#

hmm

#

someone should make a plugin which saves the PDC of any player to a file

#

welp, there go my usual weekend plans for next weekend

rough drift
#

spigot just does not let you get it

crimson terrace
#

XD I figured

wet breach
#

you can create a fake online player object for limited uses

rough drift
#

no like the server itself stores it

#

it ain't a lib

#

its just not able to get it

rough drift
#

time to make that

#

Actually, should I release my plugin core?

#

Its in a half working half broken state, but some stuff could be useful if you wanna see impl (It's also bad code lmfao)

wet breach
#

if you think it would be useful to others, sure. But ultimately it is up to you

rough drift
#

for now its meant to work, I'll make it pretty later

wet breach
#

I have gists and git repos public for various things regardless of what state it is in

#

no one ever said that a repo must be in a working state

crimson terrace
#

but honestly making a yml file for PDCs which other plugins could access sounds like a good idea for a free plugin/dependency

wet breach
#

no it doesn't

rough drift
#

the player .dat file has it iirc

crimson terrace
#

I thought it was somewhere encoded and not retrievable

rough drift
#

nope

#

its just in the .dat from what I remember

wet breach
#

too many developers rely on libs for their plugins as is and don't bother coding their projects in such a way that their plugins still work without those dependencies

crimson terrace
#

fair enough

rough drift
#

I make the dependencies from 0 with pure java, ain't no way I am using a 3rd party lib lmao

wet breach
#

most libs developers use are minor ones and that is what my comment is more directed at 😛

rough drift
#

(Unless strictly needed ofc, like extremely complex ones)

crimson terrace
#

things like protocolib are an exception of course

rough drift
#

ye

#

its now public

#

not all of the packages are done

#

go ahead and tell me everything that's wrong

#

Apart me not following SRP

sharp flare
#

you can add documentation on some finished classes and functions

#

and the use of lombok getters

#

would make your code a lot cleaner

wet breach
#

eeew lombok

vocal cloud
#

Code looks clean w/o lombok

sharp flare
#

well just a suggestion

#

not a place to grill lombok

ivory sleet
#

Lombok adds complexity to your code if anything tho

#

It just virtually makes code disappear, it doesn’t make code cleaner generally speaking, tho it might eliminate illusions and verbosity

wet breach
#

I am never a fan of auto generated code you can't see before hand

ivory sleet
#

Yeah altho Java is taking steps towards eliminating verbosity

#

Like records

wet breach
#

well I think it is fine to have methods that do that

#

as long as it isn't removing methods that provide verbosity

ivory sleet
#

Yeah, I mean the java enhancement proposal had very specific goals in mind when proposing

wet breach
#

I am all for the Java devs in trying to support all types of people

#

just as long they are not favoring one group over another 😛

#

I think what makes Java great is how dynamic it really is though

#

unlike other languages where that just simply isn't the case

ivory sleet
#

I like Java because it added the most necessary things, didn’t add a billion utility features that just bloat the language and to some extent arguably does neither belong to the solution set.

wet breach
#

yeah

#

I do look forward to when Java gives a bit more freedom over the JVM though

#

that would be an interesting thing to see

latent pelican
#

Hi I want to make an Entity move to a specific location (coordinates) in SPigot/Bukkit? How can I do that?

earnest forum
#

Entity#teleport()?

latent pelican
#

Well but teleport does that in a millisecond

#

Thats not smooth at all

#

I want it to walk

round agate
#

if i have to guess then you have to work with server tick

earnest forum
#

yea

#

dont think there is an api method for that

crisp ivy
#

hello i want create placeholder

I want replace:
TimeUnit.MILLISECONDS.toSeconds(combat - now)
to
%time%
in config please help

#

TimeUnit.MILLISECONDS.toSeconds(combat - now) is anti logout time

#

.replace dont working

latent pelican
#

I mean that cant be true

round agate
#

well from top of my head with normal bukkit api. you can use scheduler that run every tick.
or you can use paper api which it called TimeUpdate or something

earnest forum
#

i dont work with player npcs

earnest forum
#

theres stuff that allows you to do it, like the scheduler above but you will have to look into it further

#

you want the npc to walk to a point, with animation and all right?

latent pelican
#

Yesss

#

I want to hand over some coordinates and want it to walk towards them

#

I mean there must be something right

earnest forum
#

try some googling

chrome beacon
#

If you want pathfinding you will need to use NMS

earnest forum
#

oh yeah

#

completely forgot

#

use pathfinding

chrome beacon
#

Paper has some Pathfinding API

hybrid spoke
#

or use PathethicAPI

wet breach
#

maybe someone will eventially PR an entity api method to set a location for entities to navigate to

#

anyways the only way to do it is to use NMS to change its pathfinding

sharp flare
#

feels bad you gotta have to access these on nms

wet breach
#

I think you only have to change its goal

#

not entirely sure

latent pelican
chrome beacon
#

How did you import it and what methods are you trying to use

latent pelican
#

I used this video

#

But for example if I use the getNavigation method its marked red and it always says method not ressolved

chrome beacon
#

I assume you're not using mojmaps

#

So the method will be a(), b(), c() etc

#

To use mojmaps read the 1.18 release post

latent pelican
#

Well yes but inside the getNavigation method is being used

#

`
public PathfinderGoalWalkToLoc(EntityInsentient entity, Location loc, double speed)
{
this.entity = entity;
this.loc = loc;
this.navigation = this.entity.getNavigation();
this.speed = speed;
}

public boolean a()
{
    return true;
}

public void c()
{
    PathEntity pathEntity = this.navigation.a(loc.getX(), loc.getY(), loc.getZ());

    this.navigation.a(pathEntity, speed);
}

}
`

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

wet breach
#

read that thread

#

it will help you with your problem

latent pelican
#

Can you tell me why

#

Would go voice chat

#

It would be sooo helpful

latent pelican
#

Because I use maven as dependency in my project although I dont even know what it makes

#

Please its urgent

wet breach
#

if you import it with maven properly, you shouldn't have an issue in resolving methods

#

don't depend on both the server jar and the api

#

since you are going to be using NMS, you only need the server jar as a dependency as it has the api

latent pelican
#

yeah in dependcies i switched from spigot-api to spigot

#

Could you please help on voice chat

wet breach
#

I don't do voice

#

and I don't do personal help either. Here is fine

#

there is plenty here who can help 🙂

eternal oxide
latent pelican
eternal oxide
#

you didn;t read the 1.18/1.17 post

#

?bootstrap Read the post, but also read the 1.17 post that it links to

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

wet breach
#

this is normal as the player move packet doesn't get sent until they move. Teleport doesn't send this packet

#

you could send a player position packet update

#

to all the others

#

you could probably try using the api to send a chunk update maybe?

#

that is one of few methods that will cause some packets to get sent, not entirely sure if doing that would work

#

but worth trying though

earnest forum
#

can you send a player move event?

#

that should update it right

wet breach
#

no, the event is generated when the client sends a packet to the server that it moved

#

not the other way around

earnest forum
#

ah bummer

tender shard
earnest forum
#

if u teleport the player and then send the player move event

#

the packet

#

should be fine

tender shard
#

if the anti cheat is shitty, then yes

#

however every proper anti cheat has an API you can just cancel their "violation detected" event

latent pelican
#

and we are using maven

wet breach
#

I doubt it will work though

tender shard
#

I haven't really read what the conversation was about

#

I thought they just wanted to teleport a player but still "tell other plugins about it"

wet breach
#

the person is having a problem when you teleport a player, they are invisible to everyone until they move

tender shard
#

that's weird

wet breach
#

so the goal is to try and get the server to send out packets without using NMS

tender shard
#

hm weird, never heard of this problem

wet breach
#

its always existed

#

one of those nuances with minecraft

#

typically it isn't really an issue for most things 😛

latent pelican
#

Buildtools runs exception

tender shard
#

"j"?

#

what command did you enter?

latent pelican
#

java -jar BuildTools.jar --rev 1.18.2 --remapped

tender shard
#

that's correct

#

did you download the latest BuildTools?

latent pelican
#

Yeah probably

wet breach
#

show the buildtools log

#

there is a log file generated

tender shard
#

?paste

undone axleBOT
wet breach
#

?paste

latent pelican
#

where can i find that

tender shard
#

there should be a .log file in the buildtools folder

wet breach
#

in the same directory as buildtools jar

tender shard
#

BuildTools.log.txt

latent pelican
#

Loading BuildTools version: git-BuildTools-1fbeb7f-147 (#147)
Java Version: Java 17
Current Path: C:\Users\SpigotBuildTools\BuildTools.
Exception in thread "main" joptsimple.UnrecognizedOptionException: j is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633)
at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528)
at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59)
at joptsimple.OptionParser.parse(OptionParser.java:396)
at org.spigotmc.builder.Builder.main(Builder.java:164)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)

wet breach
#

is that all there is?

latent pelican
#

yes

wet breach
#

using git bash?

#

or using command console?

#

if you are using command console, recommend trying with git bash instead

small current
#

is there any packet related PlayIn packet ?

#

for inventory getting updated

wet breach
#

there is a few

#

depends on what you are wanting to do

eternal oxide
#

?bt

undone axleBOT
eternal oxide
round agate
#

talk about inventory. I haven't touch packet for a while.
I wonder how can I stop the player able to drag the ghost item out of the inventory?
When I try to cancel the packet, well the server not process it anymore.

So player can drag the ghost item out and throw it away.

Is the SetSlot the solution for this?

eternal oxide
#

why packets? Spigot has a drag event

wet breach
round agate
#

Well I send them fake equipment item.

#

But that without having to touch the SetSlot packet. Because the SetSlot packet have the parameter called stateId which I'm not sure what that's about

wet breach
#

why fake equipment item?

#

not sure why you are doing this the hard way

round agate
#

I want to disguise a few thing.

#

First of all. I can do the normal way yes

#

Well SetSlot indeed work, but I wonder if it's the correct solution to cancel the ghost item, seems like everytime I cancel something in player inventory. Spigot send a few SetSlot packet

worn sigil
#

does anyone know anything about chatcolor2? i need some help

i cant get the permissions for people to use colorcodes in chat right as i want

eternal oxide
granite owl
#

if im making new items derriving from emeralds as base item, serious question because idk in the servers scale,

should i hard/-softcode new items crafting recipe, behavior etc?

#

its going to have quite extensive custom behavior though

#

not like "ignite on hit" rather like loot boxes from mob drops etc

tender shard
#

should i hard/-softcode new items crafting recipe, behavior etc?

#

no

wet breach
#

if you want the ability to change the recipe to something else then soft coding is the way to go

#

but if you are certain that isn't something that is needed then hardcoding it shouldn't be an issue

tender shard
#

is there a plugin that lets PLAYERS define custom crafting recipes?

#

I mean not letting the admin decide, but letting the actual players create new recipes lol

#

eg 1 dirt -> 1 netherite pickaxe

twilit roost
#

Can ServerPlayer ( NMS ) send Plugin Messages?

tender shard
#

no

twilit roost
#

so there's no way of sending plugin messages from server when noone is on them

tender shard
#

nope

#

people commonly use redis for stuff like this

worldly ingot
#

pub/sub is a beautiful thing

tender shard
#

I can confirm this statement

#

although it's not as beautiful as I am

desert tinsel
#

why i have that error?

#

i want to use a boolean, not a string

#

my yaml:

//Seteaza true daca ai nevoie sa folosesti vault impreuna cu pluginul
vault-economy: true
//Daca ai setat true, scrie mai jos cati bani sa coste folosirea comenzii pentru activarea modului
Money: 10000




//Mesaje

passive-activate: '&bAi activat modul passive, ai platit &4&l-&a&l{bani}'
passive-disable: '&4Ai dezactivat modul passive.'

no-vault: 'Dependenta negasita, adauga Vault + un plugin pentru economie. Ex: EssentialsX.'

Sorry for language 🙂

tender shard
#

comments are wrong

#

in YAML comments start with "#"

#

not with //

tender shard
# desert tinsel my yaml: ```yaml //Seteaza true daca ai nevoie sa folosesti vault impreuna cu pl...

Your file should look like this

# Seteaza true daca ai nevoie sa folosesti vault impreuna cu pluginul
vault-economy: true
# Daca ai setat true, scrie mai jos cati bani sa coste folosirea comenzii pentru activarea modului
Money: 10000




# Mesaje

passive-activate: '&bAi activat modul passive, ai platit &4&l-&a&l{bani}'
passive-disable: '&4Ai dezactivat modul passive.'

no-vault: 'Dependenta negasita, adauga Vault + un plugin pentru economie. Ex: EssentialsX.'
desert tinsel
#

oh, what stupid am i

tender shard
#

lol

granite owl
#

@wet breach @tender shard only recipes and behavior defined by me. any user craftable items use vanilla mechanics like enchanting

#

like ive made obsidian tools derriving from iron tools with custom behavior

#

being repaired by "obsidian ingots"

#

which are actually obsidian blocks smelted into iron ingots with a resource pack and behavior to seperate the 2 ingots

tender shard
#

i'D make it configurable anyway

granite owl
#

stuff like that

#

hm

quaint mantle
#

hey i have a question. i have a bungee plugin for coins and token and i need to somehow make a spigot plugin to request balance from the bungee and get a response
how would i do that with the custom plugin messaging

tender shard
tender shard
#

do you ever need to send "messages" without any player online?

#

if yes, you cannot use plugin messaging anyway

#

people commonly use redis to send "messages" between servers

#

but as said, simply storing your balances in a sql db is by far the easiest way I guess

#

hm yeah might be true. sorry I don't know anything about twitch lol

quaint mantle
#

Hey everyone so I'm trying to run a command for an offline command through console and it seems I can't do it. I'm presented with an error. If anyone knows a fix I'd appreciate it.
>[14:07:09 WARN]: Unexpected exception while parsing console command "givelootbox Boryte" org.bukkit.command.CommandException: Unhandled exception executing command 'givelootbox' in plugin KyodoHub v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-21fe707-741a1bd] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-21fe707-741a1bd] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-21fe707-741a1bd] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-21fe707-741a1bd] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-21fe707-741a1bd] at java.lang.Thread.run(Thread.java:833) [?:?] Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_8_R3.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_8_R3.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app') at me.boryte.kyodohub.commands.GiveLootboxCommand.onCommand(GiveLootboxCommand.java:40) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-21fe707-741a1bd] ... 8 more

eternal oxide
#

you can't cast an OfflinePlayer to a Player

quaint mantle
#

Nvm I'm dumb

#

I think I got it

eternal oxide
#

You can only get a Player object if they are online

quaint mantle
#

OfflinePlayer target

tender shard
#

which will of course return null if the player isn't online

#

so yeah offline players cannot run commands

fallow violet
#

makes sense

quaint mantle
#

OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]); Player onlinetarget = Bukkit.getPlayer(args[0]);

#

This is my current code

#

I'll see if it works

fallow violet
#

looks good

#

but make some checks before if the getOfflinePlayer(args[0]); or getPlayer(args[0]); cannot be found

quaint mantle
#

if (args.length == 0) { p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cUsage: /givelootbox <player>")); return true; }

#

Oh I get what u mean

kindred valley
#

can i make black color more readable?

tender shard
#

to use basically every color you like

kindred valley
#

how

harsh totem
#

im trying to register an event in the OnEnable() and it says Cannot resolve method 'registerEvent(MuteEvent, Minecraft)'
Idk why this is happening.

eternal night
#

wrong method name

#

its registerEvents

#

not registerEvent

harsh totem
#

oh bruh

#

it auto corrects me to without the s

#

tf

eternal night
#

I mean that method exists too

#

just takes different parameters

harsh totem
#

oh

polar crow
#

What event will call when entity Item was removed?

kindred valley
#

is there any plugin i can hide players nametags through walls

tender shard
#

I love this

harsh totem
#

I have this in an event @EventHandler public void OnPlayerChat(PlayerChatEvent event){ Player player = event.getPlayer(); FileConfiguration config = Minecraft.getPlugin(Minecraft.class).getConfig(); System.out.println(player.isOp()); System.out.println(globalMute.getIsMuted()); if (!player.isOp()){ if (globalMute.getIsMuted()){ player.sendMessage(ChatColor.RED + String.valueOf(config.get("The chat is currently muted!"))); event.setCancelled(true); } } } and I have this in my main: ```public final class Minecraft extends JavaPlugin {
public FileConfiguration config = getConfig();

public FileConfiguration getConfig(){
    return config;
}

@Override
public void onEnable() {
    // Plugin startup logic
    this.getCommand("globalMute").setExecutor(new globalMute());
    getServer().getPluginManager().registerEvents(new MuteEvent(), this);
    config.addDefault("GlobalMuteMessage", "The chat was muted!");
    config.addDefault("GlobalUnmuteMessage", "The chat was unmuted!");
    config.addDefault("PlayerMutedMessage", "The chat is currently muted!");
    config.options().copyDefaults(true);
    saveConfig();
}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}```
I don't think I used the config correctly, can someone explain me what I should do?

tender shard
#

I added the comments to that javadocs page lol

harsh totem
tender shard
#

looks good. where's the problem?

harsh totem
#

I actually don't understand what i've done with config

#

how do i get it from the key?

#

ok

#

Cannot invoke "org.bukkit.configuration.file.FileConfiguration.addDefault(String, Object)" because "this.config" is null what?

#

Wdym?

    public FileConfiguration config = getConfig();

    public FileConfiguration getConfig(){
        return config;
    }

    @Override
    public void onEnable() {
        // Plugin startup logic
        this.getCommand("globalMute").setExecutor(new globalMute());
        getServer().getPluginManager().registerEvents(new MuteEvent(), this);
        config.addDefault("GlobalMuteMessage", "The chat was muted!");
        config.addDefault("GlobalUnmuteMessage", "The chat was unmuted!");
        config.addDefault("PlayerMutedMessage", "The chat is currently muted!");
        config.options().copyDefaults(true);
        saveConfig();
    }```
deft patrol
#

so i was interested in creating a tool which can publish plugin updates for me so my question is, is there a rest api or some way to make an http request to update a resource on spigot

harsh totem
#

so just put it like this? public FileConfiguration config;

#

I think that the plugin just doesn't know what file is the config but idk how to fix it

#

Shouldn't all the stuff after FileConfiguration config = getConfig(); be in the OnEnable()?

#

Idk I tried searching and there doesn't seem to be an error even tho it doesn't work

#

when the plugin is loaded it crashes and the console says Cannot invoke "org.bukkit.configuration.file.FileConfiguration.addDefault(String, Object)" because "this.config" is null

fallow violet
#

I have redis now running. Now i have one question: How can i publish values? I found only ways to subscribe channel (what i already did in my plugin) BTW: I use lettuce

ivory sleet
#

you got the client

#

open a pub sub connection and register a subscriber

#

if you also wanna write messages, you'll have to open a second connection

patent horizon
#

hi would anyone know why the values im grabbing from inside the croupier class are returning null? they have default values of 0

tardy delta
#

omg that format

fallow violet
#

ouch

eternal oxide
#

What is in PlayerCroupierData ?

ivory sleet
#

I mean then you invoke publish on the second connection

#

I have an example if you need

fallow violet
#

please

patent horizon
tardy delta
ivory sleet
#

yes

eternal oxide
fallow violet
#

ah wait async => asyncWrite

eternal oxide
#

show the error

tardy delta
#

?paste

undone axleBOT
patent horizon
eternal oxide
#

PlayerData.java:29

patent horizon
#

public int getCoinflipWins() { return this.croupierData.coinflipWins; }

eternal oxide
#

?paste your PlayerData class

undone axleBOT
patent horizon
#

it's a nice little treasure trove of getters and setters

eternal oxide
#

Okm the error makes no sense to me. You must have failed to update teh jar on your test server

#

The code you have show should not be possible to generate that error

#

afraid I have to go for now though

patent horizon
#

thats exactly what i thought

#

that code's been there for like a month, and all the sudden I can't reach those values without hitting null

quaint mantle
#

?paste

undone axleBOT
wet breach
patent horizon
#

yeh i think im thinking what ur thinking

wet breach
#

well the error doesn't relate to the code you showed

patent horizon
#

i mightve called for the data before the class is loaded

fallow violet
ivory sleet
#

if you use the async thing, if you test you might wanna join the future

cursive briar
#

When using BuildTools for craftbukkit it seems that it doesnt create the actual jar...
https://i.gaeta.me/gzBjf is the logs

#

it just says that but the file doesnt actually exist

fallow violet
#

i have to use sync?

patent horizon
wet breach
ivory sleet
#

no

#

you should be using the async api

#

but for testing join the future

cursive briar
ivory sleet
#

so that you can test the code predictably

fallow violet
#

nervermind i have to go now

ivory sleet
#

publish(..., ...).toCompletableFuture().join()

wet breach
#

where do you get that object from?

#

the croupierData

#

I don't see where you are setting it in that class at all

#

which is what this refers to

patent horizon
wet breach
#

can I see this class PlayerCroupierData

wet breach
cursive briar
#

nope im telling it to compile craftbukkit not spigot anyways yk

wet breach
#

that is why

#

craftbukkit no longer supported and isn't put in the directory with the buildtools jar

#

only spigot.jar which is what you should be using anyways

cursive briar
#

even with --compile craftbukkit

wet breach
#

yep even with that

dusk flicker
#

Please use spigot

patent horizon
wet breach
#

or you using lombok?

patent horizon
#

theyre in PlayerData

patent horizon
wet breach
cursive briar
dusk flicker
#

Why do you need it for testing

wet breach
# patent horizon as seen in this picture

the way you are calling the variable in that other class you are doing it via a static way and the variable isn't classed as being static, thus it isn't really initialized.

cursive briar
#

Im creating an inline cli for my linux servers that would allow me to swap jar types on the fly

wet breach
#

so it is therefore null

dusk flicker
#

The reason it's probably not allowed to be done anymore as it's an unsupported version, that no one in their right mind should be running

#

And why do you need CB for that rather than Spigot?

patent horizon
wet breach
wet breach
patent horizon
wet breach
#

basically, but your getters and setters are in a different class which doesn't quite work the same

dusk flicker
#

That link doesn't look sketch at all

cursive briar
#

its my image server sry

#

using sharex

wet breach
#

the one without the name original is the one yo uwant

dusk flicker
#

Oh I know it's just sketch lol

wet breach
#

original is before shading

cursive briar
cursive briar
#

will it always have R0.1-SNAPSHOT on all versions?

wet breach
#

yes or some variant of that

#

that indicates the API version

dusk flicker
#

I don't think I've ever seen one with anything else there for those lol

cursive briar
#

pain

misty current
#

does anyone know a good delaunay triangulation library? The one i have tried doesn't yield the best results

wet breach
cursive briar
cursive briar
#

o

misty current
#

i have found an interesting method to generate dungeons online that consists in generating rooms, creating a triangle mesh and getting the minimum spanning tree to generate the corridors

wet breach
#

you weren't around for it, sorry 😛

cursive briar
misty current
#

i wanted to try out the concept for fun and i soon realized its not as easy as it seemed

#

and the lib im using doesnt work very well

wet breach
misty current
#

yea the other rooms

wet breach
#

and in the picture above, how is it you are testing it?

patent horizon
# misty current i have found an interesting method to generate dungeons online that consists in ...

Read the original blog post here: https://vazgriz.com/119/procedurally-generated-dungeons/

Github repo: https://github.com/vazgriz/DungeonGenerator

This video describes an algorithm for procedurally generating 3D dungeons.

0:00 Intro
1:03 2D Algorithm
3:40 2D Dungeon Example
4:17 3D Algorithm
8:39 3D Dungeon Example

▶ Play video
misty current
#

that picture above is just me testing the library

#

yep

#

that one

wet breach
#

There is many ways for pathfinding

patent horizon
#

yeh i saw it awhile ago and thought it was interesting

wet breach
#

So, what kind of pathfinding are you wanting for your dungeons?

#

least distance? Most optimal?

#

crazy wacky way that does whatever XD

misty current
#

if you watch the intro of the video wally sent you'll probably understand what i am going for

wet breach
#

well you don't necessarily need a triangle mesh, you could go with a diamond mesh

#

or an octagon mesh

misty current
#

not really sure if that would be easier to implement lol

wet breach
#

Well, they allow for doing certain things. Triangle meshes give you more granular control, but sometimes such fine control isn't really needed

#

thus a different polygon that uses up more space for the rendering can be better

#

so for instance, in MC a corridor is optimal in a 2x2 configuration but you can have corridors that are 1x2

#

in a 2x2 configuration, diamond or hexagon would be more optimal and do the job while using less resources

#

however meshes are really not that hard. In coding the polygon is essentially an object that contains a set of points to describe its area it takes up

#

the larger the polygon the less information you need to store

misty current
#

i guess i could try doing that too

wet breach
#

just giving you more information so you don't think you need to find something that strictly uses triangle meshes and that other kinds of meshes do exist 😛

misty current
#

more than the final outcome i was interested in creating a delaunay triangle mesh but thats still useful to know

wet breach
#

but it also helps to understand when and why to use one type of polygon over another

#

while it is true you can fit more triangles in a given area, you are also most likely storing more information then what is necessary

#

in other words sure you got super high level of control, but unnecessary for your objective 😉

#

if this stuff interests you which it seems like it

#

recommend researching game theory and the related 😄

lethal python
#

if i want to store a list of things in the world and a string and xyz for each one, should i just store it as a file or should i use a database

misty current
#

aight thanks

lethal python
#

should i use csv or a database

wet breach
#

database would be better

#

csv is flat file still

#

just a different format

lethal python
#

so i should use a whole ass db just to look up the name and position of at most 50 armorstands

fringe hemlock
#

SQLite

lethal python
#

is that really optimal?

#

i will do it but what benefits does it pose over just using json or csv

#

for something as simple as this

#

keep in mind it's as simple as this

kindred valley
#

hello guys what the hell is skript

fringe hemlock
#

Are you loading the values from the file into memory where the file will never be touched again, or using the file as the pet ant location

#

Permanent*

lethal python
#

the file is loaded, read, very rarely written to

#

but it will be written to sometimes

#

about as often as a player might place a lodestone

fringe hemlock
#

Where will the values be saved when loaded from the file

lethal python
#

they will be written back to the file

#

i just need some really really minimal persistent storage

brave sparrow
#

That sounds like a use case for flatfile

fringe hemlock
#

I agree mineplex developer

brave sparrow
#

Lol

fringe hemlock
#

:p

lethal python
#

pogu i don't have to learn database!!1

brave sparrow
#

I mean you’ll still be better off learning it in the long run

#

You just shouldn’t use it for this

fringe hemlock
#

I mean it is a nice skill to have as said above

lethal python
#

yes i will use one eventually

#

so i just use csv/json for this right?

#

there's no fancy .flatfile right?

fringe hemlock
#

Maybe even yaml sure

#

Before I learned SQL I only used yml Lol it got me through the early days

lethal python
#

o shid i will need to learn how to make it so when u drop the jar in the server it makes a folder just for that plugin with all its associated files ://

#

is that easy

fringe hemlock
#

Yes

lethal python
#

what section of spigot docs is that

fringe hemlock
#

it’s actually a File class from Java to create them

lethal python
#

:v ?

brave sparrow
#

Flatfile isn’t a file type

#

It just means storing it inside a file

lethal python
#

ye i was hoping it was that

brave sparrow
#

As opposed to a database

lethal python
#

but alex do u know what im talking about now

#

the part where the jar puts itself in a folder with associated files

#

like a config

brave sparrow
#

Use YamlConfiguration, it’s already inside spigot

fringe hemlock
#

Alex does that classify a SQLite as a flat file storage

brave sparrow
#

Default configuration and whatnot

brave sparrow
fringe hemlock
#

Ah yea just making sure

lethal python
#

ok so this defaultconfiguration thing is specifically for saving a config file

quaint mantle
#

im trying to create an optimized version of StringBuilder

#

it seems that my allocations are slow

ivory sleet
#

I mean StringBuilder is fast and optimized

brave sparrow
#

StringBuilder is pretty optimized

#

Lol

ivory sleet
#

like it uses copyarray from System for instance

quaint mantle
#

so do i

ivory sleet
#

yeah but thats the biggest significant optimization

quaint mantle
#
public void growShift() {
    char[] newBuffer = new char[this.buffer.length << this.shiftBy];
    System.arraycopy(this.buffer, 0, newBuffer, 0, this.buffer.length);
    this.buffer = newBuffer;
}

public void append(char c) {
    if (this.size == this.buffer.length) {
        this.growShift();
    }
    this.buffer[this.size] = c;
    this.size++;
}

StringBuilder does more checks though, so why is my version slower?

ivory sleet
#

iirc jvm and compilers may do some optimizations when it comes to StringBuilder since thats a known class in the jdk

quaint mantle
#

so basically its optimized to the max already

#

got it

#
    @Override
    public AbstractStringBuilder append(char c) {
        ensureCapacityInternal(count + 1);
        if (isLatin1() && StringLatin1.canEncode(c)) {
            value[count++] = (byte)c;
        } else {
            if (isLatin1()) {
                inflate();
            }
            StringUTF16.putCharSB(value, count++, c);
        }
        return this;
    }

because theres no way in hell that this is faster than my implementation

quiet ice
#

Yeah, StringBuilder is hotspot instrinsic

#

Or at least a candidate for being instrinsic

quaint mantle
#

i hate java.

fringe hemlock
#

I dislike C++

quaint mantle
#

we all do

quaint mantle
quiet ice
#

    @IntrinsicCandidate // <-- beware this annotation
    public StringBuilder append(char c) {
quaint mantle
quiet ice
#

that being said there are instances where JIT outperforms instrinsics, System#arraycopy is a nice example there

lethal python
#

this server is really good for help because people reply and nobody is like "nOt eNoUgH iNfO" and gatekeepy

quiet ice
#

a for loop can copy certain kinds of arrays faster than arraycopy

crude pine
#

anyone who knows protocol; can you answer a quick question of mine?

For field indexes, are they the index of all fields, or just the fields of the type (e.g. boolean)

quiet ice
#

what do you mean with field indexes?

quiet ice
#

Could you link a packet or something where this is used?

crude pine
#

in protocollib, you get firlds by their index, right?

quiet ice
#

not that I think

#

I believe that this is an exclusive or basically

#

So either the packet is "addPlayer", "updateGamemode", "updatePlayer", etc. What is what is defined by the "action" field

#

There are no indices there (outside of the indices in the array)

crude pine
#

hm, so then how do I get the different fields?

#

i had this all figured out a few months ago but i lost the code i was using 😭

quiet ice
#

How you do it is beyond me as it is highly library dependent

crude pine
#

im using ProtocolLib

#

sorry i meant to put ProtocolLib instead of protocol in my original message 😄

#

ok, looking at some things it looks like the index is different for each "type"

granite owl
#

im sorry im sadly not that great with java first off so pls no bashing for this basic question, so with PDC i can give an interface as parameter like this PersistentDataType.STRING, however ive seen its using a template system, PerisistentDataType<T, Z>. how can i now use this in a fashion like this PersistentDataType<java.lang.String, java.lang.String> instead ? im having a function thats supposed to take an Object as parameter since every class including primitives are derriving from that class and then resolve the Object into its type and give it as param for the PersistentDataType interface

#

that its practically working like this

#
public boolean setItemData(String key, String value)
    {
        if (this.is != null)
        {
            if (this.is.hasItemMeta())
            {
                ItemMeta meta = this.is.getItemMeta();
                meta.getPersistentDataContainer().set(new NamespacedKey(main.getPlugin(main.class), key), PersistentDataType<value.getClass().getSuperclass(), value.getClass().getSuperclass()>, value);
                this.is.setItemMeta(meta);
                return true;
            }
        }
        
        return false;
    }
#

if that shouldnt be possible ill simply serialize everything to a byte array and treat them equally

quaint mantle
#

your codestyle is hard to look at

#

i hate newline curly braces

golden kelp
#

same

tardy delta
#

i hate people who dont use early returns

misty current
#

can you create a world that never ends up in the disk?

misty current
#

but that code style is bad indeed

tardy delta
#

if else be like

visual tide
#

oh no

#

oh nonononono

#

}else{

#

eeeeee

tardy delta
#

:{

visual tide
#

spaces boiiiiiiiiiii

sleek pond
#

You mean store it in ram?

crisp steeple
#

i doubt it would be possible to use a world without ever saving it to the disk/other data source, you could just delete it whenever you’re done with it though if that’s what you’re looking for

knotty meteor
#

Does someone know how i can do if a player gets hit that he stays on the ground and not make a little jump in the air?
Like a smoothattack or something

crimson terrace
#

maybe cancel the event and deal the damage yourself?

knotty meteor
#

Its not about the damage itself but that the attacked player goes backwards without going in the air

patent horizon
#

is persistent data only for items? or can i add persistent data to entities as well?

crimson terrace
#

yes you can

crimson terrace
knotty meteor
#

Hmm i can try that, thanks!

crimson terrace
#

np, hope it works

patent horizon
#

if String isn't a primitive object, how come I can get it without needing an import statement?

crimson terrace
#

the words primitive and object clash imo

ivory sleet
#

which is imported by default

tardy delta
#

?learnjava moment

undone axleBOT
tardy delta
#

wheres the w3schools one tbh

quiet ice
#

w3schools isn't that great for java last time I checked (which must be a few years ago now)

tardy delta
#

for beginners it can be but ye

granite owl
#
Bukkit.addRecipe(new FurnaceRecipe(new NamespacedKey(plugin, "recipe_furnace"), new ItemStack(Material.EMERALD, 1), (RecipeChoice) new ItemStack(Material.EMERALD), 1, 200));
```does this work to create a cooking recipe from a specific itemstack?
#

instead of just material

#

i want a recipe with explicit matching material

#

better question how do i make it work

#

because ive seen recipes hold a value
setInputChoice

eternal oxide
#

You can;t cast an ItemStack to a RecipeChoice

granite owl
#
RecipeChoice.ExactChoice choice = new RecipeChoice.ExactChoice(new ItemStack(Material.DIRT));
```think ive figured how
#

thats being accepted by the api

#

its being accepted by the frontend

#

its demanding explicit nbt data now

#

so u can make crafting recipes with custom items without using the api wow

#

smelting*

#

lol this is just working fine without cancelling events, vanilla base item that the custom item is derrived of is not recognized as source material```java
Bukkit.addRecipe(new FurnaceRecipe(new NamespacedKey(plugin, "furnace_diamond"), new ItemStack(Material.DIAMOND, 1), new RecipeChoice.ExactChoice(DiamondDustPile.getItemStack()), 1, 200));

#

when ive been asking...

tardy delta
#

oneliners aaaaaa

daring lark
#

item.getItemMeta().getDisplayName(); why tihs not return item name?

tardy delta
#

whats it returning then?

daring lark
tardy delta
#

or is it throwing a npe?

granite owl
# tardy delta oneliners aaaaaa

that doesnt explain why no one has ever told me explicit smelting recipes are a thing when ive been explicitly asking at multiple occasions. ive only found this by chance when digging trough the api

daring lark
#

like empty string

granite owl
#

for a different thing

#

and then thinking

#

wait thats a thing?

#

with the general answer being

#

"nah you can only give a material for furnace recipes"

#

when this is clearly not the case

fossil lily
#

What's the max bow durability?

granite owl
obsidian junco
#

p.getinv,getiteminmainhand.getmaxdurability

fossil lily
#

oh!

#

ty

obsidian junco
#

or p .getiteminhand

granite owl
#

thats literally on the wiki...

obsidian junco
#

I think cntrl+H for tooltips

granite owl
#

durability is hardcoded and dura changing enchantments dont even touch it directly

obsidian junco
#

includes duribility in lore

granite owl
midnight shore
# daring lark nothing

if the itemstack doesn't have any custom name, so it renders the default minecraft name that will return "". to get the name you should use the material i guess

#

the name would return correctly only if there is a custom one

obsidian junco
#

im playing with a /fix command that im struggling with atm

#

setting item duribility to max durability sets it to 0

fossil lily
#

So why isn't this setting the durability in chunks of 3?

obsidian junco
#

but a comment sends max durabilitty correctly

#

thats odd

misty current
#

can you create a world that always stays in ram and that doesnt get saved to disk?

misty current
#

when the server is closed it is gone

#

i know i could delete it when my plugin is disabled but i was wondering if there was the better option of making the world not save at all

snow obsidian
#

Hello guys, who can help me with plugin RPchat?

eternal oxide
snow obsidian
#

but unfortunately no one answers me

eternal oxide
#

You havn't asked any questions in there yet

#

ask an actual question to get help

obsidian junco
#

anyone know this the following code sets durability to 0

#

ItemStack inhand = p.getInventory().getItemInMainHand();
short maxDurability = inhand.getData().getItemType().getMaxDurability();
inhand.setDurability(maxDurability);
p.updateInventory();
sender.sendMessage(prefix+ChatColor.WHITE+" Repaired item in-hand");

eternal oxide
#

Durability is more of a damage indicator. 0 = a new weapon

obsidian junco
#

whats the best way to go about getting the repair command done

eternal oxide
#

if you want to repair an item, set durability to zero

obsidian junco
#

ok

#

works perfect, thank you

daring lark
#

did itemstack overrides equals()?

eternal oxide
#

two stacks of different sizes will not be equals(). Use isSimilar to compare stacks

daring lark
#

oh thanks man

eternal oxide
#

and yes ItemStack overrides equals()

granite owl
#

okay nice explicit items with nbt data as crafting material also works for crafting recipes making manual checking at runtime obsolete

#

great

eternal oxide
#

nice

granite owl
#

lmfao

#

why did ppl always say doesnt work otherwise

#

xept for runtime solutions

eternal oxide
#

quantities require runtime solutions

granite owl
#

hm?

#

writing a loader

eternal oxide
#

needing more than one of an item

granite owl
#

like look m8

#
//Diamond Dust Recipe
        ShapedRecipe recipe_diamond_dust = new ShapedRecipe(new NamespacedKey(plugin, "recipe_diamond_dust"), DiamondDust.getItemStack());
        recipe_diamond_dust.shape("CCC", "CCC", "CCC");
        recipe_diamond_dust.setIngredient('C', new RecipeChoice.ExactChoice(new ItemStack(Material.COAL_BLOCK)));
        Bukkit.addRecipe(recipe_diamond_dust);
        
        //Diamond Dust Pile Recipe
        ShapedRecipe recipe_diamond_dust_pile = new ShapedRecipe(new NamespacedKey(plugin, "recipe_diamond_dust_pile"), DiamondDustPile.getItemStack());
        recipe_diamond_dust_pile.shape("DDD", "DDD", "DDD");
        recipe_diamond_dust_pile.setIngredient('D', new RecipeChoice.ExactChoice(DiamondDust.getItemStack()));
        Bukkit.addRecipe(recipe_diamond_dust_pile);
        
        //Furnace Recipe for Custom Items
        Bukkit.addRecipe(new FurnaceRecipe(new NamespacedKey(plugin, "furnace_diamond"), new ItemStack(Material.DIAMOND, 1), new RecipeChoice.ExactChoice(DiamondDustPile.getItemStack()), 1, 200));
        Bukkit.addRecipe(new BlastingRecipe(new NamespacedKey(plugin, "blastfurnace_diamond"), new ItemStack(Material.DIAMOND, 1), new RecipeChoice.ExactChoice(DiamondDustPile.getItemStack()), 1, 100));
```bad coding its just a test ik, this already makes a fully functional system to craft diamonds from coal
#

this, can easily be put into a softcoded loader system

eternal oxide
#

yes