#help-development

1 messages · Page 1838 of 1

mighty pier
#

nothing i just thought about it

glad ruin
#

actually now that i think about it

#

i dont think it is possible

mighty pier
#

yea

hasty prawn
#

Why would you want to do that anyways

ancient plank
#

the only possible way would be to use a fallback server w/ like bungee

trail lintel
#

Is there an already available database for use in spigot like an h2 instance or something? Or do I gotta pull that in as a dependency. I guess a better question, is there a native way to store persistent data before I go down the db route?

trail lintel
#

Lolol I did want to avoid writing to files for speed reasons

quaint mantle
#

Regarding copyrights when developing a plugins with spigot, am I allowed to make javadoc that contains my author name on my plugin ?

trail lintel
#

Of course you can, its your plugin =]

kind hatch
trail lintel
#

Hmm that could possibly work. There may be many many reads though, as I want to keep track of "cooldown" on an item per player

kind hatch
#

You wouldn’t even need files

trail lintel
#

I am indeed. Problem is, I put a persistance data container on the item to keep track of "time left". But I still need to update it when the user "hovers over the item" or the timer ticks

kind hatch
#

Well, I don’t think a hover event exists, but simply updating the value should cause the item itself to update. If not, you could always Player#updateInventory()

quaint mantle
#

any guy have item builder?

trail lintel
#

I think thats what I shall do then

turbid oasis
#

public static void doSomething(String s) {

}

How do I use this in other java classes?

trail lintel
#

I think I still need some sort of data store server side to determine "which players are on cooldown" though

kind hatch
quaint mantle
kind hatch
#

You wouldn’t need to use packets

trail lintel
#

Ohh that would be amazing lol I hate working with packets

minor fox
#

Is BungeeCord supposed to autocomplete commands automatically?

turbid oasis
kind hatch
#

The method is literally called setCooldown. Not sure if it’s part of the ItemStack class or the Material class.

quaint mantle
kind hatch
#

Or setItemCooldown

#

Lemme see if I can find it.

trail lintel
#

Well holy shit lol. I was utilizing custom model data to show a "cooling down" sprite. But I may just use the native cooldown bar

quaint mantle
#

fine

trail lintel
#

Wouldn't need to keep track of stuff server side, just slap that setCooldown and call it a day

#

Ahhh yup this aint gonna work for me. Unfortunately the cooldown operates on the base material, not the specific item stack.

#

Looks like custom solution is back on the table boys

quaint mantle
#

how to set the mob?

        ItemStack spawner = new ItemStack(Material.MOB_SPAWNER);
turbid oasis
# quaint mantle code?

package me.mrkboy8.wintergames;
import me.mrkboy8.wintergames.globalEvents.asd.sad;

public class sdf {
sad.
}

#

no autocorrect

quaint mantle
#

hey

#

?learnjava

undone axleBOT
turbid oasis
#

ok

quaint mantle
#

try:

#

package me.mrkboy8.wintergames;
import me.mrkboy8.wintergames.globalEvents.asd.sad;

public class sdf {
public void abc() {
sad.doSomething("ABC");
}
}

turbid oasis
#

ok thanks!

quaint mantle
#

try

turbid oasis
#

wow, it worked

#

thanks a lot!!!

mighty pier
#

how do i add nbt data like "ASPECT_OF_THE_END" or "SUPERIOR_DRAGON_ARMOR" to items and retrieve it on 1.8?

rough drift
#

do plugin message channels (in a bungee) need the bungee to know the channel? or can serverA message serverB directly?

vale ember
mighty pier
#

ty

vale ember
#

np

kind hatch
trail lintel
#

Appreciate it! I will just be fiddling with stuff. I def could just "Get it working", but I wanna keep things lightweight

mighty pier
vale ember
mighty pier
#

ok

vale ember
#

BUT!! if you don't use abstraction or reflection your plugin will not run on different versions

#
  • you need corresponding mc version compiled with BuildTools.jar on your pc
mighty pier
#

im very confused

waxen plinth
#

Isn't there nbt API for 1.8

vale ember
#

the PDC is 1.14+

rancid beacon
#

Hello guys, i have a problem with my plugin.
in the Timings Report, the avg parameter for my plugin shows up red (I mean it looks like avg(75.44ms per - 2.32ms/0.03 per tick) and it shows me that it's supposedly because of my 3 eventhandlers, but I don't know what to do about it (and I using purpur with 1.17.1 version on server)

my code for one of them (which also shows up that it's because of it) looks like this:

    @EventHandler(priority = EventPriority.LOW)
    public void onInventoryOpenEvent(InventoryOpenEvent e){
        if (e.getInventory().getHolder() instanceof Chest || e.getInventory().getHolder() instanceof DoubleChest){
            Chest stt = (Chest) e.getInventory().getHolder();
        }
    }

What can I do about it? (I can also show a piece of code for the other events)

waxen plinth
#

Not that people should be using 1.8

kind hatch
quaint mantle
#

how to make a spawner?

tacit drift
#

I am a bit confused, if i return a FileConfiguration to a string it should return a string containing the path and the root, i load the file once and after that if i log fileconfigururation to console it shows that the path is empty but if i return the file to console it returns the corect path 😕

[20:05:30 WARN]: [MyPlugin] plugins\MyPlugin\exampleFolder\exampleFile.yml <- This is File object to console  YamlConfiguration[path='', root='YamlConfiguration'] <- This is FileConfiguration object to console
vale ember
#
  1. You need at least once build the version via BuildTools.jar, like e.g. if you're using 1.8, you should at least once runned BuildTools with 1.8
  2. If you don't use reflection/abstraction your plugin will ONLY run on that mc version, that you used in your pom.xml
#
  1. You may use ready external APIs to avoid f*cking with NMS
waxen plinth
waxen plinth
tacit drift
#

wtf

waxen plinth
#

It's the path of the ConfigurationSection within the config

sacred ice
#

NMS can be used to do awesome things

waxen plinth
#

Which, for the config root, is an empty string

trail lintel
#

Is there a way to mock a large data load for /timings? My server only has a few friends on it, but I want to stress test this plugin with a few hundred.

quaint mantle
#

welp so I made my first command plugin to give myself items and I understand the code behind it but it still makes me feel terrible about my current skills in programming for some ungodly reason

waxen plinth
#

Why

#

Can we see the code to give advice?

kind hatch
quaint mantle
#

help

The spawner disappears when I put down '-'

1.8.8 Spigot

waxen plinth
#

lol

quaint mantle
#

plsss

sacred ice
#

Can you give more details please

waxen plinth
#

no details

#

only help

trail lintel
#

Lolol

quaint mantle
#

help? '-'

trail lintel
#

Bruh you didn't give em enough information to help you

ember estuary
#

are player stats saved clientside?

kind hatch
swift adder
#

How could I put a wait time on lua?

#

Wait(1) doesn't work

waxen plinth
#

Go learn what a help vampire is and then stop being one

kind hatch
#

Wait, that’s a term?

swift adder
ancient plank
waxen plinth
#

This is very easily googleable

swift adder
#

No I swear

waxen plinth
#

And I don't know why you're asking for Lua help in the spigot discord

quaint mantle
trail lintel
#

I'm not sure what you doin here with lua lol but yea use os.execute to execute your os sleep command

swift adder
#

Wait() doesnt work

waxen plinth
#

.-.

quaint mantle
#

i created an itemstack, however when i try to put it it disappears.

swift adder
#

The lua discord server isn't English.

knotty shell
#

cuz this is help-development... well if they using Lua for something then it applies.

ancient plank
#

people need more information than "the spawner just disappears. 1.8.8" to help lol

swift adder
#

I don't know much of java.

gusty gorge
#

Hey, how would I apply the glowing effect for every nearby ArmorStand to the Player?

trail lintel
quaint mantle
#
        if(command.getName().equalsIgnoreCase("spawner")) {
            if(!(sender instanceof Player)) {
                sender.sendMessage("§cERRO » VocĂȘ precisa ser um player!");
                return true;
            }
            Player p = (Player) sender;
            ItemStack testSpawner = new ItemStack(Material.MOB_SPAWNER, 1);
            BlockStateMeta bsm = (BlockStateMeta) testSpawner.getItemMeta();
            CreatureSpawner cs = (CreatureSpawner) bsm.getBlockState();

            cs.setSpawnedType(EntityType.BAT);
            bsm.setBlockState(cs);
            testSpawner.setItemMeta(bsm);

            p.getInventory().addItem(testSpawner);

        }```
gusty gorge
tardy delta
#

what's the difference between File#mkDirs() and File#getParentFile#mkDikrs()?

trail lintel
#

pass it a string thats a straight up command to sleep

waxen plinth
#

when asking for help:

  • explain the problem and give plenty of details
  • say what you have tried already
  • don't act entitled and cooperate with the people you are expecting help from
trail lintel
#

Same applies to windows though

#

I just don't know what windows sleep command is

#

or its args

swift adder
#

I'm looking for a wait command on lua

knotty shell
#

dos batch commands...

quaint mantle
trail lintel
#

Lua doesn't have one

waxen plinth
trail lintel
#

You have to emulate it with os sleep

waxen plinth
#

Iterate over them and check which ones are armor stands

ancient plank
#

y'all got like a million different things going on rn

#

@quaint mantle make a thread

#

in this chat

quaint mantle
#

fixed

waxen plinth
#

And then you can apply glowing to the ones that are

waxen plinth
#

Koddy has done everything wrong

knotty shell
#

btw 'timeout' is the command you are looking for but there is no precision with it, so like timeout 5 is anywhere between 4-5 seconds

waxen plinth
#

Don't be like koddy

quaint mantle
#

how do communicate with the spigot console ?

 else if (!(commandSender instanceof Player)){
            
        }

For example I'm trying to send an error message if anything other than player is trying to call the command

waxen plinth
#
  • asked for help with no information
  • didn't give any details when asked
  • kept asking for help without elaborating
  • said "fixed" but didn't explain how
trail lintel
#

Bruh I think kody be trollin lol

waxen plinth
#

Yeah sendMessage works on both

knotty shell
#

if ya just doing this for testing ya can just global broadcast and just brainfarted on that fnc

ancient plank
#

brainfarted on that fnc

knotty shell
#

the name

quaint mantle
#

so if the command sender is a player, only the player will see the message ?

kind hatch
#

Yes

quaint mantle
#

great thanks

kind hatch
#

It’s the sender of the command, implying one

quaint mantle
#

already learning more that's nice

waxen plinth
#

Can we get a rule against help vampires so that we can mute people who just spam asking for help without giving details and clog up the chat so other people can't get help?

knotty shell
#

just report'm spamming and done.

quaint mantle
#

Last question for tonight, I don't want to bother too much

waxen plinth
#

Ask all you like so long as you ask respectfully

gusty gorge
waxen plinth
#

Basically yeah

#

Wait no

gusty gorge
#

Ok thank you

waxen plinth
#

Don't return lol

gusty gorge
#

Oh

waxen plinth
#

Get rid of that else

quaint mantle
#
else if (!(commandSender instanceof Player)){
            commandSender.sendMessage("Error, a player needs to call this command.");
            return false;
        }

        return true;

I'm returning false if the command sender isn't an instance of a Player but I'm not sure I understand the way returning works in public boolean onCommand()

waxen plinth
#

That would stop after reaching one non-armor stand entity

gusty gorge
#

Ok, thank u 🙏🙏

waxen plinth
#

But it's been forever since I did commands that way so I could be remembering wrong

quaint mantle
#

I'll go deeper in the docs then

kind hatch
waxen plinth
#

I would recommend abandoning the plugin.yml way of doing commands as soon as possible

#

It's ugly and horrible

quaint mantle
#

I'll read more into how commands should be done most of the time for tonight and make some javadoc so I don't get lost when I open the project tomorrow

#

thanks a lot

waxen plinth
#

Mmk

#

Once you feel comfortable with commands that way start looking into command frameworks

quaint mantle
#

command frameworks ?

ancient plank
#

command frameworks are the bomb

waxen plinth
#

They take the pain away from writing commands

#

I can recommend some good ones

quaint mantle
#

Is there some event like (PlayerCommandPreProcessEvent) for console?

kind hatch
#

There’s the normal command handler. Just check if the sender is an instance of ConsoleCommandSender.

quaint mantle
#

smth like block console from writing some commands

#

for ex. gamemode and stuff

#

mby the ServerCommandEvent

#

?jd

waxen plinth
#

Why would you want to prevent the server from sending commands

quaint mantle
#

bcz of my friend always cheating with a console commands on a survvial server and using gamemode for giving themself stuff

#

so only for private use

kind hatch
# quaint mantle mby the ServerCommandEvent

That might work. According to the Javadocs

This event is called when a command is run by a non-player. It is called early in the command handling process, and modifications in this event (via setCommand(String)) will be shown in the behavior.

#

It also has use cases listed on there.

Conditionally blocking commands belonging to other plugins.

quaint mantle
#

nice

#

thank you

waxen plinth
#

Should call setCommand("say hi") so that every command is replaced with saying hi

thorny python
#

is there a way to change priority of my plugin be loaded (calling onEnable) besides of set depend?

#

so I want my plugin be loaded as early as possible (optimally the first one)

thorny python
#

._.

#

how

waxen plinth
#

load: STARTUP

thorny python
#

uh

#

in plugin.yml?

waxen plinth
#

Yes

thorny python
#

let me try it out

waxen plinth
#

What are you actually trying to do though

#

Sounds like an xy problem

trail lintel
#

Gonna ask again I think it got buried. Is there any sort of mocking or stress testing strategy I can do for my plugin to test it on hundreds of players? My little server only ever gets like 10 at a time.

#

I know about /timings but I need to see how it works with a large number of players

thorny python
#

ya that's works perfect, thanks

waxen plinth
#

Simulating player activity for hundreds of players at a time would be a stress test for even the strongest of computers

glad ruin
#

isn't 100 players almost nothing

#

1000 even

trail lintel
#

Yeah haha thats fair, I just wanna see how it would perform on a "large server". Its hard to tell if my approach just utilizing hash maps for storage is scalable

glad ruin
waxen plinth
waxen plinth
#

And figure out the overhead of every method you're using

tardy delta
#

is there a difference between file.mkdirs() and file.getParentfile().mkdirs()?

waxen plinth
#

Yes

#

One makes the file as a directory

#

The other makes the parent

fringe latch
#

Hey! Is there a way to check if a server is running Paper or Spigot?

#

similarly to /version

scenic hornet
#

Is their a plugin where i can connect a BungeeCord server to a discord bot?

mighty sparrow
#

Is there a way to get the memory usage of the server ?

#

as an integer or other

mortal hare
#

does anyone from here use Jetbrains notnull and nullable annotations here

chrome beacon
#

Bukkit#getOnlinePlayers

mortal hare
#

that returns collection but ok

unborn yarrow
mighty sparrow
#

Never used in plugin development

#

But in android studio yes

mortal hare
#

is it me or do they check the passed arguments in run time?

mighty sparrow
#

I think that yes ?

mortal hare
#

i get illegal state exceptions that passed values are null even though i havent added guard clauses

mighty sparrow
#

You should watch a video about this on the internet. Annotation tutorial

mortal hare
#

ik how annotations work, but i thought jetbrains annotations are only for compile time (for IDE to mark yellow)

#

not for runtime

mighty pier
#
    @EventHandler
    public void onDamage(EntityDamageByEntityEvent e){
        if (e.getEntity() instanceof Arrow){
            Player player = e.getDamager();``` how do i get the item the arrow was fired with
mortal hare
#

arrow entities afaik doesnt hold that information. nvm

waxen plinth
mighty pier
#

i have no clue

#

i think i know what to do

#

i dont need help

golden turret
#

how could i get the player speed in blocks per second?

#

so i could do something like if (getSpeed(player) > 2.25)

visual tide
#

you could cast it

#

or just new Arraylist(Bukkit.getOnlinePlayers())

ivory sleet
chrome beacon
#

Do what the javadocs tell you

visual tide
round finch
#

Why not sign onlineplayers to list

#

Instead

#

Idk?

ivory sleet
#

Because there’s not particular order of the online players

round finch
#

But i would just use the api

ivory sleet
#

Which the List interface to some extent promises

round finch
sacred prairie
#

what are you guys talking about?

round finch
#

Promises?

ivory sleet
#

Yes, it the List interface promises that the implementation has some sense of order, for instance ::set and ::get which are index based.

rough drift
#

Can you send PluginMessages with a player you got from the PlayerQuitEvent?

round finch
#

Ah ok you saying to use arraylist right?

ivory sleet
#

If Bukkit would expose it as a list, then it would have to provide a list implementation which supports it, which it doesn’t do as of now (It even goes against the collection interface by not supporting Collection::add)

#

in short terms yes

ivory sleet
#

And it shouldn’t be that expensive if you use new ArrayList<>(blah);

#

(Altho a little but not noticeable)

round finch
#

Ahh.. sorry my bad for saying wrong here lol

ivory sleet
#

No worries

rough drift
# sacred prairie wdym exactly

i need to send some data when a player logs off the server to another server, can you use the player that left (PlayerQuitEvent#getPlayer) to send a plugin message?

round finch
#

I didn't mean literally to use List<>

#

Can some tell shortly about collection

#

On Mobile rn

sacred prairie
rough drift
#

a plugin message channel

#

not a message

#

event.getPlayer().sendPluginMessage(Main.INSTANCE, "MyChannel", out.toByteArray());

wide coyote
#

yes you can

#

i mean it should work

#

it still returns a player object

sacred prairie
#

you can try it out i guess

wide coyote
#

ye try and see

round finch
#

Bungee yea

sacred prairie
#

?

wide coyote
#

can swear he is going to say use velocity

rough drift
#

?

wide coyote
#

man thats not about you just read the message above those

rough drift
#

oh

ancient plank
#

plugin channels don't just apply to bungee, for example you can use it for custom packets to communicate between a client mod and the server

rough drift
#

yes i am aware

robust forge
#

Hello how can I set the clicked item to Air in InventoryClickEvent? I have tried using the code below, but it doesnt work.
clickedItem.setType(Material.AIR);

visual tide
#

set the slot to a new air itemstack

quaint mantle
#

how to make the player climb like jumping on a slime at a certain height?

round finch
#

Isn't it possible to use remove item index?

sacred prairie
#

I think:

item.setType(Material.AIR);
inventory.setItem(event.getSlot, item);```
waxen plinth
#

Why would you not just do inventory.setItem(slot, null)

sacred prairie
#

bekause no

#

xD

candid galleon
#

shouldn't you do event.setItem(ItemStack)

sacred prairie
#

dint thought about that

#

@waxen plinth

waxen plinth
#

Why are you pinging me

sacred prairie
#

bekause i wanna say you that i am dumb

waxen plinth
#

Ok you don't have to ping me for that

robust forge
candid galleon
#

@waxen plinth

waxen plinth
#

dsfgjklbjldsfjgjlsjdbfbgljlbjsdebhg

candid galleon
#

🙂

#

what's a good mod name

#

I'm trying to come up with one

waxen plinth
robust forge
#

I can set the slot to everything else except air

waxen plinth
#

Delete the item the player clicks on?

robust forge
#

Yes

waxen plinth
#

Ok

sacred prairie
#

thats what i tried

tardy delta
#

boo

waxen plinth
#
e.setCancelled(true);
Bukkit.getScheduler().scheduleSyncDelayedTask(() -> {
  e.getInventory().setItem(e.getSlot(), null);
});```
candid galleon
#

grosssssss

robust forge
#

:D

#

Scheduler

waxen plinth
#

You often need to delay stuff by a tick for inventory events

candid galleon
#

that's so annoying

waxen plinth
#

I know

wicked lake
waxen plinth
#

Ok and you could also not ping me

wicked lake
#

Sure my bad

waxen plinth
#

Seriously I have been pinged 4 times in the last 5 minutes here

candid galleon
#

that's an uneven amount

sacred prairie
#

new rekort

candid galleon
#

we should balance it out

#

5 times in the last 5 minutes

hasty prawn
#

Did you really just complain about pings lol

wicked lake
#

Replies just give some context for me, so I'm used to using em

hasty prawn
#

Disable them and don't be a baby.

candid galleon
#

you can reply w/o pinging

wicked lake
#

Oh can you :o

hasty prawn
#

Yeah, the @ symbol on the right side.

wicked lake
#

Ohh okay chill

#

Thanks for showing me that

candid galleon
#

yep

waxen plinth
#

I'm open to being pinged when it makes sense

hasty prawn
#

If it was random, sure, if you're actively talking to people, don't complain.

#

That's the point of them.

#

If you don't like pings, disable them.

waxen plinth
#

I generally don't complain about reply pings

#

I complain more when people ping me outright when they really don't need to

hasty prawn
#

Lol alright

waxen plinth
#

Sorry that my preferences upset you

sacred prairie
#

Do you have ideas what an reforge effect for an bow with the reforge spiritual can have?

hasty prawn
#

Just don't like when people complain about stupid shit that they can prevent. ¯_(ツ)_/¯

sacred prairie
#

¯_(ツ)_/¯

waxen plinth
#

"don't like junk mail? just delete your email account!"

hasty prawn
#

Ah yes, because everyone can prevent junk mail. LOL

candid galleon
#

getting a bit off topic eh

waxen plinth
#

Yes

#

Someone ask for help

sacred prairie
# hasty prawn What does that mean

I made an plugin where you can reforge stuff with souls and you can reforge an bow to spiritual, but idk what the special effect of the bow could be

hasty prawn
#

Oh

robust forge
#
    public void deleteUnwantedItems(InventoryClickEvent e) {
        if (e.getClickedInventory() == null) {
            return;
        }
        if (e.getInventory().getHolder() instanceof BodySearchGUI) {
            return;
        }
        e.setCancelled(true);
        new BukkitRunnable() {
            @Override
            public void run() {
                e.getInventory().setItem(e.getSlot(), null);
            }
        }.runTaskLater(Main.instance, 1L);
    }```
hasty prawn
#

Idk the context, but maybe you can get more souls with it or something

robust forge
#

Doesnt set it to air

waxen plinth
#

Why do people still use BukkitRunnable

#

Add some debug output to make sure the code is actually running

robust forge
#

It is

#

I have debugged it

#

Runs everything but doesnt set the item

waxen plinth
#

Wait, it might have to be e.getClickedInventory().setItem

hasty prawn
#

^

waxen plinth
#

So the event is being cancelled?

hasty prawn
#

I wonder if setting the cursor item to null would work without the delay?

candid galleon
waxen plinth
#

..what

robust forge
#

Now it works lmao

waxen plinth
#

Cool

robust forge
#

I set it to e.getClickedInventory

#

Spigot do be destroying my brains

quaint mantle
#

e.getPlayer().setVelocity(new Vector(0,3,0));
?

sacred prairie
hasty prawn
sacred prairie
hasty prawn
#

You could still have some sort of drop multiplier for that

candid galleon
sacred prairie
#

sry i upload it on yt

#

one sek

tender shard
#

don't use any undefined symbols

lyric grove
#

im not?

tender shard
#

you do

#

maybe show actual code

lyric grove
#

where?

tender shard
#

in line 37

candid galleon
#

did you copy any code?

tender shard
#

and 44

#

and 59

#

and so on

lyric grove
tender shard
#

show the correct file please

#

the one thats mentioned in the error

#

idk which one it is because it's not visible on your screenshot

candid galleon
#

scroll up when you hover over the "cannot find symbol" section

#

might give you more info

#

there ya go

tender shard
#

invitecommand class, line 25 etc

lyric grove
#

showing up everywhere, just randomly and was working before

#

line 25?

candid galleon
#

I would try Invalidating your caches and restarting

lyric grove
#

i did

sacred prairie
lyric grove
#

multiple times i even reinstalled java and intelijj

tender shard
#

maybeee

#

you could just finally show the file that's causing the error

lyric grove
#

i did

#

xd

tender shard
#

scroll up and show the file again

candid galleon
#

maybe try duplicating the project?

lyric grove
#

how?

tender shard
#

?paste the invitecommand class here pls

undone axleBOT
lyric grove
#

there is literally nothing wrong with it theres no point

tender shard
#

okay then good luck getting it to work

lyric grove
#

its a bug with intelijj i just dont know how to fix it

candid galleon
lyric grove
#

yeah already went over all of those articles, nothings working

candid galleon
#

is your project on git?

lyric grove
#

no

#

should i add it?

candid galleon
#

just trying to see if you're able to replicate the issue

sacred prairie
proud basin
candid galleon
#

doesn't bungee use redis

golden turret
#

how could i set a light level in a section of blocks?

#

1.16.5

proud basin
#

idk

regal dew
#

bungee does not use redis lol

golden turret
#

for example, i would like to set the light leve to 13 in that glasses area

regal dew
#

redis is a separate database/msg broker

#

you run it like you run mysql

candid galleon
#

the more you know

proud basin
#

im trying to use it so I can send messages across servers

quaint mantle
#

help, text isn't above spawner

candid galleon
golden turret
#

i said 1.16.5

candid galleon
#

if you don't want to do that, you might have to use Packets / NMS

regal dew
proud basin
#

redisson?

regal dew
#

similar thing as jedis

#

its a client / library to interact with your redis db

quaint mantle
#

The text is not directly on top of the spawner, how to fix?

                HologramBuilder hologram = new HologramBuilder(plugin);

                hologram.create(b.getLocation().add(0,1,0), "Teste");
    private KSpawners plugin;

    private List<ArmorStand> holograms = new ArrayList<ArmorStand>();

    public HologramBuilder(KSpawners plugin) {
        this.plugin = plugin;
    }

    public void create(Location l, String text) {
            ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
            as.setVisible(false);
            as.setCustomNameVisible(true);
            as.setCanPickupItems(true);
            as.setGravity(false);
            as.setSmall(true);
            as.setCustomName(PlaceholderAPI.setPlaceholders(null, text.replace("&", "§")));
            holograms.add(as);
    }```
proud basin
#

so if other people were gonna use this plugin would they need to have a redis db?

regal dew
#

yes

proud basin
#

okay

waxen plinth
#

They are in the corner

proud basin
#

im assuming i can just install redis on a vps

quaint mantle
#

how to fix

waxen plinth
#

Doing add(.5, 1.5, .5) instead of add(0, 1, 0) should work

regal dew
quaint mantle
#

trying

proud basin
#

Frank you mind helping me out with implementing it?

#

actually

#

hold up

quaint mantle
#

in 1.0

#

,_,

proud basin
#

yeah im confused on how its suppose to work

waxen plinth
#

Ok then use common sense

young knoll
#

Just add less to the y

quaint mantle
waxen plinth
#

Yeah exactly

#

We're not here to write all your code for you, think for yourself a bit

quaint mantle
#

._.

#

Thank you!

#

Thank you!

swift adder
#

How could I do a custom wait time?

solution = 0
alt = 1
ctrl = 1
delete = 1

if solution == 0 then
  print(solution + alt + ctrl + delete)
end```
proud basin
#

is this python

#

or lua

waxen plinth
#

Lua

#

You can easily google these things

swift adder
#

I did but everything coming up was like confusing confusing

rough drift
#

question, is there a better way to check if a server is the same as another server than to just check the name?

#

bro even i understand that

swift adder
#

What?

rough drift
#

and i don't use lua

#
require "socket"

function sleep(sec)
    socket.select(nil, nil, sec)
end

sleep(0.2)
swift adder
#

Nah it was another website

rough drift
#

there

#

use that

swift adder
#

That doesn't explain anything

proud basin
regal dew
#

a client can subscribe (listen) to a topic

#

another client an publish to a topic

#

so basically message brokering

worldly quest
#

i was told to use gradle or maven instead of the 1.18 spigot jar for plugins but im not sure where to start. could someone help me get started?

proud basin
#

so im assuming I will need those

rough drift
#

its pretty easy, in your pom.xml add this:

<repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
```And if you are using intellij, on the top right of the file there will be a reload button, press that and you're done
worldly quest
#

oh i dont even have gradle installed

rough drift
#

maven

#

its

#

maven

worldly quest
#

oh

#

yeah i dont have it installed

rough drift
#

are you using intelij?

worldly quest
#

eclipse

rough drift
#

oh then iirc you need the maven plugin and then you can make maven projects

worldly quest
#

oh

rough drift
#

i used to use eclipse for a few years tho i switched to intellij

worldly quest
#

should i swap to intellij

rough drift
#

its just better

rough drift
#

tho its more resource intensive

proud basin
worldly quest
rough drift
#

oh and if you have intellij there is a plugin named "Minecraft Development" or smt like that, it can autosetup plugins for bukkit, spigot, paper, bungeecord, waterfall and fabric/forge mod and some other things

regal dew
worldly quest
#

do you know of a tutorial for intellij i could only find one for eclipse which is why i used eclipse

proud basin
#

I've got the connection down

waxen plinth
#

Ask somewhere else, this is a chat for people to get help with code

swift adder
#

what does it mean by groupid and artifactid in eclipse?

#

I mean intellij

proud basin
#

uh so im connecting to redis right and now my plugin is just not loading when I call the instance of i t

#

no errors or anything its like it froze

swift adder
#

what do I do here?

waxen plinth
#

Are you trying to add a dependency?

crisp arch
#

Im making NPCs, but i have an issue. When i use the code below to display the NPC, everything works fine, and the NPC has a skin and everything.

connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc));

connection.send(new ClientboundAddPlayerPacket(npc));

// connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc));

But when I uncomment the third line, the NPC gets the default alex/steve skin. There are no errors in console.

connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc));

connection.send(new ClientboundAddPlayerPacket(npc));

connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, npc));
#

btw the third line is to remove the npc's name from tablist

rigid drum
#

@crisp arch that's because player info contains the skin and other profile properties

#

The most reliable solution is to simply also add a custom tab system which will fill the tab with blank entries and push the npc names off the end.

#

the unreliable solution is to wait several ticks and then send PPOPI remove

#

However some of the time the skin will still go away since there is no real way of knowing how quickly the client will receive the second packet

#

There is one slightly more complicated but also somewhat more reliable way

crisp arch
#

so wait, how do plugins like Citizens do it?

rigid drum
#

which is why you start be sending PPOTransaction

#

and then await for the response from the client

#

and then you send the removal since that means at least 1 tick will have gone by first... but ofc the name will flicker in tab list this way no matter whatever.

kind hatch
rigid drum
#

^ that is highly recommended no matter what

fallow storm
#

Hey I swapped out the 1.17.1 jar I was referencing for plugins for a newly built 1.18.1 jar and now all my references can't be resolved (import doesn't recognize anything from org.bukkit etc). I unzipped the jars and noticed that the 1.18.1 jar I built only has four classes in it, which doesn't seem right. Are we supposed to import something else now?

rigid drum
#

the entity tracker takes away a lot of the hard work

fallow storm
#

I took a look at the release thread and it just said "we don't expect many plugin breakages except for anything touching biomes or generation" so I'm pretty confused about this

rigid drum
#

but even if you use tracked entities you still need to handle player info yourself... and I do not think there is any way around them flickering

crisp arch
#

one sec

waxen plinth
#

YOOOOO

#

@rigid drum holy shit dude long time no see

kind hatch
fallow storm
#

Yes I did

rigid drum
#

Transaction packet is part of inventories

#

@waxen plinth oh damn what's up?

fallow storm
#
pause```
kind hatch
#

Did it actually finish successfully?

waxen plinth
#

In college now

#

Damn penzzly was so long ago

rigid drum
#

Sure was

#

Although TBH I still know a shocking number of people from Penzzly

waxen plinth
#

It was a tight-knit bunch

rigid drum
#

yeah

waxen plinth
#

These days I'm still working on the same library I used back then

swift adder
#

I compiled my plugin with intellij went to the location and there's no .jar file

waxen plinth
#

Some things never change I suppose

rigid drum
#

@waxen plinth which one was that?

waxen plinth
#

RedLib

rigid drum
#

link

waxen plinth
kind hatch
rigid drum
#

I mean TBH I still work on my engine although it's very different

fallow storm
sullen marlin
#

Read the release notes

waxen plinth
#

What engine?

swift adder
#

Where to find .jar file after compile?

waxen plinth
#

I remember your Tr.y thing, did you ever make anything of it?

#

inb4 "that's vavr now"

rigid drum
#

lol no, that was bad stuff.

waxen plinth
#

Was funny though

kind hatch
fallow storm
#

It was a fresh update of BuildTools, I had to update it. Had to update Java too apparently, so that's also a fresh install.

rigid drum
#

yeah it was, these days I use kotlin primarily it's more powerful.

waxen plinth
#

I still stick with java

#

I've tried kotlin, not for me

ivory sleet
#

nokotlin 😄

rigid drum
#

I'm working on a custom server impl that's not just nms copy pasted into another language.

swift adder
#

Oh I see what I did

#

I compiled it, not package

waxen plinth
#

Oh?

#

Are you rewriting it in kotlin or something else?

sullen marlin
#

Your question is clearly covered there and probably 100 threads made since

rigid drum
#

yes, since I have my networking library and my engines architecture in kotlin.

waxen plinth
#

Makes sense

proud basin
#

uhm ```
[16:41:15 WARN]: redis.clients.jedis.exceptions.JedisDataException: ERR Can't execute 'publish': only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this context
[16:41:15 WARN]: at redis.clients.jedis.Protocol.processError(Protocol.java:96)
[16:41:15 WARN]: at redis.clients.jedis.Protocol.process(Protocol.java:137)
[16:41:15 WARN]: at redis.clients.jedis.Protocol.read(Protocol.java:192)
[16:41:15 WARN]: at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:316)
[16:41:15 WARN]: at redis.clients.jedis.Connection.getUnflushedObjectMultiBulkReply(Connection.java:282)
[16:41:15 WARN]: at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:131)
[16:41:15 WARN]: at redis.clients.jedis.JedisPubSub.proceed(JedisPubSub.java:124)
[16:41:15 WARN]: at redis.clients.jedis.Jedis.subscribe(Jedis.java:7335)
[16:41:15 WARN]: at dev.stuntcore.database.RedisManager.lambda$new$0(RedisManager.java:24)
[16:41:15 WARN]: at java.lang.Thread.run(Unknown Source)

waxen plinth
#

I've been moving away from minecraft, though I still write a lot of code for it

#

Trying to learn rust and have also just been writing pure java libraries

fallow storm
sullen marlin
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or use a dependency manager such as Maven or Gradle to handle this automatically.

#

Copy pasted directly from your link

unreal quartz
fallow storm
#

Oh it's on a second comment fml

waxen plinth
#

Kotlin is full of ideas

#

I like some of them, others I don't

rigid drum
#

@waxen plinth yeah I mean until recently MC was just on the side... but I don't like working 9 to 5. I do crypto stuff and I'm writing this custom server for a network so it's pays well enough to be worth it.

waxen plinth
#

Nice

#

I would rather work a 9 to 5 because I like stability more than anything

#

But I can understand the disdain for it

rigid drum
#

Kotlin has plenty of problems... but I was just running into the edge of what was possible in java. Improving design further meant taking performance hits

#

Now I've run into the edge of Kotlin and I'm contemplating scala.

waxen plinth
#

The edge being what?

#

Java has always been very accommodating of my abstractions

#

Though seeing as I used to call your code "lambda porn" it makes sense that you would go towards a functional lang

misty current
#

how can I remove commands from the knownCommands Map?

#

do i need to get it with reflections

waxen plinth
#

By retrieving it reflectively and then removing from it

#

Yes

misty current
#

ah oke

#

i guess i need to get with reflections the CommandMap

#

from server

golden turret
misty current
#

and them the map from CommandMap?

#

thanks

waxen plinth
#

You can copy-paste it if you want

rigid drum
#

GEN 3 (Vespa based engines):

public class ExampleComponent implements Component {
    private final Togglable addListener, removeListener;

    public ExampleComponent(final Holder<Player> players) {
        addListener = players.onAdded(player -> {
            System.out.printf("%s was added!", player.getName());
        });
        removeListener = players.onAdded(player -> {
            System.out.printf("%s was added!", player.getName());
        });
    }

    @Override public void onEnable() {
        addListener.enable();
        removeListener.enable();
    }
    @Override public void onDisable() {
        addListener.disable();
        removeListener.disable();
    }
}

GEN 4 & 5 (Wespen based engines):

public class ExampleComponent extends Component {
    public ExampleComponent(final Holder<Player> players) {
        addChild(players.onAdded(player -> {
            System.out.printf("%s was added!", player.getName());
        }));
        addChild(players.onRemoved(player -> {
            System.out.printf("%s was removed!", player.getName());
        }));
    }
}

GEN 6(Suzuebachi based engines):

inline fun Toggled.Example(players: Holder<Player>) {
    players.onAdded { println("$name was added!") }
    players.onRemoved { println("$name was removed!") }
}

Gen 3: 21 lines -- 120 bytes
Gen 4 & 5: 10 lines -- 456 bytes
Gen 6: 4 lines -- 80 bytes

misty current
#

how are they stored exactly? what is the string? only the command name or plugin:commandname?

#

Command is pretty straightforward

waxen plinth
#

So you're trying to reduce the boilerplate as much as possible

rigid drum
#

Yes but also reduce the overhead

#

thre is almost no overhead from the kotlin example by comparison

waxen plinth
#

Kind of reminds me of my enchant library

#
addTrigger(EnchantTrigger.MINE_BLOCK, (e, l) -> {
  e.getPlayer().sendMessage("You mined a block!");
});```
#

Though there is some value in boilerplate like classes and overridden methods

ivory sleet
misty current
#

oh i did something similar for my enchants, tho it's a bit bigger

#

you implement an interface

#

and you need to implement various methods to get the max level, type, rarity

proud basin
rigid drum
#

the most direct java translation is this:

static void Example(Toggled scope, Mutated<Player, Player> players) {
  scope.invoke(scope, Containers.getOnAdded(players), player -> {
      System.out.printf("%s was added!", player.getName());
  });
  scope.invoke(scope, Containers.getOnRemoved(players), player -> {
      System.out.printf("%s was removed!", player.getName());
  });
}
misty current
#

and then a final one to execute code for the enchant effect

waxen plinth
#

I do focus on abstractions like that a lot, but the rest of my work usually involves pushing performance to the limits

unreal quartz
ivory sleet
#

😔

golden turret
#

Help with inverting entity direction

waxen plinth
#

Both

halcyon mica
#

Does spigot in 1.18 require a plugin.yml in independent libraries now?

waxen plinth
#

The direct command name, alias, and fallback prefixes are all used

misty current
#

wait so it stores duplicates

#

ooh

halcyon mica
#

A plugin that depends on a unrelated library fails to load because spigot attempts to initialize the lib jar as a plugin

#

And as a independent lib, it lacks one

waxen plinth
#

I suppose we should move to DMs

kind hatch
misty current
#

so let's say my command is called test and has test1 as alias, i need to remove
test, pluginname:test, test1, pluginname:test1

halcyon mica
misty current
#

there is no plugin.yml

rigid drum
halcyon mica
#

It attempts to initialize the jar as a plugin, fails, and does not add it to the classpath

rigid drum
#

what unregisters that?

halcyon mica
waxen plinth
#

That's in a class

#

The full class would look like this

misty current
halcyon mica
#

Because it is a library another plugin depends on

waxen plinth
#
public class HelloEnchant extends CustomEnchant {

  public HelloEnchant() {
    super("Hello", 1);
    addTrigger(EnchantTrigger.MINE_BLOCK, (e, l) -> {
      e.getPlayer().sendMessage("Hello");
    });
  }

}```
misty current
#

you should shade the lib into your plugin

halcyon mica
#

it's worked fine before

waxen plinth
#

Spigot now has a separate libraries folder I believe

kind hatch
halcyon mica
#

That... is not the issue

kind hatch
#

Am I misunderstanding?

misty current
#

you can't have libs in the plugin folder, everything there must provide a plugin.yml and a main class extending JavaPlugin

rigid drum
misty current
#

else spigot doesn't know what to do with it

halcyon mica
#

So it's something 1.18 introduced then

misty current
#

and throws an exception

halcyon mica
#

Is that change documented somewhere?

waxen plinth
misty current
#

afaik it's always been like that

halcyon mica
#

That is not true

sullen marlin
#

Yes it is

waxen plinth
#

Then you supply a lambda which takes T and an int for the level

misty current
#

if you had used a different lib, it might have had a plugin.yml

sacred ice
#

plugin lib

halcyon mica
#

Then I am suprised how it worked until 1.17

misty current
sullen marlin
#

Everything in the plugins folder needs a plugin.yml

waxen plinth
#

It's to make it easier to define custom enchantments, that lambda will only be run if they mine a block with a pickaxe enchanted with your custom enchant

waxen plinth
#

Yes

#

That's how it works

misty current
#

thanks

waxen plinth
#

Otherwise you would need to iterate over all the commands when running one to see which one matches

halcyon mica
#

So you're telling me the fact that it has worked until now was because of a bitflip caused by a solar flair, and the only way to load external libraries now is to shade them?

misty current
#

is that the exact string? "pluginname:commandname"

waxen plinth
#

Yes

prime reef
#

Is there a changelog somewhere for major API changes? I'm not interested in poring through the commit history on Stash

waxen plinth
#

You can try these things yourself

misty current
halcyon mica
prime reef
misty current
#

as i said, the lib probably had a main class and a plugin.yml

halcyon mica
#

It did not

prime reef
#

that or the lib was a plugin, yeah

rigid drum
#

a big part of what my engine focuses on making reactive code that stays clean... so this code here doesn't translate to very readable java... because there are many layers of Toggled that you do not see at all.

fun Toggled.whatever(online: Adepts) {
  val playing = MutableTable<Id, Togglable>()
  (online - playing).onEach { id, adept ->
    adept.handle("/spec") {
      val target = player(online and playing, "That player is not online and in a game.")
      action {
        playing[id] = playing[target.id]
        channel.send("§7You are now spectating §c${target.name}§7.")
      }
    }
  }
}

/spec command is only listening to players who are not playing a game... and the only valid targets are people who are playing a game.

misty current
#

if you were putting it into the plugins folder

halcyon mica
#

I made both the plugin, and the lib

proud basin
#

@regal dew okay so I think I got it setup properly how can I tell if I did it properly? Is the only way to see if it can communicate between servers?

prime reef
#

e.g. python

misty current
#

sounds pretty strange to me but even if it worked it should not be like that

prime reef
#

yeah that's not how your libraries should be set up

misty current
#

either shade it or make the lib a plugin

prime reef
#

^

waxen plinth
#

Yeah that seems reasonable

regal dew
waxen plinth
#

Anything for the abstractions

rigid drum
proud basin
#

ah sorry

waxen plinth
#

Data such as what?

misty current
#

abstraction 😍

regal dew
#

just test it, send some data and retrieve it

prime reef
#

me out here basically writing Spring Boot for Spigot

proud basin
#

that's what I did and seems like it works

rigid drum
#

well IDK enchantment name etc, what if bound to the player... obv it's tricker when you are working within the confines of spigot and nms.

waxen plinth
#

I see

prime reef
#

annotation magic: the plugin

waxen plinth
#

My command handler separates data and logic to the maximum degree

#

So much so that it has its own markup language for commands

prime reef
#

as it should

#

re: separation of data and logic

waxen plinth
#
commandname int:arg1 {
  hook hookname
  permission test.thing
  user player
  help This is an example
}```
#
@CommandHook("hookname")
public void example(Player sender, int arg1) {
  // Do stuff
}```
prime reef
#

i just let people annotate the full command including parents and the command handler throws together a command tree at runtime

misty current
#

i love touching stuff i should not touch in spigot, it makes me understand how shit works

crisp arch
#

anyone know the MojangMappings equivalent of DataWatcher#watch ?

prime reef
misty current
#

what was the outcome?

waxen plinth
prime reef
#

It really messed some shit up with other plugins

waxen plinth
#

That's how almost every other command library does it

#

But it's so elegant with this format

quaint mantle
#

how to set skin in a skull on itemstack?

prime reef
waxen plinth
#
basecommand,alias {
  // metadata here
  childcommand {

  }
}```
misty current
#

lmfaoooo

rigid drum
#

but like I would probably end up with something like:

interface Enchantment {
  name, blah blah
}
//ok so just a normal class here.
fun Enchantment(name, blah blah) = object : Enchantment {

}

val Players.Enchantment get() Toggled.(name, blah, blah, (Player, ...) -> (Unit)) -> (Enchantment) = { name, blah, blah, onUse ->
  val enchantment = Enchantment(name, blah, blah)
  onEach { _, player -> {
    player.onUse { onUse(player) }
  }
  enchantment
}
misty current
waxen plinth
#

It's really nice especially because it has an intellij plugin for syntax highlighting

prime reef
#

doing @Command("egg") and just letting the command handler throw everything together at runtime is more fun

misty current
waxen plinth
#

You could always create your own triggers to simplify it though

prime reef
#

also frankly I'm sick of adding in other language files/etc., I do enough of that with JavaFX

rigid drum
#

so in your <scope that uses enchantment>

val customEnchantment = players.Enchantment("hello", ..., onUse = {
  //impl
})
rigid drum
#

which bounds the enchantment into the scope with the players who it will be applicable to

prime reef
#

i misunderstood, mb

misty current
#

in case you wanna see, this is how I manage enchantments:

public class Efficiency implements RareEnchant, MiningEnchant {

    @Override
    public String getId() {
        return "efficiency";
    }

    @Override
    public String getDisplayName() {
        return "Efficiency";
    }

    @Override
    public String getDescription() {
        return "Increases mining speed.";
    }

    @Override
    public int getMaxLevel() {
        return 6;
    }

    @Override
    public int getMaxFindable() {
        return 5;
    }

    @Override
    public EnchantRarity getRarity() {
        return EnchantRarity.SIMPLE;
    }

    @Override
    public EnchantType getType() {
        return EnchantType.PICKAXE;
    }


    @Override
    public void onMineTick(MiningWrapper wrapper, int level){
        double multi = 1 + level * 0.06;
        if(level == getMaxLevel()) multi += 0.04;

        wrapper.setDamage((int) (wrapper.getDamage() * multi));

    }

    @Override
    public void onMineBlock(MiningWrapper wrapper, int level) {

    }
}
waxen plinth
#

Jesus

misty current
#

sorry lol

waxen plinth
#

Yeah that's why we need abstractions

rigid drum
prime reef
#

the syntax is still a bit questionable, but the parenting is nice

waxen plinth
#

With mine the trigger you specify determines the default items it applies you

waxen plinth
#

You simply pass the name and max level in the constructor rather than needing 2 methods for them

prime reef
#

the main reason I don't want to do something like that on my end is because a lot of what I write focuses on modularity

prime reef
misty current
#

ah

waxen plinth
prime reef
prime reef
waxen plinth
#

Oh lol

misty current
#

btw if you wonder why i have on mine tick and on mine block it's because of custom mining, i can tweak all values i want

rigid drum
#

the way I do commands now is completely functional... no concept of sub commands.

waxen plinth
#

Yeah it does take some getting used to but it cuts through boilerplate

prime reef
#

i spent this semester writing low-level C that's basically a step above ASM

prime reef
rigid drum
#

well for starters you can just do like:

players.onEach { _, player ->
  player.handle("/parent sub") {

  }
}
prime reef
#

but from a programming standpoint, it's functional

#

like, the subcommand system is entirely just for "help [command]"

waxen plinth
#

Well then what happens when you have a parent command that takes a string argument

prime reef
#

varargs

waxen plinth
#

And a player wants to run that base command with the argument sub?

rigid drum
#

but you can also do:

players.onEach { _, player ->
  player.handle("/parent") {
    matching("sub") {
      
    }
  }
}
misty current
#

this syntax looks kinda illegal lol

waxen plinth
#

That's not really separating metadata from logic though

misty current
#

kothlin right

waxen plinth
#

Yeah

prime reef
#

the tl;dr on why I'm just going to keep using annotations is because I want people to be able to develop plugin extensions

quaint mantle
misty current
#

aight

rigid drum
#

and matching is just a type adapter like any other so you could also have:

players.onEach { _, player ->
  player.handle("/parent") {
    player(moderators) { target ->
       //if they targeted a moderator
    }
  }
}
prime reef
#

the rpg plugin i'm working on is designed with modules in mind

waxen plinth
#

In mine that would look like

prime reef
#

so like it'll load behaviors/commands/abilities from other .jar files

waxen plinth
#
parent player<moderator>:target {

}```
#

And then the command would just take a Player as an argument

prime reef
#

plus the entire thing is customizable so working with it is absolute hell because nothing is hardcoded besides the core systems, it's all config

crisp arch
prime reef
#

i hate coding it

rigid drum
#

yeah but that's complexity and how do you define who mods are etc?

misty current
#

i tried sending in chat the knowncommands and the server kicked me

#

nice

waxen plinth
#

That's up to you

crisp arch
#

i tried passing in an int and a byte but it doesnt match the method's parameters

waxen plinth
#

You can define constraints for anything

rigid drum
#

where do you add that though? I don't see where you gain value from having a markup

quaint mantle
rigid drum
#

it also means now your commands have depends all the way down to the file system

waxen plinth
#

It's reusable

waxen plinth
# quaint mantle Error '-'

Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.SkullMeta

#

It's not a skull

waxen plinth
rigid drum
waxen plinth
#

I don't really see how it's all that different from depending on another class

rough drift
#

So the PlayerQuitEvent only triggers when a player leaves the proxy, and not switches server, is there any other event that i can use for listening when a player switches server (on a spigot plugin)?

waxen plinth
#

And there is plenty of value in defining constraints like that

crisp arch
quaint mantle
# waxen plinth It's not a skull

code:

    public void createHead(Location l, String Nick) {
        ItemStack skull = new ItemStack(Material.SKULL);
        SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();

        skullMeta.setOwner(Nick);
        skull.setItemMeta(skullMeta);
        ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);

        as.setVisible(false);
        as.setCustomNameVisible(true);
        as.setCanPickupItems(true);
        as.setGravity(false);
        as.setSmall(true);
        as.setHelmet(skull);
        holograms.add(as);
    }

misty current
#
    public void unregisterCommand(Plugin plugin, CommandExecutor executor){

        knownCommands.remove(plugin.getName() + ":" + executor.getName());
        knownCommands.remove(executor.getName());
        for (String alias : executor.getAliases()) {
            knownCommands.remove(plugin.getName() + ":" + alias);
            knownCommands.remove(alias);
        }

    }

so would something like this work?

rigid drum
#

show me where you add the constraint though

unreal quartz
waxen plinth
#

You can do int<1,100>:number and it will only allow ints from 1 to 100

misty current
rough drift
unreal quartz
#

yes

rough drift
#

a plugin not on the proxy

unreal quartz
#

yes

rough drift
#

i don't see it

rigid drum
#
players.onEach { _, player ->
  player.handle("/parent") {
    val whatever = int(1..100, "error when out of bounds")
  }
}
unreal quartz
#

then you coded it wrong

misty current
#

nice idea

rough drift
#

the event is just not there

waxen plinth
unreal quartz
#

idk, i can't read your mind

waxen plinth
#

My default int type also can be constrained by default

#

But when you want to define another type?

#

Like if you have a team, and you want to constrain it so only a team the player owns can be targeted?

rough drift
#

When a player switches a server within the proxy, can you know when that happens from a server in the proxy's point of view?

rigid drum
#

where do you register the constraint?

#

also "world" becomes a magic value there

waxen plinth
#

You register it prior to parsing the command file

rigid drum
#

int is not since it's compile time checked

crisp arch
#

@rigid drum i think it might be SynchedEntityData#define, but im not 100% sure

waxen plinth
#

How is it a magic value

rigid drum
#

@waxen plinth and where do you register it?

unreal quartz
quaint mantle
#

Help?

    public void createHead(Location l, String Nick) {
        ItemStack skull = new ItemStack(Material.SKULL);
        SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();

        skullMeta.setOwner(Nick);
        skull.setItemMeta(skullMeta);
        ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);

        as.setVisible(false);
        as.setCustomNameVisible(true);
        as.setCanPickupItems(true);
        as.setGravity(false);
        as.setSmall(true);
        as.setHelmet(skull);
        holograms.add(as);
    }
waxen plinth
#

You register it in your onEnable typically

rigid drum
#

like what if I want to constraint to people in a game...

crisp arch
#

is this it?

rigid drum
#
fun Toggled.whatever(online: Adepts) {
  val playing = MutableTable<Id, Togglable>()
  (online - playing).onEach { id, adept ->
    adept.handle("/spec") {
      val target = player(online and playing, "That player is not online and in a game.")
      action {
        playing[id] = playing[target.id]
        channel.send("§7You are now spectating §c${target.name}§7.")
      }
    }
  }
}
young knoll
#

Your item is not a skull

rigid drum
#

in this example the only place that contains the information about playing is in this method itself.

#

so I cannot register it way ahead of time

#

certainly not in an onEnable

paper crest
#

1.18.1

misty current
#

is a skeleton skull

paper crest
#

java.lang.NoSuchMethodError: 'net.minecraft.nbt.NBTTagCompound net.minecraft.world.item.ItemStack.save(net.minecraft.nbt.NBTTagCompound)'

waxen plinth
#

You definitely could define that in the onEnable

misty current
#

you need to add damage

paper crest
#

no import issues

misty current
#

3 iirc

waxen plinth
#

The constraint method takes a lambda which returns a predicate, essentially

rigid drum
#

@waxen plinth certainly not

quaint mantle
rigid drum
#

that's why too far up the chain

#

you would end up dragging that information way out of scope

waxen plinth
#

You could return a predicate which checks that the given player is online and in a game

misty current
#

new ItemStack(Material.SKULL, 1, (short) 3)

#

was it short for dura

#

i forgor

rigid drum
#
val player = Adapter1<Channel, Mutated<*, out Channel>> { channels ->
    string(this).mapNotNull { start -> channels.values.filter { it.name.startsWith(start, ignoreCase = true) }() }
}

is ow new ones are defined.

young knoll
#

yes

rigid drum
#

the channel stuff is from my server it's effectively lower level player

quaint mantle
waxen plinth
#

Well in that sense there's nothing stopping you from just having a helper method that tests a condition

crisp arch
waxen plinth
#

Constraints are not meant to be that context-specific

golden turret
#

pls

rigid drum
#

@waxen plinth but why not? I don't lose anything making mine context specific.

waxen plinth
#

Less separation of metadata from functionality

#

The command file lays out the command, its subcommands and arguments and other pieces of data

rigid drum
#

Not really

waxen plinth
#

Do you mean you want to check if the player sending the command is in the same game as the player they're targeting or something?

rigid drum
#

Also commands are rarely not part of the hardcoded section of whatever you are writing.

misty current
rigid drum
#

@waxen plinth sure might be one case

waxen plinth
#

If you have a game manager or similar, it would definitely be possible to define a constraint which checks the game manager to make sure the players are in the same game

crisp arch
#

so for now, no

misty current
#

what are you using

#

oke

crisp arch
#

just mojang mappings

misty current
#

so you wanna make the npc sneak?

quaint mantle
# misty current re send code
    public void createHead(Location l, String Nick) {
        ItemStack skull = new ItemStack(Material.SKULL, 1, (short) 3);

        SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();

        skullMeta.setOwner(Nick);
        skull.setItemMeta(skullMeta);
        ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);

        as.setVisible(false);
        as.setCustomNameVisible(false);
        as.setCanPickupItems(false);
        as.setGravity(false);
        as.setSmall(true);
        as.setHelmet(skull);
        holograms.add(as);
    }```
rigid drum
#

so for me that would look like:

fun Toggled.Game(players: Adepts) {
  players.onEach { _, adept ->
    adept.handle("/whatever") {
      val target = player(players, "That player is not in game or online")
      action { /*whatever*/ }
    }
  }
}
crisp arch
#

yes, according to wiki, i just need to send (0, 0b2) to make the NPC sneak

crisp arch
#

but idk how to do that

rigid drum
#

@waxen plinth game manager like things I've moved far away from as well, since they normally break DIP

sacred ice
#

2 sec

waxen plinth
#

I see

crisp arch
#

i've spawned in the NPC and everything, i just need to send an extra ClientboundSetEntityDataPacket packet

misty current
#

and then you can send a packet to update it

rigid drum
#

@waxen plinth TBH I used to mostly agree with your way... because you need to deal with tab completion anyway

misty current
#

not sure if the sneaking state of a player is in metadata

sacred ice
#

EntityPlayer.setSneaking(boolean); ?

rigid drum
#

but I figured out how to handle tab complete functionally so now I don't see much of a reason for the extra complexity... Especially since I'm not a fan of like automatic /help registration and stuff. I think it's generally very bad.

misty current
#

yea just checked there is

waxen plinth
#

You don't like automatic help menu generation?

rigid drum
#

yeah quite poor IMO

waxen plinth
#

How would you do it?

misty current
waxen plinth
#

I find automatic help menu generation wonderful, it saves me a lot of work

rigid drum
#

I just don't, I mean if that's really something that's required then ok I build I a system that wraps handle

crisp arch
waxen plinth
#

It's boilerplate that can easily be abstracted away and standardized

#

So why not standardize?

rigid drum
#

But most of the time... you can just write a command that spits out a page of docs

crisp arch
#

ill look up mappings for EntityPlayer#setSneaking

waxen plinth
#

Having it be generated also makes it really easy to make it configurable

rigid drum
#

and for many commands you really don't need or want help

#

plus it has the added issue of displaying commands that are not for the person using /help

waxen plinth
#

It doesn't

rigid drum
#

and there is no way around that without breaking a lot of design principles

waxen plinth
#

Mine will only show them commands and subcommands they have permission to run

misty current
#

construct a PacketPlayOutEntityMetadata and put as params the entityid, the datawatcher and a boolean that i don't remember what it is

#

fuck

#

try to set it to true

waxen plinth
#

It will try to only show commands that are relevant to what they are trying to run

#

And it will display a specific error telling them what they did wrong with their last command if they did something wrong