#help-development

1 messages · Page 1952 of 1

quiet ice
#

Which mostly is just "do it yourself"

sterile token
#

I dont still understand your gth code

#

So im really confuse

quiet ice
#

do you even have a extension/plugin/module/mod/whatever loading system in place?

woeful crescent
#

which packets to i need to catch to suppress movement perception?

#

(protocollib)

quiet ice
#

Another pretty obscure example would be https://github.com/Geolykt/Presence, where the API classes are located under de/geolykt/presence/common. It has absolutely no interfaces but was built as an API (while also serving as the implementation of the API) strictly speaking. In the end an API can be everything you want as long as you document it

visual tide
#

obfuscate your api to make it even better 🌝

woeful crescent
#

Yes 🙂

tender shard
#

make an api to interact with your api

woeful crescent
#

make an api to check the weather

#

if it's cold outside then more people will be playing so you need to order more servers

tender shard
woeful crescent
#

from mircosomft

quiet ice
#

Does IntelliJ use less RAM than eclipse?

woeful crescent
tender shard
quiet ice
#

I'm in a sticky situation where I have to fear the OOMKiller but I still want to make use of an IDE

woeful crescent
#

what, are you gonna tell me next that you use the interfaces in Spigot instead of the NMS classes?

quiet ice
#

I mean, I could just stop using discord

woeful crescent
#

only develop with NMS and it will be compatible with everything 🧠

sterile token
# quiet ice Another pretty obscure example would be <https://github.com/Geolykt/Presence>, w...

What do you think about this is good practice?


public interface Api {

  JavaPlugin getPlugin();

}

public static class ApiImplement implements Api {

  @Override
  public JavaPlugin getPlugin() { return JavaPlugin.getProvidingPlugin(ApiProvider.class); }
}

public static class ApiProvider  {

  private final static ApiProvider instance = new ApiProvider();
  private final Api api = new ApiImplement();

  public static ApiProvider getInstance() { return instance; }

  public Api getApi() { return api; }
}

public static class ApiConsumer {

  public void enable() {
    Api api = ApiProvider.getInstance().getApi();
    api.getPlugin().getName();
}
hybrid spoke
#

since spigot doesn't have any anyways

woeful crescent
#

yeah i can't find them

#

there isn't even a net.spigot package 😦

dusk flicker
#

naming it api aint good imo

sterile token
tardy delta
#

singleton

quiet ice
#

Ideally you'd have two classes. In Bukkit space these two classes would be Server and Bukkit

quiet ice
#

All other classes are irrelevant

woeful crescent
#

protocollib

sterile token
minor otter
#

Why is it when i edit tripwire blockstates, the player sees the wrong blockstate until they relog?

quiet ice
#

Well, to continue the example of bukkit, it stores an instance of Server within the Bukkit class. (CraftMain (I think it was called that at least) sets it after it constructs the CraftServer class, which implements the Server interface)

#

The CraftServer class and co do not need to be exposed within the API and ideally should be in a seperate repository, but that can be difficult to maintain which is why I do not do it

#

However if you make an API ontop of bukkit and want other people to register implementations of it, use Bukkit's service API which more or less does the same thing just that you only need the interface class. For example the vault api only needs to provide Economy but not any holder class as that is already done by the service api

sterile token
#

Hmn you probably no understanding me or im not explaning good

tardy delta
#

how can a location not have a world?

#

so the #getWorld will return null

blazing scarab
#

yes

#

World is nullable

#

And thats ugly af

tardy delta
#

but all blocks in an event will have a nonnull world for the location right?

blazing scarab
#

Yeah

tardy delta
#

if the world unloads i guess

#

because its a reference

quiet ice
#

it wont go null

hybrid spoke
#

if anything refers to the location, it also implies the reference to the world

#

but there is this ugly #setWorld method

quiet ice
#

If you obtain your location from bukkit, you will always get a non-null values

hybrid spoke
#

where you can null the world yourself

tardy delta
#

meh

brave sparrow
#

The world can’t unload in the middle of the event

#

So no it won’t be null

tardy delta
#

so theoretically it should never be null

quiet ice
#

And as per javadocs, it will throw an exception if it is unloaded

hybrid spoke
#

if the world is unloaded but accessed, there will be an IllegalArg thrown

quiet ice
#

It likely will never be null

#

Unless of course some plugin implements one of the APIs

brave sparrow
tardy delta
#

oki thanks

spiral light
#

not always non null world in locaton!

terse panther
#

Hey anyone do know why this <for cycle> is not being iterated? The prints are to debug the plugin.
<System.out.println("CHUNK Charged");> is being printed on the console, but the < System.out.println("For cycle");> is being printed

lavish hemlock
#

Could be that entities is empty.

terse panther
#

there is a another way to get entities on recently load chunk?

spiral light
#

the entities are not loaded when ChunkLoadEvent gets called

#

also you shouldnt create the mobs-list on each ChunkLoadEvent xD

terse panther
#

thanks!

spiral light
#

i think there was a discussion about exactly that ...

terse panther
#

there is another option to get that chunk?

terse panther
#

I want to know the solution

spiral light
#

you dont need the discussion

#

what version do you use ?

terse panther
spiral light
#

i think 1.18.x has the EntitiesLoadEvent and the EntitiesUnloadEvent

terse panther
#

Thank you so much!!!

minor otter
#

How would I stop the client from predicting blockstate changes

muted sand
#

kick the client :smart:

hexed hatch
#

firmly tell it no

lavish hemlock
#

Distract it

#

If it's looking away from the block, it can't predict the state change :)

muted sand
#

exactly

lavish hemlock
#

(Obviously)

muted sand
#

Schrödinger's cat

hexed hatch
#

I love helping people

lavish hemlock
#

Same

minor otter
#

I dont want to upset the client and make it sad so is there a more positive way of saying no?

#

Update; found an article from 2018, since the 1.9 update the client reacts better to positive reinforcement and praise

candid plover
#

How to open inventory sync?

hybrid spoke
#

player#openInventory ThinkIn

candid plover
#

Return inventoryOpenEvent may only be triggered synchronously.

vocal cloud
#

You want to open an inventory async?

chrome beacon
#

You can use the scheduler to open the invetory next tick

#

?scheduling

undone axleBOT
woeful crescent
#

what's the difference between REL_ENTITY_MOVE, REL_ENTITY_LOOK, and POSITION with ProtocolLib packets?

woeful crescent
#

but like

#

protocollib

#

idk what packet names associate with which packets

chrome beacon
#

Ctrl click it

#

It will tell you

woeful crescent
#

no but like

#

i don't know which PacketType names associate with what packets

opal juniper
#

ok yeah

chrome beacon
#

Exactly ctrl click the PacketType

#

It should have the packet name in the PacketType constructor iirc

opal juniper
#

nah it doesnt

#

not a meaningful one really

mortal hare
#

why people use base64 for encoding binary data to ascii strings instead of OutputStream#toString() method?

#

wouldnt use of toString() method result in smaller lengths of the string

#

base64 on average increase the file size by more than 25%

#

for example this byte array

byte[] = new byte[]{65, 66, 67};

could be decoded to
ABC string

drowsy helm
#

when you're working with small objects, 25% doesn't really matter

mortal hare
#

if we're using ascii

#

what's the point of inflating in the first place

drowsy helm
#

some people just arent aware of it

#

not a huge deal

minor otter
#

When editing blockstates the client will try to predict what it should be and will show something it isn't, how do i go about updating this?

mortal hare
#

well base64 is used for places where ASCII could be used

#

and to prevent bugs with weird characters, for example newline characters

#

since ASCII has over 20 control characters

#

and its "signed" charset (127 chars), thus there's no way to fit byte values above 127 without encoding separately in ASCII (unless we use extended charsets, like UTF-8)

#

maybe that's why

#

i think i answered myself lol 😄

onyx fjord
#

🥲

mortal hare
#

Its just so annoying that ASCII doesnt hold 255 values

#

and instead it holds half

#

you wouldnt need any encoding then (if you werent evading bad symbols)

#

?paste

undone axleBOT
mortal hare
#

am i blind or am i not seeing difference between ObjectOutputStream

#

and BukkitObjectOutputStream

#

it just extends the ObjectOuputStream class

#

and adds in one method

#

but inorder to write to the stream we use super method

#

of ObjectOutputStream

#

nvm

#

it overrides

   @Override
    protected Object replaceObject(Object obj) throws IOException {
        if (!(obj instanceof Serializable) && (obj instanceof ConfigurationSerializable)) {
            obj = Wrapper.newWrapper((ConfigurationSerializable) obj);
        }

        return super.replaceObject(obj);
    }
#

to add in support for bukkit object deserialization

alpine urchin
mortal hare
#

yea

#

literally

alpine urchin
#

LOL

mortal hare
#

i do this in real life too

#

sadly

alpine urchin
#

poor u

#

took screenshot of ascii thing

#

hopefully useful in future

alpine urchin
mortal hare
#

😄

#

well i'm not responsible for actions you do with that 😄

#

that's just a thought

alpine urchin
mortal hare
#

im waiting for me to roast someone for asking such dumb questions

alpine urchin
#

ima sleep

#

pce

mortal hare
#

good night

#

why this

#

warns me

#

byte[] is an object

#

which can be null

vast junco
#

Is there a reason why PlayerPortalEvent doesn't get called when the player enters the exit end portal inside the end, and is there a workaround to be able to cancel it?

vast junco
mortal hare
#

Hi, @Nullable has TYPE_USE target, it's applied to the array element type, not to the array type itself. To annotate the array type with the TYPE_USE annotation, use byte @Nullable [] bytes syntax.

#

solved

#

although i never seen a dude

#

who annotates like this

#
byte @Nullable []
#

that's weird

quaint mantle
#

horrific

mortal hare
#

tada! no warning

mortal hare
# quaint mantle horrific

you're not the one, who thinks this way:

But don't you think it's weird to declare an array this way?

Can the IDE be more intelligent in recognizing primitive arrays?
quaint mantle
#

byte @Nullable []
byte type inside of a Nullable array

#

but i'd like a different syntax

#

i dont know what that would be though

mortal hare
#

its the same type of situation like in C/C++ with pointers and references

quaint mantle
#
fun something() -> Array<Byte>? {

}
mortal hare
#

the long time war of

int* pointer;

vs

int *pointer;

or
int * pointer

quaint mantle
#

i like int*

#

because it is a reference to an int

#

although it can be seen another wway

mortal hare
#

yea i prefer int* too

quaint mantle
#

int *pointer
a pointer to the variable

#

i just dont like the way it looks

mortal hare
#

because when you think in your head it sounds technically correct an integer pointer as a type

quaint mantle
#

but

#

nvm

#

"a pointer to pointer with an int value"

#

⚰️

mortal hare
#

pointer hell

candid plover
#

Is bad?

#
                LBPlayer data = MainEngines.getPlugin().getManager().getCached(target.getUniqueId());
                scheduler.runTask(MainEssentials.getPlugin(), () -> player.openInventory(getInventory(data)));
            });```
quaint mantle
#

why async

#

you're just opening a cached inventory right

candid plover
#

When I open a menu extracting information from the database, do I do this?

patent horizon
#

should package names be uppercase or lowercase

young knoll
#

Lower

patent horizon
#

....

dusk flicker
#

?conventions

undone axleBOT
patent horizon
#

who the fuck harassed me into doing it otherwise

#

months ago

#

"tHaTs NoT pRoPeR nAmInG CoNVeNTIoNs"

quaint mantle
#

your code could improve but the idea is correct

candid plover
#

example.

quaint mantle
#

instead of using Main#getPlugin

#

use dependency injection

#

?di

undone axleBOT
dusk flicker
#

?main yours is eh but still not good

quaint mantle
dusk flicker
#

still

quaint mantle
#

still a bad name imo

dusk flicker
#

Essentials or EssentialsPlugin would be better

quaint mantle
#

stop stealing my words

dusk flicker
#

lol

young knoll
#

Essentials is taken smh

#

You gonna get sueded

candid plover
#

Is a private plugin

sacred ice
#

Why just not shading jar and using classes

young knoll
#

What

candid plover
#
                try {
                    LBPlayer data = MainEngines.getPlugin().getMySQL().getData(target.getUniqueId());
                } catch (NullPointerException exception) {
                    player.sendMessage("§cJogador não encontrado.");
                }
            });
            scheduler.runTask(MainEssentials.getPlugin(), () -> player.openInventory(getInventory(target, data)));```
#

How do I pull data from the database async and pass it to the menu?

#

I can't get the menu to open in async, it returns an error.

neon minnow
#

How can i get an offline players uuid

young knoll
#

OfflinePlayer#getUniqueID

wicked remnant
#

anyone know how to get around

Bukkit.getPluginManager().addPermission(new Permission(key, description, TRUE));
Bukkit.getPluginManager().removePermission(new Permission(key));
Bukkit.getPluginManager().addPermission(new Permission(key, description, FALSE));

failing to change the permission default to false?

#

Using PermissionAttachments isn't ideal since I don't actually want to manage players

young knoll
#

Use the vault API

neon minnow
#

vault 2011 plugin

#

😂

wicked remnant
#

and just to clarify - going from false to true works, but going from true to false doesn't happen

neon minnow
#

u the type of guy to use essentials?

#

lmao

wicked remnant
#

recalculatePermissionDefaults is always called when your register a permission (unfortunately already tried)

#

ill try that first one though, thanks

#

Not sure if it'll work since leaving the server and rejoining doesn't fix the issue, and I assume that would essentially recalculate perms

neon minnow
young knoll
#

Why not?

#

It’s free, open source, and actively developed

modest garnet
#

anyone know how to fix

young knoll
#

Something is null

#

On Core.java line 34

modest garnet
#

this.getCommand("minecoinsclear").setExecutor(new minecoinsclear());

#

??

#

wait its the plugin.yml nvm

dawn hazel
#

plugin development is fun they said

#

yeah its definitely fun especially when you fix one error MORE ERRORS POP UP

hybrid spoke
#

welcome to programming

manic crater
#

ur literal error says it cant get a configuration value so its marking it as null.... ( From what i can see )

dawn hazel
#

programming has its upsides and downsides. the downsides are how aggravated you will be when your code keeps failing and you run into more and more errors when you fix the other one

manic crater
#

anyway

manic crater
#

hm

dawn hazel
#

oh is it satisfying

hybrid spoke
dawn hazel
#

but when something works first time, best thing in the world

#

even more of a serotonin boost than the 12 cans of monster i drink to keep me awake during coding

manic crater
#

really random and ik you're all probably gonna get mad at yell at me and probably start screaming at me saying "learn java" knowing this community,

But how do you get a player variable in a gui? I've tried a ton of things but apparently none of them wanna work, So i was wondering on what the hell im doing wrong

dawn hazel
#

honestly i dont know either lmfao

#

guis are oddly complex and weird

manic crater
#

🤷

#

I tried casting player to the code but apparently that doesn't wanna work

#

i tried google apparently that has no info,

#

meh

sterile token
#

Variables?

#

Explain please

dawn hazel
#

is it a hashmapped or something variable?

manic crater
#

For instance i wanna check if this is false or true:

"Quests." + p.getUniqueId() + ".Ore Miner Status"

But apparently its the p.getUniqueId() issue where it doesn't wanna work ig 🤷 idk it just keeps saying the player is null but yet i have this above all the code in the gui:

Player p = (Player) Bukkit.getServer().getPlayer(getName());

sterile token
#

He?

#

Wait what are you using a gui or what?

manic crater
#

ye

sterile token
#

I dont understand you

dawn hazel
#

is this code in an event or a command?

#

or in a separate function

manic crater
#

well the point of the variable is to check if the "quest" in this case was started or not,

#

So i wanna use a gui to change the item lore if its enabled or not

dawn hazel
#

if

Player p = (Player) Bukkit.getServer().getPlayer(getName());``` is above all your code
#

you need to define the player in your function

young knoll
#

Where is this being done

manic crater
#

No no like

young knoll
#

Event?

manic crater
#

ill show u what i mean

#
public quests() {
            
            inv = Bukkit.createInventory(null, 45, "Daily Quests");
            
            Player p = (Player) Bukkit.getServer().getPlayer(getName());
            
            
            inv.setItem(10, createGuiItem(Material.GOLDEN_PICKAXE, ChatColor.GREEN + "Ore Miner", ChatColor.GRAY + "They say only the best", ChatColor.GRAY + "miners can complete this quest!", "", ChatColor.GRAY + "Quest Type: " + ChatColor.YELLOW + "Challenging", "", ChatColor.YELLOW + "Click to start"));
            
            
        }
dawn hazel
#

cause from my understanding its trying to call a player that doesnt exist

#

hmm

young knoll
#

Bukkit.getPlayer will return null if that player doesn’t exist

dawn hazel
#

yeah

manic crater
#

Yeah and im trying to fix the null issue, thats occuring apparently,

manic crater
young knoll
#

Same thing

manic crater
#

Alright well how can i go about fixing this?

young knoll
#

Make sure getName matches the name of an online player

dawn hazel
sterile token
undone axleBOT
manic crater
dawn hazel
#

where is Quests() getting called

manic crater
#

private Inventory inv; <- The "inv" thing gets called through a command

#

which then opens the gui and stuff

dawn hazel
#

hmm

sterile token
#

Omg i cannot understand he mixed many things together

dawn hazel
#

your code is very unusual

#

and hard to read

manic crater
#

uh thanks ig??????????????

dawn hazel
#

alright i cant exactly decipher how much of this works

manic crater
#

All of it works just the only thing that doesn't work is the getting the player

#

bc it returns null for when i open the gui and stuff

dawn hazel
#

but you could try parsing sender.getName() to the p variable in quest()

sterile token
#

@manic crater paste full code of project in ?paste

manic crater
#

yeah i did

#

lmao

young knoll
#

Just check and cast sender

sterile token
young knoll
#

No need to mess with getName

dawn hazel
manic crater
#

the project is like 2 seconds of someones life,

dawn hazel
#

ig

manic crater
sterile token
#

Lol, really strange the code

dawn hazel
#

but putting your stuff in separate classes will make your life a lot easier

manic crater
#

ik

dawn hazel
#

it shortens the amount of code on your screen at one time and makes it more organized

manic crater
#

ok ok,

#

but back to the topic tho

#

How can i make it not be "null"

sterile token
#

Alreayd answer

manic crater
#

Ik then i asked if i can have an example

sterile token
manic crater
#

well i assumed i needed that, or else it wouldn't work regardless,

sterile token
#

if i just write public quest() intellij brokes

wicked remnant
#
if (e.getWhoClicked() instanceof Player player) {
    // do shizz
}
sterile token
manic crater
manic crater
#

so im trying to see how i can fix that null issue.

sterile token
#

I cannot find it on code

wet breach
manic crater
#

and i wanna use variables in the gui

wet breach
#

ok what does that have to do with using offlineplayer?

sterile token
manic crater
#

ok so let me get this straight,

#

casting player to a string means they are an offline player

#

yes?

sterile token
#

He???

wicked remnant
#

you can't cast player to a string

manic crater
sterile token
wet breach
#

however you can reference players by name using offlineplayer

manic crater
wet breach
#

even if they don't exist

wet breach
wicked remnant
wet breach
#

otherwise, stop ignoring me and just use offlineplayer

manic crater
wet breach
#

offlineplayer has a method where you can check if they are online as well as you can cast if necessary if they are online

young knoll
#

getPlayer will return null if they aren’t online

manic crater
sterile token
young knoll
#

getName is getting the plugin name in this case

#

Your likely don’t have a player with the same name as your plugin

manic crater
sterile token
#

Oh using eclipse

#

That why btw

manic crater
young knoll
#

Lol no it’s not

#

getName is perfectly valid in this context, it’s just not what they want

wet breach
#

if the method is valid then there shouldn't be errors even if it isn't the correct method to be using 😛

manic crater
#

🤷

wet breach
#

More people need to use offlineplayer though, solves all kinds of problems for a lot of stuff

manic crater
#

Alright mr frostalf

wet breach
#

since a lot of people forget to check if a player is even connected to begin with XD

sterile token
#

I still not understand your code dishyt

manic crater
#

im willing to try your offline player strategy, i just would like a bit more input on how to do so since i dont mess with offline players

manic crater
sterile token
#

You never call method quest()

#

Idk how the gui is being created

manic crater
#

private Inventory inv; <- from this thing

#

p.openInventory(inv); <- See it opens the gui and etc

wet breach
#

and vice versa if you wanted

young knoll
#

Why are we using an OfflinePlayer

#

Their player is clearly online if they are opening a GUI

manic crater
#

yeah idk colf but im willing to try frostalf's idea

#

cuz you never know it most likely could work

sterile token
#

If where you i would separate all code and send paste md5 again

wet breach
# young knoll Why are we using an OfflinePlayer

I don't know what exactly they are doing. From the method it was returning null, which generally means a player isn't online. I don't care if people want to do something in a certain way but what I can do is tell you what methods will help accomplish it or avoid errors 😛

#

if they want to show a player regardless if they are online, OfflinePlayer is the way to go on that

young knoll
#

Yeah it returns null because they are trying to get a player from the name of their plugin

wet breach
#

Ah from the name of their plugin

#

that would do it

sterile token
#

idk

#

His code its really strange

wet breach
#

Well either way, I gave another option 😛

young knoll
#

The code is very odd, I agree

wet breach
#

Sometimes it isn't important to understand the code

sterile token
wet breach
#

Not really, you just need to understand what they are trying to do 😉

manic crater
#

ok its either im really terrible with doing offline players or not but i kind of need help getting the player from the offline player thing

sterile token
#

dishy, have you separe the command and the event to dif classes?

wet breach
young knoll
#

OfflinePlayer#getPlayer

manic crater
wet breach
#

I was interpreting it incorrectly 😛

#

I mean you could still use OfflinePlayer

manic crater
sterile token
wet breach
manic crater
sterile token
young knoll
#

I would create the inventory when you need it (in the command)

#

Then you have a player available to use (the sender)

sterile token
#

Seeing code he never call method dailyQuest() - Starting from there

wet breach
#

just change this
Player p = (Player) Bukkit.getServer().getPlayer(getName()); to

player p = Bukkit.getPlayer(String Name); or
player p = Bukkit.getPlayerExact(String name);

#

No need for the casting

#

ideally from an event is better as coll is saying

#

or the command stuff

manic crater
#

im a try the command stuff

#

ill tell u if it works out and stuff k?

young knoll
#

If I have an inventory that’s contents depend on the player I generally create it as needed

#

Whereas a static inventory can be cached at startup

wet breach
manic crater
#

probably

#

but ill let u know whats up in a few seconds

#

no errors so far in console

wet breach
#

sounds like progress 🙂

manic crater
#

true true,

#

okay let me try something

#

omg,

#

Thank you so much

#

it works 100%

manic crater
#

Honestly thank you all so much

wet breach
#

Wooo!

manic crater
#

This means a ton to me, thank you for all the suggestions i know im a noob at this stuff, but

manic crater
#

fr honestly tysm <3 and i hope the best comes your way!

dawn hazel
#
    private void PlayerItemHeld(PlayerItemHeldEvent event) {
        Player p = event.getPlayer();
        p.sendMessage(String.valueOf(p.getInventory().getHeldItemSlot()));
    }
``` having an issue where the variable im getting is the number of the previous slot held except i need the current slot
#

anyone know how to do that

#

ignore the send message thing

#

thats a debug thing

young knoll
#

Event.getNewSlot

wet breach
dawn hazel
#

thank you

tidal hollow
#

I want to make an item that when you right click you are invulnerable for 20 seconds

Does anyone know how to do it?

neon minnow
#

How do I use setLore?

#

Type mismatch.
Required:
(Mutable)List<String!>!
Found:
String

#

im4.setLore("test")

young knoll
#

You need a list

#

It does tell you that

neon minnow
#

How

#

Do

#

I make

#

a list

#

because this

quaint mantle
#

?learnjava

undone axleBOT
neon minnow
#

"hello", "hello2"

#

does not work

neon minnow
undone axleBOT
quaint mantle
#

yes, replicating the command i sent will get you the same output

neon minnow
#

you do understand

#

im doing what it says

#

still doesnt work

#

Nvm

#

I did it

young knoll
#

“A”, “B” is not a list

#

It’s just two strings

neon minnow
#

what is blue orchid

#

material

dusk flicker
#

?jd-s\

#

?jd-s

undone axleBOT
dusk flicker
neon minnow
#

Nvm

lavish hemlock
#

Is there a way to get only the items in the hotbar section and then only the items in the non-hotbar inventory section?

#

I imagine it's just down to indices.

brave sparrow
#

yup

lavish hemlock
#

Sigh

#

Time to write some utils :p

#

Bukkit b like this sometimes

brave sparrow
#

[0, 9) is hotbar

lavish hemlock
#

oh really? would've thought 10-36 (or something like that) would've been hotbar

brave sparrow
#

nope

#

hotbar is [0, 9) and then the rest of the numbers start from the top of the window

lavish hemlock
#

Btw what do you call the non-hotbar contents

brave sparrow
brave sparrow
#

it's all just inventory contents

lavish hemlock
#

Yeah but I need a method name that isn't as misleading

brave sparrow
#

there isn't really a word for it

#

lol

lavish hemlock
#

dang

brave sparrow
#

in a game where hotbar/inventory are different things you'd have inventory contents and hotbar

#

but in minecraft they're one concept

#

it's just that the hotbar has quick access

spiral bramble
waxen plinth
#

Yeah there is

#

That's not configurable to begin with

#

And you can use a wrapper or something

spiral bramble
waxen plinth
#

I have a library that helps with this sort of thing

#

You could be like

#
SQLHelper sql = new SQLHelper(SQLHelper.openMySQL(db, user, pass));```
#

It also makes config very easy

spiral bramble
#

Hmm interesting- would you mind sharing?

waxen plinth
#

What do you wanna see

lavish hemlock
waxen plinth
#

Yeah that's the library it's massive

lavish hemlock
#

There you go ^

spiral bramble
#

Sweet Ill have a look thanks

waxen plinth
#

Take a look at the wiki

lavish hemlock
#

It's probably one of the most useful Spigot libs atm ngl :p

waxen plinth
#

It documents all the major features

lavish hemlock
#

Although I don't use it cuz I don't like I don't like having the command API in my jar when I use Lamp

waxen plinth
#

You can use minimize jar

lavish hemlock
waxen plinth
#

Or use RedLib as a plugin depend

lavish hemlock
#

Nah I don't like declaring dependencies

#

As someone who used to play modded Minecraft

#

I would run into the common issue of downloading mods without checking deps

#

:)

waxen plinth
#

Then you can use minimize jar lol

blazing scarab
#

A noname minecraft lib conference?

lavish hemlock
#

Hey so if a returned ItemMeta is null, how am I supposed to set the display name?

brave sparrow
#

It shouldn’t be null

lavish hemlock
#

Oh okay

#

I thought just cuz it was nullable

#

it might be null

brave sparrow
#

As far as I know it shouldn’t ever be null

lavish hemlock
#

Aight okay then

blazing scarab
brave sparrow
#

I can’t remember if the item itself would just be null if it was air though

#

I think it would be null

blazing scarab
#

Well, yeah. Methods in inventory has notnull annotations so i always though they are air all the time

#

However... They're not

brave sparrow
#

It has not null annotations but it definitely returns null when it’s an empty slot

#

It’s very strange

blazing scarab
#

Just another bukkit api moment

ancient jackal
#

is there a way to get which tree leaves are a part of?

blazing scarab
#

They are not identified anyhow

waxen plinth
#

They kinda are

#

The game keeps track of how far from a log each leaf block is

#

You could just find the closest log to a leaf

#

And that log belongs to the tree which "owns" those leaves

midnight shore
waxen plinth
#

Bug out how

#

The game only cares that each leaf has a log within 4 blocks I think

spiral bramble
#

Stupid question, as I'm using RedLib, I also need to add it as a dependancy and install the plugin on the server?
Apologies I haven't used libraries before, I typically make my own mess

waxen plinth
#

You can use it in one of two ways

#

You can install it on your server and add it as a dependency in your plugin.yml

#

That's the recommended way

#

Or you can shade it into your plugin's jar via your build system

#

If you have further questions feel free to join my support discord, it's linked in the readme for redlib and also its plugin page on spigot

lost matrix
spiral bramble
#

Sweet thanks!

summer scroll
summer scroll
lost matrix
#

Are you using eclipse?

summer scroll
summer scroll
#

I don't know what to do with that 😕

lost matrix
quiet ice
#

Or use Method handles

echo saddle
#

or use a wrench.

dawn hazel
#

Ever had the idea of making a plugin but realized a billion other plugins do it and also do it far better than your skills are capable of

quiet ice
#

I usually have the issue that my Take on the issue is Not good for gameplay

echo saddle
#

well, one of these days i'll circle back and may my plugins better.

#

i mean, like making them "open source"

#

yas, that is my current thinkin

#

but not until i can clean up the code

#

my goal is to open source all my plugins.

#

but give me time

#

they are not at that level yet.

#

and my goal is to make them like worldedit level

#

and then everyone can have them and fix them

#

maybe we can have a open source auctionhouse

#

someday

#

but lots of changes to be done to get ther

#

yeh

#

open source AuctionHouse

sullen canyon
#

Is that possible to decrease player's reach? I heard something like that did minemen for a joke in one day

echo saddle
#

its gonna happen

#

and you can all PR request shit and stuff

#

but also

#

gonna' open source all my plugins

#

yeah.

#

oh.

#

wtf.

#

does that mean all of monkey's plugins?

#

yes.

#

padlock

#

AuctionHouse

#

IronBank

#

GoldBanK

#

PiggyBank

#

all of it

#

gonna post it.

#

All that source code.

#

It's soon, gonna be MIT

#

M fucking IT

#

MIT

#

yeh, means, well if you want to PR a fix for better usabilitty well then...

#

just don't critique me about the state it's in.

#

it you think you can improve it, just DO IT.

ivory sleet
#

Hmm, you could certainly edit your messages btw 😅

echo saddle
#

I'm dying in 3 weeks so I donlt give a shit

#

let's not be cruel__

ivory sleet
#

I’m sorry to hear that

echo saddle
#

well,

#

i'm floting in 3 weeks

ivory sleet
#

Yeah, trying not to be cruel, but well to some extent I still have to moderate

echo saddle
#

might still be around*

#

we'll see

ivory sleet
#

I hope you the best regardless, stay strong

echo saddle
#

i'm listening to wham*

#

that's a good sign

#

i'm not gonna die

tardy delta
#

👀

echo saddle
#

i have 380 cats to adopt

#

for realsies

#

just gonna let others decide what is best for that plugin

#

Wait, wait don'lt tell me......

#

oh, hey just got back from hawaii

#

is my new console here?

#

Steam Deck.

#

lemme check if it arrived.

#

still waiting for my steam Deck

tardy delta
#

This looks like you're talking to yourself

#

🥶

echo saddle
#

yes fourteen def talking

tardy delta
#

should i make my command /vanish toggle FourteenDoggo instead of /vanish FourteenDoggo?

#

tabcompletion kinda sucks

summer scroll
ivory sleet
#

Class.class.getDeclaredConstructor(ParamameterType.class).newInstance(actualParameterValue); iirc

quaint mantle
#

Guys how do I access config in another class?

quasi flint
#

static

#

or instance

#

or just ?learnjava

#

?learnjava

undone axleBOT
tardy delta
#

?di

undone axleBOT
quaint mantle
#

I know there is an easier way. like go to Code > Generate

#

but cant remeber how its done

quasi flint
#

you just cant let intellij make code

wet breach
#

o.O

quasi flint
#

well some parts, but not all

quaint mantle
grim ice
#

do you guys have an idea to stop Tnt run from lagging

tender shard
grim ice
#

it doesnt

tender shard
#

then how does it lag?

grim ice
#

do you know whats tnt run?

tender shard
#

I guess

grim ice
#

well the tnt falls into the void

#

but it probably explodes before that

#

so I think cancelling the exploding event and replacing the block with air would do the thing

tender shard
#

no need to replace any blocks, the tnt is an entity once it was primed

grim ice
#

o

tender shard
#

you can just remove() it

grim ice
#

oh ok

tender shard
#

split it into several smaller tasks

#

also using NMS can change more blocks at once

hybrid spoke
#

edit the world file directly 5Head

blazing scarab
hybrid spoke
grim ice
#

or is it sarcasm

#

./fill ez

glossy venture
#

you can wipe chunks as an optimization

hybrid spoke
glossy venture
#

but if you edit the world file directly youll need to reload it

hybrid spoke
#

no

#

just the modified region chunks

glossy venture
#

true

grim ice
glossy venture
#
FileOutputStream fos = new FileOutputStream(...);
fos.write((byte)0x0);
fos.close();
``` the best method
grim ice
#

ah yes

hybrid spoke
grim ice
#

that seems way too complicated

clever sapphire
#

@grim ice what kind of world resetting you need to do?

grim ice
#

im not the one needing that

hybrid spoke
#

pretty effective with 300m bps

grim ice
#

i just wanna know how is the best method done

clever sapphire
#

If lets say you need to reset a skywars map, you could just keep the locations of all the blocks the players broke and placed

#

Then replace them after the game

hybrid spoke
#

or just never save the world and crash the server at the end

glossy venture
#

just keep a copy of the map somewhere and load it when it will restart

glossy venture
#

but you will have to disable all autosaving shit

blazing scarab
torn shuttle
#

god I just can't stop writing the wrong syntax in foreach for c#

#

it just feels wrong

#

someone call microsoft and tell them to fix their language so it meshes with java

glossy venture
#

why was c# even created

torn shuttle
#

because microsoft looked at java and thought "that's cool but what if we make it spicier"

glossy venture
#

i searched it and it was appereantly because sun didnt allow microsoft to make changes to java or something

tribal holly
#

Hi i'm sorry i have a mind blow problem, how the f*ck is possible to have my first loop in the for x = 1 and not 0 ?

for (int x = 0; x < interfaceOrder.length; x++) {
            Material glass;
            int glassLevel = levelSpace * (x + 1);
            System.out.println("x:" + x + " countLevel: " + (x + 1));
            if (job.getLevel() >= levelSpace * (x + 2))
                glass = Material.LIME_STAINED_GLASS_PANE;

            else if (job.getLevel() >= glassLevel)
                glass = Material.ORANGE_STAINED_GLASS_PANE;

            else glass = Material.RED_STAINED_GLASS_PANE;

            content[interfaceOrder[x]] = new VisualItemStack(glass,
                    "§6Level §e" + glassLevel,
                    false,
                    "§6Reward(s):").getItem();

            // Adding rewards line to lore
            ItemMeta meta = content[interfaceOrder[x]].getItemMeta();
            List<String> lore = meta.getLore();
            for (String line : job.getReward(glassLevel))
                lore.add("§e- " + line);
            meta.setLore(lore);
            content[interfaceOrder[x]].setItemMeta(meta);
        }

here the output

glossy venture
#

what the hell

tribal holly
#

yeah you too ?

#

i can't understand

glossy venture
#

no idea

#

what if you make x -1 at start

#

does it include 0 then

tribal holly
#

out of bound of interfaceOrder table

glossy venture
#

so it does include -1 then

tribal holly
#

and first loop x is print with -1

#

wtf

glossy venture
#

what the fuck

#

lmao

tribal holly
#

just

glossy venture
#

yeah

hollow bluff
#

-1

glossy venture
#

try this:

for (int i = 0; i < 20; i++)
  System.out.println(i);
#

and see if it starts at 0

tribal holly
#

normal

#

but what the hell am i doing in my loop to do this

#

it's just skipping the first loop but how ?

worn tundra
#

Could you please paste the code?

undone pebble
#

could you comment everything passed the sysout?

worn tundra
glossy venture
#

its something before the sysout

#

because it prints 1

#

on the first loop

undone pebble
#

they're not doing anything meaningful before the sysout 🤷‍♂️

glossy venture
#

i know

#

so its really weird

worn tundra
tribal holly
lost matrix
#

x -= 1; <- ?

tribal holly
#

remove the x-=1

#

it was for testing sry

glossy venture
#

anything in the logs before that

#

?

tribal holly
#

nop

#

i only print when this for is trigger

lost matrix
#

So if one entry of interfaceOrder is not within bounds of content then content[interfaceOrder[x]] will throw an array index out of bounds

wet breach
# glossy venture why was c# even created

Originally Microsoft was going to register their own JVM implementation for licensing but then Sun Microsystem denied them such things for their implementation because Microsoft didn't follow the rules on something. Instead of Microsoft just scrapping what they created they decided to create C# with it.

glossy venture
#

ah

tribal holly
#

my interface have a good display (but the x is one higher as expected)

glossy venture
#

it starts counting at 1 appereantly

tribal holly
glossy venture
#

can you count how many loops it does

#
int c = 0;
for (int x = 0; x < ...; x++) {
  c++;
  // ...
}
System.out.println(c);
tardy delta
#

It's the same as x

glossy venture
#

no thats the problem

#

x appereantly starts at one

tribal holly
#

heuuuu

#

its start now at 0

lost matrix
#
for (int x = 0; x < interfaceOrder.length; x++) { // Declares x and initializes with 0
            Material glass;
            int glassLevel = levelSpace * (x + 1);
            System.out.println("x:" + x + " countLevel: " + (x + 1));  // Through some magic x is now 1

I do not believe that your console output corresponds to this code

glossy venture
worn tundra
#

lmao

#

fun ride

undone pebble
#

??

tribal holly
#

i test without the loop count to see if i still have the prob

#

i change nothing and now it work

#

how

#

th

glossy venture
#

wtf

#

jvm is on drugs and alchohol

worn tundra
#

u sure you compiled it before?

tribal holly
tribal holly
glossy venture
#

exactly the same code

#

what the fuck

tribal holly
#

yep

wet breach
tribal holly
tribal holly
glossy venture
#

what jvm is the server running on

#

but i dont think thats the problem

lost matrix
glossy venture
#

i suggest looking into the problem because if this keeps happening when you release your plugin wont be good

tender shard
tribal holly
#

ah

lost matrix
#
if (!condition) {
  return;
}

if (condition) {
  
} else if (condition) {

} else {

}
tribal holly
#

well i saw some stackoverflow talking about this and there is two team with this

glossy venture
#

i dont use bodies for if (...) return;

tribal holly
#

i see more calrity in the code when there is one line of execution

tender shard
glossy venture
#

yeah

#

true

lost matrix
tribal holly
#

okay thanks i will

glossy venture
wet breach
lost matrix
glossy venture
#

lmao

tribal holly
glossy venture
#

also i think that if (...) throw is fine

#

i hate writing swing code so much

lost matrix
glossy venture
#

yeah

#

swing code is ugly

#

at least the code that i write

wet breach
tribal holly
#

the bodies ?

#

don't think that came from here, i don't change the code and with a restart server it work fine

#

just what the hell java is doing

wet breach
#

it is the way you are doing math using x

tribal holly
#

i didn't override x anywhere

#

how can i wrong compute x ?

humble heath
lost matrix
lost matrix
# humble heath

Dont pass null into the translateAlternateColorCodes() method

tribal holly
#

i don't arrive to reproduce the error, as i said when i restart the server with the exact same code it work fine

#

maybe the relaod function messed up my code i don't know

humble heath
#

i see it now

quaint mantle
#

hi how can i set {EntityTag:{Invisible:1b}} to item

worldly ingot
#

I don't think you can. Invisibility is just living entities, no?

#

Yeah. Just living entities. Items don't support that tag, even in vanilla

glossy venture
#

i mean you can set anything you want with nbt

#

but what do you want it to do

lost matrix
worldly ingot
#

It doesn't

#

You can set it all you want, it just won't do anything ;p

glossy venture
#

item entity?

#

oooh

#

dropped items?

worldly ingot
#

Yes

#

Unless they're referring to spawn egg items (because of the EntityTag there), in which case I don't think the Bukkit API allows for that because there's really no great way to go about it yet. We don't really have a way to modify the entity spawned in an item stack

lost matrix
#

nms.ItemEntity at least has the method setInvisible(boolean)

#

Not sure if it does anything.

lost matrix
#

This was 2 years before i started programming... I rly dont like readin my old code. Makes me cringe. And with old i mean everything older than 3 Months XD

#

classic

wet breach
#

I have been using Java since nearly its beginning 😦

lost matrix
#

XDD

wet breach
#

it was more fun though in those times to be using VB

lost matrix
wet breach
#

Yes

#

the only proper VB acronym I don't know what else it would mean?

lost matrix
#

Isnt that only used in excel? Never really looked into that language.

wet breach
#

It is basically the predecessor to Visual Studio. VB allowed you to create applications in a visual way. Quite nice and handy

lost matrix
#

volumptous butt

#

XD

#

i should go sleep...

quiet ice
#

Whenever I hear of VB I think of the vb-style collections that I do Not understand

wet breach
#

lol

#

VB scripts are quite handy on windows even today

#

they basically can do anything you want with great ease XD

#

on windows that is

quiet ice
#

Really, who the hell thought a string-indexed list was good idea

lost matrix
#

Or a Map<String, Object>

#

(same)

quiet ice
#

You can also access it by index

golden kelp
#

hello does anyone know how to spawn a stack of an entity, each riding the one under it

quiet ice
#

So a Bit Like a linkedmap, but allows for random access

lost matrix
quiet ice
#

At least that is what I think it is

golden kelp
quiet ice
#

Why is it deprecated?

wet breach
quiet ice
#

Yes

golden kelp
quiet ice
#

?jd Well, only one way to know

golden kelp
#

btw whytf is iterating through a hashmap that complex?

#

its not hard

golden kelp
wet breach
# quiet ice Yes

Well I don't really know what they were back then, but VB is essentially .NET

golden kelp
#

kinda

#

idk i m just dumb

wet breach
#

currently look at the .net 6 api, it would seem the collections are pretty reasonable lol

golden kelp
#

my dad made a erp in vb6, then made it in vb.net and now making a web erp using angular + C#, man is in love with dotnet 😂

lost matrix
#
  public <T extends LivingEntity> void spawnMobTower(Class<T> mobClass, Location location, int size) {
    T tempEntity = null;
    World world = location.getWorld();
    for (int i = 0; i < size; i++) {
      final T lastEntity = tempEntity;
      tempEntity = world.spawn(location, mobClass, spawned -> Optional.ofNullable(lastEntity).ifPresent(last -> last.addPassenger(spawned)));
    }
  }

Something like this. (didnt test)

golden kelp
#

ty

#

i m writing a simpler thing

golden kelp
#

especially old peeps, i never had enough guts to show my dad java or other langs all he likes is windows

wet breach
#

what I like about it is just if you want to make a simple window application dotnet makes it super easy to do so

golden kelp
#

yea

#

i made my first login screen in dotnet

#

which just checked if 2 textboxes had admin in them (not even case sensitive 😂 ) and then if it did it would close tthe app, (it was supposed to show Access Granted in the bottom but the app closes so fast)

lost matrix
#

Does ItemStack#serialize() miss anything? Like PDC or custom nbt tags?
Always used BukkitObjectOutputStreams but they throw a npe at the moment
Cannot invoke "net.minecraft.nbt.NBTBase.a()" because "element" is null

wet breach
#

idk what that a() method is

lost matrix
#

I just want to serialize ItemStacks with gson. Usually i just serialize it to base64 but i want to be more resilient so
i thought about serializing the Map<String, Object> provided by ItemStack#serialize()

wet breach
quiet ice
#

I know paper has a Method for this, but eh, that is paper

#

It uses DFU instead of Java serialisation however

lost matrix
#

Ill just update my spigot version and hope that its fixed

late sonnet
blazing scarab
#

But yeah spigot serialization is trash

severe marsh
#

How do I make an item unstackable?

lost matrix
severe marsh
#

What's that?

#

Can you send me link to docs or any other thread related to it?

tender shard
#

?pdc

severe marsh
#

thanks

lost matrix
#
  public static void makeUnStackable(ItemStack itemStack) {
    ItemMeta meta = itemStack.getItemMeta();
    meta.getPersistentDataContainer().set(NamespacedKey.fromString("custom:unstackable"), PersistentDataType.STRING, UUID.randomUUID().toString());
    itemStack.setItemMeta(meta);
  }

didnt test

tender shard
#

not sure about the fromString part, I'd rather use a proper NamespacedKey using the plugin. But other than that it will definitely work fine

glossy venture
#

wait is pdc like nbt but for more things

#

like chunks as well

tender shard
#

yes

glossy venture
#

sick

tender shard
#

you can also abuse chunk's PDC to make it work for blocks

glossy venture
#

cool

golden kelp
#

Can you spawn structures using plugins, I want to spawn a pillager tower near the player

onyx fjord
#

how do i get a file from jar file in the code

#

(like config.yml)

tender shard
#

getResourceAsStream

#

from JavaPlugin

tender shard
#

oh just getResource?

vocal cloud
#

There's a few different methods of doing it

tender shard
#

To read them into a list<string> i always do this:

#
    /**
     * Reads a file from the resources directory and returns it as List of Strings
     *
     * @param plugin   Plugin
     * @param fileName File name
     * @return A list of Strings of the file's contents
     */
    @SneakyThrows
    public static List<String> readFileFromResources(final Plugin plugin, final String fileName) {
        try(InputStream input = plugin.getResource(fileName);
            BufferedReader reader = new BufferedReader(new InputStreamReader(input))) {
            return reader.lines().collect(Collectors.toList());
        }
    }
onyx fjord
#

epic

#

simplest = best ofc

blazing scarab
#

not always

onyx fjord
#

pfff

glossy venture
#

its weird that the fastest and most optimized code always turns out to be longer than the simple slower code

#

not weird but like ironic or something idk

onyx fjord
#

how can i generate yml inventory

#

not in code

#

like a website or something

glossy venture
#

idk

blazing scarab
#

No one likes spigot itemstack serialization!

onyx fjord
#

rip

#

-null

hardy swan
#

If a code is simple and fast it requires no optimisation. If LoC is reduced in optimisation, it then becomes the default way to write the code, giving the illusion that efficiency has an association with longer code if that's what you call optimisation.

onyx fjord
#

and how do i copy the resource

#

from getResource

#

basically

#

i want to put that file in plugin folder

eternal oxide
#

saveResource

onyx fjord
#

YESSSSSSSSSS

crimson terrace
#

is it faster to read out of an enum or out of config?

onyx fjord
#

I HAVE THE 100k RESOURCE ID

eternal oxide