#help-development

1 messages Β· Page 207 of 1

sterile token
#

I the case i need more than 70-80% of library i would shade the full library

wet breach
#

I would go with a module design since maven allows modules πŸ™‚

#

and then you can make modules depend on each other if need be

tall dragon
#

yea that does indeed sound good

sterile token
#

Yeah maven is so great, than you can have modules inside of modules inside of parent project

tall dragon
#

alright. thanks for the insight guys

sterile token
#

Na dont worry mate

#

Epic once i finish the library i will send it to you

#

So you can have mor ideas

tall dragon
#

that would be great. thanks

sterile token
#

I added you to remember

wet breach
#

see, I have this plugin setup as modules to separate the implementation from the api

#

this allows me to compile just the API and lets developers who want to only depend on the API a smaller jar as well

#

and then when I compile the actual implementation it compiles the api and implementation, then shades the api in πŸ™‚

tall dragon
#

yea. makes perfect sense, thanks

wet breach
#

feel free to use it as reference if need be, it is open source after all

#

I even make use of a plugin in maven to update my plugin.yml version numbers automatically too πŸ˜›

#

so I am not always cluttering my commits with just updating that file XD

tall dragon
#

can't you just use a variable in ur plugin.yml?

wet breach
#

I have issues sometimes of maven not always picking it up

#

so I make use of a replacer plugin which comes in handy with other files

tall dragon
#

ah

#

should take a look at that πŸ™‚

#

thanks

wet breach
#

also the nifty part of modules the way I have it

#

if you have a dependency that is needed by multiple modules

#

just specify the dependency in the parent module

#

all the modules below the parent will be able to pick it up even though you didn't specify it in their pom

modern bridge
tall dragon
#

whats even that download

#

?bt

undone axleBOT
tall dragon
#

download from here

sacred mountain
#

yessss

#

finally

modern bridge
sacred mountain
#

arrow trajectory + estimations

#

basically aimbot

compact crane
#

Is there a way to query with a Java code who all has bought a plugin?

drowsy helm
compact crane
drowsy helm
#

some people use paypal verification

#

theres no easy way to do it though

sterile token
#

i didnt understad what you were meaning

#

You want to verify who is using the plugin? Or want to generate then a code which allow using the plugin?

echo basalt
compact crane
echo basalt
#

and there are a few objectives...

wind blaze
#

Does anyone know how to check if a mob was spawned naturally (not by plugin or command)

noble lantern
#

iirc theres an EntitySpawnEvent you can listen to for when an entity spawns

#

not sure about just grabbing a random mob in the world an checking tho, you can store a meta data key on the entity tho so that you know it was spawned by something or natural

noble lantern
#

i edited the msg re-read 2nd one sry

#

idk if theyre a method for this now a days, but this is what we did many years ago

wind blaze
#

I’ll do it that way then ig, thanks a lot

echo basalt
#

paper has a org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason();

noble lantern
#

iirc spigot has something similar

misty current
#

how can I check if a field's type is an array/list of an Object?

ivory sleet
#

depends

#

but usually not possible to check the type passed to the type paremeter

#

as it gets erased

white dew
#

Hii guys, this is not exactly a problem I'm having, but rather something I'm trying to understand. I'm learning Java as I learn minecraft programming

#
@Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Starting my plugin!");
    }
#

what is the "@Override"

#

I mean, what does this "@" do?

#

what is Its name in Java?

fluid river
#

@ is for annotations

worldly ingot
#

They're called annotations, and Override in particular is more or less a compiler hint that lets your IDE know to give you a warning if there's no parent method that matches its signature

fluid river
#

@Override annotation says that method is from parent class and it is overriden

worldly ingot
#
public interface MyInterface {
    public void foo();
}

public class Example implements MyInterface {

    @Override
    public void foo() { } // This is fine

    @Override
    public void foo(String value) { } // This will give you an error

    @Override
    public void bar() { } // This will give you an error too

}```
fluid river
#

you can code without annotations tho

white dew
#

ooooooh

#

thank you guys, I thinking I'm understanding

fluid river
#

nobody gonna hurt you if you remove @Override

worldly ingot
#

I will hurt you

#

Use Override lol

fluid river
#

that's more like a comment

white dew
#

Haha

#

I see...

fluid river
#

for your level

worldly ingot
#

It's a compiler hint, not a comment. For beginners especially you should be using it

#

It's difference between figuring out why onEnable() vs onenable() will and won't work

white dew
#

ooooh, I think I got It now!!

misty current
quaint mantle
#

?

#

do you want to do instanceof List

white dew
worldly ingot
#

Correct

white dew
#

oh, ok!

#

thank you

#

I really appreciate your help :)

misty current
worldly ingot
#

Generic types are non-existent at runtime so you can't exactly check for them

#

You kind of just have to assume

quaint mantle
#
List<ItemStack> out = null;

if (obj instanceof List<?> list) {
    if (list.isEmpty()) {
        out = new ArrayList<>(0);
    }
    else if (list.get(0) instanceof ItemStack) {
        out = (ItemStack>) list;
    }
}
if (out == null) {
    throw new IllegalArgumentException("obj must be a List<ItemStack>");
}
#

code i made a while ago

#

close enough right

worldly ingot
#

That's probably one decent way of doing it, yeah

#

Gross, but doable lol

quaint mantle
#

lol

misty current
#

i don't have the actual object, I have the field tho

#

i guess i could read the field but that would slow down the code most likely

worldly ingot
#

You can get the object from the field

#

That's really your only way of going about it

fluid river
#

and your code won't compile

quaint mantle
fluid river
#

iirc

worldly ingot
#

This is happening every second!?

white dew
#

oh, ok

fluid river
#

at least in eclipse

quaint mantle
#

No im just saying

misty current
#

it is not

quaint mantle
#

if he has to worry about a small performance change in this case then its probably a design issue

fluid river
worldly ingot
misty current
#

i am tryna intercept packets and modify ones that contain some specific itemstacks

worldly ingot
#

I'd strongly advise the use of ProtocolLib

#

That's its whole purpose is catching and monitoring packets

#

It's not a huge burden either. It's practically an auto-install on most servers

misty current
#

i don't really see what would the benefits be compared to using nms

worldly ingot
#

Multi-version compat (for the most part) and ease of use

misty current
#

i don't need multi version compatibility, i'm testing something for a private project of mine

#

and also i find nms easier to use when dealing with packets

#

i have used protocollib in the past but the experience was pretty bad, especially with more complex packets

#

even with wrappers, that were often not updated or wrong

worldly ingot
misty current
#

i meant in general, i've always found protocol lib pretty painful to work with

#

also i don't think protocollib has a way to listen for any packet and check if the packet has an itemstack, itemstack array or itemstack list field

white dew
#

Guys, I have a question that is gonna sound silly, but here we go

#

when I create a project, where exactly the "main" method is?

#

I mean

#

every program in Java must have a "main" method, right?

fluid river
#

yes

#

you need to create first class

#

and place main method in it

white dew
#

hmmm, I see, but like

#

I only see one class in my project

#

and It doesnt have a "main"

fluid river
#

When you start .jar program, JVM basically goes to your main() method

white dew
#

but I can compile It

#

yeah, that makes sense

fluid river
#

if there is no main method

#

program won't run

white dew
#

yes, that makes sense

#

but still, I can compile my plugin even if I don't see a main method

fluid river
#

show your project structure

white dew
#

is it, running on the background or something?

#

oh

#

ok

fluid river
#

If you are coding spigot plugin

#

you don't need main method

white dew
#

oooh

#

yea

#

thats It

#

I'm using spigot

#

but why tho?

fluid river
#

Your plugins are loaded by Bukkit's class loader

#

Not starting as .jar

white dew
#

ooh

fluid river
#

Bukkit goes to your plugin .jar

#

looks for plugin.yml

#

in plugin yml should be your main class which extends JavaPlugin

#

and well Bukkit loads this class

#

runs it's onEnable() and there you go

white dew
#

ooooh, thats amazing

#

so Its like the program takes my changes and use it in the game files

#

like, I'm not exactly writing an executable program, but rather something to be used πŸ€”

fluid river
#

yes

white dew
#

oooooh

#

thats sooooo interesting

fluid river
#

the main program is your Spigot.jar

#

or Craftbukkit.jar

white dew
#

I see... :O

fluid river
#

or Paper.jar

#

it's loading classes and resources from your jar

#

and using as it wants to

white dew
#

I see

#

Its different when you are making minecraft mods, tho, right?

fluid river
#

idk never coded mods

white dew
#

ooh, ok ok

fluid river
#

i guess they are working same way tho

white dew
#

oh :O

fluid river
#

your minecraft loads every jar from mods folder

#

.ymls and classes

white dew
#

I see

fluid river
#

and other stuff

white dew
#

thats great

fluid river
white dew
#

thanks

#

Hey, does anybody here program minecraft mods, as well? I want to know If It's similar to programming plugins or way harder

#

because I'm kind of interested in It as well :o

worldly ingot
#

Slightly more difficult because you have to understand sidedness

#

That and Minecraft's resource structure

#

Definitely doable, but Bukkit plugins are far more approachable than Forge or Fabric mods

white dew
#

ooooh, I see

#

I want to understand Minecraft's resource structure very badly, hehe, so that may be fun!!

#

I'll try to learn more about spigot and bukkit, going along with my java learning before I do that tho

misty current
#

also while working on spigot plugins you only work on the server, when modding you also work on the client

worldly ingot
#

You'll definitely want a stronger grasp of Java before approaching mods

white dew
#

but It will me amazing for me to learn how the game I love since a child works

misty current
#

a lot more options but more stuff to learn

worldly ingot
#

If you have a strong understanding of language concepts then you should be fine for the most part, but you really want that foundation first

white dew
#

I see

misty current
#

even looking at nms is a fun way to understand how does a simplistic game like minecraft work and also how complex its structure is

#

but as choco said, you need to have a good knowledge of java

white dew
# worldly ingot If you have a strong understanding of language concepts then you should be fine ...

one of the problems I have as a beginner coder, is that I feel like I already now a lot about the very basic stuff, conditions, basic OOP, loops, data structures, etc. But if you asked me to make a GUI for something, I wouldn't know how to πŸ˜… what do you think is necessary for me to learn so I can have sufficient knowledge in the foundations of java (or programming, in general)? Sorry, I'm kind of lost in my journey, right now

misty current
#

you can easily find guides on that

#

anyways you can create an inventory and then open it to a player

#

then to make stuff clickable you need to listen for click events

#

one of the first things i'd learn if i were you is how to create commands and listeners

white dew
#

oooh, thanks, but I was referring to Java in general, not only spigot, like GUI interfaces for simple programs (not minecraft related). I was trying to show that I lack skills in java, even though I know the basics

white dew
#

I can actually create plugins, but sometimes I don't understand why something works, just that It works and I know how to do it πŸ€”

#

if that makes sense

misty current
#

so swing and such you meany

white dew
#

XD ok ok

misty current
#

that's also pretty easy, bro code has a very well made java course covering that

river oracle
#

use javafx

#

not swing

misty current
misty current
#

reading nms classes can answer those questions

echo basalt
#

it has its downsides

white dew
#

oh, I see

echo basalt
#

like

#

once I learned how to mess with NMS

white dew
echo basalt
#

life stopped being fun

misty current
#

i actually have even more fun now that i know how to mess with mc's code

white dew
#

thats so awesome

#

very cool

echo basalt
#

like

#

I haven't learned anything new for the past year or two

white dew
# misty current reading nms classes can answer those questions

Just one more thing. How does a listener work? I mean, I know It makes so the game detects events and when they happen, the method in my program executes, but how does It know that event happened in the first place. Do the main minecraft program runs a while loop checking for every event, or something?

echo basalt
#

Uhh it's a bit specific

#

Each action calls an event

misty current
#

nms classes are modified to include event calls when a certain action happens

#

i'll send you an example gimme a sec

echo basalt
#

The event processing code just loops through all RegisteredListeners (listener wrapper that is made when you register listeners)

misty current
#

this is a piece of a method called when a player starts to mine a block

white dew
#

oooooh

#

how did you find that?

echo basalt
#

or skeleton horses :)

misty current
#

CraftEventFactory is an utils class to call some events more easily

echo basalt
#

^ That being said, not all events go through CraftEventFactory

white dew
#

I feel like I'm learning a lot with you guys, thank you

misty current
white dew
#

I see

misty current
white dew
#

are you guys usually here? I'm going to have a lot of trouble learning in this journey haha

misty current
white dew
#

so I will be grateful to have your help

#

I see

echo basalt
#

ServerGamePacketListenerImpl contains most of the packet listening and processing code

misty current
#

i chat here sometimes, yes

white dew
#

nice

misty current
#

depends if i'm in the phase where i code often

white dew
#

awesome

misty current
#

like rn

echo basalt
#

And I believe we're from the same country just seeing your bio

#

so timezones shouldn't be an issue

white dew
#

Really???

misty current
#

i alternate between gregtech modpacks and developing

white dew
#

ooooooooh

#

awesome

white dew
echo basalt
#

I alternate between having depressive episodes and coding

white dew
#

oooh, man, sorry to hear that :(

echo basalt
#

Is ok

#

part of life

white dew
#

I have depression as well. Not saying Its the same pain, of course, but I can understand how painful It is

#

I hope you get better

#

nobody deserves to be depressed

echo basalt
#

It doesn't bother me

misty current
#

here you can see an example where CraftEventFactory is not used to call the event

echo basalt
#

Well

#

technically it does but still

misty current
#

sorry to hear that

echo basalt
#

Life goes on

white dew
#

Do you guys have any book recomendations for java, or programming in general?

#

I really like to learn using books

misty current
#

CraftEventFactory is a pretty massive class

echo basalt
#

Uhh

#

I wouldn't say books are the best for teaching programming

#

neither are schools

white dew
#

ah, I see

misty current
#

i probably will when i get to uni in 2 years

#

i'll take CS

white dew
#

I'm reading a book about java right now and It's helping me a lot to understand the foundations

#

ooooh

echo basalt
#

because they teach you about the basic functionalities of the language rather than the code quality and oop principles themselves

white dew
#

I see

white dew
echo basalt
#

I'm on my last year on my programming course

#

Didn't learn shit

white dew
#

what course are you taking?

#

college?

echo basalt
#

nop

white dew
#

or something else?

#

oh

echo basalt
#

high school / vocational type deal

misty current
#

school aint teaching me shit

echo basalt
#

well you'll learn css probably

#

and python

misty current
#

html too ig

#

and js

echo basalt
#

php

misty current
#

i havent coded much outside java

white dew
#

In my college class I started learning python

echo basalt
#

be prepared to have a 29:1 anime addict to girl ratio

misty current
#

and scratch when i was younger lol

misty current
echo basalt
#

I originally did C# bots for flash games when I was... like 6?

echo basalt
#

apes together strong

misty current
#

lol

echo basalt
#

make sure you have either the shittiest thinkpad or a baller gamer laptop

misty current
#

right now i have a PC

echo basalt
#

yeah good luck

misty current
#

2 years is a long way to go still

echo basalt
#

just bought an LG Gram laptop

#

for school

#

tired of my crappy acer

misty current
#

not sure if i should be excited or not

echo basalt
#

doesn't even have 8 bit color

misty current
#

lol

echo basalt
#

should arrive thursday

misty current
#

for now i'll keep having fun breaking minecraft

#

at 2am

echo basalt
#

let's hope I won't regret not paying 500€ more for the 4k option over 2k

white dew
misty current
white dew
#

I hope I can become good like that, so I can mess around and have some fun too

echo basalt
#

I'll... keep making cursed code

#

like ditching craftblock

misty current
#

this is a mess

#

i'm still working on registering custom items

echo basalt
#

I'm still happy I managed to make a multithreaded floodfill algorithm to process abstract shapes

misty current
#

and i'm tryna edit all item packets to a valid item so the client doesn't commit suicide

echo basalt
#

shit has a mad compression ratio too

worldly ingot
echo basalt
#

managed to convert about 360k blocks into 10k objects

misty current
#

but i'll act like i understood

echo basalt
#

with a contains method

worldly ingot
#

You mean like a HashSet? ;p

echo basalt
#

well

#

that's not that memory efficient is it

worldly ingot
#

This is Java

echo basalt
#

360k objects

worldly ingot
#

You get all the memory you want

echo basalt
#

sure but like

worldly ingot
echo basalt
#

I managed to lower it to about 7k objects

#

and been thinking of a new algorithm to compress it to ~800-1000 objects

#

I also gotta read all the blocks and match the type

#

all I have is a single Location

white dew
#

So, another silly question πŸ˜… but I have this simple event I'm handling, and I have a few doubts

#
@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Bukkit.broadcastMessage("Welcome, " + event.getPlayer().getName() + " to the server!! :)");
    }
#

First, what is the @EventHandler annotation for? Does It like, give me a warning if I try to implement a method that is not an event?

#

Is It like "@Override", but only for event methods?

echo basalt
#

@EventHandler is an annotation that indicates that the given method receives events

white dew
#

I see

echo basalt
#

The parsing algorithm just goes like

#
for(Method method : clazz.getMethodsAnnotatedBy(EventHandler.class)) {
  ...
}
#

type deal

worldly ingot
#

It's basically a way for Bukkit to identify a listener, that's all

#

Otherwise it would have to just assume that all methods are listeners

echo basalt
#

one tiny inconsistency that pisses me off

worldly ingot
#

Which may or may not be the case

misty current
echo basalt
#

and now that choco is here this is probably gonna be dealt with

white dew
#

ooooh

#

I see

echo basalt
#

is that on bukkit you can make eventhandlers private

#

because bukkit calls method.setAccessible(true)

worldly ingot
#

+1

echo basalt
#

but bungee doesn't

worldly ingot
#

It doesn't? lol

misty current
#

eventhandler is used instead to identify the method as a listener

white dew
#

nice, thanks

echo basalt
#

it throws a fuckin accessibility error

worldly ingot
#

Well that's mildly annoying. I'd assume that it would

#

I'd rather them be private >:((

echo basalt
#

I prefer to make stuff private by default

#

so like

#

it only takes 1 line of code

white dew
#

is that the same as making a for each loop containing every player and sending each one individually a message?

misty current
#

does the client know by itself what armor is it wearing or do you need to send it a packet to modify it? Right now i have a pickaxe on my head slot and it doesn't render there

#

oh nevermind 1.8 just doesn't render items on ur head

echo basalt
#

fuck it, github works nicely

#

no need to run buildtools

white dew
#

Ok, now last question, for real: Do you guys have any Java course I can follow? Udemy/youtube, doesnt matter, just looking for recomendations, hehe

echo basalt
#

Jetbrains academy works fine

white dew
#

oooh

#

I dont know this one

#

awesome

fluid river
#

also google Java coding roadmap

#

choose any random one

#

and go google each topic from the roadmap

white dew
#

that seems a good idea

#

thank you

wet breach
balmy valve
#

Anyone know how you do custom colors in hover text in the text component?

#

Im using a legacy formatting

#

and I assume that I can't without changing, but I don't know how to change it

worldly ingot
#

Yeah, you need to use components for that

balmy valve
#

Im using text components but the HoverEvent accepts only a constructer with the Action and if its the HoverEvent.Action.SHOW_TEXT, then a new Text(String input)
said text input when given a custom color doesnt actually use it, shown in the photo

worldly ingot
#

You can't use legacy colour codes when using components. It's just bound for breakages

#

If you're making use of components, you'll need to use the ComponentBuilder to construct components more easily with colour

BaseComponent[] message = new ComponentBuilder()
    .append("Hello").color(ChatColor.GOLD) // net.md_5 package, not org.bukkit.ChatColor
    .append(" world").color(ChatColor.GRAY)
    .create(); // Can't remember if it's create() or build(). One of the two```
balmy valve
#

I saw that but if i do the HoverEvent and I use the constructer using the ComponentBuilder it tells me its deprecated

worldly ingot
#

Shouldn't be. Just have to wrap the builder with a Text instance

#

new Text(new ComponentBuilder()/* blah */.create())

balmy valve
#

ohhhhh I see

#

so does .color color all before it?

worldly ingot
#

It colours that component, yeah

#

Think of .append() like the start of a new component

#

Anything following it will affect that component. Any .append() calls after that will be a new child component, which inherits the format and events of its parent component. Unless you supply a FormatRetention to state otherwise

#

The example above for instance, if I hadn't specified the colour to use for "world", it would have inherited the gold colour because it's a child of the "Hello" component

fluid river
#

explain

#

why can't you do this in java

#
if ((int i = obj.getMyInt()) == 1) {}```
#

but can do this(pattern matching)

#
if (obj.getMyPlayer() instanceof Player player) {}
#

is there any language where first construction is available

drowsy helm
#

the second one is relatively new to be fair

#

but the top line only saves 1 line of code so its not a massive deal

quaint mantle
#

Hey Guys, Is there an event for player's minecraft nickname change?

drowsy helm
#

like their mojang name

#

or server nickname

quaint mantle
#

Mojang Name

#

Yeah

drowsy helm
#

no

quaint mantle
#

Hmm

drowsy helm
#

that woudl take a relog anyway

fluid river
#

but since MC jumped from java 8 straight to java 16

#

not a big deal

quaint mantle
drowsy helm
#

noo

#

uuid

drowsy helm
#

difference is second removes an uncessary cast

#

but yeah not a huge diff

quaint mantle
fluid river
#

like i see that you can do this:

#
int i;
if (i = obj.getMyInt() == 1) {}
#

why not just combine into 1 statement

#

like bruh

drowsy helm
#

well i guess the difference is you already have the variable as the given type

#

whereas the instanceof one you dont have it

#

but yeah java has heaps of things they should add

fluid river
#

you can cast it manually

#

in if statement

#

or if it's already same type just ignore

#

or just use var

drowsy helm
#

if (i = obj.getMyInt() == 1) {}```
doesn't look very 'java-ie' tbh
fluid river
#

var i

#

or int i = (int)...

#

i mean it's the only reason

#

why we have ==

#

just cuz we can assign value inside the if statement

drowsy helm
#

huh

#

wdym

fluid river
#

the only reason languages have ==

#

is because you can use = in if statement

#

where it's gonna assign value to the pre-declared variable

drowsy helm
#

not really

#

it can be used outside of if statements

#

for boolean algebra

fluid river
#

anyways

#

in statements

#

if not in if

#

then in boolean b = ...

drowsy helm
#

boolean a = number1 == number2;
vs
bolean a = number 1 = number2;

#

second just doesnt make sense

fluid river
#

yes

#
boolean a = (number1 = number2) == 2;```
#

both assigned and compared

#

in one line

#

so just as i said

#

the only reason languages need ==

drowsy helm
#

thats a completely different scenario

fluid river
#

is because = is also used in statements

drowsy helm
#

== is used as a comparator, not only because = couldve been used

fluid river
#

it's not could've been

#

it already took it's place

#

if language doesn't support = for assigning values IN A STATEMENT

#

language woudln't need ==

#

cuz well, = would be a comparator

drowsy helm
#

that just isnt true lol

fluid river
#

let's discuss then lol

drowsy helm
fluid river
#

πŸ˜‰

drowsy helm
#

how would you do this

#

boolean a = number1 == number2;

#

in a language that doesnt have comparators

#

its a statement

fluid river
#

if language didn't support assignment in a statement

#

you could've used second thing

drowsy helm
#

how else woudl you do assignment then?

fluid river
#

cuz boolean b = is assignment part

#

not a statement, just a line of code

drowsy helm
#

it's an assignment statement

fluid river
#

it's declaration + initialization, which takes statement in it

drowsy helm
#

wait lets clear one thing

#

what do you mean by statement

fluid river
#

i mean

drowsy helm
#

because by java's official definition thats an assignment statement

fluid river
#

boolean b = statement

#

if (statement)

drowsy helm
#

so the expression

fluid river
#

oh

#

my bad

drowsy helm
#

yeah i get where you're coming from now

#

we just had differing definitions

#

you are correct

fluid river
#

my english kills me second time

drowsy helm
#

But I think syntactically speaking that would go against java’s conventions

fluid river
#

pattern matching doesnt

drowsy helm
#

Never seen a language that uses = for both

fluid river
#

or like

#

inner classes

#

Head head = new Human().new Head();

fluid river
#

even c

drowsy helm
#

Couldnt you just do new Human.Head()

fluid river
#

no

#

you can also do

#

Human h = new Human();
Head head = h.new Head();

#

πŸ˜‰

#

syntax weirdness

#

what about

#

() ->

#

i1 ->

#

(i1, i2) ->

#

is (i1) -> even possible

drowsy helm
#

Yeah

#

For a consumer

quaint mantle
#

hey guys, How to set NPC's skin? I found the class NPC So I tried to spawn it like ```java
org.bukkit.entity.NPC npc = (org.bukkit.entity.NPC) player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);

lilac dagger
#

@quaint mantle you can't cast a villager to a NPC

quaint mantle
#

Oh

lilac dagger
#

you'll need to use the api of citizens @quaint mantle

#

or cast it to Villager instead

quaint mantle
#

Hmm

lilac dagger
#

if that's what you wanna achieve

quaint mantle
#

How do I fix this problem?

#

[HELP please]
I'm trying to save blockdata to config and get blockdata from config and place it.
You can do BlockData#getAsString() but how do you get blockdata from string? (From BlockData#getAsString())

drowsy helm
#

Malformed json

quaint mantle
sick ermine
#

Hi I want to code a quest plugin. But I don't know exactly how to implement an architecture. Can anyone share their thoughts on this subject?

frail gale
#

What do you mean by architechture?

hoary sierra
#

I need help
so im trying to make it so that pvp damage is increased by 15% but it isnt really working, im making it display damage in the console and regardless if i have the plugin or not its still the same. Can someone please help me?
the damage output logger works but not the damage multiplier

#

i tested it on a zombie and i lost 1.5 hearts per hit with and without the plugin

#

the damage it outputed was 2.785

tall dragon
hoary sierra
#

aight

hoary sierra
shadow gate
#

Tell me how to make the plugin check with the player when entering the game whether a certain mod for the game is installed

chrome beacon
#

You will need to listen to the information packets that the client sends

#

wiki vg should have the Forge format documented. Not sure how fabric sends the data

#

You should be aware that this can be easily spoofed

obtuse lake
#

Hey, I'm trying to setup my Eclipse to make my first plugin, but I'm having trouble adding spigot to my libraries, I'm doing it the same as tutorials I've seen but for some reason the library is like, empty or something? It's really weird and I don't know what to do next

vocal cloud
#

Most people use intellij so you'll need to wait till someone who knows eclipse comes online

obtuse lake
#

I mean I can probably switch to Intellij too if that speeds things along, I just want to start learning really, not too invested in what IDE I'm using to do that

eternal night
#

Depends on the build system you use. Does your tutorial use maven or gradle ?

obtuse lake
#

It hasn't covered that, so I assume Eclipse handles it itself?

eternal night
#

you might want to look for a different tutorial then o.O

#

a build system like maven or gradle is a pretty essential part of developing a plugin

#

you'll either have a pom.xml or a build.gradle.kts file

obtuse lake
#

I see it's 2 years old, probably out of date

eternal oxide
#

Not good

river oracle
#

Oh god reading πŸ“š

remote swallow
#

i wonder what its like for the people that dont use minecraft development making a project

eternal oxide
#

Easy

sick ermine
obtuse lake
sick ermine
#

I cant prepare the uml diagram of the project

obtuse lake
sick ermine
chrome beacon
#

Ah nvm

#

So you just want to know where to put your code so it's structured neatly?

#

Or do you actually want to draw an UML Diagram

sick ermine
#

I'm having trouble thinking of code structure

serene sigil
#

how do u detect the new location of the dragon egg if u left click it and it teleports?

tardy delta
#

hmm when i delete the world files for the overworld, does that world still have the same uuid as before?

eternal night
#

The region files you mean ?

tardy delta
#

the files within those folders

#

looks like the newly generated world gets a new uuid when i delete those files

misty current
#

how can I decompile modify and recompile a jar file using intellij?

tardy delta
#

wondering what i should do then when some player has a home in a world that doesnt exist anymore

eternal night
#

The world uuid lives in uid.dat

#

Iirc

misty current
eternal night
#

A BlockFromToEvent should be called

#

yea

frail gale
#

then you can control them

heady spruce
#

hey! i want to teleport 2 players to different locations without teleporting to them same location. im kinda stupid rn so yea xd

tall dragon
sick ermine
heady spruce
# tall dragon so what is the problem with that

oh, i see i didnt explain it,
basically i have a list that contains some locations, and i want to teleport 2 to the locations, problem is sometimes it happens that both of the players get teleported to the same location.

tardy delta
#

check if its the same and if so pick the next one?

tall dragon
#

then on the next iteration check if its in the list

#

if it is. its already picked

quaint mantle
eternal oxide
#

personal choice

ornate mantle
#

if I have a private organisation repository on GitHub and I want a way for people to make push requests how would I do it without making new branches?

#

oh I forgot you can make clones of private repositories

rough drift
#

I used both

#

IntelliJ is superior if you have the specs

#

otherwise eclipse

#

(You can improve Eclipse autocompletion manually if that's your prob)

eternal oxide
#

I disagree. I've used both. I prefer Eclipse, unless it's a multi dev project

obtuse lake
#

Got Eclipse to work, but it says I made a legacy plugin, will try Intellij to see if that works better

wet breach
#

Netbeans is probably on par with it πŸ˜‰

rough drift
rough drift
#

My ranking is

#

IntelliJ
Eclipse
Notepad

Netbeans

#

Mostly due to tab completion

#

otherwise eclipse is just better

obtuse lake
wet breach
#

netbeans has tab completion

#

even customizable too

rough drift
#

like good tab completion

wet breach
#

and extendable

eternal oxide
#

Mine is Eclipse, Netbeans, Intelij

wet breach
#

it is good

eternal oxide
#

For Java anyway

wet breach
#

Well all those IDE's are primarily for java anyways

obtuse lake
eternal oxide
#

I was going off Eclipse for it's poor implementation of multi project support, but that was improved a while back

#

api-version: 1.19

obtuse lake
#

Ah alright

eternal oxide
#

or whatever minimum version you want to support, back as far as 1.13

rough drift
#

just put 1.17

obtuse lake
#

Yeah that fixed it

sterile token
#

In my opinion i think that using 3rd party sites for selling is really limiting

#

Because you cannot obfuscate, implement your own metrics tracking, neither buyers, etc

#

I mean its like Spigot is okay in terms of simplicity but if expect more it would be best to use your own site and apis

quaint mantle
#

@trail basin dont know if it is possible

trail basin
#

Is there any way to send a click packet before canceling an open gui packet?

#

I'll just paste it here, doesn't seem possible but maybe I understand it wrong

quaint mantle
#

Like preventing a gui from closing?

sterile token
#

I dont understand exactly what he need

#

if not i would try to help

trail basin
#

I think I'm misunderstanding it

sterile token
#

Livid why do you want to do that?

trail basin
#

I was wondering if you could change items in chest without having gui open

glossy venture
#

just use the tile entity lol

serene sigil
#

why does this not work?

#

it should point the compass to that location

glossy venture
sterile token
serene sigil
#

wdym?

sterile token
#

just do it in-line 😑

glossy venture
#

no lol

serene sigil
#

lol

glossy venture
#

this visualizes it better

sterile token
#

haha that thing cause me anxiatiy

serene sigil
trail basin
quaint mantle
#

It is good for the visuals

serene sigil
hybrid spoke
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.

sterile token
#

Okay im the weird bro which dont like using lot of lines of code

serene sigil
hybrid spoke
sterile token
#

Imaginate i use streams for not doing ifs, for loops, etc over collections

serene sigil
sterile token
obtuse lake
hybrid spoke
# serene sigil wdym?

Please describe what exactly is not working, what you expect it to do, and what actually happens.

serene sigil
#

the crafting and everything else works tho

serene sigil
#

just that one

#

thats why i used lodestonemeta

quaint mantle
#

ahh

serene sigil
#

?

quaint mantle
#

Now I see what you nee

#

d

tardy delta
#

streams impl goes brr

#

ok this is hacky

hybrid spoke
#

anyone ever had the problem that files could not be dragged into intellij anymore?

tardy delta
#

is that a thing?

#

:o

hybrid spoke
#

yeah

#

for example images

#

cant even drag & drop in my test jfx project

serene sigil
hybrid spoke
#

also works on my laptop

#

just not on my pc

sterile token
#

weird

#

Have u tried restarting the program?

hybrid spoke
#

yes

#

even my computer

#

still not

serene sigil
sterile token
#

ok

#

I dont think u will want to reinstall it but that is the only option i can see now

hybrid spoke
#

also have a drag&drop view in one of my projects and if i start it with intellij, i cant drop anything in there xD

#

switched now to EAP and installing the update

#

maybe that fixes it

#

if not i will continue in text editor

sterile token
#

how i reload Maven service?

hybrid spoke
#

what exactly do you mean?

tardy delta
#

lookin horrible

sterile token
#

I need to reload it cuz it not finding/resolving any remote dependency when the repos and everything are setup correctly

hybrid spoke
#

mvn clean install -U

sterile token
tardy delta
#

lol

#

believe i have some corruptions on the database

sterile token
#

Any idea why mongo shity logger is ignoring me?

#

Its like he doesnt care im stoping the info and warning loggings

tardy delta
#

fun thing about me working on a db is that it breaks every time i change smth

sterile token
tardy delta
#

should learn mongo too

sterile token
#

ik that i need to learn more about mongo

tardy delta
#

i dont have much relation based stuff so might be useful

sterile token
#

Hmn could be spigot task not working correctly on 1.19?

#

Because the async task im running thru PlayerJoinEvent is not executed cuz nothing is inserted into db

faint tide
#

Hi, am I stupid?
I am trying to add a cooldown to an event, which works fine but not when I try to format the cooldown.
I use System.currentTimeMillis().

to set the Cooldown I have a hashmap public HashMap<UUID, Long> cooldown = new HashMap<UUID, Long>();
In the hashmap I add the cd period: this.cooldown.put(player.getUniqueId(), System.currentTimeMillis() + 86400000);

So far so good, then I want to display the time left on the cooldown. which i do by:

            SimpleDateFormat style = new SimpleDateFormat("HH:mm:ss");
            Date date = new Date(remainingTime);
            player.sendMessage(style.format(date) + " remaining"); ```
This does work, except it doesn't display the correct time.... 68.400.000 should be a day, but when I run the command it outputs: `00:59:59`. this should be `23:59:59` right?
Am I missing something?
modern maple
#

Hey so I was looking through and was wondering if anyone has an idea to do add any item to an armor stand head slot without commands, aka by right clicking on the armor stand with the item

tardy delta
#

ok its not a data corruption issue lol

tiny tangle
tardy delta
#

my code fucking up

quaint mantle
sterile token
#

LMAo java is always trolling me

tiny tangle
#

me*

sterile token
#

I only code

warm spire
#

Hi so my ip adress was banned from spigot and I don't know why

undone axleBOT
warm spire
#

ah thanks

sterile token
#

Contact the support

#

Your welcome

warm spire
#

alr

sterile token
#

Either support or a staff members

warm spire
#

ok

sterile token
#

Your welcome my mate

#

Java Its fucking amazing because its telling me that smth is null, when in first checking

if (smth == null) stm create it; do actions with smth; // gives null

#

LMAO

#

πŸ˜‚

tardy delta
#

then it is null

runic minnow
#

SIGSEGV (0xb) at pc=0x00007fc4f4650830, pid=4951, tid=30564

sterile token
sterile token
runic minnow
# runic minnow SIGSEGV (0xb) at pc=0x00007fc4f4650830, pid=4951, tid=30564

Current thread (0x00007fc4842b6040): JavaThread "Craft Scheduler Thread - 2605 - CapeEsle" [_thread_in_Java, id=30564, stack(0x00007fc28d0fd000,0x00007fc28d1fe000)]

Stack: [0x00007fc28d0fd000,0x00007fc28d1fe000], sp=0x00007fc28d1fa590, free space=1013k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x691830] forte_fill_call_trace_given_top(JavaThread*, ASGCT_CallTrace*, int, frame)+0x180
V [libjvm.so+0x69215c] AsyncGetCallTrace+0x1dc
C [spark-103b6c5fb1675-libasyncProfiler.so.tmp+0x16619] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int, StackContext*)+0xe9
C [spark-103b6c5fb1675-libasyncProfiler.so.tmp+0x3138f] Profiler::recordSample(void*, unsigned long long, int, Event*)+0x27f
C [spark-103b6c5fb1675-libasyncProfiler.so.tmp+0x31a74] PerfEvents::signalHandler(int, siginfo*, void*)+0x74
C [libpthread.so.0+0x12730]
v ~StubRoutines::call_stub
C 0x0000000000000002

tardy delta
#

lets not print threaddumps ig

runic minnow
#

today my server crashed due to an error that i have never encountered before due to my plugin

sterile token
#

Not caused by plugins

runic minnow
#

Does anyone understand this hs-error log?

sterile token
#

I think its generally happens when sever crashes

runic minnow
#

Current thread (0x00007fc4842b6040): JavaThread "Craft Scheduler Thread - 2605 - CapeEsle" [_thread_in_Java, id=30564, stack(0x00007fc28d0fd000,0x00007fc28d1fe000)]

tardy delta
#

if the jvm crashes i dont think your plugin can do much about that

runic minnow
#

CapeEsle is my plugin

sterile token
runic minnow
#

now, how can i fix this

sterile token
#

That a problem with the JVM which have crashed

tardy delta
#

any idea what code would be causing this?

runic minnow
tardy delta
#

if this is the first time you have this just ignore it

runic minnow
#

I think it is from jvm, but the name of the thread where my plugin is running is written so I doubted it

runic minnow
sterile token
#

Does your plugin run smth asychonisly thru bukkit main thread?

runic minnow
#

yes, async has to work as my plugin is linked to discord

sterile token
#

Can u send your code?

#

I thinking you are running something async thru bukkit main thread

runic minnow
runic minnow
#

i'm not sure which code is giving an error

sterile token
#

How are u using the bot

#

Do you know how to use github?

tardy delta
eternal night
#

Probably just "are you blocking main thread with expensive operations"

runic minnow
runic minnow
tardy delta
#

imagine crashing the jvm thro heavy operations

#

only thing i achieved with computing large things on mainthread was all threads throwing an outofmem

runic minnow
#

jvm is so cute and so delicate

vocal cloud
#

JVM is actually pretty durable. Try C

tardy delta
vocal cloud
#

Yeah well if you write code so bad it crashes it then that says more about you than java

runic minnow
#

I wish you knew the reason for the collapse, u would talk like that

tardy delta
#

me doing hacky stuff again, lets just implement a proper deleteHome method ig

vocal cloud
#

Do you have the code somewhere for me to see? Or a full paste of the error

tardy delta
#

purpur kekw

runic minnow
#

that is my customer's server

#

i don't like too

snow sluice
#

How would i summon a pig with a saddle?

runic minnow
#

wear the saddle after spawn

grim ice
#

Man

vocal cloud
#

That's a very hilarious error. Are they running it with a bunch of experimental args or something

grim ice
#

@vocal cloud got an idea of how to obfuscate forge mods

vocal cloud
#

Yes, don't.

runic minnow
vocal cloud
#

So it's an issue on your end?

runic minnow
#

the server is getting this error first time

eternal night
#

looks more like a jvm bug

runic minnow
vocal cloud
#

Cause that's an issue with java itself. So either you're doing something you shouldn't or they are using a weird version of java

runic minnow
#

thx for helping

vocal cloud
#

Are they using openjdk?

runic minnow
#

idk i asked

vocal cloud
# runic minnow idk i asked

Lol I just realized that the paste has the args and it's a kilometer of junk. Try running the server using the exact args they have. They also appear to be using java 17 oracle so as long as you have that try that too.

wet breach
vocal cloud
#

This is from their client

crimson vault
#

Is there actually a plugin that simplifies the coding of inventories? For example, that you design an inventory in the game and then it is covendiert to Java code and it is then in a txt of the code to see? I hope I have explained this in a reasonably understandable way.. :9

wet breach
#

also any particular reason you have told it to not sharememory via command line?

wet breach
vocal cloud
#

Client as in person he's working for

wet breach
#

ok well the question still stands then

#

I recommend removing all the extra arguments as they are doing more harm then good

#

re-organize them to be proper

#

reduce the ram to about 10GB and no more then that unless you have a specific reason for assigning more

runic minnow
#

18G so strange

vocal cloud
#

Try copy pasting their args with native oracle jdk

crimson vault
runic minnow
wet breach
#

the problem is that GC is trying to collect from both sides of the heap but both sides of the heap are blocking the GC

runic minnow
crimson vault
#

sad

#

but thanks

wet breach
#

which is not a surprise given the arguments used on the command line

#

this is what happens when you mis-configure the GC arguments πŸ˜›

#

and why you need a profiler to know how some of those should be tuned

#

So what happened, is eden space filled up, but so did the survivor space

#

gc started on eden, but then it needed to take care of survivor and so forth until the JVM decided it must be locked and was like welp lets kill this

runic minnow
wet breach
#

not sure why that would matter

#

That is my synopsis of what happened without digging further into the binary stuff

#

the easy fix is to replace the arguments with the appropriate ones from aikar's flags

#

and set the memory to no more then 10G πŸ™‚

vocal cloud
#

Also if you're causing this issue your plugin might be using too much memory

wet breach
#

that is also possible to, but I mean with the current arguments it really wouldn't take much for that to happen

#

generating some chunks would have set it off eventually lmao

#

eden space is where new objects and stuff go, survivor space is where the new objects that haven't died off go

runic minnow
wet breach
#

generate enough new surviving objects and it would cause that to happen with the current configuration

vocal cloud
#

My point is that the only reason your plugin crashes it is because you reached that memory threshold. Either your plugin uses more memory than is reasonable or you got unlucky and your plugin pushed the unstable server over the edge

wet breach
#

basically this ^

vocal cloud
#

Either you make your plugin more memory efficient or they fix their args

wet breach
#

I think both should be done πŸ˜„

vocal cloud
#

Indeed

hard girder
#

Hi, i've some troubles trying to add a git into eclipse, i dont know how to import spigot.jar x')
can someone help ? thx

i have a folder containing the git with eclipse projects files (only .yml and .java)

vocal cloud
#

The server has 66GB of memory on it

#

But only 1.6GB free

runic minnow
#

My client is saying 'when setup your plugin after night server got the crash and server's latency was increasing by 200 300 ms from time to time.

vocal cloud
#

Again, either your code is garbage or the args are causing instability

runic minnow
#

thank u so much

#

have a nice day

vocal cloud
#

Mhm. Tell them to fix the args

runic minnow
#

i told

wet breach
#

?maven

undone axleBOT
vocal cloud
#

Isn't git integrated into eclipse like intellij?

wet breach
#

I don't know, I do recall there being a git plugin for eclipse of sorts

vocal cloud
#

Another reason to not use eclipse I suppose

wet breach
#

have no idea if they have finally integrated it or still require that. In either case eclipse has their own custom thing with git and maven lol

naive bolt
#

how do i get a block from block name like grass_block

vocal cloud
#

Using the material?

naive bolt
#

ty

vocal cloud
#

You can parse a material using a string unless that's changed

eternal oxide
#

Git and Maven are a part of Eclipse

#

just select File -> import

vocal cloud
#

That's what I thought

wet breach
vocal cloud
#

In port. You need to plug in your git cable

wet breach
#

lmao

hard girder
wet breach
#

start reading

#

and learning

#

also this I guess too

#

?learnjava

undone axleBOT
wet breach
#

these should help with some java learning while you are at it

vocal cloud
#

Important to learn about the ide you use. Too many people mess up their intellij config and complain about it later

hard girder
wet breach
#

I use Netbeans

#

does everything I need it to and never fails πŸ™‚

#

at least not yet

hard girder
wet breach
#

it does support java

vocal cloud
#

VS supports almost every language on the planet

#

Or rather VSC

#

VS is awful bloated garbage

wet breach
#

I have visual studio pro 2019 and 2015 πŸ˜„

vocal cloud
#

Why

wet breach
#

because it is the best in terms of compiling natives and creating natives as well

#

also I gain access to the MSI package stuff

vocal cloud
#

I hate having to use it when I need to

wet breach
#

MSI is super awesome and one of the best compression utilities if you know how to use it, Microsoft ironically doesn't know how

#

you can if properly tweaked compress 1GB down to like 200mb sometimes lmao

hard girder
#

VS doesnt support the import with pom.xml, like eclipse until now x')

wet breach
#

just install the plugins for it

#

that is all there is to it

vocal cloud
#

VS or VSCode

wet breach
#

VS is basically VSCode but like with way more options and utilities then you would ever need out of the box

#

VS on its own if you install everything, takes up like 100GB

hard girder
vocal cloud
#

Ugh

wet breach
#

they probably didn't install everything πŸ™‚

hard girder
#

huh x')
there is only 2 things i didnt download on vs

dire salmon
#

when im checking for a custom armor piece using getHelmet(), do i use .equals() or what?

grim ice
#

my dad just farted and the room sells radioactive help

#

Anyone there to analyze this?

#

is it safe?

vocal cloud
#

A user with 4 repos and 98 stars on it with a proton mail. Idk

misty current
#

if an itemstack equals another?

dire salmon
#

ye

#

kinda

#
if(player.getInventory().getHelmet().getItemMeta() == Crown.getItemMeta()){
                runningTasks.put(player, new TrailsTask(8, 0.5, 1));
                }```
hasty prawn
#

isSimilar

dire salmon
#

ok

#

do i need to get meta?

hasty prawn
#

No, isSimilar will check the meta for you

dire salmon
#

ok

#

so player.getInventory().getHelmet().isSimilar(Crown)

hasty prawn
#

mhm

dire salmon
#

ok thx

warped gulch
#

Hello.

dire salmon
#

what does this mean?
src/main/me/lucasgithuber/kingdoms/listeners/TrailsTask.java:[36,57] double cannot be dereferenced

#

Location particleLoc = player.getEyeHeight().add(x, y, z);

eternal oxide
#

getEyeLocation() not EyeHeight()

dire salmon
#

ok

#

it worked thanks

sterile token
#

LMao

#

Im back

#

My electricity went down

sterile token
#

For checking what classes, methods, fields, parameters, etc has a class

dire salmon
#

ok