#development

1 messages · Page 104 of 1

hard wigeon
#

wait you can extend multiple things?

#

in interfaces?

#

that's sick

#

I tried with BlockState alreadyt

lyric gyro
#

tried how?

#

code

hard wigeon
#
                        BlockState state = block.getState();
                        if (!(state instanceof ShulkerBox)) return;
#
ShulkerBox box = (ShulkerBox) state;
#

even added box.update();

lyric gyro
#

getting the block state, modifying it and updating it after will work

hard wigeon
#

here's all my code

lyric gyro
#

100%

hard wigeon
#
Block block = chunk.getBlock(t.getFirst(), t.getSecond(), t.getThird());
                        block.setType(Material.GREEN_SHULKER_BOX);
                        BlockState state = block.getState();
                        if (!(state instanceof ShulkerBox)) return;
                        ShulkerBox box = (ShulkerBox) state;
                        NamespacedKey key = new NamespacedKey(instance, "spectral");
                        box.getInventory().addItem(new ItemStack(Material.BOW) {{
                            ItemMeta meta = getItemMeta();
                            meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "true");
                            meta.displayName(MessageUtils.miniMessage("<gold>Spectral Bow"));
                            setItemMeta(meta);
                        }}, new ItemStack(Material.SPECTRAL_ARROW) {{
                            ItemMeta meta = getItemMeta();
                            meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "true");
                            meta.displayName(MessageUtils.miniMessage("<gold>Spectral Arrow"));
                            setItemMeta(meta);
                        }});
                        box.update();
#

and it is set to a green shulker successfully

lyric gyro
#

I try to open the launcher and it opens the ms store ._.

#

it doesn't even take me to the mc launcher page on the store

hard wigeon
#

fun

sudden sand
#

Does someone know how I can use the mojang-mappings for 1.17.1 on gradle ?

radiant zodiac
#

Is there any way to change plugin commands ? ... like i want to change the cmi plugins commands example .. : default commands /cmi warp /cmi tpa i want to change it to /warp /tpa just want to remove the /[cmi]

cinder forum
#

or something like that

radiant zodiac
#

so player no need to type the extra cmi thing

cinder forum
#

in plugins/CMI

radiant zodiac
#

okay

dense drift
astral rivet
#

do you remove the item from the armor stand first? shrug

#

Today at 11:19 AM
ah maybe you fixed it already

dense drift
#

it still has a small flicker but not that annoying

#

but no, I do not

astral rivet
#

what version is that

high edge
#

Despawn the armor stand quicker than the dia block get's spawned

broken elbow
#

yeah. but he's not despawning it at all.

high edge
#

Or remove the head, and once the block passes set it back

broken elbow
#

that's probably what he needs to do tho

dense drift
#

👌

dense drift
high edge
#

Removing and setting the head back will mostlikely fix it

pulsar ferry
broken elbow
#

but can you set them on fire without showing the fire animations? or will it not show because they're invisible?

pulsar ferry
#

Yeah using fire tick

#

That's what i do to make armor stand not go dark inside blocks

high edge
#

Or just make it invisible

broken elbow
#

it still goes dark if its invisible

#

the equipment I mean

high edge
#

What in the fuckery

dense drift
#

lmao

broken elbow
#

yeah

high edge
#

How does that make sense

broken elbow
#

I actually am not sure but what I think happens is that it sees the entity is in a dark area and just sets its light level to 0 or something. I never looked into this stuff

dense drift
#

do I have to run the method constantly or is it enough to do it once?

pulsar ferry
pulsar ferry
trail burrow
#

@rigid basin I can't seem to get on your Discord, I only need help in updating some code on hooking into your Quest plugin

broken elbow
#

so if my task requires me to have a natural number should I use an unsigned int or an int? My problem is that most of the stuff I work with doesnt support int so should I Just make a check for the int to be >= 0?

wintry grove
wooden loom
#

does anyone know a tutorial or documentation about how to create my own api and connect it with my plugin via maven?

lyric gyro
#
public static void test(ClanManager manager, Clan.Builder clanBuilder, ClanMember.Builder memberBuilder) {
        
        Clan clan = clanBuilder.tag("test").displayName(Component.text("Test")).build();
        ClanMember member = memberBuilder.uuid(UUID.randomUUID()).build();
        
        manager.addClan(clan);
        manager.editClan(clan, clanEditor -> {
            clanEditor.setDisplayName(Component.text("Test 2"))
                    .addMember(member)
                    .editMember(member, memberEditor -> memberEditor.setRole(member.getRole()));
        });
    }

Hey! What do you think about this design? All Objects are immutable, and to modify them, i use Editors, to avoid unecessary object creation. When editor session is done, updates got applied on database asynchronously in a transaction.

wooden loom
lyric gyro
#

Is there a good way to make a respawn system? For example i am trying to make a system where when someone dies and then after 15 seconds they respawn and i dont know how to get that to work.

#

1.17.1 btw

wooden loom
#

you can use an event for when you die and then in that event you do a teleport to a location and then just generate random locations or grab a location from your .yml file you make

fiery pollen
#

Just check in the entitydamageevent if the damage dealt is bigger then the persons health. If it is, put the player to spectator and tp them to a location wherever you want. Then just start a bukkit task and teleport them back after 15 seconds

lyric gyro
#

oh i see ok thanks

#

wait is there a way to do it within a datapack cuz that would be preferable

#

but if not then dw

cunning flume
#

I am trying to make a GUI but for some reason when you click an Item you can take it instead of it opening the submenu... https://cdn.skymc.cc/images/h1g3m.gif

/*
 * Made by SoNot
 */

package tech.sonot.blockshop;

import tech.sonot.blockshop.shops.ClayShop;
import tech.sonot.blockshop.shops.GlassShop;
import tech.sonot.blockshop.shops.WoodShop;
import tech.sonot.blockshop.shops.WoolShop;
import tech.sonot.blockshop.util.CC;
import tech.sonot.blockshop.util.ItemBuilder;
import tech.sonot.blockshop.util.menu.Button;
import tech.sonot.blockshop.util.menu.Menu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class BlockShopMenu extends Menu {

    @Override
    public String getTitle(Player player) {
        return "&b&lBlock Shop";
    }
    public int getSize() {
        return 27;
    }

    @Override
    public boolean isPlaceholder() {
        return true;
    }
    @Override
    public Map<Integer, Button> getButtons(Player player) {


        ItemStack woolshop = new ItemBuilder(Material.WOOL)
                .name(CC.translate("&b&lWool Shop"))
                .lore(CC.translate(Arrays.asList("&7Click to open the &7&lWoolShop&7!"))).build();


        HashMap<Integer, Button> buttons = new HashMap<>();

        buttons.put(10, new Button() {
            @Override
            public ItemStack getButtonItem(Player player) {
                return woolshop;
            }

            public void clicked(Player player, int slot, ClickType clickType, int hotbarSlot) {
                player.closeInventory();
                new WoolShop().openMenu(player);
            }

        });

        buttons.put(12, new Button() {
            @Override
            public ItemStack getButtonItem(Player player) {
                return glassshop;
            }

            public void clicked(Player player, int slot, ClickType clickType, int hotbarSlot) {
                player.closeInventory();
                new GlassShop().openMenu(player);
            }

        });

}
fiery pollen
cunning flume
#

Sorry..

fiery pollen
#

Are you acctualy canceling the event?

cunning flume
#

Not sure

#

lol

fiery pollen
#

Or even did you register the event in your main class

cunning flume
#

lol probs not

#

should probs think about doing that

fiery pollen
#

Yeah, happens to the most of us

hexed locust
#

Why would u not cancel the event?

#

Isn’t that what ur going for

forest jay
#

my InventoryClickEvent isnt being called when I click on orange dye. I am using 1.8.8, and this worked on 1.17.1, but when I switched it doesnt.

#

the event works for every other item

#

I think it has something to do with the fact that there isnt a actual item for dyes, you set the dye color with a int and ItemMeta#setDurability(int i)

smoky hound
#

have you tried just logging smth to console as the first thing that happens in the listener

hard wigeon
#

how do I get what level an advancement is?

forest jay
candid phoenix
#

anyone here uses maven?

warm steppe
#

no

#

gradle only

wheat carbon
candid phoenix
warm steppe
#

what errors?

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

candid phoenix
#
Dependency 'net.pl3x.purpur:purpur-api:1.17.1-R0.1-SNAPSHOT' not found
#

my pom.xml for the dependency looks like this:

#
    <repositories>
        <repository>
            <id>purpur</id>
            <url>https://repo.pl3x.net/</url>
        </repository>

    </repositories>
    <dependencies>
        <dependency>
            <groupId>net.pl3x.purpur</groupId>
            <artifactId>purpur-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
candid phoenix
# warm steppe ?paste

I sent them as a code block because I don't think its long enough to make a paste for it

cinder forum
#

wdym

#

bossbar?

#

armor stands maybe

#

you can disable armor stand hitbox

#

cant you debug it

#

on some event

#

entityhit or smth like that

#

interact

#

idk

quartz ledge
#

How can I send titles in 1.16? When I send the title packet por I use p.sendTitle It doesn't work

rancid bronze
#

For mysql what's better

teamid, teamname, leader, color, homeX ,homeY, homeZ, homeWorld```
or
```teams table:
teamid, teamname, leader, color

homes table:
teamid, homeX, homeY, homeZ, homeWorld```
#

So basically is it better to keep all the data in that one table and row or is it better to spread it out

pulsar ferry
#

I'd say second, but don't forget to add a homesid as well

rancid bronze
#

how come homesid @pulsar ferry?

pulsar ferry
#

A table should always have its own id

rancid bronze
#

teamid would be the id?

#

like the uuid

pulsar ferry
#

You could use the foreign key as the primary key but i'd say that's not scalable
If later on you want to allow multiple homes for example
I still recommend having a different id for primary key

rancid bronze
#

alrighty

#

@pulsar ferry So in the case of the teams

#

the team uuid would be primary key right?

#

or is that also not good

pulsar ferry
#

Yeah that'd be fine

rancid bronze
#

@pulsar ferry but in this case how do i update the home location

#

Since the primary key is an auto-increment int, there would be no duplicate I can update

pulsar ferry
#

You can still update it by the foreign key aka teamid

rancid bronze
#

How do I do that?

#

Ah I see the UNIQUE thing

pulsar ferry
#

Would be the same way, for example UPDATE teams SET homeX = 5 WHERE teamid = "uuid", the homesid would just be a background thing

rancid bronze
#

Ah okay so you meant homesid is a string/uuid and not auto increment?

pulsar ferry
#

No no, it is auto increment, you just don't need it to update

rancid bronze
#

Something isn't clicking for me

broken elbow
rancid bronze
#

This is my usual statement

INSERT INTO homes (teamid, x, y, z, world) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE x=VALUES(x), y=VALUES(y), z=VALUES(z), world=VALUES(world)```
#

So this is what I would do if I made teamid the primary key for homes

#

How would I do it differently if I did it the way you said @pulsar ferry

pulsar ferry
#

REPLACE INTO, if the teamid is marked as unique index REPLACE INTO homes (teamid, x, y, z, world) VALUES (?, ?, ?, ?, ?)

rancid bronze
#

Right but I'm doing insert into because I'm not sure if it's there or not

pulsar ferry
#

Replace into will insert if there is no value or replace if there is

rancid bronze
#

I still don't see the benefit of having the auto increment primary key

pulsar ferry
#

Mostly for future proof, like if you want to allow multiple homes, but i guess if you feel like that won't ever happen then sure i guess it'd be fine to have the teamid be the primary key

rancid bronze
#

right but what I meant is how does it allow for multiple homes?

broken elbow
#

that's you also have home ids

#

instead of having just the team ids for homes

rancid bronze
#

right but if its auto increment then it doesnt really help

broken elbow
#

and home ids are incremented values

rancid bronze
#

the home id would have to be a varchar

pulsar ferry
#

For example if you make both homeid and teamid primary keys, you can have 1, uuid, x, y, z and 2, uuid, z, y, z

rancid bronze
pulsar ferry
rancid bronze
#

Okay I see what you mean

#

but then uuid would have to be not unique correct?

pulsar ferry
#

Yeah, in this case it would be both primary keys, so you can have multiple of both but never the same
Which should still work well with replace into

rancid bronze
#

Right but then if I do it this way

#

then how do I limit homes?

#

Like lets say they have one home, they cant give it a name or anything

#

table is

#

homeid (auto increment), teamid (uuid), x, y, z

pulsar ferry
#

You'd limit it by checking for the count(teamid)

#

Well this would be my suggestion, if you feel like i am over complicating it for you, feel free to just use teamid as the primary key alone ;p

prisma briar
#

Is REPLACE INTO really does that? update if exist and insert if it's not exist.

#

All this time I need to query SELECT and check the result set.

pulsar ferry
#

Yeah

REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted.

prisma briar
#

Okay, no more

ResultSet resultSet = statement.executeQuery();
if(resultSet.next()){
  update();
} else {
  insert();
}
lyric gyro
pulsar ferry
#

I think it's a MySQL/Mariadb thing

#

I could be wrong though ;o

dense drift
#

if you search on google sql replace into the results are from mysql, so i assume it is specific to mysql

pulsar ferry
#

Yeah doesn't seem like sql and postgre has it

#

It's in sqlite though

dense drift
#

^

prisma briar
#

Will it exist on mysql jdbc?

#

Should be right

pulsar ferry
#

Yeah

prisma briar
#

pretty cool

vital jetty
#

Can the 1.17 and 1.17.1 javadocs be added to HelpChat's website please?

mental cypress
#

@wheat carbon ^^

lyric gyro
#

@wheat carbon ^^

wheat carbon
#

will do soon

mental cypress
#

Ty

lyric gyro
#

ty ty

void orchid
#

ty ty ty

dense drift
#

is been 30m already @wheat carbon

broken elbow
#

soon™️

#

corrected piggy's message

slate adder
#

heyo, i got a problem: i have spigot imported into my intellij project but when i try to import "JavaPlugin" it says that it "Cannot resolve symbol 'JavaPlugin'", so i cant import the library
anyone knows whats the problem there?

slate adder
#

nope, plain java

proud pebble
#

they give you the ability to compile your java plugin without requireing a server jar inside your plugin.

slate adder
#

yeah i know but its a plain java project i mean

#

not any build tools like this

proud pebble
#

just look at the guide on spigot about using maven or gradle, whichever you prefer cause without them your going to have a fun time and a base file size of 45mb or more.

#

or grab yourself the minecraft plugin developement plugin from the intellij plugin hub

ocean raptor
#

why does it takes a lot of time to set blocks to air using EditSession#setBlocks

#

even the fastmode is enabled

lyric gyro
#

"a lot of time"?

#

i mean given the amount of detail you've given I can only conclude that it doesn't

ocean raptor
#

like after ~20-30 secs

#
EditSession editSession = FaweAPI.getEditSessionBuilder(FaweAPI.getWorld(min.getWorld())).limitUnlimited().fastmode(true).build();
Region region = new CuboidRegion(new Vector(min.getX(), 1, min.getZ()), new Vector(max.getX(), 256, max.getZ()));
editSession.setBlocks(region, new BaseBlock(0));
``` 1.8 ![sad_pepe](https://cdn.discordapp.com/emojis/764016260626251808.webp?size=128 "sad_pepe")
lyric gyro
#

🤢 peepoLeaveFast

ocean raptor
#

forgot the flushQueue lol, fixed

sterile hinge
lyric gyro
#

🌚

forest jay
#

I am using 1.8.8, and my InventoryClickEvent is only triggering on the first menu. I have 2 menus, one has a item that when you click on it leads you to another, but the item on the next doesnt trigger the onInventoryClick event

uncut merlin
#

How do I put in DeluxeMenus the requirement that I need to be in a specific LuckPerm Parent to left / right click?

dusky harness
spice ore
#

How can I add full support for PAPI in my plugin? Like so that it supports any plugins placeholder, or is that not possible?

hushed badge
#

simply PlaceholderAPI.setPlaceholders(Player, String)

lyric gyro
#

Yeah I mean your plugin supports PAPI placeholders, but the admins/managers ought to download/install the expansions

spice ore
#

oh alright 😄

spice ore
#

yeah nvm, I saw that it does

hard wigeon
#

to remove hitboxes of an armorstand set it to be a "marker"

#

it has no hitbox in that case

#

and is also correctly centered iirc

#

_ _

is PDC data sent to the client in the form of an NBT tag?

#

I'd like to have custom textures based on data

#

and I'm wondering if PDC is okay for that

lyric gyro
#

the PDC lives in the NBT yes

hard wigeon
#

cool, ty

stuck rain
#

Whats the proper way of using nms for 1.18?

hard wigeon
#

I'm having a wierd issue, and I'm not sure the right way to solve it.
basically, to launch a firework rocket in a crossbow you need to have the rocket in your offhand.
but I (for cosmetic reasons), have a different slot that I keep the arrows that have yet to be shot in (code-wise, since arrows don't exist in my gamemode).
is it possible to let it shoot them without being in the off-hand

hoary scarab
#

I used scoreboards to mimic it before. Set the player name to your wanted text and the scoreboard below name to the players name.

dusky harness
hard wigeon
#

I'm gonna use model data, I was just looking for a way to get it straight from NBT tags that were already there

dusky harness
#

wdym?

hard wigeon
#

a way to not add a second layer of data, but just use the data already there

lyric gyro
#

does anyone have the website for the deobfuscated NMS for 1.17 please

#

That is very much illegal

#

it shows what is what class not the actualy code

#

Oh you mean the mappings, not the jar?

#

the mappings yes

neat pierBOT
formal locust
#

Umm guys im new to bukkit coding B:)

#

i was making a plugin for easy gamemodes

#

like gmc gms gma gmsp

#

but after i was done this error came out

#

please help me

tight junco
#

fingerguns first things first

#

lowercase your packages
change Main.java to SimpleGamemode.java

this doesn't improve code but improves my mental sanity

#

then uh did you register the Gamemode.java command

formal locust
#

yeaa

formal locust
tight junco
#

i assume your Gamemode.java class is a command

formal locust
#

it will print all commands which is available

#

./gm

tight junco
#

Are you registering the command using PluginCommand#setExecutor(CommandExecutor) and registering your command in plugin.yml

formal locust
tight junco
#

show your Gamemode.java class

formal locust
#

plugin.getCommand("gmc").setExecutor(this);

tight junco
#

huh, double check that plugin.yml

formal locust
#

wait i will send u plugin.yml

#

name: EasyGamemode
version: 1.0
author: Apex i7
main: me.Apexi7.EasyGamemodes.Main

commands:
gmc:
aliases: [gm c]
gms:
aliases: [gm s]
gmsp:
aliases: [gm sp]
gma:
aliases: [gm a]

tight junco
#

command no exist cheemssmile

formal locust
#

ineed to register it on pluginb.yml right

tight junco
#

yeah

formal locust
#

ook

#

tysm ❤️

tight junco
#

I always take the route of

PluginCommand command = this.getCommand("cmdName");
if (command != null) {
  command.setExecutor(this);
}
formal locust
#

what does if (command != null) { mean?

tight junco
#

that would check if the command exists in your plugin.yml first

formal locust
#

ooo

tight junco
#

to prevent an error

#

so if its not in your plugin.yml, it just wont try to make the command and throw an error

formal locust
#

imma try remaking it with ur route

#

@tight junco omg bro it started working
[12:10:23 INFO]: [EasyGamemode] Enabling EasyGamemode v1.0
[12:10:23 INFO]: ºf------------------------
[12:10:23 INFO]: ºaPlugin has been enabled
[12:10:23 INFO]: ºbAuthor - Apex i7
[12:10:23 INFO]: ºf------------------------
[12:10:23 INFO]: Server permissions file permissions.yml is empty, ignoring it
[12:10:23 INFO]: Done (5.462s)! For help, type "help" or "?"

#

again tysm

tight junco
formal locust
#

xD

cinder forum
#

can author contain space?

#

oh

cinder forum
formal locust
#

but without lowercase it works fine

cinder forum
#

ye it dont break stuff but its convention

fickle timber
#

does PlaceholderAPI.setPlaceholders() also translate & colour formatting, without needing to use ChatColor.translateAlternateColorCodes?

dense drift
#

Rn it spawn in an area of like 8 blocks long instead of 1.5

wooden loom
#

hey how can I give a player a glowing effect of a specific color when they join the server

tight junco
#

that uh

#

requires scoreboard teams iirc?

#

assign the player to a scoreboard team that has a specific colour

#

and give them the glowing effect

warm steppe
#

Yeah, it's scoreboard teams

wooden loom
#

ah okey thanks

steady pagoda
#

what has changed for 1.18 that i should know about?

steady pagoda
#

ok thanks was just wondering as i got a message saying to add 1.18 support for my plugin :/ but it should load if nothing has changed

tight junco
#

id just test out the 1.18 support

#

ya never know

#

you're only somewhat fucked if you're using NMS

formal crane
#

Why cant i get the Main from a other class?
This is the code in the other class:

    CorePacket.get();
}```

And this is what i use in the main:
```private static CorePacket instance;
    public static CorePacket get() {
        return instance;
    }```

It works in all other classes
fiery pollen
#

private CorePacket corePacket = CorePacket.get();?

tight junco
#

yeah you prob aren't assigning the corepacket instance

formal crane
#

i couldnt use tab so i assumed something was wrong but ty

formal crane
#

Why can't i use ReportMain.load2(); ?

    public static void load2() {
        CorePacket.get().getServer().getPluginManager().registerEvents(new AsyncChatEvent(), CorePacket.get());
    }
}```
wheat carbon
#

restart ij

#

no

#

nvm

#

if you want that code to run you need to put it in a method/function or an initializer

formal crane
#

isnt this a method?

wheat carbon
#

you're calling a method

formal crane
#

from a method right?

wheat carbon
#

no

#

you've just plonked it in a class

formal crane
#

oh i see

#

ty

formal crane
#

How would i register all the listeners in the folder listeners automaticly?

#

or isnt that a possiblity

icy shadow
#

it's possible but quite messy

formal crane
#

is it easy?

tight junco
#

relatively yes

#

i used to do it with reflections but then i got sick of them

cinder forum
formal crane
#

oh ty!

wooden loom
#

How can I give a player a specific spawner like a zombie spawner or a spider spawner

topaz gust
#

Why do you bold it?

ebon whale
#

Need answer now or bad

topaz gust
#

I assume due to you being here you want it from a coding perspective correct?

wooden loom
#

yes

topaz gust
#

First comment by outdatedVersion

#

Don’t believe it’s changed since 1.11 to my knowledge

formal crane
#

So i am trying to make something happend at a specific time but it just executes every 10 seconds instead of the specified time:

        Date date = null;
        try {
            date = dateFormatter .parse("16:53:00");
        } catch (ParseException e) {
            e.printStackTrace();
        }

        Timer timer = new Timer();

        int period = 10000;
        timer.schedule(new AutoRestartTask(), date, period );```
#

Anyone know how i would fix it?

topaz gust
#

So just change period to whatever you want the specific time to be

weak hamlet
#

Hi, i'm trying to update a plugin using NMS to support 1.18 the issue I'm having is that 1.17 and 1.18 use the same package names for NMS and the plugin uses abstraction with an interface class. Is there any way I can compile the plugin so it uses the 1.17 api in NMS_1_17_R1.java and 1.18 in NMS_1_17_R1.java possibly looking at using reflection.

I understand that this is possible with maven modules but I don't know that much about maven.

shell moon
#

Reflections? thinking

warm steppe
#

Whyyyy

rain wasp
broken elbow
#

becauze

warm steppe
#
                ItemBuilder.from(Material.AMETHYST_SHARD)
                    .name(Component.text(Util.color("test")))
                    .lore(listOf(
                        Component.text(Util.color("&71")),
                        Component.text(Util.color("&ftest")),
                        Component.text(Util.color("&7test1")),
                        Component.text(Util.color("&7223"))
                    ))
                    .glow()
                    .build()
broken elbow
#

what does the color method return? u sure it returns the string back?

#

because if its kotlin.Unit I assume its not returning anything

warm steppe
#

ughh, lemme check

#

uhmm, i don't know what did i do, but it fixed it

#

The color method didn't return the translated string

broken elbow
#

as expected

dusky harness
#

shouldn't it give an error saying that String was expected 🤔

#

unless Component.text accepts a Void parameter 🙃

broken elbow
#

ugh. dkim. look at the image. kotlin was doing Unit#toString

#

kotlin doesn't return void

#

it returns Unit

dusky harness
#

yes ik

#

but in kotlin things get "converted"

ex int to Int, i assume void = Void in kotlin's mind 🤔

#

and iirc string params dont automatically call #toString, idk

weak hamlet
formal crane
#

Does anyone know a good documentation/tutorial for sqlite?

broken elbow
#

@warm steppe can you humour me and show what your color method looked like before please?

warm steppe
#

our

#
    fun color(color: String) {
        ChatColor.translateAlternateColorCodes('&', color)
    }
broken elbow
#

also. is this method inside a companion object?

warm steppe
#

now it's

    fun color(color: String): String {
        return ChatColor.translateAlternateColorCodes('&', color)
    }
#

yes

broken elbow
#

why?

warm steppe
#

wait no

#

it's not

broken elbow
#

yeah. no idea what is going on there. lol xD

#

you using adventure right? for components

warm steppe
#

yeah, it do be like that sometimes

#

yes

icy shadow
#

epic kotlin fail

broken elbow
#

yeah. no idea what is going on there. lol. it errors for me. unless its just a "soft" warning and it actually would compile

#

which I did not test

#

to be honest

warm steppe
#

idk "No problems found" for me

marble nimbus
#

Hey so, I have a module based Discord Bot. I create URLClassLoaders for each module that is loaded. it works great no issues. But once I close that ClassLoader and recreate it, which kinda works fine. I get ClassNotFoundExceptions

#

the Main file works fine aswell as other classes, just some cause issues

#

anyone having an idea how to fix that

warm steppe
#

handle that exception where it is happening

#

ezpz

dusty frost
#

lol

graceful hedge
quartz ledge
#

Hey, its possible to change a no premium player's game profile to give him a skin? Because I'm making a skin system and I've only achieved changing premium players skins. Thanks!

vestal talon
lyric gyro
#

What JDK do you need for the source code for papi?

warm steppe
#

16

lyric gyro
#

thanks

#

Wat

wooden loom
#

can someone help me because I use an blockbreak event. And i want to make it so when I mine a spawner it drops the specific spawner I mined with the right egg in it.

karmic sierra
#

Is anyone here familiar with CMI's API?

warm steppe
wheat carbon
lyric gyro
#

thanks

warm steppe
#

thanks

icy shadow
#

thanks

dense drift
#

Does anybody know how I can display a different item (helmet to be more precise) than what they currently have, to a player?

#

I want to replace their helmet with a jack o lanter with a custom model, but withour affecting their actual helmet. With equipement packed I was able to display it to other players only.

night nacelle
#

Anyone know how to get corebot to run commands for their shop. I am using the crafting store gift card add on for corebot.

brittle thunder
#

What is core bot

ebon whale
hexed locust
#

Not sure if anybody knows

#

but is there a way to get a specific sound from a single sound

#

i.e i'm trying to get the laugh from ENTITY.PILLAGER.CELEBRATE

#

but sometimes there is a horn sound. I don't want the horn sound

tight junco
#

1.18 is killing me recently

high edge
#

L

tight junco
#

suck a dick frosty

high edge
#

hey hey that's not nice

tight junco
#

literally idk if im being stupid

#

but dependencies lowkey just stop working for no reason

hushed badge
#

building with java 17?

tight junco
#

yeah

#

but even then

#

I have some projects that are building with java 16

#

and it works

tight junco
#

CONCLUSION

#

gradle cached some scuffed shit

#

i have been banging my head against a table

#

intellij was getting invalid files Madge

hushed badge
#

conclusion: if in doubt invalidate cache?

tight junco
#

i did invalidate cache

#

several times

mental cypress
#

Delete .gradle

tight junco
#

i did do that too

mental cypress
#

Uninstall IJ

tight junco
#

no im not redoing it

mental cypress
#

Did you update to the latest 2021.3?

tight junco
#

i ended up deleting ./.m2/repository/org/spigot/ folder

#

i did

mental cypress
#

Do you have the mcdev plugin installed?

tight junco
#

yes doroClown

mental cypress
#

Delete it for the time being

#

There was a change between the RC and release for 2021.3 that's breaking some projects

#

Mcdev is working on an update to fix it

lyric gyro
#

./gradlew build --refresh-dependencies VibeCat

mental cypress
#

Change between RC and release for IntelliJ**

#

That broke mcdev

#

Like some projects not loading properly

tight junco
#

i'll try EmiCross

odd prawn
#

Hi, so im trying to check if the name of player's held item contains something in the string. But this doesn't work

String names = "Funko, Computer, Monitor, Store, Laptop, Vlag, Verkoopbord, Trophy, Troffee";
                    String meta = p.getItemInHand().getItemMeta().getDisplayName().toLowerCase();
                    if (names.toLowerCase().contains(meta)) {
//magic code
}
wooden loom
#

Your string names is not an array or a list so you are just storing one string inside it instead of 9 different strings

#

When you make it an array or list etc you can use contains

tight junco
#

^

marble nimbus
#

Anyone here experienced with Sponge Configurate? I am really struggling rn

icy thistle
#

how can I do

delay = 0;
if(delay >= 30){
//do a thing
}else{
delay += 1;
}```
#

to add a delay

#
package me.jaredy00.bedrockminer;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.event.player.PlayerInteractEvent;
var delay = 0;
public class PlayerInteract implements Listener{
    @EventHandler
    public void onPlayerInteractEvent(PlayerInteractEvent event){
        Block block = event.getClickedBlock();
        ItemStack tool = event.getItem();
        //System.out.println(tool.getItemMeta());

        // the item meta you want to find
        if(block != null && tool != null && tool.getItemMeta() != null && tool.getItemMeta().getLore() != null){
            if(block.getType() == Material.BEDROCK ){
                if(delay >= 30){
                    if(tool.getItemMeta().getLore().contains("Breaks Bedrock")){
                        block.setType(Material.AIR);
                    }else{
                        delay += 1;
                    }
                }
            }
        }
    }
}```
hard wigeon
#

are there any good libraries for caching placeholders, or should I just stuff things into a hashmap?

dusty frost
hard wigeon
#

providing

dusty frost
#

Oh yeah I just use the cache that I already have for user data to provide placeholders

#

Since SQL be slow af

hard wigeon
#

👍

#

I don't have a cache :p
I'm currently calculating everything at runtime

#

when called for

dusty frost
#

Oh jeez

#

I swapped to a new nickname plugin recently on my server, turned out it didn't use async SQL access, so every player join event it would pause the server for a good 2 seconds looking up their nickname for the join message lmao

hard wigeon
#

lmfao

dusty frost
hard wigeon
#

Man this is really sad.
I tried to implement some leaderboard placeholders in my (fairly complicated) event plugin, but at this point I'm just gonna give up ;-;
this is why Leaderheads and AJLeaderboards exist ig

#

so much value mapping

#

mine will kill performance

#

and me

dusty frost
#

Yeah this is why AJLeaderboards exists lmao

hard wigeon
#

is there a good way to measure how "optimized" a piece of code is? eg. if there are better ways to do it or not

dusty frost
#

Uh, run some profiling on a server and see what takes up the most time and try to optimize that?

#

And I guess get more experience and have others look at your code for differing perspectives

hard wigeon
#

now I need to get friends ;-;

#

you made this complicated

#

/s

icy thistle
#

how do I use bukkit runnables outside the main class

icy thistle
dusty frost
#

You use dependency injection to pass around your main class instance so you can start tasks

dusty frost
#

?di

neat pierBOT
pearl topaz
#

i have a map of strings to lists var indexMap: MutableMap<String, List<String>> = mutableMapOf() and im trying to add an item to the relevant list given the key

#

but i have a problem with nullability

thick kestrel
#

does anyone want to collab with me in a magic plugin?

#

profits are divided equally

pearl topaz
#

i've tried

if (indexMap.containsKey(w)) {
    indexMap[w].plus(listOf("test1"))
} else {
    indexMap[w] = listOf("test2")
}```
icy thistle
#

Main.java

public final class Main extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        getServer().getPluginManager().registerEvents(new PlayerInteract(), this);
    }
    BukkitTask join = new PlayerInteract().runTaskLater(plugin, 20)

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

PlayerInteract.java

public class PlayerInteract extends BukkitScheduler implements Listener{
    @EventHandler
    public void onPlayerInteractEvent(PlayerInteractEvent event){
        Block block = event.getClickedBlock();
        ItemStack tool = event.getItem();
        //System.out.println(tool.getItemMeta());

        // the item meta you want to find
        if(block != null && tool != null && tool.getItemMeta() != null && tool.getItemMeta().getLore() != null){
            if(block.getType() == Material.BEDROCK ){
                if(tool.getItemMeta().getLore().contains("Breaks Bedrock")){
                    @Override
                    public void run() {
                        block.setType(Material.AIR);
                    }
                }
            }
        }
    }
}
formal locust
#

Im new to bukkit coding

#

can you guys recommend me some videos

tight junco
#

no videos to recommend

#

learning how to code from one youtuber is like an awful way

#

?learn-java

#

nope

#

whatever the command is

steady ingot
#

?kotlin

tight junco
steady ingot
#

:/

tight junco
#

oh barry is dead

steady ingot
#

Oh yeah

#

Rip

tight junco
#

anyway yeah make sure you learn Java first fingerguns that's your priority

#

stick to basic conventions and good practice first catJAM

#

then look at spigot javadocs and look at examples from good developers

steady ingot
#

Just as importantly, keep your expectations reasonable. You will not be able to code a flawless anti cheat an your first plugin

pearl topaz
#

i have java.util.ArrayList and want to get java.util.Arrays$ArrayList, how do i do that?

#

in Kotlin

tight junco
#

me thinking i could make a skyblock plugin within 1~ month of knowing java & spigot KEKW

pearl topaz
#

i tried Arrays.asList(myList) but that creates a list within a list

wheat carbon
#

please show the whole code

#

somewhat of an xy problem

pearl topaz
#
fun addAB(): List<URL> {
  //val b = ...
  val linkList = mutableListOf<URL>()
  for (a in b):
      linkList += a
  }
  return linkList
}```
pearl topaz
wheat carbon
#

java.util.Arrays$ArrayList
what requires this type

pearl topaz
#

you can get a java.util.Arrays$ArrayList by doing Arrays.asList(linkList), but that creates a list of size 1 containing that list

pearl topaz
wheat carbon
#

redo the spec then

#

you shouldn't need to use that type

#

it's internal

pearl topaz
#

its not set by me

wheat carbon
#

it's likely unintentional

pearl topaz
#

i just need to solve this, if you know the solution i'd appreciate it

#

just gotta pass the test

#

been confused for about 4hrs

wheat carbon
#

is this for school?

pearl topaz
#

it's an optional assignment i got set but im trying to figure it out

#

so kinda

wheat carbon
#

and the assignment says in words

#

that you need Arrays$ArrayList

pearl topaz
wheat carbon
#

what are you passing the value into

pearl topaz
#

what do you mean? im just returning linkList from my function and the test gets the value from my function

#

it's just assertEquals(listOf(...), addAB())

#

i don't mind if there's a hacky solution, i can come back to it once i've spoken to them. i just need to pass this test to continue working on the rest

wheat carbon
#

that seems to be the correct way to do it

pearl topaz
#

i don't think i can change the tests

#

they want me to return an immutable fixed list which java.util.Arrays$ArrayList is, and java.util.ArrayList is not

wheat carbon
#

terrible test but just convert ur list into an array and pass it into arrays.aslist

pearl topaz
#

it's just a list containing a list

wheat carbon
#

convert list to array first

#

list.toarray

pearl topaz
#

can i just do var linkList = emptyArray<x>()?

wheat carbon
#

yes

#

idk kotlin so u tell me if thatworks

pearl topaz
#
Required:
List<URL>
Found:
(Mutable)List<Array<URL>!>
#
var linkList = emptyArray<URL>()
//...
val linkListImm = Arrays.asList(linkList)
return linkListImm
wheat carbon
#

looks right to me

#

what type is linkList

pearl topaz
#

it's returning a list inside a list

wheat carbon
#

needs to be a java array

pearl topaz
#

Array<URL>

wheat carbon
#

idk if kotlin converts that into a java array

pearl topaz
#

it says (kotlin)

wheat carbon
#

well you need a java array to use Arrays.asList

pearl topaz
#

i'm not really sure how

wheat carbon
#

neither

#

google it

pearl topaz
wheat carbon
#

I’m not going to do all the work for you…

pearl topaz
wheat carbon
#

google how to convert a kotlin array to a java array

pearl topaz
wheat carbon
#

no

#

that’s not the answer

#

first result on google has rhe answer

pearl topaz
#

val linkListImm = Arrays.asList(*linkList.toTypedArray())

#
java.lang.AssertionError: expected: java.util.Arrays$ArrayList<[https://en.wikipedia.org/wiki/HTML, https://www.w3schools.com/html/html_links.asp]> but was: java.util.Arrays$ArrayList<[https://en.wikipedia.org/wiki/HTML, https://www.w3schools.com/html/html_links.asp]>
#

fantastic

wheat carbon
#

yeah this isn’t something you should try to solve

#

it’s a fault of the assignment

#

are you meant to be using kotlin for it?

pearl topaz
#

yeah, i guess. thanks. sunk cost fallacy is making me keep going lol

#

i should stop i guess

pearl topaz
icy thistle
#
public class PlayerInteract implements Listener{
    int delay = 0;
    @EventHandler
    public void onPlayerInteractEvent(PlayerInteractEvent event){
        Block block = event.getClickedBlock();
        ItemStack tool = event.getItem();
        if(block != null && tool != null && tool.getItemMeta() != null && tool.getItemMeta().getLore() != null){
            if(block.getType() == Material.BEDROCK ){
                if(tool.getItemMeta().getLore().contains("Breaks Bedrock")){
                    if(delay >= 30){
                        delay = 0;
                        block.setType(Material.AIR);
                    }else{
                        delay += 1;
                    }
                    System.out.println(delay);
                }
            }
        }
    }
}

how do I make the int delay per player rather than per triggered event

formal locust
#

Guys This code is giving error? can you guys please help me im new to bukkit coding. in this class i was making a event which will play sound on join

dense drift
#

@pearl topaz call toList() on the array, should work

sharp hemlock
#

Does anyone know an alternative for UPDATE_SIGN in protocollib?

#

as its deprecated

sharp hemlock
dense drift
#

Sound#valueOf

sharp hemlock
#

ye

#

String#toUpperCase as well

topaz gust
#

I like the fact he did most of dependencyInjection correct but still decided to make it static

sharp hemlock
#

wait

sharp hemlock
#

i didn't even realise 😭

#

he doesn't even use the global field anywhere else in his class apart from his constructor to register the class

topaz gust
#

He does

sharp hemlock
#

yeah my bad

#

i'm too tired for this

topaz gust
#

He accessed the config

sharp hemlock
#

Yeah just realised

topaz gust
#

Personally I’d just store the enums for the sounds in memory

#

Config calls can be expensive

#

Also it’s only 2 Enums wouldn’t use much memory

#

Ohh and toUpperCase and Sound.valueOf spam would also be expensive

pearl topaz
icy shadow
#

😵‍💫

#

can you show the test case?

pearl topaz
pearl topaz
icy shadow
#

Should work fine then as long as the list content is equal

pearl topaz
thick kestrel
#

The offer is still here if anyone wants to collab with me on a magic plugin for 50/50 profit share

graceful hedge
#

Or iirc junit assertions got a method for that

idle haven
#

My papi reload isnt working

#

i loaded a expansion then typed /papi reload

#

it says no expansions loaded

#

i checked the files it has the expansion there

keen hinge
#
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            ItemStack is = p.getItemInHand();
            ItemMeta im = is.getItemMeta();
            List<String> lore = im.hasLore() ? im.getLore() : new ArrayList<String>();
            if (isSignedItem(lore,p)) {
                    for (String st : lore)
                    {
                        p.sendMessage(st);
                        p.sendMessage("Lore:" + lore);
                        if (st.startsWith("§6Firmato da: ")) {
                            p.sendMessage("Lore in if:" + lore);
                            p.sendMessage("St in if:" + st);
                            lore.remove(st); //E' questo l'errore ma non capisco :c
                            im.setLore(lore);
                            is.setItemMeta(im);
                        }
                    }
                }
            }
        return false;
    }

    public boolean isSignedItem(List<String> lore, Player p) {
        for (String st : lore) {
            if (st.startsWith("§6Firmato da: "))
                return true;
        }
            return false;
    }```
Hi, I have a problem with this code, basically lore.remove is null and I don't understand why
slow kiln
#

 @EventHandler
    public void onClick(PlayerInteractEvent e) {
        Player player = e.getPlayer();
        Location location = e.getClickedBlock().getLocation();

        if (e.getAction() == Action.RIGHT_CLICK_BLOCK && player.isSneaking())
            instance.getGenService().upgradeGen(player, location);
    }

Any idea why my PlayerInteract even is sending twice?

#

When clicking a block once it'll run the method twice

lyric gyro
#

it fires once for each hand

slow kiln
#

Is there a way to prevent this?

#

Ahh yes

#

there is an #getHand

#

    if (e.getAction() == Action.RIGHT_CLICK_BLOCK && player.isSneaking() && e.getHand() == EquipmentSlot.HAND) {

``` Should work, thank you for your help emily.
lyric gyro
slow kiln
#

Anyone know how to make a serializable version of a BukkitTask?
I'm trying to serialize a class containing a BukkitTask object into Byte64, however BukkitTask doesn't implement serializable, anyone have a resource or something that could solve this problem, thanks in advance.

dense drift
#

Why do you want to serialize a task?

#

Unless it is a custom class that extends BukkitRunnable and you want to store the data that wasn't processed yet, I don't see a reason to do so

icy thistle
#
public class PlayerInteract implements Listener{
    int delay = 0;
    @EventHandler
    public void onPlayerInteractEvent(PlayerInteractEvent event){
        Block block = event.getClickedBlock();
        ItemStack tool = event.getItem();
        if(block != null && tool != null && tool.getItemMeta() != null && tool.getItemMeta().getLore() != null){
            if(block.getType() == Material.BEDROCK ){
                if(tool.getItemMeta().getLore().contains("Breaks Bedrock")){
                    if(delay >= 30){
                        delay = 0;
                        block.setType(Material.AIR);
                    }else{
                        delay += 1;
                    }
                    System.out.println(delay);
                }
            }
        }
    }
}

how do I make the int delay per player rather than per triggered event

heavy wadi
#

Easiest way that I can think of is adding player and currentTimeMillis() of the last usage to some kinda static list. And in the event check whether currentTimeMillis() is greater than the number stored in the list + 1000. @icy thistle

tender thicket
#

Does anyone know how to set up a maven repo

dusky harness
tender thicket
#

Doesn't really matter, I'm trying to set up a maven at my website

#

So I can push artifacts from my dev group

#

I have a jenkins set up but idk how to use it

dusky harness
#

i know how to use maven central

#

¯_(ツ)_/¯

tender thicket
#

So long as I can push artifacts to it

#

And then import them via gradle

dusky harness
#

ye

#

so

dusky harness
# tender thicket And then import them via gradle

if you want to do maven central:
sign up: https://issues.sonatype.org/secure/Signup!default.jspa
apply: https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134

  • summary can just be group id, same with description (since it's required)
  • group id is, again, group id (ex: io.github.dkim19375 - com.github is replaced with io.github)
  • project url, a project that you'll upload to sonatype, im assuming its so that they know you're not botting or anything, you only have to include 1 project
  • scm url, tbh idk what it is but if you use github i just did https://github.com/username/project.git and they accepted
  • username is your jira username for sonatype
  • already synced to central: no
    then within a few minutes you'll get a reply which will ask you to verify ownership, for github they just make you create a repository with your ticket name (took 3 minutes for me)
    then you reply saying that you did it, then you'll have to publish an artifact, then tell them that you published it so that they can enable syncing (took 6 minutes for me)

lmk after this if you want to use maven central so that i can write more stuff

tender thicket
#

Thanks that's complicated but I'll try it

dusky harness
#

lol
(also i wrote this already for someone else too - so hopefully this will go smoothly)

#

DkimTutorial™️

#

also note that you only have to do this once

#

not for every project

#

but ig to verify that you're actually putting something there you'll have to specify a project

dusty frost
#

So there's like, 4 different Inventory move events that all do slightly different things if I recall correctly

#

So it's probably just another event is getting called instead

wintry grove
#

@tender thicket also actually, if you wanna setup it by hand and you have a vps and a domain you could try reposilite, it is really easy to use

lyric gyro
#

maven central is really easy to set up; it seems waaay more complicated than it actually is but it's pretty simple

steady ingot
#

Should Builder patterns have interfaces? (Java)

lyric gyro
#

i don't know if they should, but they can that's for sure

#

like e.g. you have an abstract builder interface for building different buildable types, each with its own builder impl yet all common components would lie in the abstract class / interface

#

it would also be kinda mandatory if you have an exclusively interfaces-only exposed API, and all the implementation is hidden in a non-exposed module or something like that

#

loose coupling good

steady ingot
#

Okay, thanks

wintry grove
#

explain dis to my brain:
paperweight requires a development bundle to be added to the 'paperweightDevelopmentBundle' configuration, as well as a repository to resolve it from in order to function. Use the paperweightDevBundle extension function to do this easily.

thorn cape
#

Hi, so I use Maven for my projects because I have not learned any other method and maven seems to be the easiest for me and my libraries. I was wondering if there was a way to remove this from the dependency section because it wont pass a build on jitpack because the dependency goes off of a local file. If it's not possible that fine I was just wondering 🙂

<dependency>
    <groupId>net.ricecode</groupId>
    <artifactId>string-similarity</artifactId>
    <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/string-similarity-1.0.1.jar</systemPath>
</dependency>
rugged bane
#

If it references a local file then sadly not, your best bet would be to put that code on GitHub and include it as a Jitpack dependency

#

If adding similarity is yours

sage thorn
#

how can i set my plugin to support different versions?

fossil heron
#

This line is supposted to only continue if the player is holding a netherite sword and is right clicking, but it fires when left clicking too and on any item

    ```

if (p.getInventory().getItemInMainHand().getType() == Material.NETHERITE_SWORD && e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {```
p is the event player

shell moon
#

Use ( )

fossil heron
#

where

shell moon
#

In the actions

fossil heron
#

ill try

shell moon
#

Also why are you doing that?

#

I mean, interact event?

#

Cant you simply use e.getItem()?

#

:wat:

fossil heron
#

damn yea i can use that, but still, the statement fires at the wrong times

tight junco
#

i would of seperated them into two different ifs

#

so put the item type check in its own if statement

#

ItemStack#getType != NETHERITE_SWORD

fossil heron
fossil heron
tight junco
#

i said != to hopefully make sure you dont start arrow code

#
if (ItemStack#getType != NETHERITE_SWORD)
  return

if (action != RIGHT_CLICK_BLOCK && action != RIGHT_CLICK_AIR)
  return
fossil heron
#

ooh okay

#

it worked ty!

sage thorn
#

hey guys does someone have experience with votifiers?

steady pagoda
#

is it possible to delete certain statistics from world/stats

#

im wanting to reset only the play_time statistic to 0 but its different for some mc versions

tight junco
#

very likely

#

in specific worlds? not entirely sure

#

but you could just cancel PlayerStatisticIncrementEvent if the statistic equals one very specific one

lethal plaza
#

How subcommands works in /help pluginame how can i set them because in plugin.yml i only have MighyClass Command

marble nimbus
#

Quick question, I need to split a String after 1027 characters BUT not split it just somewhere, I need to split it at the next whitespace so it doesn't cut off a word

#

anyone an Idea how to do it?

lethal plaza
#

This room is dead 😄

icy shadow
#

So true

dense drift
#

split by space and check if the current length + next word is more than 1027? @marble nimbus probably not the best way to do so

broken elbow
dense drift
#

easy

lethal plaza
#

Everybody here is so smart then there's me who don't understand a thing 😄

smoky hound
lethal plaza
# smoky hound im not 100% sure what you're asking but if you want subcommands you have to hand...

I want to make plugin and there commands to starth with mightyclass so for that i only register one command and that is mightyclass but the commands will me bile mightyclass create maybe mightyclass list or something but the second word i check when he executes the mightyclass command i will set cases for list and create so when i tipe mighty help it will show only this command but not my subcommans like create list reload etc

smoky hound
#

its not going to show them because the server has no idea what they are; your best bet is to write your own help menu so if they just run /mighty or whatever it will show the help menu with all the subcommands

lethal plaza
#

Thats the idea buy how can i execute another file or maybe text whats in it?

smoky hound
#
boolean onCommand() {
    if (args.length == 0) { /* show help */ }
    switch (args[0]) {
        case "create":
            // handle create
            break;
        case "othersubcommand":
            // handle the other subcommand
            break;
        // etc etc
    } 
}```
should be as simple as that; if you want to store the logic or strings for your help message or smth in another class,enum,etc. feel free
wintry grove
prisma briar
#

The player need to set the options for the server.

#

Prompt will gives player an option whether to accept/declined.
Enabled will automatically enable resource pack
Disabled will automatically disables resource pack

broken elbow
#

yeah. just so you understand why, when the player first accepts/declines it just sets it as accepted/declined forever for that server and the player has to change it back to either prompt or enabled

lethal plaza
#

Can you change default minecraft help? because i want to make help mightyclass the same message like mightyclass help

graceful juniper
#

Hello,
I'm currently dabbling with PathfinderGoals but I can't seem to get it to work? I'm assuming I'm not setting it right causing it to just not work at all. The entity I'm trying to edit is a ender dragon and trying to make it go from one point to another then to another again then loop through the points. (1.16.5)

Codes a bit messy but here we are:
https://paste.helpch.at/rumohegewe.java <-- Strong Dragon Class
https://paste.helpch.at/awegajocum.java <-- PathfinderGoalFlyToLocation Class

None of the Bukkit.broadcastMessage() are showing up.
Assuming off what I read on the spigot forums, the sequence of the functions go like: a>c>e>b>[e>b...]>d but as this is my first time doing this, not 100% sure

lethal plaza
#

So when i write command help mightyclass help it will show me the same thing when i whrite mightyclass help

wintry grove
wintry grove
graceful juniper
#

no idea if the commandmap option works or not never tried

lethal plaza
graceful juniper
#

np

dense drift
#

you need var

wintry grove
#

finally someone with light lol

dense drift
#
        if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
            options.release.set(targetJavaVersion)

        }```
This doesn't really makes sense, because if you target version 8 but current java version is compatible with 10, the release will be set to 8
wintry grove
#

Server Plugin\build.gradle.kts:50:9: Val cannot be reassigned PES_Rage

dense drift
#

that still says val

wintry grove
dense drift
#

it points to line 50

#
processResources {
  eachFile { expand version: version }
}```
This is what I use on groovy
wintry grove
#

this is kotlin DSL

dense drift
#

I know

#

eachFile { expand("version" to version) } would probably work

wintry grove
#

I just

#

dont get it

#

I was told to move to kotlin for mojang mappings but now this shit appears

#

I only want to code some weird mc stuff

dusky harness
#

ye

#

its a property

#

instead of just a field

wintry grove
pulsar ferry
#
processResources {
    val props = mapOf("version" to project.version)
    inputs.properties.putAll(props)
    filteringCharset = "UTF-8"
    filesMatching("plugin.yml") {
        expand(props)
    }
}
dusky harness
#

or ```kt
tasks.processResources {
outputs.upToDateWhen { false }
expand("pluginVersion" to project.version)
}

pulsar ferry
#

Kts has compile time errors, it tells you what to do

thick kestrel
#

why does args.length == 3 not work in onTabComplete

#
            arglist1.clear();
            arglist1.add("help");
            arglist1.add("bind");
            arglist1.add("item");
            return arglist1;
        }
        if (args[0].equals("item") && args.length == 2) {
            arglist1.clear();
            arglist1.add("spell");
            return arglist1;
        }
        if (args[0].equals("spell") && args.length == 3) {
            arglist1.clear();
            arglist1.add("bind");
            return arglist1;
        }```
#

the other ones work find its just adding bind that doesnt work

wintry grove
#

lel

bold ridge
#

Anyone have any idea howw to get the last numbers of these objects?

thick kestrel
#

maybe startswith

#

or equals

#

then modify the string to not have it

dusky harness
#

i think

thick kestrel
#

could someone help me with why my Tab complete is not working

#

it looks fine to me

wintry grove
#

dam

#

=

sly impBOT
#

@wintry grove, Help menu!

wintry grove
#

=help

sly impBOT
#

@wintry grove, Help menu!

neat pierBOT
#
Help Menu:

Various Commands for Barry.

󠀠󠀠󠀠/Help General

• General Bot/Guild Commands

/Help Misc

• Miscellaneous Commands

/Help Level

• XP and Level Commands

/Chatreaction Help

• ChatReaction Help

#
Help Menu:

Commands for Barry.

Miscellaneous Commands:

/paste <message> - Paste your message to paste.helpch.at
/ver <plugin/list> - Which versions of various plugins work on 1.8 - 1.13
/status <service> - Check various services to see if they're online
=faq <key/list> - Retrive a faq answer
/skin <username> - View a minecraft player skin
/head <username> - View a minecraft player head
/yaml <paste link> - YAML Parser for paste links
/fools <@user> - April Fools Stats
/links <list/plugin/service> - Get useful links and information on a plugin or service
/banner [Gradient ID] [IMG URL] <text> - Generate plugin page Banners
/plugin <Plugin Name/ID> - Search Spigot for a plugin
/buyercheck <spigot username> - Check if someone bought clip's plugins

wintry grove
#

nope

#

nvm

#

just drop ur question and err

#

also sorry for help embed flood lol

dusky harness
neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

dusky harness
#

:))

wintry grove
#

FUCK

neat pierBOT
#

There is no time to wait! Ask your question @dusky harness!

wintry grove
# dusky harness try using this

There was a failure while executing work items A failure occurred while executing io.papermc.paperweight.tasks.GenerateMappings$GenerateMappingsAction Unable to resolve class data binding for 'java/lang/Record' which is listed as the super class for 'zc$a' PES_Rage

#

I have been with this for a day now

#

I really want to end it

lyric gyro
#

what are you even trying to do lol

wintry grove
#

kekw

icy shadow
#

:nogradle:

steady ingot
#

Use cmake for jvm fingerguns

slow kiln
#

Hi, so I'm working with item-stacks with amounts greater than 64, how would I go about making it so that the item doesn't get removed when I've only got enough room in my inventory for half of the items.

wintry grove
thick kestrel
#

someone help....

wintry grove
#

damn

#

?help

neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

wintry grove
#

that

thick kestrel
#

ask suitable questions I am

wintry grove
#

give details

#

can you send your TabCompleter Class?

#

in

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

thick kestrel
#

its not returning

wintry grove
#

and what happens

#

send ur tabcompleter class then

thick kestrel
wintry grove
thick kestrel
#

I can do that but its clear that the third if is not activating

wintry grove
thick kestrel
#

does this work for sending to console? Bukkit.getConsoleSender().sendMessage("activated");

thick kestrel
#

nope it just shows my name after spell

#

on each if ok

#

I will show

wintry grove
#

oh

#

weird

thick kestrel
wintry grove
#

on third if

thick kestrel
#

ok it worked but why is it like that if all args = 0 in the space

wintry grove
thick kestrel
#

in the onTabComplete each new arg is assigned to 0

#

or at least thats what I was told so many times

wintry grove
#

¯_(ツ)_/¯

#

arrays will always work as how they worked

thick kestrel
#

ok

#

but if it were that way this should be the 2nd item in the array

#

unless /magictools doesnt count as an arg

#

so it must be that

wintry grove
#

/command arg0 arg1 arg2 arg3 and so on

thick kestrel
#

ok

#

sorry for the confusion

#

and thanks for the help

quick rampart
#

anyone knows how to detect if player was pushed by some entity?

thick kestrel
#

ugh arguments are bugged as f bro

wooden loom
thick kestrel
#

like If I use the same argument spot or another onTabCommand just because another if statement uses that spot it wont let me

#

so Im taking out length to see if that works

#

java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2

#

its on index 0

tight junco
#

check arg size

thick kestrel
#

and I used index 0 for the same placement of another tab command

#

can I even do -2 index

#

its always indexing to 2

#

Index 2 out of bounds for length 2

#

I set it to -2

#

even if I take out args length it still shows for length 2

#

I cant change the index at all wtf

#

so bugged

#

fml

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

thick kestrel
#

// Extends Profile is bugged

#

and anything past that

#

I tried taking out clear

#

I tried taking out length but that messes it up

#

I tried indexing to a negative number to stop to index of 2 always being there

#

It is static and stuck at Index 2 and Length 2

#

for anything past // Profile

#

I dont get it and find this function is broken

#

if anyone knows of another way to code this please let me know because this is not working

#

I just about had it with this args

#

been messing around for days on the same thing

#

please if anyone knows of a tab completion api send a link

#

the spigot one is broken

#

or Im not coding it in a super professional manor

slow kiln
#

    @EventHandler
    public void onPickUp(EntityPickupItemEvent e) {
        if(e.getEntity() instanceof Player player) {
            ItemStack pickUpItem = e.getItem().getItemStack();
            Bukkit.broadcastMessage("Attempting to pickup " + pickUpItem.getAmount());
            HashMap<Integer, ItemStack> remainder = player.getInventory().addItem(pickUpItem);
            if (!remainder.isEmpty()) {
                pickUpItem = remainder.get(0);
                e.getItem().setItemStack(pickUpItem);
                Bukkit.broadcastMessage(pickUpItem.getAmount() + " is the amount left.");
            } else {
                pickUpItem.setAmount(0);
                e.getItem().setItemStack(pickUpItem);
            }
            e.setCancelled(true);
        }
    }

Anyone know why this gives me two items instead of one when only one item is on the ground?

wintry grove
wintry grove
#

so I have decided to give up on the goddamn mojang mappings for a while and decided to go, but now this throws:

Script compilation error:

  Line 45:         dependsOn(reobfJar)
                             ^ Unresolved reference: reobfJar

build.gradle.kts: https://paste.helpch.at/vonowegolu.cs

shell moon
#

Best way to check if item has been modified?
I mean if it has nbt tags (like custom ones), if metadata has displayname, lore, enchantments, custom model data, if has custom effects (firework), colored (leather armor), etc

#

without checking one by one, would creating a new item of the same material and comparing itemmeta with equals work?

#

or maybe directly using isSimilar comparing the item with a new ItemStack of the same material?

quick rampart
#

How can I send actionbar message with animation, like
&8Hi
&6Hi
runtasklater?

shell moon
#

i guess, probably async one can be used too

dense drift
#

hasItemMeta should also check for nbt and such

quick rampart
shell moon
lyric gyro
#

import de.zerakles.clanapi.ClanAPI;
import de.zerakles.main.Clan;
import de.zerakles.utils.Data;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;


public class RaidTeleportListener implements Listener {

    private Data getData(){
        return Clan.getClan().data;
    }

    private  Clan getClan(){
        return Clan.getClan();
    }

    private ClanAPI getClanAPI(){
        return getClan().getClanAPI();
    }

    String ShopName = "§c§lGuardian Of The Sea Messenger";

    @EventHandler
    public void onEntityInteract(PlayerInteractEntityEvent event) {
        Bukkit.getServer().broadcastMessage(event.getRightClicked().getCustomName());
        if(event.getRightClicked().getCustomName().contains(ShopName)) {
            Bukkit.getServer().broadcastMessage("Test 1");
            Player player = event.getPlayer();
            Bukkit.getServer().broadcastMessage("Test 2");

            event.setCancelled(true);
            Bukkit.getServer().broadcastMessage("Test 3");

            if (player.getItemInHand().getType() == Material.IRON_INGOT)
                player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger" + ChatColor.YELLOW + "You have summoned the Guardian Of The Sea" + ChatColor.GRAY + "Be wise on the deciisons you make further on");
            else {
                player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger" + ChatColor.YELLOW + "You don't have the right materials to summon the Guardian of The Sea");
            }
        }
    }
}


#

Why wont this run even atleast public void onEntityInteract(PlayerInteractEntityEvent event) {

#

Bukkit.getServer().broadcastMessage(event.getRightClicked().getCustomName());
bc that wont even go through

lethal plaza
#

In plugin.yml whats the purpose for usage?

tight junco
#

for the default /help command

lethal plaza
#

i have usage: "Exapmle: /mightyclass help" but it wont show that example

lyric gyro
#

Any idea for mine

hushed badge
lyric gyro
#

Yes

lyric gyro
#

PluginManager pm = Bukkit.getPluginManager();

#
        PluginManager pm = Bukkit.getPluginManager();
        pm.registerEvents(new InventoryMasterListener(), getClan());
        pm.registerEvents(new RaidTeleportListener(), getClan());
        pm.registerEvents(new JoinEvent(), getClan());
        pm.registerEvents(new BreakListener(), getClan());
        pm.registerEvents(new ChatListener(), getClan());
        pm.registerEvents(new DamageHandler(), getClan());
        pm.registerEvents(new MovementListener(), getClan());
        pm.registerEvents(new VillagerListener(), getClan());
        pm.registerEvents(new BankShopListener(), getClan());
        pm.registerEvents(new SupplieShopListener(), getClan());
        pm.registerEvents(new OrganicShopListener(), getClan());
        pm.registerEvents(new MiningShopListener(), getClan());
        pm.registerEvents(new PvpGearShopListener(), getClan());
        pm.registerEvents(new TravelLIstener(), getClan());
    }
}```
cinder forum
#

shouldnt be this instead of getClan()?

dense drift
#

Probably some static method

lyric gyro
astral mauve
#

Are you calling that method on your onEnable?

crimson portal
#

can someone help me with changing a players name?
i used Player#setCustomName but that doesn't work

shell moon
#

he probably doesn't call loadListeners() method

crimson portal
#

i got problems at changing player name with this
p.displayName(Component.text("test" + p.getName()));
and this
p.setDisplayName("test" + p.getName());
and this
p.setCustomName("test" + p.getName());
what can i do?

lethal plaza
#

What can be the issue when usage wont work for my command?

thick kestrel
#

I hate how broken tab complete is

#

the indexing is broken af

#

like why and how do you index an item at -1

icy shadow
#

what

lyric gyro
#

How do I see if a player is at a x y z

#

a specific one

dense galleon
#

How do I update my gradle version?

#

Online I saw I gotta do ./gradlew wrapper --gradle-version 7.3 but that does nothing in my project

pulsar ferry
#

I normally just manually change it in the gradle-wrapper.properties

dense galleon
#

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip is this the latest version

dusky harness
#

make sure IJ uses gradle-wrapper.properties

dense galleon
#

Yep

#

how do I check if it does

dusky harness
#

alt + s

#

build -> build tools -> gradle

dense galleon
#

Alt s brings up the VCS window

dusky harness
#

o

#

uhhh

#

File -> Settings

#

then Use Gradle from:

#

and make sure it says 'gradle-wrapper.properties' file

dense galleon
#

Yeah

#

Nothing changed though

#

I think?

#

How do I check my gradle version?

dusky harness
#

was it that or something else already?

dense galleon
#

I mean I am having issues with fabric/geckolib but they told me the issue is the gradle version so I am asking here since a lot of people know gradle here already

dusky harness
#

click OK and double click control and type gradlew to see gradle version

#

and if you haven't already press this

dense galleon
#

Do I need to fix any errors that are happening in my IDE before I do that

#

Cause it keeps crying about stuff related to Geckolib

dusky harness
#

i dont think so

dense galleon
#

Whenever I try running ANY command

dusky harness
#

gradle command?

dense galleon
#

gradlew

#

cause I am getting these errors

#

But apparently to fix them I need to update my gradle version

#

I cannot check my gradle version if I dont fix them though

#

Issue wasn't related to gradle oh well

#
Unsupported Java. 
Your build is currently configured to use Java 17 and Gradle 7.1.1.

Possible solution:
 - Use Java 16 as Gradle JVM: Open Gradle settings 
 - Open Gradle wrapper settings, change `distributionUrl` property to use compatible Gradle version and reload the project

``` anyone know though what this gradle error means
#

I swear I have changed the version in my gradle-wrapper.properties

dusky harness
#

i got that error not while ago

#

and i just changed it in gradle-wrapper.properties

#

which fixed it

pulsar ferry
#

Go to Settings -> Build, Execution, ... -> Build Tools -> Gradle and change the gradle JVM to 17

dusky harness
#

🤔 so i can't send packets async

#

interesting

lyric gyro
thick kestrel
#

I know I dont

#

its just the most stupiest api

lyric gyro
#

What?

thick kestrel
#

onTabComplete

lyric gyro
#

I mean it's as simple as it gets, each separate argument is an element in the array

#

/command well hello there has args as ["well", "hello", "there"]

thick kestrel
#

if you think its simple then make one that has multiple line based args

lyric gyro
#

You can't send multiple lines

thick kestrel
#

like

bind
profile - myspells
item - spell - bind - spellname - slotnumber
modifiers - spell - spellnames
modifiers - set - slotnumber - modifiername - modifier amount ```
#

you will understand how useless the api is at this

lyric gyro
#

I don't even understand what that is

thick kestrel
#

it cant index for shit

lyric gyro
#

You're just ranting for nothing at this point

#

What even is that?

thick kestrel
#

thats the input for ontabcomplete

#

it goes in a line

#

bind is one command

#

profile is another starting command

lyric gyro
#

Oh so they different possible combinations

thick kestrel
#

then myspells comes after

#

yes

lyric gyro
#

And what's the issue…?

thick kestrel
#

it wont index properly it saves the old indexs and makes it impossable to index at the same spot

lyric gyro
#

???

#

You're definitely doing something wrong

thick kestrel
#

it actually adds onto the index you will try to use next that is in the same spot then make it come out with index/length errors

lyric gyro
#

Because onTabComplete doesn't save/cache anything internally unless you do of course

#

What??

thick kestrel
#

here take a look at my code

#

if you think its fixable thank you...

#

I am actually trying to get another command api because this one is broken but if you can find a fix I will go with it

#

the error is easily reproduceable

lyric gyro
#

it is most definitely not broken

#

let me look at that

thick kestrel
#

ok thanks

lyric gyro
#

I do agree it is far from ideal and annoying to use on medium command structures, that's where command frameworks come into play, but it isn't broken

#


    @EventHandler(priority= EventPriority.HIGH)
    public void onPlayerUse(PlayerInteractEvent event){
        Player player = event.getPlayer();
        Location playerloco = player.getLocation();

        if(event.getAction().equals(Action.RIGHT_CLICK_AIR)){
            Bukkit.getServer().broadcastMessage("Test 1");
            final org.bukkit.Location locationraid = new Location(Bukkit.getWorld("world"), 102, 67, -25);
            Bukkit.getServer().broadcastMessage("Test 2");

            if (playerloco.equals(locationraid)) {
                Bukkit.getServer().broadcastMessage("Test 3");

                if(player.getItemInHand().getType() == Material.IRON_INGOT){
                    Bukkit.getServer().broadcastMessage("Test 4");

                    player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger> " + ChatColor.YELLOW + "You have summoned the Guardian Of The Sea \n" + ChatColor.GRAY + "Be wise on the decisions you make further on.");
                    Bukkit.getServer().broadcastMessage("Test 5");

                final org.bukkit.Location location = new Location(Bukkit.getWorld("world"), 10, 10, 10);
                player.teleport(location);

            }
               else if (!playerloco.equals(locationraid))
                   event.setCancelled(true);
            else {
                player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger> " + ChatColor.YELLOW + "You don't have the right materials to summon the Guardian of The Sea");
            }
        }
    }
}}
#

Why does that not work

#

it stops at if (playerloco.equals(locationraid)) {

#

But I ran a broadcast it says im on the exact coords