#help-development

1 messages · Page 2021 of 1

tiny wolf
#

noice noice

#

and what does it take to make one of those ?

#

yaml based or what

tardy delta
#

Kupferzweihänder

lost matrix
#

Nope all done in code

tiny wolf
#

ah, so the idea behind mine is that it's super duper easy to add more items

#

no coding at all needed, using some nice placeholder systems

lost matrix
#

Same goes for our approach. Just something like

new CombatItemBuilder(ModelData.COPPER_SWORD)
  .withStat(CombatStat.CRITICAL_STRIKE, CombatStatMod(Type.BASE, 3.25))
  .withStat(CombatStat.MEELE_DAMAGE, CombatStatMod(Type.PERCENT_ADD, 25.5))
  .withSkill(...)
  
  // and so on
tiny wolf
#

nice nice

lost matrix
#

nice 😄

tiny wolf
#

ye now that u said it I might have to make it so different people can see different things lmao I want it too

lost matrix
#

God i just found all the stuff i did back then that never came to live

#

Mithril ore btw

fickle frost
#

Interesting shading.

#

Kinda looks like Hytale's ores.

lost matrix
fickle frost
#

They got acquired by RiotGames, got a bigger budget and delayed release to work on it more.

lost matrix
#

Did Rito just stomp it and is trying to build it up from the ground again?
With a lot of salt.

fickle frost
#

I applied for a job there a couple weeks ago and got an interview but told me they'd reach out if they found another position better suited for my skillset. Very sad.

tiny wolf
#

do you think I should store an item as a placeholder and to store data then do the rest via packets ?

lost matrix
tiny wolf
#

wdym

lost matrix
#

I for my part had those interfaces that could be registered in the packet adapter:

#

Its a bit complicated to describe

tiny wolf
#

Didn't really get what you mean, I currently have a base item which is like a template for stuff then when I want to build it I make it use what I called an instance Item

lavish hemlock
#

ayy kotlin

tiny wolf
#

gotta love kotlin

lavish hemlock
#

indeed

lost matrix
#

Ive intensively used it now for a week now and i have to admit that im not really convinced. It sure has some nice concepts
like extension methods but it really feels less strict and a bit more like a small project/prototyping language.

lime jolt
#

does anyone know why my run does not do anything

#

like the run method

#

inside it just breaks

#

after line 68

#

run should happen

#

but it does not

#

_<

quaint mantle
quaint mantle
#

then in ur run method you're sleeping the main thread

lean gull
#

anyone?

lime jolt
lime jolt
quaint mantle
#

you're still sleeping the main thread

#

everyone will lag for those two seconds

lime jolt
#

?

#

how

#

I am creating a new thread

#

called thread

quaint mantle
#

you have absolutely no idea what you're doing

lime jolt
#

crys

quaint mantle
#

this has all you need

#

?scheduler

#

?scheduling

undone axleBOT
quaint mantle
#

@lime jolt

lime jolt
#

but how do they start the run method

quaint mantle
#

just read it all

lime jolt
#

it no say

crimson terrace
#

yes it does

eager sapphire
#

Is it possible to tell that a player is in the middle of editing a book?
I'm worried it's client-side only 😦

I have a problem when opening a GUI for a player, if they are editing a book at the time it gets closed and they lose all their words.

tall dragon
tiny wolf
eager sapphire
tall dragon
#

there is an event for when a book gets signed iirc, but im pretty sure you cannot tell if they are editing a book

eager sapphire
#

Yeah I first tried PlayerEditBookEvent but as you say, that only fires when they finish editing (signed or not)

tall dragon
#

actually

#

i might be kind of hacky, but what if you keep track of players with a book open

#

u can add them to a list on player interact

#

and remove them on PlayerEditBookEvent

#

though there might be some issues where the player can close the book without being removed from the list

#

probably by closing the game is 1

eager sapphire
#

not a bad idea- could also remove them if they change to a different item

tall dragon
#

yea

#

thats something you could try then

eager sapphire
#

I think for now at least I will just prevent the menu if they are holding a book at all

tall dragon
#

thats alot simpler indeed.

#

i guess its not that annoying for players, just need to not hold a book

eager sapphire
#

yeah and I admit it's a little weird to open a gui for a player unprompted, I may need to just rethink the idea, it's basically a /tpa GUI, so player 1 chooses a player to TP to from a menu, player 2 gets a yes/no confirm menu pop-up

tall dragon
#

would you not be better off sending a clickable message?

#

idk what kind of server you run. but an unprompted gui could mess up gameplay too

#

for example someone is in the middle of a big jump xD

eager sapphire
#

heh yeah it's been ... kinda annoying tbh XD

#

clickable message is a good idea, the main idea is to avoid using chat and commands but there may not be a better way.

tall dragon
#

im afraid a clickable message is best ur gonna get without disturbing gameplay

#

and, still u can make it look pretty good

eager sapphire
#

yah true

#

if this was a custom plugin I'd probably go ahead and do it

#

but as it stands this is within the context of my magic spells plugin, which can't really easily do stuff like that since it would require a custom command just for accepting/denying .. anyway I'll figure it out, thanks for your help!

round finch
#

help my dynmap doesn't have the secure qualification
and not showing because of it

shadow night
tall dragon
arctic moth
#

the owner of this server literally gave me free nitro to get the 69th boost what a chad

dry pike
#

Looking for some advice with npc pathfinding. I would like to create hundreds of npcs on my server and minimize the performance hit. The idea of remotely generating a path comes into mind which would basically have all the same issues that async pathfinding would have. As a solution I would have to check for any world changes along the route, but would remote pathfinding save any more resources than async pathing would?

lost matrix
dry pike
#

Pathfinding at 1000+ blocks

lost matrix
vivid cave
#

thank you very much for ur help bro
Actually you're right, I could find with pretty much ease how to do it with nms
It's really amazing since moj maps; all the methods are soo easy to find, just my autocompleter did the job here
it has ItemStack#getEntityRepresentation and ItemStack#setEntityRepresentation, exactly what I need

dry pike
# lost matrix Why?

The NPC has to travel far in a dynamic world. Using smaller segments may result in dead ends.

vivid cave
#

could you explain me what u meant with Pull Request-ish tho?

lost matrix
lost matrix
vivid cave
#

oh okay!

#

i agree

dry pike
round finch
lost matrix
#

Doing a 2D pathfinding lets you find a path over thousands of blocks (pixels) in a ms

dry pike
#

Interesting and could possibly only generate hightmap for chunks along route

quasi flint
lost matrix
#

Just give every pixel a value between 0.0 and 1.0 and define how much an adjacent block can differ. For normal jump height and
a world height of 255 this would be 1.0 / 255 -> ~0,00392

quasi flint
#

Cannot get it to prop work

eternal oxide
dire salmon
#

how can i make gradients without minimessage?

dry pike
lost matrix
dry pike
vivid cave
lost matrix
lost matrix
vivid cave
#

yes true

#

but is there a way still?

lost matrix
#

Only if you use reflections.

#

Or modules -> But then you have to write everything new for every version

vivid cave
round finch
pliant oyster
#

hey uhhh, can someone help me in a vc screenshare with something, it's complicated by typing it

hexed hatch
#

Try to describe it first

pliant oyster
#

it's something to do with file configuration

hexed hatch
#

What about it?

pliant oyster
#

so, I'm making a file that stores multiple values to a players uuid

#

it's a crate keys system

hexed hatch
#

And what's happening when you try to do that?

pliant oyster
#

So

#

I know how to do
uuid: int

#

but

hexed hatch
#

What kind of file is this?

pliant oyster
#

Idk how to do

  emeraldkeys: int
  goldkeys: int```
#

.yml

#

yaml

hexed hatch
#

For starters, you store UUIDs as strings

pliant oyster
#

yeah

quaint mantle
#

Does onClose only run of no inventory is open, or if you run openInventory again on a different gui

#

for InventoryCloseEvent

pliant oyster
hexed hatch
#

You need to get the path of the uuid and add from there

pliant oyster
#

but I wanna store multiple stuff in uuid

hexed hatch
#

subcategories, right?

pliant oyster
#

but not just a single int

#

yes

hexed hatch
#

under uuid?

pliant oyster
#

yup

lost matrix
#

You mean something like

playerdata:
  someuuid:
    emerald_keys: 10
    golf_keys: 32
  anotheruuid:
    emerald_keys: 5
    golf_keys: 1
hexed hatch
#

But you said this was in separate files

#

did you not?

#

oh

pliant oyster
#

Yes it's in a seperate file

hexed hatch
#

Okay I see what you mean now

pliant oyster
#

keys.yml

pliant oyster
#

I know how to get to the uuid part but not the subcategories

lost matrix
pliant oyster
#

uhh what's the simpler way

#

rn I know how to do
Main.getInstance().getKeyConfig().set(player.getUniqueId().toString(), int);

ancient plank
#

dead

quaint mantle
#

Its quite simple actually

pliant oyster
#

sure in dms

quaint mantle
#

But credit me please :(

pliant oyster
#

well I'm not copying ur code, im just using it to learn stuff

ancient plank
#

I will never understand the point of asking for code to be sent in dms, also blobspoonfeed

lost matrix
# pliant oyster uhh what's the simpler way

sigh
Then you can just build a path like this:

FileConfiguration config = ...;
UUID playerID = player.getUniqueId();
String path = "playerdata." + playerID + ".gold_keys";
int goldKeys = config.getInt(path);
pliant oyster
#

Oh I see

ancient plank
#

imagine if every stack overflow question was resolved by saying "send it in dms" and you're trying to figure out an answer to a question but every. single. question. was resolved that way

quaint mantle
ancient plank
#

but you can never find the answer bc it was sent in dms

viral crag
#

no shortage of discords that do it that way ...

lost matrix
pliant oyster
#

correct?

quaint mantle
#

Damn then ive been wasting like 100 bytes.

#

On useless lines.

lost matrix
pliant oyster
#

ok so

quaint mantle
#

all that does it return the config

lost matrix
quaint mantle
#

for his economy yml

pliant oyster
dire salmon
#

how can i make gradients in strings without using MiniMessage or lots of ChatColor.of

lost matrix
ancient jackal
#

Make a method that takes a string and returns a string using list or arrays and iteration

lost matrix
dire salmon
#

kk thanks

vague swallow
#

How can I save a list of Strings into a config and check if the list contains a String?

lost matrix
vague swallow
#

okay thanks

grim ice
#

btw

#

what does Hash mean

#

why isnt there a hashlist

echo basalt
#

A hash is basically a one-way numerical representation of something

grim ice
#

what

#

oh

echo basalt
#

Let's say you have the values 2 and 6

grim ice
#

is a hashset

#

a set of hashed values?

echo basalt
#

And you want to make a hash for your combination

#

You can use some simple math

#

you see, multiplying 2 prime numbers is easy

#

but figuring out the 2 numbers from the result is not

ancient plank
#

easy if you know what prime numbers are wesmart

echo basalt
#

So it's a one-way type of calculation

#

You can call hashcode() which returns a hash for any object in java

grim ice
#

ic

#

so a hashset is a set of hashcodes of values

echo basalt
#

A hashset internally is a hashmap where the value is the same across all keys

ivory sleet
#

There’s more to it but yeah in principle

grim ice
#

i want the more into it

grim ice
#

is that actually it

#

i want the details if possible

ivory sleet
#

Okay so a HashSet encapsulates a HasMap<E,Boolean> and then the HashMap itself encapsulates a Set<Map,Entry<K,V>> as well as a Node<K,V>[]

lost matrix
ivory sleet
#

^

grim ice
#

i dont mind

#

ill search it up if its too much to fit in here

grim ice
#

for

#

just a place holder?

lost matrix
#

Wait there was a pdf i read when i first started out. Ill go search it.

ivory sleet
#

Yes hex

#

In simple terms

lost matrix
ivory sleet
#

Anyhow the Set<Entry<K,V>> is of internal inner class HashMap.EntrySet which is used when returning entrySet() for AbstractMap

#

and it manages the Node<K,V>[] table further

#

And is used for things like key and value views iirc

grim ice
#

ic

young knoll
#

Yeah you can iterate maps with it

lost matrix
grim ice
#

sad thing i dont even know what a node is

#

always heard about it but never searched

ivory sleet
#

A class that encapsulates the hash, the key, the value and the next node in this case

#

(For LinkedHashMap it might be different but yeah)

grim ice
#

i was gonna mention linked stuff

young knoll
#

A node is just an entry in a collection

#

Afaik

grim ice
#

o

grim ice
young knoll
#

Mhm

woeful crescent
#

how do events run things before the MONITOR methods are called?

#

like, how are EventPriority.MONITOR methods treated any differently?

#

afaik there is no overridable afterTask

#

or anything like that

lost matrix
woeful crescent
#

oh

#

damn

#

makes my job a lot harder x_x

#

I have a death event,

#

and it's called before the player respawns.

lost matrix
#

naturally

woeful crescent
#

However, that is a problem, as something that relies on the death event will also create a big explosion if the killer is using a certain weapon

#

so, after thinking about it for a second...

#

i n f i n i t e l o o p

#

Killstreak: 234

#

(the explosion does damage)

#

I could try Bukkit.getScheduler().runTask()

#

but I'm tired of doing that for all my ordering issues

lost matrix
#

Oh because the explosion is created before the player dies. I get it.

woeful crescent
#

👍

lost matrix
#

Yeah just run it a tick later.

woeful crescent
#

alr

tender shard
#

how to craft hearts

#

?

lost matrix
tender shard
#

haha

lost matrix
#

Reminds me of the plugin i did back then that had 2 cat images and the whole bible as txt in it.
2.4MB for a plugin that just hid player names when they joined. Had 200 downloads in 2 days and
nobody cared. Got removed without notice tho.

lime jolt
#

anyone know how to make a strong regeneration

#

array.get(0).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200000000, 20000000));

#

I have this

#

but it no strong

#

s.o.s

young knoll
#

That’s

#

No

#

Potion effects are bytes

#

Use like, 100

#

Past 128 it overflows to negative

#

It is

lime jolt
#

so how would I change it

young knoll
#

Not really sure why spigot takes an int

#

I just told you

lime jolt
#

array.get(0).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 128, 128));

#

?

#

what do the last 2 numbers mean

young knoll
#

Duration and amplifier

#

Read
The
Javadocs

lime jolt
#

so for duration i just make it insianly high

lime jolt
young knoll
#

Integer.MAX_INT

lime jolt
young knoll
#

I guess it means people don’t have to cast

#

But meh

#

¯_(ツ)_/¯

lime jolt
#

array.get(0).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 2147483647, 128));

#

anyone know how to make regen strong

#

very, very strong

#

so that if someone were to punch you, you would not die

young knoll
#

Did you type out the max int value

#

Y

lime jolt
#

it did not work

#

how

lime jolt
#

but that part is fine

#

alright thanks

#

but still though, how does the regeneraion thing work

#

like how to make it strong

young knoll
#

Integer.MAX_VALUE certainly does work

lime jolt
#

that is for duration

young knoll
#

Mhm

lime jolt
#

regen strength

#

how make it strong

#

very strong

young knoll
#

Regen does get stronger with each level, but Mojang may have only programmed it up to a certain point

tender shard
#

okay but the real question is, how to craft hearts

lavish hemlock
lime jolt
tender shard
#

I DONT KNOW D:

#

?recipe

lime jolt
#

❤️

young knoll
#

Imma craft you in a minute

lime jolt
#

idk what to do about the regen thing though

young knoll
#

Well, did you try regen 7

lime jolt
#

u said 128 was max

#

._>

#

._.

#

okok, i try

young knoll
#

Yes and you said 6 works

#

So the next logical step

#

Is 7

earnest forum
#

crafting hearts > everything

#

isnt 255 the limit for potions?

young knoll
#

Yes but it’s a byte

#

So 255 overflows

#

Yes

#

Maybe

#

Isn’t a signed byte -127 to 128

#

Location.getBlock.isAir

#

Ah right it starts at 0

#

Java should have unsigned values

#

Smh

lavish hemlock
#

Java doesn't have enough faith in devs

#

although it technically does have unsigned values

young knoll
#

Char doesn’t count

lavish hemlock
#

They're not great tho just sayin'

#

They're mainly wrappers around the i & 0xFFFFFFFF operation iirc?

#

Still an unsigned value, technically

#

Just not an unsigned type

young knoll
#

So what happens if you pass a number about the unsigned limit

lavish hemlock
#

idfk

young knoll
#

Magic, got it

lavish hemlock
#

I don't use those methods cuz they're shit to work with

young knoll
#

ubyte ushort uint ulong ufloat udouble

#

Gosh oracle it’s not hard

lavish hemlock
#

Personally I prefer names that use bit sizes

#

like uhh

#

i8 and u8

young knoll
#

u69

lavish hemlock
#

That's a big integer

young knoll
#

When your number is 69kb

lavish hemlock
#

yoooo sweet

simple anvil
#
Player p = (Player) sender;
        List<String> lore = new ArrayList<>();
        ItemStack hand = p.getInventory().getItemInMainHand();
        ItemMeta meta = hand.getItemMeta();

        for (int i = 0; i <  args.length; i++) {
            lore.add(args[i]);
        }

        meta.setLore(lore);

        hand.setItemMeta(meta);

on the item the lore looks like this
/addlore yes ok no
item lore

yes
ok
no

how to get all the lore on the name line?

young knoll
#

Combine all the args to one string

simple anvil
#

how?

young knoll
#

I think Arrays.join is a thing

#

Or maybe String.join

hybrid spoke
#

hey i need help with garlic

lime jolt
#

does anyone know how to check if a specific player is online or ofline

simple anvil
#
p.getPlayer().isOnline()
young knoll
#

Why p.getPlayer

#

What is p

chrome beacon
#

Bukkit#getOfflinePlayer
OfflinePlayer#isOnline

lime jolt
#

thx

young knoll
#

Or Bukkit.getPlayer() == null

hybrid spoke
#

p == null youknow

lime jolt
#

can I just do

#

p.isOnline

simple anvil
#

is this a command?

young knoll
#

If you have a player instance, yes

lime jolt
#

alright thanks

young knoll
#

But generally if you have a Player they have to be online

simple anvil
#

@lime jolt command?

chrome beacon
young knoll
#

Block.getType.isLiquid

#

Or just Block.isLiquid

#

One of those

#

I’ll # you

lime jolt
#

well yes

#

but

#

no

#

or yes

simple anvil
#

?

#

oke

lime jolt
#

I am making a small game

simple anvil
#

what is this for?

lime jolt
#

and want to see if they are online

#

if they ofline

#

other person wins

#

and there stuff is erases

#

erased*

simple anvil
#

tab?

lime jolt
lime jolt
simple anvil
#

press tab?

young knoll
#

Lol

#

Code cannot press tab

simple anvil
#

in agme

#

bruh

lime jolt
#

I meen I guess

#

but then the other player needs to erase the offline players data to win

#

and other stuff

#

idk

#

what

#

I

#

am doing

simple anvil
#

what?

#

ok explain the game

lime jolt
#

its is fine

#

everything is fine

#

it is just sumo

#

🙂

simple anvil
#

ok so why do they need to know if the other players offlline?

lime jolt
#

if player leaves in the middle of a match

#

u know

#

so it ends

#

NEW QUESTION

#

does anyone know how to use DeluxeHub and change it so that when you click a item in there menu it will run a command for u

ivory sleet
#

Use PlayerQuitEvent

#

You can basically just pick up the player instance from there

simple anvil
#

lol

lime jolt
#

this is what there yml looks like

#

wait

ivory sleet
#

Server and plugin questions that do not involve programming should be inquired in #help-server btw

lime jolt
#

oh ok

#

sry

ivory sleet
#

No worries (:

simple anvil
#
Player p = (Player) sender;
        List<String> lore = new ArrayList<>();
        ItemStack hand = p.getInventory().getItemInMainHand();
        ItemMeta meta = hand.getItemMeta();

        for (int i = 0; i <  args.length; i++) {
            lore.add(args[i]);
        }
        meta.setLore(Collections.singletonList(lore.toString()));
        hand.setItemMeta(meta);

#

how do i remove the [ ] ,

lime jolt
#

I am trying to check if 2 players are online (both arraylists are arrays of Player objects), why does this if statment not work

#

HelloCommand.array.get(0).isOnline() && HelloCommand.array.get(1).isOnline()

viral crag
simple anvil
#

i have to

#

lore is a list

lime jolt
#

whenever u print an arraylist

delicate lynx
#

just set the list as the lore

lime jolt
#

it prints it with brackets and commas

ivory sleet
#

Yes it’s a part of the ArrayList::toString

viral crag
#

[0] + " " + [1] + etc etc

simple anvil
#

all on spret lines

ivory sleet
#

@lime jolt that should work

lime jolt
delicate lynx
#

oh you want it onto a single line?

lime jolt
#

does not seem to be working

ivory sleet
#

But like, it only checks given the time it was called

lime jolt
#

idk why

simple anvil
#

yes

tender shard
#

?learnjava

undone axleBOT
simple anvil
#

lore is a list

young knoll
#

Does String.join accept an array

tender shard
#

cursed language to do cursed things

lime jolt
#

mfnalex do you know how to solve my problem ;-;

young knoll
#

I thought it was collections

simple anvil
young knoll
#

Either way, use that

tender shard
lime jolt
#

this if statment

#

HelloCommand.array.get(0).isOnline() && HelloCommand.array.get(1).isOnline()

young knoll
ivory sleet
lime jolt
#

I am trying to check if 2 people are both online

tender shard
lime jolt
#

HelloCommand.array

tender shard
#

learn basic java

young knoll
tender shard
#

that's all I can say

lime jolt
#

^^^

lime jolt
#

I got a follower

young knoll
#

Wrong reply

#

:p

tender shard
#

killing people with a gun also works but that doesn't mean it's right

lime jolt
#

it means it works

simple anvil
ivory sleet
young knoll
#

Just String.join the array

#

and you’ll get a single string

#

Which you can just add to the lore

tender shard
simple anvil
young knoll
#

String.join(“ “, args)

#

Something like that

ivory sleet
simple anvil
#

but i dont have a string in this command

tender shard
viral crag
#

there are many ways to glue an array/list together

young knoll
#

You don’t need one

#

String is the string class

simple anvil
#

ohhhh

#

lmao

tender shard
#

we should really force people to use more threads in this channel

ivory sleet
#

Oh misinput

#

But I agree

#

Threads good

tender shard
#

the problem is that discord only shows threads someone already joined

#

so if you open a thread, you get next to no replies

ivory sleet
#

Myeah, they’re quite intermediate right now

viral crag
#

clicking yes does not learn me more ...

#

mouse over the yes sticker

tender shard
simple anvil
tender shard
#

of your commadn executor class and you want to access it somewhere else?

tender shard
simple anvil
#

was not talking to u

tender shard
#

you quoted me though

simple anvil
#

i did not

#

oh

tender shard
#

i think you did

#

😄

simple anvil
#

misclick i gues

tender shard
#

np lol

#

so what's your question again

#

lets start from scratch

simple anvil
#

me?

tender shard
#

yes

simple anvil
#

ok

undone axleBOT
lime jolt
#

hehehehe

tender shard
#

thanks, quite some useful links in there

lime jolt
#

LMAO JKJKJK

#

just a prank bro

simple anvil
#
Player p = (Player) sender;
        List<String> lore = new ArrayList<>();
        ItemStack hand = p.getInventory().getItemInMainHand();
        ItemMeta meta = hand.getItemMeta();

        for (int i = 0; i <  args.length; i++) {
            lore.add(args[i]);
        }
        meta.setLore(lore);
        hand.setItemMeta(meta);
#

let me get a pic of out put

tender shard
young knoll
#

Like I said, String.join(“ “, args) should work

simple anvil
#

yes

young knoll
#

Returns a single string

tender shard
#

yes, as COll said:

simple anvil
tender shard
#

do something like this:

#
String line = String.join(" ", args);
List<String> lore = new ArrayList<>();
lore.add(line);
meta.setLore(lore);
#

String.join(" ", args) turns all the arguments into one string

simple anvil
#

so i dont need a for loop

tender shard
#

correct

simple anvil
#

ok

young knoll
#

You could simplify that with Arrays.asList

#

But yeah that should work

simple anvil
#

im still new to java

tender shard
ivory sleet
simple anvil
#

indeed

#

i really like making plugins

tender shard
#

@simple anvil I have a tip for you. Create a new java project WITHOUT bukkit/spigot etc

#

then try out the basics like turning a String array into a simple string

#

then you don't have to start up a MC server everytime for basic stuff like this

simple anvil
#

i made a discord bot with python but of the code was copy and paste(from my own code) making a new command was to easy

ivory sleet
#

Myes Cyber, crucial thing to learn (from what I can tell) is the difference between List<Something> and Something[]

tender shard
#

yeah if you come from python, then it's really important to understand that an array is totally different from a list

simple anvil
#

public class AddLore implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;
        List<String> lore = new ArrayList<>();
        ItemStack hand = p.getInventory().getItemInMainHand();
        ItemMeta meta = hand.getItemMeta();

        String line = String.join(" ", args);
        lore.add(line);
        meta.setLore(lore);


        return true;
    }
}

does nothing

tender shard
#

a list has convenient methods like .add(), .remove() etc, while an array is PRETTY STUPID. it can't do anything lol

simple anvil
#

so when do i use array

ivory sleet
#

Fast as fuck but ye sucks otherwise

tender shard
#

Your current code has one problem: You forgot to tell your your "hand" item to apply the new item meta

simple anvil
#

oh

#

lol

tender shard
#

you will also have to use

hand.setItemMeta(meta);

at the end

#

otherwise you do change the meta's lore, but you don't apply it to the actual item

#

it works like this:

simple anvil
#

yea, i forgot about that

tender shard
#
ItemMeta meta = someItem.getItemMeta();
// change the meta now
someItem.setItemMeta(meta); // Apply it to the item
simple anvil
#

i forgot to add @EventHandler and spent 30 mins trying to get it to work

tender shard
#

oh yeah that happens to everyone sooner or later

simple anvil
tender shard
#

so tl;dr: use an array unless you actually need a list 😛

#

I know it's a stupid explanation

simple anvil
#

OR if you do not need any of the special methods a list provides
its not and, why not just always use a list even if you dont need the features?

#

the code works @tender shard @young knoll thanks

tender shard
#

arrays are faster. but you don't have to worry about that in 99.999% of cases

simple anvil
#

ok

tender shard
#

you should however understand the difference between the two things anywaya

#

oh wait

#

wrong link

simple anvil
#

also, shoud the command be /addlore /setlore /lore /loreadd

tender shard
simple anvil
#

also

tender shard
#

format that shit @ivory sleet

ivory sleet
#

Just a quick cheat sheet for you

#

Yeah on phone

tender shard
#

I'll copy it

simple anvil
#

when i make a new package, the one highlighted, why does it do stuff.more stuff

tender shard
#
ClassName[] array;

//from are to list
List<ClassName> l1 = Arrays.asList(array); //fixed size

List<ClassName> l2 =new ArrayList<>(Arrays.asList(array));  //resizable (most likely you always want this)


List<ClassName> list;
//form list to arr 
ClassName[] a = list.toArray(new ClassName[0]);
ivory sleet
#

Thanks 🙏

simple anvil
#

when i was making a command open inv and open enderchest

#

i put it in the command package

#

and a made a new packing called openinventory

#

but then i could not add stuff to the command package

tender shard
#

so yeah the basic difference between array and list:

  1. array has a fixed size. if you have an array with a length of 5, it holds 5 elements. you can't just add a 6th element. in most lists, that's no problem, you can just append to them, etc
  2. list has nice methods like "add something between 2nd and 3rd element". arrays don't have that, you'll have to create a new array, copy the old content, etc
  3. arrays are faster though. they are "builtin" to java while lists always have some structures like an array in the background. so tl;dr: a list basically is a "wrapper" for an array that provides so you some convenient methods at the cost of more ram/cpu usage although you don't have to worry about that 99% of the time
simple anvil
#

thanks

#

anyone know how to reload my server once i build the plugin on intelij

tender shard
#

proper way is to restart it

#

lazy way is to enter /reload

#

lazy way MIGHT cause problems though

simple anvil
#

restarting laggs my computer

tender shard
#

spigot was not designed to reload plugins at runtime. while it might work fine, there's always a chance for it to cause memory leaks or other bad things. in the worst case, you get unexpected behaviour. your plugin might bug out and you don't know why. then you spend 3 hours debugging it while it would have worked if you would have just restarted the server

simple anvil
#

i will remember that

tender shard
#

(to test simple plugins, reload is fine most of the time)

ivory sleet
#

@simple anvil can try PlugWoman or BileTools

#

Also as bad as reloads

#

But yeah

simple anvil
#

also is adding lore smp? or smp worthy?

tender shard
tender shard
tender shard
simple anvil
#

like, if i put it on a smp would people get mad

tender shard
#

imagine you have a command /sethome and /home. Both commands obviously have to access some List / HashMap or similar that stores all existing homes. If the sethome method already stores that list in its instance, I'd probably make both commands into one class. (Although you'd normally probably want to have a separate class manage the existing homes).

If however you have one command for /sethome and another one for /heal (so two entirely different commands), I wouldn't put them into one class

simple anvil
#

ok so all in the same class?

tender shard
simple anvil
#

ok good

tender shard
#

and then it'd have different subcommands

#

/lore add
/lore remove
/lore set

#

I'd do all this in one class

simple anvil
#

how do i make sub commands

tender shard
#

you know, if someone enters this:

#

/say my name is jeff

#

then args[0] will be "my"

#

so you can just check what args[0] is

simple anvil
#

OHHH

#

YOUR SO SMART

#

DAMN

lavish hemlock
#

you're*

simple anvil
#

no no no no

#

your is easier

lavish hemlock
#

it's incorrect though

simple anvil
#

i know

lavish hemlock
#

like it isn't even excusable by the laws of Modern English

simple anvil
#

you're you are

#

your your house

lavish hemlock
#

I don't think Alex owns a "so smart"

simple anvil
#

?

ivory sleet
#

You are house fingerguns

tender shard
lavish hemlock
tender shard
#

I think your stupid

#

lol

lavish hemlock
#

I think your mom is a hoe

simple anvil
#

someone hold me back

tender shard
#

you're

#

my english skillz are yet to be surpazzed

simple anvil
#

i think you are mom is a hoe?

tender shard
#

bruh have you ever heard of a joke?

#

I know how it works

ivory sleet
#

Your you’re hmpmg

tender shard
#

yeah your annoying cyber, go ho'me

lavish hemlock
#

p

ivory sleet
#

q

tender shard
#

pq formular?

#

I always used the quadratic expansion because I couldnt remember the pq formular

ivory sleet
#

O

tender shard
#

or is it formula?

ivory sleet
#

And then there’s abc

drowsy helm
#

formula

#

lol

tender shard
#

I know gramma, but not the spelling

lavish hemlock
#

oh ye btw I learned of this conlang where complex sentences can be expressed in single words

tender shard
#

gramma!

#

grandma

simple anvil
ivory sleet
tender shard
#

like saying "thanks" when you actually mean "fuck you, you ugly piece of shit"

ivory sleet
#

Oh

lavish hemlock
tender shard
#

no idea if that's what they meant though

ivory sleet
lavish hemlock
#

That is Ithkuil for "On the contrary, I think it may turn out that this rugged mountain range trails off at some point."

tender shard
lavish hemlock
#

Very neat language

#

Incredibly hard to speak though

#

Apparently nobody speaks it fluently

ivory sleet
#

Mye

tender shard
#

lol

simple anvil
#

thats mini modding/staffing

#

im not gonna get banned

#

ignore me

ivory sleet
#

Well we don’t look down on mini modding that much

tender shard
ivory sleet
#

^

tender shard
#

like you have to want to get banned

lavish hemlock
#

Mini modding is a retarded thing to get banned for

tender shard
#

wtf does mini modding mean?

simple anvil
#

staffing people around like your a staff

ivory sleet
#

Non mod moderates

#

Yeah

tender shard
#

aaah

simple anvil
#

i almost posted the n word here once

tender shard
#

nautilus shell?

simple anvil
#

it was for a n word chat filter

ivory sleet
#

🌝

tender shard
#

we don't talk about nautilus shells here

simple anvil
#

no n||poper||

#

dont click

tender shard
#

rule 1 of the nautilus shell club: do not talk about the nautilus shell club

simple anvil
#

?ban @simple anvil

tender shard
#

?userinfo @simple anvil

undone axleBOT
#

Playing: EclipseMinecraftPlugin – PlayerJoin.java

Joined Discord on

<t:1566948396>
(<t:1566948396:R>)

Joined this server on

<t:1645583120>
(<t:1645583120:R>)

Role

<@&695824786605080576>

lavish hemlock
#

nigeria

tender shard
#

niger

#

also an african country

ivory sleet
#

But yeah cyber, generally it’s fine to approach off topic given that no one here is asking for help or so, if someone does I’d appreciate if they can be prioritized (:

lavish hemlock
#

indeed

tender shard
#

we go off topic here all the time

simple anvil
#

August 27, 2019 7:26 PM
(3 years ago)

i was on discord every day when i first got my account

ivory sleet
#

No worries

tender shard
#

I guess it's fine to go off topic all the time as long as you're not interrupting actual questions

lavish hemlock
#

?userinfo @lavish hemlock

undone axleBOT
#

Custom: I lurk so I may enact righteous judgement against spelling errors

Joined Discord on

<t:1464564509>
(<t:1464564509:R>)

Joined this server on

<t:1646215566>
(<t:1646215566:R>)

Role

<@&695824786605080576>

Previous Names

Maow but spooky, craft, Maow 🐝, Maow, Colin ;, Cοlin, Puro

Previous Nickname

maowcraft

ivory sleet
#

But to clarify for anyone who might wonder

tender shard
#

maow sucks

#

lul

#

it returns the "entity data"

lavish hemlock
tender shard
#

BUT IN THE GOOD WAY

#

shit

#

I wanted to write "NOT"

#

bad stuff

#

what MC version are you on

ivory sleet
#

zak a class that supposedly interfaces the data that gets synchronized with the client iirc

tender shard
#

uugh okay

ivory sleet
#

1.8 bad :<

lavish hemlock
tender shard
#

CraftPlayer, getHandle() etc is all part of the internals

simple anvil
#
 if (if args[0].equalsIgnoreCase("set"))
#

i wonder why it wont work

tender shard
#

If you want to access stuff that is NOT part of the spigot API, you need stuff like CraftPlayer, getHandle() etc

ivory sleet
#

That looks cursed

simple anvil
tender shard
#

it basically works around the SpigotAPI and accesses CraftBukkit and "mojang code" directly

ivory sleet
#

yup

tender shard
#

I don't know what the watch method does

ivory sleet
#

Probably registers a data id with an initial value

lavish hemlock
#

Minecraft works in mysterious ways

ivory sleet
#

But like, I scarcely remember 1.8

tender shard
#

where did you find it?

#

how do you people like my code?

lavish hemlock
#

DaddyMd5

tender shard
#

yeah it provides the fromBaseXX and toBaseXX methods

ivory sleet
#

Looks a bit wiiiide

#

But nice

tender shard
#

it's part of my Stepsister lib

lavish hemlock
#

pagoingus

tender shard
#

I wanted to do create the most cursed library without any bukkit imports

#

but also not let anyone know what classes actually get accessed

lavish hemlock
#

Oh

tender shard
#

so it also uses DaddyMD5's BaseXX

lavish hemlock
#

Oh god

tender shard
#

sometimes I am bored

lavish hemlock
#

Is it fast tho

tender shard
#

you can bet it's not

#

well tbh the baseXX method is pretty simple

simple anvil
#
if (args[0].equalsIgnoreCase("set")){
                Player p = (Player) sender;
                List<String> lore = new ArrayList<>();
                ItemStack hand = p.getInventory().getItemInMainHand();
                ItemMeta meta = hand.getItemMeta();

                String line = String.join(" ", args);
                lore.add(line);
                meta.setLore(lore);
                hand.setItemMeta(meta);
            }
#

its adding set to the lore

simple anvil
#

yes

#

its adding set to the lore

#

how do i remove that

tender shard
#

I don't really understand

#

what exactly is the problem?

#

oooh

#

I understand

#

easiest but dirty solution would be to just remove "set " from the string

#

like, just remove the first 4 characters from your string

simple anvil
#

apend?

tender shard
#

line = line.substring(4);

#

will remove everything before the 4th character

#

the "proper" solution would be to ignore the first array's element or to "shift" your array

#

but tbh that's just making things more complicated

#

I'd just substring(4) the string

simple anvil
tender shard
simple anvil
#

lol thanks

round finch
simple anvil
#

how do i remove all the lore?

tender shard
#

tl;dr: array = fixed size, no convenient methods
list = dynamic, and has lots of convenient methods

tender shard
#

meta.setLore(null)

simple anvil
#

danke

tender shard
#

bitte

#

lol

simple anvil
tender shard
simple anvil
#

bitte????

tender shard
#

yes?

simple anvil
#

what is that

lime jolt
#

guys

tender shard
#

"danke" = "thanks"
"bitte" = "youre welcome"

simple anvil
#

how

lime jolt
#

when you teleport someone why do you go to the side of the block

#

new Location(Bukkit.getWorld("world"), -190, 36, 722, 180, 0);

#

I used that to specify where I want to telport them

#

but they are like on the edge of the block

tender shard
lime jolt
#

z??

#

not y?

tender shard
#

Y is the height

lime jolt
#

oh I thought it was width :/

tender shard
#

X is left/right, Y is up/down, Z is forward/backward

simple anvil
#

when i do
/give
it will show me my options for players
how do i do that with commands

quaint mantle
#

TabExecutor

tender shard
#

you mean stuff like @s etc?

#

because normally the player names always get tab completed

#

even without a custom tabcompletion, it should show the name of online players

simple anvil
quaint mantle
#

are you trying to make a custom tab complete

simple anvil
#

yes

young knoll
quaint mantle
#

implement TabExecutor

simple anvil
#

in the same class?

tender shard
#

doesn't matter

quaint mantle
#

in your command class or main class if u wanna use it

simple anvil
#

how?


public class AddLore implements CommandExecutor
tender shard
#

you have a command executor class and you registered using setExecutor(). you can do the same thing with a class that implements TabCompleter or sth like that

young knoll
#

There’s also TabExecutor

#

Which is just both

simple anvil
#

?

quaint mantle
#

yes

young knoll
#

Mhm

simple anvil
#

how do i even use that

quaint mantle
#

let it

#

just implement TabExecutor and look at ur warnings

tender shard
#

basically you just need to override onTabComplete, like you did with onCommand. Here's an overcomplicated, incomplete, dirty example:

 @Override
    public @Nullable List<String> onTabComplete(@NotNull final CommandSender commandSender, @NotNull final Command command, @NotNull final String s, @NotNull final String[] args) {
        final List<String> list = new ArrayList<>();
        UUID uuid = commandSender instanceof Player ? ((Player) commandSender).getUniqueId() : Main.consoleSenderUUID;
        if (args.length == 1) {
            for (int i = 1; i <= getChests(uuid); i++) {
                if (String.valueOf(i).startsWith(args[0])) {
                    list.add(String.valueOf(i));
                }
            }
            if (commandSender.hasPermission(Permissions.OTHERS)) {
                for (final Player player : Bukkit.getOnlinePlayers()) {
                    if (player.getName().startsWith(args[0])) {
                        list.add(player.getName());
                    }
                }
            }
        }
    // ...
    return list;
simple anvil
#
@Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        
        return null;
    }
```now what
tender shard
quaint mantle
simple anvil
#

ok

#

danke

quaint mantle
#

no problem

tender shard
#

e.g. if you a return a list "a" "b" "c" it will suggest "a" "b" and "c" as tab completion

#

and stop saying "danke" if you don't understand "bitte"

simple anvil
#

thanks
dankes
danke

quaint mantle
#

english is like the better version

simple anvil
#

bitte explane this

quaint mantle
#

bitties are good

tender shard
simple anvil
#

no

#

u did not

#

di du

tender shard
#

your german is worse than my parent's bulgarian maid's german

#

and she doesn't speak a single word of german

pliant oyster
#

I'm getting a lot of internal errors while performing commands but I literally cannot find the issue, and I copied some of the code from my other plugin and in that plugin it works, can someone help me in vc

young knoll
#

That’s

young knoll
#

Oddly specific

pliant oyster
#

but there's a lot of them

quaint mantle
#

so

tender shard
#

then show the first one

quaint mantle
#

one could fix all the issues

tender shard
#

I really don't understand why people just don't send the error message immediately

simple anvil
#

lol

#

ikr

pliant oyster
#

[00:45:20] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'balance' in plugin MrIndiaCore v1.0

#

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if(sender instanceof Player){

            if(args.length == 0){

                Player player = (Player) sender;

                int money = MrIndia.getInstance().getEconomyConfig().getInt(player.getUniqueId().toString());
                sender.sendMessage(ChatColor.AQUA + "Your balance is " + ChatColor.YELLOW + "$" + money);
                return true;

            } else {

                String playerName = String.valueOf(args[0]);
                Player target = Bukkit.getPlayer(playerName);

                if(Bukkit.getPlayerExact(playerName) == null){
                    sender.sendMessage(ChatColor.RED + "Player is not online.");
                    return true;
                } else if(!target.isOnline()){
                    sender.sendMessage(ChatColor.RED + "Player is not online.");
                    return true;
                } else {
                    int money = MrIndia.getInstance().getEconomyConfig().getInt(target.getUniqueId().toString());
                    sender.sendMessage(ChatColor.YELLOW + target.getName() + "'s " + ChatColor.AQUA + "balance is " + ChatColor.YELLOW + "$" + money);
                    return true;
                }

            }

        } else {
            sender.sendMessage("Console does not have a balance!");
        }

        return true;
    }
}```
pliant oyster
#

need to make it a txt

tender shard
#

?paste

undone axleBOT
tender shard
#

paste it there

pliant oyster
#

alr

tender shard
#

what's BalanceCommand line 22?

pliant oyster
#

lemmie check

tender shard
#

getEconomyConfig() returns null

pliant oyster
#

int money = MrIndia.getInstance().getEconomyConfig().getInt(player.getUniqueId().toString());

#

it's a file config

quaint mantle
#

is the players UUID set to an int?

tender shard
#

getEconomyConfig() returns null

quaint mantle
#

didnt read

pliant oyster
#

lemmie check

tender shard
#

show getEconomyConfig()

pliant oyster
#

        return economyConfig;

    }```
tender shard
#

the field "economyConfig " is null

pliant oyster
#

ffs

#

I messed up something

#

nvm

tender shard
#

do you ever, anywhere, assign a value to "economyConfig"?

pliant oyster
#

economyConfig = YamlConfiguration.loadConfiguration(economy);

tender shard
#

where do you do that?

pliant oyster
#

wiat

#

wrong thing

tender shard
#

that's just the declaration

pliant oyster
#

        if (!getDataFolder().exists()) {

            getDataFolder().mkdirs();

        }

        File economy = new File(getDataFolder(), "economy.yml");
        economyConfig = YamlConfiguration.loadConfiguration(economy);
        try {
            economyConfig.save(economy);
        } catch (IOException ioException) {
            ioException.printStackTrace();
        }

    }```
#

ye I sent wrong line

tender shard
#

if so, when/where?

#

btw "economyConfig()" is a pretty bad name

#

it should be called "loadEconomyConfig()"

pliant oyster
#

oh wiat

#

yeah it's not called

lime jolt
#

anyone know how I can make a sound, so that the entire server can hear it

tender shard
pliant oyster
#

I see the issue

#

I have to put economyConfig(); at on enable

tender shard
pliant oyster
#

ty

tender shard
lime jolt
tender shard
#

?learnjava

lime jolt
#

;-;

undone axleBOT
tender shard
#

it's a basic for each loop

lime jolt
#

i know how to make a loop

#

how do I get all players

pliant oyster
#

I gotchu

tender shard
lime jolt
#

like a single one

#

out of all

#

can i do

#

Bukkit.getOnlinePlayers().get(0)

#

i know basics I just dont know minecraft ;-;

pliant oyster
#

Bukkit.getOnlinePlayers.contains(ur player);

hasty prawn
#

and you were judging method names...

lime jolt
#

so if that is the case

#

I could also do

pliant oyster
hasty prawn
#

someMethodThatReturnsAnArrayOfStrings LMAO

pliant oyster
#

KLMAO

hasty prawn
#

I know it's an example, still hilarious

#

Good point

lime jolt
#
String[] someStrings = someMethodThatReturnsAnArrayOfStrings();
for(int i = 0; i < someStrings.length; i++) {
  System.out.print(someStrings[i]+ " ");
}
#

yeyeye

simple anvil
hasty prawn
#

You can use a switch for args[0]

simple anvil
#

ok

hasty prawn
#

Yeah if you had more cases then you'd want to use a switch, only 2 though, doesn't really matter tbh

simple anvil
#

ok

lime jolt
#

u lied to me

#

Type mismatch: cannot convert from Collection<capture#1-of ? extends Player> to Player[]

#

;-;

hasty prawn
#

He didn't lie to you NotLikeThis

lime jolt
#

HE DID

#

gun point

#

emogi

simple anvil
#

my names jeff

lime jolt
#

u cant turn Bukkit.getOnlinePlayers();

#

into area

#

array

young knoll
#

Area