#help-development

1 messages ยท Page 215 of 1

glossy venture
#

its a minecraft server

molten hearth
#

not really it works pretty well

#

it uses close to 0 resources as well

#

but also it has close to 0 resources lul

#

I actually hate the way they designed their minecraft server but I make use of some of their repos

glossy venture
#

why is every single component in a different repository

molten hearth
#

lmao

#

to organise it

glossy venture
molten hearth
#

minecraft-data for example is used by both the bot library and the mc server

glossy venture
#

this repo

#

has one file of significance

#

just make one package with submodules

molten hearth
#

dunno I never used that

#

im like the singular user using the minecraft server

glossy venture
#

holy shit this repository holds 90 lines of code

molten hearth
#

I actually started to re-implement it but I CANT FUCKING FIGURE OUT HOW TO SEND CHUNKS TO THE CLIENT

#

I send the packets to the client and the client commits le handicapped

glossy venture
#

compress the former

molten hearth
#

wat the fuck

#

I just sent a map_chunk

#

(this is on spawn btW)

glossy venture
#

are you sending json ๐Ÿ’€

molten hearth
#

nooo I would never

#

idk what im sending Im using a wrapper for the packets

glossy venture
#

lmao

molten hearth
#
client.write("map_chunk", {
                x: 0,
                z: 0,
                heightmaps: {
                    type: 'compound',
                    name: '',
                    value: {
                        MOTION_BLOCKING: {
                            type: 'longArray',
                            value: new Array(36).fill([0, 100])
                        }
                    }
                },
                chunkData: chunk.dump(),
                blockEntities: [],
                trustEdges: false,
                skyLightMask: [],
                blockLightMask: [],
                emptySkyLightMask: [],
                emptyBlockLightMask: [],
                skyLight: [],
                blockLight: []
            });```
#

looks like this

glossy venture
#

you know you need to conform to the minecraft protocol standards

molten hearth
#

I am

glossy venture
#

or is this with a custom server as well

molten hearth
#

I analysed the fucking

#

for 2 days

#

I see no differences

#

its all the SAMEEE

glossy venture
#

but youre using a wrapper

molten hearth
#

but it doesnt work

#

oh are you saying the wrapper is handicapped

#

fuc

glossy venture
#

idk how did you configure it

molten hearth
#

idk its part of minecraft-protocol

glossy venture
#

also you need to send things like encryption info

#

oh

molten hearth
#

it gives you a client and you can just do client.write(packet_name, packet_data)

#

mojang also randomly changing the way chunks work doesn't help

subtle folio
#

@river oracle Still doesn't show up,

molten hearth
#

so i tried updating it to 1.19 lol

molten hearth
#

and this is what the wrapper expects

zealous osprey
#

Quick question, what's the idea behind wrapper classes and what defines them?

hazy parrot
#

Are you referring to primitive wrapper classes (Integer) or like in general

zealous osprey
#

in general, issue is that I can only find resources about the primitive types. Yet those resources only tell you when to use them, like for arrays, but doesnt illustrate why and how you create them

hazy parrot
#

It's mostly used for primitives so you can add some methods or pass it by reference

#

As in java those are passed by value

#

Also before java records, I saw people refer to class that is holding more objects as wrapper

zealous osprey
#

Ah, cause I thaught wrappers were basically classes which would encapsulate something like a record

mighty pier
#

quick question, how was the universe made?

remote swallow
#

big bang

mighty pier
#

that was disproven

#

noob

remote swallow
#

ok

ivory sleet
#

Which one are you referring to? (The most common canonical ones being Proxy and Adapter)

#

but the general idea is some type of delegation pattern we talk about the notion of a wrapper

mighty pier
#

bazinga

worldly ingot
#

Conclure is just saying big words

#

Basically a wrapper, bare bones, is a class that has a field of a type that is operated on a lot

#
public class MyWrapper {

    private final WrappedType value;

    public MyWrapper(WrappedType value) {
        this.value = value;
    }

}```
#

Practically all of CraftBukkit is wrappers

hoary wing
#

How can I send a message when starting the game in bedwars with this api

#

|| @EventHandler
public void onJoin(final BedWarsPlayerJoinEvent event) {
final Arena arena = event.getArena();
final Player player = event.getPlayer();
}||

remote swallow
#

player.sendMessage()?

hoary wing
#

it does not work

mighty pier
#

wrong discord

robust sinew
#

how do I cancel a runTaskTimer?

mighty pier
#

make your own bedwars or go to the api developers

hoary wing
#

I was wrong

#

@EventHandler public void onStart(final BedWarsGameStartEvent event) { final Arena arena = event.getArena(); }

remote swallow
#

what api is it

hoary wing
hasty prawn
#

Who are you trying to send a message to

#

Everyone?

hoary wing
#

actually I want to send an actionbar that lasts the whole game

remote swallow
#

the only api stuff i can find online is just the stuff on their built by bit which doesnt even give jds

hasty prawn
undone axleBOT
hazy parrot
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

rough drift
#

Does anyone know how to use snakeyaml?

ivory sleet
#

yea

#

well on a moderate level

hybrid spoke
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

quaint mantle
#

how does friction work in minecraft

rough drift
#

xD

rough drift
ivory sleet
#

Node

next plume
#

Are you doing this with a configuration file, using Spigots API?

rough drift
ivory sleet
#

youve Node::set<typeOfComment>Comments

rough drift
#

Oh damn

#

I need to figure out how to make a node now

ivory sleet
#

you've ScalarNode, CollectionNode and iirc some other Node derivative

rough drift
#

So what is a node for like a simple value

ivory sleet
#

ScalarNode

rough drift
#

It doesn't work if I plop a list in correct?

#

All collections need to go in CollectionNode right?

ivory sleet
#

well I think thats for like a yaml sequence

#

yk

#

x:

  • 1
  • 2

or
x: [1, 2]

rough drift
#

SequenceNode

#

and MapperNode

#

MappingNode*

ivory sleet
#

ah might be those then

rough drift
#

ScalarNode instead is value

#

so, technically

#

hello: 56 ScalarNode
list: [1, 2, 3] SequenceNode
map: {a: 1, b: 2} MappingNode

#

now how do I construct them

ivory sleet
#

ah

#

Mapping and Sequence derive Collection

rough drift
#

ye

ivory sleet
#

think that solves that init?

rough drift
#

hm?

wary harness
#

I am doing custom shop iventory menu

#

now would it be fine if I would extand ItemStack class

#

I mean

eternal night
#

extending ItemStack basically never works out the way you expect it

wary harness
#

I know data will be lost after menu is closed

eternal night
#

the server does not guarantee you that the same instance is returned at any point tbh

wary harness
#

oh

eternal night
#

I mean, it does to some degree

#

just that it isn't an interface contract

wary harness
#

I think it should return proper instance until inventory is closed

eternal night
#

You should not extend API classes

#

basically completely unsupported

wary harness
#

got you

tardy delta
#

just wrap itemstack

wary harness
rare rover
#

bro i must be on something

#

ServerLevel serverLevel = ((ServerLevel) location.getWorld()); why cant i cast this?

eternal night
#

get the handle first

#

Bukkit's.World is implemented by CraftWorld

#

which exposes getHandle() which returns you the level

rare rover
#

i can do getLevel()

#

not handle tho

tardy delta
#

ok got mongodb to work

#

got two ids now by setting uuid representation to standard

rare rover
#

its eh

#

much rather mysql

grim ice
#

i wanna make something

#

something useful

rare rover
tardy delta
#

when not using UuidRepresentation.STANDARD it looks like this

grim ice
#

why is it Uuid

#

๐Ÿ˜ญ

#

cursed

tardy delta
#

ok i can directly modify _id

tardy delta
#

cry about why they call generic params TItem and not just T too

echo basalt
#

I got automatic type conversion working on mongodb

#

where I store a Map<String, Object> and deserialize it into the correct class types using gson

#

without breaking shit

tardy delta
#

oh i found my mongodb buddy now

echo basalt
#

no you haven't

#

we aren't buddies

tardy delta
#

what

#

but i thought..

echo basalt
#

no.

tardy delta
vocal cloud
#

You got smoked

tardy delta
raw prairie
#

hey, uh I have a runnable that is in a for loop that loops through inventory contents, but it seems to spam the broadcast message, how could I make it stop the runnable and for loop once it detects the item in your ivnentory

hazy parrot
#

show code ?

fluid river
#

return;

icy beacon
#

sorry if this is not the best place to ask, but why the hell can't I import snakeyaml properly? as seen on the left, snakeYAML has a Yaml class, but i can't find it by package or by auto-import. as seen on the right, snakeYAML is indeed in the project

#
<dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.33</version>
        </dependency>
echo basalt
fluid river
echo basalt
#

just safer overall

#

both have their scenarios

fluid river
#

sometimes i return in the loop, cuz loop is the last part of the method

icy beacon
echo basalt
#

that's valid

delicate lynx
#

intellij moment

icy beacon
#

thanks for a helpful response, i am totally going to use netbeans from now on

fluid river
#

why not eclipse

icy beacon
#

forgot that exists

#

eh

fluid river
#

why do you need snakeYaml tho

remote swallow
#

eclipse looks ugly

icy beacon
#

to.. parse yaml files?

fluid river
#

isn't bukkit's YamlConfiguration alright?

icy beacon
#

it's not bukkit, just java

fluid river
#

oh

icy beacon
#

that's why i said that it might be not the best place to ask

#

i just get the fastest responses here

#

soz

fluid river
#

at least on win 11

eternal night
#

jackson has yaml dataformat support

#

if you are already using jackson

icy beacon
#

no, i am going to use snakeyaml for its pure simplicity

eternal night
#

๐Ÿ‘

icy beacon
#

unless like

#

the dependency is broken

river oracle
raw prairie
#

code

#
    public void onPlayerUse(EntityPickupItemEvent event) {
        Player p = (Player) event.getEntity();
        Bukkit.getScheduler().runTaskTimer(plugin, () -> {
            for (ItemStack i : p.getInventory().getContents()) {
                if (i.isSimilar(ItemManager.Ball)) {
                    p.sendMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + p.getName() + " has the ball!");
                    Bukkit.getScheduler().runTaskLater(plugin, () -> {
                        p.getInventory().setHelmet(ItemManager.DiamondHelmet);
                        p.getInventory().setChestplate(ItemManager.NetheriteChestplate);
                        p.getInventory().setLeggings(ItemManager.DiamondLeggings);
                        p.getInventory().setBoots(ItemManager.DiamondBoots);
                        p.getInventory().remove(ItemManager.GravHammer);
                    }, 20);
                }
                break;
            }
        }, 0, 1);


    }```
fluid river
#

why

raw prairie
icy beacon
#

oh apparently none of my dependencies are working, they are imported but i can't use any of the classes or annotations or shit

quasi patrol
#

How does one check when a plugin runs a command? ServerCommandEvent printed nothin when a plugin runs a command.

fluid river
#

there are ServerCommandEvent for console

#

and PlayerCommandPreProcessEvent for player

raw prairie
quasi patrol
#

But what about for plugins?

fluid river
#

plugins can't run commands by themself tho

#

only Player#somethingWithCommand

#

or Server#dispatchCommand

icy beacon
#

dispatchCommand

#

yeah it kinda belongs to somebody

fluid river
#

so server doesn't count command dispatch as ServerCommandEvent?

quasi patrol
#

Ig.

fluid river
#

it should tho

raw prairie
#

@fluid river what should i do

#

with the code i gave

fluid river
#

i don't even know your current goal

#

what are you trying to do

raw prairie
#

then do shit based on t

icy beacon
#

this code isn't even bad it's literally readable

fluid river
#

it's readable but it starts a timer

raw prairie
#

yea how do I break it once it finds the ball

fluid river
#

for no reason

icy beacon
#

it's a 1 tick delay

#

bro

fluid river
#

each time somebody picks up an item

#

tahd starts a task timer

icy beacon
#

nvm i am blind soz

#

but i think the intention was to do a delay

fluid river
#

and idk why

icy beacon
#

runTaskLater

#

kinda just assumed that

river oracle
#

That seems like a super inefficient way to do something super simple

icy beacon
#

because it's sometimes necessary

#

with some events

raw prairie
#

i wanan loop through the inventory

raw prairie
#

but when i dont use the runnable

fluid river
#

why

raw prairie
#

it doesnt work

raw prairie
fluid river
#

you can just check if picked-up item is a ball

remote swallow
#

ur for statement loops through the inv

#

runTaskLater for a delay

fluid river
#

no need for loop

river oracle
#

Doesn't inventory have a contains method?

fluid river
#

it does

remote swallow
fluid river
#

contains

icy beacon
#

i thought isSimilar accepted a Material?

raw prairie
fluid river
#
  • containsAtLeast(item, amount)
raw prairie
#

oh

fluid river
icy beacon
#

ah shit

fluid river
#

there is no ball material in minecraft too

raw prairie
icy beacon
#

yeah it's a custom item i imagine

#

ItemManage is tahd's class

raw prairie
#

for sum reason

fluid river
#
public void onPlayerUse(EntityPickupItemEvent event) {
    if (!(event.getEntity() instanceof Player player)) return;
    if (!event.getItem().getItemStack().isSimilar(ItemManager.BALL)) return;
    p.sendMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + p.getName() + " has the ball!");
    Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
        // change equipment and remove GravHammer
    }, 1L);
}```
raw prairie
#

what is the ! for

icy beacon
#

negation

raw prairie
#

also why do we need to check for if its a player

#

its a pvp game

fluid river
#

?learnjava

undone axleBOT
icy beacon
#

because you probably want to use these events for players?..

remote swallow
fluid river
raw prairie
#

actually true

#

I guess thats need

icy beacon
#

i just realized why my project wouldn't read the snakeyaml dependency

#
module com.example.underscorecubing {
    requires javafx.controls;
    requires javafx.fxml;

    requires org.kordamp.ikonli.javafx;
    requires org.kordamp.bootstrapfx.core;

    opens com.example.underscorecubing to javafx.fxml;
    exports com.example.underscorecubing;
}

this shit was autogenerated

#

when i created the project

#

ffs

fluid river
#

well it was added in 1.18

raw prairie
#

while on the ground

#

I tried by setting the item meta to unbreakable

#

but that doesn't work

eternal night
#

you'll have to listen to the event

#

the exceptions for explosion damage are hardcoded

raw prairie
#

Ill just retexture the nether star ๐Ÿ˜… t

eternal night
#

or that xD

raw prairie
#

easy way out

eternal night
#

but yea ```java
@Override
public boolean hurt(DamageSource source, float amount) {
if (this.isInvulnerableTo(source)) {
return false;
} else if (!this.getItem().isEmpty() && this.getItem().is(Items.NETHER_STAR) && source.isExplosion()) {
return false;
}
....

#

that is the mojang code kekw

raw prairie
#

kek

tardy delta
#

brr

raw prairie
#

๐Ÿ˜ฑ

raw prairie
#

that isn't outright canceling te gravity?

eternal night
#

eh, doubt

raw prairie
eternal night
#

that is a good question

raw prairie
raw prairie
remote swallow
#

velocity to 0 i would guess

raw prairie
#

also im geting this error

#

[ERROR] Could not pass event EntityResurrectEvent to CrystalBall v1.0-SNAPSHOT

org.bukkit.event.EventException: null

#

any idea?

remote swallow
#

?paste the full error

undone axleBOT
hoary wing
#

saco

remote swallow
#

Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.entity.CraftSlime cannot be cast to class org.bukkit.entity.Player on at crystalball.crystalball.Event.OnEntityTotemPop(Event.java:67) ~[?:?]

tardy delta
#

unchecked cast

remote swallow
#

look at ur code

hazy parrot
#

Implementation of slime interface ig

remote swallow
#

Event class, line 67

raw prairie
#

public void OnEntityTotemPop(EntityResurrectEvent e){

#

Player player = (Player) e.getEntity();

#

tru

#

lemme do dat rq

tardy delta
#

PlayerResurrectEvent?

raw prairie
#

yea i fixed that

heady hinge
#

Is it possible to disable anvil renaming letter cap or increase it or is it hard coded?

vocal cloud
#

Most likely hard coded.

eternal night
#

you can increase it

#

on the server at least

#

the client won't care

vocal cloud
#

I imagine the client has the limit hard coded but I haven't really ever used an anvil in Minecraft

eternal night
#

yea the client has

#

you can change it on the server to technically allow too expensive operations

#

but you'll have to trick the client with a fake cost

vocal cloud
#

Ah

twilit roost
#

how do you call this thing?

#

also can I do something like
<T extends MyClass>?

carmine flame
twilit roost
#

ooh right thx

winged anvil
tardy delta
#
public class Wrapper<T extends WrappedValue> {
  T value;
}```
twilit roost
#

?paste

undone axleBOT
twilit roost
tardy delta
#

what about you actually storing a List<ICategorized>

twilit roost
#

that would just help the readability right>

tardy delta
#

there isnt a reason to use a generic param right?

spiral wharf
#

Hello how do i stop a player from charging a bow?

rough drift
#

Is there an event for when a plugin sets an item in an inventory?

rough drift
#

lemme check

tardy delta
#

anyone knows if this is possible in acf: i want to create a player wrapper class that, when declared as first param tells acf to only let players use this method and automatically map the user object

@CommandAlias("sethome")
public void onSetHome(User user, String name) {}```
#

and ill have to provide a way to map a Player -> User ofc

rough drift
spiral wharf
#

yea i have that its just like when i cancel it the bow charge wont reset its just not shooting the arrow

rough drift
#

try setting the bow charge

#

or

#

@spiral wharf

spiral wharf
#

ye

rough drift
#

There is an easier method

#

check for when they shoot, and if your condition is false cancel

#

otherwise you might need to use packets

spiral wharf
#

i just want like after 0.5 seconds of charging it should cancel so ima need to use packets or just try to find another way ig

rough drift
#

like you don't want too much charge?

spiral wharf
#

ye

rough drift
#

but why

spiral wharf
#

uh idk just trying to make a op bow for my friend to prank his friends on his smp XD

rough drift
#

oh, but charging for .5s will be at max regardless

#

or no

#

wait yeah no

#

you can try to simply limit the velocity

#

as the velocity dictates damage

spiral wharf
#

ima try that ig thanks

rough drift
#

try to shoot bow and print velocity

#

then use some velocity around that or smt

#

(print individual comps)

spiral wharf
#

k

#

thx

rough drift
#

npnp

serene sigil
#

how do u check if a yml file path doesnt exist

rough drift
#

contains or exists

#

I forgot

sterile token
#

Also you have some amazing invention called javadocs

rough drift
#

ConfigurationSection#contains

sterile token
#

๐Ÿค”

serene sigil
#

tysm

rough drift
#

np

serene sigil
#

also another quick thing, how to set a path?

sterile token
# serene sigil tysm

can always look it on google first and aso you have some amazing invention called javadocs

sterile token
#

?jd-s

undone axleBOT
rough drift
#

Also

serene sigil
#

lol sry

remote swallow
#

config.set(path, settingThing)
config.save

sterile token
#

I mean take time to read LMAO

#

Sorry if i sound rude

rough drift
#

add a true as the last contains argument to ignore defaults

sterile token
#

But those simple questions can be answered by JAVADOCS or JUST GOOGLING!!!!

rough drift
#

I mean yes

#

but not everyone has learnt the skill of googling correctly

sterile token
#

Lmao i dont like those actitudes because you ppl now a days want to get the food served and cut on the plate

#

Making refence that they want to have everything simple an simple

rough drift
#

I mean look, people might not have learnt how to google or they might not even know about javadocs

#

catch them a break

#

Maybe they're even new to programming

remote swallow
#

javadocs at the start are just confusing as hell to people

sterile token
#

No they are just fucking

#

He do that most of the time

sterile token
rough drift
#

Though it was one of the first things I learnt

sterile token
#

LMAO what shity society we are creating

shut meadow
#

Hello i have a question, is there a way after .registerNewTeam that i can set the Prefix for the team?

rough drift
#

like the name?

#

oh wait I am dumb

#

yeah you can

#

You need the team instance iirc

#

Team#setPrefix

remote swallow
# sterile token JUST GOOGLE SO

i remember when i started, googling isnt hard. Finding the correct thing to google to get the thing you want is the hard part. People learn by getting some help

sterile token
#

i dont know how to say it

remote swallow
#

yep having 2 questions answered is being spoonfed

sterile token
#

spoofed*

sterile token
#

Also i act like this because when i learnt its was by hard no one wanted to help me with this litle things. And it was the best they can do because i realize that putting effort i would learnt them by my self

shut meadow
# rough drift Wdym prefix

A prefix before the name like [LIVE] PLAYERNAME, in the tablist i got it to work but in the chat it looks like this <[LIVE] Playername> but i want that is is looking like: [LIVE] <Playername> and i dont want to change every message to this format with the plugin

sterile token
remote swallow
#

okay so, how are they meant to google what they need if they dont know what they need

sterile token
#

Come on its not so diff to look for stmh online, you look on url try it and see, then another url try and see

#

And then its loop until you have been more than 1h, then yes you can come to ask

#

Because i just googled that and first answer worked

#

๐Ÿ˜ก

rough drift
#

oh wait you don't want to edit

#

sorry but there isn't another way

shut meadow
#

okay but thanks i guess i will look into it to get some other ideas

rough drift
#

No like, there is no other way

#

Its that way or nothing

sterile token
serene sigil
#

alright..... i have ONE more question (sry its a little more complex and there will be definitely no answers on google). So i need to detect if a player puts an item in their 2x2 inventory slot, but i cant use InventoryClickEvent, cuz i need to detect it every tick, is there a way to do it?

rough drift
serene sigil
#

bruh read

eternal oxide
#

why every tick?

sterile token
serene sigil
#

cuz i need to write to a yml file if a player has a dragon egg in their inv

sterile token
eternal oxide
#

but placing in the 2x2 crafting isn;t going to change outside the InventoryClickEvent

rough drift
serene sigil
#

why?

serene sigil
rough drift
#

And is prone to user tampering

sterile token
#

Its more use for making configurations

#

Not for saving data

rough drift
#

I did make the mistake of saving to it though xD

eternal oxide
#

yml is OK for data, but ONLY data which doesn't change often or quickly.

serene sigil
#

cuz there is only 1 egg

rough drift
#

or

#

or

#

just use a separate file

#

eggHolder and write the uuid to it

#

with a data stream or smt

serene sigil
#

why isnt yml ok for this?

#

whats the reason yml exists??

eternal oxide
#

yaml is OK for backend data, so long as you do not read nor write often

#

and its not a lot of data

eternal night
#

so pretty much, never okay kekw

eternal oxide
#

your use case seems to point to PDC being a better choice

serene sigil
#

wtf is pdc

eternal night
#

?pdc

serene sigil
#

lol

eternal night
#

basically in-game data storage tied directly to items/players/entities

eternal oxide
#

Stored on the object, in yoru case the egg or the player

serene sigil
#

but it isnt memory based right?

rough drift
eternal oxide
#

it's persistent between logins

sterile token
rough drift
eternal oxide
#

and if on the Player it's saved on the Player object so would be accurate for teh players current inventory state.

sterile token
#

FlatFile is not designed for fast CRUD operations

rough drift
#

also you should know how to use SQL, even in case you don't like it

sterile token
#

Not telling you to change a configuration

tardy delta
#

good ol' map

sterile token
#

Changing smth user/sql itself tables are a messs

rough drift
tardy delta
#

i should compare mongodb speeds vs sql

serene sigil
#

In this episode, I show you how to use Spigot's Persistent Data API to store primitives and Strings in items, blocks, and players. #Spigot #Minecraft

โญ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentatio...

โ–ถ Play video
tardy delta
#

kody simpson ugh

serene sigil
#

ikr

tardy delta
#

atleast not codedred

river oracle
#

what is it with ever spigot coder youtuber sucking at coding

#

I mean I'm not very good either, but thats why I don't make youtube tutorials

vocal cloud
#

I'll join them hes_UwU. Make another awful YT coding channel with skript kiddies in the comments who want the source code so they can copy paste

#

22 minute video for a 1 minute concept

raw prairie
#

Im having a lil trouble with this snipet of code

#
        if(e.getDrops().contains(ItemManager.Ball)) return;
        if(e instanceof Player) return;
        Bukkit.broadcastMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + "The ball carrier has been killed at " + e.getEntity().getLocation().getBlockX() + " ," + e.getEntity().getLocation().getBlockZ() + "!");```
#

i wanna check if the player has a certain item they drop opon death

#

and broadcast the message

serene sigil
#

wtf there isnt a boolean PersistentDataType?

vocal cloud
#

use an int

#

and store 1 = true 0 = false

serene sigil
#

but there is in vanilla

vocal cloud
vocal cloud
serene sigil
#

ohh

#

ye forgor lol

raw prairie
#

whats with PDC

vocal cloud
#

Wym what's with PDC

raw prairie
#

everyones talking bout it

#

but ok

#

?pdc

vocal cloud
#

Yeah, because it's a great solution to a lot of peoples problems

#

Or rather, use bytes for booleans

sterile token
#

Doesnt sound stupid how the MongoClient works? Because in my case i connecting to the database thru mongo uri which ask you for all the credentials, etc including the db name. But then when you want to work over the collections there is only one posibility and its by getting the db name. And that makes it stupid because i need another config field for the db name. But its already included on the url

#

๐Ÿ‘

vocal cloud
#

What

#

You're not making sense

#

Why not store the db name as a separate string so that you can get it?

raw prairie
#

why does that need a pdc

vocal cloud
#

Is the object you're looking for a direct reference to the object being dropped?

vocal cloud
#

So what's not working with the code then

raw prairie
#

Its not broadcasting the said code

vocal cloud
#

Because it's probably not a direct reference

#

.contains really calls

    int indexOfRange(Object o, int start, int end) {
        Object[] es = elementData;
        if (o == null) {
            for (int i = start; i < end; i++) {
                if (es[i] == null) {
                    return i;
                }
            }
        } else {
            for (int i = start; i < end; i++) {
                if (o.equals(es[i])) {
                    return i;
                }
            }
        }
        return -1;
    }
#

Which does a .equals check

raw prairie
#

so what should I do

#

..

vocal cloud
#

Use PDC

raw prairie
#

alr

sterile token
sterile token
vocal cloud
#

I don't really understand your problem lol.

serene sigil
vocal cloud
#

Personally I'd store the key as a variable so you don't have to make a new instance of it every few lines and helps prevent bugs

serene sigil
#

okay

vocal cloud
#

Have you tried logging the individual variables?

sterile token
#

Let me use the translator

#

Because i dont think u are trolling me

vocal cloud
#

Are you trolling me? I legit don't understand what your problem is that doesn't have an easy solution

sterile token
# vocal cloud Are you trolling me? I legit don't understand what your problem is that doesn't ...

I mean it doesn't sound stupid that to get the database collections it asks for the name of the database. When when you start the client itself you pass it the fucking database name included in the mongo uri

Translated by using: https://www.deepl.com/translator

Translate texts & full document files instantly. Accurate translations for individuals and Teams. Millions translate with DeepL every day.

serene sigil
# vocal cloud Have you tried logging the individual variables?
[22:31:54 WARN]: Task #42 for ZMP v1.69.42 generated an exception
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null
    at com.zushee.zmp.Egg.DragonEggFunction.checkegg(DragonEggFunction.java:35) ~[ZMP.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.jar:git-Paper-81]
    at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1491) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1415) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1188) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:303) ~[paper-1.19.jar:git-Paper-81]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
serene sigil
#

it gave me an exeption

vocal cloud
#
  1. pastebin
  2. That looks like a you problem
sterile token
#

Seriously have you learn how java works?
I mean the basics LMAO

#

Its really make me mad ppl asking for help when they dont event know basic things

tardy delta
#

assign it to an Integer instead of an int (Integer can be null) and do a nullcheck

serene sigil
#

๐Ÿคฆโ€โ™‚๏ธ

vocal cloud
#

Also with mongo I always need to ask for the DB name so I don't understand the issue

tardy delta
#

or do pdc::getorDefault(, -1)

sterile token
#
MongoClient client = MongoClients.create("mongodb://password:username@host:port/db-name?authSource=admin");
MongoCollection<Document> test = client.getDatabase("").getCollection("test");
#

Its stupid mongo

#

Its asking for db name again

#

When you already pass it thru the client ๐Ÿ˜ก

tardy delta
#

it doesnt save the db name its as simple as thhat

vocal cloud
#

No, it's because it doesn't know/see/care about the db you pass into the client

sterile token
vocal cloud
#

This isn't SQL where it works for you

sterile token
#

I have already open many github pr and they just ignore them

#

Im thinking seriuosly starting blaming them

vocal cloud
#

This shouldn't even be an issue because you can always just store the name as a var

vocal cloud
#

More lines =/= bad code

#

Storing the database name in a variable or hardcoding it produces the exact same result

tall dragon
#

bro the bigger ur file is the better the coder

tardy delta
#

you can create a MongoClient based on a connstring, well just retrieve the db back from it, issue solved

vocal cloud
#

He knows that he's just malding he can't do it in 1 line

serene sigil
#

ye i fixed it now, thx!

vocal cloud
#

Logging does wonderful things hmm

tardy delta
#

in one line

vocal cloud
#

your worst enemy will be ctrl + alt + L

tardy delta
#

just dont use it ;-;

vocal cloud
#

It's a free country can't stop me

sterile token
tardy delta
#

if youre struggling to find the line of the exception, just put everything on one line

sterile token
tardy delta
#

whats the problem then

sonic goblet
#

Donโ€™t read the stacktraces when you get them, thatโ€™s what theyโ€™re expecting you to do. Never let them know your next move

shut meadow
# sterile token You will have to unregister and register it again

I have got it to work with the AsyncPlayerChatEvent, but the problem is that when the player hast set a status the hole thing would run into an error ๐Ÿ˜ฆ

Then i have added a if (Vcstatus.sb.getEntryTeam(apce.getPlayer().getName()).getPrefix() == null bit the error in the log still apears here a link: https://pastebin.com/Te9vcwjh

Bukkit.broadcastMessage(Vcstatus.sb.getEntryTeam(apce.getPlayer().getName()).getPrefix() + "<" + apce.getPlayer().getName() + "> " + apce.getMessage());

maybe you could help me

tardy delta
#

throw exceptions by Unsafe::throwException

#

never let them know your next move

sterile token
#

and put the code inside that try-catch

tardy delta
#

dont catch a npe

#

check where its null instead

vocal cloud
#

Never try catch if you can avoid it

shut meadow
sterile token
sterile token
livid dove
#

So im going utterly wonko

#

I have commands that are still registering even if a space is added

sterile token
livid dove
#

/pv and / pv both work

#

And I have no idea why

sterile token
#

PDC are not designed for 1.8 right? A friend want to know

sonic goblet
#

Correct

tardy delta
#

no

sterile token
#

perfect

remote swallow
#

pdc came in 1.16 iirc

vocal cloud
shut meadow
vocal cloud
#

It worked but it's awful

#

๐Ÿ˜ญ

#

Teaching bad practice right off the bat is so wrongggg

desert loom
# shut meadow thank you man ๐Ÿ™‚ worked!

better to check if the return value of org.bukkit.scoreboard.Scoreboard.getEntryTeam(String) is not null prior to executing org.bukkit.scoreboard.Team.getPrefix() on the returned value

sterile token
sterile token
shut meadow
sterile token
#

Have a good night

livid dove
#

this is what im saying

#

something about this server

#

makes it so you can

#

with basically any command

#

2 different plugins, neither of which do this on standard

#

but yet on this server do

#

It has utterly stumped me

#

I do not think you quite understand me

#

This does not happen

#

in my private server with said plugins

#

but does here

#

It is honestly driving me up the wall

grand flint
#

How could I make a plugin where if the user puts items in the crafting table, the items stay there. Also only the player that put them sees it, others see what they put

serene sigil
#

how do u update a block client-side in spigot?

grand flint
#

Why not?

serene sigil
#

crafting tables arent storage

grand flint
#

There is a version from 2014 ๐Ÿคทโ€โ™‚๏ธ

serene sigil
#

really?

grand flint
#

Yes

serene sigil
#

i might be wrong

grand flint
#

You must be

eternal oxide
#

You would have to implement a server side cache of the table inventory per player

grand flint
#

I should store it on the server?

eternal oxide
#

thats where plugins go

eternal oxide
#

update?

grand flint
#

Can I not store it on the player?

eternal oxide
#

yes you can store it in the players PDC but that could be messy once you start with more than one table

grand flint
#

What do you mean by messy?

eternal oxide
#

You'd be better using teh Blocks PDC

grand flint
#

Okay, would that affect server performance if there are tons?

eternal oxide
#

I think crafting benches have TileStates

#

no it would not have any noticable effect on the performance

grand flint
#

Not at all? Like even if there is 10,000

eternal oxide
#

still not as they would not all be loaded at teh same time and they'd not all have data for lots of players

#

you'd need to check it has a PDC/TileState though

#

not sure crafting tables do

grand flint
#

What do you mean?

eternal oxide
#

chests, furnace, hopper etc do

grand flint
#

WorkbenchInventory

#

What is that?

eternal oxide
#

thats it's inventory

grand flint
#

Oh so I would store that in the crafting table it self

#

What do you mean by not loaded

#

So if the chunk there isn't loaded, it doesn't have any affect?

eternal oxide
#

no

#

however, it doesn't look like a crafting bench has a TileState, so no PDC

grand flint
#

Sorry, what is PDC?

eternal oxide
#

persistent data storage

#

and all Entities

grand flint
#

So I can't store it in the crafting table

eternal oxide
#

nope

#

a shame

grand flint
#

so how else would i go on about doing this

#

without affecting too much performance

eternal oxide
#

you could store it in teh Chunk PDC, but you'd have to monitor block break or other types of being destroyed so you could cleanup data

#

there is a library that does that for you

grand flint
#

That won't affect performance too much?

eternal oxide
#

by mfnalex

#

no

sterile token
eternal oxide
grand flint
#

Thank you very much :)

#

Is PDC how minecraft stores normally? In like anvils and stuff

eternal oxide
#

kinda

#

PDC is Bukkits NBT wrapper

grand flint
#

Ohh I thought it was a minecraft thing

eternal night
#

just make sure to not think of it as a NBT wrapper

#

you cannot modify vanilla NBT for example

#

nor do you have access to any NBT types etc

undone axleBOT
sterile token
#

NBT is used on legacy versions

eternal night
#

what

#

wtf does that have to do with anything xD

#

who was even talking about legacy

river oracle
#

yes is the answer to that question

#

there are still viable uses for NBT post 1.14 which is when pdc was added

eternal night
#

barely

#

some I guess

river oracle
#

barely but there are some

sterile token
#

You musnt use them

river oracle
#

vernan post means after

sterile token
#

Pppl under 1.16 should be permanent BAN

eternal night
#

are you drunk ?

sterile token
eternal night
#

ah ๐Ÿ˜… enjoy that, I can recommend #general

livid dove
sterile token
#

How would i loop over 1 list of strings from config, replacing each variable from values taken form another list of strings?

#

I mean i know how to do loops, but i dont know how to do it for what i want, so i can get this output into player;

-        "/command help"
- ""
- "/%command% %usage% - %description%"
- ""

So that message is sent one time to the player, but replacing the variable with adding more lines depending on how much commands i have onthe list
#

Were both of them are Lists

raw prairie
#

would this work for detecting if a player has an item on death?

#
            if(event instanceof Player) return;
            if(((Player) event.getEntity()).getHealth() <= 0 && (!player.getInventory().getItemInOffHand().isSimilar(new ItemStack(Material.AIR))) && ((Player) event.getEntity()).getInventory().contains(ItemManager.Ball)) return;
            Bukkit.broadcastMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + "The ball carrier has been killed at " + event.getEntity().getLocation().getBlockX() + " ," + event.getEntity().getLocation().getBlockZ() + "!");


sonic goblet
#

event instanceof Player

sterile token
sterile token
#

Also

#

Please i would recommend learning the basics of java

#

Its REALLY important

raw prairie
sterile token
#

I mean you shouldnt start with plugins

raw prairie
sterile token
#

Its like trying to drive a car without going to classes or any knowledge about it

#

It apply the same for coding, if you dont know the lang itself its not recommend to code not even use a library

#

I told you because i learnt java by hurt and i have really bad experiences of it

full forge
#

for using nms, do you include the jar produced from buildtools into your buildscript?

#

or is there an external maven repository you include?

sterile token
full forge
#

so whats the best practice for doing that, im using gradle so should i add a libs folder with the jar in it, and then include that folder in my repositories block?

sterile token
#

I dont know if that is posible

full forge
sterile token
#

I use maven and with maven, you can install projects into local repo

#

Which then can be used as dependency but locally of course

#

Then you can deploy them into remote repos

full forge
#

im not as familiar with maven

#

ill just include the jar then on the classpath or something, ty

sterile token
#

na dont worry you welcome

#

have a good morning

hollow pelican
#

I have no clue how to do this but how can I check if a JSON object with a certain property already exists in my .json file using Gson?

#

Every attempt I've tried hasn't worked so far, it just creates a new object in the file for the same property (while the old one already exists) or just replaces everything in that file.

full forge
#

im still slightly confused about nms, wheres the jar i'm supposed to include when i run build tools?

#

would i need to compile the repository that ends up in the CraftBukkit folder to a jar?

fresh timber
#

How can I get a player's head?

#

as an itemstack

river oracle
#

and run it

full forge
#

Does it matter in what directory?

river oracle
#

nope as long as its not in One Drive

#

beacuse apparently some people use that and thats cringe

full forge
#

And then what do I do lol, just include org.spigot:spigot:version or whatever?

river oracle
#

you don't need to include anything just run buildtools

#

oh NMS

full forge
#

Yes

river oracle
#

wait ๐Ÿคฆ๐Ÿฝโ€โ™‚๏ธ sorry

full forge
#

Lmao

#

You're good

river oracle
#

firstly you can't use gradle

#

if you want to use gradle you need to go with Paper API

#

spigot runs purely off of maven and I have no clue if anyone has translated the mapping plugin md5 made to gradle

#

I know one of the pink clowns on the sidebar uses gradle with spigot, but I forgot

full forge
#

Aw what

#

I hate maven ๐Ÿ—ฟ

river oracle
#

just because you don't understand it doesn't mean its bad :P

full forge
#

No I hate the syntax I get how it works

#

Gradle seems so much cleaner

river oracle
#

xml and that html like syntax is everywhere

full forge
#

Ah, whatever, I'll try maven tomorrow

#

Thanks :)

river oracle
#

:P its easy with maven

full forge
#

I figured once everything I googled was using maven

hollow pelican
#

nvm, something else did it.

raw prairie
#

nvm found a diff solution

leaden wadi
#

hi, im having issues running buildtools

Attempting to build Minecraft with details: VersionInfo(minecraftVersion=1.8.8, accessTransforms=bukkit-1.8.8.at, classMappings=bukkit-1.8.8-cl.csrg, memberMappings=bukkit-1.8.8-members.csrg, packageMappings=package.srg, minecraftHash=a0671390aa0691e70a950155aab06ffb, classMapCommand=null, memberMapCommand=null, finalMapCommand=null, decompileCommand=null, serverUrl=null, mappingsUrl=null, spigotVersion=null, toolsVersion=0)
Starting download of https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1902)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1500)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
        at java.net.URL.openStream(URL.java:1093)
        at com.google.common.io.Resources$UrlByteSource.openStream(Resources.java:72)
        at com.google.common.io.ByteSource.read(ByteSource.java:296)
        at com.google.common.io.Resources.toByteArray(Resources.java:98)
        at org.spigotmc.builder.Builder.download(Builder.java:1083)
        at org.spigotmc.builder.Builder.main(Builder.java:416)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
#

im using the latest buildtools

river oracle
#

๐Ÿ’€ 1.8

#

?1.8

undone axleBOT
leaden wadi
#

yes lol

rare rover
#

Should i code paper or spigot?

#

Paper has better performance but spigot seems easoer

#

Easier

#

I've been using paper but eh idk

river oracle
#

just use spigot

#

if you like components use paper

#

there really isn't another reason to use it other than the components and they have like 2 or 3 more events

#

plus it makes your plugin compatible with spigot as well

rare rover
#

Alr, plus all the tutorials are spigot so

#

Save me some time

#

Ig

river oracle
#

๐Ÿ’€ please don't use spigot tutorials on youtube

#

read the wiki instead

rare rover
#

No no, i dont use youtube Harold

#

I find forums and stuff

#

And wiki ofc

dry forum
#
        armorStand = location.getWorld().spawn(location.add(5, 0, 5), ArmorStand.class);

        guardian.setLaser(true);
        guardian.setGravity(false);
        guardian.setInvisible(true);
        guardian.setInvulnerable(true);
        guardian.setTarget(armorStand);

        armorStand.setInvulnerable(true);
        armorStand.setInvisible(true);
        armorStand.setGravity(false);``` why does the guardian beam randomly dissapear after like 6 seconds
wet breach
#

Buildtools requires vanilla server jar in order to do its thing

leaden wadi
#

im compiling it now

wet breach
#

At least you solved the problem

balmy valve
#

Is there any way for me to get an item that gets shift left clicked from the inventoryclickevent?

#
@EventHandler(priority = EventPriority.HIGHEST)
    public void onInventoryClick(InventoryClickEvent e) {
        final Player player = (Player) e.getWhoClicked();
        final InventoryView inventoryView = e.getView();
        final ClickType clickType = e.getClick();
        final ItemStack inHand = e.getCursor() != null ? e.getCursor().clone() : null;
        final ItemStack inSlot = e.getCurrentItem() != null ? e.getCurrentItem().clone() : null;
        final int rawSlot = e.getRawSlot();
        player.sendMessage("Inventory Click Cursor");
        changeSpirits(player, inHand, false);
        if (clickType == ClickType.SHIFT_LEFT) {
            player.sendMessage("Inventory Click ShiftClicked");
        } else if (clickType == ClickType.LEFT && inventoryView.getInventory(rawSlot) == inventoryView.getBottomInventory()) {
            player.sendMessage("Inventory Click Placed");
            changeSpirits(player, inSlot, true);
        }
    }

Current code ^
Just trying to figure out how I could see what item is moved from the shift click

#

would it just be the 'inSlot' variable, aka e.getCurrentItem()

#

ok just tested it, it is

lost wolf
#

Does the CreatureSpawnEvent is triggered by the spawnEntity method?

earnest forum
#

probably

#

only living entities

#

tho\

fierce whale
#

is there anyway to create world per player? like sky block plugin.
I wanna make player's personal island but I'm noob ๐Ÿ˜ฆ

chrome beacon
#

There are premade skyblock plugins available if you feel like it's too hard

fierce whale
#

I tried to read other plugin's source code. but It was so hard to me ๐Ÿ˜ฆ

wet breach
fierce whale
#

do I need to use world generator?

fierce whale
#

collect many island in one world?

wet breach
#

How skyblock does it is it uses a void world and then with some logic uses a schematic or schematics to paste islands in as needed when players join

earnest forum
#

they usually have a boundary

#

and then like 1000 blocks in between islands

#

so theres no way they ever meet

chrome beacon
#

^

fierce whale
#

ahha...

#

But what I'm worring if I use one world is so many chunk Loaded.

earnest forum
#

a world for each player might be more resource intensive

fierce whale
#

ohh I was stupid

wet breach
#

Multiple worlds doesn't help that problem either and will use more resources in the long run due to how world loading works. Better off with just a single world. Also chunks don't stay loaded unless a player is at their island

fierce whale
#

I got it! ๐Ÿ™‚

wet breach
#

Also empty chunks don't take resources either

fierce whale
#

then.. have I use worldedit code to use schematics?

wet breach
#

Hence void world being used. Most of the chunks being loaded will not contain blocks so not really an issue

earnest forum
#

yep

chrome beacon
fierce whale
#

I got it! ๐Ÿ˜Š thanks!

glossy venture
#

did their account just get deleted

#

or is it a fake name

earnest forum
#

fake name

mighty pier
#

imagine being korean

#

so cringe

hybrid spoke
#

so ultra cringe

mighty pier
molten hearth
white dew
#

Hi guys. I have been wanting to make a plugin where a player will be able to gain new skills given certain events

#

I wanna hold all these skills in an array

#

however, I have been thinking, maybe I should add a new class like PlayerPlus where I extend player and add this new array (plus other things as well)

#

or maybe It would be best if the player was an attribute, as well as the array and the other stuff

#

both work correctly

#

However, what would be the approach of you guys, to do something like this?

white dew
#

Hmmm ๐Ÿค”

hybrid spoke
#

wrap the uuid of the player instead with it skills

white dew
#

I don't know what is uuid, but I can search It

#

ooh, is It like the id given by the player?

#

like, each player has one?

hybrid spoke
#

yeah, its the โœจ universally unique identifier โœจ given each account on creation

white dew
#

:o

#

awesome

#

so I will use this uuid as an attribute, instead of a Player attribute

#

and when I want to use methods from Player

#

I will do something like

#

uuid.getPlayer().somePlayerMethod() ?

hybrid spoke
#

no, then you get the player by Bukkit with the getPlayer method

#

i mean, you could also have the player as attribute, but UUID leaves more options open

white dew
#

oooh

#

so I can access more stuff with the UUID?

#

๐Ÿค”

#

If I understand correctly, that seems cool

hybrid spoke
#

no, the UUID is just, like the name says, the identifier for the player. you can either request the offlineplayer object or the player object with the UUID

white dew
#

oh, ok!

#

ah

hybrid spoke
#

but for serialization f.e. the UUID will make your live easier

white dew
#

think I got It

hybrid spoke
#

also this gives somewhat of an offline functionality

white dew
#

Cool!

#

Thanks

hybrid spoke
#

np

white dew
#

Hi guys, what would be a good approach for creating new custom Items?

#

I'm thinking about creating a class named "CustomItem"

#

and then

#

passing the item lore, display name, quantity, material, etc, as parameters

#

and then I construct an ItemStack on the constructor

#

and set the lore, display name, etc, with the respective arguments

hybrid spoke
#

then you can just use ItemStack

white dew
#

yeah, but

#

I think It will nice to have methods that generate a specific custom Item I have, so I don't have to create all these values in my main code

#

for example

#
public CustomItem createCustomItem1() {
  Material material = Material.BUCKET
  String displayName = "Super Bucket"
  ...
  return new CustomItem(material, displayName)
}
#

something like this

#

ooh

#

Maybe I can create a class with these methods

#

but just use ItemStack for the item, as you suggested

#

๐Ÿค”

#

Yeah, that makes a lot more sense ๐Ÿ˜…

#

Now that I think about It, I don't even need a constructor for the class CustomItem

#

I just have to create methods to generate new ItemStack items

#

Is there a way to use methods without necessarily needing an object? I'm kind of new to OOP

#

like, instead of instance1.do_something()

#

I could do class1.do_something()

#

so I don't have to initialize a new instance everytime I want to use It

#

Oooh, I think I found out

#

I have to use "Static Methods"

kindred valley
#

Hello noob @fluid river

white dew
#

Hi, this is more of a Java question, rather than spigot

#

but I want to store a list of skills

#

they don't have to be in order, I just want to efficiently search if the player has an skill

#

My first thought was to use sets, since they usually provide this function

#

but the Set java provides doesn't seem to offer a "search" or "has" operator

mighty pier
#

list

#

List<>()

white dew
#

The problem with list is that searching on It takes O(n) complexity, where n is the length of the list

#

I want it taking O(logn)

#

i mean

#

logn

mighty pier
#

what that

white dew
#

It's computational complexity

hazy parrot
#

You can use Set

#

If index is irrelevant

white dew
#

Yeah, but set doesn't have a method for searching, does It?

flint coyote
#

it has a .contains

hazy parrot
#

It has contains

white dew
#

it has????

#

wait

#

let me see

mighty pier
#

limo

white dew
#

you are right

#

Ahaha

#

Awesome

#

Oh, Set is abstract

#

I'm gonna use HashSet

hazy parrot
#

It's interface ๐Ÿคทโ€โ™‚๏ธ

white dew
#

Yeah, I'm new to java programming, didn't know, haha

#

cool

#

It works

#

Hey, suppose I have a class PlayerPlus

#

each player is going to be an object of PlayerPlus

#

PlayerPlus has a player object, and also has a set of skills, and other attributes

#

When a event happens, I want to get the object PlayerPlus that made that event happen

#

however, I can only get the player, with event.getPlayer()

#

Is It a good idea for me to make a map, mapping the uuid of the players to the respective object PlayerPlus?

#

Yeah, I got It

#

but thanks!! :)

#

well, I'm using a HashSet, so I suppose I can get the value in O(logn)

white dew
#

Yeah, I already did It

#

But thanks guys