#help-development

1 messages Β· Page 729 of 1

young knoll
#

Those are common here

#

Don’t worry

ivory sleet
#

^ this as well alongside whats called open source projects where there can be thousands of contributors

barren nacelle
#

I keep getting this error : "org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!" because i'm initializing the plugin twice, how do I not

#

That was my question

wraith apex
#

Starting again from a clean slate, my point, put simply is yes for the vast amount of variables encapsulation is great. But there are edge cases where its more annoying than useful. In a usecase where you're developing a plugin for personal use and are going to use it with other plugins, the likley hood another plugin dev who has never heard of your plugin, attempting to disable and cripple it is almost 0. At that point it's malware and shouldn't even be on spigot. Race conditions yes. If you're threading then it's very dumb to not use it. If I wanted to protect my variables from invalid write or read requests I'd be on it all day. Nothing is perfect. I could bypass the method with reflection and set it to null if I wanted. Or some JVM trickery. It's not going to kill someone if the instance of the main plugin is public. That's all.

barren nacelle
#

Maybe I said it wrong

kind hatch
wraith apex
young knoll
ivory sleet
young knoll
#

?di

undone axleBOT
young knoll
#

Stupid bot is case sensitive smh

ivory sleet
#

I think it may be fine for certain singletons, esp if they are eager ones

wraith apex
#

If a getter's only purpose for the variable is supervises is to provide the variable and there is no other validation logic, or threading, I don't see why it needs a getter

barren nacelle
ivory sleet
#

the issue is that you rarely know if a getter's only purpose is ever going to be that of a vessel just acting as a bridge to the field invocation

#

i mean sure we can assume that

#

but that also presupposed that we never use that class in a situation where it is exposed to situations that may widen its usecase

#

or well that variable at least

wraith apex
ivory sleet
#

this especially in light of that I wanna avoid writing proxy patterns and adapter patterns for poorly written apis just to have that binary compatibility

wraith apex
#

they always seem to grow

ivory sleet
wraith apex
#

well yes

ivory sleet
#

functional and non functional

wraith apex
#

However, a private instance doesn't stop me from killing a plugin

#

there are many ways one can do that

ivory sleet
#

i mean if you wanna write mal code thats hella easy to do

#

just about anywhere

wraith apex
#

yeah

#

you might want to protect instance if you're doing other things in the main class?

#

other than onEnable and onDisable?

#

personally I'd delegate those to other classes hence the S.O.L.I.D principles

ivory sleet
#

from what I have been taught and what I learnt its rather about trying to show our intentions in code

#

as good as possible

wraith apex
#

aye

barren nacelle
wraith apex
ivory sleet
#

i mean whilst keeping it maintainable and extendable etc :>

wraith apex
#

oh ofc :>

barren nacelle
#

Should I open a thread instead?

wraith apex
#

ye

#

discord needs tabs

ivory sleet
#

optional, I wrote a pinned message about it tho no1 really cares

wraith apex
#

so I can talk in 2 places

ivory sleet
#

fr

wraith apex
#

or multiple

#

there is a game framework for java, I think it's LibGDX, you'll faint when you see how many public vars it has lol

ivory sleet
#

ugh

#

i can only think of constants

#

thats when imo it would be fine

barren nacelle
#

I keep getting this error : "org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentExce

quaint mantle
#

Is there a way to config the clean task to not clean certain moduels? I dont want my nms modules to be cleaned

#

since it takes like 40s per

#

and i have 7

ivory sleet
#

gradle?

quaint mantle
#

yes

prime reef
#

@wraith apex I tried to type an actual apology and got hit with the "contains content blocked by server owners" message, I have literally no idea what I would have said that triggered that

ivory sleet
#

you can define a lifecycle task

prime reef
#

originally meant to DM it but it wouldn't go through so

ivory sleet
#

that just composes the clean tasks of said modules

young knoll
#

Ooh find the filtered word

wraith apex
young knoll
#

My favourite game

wraith apex
#

we both get hot headed :D

prime reef
#

not that this excuses it but I think work/home stress are just spilling over into other shit lately πŸ’€

wraith apex
#

The secret is my coconut scented candle

prime reef
#

maybe I should invest in one lmfao

wraith apex
#

it has a calming effect

#

Search for WoodWick Island Coconut

#

πŸ‘Œ

prime reef
#

shit, it's popular

wraith apex
#

aw :c

prime reef
#

raincheck time

wraith apex
#

it's great

prime reef
#

oh yeah, I originally did come in here to ask a question - has anyone worked with the JNI through Spigot?

#

the Java GC isn't super performance friendly sometimes, even with object reuse

#

would rather just hit it with the C++ treatment

wraith apex
#

I heard GC is pointless since a call to GC is only a oh would you pleeeease gc this?

ivory sleet
#

have u tried optimize gc first?

echo basalt
#

it's not great

prime reef
#

it's like someone tried to memory management and then didn't

echo basalt
#

it's cool for uhh

#

Spark

ivory sleet
#

its disabled for most jvm instances

prime reef
#

for the server

ivory sleet
#

jvm flags

prime reef
#

Yeah, those

#

yeah I do have that running

ivory sleet
#

yeah well they have a steep learning curve

prime reef
#

I'm trying to think of a way to simulate how this stuff would get used in an actual environment

ivory sleet
#

i still dont get some of them

prime reef
#

it's okay I've been working with what I do at my job for over a year and I still don't understand about 70% of it

prime reef
#

plus shit like raycasting

#

guess I'll have to write some kind of test plugin to break the server first

#

i'm absolutely terrible at profiling plugins, haven't really worked with spigot for a couple years so idk what tools people even use anymore

wraith apex
#

Spigot devs when they shade their plugin with 2tb of node modules because it has an inbuilt web server

prime reef
#

sweats

wraith apex
#

4.5mb

#

lol

prime reef
#

it contains the entirety of jackson, unfortunately

wraith apex
#

this has no libs

#

this is all me

prime reef
#

it's actually not that much code

wraith apex
#

oh

prime reef
#

my unshaded jar is like 1/10 the size

wraith apex
prime reef
#

bro wrote a comprehensive solution to all spigot problems

echo basalt
#

think I've made a 1mb plugin before

#

with nothing shaded

prime reef
#

just kidding, you'd need to fork spigot

echo basalt
#

was like 45k lines

prime reef
#

i've got one that's uhh

#

325kb? but that's only about 30% done because I got an actual job and just left it on the backburner

wraith apex
prime reef
#

looks really clean too

wraith apex
#

blueprint plugin for survival

prime reef
#

factorio energy

wraith apex
#

allows players to create, store, rotate, mirror, copy, and paste blueprints of builds

#

it's to encourage bigger base building

prime reef
#

not much of a builder and the lack of a blueprint system is probably why tbh

wraith apex
#

lol

#

well for mega bases

#

I was a builder before I was dev

#

in like 2013

prime reef
#

is this for a server?

wraith apex
#

yup

prime reef
#

ah, alright, having an actual purpose probably helps too lmao

#

I kinda lost motivation to work on any plugin stuff once I stopped working on servers lmao

wraith apex
#

pivoted too many times and I'm stick of re-inventing the server every year

#

so I'm sticking to Minecraft is a lego game and will be treated as such

#

so SMP with some roleplaying basically

#

also did some re-inventing with /home and /tpa

#

tpa stuff allows someone to automate the process of a teleport request. If you trust a player, they can just tp to you. No need to keep asking

#

can also just block others from asking to tp to you

#

or leave them on request only

prime reef
#

yeah I was uh

working on basically a full-scale RPG overhaul with support for shit like Overwatch-style barriers and completely custom models + skins + animations for classes

i am genuinely not trying to one up anyone here, especially because i never finished it. it was such a pain in the ass lmao

wraith apex
#

kinda sad I came up with a name for this plugin long ago only for Intel to nick it for their GPU's

echo basalt
#

me naming my skyblock core "SkyblockCore"

prime reef
#

i'm surprised that's not in normal TPA plugins actually

wraith apex
prime reef
wraith apex
#

oh wait I have something else neat

prime reef
#

if you want you can just do vanilla+

#

or you can go full mmo

#

but that results in really stupid shit like uhh

wraith apex
prime reef
#

rpg servers are pain

#

fortunately i have never tried to make one myself, this is purely the plugin

#

yeah you get stupid shit like this

#

which exists solely to let people configure conversions from vanilla damage to whatever damage system they have in place in a way that doesn't look insane in config

wraith apex
#

(waiting for ms to let me log in)

#

they pos

prime reef
#

and then you end up with this massive setup lmfao

wraith apex
#

after 1.19 hit with the in-game reporting bs, I decided it was a good time to build my own chat

prime reef
#

modules is literally just extra code the plugin can load for extra NPC behaviours/abilities/etc.

wraith apex
prime reef
#

unironically

#

does your plugin just yoink incoming chat messages and put them through a relay server somehow, or?

wraith apex
#

cancels the chat event

#

and sends them through the server

#

as if it's a server message

prime reef
#

always think it's neat when a plugin just completely disregards spigot/minecraft conventions and does something else

wraith apex
#

can't report the server for cussing πŸ‘

prime reef
#

is that a workaround for the MS stuff?

wraith apex
#

yup

#

it works

prime reef
#

kind of insane that they did that in the first place tbh

wraith apex
#

and yes there is a setting in spigot

#

to disable chat auth

#

but I'd rather not have it accidently turn on one day

young knoll
#

Tbh I’m surprised no public tpa plugins have a trust system

#

At least none that I know

prime reef
#

right? it seems like common sense

#

i think this might actually be the same rpg plugin, but this gif is from like 2016

#

think I was 17 at the time so the code was awful though

#

basically gutted and rewrote it when I came back to it a few years back

young knoll
#

Poor creepers

prime reef
#

I still have no idea how the game actually orders entities

#

my intent was to pull a DVD screensaver and go back and forth across the center of the circle, but I did not have the know-how for that at the time

#

is it by UUID or something?

young knoll
#

No idea

#

Might be by time spawned or entity id

wraith apex
#

Chat QOL, players can personalise how they want their chat to look like for them

prime reef
#

oh that's nice, i actually was doing something similar for the rpg plugin i had

young knoll
#

Chat bubbles are cool

prime reef
#

yeah I was just about to say

wraith apex
#

it's like Habbo Hotel lol

prime reef
#

this definitely goes beyond just chat formatting lmao

wraith apex
#

if you get that reference

prime reef
#

or gmod

#

worlds online wants to know your location

#

nexpo did an excellent video about that one, actually

kind hatch
prime reef
#

the little blip sound for chat is a nice touch too

young knoll
#

Should be a ghast scream

kind hatch
#

lmao

wraith apex
#

but I actually did lol

#

this is all custom coded by me

#

tis not on spigot anywhere

#

unless someone has hacked me for my source code

prime reef
#

i thought about implementing DRM not because I care about piracy but just to be spiteful ngl

young knoll
#

Quick someone steal his ideas and make them public!

prime reef
#

and doing it in a way that makes it nearly impossible to disentangle it from the plugin code so someone can't just decompile and edit like one line of it lmao

wraith apex
young knoll
#

Dark yellow spigot

prime reef
#

which

#

i can't even think of a way to do that offhand lmao

prime reef
#

write your entire plugin in native code

#

compile to dll

wraith apex
#

LOL

#

compile to x86 assembly

#

lets goooo

prime reef
#

me when my code runs on a 10 year old ARM processor but not my own CPU

wraith apex
#

I need some leverage/reason for people to join heheh

#

we even have a block bank

#

:)

prime reef
#

well, I guess having a plugin that's a pain in the ass to set up properly is another form of DRM

#

I was considering having the plugin .jar double as a config tool, tbh

#

but like

that's work

#

dunno if anyone's done that before, haven't seen it

wraith apex
#

the only 'good' way to have a plugin that cannot be pirated

prime reef
#

"is to make it free"

#

kidding, go on

wraith apex
#

is a plugin that makes calls to another server that actually has the code on it

#

the plugin you buy is a skeleton plugin

#

and needs a license key

prime reef
#

yeah that's one way to go about it, i don't really know how feasible that would be for a particularly demanding plugin

#

for something with minimal throughput, though? for sure

#

the native/dll approach could actually work to some extent

#

use native code for anything related to actual performance and treat java as a glorified schema/config loader

wraith apex
#

What I'm working on atm, my own land claim plugin. Why? Lands is money and Grief prevention sucks ass

prime reef
#

if auth fails then just have the dll break

wraith apex
#

Land claim plugins are a bloody rabbit hole of their own

prime reef
#

reminds me

#

server I used to work on was gonna have like, a towns plugin

#

it's been two years and apparently the guy who was working on it hasn't finished it yet

#

have I finished my rpg plugin? no, but i also haven't touched it in 14 months.

wraith apex
#

lol

prime reef
#

14? 16

kind hatch
#

I should attempt a land claim plugin. It'd probably pretty easy with the chunk pdc now.

prime reef
#

oh yeah that was my other question, i just remembered

young knoll
#

All fun and games until you want non-chunk aligned claims

prime reef
#

how feasible do y'all think it would be to write a plugin that's capable of creating artificial players that actually play the game

wraith apex
kind hatch
prime reef
#

there's a gmod addon that does this for gmod sandbox, it's what gave me the idea

prime reef
wraith apex
prime reef
#

majority are strictly chunk based

wraith apex
#

(from outside a claim)

prime reef
#

😳

wraith apex
#

instead of checking everytime player moves

#

or running logic when they move

#

just check if they've moved chunk

#

lot less calls

kind hatch
#

I can't imagine how much work would need to be done for a non chunk system that is easy to use.

#

At least chunk based systems are easy enough to make and gets the job done.

prime reef
prime reef
#

circles are really easy to check

wraith apex
#

it fires but nothing comes out

#

which is fine I guess

prime reef
#

it's also easy to check a regular quadrilateral for whether a specific tile falls into its boundaries

#

or any rectangular prism, if your claims work in 3 dimensions

#

if you want to start doing stuff like convex hull claims it's more complicated

wraith apex
#

each chunk I can check relative from 0,0 to 15,15

prime reef
#

especially if you move into three dimensions

prime reef
wraith apex
prime reef
#

weird that it still fires

#

probably just a spigot issue but if it isn't functionally firing that's fine ig

wraith apex
#

yeah no the item stays in

#

which is good

#

but it still makes a sound

#

fun thing about observers though

#

you have to check that the pulse they get is not from an illegally powered block

#

like say a noteblock

#

redstone would set off the noteblock which would set off the observer

#

redstone is outside the claim so it should be not allowed to power it

#

this is a headache

#

don't get me started on the bs with checking for entities landing, being thrown into or interacting in a claim

#

ender pearls, snow balls, eggs, boats, armour stands being pushed in etc.

#

on the bright side, my land claim plugin mechanic does have one thing that a lot of players will love

#

I dub it the YEET mechanic

#

you can YEET unwanted players out of your claimed area

#

automatically ofc

prime reef
#

oh thsi reminds me

#

@wraith apex you might wanna check out some of the stuff Noita did for resource conservation per chunk

wraith apex
wraith apex
prime reef
#

most relevant one is gonna be marking inactive chunks

#

and only reactivating them if anything happens in an adjacent chunk or something happens that affects the inactive chunk

#

noita's a bit different since it uses a cellular automata-based engine (it's a falling sand game)

wraith apex
#

yeah

#

it's also... 2d?

prime reef
#

but I employed something similar for a plugin I threw in with turrets

#

chunk grid is 2d, tbf

wraith apex
#

yeah it is

#

it's more so how fast can the server load a chunk

#

to let a projectile continue

prime reef
#

seems to work

wraith apex
#

chunk that a turret is in sets a chunk ticket?

#

to keep it loaded

prime reef
#

nah, more like

turrets aren't tied to anything specific, so by default they wouldn't care what the status of their current chunk is

#

their update logic is in the spigot thread

#

meaning that if a server has a thousand turrets, but only two people are online and so only like 50 of those turrets are actually active, all 1000 will still update every tick

not great

#

so it p much just cycles turrets into/out of an update pool based on which chunks are loaded

but i have no way to test this organically and I wrote the plugin itself in 30 minutes so

wraith apex
prime reef
#

mojang really added spleef blocks

#

invalidating the work of spleef devs everywhere by using some leaves

wraith apex
#

well not really, I'm just using them for that

prime reef
#

spleaves, even

wraith apex
#

because of their unique mechanic

#

spleaves lol

prime reef
#

actually i'm curious, do they trigger events when that happens?

wraith apex
#

might want to check EntityChangeBlockEvent

#

and check the type if it's a drip leaf

#

so probably

#

unlike some plugin implementations of some other games, you can't cheat by being on the edge, it will depress

full gull
#

Hello! Im pretty new, and Ive been twisting my head on smn thats probably really simple. Does anyone know if there is a plugin (or how to make one) that will track the position (coordinates) of an arrow that is in flight? all i need is for it to track the position from when its fired to when it lands so i can then model it as a cuadratic equation (ive removed drag and randomness). Please ive been really stuck so any help is appreciated. Thanks!!

echo basalt
#

yeah it's not hard to make

wraith apex
#

you'll want to listen to this event

prime reef
#

tbh you don't really need to track the arrow, either

wraith apex
#

and then once you have it sample the x,y,z coords of the projectile as fast as you want (up to 20 per second)

#

you can just keep printing out the x,y,z values

#

possibly even the yaw and pitch

prime reef
#

you can extrapolate the arrow's trajectory solely from the launch event given the direction and velocity

wraith apex
prime reef
#

and the weirdly specific number of how much gravity affects arrows

wraith apex
#

hit event is when arrow/projectile has hit something so it will stop moving

prime reef
#

^ this fires on hitting an entity or block btw

#

if you want the "real" trajectory of the arrow, then def use this too

wraith apex
#

I'm thinking these 2 events + a bukkit clock to sample the projectile

#

clock will start then the projectile is launched and it will stop when it hits something

prime reef
#

you could also just use system time

#

which is TPS agnostic

#

I'm probably overthinking though

#

okay yeah arrows are subject to 20m/s^2 of downward acceleration due to gravity

#

that's some powerful gravity

wraith apex
#

I just mean the arrow is not going to move in less than a 20th of a second

prime reef
#

oh yeah, it's not

wraith apex
#

since the server has to move the arrow :p

prime reef
#

now, if you use my implementation, it will

wraith apex
#

xD

prime reef
#

(don't use my implementation, it's bad for you)

wraith apex
#

or I guess use some NMS

#

and look into how a projectile is fired

prime reef
#

my implementation basically raycasts

wraith apex
#

mmm raycasts

prime reef
#

and wraps it up neatly

wraith apex
#

I love raycasts

prime reef
#

default mc projectiles behave so badly on servers

wraith apex
#

ah yes the arrow comes up directly behind me, stops, I step to one side, and then it zooms past at mac 12 exploding an entire mountain before getting glitched in a mob

prime reef
#

being on fire is basically free iframes

#

and because of how global no damage ticks are, well, global, you can't disable them without turning fire/lava into an instant death sentence lmao

#

i mean you can, but that requires some fuckery

better to just offload projectile hits to a more reliable method

young knoll
#

I see no problem with getting instantly melted in lava

wraith apex
#

anyone else here really fucking hate the death event?

prime reef
#

anyway, we're wildly off track, @full gull let us know if you need further assistance lmao

prime reef
wraith apex
#

death event does not even tell you WHO killed you

#

it just like you ded

#

suc it bruv

young knoll
#

It does if you’re a player

prime reef
#

it didn't for years

young knoll
#

Since player has getKiller

wraith apex
#

aye aye but that's not intuitive

prime reef
#

And yeah it still doesn't work for mobs, which makes pve-centric plugins kind of a pain still

wraith apex
#

I expect that to be in the event

prime reef
#

^

wraith apex
#

the event itself I expect to have methods relating to what just happened

prime reef
#

I p much just threw in a death event that fires when an entity takes fatal damage

#

bit dumb that's not already in, though

wraith apex
#

aye same

wraith apex
# wraith apex

I also don't have any commands registered in the 'traditional' way

prime reef
#

christ lol

prime reef
#

annotation-mapped commands are probably easiest honestly

wraith apex
prime reef
#

but I implemented commands like a daft bastard

#

i've got a command tree πŸ’€

lunar mica
#

any idea why private static final World world = Bukkit.getWorld("world"); return null?

prime reef
#

pros: it pretty much auto generates pretty help formats
cons: inheritance based

wraith apex
#
@Command(name = "chatchannel",alias = {"cc"},description = "A command to change the channel you're talking in.")
public class ChatChannelCommand extends BaseExecutor
{    
    public ChatChannelCommand()
    {
        addSyntax("changeToGlobal",Sender.PLAYER,new ArgumentSet().of("global"));
        
        addSyntax("changeToParty",Sender.PLAYER,new ArgumentSet().of("party"));
    }
    
    @Syntax(description = "Changes your chat channel to global",permission = "arc.command.chatchannel.change.global",syntax = "/chatchannel global",example = "/chatchannel global")
    public void changeToGlobal(CommandSender sender,String[] args)
    {
        Player p = (Player) sender;
        
        PlayerEntityDataKeys.CHAT_CHANNEL.set(p,PlayerEntityDataKeys.CHAT_CHANNEL.getDefaultValue());
        
        PrintUtils.sendInfoMessage(p,"You are now talking in Global chat");
    }
    
    @Syntax(description = "Changes your chat channel to party (if you are in one)",permission = "arc.command.chatchannel.change.party",syntax = "/chatchannel party",example = "/chatchannel party")
    public void changeToParty(CommandSender sender,String[] args)
    {
        Player p = (Player) sender;
        
        if(((String) PlayerEntityDataKeys.PARTY.getValue(p)).equals(PlayerEntityDataKeys.PARTY.getDefaultValue())) { PrintUtils.sendMessage(p,"&cYou are not in a party!"); return; }
        PlayerEntityDataKeys.CHAT_CHANNEL.set(p,"party");
        
        PrintUtils.sendInfoMessage(p,"You are now talking in Party chat");
    }
}

This is what a command from my system looks like

#

oh god the anno makes it look ugly af

lunar mica
prime reef
#

I mean where is that field

#

like

#

what class

#

is it in your plugin class?

lunar mica
#

yes

prime reef
#

would suggest not doing that

#

I don't actually know if this is the case but

wraith apex
prime reef
#

when a plugin is enabled, it won't necessarily be able to access the world

#

yeah

wraith apex
#

Bukkit does not get initialised until AFTER

prime reef
#

You can set your plugin to only load after worlds have loaded iirc

young knoll
#

It does by default

prime reef
#

does it? mb, i'm rusty

wraith apex
young knoll
#

But the plugin instance is created before

prime reef
#

A more secure way of doing this would be to code around it

lunar mica
prime reef
young knoll
#

Should be fine if you set it in onEnable

prime reef
full gull
wraith apex
prime reef
young knoll
#

Mhm

prime reef
wraith apex
#

Do you have a world called 'world' ?

lunar mica
#

p.getWorld return world but Bukkit.getWorld return null

prime reef
wraith apex
#

can we see your code?

#

I promise I'm not going to tell md_5

#

:3

prime reef
#

also yeah if you're having code trouble, just paste your relevant code + stacktrace if applicable into hatebin or something

#

hastebin but angry

wraith apex
#

didn't know hate bin was a thing

#

lol

#

grrrr

young knoll
#

?paste

undone axleBOT
young knoll
#

Official MD paste

#

Definitely not just hastebin

lunar mica
wraith apex
#

and are you getting an error?

#

or nothing at all?

lunar mica
wraith apex
#

world is not loaded then

prime reef
prime reef
lunar mica
wraith apex
#

I'm guessing world is not the main world then

prime reef
#

yeah if you don't have a world named "world"

wraith apex
#

you have to tell bukkit to load additional worlds other than the main 3 it usually loads by default

prime reef
#

the default world is world, but yeah if you're running like, multiverse, that won't be the case

#

anything that would interfere with that, basically

full gull
#

Arrow tracker

young knoll
#

Even with multiverse the default world is world

young knoll
#

It’s only different if you change it in the server.properties

wraith apex
#

to load a world in code

#
new WorldCreator("world").createWorld();
#

this will load if the world already exists

lunar mica
#

Bukkit.loadWorld("world")

wraith apex
#

or create a new world if it does not

wraith apex
wraith apex
# prime reef Mine's a bit hideous, each command ends up in its own object however, as a resu...

I have a new parser where I can have arguments of what the player typed in-game casted and presented in a method neatly in any order I wish!

@Path(name = "mapped args",description = "A test for mapped args",syntax = "/test mappedArgs <material> <amount> <message> <say message>",usage = "/test mappedArgs sand 5 \"Hi there\" true")
public boolean mapArgs(Player p,@Mapped("sayMsg") boolean say,@Mapped("amount") int a,@Mapped("mat") Material m,@Mapped("msg") String s)
{
    PrintUtils.sendMessage(p,"Aye!");
    PrintUtils.sendMessage(p,"Material: " + m.toString());
    PrintUtils.sendMessage(p,"Amount: " + a);
    PrintUtils.sendMessage(p,"Message: " + s);
    PrintUtils.sendMessage(p,"Say: " + say);
    return true;
}
echo basalt
#

ew

wraith apex
#

in the constructor I have

public TestCommand() throws MissingAnnotationException
{
    super(TestCommand.class);
    
    addPath("mapped args",CmdSender.PLAYER,
            new ArgSet()
            .of("mappedArgs")
            .of("<material>",ArgTypes.MATERIAL,Suggestions.minecraftMaterials()).map("mat")
            .of("<amount>",ArgTypes.INT).map("amount")
            .of("<message>",ArgTypes.STRING).map("msg")
            .of("<say message>",ArgTypes.BOOLEAN).map("sayMsg"));
}
echo basalt
wraith apex
echo basalt
#

ye

wraith apex
#

cool

#

so how do you input arguments?

#

those 2 arguments I assume you need to create in advance?

echo basalt
#

There are default arguments

#

These ones are custom

wraith apex
#

Ah ok

echo basalt
#

You can also do stuff like

#

addArgument(new NumberArgument("Joe").orDefault(123))

young knoll
#

Is that hardcoded to the last arg

echo basalt
#

uhh

young knoll
#

Or does CommandContext have a stack

echo basalt
#

it's like a mutable thing

#

Because some arguments need others I build from start -> finish

#

So /test 123 abc 456
makes a mutable command context with full input as "test 123 abc 456" and then I parse each node with "last input" being the word I'm parsing

#

So the later nodes have context of the early nodes

#

under a single object

#

bit messy

#

bro thanking a month old post

#

next time just ask for it again

#

data watchers are simple

#

yeah 1.19 changed stuff

young knoll
#

Protocollib sending packets is so jank

#

Compared to just NMS

#

Yes I know it needs to be version independent

prime reef
echo basalt
#

uhh it's picky

#

you need to send entity metadata once

#

to define the item in the itemframe

wraith apex
echo basalt
#

All following packets are just map packets

#

re-use the map id

#

yada yada

#

updating the map's content

#

you need to toss a map itemstack with the map id in the meta

wraith apex
#

json object

echo basalt
#

bro thinks a json object is going to solve all his life's problems

wraith apex
echo basalt
#

you can make a map view with bukkit

wraith apex
#

json object is basically a map anyway

echo basalt
#

and set the view on the map meta

wraith apex
#

can turn it into a string

echo basalt
#

we're talking about

#

like

#

actual map items

#

not a Map<?, ?>

wraith apex
#

oh

echo basalt
wraith apex
#

yeah yeah yeah

#

my bad

echo basalt
#

toss it in a json object

wraith apex
#

can we toss you in a json object?

echo basalt
#

OutOfMemoryError

#

πŸ’€

wraith apex
#

StackOverflow eh?

echo basalt
#

you can't contain my awesomeness in a single object

#

(i'm clinically insane)

wraith apex
#

I have 2 objects

#

it's fine

echo basalt
#

sigh

#

Let's recap

#
  • Create a map view
    (Contains map id, all that stuff)

  • Create a map itemstack

  • Set the map view in the mapmeta

  • Create an entity metadata packet for your fake item frame

  • Set the item frame's contents as the map itemstack

  • Send a map packet with the id of your mapview, and whatever colors

#

there

#

here's an old impl I did

#

uses nms, I can't be bothered

#

sleep time

full gull
#

btw ty @wraith apex for the help!

tribal sable
#

hi

#

can some1 help me with a lil plugin?

lethal coral
#

should I make eventhandlers private methods

sullen marlin
#

No

lethal coral
eternal oxide
#

method identity must match

lethal coral
#

I don't exactly want people to be calling these methods instead of using the plugin manager

lethal coral
eternal oxide
#

Spigot will look for a public method annotated as an event handler

lethal coral
#

and it just seems odd having those methods publicly available

eternal oxide
#

has to be pubic and accept one of the event args

small holly
#

Hey so I am trying to setup Unit tests for Spigot 1.20 using MockBukkit and I am getting this issue when trying to test my getters Cannot access com.sk89q.worldguard.bukkit.WorldGuardPlugin

#

any idea why? not used Junit or MockBukkit in ages lol

#

Assertions.assertNotNull(plugin.getWorldGuard());
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.9' in my gradle

#

oh I see compileOnly is the issue

quaint mantle
#

Maven

visual tide
#

gradle 😍

#

so uncomplicated and intuitive

glad prawn
#

i need madle

winter flower
#

I'm trying to create a custom mob and I've reached an issue where I can't use this.setCustomName() since it requires a Component, I tried using TextComponent

this.setCustomName(new TextComponent(ChatColor.GREEN + "MyEntity"));

But that didn't work it said needing (Component) not (TextComponent) I tried casting Component to it but that also didn't work

tall dragon
#

isnt there Component#text ?

winter flower
#

I tried that, didn't find it

tall dragon
#

this also smells like paper api

#

is it?

winter flower
#

I'm just using spigot

#

I'm extending the Sheep class from net.minecraft.world.entity.animal.Sheep

vast ledge
#

new TextComponent(Chat Color. GREEN + "My entity"). getComponent()

#

It no exist?

winter flower
#

No

vast ledge
#

are u using the right text component

tall dragon
#

what version ru even working with

winter flower
#

There's only 1 that I can use

#

1.20

#

net.md_5.bungee.api.chat.TextComponent The only TextComponent I can use

tall dragon
#

does ChatComponentText exist?

winter flower
#

I can't find any other that I can import

winter flower
worn tundra
winter flower
#

Just Component

worn tundra
#

Also from md5?

winter flower
#

net.minecraft.network.chat.Component

worn tundra
#

Bruh

winter flower
#

net.minecraft.network.chat has no importable TextComponent

#

nor does it have ChatComponentText

vast ledge
#

What method

#

from where is it+

winter flower
#

Sheep#setCustomName

vast ledge
#

nms?

winter flower
#

mojang remapping

vast ledge
#

so nms

winter flower
#

yes

vast ledge
#

well I don't work with nms often

#

but why don't you use spigot api to change the name of the mob?

worn tundra
#

^

winter flower
vast ledge
#

entity. setCustomName()

winter flower
#

Alright I'll attempt that

vast ledge
#

and entity. setCustomNameVisible(true)

winter flower
#

I also found a resource that says TextComponent should be an import from net.minecraft.network.chat.TextComponent which is why I'm confused how I'm missing it

vast ledge
#

TextComponent. fromLegacyText()

winter flower
#

not a function, the only one similar is toLegacyText which returns a String

#

also I think I found a fix

#

Component.literal(String)

#

So I'll leave it here incase anyone else faces that issue

vast ledge
#

okay

upper hazel
#

can I use my api in another project via projectSettings -> models - Dependencies so that there is NO dependence on the location of the api on the PC?

#

or is the only way to use maven?

wet breach
#

I think you are confusing two different build systems that your IDE lets you use?

#

The location of the dependency is always a factor regardless of the build method used. Maven just handles this for you by making use of maven stuff

#

the build system your IDE most likely has built in that isn't maven is ANT

upper hazel
#

i want add api for my plugin

#

but but not using maven

#

add in local

#

or how this say

wet breach
#

ANT is more basic and requires you to fill in more details manually that maven would do at times automatically. Such as specifying the location of the dependency

upper hazel
#

I heard about 2 ways to add a dependency so I wanted to use method 2

#

load jar

#

or how this saying

wet breach
#

the easiest method to add an API into a project using ANT is to simply copy the sources for said api into the project under its own directory AKA package

hazy parrot
wet breach
#

the other method is just ensuring the API is present in the same location as the plugin, meaning the plugin directory for the server

#

but as the above, I was going to recommend to just continue using maven as its just easier and really not much of a reason to avoid it unless you want to use gradle. ANT doesn't provide many things and isn't always easy to use without issues unless you know what you are doing. This is why things like maven and gradle came about

upper hazel
#

when I try to add a dependency through models in settings api becomes location dependent and I can’t use it on another PC

wet breach
#

the same will happen with maven and gradle if the API isn't accessible in a repository that the other PC has access to

#

so that means if the API is only in a local repository, you will get the same problem

twin venture
#

InventoryCloseEvent : the item that is on the Courser will be removed no matter what i do is there a fix for it

wet breach
#

best option is to make use of the windows file sharing or linux which ever you are using, and just transfer the api to that other pc

upper hazel
#

wait, if maven has the same problem, then using the api will depend on whether the server is connected to the Internet or not?

wet breach
#

optionally you could run a small http server to make your local repo accessible for those other pc's

wet breach
#

it would depend on whether the pc has appropriate connections to the other PC

upper hazel
#

but server can be localhost

#

in

#

if server in local host then how my project can search repository in internet

wet breach
#

the server has a built in lookup that looks to maven central for dependencies

#

if the dependency is not found on maven central it will fail, so it doesn't work for all dependencies

upper hazel
#

so this system use pc for coonect with site?

wet breach
#

well of course, that is how connections work in regards to software it isn't going to manifest its own system you know lol

#

so a localhost only pc that has no connection to the internet, it will obviously fail

fluid river
#

are you afraid of maven or smth?

upper hazel
#

so if i disconnect internen in my pc plugin not found repository

fluid river
wet breach
#

that isn't their issue

fluid river
#

and then you can plug off the internet cable

upper hazel
#

wdym "you just update your project once you filled in maven stuff"

wet breach
fluid river
#

fill pom.xml with data -> update dependencies -> dependency is installed locally now and you can use it even without internet access

wet breach
#

this is why many projects still provide the repositories or links for dependencies their projects require

#

because not all projects submit their stuff to be on maven central

upper hazel
fluid river
#

idk which ide are you working in

upper hazel
#

intelji

fluid river
#

i have no clue then

#

never worked with maven on IJ

wet breach
upper hazel
#

Well, judging by the attempt, it doesn’t work that way

fluid river
#

that way

wet breach
#

sure because they have repositories that are accessible

fluid river
#

yeah ofc

upper hazel
#

Isn’t it possible to add a dependency so that it looks for api in the plugins folder on any PC?

wet breach
#

but 2 pcs on your home network though to have one that has the dependency the other not, this won't work and will not magically make your dependency move to the other pc πŸ˜›

fluid river
#

but after you do maven update you can work with that stuff even offline

#

that's what i'm trying to say

#

can't you just depend on .jar tho?

#

i mean it was possible in eclipse, at least

wet breach
fluid river
#

Install the dependency plugin on their server?)

#

@upper hazel what exactly are you trying to achieve?

upper hazel
#

look - https://youtu.be/r7x4XRQsD6k?si=feIEuvtNH4NZJ9vI it adds a dependency not using maven and it won't work on another PC right?

Love the video or need more help...or maybe both?
πŸ’¬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❀️

If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!

All code is available on Github:
...

β–Ά Play video
fluid river
#

wdym on other pc

upper hazel
#

other server

fluid river
#

you need the same jar to be on another pc too

#

you just install the plugin you depend on

#

on this server

#

and it just worksℒ️

#
  1. You have Plugin1 with API
#
  1. You have Plugin2
#
  1. You add Plugin1 as dependency to Plugin2
#
  1. You code stuff
#
  1. You install both Plugin1 and Plugin2 on the server's plugins folder
  2. You run the server
  3. KA-BOOM
upper hazel
#

he not use maven

#

so this not will worked if another person want use api

fluid river
wet breach
#

however for a project that dependends on something built this way, requires that dependency to also be present on another system for it to work

#

its not magic

#

the exception to this, is if said dependency is on maven central

#

because the modern spigot servers will look to maven central for dependencies

#

and if it finds it, will auto download it

#

the build system only matters for building btw. The build systems have nothing to do with the jar running afterwards

fluid river
#

^

wet breach
#

so that means you can build with ANT, and the server still pull a dependency from maven central

#

even though maven wasn't used to build it to begin with

upper hazel
#

so If I add an api like in the video, will other users be able to use the api?

fluid river
#

they would need your API to be installed on their server

#

as a plugin

#

with implements JavaPlugin shit

wet breach
#

so you would need to provide some way for them to obtain the API to put it on their server. This is how we get maven repositories for projects existing primarily for developers to use, and other methods for users πŸ˜›

#

I feel we are making progress in clearing this confusion of theirs

fluid river
#

@upper hazel look at Vault plugin

#

it's useless by itself

#

but lots of plugins depend on it

#

it's just an API plugin

wet breach
#

and its provided by both spigot site and has a maven repo

fluid river
#

and well, you can still depend on it manually

wet breach
#

yeah you can do that too lol

fluid river
#

with a .jar dependency

#

i mean that was his original question

#

if i read correctly

fluid river
#

so well, you can also post your API plugin on spigotmc and tell people to download it if they want your plugins to work

#

but bruh

upper hazel
#

ahh now I understand. In order for another user to use the api, he needs a repository on my PC to access the api, and maven solves this by using the Internet available to everyone

#

this is true?

#

if so, then a good addition for the spigot server would be to search for the api in the same folder as the api itself

wet breach
# upper hazel ahh now I understand. In order for another user to use the api, he needs a repos...

almost correct. They need someway to download it. This is where spigot site comes in, where users could download it. Or you can provide alternative means for them to get it. Maven repos is a way but this method is typically used for developers when building their plugins so they don't have to go to something like the spigot site and download the api and then manually attach it to their project. Maven is where this comes in doing that for you if a maven repo is available for them to specify

upper hazel
#

just search him in plugins

#

derictory

#

or he do this?

barren nacelle
#

if the timings system is turned off does that mean I cannot use bukkit runnables?

tall dragon
#

No

#

Timing system is just measurements

#

Everything works

upper hazel
#

if this true then repository not need bc plugin just can search him in plugins derictory

tall dragon
#

But u havr no performance insight

upper hazel
#

but in fact you can use the api for example like this β€œBukkit.getPlugin” without using the repository in maven

#

or I'm wrong

#

i was not use it but think obaut this

#

i mean a repository in maven only saves us from a lot of lines of code, no?

chrome beacon
#

If you plan on using code from some other project it needs to be added as a dependency in maven

upper hazel
#

oh

#

i see

upper hazel
#

hey what mean this error 0.9/worldguard-core-7.0.9.jar(/com/sk89q/worldguard/protection/flags/Flag.class)
[ERROR] class file has wrong version 61.0, should be 54.0

wet breach
#

has to do with the java version. The java version you are using is too old for the version of worldguard was compiled against

lost matrix
#

I was trying hard not to πŸ™‚

wet breach
#

either use an older worldguard version or upgrade your java version

#

54 refers to java version 10

#

61 is java 17

lost matrix
echo basalt
shadow night
#

hey, I'm developing a plugin for my friend to run a script, but when the path contains a space it breaks and since all my servers are in a directory called "minecraft servers" I can't really test it and I also don't wanna rename the folder

prime reef
#

can you translate what that's saying lmao

#

it switches to german halfway through

#

is it saying it can't find the path or

wraith apex
#

don't need to know german to figure this out

prime reef
#

i don't know what exactly the error is

wraith apex
#

in windows if you use a space in cmd

#

it's treated as another arg

prime reef
#

you can circumvent that by just wrapping the arg in quotation marks

wraith apex
#

in his program it's doing exactly this

#

yeah

#

just wrap it in quotes in code

prime reef
#

I'm not sure if the output is printing it in quotes because of formatting or because that's how the arg is being parsed, but I guess it's the former

shadow night
wraith apex
#

command.add("\"" + runetimeCommand + "\"");

prime reef
#

^ yeah p much, or you can use string.insert or whatever if you're weird

wraith apex
#

ah

prime reef
#

wait no wrong language

#

java string immutability moment

prime reef
shadow night
#

indeed it is

wraith apex
#

I wonder if cmd is executing as the command is pasted?

prime reef
#

this is probably some weird edge case shit

shadow night
prime reef
#

hold up

wraith apex
#

I'd print runtimeCommand

prime reef
#

try not adding the quotes

wraith apex
#

just before you add it

prime reef
#

does it work then?

wraith apex
shadow night
prime reef
#

quotes are all fine and dandy when typing the command but it's running through an API here so

shadow night
#

then it didn't work, I tried adding quotes

prime reef
#

hmm, okay

wraith apex
#

can you print out 'runtimeCommand' before you add it to command?

shadow night
#

sec

wraith apex
#

seems fine

shadow night
#

weird stuff

wraith apex
#

I guess further debugging is trying hard-coded file paths and see what works and what does not

shadow night
#

hm

#

Β―_(ツ)_/Β―

lost matrix
wraith apex
#

we already tried that

lost matrix
#

What was the exception on that?

wraith apex
#

there is none

shadow night
#

so, I tried this now and now it just can't find the file (plugins\ScriptRunnerMC\runtime\node.exe) which exists

young knoll
#

Oh no

#

Not the node

wraith apex
#

node modules

shadow night
shadow night
young knoll
#

Smh

#

This is why jda exists

shadow night
#

my friends exist too btw

#

and you're not helping fix the problem, why criticize a choice I didn't even make

upper hazel
lost matrix
#

\runtime instead of runtime

shadow night
#

hm

#

lemme try

#

well, that didn't quite work

young knoll
#

Is that the correct path to the file

shadow night
#

yes

#

it seems to be

young knoll
#

Is it maybe confused because it’s trying to run β€œruntime/node.exe” instead of just β€œnode.exe”

wraith apex
#

I'm working on something in the bg

#

Interesting

shadow night
#

if it's because a backslash I'll

#

idk what I will do

lost matrix
#

*Or relative when setting the folder

shadow night
#

are you kidding me

#

what kind of torture is this

kind hatch
# wraith apex

You need to specify the full path to the file including the extension on windows.
Not quite sure why the string isn't allowing spaces though. Might want to stick with non spaced folders for the time being.

worldly ingot
#

Generally good advice to begin with anyways lol

shadow night
#

The thing is, before I run node I have a check to make sure the script and the runtime exists and both of them pass, but once I try to run stuff, it doesn't run

young knoll
#

Didn't linux used to absolutely hate spaces

shadow night
kind hatch
#

Command Prompt and Powershell are not consistent for some reason.
I think you can get away with more in CMD, but usually you only need to encapuslate the path in strings if your path contains a folder with a space.
I think in some cases it wants you to surround only the folder in the path with quotes.

#

Β―_(ツ)_/Β―

frank kettle
#

im having again an error for Caused by: java.lang.NoClassDefFoundError: while the class it's from the own plugin.

#

Any thoughts why this is happening?

chrome beacon
#

?paste

undone axleBOT
frank kettle
#

Im using Spigot api, paper server.

wraith apex
#

instead of slashes we used File.seperator

#

so it would use whatever the OS used for seperating files/folders in a path

young knoll
#

Java will handle that in some places

#

But not all

wraith apex
frank kettle
#

well, its an error for my plugin only

#

and im using spigot api

kind hatch
frank kettle
#

the server is working fine

eternal oxide
#

Probably an error in your class static initialization or static Field

frank kettle
#

what paper method am i using?

frank kettle
eternal oxide
#

then repeat the error using a Spigot server

frank kettle
#

it's hard to repeat error since it happens randomly and rarely

#

out of nowhere classes cant be found

eternal oxide
#

yeah I've seen the error from one other Dev

young knoll
#

You got some weird java install?

eternal oxide
#

Repeat it on Spigot

young knoll
#

Or code ghosts

#

Never rule out the code ghosts

kind hatch
#

G.ggg..gg.. GHOSTS!?!?!

#

That's too spooky for me

shadow night
#

Imagine if the gc was an ai: "this mfs code is so bad I'm gonna take out all of his garbage classes once an instance is created"

wraith apex
kind hatch
#

GC knows all. Don't question it.

wraith apex
#

aight

eternal oxide
frank kettle
#

and it works fine at first, then later some class disappears

frank kettle
eternal oxide
#

Thats not an answer to my question

frank kettle
#

the problem there is that the HomeDatabase can't be found when it's a class on the plugin

wraith apex
#

Do you have any logic that mucks around with URLClassLoaders? or really class loaders in general?

frank kettle
#

yesterday i got the same issue for another class

young knoll
#

Do you mess with ClassLoaders

#

at all

ancient plank
#

I was having this issue yesterday, ended up fixing something else and hoping it fixed the issue. Ain't got no idea if it fixed it kekw

wraith apex
frank kettle
#

no

wraith apex
#

and your plugin the only plugin

eternal oxide
wraith apex
#

in the server

frank kettle
#

nah

#

i have some others like worldedit, citizens, multiversecore, etc

kind hatch
young knoll
#

And they behave fine?

wraith apex
#

Well I'd start eliminating variables, remove all plugins apart from your own

eternal oxide
frank kettle
#

only mine is giving this error

#

this are the plugins

eternal oxide
#

Moterious was teh exact same error but he was also messing with the logger which could be been an issue

wraith apex
#

I can only assume classpath is faulty

frank kettle
#

weird cause its a class from the plugin 😐

#

if the classpath was wrong, it wouldnt be working either on the import part and the plugin would be giving me a lot of reds

wraith apex
#

But you say it happens rarely

eternal oxide
#

its not the classpath

shadow night
#

I thought by our conventions we don't name the main class Main

wraith apex
#

IDE will show squiggles as a static evaluation of the code

frank kettle
wraith apex
#

it may be there and it may be showing perfectly fine

frank kettle
#

I will change the main class to other thing, surely it will fix the issue πŸ‘Ό

young knoll
#

imports are an IDE only thing

#

imports don't exist in the bytecode

wraith apex
#

in the .jar that's compiled, it may or may not be there

#

manifest.mf

shadow night
eternal oxide
#

if it was an actual issue with classpath/manifest.mf it would error every time, not randomly

frank kettle
wraith apex
#

a dumb fix for this I've found is copying the code somewhere, deleting the class file, re-creating a new class file with the same name and then copying the code back in

frank kettle
#

i feel like you're just wasting conversation space here 😐

shadow night
frank kettle
eternal oxide
#

as I said, repeat the error on Spigot and come back. You are on Paper and I suspect the other dev was also.

frank kettle
#

if i restart, the the class will suddenly work fine

#

and then later into the server, some other class will disappear

#

at least thats what has happened

frank kettle
wraith apex
#

at this point I'd have to agree with Elgar, try running it on a spigot server

eternal oxide
#

Theres obviously a specific set of variables required to trigger it

wraith apex
#

not a paper one

kind hatch
#

Is your plugin depending on those other ones?

frank kettle
#

nope

wraith apex
#

for a plugin to loose a classpath midway through is odd

frank kettle
#

my plugin only uses spigot-api and "spigot remapped" stuff

wraith apex
#

doesn't matter

kind hatch
wraith apex
#

the server is what is running the code

eternal oxide
#

that error is generally due to a Statc intializer/Fied error when instancing the class, or a caught exception being hidden.

wraith apex
#

paper makes many alterations to the implementation

kind hatch
#

Their most recent ones including changes to plugin loading.

wraith apex
#

run the plugin on a spigot server

frank kettle
#

this will be so annoying

#

cause even if i open a spigot server, it only happens randomly after a while and seems after many things have been done on the server...

wraith apex
#

Β―_(ツ)_/Β―

shadow night
#

Then do many things and let it happen

wraith apex
#

We can't really do a whole lot then

frank kettle
#

yeah i will try

#

but yesterday for example there was 10 people playing and running commands

#

and everythign worked fine

#

now i restarted like an hour and its just us 3 on the server, barely did much

#

and it happened

#

πŸ˜ͺ

eternal oxide
#

just change teh server jar for a day to spigot

frank kettle
#

Spigot is more laggy tho, is there a guide to follow to make it less laggy like paper?

wraith apex
#

this is just for testing

eternal oxide
#

Do you want to fix your issue or just complain?

#

don;t change anything other than the server jar

frank kettle
#

or what's the reason for paper to work so much "better" than spigot for servers?

frank kettle
wraith apex
#

paper changes how some of underlying implementation for some operations on spigot work to make them either more memory efficient or use less cpu cycles

lost matrix
#

Show us some code

wraith apex
#

^

kind hatch
wraith apex
#

Lets see the HomeDatabase class

#

in its entirety

frank kettle
#

Line 39 of cmdHome:

HomeDatabase db = new HomeDatabase(p);```

code for HomeDatabase:
```java
public HomeDatabase(Player p) {
        this.p = p;
    }```