#help-development

1 messages · Page 1968 of 1

quaint mantle
#

oh so i have to put the [arraylist = new arraylist<>();] in the menu constructor

#

?

lost matrix
#

Just from my head.
Ez serializer:

public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
  
  @Override
  public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    Map<String, Object> data = context.deserialize(jsonObject.get("item"), new TypeToken<Map<String, Object>>(){}.getType());
    return ItemStack.deserialize(data);
  }

  @Override
  public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObject = new JsonObject();
    jsonObject.add("item", context.serialize(src.serialize()));
    return jsonObject;
  }

}

Then you can just use it:

    Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(ItemStack.class, new ItemStackSerializer()).create();
    List<ItemStack> itemListOne = ...;
    List<ItemStack> itemListTwo = ...;
    List<ItemStack> itemListThree = ...;
    
    // Serialize them
    String listOneJson = gson.toJson(itemListOne);
    String listTwoJson = gson.toJson(itemListTwo);
    String listThreeJson = gson.toJson(itemListThree);
    
    // Deserialize them
    Type listType = new TypeToken<List<ItemStack>>(){}.getType();
    List<ItemStack> desItemsOne = gson.fromJson(listOneJson, listType);
    List<ItemStack> desItemsTwo = gson.fromJson(listTwoJson, listType);
    List<ItemStack> desItemsThree = gson.fromJson(listThreeJson, listType);

Literally as easy as it gets

patent horizon
#

else if (gControl.getConfigs().contains(name)) player.sendMessage(u.f("&3&lGUILDS &8» &7A guild with this name already exists.")); is there any way to do this similar to .equalsIgnoreCase() ?

patent horizon
#

like i wanna see if a list contains a string, but not case sensitive

lost matrix
patent horizon
#

yeah

#

like it doesn't really matter since it wouldn't cause any problems in the file structure, but i just dont want multiple guilds with the same name

#

for impersonation reasons

lost matrix
#

What you want to do is maintain a Set<String> and modify the String with toLowerCase when adding/checking for contains

#

this way Sign and sIgN would both be hashed using sign

patent horizon
#

so just a for loop through the getConfigs()

#

or is there a way to do it with streams

brave sparrow
quaint bough
#

How would I got about getting those 4 locations ?

#

The player is technically standing on all 4

lost matrix
patent horizon
#

im not using configs

#

i guess it's poorly named

brave sparrow
patent horizon
#

it's grabbing keys from a map that contains instance of configs that were pulled at startup

rough drift
#

then i should rework my plugin

brave sparrow
#

@patent horizon having the same name aside from capitalization will cause file system issues on different operating systems

lost matrix
quaint bough
brave sparrow
#

Location#add

#

Location#subtract

patent horizon
#

else if (gControl.getConfigs().forEach(s -> s.toLowerCase().equals(name.toLowerCase()))) how come this doesnt work

brave sparrow
#

Why don’t you just use s.equalsIgnoreCase(name)?

patent horizon
#

good point

lost matrix
#

You can actually get the 4 lower corners of the players bounding box.
This way you can actually calculate all blocks the player is intersecting with.

tardy delta
#

also String#equalsIgnoreCase is something

brave sparrow
patent horizon
#

hm

#

what's like forEach but returns a bool

tardy delta
#

?

#

Stream#filter?

brave sparrow
patent horizon
#

fancy

brave sparrow
lost matrix
#

The players bounding box is not axis aligned. So adding and subtracting in fixed directions will often lead to
unexpected results if he wants to get all blocks the player is standing in.

tardy delta
#

ah ye

#

filter on that and get the result lol

brave sparrow
quiet ice
#

@lost matrix Since you wanted the answer about the question I asked a few days ago, the official openjdk irc did not answer (It appears pretty dead, not sure why it is linked to in the openjdk page), however the java channel over at libera answered that + and | are both usually 1 cycle long but apparently the bitwise OR takes a bit longer to set up due to having to set up registers.

18:23:05 < dmlloyd> but in just about every CPU on earth, A|B takes the same number of cycles as A+B
18:23:24 < dmlloyd> unless you have a 1-bit ALU like the old RCA 1802 from the 1970s..
18:23:33 < dreamreal> dmlloyd: at the machine level, | is "faster" but the cost is in preparing to apply the operation
dmlloyd> sure, in theory, but in practice the cycle count is generally going to be the same
18:24:13 < dreamreal> add is a "slower operation" than "or" in actual implementation - probably a few dozen nanoseconds!
18:24:30 < dreamreal> but the problem is you have to load the registers and THAT takes most of the time
18:25:35 < dmlloyd> on silicon, OR is basically a SIMD operation: every bit can be processed separately, whereas + requires every bit to feed into the next-most-significant bit's add result (due to carry) - but in practice again CPU
makers generally just make a cycle long enough to allow for the cascade effect to propagate all the way for a single word add
18:26:00 < dmlloyd> otherwise things like multiply would take thousands and thousands of cycles
18:27:33 < dmlloyd> relatedly, any attempt by CPU makers to make OR, AND, or XOR be "faster" than +/- would likely only ever be perceived as making +/- be slower :)

lost matrix
quiet ice
#

Yeah, probably just the operation itself

lost matrix
#

So its basically this because adding does require to transfer the carry bits to the next adder.
But both ops happen in sub cycle time which leads to effectively no difference.

zealous osprey
#

Could someone help me for a sec concerning gradel dependencies.
Heads up, no idea how gradle works, just need the dependency part quickly for 1.12.2 spigot, the rest I can manage <3 thx

quiet ice
#

gradle trash, maven better

lost matrix
zealous osprey
#

One sec

#

Sorry, I managed it

#

Thx for the quick response though

lost matrix
chilly haven
#

Hey, i am rather new to coding, but i wanted to make custom enchants and a way to apply the enchant via a book.
public void onClick(InventoryClickEvent e){
if (e.getAction() == InventoryAction.SWAP_WITH_CURSOR){
ItemStack weapon = e.getCurrentItem();
ItemStack enchantbook = e.getCursor();
if (weapon.getType().equals(Material.DIAMOND_PICKAXE)){
if (enchantbook.getType().equals(Material.BOOK)){
if (enchantbook.getItemMeta().getLore().contains("Miner I")){
e.getWhoClicked().sendMessage(ChatColor.GRAY + "Hello");
e.getInventory().remove(e.getCursor());
ArrayList<String> minerenchant_lore = new ArrayList<>();
minerenchant_lore.add(ChatColor.GRAY + "Miner I");
ItemMeta minerenchant_meta = weapon.getItemMeta();
minerenchant_meta.setLore(minerenchant_lore);
weapon.setItemMeta(minerenchant_meta);
}
}
}
}
}
But this doesnt work, Why doesnt this work?

lost matrix
#

*Insert hadouken

lost matrix
#

Basically throw in some debug messages and see where it messes up

chilly haven
#

getServer().getPluginManager().registerEvents(new BookSystem(),this);

#

last one no

#

i dont know how to do that

lapis widget
#

add @EventHandler
on top of your void -_-

lost matrix
chilly haven
#

already have @lapis widget

#

oh srry

#

for tag

deft forum
#

Anyone know how to get an anvil's first item and the second item in itemStack?

#

in InventoryClickEvent

tardy delta
tardy delta
#

early returns 😌

lost matrix
ancient jackal
tardy delta
#
if (!obj.something) return;
if (!obj.somethingElse) return;
obj.doTheActualCalculation();```
young knoll
#

if then else end

#

The best if syntax

tardy delta
#

lmao

grim ice
#

it might be something else though, I'm not sure

tender shard
#

as fourteen said

grim ice
#

guys say "C++"

tender shard
#
if(!firstCondition) return;
if(!secondCondition) return;
doStuff();
tender shard
grim ice
#

say "c++" tho

tender shard
grim ice
#

say it alone

tender shard
#

I said it about 20 times now. you probably didn't hear it because we're a few miles distanced from each other

grim ice
#

haha

#

send it as a message in this discord channel

young knoll
#

See pp

tardy delta
#

damn

#

just earned two stars

tardy delta
deft forum
#

can someone come general-1?

tardy delta
#

yes

grim ice
#

BRO

tardy delta
#

not me tho

tender shard
#

wtf is that

grim ice
#

just say "c++" already

#

yall need to ruin my unfunny jokes

#

all the time

tender shard
#

c++

grim ice
#

😢

ancient jackal
#

c++

grim ice
#

Cannot resolve symbol 'C'
';' expected

#

finally

tardy delta
#

i dont understand

grim ice
#

:DDDDDD

#

i++;

tender shard
#

int C;
C++

grim ice
#

';' expected

#

haha

tender shard
#

;

tardy delta
#

colon

#

or how is it called

tender shard
#

semicolon

#

colon = :

#

semicolon = ;

young knoll
#

Colon lite

tardy delta
#

zh

#

dont get it

grim ice
#

semicolon should be .

#

smh

tender shard
sacred mountain
#

anyone know the best/a good config api/lib

#

im trying to clean up my project

grim ice
#

its unfunny i started cringing on my own joke but yeah

tender shard
sacred mountain
#

right ko

grim ice
#

your project can be clean just by using the built in one

tender shard
#

I never get why people need any more than builtin MemorySection/FileConfiguration

sacred mountain
#

im just looking to see if there are nicer ones

grim ice
#

how could it get any nicer

tender shard
#

yeah the builtin is totally fine

sacred mountain
#

alr thanks

tender shard
#

builtin stuff already is a nice wrapper for SnakeYaml

sacred mountain
#

ill stick with that then. one of my projects uses a weird one

vale ember
#

how can i delete thread on spigot forum?

grim ice
#

report it

tender shard
grim ice
#

and why even delete

tender shard
#

(let's all stalk what they want to remove)

tardy delta
grim ice
tardy delta
#

oh

grim ice
#

thats the point of an unfunny joke

tender shard
tardy delta
#

oh

grim ice
#

yes its mine

tardy delta
#

this is weird

tender shard
#

you know

grim ice
#

its the same as

tender shard
#

if something is not genius as hell

#

you can be sure it wasn't mfnalex who wrote it

grim ice
#

java developers cant do C well

#

they dont have glasses

tender shard
#

I once made a device that allowed you to send messages, read wikipedia articles and news

grim ice
#

I did

tender shard
#

in just 16kb of C

#

or IDK if it was 16kb

#

it was running on an ESP8266

grim ice
#

lmao

tender shard
#

32kb

quiet ice
tender shard
#

but it didn't fit so I had to redo it in C

deft forum
#

Anyone know how to get an anvil's first item and the second item in itemStack?
in InventoryClickEvent

tender shard
#

inventories like anvil most of the time do NOT start with 0 index

#

but anvil should be slot 0 and 1 tbh

sacred mountain
#

can you force a player to do stuff like placing blocks, walking, etc

tender shard
young knoll
#

No

deft forum
deft forum
tender shard
young knoll
#

There’s breakBlock though

tender shard
sacred mountain
sacred mountain
#

player.placeSphere

#

:)

tender shard
sacred mountain
sacred mountain
tender shard
#

just saying it's bad without any reason is not very useful

opal juniper
#

kek

#

lol

wary harness
#

So guys I was just on origin realms and was looking how there back pack plugins works
what I noticed you can see backpack only when u are in third person view
and you don't see it in first person
how do they detect if player is in first person or third person view ?

tender shard
#

an LCD1608 can't display umlauts

opal juniper
#

in python you can chain them

sacred mountain
#

lol

opal juniper
#

.replace().replace().replace()...

tender shard
#

also I don't think it's bad just because of this

opal juniper
#

no for sure

#

just looks a bit nooby

tender shard
#

doing it this way everything's aligned nicely at least

opal juniper
#

like, for example assigning this URL constant that u used a total of one time lol

tender shard
#

I don't think it's nice to inline those kind of values

young knoll
sacred mountain
#

imagine someone made a 'plugin to mod' converter

tender shard
#

but yeah of course the code isn't good

sacred mountain
#

that would be pretty cool

opal juniper
#

im just joking around

#

its just quite funny

tender shard
#

let me see if I find a video of the "device" I coded lol

young knoll
#

Good code is overrated

tender shard
young knoll
tender shard
#

and can be used to read wikipedia articles, news and other things

deft forum
#

mfnalex do you m ow why its not working correctly?
i mean i put the first item in put its still show the same message as if i didn't set the first item
but if i click on any other item it updates and it says to put in the second item

sacred mountain
#

my plugin is literally 100% customizable now

grim ice
#

ic

sacred mountain
#

you can literally change everything

#

hah

grim ice
#

show me output of it

opal juniper
grim ice
wary harness
young knoll
#

Ah

grim ice
#

u cant customize performance so ur statement is invalid

young knoll
#

¯_(ツ)_/¯

#

Ask origin realms

grim ice
#

i like how when u use var in intellij

#

it uses kotlin syntax

tender shard
grim ice
grim ice
#

BRUH

hexed hatch
tardy delta
hexed hatch
#

It has an editor that makes it easy to modify the model in different perspectives

sacred mountain
tender shard
grim ice
#

mfn is that real

#

dd u fr make that

sacred mountain
#

why

#

huh

#

no way

tender shard
#

I literally sent the code for it

#

lol

grim ice
#

what the fuck

sacred mountain
#

pro

#

whats the point tho

#

would make a cool alarm clock

grim ice
#

You can turn code into an actual device

tender shard
#

it was gift to my best friend

grim ice
#

how did you do that

tender shard
#

but it can only play 3 songs

sacred mountain
#

oh damn

#

nice

tender shard
#

then the RAM was full

#

as said it only has 32kb

sacred mountain
#

lool

tender shard
#

the "main thing" is an ESP8266

#

it's like a 5$ computer

sacred mountain
#

how much did it cost in total

tender shard
#

with basic GPIO + wifi

sacred mountain
#

how tf did you respond that fast

tender shard
sacred mountain
#

o

#

not bad

tender shard
#

most espensive thing was the LCD

grim ice
#

how did u make it run code

sacred mountain
tender shard
#

you can flash it via USB and "upload" compiled C code

#

IIRC it can store 32kb of "data" (static variables etc) and 32kb of code

grim ice
#

what the fuck

#

this is fucking cool

sacred mountain
#

agree

tender shard
#

lol I still have it laying around in my car

#

I never gave it to her

grim ice
#

u can actually build real life achines wtfff

#

LMAO WHAT

sacred mountain
#

rip

grim ice
#

why

sacred mountain
#

u should

tender shard
#

she comes around in an hour anyway to celebrate my birthday lol

#

I can just give it to her today

grim ice
#

is there something like that possible to do in java

sacred mountain
#

my friend made 6 raspberry pis and somehow linked them and hosted a mc server on it

tender shard
#

the only downside is

tender shard
#

the wifi credentials are hardcoded

#

and she moved to a new place before I could give it to her

#

that's why I never gave it to her - it wouldn't have internet at her "new" place

#

it's 1.5 years old now

grim ice
#

damn

#

recode it

#

fast

#

IN THIS HOUR DO IT NOW

sacred mountain
tender shard
#

what's that, pi 3?

sacred mountain
#

why the fuck is that image 24 megabytes

tender shard
#

pi 3 is like heaven compared to an esp8266

#

but a pi takes like a minute to startup

sacred mountain
tender shard
#

because it runs a full linux

grim ice
#

MFN

sacred mountain
#

my first coding experience prob

grim ice
#

can u run java code on a raspberry pi

tardy delta
#

i got a pi 4

tender shard
tardy delta
#

ye

sacred mountain
#

ye

tender shard
#

a pi is a full featured ARM computer

grim ice
#

WOAH

#

can it show text

tender shard
#

a pi has HDMI builtin

grim ice
#

YO

tender shard
#

you can basically use it as a slow full featuerd computer

grim ice
#

ive never seen smth like thati n my country

#

THATS SO COOL ISTG

tender shard
#

yeah but

#

watch out with GPIO

grim ice
#

I THOUGHT U NEED TO HAVE LIKE

tender shard
#

you can fry it if you connect something wrong on the GPIO pins

grim ice
#

A LOT of experience to do it

tender shard
#

a pi is basically just a fully working computer

sacred mountain
#

yea no

#

i set one up when i was 11

tender shard
#

on the ESP8266, theres no operating system

#

ESP8266 is basically bare metal

#

well not really

#

but pi is like the luxury version of an ESP8266

grim ice
#

can u access databases from it

#

or is it too weak

tender shard
#

it can run a fully featured debian with GUI

sacred mountain
tender shard
#

(was talking about pi now, not esp)

sacred mountain
#

i dont have nitro

grim ice
#

this is so cool i wish i can get smth like it in my country

sacred mountain
#

so im sending an image

grim ice
#

sad

grim ice
#

haha we dont use credit cards

tender shard
grim ice
#

i love my country

#

!!!

sacred mountain
#

lool

tender shard
#

pi pico is just 4$

grim ice
#

istg im moving once im able to

#

not about i can buy it or not

#

i cant pay

#

lmao

#

no credit or debit card

#

only cash here

tender shard
#

oh wait

#

I told you guys bullshit

#

the device I sent was made with a pi zero

#

so it was actually running the python code on a debian

#

but I made another device using just an ESP8266 a year prior

grim ice
#

can i make it explode

tender shard
#

let me look for that video lol

grim ice
#

can i make the thing explode

tender shard
grim ice
#

nah i want it to explode

tender shard
#

hm

grim ice
#

programmatically

tender shard
#

you'll need some capacitors to make it explode

sacred mountain
#

i have an enum right, how would i give the user access to change those string via the config>

grim ice
#

can i make it move smth

sacred mountain
tender shard
#

at least not the ones you have in your constructors

sacred mountain
#

right ok

#

sad

grim ice
#

why do u have a constructor

#

.name() exists

sacred mountain
#

wut

#

oh

grim ice
sacred mountain
#

oh right

#

i see

grim ice
#

and btw dont name them like that

#

it should be

#

GIVE

sacred mountain
#

mk

grim ice
#

and RELOAD extra

tender shard
grim ice
#

so for example, YOUR_MOTHER

sacred mountain
quaint mantle
#

SUSSY_BAKA

sacred mountain
#

i presume

#

pretty cool

sacred mountain
grim ice
sacred mountain
#

get it*

grim ice
#

anyways is that possible to do with java

#

i assume u did it with c or c++

quaint mantle
#

ummm is this only supported in 1.18?

sacred mountain
vital yacht
#

Wdym “ig” lol

tender shard
#

BaseComponent or NotNull?

grim ice
#

so its enum abuse, we know

#

@NotNull u gotta include jetbrains shit to ur classpath

quaint mantle
tender shard
sacred mountain
tender shard
ivory sleet
quaint mantle
#

spigot api?

vital yacht
ivory sleet
#

thats just the default implementation

lost matrix
ivory sleet
#

but in most cases it'll be overridden

quaint mantle
#

ok

#

but

ivory sleet
#

@ timar

grim ice
#

MFN can u use arduino with java

tender shard
sacred mountain
#

why are all the cool ppl german

ivory sleet
#

im swedish, tho guess not so cool but ye

grim ice
#

pi?

quaint mantle
tender shard
#

at least that's what it did when I last time used it

#

that's why I always say "get a pi zero instead"

quaint mantle
ivory sleet
#

thats an enum

quaint mantle
#

yeah

ivory sleet
#

?jd-s

undone axleBOT
tender shard
ivory sleet
#

check the docs

#

index the enum class

quaint mantle
#

no results

#

why does it take an enum, but not exist

tender shard
#

then you used gnoogle wrongly

patent horizon
#
        if (filter.filteredWords.stream().anyMatch(message::contains)) {
            event.setCancelled(true);
            player.sendMessage(u.f("&3&lPLEXPVP &8» &7Your message contained blacklisted word: ."));
        }``` is there any way i can get the element in the stream that caused the condition to return true?
blazing scarab
sacred mountain
quaint mantle
ivory sleet
#

oh it was bungeecord chat

#

nvm

chrome beacon
#

Arduino runs C++ with extra methods, right?

tender shard
blazing scarab
#

C# iirc

ivory sleet
#

?jd-bcc would be the correct one then

chrome beacon
lost matrix
# tender shard arduino only runs C code

But with an arduino you really learn the basics quite well. Wanna make a light blink at a specific frequency without sleeping and blocking other stuff? Better start counting those cycles.

quaint mantle
grim ice
#

@tender shard can u use pi

grim ice
#

with java

ivory sleet
tender shard
patent horizon
#

i thought filter didnt return true/false though

grim ice
#

o

#

pogger

ivory sleet
#

filter takes a predicate and returns a new stream of same type

tender shard
#

filter removes all objects that don't "return" true

grim ice
#

imagine living in a decent country

sacred mountain
quaint mantle
tender shard
#

raspbian even has minecraft preinstaled

quaint mantle
#

it does not know what net even is

olive lance
#

How can you only check regions that intersect a certain chunk without checking every region?

grim ice
#

if u have like 1gb ram

tender shard
#

you probably used craftbukkit

quaint mantle
#

no

sacred mountain
tender shard
#

use spigot instead

ivory sleet
#

ill let alex assist you further

quaint mantle
#

I have spigot

chrome beacon
#

Hm no from what I can find online Arduino code is written in C++

grim ice
#

btw how is data transferred through a local network, without wifi

#

like offline mode in servers

tender shard
#

or intellij build artifacts?

quaint mantle
#

intellij build artifacts @tender shard

tardy delta
tender shard
tardy delta
#

i tried optifine and optifine crashed

tender shard
#

pi 4 should handle java edition fine

chrome beacon
#

Optifine is annoying to work with

lost matrix
tardy delta
#

tried with launcher and launcher said no

tender shard
#

it probably said a bit more than just "no" 😛

tardy delta
#

some error

#

too long ago

tender shard
#

?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.

tender shard
#

😛

tardy delta
#

lmao

#

lets ?paste the stacktrace

lost matrix
tender shard
quaint mantle
patent horizon
tender shard
#

I just thought "if it runs java, it'll also run MC"

#

I thought raspbian includes proper graphics drivers

ivory sleet
#

Well you wanted to obtain a result wallytube?

patent horizon
#

yeah

tender shard
tardy delta
#

its too bad to actually handle it smootly

ivory sleet
#

collect allows you to transform the stream into a list or set or sth

lost matrix
ivory sleet
#

For instance

tardy delta
#

its because of the graphic card i think

ivory sleet
#

stream.collect(Collectors.toList());

tardy delta
#

not even set ._.

quaint mantle
#

just does not see it exists

grim ice
#

like 1.1

#

or smth

ivory sleet
#

whilst reduce simply reduces the stream by a binary operator

#

Where the reduced result of one binary operation will be passed as an argument to the next binary operation

chrome beacon
patent horizon
tender shard
ivory sleet
#

Yeah Ig

chrome beacon
#

You sure

quaint mantle
#

maybe both?

tender shard
#

yes

#

I'm 100% sure

quaint mantle
#

yeah

wary harness
#

any one can explain how is that acomplished on first 2 images
model can't be seen in first person in my case you can see model when u look at floor

quaint mantle
#

spigot-api has chat color

tender shard
#

my updatechecker lib

#

uses spigot-api

#

and sends clickable messages

#

i.e. ChatComponents

quaint mantle
#

weird

chrome beacon
#

With Maven?

tender shard
#

yeah ofc I use maven

#

oh wait

#

did you add spigot-api.jar

chrome beacon
#

Mhm

tender shard
#

or spigot-api-shaded

chrome beacon
#

Yes

tender shard
#

you must use the shaded .jar

quaint mantle
#

oh well that fixed

lost matrix
tender shard
#

(or just switch to maven and do not experience any problems like that anymore)

quaint mantle
#

what's shaded even

tender shard
#

it includes the libraries that spigot uses

tender shard
#

shaded = include its own dependencies

quaint mantle
#

ah I see

quaint mantle
#

and maven does that for you

#

ok ty

tender shard
#

maven does so much for you

quaint mantle
#

lel

#

I know

tender shard
#

you will never want to miss it again after using it

quaint mantle
#

I have used it

tender shard
#

the only problem is

quaint mantle
#

I don't wanna switch to it idk how

tender shard
#

converting a non-maven project to maven can be a bit annoying

quaint mantle
#

yeah that's what I mean

#

I tried

#

and I failed

tender shard
#

most easiest solution is to create a new maven project

#

then copy/paste over your old code

quaint mantle
#

and import code

#

yeah

#

I guess

tender shard
#

that's tbh the easiest solution

#

ofc you can do it otherwise as well

olive lance
#

I’ve never used maven so I don’t know much about it is it a command line only tool

tender shard
#

but then you must already know how maven works

olive lance
#

I’ll check it out

tender shard
#

but it doesnt explain on how to add maven to an already existent non-maven project

quaint mantle
#

I do know how it works tho, I just followed tutorial on spigot without maven

#

and I'm doing fine for now

#

I think

tender shard
#

and you want other people to contribute

#

they will all be upset if you don't use maven or gradle

lost matrix
#

Hard to explain. Let me draw an example.
@patent horizon

tender shard
#

because you basically hardcoded C:\Users\timar\spigot\spigot-api.jar etc

#

and also all other dependencies you use

quaint mantle
#

lelel who tf gonna care about my shitty code

#

xD

#

but ok

tender shard
#

I thought so too

#

now chestsort has 100k downloads lol

quaint mantle
#

I'll consider switching mayb

tardy delta
#

we eat shitty code here

quaint mantle
#

I actually made a maze generator so it might be a good idea

young knoll
#

Shitty code is a requirement on spigot

#

:p

quaint mantle
#

Is spigot not considered shitty?

tender shard
#

maven does this stuff plus more:

  1. dependency management
  2. handle building process
  3. shading your dependencies if you need that
  4. deploying your stuff
  5. generating javadocs
  6. and much more
quaint mantle
#

javadocs ftw I never used those

olive lance
#

IntelliJ does that except number 6

tender shard
olive lance
#

Maven is probably better at all the stuff though

#

So if I didn’t use maven and someone wanted to conftribute they would have to add the spigot api dependency themselves but with maven they wouldn’t?

young knoll
#

Correct

blazing scarab
#

gradle tho

tardy delta
#

was it possible to literately use yield return something?

ancient jackal
#

Intellij just kind of puts it there

tender shard
#

then it'll create HTML files out of your /** comments */

midnight shore
#

"Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default-cli) on project WilloAC: Failed to create shaded artifact, project main artifact does not exist." whats this?

lost matrix
grim ice
#

is concurrency advanced

patent horizon
#

interesting

#

what are the upsides to that

tardy delta
#

but its extremely useful

grim ice
#

It's not that atm tbh

#

well it might be

#

cuz im really early into it

#

im here

lost matrix
# patent horizon what are the upsides to that

Hugely better performance than checking contains on each word.
For 500 blacklisted words this could take easily a second (scales O(n)) for bigger sentences while this approach will scale O(log(n)) and might take just a few milliseconds.

lost matrix
quiet ice
#

Making concurrent stuff in java is quite easy as long as you do not develop your own data structures

tardy delta
#

concurrency is a bitch

quiet ice
#

However at some point you want to combine the benefits of concurrency and performance. Want to make a simple long -> Object map that is concurrent and does not have a boxing overhead? Well, time to die (but hey, I was able to achieve that after some time).

#

However it probably gets easier with experience as you develop a backlog catalogue you can use at all times

lost matrix
#

One of my favourites is still the SynchronousQueue<E>
Its a queue that has no capacity and no elements. But you can call get on it and the thread will wait until
another thread called add on it. Quite elegant way to transfer data between threads or wait on another thread.

quiet ice
#

huh,TIL

sacred mountain
#

for my plugin .yml can i put permissions that have children into the children of another permission

eternal oxide
#

yes

quaint mantle
#

public static void getLoadedArray() {
for (Menu menu : menus) {
MenuStorageUtil.createMenu(menu.name, menu.size);
}
} this method causes an error ive never seen before that i am about to show

tardy delta
#

getLoadedArray but it returns nothing?

lost matrix
#

PES_AngeryDiamondSword 1.8

tardy delta
#

oh god

quaint mantle
waxen plinth
#

I love those

lost matrix
quaint mantle
waxen plinth
#

I have an implementation of one that you could steal

lost matrix
quaint mantle
quaint mantle
#

public static ArrayList<Menu> menus = new ArrayList<>();

waxen plinth
#

It's really pretty basic but it gets the job done

tardy delta
#

cant cast linkedhashmap

waxen plinth
#

There is no remove function lol

quaint mantle
#

or a map in general

waxen plinth
#

You should

tardy delta
#

json internally does i guess

waxen plinth
#

They're great

tardy delta
#

idk whats happening

fierce salmon
#

lmk if you need my code

lost matrix
#

Reminds me of that one meme about coding interviews. "If you dont know how to proceed, throw a hashmap at the problem"

tardy delta
#

plugin disabled it says

waxen plinth
#

^

fierce salmon
#

its not though thats the strange part

tardy delta
#

lets throw a hashmap at my dynamix command parsing problem

#

thats the spiwit

waxen plinth
#

Command parsing?

quaint mantle
#

learn malbolge very beginner friendly

lost matrix
waxen plinth
#

If you need command parsing I have a good solution

fierce salmon
tardy delta
#

some enum that returns what the command should do instead of having a long switch with the possibilities and the length checking of the arguments

#

something stupid actually

waxen plinth
#

Can you show me what you're trying to accomplish

tardy delta
#

just passing in the args from the command and i get what the user wants to do

waxen plinth
#

Oh geez

tardy delta
#

weird stuff

#

just trying something

waxen plinth
#

Why are you doing it that way

lost matrix
waxen plinth
#

Wat

#

Switches are O(1)

tardy delta
#

to prevent me from doing something like this

#

looks ugly

fierce salmon
waxen plinth
#

Okay yeah but the way you showed is not pretty either

tardy delta
#

lol ye

waxen plinth
#

Using enums is gonna be clunky

#

Do you want to try my way

lost matrix
#

runtime complexity of switch statement is O(n) at worst

olive lance
#

Early development all my commands would be so encapsulated and its gotten messy over time

waxen plinth
#

Isn't a switch just a lookup table with a goto

tardy delta
waxen plinth
grim ice
lost matrix
grim ice
#

if you have time tho

lost matrix
# grim ice What's the best way you know rn? I want to know it too

There is no definite best way.
But you can do something like a
Map<String, Function<String[], Boolean>>
and fill it with methods to handle sub commands.

But to be honest commands would need way more classes and more abstraction for my taste.
I didnt use spigots command system for a while because literally any command framework does a better job.

#

This is how my command classes look atm

dry pike
#

So I'm creating fake players and when interacting with them PacketPlayInUseEntity should be fired but its not firing for some reason, I am intercepting packets and there is no log. Is there a problem how I create my NPC? Is it because I have them in a laying position?
http://pastie.org/p/4ME868GpoAGugySA6QYJ4L

waxen plinth
lost matrix
waxen plinth
#

Yeah but all the annotations and the help menu

grim ice
lost matrix
#

I mean... the information has to be defined somewhere. Its not like the framework can read my mind and define method names based on the star constellation.

lost matrix
grim ice
#

oh right

#

damn thats useful as fuck

#

does it automatically parse an entity type or do you need to make a context urself

lost matrix
#

If a player types in some garbage the error handler of that type resolver kicks in and tells the user whats wrong and makes suggestions.

waxen plinth
#

Fixed set of values?

grim ice
lost matrix
grim ice
#

it will get an error

#

thats what i understood

#

cuz entity type is an enum isnt it

#

if its not a value of that enum then it will error, thats what i get

waxen plinth
#

Well yeah that's a type

grim ice
#

ill start using this

#

but

#

wait

#

what if i do

waxen plinth
#

You could check mine out too 👀

#

With mine you only use a single annotation, the rest of the metadata comes from a markup file in a custom format

quaint mantle
#

redempt the ultimate non-advertising promoter

waxen plinth
#

Hello imagine

grim ice
#

/adm edit mobdrop ender pearl

#

instead of

#

/adm edit mobdrop ENDER_PEARL

waxen plinth
#

Yeah I am pretty transparently here mostly to promote my library lol

#

How does yours do optional arguments, 7?

grim ice
#

7 sounds weird

waxen plinth
#

7smile?

grim ice
#

it seems like he's a prisoner

waxen plinth
#

I dunno

grim ice
#

and he's being called by his id

waxen plinth
#

Number 7, please step forward

grim ice
#

Lol

#

i got a plugin idea which might suck

lost matrix
# waxen plinth Fixed set of values?

This is how i register sets for completion.
If i annotate a param with @Values("@Leaves") then only values from this set are accepted.
Faulty user input is handled by telling him "Parameter x only allows one of [A, B, C]" or "Parameter x is invalid. Did you mean C" if its similar.

grim ice
#

a way to create spigot events without knowing how to code

waxen plinth
#

Oh

#

Hmm

grim ice
#

so like u have a place to write code, and theres a syntax

#

where u can make events

#

and they would get registered

lost matrix
#

Doesnt have to be static. You can also register something similar to a Function<Player, List<String>> (friend lists for example)

waxen plinth
#

With mine you would do ArgType.of("entitytype", EntityType.class) for an argument type for that

#

It figures out what you want for enums

#

For non enum types it would be like this

#

new ArgType<>("world", Bukkit::getWorld).tabStream(c -> Bukkit.getWorlds().stream().map(World::getName))

grim ice
#

can u show us it

lost matrix
#

For context resolvers in acf a primitive approach would be

  private final PlayerDataManager dataManager;
  
  private void registerCommandContext(BukkitCommandManager commandManager) {
    commandManager.getCommandContexts().registerContext(PlayerData.class, context -> dataManager.getByName(context.popFirstArg()));
    ...
grim ice
#

what is context.popFirstArg()

#

i do realize that it's a Stack

#

but what is it

waxen plinth
#

Interesting

lost matrix
lost matrix
misty current
#

can you manipulate hoppers to act like they are extracting something out of something they should not? as an example, if I have a log and i want the hopper to think there are logs inside it

waxen plinth
#

Not easily

grim ice
waxen plinth
#

Gives an error, I'd imagine

misty current
lost matrix
# lost matrix And then methods like this are valid: ```java @Subcommand("edit playerdata") ...
  @Subcommand("edit playerdata")
  @CommandCompletion("@StoredPlayerNames")
  public void onEditData(Player sender, @Values("@StoredPlayerNames") PlayerData data) {

  }

  ...

  private final PlayerDataManager dataManager;

  private void registerCommandContext(BukkitCommandManager commandManager) {
    commandManager.getCommandContexts().registerContext(PlayerData.class, context -> this.dataManager.getByName(context.popFirstArg()));
    commandManager.getCommandCompletions().registerCompletion("StoredPlayerNames", context -> this.dataManager.getAllPlayerNames());
  }

This would include auto completion. context resolving and limiting a param to accept only valid input

quaint mantle
#

wtf are yall talking about

#

did i miss an update?

grim ice
#

ACF

quaint mantle
#

literally i will recommend redempts library

#

his command handling is actually easy

waxen plinth
#

😳

grim ice
#

i assume redempt would make smth amazing

#

ill check it out later then ill compare it to acf

waxen plinth
#

Want the wiki link?

grim ice
#

yes

waxen plinth
lost matrix
#

I would also not recommend ACF unless you want to invest quite a bit of time into learning all the internals.
Because the documentation is kind of poop and the framework is pretty complex and has a ton of little dials you can adjust.

grim ice
#

ty

waxen plinth
#

Mine is fully documented and simple to use for most use cases, but you can get up to some arcane bullshit if you must

grim ice
#

wew

#

mustve been pain to make that

#

cant imagine myself ever doing something like that without getting paid :troll:

waxen plinth
#

I enjoyed it

grim ice
#

that's epic

waxen plinth
#

It wasn't easy but it's worthwhile

#

Stop what

grim ice
#

prob impossible

waxen plinth
#

Oh

#

I didn't see that lol

grim ice
#

the texture will have to adapt to the small head

waxen plinth
#

Probably not

grim ice
#

so it wont be easy

misty current
#

balls 1

waxen plinth
#

balls 1

grim ice
#

Are you thinking what I'm thinking, B1?

#

I remembered this

lost matrix
misty current
#

what if I used a tileentity instead of a log? would I be able to recreate the behavior shown in the video or would minecraft refuse to add the nbt on the tile entity?

lost matrix
#

The video? I think i skipped something. One moment.

misty current
#

basically because of a generation glitch, he shows that a spawner chest nbt overlapped with the spawner's resulting in the items coming out of it with the usage of an hopper

#

as if it was a chest

#

put an armorstand on it

#

or an AOE cloud

lost matrix
# misty current this one

Ah i see. Yes you can do that. But only with tile blocks.
The hopper basically sees the TileState of the spawner as a chest because its whole state is that of a chest.
Can be done with NMS but again: only for tile states

misty current
#

area of effect cloud

#

use aoe clouds actually theyhold less data

misty current
#

that would be a lot of digging in nms code

quaint mantle
#

how would i use jackson to put the json data i have deserialized in an ArrayLIST? ive tried so many times but i end up with a blank array woohooo

misty current
#

spawn an aoe cloud

#

give it a name

#

make it ride your entity

quaint mantle
#

menus.add((Menu) Arrays.asList(coolMenu));

#

currently what i have ^^^^^^^^

lost matrix
#

Deserialize the whole ArrayList. As a matter of fact serialize the whole class that contains the list.
With Jackson and Gson you dont want to do anything manually.

#

All you do is register serializers and then dump your data to a File

misty current
#

spawn the entity with the world class, keep an instance of it

midnight shore
#

how can i make an arrow travel towards an entity?

quaint mantle
#

it doesnt DEserialize

#

i need it to take the deserialized data, and put it in my menus arrayLIST

lost matrix
misty current
#

and use it inside a setpassenger method

quaint mantle
lost matrix
#

Why do you cast a List<Menu> to a single Menu?

quaint mantle
#

ive been stumped on this deserializing thing for a week now so

#

i am pretty desperate

lost matrix
#

Like you spawn any other entity

waxen plinth
#

Don't do forEach add

#

Just use addAll

hexed hatch
#

It’s an entity

#

Called AreaEffectCloud

#

Spawn it like you would any other entity

#

Yeah that’s why lol

misty current
#

that explains

lost matrix
#
    Location location = ...;
    World world = location.getWorld();
    AreaEffectCloud cloud = world.spawn(location, AreaEffectCloud.class);

If you want to do it without packets.

hexed hatch
#

Imagine using dinosaur versions

misty current
#

it was introduced in 1.9

#

use marker stands then

lost matrix
#

Ancient. Then go search in old forum posts from 2017

misty current
#

i don't blame people who use 1.8 but you must expect 90% of things not existing

#

yea use a marker stand

quaint mantle
waxen plinth
#

No

misty current
#

also if you are inexperienced with bukkit i'd not suggest making 1.8 stuff

waxen plinth
#

menus.addAll(Arrays.asList(coolMenu))

quaint mantle
#

ok

misty current
#

i was just saying dont get offended

waxen plinth
#

What if we stopped giving help for 1.8

#

Just like

misty current
#

and if you want the most efficient way, having a stand for each entity could become a bit heavy on the server so i'd rather use packets

rugged wyvern
#

does Location.getX() not exist in 1.18 spigot jar anymore?

waxen plinth
#

You have to state what version it's for

misty current
#

but it takes longer and its annoying

waxen plinth
#

And if it's for 1.8 you get no help

waxen plinth
misty current
#

are you trying to call it statically

lost matrix
misty current
#

lmao

misty current
#

ohno

grim ice
#

so u wont learn a lot

#

or maybe not

misty current
#

1.8 has less support and personally i have found more need for nms usage/harder ways to code things

#

compared to modern api

quaint mantle
quaint mantle
#

i will give code

waxen plinth
#

?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.

quaint mantle
#

my menu storage class

#

i dont see what else could be causing the problem

misty current
#

"server infinisleeper"

lost matrix
#

static

misty current
#

mojang code is funny

quaint mantle
low temple
quaint mantle
lost matrix
#

There should be a password in intellij that you first have to write an essay about dependency injection and static abuse before the static keyword gets unlocked.

quaint mantle
#

i swear to god when this plugin is finished i am never touching java again, other than updating the plugin

low temple
low temple
#

Or have you tried using ObjectStreams

#

Oh ok

#

And the file isn’t empty?

quaint mantle
low temple
#

Maybe do a “file.exists()” test to see if it’s finding the file correctly in loadMenus()

unkempt peak
#

Have you tried printing out to see if the file is being read correctly?

misty current
#

more like the compiler should ask you

#

because you could bypass :p

quaint mantle
#

does not work = what i said earlier

#

i may have found the problem

#

[{"name":"placeholder,"size":54,"optionNames":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"optionIcons":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]}]

sacred mountain
#

hey how would i create a folder withyml files named the player uuid, and store data in them?

#

like abcd-1234-efgh-5678.yml

and it would store:

vanished: true
setting1: true
setting2: false

#

and i can get these values in my code

humble heath
#

hey

misty current
#

can I somehow override hopper ticking from minecraft?

odd tapir
main dew
#

How can I check if selected player is in a block? (for example to check whether a block can be placed there)

hasty prawn
#

.

main dew
hasty prawn
#

Instead of using World#getNearbyEntities just check the one you want to check.

low temple
#

If gson isn’t required I’d honestly just use Serialization to save ur data

main dew
main dew
somber sequoia
#

hey, I'm having trouble with sending a player a title, currently I'm trying to do player.sendTitle(text, text2, fadein, stay, fadeout) but my IDE yells at me that I've passed too many arguments to the function is there anything I'm doing wrong? I'm using spigot 1.8.8

storm crescent
#

Does anyone know why the Bukkit.getPlayer() method returns null if I change the players uuid in the Entity class?

hasty prawn
hasty prawn
main dew
somber sequoia
sacred mountain
#

how do i write an arraylist to a file

main dew
sacred mountain
#

i want to create a file named storage.yml and store all the player stuff in it

#

or should i create a file for every playe and store their individual values that way

#

like the filename as the player uuid

main dew
main dew
#

I'm not sure but I don't know if you should use the database more because you didn't say what you needed it for

misty current
#

is it me or did mojang improve their obfuscation in later versions

#

i can't even get x, y, z of a blockposition

ivory sleet
#

moj maps

#

👀

olive lance
#

why is json better than yaml for file storage

ivory sleet
#

define better

olive lance
#

idk people said better

#

is it easier perhaps?

misty current
ivory sleet
#

I can say its easier to serialize and deserialize to some extent

PS since json has a more determined format than yaml

misty current
#

is there a new way to do nms now

ivory sleet
#

mojang mappings

bold flume
quaint mantle
#

i need to deserialize an array in a json file seperatly, since gson cannot deserialize itemstacks on its own, so i created a seperate way to deserialize the item arraylist<itemstack> and it is annotated with @Expose(deserialize = false) but it still deserializes? help

#

my code^^^^

dry pike
#

Im having issues with an NPC hitbox. My NPC class is here;
https://paste.gg/p/anonymous/b6d41970005341d5bdfd6d6a6b6d4c52

When the NPC spawns the hitbox is normal and works fine, the problem starts when setting the NPC's pose with setPose in the above class. The hitbox gets really small, I would like the hitbox to be around the whole NPC not just its foot.
https://imgur.com/a/tPbF5Ce

Has anyone had this issue? Can I set a custom BoundingBox to the npc somehow?

olive lance
#

ok im not gonna lie that looks a bit more complicated than the way i do it in yaml

visual tide
dry pike
sly trout
#

guys how do i check if a player's inventory is empty?

young knoll
#

isEmpty?

vocal cloud
quaint mantle
#

how do i add two variables in one parameter

bold flume
#

yes

sterile token
sterile token
quaint mantle
#

or something like that