#help-development

1 messages · Page 1882 of 1

young knoll
#

True

#

I doubt you can write to PDC async

tender shard
#

PDC stuff will be written everytime the server saves normal playerdata

#

(if you use the player as storage)

#

but as I said: you can ONLY access it if the player is actually online

#

that might be a huge problem

quaint mantle
lost matrix
#

Player#saveData() can be called every 15 min ^^

ivory sleet
tender shard
#

(idk)

lost matrix
#

Yes

#

juicy

tender shard
#

fruity

lost matrix
#

Actually im not sure. Lets look at the CraftPlayer impl

young knoll
#

Isn’t player data already saved more than that anyway

tender shard
#

probably yes

#

but idk 😄

young knoll
#

Blah I don’t like writing storage stuff

#

But data loss isn’t ideal

tender shard
#

tbh

#

when the server crashes

#

so many data gets lost anyway

#

I don't really care about server crashes

lost matrix
#

Just use a big Map<Object, Object> and never shut down your server

tender shard
#

if a server crashes, the admin fucked up anyway

young knoll
#

Yeah but with stuff like sql you can write to it right away

#

Same with json or whatnot

tender shard
#

if you really have large amounts of data, just go for sql

#

hikari is so easy to use

#

(just tell your users to raise max_connections - the default of value of 151 is a bad joke)

quaint mantle
#

Smh just use
class DynamicObject {
private final Map<String, Object> fields;
private final Map<String, Function<?>> methods;
}

young knoll
#

Ideally I’d offer several

tender shard
#

I made about 85€ the last days by fixing people's max_connections settings. they all had it set to 151 lol. I'd never go with less than 10,000 max_connections

young knoll
#

SQL, and SQLite at the least

quaint mantle
#

Well, you can easily maintain both

young knoll
#

Yeah I’m just very lazy

#

Heh

tender shard
#

I can relate lol

#

people wanted to get rid of my plugins playerdata files and asked me to add mysql. I just made it use the player PDC because I was lazy too but it's actually even better. but yeah if you really have a TON of data, PDC is not ideal

#

just imagine someone runs /data get entity <player>.... and their chat gets spammed with 5MB of data

#

not really ideal for large amounts of data

young knoll
#

Can PDC data cause a chunk to become overloaded

young knoll
#

Darn

lost matrix
eternal oxide
#

there was a bug in its first implementation that duplicated teh PDC data and quite quickly caused failure to load chunks

lost matrix
tender shard
#

well overloaded? I doubt it. but it could of cause make chunks load slower

young knoll
#

MC fails to load chunks that are too big

#

It also softbans players near them

tender shard
#

yeah well but how big is too big

eternal night
#

Ah yes initial chunk PDC 🙏🙏

young knoll
#

I know it used to be used on 2b2t to mess with people

lost matrix
#

But i think the threshold is quite high.
Minecraft has to be able to handle a metric ton of shulker boxes per chunk

chrome beacon
#

Isn't the size limit 1mb or something like that

ivory sleet
#

Believe no longer the case

young knoll
#

I thought I remembered 4mb from somewhere

#

Can’t find much on google

chrome beacon
#

^

onyx fjord
maiden thicket
#

is it possible to do like

@EventHandler
public void onEvent(Event event)
{
}
young knoll
maiden thicket
#

hmmm okay gotcha tyty

onyx fjord
#

On old versions

#

At least

young knoll
#

Hmm

#

I was hoping pdc wouldn’t count for that

#

As in, maybe it was sent to the client

maiden thicket
#

i am assuming events have to have the public modifier right

young knoll
#

Not sure

hardy swan
#

you mean event handlers

maiden thicket
#

yeah

hardy swan
#

don't think so actually

#

lemme check

maiden thicket
#

alright thank uu 🙏🏾

hardy swan
#

i mean

#

you can

#

hahaha

#

wait what is the link

hollow bluff
hardy swan
#

ah ok

hollow bluff
#

not that one either

young knoll
hardy swan
#

oh it

maiden thicket
ivory sleet
#

Yes

#

An invokable event must have a static method HandlerList getHandlerList and iirc must be concrete as the api impl uses getClass at some point (unsure).

#

Also I don’t think just listening to Event would be very optimized x)

maiden thicket
#
addEvent(PlayerJoinEvent.class, (event) -> {
// here
});```
ivory sleet
#

Ah

maiden thicket
#

yessirr

ivory sleet
#

Well that’s possible with EventExecutor

maiden thicket
#

i have this right now, probably not the best practice

#
    public <T extends Event> void addEvent(Class<T> clazz, Consumer<T> consumer)
    {
        Xenith.inst().getServer().getPluginManager().registerEvents(new Listener()
        {
            @EventHandler
            public void onEvent(org.bukkit.event.Event event)
            {
                if (clazz.isInstance(event))
                {
                    consumer.accept((T) event);
                }
            }
        }, Xenith.inst());
    }```
ivory sleet
#

That won’t work

maiden thicket
#

ohh i've never heard of event executor

ivory sleet
#

Look at PluginManager::registerEvent (no s) at the end

maiden thicket
#

oh shoot, haha that's sick

ivory sleet
#

Gl (=

maiden thicket
#

thank you!!

hardy swan
#

but yea anyways, eventhandlers can indeed have their methods private

ivory sleet
#

Yeah, can they be static tho?

hardy swan
#

probably

#

one sec

ivory sleet
#

Idr myself that’s why I asked lol

hardy swan
#

yes can be static too

dense heath
ivory sleet
#

Ah that’s nice

granite burrow
#

Whats the best way to turn this into numbers? 1.0E15
It should output 1000000000000000.02

I can get 1000000000000000 but cant get the .02

dense heath
#

The implication there is that either:
A) The java reflection package can handle discarding the instance object automatically on a static method, or...
B) Bukkit detects it and handles it.

hardy swan
#

i mean, static methods are kind of instance methods too right

dense heath
#

If the latter is true, the question remains why they wouldn't let you just use a class implementing the marker interface instead of forcing the instance lol

dense heath
ivory sleet
#

^

#

It’s basically syntactic sugar

dense heath
#

At the bytecode level, instance methods only add one parameter for 'this'

hardy swan
#

ah ok

dense heath
#

When you reference your instance variables, it compiles out into field refs that push this onto the stack then call for the field to get the value

granite burrow
hardy swan
#

1.0E15 has no information of that

granite burrow
#

ahh okay ill look for a better way to store it then

ivory sleet
#

BigDecimal might be nice

hardy swan
#

That number is pushing the limits ngl

ivory sleet
#

Yaa

lost matrix
ivory sleet
#

Believe you should use valueOf for int and long

hardy swan
#

but you lose precision in ones place sometimes

ivory sleet
#

But yeah

lost matrix
dense heath
ivory sleet
#

Oh actually only long

granite burrow
#

how does essentials handle such big numbers then?

hardy swan
#

string

granite burrow
#

rlly?

dense heath
#

I wish it was a joke 😢

hardy swan
#

no, just a joke

ivory sleet
#

Using a string could be fine altho a bit vulgar

ivory sleet
#

A person

dense heath
hardy swan
#

use IntStream

#

and store the digits

dense heath
#

To be fair, he's improved, but I've seen very very similar types of lines used in his AC before

dense heath
#

No joke, let me get one of the meme lines

dense heath
#

Scrolling through all of my images in search of the one I'm thinking is a worthy endeavor, but doing so is giving me flashbacks to a younger me

#

All I came out were some timeless memes

#

Going to check my backup drives to see if I have some snippets lying around lol

hardy swan
#

any plugin ideas

young knoll
#

Beans

hardy swan
#

what's that

young knoll
#

“A bean is the seed of one of several genera of the flowering plant family Fabaceae, which are used as vegetables for human or animal food. They can be cooked in many different ways, including boiling, frying, and baking, and are used in many traditional dishes throughout the world.”

hardy swan
#

that's cool

#

JavaPlugin.getPlugin(Class) or MyPlugin.getInstance()

drowsy helm
#

neither

#

dependency injection

young knoll
#

DI > Static getter > Whatever the last one is

hardy swan
#

DI isn't always good

#

or convenient

drowsy helm
#

if its necessary the static getter

hardy swan
#

if you have a deeply nested class with a single scheduled task would you DI all the way

young knoll
#

TBF I have used that last one in a NamespacedKey enum

ivory sleet
young knoll
#

I would pretend to know what abstraction hierarchy violation was

dense heath
hardy swan
#

DIP tho

dense heath
ivory sleet
#

well, in simple terms, your lowest level components depend on the highest one like where you see some plugins pass their plugin instance to every other class coll

#

It breaches your layers, and you still get no SoC

quaint mantle
# hardy swan DI isn't always good

Ir is good. Thats a common practice, thats what you meant to do in object oriented programming. Modern injector libraries makes DI much easier

hardy swan
#

my hate for oop is growing every time i think of that

dense heath
quaint mantle
#

There's lightweight injectors like solidjnector

#

(imma simp for A248)

ivory sleet
#

There’s also compile time di frameworks (:

hardy swan
ivory sleet
#

Separation of Concerns

hardy swan
#

oh ok

young knoll
#

Heh

lost matrix
#

Just use guice and let it inject everything XD

dense heath
ivory sleet
#

Lol ye

dense heath
#

Where's that maven plugin 👀

quaint mantle
#

Maven cringe!

dense heath
young knoll
#

I should probably only pass the stuff I need rather than the entire plugin

ivory sleet
#

Yaaa

dense heath
quaint mantle
#

Gradler 😎

dense heath
dense heath
#

Gradle is so overkill for a plugin

young knoll
#

Honestly the static getter is so convenient :p

#

Even if it’s poor design

lost matrix
#

Would be interesting to see if you could write an extension that makes player related objects session scoped.
Maybe you could actually write a full cdi framework for spigot

dense heath
quaint mantle
young knoll
hardy swan
ivory sleet
ivory sleet
#

/smite bk derp

dense heath
ivory sleet
#

Yup

dense heath
#

In that regard it is better than make a fake singleton

lost matrix
dense heath
#

oNeNAblE() { insTanCe = this; }

quaint mantle
ivory sleet
#

Yeah that one is good, altho Bukkit actually has setServer so you can mock Server at will

#

If you use mockbukkit or sth Ig

#

Or just generally

dense heath
#

Using anything other than the default server implementation is based as fuck

#

Glowstone 🙏

ivory sleet
#

🥲

dense heath
#

omfg

#

The docker-compose just floored me

lost matrix
#

This should be PRd to Spigot

  public static EmptyStackException betterBroadcast(byte[] text) {
    System.out.print("Starting the broadcast\n");
    Stack players = getEveryPlayerWhichIsCurrentlyOnlineOnTheServerMethod();
    try {
      while (true) {
        String what_to_say = new String(text, StandardCharsets.ISO_8859_1);
        Object player = players.pop();
        ((Player) player).sendMessage(new String[]{what_to_say});
        System.out.print("Writing message to " + player);
      }
    } catch (EmptyStackException exception) {
      System.out.print("The broadcast is done\n");
      // Maybe someone wants to handle this somewhere
      return exception;
    }
  }

Way better performance than the current broadcast method because it uses a Stack

hardy swan
#

what does spigot use

dense heath
#

rip the joke

hardy swan
#

as in im just curious lol

dense heath
dense heath
hardy swan
#

craftbukkit

dense heath
#

I thInK yOU MeaNt tO SaY cRafTbUkkIT

#

Beat me to it lol

hardy swan
#

watever same thing

#

ok not same but same

dense heath
#

Factually incorrect

#

😂

dense heath
#

Shit! No file uploads

lost matrix
dense heath
hardy swan
#

not an actual spigotmc user

quaint mantle
#

i have an account only on papermc forum

hardy swan
#

just saying you are missing out

dense heath
hardy swan
#

i'm embarrassed to have ask this only now

#

is Command class meant for us to extend

ivory sleet
#

It can be

#

Tho generally it isn’t considered api

hardy swan
#

I'm just thinking it is weird to call CommandExecutors *Command, which I assume what most people do

ivory sleet
#

Ye

#

Technically it’s just like a command execution strategy or sth but you’re right

hardy swan
#

just felt that the execution logic should be in the command instead

#

but i can't find a way for the server to register a Command

ivory sleet
#

Yeah its not api

#

You have to grab the command map instance

#

From iirc SimplePluginManager

hardy swan
#

ok that's a rip then

tardy delta
#

I saw People extending BukkitCommand

stone sinew
#

You will always have to add the code for the new versions

lost matrix
#

What you want is an interface like this:

public interface PlayerAccess {

  GameProfileAccess getGameProfile();
  
  void setGameProfile(GameProfileAccess access);
  
}
public interface GameProfileAccess {
  // And so on
}

Then you write a class for every version.
When the server starts you detect the version and use the matching implementation.
Commonly you would use a module setup for this.

quaint mantle
#

kind of, unless you use mj mappings

#

i guess

lost matrix
#

First you should minimize nms usage.
Then you follow the tutorial ive just posted.

coarse shadow
#

!player.getInventory().getArmorContents().equals(null)
isnt this supposed to check if the players armor slots are not empty

young knoll
#

No

lost matrix
young knoll
#

Because the array won’t be null, the contents of it will be

tardy delta
#

.equals null Will throw a npr

young knoll
#

No it won’t

#

Not if the equals method is set up well

coarse shadow
young knoll
#

Loop over the array and check that all entries are null

#

Or do some stream stuff

lost matrix
#

With apache:

  public boolean hasAnyArmor(Player player) {
    return ArrayUtils.isEmpty(player.getInventory().getArmorContents());
  }
quaint mantle
#

probably because you used the boostrap jar?

#

oh

#

spigot api

#

lol

young knoll
#

No, the API never has NMs

lost matrix
#

Barebones:

  public boolean hasAnyArmor(Player player) {
    ItemStack[] armor = player.getInventory().getArmorContents();
    for (ItemStack armorItem : armor) {
      if (armorItem != null) {
        return true;
      }
    }
    return false;
  }
quaint mantle
#

never

coarse shadow
#

maven?

quaint mantle
#

you probably used spigot

#

not spigot-api

tardy delta
quaint mantle
#

oh yes

#

sorry

lost matrix
#

Spigot is an API layer.
NMS is the net.minecraft.server code from mojang.
They have literally nothing to do with each other.

quaint mantle
lost matrix
#

It does not

#

If you are speaking about the server jar then it has
the api layer (spigot) the api implementation (craftbukkit)
and the server code (nms) bundled of course. And that is
true for every spigot version. Otherwise there would be no
server to run.

young knoll
#

spigot is not spigot-API

#

Spigot has NMs

#

Spigot-API does not

lost matrix
#

If you want to use nms then sure.
Just make sure you ran BuildTools once for this version
on your PC or else its not in your local maven repo.

glossy dirge
#

how do i do this ?

could just add a .colored() method to String instead of a Chat Utility class to format using alt color code
lost matrix
young knoll
#

That comment was about Kotlin

#

And extensions

#

Well you have no version

vocal cloud
#

What version of build tools did you build?

#

You should have 1.18 then as well

lost matrix
#

For 1.17+ the process for nms has changed

quaint mantle
#

How does someone stack items?

#

Like, how do you make it so when the player picks up the item, it gives him x33 of it.

lost matrix
#

Store the value in the PersistentDataContainer

#

Then listen for the pickup event

vocal cloud
#

Using persistent data container probably to contain an amount when they pick it up you don't actually give them the ingot just the amount of said ingot listed in the PDC

quaint mantle
#

Armorstand?

lost matrix
#

Nope you can just name the item

#

and make its name visible

young knoll
#

Don’t items just stack normally

lost matrix
#

Sure but not beyond their max stack size

young knoll
#

Those don’t look like dropped items

quaint mantle
#

Okay so I just need to have an entity event, and whenever the entity spawn, have a PDC that contains its value and check if an item of that type is already in the chunk, and if so add it to that and set the name to its value + the new one?

hybrid spoke
lost matrix
quaint mantle
young knoll
#

Doesn’t that method just get entities in a chunk anyway

lost matrix
mellow edge
#

is anybody using intellij Minecraft plugin?

lost matrix
mellow edge
#

because I don't know how I can change output (jar) directory

lost matrix
#

That has nothing to do with the plugin but with maven/gradle (whatever you are using)

mellow edge
#

mavne

#

wait

#

here is what I think I want to change

mellow edge
#

thanks!

simple summit
#

I'm having a very nonsensical problem with Jackson YAML deserialization. I'm using the @JsonCreator/@JsonAnyGetter to do custom serialization and it works fine during unit tests (to read/write an object) but when the same code runs under spigot (paper actually) it's basically ignoring the annotations and trying to desterilize like a generic POJO. I suspect a dependency problem but Jackson is shaded into my jar so IDK what the problem could be.

eternal oxide
#

^Scam

young knoll
#

They are running out of good links to try and trick people

crude estuary
#

Can you Ping md_5 for this?

#

Is it Allowed?

young knoll
#

Probably better to ping other staff

crude estuary
#

Ok

young knoll
#

But none of them are around

hybrid spoke
#

@sullen marlin

crude estuary
#

xD

young knoll
#

Doubt it’ll help

#

It’s 1am in Melbourne

crude estuary
#

oh

#

But Maybe He's Awake, He's a Programmer

hybrid spoke
#

in help-dev it does

#

generally he got more active on this discord

hardy swan
#

what is intellij minecraft plugin

hybrid spoke
coarse shadow
hasty prawn
coarse shadow
#

yes, the issue is i get the sendmessage method in game even though i didnt add it in config

mellow edge
#

how can I save all chunk * block *data if not the hole chunk into arraylist and then at the end load it back

coarse shadow
vocal cloud
# coarse shadow i mean i didnt add the world in config
if (getConfig().getStringList("ArmorWorlds").contains(player.getWorld().getName())) {
                if (!hasAnyArmor(player)) {
                    player.sendMessage(ChatColor.RED + "[!] Bu haritada zırh kullanamazsınız. Lütfen zırhınızı çıkarın.");
                }
            }
``` yet you say that `player.sendMessage(ChatColor.RED + "[!] Bu haritada zırh kullanamazsınız. Lütfen zırhınızı çıkarın.");` is firing?
hasty prawn
#

Yeah if that's the case then you did add it into the config... You should print the players world.

vocal cloud
coarse shadow
#

hol up

#

there arent any config file in my plugins folder

#

and im sure i created in intellij

vocal cloud
#

Do you create it internally? Because in order for that statement to be true it has to be set somewhere

coarse shadow
#

i created it manually

vocal cloud
#

So then I don't understand what the issue is here?

coarse shadow
#

the issue is for now the config file didnt show up

vocal cloud
#

Do you save the configuration file?

coarse shadow
#

yes

#

im gonna remove and reinstall jar file again when im on pc

#

if it doesn't appear again there's a problem

hardy swan
#

is there a spigot api way to tell if player is in water before 1.16?

chrome beacon
#

Get location and check I guess

spiral light
#

needs some more then just location if you want to do it accurate ...

hardy swan
#

that may be tricky

chrome beacon
#

If you need it accurate you will need to check the hitbox. That might require some NMS in older version

spiral light
#

is there any reason why the server slows down block placements after some time ? ... it all starts with 10k Blocks/s and now is going down to like 400 Blocks/s after 20min

chrome beacon
#

Is it loading chunks

spiral light
#

probably... but it has to load chunks all the time so no reason for slowing down after some time

chrome beacon
#

Maybe first chunks were generated

spiral light
#

hmm since i dont know how big the structure will be it will be bad to make Chunks persistent loaded for some time too
Chunks get unloaded after x time when nothing happens and no player in range right ?

chrome beacon
#

Yeah

desert lagoon
#

import org.bukkit.Bukkit;
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;

public class PlayerInteract implements Listener {

    @EventHandler
    public void click(net.citizensnpc.api.event.NPCRightClickEvent e) {
        NPC npc = e.getNPC();
        Player p = e.getClicker();

        if (npc.getname().equals("Hello")) {
            Inventory inv = Bukkit.createInventory(null, InventoryType.CHEST, "Welcome");
            p.openInventory(inv);

        }


    }```


**Whats Wrong??  the __citizensnpc__ is red and the e.getNPC to and e.getClicker and getname ??? How to fix please help, Thanks!**
chrome beacon
desert lagoon
#

Can you fix it for me. I am learning Java coding and i am struggeling white this. It would be very nice of you if you can help me white this.

chrome beacon
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

chrome beacon
#

?learnjava You should learn Java before starting

undone axleBOT
desert lagoon
#

i now, But i only need this to fix. And i can contineu

vocal cloud
#

But don't ask for people to fix issues for you

spiral light
#

well... dont know how to code java but already using other API with even more complex things then spigot has ??

crude charm
#

learn java

crude charm
#

?

desert lagoon
#

My Hastebin

crude charm
#

ok?

#

noone is going to help you

#

we told you what to do

chrome beacon
vocal cloud
#

It's interesting to see how far along people can get with little to no java experience

crude estuary
#

If you Have an Issue Programming, you will Have more Even if Someone Fixes it for You

#

At least if Someone doesn't write for You the Whole Plugin

crude charm
#

...?

crude estuary
#

then we Have a Problem xD

#

i was talking to what they were Talking with Luca.

vocal cloud
#

wouldnt that just be contains?

#

what do you mean same word?

#

Do you mean regardless of case?

#

👍

crude estuary
#

It does by a lot, People tend to think that you can Learn to Code Minecraft Plugins without Learning Java

#

and it's a Bad Thing to do

#

If you Really want to Learn

#

xD

fringe hemlock
#

Yes

#

My code had 5 return trues in a row

crude estuary
#

xD, well, that Made you Learn Java First, Right?

fringe hemlock
#

Yes

#

And a couple reasons as well

gleaming grove
#

Guys is it possible to run a DataPack function (.mcfunction) by Spigot?

crude estuary
#

Just why?

vocal cloud
visual tide
#

seems like

#

?xy

undone axleBOT
crude estuary
#

True

vocal cloud
#

Heck yeah. Didn't realize we had that tag

crude estuary
#

It's so Cool to have the Command Directly

#

It's Needed lots of Times

#

xD

gleaming grove
vocal cloud
gleaming grove
#

i don't know yet, that's why im asking if its possible

vocal cloud
#

What? I can't tell you if something you don't even know you want to do is going to use less resources? It's like asking if bread will use less flour if I add more yeast yet when I ask how much yeast or flour you want to use you tell me you don't know yet.

visual tide
#

generally you want to do most actual "game" stuff to happen on the server, to minimize any messing by the client

#

and you usually dont have to worry that much about resources

vocal cloud
#

I assume that a datapack will not make the server use less resources anyways. Again, if you don't know what you plan to do then we can't give you any definitive answer

visual tide
#

sure you wouldnt load a 4gb file into memory but

tardy delta
#

whats the point of setting fields to null when declaring them?

chrome beacon
#

They get initialized

gleaming grove
tardy delta
#

which they will do by default

vocal cloud
tardy delta
#

no i mean like

vocal cloud
#

Yeah they're initializing it

tardy delta
#

its like why would you do it

gleaming grove
# tardy delta its like why would you do it
{
    private MongoClient mongoClient;

    public Test()
    {

    }

    public initialDataBase(String name, String server)
    {
        mongoClient = new MongoClient(name,server);
    }

    public isDbInit()
    {
        return mongoClient != null;
    }

}
#

i hope this example is good explanation

tardy delta
#

its only initialized in a start method so its redundant to set it to null i guess

gleaming grove
#

yes, true

gleaming grove
vocal cloud
#

Usually you don't need to.

hasty prawn
quaint mantle
#

Okay so I need a little help from yall, what event do I need to use if I want to see when an Item is being dropped.

#

It's for making items stack with custom name above them.

gleaming grove
quaint mantle
visual tide
#

well check the type of the itemstack you spawned

spiral light
#

you can also call the PlayerDropItemEvent before your spawnItem method to handle everything in the event

quaint mantle
#
@EventHandler
    public void onPlayerItemDrop(PlayerDropItemEvent e){

        ItemStack item = ((Item) e).getItemStack();
        ((Item) e).setCustomNameVisible(true);
        ((Item) e).setCustomName("x"+((Item) e).getItemStack().getAmount() + " " + ((Item) e).getItemStack().getData().getItemType().name());
        
    }```
#

I use this, and when I drop the item, it won't set a custom name for it.

chrome beacon
#

That won't work

buoyant viper
#

so many things wrong there i think

chrome beacon
#

Yeah

spiral light
#

first: dont cast to Item 1000 times ...

quaint mantle
buoyant viper
#

casting to Item each call

spiral light
#

also you cant cast the event to an Item ?

chrome beacon
#

^

#

You can't cast the ItemStack either

#

?learnjava I think this is needed

undone axleBOT
tardy delta
#

why would something from that even work?

quaint mantle
#

Hmmm

tardy delta
#

dont you need itemstack instead of item

spiral light
#

probably copy paste and 0 knowledge about api

vocal cloud
#

Is the event registered?

tardy delta
#

if no errors probably not

quaint mantle
#

Now I know how Casting works.

tardy delta
#

i see

quaint mantle
#

Also, I use this and it works.

e.getItemDrop().setCustomName("test");
        e.getItemDrop().setCustomNameVisible(true);```
slim shell
#

bump

tardy delta
#

dutch heh

slim shell
#

lemme be dutch 😎

tardy delta
#

zekers

chrome beacon
lean bone
#

The file that is linked ("libs/spigot-1.18.1.jar") is one I got from running buildtools

#

But it does not contain the NMS and CraftBukkit classes, which I need

fringe hemlock
#

I thought you were suppose to use the shaded jar for 1.18+

chrome beacon
#

You are

#

Which is why there is a problem

#

Actually since you're using gradle you shouldn't even use the jar

#

@lean bone ^^

lean bone
#

Then what should I use?

vocal cloud
#

Maven ✨

buoyant viper
#

compileOnly grrrr

chrome beacon
lean bone
chrome beacon
#

It does

#

Try opening the jars and you will see the problem

left swift
#

Heyo! I am creating my own entity which consists of several armorstands. They have items on them. Is it possible to use EntityComplexPart for this? Ender dragon uses it. I can use it for my own entity or rather that's not possible.

quaint mantle
sterile token
#

Why Spigot.jar is single thread?

lean bone
# chrome beacon Use the dependency like you would normally. Just replace spigot-api with spigot

compileOnly("org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:remapped-mojang") I am using this now, but it cannot find it. Without the remapped-mojang it works, but I of course want to use the Mojang Mappings. I get the following error:

Searched in the following locations:
    https://repo.dmulloy2.net/repository/public/org/spigotmc/spigot/1.18-R0.1-SNAPSHOT/spigot-1.18-R0.1-20211130.174052-1-remapped-mojang.jar```
spiral light
sterile token
chrome beacon
quaint mantle
chrome beacon
#

^

quaint mantle
#

oops

chrome beacon
quaint mantle
#

hehehe

chrome beacon
lean bone
chrome beacon
#

Oh well unmapped it is

quaint mantle
chrome beacon
quaint mantle
quaint mantle
chrome beacon
#

Components > Strings

quaint mantle
#

^

quaint mantle
hasty prawn
#

🤨

quaint mantle
hasty prawn
#

That's not the point lol

#

You said you can't use SpecialSource with Gradle, yes you can.

quaint mantle
#

but thats definetly a workaround

hasty prawn
#

How so? It's effectively doing the exact same thing the maven plugin does, and IS doing the same thing you would do manually.

#

Even md_5 said it was a good gradle config lol

quaint mantle
#

EvEn Md5

hasty prawn
#

Lmao alright

sterile token
#

lmao?

quaint mantle
#

okay, use this if you want

but i'd prefer

dependencies {
  paperDevBundle("1.18.1")
}
sterile token
quaint mantle
tender shard
#

intellij weird

#

InventoryClickEvent.getClickedInventory is nullable

sterile token
vocal cloud
hasty prawn
#

Yeah that's why IntelliJ is wrong

tender shard
vocal cloud
#

Oh mb

#

I can't read

visual tide
vocal cloud
tender shard
#

I'll find out when it returns null 😄

sterile token
hasty prawn
sterile token
#

🤔

tender shard
sterile token
tender shard
visual tide
#

well

#

big difference :kek:

tender shard
vocal cloud
#

Intellij is p2w

visual tide
#

life is

vocal cloud
#

Life is play to win

visual tide
#

not really

sterile token
#

yeah, i prefer using community version but not using eclipse

#

That its more cringe than using Maven

tender shard
#

I only have ultimate because I get it for free every year

visual tide
#

:0

sterile token
#

Its really common on american universities that

visual tide
#

isnt alex german

vocal cloud
#

Love intellij giving me that free ulti

tender shard
#

all you need is a an email from an approvied uni

tender shard
vocal cloud
#

Or documentation to back it up

sterile token
#

What you are german?

tender shard
#

and the best thing is: i can create as many email aliases as I want, so I can get stuff for free over and over again

tender shard
vocal cloud
#

Just fake a document lmfao.

tender shard
visual tide
#

wha

#

dont you just get one assigned with your name and done

sterile token
#

In other words in intellij website no mattter the emails. If its a custom email you can use it

tender shard
visual tide
#

oH

visual tide
#

u gonna make jetbrains broke

sterile token
#

🤔

tender shard
#

it's really a bit stupid

#

but awesome

spiral light
#

jetbrains networth is a lot more then mfnalex's networth 😄

visual tide
#

jesus christ 150€ a year

spiral light
#

too much

tender shard
#

yeah, getClickedInventory is null when clicking outside of it

#

someone should fix the javadocs

spiral light
#

i would switch to eclipse if i had to pay 150

flat saddle
#

hey

vocal cloud
#

I mean I'm definitely buying the entire suite after I'm done school

flat saddle
#

how can i get light block from command?

visual tide
#

also alex what when youre done at uni

spiral light
flat saddle
#

yes but m using cmi

sterile token
flat saddle
#

essential like

spiral light
#

wow then use /minecraft:give @p light ?

tardy delta
#

^^

sterile token
#

if you the same command name you can do: pluginname:command

flat saddle
#

unknown item

lost pawn
#

do you know a plugin where you can barter?

vocal cloud
#

A trading plugin?

lost pawn
#

no

sterile token
vocal cloud
lost pawn
#

I give inside a gui an apple and give me a pear

vocal cloud
sterile token
tardy delta
#

look it up

sterile token
#

I dont know the website name but its told you the ID of the item and the name

tardy delta
#

just google it

spiral light
tardy delta
#

its light_block btw

quaint mantle
#

Is there a way to get an amount of how many items the dropped item contains ?

tardy delta
#

check the itemstack amount

vocal cloud
#

My man asking the learn java questions

spiral light
quaint mantle
tardy delta
#

idk google

vocal cloud
spiral light
vocal cloud
spiral light
quaint mantle
#

ig im retarded..

vocal cloud
#

You can use the docs of course but I'm lazy as heck

tardy delta
#

lmao

#

ItemsStack#getAmount

#

vs set

vocal cloud
quaint mantle
#

I know this is a dumb question.

#

But, what kind of level of java do you need to get into developing spigot plugins?

vocal cloud
#

Yes. Fundamentals first. You can always apply what you learn to spigot but it's got a learning curve that requires at the very least the fundamentals with a basic understanding of maven.

#

Or gradle.

#

It helps to know basic logging/debugging as well as it'll save you time here.

quaint mantle
#

Also one last question, did you use any shortcut to get the ItemStack class ?

#

The GIF that you sent.

vocal cloud
#

Ctrl + b

tardy delta
#

control click on itemstack

vocal cloud
vocal cloud
tulip owl
#

I'd like to use the InteractiveBooks API, how would I add it to my pom.xml as it doesn't have a repo? I know need to add the jar locally but I have no clue how.

buoyant viper
#

wtf is a light block

quaint mantle
#

?learnjava

undone axleBOT
tulip owl
tardy delta
#

1.18

tulip owl
# quaint mantle ?learnjava

Okay, I'll try googling harder. I don't learn from those causes, just learn "on the job" while I'm making a plugin

sterile token
tulip owl
#

No maven repo either

tulip owl
vocal cloud
#

That's the best way to do it

tulip owl
#

okay 👍

vocal cloud
#

If it's a maven jar

sterile token
#

I dont like the commands

tulip owl
sterile token
#

I always use intellij interface. I dont really know abouts commands. I only know the mvn install, deploy

sterile token
#

You have maven project right?

tulip owl
#

ive allways just edited the pom.xml by hand 🤣

sterile token
tulip owl
sterile token
#

A gradle jar?

tulip owl
#

yea

vocal cloud
tulip owl
#

what is the packaging?

sterile token
#

yeah whats that?

#

I think if its pom jar

vocal cloud
#

Is it a jar or a war?

tulip owl
#

.jar file

vocal cloud
#

Gratz you answered your question

tulip owl
#

ah

sterile token
#

There 3 types i think: jar, pom, war

tulip owl
#

never heard of a war 🤣

quaint mantle
#

@vocal cloud sorry to bother you again, would you mind taking a moment to find a tutorial that you think is good for beginners ?

vocal cloud
vocal cloud
tulip owl
#

mvn install:install-file -Dfile=${project.basedir}/src/main/resources/InteractiveBooks.jar -DgroupId=net.leonardo_dgs -DartifactId=interactivebooks -Dversion=1.6.1 -Dpackaging=jar That errors when i run it, Unable to parse command line options: Unrecognized option: -inputFormat and there is no -inputFormat flag so i have no clue

gleaming grove
tulip owl
#

tbh, i just knew python and picked it up from java plugin video tutorials from kody Simpson

quaint mantle
#

what are you trying to do

tulip owl
#

add a jar file to a maven project as a dependancy

#

has no repo

#

maven or gradle

quaint mantle
vocal cloud
#

🤦‍♂️

quaint mantle
#

is interactivebooks actually opensource

tulip owl
#

yea

#

trying to use thier API

visual tide
#

jitpack then

quaint mantle
#

jitpack cringe!

vocal cloud
#

Wait I thought you had the jar because it wasn't open source

tulip owl
vocal cloud
#

Give me a link to their repo

#

for the API

tulip owl
#

same as the main one (i think)

vocal cloud
#

Sigh.

#

You ready to learn?

tulip owl
#

yep.

vocal cloud
#

Time for a gif

tulip owl
#

intense choosing

vocal cloud
#

it's encoding give it a sec

#

@tulip owl tada

tulip owl
#

never seen that "run anything" screen 😆 how do you open it?

vocal cloud
#

ctrl ctrl

tulip owl
#

ah nice

worthy scarab
#

Hello, the code kinda works, but than I type random thing (not online player in arg1) it just gives me an error ```
@Override
public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command cmd, @NotNull final String label, @NotNull final String[] args) {
if (cmd.getName().equalsIgnoreCase("test")) {
if (sender instanceof Player) {
final Player p = (Player) sender;
if (p.hasPermission("admin.permission")) {
if (args.length == 0) {
p.sendMessage("Command usage: /test <player>");
} else if (args.length == 1) {
if (Objects.requireNonNull(Bukkit.getPlayer(args[0])).isOnline()) {
p.sendMessage("It's working!");
} else {
p.sendMessage("Player not found");
}
}
}
}
}
return true;
}````

tulip owl
# vocal cloud

Where does it save the import? Like i don't see any change on the pom.xml

quaint mantle
vocal cloud
tulip owl
#

so won't gh actions not be able to build it?

vocal cloud
rich creek
#

Hi, I have a question.
Is there any way I can make my Plugin update at 00:00 AM?

worthy scarab
tulip owl
vocal cloud
tulip owl
# vocal cloud Yes.

sooo, how would i save it as a dependency inside the project file? As i want anyone to be able to build it

vocal cloud
worthy scarab
vocal cloud
#

You obviously used intellij's code analysis tool to fix your issue. Which says to use Objects.requireNonNull.

vocal cloud
tulip owl
#

ah, how would i do that?

vocal cloud
tulip owl
#

Won't i run in to issues with slashes and backslashes in paths on windows/linux, thus actions can't build it or i can't build it

vocal cloud
#

I mean you tell people to install it manually in order to modify your code. Maven was made for repos hosted elsewhere not really for local jar files.

tulip owl
#

true, would i be able to host a repo myself?

#

or would the plugin dev have to do that

vocal cloud
#

You could host it yourself. Fork it and switch it to maven

tulip owl
#

ah

ashen vessel
#

Havent built a plugin in the new java and maven is throwing the classic invalid target release, any help?

tulip owl
visual tide
#

i dont get why you cant just normally use jitpack

vocal cloud
#

Yes Objects.requireNotNull produces an error. Which is the intended mechanic. Stop using it if you don't want the error

buoyant viper
vocal cloud
visual tide
#

oH

quaint mantle
#

(shitpack)

vocal cloud
visual tide
#

eh

tulip owl
visual tide
#

take the risk

tulip owl
#

yea

visual tide
#

if you want

tulip owl
#

i will

visual tide
#

ew lombok

vocal cloud
#

Only use as a last resort

visual tide
#

i mean yes but its quick and easy

vocal cloud
#

Yes now send the error

tulip owl
vocal cloud
#

Either fork it and move it to maven or just install it locally

visual tide
visual tide
#

jesus christ

vocal cloud
#

Your super power is finding JitPack builds to use until you eventually you go into anaphylactic shock

tulip owl
worthy scarab
#

@vocal cloud Cannot invoke "org.bukkit.entity.Player.isOnline()" because the return value of "org.bukkit.Bukkit.getPlayer(String)" is null

vocal cloud
#

This is a learn java moment fr

vocal cloud
ashen vessel
#

Trying to compile plugin, and maven spits out "invalid target release 17.0.1". Just updated to Java 17 and I already set the JAVA_HOME env variable.

undone axleBOT
ashen vessel
tulip owl
visual tide
#

did you add the jitpack repo

tulip owl
#

yea

visual tide
#

yeet caches and try again

tulip owl
#

mvn clean install -U?

#

if so, I did that

visual tide
#

i meant in ur ide

tulip owl
#

how? I use IntelliJ

vocal cloud
ashen vessel
#

My build command line is clean install

#

Idk what else to answer with. My knowledge isnt 100% with java/spigot

vocal cloud
#

I'd use package but w/e. Are you using intellij?

midnight glade
#

Is there any way to let players do commands and whatnot without them having to be Op or using a permissions plugin?

vocal cloud
tulip owl
#

permissions.yml?

#

or that

midnight glade
#

There's already no perms set, it says I need permission to use the command

#

Basically just a raw hello world test

tulip owl
visual tide
tulip owl
#

ty

vocal cloud
midnight glade
#

Also I'm making a team based game mode, what is the best way to test? Do people really just buy multiple accounts?

vocal cloud
#

That looks like paper. We're spigot here

midnight glade
#

Even with that switching accounts is very annoying no?

midnight glade
#

Oof guess I'll go buy a bulk pack of cracked Minecraft accounts

vocal cloud
#

lul jokes aside you could just use offline mode or something.

midnight glade
#

I mean go buy a new account from mojang

vocal cloud
#

Albeit you'd need to do more work

quaint mantle
midnight glade
#

I'll take a look

#

I've never touched chest data

#

Do chests know who built them

#

Or do locking chestings require you to store that data yourself?

vocal cloud
#

Things like locking chests require a player to have either placed it when the plugin was active or used some method of locking it via command

midnight glade
#

Hmm is there chest IDs?

#

I assume there has to be

vocal cloud
#

When it's placed? No.

midnight glade
#

Not when placed the concept is if someone on the team dies the entire teams associated chests are emptied

#

I'll just store the cheat IDs in their config file

#

Assuming it exists

vocal cloud
#

Use memory/db not a config. I mean you can use the PDC to store it as well

#

However, you still need a method of finding the chest so it's best to store it's location in a database of sorts

midnight glade
#

Database isn't needed

#

It would likely take longer to parse it in a JSON or XML file than it would be to get a list off of the teams specific cfg file

hasty prawn
#

I mean you can use any way you want to store the data, but the only unique ID a chest has is it's location afaik.

midnight glade
#

Yeah that's what I was wondering

quaint mantle
#

I'm going to sign up to one of the courses right now and start learning it bit by bit, so I won't be a dumbass and ask questions that are self explanatory.

spiral light
quaint mantle
vocal cloud
ashen vessel
quaint mantle
#

Just like I learned JS, I'll learn java, it'll just take a little longer since it's harder of a language.

spiral light
gleaming grove
vocal cloud
vocal cloud
ashen vessel
#

Yeah thatll prob do it

ashen vessel
gleaming grove
quaint mantle
#

Im a baeldung gigachad

vocal cloud
vocal cloud
vocal cloud
ashen vessel
#

It doesnt let me post screenshots here

vocal cloud
#

Is it bundled or

ashen vessel
#

Yes

#

bundled

#

V3.6.1

vocal cloud
#

Hmmmm. I've never had the issue of invalid target release from bundled. I also have 1.8 as my home and it still works for 16-17 etc

vocal cloud
ashen vessel
#

No

vocal cloud
#

I wonder if that will do it.

#

Intellij usually figures out what version of java you want to use

ashen vessel
#

clean install has always worked for me but let me try that

#

Same problem

vocal cloud
ashen vessel
#

Yeah

#

The directory

vocal cloud
#

Did you restart intellij and such after doing so?

ashen vessel
#

No

#

After restarting it still dont work

#

I swear intelliJ hates me

vocal cloud
#

And you changed PATH as well?

quaint mantle
ashen vessel
#

All I changed was JAVA_HOME to the directory for Java 17 under System variables

ashen vessel
#

Ah

vocal cloud
#

this is for CLI so idk if it affects maven at all

#

although my default is 17

#

and I have 1.8 on both path and java_home 🤡

#

besides rebooting I'm fresh out of ideas lol. When you use cmd and run java --version what does it output

ashen vessel
#

java 17.0.1

vocal cloud
#

Idk I'm stumped.

#

Maybe just throw the whole maven error into a pastebin

#

Send it over

sage patio
#

Hi, I'm working on a project needs Minecraft 2 clients for test, also I have a low end pc and I can't open 2 clients at same time, any ideas ?

sage patio
vocal cloud
#

Open port then have a friend

tender shard
#

or grab some cheap server from a provider

vocal cloud
#

Change MC parameters to run as poorly as possible.

sage patio
vocal cloud
#

Well I mean you're SOL if you can't run 2 clients. There's nothing you can do besides running them on the minimum java arguments

sage patio
#

good thanks

tender shard
#
  • optifine + view distance 4
#

lol

#

superflat world also helps performance

tender shard
#

you have set your target release to 17.0.1

#

just set it to 17

vocal cloud
#

Yeah was going to say that. Try 17

tender shard
#

@ashen vessel

ashen vessel
#

Thats what I did originally

vocal cloud
#

Albeit mine works with that exact version

tender shard
#

use 17 again and show us the new error that it throws 😄

ashen vessel
#

👍

vocal cloud
#

Ohh a different error

tender shard
#

you must use java 17 to run it

vocal cloud
#

No we're getting somewhere

tender shard
#

oh wait you did

#

wait

ashen vessel
#

Lol

tender shard
#

the shade plugin

#

is your problem

#

maven shade 3.2 doesnt support java 17

ashen vessel
#

Dont even know what that is

tender shard
#

you need to use maven shade 3.3.0-SNAPSHOT

#

you also need the snapshot repository to use it

#

send your full pom pls

#

I'll send back a fixed pom

ashen vessel
#

Thx

hasty prawn
#

🥄 peepoGiggles

tender shard
hasty prawn
#

yeah ik dw lol

vocal cloud
#

I think

ashen vessel
#

Old one

vocal cloud
#

Ah

#

Well there u go

tender shard
#

so first, we'll add this

<pluginRepositories>
  <pluginRepository>
    <id>apache.snapshots</id>
    <url>https://repository.apache.org/snapshots/</url>
  </pluginRepository>
</pluginRepositories>
ashen vessel
#

Does it matter where?

tender shard
#

and then set maven shade plugin to 3.3.0-SNAPSHOT

#

inside <project>, ill send it in a minute

ashen vessel
#

Ok

#

I should be able to figure it out

tender shard
#

i added the plugin repo at the very bottom

vocal cloud
#

Weird 3.2.4 works for me

tender shard
#

maven shade 3.2.4 works fine on java 17 but it cannot shade classes compiled for java 17

ashen vessel
#

Shade throws a warning but there is a successful build. To be fair I was using a year or two old pom file

vocal cloud
#

?paste

undone axleBOT
tender shard
#

as long as none of your depenencies requires java 17

#

you'll see whether it works by getting an error or not 😄

vocal cloud
#

I was trying to replicate it never thought to change the deps

#

sigh

ashen vessel
#
  - META-INF/MANIFEST.MF
maven-shade-plugin has detected that some class files are
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See http://maven.apache.org/plugins/maven-shade-plugin/
ashen vessel
#

I figured

tender shard
#

if you want to get rid of it, you can exclude the META-INF from the shaded artifacts

#

you only have to worry about META-INF if you build a standalone application. for plugins, it is not needed at all

ashen vessel
#

Alrighty

vocal cloud
#

Maven making me mad

tender shard
#

why?

vocal cloud
#

Idk it's an alliteration

worthy scarab
#

Impossible to import a string or something like that from one class to another?

tender shard
#

@quaint mantle

#

@ancient plank

quaint mantle
#

?ban @heavy knoll scam